
(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);
var app = (function () {
    'use strict';

    function noop$2() { }
    function assign$1(tar, src) {
        // @ts-ignore
        for (const k in src)
            tar[k] = src[k];
        return tar;
    }
    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 validate_store(store, name) {
        if (store != null && typeof store.subscribe !== 'function') {
            throw new Error(`'${name}' is not a store with a 'subscribe' method`);
        }
    }
    function subscribe(store, ...callbacks) {
        if (store == null) {
            return noop$2;
        }
        const unsub = store.subscribe(...callbacks);
        return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
    }
    function component_subscribe(component, store, callback) {
        component.$$.on_destroy.push(subscribe(store, callback));
    }
    function create_slot(definition, ctx, $$scope, fn) {
        if (definition) {
            const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
            return definition[0](slot_ctx);
        }
    }
    function get_slot_context(definition, ctx, $$scope, fn) {
        return definition[1] && fn
            ? assign$1($$scope.ctx.slice(), definition[1](fn(ctx)))
            : $$scope.ctx;
    }
    function get_slot_changes(definition, $$scope, dirty, fn) {
        if (definition[2] && fn) {
            const lets = definition[2](fn(dirty));
            if ($$scope.dirty === undefined) {
                return lets;
            }
            if (typeof lets === 'object') {
                const merged = [];
                const len = Math.max($$scope.dirty.length, lets.length);
                for (let i = 0; i < len; i += 1) {
                    merged[i] = $$scope.dirty[i] | lets[i];
                }
                return merged;
            }
            return $$scope.dirty | lets;
        }
        return $$scope.dirty;
    }
    function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
        if (slot_changes) {
            const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
            slot.p(slot_context, slot_changes);
        }
    }
    function get_all_dirty_from_scope($$scope) {
        if ($$scope.ctx.length > 32) {
            const dirty = [];
            const length = $$scope.ctx.length / 32;
            for (let i = 0; i < length; i++) {
                dirty[i] = -1;
            }
            return dirty;
        }
        return -1;
    }
    function exclude_internal_props(props) {
        const result = {};
        for (const k in props)
            if (k[0] !== '$')
                result[k] = props[k];
        return result;
    }
    function compute_rest_props(props, keys) {
        const rest = {};
        keys = new Set(keys);
        for (const k in props)
            if (!keys.has(k) && k[0] !== '$')
                rest[k] = props[k];
        return rest;
    }
    function compute_slots(slots) {
        const result = {};
        for (const key in slots) {
            result[key] = true;
        }
        return result;
    }
    function set_store_value(store, ret, value) {
        store.set(value);
        return ret;
    }
    function action_destroyer(action_result) {
        return action_result && is_function(action_result.destroy) ? action_result.destroy : noop$2;
    }
    function append$1(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$2() {
        return text('');
    }
    function listen(node, event, handler, options) {
        node.addEventListener(event, handler, options);
        return () => node.removeEventListener(event, handler, options);
    }
    function prevent_default(fn) {
        return function (event) {
            event.preventDefault();
            // @ts-ignore
            return fn.call(this, event);
        };
    }
    function stop_propagation(fn) {
        return function (event) {
            event.stopPropagation();
            // @ts-ignore
            return fn.call(this, event);
        };
    }
    function attr(node, attribute, value) {
        if (value == null)
            node.removeAttribute(attribute);
        else if (node.getAttribute(attribute) !== value)
            node.setAttribute(attribute, value);
    }
    function set_attributes(node, attributes) {
        // @ts-ignore
        const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
        for (const key in attributes) {
            if (attributes[key] == null) {
                node.removeAttribute(key);
            }
            else if (key === 'style') {
                node.style.cssText = attributes[key];
            }
            else if (key === '__value') {
                node.value = node[key] = attributes[key];
            }
            else if (descriptors[key] && descriptors[key].set) {
                node[key] = attributes[key];
            }
            else {
                attr(node, key, attributes[key]);
            }
        }
    }
    function set_svg_attributes(node, attributes) {
        for (const key in attributes) {
            attr(node, key, attributes[key]);
        }
    }
    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' : '');
        }
    }
    // unfortunately this can't be a constant as that wouldn't be tree-shakeable
    // so we cache the result instead
    let crossorigin;
    function is_crossorigin() {
        if (crossorigin === undefined) {
            crossorigin = false;
            try {
                if (typeof window !== 'undefined' && window.parent) {
                    void window.parent.document;
                }
            }
            catch (error) {
                crossorigin = true;
            }
        }
        return crossorigin;
    }
    function add_resize_listener(node, fn) {
        const computed_style = getComputedStyle(node);
        if (computed_style.position === 'static') {
            node.style.position = 'relative';
        }
        const iframe = element('iframe');
        iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
            'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');
        iframe.setAttribute('aria-hidden', 'true');
        iframe.tabIndex = -1;
        const crossorigin = is_crossorigin();
        let unsubscribe;
        if (crossorigin) {
            iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>";
            unsubscribe = listen(window, 'message', (event) => {
                if (event.source === iframe.contentWindow)
                    fn();
            });
        }
        else {
            iframe.src = 'about:blank';
            iframe.onload = () => {
                unsubscribe = listen(iframe.contentWindow, 'resize', fn);
            };
        }
        append$1(node, iframe);
        return () => {
            if (crossorigin) {
                unsubscribe();
            }
            else if (unsubscribe && iframe.contentWindow) {
                unsubscribe();
            }
            detach(iframe);
        };
    }
    function toggle_class(element, name, toggle) {
        element.classList[toggle ? 'add' : 'remove'](name);
    }
    function custom_event(type, detail, bubbles = false) {
        const e = document.createEvent('CustomEvent');
        e.initCustomEvent(type, bubbles, false, detail);
        return e;
    }
    class HtmlTag {
        constructor() {
            this.e = this.n = null;
        }
        c(html) {
            this.h(html);
        }
        m(html, target, anchor = null) {
            if (!this.e) {
                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);
        }
    }

    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;
    }
    function onMount(fn) {
        get_current_component().$$.on_mount.push(fn);
    }
    function afterUpdate(fn) {
        get_current_component().$$.after_update.push(fn);
    }
    function onDestroy(fn) {
        get_current_component().$$.on_destroy.push(fn);
    }
    function createEventDispatcher() {
        const component = get_current_component();
        return (type, detail) => {
            const callbacks = component.$$.callbacks[type];
            if (callbacks) {
                // TODO are there situations where events could be dispatched
                // in a server (non-DOM) environment?
                const event = custom_event(type, detail);
                callbacks.slice().forEach(fn => {
                    fn.call(component, event);
                });
            }
        };
    }
    function setContext(key, context) {
        get_current_component().$$.context.set(key, context);
    }
    function getContext(key) {
        return get_current_component().$$.context.get(key);
    }
    // TODO figure out if we still want to support
    // shorthand events, or if we want to implement
    // a real bubbling mechanism
    function bubble(component, event) {
        const callbacks = component.$$.callbacks[event.type];
        if (callbacks) {
            // @ts-ignore
            callbacks.slice().forEach(fn => fn.call(this, event));
        }
    }

    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 tick() {
        schedule_update();
        return resolved_promise;
    }
    function add_render_callback(fn) {
        render_callbacks.push(fn);
    }
    function add_flush_callback(fn) {
        flush_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$1(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$1($$) {
        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();
    let outros;
    function group_outros() {
        outros = {
            r: 0,
            c: [],
            p: outros // parent group
        };
    }
    function check_outros() {
        if (!outros.r) {
            run_all(outros.c);
        }
        outros = outros.p;
    }
    function transition_in(block, local) {
        if (block && block.i) {
            outroing.delete(block);
            block.i(local);
        }
    }
    function transition_out(block, local, detach, callback) {
        if (block && block.o) {
            if (outroing.has(block))
                return;
            outroing.add(block);
            outros.c.push(() => {
                outroing.delete(block);
                if (callback) {
                    if (detach)
                        block.d(1);
                    callback();
                }
            });
            block.o(local);
        }
    }

    const globals = (typeof window !== 'undefined'
        ? window
        : typeof globalThis !== 'undefined'
            ? globalThis
            : global);
    function outro_and_destroy_block(block, lookup) {
        transition_out(block, 1, 1, () => {
            lookup.delete(block.key);
        });
    }
    function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {
        let o = old_blocks.length;
        let n = list.length;
        let i = o;
        const old_indexes = {};
        while (i--)
            old_indexes[old_blocks[i].key] = i;
        const new_blocks = [];
        const new_lookup = new Map();
        const deltas = new Map();
        i = n;
        while (i--) {
            const child_ctx = get_context(ctx, list, i);
            const key = get_key(child_ctx);
            let block = lookup.get(key);
            if (!block) {
                block = create_each_block(key, child_ctx);
                block.c();
            }
            else if (dynamic) {
                block.p(child_ctx, dirty);
            }
            new_lookup.set(key, new_blocks[i] = block);
            if (key in old_indexes)
                deltas.set(key, Math.abs(i - old_indexes[key]));
        }
        const will_move = new Set();
        const did_move = new Set();
        function insert(block) {
            transition_in(block, 1);
            block.m(node, next);
            lookup.set(block.key, block);
            next = block.first;
            n--;
        }
        while (o && n) {
            const new_block = new_blocks[n - 1];
            const old_block = old_blocks[o - 1];
            const new_key = new_block.key;
            const old_key = old_block.key;
            if (new_block === old_block) {
                // do nothing
                next = new_block.first;
                o--;
                n--;
            }
            else if (!new_lookup.has(old_key)) {
                // remove old block
                destroy(old_block, lookup);
                o--;
            }
            else if (!lookup.has(new_key) || will_move.has(new_key)) {
                insert(new_block);
            }
            else if (did_move.has(old_key)) {
                o--;
            }
            else if (deltas.get(new_key) > deltas.get(old_key)) {
                did_move.add(new_key);
                insert(new_block);
            }
            else {
                will_move.add(old_key);
                o--;
            }
        }
        while (o--) {
            const old_block = old_blocks[o];
            if (!new_lookup.has(old_block.key))
                destroy(old_block, lookup);
        }
        while (n)
            insert(new_blocks[n - 1]);
        return new_blocks;
    }
    function validate_each_keys(ctx, list, get_context, get_key) {
        const keys = new Set();
        for (let i = 0; i < list.length; i++) {
            const key = get_key(get_context(ctx, list, i));
            if (keys.has(key)) {
                throw new Error('Cannot have duplicate keys in a keyed each');
            }
            keys.add(key);
        }
    }

    function get_spread_update(levels, updates) {
        const update = {};
        const to_null_out = {};
        const accounted_for = { $$scope: 1 };
        let i = levels.length;
        while (i--) {
            const o = levels[i];
            const n = updates[i];
            if (n) {
                for (const key in o) {
                    if (!(key in n))
                        to_null_out[key] = 1;
                }
                for (const key in n) {
                    if (!accounted_for[key]) {
                        update[key] = n[key];
                        accounted_for[key] = 1;
                    }
                }
                levels[i] = n;
            }
            else {
                for (const key in o) {
                    accounted_for[key] = 1;
                }
            }
        }
        for (const key in to_null_out) {
            if (!(key in update))
                update[key] = undefined;
        }
        return update;
    }
    function get_spread_object(spread_props) {
        return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
    }

    function bind(component, name, callback) {
        const index = component.$$.props[name];
        if (index !== undefined) {
            component.$$.bound[index] = callback;
            callback(component.$$.ctx[index]);
        }
    }
    function create_component(block) {
        block && block.c();
    }
    function mount_component(component, target, anchor, customElement) {
        const { fragment, on_mount, on_destroy, after_update } = component.$$;
        fragment && fragment.m(target, anchor);
        if (!customElement) {
            // onMount happens before the initial afterUpdate
            add_render_callback(() => {
                const new_on_destroy = on_mount.map(run).filter(is_function);
                if (on_destroy) {
                    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$1(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: null,
            // state
            props,
            update: noop$2,
            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);
    }
    /**
     * Base class for Svelte components. Used when dev=false.
     */
    class SvelteComponent {
        $destroy() {
            destroy_component(this, 1);
            this.$destroy = noop$2;
        }
        $on(type, callback) {
            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.46.4' }, detail), true));
    }
    function append_dev(target, node) {
        dispatch_dev('SvelteDOMInsert', { target, node });
        append$1(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}".`);
            }
        }
    }
    /**
     * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
     */
    class SvelteComponentDev extends SvelteComponent {
        constructor(options) {
            if (!options || (!options.target && !options.$$inline)) {
                throw new Error("'target' is a required option");
            }
            super();
        }
        $destroy() {
            super.$destroy();
            this.$destroy = () => {
                console.warn('Component was already destroyed'); // eslint-disable-line no-console
            };
        }
        $capture_state() { }
        $inject_state() { }
    }

    // Material Design Icons v6.5.95
    var mdiApi = "M7 7H5A2 2 0 0 0 3 9V17H5V13H7V17H9V9A2 2 0 0 0 7 7M7 11H5V9H7M14 7H10V17H12V13H14A2 2 0 0 0 16 11V9A2 2 0 0 0 14 7M14 11H12V9H14M20 9V15H21V17H17V15H18V9H17V7H21V9Z";
    var mdiGithub = "M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z";

    /*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */
    /* global Reflect, Promise */

    var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };

    function __extends(d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }

    var __assign = function() {
        __assign = Object.assign || function __assign(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
            return t;
        };
        return __assign.apply(this, arguments);
    };

    function __awaiter(thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    }

    function __generator(thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    }

    function __values(o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m) return m.call(o);
        if (o && typeof o.length === "number") return {
            next: function () {
                if (o && i >= o.length) o = void 0;
                return { value: o && o[i++], done: !o };
            }
        };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    }

    function __read(o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    }

    function __spreadArray(to, from, pack) {
        if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
            if (ar || !(i in from)) {
                if (!ar) ar = Array.prototype.slice.call(from, 0, i);
                ar[i] = from[i];
            }
        }
        return to.concat(ar || Array.prototype.slice.call(from));
    }

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCFoundation = /** @class */ (function () {
        function MDCFoundation(adapter) {
            if (adapter === void 0) { adapter = {}; }
            this.adapter = adapter;
        }
        Object.defineProperty(MDCFoundation, "cssClasses", {
            get: function () {
                // Classes extending MDCFoundation should implement this method to return an object which exports every
                // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
                return {};
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCFoundation, "strings", {
            get: function () {
                // Classes extending MDCFoundation should implement this method to return an object which exports all
                // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
                return {};
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCFoundation, "numbers", {
            get: function () {
                // Classes extending MDCFoundation should implement this method to return an object which exports all
                // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
                return {};
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCFoundation, "defaultAdapter", {
            get: function () {
                // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
                // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
                // validation.
                return {};
            },
            enumerable: false,
            configurable: true
        });
        MDCFoundation.prototype.init = function () {
            // Subclasses should override this method to perform initialization routines (registering events, etc.)
        };
        MDCFoundation.prototype.destroy = function () {
            // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
        };
        return MDCFoundation;
    }());

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCComponent = /** @class */ (function () {
        function MDCComponent(root, foundation) {
            var args = [];
            for (var _i = 2; _i < arguments.length; _i++) {
                args[_i - 2] = arguments[_i];
            }
            this.root = root;
            this.initialize.apply(this, __spreadArray([], __read(args)));
            // Note that we initialize foundation here and not within the constructor's
            // default param so that this.root is defined and can be used within the
            // foundation class.
            this.foundation =
                foundation === undefined ? this.getDefaultFoundation() : foundation;
            this.foundation.init();
            this.initialSyncWithDOM();
        }
        MDCComponent.attachTo = function (root) {
            // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
            // returns an instantiated component with its root set to that element. Also note that in the cases of
            // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
            // from getDefaultFoundation().
            return new MDCComponent(root, new MDCFoundation({}));
        };
        /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
        MDCComponent.prototype.initialize = function () {
            var _args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                _args[_i] = arguments[_i];
            }
            // Subclasses can override this to do any additional setup work that would be considered part of a
            // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
            // initialized. Any additional arguments besides root and foundation will be passed in here.
        };
        MDCComponent.prototype.getDefaultFoundation = function () {
            // Subclasses must override this method to return a properly configured foundation class for the
            // component.
            throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
                'foundation class');
        };
        MDCComponent.prototype.initialSyncWithDOM = function () {
            // Subclasses should override this method if they need to perform work to synchronize with a host DOM
            // object. An example of this would be a form control wrapper that needs to synchronize its internal state
            // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
            // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
        };
        MDCComponent.prototype.destroy = function () {
            // Subclasses may implement this method to release any resources / deregister any listeners they have
            // attached. An example of this might be deregistering a resize event from the window object.
            this.foundation.destroy();
        };
        MDCComponent.prototype.listen = function (evtType, handler, options) {
            this.root.addEventListener(evtType, handler, options);
        };
        MDCComponent.prototype.unlisten = function (evtType, handler, options) {
            this.root.removeEventListener(evtType, handler, options);
        };
        /**
         * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
         */
        MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
            if (shouldBubble === void 0) { shouldBubble = false; }
            var evt;
            if (typeof CustomEvent === 'function') {
                evt = new CustomEvent(evtType, {
                    bubbles: shouldBubble,
                    detail: evtData,
                });
            }
            else {
                evt = document.createEvent('CustomEvent');
                evt.initCustomEvent(evtType, shouldBubble, false, evtData);
            }
            this.root.dispatchEvent(evt);
        };
        return MDCComponent;
    }());

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * CSS class names used in component.
     */
    var cssClasses$f = {
        INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate',
        CLOSED_CLASS: 'mdc-circular-progress--closed',
    };
    /**
     * Attributes and selectors used in component.
     */
    var strings$d = {
        ARIA_HIDDEN: 'aria-hidden',
        ARIA_VALUENOW: 'aria-valuenow',
        DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle',
        RADIUS: 'r',
        STROKE_DASHOFFSET: 'stroke-dashoffset',
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCCircularProgressFoundation = /** @class */ (function (_super) {
        __extends(MDCCircularProgressFoundation, _super);
        function MDCCircularProgressFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", {
            get: function () {
                return cssClasses$f;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCCircularProgressFoundation, "strings", {
            get: function () {
                return strings$d;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClass: function () { return undefined; },
                    getDeterminateCircleAttribute: function () { return null; },
                    hasClass: function () { return false; },
                    removeClass: function () { return undefined; },
                    removeAttribute: function () { return undefined; },
                    setAttribute: function () { return undefined; },
                    setDeterminateCircleAttribute: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCCircularProgressFoundation.prototype.init = function () {
            this.closed = this.adapter.hasClass(cssClasses$f.CLOSED_CLASS);
            this.determinate = !this.adapter.hasClass(cssClasses$f.INDETERMINATE_CLASS);
            this.progress = 0;
            if (this.determinate) {
                this.adapter.setAttribute(strings$d.ARIA_VALUENOW, this.progress.toString());
            }
            this.radius =
                Number(this.adapter.getDeterminateCircleAttribute(strings$d.RADIUS));
        };
        /**
         * Sets whether the progress indicator is in determinate mode.
         * @param determinate Whether the indicator should be determinate.
         */
        MDCCircularProgressFoundation.prototype.setDeterminate = function (determinate) {
            this.determinate = determinate;
            if (this.determinate) {
                this.adapter.removeClass(cssClasses$f.INDETERMINATE_CLASS);
                this.setProgress(this.progress);
            }
            else {
                this.adapter.addClass(cssClasses$f.INDETERMINATE_CLASS);
                this.adapter.removeAttribute(strings$d.ARIA_VALUENOW);
            }
        };
        MDCCircularProgressFoundation.prototype.isDeterminate = function () {
            return this.determinate;
        };
        /**
         * Sets the current progress value. In indeterminate mode, this has no
         * visual effect but will be reflected if the indicator is switched to
         * determinate mode.
         * @param value The current progress value, which must be between 0 and 1.
         */
        MDCCircularProgressFoundation.prototype.setProgress = function (value) {
            this.progress = value;
            if (this.determinate) {
                var unfilledArcLength = (1 - this.progress) * (2 * Math.PI * this.radius);
                this.adapter.setDeterminateCircleAttribute(strings$d.STROKE_DASHOFFSET, "" + unfilledArcLength);
                this.adapter.setAttribute(strings$d.ARIA_VALUENOW, this.progress.toString());
            }
        };
        MDCCircularProgressFoundation.prototype.getProgress = function () {
            return this.progress;
        };
        /**
         * Shows the progress indicator.
         */
        MDCCircularProgressFoundation.prototype.open = function () {
            this.closed = false;
            this.adapter.removeClass(cssClasses$f.CLOSED_CLASS);
            this.adapter.removeAttribute(strings$d.ARIA_HIDDEN);
        };
        /**
         * Hides the progress indicator
         */
        MDCCircularProgressFoundation.prototype.close = function () {
            this.closed = true;
            this.adapter.addClass(cssClasses$f.CLOSED_CLASS);
            this.adapter.setAttribute(strings$d.ARIA_HIDDEN, 'true');
        };
        /**
         * @return Returns whether the progress indicator is hidden.
         */
        MDCCircularProgressFoundation.prototype.isClosed = function () {
            return this.closed;
        };
        return MDCCircularProgressFoundation;
    }(MDCFoundation));

    /**
     * A screen reader announcer, compatible with the announce function from
     * @material/dom/announce.js.
     *
     * @param message The text to announce with the screen reader.
     * @param options The options, including "priority" and "ownerDocument".
     */
    function announce$1(message, options = {}) {
        const priority = options.priority || 'polite';
        const ownerDocument = options.ownerDocument || document;
        const previousElements = ownerDocument.querySelectorAll('[data-smui-dom-announce]');
        if (previousElements.length) {
            previousElements.forEach((el) => {
                var _a;
                (_a = el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
            });
        }
        const el = ownerDocument.createElement('div');
        el.style.position = 'absolute';
        el.style.top = '-9999px';
        el.style.left = '-9999px';
        el.style.height = '1px';
        el.style.overflow = 'hidden';
        el.setAttribute('aria-atomic', 'true');
        el.setAttribute('aria-live', priority);
        el.setAttribute('data-mdc-dom-announce', 'true');
        el.setAttribute('data-smui-dom-announce', 'true');
        ownerDocument.body.appendChild(el);
        window.setTimeout(() => {
            el.textContent = message;
            const clear = () => {
                el.textContent = '';
                el.removeEventListener('click', clear);
            };
            el.addEventListener('click', clear, { once: true });
        }, 100);
    }

    function classMap(classObj) {
        return Object.entries(classObj)
            .filter(([name, value]) => name !== '' && value)
            .map(([name]) => name)
            .join(' ');
    }

    function dispatch$1(element, eventType, detail, eventInit = { bubbles: true }, 
    /** This is an internal thing used by SMUI to duplicate some SMUI events as MDC events. */
    duplicateEventForMDC = false) {
        if (typeof Event !== 'undefined' && element) {
            const event = new CustomEvent(eventType, Object.assign(Object.assign({}, eventInit), { detail }));
            element === null || element === void 0 ? void 0 : element.dispatchEvent(event);
            if (duplicateEventForMDC && eventType.startsWith('SMUI')) {
                const duplicateEvent = new CustomEvent(eventType.replace(/^SMUI/g, () => 'MDC'), Object.assign(Object.assign({}, eventInit), { detail }));
                element === null || element === void 0 ? void 0 : element.dispatchEvent(duplicateEvent);
                if (duplicateEvent.defaultPrevented) {
                    event.preventDefault();
                }
            }
            return event;
        }
    }

    function exclude(obj, keys) {
        let names = Object.getOwnPropertyNames(obj);
        const newObj = {};
        for (let i = 0; i < names.length; i++) {
            const name = names[i];
            const cashIndex = name.indexOf('$');
            if (cashIndex !== -1 &&
                keys.indexOf(name.substring(0, cashIndex + 1)) !== -1) {
                continue;
            }
            if (keys.indexOf(name) !== -1) {
                continue;
            }
            newObj[name] = obj[name];
        }
        return newObj;
    }

    // Match old modifiers. (only works on DOM events)
    const oldModifierRegex = /^[a-z]+(?::(?:preventDefault|stopPropagation|passive|nonpassive|capture|once|self))+$/;
    // Match new modifiers.
    const newModifierRegex = /^[^$]+(?:\$(?:preventDefault|stopPropagation|passive|nonpassive|capture|once|self))+$/;
    function forwardEventsBuilder(component) {
        // This is our pseudo $on function. It is defined on component mount.
        let $on;
        // This is a list of events bound before mount.
        let events = [];
        // And we override the $on function to forward all bound events.
        component.$on = (fullEventType, callback) => {
            let eventType = fullEventType;
            let destructor = () => { };
            if ($on) {
                // The event was bound programmatically.
                destructor = $on(eventType, callback);
            }
            else {
                // The event was bound before mount by Svelte.
                events.push([eventType, callback]);
            }
            const oldModifierMatch = eventType.match(oldModifierRegex);
            if (oldModifierMatch && console) {
                console.warn('Event modifiers in SMUI now use "$" instead of ":", so that ' +
                    'all events can be bound with modifiers. Please update your ' +
                    'event binding: ', eventType);
            }
            return () => {
                destructor();
            };
        };
        function forward(e) {
            // Internally bubble the event up from Svelte components.
            bubble(component, e);
        }
        return (node) => {
            const destructors = [];
            const forwardDestructors = {};
            // This function is responsible for listening and forwarding
            // all bound events.
            $on = (fullEventType, callback) => {
                let eventType = fullEventType;
                let handler = callback;
                // DOM addEventListener options argument.
                let options = false;
                const oldModifierMatch = eventType.match(oldModifierRegex);
                const newModifierMatch = eventType.match(newModifierRegex);
                const modifierMatch = oldModifierMatch || newModifierMatch;
                if (eventType.match(/^SMUI:\w+:/)) {
                    const newEventTypeParts = eventType.split(':');
                    let newEventType = '';
                    for (let i = 0; i < newEventTypeParts.length; i++) {
                        newEventType +=
                            i === newEventTypeParts.length - 1
                                ? ':' + newEventTypeParts[i]
                                : newEventTypeParts[i]
                                    .split('-')
                                    .map((value) => value.slice(0, 1).toUpperCase() + value.slice(1))
                                    .join('');
                    }
                    console.warn(`The event ${eventType.split('$')[0]} has been renamed to ${newEventType.split('$')[0]}.`);
                    eventType = newEventType;
                }
                if (modifierMatch) {
                    // Parse the event modifiers.
                    // Supported modifiers:
                    // - preventDefault
                    // - stopPropagation
                    // - passive
                    // - nonpassive
                    // - capture
                    // - once
                    const parts = eventType.split(oldModifierMatch ? ':' : '$');
                    eventType = parts[0];
                    const eventOptions = Object.fromEntries(parts.slice(1).map((mod) => [mod, true]));
                    if (eventOptions.passive) {
                        options = options || {};
                        options.passive = true;
                    }
                    if (eventOptions.nonpassive) {
                        options = options || {};
                        options.passive = false;
                    }
                    if (eventOptions.capture) {
                        options = options || {};
                        options.capture = true;
                    }
                    if (eventOptions.once) {
                        options = options || {};
                        options.once = true;
                    }
                    if (eventOptions.preventDefault) {
                        handler = prevent_default(handler);
                    }
                    if (eventOptions.stopPropagation) {
                        handler = stop_propagation(handler);
                    }
                }
                // Listen for the event directly, with the given options.
                const off = listen(node, eventType, handler, options);
                const destructor = () => {
                    off();
                    const idx = destructors.indexOf(destructor);
                    if (idx > -1) {
                        destructors.splice(idx, 1);
                    }
                };
                destructors.push(destructor);
                // Forward the event from Svelte.
                if (!(eventType in forwardDestructors)) {
                    forwardDestructors[eventType] = listen(node, eventType, forward);
                }
                return destructor;
            };
            for (let i = 0; i < events.length; i++) {
                // Listen to all the events added before mount.
                $on(events[i][0], events[i][1]);
            }
            return {
                destroy: () => {
                    // Remove all event listeners.
                    for (let i = 0; i < destructors.length; i++) {
                        destructors[i]();
                    }
                    // Remove all event forwarders.
                    for (let entry of Object.entries(forwardDestructors)) {
                        entry[1]();
                    }
                },
            };
        };
    }

    function prefixFilter(obj, prefix) {
        let names = Object.getOwnPropertyNames(obj);
        const newObj = {};
        for (let i = 0; i < names.length; i++) {
            const name = names[i];
            if (name.substring(0, prefix.length) === prefix) {
                newObj[name.substring(prefix.length)] = obj[name];
            }
        }
        return newObj;
    }

    function useActions(node, actions) {
        let actionReturns = [];
        if (actions) {
            for (let i = 0; i < actions.length; i++) {
                const actionEntry = actions[i];
                const action = Array.isArray(actionEntry) ? actionEntry[0] : actionEntry;
                if (Array.isArray(actionEntry) && actionEntry.length > 1) {
                    actionReturns.push(action(node, actionEntry[1]));
                }
                else {
                    actionReturns.push(action(node));
                }
            }
        }
        return {
            update(actions) {
                if (((actions && actions.length) || 0) != actionReturns.length) {
                    throw new Error('You must not change the length of an actions array.');
                }
                if (actions) {
                    for (let i = 0; i < actions.length; i++) {
                        const returnEntry = actionReturns[i];
                        if (returnEntry && returnEntry.update) {
                            const actionEntry = actions[i];
                            if (Array.isArray(actionEntry) && actionEntry.length > 1) {
                                returnEntry.update(actionEntry[1]);
                            }
                            else {
                                returnEntry.update();
                            }
                        }
                    }
                }
            },
            destroy() {
                for (let i = 0; i < actionReturns.length; i++) {
                    const returnEntry = actionReturns[i];
                    if (returnEntry && returnEntry.destroy) {
                        returnEntry.destroy();
                    }
                }
            },
        };
    }

    /* node_modules/@smui/circular-progress/dist/CircularProgress.svelte generated by Svelte v3.46.4 */
    const file$U = "node_modules/@smui/circular-progress/dist/CircularProgress.svelte";

    function get_each_context$a(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[24] = list[i];
    	return child_ctx;
    }

    // (46:4) {#each fourColor ? [1, 2, 3, 4] : [1] as color}
    function create_each_block$a(ctx) {
    	let div3;
    	let div0;
    	let svg0;
    	let circle0;
    	let t0;
    	let div1;
    	let svg1;
    	let circle1;
    	let t1;
    	let div2;
    	let svg2;
    	let circle2;
    	let t2;
    	let div3_class_value;

    	const block = {
    		c: function create() {
    			div3 = element("div");
    			div0 = element("div");
    			svg0 = svg_element("svg");
    			circle0 = svg_element("circle");
    			t0 = space();
    			div1 = element("div");
    			svg1 = svg_element("svg");
    			circle1 = svg_element("circle");
    			t1 = space();
    			div2 = element("div");
    			svg2 = svg_element("svg");
    			circle2 = svg_element("circle");
    			t2 = space();
    			attr_dev(circle0, "cx", "24");
    			attr_dev(circle0, "cy", "24");
    			attr_dev(circle0, "r", "18");
    			attr_dev(circle0, "stroke-dasharray", "113.097");
    			attr_dev(circle0, "stroke-dashoffset", "56.549");
    			attr_dev(circle0, "stroke-width", "4");
    			add_location(circle0, file$U, 61, 12, 1742);
    			attr_dev(svg0, "class", "mdc-circular-progress__indeterminate-circle-graphic");
    			attr_dev(svg0, "viewBox", "0 0 48 48");
    			attr_dev(svg0, "xmlns", "http://www.w3.org/2000/svg");
    			add_location(svg0, file$U, 56, 10, 1562);
    			attr_dev(div0, "class", "mdc-circular-progress__circle-clipper mdc-circular-progress__circle-left");
    			add_location(div0, file$U, 53, 8, 1446);
    			attr_dev(circle1, "cx", "24");
    			attr_dev(circle1, "cy", "24");
    			attr_dev(circle1, "r", "18");
    			attr_dev(circle1, "stroke-dasharray", "113.097");
    			attr_dev(circle1, "stroke-dashoffset", "56.549");
    			attr_dev(circle1, "stroke-width", "3.2");
    			add_location(circle1, file$U, 77, 12, 2220);
    			attr_dev(svg1, "class", "mdc-circular-progress__indeterminate-circle-graphic");
    			attr_dev(svg1, "viewBox", "0 0 48 48");
    			attr_dev(svg1, "xmlns", "http://www.w3.org/2000/svg");
    			add_location(svg1, file$U, 72, 10, 2040);
    			attr_dev(div1, "class", "mdc-circular-progress__gap-patch");
    			add_location(div1, file$U, 71, 8, 1983);
    			attr_dev(circle2, "cx", "24");
    			attr_dev(circle2, "cy", "24");
    			attr_dev(circle2, "r", "18");
    			attr_dev(circle2, "stroke-dasharray", "113.097");
    			attr_dev(circle2, "stroke-dashoffset", "56.549");
    			attr_dev(circle2, "stroke-width", "4");
    			add_location(circle2, file$U, 95, 12, 2760);
    			attr_dev(svg2, "class", "mdc-circular-progress__indeterminate-circle-graphic");
    			attr_dev(svg2, "viewBox", "0 0 48 48");
    			attr_dev(svg2, "xmlns", "http://www.w3.org/2000/svg");
    			add_location(svg2, file$U, 90, 10, 2580);
    			attr_dev(div2, "class", "mdc-circular-progress__circle-clipper mdc-circular-progress__circle-right");
    			add_location(div2, file$U, 87, 8, 2463);

    			attr_dev(div3, "class", div3_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-circular-progress__spinner-layer': true,
    				['mdc-circular-progress__color-' + /*color*/ ctx[24]]: /*fourColor*/ ctx[5]
    			}));

    			add_location(div3, file$U, 46, 6, 1238);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div3, anchor);
    			append_dev(div3, div0);
    			append_dev(div0, svg0);
    			append_dev(svg0, circle0);
    			append_dev(div3, t0);
    			append_dev(div3, div1);
    			append_dev(div1, svg1);
    			append_dev(svg1, circle1);
    			append_dev(div3, t1);
    			append_dev(div3, div2);
    			append_dev(div2, svg2);
    			append_dev(svg2, circle2);
    			append_dev(div3, t2);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*className, fourColor*/ 34 && div3_class_value !== (div3_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-circular-progress__spinner-layer': true,
    				['mdc-circular-progress__color-' + /*color*/ ctx[24]]: /*fourColor*/ ctx[5]
    			}))) {
    				attr_dev(div3, "class", div3_class_value);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div3);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$a.name,
    		type: "each",
    		source: "(46:4) {#each fourColor ? [1, 2, 3, 4] : [1] as color}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$12(ctx) {
    	let div2;
    	let div0;
    	let svg;
    	let circle0;
    	let circle1;
    	let t;
    	let div1;
    	let div2_class_value;
    	let div2_aria_valuemin_value;
    	let div2_aria_valuemax_value;
    	let div2_aria_valuenow_value;
    	let useActions_action;
    	let mounted;
    	let dispose;

    	let circle1_levels = [
    		{
    			class: "mdc-circular-progress__determinate-circle"
    		},
    		{ cx: "24" },
    		{ cy: "24" },
    		{ r: "18" },
    		{ "stroke-dasharray": "113.097" },
    		{ "stroke-dashoffset": "113.097" },
    		{ "stroke-width": "4" },
    		/*determinateCircleAttrs*/ ctx[9]
    	];

    	let circle1_data = {};

    	for (let i = 0; i < circle1_levels.length; i += 1) {
    		circle1_data = assign$1(circle1_data, circle1_levels[i]);
    	}

    	let each_value = /*fourColor*/ ctx[5] ? [1, 2, 3, 4] : [1];
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$a(get_each_context$a(ctx, each_value, i));
    	}

    	let div2_levels = [
    		{
    			class: div2_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-circular-progress': true,
    				'mdc-circular-progress--indeterminate': /*indeterminate*/ ctx[2],
    				'mdc-circular-progress--closed': /*closed*/ ctx[3],
    				.../*internalClasses*/ ctx[7]
    			})
    		},
    		{ role: "progressbar" },
    		{
    			"aria-valuemin": div2_aria_valuemin_value = 0
    		},
    		{
    			"aria-valuemax": div2_aria_valuemax_value = 1
    		},
    		{
    			"aria-valuenow": div2_aria_valuenow_value = /*indeterminate*/ ctx[2]
    			? undefined
    			: /*progress*/ ctx[4]
    		},
    		/*internalAttrs*/ ctx[8],
    		/*$$restProps*/ ctx[12]
    	];

    	let div2_data = {};

    	for (let i = 0; i < div2_levels.length; i += 1) {
    		div2_data = assign$1(div2_data, div2_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div2 = element("div");
    			div0 = element("div");
    			svg = svg_element("svg");
    			circle0 = svg_element("circle");
    			circle1 = svg_element("circle");
    			t = space();
    			div1 = element("div");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			attr_dev(circle0, "class", "mdc-circular-progress__determinate-track");
    			attr_dev(circle0, "cx", "24");
    			attr_dev(circle0, "cy", "24");
    			attr_dev(circle0, "r", "18");
    			attr_dev(circle0, "stroke-width", "4");
    			add_location(circle0, file$U, 24, 6, 653);
    			set_svg_attributes(circle1, circle1_data);
    			add_location(circle1, file$U, 31, 6, 805);
    			attr_dev(svg, "class", "mdc-circular-progress__determinate-circle-graphic");
    			attr_dev(svg, "viewBox", "0 0 48 48");
    			attr_dev(svg, "xmlns", "http://www.w3.org/2000/svg");
    			add_location(svg, file$U, 19, 4, 505);
    			attr_dev(div0, "class", "mdc-circular-progress__determinate-container");
    			add_location(div0, file$U, 18, 2, 442);
    			attr_dev(div1, "class", "mdc-circular-progress__indeterminate-container");
    			add_location(div1, file$U, 44, 2, 1119);
    			set_attributes(div2, div2_data);
    			add_location(div2, file$U, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div2, anchor);
    			append_dev(div2, div0);
    			append_dev(div0, svg);
    			append_dev(svg, circle0);
    			append_dev(svg, circle1);
    			/*circle1_binding*/ ctx[15](circle1);
    			append_dev(div2, t);
    			append_dev(div2, div1);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(div1, null);
    			}

    			/*div2_binding*/ ctx[16](div2);

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div2, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[11].call(null, div2))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			set_svg_attributes(circle1, circle1_data = get_spread_update(circle1_levels, [
    				{
    					class: "mdc-circular-progress__determinate-circle"
    				},
    				{ cx: "24" },
    				{ cy: "24" },
    				{ r: "18" },
    				{ "stroke-dasharray": "113.097" },
    				{ "stroke-dashoffset": "113.097" },
    				{ "stroke-width": "4" },
    				dirty & /*determinateCircleAttrs*/ 512 && /*determinateCircleAttrs*/ ctx[9]
    			]));

    			if (dirty & /*classMap, className, fourColor*/ 34) {
    				each_value = /*fourColor*/ ctx[5] ? [1, 2, 3, 4] : [1];
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$a(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    					} else {
    						each_blocks[i] = create_each_block$a(child_ctx);
    						each_blocks[i].c();
    						each_blocks[i].m(div1, null);
    					}
    				}

    				for (; i < each_blocks.length; i += 1) {
    					each_blocks[i].d(1);
    				}

    				each_blocks.length = each_value.length;
    			}

    			set_attributes(div2, div2_data = get_spread_update(div2_levels, [
    				dirty & /*className, indeterminate, closed, internalClasses*/ 142 && div2_class_value !== (div2_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-circular-progress': true,
    					'mdc-circular-progress--indeterminate': /*indeterminate*/ ctx[2],
    					'mdc-circular-progress--closed': /*closed*/ ctx[3],
    					.../*internalClasses*/ ctx[7]
    				})) && { class: div2_class_value },
    				{ role: "progressbar" },
    				{
    					"aria-valuemin": div2_aria_valuemin_value
    				},
    				{
    					"aria-valuemax": div2_aria_valuemax_value
    				},
    				dirty & /*indeterminate, progress*/ 20 && div2_aria_valuenow_value !== (div2_aria_valuenow_value = /*indeterminate*/ ctx[2]
    				? undefined
    				: /*progress*/ ctx[4]) && {
    					"aria-valuenow": div2_aria_valuenow_value
    				},
    				dirty & /*internalAttrs*/ 256 && /*internalAttrs*/ ctx[8],
    				dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div2);
    			/*circle1_binding*/ ctx[15](null);
    			destroy_each(each_blocks, detaching);
    			/*div2_binding*/ ctx[16](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$12.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance_1$f($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","indeterminate","closed","progress","fourColor","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('CircularProgress', slots, []);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { indeterminate = false } = $$props;
    	let { closed = false } = $$props;
    	let { progress = 0 } = $$props;
    	let { fourColor = false } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalAttrs = {};
    	let determinateCircleAttrs = {};
    	let determinateCircle;

    	onMount(() => {
    		$$invalidate(14, instance = new MDCCircularProgressFoundation({
    				addClass,
    				getDeterminateCircleAttribute: getDeterminateCircleAttr,
    				hasClass,
    				removeClass,
    				removeAttribute: removeAttr,
    				setAttribute: addAttr,
    				setDeterminateCircleAttribute: addDeterminateCircleAttr
    			}));

    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(7, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(7, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(8, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function removeAttr(name) {
    		if (!(name in internalAttrs) || internalAttrs[name] != null) {
    			$$invalidate(8, internalAttrs[name] = undefined, internalAttrs);
    		}
    	}

    	function getDeterminateCircleAttr(name) {
    		var _a;

    		return name in determinateCircleAttrs
    		? (_a = determinateCircleAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: determinateCircle.getAttribute(name);
    	}

    	function addDeterminateCircleAttr(name, value) {
    		if (determinateCircleAttrs[name] !== value) {
    			$$invalidate(9, determinateCircleAttrs[name] = value, determinateCircleAttrs);
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function circle1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			determinateCircle = $$value;
    			$$invalidate(10, determinateCircle);
    		});
    	}

    	function div2_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(6, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('indeterminate' in $$new_props) $$invalidate(2, indeterminate = $$new_props.indeterminate);
    		if ('closed' in $$new_props) $$invalidate(3, closed = $$new_props.closed);
    		if ('progress' in $$new_props) $$invalidate(4, progress = $$new_props.progress);
    		if ('fourColor' in $$new_props) $$invalidate(5, fourColor = $$new_props.fourColor);
    	};

    	$$self.$capture_state = () => ({
    		MDCCircularProgressFoundation,
    		onMount,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		indeterminate,
    		closed,
    		progress,
    		fourColor,
    		element,
    		instance,
    		internalClasses,
    		internalAttrs,
    		determinateCircleAttrs,
    		determinateCircle,
    		hasClass,
    		addClass,
    		removeClass,
    		addAttr,
    		removeAttr,
    		getDeterminateCircleAttr,
    		addDeterminateCircleAttr,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('indeterminate' in $$props) $$invalidate(2, indeterminate = $$new_props.indeterminate);
    		if ('closed' in $$props) $$invalidate(3, closed = $$new_props.closed);
    		if ('progress' in $$props) $$invalidate(4, progress = $$new_props.progress);
    		if ('fourColor' in $$props) $$invalidate(5, fourColor = $$new_props.fourColor);
    		if ('element' in $$props) $$invalidate(6, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(14, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(7, internalClasses = $$new_props.internalClasses);
    		if ('internalAttrs' in $$props) $$invalidate(8, internalAttrs = $$new_props.internalAttrs);
    		if ('determinateCircleAttrs' in $$props) $$invalidate(9, determinateCircleAttrs = $$new_props.determinateCircleAttrs);
    		if ('determinateCircle' in $$props) $$invalidate(10, determinateCircle = $$new_props.determinateCircle);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*instance, indeterminate*/ 16388) {
    			if (instance && instance.isDeterminate() !== !indeterminate) {
    				instance.setDeterminate(!indeterminate);
    			}
    		}

    		if ($$self.$$.dirty & /*instance, progress*/ 16400) {
    			if (instance && instance.getProgress() !== progress) {
    				instance.setProgress(progress);
    			}
    		}

    		if ($$self.$$.dirty & /*instance, closed*/ 16392) {
    			if (instance) {
    				if (closed) {
    					instance.close();
    				} else {
    					instance.open();
    				}
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		indeterminate,
    		closed,
    		progress,
    		fourColor,
    		element,
    		internalClasses,
    		internalAttrs,
    		determinateCircleAttrs,
    		determinateCircle,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		instance,
    		circle1_binding,
    		div2_binding
    	];
    }

    class CircularProgress extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$f, create_fragment$12, safe_not_equal, {
    			use: 0,
    			class: 1,
    			indeterminate: 2,
    			closed: 3,
    			progress: 4,
    			fourColor: 5,
    			getElement: 13
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "CircularProgress",
    			options,
    			id: create_fragment$12.name
    		});
    	}

    	get use() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get indeterminate() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set indeterminate(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get closed() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set closed(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get progress() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set progress(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get fourColor() {
    		throw new Error("<CircularProgress>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set fourColor(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[13];
    	}

    	set getElement(value) {
    		throw new Error("<CircularProgress>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/A.svelte generated by Svelte v3.46.4 */
    const file$T = "node_modules/@smui/common/dist/elements/A.svelte";

    function create_fragment$11(ctx) {
    	let a;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[7].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[6], null);
    	let a_levels = [{ href: /*href*/ ctx[1] }, /*$$restProps*/ ctx[4]];
    	let a_data = {};

    	for (let i = 0; i < a_levels.length; i += 1) {
    		a_data = assign$1(a_data, a_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			a = element("a");
    			if (default_slot) default_slot.c();
    			set_attributes(a, a_data);
    			add_location(a, file$T, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, a, anchor);

    			if (default_slot) {
    				default_slot.m(a, null);
    			}

    			/*a_binding*/ ctx[8](a);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, a, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[3].call(null, a))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 64)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[6],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[6])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[6], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(a, a_data = get_spread_update(a_levels, [
    				(!current || dirty & /*href*/ 2) && { href: /*href*/ ctx[1] },
    				dirty & /*$$restProps*/ 16 && /*$$restProps*/ ctx[4]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(a);
    			if (default_slot) default_slot.d(detaching);
    			/*a_binding*/ ctx[8](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$11.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$Y($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","href","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('A', slots, ['default']);
    	let { use = [] } = $$props;
    	let { href = 'javascript:void(0);' } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function a_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(4, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('href' in $$new_props) $$invalidate(1, href = $$new_props.href);
    		if ('$$scope' in $$new_props) $$invalidate(6, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		href,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('href' in $$props) $$invalidate(1, href = $$new_props.href);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		href,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		a_binding
    	];
    }

    class A$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$Y, create_fragment$11, safe_not_equal, { use: 0, href: 1, getElement: 5 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "A",
    			options,
    			id: create_fragment$11.name
    		});
    	}

    	get use() {
    		throw new Error("<A>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<A>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get href() {
    		throw new Error("<A>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set href(value) {
    		throw new Error("<A>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[5];
    	}

    	set getElement(value) {
    		throw new Error("<A>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Button.svelte generated by Svelte v3.46.4 */
    const file$S = "node_modules/@smui/common/dist/elements/Button.svelte";

    function create_fragment$10(ctx) {
    	let button;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let button_levels = [/*$$restProps*/ ctx[3]];
    	let button_data = {};

    	for (let i = 0; i < button_levels.length; i += 1) {
    		button_data = assign$1(button_data, button_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			button = element("button");
    			if (default_slot) default_slot.c();
    			set_attributes(button, button_data);
    			add_location(button, file$S, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, button, anchor);

    			if (default_slot) {
    				default_slot.m(button, null);
    			}

    			if (button.autofocus) button.focus();
    			/*button_binding*/ ctx[7](button);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, button, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, button))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(button, button_data = get_spread_update(button_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(button);
    			if (default_slot) default_slot.d(detaching);
    			/*button_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$10.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$X($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Button', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function button_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		button_binding
    	];
    }

    class Button$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$X, create_fragment$10, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Button",
    			options,
    			id: create_fragment$10.name
    		});
    	}

    	get use() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Div.svelte generated by Svelte v3.46.4 */
    const file$R = "node_modules/@smui/common/dist/elements/Div.svelte";

    function create_fragment$$(ctx) {
    	let div;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let div_levels = [/*$$restProps*/ ctx[3]];
    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div, div_data);
    			add_location(div, file$R, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[7](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, div))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$$.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$W($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Div', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		div_binding
    	];
    }

    class Div$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$W, create_fragment$$, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Div",
    			options,
    			id: create_fragment$$.name
    		});
    	}

    	get use() {
    		throw new Error("<Div>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Div>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Div>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/H2.svelte generated by Svelte v3.46.4 */
    const file$Q = "node_modules/@smui/common/dist/elements/H2.svelte";

    function create_fragment$_(ctx) {
    	let h2;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let h2_levels = [/*$$restProps*/ ctx[3]];
    	let h2_data = {};

    	for (let i = 0; i < h2_levels.length; i += 1) {
    		h2_data = assign$1(h2_data, h2_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			h2 = element("h2");
    			if (default_slot) default_slot.c();
    			set_attributes(h2, h2_data);
    			add_location(h2, file$Q, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h2, anchor);

    			if (default_slot) {
    				default_slot.m(h2, null);
    			}

    			/*h2_binding*/ ctx[7](h2);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, h2, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, h2))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(h2, h2_data = get_spread_update(h2_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h2);
    			if (default_slot) default_slot.d(detaching);
    			/*h2_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$_.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$V($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('H2', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function h2_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		h2_binding
    	];
    }

    class H2$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$V, create_fragment$_, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "H2",
    			options,
    			id: create_fragment$_.name
    		});
    	}

    	get use() {
    		throw new Error("<H2>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<H2>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<H2>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/H3.svelte generated by Svelte v3.46.4 */
    const file$P = "node_modules/@smui/common/dist/elements/H3.svelte";

    function create_fragment$Z(ctx) {
    	let h3;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let h3_levels = [/*$$restProps*/ ctx[3]];
    	let h3_data = {};

    	for (let i = 0; i < h3_levels.length; i += 1) {
    		h3_data = assign$1(h3_data, h3_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			h3 = element("h3");
    			if (default_slot) default_slot.c();
    			set_attributes(h3, h3_data);
    			add_location(h3, file$P, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h3, anchor);

    			if (default_slot) {
    				default_slot.m(h3, null);
    			}

    			/*h3_binding*/ ctx[7](h3);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, h3, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, h3))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(h3, h3_data = get_spread_update(h3_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h3);
    			if (default_slot) default_slot.d(detaching);
    			/*h3_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$Z.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$U($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('H3', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function h3_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		h3_binding
    	];
    }

    class H3$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$U, create_fragment$Z, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "H3",
    			options,
    			id: create_fragment$Z.name
    		});
    	}

    	get use() {
    		throw new Error("<H3>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<H3>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<H3>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/H5.svelte generated by Svelte v3.46.4 */
    const file$O = "node_modules/@smui/common/dist/elements/H5.svelte";

    function create_fragment$Y(ctx) {
    	let h5;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let h5_levels = [/*$$restProps*/ ctx[3]];
    	let h5_data = {};

    	for (let i = 0; i < h5_levels.length; i += 1) {
    		h5_data = assign$1(h5_data, h5_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			h5 = element("h5");
    			if (default_slot) default_slot.c();
    			set_attributes(h5, h5_data);
    			add_location(h5, file$O, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h5, anchor);

    			if (default_slot) {
    				default_slot.m(h5, null);
    			}

    			/*h5_binding*/ ctx[7](h5);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, h5, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, h5))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(h5, h5_data = get_spread_update(h5_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h5);
    			if (default_slot) default_slot.d(detaching);
    			/*h5_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$Y.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$T($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('H5', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function h5_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		h5_binding
    	];
    }

    class H5$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$T, create_fragment$Y, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "H5",
    			options,
    			id: create_fragment$Y.name
    		});
    	}

    	get use() {
    		throw new Error("<H5>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<H5>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<H5>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/H6.svelte generated by Svelte v3.46.4 */
    const file$N = "node_modules/@smui/common/dist/elements/H6.svelte";

    function create_fragment$X(ctx) {
    	let h6;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let h6_levels = [/*$$restProps*/ ctx[3]];
    	let h6_data = {};

    	for (let i = 0; i < h6_levels.length; i += 1) {
    		h6_data = assign$1(h6_data, h6_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			h6 = element("h6");
    			if (default_slot) default_slot.c();
    			set_attributes(h6, h6_data);
    			add_location(h6, file$N, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h6, anchor);

    			if (default_slot) {
    				default_slot.m(h6, null);
    			}

    			/*h6_binding*/ ctx[7](h6);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, h6, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, h6))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(h6, h6_data = get_spread_update(h6_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h6);
    			if (default_slot) default_slot.d(detaching);
    			/*h6_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$X.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$S($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('H6', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function h6_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		h6_binding
    	];
    }

    class H6$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$S, create_fragment$X, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "H6",
    			options,
    			id: create_fragment$X.name
    		});
    	}

    	get use() {
    		throw new Error("<H6>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<H6>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<H6>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Hr.svelte generated by Svelte v3.46.4 */
    const file$M = "node_modules/@smui/common/dist/elements/Hr.svelte";

    function create_fragment$W(ctx) {
    	let hr;
    	let useActions_action;
    	let t;
    	let current;
    	let mounted;
    	let dispose;
    	let hr_levels = [/*$$restProps*/ ctx[3]];
    	let hr_data = {};

    	for (let i = 0; i < hr_levels.length; i += 1) {
    		hr_data = assign$1(hr_data, hr_levels[i]);
    	}

    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);

    	const block = {
    		c: function create() {
    			hr = element("hr");
    			t = space();
    			if (default_slot) default_slot.c();
    			set_attributes(hr, hr_data);
    			add_location(hr, file$M, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, hr, anchor);
    			/*hr_binding*/ ctx[7](hr);
    			insert_dev(target, t, anchor);

    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, hr, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, hr))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			set_attributes(hr, hr_data = get_spread_update(hr_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(hr);
    			/*hr_binding*/ ctx[7](null);
    			if (detaching) detach_dev(t);
    			if (default_slot) default_slot.d(detaching);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$W.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$R($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Hr', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function hr_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		hr_binding
    	];
    }

    class Hr$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$R, create_fragment$W, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Hr",
    			options,
    			id: create_fragment$W.name
    		});
    	}

    	get use() {
    		throw new Error("<Hr>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Hr>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Hr>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/I.svelte generated by Svelte v3.46.4 */
    const file$L = "node_modules/@smui/common/dist/elements/I.svelte";

    function create_fragment$V(ctx) {
    	let i;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let i_levels = [/*$$restProps*/ ctx[3]];
    	let i_data = {};

    	for (let i = 0; i < i_levels.length; i += 1) {
    		i_data = assign$1(i_data, i_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			i = element("i");
    			if (default_slot) default_slot.c();
    			set_attributes(i, i_data);
    			add_location(i, file$L, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, i, anchor);

    			if (default_slot) {
    				default_slot.m(i, null);
    			}

    			/*i_binding*/ ctx[7](i);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, i, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, i))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(i, i_data = get_spread_update(i_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(i);
    			if (default_slot) default_slot.d(detaching);
    			/*i_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$V.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$Q($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('I', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function i_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		i_binding
    	];
    }

    class I extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$Q, create_fragment$V, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "I",
    			options,
    			id: create_fragment$V.name
    		});
    	}

    	get use() {
    		throw new Error("<I>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<I>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<I>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Li.svelte generated by Svelte v3.46.4 */
    const file$K = "node_modules/@smui/common/dist/elements/Li.svelte";

    function create_fragment$U(ctx) {
    	let li;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let li_levels = [/*$$restProps*/ ctx[3]];
    	let li_data = {};

    	for (let i = 0; i < li_levels.length; i += 1) {
    		li_data = assign$1(li_data, li_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			li = element("li");
    			if (default_slot) default_slot.c();
    			set_attributes(li, li_data);
    			add_location(li, file$K, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, li, anchor);

    			if (default_slot) {
    				default_slot.m(li, null);
    			}

    			/*li_binding*/ ctx[7](li);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, li, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, li))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(li, li_data = get_spread_update(li_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(li);
    			if (default_slot) default_slot.d(detaching);
    			/*li_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$U.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$P($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Li', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function li_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		li_binding
    	];
    }

    class Li$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$P, create_fragment$U, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Li",
    			options,
    			id: create_fragment$U.name
    		});
    	}

    	get use() {
    		throw new Error("<Li>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Li>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Li>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Nav.svelte generated by Svelte v3.46.4 */
    const file$J = "node_modules/@smui/common/dist/elements/Nav.svelte";

    function create_fragment$T(ctx) {
    	let nav;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let nav_levels = [/*$$restProps*/ ctx[3]];
    	let nav_data = {};

    	for (let i = 0; i < nav_levels.length; i += 1) {
    		nav_data = assign$1(nav_data, nav_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			nav = element("nav");
    			if (default_slot) default_slot.c();
    			set_attributes(nav, nav_data);
    			add_location(nav, file$J, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, nav, anchor);

    			if (default_slot) {
    				default_slot.m(nav, null);
    			}

    			/*nav_binding*/ ctx[7](nav);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, nav, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, nav))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(nav, nav_data = get_spread_update(nav_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(nav);
    			if (default_slot) default_slot.d(detaching);
    			/*nav_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$T.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$O($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Nav', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function nav_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		nav_binding
    	];
    }

    class Nav$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$O, create_fragment$T, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Nav",
    			options,
    			id: create_fragment$T.name
    		});
    	}

    	get use() {
    		throw new Error("<Nav>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Nav>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Nav>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Span.svelte generated by Svelte v3.46.4 */
    const file$I = "node_modules/@smui/common/dist/elements/Span.svelte";

    function create_fragment$S(ctx) {
    	let span;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let span_levels = [/*$$restProps*/ ctx[3]];
    	let span_data = {};

    	for (let i = 0; i < span_levels.length; i += 1) {
    		span_data = assign$1(span_data, span_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			span = element("span");
    			if (default_slot) default_slot.c();
    			set_attributes(span, span_data);
    			add_location(span, file$I, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);

    			if (default_slot) {
    				default_slot.m(span, null);
    			}

    			/*span_binding*/ ctx[7](span);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, span, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, span))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(span, span_data = get_spread_update(span_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    			if (default_slot) default_slot.d(detaching);
    			/*span_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$S.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$N($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Span', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function span_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		span_binding
    	];
    }

    class Span$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$N, create_fragment$S, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Span",
    			options,
    			id: create_fragment$S.name
    		});
    	}

    	get use() {
    		throw new Error("<Span>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Span>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Span>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Svg.svelte generated by Svelte v3.46.4 */
    const file$H = "node_modules/@smui/common/dist/elements/Svg.svelte";

    function create_fragment$R(ctx) {
    	let svg;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let svg_levels = [/*$$restProps*/ ctx[3]];
    	let svg_data = {};

    	for (let i = 0; i < svg_levels.length; i += 1) {
    		svg_data = assign$1(svg_data, svg_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			svg = svg_element("svg");
    			if (default_slot) default_slot.c();
    			set_svg_attributes(svg, svg_data);
    			add_location(svg, file$H, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, svg, anchor);

    			if (default_slot) {
    				default_slot.m(svg, null);
    			}

    			/*svg_binding*/ ctx[7](svg);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, svg, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, svg))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_svg_attributes(svg, svg_data = get_spread_update(svg_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(svg);
    			if (default_slot) default_slot.d(detaching);
    			/*svg_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$R.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$M($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Svg', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function svg_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		svg_binding
    	];
    }

    class Svg$2 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$M, create_fragment$R, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Svg",
    			options,
    			id: create_fragment$R.name
    		});
    	}

    	get use() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/elements/Ul.svelte generated by Svelte v3.46.4 */
    const file$G = "node_modules/@smui/common/dist/elements/Ul.svelte";

    function create_fragment$Q(ctx) {
    	let ul;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], null);
    	let ul_levels = [/*$$restProps*/ ctx[3]];
    	let ul_data = {};

    	for (let i = 0; i < ul_levels.length; i += 1) {
    		ul_data = assign$1(ul_data, ul_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			ul = element("ul");
    			if (default_slot) default_slot.c();
    			set_attributes(ul, ul_data);
    			add_location(ul, file$G, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, ul, anchor);

    			if (default_slot) {
    				default_slot.m(ul, null);
    			}

    			/*ul_binding*/ ctx[7](ul);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, ul, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[2].call(null, ul))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(ul, ul_data = get_spread_update(ul_levels, [dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(ul);
    			if (default_slot) default_slot.d(detaching);
    			/*ul_binding*/ ctx[7](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$Q.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$L($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Ul', slots, ['default']);
    	let { use = [] } = $$props;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let element;

    	function getElement() {
    		return element;
    	}

    	function ul_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		use,
    		forwardEvents,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		ul_binding
    	];
    }

    class Ul$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$L, create_fragment$Q, safe_not_equal, { use: 0, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Ul",
    			options,
    			id: create_fragment$Q.name
    		});
    	}

    	get use() {
    		throw new Error("<Ul>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Ul>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Ul>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const A = A$1;
    const Button = Button$1;
    const Div = Div$1;
    const H2 = H2$1;
    const H3 = H3$1;
    const H5 = H5$1;
    const H6 = H6$1;
    const Hr = Hr$1;
    const Li = Li$1;
    const Nav = Nav$1;
    const Span = Span$1;
    const Svg$1 = Svg$2;
    const Ul = Ul$1;

    /**
     * @license
     * Copyright 2019 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * Determine whether the current browser supports passive event listeners, and
     * if so, use them.
     */
    function applyPassive$1(globalObj) {
        if (globalObj === void 0) { globalObj = window; }
        return supportsPassiveOption(globalObj) ?
            { passive: true } :
            false;
    }
    function supportsPassiveOption(globalObj) {
        if (globalObj === void 0) { globalObj = window; }
        // See
        // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
        var passiveSupported = false;
        try {
            var options = {
                // This function will be called when the browser
                // attempts to access the passive property.
                get passive() {
                    passiveSupported = true;
                    return false;
                }
            };
            var handler = function () { };
            globalObj.document.addEventListener('test', handler, options);
            globalObj.document.removeEventListener('test', handler, options);
        }
        catch (err) {
            passiveSupported = false;
        }
        return passiveSupported;
    }

    var events = /*#__PURE__*/Object.freeze({
        __proto__: null,
        applyPassive: applyPassive$1
    });

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
     * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
     */
    function closest(element, selector) {
        if (element.closest) {
            return element.closest(selector);
        }
        var el = element;
        while (el) {
            if (matches$2(el, selector)) {
                return el;
            }
            el = el.parentElement;
        }
        return null;
    }
    function matches$2(element, selector) {
        var nativeMatches = element.matches
            || element.webkitMatchesSelector
            || element.msMatchesSelector;
        return nativeMatches.call(element, selector);
    }
    /**
     * Used to compute the estimated scroll width of elements. When an element is
     * hidden due to display: none; being applied to a parent element, the width is
     * returned as 0. However, the element will have a true width once no longer
     * inside a display: none context. This method computes an estimated width when
     * the element is hidden or returns the true width when the element is visble.
     * @param {Element} element the element whose width to estimate
     */
    function estimateScrollWidth(element) {
        // Check the offsetParent. If the element inherits display: none from any
        // parent, the offsetParent property will be null (see
        // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
        // This check ensures we only clone the node when necessary.
        var htmlEl = element;
        if (htmlEl.offsetParent !== null) {
            return htmlEl.scrollWidth;
        }
        var clone = htmlEl.cloneNode(true);
        clone.style.setProperty('position', 'absolute');
        clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
        document.documentElement.appendChild(clone);
        var scrollWidth = clone.scrollWidth;
        document.documentElement.removeChild(clone);
        return scrollWidth;
    }

    var ponyfill = /*#__PURE__*/Object.freeze({
        __proto__: null,
        closest: closest,
        matches: matches$2,
        estimateScrollWidth: estimateScrollWidth
    });

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$e = {
        // Ripple is a special case where the "root" component is really a "mixin" of sorts,
        // given that it's an 'upgrade' to an existing component. That being said it is the root
        // CSS class that all other CSS classes derive from.
        BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
        FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
        FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
        ROOT: 'mdc-ripple-upgraded',
        UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
    };
    var strings$c = {
        VAR_FG_SCALE: '--mdc-ripple-fg-scale',
        VAR_FG_SIZE: '--mdc-ripple-fg-size',
        VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
        VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
        VAR_LEFT: '--mdc-ripple-left',
        VAR_TOP: '--mdc-ripple-top',
    };
    var numbers$6 = {
        DEACTIVATION_TIMEOUT_MS: 225,
        FG_DEACTIVATION_MS: 150,
        INITIAL_ORIGIN_SCALE: 0.6,
        PADDING: 10,
        TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
    };

    /**
     * Stores result from supportsCssVariables to avoid redundant processing to
     * detect CSS custom variable support.
     */
    var supportsCssVariables_;
    function supportsCssVariables(windowObj, forceRefresh) {
        if (forceRefresh === void 0) { forceRefresh = false; }
        var CSS = windowObj.CSS;
        var supportsCssVars = supportsCssVariables_;
        if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
            return supportsCssVariables_;
        }
        var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
        if (!supportsFunctionPresent) {
            return false;
        }
        var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
        // See: https://bugs.webkit.org/show_bug.cgi?id=154669
        // See: README section on Safari
        var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&
            CSS.supports('color', '#00000000'));
        supportsCssVars =
            explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
        if (!forceRefresh) {
            supportsCssVariables_ = supportsCssVars;
        }
        return supportsCssVars;
    }
    function getNormalizedEventCoords(evt, pageOffset, clientRect) {
        if (!evt) {
            return { x: 0, y: 0 };
        }
        var x = pageOffset.x, y = pageOffset.y;
        var documentX = x + clientRect.left;
        var documentY = y + clientRect.top;
        var normalizedX;
        var normalizedY;
        // Determine touch point relative to the ripple container.
        if (evt.type === 'touchstart') {
            var touchEvent = evt;
            normalizedX = touchEvent.changedTouches[0].pageX - documentX;
            normalizedY = touchEvent.changedTouches[0].pageY - documentY;
        }
        else {
            var mouseEvent = evt;
            normalizedX = mouseEvent.pageX - documentX;
            normalizedY = mouseEvent.pageY - documentY;
        }
        return { x: normalizedX, y: normalizedY };
    }

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    // Activation events registered on the root element of each instance for activation
    var ACTIVATION_EVENT_TYPES = [
        'touchstart', 'pointerdown', 'mousedown', 'keydown',
    ];
    // Deactivation events registered on documentElement when a pointer-related down event occurs
    var POINTER_DEACTIVATION_EVENT_TYPES = [
        'touchend', 'pointerup', 'mouseup', 'contextmenu',
    ];
    // simultaneous nested activations
    var activatedTargets = [];
    var MDCRippleFoundation = /** @class */ (function (_super) {
        __extends(MDCRippleFoundation, _super);
        function MDCRippleFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
            _this.activationAnimationHasEnded = false;
            _this.activationTimer = 0;
            _this.fgDeactivationRemovalTimer = 0;
            _this.fgScale = '0';
            _this.frame = { width: 0, height: 0 };
            _this.initialSize = 0;
            _this.layoutFrame = 0;
            _this.maxRadius = 0;
            _this.unboundedCoords = { left: 0, top: 0 };
            _this.activationState = _this.defaultActivationState();
            _this.activationTimerCallback = function () {
                _this.activationAnimationHasEnded = true;
                _this.runDeactivationUXLogicIfReady();
            };
            _this.activateHandler = function (e) {
                _this.activateImpl(e);
            };
            _this.deactivateHandler = function () {
                _this.deactivateImpl();
            };
            _this.focusHandler = function () {
                _this.handleFocus();
            };
            _this.blurHandler = function () {
                _this.handleBlur();
            };
            _this.resizeHandler = function () {
                _this.layout();
            };
            return _this;
        }
        Object.defineProperty(MDCRippleFoundation, "cssClasses", {
            get: function () {
                return cssClasses$e;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCRippleFoundation, "strings", {
            get: function () {
                return strings$c;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCRippleFoundation, "numbers", {
            get: function () {
                return numbers$6;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClass: function () { return undefined; },
                    browserSupportsCssVars: function () { return true; },
                    computeBoundingRect: function () {
                        return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
                    },
                    containsEventTarget: function () { return true; },
                    deregisterDocumentInteractionHandler: function () { return undefined; },
                    deregisterInteractionHandler: function () { return undefined; },
                    deregisterResizeHandler: function () { return undefined; },
                    getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },
                    isSurfaceActive: function () { return true; },
                    isSurfaceDisabled: function () { return true; },
                    isUnbounded: function () { return true; },
                    registerDocumentInteractionHandler: function () { return undefined; },
                    registerInteractionHandler: function () { return undefined; },
                    registerResizeHandler: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    updateCssVariable: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCRippleFoundation.prototype.init = function () {
            var _this = this;
            var supportsPressRipple = this.supportsPressRipple();
            this.registerRootHandlers(supportsPressRipple);
            if (supportsPressRipple) {
                var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;
                requestAnimationFrame(function () {
                    _this.adapter.addClass(ROOT_1);
                    if (_this.adapter.isUnbounded()) {
                        _this.adapter.addClass(UNBOUNDED_1);
                        // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
                        _this.layoutInternal();
                    }
                });
            }
        };
        MDCRippleFoundation.prototype.destroy = function () {
            var _this = this;
            if (this.supportsPressRipple()) {
                if (this.activationTimer) {
                    clearTimeout(this.activationTimer);
                    this.activationTimer = 0;
                    this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
                }
                if (this.fgDeactivationRemovalTimer) {
                    clearTimeout(this.fgDeactivationRemovalTimer);
                    this.fgDeactivationRemovalTimer = 0;
                    this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
                }
                var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;
                requestAnimationFrame(function () {
                    _this.adapter.removeClass(ROOT_2);
                    _this.adapter.removeClass(UNBOUNDED_2);
                    _this.removeCssVars();
                });
            }
            this.deregisterRootHandlers();
            this.deregisterDeactivationHandlers();
        };
        /**
         * @param evt Optional event containing position information.
         */
        MDCRippleFoundation.prototype.activate = function (evt) {
            this.activateImpl(evt);
        };
        MDCRippleFoundation.prototype.deactivate = function () {
            this.deactivateImpl();
        };
        MDCRippleFoundation.prototype.layout = function () {
            var _this = this;
            if (this.layoutFrame) {
                cancelAnimationFrame(this.layoutFrame);
            }
            this.layoutFrame = requestAnimationFrame(function () {
                _this.layoutInternal();
                _this.layoutFrame = 0;
            });
        };
        MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
            var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
            if (unbounded) {
                this.adapter.addClass(UNBOUNDED);
            }
            else {
                this.adapter.removeClass(UNBOUNDED);
            }
        };
        MDCRippleFoundation.prototype.handleFocus = function () {
            var _this = this;
            requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
        };
        MDCRippleFoundation.prototype.handleBlur = function () {
            var _this = this;
            requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
        };
        /**
         * We compute this property so that we are not querying information about the client
         * until the point in time where the foundation requests it. This prevents scenarios where
         * client-side feature-detection may happen too early, such as when components are rendered on the server
         * and then initialized at mount time on the client.
         */
        MDCRippleFoundation.prototype.supportsPressRipple = function () {
            return this.adapter.browserSupportsCssVars();
        };
        MDCRippleFoundation.prototype.defaultActivationState = function () {
            return {
                activationEvent: undefined,
                hasDeactivationUXRun: false,
                isActivated: false,
                isProgrammatic: false,
                wasActivatedByPointer: false,
                wasElementMadeActive: false,
            };
        };
        /**
         * supportsPressRipple Passed from init to save a redundant function call
         */
        MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
            var e_1, _a;
            if (supportsPressRipple) {
                try {
                    for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
                        var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
                        this.adapter.registerInteractionHandler(evtType, this.activateHandler);
                    }
                }
                catch (e_1_1) { e_1 = { error: e_1_1 }; }
                finally {
                    try {
                        if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
                    }
                    finally { if (e_1) throw e_1.error; }
                }
                if (this.adapter.isUnbounded()) {
                    this.adapter.registerResizeHandler(this.resizeHandler);
                }
            }
            this.adapter.registerInteractionHandler('focus', this.focusHandler);
            this.adapter.registerInteractionHandler('blur', this.blurHandler);
        };
        MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
            var e_2, _a;
            if (evt.type === 'keydown') {
                this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
            }
            else {
                try {
                    for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
                        var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
                        this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
                    }
                }
                catch (e_2_1) { e_2 = { error: e_2_1 }; }
                finally {
                    try {
                        if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
                    }
                    finally { if (e_2) throw e_2.error; }
                }
            }
        };
        MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
            var e_3, _a;
            try {
                for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
                    var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
                    this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
                }
            }
            catch (e_3_1) { e_3 = { error: e_3_1 }; }
            finally {
                try {
                    if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
                }
                finally { if (e_3) throw e_3.error; }
            }
            this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
            this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
            if (this.adapter.isUnbounded()) {
                this.adapter.deregisterResizeHandler(this.resizeHandler);
            }
        };
        MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
            var e_4, _a;
            this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
            try {
                for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
                    var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
                    this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
                }
            }
            catch (e_4_1) { e_4 = { error: e_4_1 }; }
            finally {
                try {
                    if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
                }
                finally { if (e_4) throw e_4.error; }
            }
        };
        MDCRippleFoundation.prototype.removeCssVars = function () {
            var _this = this;
            var rippleStrings = MDCRippleFoundation.strings;
            var keys = Object.keys(rippleStrings);
            keys.forEach(function (key) {
                if (key.indexOf('VAR_') === 0) {
                    _this.adapter.updateCssVariable(rippleStrings[key], null);
                }
            });
        };
        MDCRippleFoundation.prototype.activateImpl = function (evt) {
            var _this = this;
            if (this.adapter.isSurfaceDisabled()) {
                return;
            }
            var activationState = this.activationState;
            if (activationState.isActivated) {
                return;
            }
            // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
            var previousActivationEvent = this.previousActivationEvent;
            var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
            if (isSameInteraction) {
                return;
            }
            activationState.isActivated = true;
            activationState.isProgrammatic = evt === undefined;
            activationState.activationEvent = evt;
            activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
            var hasActivatedChild = evt !== undefined &&
                activatedTargets.length > 0 &&
                activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });
            if (hasActivatedChild) {
                // Immediately reset activation state, while preserving logic that prevents touch follow-on events
                this.resetActivationState();
                return;
            }
            if (evt !== undefined) {
                activatedTargets.push(evt.target);
                this.registerDeactivationHandlers(evt);
            }
            activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
            if (activationState.wasElementMadeActive) {
                this.animateActivation();
            }
            requestAnimationFrame(function () {
                // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
                activatedTargets = [];
                if (!activationState.wasElementMadeActive
                    && evt !== undefined
                    && (evt.key === ' ' || evt.keyCode === 32)) {
                    // If space was pressed, try again within an rAF call to detect :active, because different UAs report
                    // active states inconsistently when they're called within event handling code:
                    // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
                    // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
                    // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
                    // variable is set within a rAF callback for a submit button interaction (#2241).
                    activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
                    if (activationState.wasElementMadeActive) {
                        _this.animateActivation();
                    }
                }
                if (!activationState.wasElementMadeActive) {
                    // Reset activation state immediately if element was not made active.
                    _this.activationState = _this.defaultActivationState();
                }
            });
        };
        MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
            return (evt !== undefined && evt.type === 'keydown') ?
                this.adapter.isSurfaceActive() :
                true;
        };
        MDCRippleFoundation.prototype.animateActivation = function () {
            var _this = this;
            var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
            var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;
            var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
            this.layoutInternal();
            var translateStart = '';
            var translateEnd = '';
            if (!this.adapter.isUnbounded()) {
                var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;
                translateStart = startPoint.x + "px, " + startPoint.y + "px";
                translateEnd = endPoint.x + "px, " + endPoint.y + "px";
            }
            this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
            this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
            // Cancel any ongoing activation/deactivation animations
            clearTimeout(this.activationTimer);
            clearTimeout(this.fgDeactivationRemovalTimer);
            this.rmBoundedActivationClasses();
            this.adapter.removeClass(FG_DEACTIVATION);
            // Force layout in order to re-trigger the animation.
            this.adapter.computeBoundingRect();
            this.adapter.addClass(FG_ACTIVATION);
            this.activationTimer = setTimeout(function () {
                _this.activationTimerCallback();
            }, DEACTIVATION_TIMEOUT_MS);
        };
        MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
            var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;
            var startPoint;
            if (wasActivatedByPointer) {
                startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
            }
            else {
                startPoint = {
                    x: this.frame.width / 2,
                    y: this.frame.height / 2,
                };
            }
            // Center the element around the start point.
            startPoint = {
                x: startPoint.x - (this.initialSize / 2),
                y: startPoint.y - (this.initialSize / 2),
            };
            var endPoint = {
                x: (this.frame.width / 2) - (this.initialSize / 2),
                y: (this.frame.height / 2) - (this.initialSize / 2),
            };
            return { startPoint: startPoint, endPoint: endPoint };
        };
        MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
            var _this = this;
            // This method is called both when a pointing device is released, and when the activation animation ends.
            // The deactivation animation should only run after both of those occur.
            var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
            var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;
            var activationHasEnded = hasDeactivationUXRun || !isActivated;
            if (activationHasEnded && this.activationAnimationHasEnded) {
                this.rmBoundedActivationClasses();
                this.adapter.addClass(FG_DEACTIVATION);
                this.fgDeactivationRemovalTimer = setTimeout(function () {
                    _this.adapter.removeClass(FG_DEACTIVATION);
                }, numbers$6.FG_DEACTIVATION_MS);
            }
        };
        MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
            var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
            this.adapter.removeClass(FG_ACTIVATION);
            this.activationAnimationHasEnded = false;
            this.adapter.computeBoundingRect();
        };
        MDCRippleFoundation.prototype.resetActivationState = function () {
            var _this = this;
            this.previousActivationEvent = this.activationState.activationEvent;
            this.activationState = this.defaultActivationState();
            // Touch devices may fire additional events for the same interaction within a short time.
            // Store the previous event until it's safe to assume that subsequent events are for new interactions.
            setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
        };
        MDCRippleFoundation.prototype.deactivateImpl = function () {
            var _this = this;
            var activationState = this.activationState;
            // This can happen in scenarios such as when you have a keyup event that blurs the element.
            if (!activationState.isActivated) {
                return;
            }
            var state = __assign({}, activationState);
            if (activationState.isProgrammatic) {
                requestAnimationFrame(function () {
                    _this.animateDeactivation(state);
                });
                this.resetActivationState();
            }
            else {
                this.deregisterDeactivationHandlers();
                requestAnimationFrame(function () {
                    _this.activationState.hasDeactivationUXRun = true;
                    _this.animateDeactivation(state);
                    _this.resetActivationState();
                });
            }
        };
        MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
            var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;
            if (wasActivatedByPointer || wasElementMadeActive) {
                this.runDeactivationUXLogicIfReady();
            }
        };
        MDCRippleFoundation.prototype.layoutInternal = function () {
            var _this = this;
            this.frame = this.adapter.computeBoundingRect();
            var maxDim = Math.max(this.frame.height, this.frame.width);
            // Surface diameter is treated differently for unbounded vs. bounded ripples.
            // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
            // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
            // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
            // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
            // `overflow: hidden`.
            var getBoundedRadius = function () {
                var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
                return hypotenuse + MDCRippleFoundation.numbers.PADDING;
            };
            this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
            // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
            var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
            // Unbounded ripple size should always be even number to equally center align.
            if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
                this.initialSize = initialSize - 1;
            }
            else {
                this.initialSize = initialSize;
            }
            this.fgScale = "" + this.maxRadius / this.initialSize;
            this.updateLayoutCssVars();
        };
        MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
            var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE;
            this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
            this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
            if (this.adapter.isUnbounded()) {
                this.unboundedCoords = {
                    left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),
                    top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),
                };
                this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
                this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
            }
        };
        return MDCRippleFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCRipple = /** @class */ (function (_super) {
        __extends(MDCRipple, _super);
        function MDCRipple() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.disabled = false;
            return _this;
        }
        MDCRipple.attachTo = function (root, opts) {
            if (opts === void 0) { opts = {
                isUnbounded: undefined
            }; }
            var ripple = new MDCRipple(root);
            // Only override unbounded behavior if option is explicitly specified
            if (opts.isUnbounded !== undefined) {
                ripple.unbounded = opts.isUnbounded;
            }
            return ripple;
        };
        MDCRipple.createAdapter = function (instance) {
            return {
                addClass: function (className) { return instance.root.classList.add(className); },
                browserSupportsCssVars: function () { return supportsCssVariables(window); },
                computeBoundingRect: function () { return instance.root.getBoundingClientRect(); },
                containsEventTarget: function (target) { return instance.root.contains(target); },
                deregisterDocumentInteractionHandler: function (evtType, handler) {
                    return document.documentElement.removeEventListener(evtType, handler, applyPassive$1());
                },
                deregisterInteractionHandler: function (evtType, handler) {
                    return instance.root
                        .removeEventListener(evtType, handler, applyPassive$1());
                },
                deregisterResizeHandler: function (handler) {
                    return window.removeEventListener('resize', handler);
                },
                getWindowPageOffset: function () {
                    return ({ x: window.pageXOffset, y: window.pageYOffset });
                },
                isSurfaceActive: function () { return matches$2(instance.root, ':active'); },
                isSurfaceDisabled: function () { return Boolean(instance.disabled); },
                isUnbounded: function () { return Boolean(instance.unbounded); },
                registerDocumentInteractionHandler: function (evtType, handler) {
                    return document.documentElement.addEventListener(evtType, handler, applyPassive$1());
                },
                registerInteractionHandler: function (evtType, handler) {
                    return instance.root
                        .addEventListener(evtType, handler, applyPassive$1());
                },
                registerResizeHandler: function (handler) {
                    return window.addEventListener('resize', handler);
                },
                removeClass: function (className) { return instance.root.classList.remove(className); },
                updateCssVariable: function (varName, value) {
                    return instance.root.style.setProperty(varName, value);
                },
            };
        };
        Object.defineProperty(MDCRipple.prototype, "unbounded", {
            get: function () {
                return Boolean(this.isUnbounded);
            },
            set: function (unbounded) {
                this.isUnbounded = Boolean(unbounded);
                this.setUnbounded();
            },
            enumerable: false,
            configurable: true
        });
        MDCRipple.prototype.activate = function () {
            this.foundation.activate();
        };
        MDCRipple.prototype.deactivate = function () {
            this.foundation.deactivate();
        };
        MDCRipple.prototype.layout = function () {
            this.foundation.layout();
        };
        MDCRipple.prototype.getDefaultFoundation = function () {
            return new MDCRippleFoundation(MDCRipple.createAdapter(this));
        };
        MDCRipple.prototype.initialSyncWithDOM = function () {
            var root = this.root;
            this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
        };
        /**
         * Closure Compiler throws an access control error when directly accessing a
         * protected or private property inside a getter/setter, like unbounded above.
         * By accessing the protected property inside a method, we solve that problem.
         * That's why this function exists.
         */
        MDCRipple.prototype.setUnbounded = function () {
            this.foundation.setUnbounded(Boolean(this.isUnbounded));
        };
        return MDCRipple;
    }(MDCComponent));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$d = {
        ICON_BUTTON_ON: 'mdc-icon-button--on',
        ROOT: 'mdc-icon-button',
    };
    var strings$b = {
        ARIA_LABEL: 'aria-label',
        ARIA_PRESSED: 'aria-pressed',
        DATA_ARIA_LABEL_OFF: 'data-aria-label-off',
        DATA_ARIA_LABEL_ON: 'data-aria-label-on',
        CHANGE_EVENT: 'MDCIconButtonToggle:change',
    };

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCIconButtonToggleFoundation = /** @class */ (function (_super) {
        __extends(MDCIconButtonToggleFoundation, _super);
        function MDCIconButtonToggleFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this;
            /**
             * Whether the icon button has an aria label that changes depending on
             * toggled state.
             */
            _this.hasToggledAriaLabel = false;
            return _this;
        }
        Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", {
            get: function () {
                return cssClasses$d;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCIconButtonToggleFoundation, "strings", {
            get: function () {
                return strings$b;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    notifyChange: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    getAttr: function () { return null; },
                    setAttr: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCIconButtonToggleFoundation.prototype.init = function () {
            var ariaLabelOn = this.adapter.getAttr(strings$b.DATA_ARIA_LABEL_ON);
            var ariaLabelOff = this.adapter.getAttr(strings$b.DATA_ARIA_LABEL_OFF);
            if (ariaLabelOn && ariaLabelOff) {
                if (this.adapter.getAttr(strings$b.ARIA_PRESSED) !== null) {
                    throw new Error('MDCIconButtonToggleFoundation: Button should not set ' +
                        '`aria-pressed` if it has a toggled aria label.');
                }
                this.hasToggledAriaLabel = true;
            }
            else {
                this.adapter.setAttr(strings$b.ARIA_PRESSED, String(this.isOn()));
            }
        };
        MDCIconButtonToggleFoundation.prototype.handleClick = function () {
            this.toggle();
            this.adapter.notifyChange({ isOn: this.isOn() });
        };
        MDCIconButtonToggleFoundation.prototype.isOn = function () {
            return this.adapter.hasClass(cssClasses$d.ICON_BUTTON_ON);
        };
        MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) {
            if (isOn === void 0) { isOn = !this.isOn(); }
            // Toggle UI based on state.
            if (isOn) {
                this.adapter.addClass(cssClasses$d.ICON_BUTTON_ON);
            }
            else {
                this.adapter.removeClass(cssClasses$d.ICON_BUTTON_ON);
            }
            // Toggle aria attributes based on state.
            if (this.hasToggledAriaLabel) {
                var ariaLabel = isOn ?
                    this.adapter.getAttr(strings$b.DATA_ARIA_LABEL_ON) :
                    this.adapter.getAttr(strings$b.DATA_ARIA_LABEL_OFF);
                this.adapter.setAttr(strings$b.ARIA_LABEL, ariaLabel || '');
            }
            else {
                this.adapter.setAttr(strings$b.ARIA_PRESSED, "" + isOn);
            }
        };
        return MDCIconButtonToggleFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * KEY provides normalized string values for keys.
     */
    var KEY = {
        UNKNOWN: 'Unknown',
        BACKSPACE: 'Backspace',
        ENTER: 'Enter',
        SPACEBAR: 'Spacebar',
        PAGE_UP: 'PageUp',
        PAGE_DOWN: 'PageDown',
        END: 'End',
        HOME: 'Home',
        ARROW_LEFT: 'ArrowLeft',
        ARROW_UP: 'ArrowUp',
        ARROW_RIGHT: 'ArrowRight',
        ARROW_DOWN: 'ArrowDown',
        DELETE: 'Delete',
        ESCAPE: 'Escape',
        TAB: 'Tab',
    };
    var normalizedKeys = new Set();
    // IE11 has no support for new Map with iterable so we need to initialize this
    // by hand.
    normalizedKeys.add(KEY.BACKSPACE);
    normalizedKeys.add(KEY.ENTER);
    normalizedKeys.add(KEY.SPACEBAR);
    normalizedKeys.add(KEY.PAGE_UP);
    normalizedKeys.add(KEY.PAGE_DOWN);
    normalizedKeys.add(KEY.END);
    normalizedKeys.add(KEY.HOME);
    normalizedKeys.add(KEY.ARROW_LEFT);
    normalizedKeys.add(KEY.ARROW_UP);
    normalizedKeys.add(KEY.ARROW_RIGHT);
    normalizedKeys.add(KEY.ARROW_DOWN);
    normalizedKeys.add(KEY.DELETE);
    normalizedKeys.add(KEY.ESCAPE);
    normalizedKeys.add(KEY.TAB);
    var KEY_CODE = {
        BACKSPACE: 8,
        ENTER: 13,
        SPACEBAR: 32,
        PAGE_UP: 33,
        PAGE_DOWN: 34,
        END: 35,
        HOME: 36,
        ARROW_LEFT: 37,
        ARROW_UP: 38,
        ARROW_RIGHT: 39,
        ARROW_DOWN: 40,
        DELETE: 46,
        ESCAPE: 27,
        TAB: 9,
    };
    var mappedKeyCodes = new Map();
    // IE11 has no support for new Map with iterable so we need to initialize this
    // by hand.
    mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
    mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
    mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
    mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
    mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
    mappedKeyCodes.set(KEY_CODE.END, KEY.END);
    mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
    mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
    mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
    mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
    mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
    mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
    mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
    mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
    var navigationKeys$1 = new Set();
    // IE11 has no support for new Set with iterable so we need to initialize this
    // by hand.
    navigationKeys$1.add(KEY.PAGE_UP);
    navigationKeys$1.add(KEY.PAGE_DOWN);
    navigationKeys$1.add(KEY.END);
    navigationKeys$1.add(KEY.HOME);
    navigationKeys$1.add(KEY.ARROW_LEFT);
    navigationKeys$1.add(KEY.ARROW_UP);
    navigationKeys$1.add(KEY.ARROW_RIGHT);
    navigationKeys$1.add(KEY.ARROW_DOWN);
    /**
     * normalizeKey returns the normalized string for a navigational action.
     */
    function normalizeKey(evt) {
        var key = evt.key;
        // If the event already has a normalized key, return it
        if (normalizedKeys.has(key)) {
            return key;
        }
        // tslint:disable-next-line:deprecation
        var mappedKey = mappedKeyCodes.get(evt.keyCode);
        if (mappedKey) {
            return mappedKey;
        }
        return KEY.UNKNOWN;
    }
    /**
     * isNavigationEvent returns whether the event is a navigation event
     */
    function isNavigationEvent(evt) {
        return navigationKeys$1.has(normalizeKey(evt));
    }

    const { applyPassive } = events;
    const { matches: matches$1 } = ponyfill;
    function Ripple(node, { ripple = true, surface = false, unbounded = false, disabled = false, color, active, rippleElement, eventTarget, activeTarget, addClass = (className) => node.classList.add(className), removeClass = (className) => node.classList.remove(className), addStyle = (name, value) => node.style.setProperty(name, value), initPromise = Promise.resolve(), } = {}) {
        let instance;
        let addLayoutListener = getContext('SMUI:addLayoutListener');
        let removeLayoutListener;
        let oldActive = active;
        let oldEventTarget = eventTarget;
        let oldActiveTarget = activeTarget;
        function handleProps() {
            if (surface) {
                addClass('mdc-ripple-surface');
                if (color === 'primary') {
                    addClass('smui-ripple-surface--primary');
                    removeClass('smui-ripple-surface--secondary');
                }
                else if (color === 'secondary') {
                    removeClass('smui-ripple-surface--primary');
                    addClass('smui-ripple-surface--secondary');
                }
                else {
                    removeClass('smui-ripple-surface--primary');
                    removeClass('smui-ripple-surface--secondary');
                }
            }
            else {
                removeClass('mdc-ripple-surface');
                removeClass('smui-ripple-surface--primary');
                removeClass('smui-ripple-surface--secondary');
            }
            // Handle activation first.
            if (instance && oldActive !== active) {
                oldActive = active;
                if (active) {
                    instance.activate();
                }
                else if (active === false) {
                    instance.deactivate();
                }
            }
            // Then create/destroy an instance.
            if (ripple && !instance) {
                instance = new MDCRippleFoundation({
                    addClass,
                    browserSupportsCssVars: () => supportsCssVariables(window),
                    computeBoundingRect: () => (rippleElement || node).getBoundingClientRect(),
                    containsEventTarget: (target) => node.contains(target),
                    deregisterDocumentInteractionHandler: (evtType, handler) => document.documentElement.removeEventListener(evtType, handler, applyPassive()),
                    deregisterInteractionHandler: (evtType, handler) => (eventTarget || node).removeEventListener(evtType, handler, applyPassive()),
                    deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler),
                    getWindowPageOffset: () => ({
                        x: window.pageXOffset,
                        y: window.pageYOffset,
                    }),
                    isSurfaceActive: () => active == null ? matches$1(activeTarget || node, ':active') : active,
                    isSurfaceDisabled: () => !!disabled,
                    isUnbounded: () => !!unbounded,
                    registerDocumentInteractionHandler: (evtType, handler) => document.documentElement.addEventListener(evtType, handler, applyPassive()),
                    registerInteractionHandler: (evtType, handler) => (eventTarget || node).addEventListener(evtType, handler, applyPassive()),
                    registerResizeHandler: (handler) => window.addEventListener('resize', handler),
                    removeClass,
                    updateCssVariable: addStyle,
                });
                initPromise.then(() => {
                    if (instance) {
                        instance.init();
                        instance.setUnbounded(unbounded);
                    }
                });
            }
            else if (instance && !ripple) {
                initPromise.then(() => {
                    if (instance) {
                        instance.destroy();
                        instance = undefined;
                    }
                });
            }
            // Now handle event/active targets
            if (instance &&
                (oldEventTarget !== eventTarget || oldActiveTarget !== activeTarget)) {
                oldEventTarget = eventTarget;
                oldActiveTarget = activeTarget;
                instance.destroy();
                requestAnimationFrame(() => {
                    if (instance) {
                        instance.init();
                        instance.setUnbounded(unbounded);
                    }
                });
            }
            if (!ripple && unbounded) {
                addClass('mdc-ripple-upgraded--unbounded');
            }
        }
        handleProps();
        if (addLayoutListener) {
            removeLayoutListener = addLayoutListener(layout);
        }
        function layout() {
            if (instance) {
                instance.layout();
            }
        }
        return {
            update(props) {
                ({
                    ripple,
                    surface,
                    unbounded,
                    disabled,
                    color,
                    active,
                    rippleElement,
                    eventTarget,
                    activeTarget,
                    addClass,
                    removeClass,
                    addStyle,
                    initPromise,
                } = Object.assign({ ripple: true, surface: false, unbounded: false, disabled: false, color: undefined, active: undefined, rippleElement: undefined, eventTarget: undefined, activeTarget: undefined, addClass: (className) => node.classList.add(className), removeClass: (className) => node.classList.remove(className), addStyle: (name, value) => node.style.setProperty(name, value), initPromise: Promise.resolve() }, props));
                handleProps();
            },
            destroy() {
                if (instance) {
                    instance.destroy();
                    instance = undefined;
                    removeClass('mdc-ripple-surface');
                    removeClass('smui-ripple-surface--primary');
                    removeClass('smui-ripple-surface--secondary');
                }
                if (removeLayoutListener) {
                    removeLayoutListener();
                }
            },
        };
    }

    /* node_modules/@smui/icon-button/dist/IconButton.svelte generated by Svelte v3.46.4 */
    const file$F = "node_modules/@smui/icon-button/dist/IconButton.svelte";

    // (61:10) {#if touch}
    function create_if_block$p(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-icon-button__touch");
    			add_location(div, file$F, 60, 21, 1955);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$p.name,
    		type: "if",
    		source: "(61:10) {#if touch}",
    		ctx
    	});

    	return block;
    }

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple,         unbounded: true,         color,         disabled: !!$$restProps.disabled,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-icon-button': true,     'mdc-icon-button--on': !isUninitializedValue(pressed) && pressed,     'mdc-icon-button--touch': touch,     'mdc-icon-button--display-flex': displayFlex,     'smui-icon-button--size-button': size === 'button',     'mdc-icon-button--reduced-size': size === 'mini' || size === 'button',     'mdc-card__action': context === 'card:action',     'mdc-card__action--icon': context === 'card:action',     'mdc-top-app-bar__navigation-icon': context === 'top-app-bar:navigation',     'mdc-top-app-bar__action-item': context === 'top-app-bar:action',     'mdc-snackbar__dismiss': context === 'snackbar:actions',     'mdc-data-table__pagination-button': context === 'data-table:pagination',     'mdc-data-table__sort-icon-button':       context === 'data-table:sortable-header-cell',     'mdc-dialog__close': context === 'dialog:header' && action === 'close',     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   aria-pressed={!isUninitializedValue(pressed)     ? pressed       ? 'true'       : 'false'     : null}   aria-label={pressed ? ariaLabelOn : ariaLabelOff}   data-aria-label-on={ariaLabelOn}   data-aria-label-off={ariaLabelOff}   aria-describedby={ariaDescribedby}   on:click={() => instance && instance.handleClick()}   on:click={() =>     context === 'top-app-bar:navigation' &&     dispatch(getElement(), 'SMUITopAppBarIconButton:nav')}   {href}   {...actionProp}   {...internalAttrs}   {...$$restProps}   >
    function create_default_slot$k(ctx) {
    	let div;
    	let t;
    	let if_block_anchor;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[32].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[36], null);
    	let if_block = /*touch*/ ctx[8] && create_if_block$p(ctx);

    	const block = {
    		c: function create() {
    			div = element("div");
    			t = space();
    			if (default_slot) default_slot.c();
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    			attr_dev(div, "class", "mdc-icon-button__ripple");
    			add_location(div, file$F, 59, 3, 1894);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			insert_dev(target, t, anchor);

    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 32)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[36],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[36])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[36], dirty, null),
    						null
    					);
    				}
    			}

    			if (/*touch*/ ctx[8]) {
    				if (if_block) ; else {
    					if_block = create_if_block$p(ctx);
    					if_block.c();
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				if_block.d(1);
    				if_block = null;
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (detaching) detach_dev(t);
    			if (default_slot) default_slot.d(detaching);
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$k.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple,         unbounded: true,         color,         disabled: !!$$restProps.disabled,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-icon-button': true,     'mdc-icon-button--on': !isUninitializedValue(pressed) && pressed,     'mdc-icon-button--touch': touch,     'mdc-icon-button--display-flex': displayFlex,     'smui-icon-button--size-button': size === 'button',     'mdc-icon-button--reduced-size': size === 'mini' || size === 'button',     'mdc-card__action': context === 'card:action',     'mdc-card__action--icon': context === 'card:action',     'mdc-top-app-bar__navigation-icon': context === 'top-app-bar:navigation',     'mdc-top-app-bar__action-item': context === 'top-app-bar:action',     'mdc-snackbar__dismiss': context === 'snackbar:actions',     'mdc-data-table__pagination-button': context === 'data-table:pagination',     'mdc-data-table__sort-icon-button':       context === 'data-table:sortable-header-cell',     'mdc-dialog__close': context === 'dialog:header' && action === 'close',     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   aria-pressed={!isUninitializedValue(pressed)     ? pressed       ? 'true'       : 'false'     : null}   aria-label={pressed ? ariaLabelOn : ariaLabelOff}   data-aria-label-on={ariaLabelOn}   data-aria-label-off={ariaLabelOff}   aria-describedby={ariaDescribedby}   on:click={() => instance && instance.handleClick()}   on:click={() =>     context === 'top-app-bar:navigation' &&     dispatch(getElement(), 'SMUITopAppBarIconButton:nav')}   {href}   {...actionProp}   {...internalAttrs}   {...$$restProps}   >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$P(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [
    				[
    					Ripple,
    					{
    						ripple: /*ripple*/ ctx[4],
    						unbounded: true,
    						color: /*color*/ ctx[5],
    						disabled: !!/*$$restProps*/ ctx[28].disabled,
    						addClass: /*addClass*/ ctx[25],
    						removeClass: /*removeClass*/ ctx[26],
    						addStyle: /*addStyle*/ ctx[27]
    					}
    				],
    				/*forwardEvents*/ ctx[21],
    				.../*use*/ ctx[1]
    			]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[2]]: true,
    				'mdc-icon-button': true,
    				'mdc-icon-button--on': !/*isUninitializedValue*/ ctx[22](/*pressed*/ ctx[0]) && /*pressed*/ ctx[0],
    				'mdc-icon-button--touch': /*touch*/ ctx[8],
    				'mdc-icon-button--display-flex': /*displayFlex*/ ctx[9],
    				'smui-icon-button--size-button': /*size*/ ctx[10] === 'button',
    				'mdc-icon-button--reduced-size': /*size*/ ctx[10] === 'mini' || /*size*/ ctx[10] === 'button',
    				'mdc-card__action': /*context*/ ctx[23] === 'card:action',
    				'mdc-card__action--icon': /*context*/ ctx[23] === 'card:action',
    				'mdc-top-app-bar__navigation-icon': /*context*/ ctx[23] === 'top-app-bar:navigation',
    				'mdc-top-app-bar__action-item': /*context*/ ctx[23] === 'top-app-bar:action',
    				'mdc-snackbar__dismiss': /*context*/ ctx[23] === 'snackbar:actions',
    				'mdc-data-table__pagination-button': /*context*/ ctx[23] === 'data-table:pagination',
    				'mdc-data-table__sort-icon-button': /*context*/ ctx[23] === 'data-table:sortable-header-cell',
    				'mdc-dialog__close': /*context*/ ctx[23] === 'dialog:header' && /*action*/ ctx[12] === 'close',
    				.../*internalClasses*/ ctx[17]
    			})
    		},
    		{
    			style: Object.entries(/*internalStyles*/ ctx[18]).map(func$g).concat([/*style*/ ctx[3]]).join(' ')
    		},
    		{
    			"aria-pressed": !/*isUninitializedValue*/ ctx[22](/*pressed*/ ctx[0])
    			? /*pressed*/ ctx[0] ? 'true' : 'false'
    			: null
    		},
    		{
    			"aria-label": /*pressed*/ ctx[0]
    			? /*ariaLabelOn*/ ctx[6]
    			: /*ariaLabelOff*/ ctx[7]
    		},
    		{
    			"data-aria-label-on": /*ariaLabelOn*/ ctx[6]
    		},
    		{
    			"data-aria-label-off": /*ariaLabelOff*/ ctx[7]
    		},
    		{
    			"aria-describedby": /*ariaDescribedby*/ ctx[24]
    		},
    		{ href: /*href*/ ctx[11] },
    		/*actionProp*/ ctx[20],
    		/*internalAttrs*/ ctx[19],
    		/*$$restProps*/ ctx[28]
    	];

    	var switch_value = /*component*/ ctx[13];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$k] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[33](switch_instance);
    		switch_instance.$on("click", /*click_handler*/ ctx[34]);
    		switch_instance.$on("click", /*click_handler_1*/ ctx[35]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty[0] & /*ripple, color, $$restProps, addClass, removeClass, addStyle, forwardEvents, use, className, isUninitializedValue, pressed, touch, displayFlex, size, context, action, internalClasses, internalStyles, style, ariaLabelOn, ariaLabelOff, ariaDescribedby, href, actionProp, internalAttrs*/ 536748031)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty[0] & /*ripple, color, $$restProps, addClass, removeClass, addStyle, forwardEvents, use*/ 505413682 && {
    						use: [
    							[
    								Ripple,
    								{
    									ripple: /*ripple*/ ctx[4],
    									unbounded: true,
    									color: /*color*/ ctx[5],
    									disabled: !!/*$$restProps*/ ctx[28].disabled,
    									addClass: /*addClass*/ ctx[25],
    									removeClass: /*removeClass*/ ctx[26],
    									addStyle: /*addStyle*/ ctx[27]
    								}
    							],
    							/*forwardEvents*/ ctx[21],
    							.../*use*/ ctx[1]
    						]
    					},
    					dirty[0] & /*className, isUninitializedValue, pressed, touch, displayFlex, size, context, action, internalClasses*/ 12719877 && {
    						class: classMap({
    							[/*className*/ ctx[2]]: true,
    							'mdc-icon-button': true,
    							'mdc-icon-button--on': !/*isUninitializedValue*/ ctx[22](/*pressed*/ ctx[0]) && /*pressed*/ ctx[0],
    							'mdc-icon-button--touch': /*touch*/ ctx[8],
    							'mdc-icon-button--display-flex': /*displayFlex*/ ctx[9],
    							'smui-icon-button--size-button': /*size*/ ctx[10] === 'button',
    							'mdc-icon-button--reduced-size': /*size*/ ctx[10] === 'mini' || /*size*/ ctx[10] === 'button',
    							'mdc-card__action': /*context*/ ctx[23] === 'card:action',
    							'mdc-card__action--icon': /*context*/ ctx[23] === 'card:action',
    							'mdc-top-app-bar__navigation-icon': /*context*/ ctx[23] === 'top-app-bar:navigation',
    							'mdc-top-app-bar__action-item': /*context*/ ctx[23] === 'top-app-bar:action',
    							'mdc-snackbar__dismiss': /*context*/ ctx[23] === 'snackbar:actions',
    							'mdc-data-table__pagination-button': /*context*/ ctx[23] === 'data-table:pagination',
    							'mdc-data-table__sort-icon-button': /*context*/ ctx[23] === 'data-table:sortable-header-cell',
    							'mdc-dialog__close': /*context*/ ctx[23] === 'dialog:header' && /*action*/ ctx[12] === 'close',
    							.../*internalClasses*/ ctx[17]
    						})
    					},
    					dirty[0] & /*internalStyles, style*/ 262152 && {
    						style: Object.entries(/*internalStyles*/ ctx[18]).map(func$g).concat([/*style*/ ctx[3]]).join(' ')
    					},
    					dirty[0] & /*isUninitializedValue, pressed*/ 4194305 && {
    						"aria-pressed": !/*isUninitializedValue*/ ctx[22](/*pressed*/ ctx[0])
    						? /*pressed*/ ctx[0] ? 'true' : 'false'
    						: null
    					},
    					dirty[0] & /*pressed, ariaLabelOn, ariaLabelOff*/ 193 && {
    						"aria-label": /*pressed*/ ctx[0]
    						? /*ariaLabelOn*/ ctx[6]
    						: /*ariaLabelOff*/ ctx[7]
    					},
    					dirty[0] & /*ariaLabelOn*/ 64 && {
    						"data-aria-label-on": /*ariaLabelOn*/ ctx[6]
    					},
    					dirty[0] & /*ariaLabelOff*/ 128 && {
    						"data-aria-label-off": /*ariaLabelOff*/ ctx[7]
    					},
    					dirty[0] & /*ariaDescribedby*/ 16777216 && {
    						"aria-describedby": /*ariaDescribedby*/ ctx[24]
    					},
    					dirty[0] & /*href*/ 2048 && { href: /*href*/ ctx[11] },
    					dirty[0] & /*actionProp*/ 1048576 && get_spread_object(/*actionProp*/ ctx[20]),
    					dirty[0] & /*internalAttrs*/ 524288 && get_spread_object(/*internalAttrs*/ ctx[19]),
    					dirty[0] & /*$$restProps*/ 268435456 && get_spread_object(/*$$restProps*/ ctx[28])
    				])
    			: {};

    			if (dirty[0] & /*touch*/ 256 | dirty[1] & /*$$scope*/ 32) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[13])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[33](switch_instance);
    					switch_instance.$on("click", /*click_handler*/ ctx[34]);
    					switch_instance.$on("click", /*click_handler_1*/ ctx[35]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[33](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$P.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$g = ([name, value]) => `${name}: ${value};`;

    function instance_1$e($$self, $$props, $$invalidate) {
    	let actionProp;

    	const omit_props_names = [
    		"use","class","style","ripple","color","toggle","pressed","ariaLabelOn","ariaLabelOff","touch","displayFlex","size","href","action","component","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('IconButton', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());

    	let uninitializedValue = () => {
    		
    	};

    	function isUninitializedValue(value) {
    		return value === uninitializedValue;
    	}

    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { ripple = true } = $$props;
    	let { color = undefined } = $$props;
    	let { toggle = false } = $$props;
    	let { pressed = uninitializedValue } = $$props;
    	let { ariaLabelOn = undefined } = $$props;
    	let { ariaLabelOff = undefined } = $$props;
    	let { touch = false } = $$props;
    	let { displayFlex = true } = $$props;
    	let { size = 'normal' } = $$props;
    	let { href = undefined } = $$props;
    	let { action = undefined } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};
    	let internalAttrs = {};
    	let context = getContext('SMUI:icon-button:context');
    	let ariaDescribedby = getContext('SMUI:icon-button:aria-describedby');
    	let { component = href == null ? Button : A } = $$props;
    	let previousDisabled = $$restProps.disabled;
    	setContext('SMUI:icon:context', 'icon-button');
    	let oldToggle = null;

    	onDestroy(() => {
    		instance && instance.destroy();
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(17, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(17, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(18, internalStyles);
    			} else {
    				$$invalidate(18, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(19, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function handleChange(evtData) {
    		$$invalidate(0, pressed = evtData.isOn);
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(15, element);
    		});
    	}

    	const click_handler = () => instance && instance.handleClick();
    	const click_handler_1 = () => context === 'top-app-bar:navigation' && dispatch$1(getElement(), 'SMUITopAppBarIconButton:nav');

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(28, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(1, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(3, style = $$new_props.style);
    		if ('ripple' in $$new_props) $$invalidate(4, ripple = $$new_props.ripple);
    		if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color);
    		if ('toggle' in $$new_props) $$invalidate(29, toggle = $$new_props.toggle);
    		if ('pressed' in $$new_props) $$invalidate(0, pressed = $$new_props.pressed);
    		if ('ariaLabelOn' in $$new_props) $$invalidate(6, ariaLabelOn = $$new_props.ariaLabelOn);
    		if ('ariaLabelOff' in $$new_props) $$invalidate(7, ariaLabelOff = $$new_props.ariaLabelOff);
    		if ('touch' in $$new_props) $$invalidate(8, touch = $$new_props.touch);
    		if ('displayFlex' in $$new_props) $$invalidate(9, displayFlex = $$new_props.displayFlex);
    		if ('size' in $$new_props) $$invalidate(10, size = $$new_props.size);
    		if ('href' in $$new_props) $$invalidate(11, href = $$new_props.href);
    		if ('action' in $$new_props) $$invalidate(12, action = $$new_props.action);
    		if ('component' in $$new_props) $$invalidate(13, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(36, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCIconButtonToggleFoundation,
    		onDestroy,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Ripple,
    		A,
    		Button,
    		forwardEvents,
    		uninitializedValue,
    		isUninitializedValue,
    		use,
    		className,
    		style,
    		ripple,
    		color,
    		toggle,
    		pressed,
    		ariaLabelOn,
    		ariaLabelOff,
    		touch,
    		displayFlex,
    		size,
    		href,
    		action,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		context,
    		ariaDescribedby,
    		component,
    		previousDisabled,
    		oldToggle,
    		hasClass,
    		addClass,
    		removeClass,
    		addStyle,
    		getAttr,
    		addAttr,
    		handleChange,
    		getElement,
    		actionProp
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('uninitializedValue' in $$props) uninitializedValue = $$new_props.uninitializedValue;
    		if ('use' in $$props) $$invalidate(1, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(2, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(3, style = $$new_props.style);
    		if ('ripple' in $$props) $$invalidate(4, ripple = $$new_props.ripple);
    		if ('color' in $$props) $$invalidate(5, color = $$new_props.color);
    		if ('toggle' in $$props) $$invalidate(29, toggle = $$new_props.toggle);
    		if ('pressed' in $$props) $$invalidate(0, pressed = $$new_props.pressed);
    		if ('ariaLabelOn' in $$props) $$invalidate(6, ariaLabelOn = $$new_props.ariaLabelOn);
    		if ('ariaLabelOff' in $$props) $$invalidate(7, ariaLabelOff = $$new_props.ariaLabelOff);
    		if ('touch' in $$props) $$invalidate(8, touch = $$new_props.touch);
    		if ('displayFlex' in $$props) $$invalidate(9, displayFlex = $$new_props.displayFlex);
    		if ('size' in $$props) $$invalidate(10, size = $$new_props.size);
    		if ('href' in $$props) $$invalidate(11, href = $$new_props.href);
    		if ('action' in $$props) $$invalidate(12, action = $$new_props.action);
    		if ('element' in $$props) $$invalidate(15, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(16, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(17, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(18, internalStyles = $$new_props.internalStyles);
    		if ('internalAttrs' in $$props) $$invalidate(19, internalAttrs = $$new_props.internalAttrs);
    		if ('context' in $$props) $$invalidate(23, context = $$new_props.context);
    		if ('ariaDescribedby' in $$props) $$invalidate(24, ariaDescribedby = $$new_props.ariaDescribedby);
    		if ('component' in $$props) $$invalidate(13, component = $$new_props.component);
    		if ('previousDisabled' in $$props) $$invalidate(30, previousDisabled = $$new_props.previousDisabled);
    		if ('oldToggle' in $$props) $$invalidate(31, oldToggle = $$new_props.oldToggle);
    		if ('actionProp' in $$props) $$invalidate(20, actionProp = $$new_props.actionProp);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*action*/ 4096) {
    			$$invalidate(20, actionProp = (() => {
    				if (context === 'data-table:pagination') {
    					switch (action) {
    						case 'first-page':
    							return { 'data-first-page': 'true' };
    						case 'prev-page':
    							return { 'data-prev-page': 'true' };
    						case 'next-page':
    							return { 'data-next-page': 'true' };
    						case 'last-page':
    							return { 'data-last-page': 'true' };
    						default:
    							return { 'data-action': 'true' };
    					}
    				} else if (context === 'dialog:header') {
    					return { 'data-mdc-dialog-action': action };
    				} else {
    					return { action };
    				}
    			})());
    		}

    		if (previousDisabled !== $$restProps.disabled) {
    			const elem = getElement();

    			if ('blur' in elem) {
    				elem.blur();
    			}

    			$$invalidate(30, previousDisabled = $$restProps.disabled);
    		}

    		if ($$self.$$.dirty[0] & /*element, toggle, instance*/ 536969216 | $$self.$$.dirty[1] & /*oldToggle*/ 1) {
    			if (element && getElement() && toggle !== oldToggle) {
    				if (toggle && !instance) {
    					$$invalidate(16, instance = new MDCIconButtonToggleFoundation({
    							addClass,
    							hasClass,
    							notifyChange: evtData => {
    								handleChange(evtData);
    								dispatch$1(getElement(), 'SMUIIconButtonToggle:change', evtData, undefined, true);
    							},
    							removeClass,
    							getAttr,
    							setAttr: addAttr
    						}));

    					instance.init();
    				} else if (!toggle && instance) {
    					instance.destroy();
    					$$invalidate(16, instance = undefined);
    					$$invalidate(17, internalClasses = {});
    					$$invalidate(19, internalAttrs = {});
    				}

    				$$invalidate(31, oldToggle = toggle);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, pressed*/ 65537) {
    			if (instance && !isUninitializedValue(pressed) && instance.isOn() !== pressed) {
    				instance.toggle(pressed);
    			}
    		}
    	};

    	return [
    		pressed,
    		use,
    		className,
    		style,
    		ripple,
    		color,
    		ariaLabelOn,
    		ariaLabelOff,
    		touch,
    		displayFlex,
    		size,
    		href,
    		action,
    		component,
    		getElement,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		actionProp,
    		forwardEvents,
    		isUninitializedValue,
    		context,
    		ariaDescribedby,
    		addClass,
    		removeClass,
    		addStyle,
    		$$restProps,
    		toggle,
    		previousDisabled,
    		oldToggle,
    		slots,
    		switch_instance_binding,
    		click_handler,
    		click_handler_1,
    		$$scope
    	];
    }

    class IconButton extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$e,
    			create_fragment$P,
    			safe_not_equal,
    			{
    				use: 1,
    				class: 2,
    				style: 3,
    				ripple: 4,
    				color: 5,
    				toggle: 29,
    				pressed: 0,
    				ariaLabelOn: 6,
    				ariaLabelOff: 7,
    				touch: 8,
    				displayFlex: 9,
    				size: 10,
    				href: 11,
    				action: 12,
    				component: 13,
    				getElement: 14
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "IconButton",
    			options,
    			id: create_fragment$P.name
    		});
    	}

    	get use() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get color() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set color(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get toggle() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set toggle(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get pressed() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set pressed(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ariaLabelOn() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ariaLabelOn(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ariaLabelOff() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ariaLabelOff(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get touch() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set touch(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get displayFlex() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set displayFlex(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get size() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set size(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get href() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set href(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get action() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set action(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[14];
    	}

    	set getElement(value) {
    		throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/CommonLabel.svelte generated by Svelte v3.46.4 */

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-button__label': context === 'button',     'mdc-fab__label': context === 'fab',     'mdc-tab__text-label': context === 'tab',     'mdc-image-list__label': context === 'image-list',     'mdc-snackbar__label': context === 'snackbar',     'mdc-banner__text': context === 'banner',     'mdc-segmented-button__label': context === 'segmented-button',     'mdc-data-table__pagination-rows-per-page-label':       context === 'data-table:pagination',     'mdc-data-table__header-cell-label':       context === 'data-table:sortable-header-cell',   })}   {...context === 'snackbar' ? { 'aria-atomic': 'false' } : {}}   {tabindex}   {...$$restProps}>
    function create_default_slot$j(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[9].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$j.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-button__label': context === 'button',     'mdc-fab__label': context === 'fab',     'mdc-tab__text-label': context === 'tab',     'mdc-image-list__label': context === 'image-list',     'mdc-snackbar__label': context === 'snackbar',     'mdc-banner__text': context === 'banner',     'mdc-segmented-button__label': context === 'segmented-button',     'mdc-data-table__pagination-rows-per-page-label':       context === 'data-table:pagination',     'mdc-data-table__header-cell-label':       context === 'data-table:sortable-header-cell',   })}   {...context === 'snackbar' ? { 'aria-atomic': 'false' } : {}}   {tabindex}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$O(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [/*forwardEvents*/ ctx[4], .../*use*/ ctx[0]]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-button__label': /*context*/ ctx[5] === 'button',
    				'mdc-fab__label': /*context*/ ctx[5] === 'fab',
    				'mdc-tab__text-label': /*context*/ ctx[5] === 'tab',
    				'mdc-image-list__label': /*context*/ ctx[5] === 'image-list',
    				'mdc-snackbar__label': /*context*/ ctx[5] === 'snackbar',
    				'mdc-banner__text': /*context*/ ctx[5] === 'banner',
    				'mdc-segmented-button__label': /*context*/ ctx[5] === 'segmented-button',
    				'mdc-data-table__pagination-rows-per-page-label': /*context*/ ctx[5] === 'data-table:pagination',
    				'mdc-data-table__header-cell-label': /*context*/ ctx[5] === 'data-table:sortable-header-cell'
    			})
    		},
    		/*context*/ ctx[5] === 'snackbar'
    		? { 'aria-atomic': 'false' }
    		: {},
    		{ tabindex: /*tabindex*/ ctx[6] },
    		/*$$restProps*/ ctx[7]
    	];

    	var switch_value = /*component*/ ctx[2];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$j] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[10](switch_instance);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const switch_instance_changes = (dirty & /*forwardEvents, use, classMap, className, context, tabindex, $$restProps*/ 243)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*forwardEvents, use*/ 17 && {
    						use: [/*forwardEvents*/ ctx[4], .../*use*/ ctx[0]]
    					},
    					dirty & /*classMap, className, context*/ 34 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-button__label': /*context*/ ctx[5] === 'button',
    							'mdc-fab__label': /*context*/ ctx[5] === 'fab',
    							'mdc-tab__text-label': /*context*/ ctx[5] === 'tab',
    							'mdc-image-list__label': /*context*/ ctx[5] === 'image-list',
    							'mdc-snackbar__label': /*context*/ ctx[5] === 'snackbar',
    							'mdc-banner__text': /*context*/ ctx[5] === 'banner',
    							'mdc-segmented-button__label': /*context*/ ctx[5] === 'segmented-button',
    							'mdc-data-table__pagination-rows-per-page-label': /*context*/ ctx[5] === 'data-table:pagination',
    							'mdc-data-table__header-cell-label': /*context*/ ctx[5] === 'data-table:sortable-header-cell'
    						})
    					},
    					dirty & /*context*/ 32 && get_spread_object(/*context*/ ctx[5] === 'snackbar'
    					? { 'aria-atomic': 'false' }
    					: {}),
    					dirty & /*tabindex*/ 64 && { tabindex: /*tabindex*/ ctx[6] },
    					dirty & /*$$restProps*/ 128 && get_spread_object(/*$$restProps*/ ctx[7])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 2048) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[2])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[10](switch_instance);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[10](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$O.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$K($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","component","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('CommonLabel', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let element;
    	let { component = Span$1 } = $$props;
    	const context = getContext('SMUI:label:context');
    	const tabindex = getContext('SMUI:label:tabindex');

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(3, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(7, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('component' in $$new_props) $$invalidate(2, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(11, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		Span: Span$1,
    		forwardEvents,
    		use,
    		className,
    		element,
    		component,
    		context,
    		tabindex,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('element' in $$props) $$invalidate(3, element = $$new_props.element);
    		if ('component' in $$props) $$invalidate(2, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		component,
    		element,
    		forwardEvents,
    		context,
    		tabindex,
    		$$restProps,
    		getElement,
    		slots,
    		switch_instance_binding,
    		$$scope
    	];
    }

    class CommonLabel extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$K, create_fragment$O, safe_not_equal, {
    			use: 0,
    			class: 1,
    			component: 2,
    			getElement: 8
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "CommonLabel",
    			options,
    			id: create_fragment$O.name
    		});
    	}

    	get use() {
    		throw new Error("<CommonLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<CommonLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<CommonLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<CommonLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<CommonLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<CommonLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[8];
    	}

    	set getElement(value) {
    		throw new Error("<CommonLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/CommonIcon.svelte generated by Svelte v3.46.4 */

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-button__icon': context === 'button',     'mdc-fab__icon': context === 'fab',     'mdc-icon-button__icon': context === 'icon-button',     'mdc-icon-button__icon--on': context === 'icon-button' && on,     'mdc-tab__icon': context === 'tab',     'mdc-banner__icon': context === 'banner',     'mdc-segmented-button__icon': context === 'segmented-button',   })}   aria-hidden="true"   {...component === Svg ? { focusable: 'false', tabindex: '-1' } : {}}   {...$$restProps}>
    function create_default_slot$i(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[9].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$i.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-button__icon': context === 'button',     'mdc-fab__icon': context === 'fab',     'mdc-icon-button__icon': context === 'icon-button',     'mdc-icon-button__icon--on': context === 'icon-button' && on,     'mdc-tab__icon': context === 'tab',     'mdc-banner__icon': context === 'banner',     'mdc-segmented-button__icon': context === 'segmented-button',   })}   aria-hidden=\\\"true\\\"   {...component === Svg ? { focusable: 'false', tabindex: '-1' } : {}}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$N(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [/*forwardEvents*/ ctx[5], .../*use*/ ctx[0]]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-button__icon': /*context*/ ctx[6] === 'button',
    				'mdc-fab__icon': /*context*/ ctx[6] === 'fab',
    				'mdc-icon-button__icon': /*context*/ ctx[6] === 'icon-button',
    				'mdc-icon-button__icon--on': /*context*/ ctx[6] === 'icon-button' && /*on*/ ctx[2],
    				'mdc-tab__icon': /*context*/ ctx[6] === 'tab',
    				'mdc-banner__icon': /*context*/ ctx[6] === 'banner',
    				'mdc-segmented-button__icon': /*context*/ ctx[6] === 'segmented-button'
    			})
    		},
    		{ "aria-hidden": "true" },
    		/*component*/ ctx[3] === Svg$2
    		? { focusable: 'false', tabindex: '-1' }
    		: {},
    		/*$$restProps*/ ctx[7]
    	];

    	var switch_value = /*component*/ ctx[3];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$i] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[10](switch_instance);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const switch_instance_changes = (dirty & /*forwardEvents, use, classMap, className, context, on, component, Svg, $$restProps*/ 239)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*forwardEvents, use*/ 33 && {
    						use: [/*forwardEvents*/ ctx[5], .../*use*/ ctx[0]]
    					},
    					dirty & /*classMap, className, context, on*/ 70 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-button__icon': /*context*/ ctx[6] === 'button',
    							'mdc-fab__icon': /*context*/ ctx[6] === 'fab',
    							'mdc-icon-button__icon': /*context*/ ctx[6] === 'icon-button',
    							'mdc-icon-button__icon--on': /*context*/ ctx[6] === 'icon-button' && /*on*/ ctx[2],
    							'mdc-tab__icon': /*context*/ ctx[6] === 'tab',
    							'mdc-banner__icon': /*context*/ ctx[6] === 'banner',
    							'mdc-segmented-button__icon': /*context*/ ctx[6] === 'segmented-button'
    						})
    					},
    					switch_instance_spread_levels[2],
    					dirty & /*component, Svg*/ 8 && get_spread_object(/*component*/ ctx[3] === Svg$2
    					? { focusable: 'false', tabindex: '-1' }
    					: {}),
    					dirty & /*$$restProps*/ 128 && get_spread_object(/*$$restProps*/ ctx[7])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 2048) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[3])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[10](switch_instance);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[10](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$N.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$J($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","on","component","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('CommonIcon', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { on = false } = $$props;
    	let element;
    	let { component = I } = $$props;
    	const context = getContext('SMUI:icon:context');

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(4, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(7, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('on' in $$new_props) $$invalidate(2, on = $$new_props.on);
    		if ('component' in $$new_props) $$invalidate(3, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(11, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		I,
    		Svg: Svg$2,
    		forwardEvents,
    		use,
    		className,
    		on,
    		element,
    		component,
    		context,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('on' in $$props) $$invalidate(2, on = $$new_props.on);
    		if ('element' in $$props) $$invalidate(4, element = $$new_props.element);
    		if ('component' in $$props) $$invalidate(3, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		on,
    		component,
    		element,
    		forwardEvents,
    		context,
    		$$restProps,
    		getElement,
    		slots,
    		switch_instance_binding,
    		$$scope
    	];
    }

    class CommonIcon extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$J, create_fragment$N, safe_not_equal, {
    			use: 0,
    			class: 1,
    			on: 2,
    			component: 3,
    			getElement: 8
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "CommonIcon",
    			options,
    			id: create_fragment$N.name
    		});
    	}

    	get use() {
    		throw new Error("<CommonIcon>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<CommonIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<CommonIcon>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<CommonIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get on() {
    		throw new Error("<CommonIcon>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set on(value) {
    		throw new Error("<CommonIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<CommonIcon>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<CommonIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[8];
    	}

    	set getElement(value) {
    		throw new Error("<CommonIcon>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const subscriber_queue = [];
    /**
     * Creates a `Readable` store that allows reading by subscription.
     * @param value initial value
     * @param {StartStopNotifier}start start and stop notifications for subscriptions
     */
    function readable(value, start) {
        return {
            subscribe: writable(value, start).subscribe
        };
    }
    /**
     * Create a `Writable` store that allows both updating and reading by subscription.
     * @param {*=}value initial value
     * @param {StartStopNotifier=}start start and stop notifications for subscriptions
     */
    function writable(value, start = noop$2) {
        let stop;
        const subscribers = new Set();
        function set(new_value) {
            if (safe_not_equal(value, new_value)) {
                value = new_value;
                if (stop) { // store is ready
                    const run_queue = !subscriber_queue.length;
                    for (const subscriber of subscribers) {
                        subscriber[1]();
                        subscriber_queue.push(subscriber, value);
                    }
                    if (run_queue) {
                        for (let i = 0; i < subscriber_queue.length; i += 2) {
                            subscriber_queue[i][0](subscriber_queue[i + 1]);
                        }
                        subscriber_queue.length = 0;
                    }
                }
            }
        }
        function update(fn) {
            set(fn(value));
        }
        function subscribe(run, invalidate = noop$2) {
            const subscriber = [run, invalidate];
            subscribers.add(subscriber);
            if (subscribers.size === 1) {
                stop = start(set) || noop$2;
            }
            run(value);
            return () => {
                subscribers.delete(subscriber);
                if (subscribers.size === 0) {
                    stop();
                    stop = null;
                }
            };
        }
        return { set, update, subscribe };
    }
    function derived(stores, fn, initial_value) {
        const single = !Array.isArray(stores);
        const stores_array = single
            ? [stores]
            : stores;
        const auto = fn.length < 2;
        return readable(initial_value, (set) => {
            let inited = false;
            const values = [];
            let pending = 0;
            let cleanup = noop$2;
            const sync = () => {
                if (pending) {
                    return;
                }
                cleanup();
                const result = fn(single ? values[0] : values, set);
                if (auto) {
                    set(result);
                }
                else {
                    cleanup = is_function(result) ? result : noop$2;
                }
            };
            const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
                values[i] = value;
                pending &= ~(1 << i);
                if (inited) {
                    sync();
                }
            }, () => {
                pending |= (1 << i);
            }));
            inited = true;
            sync();
            return function stop() {
                run_all(unsubscribers);
                cleanup();
            };
        });
    }

    /* node_modules/@smui/common/dist/ContextFragment.svelte generated by Svelte v3.46.4 */

    function create_fragment$M(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[4].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[3], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 8)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[3],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[3])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[3], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$M.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$I($$self, $$props, $$invalidate) {
    	let $storeValue;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('ContextFragment', slots, ['default']);
    	let { key } = $$props;
    	let { value } = $$props;
    	const storeValue = writable(value);
    	validate_store(storeValue, 'storeValue');
    	component_subscribe($$self, storeValue, value => $$invalidate(5, $storeValue = value));
    	setContext(key, storeValue);

    	onDestroy(() => {
    		storeValue.set(undefined);
    	});

    	const writable_props = ['key', 'value'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<ContextFragment> was created with unknown prop '${key}'`);
    	});

    	$$self.$$set = $$props => {
    		if ('key' in $$props) $$invalidate(1, key = $$props.key);
    		if ('value' in $$props) $$invalidate(2, value = $$props.value);
    		if ('$$scope' in $$props) $$invalidate(3, $$scope = $$props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onDestroy,
    		setContext,
    		writable,
    		key,
    		value,
    		storeValue,
    		$storeValue
    	});

    	$$self.$inject_state = $$props => {
    		if ('key' in $$props) $$invalidate(1, key = $$props.key);
    		if ('value' in $$props) $$invalidate(2, value = $$props.value);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*value*/ 4) {
    			set_store_value(storeValue, $storeValue = value, $storeValue);
    		}
    	};

    	return [storeValue, key, value, $$scope, slots];
    }

    class ContextFragment extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$I, create_fragment$M, safe_not_equal, { key: 1, value: 2 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "ContextFragment",
    			options,
    			id: create_fragment$M.name
    		});

    		const { ctx } = this.$$;
    		const props = options.props || {};

    		if (/*key*/ ctx[1] === undefined && !('key' in props)) {
    			console.warn("<ContextFragment> was created without expected prop 'key'");
    		}

    		if (/*value*/ ctx[2] === undefined && !('value' in props)) {
    			console.warn("<ContextFragment> was created without expected prop 'value'");
    		}
    	}

    	get key() {
    		throw new Error("<ContextFragment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set key(value) {
    		throw new Error("<ContextFragment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get value() {
    		throw new Error("<ContextFragment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set value(value) {
    		throw new Error("<ContextFragment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Label = CommonLabel;
    const Icon = CommonIcon;

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var _a$1, _b;
    var cssClasses$c = {
        LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
        LIST_ITEM_CLASS: 'mdc-list-item',
        LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
        LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
        LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
        LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
        ROOT: 'mdc-list',
    };
    (_a$1 = {},
        _a$1["" + cssClasses$c.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated',
        _a$1["" + cssClasses$c.LIST_ITEM_CLASS] = 'mdc-list-item',
        _a$1["" + cssClasses$c.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled',
        _a$1["" + cssClasses$c.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected',
        _a$1["" + cssClasses$c.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text',
        _a$1["" + cssClasses$c.ROOT] = 'mdc-list',
        _a$1);
    var deprecatedClassNameMap = (_b = {},
        _b["" + cssClasses$c.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated',
        _b["" + cssClasses$c.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item',
        _b["" + cssClasses$c.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled',
        _b["" + cssClasses$c.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected',
        _b["" + cssClasses$c.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text',
        _b["" + cssClasses$c.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text',
        _b["" + cssClasses$c.ROOT] = 'mdc-deprecated-list',
        _b);
    var strings$a = {
        ACTION_EVENT: 'MDCList:action',
        ARIA_CHECKED: 'aria-checked',
        ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
        ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
        ARIA_CURRENT: 'aria-current',
        ARIA_DISABLED: 'aria-disabled',
        ARIA_ORIENTATION: 'aria-orientation',
        ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
        ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
        ARIA_SELECTED: 'aria-selected',
        ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
        ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
        CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
        CHECKBOX_SELECTOR: 'input[type="checkbox"]',
        CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n    ." + cssClasses$c.LIST_ITEM_CLASS + " button:not(:disabled),\n    ." + cssClasses$c.LIST_ITEM_CLASS + " a,\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " button:not(:disabled),\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " a\n  ",
        DEPRECATED_SELECTOR: '.mdc-deprecated-list',
        FOCUSABLE_CHILD_ELEMENTS: "\n    ." + cssClasses$c.LIST_ITEM_CLASS + " button:not(:disabled),\n    ." + cssClasses$c.LIST_ITEM_CLASS + " a,\n    ." + cssClasses$c.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n    ." + cssClasses$c.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " button:not(:disabled),\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " a,\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n    ." + deprecatedClassNameMap[cssClasses$c.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n  ",
        RADIO_SELECTOR: 'input[type="radio"]',
        SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]',
    };
    var numbers$5 = {
        UNSET_INDEX: -1,
        TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
    /**
     * Ensures that preventDefault is only called if the containing element
     * doesn't consume the event, and it will cause an unintended scroll.
     *
     * @param evt keyboard event to be prevented.
     */
    var preventDefaultEvent = function (evt) {
        var target = evt.target;
        if (!target) {
            return;
        }
        var tagName = ("" + target.tagName).toLowerCase();
        if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
            evt.preventDefault();
        }
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * Initializes a state object for typeahead. Use the same reference for calls to
     * typeahead functions.
     *
     * @return The current state of the typeahead process. Each state reference
     *     represents a typeahead instance as the reference is typically mutated
     *     in-place.
     */
    function initState() {
        var state = {
            bufferClearTimeout: 0,
            currentFirstChar: '',
            sortedIndexCursor: 0,
            typeaheadBuffer: '',
        };
        return state;
    }
    /**
     * Initializes typeahead state by indexing the current list items by primary
     * text into the sortedIndexByFirstChar data structure.
     *
     * @param listItemCount numer of items in the list
     * @param getPrimaryTextByItemIndex function that returns the primary text at a
     *     given index
     *
     * @return Map that maps the first character of the primary text to the full
     *     list text and it's index
     */
    function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
        var sortedIndexByFirstChar = new Map();
        // Aggregate item text to index mapping
        for (var i = 0; i < listItemCount; i++) {
            var primaryText = getPrimaryTextByItemIndex(i).trim();
            if (!primaryText) {
                continue;
            }
            var firstChar = primaryText[0].toLowerCase();
            if (!sortedIndexByFirstChar.has(firstChar)) {
                sortedIndexByFirstChar.set(firstChar, []);
            }
            sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
        }
        // Sort the mapping
        // TODO(b/157162694): Investigate replacing forEach with Map.values()
        sortedIndexByFirstChar.forEach(function (values) {
            values.sort(function (first, second) {
                return first.index - second.index;
            });
        });
        return sortedIndexByFirstChar;
    }
    /**
     * Given the next desired character from the user, it attempts to find the next
     * list option matching the buffer. Wraps around if at the end of options.
     *
     * @param opts Options and accessors
     *   - nextChar - the next character to match against items
     *   - sortedIndexByFirstChar - output of `initSortedIndex(...)`
     *   - focusedItemIndex - the index of the currently focused item
     *   - focusItemAtIndex - function that focuses a list item at given index
     *   - skipFocus - whether or not to focus the matched item
     *   - isItemAtIndexDisabled - function that determines whether an item at a
     *        given index is disabled
     * @param state The typeahead state instance. See `initState`.
     *
     * @return The index of the matched item, or -1 if no match.
     */
    function matchItem(opts, state) {
        var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
        clearTimeout(state.bufferClearTimeout);
        state.bufferClearTimeout = setTimeout(function () {
            clearBuffer(state);
        }, numbers$5.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
        state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
        var index;
        if (state.typeaheadBuffer.length === 1) {
            index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
        }
        else {
            index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
        }
        if (index !== -1 && !skipFocus) {
            focusItemAtIndex(index);
        }
        return index;
    }
    /**
     * Matches the user's single input character in the buffer to the
     * next option that begins with such character. Wraps around if at
     * end of options. Returns -1 if no match is found.
     */
    function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) {
        var firstChar = state.typeaheadBuffer[0];
        var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
        if (!itemsMatchingFirstChar) {
            return -1;
        }
        // Has the same firstChar been recently matched?
        // Also, did starting index remain the same between key presses?
        // If both hold true, simply increment index.
        if (firstChar === state.currentFirstChar &&
            itemsMatchingFirstChar[state.sortedIndexCursor].index ===
                focusedItemIndex) {
            state.sortedIndexCursor =
                (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
            var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index;
            if (!isItemAtIndexDisabled(newIndex)) {
                return newIndex;
            }
        }
        // If we're here, it means one of the following happened:
        // - either firstChar or startingIndex has changed, invalidating the
        // cursor.
        // - The next item of typeahead is disabled, so we have to look further.
        state.currentFirstChar = firstChar;
        var newCursorPosition = -1;
        var cursorPosition;
        // Find the first non-disabled item as a fallback.
        for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
            if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
                newCursorPosition = cursorPosition;
                break;
            }
        }
        // Advance cursor to first item matching the firstChar that is positioned
        // after starting item. Cursor is unchanged from fallback if there's no
        // such item.
        for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
            if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex &&
                !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
                newCursorPosition = cursorPosition;
                break;
            }
        }
        if (newCursorPosition !== -1) {
            state.sortedIndexCursor = newCursorPosition;
            return itemsMatchingFirstChar[state.sortedIndexCursor].index;
        }
        return -1;
    }
    /**
     * Attempts to find the next item that matches all of the typeahead buffer.
     * Wraps around if at end of options. Returns -1 if no match is found.
     */
    function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) {
        var firstChar = state.typeaheadBuffer[0];
        var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
        if (!itemsMatchingFirstChar) {
            return -1;
        }
        // Do nothing if text already matches
        var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor];
        if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 &&
            !isItemAtIndexDisabled(startingItem.index)) {
            return startingItem.index;
        }
        // Find next item that matches completely; if no match, we'll eventually
        // loop around to same position
        var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
        var nextCursorPosition = -1;
        while (cursorPosition !== state.sortedIndexCursor) {
            var currentItem = itemsMatchingFirstChar[cursorPosition];
            var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0;
            var isEnabled = !isItemAtIndexDisabled(currentItem.index);
            if (matches && isEnabled) {
                nextCursorPosition = cursorPosition;
                break;
            }
            cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length;
        }
        if (nextCursorPosition !== -1) {
            state.sortedIndexCursor = nextCursorPosition;
            return itemsMatchingFirstChar[state.sortedIndexCursor].index;
        }
        return -1;
    }
    /**
     * Whether or not the given typeahead instaance state is currently typing.
     *
     * @param state The typeahead state instance. See `initState`.
     */
    function isTypingInProgress(state) {
        return state.typeaheadBuffer.length > 0;
    }
    /**
     * Clears the typeahaed buffer so that it resets item matching to the first
     * character.
     *
     * @param state The typeahead state instance. See `initState`.
     */
    function clearBuffer(state) {
        state.typeaheadBuffer = '';
    }
    /**
     * Given a keydown event, it calculates whether or not to automatically focus a
     * list item depending on what was typed mimicing the typeahead functionality of
     * a standard <select> element that is open.
     *
     * @param opts Options and accessors
     *   - event - the KeyboardEvent to handle and parse
     *   - sortedIndexByFirstChar - output of `initSortedIndex(...)`
     *   - focusedItemIndex - the index of the currently focused item
     *   - focusItemAtIndex - function that focuses a list item at given index
     *   - isItemAtFocusedIndexDisabled - whether or not the currently focused item
     *      is disabled
     *   - isTargetListItem - whether or not the event target is a list item
     * @param state The typeahead state instance. See `initState`.
     *
     * @returns index of the item matched by the keydown. -1 if not matched.
     */
    function handleKeydown(opts, state) {
        var event = opts.event, isTargetListItem = opts.isTargetListItem, focusedItemIndex = opts.focusedItemIndex, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
        var isArrowLeft = normalizeKey(event) === 'ArrowLeft';
        var isArrowUp = normalizeKey(event) === 'ArrowUp';
        var isArrowRight = normalizeKey(event) === 'ArrowRight';
        var isArrowDown = normalizeKey(event) === 'ArrowDown';
        var isHome = normalizeKey(event) === 'Home';
        var isEnd = normalizeKey(event) === 'End';
        var isEnter = normalizeKey(event) === 'Enter';
        var isSpace = normalizeKey(event) === 'Spacebar';
        if (event.ctrlKey || event.metaKey || isArrowLeft || isArrowUp ||
            isArrowRight || isArrowDown || isHome || isEnd || isEnter) {
            return -1;
        }
        var isCharacterKey = !isSpace && event.key.length === 1;
        if (isCharacterKey) {
            preventDefaultEvent(event);
            var matchItemOpts = {
                focusItemAtIndex: focusItemAtIndex,
                focusedItemIndex: focusedItemIndex,
                nextChar: event.key.toLowerCase(),
                sortedIndexByFirstChar: sortedIndexByFirstChar,
                skipFocus: false,
                isItemAtIndexDisabled: isItemAtIndexDisabled,
            };
            return matchItem(matchItemOpts, state);
        }
        if (!isSpace) {
            return -1;
        }
        if (isTargetListItem) {
            preventDefaultEvent(event);
        }
        var typeaheadOnListItem = isTargetListItem && isTypingInProgress(state);
        if (typeaheadOnListItem) {
            var matchItemOpts = {
                focusItemAtIndex: focusItemAtIndex,
                focusedItemIndex: focusedItemIndex,
                nextChar: ' ',
                sortedIndexByFirstChar: sortedIndexByFirstChar,
                skipFocus: false,
                isItemAtIndexDisabled: isItemAtIndexDisabled,
            };
            // space participates in typeahead matching if in rapid typing mode
            return matchItem(matchItemOpts, state);
        }
        return -1;
    }

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    function isNumberArray$1(selectedIndex) {
        return selectedIndex instanceof Array;
    }
    var MDCListFoundation = /** @class */ (function (_super) {
        __extends(MDCListFoundation, _super);
        function MDCListFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this;
            _this.wrapFocus = false;
            _this.isVertical = true;
            _this.isSingleSelectionList = false;
            _this.selectedIndex = numbers$5.UNSET_INDEX;
            _this.focusedItemIndex = numbers$5.UNSET_INDEX;
            _this.useActivatedClass = false;
            _this.useSelectedAttr = false;
            _this.ariaCurrentAttrValue = null;
            _this.isCheckboxList = false;
            _this.isRadioList = false;
            _this.hasTypeahead = false;
            // Transiently holds current typeahead prefix from user.
            _this.typeaheadState = initState();
            _this.sortedIndexByFirstChar = new Map();
            return _this;
        }
        Object.defineProperty(MDCListFoundation, "strings", {
            get: function () {
                return strings$a;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCListFoundation, "cssClasses", {
            get: function () {
                return cssClasses$c;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCListFoundation, "numbers", {
            get: function () {
                return numbers$5;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCListFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClassForElementIndex: function () { return undefined; },
                    focusItemAtIndex: function () { return undefined; },
                    getAttributeForElementIndex: function () { return null; },
                    getFocusedElementIndex: function () { return 0; },
                    getListItemCount: function () { return 0; },
                    hasCheckboxAtIndex: function () { return false; },
                    hasRadioAtIndex: function () { return false; },
                    isCheckboxCheckedAtIndex: function () { return false; },
                    isFocusInsideList: function () { return false; },
                    isRootFocused: function () { return false; },
                    listItemAtIndexHasClass: function () { return false; },
                    notifyAction: function () { return undefined; },
                    removeClassForElementIndex: function () { return undefined; },
                    setAttributeForElementIndex: function () { return undefined; },
                    setCheckedCheckboxOrRadioAtIndex: function () { return undefined; },
                    setTabIndexForListItemChildren: function () { return undefined; },
                    getPrimaryTextAtIndex: function () { return ''; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCListFoundation.prototype.layout = function () {
            if (this.adapter.getListItemCount() === 0) {
                return;
            }
            // TODO(b/172274142): consider all items when determining the list's type.
            if (this.adapter.hasCheckboxAtIndex(0)) {
                this.isCheckboxList = true;
            }
            else if (this.adapter.hasRadioAtIndex(0)) {
                this.isRadioList = true;
            }
            else {
                this.maybeInitializeSingleSelection();
            }
            if (this.hasTypeahead) {
                this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
            }
        };
        /** Returns the index of the item that was last focused. */
        MDCListFoundation.prototype.getFocusedItemIndex = function () {
            return this.focusedItemIndex;
        };
        /** Toggles focus wrapping with keyboard navigation. */
        MDCListFoundation.prototype.setWrapFocus = function (value) {
            this.wrapFocus = value;
        };
        /**
         * Toggles orientation direction for keyboard navigation (true for vertical,
         * false for horizontal).
         */
        MDCListFoundation.prototype.setVerticalOrientation = function (value) {
            this.isVertical = value;
        };
        /** Toggles single-selection behavior. */
        MDCListFoundation.prototype.setSingleSelection = function (value) {
            this.isSingleSelectionList = value;
            if (value) {
                this.maybeInitializeSingleSelection();
                this.selectedIndex = this.getSelectedIndexFromDOM();
            }
        };
        /**
         * Automatically determines whether the list is single selection list. If so,
         * initializes the internal state to match the selected item.
         */
        MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
            var selectedItemIndex = this.getSelectedIndexFromDOM();
            if (selectedItemIndex === numbers$5.UNSET_INDEX)
                return;
            var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses$c.LIST_ITEM_ACTIVATED_CLASS);
            if (hasActivatedClass) {
                this.setUseActivatedClass(true);
            }
            this.isSingleSelectionList = true;
            this.selectedIndex = selectedItemIndex;
        };
        /** @return Index of the first selected item based on the DOM state. */
        MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
            var selectedIndex = numbers$5.UNSET_INDEX;
            var listItemsCount = this.adapter.getListItemCount();
            for (var i = 0; i < listItemsCount; i++) {
                var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$c.LIST_ITEM_SELECTED_CLASS);
                var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$c.LIST_ITEM_ACTIVATED_CLASS);
                if (!(hasSelectedClass || hasActivatedClass)) {
                    continue;
                }
                selectedIndex = i;
                break;
            }
            return selectedIndex;
        };
        /**
         * Sets whether typeahead is enabled on the list.
         * @param hasTypeahead Whether typeahead is enabled.
         */
        MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) {
            this.hasTypeahead = hasTypeahead;
            if (hasTypeahead) {
                this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
            }
        };
        /**
         * @return Whether typeahead is currently matching a user-specified prefix.
         */
        MDCListFoundation.prototype.isTypeaheadInProgress = function () {
            return this.hasTypeahead &&
                isTypingInProgress(this.typeaheadState);
        };
        /** Toggle use of the "activated" CSS class. */
        MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
            this.useActivatedClass = useActivated;
        };
        /**
         * Toggles use of the selected attribute (true for aria-selected, false for
         * aria-checked).
         */
        MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) {
            this.useSelectedAttr = useSelected;
        };
        MDCListFoundation.prototype.getSelectedIndex = function () {
            return this.selectedIndex;
        };
        MDCListFoundation.prototype.setSelectedIndex = function (index, _a) {
            var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
            if (!this.isIndexValid(index)) {
                return;
            }
            if (this.isCheckboxList) {
                this.setCheckboxAtIndex(index);
            }
            else if (this.isRadioList) {
                this.setRadioAtIndex(index);
            }
            else {
                this.setSingleSelectionAtIndex(index, { forceUpdate: forceUpdate });
            }
        };
        /**
         * Focus in handler for the list items.
         */
        MDCListFoundation.prototype.handleFocusIn = function (listItemIndex) {
            if (listItemIndex >= 0) {
                this.focusedItemIndex = listItemIndex;
                this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0');
                this.adapter.setTabIndexForListItemChildren(listItemIndex, '0');
            }
        };
        /**
         * Focus out handler for the list items.
         */
        MDCListFoundation.prototype.handleFocusOut = function (listItemIndex) {
            var _this = this;
            if (listItemIndex >= 0) {
                this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1');
                this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1');
            }
            /**
             * Between Focusout & Focusin some browsers do not have focus on any
             * element. Setting a delay to wait till the focus is moved to next element.
             */
            setTimeout(function () {
                if (!_this.adapter.isFocusInsideList()) {
                    _this.setTabindexToFirstSelectedOrFocusedItem();
                }
            }, 0);
        };
        /**
         * Key handler for the list.
         */
        MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) {
            var _this = this;
            var isArrowLeft = normalizeKey(event) === 'ArrowLeft';
            var isArrowUp = normalizeKey(event) === 'ArrowUp';
            var isArrowRight = normalizeKey(event) === 'ArrowRight';
            var isArrowDown = normalizeKey(event) === 'ArrowDown';
            var isHome = normalizeKey(event) === 'Home';
            var isEnd = normalizeKey(event) === 'End';
            var isEnter = normalizeKey(event) === 'Enter';
            var isSpace = normalizeKey(event) === 'Spacebar';
            // Have to check both upper and lower case, because having caps lock on
            // affects the value.
            var isLetterA = event.key === 'A' || event.key === 'a';
            if (this.adapter.isRootFocused()) {
                if (isArrowUp || isEnd) {
                    event.preventDefault();
                    this.focusLastElement();
                }
                else if (isArrowDown || isHome) {
                    event.preventDefault();
                    this.focusFirstElement();
                }
                if (this.hasTypeahead) {
                    var handleKeydownOpts = {
                        event: event,
                        focusItemAtIndex: function (index) {
                            _this.focusItemAtIndex(index);
                        },
                        focusedItemIndex: -1,
                        isTargetListItem: isRootListItem,
                        sortedIndexByFirstChar: this.sortedIndexByFirstChar,
                        isItemAtIndexDisabled: function (index) {
                            return _this.adapter.listItemAtIndexHasClass(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS);
                        },
                    };
                    handleKeydown(handleKeydownOpts, this.typeaheadState);
                }
                return;
            }
            var currentIndex = this.adapter.getFocusedElementIndex();
            if (currentIndex === -1) {
                currentIndex = listItemIndex;
                if (currentIndex < 0) {
                    // If this event doesn't have a mdc-list-item ancestor from the
                    // current list (not from a sublist), return early.
                    return;
                }
            }
            if ((this.isVertical && isArrowDown) ||
                (!this.isVertical && isArrowRight)) {
                preventDefaultEvent(event);
                this.focusNextElement(currentIndex);
            }
            else if ((this.isVertical && isArrowUp) || (!this.isVertical && isArrowLeft)) {
                preventDefaultEvent(event);
                this.focusPrevElement(currentIndex);
            }
            else if (isHome) {
                preventDefaultEvent(event);
                this.focusFirstElement();
            }
            else if (isEnd) {
                preventDefaultEvent(event);
                this.focusLastElement();
            }
            else if (isLetterA && event.ctrlKey && this.isCheckboxList) {
                event.preventDefault();
                this.toggleAll(this.selectedIndex === numbers$5.UNSET_INDEX ?
                    [] :
                    this.selectedIndex);
            }
            else if (isEnter || isSpace) {
                if (isRootListItem) {
                    // Return early if enter key is pressed on anchor element which triggers
                    // synthetic MouseEvent event.
                    var target = event.target;
                    if (target && target.tagName === 'A' && isEnter) {
                        return;
                    }
                    preventDefaultEvent(event);
                    if (this.adapter.listItemAtIndexHasClass(currentIndex, cssClasses$c.LIST_ITEM_DISABLED_CLASS)) {
                        return;
                    }
                    if (!this.isTypeaheadInProgress()) {
                        if (this.isSelectableList()) {
                            this.setSelectedIndexOnAction(currentIndex);
                        }
                        this.adapter.notifyAction(currentIndex);
                    }
                }
            }
            if (this.hasTypeahead) {
                var handleKeydownOpts = {
                    event: event,
                    focusItemAtIndex: function (index) {
                        _this.focusItemAtIndex(index);
                    },
                    focusedItemIndex: this.focusedItemIndex,
                    isTargetListItem: isRootListItem,
                    sortedIndexByFirstChar: this.sortedIndexByFirstChar,
                    isItemAtIndexDisabled: function (index) { return _this.adapter.listItemAtIndexHasClass(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS); },
                };
                handleKeydown(handleKeydownOpts, this.typeaheadState);
            }
        };
        /**
         * Click handler for the list.
         */
        MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
            if (index === numbers$5.UNSET_INDEX) {
                return;
            }
            if (this.adapter.listItemAtIndexHasClass(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS)) {
                return;
            }
            if (this.isSelectableList()) {
                this.setSelectedIndexOnAction(index, toggleCheckbox);
            }
            this.adapter.notifyAction(index);
        };
        /**
         * Focuses the next element on the list.
         */
        MDCListFoundation.prototype.focusNextElement = function (index) {
            var count = this.adapter.getListItemCount();
            var nextIndex = index + 1;
            if (nextIndex >= count) {
                if (this.wrapFocus) {
                    nextIndex = 0;
                }
                else {
                    // Return early because last item is already focused.
                    return index;
                }
            }
            this.focusItemAtIndex(nextIndex);
            return nextIndex;
        };
        /**
         * Focuses the previous element on the list.
         */
        MDCListFoundation.prototype.focusPrevElement = function (index) {
            var prevIndex = index - 1;
            if (prevIndex < 0) {
                if (this.wrapFocus) {
                    prevIndex = this.adapter.getListItemCount() - 1;
                }
                else {
                    // Return early because first item is already focused.
                    return index;
                }
            }
            this.focusItemAtIndex(prevIndex);
            return prevIndex;
        };
        MDCListFoundation.prototype.focusFirstElement = function () {
            this.focusItemAtIndex(0);
            return 0;
        };
        MDCListFoundation.prototype.focusLastElement = function () {
            var lastIndex = this.adapter.getListItemCount() - 1;
            this.focusItemAtIndex(lastIndex);
            return lastIndex;
        };
        MDCListFoundation.prototype.focusInitialElement = function () {
            var initialIndex = this.getFirstSelectedOrFocusedItemIndex();
            this.focusItemAtIndex(initialIndex);
            return initialIndex;
        };
        /**
         * @param itemIndex Index of the list item
         * @param isEnabled Sets the list item to enabled or disabled.
         */
        MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
            if (!this.isIndexValid(itemIndex)) {
                return;
            }
            if (isEnabled) {
                this.adapter.removeClassForElementIndex(itemIndex, cssClasses$c.LIST_ITEM_DISABLED_CLASS);
                this.adapter.setAttributeForElementIndex(itemIndex, strings$a.ARIA_DISABLED, 'false');
            }
            else {
                this.adapter.addClassForElementIndex(itemIndex, cssClasses$c.LIST_ITEM_DISABLED_CLASS);
                this.adapter.setAttributeForElementIndex(itemIndex, strings$a.ARIA_DISABLED, 'true');
            }
        };
        MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, _a) {
            var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
            if (this.selectedIndex === index && !forceUpdate) {
                return;
            }
            var selectedClassName = cssClasses$c.LIST_ITEM_SELECTED_CLASS;
            if (this.useActivatedClass) {
                selectedClassName = cssClasses$c.LIST_ITEM_ACTIVATED_CLASS;
            }
            if (this.selectedIndex !== numbers$5.UNSET_INDEX) {
                this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
            }
            this.setAriaForSingleSelectionAtIndex(index);
            this.setTabindexAtIndex(index);
            if (index !== numbers$5.UNSET_INDEX) {
                this.adapter.addClassForElementIndex(index, selectedClassName);
            }
            this.selectedIndex = index;
        };
        /**
         * Sets aria attribute for single selection at given index.
         */
        MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
            // Detect the presence of aria-current and get the value only during list
            // initialization when it is in unset state.
            if (this.selectedIndex === numbers$5.UNSET_INDEX) {
                this.ariaCurrentAttrValue =
                    this.adapter.getAttributeForElementIndex(index, strings$a.ARIA_CURRENT);
            }
            var isAriaCurrent = this.ariaCurrentAttrValue !== null;
            var ariaAttribute = isAriaCurrent ? strings$a.ARIA_CURRENT : strings$a.ARIA_SELECTED;
            if (this.selectedIndex !== numbers$5.UNSET_INDEX) {
                this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
            }
            if (index !== numbers$5.UNSET_INDEX) {
                var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
                this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
            }
        };
        /**
         * Returns the attribute to use for indicating selection status.
         */
        MDCListFoundation.prototype.getSelectionAttribute = function () {
            return this.useSelectedAttr ? strings$a.ARIA_SELECTED : strings$a.ARIA_CHECKED;
        };
        /**
         * Toggles radio at give index. Radio doesn't change the checked state if it
         * is already checked.
         */
        MDCListFoundation.prototype.setRadioAtIndex = function (index) {
            var selectionAttribute = this.getSelectionAttribute();
            this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);
            if (this.selectedIndex !== numbers$5.UNSET_INDEX) {
                this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
            }
            this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
            this.selectedIndex = index;
        };
        MDCListFoundation.prototype.setCheckboxAtIndex = function (index) {
            var selectionAttribute = this.getSelectionAttribute();
            for (var i = 0; i < this.adapter.getListItemCount(); i++) {
                var isChecked = false;
                if (index.indexOf(i) >= 0) {
                    isChecked = true;
                }
                this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
                this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false');
            }
            this.selectedIndex = index;
        };
        MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
            if (this.focusedItemIndex === numbers$5.UNSET_INDEX && index !== 0) {
                // If some list item was selected set first list item's tabindex to -1.
                // Generally, tabindex is set to 0 on first list item of list that has no
                // preselected items.
                this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1');
            }
            else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) {
                this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1');
            }
            // Set the previous selection's tabindex to -1. We need this because
            // in selection menus that are not visible, programmatically setting an
            // option will not change focus but will change where tabindex should be 0.
            if (!(this.selectedIndex instanceof Array) &&
                this.selectedIndex !== index) {
                this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
            }
            if (index !== numbers$5.UNSET_INDEX) {
                this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
            }
        };
        /**
         * @return Return true if it is single selectin list, checkbox list or radio
         *     list.
         */
        MDCListFoundation.prototype.isSelectableList = function () {
            return this.isSingleSelectionList || this.isCheckboxList ||
                this.isRadioList;
        };
        MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () {
            var targetIndex = this.getFirstSelectedOrFocusedItemIndex();
            this.setTabindexAtIndex(targetIndex);
        };
        MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () {
            // Action lists retain focus on the most recently focused item.
            if (!this.isSelectableList()) {
                return Math.max(this.focusedItemIndex, 0);
            }
            // Single-selection lists focus the selected item.
            if (typeof this.selectedIndex === 'number' &&
                this.selectedIndex !== numbers$5.UNSET_INDEX) {
                return this.selectedIndex;
            }
            // Multiple-selection lists focus the first selected item.
            if (isNumberArray$1(this.selectedIndex) && this.selectedIndex.length > 0) {
                return this.selectedIndex.reduce(function (minIndex, currentIndex) { return Math.min(minIndex, currentIndex); });
            }
            // Selection lists without a selection focus the first item.
            return 0;
        };
        MDCListFoundation.prototype.isIndexValid = function (index) {
            var _this = this;
            if (index instanceof Array) {
                if (!this.isCheckboxList) {
                    throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
                }
                if (index.length === 0) {
                    return true;
                }
                else {
                    return index.some(function (i) { return _this.isIndexInRange(i); });
                }
            }
            else if (typeof index === 'number') {
                if (this.isCheckboxList) {
                    throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
                }
                return this.isIndexInRange(index) ||
                    this.isSingleSelectionList && index === numbers$5.UNSET_INDEX;
            }
            else {
                return false;
            }
        };
        MDCListFoundation.prototype.isIndexInRange = function (index) {
            var listSize = this.adapter.getListItemCount();
            return index >= 0 && index < listSize;
        };
        /**
         * Sets selected index on user action, toggles checkbox / radio based on
         * toggleCheckbox value. User interaction should not toggle list item(s) when
         * disabled.
         */
        MDCListFoundation.prototype.setSelectedIndexOnAction = function (index, toggleCheckbox) {
            if (toggleCheckbox === void 0) { toggleCheckbox = true; }
            if (this.isCheckboxList) {
                this.toggleCheckboxAtIndex(index, toggleCheckbox);
            }
            else {
                this.setSelectedIndex(index);
            }
        };
        MDCListFoundation.prototype.toggleCheckboxAtIndex = function (index, toggleCheckbox) {
            var selectionAttribute = this.getSelectionAttribute();
            var isChecked = this.adapter.isCheckboxCheckedAtIndex(index);
            if (toggleCheckbox) {
                isChecked = !isChecked;
                this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
            }
            this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false');
            // If none of the checkbox items are selected and selectedIndex is not
            // initialized then provide a default value.
            var selectedIndexes = this.selectedIndex === numbers$5.UNSET_INDEX ?
                [] :
                this.selectedIndex.slice();
            if (isChecked) {
                selectedIndexes.push(index);
            }
            else {
                selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; });
            }
            this.selectedIndex = selectedIndexes;
        };
        MDCListFoundation.prototype.focusItemAtIndex = function (index) {
            this.adapter.focusItemAtIndex(index);
            this.focusedItemIndex = index;
        };
        MDCListFoundation.prototype.toggleAll = function (currentlySelectedIndexes) {
            var count = this.adapter.getListItemCount();
            // If all items are selected, deselect everything.
            if (currentlySelectedIndexes.length === count) {
                this.setCheckboxAtIndex([]);
            }
            else {
                // Otherwise select all enabled options.
                var allIndexes = [];
                for (var i = 0; i < count; i++) {
                    if (!this.adapter.listItemAtIndexHasClass(i, cssClasses$c.LIST_ITEM_DISABLED_CLASS) ||
                        currentlySelectedIndexes.indexOf(i) > -1) {
                        allIndexes.push(i);
                    }
                }
                this.setCheckboxAtIndex(allIndexes);
            }
        };
        /**
         * Given the next desired character from the user, adds it to the typeahead
         * buffer. Then, attempts to find the next option matching the buffer. Wraps
         * around if at the end of options.
         *
         * @param nextChar The next character to add to the prefix buffer.
         * @param startingIndex The index from which to start matching. Only relevant
         *     when starting a new match sequence. To start a new match sequence,
         *     clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
         *     to clear after a set interval defined in list foundation. Defaults to
         *     the currently focused index.
         * @return The index of the matched item, or -1 if no match.
         */
        MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) {
            var _this = this;
            if (skipFocus === void 0) { skipFocus = false; }
            var opts = {
                focusItemAtIndex: function (index) {
                    _this.focusItemAtIndex(index);
                },
                focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex,
                nextChar: nextChar,
                sortedIndexByFirstChar: this.sortedIndexByFirstChar,
                skipFocus: skipFocus,
                isItemAtIndexDisabled: function (index) { return _this.adapter.listItemAtIndexHasClass(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS); }
            };
            return matchItem(opts, this.typeaheadState);
        };
        /**
         * Initializes the MDCListTextAndIndex data structure by indexing the current
         * list items by primary text.
         *
         * @return The primary texts of all the list items sorted by first character.
         */
        MDCListFoundation.prototype.typeaheadInitSortedIndex = function () {
            return initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex);
        };
        /**
         * Clears the typeahead buffer.
         */
        MDCListFoundation.prototype.clearTypeaheadBuffer = function () {
            clearBuffer(this.typeaheadState);
        };
        return MDCListFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/list/dist/List.svelte generated by Svelte v3.46.4 */

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-deprecated-list': true,     'mdc-deprecated-list--non-interactive': nonInteractive,     'mdc-deprecated-list--dense': dense,     'mdc-deprecated-list--textual-list': textualList,     'mdc-deprecated-list--avatar-list': avatarList || selectionDialog,     'mdc-deprecated-list--icon-list': iconList,     'mdc-deprecated-list--image-list': imageList,     'mdc-deprecated-list--thumbnail-list': thumbnailList,     'mdc-deprecated-list--video-list': videoList,     'mdc-deprecated-list--two-line': twoLine,     'smui-list--three-line': threeLine && !twoLine,   })}   {role}   on:keydown={(event) =>     instance &&     instance.handleKeydown(       event,       event.target.classList.contains('mdc-deprecated-list-item'),       getListItemIndex(event.target)     )}   on:focusin={(event) =>     instance && instance.handleFocusIn(getListItemIndex(event.target))}   on:focusout={(event) =>     instance && instance.handleFocusOut(getListItemIndex(event.target))}   on:click={(event) =>     instance &&     instance.handleClick(       getListItemIndex(event.target),       !matches(event.target, 'input[type="checkbox"], input[type="radio"]')     )}   on:SMUIListItem:mount={handleItemMount}   on:SMUIListItem:unmount={handleItemUnmount}   on:SMUI:action={handleAction}   {...$$restProps} >
    function create_default_slot$h(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[37].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[43], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 4096)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[43],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[43])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[43], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$h.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     'mdc-deprecated-list': true,     'mdc-deprecated-list--non-interactive': nonInteractive,     'mdc-deprecated-list--dense': dense,     'mdc-deprecated-list--textual-list': textualList,     'mdc-deprecated-list--avatar-list': avatarList || selectionDialog,     'mdc-deprecated-list--icon-list': iconList,     'mdc-deprecated-list--image-list': imageList,     'mdc-deprecated-list--thumbnail-list': thumbnailList,     'mdc-deprecated-list--video-list': videoList,     'mdc-deprecated-list--two-line': twoLine,     'smui-list--three-line': threeLine && !twoLine,   })}   {role}   on:keydown={(event) =>     instance &&     instance.handleKeydown(       event,       event.target.classList.contains('mdc-deprecated-list-item'),       getListItemIndex(event.target)     )}   on:focusin={(event) =>     instance && instance.handleFocusIn(getListItemIndex(event.target))}   on:focusout={(event) =>     instance && instance.handleFocusOut(getListItemIndex(event.target))}   on:click={(event) =>     instance &&     instance.handleClick(       getListItemIndex(event.target),       !matches(event.target, 'input[type=\\\"checkbox\\\"], input[type=\\\"radio\\\"]')     )}   on:SMUIListItem:mount={handleItemMount}   on:SMUIListItem:unmount={handleItemUnmount}   on:SMUI:action={handleAction}   {...$$restProps} >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$L(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [/*forwardEvents*/ ctx[17], .../*use*/ ctx[0]]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-deprecated-list': true,
    				'mdc-deprecated-list--non-interactive': /*nonInteractive*/ ctx[2],
    				'mdc-deprecated-list--dense': /*dense*/ ctx[3],
    				'mdc-deprecated-list--textual-list': /*textualList*/ ctx[4],
    				'mdc-deprecated-list--avatar-list': /*avatarList*/ ctx[5] || /*selectionDialog*/ ctx[18],
    				'mdc-deprecated-list--icon-list': /*iconList*/ ctx[6],
    				'mdc-deprecated-list--image-list': /*imageList*/ ctx[7],
    				'mdc-deprecated-list--thumbnail-list': /*thumbnailList*/ ctx[8],
    				'mdc-deprecated-list--video-list': /*videoList*/ ctx[9],
    				'mdc-deprecated-list--two-line': /*twoLine*/ ctx[10],
    				'smui-list--three-line': /*threeLine*/ ctx[11] && !/*twoLine*/ ctx[10]
    			})
    		},
    		{ role: /*role*/ ctx[15] },
    		/*$$restProps*/ ctx[23]
    	];

    	var switch_value = /*component*/ ctx[12];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$h] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[38](switch_instance);
    		switch_instance.$on("keydown", /*keydown_handler*/ ctx[39]);
    		switch_instance.$on("focusin", /*focusin_handler*/ ctx[40]);
    		switch_instance.$on("focusout", /*focusout_handler*/ ctx[41]);
    		switch_instance.$on("click", /*click_handler*/ ctx[42]);
    		switch_instance.$on("SMUIListItem:mount", /*handleItemMount*/ ctx[19]);
    		switch_instance.$on("SMUIListItem:unmount", /*handleItemUnmount*/ ctx[20]);
    		switch_instance.$on("SMUI:action", /*handleAction*/ ctx[21]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty[0] & /*forwardEvents, use, className, nonInteractive, dense, textualList, avatarList, selectionDialog, iconList, imageList, thumbnailList, videoList, twoLine, threeLine, role, $$restProps*/ 8818687)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty[0] & /*forwardEvents, use*/ 131073 && {
    						use: [/*forwardEvents*/ ctx[17], .../*use*/ ctx[0]]
    					},
    					dirty[0] & /*className, nonInteractive, dense, textualList, avatarList, selectionDialog, iconList, imageList, thumbnailList, videoList, twoLine, threeLine*/ 266238 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-deprecated-list': true,
    							'mdc-deprecated-list--non-interactive': /*nonInteractive*/ ctx[2],
    							'mdc-deprecated-list--dense': /*dense*/ ctx[3],
    							'mdc-deprecated-list--textual-list': /*textualList*/ ctx[4],
    							'mdc-deprecated-list--avatar-list': /*avatarList*/ ctx[5] || /*selectionDialog*/ ctx[18],
    							'mdc-deprecated-list--icon-list': /*iconList*/ ctx[6],
    							'mdc-deprecated-list--image-list': /*imageList*/ ctx[7],
    							'mdc-deprecated-list--thumbnail-list': /*thumbnailList*/ ctx[8],
    							'mdc-deprecated-list--video-list': /*videoList*/ ctx[9],
    							'mdc-deprecated-list--two-line': /*twoLine*/ ctx[10],
    							'smui-list--three-line': /*threeLine*/ ctx[11] && !/*twoLine*/ ctx[10]
    						})
    					},
    					dirty[0] & /*role*/ 32768 && { role: /*role*/ ctx[15] },
    					dirty[0] & /*$$restProps*/ 8388608 && get_spread_object(/*$$restProps*/ ctx[23])
    				])
    			: {};

    			if (dirty[1] & /*$$scope*/ 4096) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[12])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[38](switch_instance);
    					switch_instance.$on("keydown", /*keydown_handler*/ ctx[39]);
    					switch_instance.$on("focusin", /*focusin_handler*/ ctx[40]);
    					switch_instance.$on("focusout", /*focusout_handler*/ ctx[41]);
    					switch_instance.$on("click", /*click_handler*/ ctx[42]);
    					switch_instance.$on("SMUIListItem:mount", /*handleItemMount*/ ctx[19]);
    					switch_instance.$on("SMUIListItem:unmount", /*handleItemUnmount*/ ctx[20]);
    					switch_instance.$on("SMUI:action", /*handleAction*/ ctx[21]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[38](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$L.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance_1$d($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","nonInteractive","dense","textualList","avatarList","iconList","imageList","thumbnailList","videoList","twoLine","threeLine","vertical","wrapFocus","singleSelection","selectedIndex","radioList","checkList","hasTypeahead","component","layout","setEnabled","getTypeaheadInProgress","getSelectedIndex","getFocusedItemIndex","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('List', slots, ['default']);
    	var _a;
    	const { closest, matches } = ponyfill;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { nonInteractive = false } = $$props;
    	let { dense = false } = $$props;
    	let { textualList = false } = $$props;
    	let { avatarList = false } = $$props;
    	let { iconList = false } = $$props;
    	let { imageList = false } = $$props;
    	let { thumbnailList = false } = $$props;
    	let { videoList = false } = $$props;
    	let { twoLine = false } = $$props;
    	let { threeLine = false } = $$props;
    	let { vertical = true } = $$props;

    	let { wrapFocus = (_a = getContext('SMUI:list:wrapFocus')) !== null && _a !== void 0
    	? _a
    	: false } = $$props;

    	let { singleSelection = false } = $$props;
    	let { selectedIndex = -1 } = $$props;
    	let { radioList = false } = $$props;
    	let { checkList = false } = $$props;
    	let { hasTypeahead = false } = $$props;
    	let element;
    	let instance;
    	let items = [];
    	let role = getContext('SMUI:list:role');
    	let nav = getContext('SMUI:list:nav');
    	const itemAccessorMap = new WeakMap();
    	let selectionDialog = getContext('SMUI:dialog:selection');
    	let addLayoutListener = getContext('SMUI:addLayoutListener');
    	let removeLayoutListener;
    	let { component = nav ? Nav : Ul } = $$props;
    	setContext('SMUI:list:nonInteractive', nonInteractive);
    	setContext('SMUI:separator:context', 'list');

    	if (!role) {
    		if (singleSelection) {
    			role = 'listbox';
    			setContext('SMUI:list:item:role', 'option');
    		} else if (radioList) {
    			role = 'radiogroup';
    			setContext('SMUI:list:item:role', 'radio');
    		} else if (checkList) {
    			role = 'group';
    			setContext('SMUI:list:item:role', 'checkbox');
    		} else {
    			role = 'list';
    			setContext('SMUI:list:item:role', undefined);
    		}
    	}

    	if (addLayoutListener) {
    		removeLayoutListener = addLayoutListener(layout);
    	}

    	onMount(() => {
    		$$invalidate(13, instance = new MDCListFoundation({
    				addClassForElementIndex,
    				focusItemAtIndex,
    				getAttributeForElementIndex: (index, name) => {
    					var _a, _b;

    					return (_b = (_a = getOrderedList()[index]) === null || _a === void 0
    					? void 0
    					: _a.getAttr(name)) !== null && _b !== void 0
    					? _b
    					: null;
    				},
    				getFocusedElementIndex: () => document.activeElement
    				? getOrderedList().map(accessor => accessor.element).indexOf(document.activeElement)
    				: -1,
    				getListItemCount: () => items.length,
    				getPrimaryTextAtIndex,
    				hasCheckboxAtIndex: index => {
    					var _a, _b;

    					return (_b = (_a = getOrderedList()[index]) === null || _a === void 0
    					? void 0
    					: _a.hasCheckbox) !== null && _b !== void 0
    					? _b
    					: false;
    				},
    				hasRadioAtIndex: index => {
    					var _a, _b;

    					return (_b = (_a = getOrderedList()[index]) === null || _a === void 0
    					? void 0
    					: _a.hasRadio) !== null && _b !== void 0
    					? _b
    					: false;
    				},
    				isCheckboxCheckedAtIndex: index => {
    					var _a;
    					const listItem = getOrderedList()[index];

    					return (_a = (listItem === null || listItem === void 0
    					? void 0
    					: listItem.hasCheckbox) && listItem.checked) !== null && _a !== void 0
    					? _a
    					: false;
    				},
    				isFocusInsideList: () => element != null && getElement() !== document.activeElement && getElement().contains(document.activeElement),
    				isRootFocused: () => element != null && document.activeElement === getElement(),
    				listItemAtIndexHasClass,
    				notifyAction: index => {
    					$$invalidate(24, selectedIndex = index);

    					if (element != null) {
    						dispatch$1(getElement(), 'SMUIList:action', { index }, undefined, true);
    					}
    				},
    				removeClassForElementIndex,
    				setAttributeForElementIndex,
    				setCheckedCheckboxOrRadioAtIndex: (index, isChecked) => {
    					getOrderedList()[index].checked = isChecked;
    				},
    				setTabIndexForListItemChildren: (listItemIndex, tabIndexValue) => {
    					const listItem = getOrderedList()[listItemIndex];
    					const selector = 'button:not(:disabled), a';

    					Array.prototype.forEach.call(listItem.element.querySelectorAll(selector), el => {
    						el.setAttribute('tabindex', tabIndexValue);
    					});
    				}
    			}));

    		const accessor = {
    			get element() {
    				return getElement();
    			},
    			get items() {
    				return items;
    			},
    			get typeaheadInProgress() {
    				return instance.isTypeaheadInProgress();
    			},
    			typeaheadMatchItem(nextChar, startingIndex) {
    				return instance.typeaheadMatchItem(nextChar, startingIndex, /** skipFocus */
    				true);
    			},
    			getOrderedList,
    			focusItemAtIndex,
    			addClassForElementIndex,
    			removeClassForElementIndex,
    			setAttributeForElementIndex,
    			removeAttributeForElementIndex,
    			getAttributeFromElementIndex,
    			getPrimaryTextAtIndex
    		};

    		dispatch$1(getElement(), 'SMUIList:mount', accessor);
    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	onDestroy(() => {
    		if (removeLayoutListener) {
    			removeLayoutListener();
    		}
    	});

    	function handleItemMount(event) {
    		items.push(event.detail);
    		itemAccessorMap.set(event.detail.element, event.detail);

    		if (singleSelection && event.detail.selected) {
    			$$invalidate(24, selectedIndex = getListItemIndex(event.detail.element));
    		}

    		event.stopPropagation();
    	}

    	function handleItemUnmount(event) {
    		var _a;

    		const idx = (_a = event.detail && items.indexOf(event.detail)) !== null && _a !== void 0
    		? _a
    		: -1;

    		if (idx !== -1) {
    			items.splice(idx, 1);
    			items = items;
    			itemAccessorMap.delete(event.detail.element);
    		}

    		event.stopPropagation();
    	}

    	function handleAction(event) {
    		if (radioList || checkList) {
    			const index = getListItemIndex(event.target);

    			if (index !== -1) {
    				const item = getOrderedList()[index];

    				if (item && (radioList && !item.checked || checkList)) {
    					item.checked = !item.checked;
    					item.activateRipple();

    					window.requestAnimationFrame(() => {
    						item.deactivateRipple();
    					});
    				}
    			}
    		}
    	}

    	function getOrderedList() {
    		if (element == null) {
    			return [];
    		}

    		return [...getElement().children].map(element => itemAccessorMap.get(element)).filter(accessor => accessor && accessor._smui_list_item_accessor);
    	}

    	function focusItemAtIndex(index) {
    		const accessor = getOrderedList()[index];
    		accessor && 'focus' in accessor.element && accessor.element.focus();
    	}

    	function listItemAtIndexHasClass(index, className) {
    		var _a;
    		const accessor = getOrderedList()[index];

    		return (_a = accessor && accessor.hasClass(className)) !== null && _a !== void 0
    		? _a
    		: false;
    	}

    	function addClassForElementIndex(index, className) {
    		const accessor = getOrderedList()[index];
    		accessor && accessor.addClass(className);
    	}

    	function removeClassForElementIndex(index, className) {
    		const accessor = getOrderedList()[index];
    		accessor && accessor.removeClass(className);
    	}

    	function setAttributeForElementIndex(index, name, value) {
    		const accessor = getOrderedList()[index];
    		accessor && accessor.addAttr(name, value);
    	}

    	function removeAttributeForElementIndex(index, name) {
    		const accessor = getOrderedList()[index];
    		accessor && accessor.removeAttr(name);
    	}

    	function getAttributeFromElementIndex(index, name) {
    		const accessor = getOrderedList()[index];

    		if (accessor) {
    			return accessor.getAttr(name);
    		} else {
    			return null;
    		}
    	}

    	function getPrimaryTextAtIndex(index) {
    		var _a;
    		const accessor = getOrderedList()[index];

    		return (_a = accessor && accessor.getPrimaryText()) !== null && _a !== void 0
    		? _a
    		: '';
    	}

    	function getListItemIndex(element) {
    		const nearestParent = closest(element, '.mdc-deprecated-list-item, .mdc-deprecated-list');

    		// Get the index of the element if it is a list item.
    		if (nearestParent && matches(nearestParent, '.mdc-deprecated-list-item')) {
    			return getOrderedList().map(item => item === null || item === void 0 ? void 0 : item.element).indexOf(nearestParent);
    		}

    		return -1;
    	}

    	function layout() {
    		return instance.layout();
    	}

    	function setEnabled(itemIndex, isEnabled) {
    		return instance.setEnabled(itemIndex, isEnabled);
    	}

    	function getTypeaheadInProgress() {
    		return instance.isTypeaheadInProgress();
    	}

    	function getSelectedIndex() {
    		return instance.getSelectedIndex();
    	}

    	function getFocusedItemIndex() {
    		return instance.getFocusedItemIndex();
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(14, element);
    		});
    	}

    	const keydown_handler = event => instance && instance.handleKeydown(event, event.target.classList.contains('mdc-deprecated-list-item'), getListItemIndex(event.target));
    	const focusin_handler = event => instance && instance.handleFocusIn(getListItemIndex(event.target));
    	const focusout_handler = event => instance && instance.handleFocusOut(getListItemIndex(event.target));
    	const click_handler = event => instance && instance.handleClick(getListItemIndex(event.target), !matches(event.target, 'input[type="checkbox"], input[type="radio"]'));

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(23, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('nonInteractive' in $$new_props) $$invalidate(2, nonInteractive = $$new_props.nonInteractive);
    		if ('dense' in $$new_props) $$invalidate(3, dense = $$new_props.dense);
    		if ('textualList' in $$new_props) $$invalidate(4, textualList = $$new_props.textualList);
    		if ('avatarList' in $$new_props) $$invalidate(5, avatarList = $$new_props.avatarList);
    		if ('iconList' in $$new_props) $$invalidate(6, iconList = $$new_props.iconList);
    		if ('imageList' in $$new_props) $$invalidate(7, imageList = $$new_props.imageList);
    		if ('thumbnailList' in $$new_props) $$invalidate(8, thumbnailList = $$new_props.thumbnailList);
    		if ('videoList' in $$new_props) $$invalidate(9, videoList = $$new_props.videoList);
    		if ('twoLine' in $$new_props) $$invalidate(10, twoLine = $$new_props.twoLine);
    		if ('threeLine' in $$new_props) $$invalidate(11, threeLine = $$new_props.threeLine);
    		if ('vertical' in $$new_props) $$invalidate(25, vertical = $$new_props.vertical);
    		if ('wrapFocus' in $$new_props) $$invalidate(26, wrapFocus = $$new_props.wrapFocus);
    		if ('singleSelection' in $$new_props) $$invalidate(27, singleSelection = $$new_props.singleSelection);
    		if ('selectedIndex' in $$new_props) $$invalidate(24, selectedIndex = $$new_props.selectedIndex);
    		if ('radioList' in $$new_props) $$invalidate(28, radioList = $$new_props.radioList);
    		if ('checkList' in $$new_props) $$invalidate(29, checkList = $$new_props.checkList);
    		if ('hasTypeahead' in $$new_props) $$invalidate(30, hasTypeahead = $$new_props.hasTypeahead);
    		if ('component' in $$new_props) $$invalidate(12, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(43, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		_a,
    		MDCListFoundation,
    		ponyfill,
    		onMount,
    		onDestroy,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Ul,
    		Nav,
    		closest,
    		matches,
    		forwardEvents,
    		use,
    		className,
    		nonInteractive,
    		dense,
    		textualList,
    		avatarList,
    		iconList,
    		imageList,
    		thumbnailList,
    		videoList,
    		twoLine,
    		threeLine,
    		vertical,
    		wrapFocus,
    		singleSelection,
    		selectedIndex,
    		radioList,
    		checkList,
    		hasTypeahead,
    		element,
    		instance,
    		items,
    		role,
    		nav,
    		itemAccessorMap,
    		selectionDialog,
    		addLayoutListener,
    		removeLayoutListener,
    		component,
    		handleItemMount,
    		handleItemUnmount,
    		handleAction,
    		getOrderedList,
    		focusItemAtIndex,
    		listItemAtIndexHasClass,
    		addClassForElementIndex,
    		removeClassForElementIndex,
    		setAttributeForElementIndex,
    		removeAttributeForElementIndex,
    		getAttributeFromElementIndex,
    		getPrimaryTextAtIndex,
    		getListItemIndex,
    		layout,
    		setEnabled,
    		getTypeaheadInProgress,
    		getSelectedIndex,
    		getFocusedItemIndex,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('_a' in $$props) _a = $$new_props._a;
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('nonInteractive' in $$props) $$invalidate(2, nonInteractive = $$new_props.nonInteractive);
    		if ('dense' in $$props) $$invalidate(3, dense = $$new_props.dense);
    		if ('textualList' in $$props) $$invalidate(4, textualList = $$new_props.textualList);
    		if ('avatarList' in $$props) $$invalidate(5, avatarList = $$new_props.avatarList);
    		if ('iconList' in $$props) $$invalidate(6, iconList = $$new_props.iconList);
    		if ('imageList' in $$props) $$invalidate(7, imageList = $$new_props.imageList);
    		if ('thumbnailList' in $$props) $$invalidate(8, thumbnailList = $$new_props.thumbnailList);
    		if ('videoList' in $$props) $$invalidate(9, videoList = $$new_props.videoList);
    		if ('twoLine' in $$props) $$invalidate(10, twoLine = $$new_props.twoLine);
    		if ('threeLine' in $$props) $$invalidate(11, threeLine = $$new_props.threeLine);
    		if ('vertical' in $$props) $$invalidate(25, vertical = $$new_props.vertical);
    		if ('wrapFocus' in $$props) $$invalidate(26, wrapFocus = $$new_props.wrapFocus);
    		if ('singleSelection' in $$props) $$invalidate(27, singleSelection = $$new_props.singleSelection);
    		if ('selectedIndex' in $$props) $$invalidate(24, selectedIndex = $$new_props.selectedIndex);
    		if ('radioList' in $$props) $$invalidate(28, radioList = $$new_props.radioList);
    		if ('checkList' in $$props) $$invalidate(29, checkList = $$new_props.checkList);
    		if ('hasTypeahead' in $$props) $$invalidate(30, hasTypeahead = $$new_props.hasTypeahead);
    		if ('element' in $$props) $$invalidate(14, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(13, instance = $$new_props.instance);
    		if ('items' in $$props) items = $$new_props.items;
    		if ('role' in $$props) $$invalidate(15, role = $$new_props.role);
    		if ('nav' in $$props) nav = $$new_props.nav;
    		if ('selectionDialog' in $$props) $$invalidate(18, selectionDialog = $$new_props.selectionDialog);
    		if ('addLayoutListener' in $$props) addLayoutListener = $$new_props.addLayoutListener;
    		if ('removeLayoutListener' in $$props) removeLayoutListener = $$new_props.removeLayoutListener;
    		if ('component' in $$props) $$invalidate(12, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*instance, vertical*/ 33562624) {
    			if (instance) {
    				instance.setVerticalOrientation(vertical);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, wrapFocus*/ 67117056) {
    			if (instance) {
    				instance.setWrapFocus(wrapFocus);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, hasTypeahead*/ 1073750016) {
    			if (instance) {
    				instance.setHasTypeahead(hasTypeahead);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, singleSelection*/ 134225920) {
    			if (instance) {
    				instance.setSingleSelection(singleSelection);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, singleSelection, selectedIndex*/ 151003136) {
    			if (instance && singleSelection && getSelectedIndex() !== selectedIndex) {
    				instance.setSelectedIndex(selectedIndex);
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		nonInteractive,
    		dense,
    		textualList,
    		avatarList,
    		iconList,
    		imageList,
    		thumbnailList,
    		videoList,
    		twoLine,
    		threeLine,
    		component,
    		instance,
    		element,
    		role,
    		matches,
    		forwardEvents,
    		selectionDialog,
    		handleItemMount,
    		handleItemUnmount,
    		handleAction,
    		getListItemIndex,
    		$$restProps,
    		selectedIndex,
    		vertical,
    		wrapFocus,
    		singleSelection,
    		radioList,
    		checkList,
    		hasTypeahead,
    		layout,
    		setEnabled,
    		getTypeaheadInProgress,
    		getSelectedIndex,
    		getFocusedItemIndex,
    		getElement,
    		slots,
    		switch_instance_binding,
    		keydown_handler,
    		focusin_handler,
    		focusout_handler,
    		click_handler,
    		$$scope
    	];
    }

    class List$2 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$d,
    			create_fragment$L,
    			safe_not_equal,
    			{
    				use: 0,
    				class: 1,
    				nonInteractive: 2,
    				dense: 3,
    				textualList: 4,
    				avatarList: 5,
    				iconList: 6,
    				imageList: 7,
    				thumbnailList: 8,
    				videoList: 9,
    				twoLine: 10,
    				threeLine: 11,
    				vertical: 25,
    				wrapFocus: 26,
    				singleSelection: 27,
    				selectedIndex: 24,
    				radioList: 28,
    				checkList: 29,
    				hasTypeahead: 30,
    				component: 12,
    				layout: 31,
    				setEnabled: 32,
    				getTypeaheadInProgress: 33,
    				getSelectedIndex: 34,
    				getFocusedItemIndex: 35,
    				getElement: 36
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "List",
    			options,
    			id: create_fragment$L.name
    		});
    	}

    	get use() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get nonInteractive() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set nonInteractive(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get dense() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set dense(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get textualList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set textualList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get avatarList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set avatarList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get iconList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set iconList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get imageList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set imageList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get thumbnailList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set thumbnailList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get videoList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set videoList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get twoLine() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set twoLine(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get threeLine() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set threeLine(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get vertical() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set vertical(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get wrapFocus() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set wrapFocus(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get singleSelection() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set singleSelection(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selectedIndex() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selectedIndex(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get radioList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set radioList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get checkList() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set checkList(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get hasTypeahead() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set hasTypeahead(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<List>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get layout() {
    		return this.$$.ctx[31];
    	}

    	set layout(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setEnabled() {
    		return this.$$.ctx[32];
    	}

    	set setEnabled(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getTypeaheadInProgress() {
    		return this.$$.ctx[33];
    	}

    	set getTypeaheadInProgress(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getSelectedIndex() {
    		return this.$$.ctx[34];
    	}

    	set getSelectedIndex(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getFocusedItemIndex() {
    		return this.$$.ctx[35];
    	}

    	set getFocusedItemIndex(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[36];
    	}

    	set getElement(value) {
    		throw new Error("<List>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/list/dist/Item.svelte generated by Svelte v3.46.4 */
    const file$E = "node_modules/@smui/list/dist/Item.svelte";

    // (57:3) {#if ripple}
    function create_if_block$o(ctx) {
    	let span;

    	const block = {
    		c: function create() {
    			span = element("span");
    			attr_dev(span, "class", "mdc-deprecated-list-item__ripple");
    			add_location(span, file$E, 56, 15, 1701);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$o.name,
    		type: "if",
    		source: "(57:3) {#if ripple}",
    		ctx
    	});

    	return block;
    }

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[     ...(nonInteractive       ? []       : [           [             Ripple,             {               ripple: !input,               unbounded: false,               color:                 (activated || selected) && color == null ? 'primary' : color,               disabled,               addClass,               removeClass,               addStyle,             },           ],         ]),     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-deprecated-list-item': true,     'mdc-deprecated-list-item--activated': activated,     'mdc-deprecated-list-item--selected': selected,     'mdc-deprecated-list-item--disabled': disabled,     'mdc-menu-item--selected': !nav && role === 'menuitem' && selected,     'smui-menu-item--non-interactive': nonInteractive,     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   {...nav && activated ? { 'aria-current': 'page' } : {}}   {...!nav ? { role } : {}}   {...!nav && role === 'option'     ? { 'aria-selected': selected ? 'true' : 'false' }     : {}}   {...!nav && (role === 'radio' || role === 'checkbox')     ? { 'aria-checked': input && input.checked ? 'true' : 'false' }     : {}}   {...!nav ? { 'aria-disabled': disabled ? 'true' : 'false' } : {}}   data-menu-item-skip-restore-focus={skipRestoreFocus || undefined}   {tabindex}   on:click={action}   on:keydown={handleKeydown}   on:SMUIGenericInput:mount={handleInputMount}   on:SMUIGenericInput:unmount={() => (input = undefined)}   {href}   {...internalAttrs}   {...$$restProps}   >
    function create_default_slot$g(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*ripple*/ ctx[7] && create_if_block$o(ctx);
    	const default_slot_template = /*#slots*/ ctx[32].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[35], null);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);

    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*ripple*/ ctx[7]) {
    				if (if_block) ; else {
    					if_block = create_if_block$o(ctx);
    					if_block.c();
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				if_block.d(1);
    				if_block = null;
    			}

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 16)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[35],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[35])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[35], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$g.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[     ...(nonInteractive       ? []       : [           [             Ripple,             {               ripple: !input,               unbounded: false,               color:                 (activated || selected) && color == null ? 'primary' : color,               disabled,               addClass,               removeClass,               addStyle,             },           ],         ]),     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-deprecated-list-item': true,     'mdc-deprecated-list-item--activated': activated,     'mdc-deprecated-list-item--selected': selected,     'mdc-deprecated-list-item--disabled': disabled,     'mdc-menu-item--selected': !nav && role === 'menuitem' && selected,     'smui-menu-item--non-interactive': nonInteractive,     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   {...nav && activated ? { 'aria-current': 'page' } : {}}   {...!nav ? { role } : {}}   {...!nav && role === 'option'     ? { 'aria-selected': selected ? 'true' : 'false' }     : {}}   {...!nav && (role === 'radio' || role === 'checkbox')     ? { 'aria-checked': input && input.checked ? 'true' : 'false' }     : {}}   {...!nav ? { 'aria-disabled': disabled ? 'true' : 'false' } : {}}   data-menu-item-skip-restore-focus={skipRestoreFocus || undefined}   {tabindex}   on:click={action}   on:keydown={handleKeydown}   on:SMUIGenericInput:mount={handleInputMount}   on:SMUIGenericInput:unmount={() => (input = undefined)}   {href}   {...internalAttrs}   {...$$restProps}   >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$K(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [
    				.../*nonInteractive*/ ctx[6]
    				? []
    				: [
    						[
    							Ripple,
    							{
    								ripple: !/*input*/ ctx[14],
    								unbounded: false,
    								color: (/*activated*/ ctx[1] || /*selected*/ ctx[0]) && /*color*/ ctx[5] == null
    								? 'primary'
    								: /*color*/ ctx[5],
    								disabled: /*disabled*/ ctx[9],
    								addClass: /*addClass*/ ctx[22],
    								removeClass: /*removeClass*/ ctx[23],
    								addStyle: /*addStyle*/ ctx[24]
    							}
    						]
    					],
    				/*forwardEvents*/ ctx[20],
    				.../*use*/ ctx[2]
    			]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[3]]: true,
    				'mdc-deprecated-list-item': true,
    				'mdc-deprecated-list-item--activated': /*activated*/ ctx[1],
    				'mdc-deprecated-list-item--selected': /*selected*/ ctx[0],
    				'mdc-deprecated-list-item--disabled': /*disabled*/ ctx[9],
    				'mdc-menu-item--selected': !/*nav*/ ctx[21] && /*role*/ ctx[8] === 'menuitem' && /*selected*/ ctx[0],
    				'smui-menu-item--non-interactive': /*nonInteractive*/ ctx[6],
    				.../*internalClasses*/ ctx[16]
    			})
    		},
    		{
    			style: Object.entries(/*internalStyles*/ ctx[17]).map(func$f).concat([/*style*/ ctx[4]]).join(' ')
    		},
    		/*nav*/ ctx[21] && /*activated*/ ctx[1]
    		? { 'aria-current': 'page' }
    		: {},
    		!/*nav*/ ctx[21] ? { role: /*role*/ ctx[8] } : {},
    		!/*nav*/ ctx[21] && /*role*/ ctx[8] === 'option'
    		? {
    				'aria-selected': /*selected*/ ctx[0] ? 'true' : 'false'
    			}
    		: {},
    		!/*nav*/ ctx[21] && (/*role*/ ctx[8] === 'radio' || /*role*/ ctx[8] === 'checkbox')
    		? {
    				'aria-checked': /*input*/ ctx[14] && /*input*/ ctx[14].checked
    				? 'true'
    				: 'false'
    			}
    		: {},
    		!/*nav*/ ctx[21]
    		? {
    				'aria-disabled': /*disabled*/ ctx[9] ? 'true' : 'false'
    			}
    		: {},
    		{
    			"data-menu-item-skip-restore-focus": /*skipRestoreFocus*/ ctx[10] || undefined
    		},
    		{ tabindex: /*tabindex*/ ctx[19] },
    		{ href: /*href*/ ctx[11] },
    		/*internalAttrs*/ ctx[18],
    		/*$$restProps*/ ctx[27]
    	];

    	var switch_value = /*component*/ ctx[12];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$g] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[33](switch_instance);
    		switch_instance.$on("click", /*action*/ ctx[13]);
    		switch_instance.$on("keydown", /*handleKeydown*/ ctx[25]);
    		switch_instance.$on("SMUIGenericInput:mount", /*handleInputMount*/ ctx[26]);
    		switch_instance.$on("SMUIGenericInput:unmount", /*SMUIGenericInput_unmount_handler*/ ctx[34]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty[0] & /*nonInteractive, input, activated, selected, color, disabled, addClass, removeClass, addStyle, forwardEvents, use, className, nav, role, internalClasses, internalStyles, style, skipRestoreFocus, tabindex, href, internalAttrs, $$restProps*/ 167726975)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty[0] & /*nonInteractive, input, activated, selected, color, disabled, addClass, removeClass, addStyle, forwardEvents, use*/ 30425703 && {
    						use: [
    							.../*nonInteractive*/ ctx[6]
    							? []
    							: [
    									[
    										Ripple,
    										{
    											ripple: !/*input*/ ctx[14],
    											unbounded: false,
    											color: (/*activated*/ ctx[1] || /*selected*/ ctx[0]) && /*color*/ ctx[5] == null
    											? 'primary'
    											: /*color*/ ctx[5],
    											disabled: /*disabled*/ ctx[9],
    											addClass: /*addClass*/ ctx[22],
    											removeClass: /*removeClass*/ ctx[23],
    											addStyle: /*addStyle*/ ctx[24]
    										}
    									]
    								],
    							/*forwardEvents*/ ctx[20],
    							.../*use*/ ctx[2]
    						]
    					},
    					dirty[0] & /*className, activated, selected, disabled, nav, role, nonInteractive, internalClasses*/ 2163531 && {
    						class: classMap({
    							[/*className*/ ctx[3]]: true,
    							'mdc-deprecated-list-item': true,
    							'mdc-deprecated-list-item--activated': /*activated*/ ctx[1],
    							'mdc-deprecated-list-item--selected': /*selected*/ ctx[0],
    							'mdc-deprecated-list-item--disabled': /*disabled*/ ctx[9],
    							'mdc-menu-item--selected': !/*nav*/ ctx[21] && /*role*/ ctx[8] === 'menuitem' && /*selected*/ ctx[0],
    							'smui-menu-item--non-interactive': /*nonInteractive*/ ctx[6],
    							.../*internalClasses*/ ctx[16]
    						})
    					},
    					dirty[0] & /*internalStyles, style*/ 131088 && {
    						style: Object.entries(/*internalStyles*/ ctx[17]).map(func$f).concat([/*style*/ ctx[4]]).join(' ')
    					},
    					dirty[0] & /*nav, activated*/ 2097154 && get_spread_object(/*nav*/ ctx[21] && /*activated*/ ctx[1]
    					? { 'aria-current': 'page' }
    					: {}),
    					dirty[0] & /*nav, role*/ 2097408 && get_spread_object(!/*nav*/ ctx[21] ? { role: /*role*/ ctx[8] } : {}),
    					dirty[0] & /*nav, role, selected*/ 2097409 && get_spread_object(!/*nav*/ ctx[21] && /*role*/ ctx[8] === 'option'
    					? {
    							'aria-selected': /*selected*/ ctx[0] ? 'true' : 'false'
    						}
    					: {}),
    					dirty[0] & /*nav, role, input*/ 2113792 && get_spread_object(!/*nav*/ ctx[21] && (/*role*/ ctx[8] === 'radio' || /*role*/ ctx[8] === 'checkbox')
    					? {
    							'aria-checked': /*input*/ ctx[14] && /*input*/ ctx[14].checked
    							? 'true'
    							: 'false'
    						}
    					: {}),
    					dirty[0] & /*nav, disabled*/ 2097664 && get_spread_object(!/*nav*/ ctx[21]
    					? {
    							'aria-disabled': /*disabled*/ ctx[9] ? 'true' : 'false'
    						}
    					: {}),
    					dirty[0] & /*skipRestoreFocus*/ 1024 && {
    						"data-menu-item-skip-restore-focus": /*skipRestoreFocus*/ ctx[10] || undefined
    					},
    					dirty[0] & /*tabindex*/ 524288 && { tabindex: /*tabindex*/ ctx[19] },
    					dirty[0] & /*href*/ 2048 && { href: /*href*/ ctx[11] },
    					dirty[0] & /*internalAttrs*/ 262144 && get_spread_object(/*internalAttrs*/ ctx[18]),
    					dirty[0] & /*$$restProps*/ 134217728 && get_spread_object(/*$$restProps*/ ctx[27])
    				])
    			: {};

    			if (dirty[0] & /*ripple*/ 128 | dirty[1] & /*$$scope*/ 16) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[12])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[33](switch_instance);
    					switch_instance.$on("click", /*action*/ ctx[13]);
    					switch_instance.$on("keydown", /*handleKeydown*/ ctx[25]);
    					switch_instance.$on("SMUIGenericInput:mount", /*handleInputMount*/ ctx[26]);
    					switch_instance.$on("SMUIGenericInput:unmount", /*SMUIGenericInput_unmount_handler*/ ctx[34]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[33](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$K.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter$5 = 0;
    const func$f = ([name, value]) => `${name}: ${value};`;

    function instance$H($$self, $$props, $$invalidate) {
    	let tabindex;

    	const omit_props_names = [
    		"use","class","style","color","nonInteractive","ripple","activated","role","selected","disabled","skipRestoreFocus","tabindex","inputId","href","component","action","getPrimaryText","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Item', slots, ['default']);
    	var _a;
    	const forwardEvents = forwardEventsBuilder(get_current_component());

    	let uninitializedValue = () => {
    		
    	};

    	function isUninitializedValue(value) {
    		return value === uninitializedValue;
    	}

    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { color = undefined } = $$props;

    	let { nonInteractive = (_a = getContext('SMUI:list:nonInteractive')) !== null && _a !== void 0
    	? _a
    	: false } = $$props;

    	setContext('SMUI:list:nonInteractive', undefined);
    	let { ripple = !nonInteractive } = $$props;
    	let { activated = false } = $$props;
    	let { role = getContext('SMUI:list:item:role') } = $$props;
    	setContext('SMUI:list:item:role', undefined);
    	let { selected = false } = $$props;
    	let { disabled = false } = $$props;
    	let { skipRestoreFocus = false } = $$props;
    	let { tabindex: tabindexProp = uninitializedValue } = $$props;
    	let { inputId = 'SMUI-form-field-list-' + counter$5++ } = $$props;
    	let { href = undefined } = $$props;
    	let element;
    	let internalClasses = {};
    	let internalStyles = {};
    	let internalAttrs = {};
    	let input;
    	let addTabindexIfNoItemsSelectedRaf;
    	let nav = getContext('SMUI:list:item:nav');
    	let { component = nav ? href ? A : Span : Li } = $$props;
    	setContext('SMUI:generic:input:props', { id: inputId });

    	// Reset separator context, because we aren't directly under a list anymore.
    	setContext('SMUI:separator:context', undefined);

    	onMount(() => {
    		// Tabindex needs to be '0' if this is the first non-disabled list item, and
    		// no other item is selected.
    		if (!selected && !nonInteractive) {
    			let first = true;
    			let el = element;

    			while (el.previousSibling) {
    				el = el.previousSibling;

    				if (el.nodeType === 1 && el.classList.contains('mdc-deprecated-list-item') && !el.classList.contains('mdc-deprecated-list-item--disabled')) {
    					first = false;
    					break;
    				}
    			}

    			if (first) {
    				// This is first, so now set up a check that no other items are
    				// selected.
    				addTabindexIfNoItemsSelectedRaf = window.requestAnimationFrame(addTabindexIfNoItemsSelected);
    			}
    		}

    		const accessor = {
    			_smui_list_item_accessor: true,
    			get element() {
    				return getElement();
    			},
    			get selected() {
    				return selected;
    			},
    			set selected(value) {
    				$$invalidate(0, selected = value);
    			},
    			hasClass,
    			addClass,
    			removeClass,
    			getAttr,
    			addAttr,
    			removeAttr,
    			getPrimaryText,
    			// For inputs within item.
    			get checked() {
    				var _a;

    				return (_a = input && input.checked) !== null && _a !== void 0
    				? _a
    				: false;
    			},
    			set checked(value) {
    				if (input) {
    					$$invalidate(14, input.checked = !!value, input);
    				}
    			},
    			get hasCheckbox() {
    				return !!(input && '_smui_checkbox_accessor' in input);
    			},
    			get hasRadio() {
    				return !!(input && '_smui_radio_accessor' in input);
    			},
    			activateRipple() {
    				if (input) {
    					input.activateRipple();
    				}
    			},
    			deactivateRipple() {
    				if (input) {
    					input.deactivateRipple();
    				}
    			},
    			// For select options.
    			getValue() {
    				return $$restProps.value;
    			},
    			// For autocomplete
    			action,
    			get tabindex() {
    				return tabindex;
    			},
    			set tabindex(value) {
    				$$invalidate(28, tabindexProp = value);
    			},
    			get disabled() {
    				return disabled;
    			},
    			get activated() {
    				return activated;
    			},
    			set activated(value) {
    				$$invalidate(1, activated = value);
    			}
    		};

    		dispatch$1(getElement(), 'SMUIListItem:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIListItem:unmount', accessor);
    		};
    	});

    	onDestroy(() => {
    		if (addTabindexIfNoItemsSelectedRaf) {
    			window.cancelAnimationFrame(addTabindexIfNoItemsSelectedRaf);
    		}
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(16, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(16, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(17, internalStyles);
    			} else {
    				$$invalidate(17, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(18, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function removeAttr(name) {
    		if (!(name in internalAttrs) || internalAttrs[name] != null) {
    			$$invalidate(18, internalAttrs[name] = undefined, internalAttrs);
    		}
    	}

    	function addTabindexIfNoItemsSelected() {
    		// Look through next siblings to see if none of them are selected.
    		let noneSelected = true;

    		let el = element.getElement();

    		while (el.nextElementSibling) {
    			el = el.nextElementSibling;

    			if (el.nodeType === 1 && el.classList.contains('mdc-deprecated-list-item')) {
    				const tabindexAttr = el.attributes.getNamedItem('tabindex');

    				if (tabindexAttr && tabindexAttr.value === '0') {
    					noneSelected = false;
    					break;
    				}
    			}
    		}

    		if (noneSelected) {
    			// This is the first element, and no other element is selected, so the
    			// tabindex should be '0'.
    			$$invalidate(19, tabindex = 0);
    		}
    	}

    	function handleKeydown(e) {
    		const isEnter = e.key === 'Enter';
    		const isSpace = e.key === 'Space';

    		if (isEnter || isSpace) {
    			action(e);
    		}
    	}

    	function handleInputMount(e) {
    		if ('_smui_checkbox_accessor' in e.detail || '_smui_radio_accessor' in e.detail) {
    			$$invalidate(14, input = e.detail);
    		}
    	}

    	function action(e) {
    		if (!disabled) {
    			dispatch$1(getElement(), 'SMUI:action', e);
    		}
    	}

    	function getPrimaryText() {
    		var _a, _b, _c;
    		const element = getElement();
    		const primaryText = element.querySelector('.mdc-deprecated-list-item__primary-text');

    		if (primaryText) {
    			return (_a = primaryText.textContent) !== null && _a !== void 0
    			? _a
    			: '';
    		}

    		const text = element.querySelector('.mdc-deprecated-list-item__text');

    		if (text) {
    			return (_b = text.textContent) !== null && _b !== void 0
    			? _b
    			: '';
    		}

    		return (_c = element.textContent) !== null && _c !== void 0
    		? _c
    		: '';
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(15, element);
    		});
    	}

    	const SMUIGenericInput_unmount_handler = () => $$invalidate(14, input = undefined);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(27, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(2, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(3, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(4, style = $$new_props.style);
    		if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color);
    		if ('nonInteractive' in $$new_props) $$invalidate(6, nonInteractive = $$new_props.nonInteractive);
    		if ('ripple' in $$new_props) $$invalidate(7, ripple = $$new_props.ripple);
    		if ('activated' in $$new_props) $$invalidate(1, activated = $$new_props.activated);
    		if ('role' in $$new_props) $$invalidate(8, role = $$new_props.role);
    		if ('selected' in $$new_props) $$invalidate(0, selected = $$new_props.selected);
    		if ('disabled' in $$new_props) $$invalidate(9, disabled = $$new_props.disabled);
    		if ('skipRestoreFocus' in $$new_props) $$invalidate(10, skipRestoreFocus = $$new_props.skipRestoreFocus);
    		if ('tabindex' in $$new_props) $$invalidate(28, tabindexProp = $$new_props.tabindex);
    		if ('inputId' in $$new_props) $$invalidate(29, inputId = $$new_props.inputId);
    		if ('href' in $$new_props) $$invalidate(11, href = $$new_props.href);
    		if ('component' in $$new_props) $$invalidate(12, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(35, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter: counter$5,
    		_a,
    		onMount,
    		onDestroy,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Ripple,
    		A,
    		Span,
    		Li,
    		forwardEvents,
    		uninitializedValue,
    		isUninitializedValue,
    		use,
    		className,
    		style,
    		color,
    		nonInteractive,
    		ripple,
    		activated,
    		role,
    		selected,
    		disabled,
    		skipRestoreFocus,
    		tabindexProp,
    		inputId,
    		href,
    		element,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		input,
    		addTabindexIfNoItemsSelectedRaf,
    		nav,
    		component,
    		hasClass,
    		addClass,
    		removeClass,
    		addStyle,
    		getAttr,
    		addAttr,
    		removeAttr,
    		addTabindexIfNoItemsSelected,
    		handleKeydown,
    		handleInputMount,
    		action,
    		getPrimaryText,
    		getElement,
    		tabindex
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('_a' in $$props) _a = $$new_props._a;
    		if ('uninitializedValue' in $$props) uninitializedValue = $$new_props.uninitializedValue;
    		if ('use' in $$props) $$invalidate(2, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(3, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(4, style = $$new_props.style);
    		if ('color' in $$props) $$invalidate(5, color = $$new_props.color);
    		if ('nonInteractive' in $$props) $$invalidate(6, nonInteractive = $$new_props.nonInteractive);
    		if ('ripple' in $$props) $$invalidate(7, ripple = $$new_props.ripple);
    		if ('activated' in $$props) $$invalidate(1, activated = $$new_props.activated);
    		if ('role' in $$props) $$invalidate(8, role = $$new_props.role);
    		if ('selected' in $$props) $$invalidate(0, selected = $$new_props.selected);
    		if ('disabled' in $$props) $$invalidate(9, disabled = $$new_props.disabled);
    		if ('skipRestoreFocus' in $$props) $$invalidate(10, skipRestoreFocus = $$new_props.skipRestoreFocus);
    		if ('tabindexProp' in $$props) $$invalidate(28, tabindexProp = $$new_props.tabindexProp);
    		if ('inputId' in $$props) $$invalidate(29, inputId = $$new_props.inputId);
    		if ('href' in $$props) $$invalidate(11, href = $$new_props.href);
    		if ('element' in $$props) $$invalidate(15, element = $$new_props.element);
    		if ('internalClasses' in $$props) $$invalidate(16, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(17, internalStyles = $$new_props.internalStyles);
    		if ('internalAttrs' in $$props) $$invalidate(18, internalAttrs = $$new_props.internalAttrs);
    		if ('input' in $$props) $$invalidate(14, input = $$new_props.input);
    		if ('addTabindexIfNoItemsSelectedRaf' in $$props) addTabindexIfNoItemsSelectedRaf = $$new_props.addTabindexIfNoItemsSelectedRaf;
    		if ('nav' in $$props) $$invalidate(21, nav = $$new_props.nav);
    		if ('component' in $$props) $$invalidate(12, component = $$new_props.component);
    		if ('tabindex' in $$props) $$invalidate(19, tabindex = $$new_props.tabindex);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*tabindexProp, nonInteractive, disabled, selected, input*/ 268452417) {
    			$$invalidate(19, tabindex = isUninitializedValue(tabindexProp)
    			? !nonInteractive && !disabled && (selected || input && input.checked)
    				? 0
    				: -1
    			: tabindexProp);
    		}
    	};

    	return [
    		selected,
    		activated,
    		use,
    		className,
    		style,
    		color,
    		nonInteractive,
    		ripple,
    		role,
    		disabled,
    		skipRestoreFocus,
    		href,
    		component,
    		action,
    		input,
    		element,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		tabindex,
    		forwardEvents,
    		nav,
    		addClass,
    		removeClass,
    		addStyle,
    		handleKeydown,
    		handleInputMount,
    		$$restProps,
    		tabindexProp,
    		inputId,
    		getPrimaryText,
    		getElement,
    		slots,
    		switch_instance_binding,
    		SMUIGenericInput_unmount_handler,
    		$$scope
    	];
    }

    class Item$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance$H,
    			create_fragment$K,
    			safe_not_equal,
    			{
    				use: 2,
    				class: 3,
    				style: 4,
    				color: 5,
    				nonInteractive: 6,
    				ripple: 7,
    				activated: 1,
    				role: 8,
    				selected: 0,
    				disabled: 9,
    				skipRestoreFocus: 10,
    				tabindex: 28,
    				inputId: 29,
    				href: 11,
    				component: 12,
    				action: 13,
    				getPrimaryText: 30,
    				getElement: 31
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Item",
    			options,
    			id: create_fragment$K.name
    		});
    	}

    	get use() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get color() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set color(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get nonInteractive() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set nonInteractive(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get activated() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set activated(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get role() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set role(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selected() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selected(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get disabled() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set disabled(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get skipRestoreFocus() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set skipRestoreFocus(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get tabindex() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set tabindex(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get inputId() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set inputId(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get href() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set href(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<Item>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get action() {
    		return this.$$.ctx[13];
    	}

    	set action(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getPrimaryText() {
    		return this.$$.ctx[30];
    	}

    	set getPrimaryText(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[31];
    	}

    	set getElement(value) {
    		throw new Error("<Item>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/common/dist/classadder/ClassAdder.svelte generated by Svelte v3.46.4 */

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     [smuiClass]: true,     ...smuiClassMap,   })}   {...props}   {...$$restProps}>
    function create_default_slot$f(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[10].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[12],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[12])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$f.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[forwardEvents, ...use]}   class={classMap({     [className]: true,     [smuiClass]: true,     ...smuiClassMap,   })}   {...props}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$J(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [/*forwardEvents*/ ctx[7], .../*use*/ ctx[0]]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				[/*smuiClass*/ ctx[5]]: true,
    				.../*smuiClassMap*/ ctx[4]
    			})
    		},
    		/*props*/ ctx[6],
    		/*$$restProps*/ ctx[8]
    	];

    	var switch_value = /*component*/ ctx[2];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$f] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[11](switch_instance);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const switch_instance_changes = (dirty & /*forwardEvents, use, classMap, className, smuiClass, smuiClassMap, props, $$restProps*/ 499)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*forwardEvents, use*/ 129 && {
    						use: [/*forwardEvents*/ ctx[7], .../*use*/ ctx[0]]
    					},
    					dirty & /*classMap, className, smuiClass, smuiClassMap*/ 50 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							[/*smuiClass*/ ctx[5]]: true,
    							.../*smuiClassMap*/ ctx[4]
    						})
    					},
    					dirty & /*props*/ 64 && get_spread_object(/*props*/ ctx[6]),
    					dirty & /*$$restProps*/ 256 && get_spread_object(/*$$restProps*/ ctx[8])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 4096) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[2])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[11](switch_instance);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[11](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$J.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const internals = {
    	component: Div$1,
    	class: '',
    	classMap: {},
    	contexts: {},
    	props: {}
    };

    function instance$G($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","component","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('ClassAdder', slots, ['default']);
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let element;
    	const smuiClass = internals.class;
    	const smuiClassMap = {};
    	const smuiClassUnsubscribes = [];
    	const contexts = internals.contexts;
    	const props = internals.props;
    	let { component = internals.component } = $$props;

    	Object.entries(internals.classMap).forEach(([name, context]) => {
    		const store = getContext(context);

    		if (store && 'subscribe' in store) {
    			smuiClassUnsubscribes.push(store.subscribe(value => {
    				$$invalidate(4, smuiClassMap[name] = value, smuiClassMap);
    			}));
    		}
    	});

    	const forwardEvents = forwardEventsBuilder(get_current_component());

    	for (let context in contexts) {
    		if (contexts.hasOwnProperty(context)) {
    			setContext(context, contexts[context]);
    		}
    	}

    	onDestroy(() => {
    		for (const unsubscribe of smuiClassUnsubscribes) {
    			unsubscribe();
    		}
    	});

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(3, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(8, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('component' in $$new_props) $$invalidate(2, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		Div: Div$1,
    		internals,
    		onDestroy,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		use,
    		className,
    		element,
    		smuiClass,
    		smuiClassMap,
    		smuiClassUnsubscribes,
    		contexts,
    		props,
    		component,
    		forwardEvents,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('element' in $$props) $$invalidate(3, element = $$new_props.element);
    		if ('component' in $$props) $$invalidate(2, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		component,
    		element,
    		smuiClassMap,
    		smuiClass,
    		props,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		slots,
    		switch_instance_binding,
    		$$scope
    	];
    }

    class ClassAdder extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$G, create_fragment$J, safe_not_equal, {
    			use: 0,
    			class: 1,
    			component: 2,
    			getElement: 9
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "ClassAdder",
    			options,
    			id: create_fragment$J.name
    		});
    	}

    	get use() {
    		throw new Error("<ClassAdder>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<ClassAdder>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<ClassAdder>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<ClassAdder>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<ClassAdder>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<ClassAdder>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[9];
    	}

    	set getElement(value) {
    		throw new Error("<ClassAdder>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    // @ts-ignore: Internals is exported... argh.
    const defaults = Object.assign({}, internals);
    function classAdderBuilder(props) {
        return new Proxy(ClassAdder, {
            construct: function (target, args) {
                Object.assign(internals, defaults, props);
                // @ts-ignore: Need spread arg.
                return new target(...args);
            },
            get: function (target, prop) {
                Object.assign(internals, defaults, props);
                return target[prop];
            },
        });
    }

    var Text$2 = classAdderBuilder({
        class: 'mdc-deprecated-list-item__text',
        component: Span,
    });

    var PrimaryText = classAdderBuilder({
        class: 'mdc-deprecated-list-item__primary-text',
        component: Span,
    });

    var SecondaryText = classAdderBuilder({
        class: 'mdc-deprecated-list-item__secondary-text',
        component: Span,
    });

    /* node_modules/@smui/list/dist/Graphic.svelte generated by Svelte v3.46.4 */
    const file$D = "node_modules/@smui/list/dist/Graphic.svelte";

    function create_fragment$I(ctx) {
    	let span;
    	let span_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[8].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[7], null);

    	let span_levels = [
    		{
    			class: span_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-deprecated-list-item__graphic': true,
    				'mdc-menu__selection-group-icon': /*menuSelectionGroup*/ ctx[4]
    			})
    		},
    		/*$$restProps*/ ctx[5]
    	];

    	let span_data = {};

    	for (let i = 0; i < span_levels.length; i += 1) {
    		span_data = assign$1(span_data, span_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			span = element("span");
    			if (default_slot) default_slot.c();
    			set_attributes(span, span_data);
    			add_location(span, file$D, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);

    			if (default_slot) {
    				default_slot.m(span, null);
    			}

    			/*span_binding*/ ctx[9](span);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, span, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[3].call(null, span))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 128)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[7],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[7])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[7], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(span, span_data = get_spread_update(span_levels, [
    				(!current || dirty & /*className*/ 2 && span_class_value !== (span_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-deprecated-list-item__graphic': true,
    					'mdc-menu__selection-group-icon': /*menuSelectionGroup*/ ctx[4]
    				}))) && { class: span_class_value },
    				dirty & /*$$restProps*/ 32 && /*$$restProps*/ ctx[5]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    			if (default_slot) default_slot.d(detaching);
    			/*span_binding*/ ctx[9](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$I.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$F($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Graphic', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let element;
    	let menuSelectionGroup = getContext('SMUI:list:graphic:menu-selection-group');

    	function getElement() {
    		return element;
    	}

    	function span_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(5, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('$$scope' in $$new_props) $$invalidate(7, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		element,
    		menuSelectionGroup,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    		if ('menuSelectionGroup' in $$props) $$invalidate(4, menuSelectionGroup = $$new_props.menuSelectionGroup);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		element,
    		forwardEvents,
    		menuSelectionGroup,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		span_binding
    	];
    }

    class Graphic$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$F, create_fragment$I, safe_not_equal, { use: 0, class: 1, getElement: 6 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Graphic",
    			options,
    			id: create_fragment$I.name
    		});
    	}

    	get use() {
    		throw new Error("<Graphic>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Graphic>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Graphic>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Graphic>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[6];
    	}

    	set getElement(value) {
    		throw new Error("<Graphic>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    classAdderBuilder({
        class: 'mdc-deprecated-list-item__meta',
        component: Span,
    });

    classAdderBuilder({
        class: 'mdc-deprecated-list-group',
        component: Div,
    });

    classAdderBuilder({
        class: 'mdc-deprecated-list-group__subheader',
        component: H3,
    });

    /* node_modules/@smui/list/dist/Separator.svelte generated by Svelte v3.46.4 */

    function create_fragment$H(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [/*forwardEvents*/ ctx[9], .../*use*/ ctx[0]]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-deprecated-list-divider': true,
    				'mdc-deprecated-list-divider--padded': /*padded*/ ctx[2],
    				'mdc-deprecated-list-divider--inset': /*inset*/ ctx[3],
    				'mdc-deprecated-list-divider--inset-leading': /*insetLeading*/ ctx[4],
    				'mdc-deprecated-list-divider--inset-trailing': /*insetTrailing*/ ctx[5],
    				'mdc-deprecated-list-divider--inset-padding': /*insetPadding*/ ctx[6]
    			})
    		},
    		{ role: "separator" },
    		/*$$restProps*/ ctx[10]
    	];

    	var switch_value = /*component*/ ctx[7];

    	function switch_props(ctx) {
    		let switch_instance_props = {};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props());
    		/*switch_instance_binding*/ ctx[12](switch_instance);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const switch_instance_changes = (dirty & /*forwardEvents, use, classMap, className, padded, inset, insetLeading, insetTrailing, insetPadding, $$restProps*/ 1663)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*forwardEvents, use*/ 513 && {
    						use: [/*forwardEvents*/ ctx[9], .../*use*/ ctx[0]]
    					},
    					dirty & /*classMap, className, padded, inset, insetLeading, insetTrailing, insetPadding*/ 126 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-deprecated-list-divider': true,
    							'mdc-deprecated-list-divider--padded': /*padded*/ ctx[2],
    							'mdc-deprecated-list-divider--inset': /*inset*/ ctx[3],
    							'mdc-deprecated-list-divider--inset-leading': /*insetLeading*/ ctx[4],
    							'mdc-deprecated-list-divider--inset-trailing': /*insetTrailing*/ ctx[5],
    							'mdc-deprecated-list-divider--inset-padding': /*insetPadding*/ ctx[6]
    						})
    					},
    					switch_instance_spread_levels[2],
    					dirty & /*$$restProps*/ 1024 && get_spread_object(/*$$restProps*/ ctx[10])
    				])
    			: {};

    			if (switch_value !== (switch_value = /*component*/ ctx[7])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props());
    					/*switch_instance_binding*/ ctx[12](switch_instance);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[12](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$H.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$E($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","padded","inset","insetLeading","insetTrailing","insetPadding","component","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Separator', slots, []);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { padded = false } = $$props;
    	let { inset = false } = $$props;
    	let { insetLeading = false } = $$props;
    	let { insetTrailing = false } = $$props;
    	let { insetPadding = false } = $$props;
    	let element;
    	let nav = getContext('SMUI:list:item:nav');
    	let context = getContext('SMUI:separator:context');
    	let { component = nav || context !== 'list' ? Hr : Li } = $$props;

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(8, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('padded' in $$new_props) $$invalidate(2, padded = $$new_props.padded);
    		if ('inset' in $$new_props) $$invalidate(3, inset = $$new_props.inset);
    		if ('insetLeading' in $$new_props) $$invalidate(4, insetLeading = $$new_props.insetLeading);
    		if ('insetTrailing' in $$new_props) $$invalidate(5, insetTrailing = $$new_props.insetTrailing);
    		if ('insetPadding' in $$new_props) $$invalidate(6, insetPadding = $$new_props.insetPadding);
    		if ('component' in $$new_props) $$invalidate(7, component = $$new_props.component);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		Li,
    		Hr,
    		forwardEvents,
    		use,
    		className,
    		padded,
    		inset,
    		insetLeading,
    		insetTrailing,
    		insetPadding,
    		element,
    		nav,
    		context,
    		component,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('padded' in $$props) $$invalidate(2, padded = $$new_props.padded);
    		if ('inset' in $$props) $$invalidate(3, inset = $$new_props.inset);
    		if ('insetLeading' in $$props) $$invalidate(4, insetLeading = $$new_props.insetLeading);
    		if ('insetTrailing' in $$props) $$invalidate(5, insetTrailing = $$new_props.insetTrailing);
    		if ('insetPadding' in $$props) $$invalidate(6, insetPadding = $$new_props.insetPadding);
    		if ('element' in $$props) $$invalidate(8, element = $$new_props.element);
    		if ('nav' in $$props) nav = $$new_props.nav;
    		if ('context' in $$props) context = $$new_props.context;
    		if ('component' in $$props) $$invalidate(7, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		padded,
    		inset,
    		insetLeading,
    		insetTrailing,
    		insetPadding,
    		component,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		switch_instance_binding
    	];
    }

    class Separator$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$E, create_fragment$H, safe_not_equal, {
    			use: 0,
    			class: 1,
    			padded: 2,
    			inset: 3,
    			insetLeading: 4,
    			insetTrailing: 5,
    			insetPadding: 6,
    			component: 7,
    			getElement: 11
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Separator",
    			options,
    			id: create_fragment$H.name
    		});
    	}

    	get use() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get padded() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set padded(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get inset() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set inset(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get insetLeading() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set insetLeading(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get insetTrailing() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set insetTrailing(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get insetPadding() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set insetPadding(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<Separator>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[11];
    	}

    	set getElement(value) {
    		throw new Error("<Separator>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Item = Item$1;
    const Graphic = Graphic$1;
    const Separator = Separator$1;

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var CssClasses;
    (function (CssClasses) {
        CssClasses["RICH"] = "mdc-tooltip--rich";
        CssClasses["SHOWN"] = "mdc-tooltip--shown";
        CssClasses["SHOWING"] = "mdc-tooltip--showing";
        CssClasses["SHOWING_TRANSITION"] = "mdc-tooltip--showing-transition";
        CssClasses["HIDE"] = "mdc-tooltip--hide";
        CssClasses["HIDE_TRANSITION"] = "mdc-tooltip--hide-transition";
        CssClasses["MULTILINE_TOOLTIP"] = "mdc-tooltip--multiline";
        CssClasses["SURFACE"] = "mdc-tooltip__surface";
        CssClasses["SURFACE_ANIMATION"] = "mdc-tooltip__surface-animation";
        CssClasses["TOOLTIP_CARET_TOP"] = "mdc-tooltip__caret-surface-top";
        CssClasses["TOOLTIP_CARET_BOTTOM"] = "mdc-tooltip__caret-surface-bottom";
    })(CssClasses || (CssClasses = {}));
    var numbers$4 = {
        BOUNDED_ANCHOR_GAP: 4,
        UNBOUNDED_ANCHOR_GAP: 8,
        MIN_VIEWPORT_TOOLTIP_THRESHOLD: 8,
        HIDE_DELAY_MS: 600,
        SHOW_DELAY_MS: 500,
        // LINT.IfChange(tooltip-dimensions)
        MIN_HEIGHT: 24,
        MAX_WIDTH: 200,
        // LINT.ThenChange(_tooltip.scss:tooltip-dimensions)
        CARET_INDENTATION: 24,
        // LINT.IfChange(tooltip-anim-scale)
        ANIMATION_SCALE: 0.8,
        // LINT.ThenChange(_tooltip.scss:tooltip-anim-scale)
    };
    var attributes$2 = {
        ARIA_EXPANDED: 'aria-expanded',
        ARIA_HASPOPUP: 'aria-haspopup',
        PERSISTENT: 'data-mdc-tooltip-persistent',
        SCROLLABLE_ANCESTOR: 'tooltip-scrollable-ancestor',
        HAS_CARET: 'data-mdc-tooltip-has-caret',
    };
    /** Enum for possible tooltip positioning relative to its anchor element. */
    var XPosition;
    (function (XPosition) {
        XPosition[XPosition["DETECTED"] = 0] = "DETECTED";
        XPosition[XPosition["START"] = 1] = "START";
        // Note: CENTER is not valid for rich tooltips.
        XPosition[XPosition["CENTER"] = 2] = "CENTER";
        XPosition[XPosition["END"] = 3] = "END";
    })(XPosition || (XPosition = {}));
    var YPosition;
    (function (YPosition) {
        YPosition[YPosition["DETECTED"] = 0] = "DETECTED";
        YPosition[YPosition["ABOVE"] = 1] = "ABOVE";
        YPosition[YPosition["BELOW"] = 2] = "BELOW";
    })(YPosition || (YPosition = {}));
    /**
     * Enum for possible anchor boundary types. This determines the gap between the
     * bottom of the anchor and the tooltip element.
     * Bounded anchors have an identifiable boundary (e.g. buttons).
     * Unbounded anchors don't have a visually declared boundary (e.g. plain text).
     */
    var AnchorBoundaryType;
    (function (AnchorBoundaryType) {
        AnchorBoundaryType[AnchorBoundaryType["BOUNDED"] = 0] = "BOUNDED";
        AnchorBoundaryType[AnchorBoundaryType["UNBOUNDED"] = 1] = "UNBOUNDED";
    })(AnchorBoundaryType || (AnchorBoundaryType = {}));
    var strings$9 = {
        LEFT: 'left',
        RIGHT: 'right',
        CENTER: 'center',
        TOP: 'top',
        BOTTOM: 'bottom'
    };
    /**
     * Enum for possible positions of a tooltip with caret (this specifies the
     * positioning of the tooltip relative to the anchor -- the position of the
     * caret will follow that of the tooltip). This can NOT be combined with the
     * above X/YPosition options. Naming for the enums follows: (vertical
     * placement)_(horizontal placement).
     */
    var PositionWithCaret;
    (function (PositionWithCaret) {
        PositionWithCaret[PositionWithCaret["DETECTED"] = 0] = "DETECTED";
        PositionWithCaret[PositionWithCaret["ABOVE_START"] = 1] = "ABOVE_START";
        PositionWithCaret[PositionWithCaret["ABOVE_CENTER"] = 2] = "ABOVE_CENTER";
        PositionWithCaret[PositionWithCaret["ABOVE_END"] = 3] = "ABOVE_END";
        PositionWithCaret[PositionWithCaret["TOP_SIDE_START"] = 4] = "TOP_SIDE_START";
        PositionWithCaret[PositionWithCaret["CENTER_SIDE_START"] = 5] = "CENTER_SIDE_START";
        PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_START"] = 6] = "BOTTOM_SIDE_START";
        PositionWithCaret[PositionWithCaret["TOP_SIDE_END"] = 7] = "TOP_SIDE_END";
        PositionWithCaret[PositionWithCaret["CENTER_SIDE_END"] = 8] = "CENTER_SIDE_END";
        PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_END"] = 9] = "BOTTOM_SIDE_END";
        PositionWithCaret[PositionWithCaret["BELOW_START"] = 10] = "BELOW_START";
        PositionWithCaret[PositionWithCaret["BELOW_CENTER"] = 11] = "BELOW_CENTER";
        PositionWithCaret[PositionWithCaret["BELOW_END"] = 12] = "BELOW_END";
    })(PositionWithCaret || (PositionWithCaret = {}));
    var YPositionWithCaret;
    (function (YPositionWithCaret) {
        YPositionWithCaret[YPositionWithCaret["ABOVE"] = 1] = "ABOVE";
        YPositionWithCaret[YPositionWithCaret["BELOW"] = 2] = "BELOW";
        YPositionWithCaret[YPositionWithCaret["SIDE_TOP"] = 3] = "SIDE_TOP";
        YPositionWithCaret[YPositionWithCaret["SIDE_CENTER"] = 4] = "SIDE_CENTER";
        YPositionWithCaret[YPositionWithCaret["SIDE_BOTTOM"] = 5] = "SIDE_BOTTOM";
    })(YPositionWithCaret || (YPositionWithCaret = {}));
    var XPositionWithCaret;
    (function (XPositionWithCaret) {
        XPositionWithCaret[XPositionWithCaret["START"] = 1] = "START";
        XPositionWithCaret[XPositionWithCaret["CENTER"] = 2] = "CENTER";
        XPositionWithCaret[XPositionWithCaret["END"] = 3] = "END";
        XPositionWithCaret[XPositionWithCaret["SIDE_START"] = 4] = "SIDE_START";
        XPositionWithCaret[XPositionWithCaret["SIDE_END"] = 5] = "SIDE_END";
    })(XPositionWithCaret || (XPositionWithCaret = {}));

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * AnimationFrame provides a user-friendly abstraction around requesting
     * and canceling animation frames.
     */
    var AnimationFrame = /** @class */ (function () {
        function AnimationFrame() {
            this.rafIDs = new Map();
        }
        /**
         * Requests an animation frame. Cancels any existing frame with the same key.
         * @param {string} key The key for this callback.
         * @param {FrameRequestCallback} callback The callback to be executed.
         */
        AnimationFrame.prototype.request = function (key, callback) {
            var _this = this;
            this.cancel(key);
            var frameID = requestAnimationFrame(function (frame) {
                _this.rafIDs.delete(key);
                // Callback must come *after* the key is deleted so that nested calls to
                // request with the same key are not deleted.
                callback(frame);
            });
            this.rafIDs.set(key, frameID);
        };
        /**
         * Cancels a queued callback with the given key.
         * @param {string} key The key for this callback.
         */
        AnimationFrame.prototype.cancel = function (key) {
            var rafID = this.rafIDs.get(key);
            if (rafID) {
                cancelAnimationFrame(rafID);
                this.rafIDs.delete(key);
            }
        };
        /**
         * Cancels all queued callback.
         */
        AnimationFrame.prototype.cancelAll = function () {
            var _this = this;
            // Need to use forEach because it's the only iteration method supported
            // by IE11. Suppress the underscore because we don't need it.
            // tslint:disable-next-line:enforce-name-casing
            this.rafIDs.forEach(function (_, key) {
                _this.cancel(key);
            });
        };
        /**
         * Returns the queue of unexecuted callback keys.
         */
        AnimationFrame.prototype.getQueue = function () {
            var queue = [];
            // Need to use forEach because it's the only iteration method supported
            // by IE11. Suppress the underscore because we don't need it.
            // tslint:disable-next-line:enforce-name-casing
            this.rafIDs.forEach(function (_, key) {
                queue.push(key);
            });
            return queue;
        };
        return AnimationFrame;
    }());

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssPropertyNameMap = {
        animation: {
            prefixed: '-webkit-animation',
            standard: 'animation',
        },
        transform: {
            prefixed: '-webkit-transform',
            standard: 'transform',
        },
        transition: {
            prefixed: '-webkit-transition',
            standard: 'transition',
        },
    };
    function isWindow(windowObj) {
        return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
    }
    function getCorrectPropertyName(windowObj, cssProperty) {
        if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
            var el = windowObj.document.createElement('div');
            var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed;
            var isStandard = standard in el.style;
            return isStandard ? standard : prefixed;
        }
        return cssProperty;
    }

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var RICH = CssClasses.RICH, SHOWN = CssClasses.SHOWN, SHOWING = CssClasses.SHOWING, SHOWING_TRANSITION = CssClasses.SHOWING_TRANSITION, HIDE = CssClasses.HIDE, HIDE_TRANSITION = CssClasses.HIDE_TRANSITION, MULTILINE_TOOLTIP = CssClasses.MULTILINE_TOOLTIP;
    var AnimationKeys;
    (function (AnimationKeys) {
        AnimationKeys["POLL_ANCHOR"] = "poll_anchor";
    })(AnimationKeys || (AnimationKeys = {}));
    // Accessing `window` without a `typeof` check will throw on Node environments.
    var HAS_WINDOW = typeof window !== 'undefined';
    var MDCTooltipFoundation = /** @class */ (function (_super) {
        __extends(MDCTooltipFoundation, _super);
        function MDCTooltipFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCTooltipFoundation.defaultAdapter), adapter)) || this;
            _this.tooltipShown = false;
            _this.anchorGap = numbers$4.BOUNDED_ANCHOR_GAP;
            _this.xTooltipPos = XPosition.DETECTED;
            _this.yTooltipPos = YPosition.DETECTED;
            _this.tooltipPositionWithCaret = PositionWithCaret.DETECTED;
            // Minimum threshold distance needed between the tooltip and the viewport.
            _this.minViewportTooltipThreshold = numbers$4.MIN_VIEWPORT_TOOLTIP_THRESHOLD;
            _this.hideDelayMs = numbers$4.HIDE_DELAY_MS;
            _this.showDelayMs = numbers$4.SHOW_DELAY_MS;
            _this.anchorRect = null;
            _this.parentRect = null;
            _this.frameId = null;
            _this.hideTimeout = null;
            _this.showTimeout = null;
            _this.addAncestorScrollEventListeners = new Array();
            _this.removeAncestorScrollEventListeners = new Array();
            _this.animFrame = new AnimationFrame();
            _this.anchorBlurHandler = function (evt) {
                _this.handleAnchorBlur(evt);
            };
            _this.documentClickHandler = function (evt) {
                _this.handleDocumentClick(evt);
            };
            _this.documentKeydownHandler = function (evt) {
                _this.handleKeydown(evt);
            };
            _this.tooltipMouseEnterHandler = function () {
                _this.handleTooltipMouseEnter();
            };
            _this.tooltipMouseLeaveHandler = function () {
                _this.handleTooltipMouseLeave();
            };
            _this.richTooltipFocusOutHandler = function (evt) {
                _this.handleRichTooltipFocusOut(evt);
            };
            _this.windowScrollHandler = function () {
                _this.handleWindowScrollEvent();
            };
            _this.windowResizeHandler = function () {
                _this.handleWindowChangeEvent();
            };
            return _this;
        }
        Object.defineProperty(MDCTooltipFoundation, "defaultAdapter", {
            get: function () {
                return {
                    getAttribute: function () { return null; },
                    setAttribute: function () { return undefined; },
                    removeAttribute: function () { return undefined; },
                    addClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    removeClass: function () { return undefined; },
                    getComputedStyleProperty: function () { return ''; },
                    setStyleProperty: function () { return undefined; },
                    setSurfaceAnimationStyleProperty: function () { return undefined; },
                    getViewportWidth: function () { return 0; },
                    getViewportHeight: function () { return 0; },
                    getTooltipSize: function () { return ({ width: 0, height: 0 }); },
                    getAnchorBoundingRect: function () {
                        return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
                    },
                    getParentBoundingRect: function () {
                        return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
                    },
                    getAnchorAttribute: function () { return null; },
                    setAnchorAttribute: function () { return null; },
                    isRTL: function () { return false; },
                    anchorContainsElement: function () { return false; },
                    tooltipContainsElement: function () { return false; },
                    focusAnchorElement: function () { return undefined; },
                    registerEventHandler: function () { return undefined; },
                    deregisterEventHandler: function () { return undefined; },
                    registerAnchorEventHandler: function () { return undefined; },
                    deregisterAnchorEventHandler: function () { return undefined; },
                    registerDocumentEventHandler: function () { return undefined; },
                    deregisterDocumentEventHandler: function () { return undefined; },
                    registerWindowEventHandler: function () { return undefined; },
                    deregisterWindowEventHandler: function () { return undefined; },
                    notifyHidden: function () { return undefined; },
                    getTooltipCaretBoundingRect: function () {
                        return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
                    },
                    setTooltipCaretStyle: function () { return undefined; },
                    clearTooltipCaretStyles: function () { return undefined; },
                    getActiveElement: function () { return null; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCTooltipFoundation.prototype.init = function () {
            this.richTooltip = this.adapter.hasClass(RICH);
            this.persistentTooltip =
                this.adapter.getAttribute(attributes$2.PERSISTENT) === 'true';
            this.interactiveTooltip =
                !!this.adapter.getAnchorAttribute(attributes$2.ARIA_EXPANDED) &&
                    this.adapter.getAnchorAttribute(attributes$2.ARIA_HASPOPUP) === 'dialog';
            this.hasCaret = this.richTooltip &&
                this.adapter.getAttribute(attributes$2.HAS_CARET) === 'true';
        };
        MDCTooltipFoundation.prototype.isShown = function () {
            return this.tooltipShown;
        };
        MDCTooltipFoundation.prototype.isRich = function () {
            return this.richTooltip;
        };
        MDCTooltipFoundation.prototype.isPersistent = function () {
            return this.persistentTooltip;
        };
        MDCTooltipFoundation.prototype.handleAnchorMouseEnter = function () {
            var _this = this;
            if (this.tooltipShown) {
                // Covers the instance where a user hovers over the anchor to reveal the
                // tooltip, and then quickly navigates away and then back to the anchor.
                // The tooltip should stay visible without animating out and then back in
                // again.
                this.show();
            }
            else {
                // clearHideTimeout here since handleAnchorMouseLeave sets a hideTimeout
                // and that can execute before the showTimeout executes, resulting in hide
                // being called and the showTimeout set below to be cleared.
                this.clearHideTimeout();
                this.showTimeout = setTimeout(function () {
                    _this.show();
                }, this.showDelayMs);
            }
        };
        MDCTooltipFoundation.prototype.handleAnchorTouchstart = function () {
            var _this = this;
            this.showTimeout = setTimeout(function () {
                _this.show();
            }, this.showDelayMs);
            // Prevent a context menu from appearing if user is long-pressing on a
            // tooltip anchor.
            this.adapter.registerWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
        };
        MDCTooltipFoundation.prototype.preventContextMenuOnLongTouch = function (evt) {
            evt.preventDefault();
        };
        MDCTooltipFoundation.prototype.handleAnchorTouchend = function () {
            this.clearShowTimeout();
            // Only remove the 'contextmenu' listener if the tooltip is not shown. When
            // the tooltip *is* shown, listener is removed in the close method.
            if (!this.isShown()) {
                this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
            }
        };
        MDCTooltipFoundation.prototype.handleAnchorFocus = function (evt) {
            var _this = this;
            // TODO(b/157075286): Need to add some way to distinguish keyboard
            // navigation focus events from other focus events, and only show the
            // tooltip on the former of these events.
            var relatedTarget = evt.relatedTarget;
            var tooltipContainsRelatedTarget = relatedTarget instanceof HTMLElement &&
                this.adapter.tooltipContainsElement(relatedTarget);
            // Do not show tooltip if the previous focus was on a tooltip element. This
            // occurs when a rich tooltip is closed and focus is restored to the anchor
            // or when user tab-navigates back into the anchor from the rich tooltip.
            if (tooltipContainsRelatedTarget) {
                return;
            }
            this.showTimeout = setTimeout(function () {
                _this.show();
            }, this.showDelayMs);
        };
        MDCTooltipFoundation.prototype.handleAnchorMouseLeave = function () {
            var _this = this;
            this.clearShowTimeout();
            this.hideTimeout = setTimeout(function () {
                _this.hide();
            }, this.hideDelayMs);
        };
        MDCTooltipFoundation.prototype.handleAnchorClick = function () {
            if (this.tooltipShown) {
                this.hide();
            }
            else {
                this.show();
            }
        };
        MDCTooltipFoundation.prototype.handleDocumentClick = function (evt) {
            var anchorOrTooltipContainsTargetElement = evt.target instanceof HTMLElement &&
                (this.adapter.anchorContainsElement(evt.target) ||
                    this.adapter.tooltipContainsElement(evt.target));
            // For persistent rich tooltips, we will not hide if:
            // - The click target is within the anchor element. Otherwise, both
            //   the anchor element's click handler and this handler will handle the
            //   click (due to event propagation), resulting in a shown tooltip
            //   being immediately hidden if the tooltip was initially hidden.
            // - The click target is within the tooltip element, since clicks
            //   on the tooltip do not close the tooltip.
            if (this.richTooltip && this.persistentTooltip &&
                anchorOrTooltipContainsTargetElement) {
                return;
            }
            // Hide the tooltip immediately on click.
            this.hide();
        };
        MDCTooltipFoundation.prototype.handleKeydown = function (evt) {
            // Hide the tooltip immediately on ESC key.
            var key = normalizeKey(evt);
            if (key === KEY.ESCAPE) {
                var activeElement = this.adapter.getActiveElement();
                var tooltipContainsActiveElement = activeElement instanceof HTMLElement &&
                    this.adapter.tooltipContainsElement(activeElement);
                if (tooltipContainsActiveElement) {
                    this.adapter.focusAnchorElement();
                }
                this.hide();
            }
        };
        MDCTooltipFoundation.prototype.handleAnchorBlur = function (evt) {
            if (this.richTooltip) {
                var tooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement &&
                    this.adapter.tooltipContainsElement(evt.relatedTarget);
                // If focus changed to the tooltip element, don't hide the tooltip.
                if (tooltipContainsRelatedTargetElement) {
                    return;
                }
                if (evt.relatedTarget === null && this.interactiveTooltip) {
                    // If evt.relatedTarget is null, it is because focus is moving to an
                    // element that is not focusable. This should only occur in instances
                    // of a screen reader in browse mode/linear navigation mode. If the
                    // tooltip is interactive (and so the entire content is not read by
                    // the screen reader upon the tooltip being opened), we want to allow
                    // users to read the content of the tooltip (and not just the focusable
                    // elements).
                    return;
                }
            }
            // Hide tooltip immediately on focus change.
            this.hide();
        };
        MDCTooltipFoundation.prototype.handleTooltipMouseEnter = function () {
            this.show();
        };
        MDCTooltipFoundation.prototype.handleTooltipMouseLeave = function () {
            var _this = this;
            this.clearShowTimeout();
            this.hideTimeout = setTimeout(function () {
                _this.hide();
            }, this.hideDelayMs);
        };
        MDCTooltipFoundation.prototype.handleRichTooltipFocusOut = function (evt) {
            var anchorOrTooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement &&
                (this.adapter.anchorContainsElement(evt.relatedTarget) ||
                    this.adapter.tooltipContainsElement(evt.relatedTarget));
            // If the focus is still within the anchor or the tooltip, do not hide the
            // tooltip.
            if (anchorOrTooltipContainsRelatedTargetElement) {
                return;
            }
            if (evt.relatedTarget === null && this.interactiveTooltip) {
                // If evt.relatedTarget is null, it is because focus is moving to an
                // element that is not focusable. This should only occur in instances
                // of a screen reader in browse mode/linear navigation mode. If the
                // tooltip is interactive (and so the entire content is not read by
                // the screen reader upon the tooltip being opened), we want to allow
                // users to read the content of the tooltip (and not just the focusable
                // elements).
                return;
            }
            this.hide();
        };
        MDCTooltipFoundation.prototype.handleWindowScrollEvent = function () {
            if (this.persistentTooltip) {
                // Persistent tooltips remain visible on user scroll, call appropriate
                // handler to ensure the tooltip remains pinned to the anchor on page
                // scroll.
                this.handleWindowChangeEvent();
                return;
            }
            this.hide();
        };
        /**
         * On window resize or scroll, check the anchor position and size and
         * repostion tooltip if necessary.
         */
        MDCTooltipFoundation.prototype.handleWindowChangeEvent = function () {
            var _this = this;
            // Since scroll and resize events can fire at a high rate, we throttle
            // the potential re-positioning of tooltip component using
            // requestAnimationFrame.
            this.animFrame.request(AnimationKeys.POLL_ANCHOR, function () {
                _this.repositionTooltipOnAnchorMove();
            });
        };
        MDCTooltipFoundation.prototype.show = function () {
            var e_1, _a;
            var _this = this;
            this.clearHideTimeout();
            this.clearShowTimeout();
            if (this.tooltipShown) {
                return;
            }
            this.tooltipShown = true;
            this.adapter.removeAttribute('aria-hidden');
            if (this.richTooltip) {
                if (this.interactiveTooltip) {
                    this.adapter.setAnchorAttribute('aria-expanded', 'true');
                }
                this.adapter.registerEventHandler('focusout', this.richTooltipFocusOutHandler);
            }
            if (!this.persistentTooltip) {
                this.adapter.registerEventHandler('mouseenter', this.tooltipMouseEnterHandler);
                this.adapter.registerEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
            }
            this.adapter.removeClass(HIDE);
            this.adapter.addClass(SHOWING);
            if (this.isTooltipMultiline() && !this.richTooltip) {
                this.adapter.addClass(MULTILINE_TOOLTIP);
            }
            this.anchorRect = this.adapter.getAnchorBoundingRect();
            this.parentRect = this.adapter.getParentBoundingRect();
            this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip();
            this.adapter.registerAnchorEventHandler('blur', this.anchorBlurHandler);
            this.adapter.registerDocumentEventHandler('click', this.documentClickHandler);
            this.adapter.registerDocumentEventHandler('keydown', this.documentKeydownHandler);
            this.adapter.registerWindowEventHandler('scroll', this.windowScrollHandler);
            this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);
            try {
                // Register any additional scroll handlers
                for (var _b = __values(this.addAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var fn = _c.value;
                    fn();
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
            this.frameId = requestAnimationFrame(function () {
                _this.clearAllAnimationClasses();
                _this.adapter.addClass(SHOWN);
                _this.adapter.addClass(SHOWING_TRANSITION);
            });
        };
        MDCTooltipFoundation.prototype.hide = function () {
            var e_2, _a;
            this.clearHideTimeout();
            this.clearShowTimeout();
            if (!this.tooltipShown) {
                return;
            }
            if (this.frameId) {
                cancelAnimationFrame(this.frameId);
            }
            this.tooltipShown = false;
            this.adapter.setAttribute('aria-hidden', 'true');
            this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);
            if (this.richTooltip) {
                if (this.interactiveTooltip) {
                    this.adapter.setAnchorAttribute('aria-expanded', 'false');
                }
            }
            if (!this.persistentTooltip) {
                this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);
                this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
            }
            this.clearAllAnimationClasses();
            this.adapter.addClass(HIDE);
            this.adapter.addClass(HIDE_TRANSITION);
            this.adapter.removeClass(SHOWN);
            this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);
            this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);
            this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);
            this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);
            this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
            this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
            try {
                // Deregister any additional scroll handlers
                for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var fn = _c.value;
                    fn();
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_2) throw e_2.error; }
            }
        };
        MDCTooltipFoundation.prototype.handleTransitionEnd = function () {
            var isHidingTooltip = this.adapter.hasClass(HIDE);
            this.adapter.removeClass(SHOWING);
            this.adapter.removeClass(SHOWING_TRANSITION);
            this.adapter.removeClass(HIDE);
            this.adapter.removeClass(HIDE_TRANSITION);
            // If handleTransitionEnd is called after hiding the tooltip, the tooltip
            // will have the HIDE class (before calling the adapter removeClass method).
            // If tooltip is now hidden, send a notification that the animation has
            // completed and the tooltip is no longer visible.
            if (isHidingTooltip) {
                this.adapter.notifyHidden();
            }
        };
        MDCTooltipFoundation.prototype.clearAllAnimationClasses = function () {
            this.adapter.removeClass(SHOWING_TRANSITION);
            this.adapter.removeClass(HIDE_TRANSITION);
        };
        MDCTooltipFoundation.prototype.setTooltipPosition = function (position) {
            var xPos = position.xPos, yPos = position.yPos, withCaretPos = position.withCaretPos;
            if (this.hasCaret && withCaretPos) {
                this.tooltipPositionWithCaret = withCaretPos;
                return;
            }
            if (xPos) {
                this.xTooltipPos = xPos;
            }
            if (yPos) {
                this.yTooltipPos = yPos;
            }
        };
        MDCTooltipFoundation.prototype.setAnchorBoundaryType = function (type) {
            if (type === AnchorBoundaryType.UNBOUNDED) {
                this.anchorGap = numbers$4.UNBOUNDED_ANCHOR_GAP;
            }
            else {
                this.anchorGap = numbers$4.BOUNDED_ANCHOR_GAP;
            }
        };
        MDCTooltipFoundation.prototype.setShowDelay = function (delayMs) {
            this.showDelayMs = delayMs;
        };
        MDCTooltipFoundation.prototype.setHideDelay = function (delayMs) {
            this.hideDelayMs = delayMs;
        };
        MDCTooltipFoundation.prototype.isTooltipMultiline = function () {
            var tooltipSize = this.adapter.getTooltipSize();
            return tooltipSize.height > numbers$4.MIN_HEIGHT &&
                tooltipSize.width >= numbers$4.MAX_WIDTH;
        };
        MDCTooltipFoundation.prototype.positionPlainTooltip = function () {
            // A plain tooltip has `fixed` positioning and is placed as an immediate
            // child of the document body. Its positioning is calculated with respect to
            // the viewport.
            var _a = this.calculateTooltipStyles(this.anchorRect), top = _a.top, yTransformOrigin = _a.yTransformOrigin, left = _a.left, xTransformOrigin = _a.xTransformOrigin;
            var transformProperty = HAS_WINDOW ? getCorrectPropertyName(window, 'transform') : 'transform';
            this.adapter.setSurfaceAnimationStyleProperty(transformProperty + "-origin", xTransformOrigin + " " + yTransformOrigin);
            this.adapter.setStyleProperty('top', top + "px");
            this.adapter.setStyleProperty('left', left + "px");
        };
        MDCTooltipFoundation.prototype.positionRichTooltip = function () {
            // TODO(b/177686782): Remove width setting when max-content is used to style
            // the rich tooltip.
            var _a, _b, _c, _d;
            // getComputedStyleProperty is used instead of getTooltipSize since
            // getTooltipSize returns the offSetWidth, which includes the border and
            // padding. What we need is the width of the tooltip without border and
            // padding.
            var width = this.adapter.getComputedStyleProperty('width');
            // When rich tooltips are positioned within their parent containers, the
            // tooltip width might be shrunk if it collides with the edge of the parent
            // container. We set the width of the tooltip to prevent this.
            this.adapter.setStyleProperty('width', width);
            var _e = this.hasCaret ?
                this.calculateTooltipWithCaretStyles(this.anchorRect) :
                this.calculateTooltipStyles(this.anchorRect), top = _e.top, yTransformOrigin = _e.yTransformOrigin, left = _e.left, xTransformOrigin = _e.xTransformOrigin;
            var transformProperty = HAS_WINDOW ? getCorrectPropertyName(window, 'transform') : 'transform';
            this.adapter.setSurfaceAnimationStyleProperty(transformProperty + "-origin", xTransformOrigin + " " + yTransformOrigin);
            // A rich tooltip has `absolute` positioning and is placed as a sibling to
            // the anchor element. Its positioning is calculated with respect to the
            // parent element, and so the values need to be adjusted against the parent
            // element.
            var leftAdjustment = left - ((_b = (_a = this.parentRect) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0);
            var topAdjustment = top - ((_d = (_c = this.parentRect) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0);
            this.adapter.setStyleProperty('top', topAdjustment + "px");
            this.adapter.setStyleProperty('left', leftAdjustment + "px");
        };
        /**
         * Calculates the position of the tooltip. A tooltip will be placed beneath
         * the anchor element and aligned either with the 'start'/'end' edge of the
         * anchor element or the 'center'.
         *
         * Tooltip alignment is selected such that the tooltip maintains a threshold
         * distance away from the viewport (defaulting to 'center' alignment). If the
         * placement of the anchor prevents this threshold distance from being
         * maintained, the tooltip is positioned so that it does not collide with the
         * viewport.
         *
         * Users can specify an alignment, however, if this alignment results in the
         * tooltip colliding with the viewport, this specification is overwritten.
         */
        MDCTooltipFoundation.prototype.calculateTooltipStyles = function (anchorRect) {
            if (!anchorRect) {
                return { top: 0, left: 0 };
            }
            var tooltipSize = this.adapter.getTooltipSize();
            var top = this.calculateYTooltipDistance(anchorRect, tooltipSize.height);
            var left = this.calculateXTooltipDistance(anchorRect, tooltipSize.width);
            return {
                top: top.distance,
                yTransformOrigin: top.yTransformOrigin,
                left: left.distance,
                xTransformOrigin: left.xTransformOrigin
            };
        };
        /**
         * Calculates the `left` distance for the tooltip.
         * Returns the distance value and a string indicating the x-axis transform-
         * origin that should be used when animating the tooltip.
         */
        MDCTooltipFoundation.prototype.calculateXTooltipDistance = function (anchorRect, tooltipWidth) {
            var isLTR = !this.adapter.isRTL();
            var startPos, endPos, centerPos;
            var startTransformOrigin, endTransformOrigin;
            if (this.richTooltip) {
                startPos = isLTR ? anchorRect.left - tooltipWidth : anchorRect.right;
                endPos = isLTR ? anchorRect.right : anchorRect.left - tooltipWidth;
                startTransformOrigin = isLTR ? strings$9.RIGHT : strings$9.LEFT;
                endTransformOrigin = isLTR ? strings$9.LEFT : strings$9.RIGHT;
            }
            else {
                startPos = isLTR ? anchorRect.left : anchorRect.right - tooltipWidth;
                endPos = isLTR ? anchorRect.right - tooltipWidth : anchorRect.left;
                centerPos = anchorRect.left + (anchorRect.width - tooltipWidth) / 2;
                startTransformOrigin = isLTR ? strings$9.LEFT : strings$9.RIGHT;
                endTransformOrigin = isLTR ? strings$9.RIGHT : strings$9.LEFT;
            }
            var positionOptions = this.richTooltip ?
                this.determineValidPositionOptions(startPos, endPos) :
                // For plain tooltips, centerPos is defined
                this.determineValidPositionOptions(centerPos, startPos, endPos);
            if (this.xTooltipPos === XPosition.START && positionOptions.has(startPos)) {
                return { distance: startPos, xTransformOrigin: startTransformOrigin };
            }
            if (this.xTooltipPos === XPosition.END && positionOptions.has(endPos)) {
                return { distance: endPos, xTransformOrigin: endTransformOrigin };
            }
            if (this.xTooltipPos === XPosition.CENTER &&
                positionOptions.has(centerPos)) {
                // This code path is only executed if calculating the distance for plain
                // tooltips. In this instance, centerPos will always be defined, so we can
                // safely assert that the returned value is non-null/undefined.
                return { distance: centerPos, xTransformOrigin: strings$9.CENTER };
            }
            // If no user position is supplied, rich tooltips default to end pos, then
            // start position. Plain tooltips default to center, start, then end.
            var possiblePositions = this.richTooltip ?
                [
                    { distance: endPos, xTransformOrigin: endTransformOrigin },
                    { distance: startPos, xTransformOrigin: startTransformOrigin }
                ] :
                [
                    { distance: centerPos, xTransformOrigin: strings$9.CENTER },
                    { distance: startPos, xTransformOrigin: startTransformOrigin },
                    { distance: endPos, xTransformOrigin: endTransformOrigin }
                ];
            var validPosition = possiblePositions.find(function (_a) {
                var distance = _a.distance;
                return positionOptions.has(distance);
            });
            if (validPosition) {
                return validPosition;
            }
            // Indicates that all potential positions would result in the tooltip
            // colliding with the viewport. This would only occur when the anchor
            // element itself collides with the viewport, or the viewport is very
            // narrow. In this case, we allow the tooltip to be mis-aligned from the
            // anchor element.
            if (anchorRect.left < 0) {
                return {
                    distance: this.minViewportTooltipThreshold,
                    xTransformOrigin: strings$9.LEFT
                };
            }
            else {
                var viewportWidth = this.adapter.getViewportWidth();
                var distance = viewportWidth - (tooltipWidth + this.minViewportTooltipThreshold);
                return { distance: distance, xTransformOrigin: strings$9.RIGHT };
            }
        };
        /**
         * Given the values for the horizontal alignments of the tooltip, calculates
         * which of these options would result in the tooltip maintaining the required
         * threshold distance vs which would result in the tooltip staying within the
         * viewport.
         *
         * A Set of values is returned holding the distances that would honor the
         * above requirements. Following the logic for determining the tooltip
         * position, if all alignments violate the threshold, then the returned Set
         * contains values that keep the tooltip within the viewport.
         */
        MDCTooltipFoundation.prototype.determineValidPositionOptions = function () {
            var e_3, _a;
            var positions = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                positions[_i] = arguments[_i];
            }
            var posWithinThreshold = new Set();
            var posWithinViewport = new Set();
            try {
                for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
                    var position = positions_1_1.value;
                    if (this.positionHonorsViewportThreshold(position)) {
                        posWithinThreshold.add(position);
                    }
                    else if (this.positionDoesntCollideWithViewport(position)) {
                        posWithinViewport.add(position);
                    }
                }
            }
            catch (e_3_1) { e_3 = { error: e_3_1 }; }
            finally {
                try {
                    if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
                }
                finally { if (e_3) throw e_3.error; }
            }
            return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
        };
        MDCTooltipFoundation.prototype.positionHonorsViewportThreshold = function (leftPos) {
            var viewportWidth = this.adapter.getViewportWidth();
            var tooltipWidth = this.adapter.getTooltipSize().width;
            return leftPos + tooltipWidth <=
                viewportWidth - this.minViewportTooltipThreshold &&
                leftPos >= this.minViewportTooltipThreshold;
        };
        MDCTooltipFoundation.prototype.positionDoesntCollideWithViewport = function (leftPos) {
            var viewportWidth = this.adapter.getViewportWidth();
            var tooltipWidth = this.adapter.getTooltipSize().width;
            return leftPos + tooltipWidth <= viewportWidth && leftPos >= 0;
        };
        /**
         * Calculates the `top` distance for the tooltip.
         * Returns the distance value and a string indicating the y-axis transform-
         * origin that should be used when animating the tooltip.
         */
        MDCTooltipFoundation.prototype.calculateYTooltipDistance = function (anchorRect, tooltipHeight) {
            var belowYPos = anchorRect.bottom + this.anchorGap;
            var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight);
            var yPositionOptions = this.determineValidYPositionOptions(aboveYPos, belowYPos);
            if (this.yTooltipPos === YPosition.ABOVE &&
                yPositionOptions.has(aboveYPos)) {
                return { distance: aboveYPos, yTransformOrigin: strings$9.BOTTOM };
            }
            else if (this.yTooltipPos === YPosition.BELOW &&
                yPositionOptions.has(belowYPos)) {
                return { distance: belowYPos, yTransformOrigin: strings$9.TOP };
            }
            if (yPositionOptions.has(belowYPos)) {
                return { distance: belowYPos, yTransformOrigin: strings$9.TOP };
            }
            if (yPositionOptions.has(aboveYPos)) {
                return { distance: aboveYPos, yTransformOrigin: strings$9.BOTTOM };
            }
            // Indicates that all potential positions would result in the tooltip
            // colliding with the viewport. This would only occur when the viewport is
            // very short.
            return { distance: belowYPos, yTransformOrigin: strings$9.TOP };
        };
        /**
         * Given the values for above/below alignment of the tooltip, calculates
         * which of these options would result in the tooltip maintaining the required
         * threshold distance vs which would result in the tooltip staying within the
         * viewport.
         *
         * A Set of values is returned holding the distances that would honor the
         * above requirements. Following the logic for determining the tooltip
         * position, if all possible alignments violate the threshold, then the
         * returned Set contains values that keep the tooltip within the viewport.
         */
        MDCTooltipFoundation.prototype.determineValidYPositionOptions = function (aboveAnchorPos, belowAnchorPos) {
            var posWithinThreshold = new Set();
            var posWithinViewport = new Set();
            if (this.yPositionHonorsViewportThreshold(aboveAnchorPos)) {
                posWithinThreshold.add(aboveAnchorPos);
            }
            else if (this.yPositionDoesntCollideWithViewport(aboveAnchorPos)) {
                posWithinViewport.add(aboveAnchorPos);
            }
            if (this.yPositionHonorsViewportThreshold(belowAnchorPos)) {
                posWithinThreshold.add(belowAnchorPos);
            }
            else if (this.yPositionDoesntCollideWithViewport(belowAnchorPos)) {
                posWithinViewport.add(belowAnchorPos);
            }
            return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
        };
        MDCTooltipFoundation.prototype.yPositionHonorsViewportThreshold = function (yPos) {
            var viewportHeight = this.adapter.getViewportHeight();
            var tooltipHeight = this.adapter.getTooltipSize().height;
            return yPos + tooltipHeight + this.minViewportTooltipThreshold <=
                viewportHeight &&
                yPos >= this.minViewportTooltipThreshold;
        };
        MDCTooltipFoundation.prototype.yPositionDoesntCollideWithViewport = function (yPos) {
            var viewportHeight = this.adapter.getViewportHeight();
            var tooltipHeight = this.adapter.getTooltipSize().height;
            return yPos + tooltipHeight <= viewportHeight && yPos >= 0;
        };
        MDCTooltipFoundation.prototype.calculateTooltipWithCaretStyles = function (anchorRect) {
            // Prior to grabbing the caret bounding rect, we clear all styles set on the
            // caret. This will ensure the width/height is consistent (since we rotate
            // the caret 90deg in some positions which would result in the height and
            // width bounding rect measurements flipping).
            this.adapter.clearTooltipCaretStyles();
            var caretSize = this.adapter.getTooltipCaretBoundingRect();
            if (!anchorRect || !caretSize) {
                return { position: PositionWithCaret.DETECTED, top: 0, left: 0 };
            }
            // The caret for the rich tooltip is created by rotating/skewing/scaling
            // square div into a diamond shape and then hiding half of it so it looks
            // like a triangle. We use the boundingClientRect to calculate the
            // width/height of the element after the transforms (to the caret) have been
            // applied. Since the full tooltip is scaled by 0.8 for the entrance
            // animation, we divide by this value to retrieve the actual caret
            // dimensions.
            var caretWidth = caretSize.width / numbers$4.ANIMATION_SCALE;
            // Since we hide half of caret, we divide the returned ClientRect height
            // by 2.
            var caretHeight = (caretSize.height / numbers$4.ANIMATION_SCALE) / 2;
            var tooltipSize = this.adapter.getTooltipSize();
            var yOptions = this.calculateYWithCaretDistanceOptions(anchorRect, tooltipSize.height, { caretWidth: caretWidth, caretHeight: caretHeight });
            var xOptions = this.calculateXWithCaretDistanceOptions(anchorRect, tooltipSize.width, { caretWidth: caretWidth, caretHeight: caretHeight });
            var positionOptions = this.validateTooltipWithCaretDistances(yOptions, xOptions);
            if (positionOptions.size < 1) {
                positionOptions = this.generateBackupPositionOption(anchorRect, tooltipSize, { caretWidth: caretWidth, caretHeight: caretHeight });
            }
            var _a = this.determineTooltipWithCaretDistance(positionOptions), position = _a.position, xDistance = _a.xDistance, yDistance = _a.yDistance;
            // After determining the position of the tooltip relative to the anchor,
            // place the caret in the corresponding position and retrieve the necessary
            // x/y transform origins needed to properly animate the tooltip entrance.
            var _b = this.setCaretPositionStyles(position, { caretWidth: caretWidth, caretHeight: caretHeight }), yTransformOrigin = _b.yTransformOrigin, xTransformOrigin = _b.xTransformOrigin;
            return {
                yTransformOrigin: yTransformOrigin,
                xTransformOrigin: xTransformOrigin,
                top: yDistance,
                left: xDistance
            };
        };
        MDCTooltipFoundation.prototype.calculateXWithCaretDistanceOptions = function (anchorRect, tooltipWidth, caretSize) {
            var caretWidth = caretSize.caretWidth, caretHeight = caretSize.caretHeight;
            var isLTR = !this.adapter.isRTL();
            var anchorMidpoint = anchorRect.left + anchorRect.width / 2;
            var sideLeftAligned = anchorRect.left - (tooltipWidth + this.anchorGap + caretHeight);
            var sideRightAligned = anchorRect.right + this.anchorGap + caretHeight;
            var sideStartPos = isLTR ? sideLeftAligned : sideRightAligned;
            var sideEndPos = isLTR ? sideRightAligned : sideLeftAligned;
            var verticalLeftAligned = anchorMidpoint - (numbers$4.CARET_INDENTATION + caretWidth / 2);
            var verticalRightAligned = anchorMidpoint -
                (tooltipWidth - numbers$4.CARET_INDENTATION - caretWidth / 2);
            var verticalStartPos = isLTR ? verticalLeftAligned : verticalRightAligned;
            var verticalEndPos = isLTR ? verticalRightAligned : verticalLeftAligned;
            var verticalCenterPos = anchorMidpoint - tooltipWidth / 2;
            var possiblePositionsMap = new Map([
                [XPositionWithCaret.START, verticalStartPos],
                [XPositionWithCaret.CENTER, verticalCenterPos],
                [XPositionWithCaret.END, verticalEndPos],
                [XPositionWithCaret.SIDE_END, sideEndPos],
                [XPositionWithCaret.SIDE_START, sideStartPos],
            ]);
            return possiblePositionsMap;
        };
        MDCTooltipFoundation.prototype.calculateYWithCaretDistanceOptions = function (anchorRect, tooltipHeight, caretSize) {
            var caretWidth = caretSize.caretWidth, caretHeight = caretSize.caretHeight;
            var anchorMidpoint = anchorRect.top + anchorRect.height / 2;
            var belowYPos = anchorRect.bottom + this.anchorGap + caretHeight;
            var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight + caretHeight);
            var sideTopYPos = anchorMidpoint - (numbers$4.CARET_INDENTATION + caretWidth / 2);
            var sideCenterYPos = anchorMidpoint - (tooltipHeight / 2);
            var sideBottomYPos = anchorMidpoint -
                (tooltipHeight - numbers$4.CARET_INDENTATION - caretWidth / 2);
            var possiblePositionsMap = new Map([
                [YPositionWithCaret.ABOVE, aboveYPos],
                [YPositionWithCaret.BELOW, belowYPos],
                [YPositionWithCaret.SIDE_TOP, sideTopYPos],
                [YPositionWithCaret.SIDE_CENTER, sideCenterYPos],
                [YPositionWithCaret.SIDE_BOTTOM, sideBottomYPos],
            ]);
            return possiblePositionsMap;
        };
        MDCTooltipFoundation.prototype.repositionTooltipOnAnchorMove = function () {
            var newAnchorRect = this.adapter.getAnchorBoundingRect();
            if (!newAnchorRect || !this.anchorRect)
                return;
            if (newAnchorRect.top !== this.anchorRect.top ||
                newAnchorRect.left !== this.anchorRect.left ||
                newAnchorRect.height !== this.anchorRect.height ||
                newAnchorRect.width !== this.anchorRect.width) {
                this.anchorRect = newAnchorRect;
                this.parentRect = this.adapter.getParentBoundingRect();
                this.richTooltip ? this.positionRichTooltip() :
                    this.positionPlainTooltip();
            }
        };
        /**
         * Given a list of x/y position options for a rich tooltip with caret, checks
         * if valid x/y combinations of these position options are either within the
         * viewport threshold, or simply within the viewport. Returns a map with the
         * valid x/y position combinations that all either honor the viewport
         * threshold or are simply inside within the viewport.
         */
        MDCTooltipFoundation.prototype.validateTooltipWithCaretDistances = function (yOptions, xOptions) {
            var e_4, _a, e_5, _b, e_6, _c;
            var posWithinThreshold = new Map();
            var posWithinViewport = new Map();
            // If a tooltip has a caret, not all combinations of YPositionWithCarets and
            // XPositionWithCarets are possible. Because of this we only check the
            // validity of a given XPositionWithCaret if a potential corresponding
            // YPositionWithCaret is valid.
            var validMappings = new Map([
                [
                    YPositionWithCaret.ABOVE,
                    [
                        XPositionWithCaret.START, XPositionWithCaret.CENTER,
                        XPositionWithCaret.END
                    ]
                ],
                [
                    YPositionWithCaret.BELOW,
                    [
                        XPositionWithCaret.START, XPositionWithCaret.CENTER,
                        XPositionWithCaret.END
                    ]
                ],
                [
                    YPositionWithCaret.SIDE_TOP,
                    [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]
                ],
                [
                    YPositionWithCaret.SIDE_CENTER,
                    [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]
                ],
                [
                    YPositionWithCaret.SIDE_BOTTOM,
                    [XPositionWithCaret.SIDE_START, XPositionWithCaret.SIDE_END]
                ],
            ]);
            try {
                for (var _d = __values(validMappings.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {
                    var y = _e.value;
                    var yDistance = yOptions.get(y);
                    if (this.yPositionHonorsViewportThreshold(yDistance)) {
                        try {
                            for (var _f = (e_5 = void 0, __values(validMappings.get(y))), _g = _f.next(); !_g.done; _g = _f.next()) {
                                var x = _g.value;
                                var xDistance = xOptions.get(x);
                                if (this.positionHonorsViewportThreshold(xDistance)) {
                                    var caretPositionName = this.caretPositionOptionsMapping(x, y);
                                    posWithinThreshold.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });
                                }
                            }
                        }
                        catch (e_5_1) { e_5 = { error: e_5_1 }; }
                        finally {
                            try {
                                if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
                            }
                            finally { if (e_5) throw e_5.error; }
                        }
                    }
                    else if (this.yPositionDoesntCollideWithViewport(yDistance)) {
                        try {
                            for (var _h = (e_6 = void 0, __values(validMappings.get(y))), _j = _h.next(); !_j.done; _j = _h.next()) {
                                var x = _j.value;
                                var xDistance = xOptions.get(x);
                                if (this.positionDoesntCollideWithViewport(xDistance)) {
                                    var caretPositionName = this.caretPositionOptionsMapping(x, y);
                                    posWithinViewport.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });
                                }
                            }
                        }
                        catch (e_6_1) { e_6 = { error: e_6_1 }; }
                        finally {
                            try {
                                if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
                            }
                            finally { if (e_6) throw e_6.error; }
                        }
                    }
                }
            }
            catch (e_4_1) { e_4 = { error: e_4_1 }; }
            finally {
                try {
                    if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
                }
                finally { if (e_4) throw e_4.error; }
            }
            return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
        };
        /**
         * Method for generating a horizontal and vertical position for the tooltip if
         * all other calculated values are considered invalid. This would only happen
         * in situations of very small viewports/large tooltips.
         */
        MDCTooltipFoundation.prototype.generateBackupPositionOption = function (anchorRect, tooltipSize, caretSize) {
            var isLTR = !this.adapter.isRTL();
            var xDistance;
            var xPos;
            if (anchorRect.left < 0) {
                xDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;
                xPos = isLTR ? XPositionWithCaret.END : XPositionWithCaret.START;
            }
            else {
                var viewportWidth = this.adapter.getViewportWidth();
                xDistance = viewportWidth -
                    (tooltipSize.width + this.minViewportTooltipThreshold +
                        caretSize.caretHeight);
                xPos = isLTR ? XPositionWithCaret.START : XPositionWithCaret.END;
            }
            var yDistance;
            var yPos;
            if (anchorRect.top < 0) {
                yDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;
                yPos = YPositionWithCaret.BELOW;
            }
            else {
                var viewportHeight = this.adapter.getViewportHeight();
                yDistance = viewportHeight -
                    (tooltipSize.height + this.minViewportTooltipThreshold +
                        caretSize.caretHeight);
                yPos = YPositionWithCaret.ABOVE;
            }
            var caretPositionName = this.caretPositionOptionsMapping(xPos, yPos);
            return new Map([[caretPositionName, { xDistance: xDistance, yDistance: yDistance }]]);
        };
        /**
         * Given a list of valid position options for a rich tooltip with caret,
         * returns the option that should be used.
         */
        MDCTooltipFoundation.prototype.determineTooltipWithCaretDistance = function (options) {
            if (options.has(this.tooltipPositionWithCaret)) {
                var tooltipPos = options.get(this.tooltipPositionWithCaret);
                return {
                    position: this.tooltipPositionWithCaret,
                    xDistance: tooltipPos.xDistance,
                    yDistance: tooltipPos.yDistance,
                };
            }
            var orderPref = [
                PositionWithCaret.ABOVE_START, PositionWithCaret.ABOVE_CENTER,
                PositionWithCaret.ABOVE_END, PositionWithCaret.TOP_SIDE_START,
                PositionWithCaret.CENTER_SIDE_START, PositionWithCaret.BOTTOM_SIDE_START,
                PositionWithCaret.TOP_SIDE_END, PositionWithCaret.CENTER_SIDE_END,
                PositionWithCaret.BOTTOM_SIDE_END, PositionWithCaret.BELOW_START,
                PositionWithCaret.BELOW_CENTER, PositionWithCaret.BELOW_END
            ];
            // Before calling this method we check whether or not the "options" param
            // is empty and invoke a different method. We, therefore, can be certain
            // that "validPosition" will always be defined.
            var validPosition = orderPref.find(function (pos) { return options.has(pos); });
            var pos = options.get(validPosition);
            return {
                position: validPosition,
                xDistance: pos.xDistance,
                yDistance: pos.yDistance,
            };
        };
        /**
         * Returns the corresponding PositionWithCaret enum for the proivded
         * XPositionWithCaret and YPositionWithCaret enums. This mapping exists so our
         * public API accepts only PositionWithCaret enums (as all combinations of
         * XPositionWithCaret and YPositionWithCaret are not valid), but internally we
         * can calculate the X and Y positions of a rich tooltip with caret
         * separately.
         */
        MDCTooltipFoundation.prototype.caretPositionOptionsMapping = function (xPos, yPos) {
            switch (yPos) {
                case YPositionWithCaret.ABOVE:
                    if (xPos === XPositionWithCaret.START) {
                        return PositionWithCaret.ABOVE_START;
                    }
                    else if (xPos === XPositionWithCaret.CENTER) {
                        return PositionWithCaret.ABOVE_CENTER;
                    }
                    else if (xPos === XPositionWithCaret.END) {
                        return PositionWithCaret.ABOVE_END;
                    }
                    break;
                case YPositionWithCaret.BELOW:
                    if (xPos === XPositionWithCaret.START) {
                        return PositionWithCaret.BELOW_START;
                    }
                    else if (xPos === XPositionWithCaret.CENTER) {
                        return PositionWithCaret.BELOW_CENTER;
                    }
                    else if (xPos === XPositionWithCaret.END) {
                        return PositionWithCaret.BELOW_END;
                    }
                    break;
                case YPositionWithCaret.SIDE_TOP:
                    if (xPos === XPositionWithCaret.SIDE_START) {
                        return PositionWithCaret.TOP_SIDE_START;
                    }
                    else if (xPos === XPositionWithCaret.SIDE_END) {
                        return PositionWithCaret.TOP_SIDE_END;
                    }
                    break;
                case YPositionWithCaret.SIDE_CENTER:
                    if (xPos === XPositionWithCaret.SIDE_START) {
                        return PositionWithCaret.CENTER_SIDE_START;
                    }
                    else if (xPos === XPositionWithCaret.SIDE_END) {
                        return PositionWithCaret.CENTER_SIDE_END;
                    }
                    break;
                case YPositionWithCaret.SIDE_BOTTOM:
                    if (xPos === XPositionWithCaret.SIDE_START) {
                        return PositionWithCaret.BOTTOM_SIDE_START;
                    }
                    else if (xPos === XPositionWithCaret.SIDE_END) {
                        return PositionWithCaret.BOTTOM_SIDE_END;
                    }
                    break;
            }
            throw new Error("MDCTooltipFoundation: Invalid caret position of " + xPos + ", " + yPos);
        };
        /**
         * Given a PositionWithCaret, applies the correct styles to the caret element
         * so that it is positioned properly on the rich tooltip.
         * Returns the x and y positions of the caret, to be used as the
         * transform-origin on the tooltip itself for entrance animations.
         */
        MDCTooltipFoundation.prototype.setCaretPositionStyles = function (position, caretSize) {
            var e_7, _a;
            var values = this.calculateCaretPositionOnTooltip(position, caretSize);
            if (!values) {
                return { yTransformOrigin: 0, xTransformOrigin: 0 };
            }
            // Prior to setting the caret position styles, clear any previous styles
            // set. This is necessary as all position options do not use the same
            // properties (e.g. using 'left' or 'right') and so old style properties
            // might not get overridden, causing misplaced carets.
            this.adapter.clearTooltipCaretStyles();
            this.adapter.setTooltipCaretStyle(values.yAlignment, values.yAxisPx);
            this.adapter.setTooltipCaretStyle(values.xAlignment, values.xAxisPx);
            // Value of scaleX is cos(skew), Math.cos() expects radians though, so we
            // must first convert the skew value (which is in degrees) to radians.
            var skewRadians = values.skew * (Math.PI / 180);
            var scaleX = Math.cos(skewRadians);
            this.adapter.setTooltipCaretStyle('transform', "rotate(" + values.rotation + "deg) skewY(" + values.skew + "deg) scaleX(" + scaleX + ")");
            this.adapter.setTooltipCaretStyle('transform-origin', values.xAlignment + " " + values.yAlignment);
            try {
                for (var _b = __values(values.caretCorners), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var corner = _c.value;
                    this.adapter.setTooltipCaretStyle(corner, '0');
                }
            }
            catch (e_7_1) { e_7 = { error: e_7_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_7) throw e_7.error; }
            }
            return {
                yTransformOrigin: values.yTransformOrigin,
                xTransformOrigin: values.xTransformOrigin
            };
        };
        /**
         * Given a PositionWithCaret, determines the correct styles to position the
         * caret properly on the rich tooltip.
         */
        MDCTooltipFoundation.prototype.calculateCaretPositionOnTooltip = function (tooltipPos, caretSize) {
            var isLTR = !this.adapter.isRTL();
            var tooltipWidth = this.adapter.getComputedStyleProperty('width');
            var tooltipHeight = this.adapter.getComputedStyleProperty('height');
            if (!tooltipWidth || !tooltipHeight || !caretSize) {
                return;
            }
            var midpointWidth = "calc((" + tooltipWidth + " - " + caretSize.caretWidth + "px) / 2)";
            var midpointHeight = "calc((" + tooltipHeight + " - " + caretSize.caretWidth + "px) / 2)";
            var flushWithEdge = '0';
            var indentedFromEdge = numbers$4.CARET_INDENTATION + "px";
            var indentedFromWidth = "calc(" + tooltipWidth + " - " + indentedFromEdge + ")";
            var indentedFromHeight = "calc(" + tooltipHeight + " - " + indentedFromEdge + ")";
            var verticalRotation = 35;
            var horizontalRotation = Math.abs(90 - verticalRotation);
            var bottomRightTopLeftBorderRadius = ['border-bottom-right-radius', 'border-top-left-radius'];
            var bottomLeftTopRightBorderRadius = ['border-bottom-left-radius', 'border-top-right-radius'];
            var skewDeg = 20;
            switch (tooltipPos) {
                case PositionWithCaret.BELOW_CENTER:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: strings$9.LEFT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: midpointWidth,
                        rotation: -1 * verticalRotation,
                        skew: -1 * skewDeg,
                        xTransformOrigin: midpointWidth,
                        yTransformOrigin: flushWithEdge,
                        caretCorners: bottomRightTopLeftBorderRadius,
                    };
                case PositionWithCaret.BELOW_END:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.RIGHT : strings$9.LEFT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: indentedFromEdge,
                        rotation: isLTR ? verticalRotation : -1 * verticalRotation,
                        skew: isLTR ? skewDeg : -1 * skewDeg,
                        xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,
                        yTransformOrigin: flushWithEdge,
                        caretCorners: isLTR ? bottomLeftTopRightBorderRadius :
                            bottomRightTopLeftBorderRadius,
                    };
                case PositionWithCaret.BELOW_START:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.LEFT : strings$9.RIGHT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: indentedFromEdge,
                        rotation: isLTR ? -1 * verticalRotation : verticalRotation,
                        skew: isLTR ? -1 * skewDeg : skewDeg,
                        xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,
                        yTransformOrigin: flushWithEdge,
                        caretCorners: isLTR ? bottomRightTopLeftBorderRadius :
                            bottomLeftTopRightBorderRadius,
                    };
                case PositionWithCaret.TOP_SIDE_END:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.LEFT : strings$9.RIGHT,
                        yAxisPx: indentedFromEdge,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
                        skew: isLTR ? -1 * skewDeg : skewDeg,
                        xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
                        yTransformOrigin: indentedFromEdge,
                        caretCorners: isLTR ? bottomRightTopLeftBorderRadius :
                            bottomLeftTopRightBorderRadius,
                    };
                case PositionWithCaret.CENTER_SIDE_END:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.LEFT : strings$9.RIGHT,
                        yAxisPx: midpointHeight,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
                        skew: isLTR ? -1 * skewDeg : skewDeg,
                        xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
                        yTransformOrigin: midpointHeight,
                        caretCorners: isLTR ? bottomRightTopLeftBorderRadius :
                            bottomLeftTopRightBorderRadius,
                    };
                case PositionWithCaret.BOTTOM_SIDE_END:
                    return {
                        yAlignment: strings$9.BOTTOM,
                        xAlignment: isLTR ? strings$9.LEFT : strings$9.RIGHT,
                        yAxisPx: indentedFromEdge,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
                        skew: isLTR ? skewDeg : -1 * skewDeg,
                        xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
                        yTransformOrigin: indentedFromHeight,
                        caretCorners: isLTR ? bottomLeftTopRightBorderRadius :
                            bottomRightTopLeftBorderRadius,
                    };
                case PositionWithCaret.TOP_SIDE_START:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.RIGHT : strings$9.LEFT,
                        yAxisPx: indentedFromEdge,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
                        skew: isLTR ? skewDeg : -1 * skewDeg,
                        xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
                        yTransformOrigin: indentedFromEdge,
                        caretCorners: isLTR ? bottomLeftTopRightBorderRadius :
                            bottomRightTopLeftBorderRadius,
                    };
                case PositionWithCaret.CENTER_SIDE_START:
                    return {
                        yAlignment: strings$9.TOP,
                        xAlignment: isLTR ? strings$9.RIGHT : strings$9.LEFT,
                        yAxisPx: midpointHeight,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
                        skew: isLTR ? skewDeg : -1 * skewDeg,
                        xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
                        yTransformOrigin: midpointHeight,
                        caretCorners: isLTR ? bottomLeftTopRightBorderRadius :
                            bottomRightTopLeftBorderRadius,
                    };
                case PositionWithCaret.BOTTOM_SIDE_START:
                    return {
                        yAlignment: strings$9.BOTTOM,
                        xAlignment: isLTR ? strings$9.RIGHT : strings$9.LEFT,
                        yAxisPx: indentedFromEdge,
                        xAxisPx: flushWithEdge,
                        rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
                        skew: isLTR ? -1 * skewDeg : skewDeg,
                        xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
                        yTransformOrigin: indentedFromHeight,
                        caretCorners: isLTR ? bottomRightTopLeftBorderRadius :
                            bottomLeftTopRightBorderRadius,
                    };
                case PositionWithCaret.ABOVE_CENTER:
                    return {
                        yAlignment: strings$9.BOTTOM,
                        xAlignment: strings$9.LEFT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: midpointWidth,
                        rotation: verticalRotation,
                        skew: skewDeg,
                        xTransformOrigin: midpointWidth,
                        yTransformOrigin: tooltipHeight,
                        caretCorners: bottomLeftTopRightBorderRadius,
                    };
                case PositionWithCaret.ABOVE_END:
                    return {
                        yAlignment: strings$9.BOTTOM,
                        xAlignment: isLTR ? strings$9.RIGHT : strings$9.LEFT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: indentedFromEdge,
                        rotation: isLTR ? -1 * verticalRotation : verticalRotation,
                        skew: isLTR ? -1 * skewDeg : skewDeg,
                        xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,
                        yTransformOrigin: tooltipHeight,
                        caretCorners: isLTR ? bottomRightTopLeftBorderRadius :
                            bottomLeftTopRightBorderRadius,
                    };
                default:
                case PositionWithCaret.ABOVE_START:
                    return {
                        yAlignment: strings$9.BOTTOM,
                        xAlignment: isLTR ? strings$9.LEFT : strings$9.RIGHT,
                        yAxisPx: flushWithEdge,
                        xAxisPx: indentedFromEdge,
                        rotation: isLTR ? verticalRotation : -1 * verticalRotation,
                        skew: isLTR ? skewDeg : -1 * skewDeg,
                        xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,
                        yTransformOrigin: tooltipHeight,
                        caretCorners: isLTR ? bottomLeftTopRightBorderRadius :
                            bottomRightTopLeftBorderRadius,
                    };
            }
        };
        MDCTooltipFoundation.prototype.clearShowTimeout = function () {
            if (this.showTimeout) {
                clearTimeout(this.showTimeout);
                this.showTimeout = null;
            }
        };
        MDCTooltipFoundation.prototype.clearHideTimeout = function () {
            if (this.hideTimeout) {
                clearTimeout(this.hideTimeout);
                this.hideTimeout = null;
            }
        };
        /**
         * Method that allows user to specify additional elements that should have a
         * scroll event listener attached to it. This should be used in instances
         * where the anchor element is placed inside a scrollable container, and will
         * ensure that the tooltip will stay attached to the anchor on scroll.
         */
        MDCTooltipFoundation.prototype.attachScrollHandler = function (addEventListenerFn) {
            var _this = this;
            this.addAncestorScrollEventListeners.push(function () {
                addEventListenerFn('scroll', _this.windowScrollHandler);
            });
        };
        /**
         * Must be used in conjunction with #attachScrollHandler. Removes the scroll
         * event handler from elements on the page.
         */
        MDCTooltipFoundation.prototype.removeScrollHandler = function (removeEventHandlerFn) {
            var _this = this;
            this.removeAncestorScrollEventListeners.push(function () {
                removeEventHandlerFn('scroll', _this.windowScrollHandler);
            });
        };
        MDCTooltipFoundation.prototype.destroy = function () {
            var e_8, _a;
            if (this.frameId) {
                cancelAnimationFrame(this.frameId);
                this.frameId = null;
            }
            this.clearHideTimeout();
            this.clearShowTimeout();
            this.adapter.removeClass(SHOWN);
            this.adapter.removeClass(SHOWING_TRANSITION);
            this.adapter.removeClass(SHOWING);
            this.adapter.removeClass(HIDE);
            this.adapter.removeClass(HIDE_TRANSITION);
            if (this.richTooltip) {
                this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);
            }
            if (!this.persistentTooltip) {
                this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);
                this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
            }
            this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);
            this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);
            this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);
            this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);
            this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
            try {
                for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var fn = _c.value;
                    fn();
                }
            }
            catch (e_8_1) { e_8 = { error: e_8_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_8) throw e_8.error; }
            }
            this.animFrame.cancelAll();
        };
        return MDCTooltipFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/tooltip/dist/Tooltip.svelte generated by Svelte v3.46.4 */

    const file$C = "node_modules/@smui/tooltip/dist/Tooltip.svelte";

    function create_fragment$G(ctx) {
    	let div1;
    	let div0;
    	let div0_class_value;
    	let div0_style_value;
    	let div1_class_value;
    	let div1_style_value;
    	let div1_role_value;
    	let div1_tabindex_value;
    	let div1_data_mdc_tooltip_persist_value;
    	let div1_data_mdc_tooltip_persistent_value;
    	let div1_data_hide_tooltip_from_screenreader_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[31].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[30], null);

    	let div0_levels = [
    		{
    			class: div0_class_value = classMap({
    				[/*surface$class*/ ctx[7]]: true,
    				'mdc-tooltip__surface': true,
    				'mdc-tooltip__surface-animation': true
    			})
    		},
    		{
    			style: div0_style_value = Object.entries(/*surfaceAnimationStyles*/ ctx[14]).map(func$e).concat([/*surface$style*/ ctx[8]]).join(' ')
    		},
    		prefixFilter(/*$$restProps*/ ctx[19], 'surface$')
    	];

    	let div0_data = {};

    	for (let i = 0; i < div0_levels.length; i += 1) {
    		div0_data = assign$1(div0_data, div0_levels[i]);
    	}

    	let div1_levels = [
    		{
    			class: div1_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-tooltip': true,
    				'mdc-tooltip--rich': /*rich*/ ctx[18],
    				.../*internalClasses*/ ctx[11]
    			})
    		},
    		{
    			style: div1_style_value = Object.entries(/*internalStyles*/ ctx[12]).map(func_1$2).concat([/*style*/ ctx[2]]).join(' ')
    		},
    		{
    			role: div1_role_value = /*rich*/ ctx[18] && /*interactive*/ ctx[5]
    			? 'dialog'
    			: 'tooltip'
    		},
    		{ "aria-hidden": "true" },
    		{ id: /*id*/ ctx[3] },
    		{
    			tabindex: div1_tabindex_value = /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    			? -1
    			: undefined
    		},
    		{
    			"data-mdc-tooltip-persist": div1_data_mdc_tooltip_persist_value = /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    			? 'true'
    			: undefined
    		},
    		{
    			"data-mdc-tooltip-persistent": div1_data_mdc_tooltip_persistent_value = /* MDC uses this attr, but document the one above */ /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    			? 'true'
    			: undefined
    		},
    		{ "data-mdc-tooltip-has-caret": undefined },
    		{
    			"data-hide-tooltip-from-screenreader": div1_data_hide_tooltip_from_screenreader_value = /*hideFromScreenreader*/ ctx[6] ? 'true' : undefined
    		},
    		/*internalAttrs*/ ctx[13],
    		exclude(/*$$restProps*/ ctx[19], ['surface$'])
    	];

    	let div1_data = {};

    	for (let i = 0; i < div1_levels.length; i += 1) {
    		div1_data = assign$1(div1_data, div1_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			div0 = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div0, div0_data);
    			add_location(div0, file$C, 31, 2, 927);
    			set_attributes(div1, div1_data);
    			add_location(div1, file$C, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			append_dev(div1, div0);

    			if (default_slot) {
    				default_slot.m(div0, null);
    			}

    			/*div1_binding*/ ctx[32](div1);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div1, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[15].call(null, div1)),
    					listen_dev(div1, "transitionend", /*transitionend_handler*/ ctx[33], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 1073741824)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[30],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[30])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[30], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div0, div0_data = get_spread_update(div0_levels, [
    				(!current || dirty[0] & /*surface$class*/ 128 && div0_class_value !== (div0_class_value = classMap({
    					[/*surface$class*/ ctx[7]]: true,
    					'mdc-tooltip__surface': true,
    					'mdc-tooltip__surface-animation': true
    				}))) && { class: div0_class_value },
    				(!current || dirty[0] & /*surfaceAnimationStyles, surface$style*/ 16640 && div0_style_value !== (div0_style_value = Object.entries(/*surfaceAnimationStyles*/ ctx[14]).map(func$e).concat([/*surface$style*/ ctx[8]]).join(' '))) && { style: div0_style_value },
    				dirty[0] & /*$$restProps*/ 524288 && prefixFilter(/*$$restProps*/ ctx[19], 'surface$')
    			]));

    			set_attributes(div1, div1_data = get_spread_update(div1_levels, [
    				(!current || dirty[0] & /*className, internalClasses*/ 2050 && div1_class_value !== (div1_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-tooltip': true,
    					'mdc-tooltip--rich': /*rich*/ ctx[18],
    					.../*internalClasses*/ ctx[11]
    				}))) && { class: div1_class_value },
    				(!current || dirty[0] & /*internalStyles, style*/ 4100 && div1_style_value !== (div1_style_value = Object.entries(/*internalStyles*/ ctx[12]).map(func_1$2).concat([/*style*/ ctx[2]]).join(' '))) && { style: div1_style_value },
    				(!current || dirty[0] & /*interactive*/ 32 && div1_role_value !== (div1_role_value = /*rich*/ ctx[18] && /*interactive*/ ctx[5]
    				? 'dialog'
    				: 'tooltip')) && { role: div1_role_value },
    				{ "aria-hidden": "true" },
    				(!current || dirty[0] & /*id*/ 8) && { id: /*id*/ ctx[3] },
    				(!current || dirty[0] & /*persistent*/ 16 && div1_tabindex_value !== (div1_tabindex_value = /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    				? -1
    				: undefined)) && { tabindex: div1_tabindex_value },
    				(!current || dirty[0] & /*persistent*/ 16 && div1_data_mdc_tooltip_persist_value !== (div1_data_mdc_tooltip_persist_value = /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    				? 'true'
    				: undefined)) && {
    					"data-mdc-tooltip-persist": div1_data_mdc_tooltip_persist_value
    				},
    				(!current || dirty[0] & /*persistent*/ 16 && div1_data_mdc_tooltip_persistent_value !== (div1_data_mdc_tooltip_persistent_value = /* MDC uses this attr, but document the one above */ /*rich*/ ctx[18] && /*persistent*/ ctx[4]
    				? 'true'
    				: undefined)) && {
    					"data-mdc-tooltip-persistent": div1_data_mdc_tooltip_persistent_value
    				},
    				{ "data-mdc-tooltip-has-caret": undefined },
    				(!current || dirty[0] & /*hideFromScreenreader*/ 64 && div1_data_hide_tooltip_from_screenreader_value !== (div1_data_hide_tooltip_from_screenreader_value = /*hideFromScreenreader*/ ctx[6] ? 'true' : undefined)) && {
    					"data-hide-tooltip-from-screenreader": div1_data_hide_tooltip_from_screenreader_value
    				},
    				dirty[0] & /*internalAttrs*/ 8192 && /*internalAttrs*/ ctx[13],
    				dirty[0] & /*$$restProps*/ 524288 && exclude(/*$$restProps*/ ctx[19], ['surface$'])
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (default_slot) default_slot.d(detaching);
    			/*div1_binding*/ ctx[32](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$G.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter$4 = 0;
    const func$e = ([name, value]) => `${name}: ${value};`;
    const func_1$2 = ([name, value]) => `${name}: ${value};`;

    function instance_1$c($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","id","unbounded","xPos","yPos","persistent","interactive","hideFromScreenreader","showDelay","hideDelay","surface$class","surface$style","attachScrollHandler","removeScrollHandler","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $anchor;
    	let $tooltip;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Tooltip', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { id = 'SMUI-tooltip-' + counter$4++ } = $$props;
    	let { unbounded = false } = $$props;
    	let { xPos = 'detected' } = $$props;
    	let { yPos = 'detected' } = $$props;
    	let { persistent = false } = $$props;
    	let { interactive = persistent } = $$props;
    	let { hideFromScreenreader = false } = $$props;
    	let { showDelay = undefined } = $$props;
    	let { hideDelay = undefined } = $$props;
    	let { surface$class = '' } = $$props;
    	let { surface$style = '' } = $$props;
    	let element;
    	let instance;

    	let nonReactiveLocationStore = {
    		setParent(value) {
    			Object.defineProperty(this, 'parent', { value });
    		},
    		setNextSibling(value) {
    			Object.defineProperty(this, 'nextSibling', { value });
    		}
    	};

    	let internalClasses = {};
    	let internalStyles = {};
    	let internalAttrs = {};
    	let surfaceAnimationStyles = {};
    	let anchor = getContext('SMUI:tooltip:wrapper:anchor');
    	validate_store(anchor, 'anchor');
    	component_subscribe($$self, anchor, value => $$invalidate(29, $anchor = value));
    	let tooltip = getContext('SMUI:tooltip:wrapper:tooltip');
    	validate_store(tooltip, 'tooltip');
    	component_subscribe($$self, tooltip, value => $$invalidate(34, $tooltip = value));
    	const rich = getContext('SMUI:tooltip:rich');
    	let previousAnchor = undefined;

    	onMount(() => {
    		$$invalidate(9, instance = new MDCTooltipFoundation({
    				getAttribute: getAttr,
    				setAttribute: addAttr,
    				removeAttribute: removeAttr,
    				addClass,
    				hasClass,
    				removeClass,
    				getComputedStyleProperty: propertyName => {
    					const element = getElement();
    					let style = getComputedStyle(element).getPropertyValue(propertyName);

    					if (style === 'auto') {
    						element.classList.add('smui-banner--force-show');
    						style = getComputedStyle(element).getPropertyValue(propertyName);
    						element.classList.remove('smui-banner--force-show');
    					}

    					return style;
    				},
    				setStyleProperty: addStyle,
    				setSurfaceAnimationStyleProperty: addSurfaceAnimationStyle,
    				getViewportWidth: () => window.innerWidth,
    				getViewportHeight: () => window.innerHeight,
    				getTooltipSize: () => {
    					const element = getElement();

    					let size = {
    						width: element.offsetWidth,
    						height: element.offsetHeight
    					};

    					if (size.width === 0 || size.height === 0) {
    						element.classList.add('smui-banner--force-show');

    						size = {
    							width: element.offsetWidth,
    							height: element.offsetHeight
    						};

    						element.classList.remove('smui-banner--force-show');
    					}

    					return size;
    				},
    				getAnchorBoundingRect: () => {
    					return $anchor ? $anchor.getBoundingClientRect() : null;
    				},
    				getParentBoundingRect: () => {
    					let parent = getElement().parentElement;

    					if (!rich) {
    						parent = document.body;
    					}

    					return (parent === null || parent === void 0
    					? void 0
    					: parent.getBoundingClientRect()) || null;
    				},
    				getAnchorAttribute: attr => {
    					return $anchor ? $anchor.getAttribute(attr) : null;
    				},
    				setAnchorAttribute: (attr, value) => {
    					$anchor && $anchor.setAttribute(attr, value);
    				},
    				isRTL: () => getComputedStyle(getElement()).direction === 'rtl',
    				anchorContainsElement: element => {
    					return !!($anchor && $anchor.contains(element));
    				},
    				tooltipContainsElement: element => {
    					return getElement().contains(element);
    				},
    				focusAnchorElement: () => {
    					$anchor && $anchor.focus();
    				},
    				registerEventHandler: (evt, handler) => {
    					getElement().addEventListener(evt, handler);
    				},
    				deregisterEventHandler: (evt, handler) => {
    					getElement().removeEventListener(evt, handler);
    				},
    				registerAnchorEventHandler: (evt, handler) => {
    					$anchor && $anchor.addEventListener(evt, handler);
    				},
    				deregisterAnchorEventHandler: (evt, handler) => {
    					$anchor && $anchor.removeEventListener(evt, handler);
    				},
    				registerDocumentEventHandler: (evt, handler) => {
    					document.body.addEventListener(evt, handler);
    				},
    				deregisterDocumentEventHandler: (evt, handler) => {
    					document.body.removeEventListener(evt, handler);
    				},
    				registerWindowEventHandler: (evt, handler) => {
    					window.addEventListener(evt, handler, evt === 'scroll' && { capture: true, passive: true });
    				},
    				deregisterWindowEventHandler: (evt, handler) => {
    					window.removeEventListener(evt, handler, evt === 'scroll' && { capture: true, passive: true });
    				},
    				notifyHidden: () => {
    					dispatch$1(getElement(), 'SMUITooltip:hidden', undefined, undefined, true);
    				},
    				// TODO: figure out why MDC-Web included these caret functions, because they're entirely undocumented.
    				getTooltipCaretBoundingRect: () => {
    					const caret = getElement().querySelector(`.${CssClasses.TOOLTIP_CARET_TOP}`);

    					if (!caret) {
    						return null;
    					}

    					return caret.getBoundingClientRect();
    				},
    				setTooltipCaretStyle: (propertyName, value) => {
    					const topCaret = getElement().querySelector(`.${CssClasses.TOOLTIP_CARET_TOP}`);
    					const bottomCaret = getElement().querySelector(`.${CssClasses.TOOLTIP_CARET_BOTTOM}`);

    					if (!topCaret || !bottomCaret) {
    						return;
    					}

    					topCaret.style.setProperty(propertyName, value);
    					bottomCaret.style.setProperty(propertyName, value);
    				},
    				clearTooltipCaretStyles: () => {
    					const topCaret = getElement().querySelector(`.${CssClasses.TOOLTIP_CARET_TOP}`);
    					const bottomCaret = getElement().querySelector(`.${CssClasses.TOOLTIP_CARET_BOTTOM}`);

    					if (!topCaret || !bottomCaret) {
    						return;
    					}

    					topCaret.removeAttribute('style');
    					bottomCaret.removeAttribute('style');
    				},
    				getActiveElement: () => document.activeElement
    			}));

    		set_store_value(tooltip, $tooltip = element, $tooltip);

    		return () => {
    			if ($anchor) {
    				destroy($anchor);
    			}
    		};
    	});

    	onDestroy(() => {
    		var _a;

    		if (!rich && typeof document !== 'undefined' && document.body === getElement().parentElement && nonReactiveLocationStore.parent !== getElement().parentElement && ((_a = nonReactiveLocationStore.parent) === null || _a === void 0
    		? void 0
    		: _a.insertBefore) && nonReactiveLocationStore.nextSibling) {
    			nonReactiveLocationStore.parent.insertBefore(getElement(), nonReactiveLocationStore.nextSibling);
    		}
    	});

    	function destroy(anchor) {
    		anchor.removeEventListener('focusout', handleAnchorFocusOut);

    		if (rich && persistent) {
    			anchor.removeEventListener('click', handleAnchorActivate);
    			anchor.removeEventListener('keydown', handleAnchorActivate);
    		} else {
    			anchor.removeEventListener('mouseenter', handleAnchorMouseEnter);
    			anchor.removeEventListener('focusin', handleAnchorFocus);
    			anchor.removeEventListener('mouseleave', handleAnchorMouseLeave);
    			anchor.removeEventListener('touchstart', handleAnchorTouchStart);
    			anchor.removeEventListener('touchend', handleAnchorTouchEnd);
    		}

    		if (rich && interactive) {
    			anchor.removeAttribute('aria-haspopup');
    			anchor.removeAttribute('aria-expanded');
    			anchor.removeAttribute('data-tooltip-id');
    		} else {
    			anchor.removeAttribute('aria-describedby');
    		}

    		instance.destroy();
    	}

    	function init(anchor) {
    		anchor.addEventListener('focusout', handleAnchorFocusOut);

    		if (rich && persistent) {
    			anchor.addEventListener('click', handleAnchorActivate);
    			anchor.addEventListener('keydown', handleAnchorActivate);
    		} else {
    			anchor.addEventListener('mouseenter', handleAnchorMouseEnter);
    			anchor.addEventListener('focusin', handleAnchorFocus);
    			anchor.addEventListener('mouseleave', handleAnchorMouseLeave);
    			anchor.addEventListener('touchstart', handleAnchorTouchStart);
    			anchor.addEventListener('touchend', handleAnchorTouchEnd);
    		}

    		if (rich && interactive) {
    			anchor.setAttribute('aria-haspopup', 'dialog');
    			anchor.setAttribute('aria-expanded', 'false');
    			anchor.setAttribute('data-tooltip-id', id);
    		} else {
    			anchor.setAttribute('aria-describedby', id);
    		}

    		if (!rich) {
    			hoistToBody();
    		}

    		instance.init();
    	}

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(11, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(11, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(12, internalStyles);
    			} else {
    				$$invalidate(12, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function addSurfaceAnimationStyle(name, value) {
    		if (surfaceAnimationStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete surfaceAnimationStyles[name];
    				$$invalidate(14, surfaceAnimationStyles);
    			} else {
    				$$invalidate(14, surfaceAnimationStyles[name] = value, surfaceAnimationStyles);
    			}
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(13, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function removeAttr(name) {
    		if (!(name in internalAttrs) || internalAttrs[name] != null) {
    			$$invalidate(13, internalAttrs[name] = undefined, internalAttrs);
    		}
    	}

    	function handleAnchorFocusOut(event) {
    		// The foundation only watches for blur, which
    		// doesn't fire on all components you would
    		// anchor a tooltip to (since it doesn't
    		// bubble), so we handle focusout like a blur.
    		if (element.contains(event.relatedTarget)) {
    			return;
    		}

    		instance && instance.hide();
    	}

    	function handleAnchorActivate(event) {
    		if (event.type === 'keydown' && event.key !== 'Enter' && event.key !== ' ') {
    			return;
    		}

    		instance && instance.handleAnchorClick();
    	}

    	function handleAnchorMouseEnter() {
    		instance && instance.handleAnchorMouseEnter();
    	}

    	function handleAnchorFocus(event) {
    		instance && instance.handleAnchorFocus(event);
    	}

    	function handleAnchorMouseLeave() {
    		instance && instance.handleAnchorMouseLeave();
    	}

    	function handleAnchorTouchStart() {
    		// Purposefully capitalized differently to match MDC.
    		instance && instance.handleAnchorTouchstart();
    	}

    	function handleAnchorTouchEnd() {
    		// Purposefully capitalized differently to match MDC.
    		instance && instance.handleAnchorTouchend();
    	}

    	function hoistToBody() {
    		var _a, _b;

    		if ($anchor && document.body !== getElement().parentNode) {
    			nonReactiveLocationStore.setParent((_a = getElement().parentElement) !== null && _a !== void 0
    			? _a
    			: undefined);

    			nonReactiveLocationStore.setNextSibling((_b = getElement().nextElementSibling) !== null && _b !== void 0
    			? _b
    			: undefined);

    			document.body.appendChild(getElement());
    		}
    	}

    	function attachScrollHandler(addEventListenerFn) {
    		instance && instance.attachScrollHandler(addEventListenerFn);
    	}

    	function removeScrollHandler(removeEventHandlerFn) {
    		instance && instance.removeScrollHandler(removeEventHandlerFn);
    	}

    	function getElement() {
    		return element;
    	}

    	function div1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(10, element);
    		});
    	}

    	const transitionend_handler = () => instance && instance.handleTransitionEnd();

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(19, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(2, style = $$new_props.style);
    		if ('id' in $$new_props) $$invalidate(3, id = $$new_props.id);
    		if ('unbounded' in $$new_props) $$invalidate(20, unbounded = $$new_props.unbounded);
    		if ('xPos' in $$new_props) $$invalidate(21, xPos = $$new_props.xPos);
    		if ('yPos' in $$new_props) $$invalidate(22, yPos = $$new_props.yPos);
    		if ('persistent' in $$new_props) $$invalidate(4, persistent = $$new_props.persistent);
    		if ('interactive' in $$new_props) $$invalidate(5, interactive = $$new_props.interactive);
    		if ('hideFromScreenreader' in $$new_props) $$invalidate(6, hideFromScreenreader = $$new_props.hideFromScreenreader);
    		if ('showDelay' in $$new_props) $$invalidate(23, showDelay = $$new_props.showDelay);
    		if ('hideDelay' in $$new_props) $$invalidate(24, hideDelay = $$new_props.hideDelay);
    		if ('surface$class' in $$new_props) $$invalidate(7, surface$class = $$new_props.surface$class);
    		if ('surface$style' in $$new_props) $$invalidate(8, surface$style = $$new_props.surface$style);
    		if ('$$scope' in $$new_props) $$invalidate(30, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter: counter$4,
    		MDCTooltipFoundation,
    		AnchorBoundaryType,
    		XPosition,
    		YPosition,
    		CssClasses,
    		onMount,
    		onDestroy,
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		exclude,
    		prefixFilter,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		className,
    		style,
    		id,
    		unbounded,
    		xPos,
    		yPos,
    		persistent,
    		interactive,
    		hideFromScreenreader,
    		showDelay,
    		hideDelay,
    		surface$class,
    		surface$style,
    		element,
    		instance,
    		nonReactiveLocationStore,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		surfaceAnimationStyles,
    		anchor,
    		tooltip,
    		rich,
    		previousAnchor,
    		destroy,
    		init,
    		hasClass,
    		addClass,
    		removeClass,
    		addStyle,
    		addSurfaceAnimationStyle,
    		getAttr,
    		addAttr,
    		removeAttr,
    		handleAnchorFocusOut,
    		handleAnchorActivate,
    		handleAnchorMouseEnter,
    		handleAnchorFocus,
    		handleAnchorMouseLeave,
    		handleAnchorTouchStart,
    		handleAnchorTouchEnd,
    		hoistToBody,
    		attachScrollHandler,
    		removeScrollHandler,
    		getElement,
    		$anchor,
    		$tooltip
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(2, style = $$new_props.style);
    		if ('id' in $$props) $$invalidate(3, id = $$new_props.id);
    		if ('unbounded' in $$props) $$invalidate(20, unbounded = $$new_props.unbounded);
    		if ('xPos' in $$props) $$invalidate(21, xPos = $$new_props.xPos);
    		if ('yPos' in $$props) $$invalidate(22, yPos = $$new_props.yPos);
    		if ('persistent' in $$props) $$invalidate(4, persistent = $$new_props.persistent);
    		if ('interactive' in $$props) $$invalidate(5, interactive = $$new_props.interactive);
    		if ('hideFromScreenreader' in $$props) $$invalidate(6, hideFromScreenreader = $$new_props.hideFromScreenreader);
    		if ('showDelay' in $$props) $$invalidate(23, showDelay = $$new_props.showDelay);
    		if ('hideDelay' in $$props) $$invalidate(24, hideDelay = $$new_props.hideDelay);
    		if ('surface$class' in $$props) $$invalidate(7, surface$class = $$new_props.surface$class);
    		if ('surface$style' in $$props) $$invalidate(8, surface$style = $$new_props.surface$style);
    		if ('element' in $$props) $$invalidate(10, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(9, instance = $$new_props.instance);
    		if ('nonReactiveLocationStore' in $$props) nonReactiveLocationStore = $$new_props.nonReactiveLocationStore;
    		if ('internalClasses' in $$props) $$invalidate(11, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(12, internalStyles = $$new_props.internalStyles);
    		if ('internalAttrs' in $$props) $$invalidate(13, internalAttrs = $$new_props.internalAttrs);
    		if ('surfaceAnimationStyles' in $$props) $$invalidate(14, surfaceAnimationStyles = $$new_props.surfaceAnimationStyles);
    		if ('anchor' in $$props) $$invalidate(16, anchor = $$new_props.anchor);
    		if ('tooltip' in $$props) $$invalidate(17, tooltip = $$new_props.tooltip);
    		if ('previousAnchor' in $$props) $$invalidate(28, previousAnchor = $$new_props.previousAnchor);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*instance, previousAnchor, $anchor*/ 805306880) {
    			if (instance && previousAnchor !== $anchor) {
    				if (previousAnchor) {
    					destroy(previousAnchor);
    				}

    				if ($anchor) {
    					init($anchor);
    				}

    				$$invalidate(28, previousAnchor = $anchor);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, unbounded*/ 1049088) {
    			if (instance) {
    				instance.setAnchorBoundaryType(AnchorBoundaryType[unbounded ? 'UNBOUNDED' : 'BOUNDED']);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, xPos, yPos*/ 6291968) {
    			if (instance) {
    				instance.setTooltipPosition({
    					xPos: XPosition[xPos.toUpperCase()],
    					yPos: YPosition[yPos.toUpperCase()]
    				});
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, showDelay*/ 8389120) {
    			if (instance && showDelay != null) {
    				instance.setShowDelay(showDelay);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, hideDelay*/ 16777728) {
    			if (instance && hideDelay != null) {
    				instance.setHideDelay(hideDelay);
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		style,
    		id,
    		persistent,
    		interactive,
    		hideFromScreenreader,
    		surface$class,
    		surface$style,
    		instance,
    		element,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		surfaceAnimationStyles,
    		forwardEvents,
    		anchor,
    		tooltip,
    		rich,
    		$$restProps,
    		unbounded,
    		xPos,
    		yPos,
    		showDelay,
    		hideDelay,
    		attachScrollHandler,
    		removeScrollHandler,
    		getElement,
    		previousAnchor,
    		$anchor,
    		$$scope,
    		slots,
    		div1_binding,
    		transitionend_handler
    	];
    }

    class Tooltip$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$c,
    			create_fragment$G,
    			safe_not_equal,
    			{
    				use: 0,
    				class: 1,
    				style: 2,
    				id: 3,
    				unbounded: 20,
    				xPos: 21,
    				yPos: 22,
    				persistent: 4,
    				interactive: 5,
    				hideFromScreenreader: 6,
    				showDelay: 23,
    				hideDelay: 24,
    				surface$class: 7,
    				surface$style: 8,
    				attachScrollHandler: 25,
    				removeScrollHandler: 26,
    				getElement: 27
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Tooltip",
    			options,
    			id: create_fragment$G.name
    		});
    	}

    	get use() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get id() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set id(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get unbounded() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set unbounded(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xPos() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xPos(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yPos() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yPos(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get persistent() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set persistent(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get interactive() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set interactive(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get hideFromScreenreader() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set hideFromScreenreader(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get showDelay() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set showDelay(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get hideDelay() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set hideDelay(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get surface$class() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set surface$class(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get surface$style() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set surface$style(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get attachScrollHandler() {
    		return this.$$.ctx[25];
    	}

    	set attachScrollHandler(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get removeScrollHandler() {
    		return this.$$.ctx[26];
    	}

    	set removeScrollHandler(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[27];
    	}

    	set getElement(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/tooltip/dist/Wrapper.svelte generated by Svelte v3.46.4 */
    const file$B = "node_modules/@smui/tooltip/dist/Wrapper.svelte";

    // (14:0) {:else}
    function create_else_block$6(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[12].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$6.name,
    		type: "else",
    		source: "(14:0) {:else}",
    		ctx
    	});

    	return block;
    }

    // (1:0) {#if rich}
    function create_if_block$n(ctx) {
    	let div;
    	let div_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[12].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-tooltip-wrapper--rich': true
    			})
    		},
    		/*$$restProps*/ ctx[7]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div, div_data);
    			add_location(div, file$B, 1, 2, 13);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[13](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[4].call(null, div))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty & /*className*/ 2 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-tooltip-wrapper--rich': true
    				}))) && { class: div_class_value },
    				dirty & /*$$restProps*/ 128 && /*$$restProps*/ ctx[7]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[13](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$n.name,
    		type: "if",
    		source: "(1:0) {#if rich}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$F(ctx) {
    	let current_block_type_index;
    	let if_block;
    	let if_block_anchor;
    	let current;
    	const if_block_creators = [create_if_block$n, create_else_block$6];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*rich*/ ctx[2]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	const block = {
    		c: function create() {
    			if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if_blocks[current_block_type_index].m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block = if_blocks[current_block_type_index];

    				if (!if_block) {
    					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block.c();
    				} else {
    					if_block.p(ctx, dirty);
    				}

    				transition_in(if_block, 1);
    				if_block.m(if_block_anchor.parentNode, if_block_anchor);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if_blocks[current_block_type_index].d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$F.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$D($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","rich","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $tooltip;
    	let $anchor;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Wrapper', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { rich = false } = $$props;
    	let element;
    	const anchor = writable(undefined);
    	validate_store(anchor, 'anchor');
    	component_subscribe($$self, anchor, value => $$invalidate(10, $anchor = value));
    	const tooltip = writable(undefined);
    	validate_store(tooltip, 'tooltip');
    	component_subscribe($$self, tooltip, value => $$invalidate(9, $tooltip = value));
    	setContext('SMUI:tooltip:wrapper:anchor', anchor);
    	setContext('SMUI:tooltip:wrapper:tooltip', tooltip);
    	setContext('SMUI:tooltip:rich', rich);

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(3, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(7, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('rich' in $$new_props) $$invalidate(2, rich = $$new_props.rich);
    		if ('$$scope' in $$new_props) $$invalidate(11, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		setContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		rich,
    		element,
    		anchor,
    		tooltip,
    		getElement,
    		$tooltip,
    		$anchor
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('rich' in $$props) $$invalidate(2, rich = $$new_props.rich);
    		if ('element' in $$props) $$invalidate(3, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*$tooltip, $anchor*/ 1536) {
    			if ($tooltip && !$anchor) {
    				set_store_value(anchor, $anchor = $tooltip.previousElementSibling, $anchor);
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		rich,
    		element,
    		forwardEvents,
    		anchor,
    		tooltip,
    		$$restProps,
    		getElement,
    		$tooltip,
    		$anchor,
    		$$scope,
    		slots,
    		div_binding
    	];
    }

    class Wrapper$2 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$D, create_fragment$F, safe_not_equal, { use: 0, class: 1, rich: 2, getElement: 8 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Wrapper",
    			options,
    			id: create_fragment$F.name
    		});
    	}

    	get use() {
    		throw new Error("<Wrapper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Wrapper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Wrapper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Wrapper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rich() {
    		throw new Error("<Wrapper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rich(value) {
    		throw new Error("<Wrapper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[8];
    	}

    	set getElement(value) {
    		throw new Error("<Wrapper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    classAdderBuilder({
        class: 'mdc-tooltip__title',
        component: H2,
    });

    classAdderBuilder({
        class: 'mdc-tooltip__content',
        component: Div,
    });

    classAdderBuilder({
        class: 'mdc-tooltip__content-link',
        component: A,
    });

    classAdderBuilder({
        class: 'mdc-tooltip--rich-actions',
        component: Div,
        contexts: {
            'SMUI:button:context': 'tooltip:rich-actions',
        },
    });

    const Wrapper$1 = Wrapper$2;

    const github = `<style>pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
  Theme: GitHub
  Description: Light theme as seen on github.com
  Author: github.com
  Maintainer: @Hirse
  Updated: 2021-05-15

  Outdated base version: https://github.com/primer/github-syntax-light
  Current colors taken from GitHub's CSS
*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}</style>`;

    var github$1 = github;

    /**
     * @typedef {Object} WrappedComponent Object returned by the `wrap` method
     * @property {SvelteComponent} component - Component to load (this is always asynchronous)
     * @property {RoutePrecondition[]} [conditions] - Route pre-conditions to validate
     * @property {Object} [props] - Optional dictionary of static props
     * @property {Object} [userData] - Optional user data dictionary
     * @property {bool} _sveltesparouter - Internal flag; always set to true
     */

    /**
     * @callback AsyncSvelteComponent
     * @returns {Promise<SvelteComponent>} Returns a Promise that resolves with a Svelte component
     */

    /**
     * @callback RoutePrecondition
     * @param {RouteDetail} detail - Route detail object
     * @returns {boolean|Promise<boolean>} If the callback returns a false-y value, it's interpreted as the precondition failed, so it aborts loading the component (and won't process other pre-condition callbacks)
     */

    /**
     * @typedef {Object} WrapOptions Options object for the call to `wrap`
     * @property {SvelteComponent} [component] - Svelte component to load (this is incompatible with `asyncComponent`)
     * @property {AsyncSvelteComponent} [asyncComponent] - Function that returns a Promise that fulfills with a Svelte component (e.g. `{asyncComponent: () => import('Foo.svelte')}`)
     * @property {SvelteComponent} [loadingComponent] - Svelte component to be displayed while the async route is loading (as a placeholder); when unset or false-y, no component is shown while component
     * @property {object} [loadingParams] - Optional dictionary passed to the `loadingComponent` component as params (for an exported prop called `params`)
     * @property {object} [userData] - Optional object that will be passed to events such as `routeLoading`, `routeLoaded`, `conditionsFailed`
     * @property {object} [props] - Optional key-value dictionary of static props that will be passed to the component. The props are expanded with {...props}, so the key in the dictionary becomes the name of the prop.
     * @property {RoutePrecondition[]|RoutePrecondition} [conditions] - Route pre-conditions to add, which will be executed in order
     */

    /**
     * Wraps a component to enable multiple capabilities:
     * 1. Using dynamically-imported component, with (e.g. `{asyncComponent: () => import('Foo.svelte')}`), which also allows bundlers to do code-splitting.
     * 2. Adding route pre-conditions (e.g. `{conditions: [...]}`)
     * 3. Adding static props that are passed to the component
     * 4. Adding custom userData, which is passed to route events (e.g. route loaded events) or to route pre-conditions (e.g. `{userData: {foo: 'bar}}`)
     * 
     * @param {WrapOptions} args - Arguments object
     * @returns {WrappedComponent} Wrapped component
     */
    function wrap$2(args) {
        if (!args) {
            throw Error('Parameter args is required')
        }

        // We need to have one and only one of component and asyncComponent
        // This does a "XNOR"
        if (!args.component == !args.asyncComponent) {
            throw Error('One and only one of component and asyncComponent is required')
        }

        // If the component is not async, wrap it into a function returning a Promise
        if (args.component) {
            args.asyncComponent = () => Promise.resolve(args.component);
        }

        // Parameter asyncComponent and each item of conditions must be functions
        if (typeof args.asyncComponent != 'function') {
            throw Error('Parameter asyncComponent must be a function')
        }
        if (args.conditions) {
            // Ensure it's an array
            if (!Array.isArray(args.conditions)) {
                args.conditions = [args.conditions];
            }
            for (let i = 0; i < args.conditions.length; i++) {
                if (!args.conditions[i] || typeof args.conditions[i] != 'function') {
                    throw Error('Invalid parameter conditions[' + i + ']')
                }
            }
        }

        // Check if we have a placeholder component
        if (args.loadingComponent) {
            args.asyncComponent.loading = args.loadingComponent;
            args.asyncComponent.loadingParams = args.loadingParams || undefined;
        }

        // Returns an object that contains all the functions to execute too
        // The _sveltesparouter flag is to confirm the object was created by this router
        const obj = {
            component: args.asyncComponent,
            userData: args.userData,
            conditions: (args.conditions && args.conditions.length) ? args.conditions : undefined,
            props: (args.props && Object.keys(args.props).length) ? args.props : {},
            _sveltesparouter: true
        };

        return obj
    }

    function parse$4(str, loose) {
    	if (str instanceof RegExp) return { keys:false, pattern:str };
    	var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/');
    	arr[0] || arr.shift();

    	while (tmp = arr.shift()) {
    		c = tmp[0];
    		if (c === '*') {
    			keys.push('wild');
    			pattern += '/(.*)';
    		} else if (c === ':') {
    			o = tmp.indexOf('?', 1);
    			ext = tmp.indexOf('.', 1);
    			keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );
    			pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';
    			if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext);
    		} else {
    			pattern += '/' + tmp;
    		}
    	}

    	return {
    		keys: keys,
    		pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i')
    	};
    }

    /* node_modules/svelte-spa-router/Router.svelte generated by Svelte v3.46.4 */

    const { Error: Error_1$3, Object: Object_1$4, console: console_1$6 } = globals;

    // (251:0) {:else}
    function create_else_block$5(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;
    	const switch_instance_spread_levels = [/*props*/ ctx[2]];
    	var switch_value = /*component*/ ctx[0];

    	function switch_props(ctx) {
    		let switch_instance_props = {};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props());
    		switch_instance.$on("routeEvent", /*routeEvent_handler_1*/ ctx[7]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty & /*props*/ 4)
    			? get_spread_update(switch_instance_spread_levels, [get_spread_object(/*props*/ ctx[2])])
    			: {};

    			if (switch_value !== (switch_value = /*component*/ ctx[0])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props());
    					switch_instance.$on("routeEvent", /*routeEvent_handler_1*/ ctx[7]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$5.name,
    		type: "else",
    		source: "(251:0) {:else}",
    		ctx
    	});

    	return block;
    }

    // (244:0) {#if componentParams}
    function create_if_block$m(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;
    	const switch_instance_spread_levels = [{ params: /*componentParams*/ ctx[1] }, /*props*/ ctx[2]];
    	var switch_value = /*component*/ ctx[0];

    	function switch_props(ctx) {
    		let switch_instance_props = {};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props());
    		switch_instance.$on("routeEvent", /*routeEvent_handler*/ ctx[6]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty & /*componentParams, props*/ 6)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*componentParams*/ 2 && { params: /*componentParams*/ ctx[1] },
    					dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2])
    				])
    			: {};

    			if (switch_value !== (switch_value = /*component*/ ctx[0])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props());
    					switch_instance.$on("routeEvent", /*routeEvent_handler*/ ctx[6]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$m.name,
    		type: "if",
    		source: "(244:0) {#if componentParams}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$E(ctx) {
    	let current_block_type_index;
    	let if_block;
    	let if_block_anchor;
    	let current;
    	const if_block_creators = [create_if_block$m, create_else_block$5];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*componentParams*/ ctx[1]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	const block = {
    		c: function create() {
    			if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error_1$3("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if_blocks[current_block_type_index].m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block = if_blocks[current_block_type_index];

    				if (!if_block) {
    					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block.c();
    				} else {
    					if_block.p(ctx, dirty);
    				}

    				transition_in(if_block, 1);
    				if_block.m(if_block_anchor.parentNode, if_block_anchor);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if_blocks[current_block_type_index].d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$E.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function wrap$1(component, userData, ...conditions) {
    	// Use the new wrap method and show a deprecation warning
    	// eslint-disable-next-line no-console
    	console.warn('Method `wrap` from `svelte-spa-router` is deprecated and will be removed in a future version. Please use `svelte-spa-router/wrap` instead. See http://bit.ly/svelte-spa-router-upgrading');

    	return wrap$2({ component, userData, conditions });
    }

    /**
     * @typedef {Object} Location
     * @property {string} location - Location (page/view), for example `/book`
     * @property {string} [querystring] - Querystring from the hash, as a string not parsed
     */
    /**
     * Returns the current location from the hash.
     *
     * @returns {Location} Location object
     * @private
     */
    function getLocation() {
    	const hashPosition = window.location.href.indexOf('#/');

    	let location = hashPosition > -1
    	? window.location.href.substr(hashPosition + 1)
    	: '/';

    	// Check if there's a querystring
    	const qsPosition = location.indexOf('?');

    	let querystring = '';

    	if (qsPosition > -1) {
    		querystring = location.substr(qsPosition + 1);
    		location = location.substr(0, qsPosition);
    	}

    	return { location, querystring };
    }

    const loc = readable(null, // eslint-disable-next-line prefer-arrow-callback
    function start(set) {
    	set(getLocation());

    	const update = () => {
    		set(getLocation());
    	};

    	window.addEventListener('hashchange', update, false);

    	return function stop() {
    		window.removeEventListener('hashchange', update, false);
    	};
    });

    const location = derived(loc, $loc => $loc.location);
    const querystring = derived(loc, $loc => $loc.querystring);
    const params = writable(undefined);

    async function push(location) {
    	if (!location || location.length < 1 || location.charAt(0) != '/' && location.indexOf('#/') !== 0) {
    		throw Error('Invalid parameter location');
    	}

    	// Execute this code when the current call stack is complete
    	await tick();

    	// Note: this will include scroll state in history even when restoreScrollState is false
    	history.replaceState(
    		{
    			...history.state,
    			__svelte_spa_router_scrollX: window.scrollX,
    			__svelte_spa_router_scrollY: window.scrollY
    		},
    		undefined,
    		undefined
    	);

    	window.location.hash = (location.charAt(0) == '#' ? '' : '#') + location;
    }

    async function pop() {
    	// Execute this code when the current call stack is complete
    	await tick();

    	window.history.back();
    }

    async function replace(location) {
    	if (!location || location.length < 1 || location.charAt(0) != '/' && location.indexOf('#/') !== 0) {
    		throw Error('Invalid parameter location');
    	}

    	// Execute this code when the current call stack is complete
    	await tick();

    	const dest = (location.charAt(0) == '#' ? '' : '#') + location;

    	try {
    		const newState = { ...history.state };
    		delete newState['__svelte_spa_router_scrollX'];
    		delete newState['__svelte_spa_router_scrollY'];
    		window.history.replaceState(newState, undefined, dest);
    	} catch(e) {
    		// eslint-disable-next-line no-console
    		console.warn('Caught exception while replacing the current page. If you\'re running this in the Svelte REPL, please note that the `replace` method might not work in this environment.');
    	}

    	// The method above doesn't trigger the hashchange event, so let's do that manually
    	window.dispatchEvent(new Event('hashchange'));
    }

    function link(node, opts) {
    	opts = linkOpts(opts);

    	// Only apply to <a> tags
    	if (!node || !node.tagName || node.tagName.toLowerCase() != 'a') {
    		throw Error('Action "link" can only be used with <a> tags');
    	}

    	updateLink(node, opts);

    	return {
    		update(updated) {
    			updated = linkOpts(updated);
    			updateLink(node, updated);
    		}
    	};
    }

    // Internal function used by the link function
    function updateLink(node, opts) {
    	let href = opts.href || node.getAttribute('href');

    	// Destination must start with '/' or '#/'
    	if (href && href.charAt(0) == '/') {
    		// Add # to the href attribute
    		href = '#' + href;
    	} else if (!href || href.length < 2 || href.slice(0, 2) != '#/') {
    		throw Error('Invalid value for "href" attribute: ' + href);
    	}

    	node.setAttribute('href', href);

    	node.addEventListener('click', event => {
    		// Prevent default anchor onclick behaviour
    		event.preventDefault();

    		if (!opts.disabled) {
    			scrollstateHistoryHandler(event.currentTarget.getAttribute('href'));
    		}
    	});
    }

    // Internal function that ensures the argument of the link action is always an object
    function linkOpts(val) {
    	if (val && typeof val == 'string') {
    		return { href: val };
    	} else {
    		return val || {};
    	}
    }

    /**
     * The handler attached to an anchor tag responsible for updating the
     * current history state with the current scroll state
     *
     * @param {string} href - Destination
     */
    function scrollstateHistoryHandler(href) {
    	// Setting the url (3rd arg) to href will break clicking for reasons, so don't try to do that
    	history.replaceState(
    		{
    			...history.state,
    			__svelte_spa_router_scrollX: window.scrollX,
    			__svelte_spa_router_scrollY: window.scrollY
    		},
    		undefined,
    		undefined
    	);

    	// This will force an update as desired, but this time our scroll state will be attached
    	window.location.hash = href;
    }

    function instance$C($$self, $$props, $$invalidate) {
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Router', slots, []);
    	let { routes = {} } = $$props;
    	let { prefix = '' } = $$props;
    	let { restoreScrollState = false } = $$props;

    	/**
     * Container for a route: path, component
     */
    	class RouteItem {
    		/**
     * Initializes the object and creates a regular expression from the path, using regexparam.
     *
     * @param {string} path - Path to the route (must start with '/' or '*')
     * @param {SvelteComponent|WrappedComponent} component - Svelte component for the route, optionally wrapped
     */
    		constructor(path, component) {
    			if (!component || typeof component != 'function' && (typeof component != 'object' || component._sveltesparouter !== true)) {
    				throw Error('Invalid component object');
    			}

    			// Path must be a regular or expression, or a string starting with '/' or '*'
    			if (!path || typeof path == 'string' && (path.length < 1 || path.charAt(0) != '/' && path.charAt(0) != '*') || typeof path == 'object' && !(path instanceof RegExp)) {
    				throw Error('Invalid value for "path" argument - strings must start with / or *');
    			}

    			const { pattern, keys } = parse$4(path);
    			this.path = path;

    			// Check if the component is wrapped and we have conditions
    			if (typeof component == 'object' && component._sveltesparouter === true) {
    				this.component = component.component;
    				this.conditions = component.conditions || [];
    				this.userData = component.userData;
    				this.props = component.props || {};
    			} else {
    				// Convert the component to a function that returns a Promise, to normalize it
    				this.component = () => Promise.resolve(component);

    				this.conditions = [];
    				this.props = {};
    			}

    			this._pattern = pattern;
    			this._keys = keys;
    		}

    		/**
     * Checks if `path` matches the current route.
     * If there's a match, will return the list of parameters from the URL (if any).
     * In case of no match, the method will return `null`.
     *
     * @param {string} path - Path to test
     * @returns {null|Object.<string, string>} List of paramters from the URL if there's a match, or `null` otherwise.
     */
    		match(path) {
    			// If there's a prefix, check if it matches the start of the path.
    			// If not, bail early, else remove it before we run the matching.
    			if (prefix) {
    				if (typeof prefix == 'string') {
    					if (path.startsWith(prefix)) {
    						path = path.substr(prefix.length) || '/';
    					} else {
    						return null;
    					}
    				} else if (prefix instanceof RegExp) {
    					const match = path.match(prefix);

    					if (match && match[0]) {
    						path = path.substr(match[0].length) || '/';
    					} else {
    						return null;
    					}
    				}
    			}

    			// Check if the pattern matches
    			const matches = this._pattern.exec(path);

    			if (matches === null) {
    				return null;
    			}

    			// If the input was a regular expression, this._keys would be false, so return matches as is
    			if (this._keys === false) {
    				return matches;
    			}

    			const out = {};
    			let i = 0;

    			while (i < this._keys.length) {
    				// In the match parameters, URL-decode all values
    				try {
    					out[this._keys[i]] = decodeURIComponent(matches[i + 1] || '') || null;
    				} catch(e) {
    					out[this._keys[i]] = null;
    				}

    				i++;
    			}

    			return out;
    		}

    		/**
     * Dictionary with route details passed to the pre-conditions functions, as well as the `routeLoading`, `routeLoaded` and `conditionsFailed` events
     * @typedef {Object} RouteDetail
     * @property {string|RegExp} route - Route matched as defined in the route definition (could be a string or a reguar expression object)
     * @property {string} location - Location path
     * @property {string} querystring - Querystring from the hash
     * @property {object} [userData] - Custom data passed by the user
     * @property {SvelteComponent} [component] - Svelte component (only in `routeLoaded` events)
     * @property {string} [name] - Name of the Svelte component (only in `routeLoaded` events)
     */
    		/**
     * Executes all conditions (if any) to control whether the route can be shown. Conditions are executed in the order they are defined, and if a condition fails, the following ones aren't executed.
     * 
     * @param {RouteDetail} detail - Route detail
     * @returns {boolean} Returns true if all the conditions succeeded
     */
    		async checkConditions(detail) {
    			for (let i = 0; i < this.conditions.length; i++) {
    				if (!await this.conditions[i](detail)) {
    					return false;
    				}
    			}

    			return true;
    		}
    	}

    	// Set up all routes
    	const routesList = [];

    	if (routes instanceof Map) {
    		// If it's a map, iterate on it right away
    		routes.forEach((route, path) => {
    			routesList.push(new RouteItem(path, route));
    		});
    	} else {
    		// We have an object, so iterate on its own properties
    		Object.keys(routes).forEach(path => {
    			routesList.push(new RouteItem(path, routes[path]));
    		});
    	}

    	// Props for the component to render
    	let component = null;

    	let componentParams = null;
    	let props = {};

    	// Event dispatcher from Svelte
    	const dispatch = createEventDispatcher();

    	// Just like dispatch, but executes on the next iteration of the event loop
    	async function dispatchNextTick(name, detail) {
    		// Execute this code when the current call stack is complete
    		await tick();

    		dispatch(name, detail);
    	}

    	// If this is set, then that means we have popped into this var the state of our last scroll position
    	let previousScrollState = null;

    	let popStateChanged = null;

    	if (restoreScrollState) {
    		popStateChanged = event => {
    			// If this event was from our history.replaceState, event.state will contain
    			// our scroll history. Otherwise, event.state will be null (like on forward
    			// navigation)
    			if (event.state && event.state.__svelte_spa_router_scrollY) {
    				previousScrollState = event.state;
    			} else {
    				previousScrollState = null;
    			}
    		};

    		// This is removed in the destroy() invocation below
    		window.addEventListener('popstate', popStateChanged);

    		afterUpdate(() => {
    			// If this exists, then this is a back navigation: restore the scroll position
    			if (previousScrollState) {
    				window.scrollTo(previousScrollState.__svelte_spa_router_scrollX, previousScrollState.__svelte_spa_router_scrollY);
    			} else {
    				// Otherwise this is a forward navigation: scroll to top
    				window.scrollTo(0, 0);
    			}
    		});
    	}

    	// Always have the latest value of loc
    	let lastLoc = null;

    	// Current object of the component loaded
    	let componentObj = null;

    	// Handle hash change events
    	// Listen to changes in the $loc store and update the page
    	// Do not use the $: syntax because it gets triggered by too many things
    	const unsubscribeLoc = loc.subscribe(async newLoc => {
    		lastLoc = newLoc;

    		// Find a route matching the location
    		let i = 0;

    		while (i < routesList.length) {
    			const match = routesList[i].match(newLoc.location);

    			if (!match) {
    				i++;
    				continue;
    			}

    			const detail = {
    				route: routesList[i].path,
    				location: newLoc.location,
    				querystring: newLoc.querystring,
    				userData: routesList[i].userData,
    				params: match && typeof match == 'object' && Object.keys(match).length
    				? match
    				: null
    			};

    			// Check if the route can be loaded - if all conditions succeed
    			if (!await routesList[i].checkConditions(detail)) {
    				// Don't display anything
    				$$invalidate(0, component = null);

    				componentObj = null;

    				// Trigger an event to notify the user, then exit
    				dispatchNextTick('conditionsFailed', detail);

    				return;
    			}

    			// Trigger an event to alert that we're loading the route
    			// We need to clone the object on every event invocation so we don't risk the object to be modified in the next tick
    			dispatchNextTick('routeLoading', Object.assign({}, detail));

    			// If there's a component to show while we're loading the route, display it
    			const obj = routesList[i].component;

    			// Do not replace the component if we're loading the same one as before, to avoid the route being unmounted and re-mounted
    			if (componentObj != obj) {
    				if (obj.loading) {
    					$$invalidate(0, component = obj.loading);
    					componentObj = obj;
    					$$invalidate(1, componentParams = obj.loadingParams);
    					$$invalidate(2, props = {});

    					// Trigger the routeLoaded event for the loading component
    					// Create a copy of detail so we don't modify the object for the dynamic route (and the dynamic route doesn't modify our object too)
    					dispatchNextTick('routeLoaded', Object.assign({}, detail, {
    						component,
    						name: component.name,
    						params: componentParams
    					}));
    				} else {
    					$$invalidate(0, component = null);
    					componentObj = null;
    				}

    				// Invoke the Promise
    				const loaded = await obj();

    				// Now that we're here, after the promise resolved, check if we still want this component, as the user might have navigated to another page in the meanwhile
    				if (newLoc != lastLoc) {
    					// Don't update the component, just exit
    					return;
    				}

    				// If there is a "default" property, which is used by async routes, then pick that
    				$$invalidate(0, component = loaded && loaded.default || loaded);

    				componentObj = obj;
    			}

    			// Set componentParams only if we have a match, to avoid a warning similar to `<Component> was created with unknown prop 'params'`
    			// Of course, this assumes that developers always add a "params" prop when they are expecting parameters
    			if (match && typeof match == 'object' && Object.keys(match).length) {
    				$$invalidate(1, componentParams = match);
    			} else {
    				$$invalidate(1, componentParams = null);
    			}

    			// Set static props, if any
    			$$invalidate(2, props = routesList[i].props);

    			// Dispatch the routeLoaded event then exit
    			// We need to clone the object on every event invocation so we don't risk the object to be modified in the next tick
    			dispatchNextTick('routeLoaded', Object.assign({}, detail, {
    				component,
    				name: component.name,
    				params: componentParams
    			})).then(() => {
    				params.set(componentParams);
    			});

    			return;
    		}

    		// If we're still here, there was no match, so show the empty component
    		$$invalidate(0, component = null);

    		componentObj = null;
    		params.set(undefined);
    	});

    	onDestroy(() => {
    		unsubscribeLoc();
    		popStateChanged && window.removeEventListener('popstate', popStateChanged);
    	});

    	const writable_props = ['routes', 'prefix', 'restoreScrollState'];

    	Object_1$4.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$6.warn(`<Router> was created with unknown prop '${key}'`);
    	});

    	function routeEvent_handler(event) {
    		bubble.call(this, $$self, event);
    	}

    	function routeEvent_handler_1(event) {
    		bubble.call(this, $$self, event);
    	}

    	$$self.$$set = $$props => {
    		if ('routes' in $$props) $$invalidate(3, routes = $$props.routes);
    		if ('prefix' in $$props) $$invalidate(4, prefix = $$props.prefix);
    		if ('restoreScrollState' in $$props) $$invalidate(5, restoreScrollState = $$props.restoreScrollState);
    	};

    	$$self.$capture_state = () => ({
    		readable,
    		writable,
    		derived,
    		tick,
    		_wrap: wrap$2,
    		wrap: wrap$1,
    		getLocation,
    		loc,
    		location,
    		querystring,
    		params,
    		push,
    		pop,
    		replace,
    		link,
    		updateLink,
    		linkOpts,
    		scrollstateHistoryHandler,
    		onDestroy,
    		createEventDispatcher,
    		afterUpdate,
    		parse: parse$4,
    		routes,
    		prefix,
    		restoreScrollState,
    		RouteItem,
    		routesList,
    		component,
    		componentParams,
    		props,
    		dispatch,
    		dispatchNextTick,
    		previousScrollState,
    		popStateChanged,
    		lastLoc,
    		componentObj,
    		unsubscribeLoc
    	});

    	$$self.$inject_state = $$props => {
    		if ('routes' in $$props) $$invalidate(3, routes = $$props.routes);
    		if ('prefix' in $$props) $$invalidate(4, prefix = $$props.prefix);
    		if ('restoreScrollState' in $$props) $$invalidate(5, restoreScrollState = $$props.restoreScrollState);
    		if ('component' in $$props) $$invalidate(0, component = $$props.component);
    		if ('componentParams' in $$props) $$invalidate(1, componentParams = $$props.componentParams);
    		if ('props' in $$props) $$invalidate(2, props = $$props.props);
    		if ('previousScrollState' in $$props) previousScrollState = $$props.previousScrollState;
    		if ('popStateChanged' in $$props) popStateChanged = $$props.popStateChanged;
    		if ('lastLoc' in $$props) lastLoc = $$props.lastLoc;
    		if ('componentObj' in $$props) componentObj = $$props.componentObj;
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*restoreScrollState*/ 32) {
    			// Update history.scrollRestoration depending on restoreScrollState
    			history.scrollRestoration = restoreScrollState ? 'manual' : 'auto';
    		}
    	};

    	return [
    		component,
    		componentParams,
    		props,
    		routes,
    		prefix,
    		restoreScrollState,
    		routeEvent_handler,
    		routeEvent_handler_1
    	];
    }

    class Router extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$C, create_fragment$E, safe_not_equal, {
    			routes: 3,
    			prefix: 4,
    			restoreScrollState: 5
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Router",
    			options,
    			id: create_fragment$E.name
    		});
    	}

    	get routes() {
    		throw new Error_1$3("<Router>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set routes(value) {
    		throw new Error_1$3("<Router>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get prefix() {
    		throw new Error_1$3("<Router>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set prefix(value) {
    		throw new Error_1$3("<Router>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get restoreScrollState() {
    		throw new Error_1$3("<Router>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set restoreScrollState(value) {
    		throw new Error_1$3("<Router>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/Home.svelte generated by Svelte v3.46.4 */

    const file$A = "src/Home.svelte";

    function create_fragment$D(ctx) {
    	let h2;

    	const block = {
    		c: function create() {
    			h2 = element("h2");
    			h2.textContent = "Home";
    			add_location(h2, file$A, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h2, anchor);
    		},
    		p: noop$2,
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h2);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$D.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$B($$self, $$props) {
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Home', slots, []);
    	const writable_props = [];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Home> was created with unknown prop '${key}'`);
    	});

    	return [];
    }

    class Home extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$B, create_fragment$D, safe_not_equal, {});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Home",
    			options,
    			id: create_fragment$D.name
    		});
    	}
    }

    /* node_modules/@smui/paper/dist/Paper.svelte generated by Svelte v3.46.4 */
    const file$z = "node_modules/@smui/paper/dist/Paper.svelte";

    function create_fragment$C(ctx) {
    	let div;
    	let div_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[12].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null);

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'smui-paper': true,
    				'smui-paper--raised': /*variant*/ ctx[2] === 'raised',
    				'smui-paper--unelevated': /*variant*/ ctx[2] === 'unelevated',
    				'smui-paper--outlined': /*variant*/ ctx[2] === 'outlined',
    				['smui-paper--elevation-z' + /*elevation*/ ctx[5]]: /*elevation*/ ctx[5] !== 0 && /*variant*/ ctx[2] === 'raised',
    				'smui-paper--rounded': !/*square*/ ctx[3],
    				['smui-paper--color-' + /*color*/ ctx[4]]: /*color*/ ctx[4] !== 'default',
    				'smui-paper-transition': /*transition*/ ctx[6]
    			})
    		},
    		/*$$restProps*/ ctx[9]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div, div_data);
    			add_location(div, file$z, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[13](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[8].call(null, div))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2048)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty & /*className, variant, elevation, square, color, transition*/ 126 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'smui-paper': true,
    					'smui-paper--raised': /*variant*/ ctx[2] === 'raised',
    					'smui-paper--unelevated': /*variant*/ ctx[2] === 'unelevated',
    					'smui-paper--outlined': /*variant*/ ctx[2] === 'outlined',
    					['smui-paper--elevation-z' + /*elevation*/ ctx[5]]: /*elevation*/ ctx[5] !== 0 && /*variant*/ ctx[2] === 'raised',
    					'smui-paper--rounded': !/*square*/ ctx[3],
    					['smui-paper--color-' + /*color*/ ctx[4]]: /*color*/ ctx[4] !== 'default',
    					'smui-paper-transition': /*transition*/ ctx[6]
    				}))) && { class: div_class_value },
    				dirty & /*$$restProps*/ 512 && /*$$restProps*/ ctx[9]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[13](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$C.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$A($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","variant","square","color","elevation","transition","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Paper', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { variant = 'raised' } = $$props;
    	let { square = false } = $$props;
    	let { color = 'default' } = $$props;
    	let { elevation = 1 } = $$props;
    	let { transition = false } = $$props;
    	let element;

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(7, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(9, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('variant' in $$new_props) $$invalidate(2, variant = $$new_props.variant);
    		if ('square' in $$new_props) $$invalidate(3, square = $$new_props.square);
    		if ('color' in $$new_props) $$invalidate(4, color = $$new_props.color);
    		if ('elevation' in $$new_props) $$invalidate(5, elevation = $$new_props.elevation);
    		if ('transition' in $$new_props) $$invalidate(6, transition = $$new_props.transition);
    		if ('$$scope' in $$new_props) $$invalidate(11, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		variant,
    		square,
    		color,
    		elevation,
    		transition,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('variant' in $$props) $$invalidate(2, variant = $$new_props.variant);
    		if ('square' in $$props) $$invalidate(3, square = $$new_props.square);
    		if ('color' in $$props) $$invalidate(4, color = $$new_props.color);
    		if ('elevation' in $$props) $$invalidate(5, elevation = $$new_props.elevation);
    		if ('transition' in $$props) $$invalidate(6, transition = $$new_props.transition);
    		if ('element' in $$props) $$invalidate(7, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		variant,
    		square,
    		color,
    		elevation,
    		transition,
    		element,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		div_binding
    	];
    }

    class Paper extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$A, create_fragment$C, safe_not_equal, {
    			use: 0,
    			class: 1,
    			variant: 2,
    			square: 3,
    			color: 4,
    			elevation: 5,
    			transition: 6,
    			getElement: 10
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Paper",
    			options,
    			id: create_fragment$C.name
    		});
    	}

    	get use() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get variant() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set variant(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get square() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set square(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get color() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set color(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get elevation() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set elevation(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get transition() {
    		throw new Error("<Paper>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set transition(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[10];
    	}

    	set getElement(value) {
    		throw new Error("<Paper>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    var Content = classAdderBuilder({
        class: 'smui-paper__content',
        component: Div,
    });

    classAdderBuilder({
        class: 'smui-paper__title',
        component: H5,
    });

    classAdderBuilder({
        class: 'smui-paper__subtitle',
        component: H6,
    });

    var deepFreezeEs6 = {exports: {}};

    function deepFreeze(obj) {
        if (obj instanceof Map) {
            obj.clear = obj.delete = obj.set = function () {
                throw new Error('map is read-only');
            };
        } else if (obj instanceof Set) {
            obj.add = obj.clear = obj.delete = function () {
                throw new Error('set is read-only');
            };
        }

        // Freeze self
        Object.freeze(obj);

        Object.getOwnPropertyNames(obj).forEach(function (name) {
            var prop = obj[name];

            // Freeze prop if it is an object
            if (typeof prop == 'object' && !Object.isFrozen(prop)) {
                deepFreeze(prop);
            }
        });

        return obj;
    }

    deepFreezeEs6.exports = deepFreeze;
    deepFreezeEs6.exports.default = deepFreeze;

    var deepFreeze$1 = deepFreezeEs6.exports;

    /** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */
    /** @typedef {import('highlight.js').CompiledMode} CompiledMode */
    /** @implements CallbackResponse */

    class Response {
      /**
       * @param {CompiledMode} mode
       */
      constructor(mode) {
        // eslint-disable-next-line no-undefined
        if (mode.data === undefined) mode.data = {};

        this.data = mode.data;
        this.isMatchIgnored = false;
      }

      ignoreMatch() {
        this.isMatchIgnored = true;
      }
    }

    /**
     * @param {string} value
     * @returns {string}
     */
    function escapeHTML(value) {
      return value
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/"/g, '&quot;')
        .replace(/'/g, '&#x27;');
    }

    /**
     * performs a shallow merge of multiple objects into one
     *
     * @template T
     * @param {T} original
     * @param {Record<string,any>[]} objects
     * @returns {T} a single new object
     */
    function inherit$1(original, ...objects) {
      /** @type Record<string,any> */
      const result = Object.create(null);

      for (const key in original) {
        result[key] = original[key];
      }
      objects.forEach(function(obj) {
        for (const key in obj) {
          result[key] = obj[key];
        }
      });
      return /** @type {T} */ (result);
    }

    /**
     * @typedef {object} Renderer
     * @property {(text: string) => void} addText
     * @property {(node: Node) => void} openNode
     * @property {(node: Node) => void} closeNode
     * @property {() => string} value
     */

    /** @typedef {{kind?: string, sublanguage?: boolean}} Node */
    /** @typedef {{walk: (r: Renderer) => void}} Tree */
    /** */

    const SPAN_CLOSE = '</span>';

    /**
     * Determines if a node needs to be wrapped in <span>
     *
     * @param {Node} node */
    const emitsWrappingTags = (node) => {
      return !!node.kind;
    };

    /**
     *
     * @param {string} name
     * @param {{prefix:string}} options
     */
    const expandScopeName = (name, { prefix }) => {
      if (name.includes(".")) {
        const pieces = name.split(".");
        return [
          `${prefix}${pieces.shift()}`,
          ...(pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`))
        ].join(" ");
      }
      return `${prefix}${name}`;
    };

    /** @type {Renderer} */
    class HTMLRenderer {
      /**
       * Creates a new HTMLRenderer
       *
       * @param {Tree} parseTree - the parse tree (must support `walk` API)
       * @param {{classPrefix: string}} options
       */
      constructor(parseTree, options) {
        this.buffer = "";
        this.classPrefix = options.classPrefix;
        parseTree.walk(this);
      }

      /**
       * Adds texts to the output stream
       *
       * @param {string} text */
      addText(text) {
        this.buffer += escapeHTML(text);
      }

      /**
       * Adds a node open to the output stream (if needed)
       *
       * @param {Node} node */
      openNode(node) {
        if (!emitsWrappingTags(node)) return;

        let scope = node.kind;
        if (node.sublanguage) {
          scope = `language-${scope}`;
        } else {
          scope = expandScopeName(scope, { prefix: this.classPrefix });
        }
        this.span(scope);
      }

      /**
       * Adds a node close to the output stream (if needed)
       *
       * @param {Node} node */
      closeNode(node) {
        if (!emitsWrappingTags(node)) return;

        this.buffer += SPAN_CLOSE;
      }

      /**
       * returns the accumulated buffer
      */
      value() {
        return this.buffer;
      }

      // helpers

      /**
       * Builds a span element
       *
       * @param {string} className */
      span(className) {
        this.buffer += `<span class="${className}">`;
      }
    }

    /** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} | string} Node */
    /** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} } DataNode */
    /** @typedef {import('highlight.js').Emitter} Emitter */
    /**  */

    class TokenTree {
      constructor() {
        /** @type DataNode */
        this.rootNode = { children: [] };
        this.stack = [this.rootNode];
      }

      get top() {
        return this.stack[this.stack.length - 1];
      }

      get root() { return this.rootNode; }

      /** @param {Node} node */
      add(node) {
        this.top.children.push(node);
      }

      /** @param {string} kind */
      openNode(kind) {
        /** @type Node */
        const node = { kind, children: [] };
        this.add(node);
        this.stack.push(node);
      }

      closeNode() {
        if (this.stack.length > 1) {
          return this.stack.pop();
        }
        // eslint-disable-next-line no-undefined
        return undefined;
      }

      closeAllNodes() {
        while (this.closeNode());
      }

      toJSON() {
        return JSON.stringify(this.rootNode, null, 4);
      }

      /**
       * @typedef { import("./html_renderer").Renderer } Renderer
       * @param {Renderer} builder
       */
      walk(builder) {
        // this does not
        return this.constructor._walk(builder, this.rootNode);
        // this works
        // return TokenTree._walk(builder, this.rootNode);
      }

      /**
       * @param {Renderer} builder
       * @param {Node} node
       */
      static _walk(builder, node) {
        if (typeof node === "string") {
          builder.addText(node);
        } else if (node.children) {
          builder.openNode(node);
          node.children.forEach((child) => this._walk(builder, child));
          builder.closeNode(node);
        }
        return builder;
      }

      /**
       * @param {Node} node
       */
      static _collapse(node) {
        if (typeof node === "string") return;
        if (!node.children) return;

        if (node.children.every(el => typeof el === "string")) {
          // node.text = node.children.join("");
          // delete node.children;
          node.children = [node.children.join("")];
        } else {
          node.children.forEach((child) => {
            TokenTree._collapse(child);
          });
        }
      }
    }

    /**
      Currently this is all private API, but this is the minimal API necessary
      that an Emitter must implement to fully support the parser.

      Minimal interface:

      - addKeyword(text, kind)
      - addText(text)
      - addSublanguage(emitter, subLanguageName)
      - finalize()
      - openNode(kind)
      - closeNode()
      - closeAllNodes()
      - toHTML()

    */

    /**
     * @implements {Emitter}
     */
    class TokenTreeEmitter extends TokenTree {
      /**
       * @param {*} options
       */
      constructor(options) {
        super();
        this.options = options;
      }

      /**
       * @param {string} text
       * @param {string} kind
       */
      addKeyword(text, kind) {
        if (text === "") { return; }

        this.openNode(kind);
        this.addText(text);
        this.closeNode();
      }

      /**
       * @param {string} text
       */
      addText(text) {
        if (text === "") { return; }

        this.add(text);
      }

      /**
       * @param {Emitter & {root: DataNode}} emitter
       * @param {string} name
       */
      addSublanguage(emitter, name) {
        /** @type DataNode */
        const node = emitter.root;
        node.kind = name;
        node.sublanguage = true;
        this.add(node);
      }

      toHTML() {
        const renderer = new HTMLRenderer(this, this.options);
        return renderer.value();
      }

      finalize() {
        return true;
      }
    }

    /**
     * @param {string} value
     * @returns {RegExp}
     * */

    /**
     * @param {RegExp | string } re
     * @returns {string}
     */
    function source$1(re) {
      if (!re) return null;
      if (typeof re === "string") return re;

      return re.source;
    }

    /**
     * @param {RegExp | string } re
     * @returns {string}
     */
    function lookahead(re) {
      return concat$1('(?=', re, ')');
    }

    /**
     * @param {RegExp | string } re
     * @returns {string}
     */
    function anyNumberOfTimes(re) {
      return concat$1('(?:', re, ')*');
    }

    /**
     * @param {RegExp | string } re
     * @returns {string}
     */
    function optional(re) {
      return concat$1('(?:', re, ')?');
    }

    /**
     * @param {...(RegExp | string) } args
     * @returns {string}
     */
    function concat$1(...args) {
      const joined = args.map((x) => source$1(x)).join("");
      return joined;
    }

    /**
     * @param { Array<string | RegExp | Object> } args
     * @returns {object}
     */
    function stripOptionsFromArgs(args) {
      const opts = args[args.length - 1];

      if (typeof opts === 'object' && opts.constructor === Object) {
        args.splice(args.length - 1, 1);
        return opts;
      } else {
        return {};
      }
    }

    /** @typedef { {capture?: boolean} } RegexEitherOptions */

    /**
     * Any of the passed expresssions may match
     *
     * Creates a huge this | this | that | that match
     * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
     * @returns {string}
     */
    function either(...args) {
      /** @type { object & {capture?: boolean} }  */
      const opts = stripOptionsFromArgs(args);
      const joined = '('
        + (opts.capture ? "" : "?:")
        + args.map((x) => source$1(x)).join("|") + ")";
      return joined;
    }

    /**
     * @param {RegExp | string} re
     * @returns {number}
     */
    function countMatchGroups(re) {
      return (new RegExp(re.toString() + '|')).exec('').length - 1;
    }

    /**
     * Does lexeme start with a regular expression match at the beginning
     * @param {RegExp} re
     * @param {string} lexeme
     */
    function startsWith(re, lexeme) {
      const match = re && re.exec(lexeme);
      return match && match.index === 0;
    }

    // BACKREF_RE matches an open parenthesis or backreference. To avoid
    // an incorrect parse, it additionally matches the following:
    // - [...] elements, where the meaning of parentheses and escapes change
    // - other escape sequences, so we do not misparse escape sequences as
    //   interesting elements
    // - non-matching or lookahead parentheses, which do not capture. These
    //   follow the '(' with a '?'.
    const BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;

    // **INTERNAL** Not intended for outside usage
    // join logically computes regexps.join(separator), but fixes the
    // backreferences so they continue to match.
    // it also places each individual regular expression into it's own
    // match group, keeping track of the sequencing of those match groups
    // is currently an exercise for the caller. :-)
    /**
     * @param {(string | RegExp)[]} regexps
     * @param {{joinWith: string}} opts
     * @returns {string}
     */
    function _rewriteBackreferences(regexps, { joinWith }) {
      let numCaptures = 0;

      return regexps.map((regex) => {
        numCaptures += 1;
        const offset = numCaptures;
        let re = source$1(regex);
        let out = '';

        while (re.length > 0) {
          const match = BACKREF_RE.exec(re);
          if (!match) {
            out += re;
            break;
          }
          out += re.substring(0, match.index);
          re = re.substring(match.index + match[0].length);
          if (match[0][0] === '\\' && match[1]) {
            // Adjust the backreference.
            out += '\\' + String(Number(match[1]) + offset);
          } else {
            out += match[0];
            if (match[0] === '(') {
              numCaptures++;
            }
          }
        }
        return out;
      }).map(re => `(${re})`).join(joinWith);
    }

    /** @typedef {import('highlight.js').Mode} Mode */
    /** @typedef {import('highlight.js').ModeCallback} ModeCallback */

    // Common regexps
    const MATCH_NOTHING_RE = /\b\B/;
    const IDENT_RE = '[a-zA-Z]\\w*';
    const UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*';
    const NUMBER_RE = '\\b\\d+(\\.\\d+)?';
    const C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float
    const BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b...
    const RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';

    /**
    * @param { Partial<Mode> & {binary?: string | RegExp} } opts
    */
    const SHEBANG = (opts = {}) => {
      const beginShebang = /^#![ ]*\//;
      if (opts.binary) {
        opts.begin = concat$1(
          beginShebang,
          /.*\b/,
          opts.binary,
          /\b.*/);
      }
      return inherit$1({
        scope: 'meta',
        begin: beginShebang,
        end: /$/,
        relevance: 0,
        /** @type {ModeCallback} */
        "on:begin": (m, resp) => {
          if (m.index !== 0) resp.ignoreMatch();
        }
      }, opts);
    };

    // Common modes
    const BACKSLASH_ESCAPE = {
      begin: '\\\\[\\s\\S]', relevance: 0
    };
    const APOS_STRING_MODE = {
      scope: 'string',
      begin: '\'',
      end: '\'',
      illegal: '\\n',
      contains: [BACKSLASH_ESCAPE]
    };
    const QUOTE_STRING_MODE = {
      scope: 'string',
      begin: '"',
      end: '"',
      illegal: '\\n',
      contains: [BACKSLASH_ESCAPE]
    };
    const PHRASAL_WORDS_MODE = {
      begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
    };
    /**
     * Creates a comment mode
     *
     * @param {string | RegExp} begin
     * @param {string | RegExp} end
     * @param {Mode | {}} [modeOptions]
     * @returns {Partial<Mode>}
     */
    const COMMENT = function(begin, end, modeOptions = {}) {
      const mode = inherit$1(
        {
          scope: 'comment',
          begin,
          end,
          contains: []
        },
        modeOptions
      );
      mode.contains.push({
        scope: 'doctag',
        // hack to avoid the space from being included. the space is necessary to
        // match here to prevent the plain text rule below from gobbling up doctags
        begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
        end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
        excludeBegin: true,
        relevance: 0
      });
      const ENGLISH_WORD = either(
        // list of common 1 and 2 letter words in English
        "I",
        "a",
        "is",
        "so",
        "us",
        "to",
        "at",
        "if",
        "in",
        "it",
        "on",
        // note: this is not an exhaustive list of contractions, just popular ones
        /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc
        /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.
        /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences
      );
      // looking like plain text, more likely to be a comment
      mode.contains.push(
        {
          // TODO: how to include ", (, ) without breaking grammars that use these for
          // comment delimiters?
          // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
          // ---

          // this tries to find sequences of 3 english words in a row (without any
          // "programming" type syntax) this gives us a strong signal that we've
          // TRULY found a comment - vs perhaps scanning with the wrong language.
          // It's possible to find something that LOOKS like the start of the
          // comment - but then if there is no readable text - good chance it is a
          // false match and not a comment.
          //
          // for a visual example please see:
          // https://github.com/highlightjs/highlight.js/issues/2827

          begin: concat$1(
            /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
            '(',
            ENGLISH_WORD,
            /[.]?[:]?([.][ ]|[ ])/,
            '){3}') // look for 3 words in a row
        }
      );
      return mode;
    };
    const C_LINE_COMMENT_MODE = COMMENT('//', '$');
    const C_BLOCK_COMMENT_MODE = COMMENT('/\\*', '\\*/');
    const HASH_COMMENT_MODE = COMMENT('#', '$');
    const NUMBER_MODE = {
      scope: 'number',
      begin: NUMBER_RE,
      relevance: 0
    };
    const C_NUMBER_MODE = {
      scope: 'number',
      begin: C_NUMBER_RE,
      relevance: 0
    };
    const BINARY_NUMBER_MODE = {
      scope: 'number',
      begin: BINARY_NUMBER_RE,
      relevance: 0
    };
    const REGEXP_MODE = {
      // this outer rule makes sure we actually have a WHOLE regex and not simply
      // an expression such as:
      //
      //     3 / something
      //
      // (which will then blow up when regex's `illegal` sees the newline)
      begin: /(?=\/[^/\n]*\/)/,
      contains: [{
        scope: 'regexp',
        begin: /\//,
        end: /\/[gimuy]*/,
        illegal: /\n/,
        contains: [
          BACKSLASH_ESCAPE,
          {
            begin: /\[/,
            end: /\]/,
            relevance: 0,
            contains: [BACKSLASH_ESCAPE]
          }
        ]
      }]
    };
    const TITLE_MODE = {
      scope: 'title',
      begin: IDENT_RE,
      relevance: 0
    };
    const UNDERSCORE_TITLE_MODE = {
      scope: 'title',
      begin: UNDERSCORE_IDENT_RE,
      relevance: 0
    };
    const METHOD_GUARD = {
      // excludes method names from keyword processing
      begin: '\\.\\s*' + UNDERSCORE_IDENT_RE,
      relevance: 0
    };

    /**
     * Adds end same as begin mechanics to a mode
     *
     * Your mode must include at least a single () match group as that first match
     * group is what is used for comparison
     * @param {Partial<Mode>} mode
     */
    const END_SAME_AS_BEGIN = function(mode) {
      return Object.assign(mode,
        {
          /** @type {ModeCallback} */
          'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },
          /** @type {ModeCallback} */
          'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }
        });
    };

    var MODES = /*#__PURE__*/Object.freeze({
        __proto__: null,
        MATCH_NOTHING_RE: MATCH_NOTHING_RE,
        IDENT_RE: IDENT_RE,
        UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,
        NUMBER_RE: NUMBER_RE,
        C_NUMBER_RE: C_NUMBER_RE,
        BINARY_NUMBER_RE: BINARY_NUMBER_RE,
        RE_STARTERS_RE: RE_STARTERS_RE,
        SHEBANG: SHEBANG,
        BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,
        APOS_STRING_MODE: APOS_STRING_MODE,
        QUOTE_STRING_MODE: QUOTE_STRING_MODE,
        PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,
        COMMENT: COMMENT,
        C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,
        C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,
        HASH_COMMENT_MODE: HASH_COMMENT_MODE,
        NUMBER_MODE: NUMBER_MODE,
        C_NUMBER_MODE: C_NUMBER_MODE,
        BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,
        REGEXP_MODE: REGEXP_MODE,
        TITLE_MODE: TITLE_MODE,
        UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE,
        METHOD_GUARD: METHOD_GUARD,
        END_SAME_AS_BEGIN: END_SAME_AS_BEGIN
    });

    /**
    @typedef {import('highlight.js').CallbackResponse} CallbackResponse
    @typedef {import('highlight.js').CompilerExt} CompilerExt
    */

    // Grammar extensions / plugins
    // See: https://github.com/highlightjs/highlight.js/issues/2833

    // Grammar extensions allow "syntactic sugar" to be added to the grammar modes
    // without requiring any underlying changes to the compiler internals.

    // `compileMatch` being the perfect small example of now allowing a grammar
    // author to write `match` when they desire to match a single expression rather
    // than being forced to use `begin`.  The extension then just moves `match` into
    // `begin` when it runs.  Ie, no features have been added, but we've just made
    // the experience of writing (and reading grammars) a little bit nicer.

    // ------

    // TODO: We need negative look-behind support to do this properly
    /**
     * Skip a match if it has a preceding dot
     *
     * This is used for `beginKeywords` to prevent matching expressions such as
     * `bob.keyword.do()`. The mode compiler automatically wires this up as a
     * special _internal_ 'on:begin' callback for modes with `beginKeywords`
     * @param {RegExpMatchArray} match
     * @param {CallbackResponse} response
     */
    function skipIfHasPrecedingDot(match, response) {
      const before = match.input[match.index - 1];
      if (before === ".") {
        response.ignoreMatch();
      }
    }

    /**
     *
     * @type {CompilerExt}
     */
    function scopeClassName(mode, _parent) {
      // eslint-disable-next-line no-undefined
      if (mode.className !== undefined) {
        mode.scope = mode.className;
        delete mode.className;
      }
    }

    /**
     * `beginKeywords` syntactic sugar
     * @type {CompilerExt}
     */
    function beginKeywords(mode, parent) {
      if (!parent) return;
      if (!mode.beginKeywords) return;

      // for languages with keywords that include non-word characters checking for
      // a word boundary is not sufficient, so instead we check for a word boundary
      // or whitespace - this does no harm in any case since our keyword engine
      // doesn't allow spaces in keywords anyways and we still check for the boundary
      // first
      mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\.)(?=\\b|\\s)';
      mode.__beforeBegin = skipIfHasPrecedingDot;
      mode.keywords = mode.keywords || mode.beginKeywords;
      delete mode.beginKeywords;

      // prevents double relevance, the keywords themselves provide
      // relevance, the mode doesn't need to double it
      // eslint-disable-next-line no-undefined
      if (mode.relevance === undefined) mode.relevance = 0;
    }

    /**
     * Allow `illegal` to contain an array of illegal values
     * @type {CompilerExt}
     */
    function compileIllegal(mode, _parent) {
      if (!Array.isArray(mode.illegal)) return;

      mode.illegal = either(...mode.illegal);
    }

    /**
     * `match` to match a single expression for readability
     * @type {CompilerExt}
     */
    function compileMatch(mode, _parent) {
      if (!mode.match) return;
      if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");

      mode.begin = mode.match;
      delete mode.match;
    }

    /**
     * provides the default 1 relevance to all modes
     * @type {CompilerExt}
     */
    function compileRelevance(mode, _parent) {
      // eslint-disable-next-line no-undefined
      if (mode.relevance === undefined) mode.relevance = 1;
    }

    // allow beforeMatch to act as a "qualifier" for the match
    // the full match begin must be [beforeMatch][begin]
    const beforeMatchExt = (mode, parent) => {
      if (!mode.beforeMatch) return;
      // starts conflicts with endsParent which we need to make sure the child
      // rule is not matched multiple times
      if (mode.starts) throw new Error("beforeMatch cannot be used with starts");

      const originalMode = Object.assign({}, mode);
      Object.keys(mode).forEach((key) => { delete mode[key]; });

      mode.keywords = originalMode.keywords;
      mode.begin = concat$1(originalMode.beforeMatch, lookahead(originalMode.begin));
      mode.starts = {
        relevance: 0,
        contains: [
          Object.assign(originalMode, { endsParent: true })
        ]
      };
      mode.relevance = 0;

      delete originalMode.beforeMatch;
    };

    // keywords that should have no default relevance value
    const COMMON_KEYWORDS = [
      'of',
      'and',
      'for',
      'in',
      'not',
      'or',
      'if',
      'then',
      'parent', // common variable name
      'list', // common variable name
      'value' // common variable name
    ];

    const DEFAULT_KEYWORD_SCOPE = "keyword";

    /**
     * Given raw keywords from a language definition, compile them.
     *
     * @param {string | Record<string,string|string[]> | Array<string>} rawKeywords
     * @param {boolean} caseInsensitive
     */
    function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
      /** @type KeywordDict */
      const compiledKeywords = Object.create(null);

      // input can be a string of keywords, an array of keywords, or a object with
      // named keys representing scopeName (which can then point to a string or array)
      if (typeof rawKeywords === 'string') {
        compileList(scopeName, rawKeywords.split(" "));
      } else if (Array.isArray(rawKeywords)) {
        compileList(scopeName, rawKeywords);
      } else {
        Object.keys(rawKeywords).forEach(function(scopeName) {
          // collapse all our objects back into the parent object
          Object.assign(
            compiledKeywords,
            compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)
          );
        });
      }
      return compiledKeywords;

      // ---

      /**
       * Compiles an individual list of keywords
       *
       * Ex: "for if when while|5"
       *
       * @param {string} scopeName
       * @param {Array<string>} keywordList
       */
      function compileList(scopeName, keywordList) {
        if (caseInsensitive) {
          keywordList = keywordList.map(x => x.toLowerCase());
        }
        keywordList.forEach(function(keyword) {
          const pair = keyword.split('|');
          compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];
        });
      }
    }

    /**
     * Returns the proper score for a given keyword
     *
     * Also takes into account comment keywords, which will be scored 0 UNLESS
     * another score has been manually assigned.
     * @param {string} keyword
     * @param {string} [providedScore]
     */
    function scoreForKeyword(keyword, providedScore) {
      // manual scores always win over common keywords
      // so you can force a score of 1 if you really insist
      if (providedScore) {
        return Number(providedScore);
      }

      return commonKeyword(keyword) ? 0 : 1;
    }

    /**
     * Determines if a given keyword is common or not
     *
     * @param {string} keyword */
    function commonKeyword(keyword) {
      return COMMON_KEYWORDS.includes(keyword.toLowerCase());
    }

    /*

    For the reasoning behind this please see:
    https://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419

    */

    /**
     * @type {Record<string, boolean>}
     */
    const seenDeprecations = {};

    /**
     * @param {string} message
     */
    const error$1 = (message) => {
      console.error(message);
    };

    /**
     * @param {string} message
     * @param {any} args
     */
    const warn = (message, ...args) => {
      console.log(`WARN: ${message}`, ...args);
    };

    /**
     * @param {string} version
     * @param {string} message
     */
    const deprecated$1 = (version, message) => {
      if (seenDeprecations[`${version}/${message}`]) return;

      console.log(`Deprecated as of ${version}. ${message}`);
      seenDeprecations[`${version}/${message}`] = true;
    };

    /* eslint-disable no-throw-literal */

    /**
    @typedef {import('highlight.js').CompiledMode} CompiledMode
    */

    const MultiClassError = new Error();

    /**
     * Renumbers labeled scope names to account for additional inner match
     * groups that otherwise would break everything.
     *
     * Lets say we 3 match scopes:
     *
     *   { 1 => ..., 2 => ..., 3 => ... }
     *
     * So what we need is a clean match like this:
     *
     *   (a)(b)(c) => [ "a", "b", "c" ]
     *
     * But this falls apart with inner match groups:
     *
     * (a)(((b)))(c) => ["a", "b", "b", "b", "c" ]
     *
     * Our scopes are now "out of alignment" and we're repeating `b` 3 times.
     * What needs to happen is the numbers are remapped:
     *
     *   { 1 => ..., 2 => ..., 5 => ... }
     *
     * We also need to know that the ONLY groups that should be output
     * are 1, 2, and 5.  This function handles this behavior.
     *
     * @param {CompiledMode} mode
     * @param {Array<RegExp | string>} regexes
     * @param {{key: "beginScope"|"endScope"}} opts
     */
    function remapScopeNames(mode, regexes, { key }) {
      let offset = 0;
      const scopeNames = mode[key];
      /** @type Record<number,boolean> */
      const emit = {};
      /** @type Record<number,string> */
      const positions = {};

      for (let i = 1; i <= regexes.length; i++) {
        positions[i + offset] = scopeNames[i];
        emit[i + offset] = true;
        offset += countMatchGroups(regexes[i - 1]);
      }
      // we use _emit to keep track of which match groups are "top-level" to avoid double
      // output from inside match groups
      mode[key] = positions;
      mode[key]._emit = emit;
      mode[key]._multi = true;
    }

    /**
     * @param {CompiledMode} mode
     */
    function beginMultiClass(mode) {
      if (!Array.isArray(mode.begin)) return;

      if (mode.skip || mode.excludeBegin || mode.returnBegin) {
        error$1("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
        throw MultiClassError;
      }

      if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
        error$1("beginScope must be object");
        throw MultiClassError;
      }

      remapScopeNames(mode, mode.begin, { key: "beginScope" });
      mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
    }

    /**
     * @param {CompiledMode} mode
     */
    function endMultiClass(mode) {
      if (!Array.isArray(mode.end)) return;

      if (mode.skip || mode.excludeEnd || mode.returnEnd) {
        error$1("skip, excludeEnd, returnEnd not compatible with endScope: {}");
        throw MultiClassError;
      }

      if (typeof mode.endScope !== "object" || mode.endScope === null) {
        error$1("endScope must be object");
        throw MultiClassError;
      }

      remapScopeNames(mode, mode.end, { key: "endScope" });
      mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
    }

    /**
     * this exists only to allow `scope: {}` to be used beside `match:`
     * Otherwise `beginScope` would necessary and that would look weird

      {
        match: [ /def/, /\w+/ ]
        scope: { 1: "keyword" , 2: "title" }
      }

     * @param {CompiledMode} mode
     */
    function scopeSugar(mode) {
      if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
        mode.beginScope = mode.scope;
        delete mode.scope;
      }
    }

    /**
     * @param {CompiledMode} mode
     */
    function MultiClass(mode) {
      scopeSugar(mode);

      if (typeof mode.beginScope === "string") {
        mode.beginScope = { _wrap: mode.beginScope };
      }
      if (typeof mode.endScope === "string") {
        mode.endScope = { _wrap: mode.endScope };
      }

      beginMultiClass(mode);
      endMultiClass(mode);
    }

    /**
    @typedef {import('highlight.js').Mode} Mode
    @typedef {import('highlight.js').CompiledMode} CompiledMode
    @typedef {import('highlight.js').Language} Language
    @typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
    @typedef {import('highlight.js').CompiledLanguage} CompiledLanguage
    */

    // compilation

    /**
     * Compiles a language definition result
     *
     * Given the raw result of a language definition (Language), compiles this so
     * that it is ready for highlighting code.
     * @param {Language} language
     * @returns {CompiledLanguage}
     */
    function compileLanguage(language) {
      /**
       * Builds a regex with the case sensitivity of the current language
       *
       * @param {RegExp | string} value
       * @param {boolean} [global]
       */
      function langRe(value, global) {
        return new RegExp(
          source$1(value),
          'm'
          + (language.case_insensitive ? 'i' : '')
          + (language.unicodeRegex ? 'u' : '')
          + (global ? 'g' : '')
        );
      }

      /**
        Stores multiple regular expressions and allows you to quickly search for
        them all in a string simultaneously - returning the first match.  It does
        this by creating a huge (a|b|c) regex - each individual item wrapped with ()
        and joined by `|` - using match groups to track position.  When a match is
        found checking which position in the array has content allows us to figure
        out which of the original regexes / match groups triggered the match.

        The match object itself (the result of `Regex.exec`) is returned but also
        enhanced by merging in any meta-data that was registered with the regex.
        This is how we keep track of which mode matched, and what type of rule
        (`illegal`, `begin`, end, etc).
      */
      class MultiRegex {
        constructor() {
          this.matchIndexes = {};
          // @ts-ignore
          this.regexes = [];
          this.matchAt = 1;
          this.position = 0;
        }

        // @ts-ignore
        addRule(re, opts) {
          opts.position = this.position++;
          // @ts-ignore
          this.matchIndexes[this.matchAt] = opts;
          this.regexes.push([opts, re]);
          this.matchAt += countMatchGroups(re) + 1;
        }

        compile() {
          if (this.regexes.length === 0) {
            // avoids the need to check length every time exec is called
            // @ts-ignore
            this.exec = () => null;
          }
          const terminators = this.regexes.map(el => el[1]);
          this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);
          this.lastIndex = 0;
        }

        /** @param {string} s */
        exec(s) {
          this.matcherRe.lastIndex = this.lastIndex;
          const match = this.matcherRe.exec(s);
          if (!match) { return null; }

          // eslint-disable-next-line no-undefined
          const i = match.findIndex((el, i) => i > 0 && el !== undefined);
          // @ts-ignore
          const matchData = this.matchIndexes[i];
          // trim off any earlier non-relevant match groups (ie, the other regex
          // match groups that make up the multi-matcher)
          match.splice(0, i);

          return Object.assign(match, matchData);
        }
      }

      /*
        Created to solve the key deficiently with MultiRegex - there is no way to
        test for multiple matches at a single location.  Why would we need to do
        that?  In the future a more dynamic engine will allow certain matches to be
        ignored.  An example: if we matched say the 3rd regex in a large group but
        decided to ignore it - we'd need to started testing again at the 4th
        regex... but MultiRegex itself gives us no real way to do that.

        So what this class creates MultiRegexs on the fly for whatever search
        position they are needed.

        NOTE: These additional MultiRegex objects are created dynamically.  For most
        grammars most of the time we will never actually need anything more than the
        first MultiRegex - so this shouldn't have too much overhead.

        Say this is our search group, and we match regex3, but wish to ignore it.

          regex1 | regex2 | regex3 | regex4 | regex5    ' ie, startAt = 0

        What we need is a new MultiRegex that only includes the remaining
        possibilities:

          regex4 | regex5                               ' ie, startAt = 3

        This class wraps all that complexity up in a simple API... `startAt` decides
        where in the array of expressions to start doing the matching. It
        auto-increments, so if a match is found at position 2, then startAt will be
        set to 3.  If the end is reached startAt will return to 0.

        MOST of the time the parser will be setting startAt manually to 0.
      */
      class ResumableMultiRegex {
        constructor() {
          // @ts-ignore
          this.rules = [];
          // @ts-ignore
          this.multiRegexes = [];
          this.count = 0;

          this.lastIndex = 0;
          this.regexIndex = 0;
        }

        // @ts-ignore
        getMatcher(index) {
          if (this.multiRegexes[index]) return this.multiRegexes[index];

          const matcher = new MultiRegex();
          this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
          matcher.compile();
          this.multiRegexes[index] = matcher;
          return matcher;
        }

        resumingScanAtSamePosition() {
          return this.regexIndex !== 0;
        }

        considerAll() {
          this.regexIndex = 0;
        }

        // @ts-ignore
        addRule(re, opts) {
          this.rules.push([re, opts]);
          if (opts.type === "begin") this.count++;
        }

        /** @param {string} s */
        exec(s) {
          const m = this.getMatcher(this.regexIndex);
          m.lastIndex = this.lastIndex;
          let result = m.exec(s);

          // The following is because we have no easy way to say "resume scanning at the
          // existing position but also skip the current rule ONLY". What happens is
          // all prior rules are also skipped which can result in matching the wrong
          // thing. Example of matching "booger":

          // our matcher is [string, "booger", number]
          //
          // ....booger....

          // if "booger" is ignored then we'd really need a regex to scan from the
          // SAME position for only: [string, number] but ignoring "booger" (if it
          // was the first match), a simple resume would scan ahead who knows how
          // far looking only for "number", ignoring potential string matches (or
          // future "booger" matches that might be valid.)

          // So what we do: We execute two matchers, one resuming at the same
          // position, but the second full matcher starting at the position after:

          //     /--- resume first regex match here (for [number])
          //     |/---- full match here for [string, "booger", number]
          //     vv
          // ....booger....

          // Which ever results in a match first is then used. So this 3-4 step
          // process essentially allows us to say "match at this position, excluding
          // a prior rule that was ignored".
          //
          // 1. Match "booger" first, ignore. Also proves that [string] does non match.
          // 2. Resume matching for [number]
          // 3. Match at index + 1 for [string, "booger", number]
          // 4. If #2 and #3 result in matches, which came first?
          if (this.resumingScanAtSamePosition()) {
            if (result && result.index === this.lastIndex) ; else { // use the second matcher result
              const m2 = this.getMatcher(0);
              m2.lastIndex = this.lastIndex + 1;
              result = m2.exec(s);
            }
          }

          if (result) {
            this.regexIndex += result.position + 1;
            if (this.regexIndex === this.count) {
              // wrap-around to considering all matches again
              this.considerAll();
            }
          }

          return result;
        }
      }

      /**
       * Given a mode, builds a huge ResumableMultiRegex that can be used to walk
       * the content and find matches.
       *
       * @param {CompiledMode} mode
       * @returns {ResumableMultiRegex}
       */
      function buildModeRegex(mode) {
        const mm = new ResumableMultiRegex();

        mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: "begin" }));

        if (mode.terminatorEnd) {
          mm.addRule(mode.terminatorEnd, { type: "end" });
        }
        if (mode.illegal) {
          mm.addRule(mode.illegal, { type: "illegal" });
        }

        return mm;
      }

      /** skip vs abort vs ignore
       *
       * @skip   - The mode is still entered and exited normally (and contains rules apply),
       *           but all content is held and added to the parent buffer rather than being
       *           output when the mode ends.  Mostly used with `sublanguage` to build up
       *           a single large buffer than can be parsed by sublanguage.
       *
       *             - The mode begin ands ends normally.
       *             - Content matched is added to the parent mode buffer.
       *             - The parser cursor is moved forward normally.
       *
       * @abort  - A hack placeholder until we have ignore.  Aborts the mode (as if it
       *           never matched) but DOES NOT continue to match subsequent `contains`
       *           modes.  Abort is bad/suboptimal because it can result in modes
       *           farther down not getting applied because an earlier rule eats the
       *           content but then aborts.
       *
       *             - The mode does not begin.
       *             - Content matched by `begin` is added to the mode buffer.
       *             - The parser cursor is moved forward accordingly.
       *
       * @ignore - Ignores the mode (as if it never matched) and continues to match any
       *           subsequent `contains` modes.  Ignore isn't technically possible with
       *           the current parser implementation.
       *
       *             - The mode does not begin.
       *             - Content matched by `begin` is ignored.
       *             - The parser cursor is not moved forward.
       */

      /**
       * Compiles an individual mode
       *
       * This can raise an error if the mode contains certain detectable known logic
       * issues.
       * @param {Mode} mode
       * @param {CompiledMode | null} [parent]
       * @returns {CompiledMode | never}
       */
      function compileMode(mode, parent) {
        const cmode = /** @type CompiledMode */ (mode);
        if (mode.isCompiled) return cmode;

        [
          scopeClassName,
          // do this early so compiler extensions generally don't have to worry about
          // the distinction between match/begin
          compileMatch,
          MultiClass,
          beforeMatchExt
        ].forEach(ext => ext(mode, parent));

        language.compilerExtensions.forEach(ext => ext(mode, parent));

        // __beforeBegin is considered private API, internal use only
        mode.__beforeBegin = null;

        [
          beginKeywords,
          // do this later so compiler extensions that come earlier have access to the
          // raw array if they wanted to perhaps manipulate it, etc.
          compileIllegal,
          // default to 1 relevance if not specified
          compileRelevance
        ].forEach(ext => ext(mode, parent));

        mode.isCompiled = true;

        let keywordPattern = null;
        if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
          // we need a copy because keywords might be compiled multiple times
          // so we can't go deleting $pattern from the original on the first
          // pass
          mode.keywords = Object.assign({}, mode.keywords);
          keywordPattern = mode.keywords.$pattern;
          delete mode.keywords.$pattern;
        }
        keywordPattern = keywordPattern || /\w+/;

        if (mode.keywords) {
          mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
        }

        cmode.keywordPatternRe = langRe(keywordPattern, true);

        if (parent) {
          if (!mode.begin) mode.begin = /\B|\b/;
          cmode.beginRe = langRe(cmode.begin);
          if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
          if (mode.end) cmode.endRe = langRe(cmode.end);
          cmode.terminatorEnd = source$1(cmode.end) || '';
          if (mode.endsWithParent && parent.terminatorEnd) {
            cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;
          }
        }
        if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));
        if (!mode.contains) mode.contains = [];

        mode.contains = [].concat(...mode.contains.map(function(c) {
          return expandOrCloneMode(c === 'self' ? mode : c);
        }));
        mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });

        if (mode.starts) {
          compileMode(mode.starts, parent);
        }

        cmode.matcher = buildModeRegex(cmode);
        return cmode;
      }

      if (!language.compilerExtensions) language.compilerExtensions = [];

      // self is not valid at the top-level
      if (language.contains && language.contains.includes('self')) {
        throw new Error("ERR: contains `self` is not supported at the top-level of a language.  See documentation.");
      }

      // we need a null object, which inherit will guarantee
      language.classNameAliases = inherit$1(language.classNameAliases || {});

      return compileMode(/** @type Mode */ (language));
    }

    /**
     * Determines if a mode has a dependency on it's parent or not
     *
     * If a mode does have a parent dependency then often we need to clone it if
     * it's used in multiple places so that each copy points to the correct parent,
     * where-as modes without a parent can often safely be re-used at the bottom of
     * a mode chain.
     *
     * @param {Mode | null} mode
     * @returns {boolean} - is there a dependency on the parent?
     * */
    function dependencyOnParent(mode) {
      if (!mode) return false;

      return mode.endsWithParent || dependencyOnParent(mode.starts);
    }

    /**
     * Expands a mode or clones it if necessary
     *
     * This is necessary for modes with parental dependenceis (see notes on
     * `dependencyOnParent`) and for nodes that have `variants` - which must then be
     * exploded into their own individual modes at compile time.
     *
     * @param {Mode} mode
     * @returns {Mode | Mode[]}
     * */
    function expandOrCloneMode(mode) {
      if (mode.variants && !mode.cachedVariants) {
        mode.cachedVariants = mode.variants.map(function(variant) {
          return inherit$1(mode, { variants: null }, variant);
        });
      }

      // EXPAND
      // if we have variants then essentially "replace" the mode with the variants
      // this happens in compileMode, where this function is called from
      if (mode.cachedVariants) {
        return mode.cachedVariants;
      }

      // CLONE
      // if we have dependencies on parents then we need a unique
      // instance of ourselves, so we can be reused with many
      // different parents without issue
      if (dependencyOnParent(mode)) {
        return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
      }

      if (Object.isFrozen(mode)) {
        return inherit$1(mode);
      }

      // no special dependency issues, just return ourselves
      return mode;
    }

    var version$3 = "11.4.0";

    class HTMLInjectionError extends Error {
      constructor(reason, html) {
        super(reason);
        this.name = "HTMLInjectionError";
        this.html = html;
      }
    }

    /*
    Syntax highlighting with language autodetection.
    https://highlightjs.org/
    */

    /**
    @typedef {import('highlight.js').Mode} Mode
    @typedef {import('highlight.js').CompiledMode} CompiledMode
    @typedef {import('highlight.js').CompiledScope} CompiledScope
    @typedef {import('highlight.js').Language} Language
    @typedef {import('highlight.js').HLJSApi} HLJSApi
    @typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
    @typedef {import('highlight.js').PluginEvent} PluginEvent
    @typedef {import('highlight.js').HLJSOptions} HLJSOptions
    @typedef {import('highlight.js').LanguageFn} LanguageFn
    @typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement
    @typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext
    @typedef {import('highlight.js/private').MatchType} MatchType
    @typedef {import('highlight.js/private').KeywordData} KeywordData
    @typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch
    @typedef {import('highlight.js/private').AnnotatedError} AnnotatedError
    @typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult
    @typedef {import('highlight.js').HighlightOptions} HighlightOptions
    @typedef {import('highlight.js').HighlightResult} HighlightResult
    */


    const escape$1 = escapeHTML;
    const inherit = inherit$1;
    const NO_MATCH = Symbol("nomatch");
    const MAX_KEYWORD_HITS = 7;

    /**
     * @param {any} hljs - object that is extended (legacy)
     * @returns {HLJSApi}
     */
    const HLJS = function(hljs) {
      // Global internal variables used within the highlight.js library.
      /** @type {Record<string, Language>} */
      const languages = Object.create(null);
      /** @type {Record<string, string>} */
      const aliases = Object.create(null);
      /** @type {HLJSPlugin[]} */
      const plugins = [];

      // safe/production mode - swallows more errors, tries to keep running
      // even if a single syntax or parse hits a fatal error
      let SAFE_MODE = true;
      const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
      /** @type {Language} */
      const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };

      // Global options used when within external APIs. This is modified when
      // calling the `hljs.configure` function.
      /** @type HLJSOptions */
      let options = {
        ignoreUnescapedHTML: false,
        throwUnescapedHTML: false,
        noHighlightRe: /^(no-?highlight)$/i,
        languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
        classPrefix: 'hljs-',
        cssSelector: 'pre code',
        languages: null,
        // beta configuration options, subject to change, welcome to discuss
        // https://github.com/highlightjs/highlight.js/issues/1086
        __emitter: TokenTreeEmitter
      };

      /* Utility functions */

      /**
       * Tests a language name to see if highlighting should be skipped
       * @param {string} languageName
       */
      function shouldNotHighlight(languageName) {
        return options.noHighlightRe.test(languageName);
      }

      /**
       * @param {HighlightedHTMLElement} block - the HTML element to determine language for
       */
      function blockLanguage(block) {
        let classes = block.className + ' ';

        classes += block.parentNode ? block.parentNode.className : '';

        // language-* takes precedence over non-prefixed class names.
        const match = options.languageDetectRe.exec(classes);
        if (match) {
          const language = getLanguage(match[1]);
          if (!language) {
            warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
            warn("Falling back to no-highlight mode for this block.", block);
          }
          return language ? match[1] : 'no-highlight';
        }

        return classes
          .split(/\s+/)
          .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
      }

      /**
       * Core highlighting function.
       *
       * OLD API
       * highlight(lang, code, ignoreIllegals, continuation)
       *
       * NEW API
       * highlight(code, {lang, ignoreIllegals})
       *
       * @param {string} codeOrLanguageName - the language to use for highlighting
       * @param {string | HighlightOptions} optionsOrCode - the code to highlight
       * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
       *
       * @returns {HighlightResult} Result - an object that represents the result
       * @property {string} language - the language name
       * @property {number} relevance - the relevance score
       * @property {string} value - the highlighted HTML code
       * @property {string} code - the original raw code
       * @property {CompiledMode} top - top of the current mode stack
       * @property {boolean} illegal - indicates whether any illegal matches were found
      */
      function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
        let code = "";
        let languageName = "";
        if (typeof optionsOrCode === "object") {
          code = codeOrLanguageName;
          ignoreIllegals = optionsOrCode.ignoreIllegals;
          languageName = optionsOrCode.language;
        } else {
          // old API
          deprecated$1("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
          deprecated$1("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
          languageName = codeOrLanguageName;
          code = optionsOrCode;
        }

        // https://github.com/highlightjs/highlight.js/issues/3149
        // eslint-disable-next-line no-undefined
        if (ignoreIllegals === undefined) { ignoreIllegals = true; }

        /** @type {BeforeHighlightContext} */
        const context = {
          code,
          language: languageName
        };
        // the plugin can change the desired language or the code to be highlighted
        // just be changing the object it was passed
        fire("before:highlight", context);

        // a before plugin can usurp the result completely by providing it's own
        // in which case we don't even need to call highlight
        const result = context.result
          ? context.result
          : _highlight(context.language, context.code, ignoreIllegals);

        result.code = context.code;
        // the plugin can change anything in result to suite it
        fire("after:highlight", result);

        return result;
      }

      /**
       * private highlight that's used internally and does not fire callbacks
       *
       * @param {string} languageName - the language to use for highlighting
       * @param {string} codeToHighlight - the code to highlight
       * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
       * @param {CompiledMode?} [continuation] - current continuation mode, if any
       * @returns {HighlightResult} - result of the highlight operation
      */
      function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
        const keywordHits = Object.create(null);

        /**
         * Return keyword data if a match is a keyword
         * @param {CompiledMode} mode - current mode
         * @param {string} matchText - the textual match
         * @returns {KeywordData | false}
         */
        function keywordData(mode, matchText) {
          return mode.keywords[matchText];
        }

        function processKeywords() {
          if (!top.keywords) {
            emitter.addText(modeBuffer);
            return;
          }

          let lastIndex = 0;
          top.keywordPatternRe.lastIndex = 0;
          let match = top.keywordPatternRe.exec(modeBuffer);
          let buf = "";

          while (match) {
            buf += modeBuffer.substring(lastIndex, match.index);
            const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
            const data = keywordData(top, word);
            if (data) {
              const [kind, keywordRelevance] = data;
              emitter.addText(buf);
              buf = "";

              keywordHits[word] = (keywordHits[word] || 0) + 1;
              if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
              if (kind.startsWith("_")) {
                // _ implied for relevance only, do not highlight
                // by applying a class name
                buf += match[0];
              } else {
                const cssClass = language.classNameAliases[kind] || kind;
                emitter.addKeyword(match[0], cssClass);
              }
            } else {
              buf += match[0];
            }
            lastIndex = top.keywordPatternRe.lastIndex;
            match = top.keywordPatternRe.exec(modeBuffer);
          }
          buf += modeBuffer.substr(lastIndex);
          emitter.addText(buf);
        }

        function processSubLanguage() {
          if (modeBuffer === "") return;
          /** @type HighlightResult */
          let result = null;

          if (typeof top.subLanguage === 'string') {
            if (!languages[top.subLanguage]) {
              emitter.addText(modeBuffer);
              return;
            }
            result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
            continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);
          } else {
            result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
          }

          // Counting embedded language score towards the host language may be disabled
          // with zeroing the containing mode relevance. Use case in point is Markdown that
          // allows XML everywhere and makes every XML snippet to have a much larger Markdown
          // score.
          if (top.relevance > 0) {
            relevance += result.relevance;
          }
          emitter.addSublanguage(result._emitter, result.language);
        }

        function processBuffer() {
          if (top.subLanguage != null) {
            processSubLanguage();
          } else {
            processKeywords();
          }
          modeBuffer = '';
        }

        /**
         * @param {CompiledScope} scope
         * @param {RegExpMatchArray} match
         */
        function emitMultiClass(scope, match) {
          let i = 1;
          // eslint-disable-next-line no-undefined
          while (match[i] !== undefined) {
            if (!scope._emit[i]) { i++; continue; }
            const klass = language.classNameAliases[scope[i]] || scope[i];
            const text = match[i];
            if (klass) {
              emitter.addKeyword(text, klass);
            } else {
              modeBuffer = text;
              processKeywords();
              modeBuffer = "";
            }
            i++;
          }
        }

        /**
         * @param {CompiledMode} mode - new mode to start
         * @param {RegExpMatchArray} match
         */
        function startNewMode(mode, match) {
          if (mode.scope && typeof mode.scope === "string") {
            emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
          }
          if (mode.beginScope) {
            // beginScope just wraps the begin match itself in a scope
            if (mode.beginScope._wrap) {
              emitter.addKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
              modeBuffer = "";
            } else if (mode.beginScope._multi) {
              // at this point modeBuffer should just be the match
              emitMultiClass(mode.beginScope, match);
              modeBuffer = "";
            }
          }

          top = Object.create(mode, { parent: { value: top } });
          return top;
        }

        /**
         * @param {CompiledMode } mode - the mode to potentially end
         * @param {RegExpMatchArray} match - the latest match
         * @param {string} matchPlusRemainder - match plus remainder of content
         * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode
         */
        function endOfMode(mode, match, matchPlusRemainder) {
          let matched = startsWith(mode.endRe, matchPlusRemainder);

          if (matched) {
            if (mode["on:end"]) {
              const resp = new Response(mode);
              mode["on:end"](match, resp);
              if (resp.isMatchIgnored) matched = false;
            }

            if (matched) {
              while (mode.endsParent && mode.parent) {
                mode = mode.parent;
              }
              return mode;
            }
          }
          // even if on:end fires an `ignore` it's still possible
          // that we might trigger the end node because of a parent mode
          if (mode.endsWithParent) {
            return endOfMode(mode.parent, match, matchPlusRemainder);
          }
        }

        /**
         * Handle matching but then ignoring a sequence of text
         *
         * @param {string} lexeme - string containing full match text
         */
        function doIgnore(lexeme) {
          if (top.matcher.regexIndex === 0) {
            // no more regexes to potentially match here, so we move the cursor forward one
            // space
            modeBuffer += lexeme[0];
            return 1;
          } else {
            // no need to move the cursor, we still have additional regexes to try and
            // match at this very spot
            resumeScanAtSamePosition = true;
            return 0;
          }
        }

        /**
         * Handle the start of a new potential mode match
         *
         * @param {EnhancedMatch} match - the current match
         * @returns {number} how far to advance the parse cursor
         */
        function doBeginMatch(match) {
          const lexeme = match[0];
          const newMode = match.rule;

          const resp = new Response(newMode);
          // first internal before callbacks, then the public ones
          const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
          for (const cb of beforeCallbacks) {
            if (!cb) continue;
            cb(match, resp);
            if (resp.isMatchIgnored) return doIgnore(lexeme);
          }

          if (newMode.skip) {
            modeBuffer += lexeme;
          } else {
            if (newMode.excludeBegin) {
              modeBuffer += lexeme;
            }
            processBuffer();
            if (!newMode.returnBegin && !newMode.excludeBegin) {
              modeBuffer = lexeme;
            }
          }
          startNewMode(newMode, match);
          return newMode.returnBegin ? 0 : lexeme.length;
        }

        /**
         * Handle the potential end of mode
         *
         * @param {RegExpMatchArray} match - the current match
         */
        function doEndMatch(match) {
          const lexeme = match[0];
          const matchPlusRemainder = codeToHighlight.substr(match.index);

          const endMode = endOfMode(top, match, matchPlusRemainder);
          if (!endMode) { return NO_MATCH; }

          const origin = top;
          if (top.endScope && top.endScope._wrap) {
            processBuffer();
            emitter.addKeyword(lexeme, top.endScope._wrap);
          } else if (top.endScope && top.endScope._multi) {
            processBuffer();
            emitMultiClass(top.endScope, match);
          } else if (origin.skip) {
            modeBuffer += lexeme;
          } else {
            if (!(origin.returnEnd || origin.excludeEnd)) {
              modeBuffer += lexeme;
            }
            processBuffer();
            if (origin.excludeEnd) {
              modeBuffer = lexeme;
            }
          }
          do {
            if (top.scope) {
              emitter.closeNode();
            }
            if (!top.skip && !top.subLanguage) {
              relevance += top.relevance;
            }
            top = top.parent;
          } while (top !== endMode.parent);
          if (endMode.starts) {
            startNewMode(endMode.starts, match);
          }
          return origin.returnEnd ? 0 : lexeme.length;
        }

        function processContinuations() {
          const list = [];
          for (let current = top; current !== language; current = current.parent) {
            if (current.scope) {
              list.unshift(current.scope);
            }
          }
          list.forEach(item => emitter.openNode(item));
        }

        /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */
        let lastMatch = {};

        /**
         *  Process an individual match
         *
         * @param {string} textBeforeMatch - text preceding the match (since the last match)
         * @param {EnhancedMatch} [match] - the match itself
         */
        function processLexeme(textBeforeMatch, match) {
          const lexeme = match && match[0];

          // add non-matched text to the current mode buffer
          modeBuffer += textBeforeMatch;

          if (lexeme == null) {
            processBuffer();
            return 0;
          }

          // we've found a 0 width match and we're stuck, so we need to advance
          // this happens when we have badly behaved rules that have optional matchers to the degree that
          // sometimes they can end up matching nothing at all
          // Ref: https://github.com/highlightjs/highlight.js/issues/2140
          if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
            // spit the "skipped" character that our regex choked on back into the output sequence
            modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
            if (!SAFE_MODE) {
              /** @type {AnnotatedError} */
              const err = new Error(`0 width match regex (${languageName})`);
              err.languageName = languageName;
              err.badRule = lastMatch.rule;
              throw err;
            }
            return 1;
          }
          lastMatch = match;

          if (match.type === "begin") {
            return doBeginMatch(match);
          } else if (match.type === "illegal" && !ignoreIllegals) {
            // illegal match, we do not continue processing
            /** @type {AnnotatedError} */
            const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || '<unnamed>') + '"');
            err.mode = top;
            throw err;
          } else if (match.type === "end") {
            const processed = doEndMatch(match);
            if (processed !== NO_MATCH) {
              return processed;
            }
          }

          // edge case for when illegal matches $ (end of line) which is technically
          // a 0 width match but not a begin/end match so it's not caught by the
          // first handler (when ignoreIllegals is true)
          if (match.type === "illegal" && lexeme === "") {
            // advance so we aren't stuck in an infinite loop
            return 1;
          }

          // infinite loops are BAD, this is a last ditch catch all. if we have a
          // decent number of iterations yet our index (cursor position in our
          // parsing) still 3x behind our index then something is very wrong
          // so we bail
          if (iterations > 100000 && iterations > match.index * 3) {
            const err = new Error('potential infinite loop, way more iterations than matches');
            throw err;
          }

          /*
          Why might be find ourselves here?  An potential end match that was
          triggered but could not be completed.  IE, `doEndMatch` returned NO_MATCH.
          (this could be because a callback requests the match be ignored, etc)

          This causes no real harm other than stopping a few times too many.
          */

          modeBuffer += lexeme;
          return lexeme.length;
        }

        const language = getLanguage(languageName);
        if (!language) {
          error$1(LANGUAGE_NOT_FOUND.replace("{}", languageName));
          throw new Error('Unknown language: "' + languageName + '"');
        }

        const md = compileLanguage(language);
        let result = '';
        /** @type {CompiledMode} */
        let top = continuation || md;
        /** @type Record<string,CompiledMode> */
        const continuations = {}; // keep continuations for sub-languages
        const emitter = new options.__emitter(options);
        processContinuations();
        let modeBuffer = '';
        let relevance = 0;
        let index = 0;
        let iterations = 0;
        let resumeScanAtSamePosition = false;

        try {
          top.matcher.considerAll();

          for (;;) {
            iterations++;
            if (resumeScanAtSamePosition) {
              // only regexes not matched previously will now be
              // considered for a potential match
              resumeScanAtSamePosition = false;
            } else {
              top.matcher.considerAll();
            }
            top.matcher.lastIndex = index;

            const match = top.matcher.exec(codeToHighlight);
            // console.log("match", match[0], match.rule && match.rule.begin)

            if (!match) break;

            const beforeMatch = codeToHighlight.substring(index, match.index);
            const processedCount = processLexeme(beforeMatch, match);
            index = match.index + processedCount;
          }
          processLexeme(codeToHighlight.substr(index));
          emitter.closeAllNodes();
          emitter.finalize();
          result = emitter.toHTML();

          return {
            language: languageName,
            value: result,
            relevance: relevance,
            illegal: false,
            _emitter: emitter,
            _top: top
          };
        } catch (err) {
          if (err.message && err.message.includes('Illegal')) {
            return {
              language: languageName,
              value: escape$1(codeToHighlight),
              illegal: true,
              relevance: 0,
              _illegalBy: {
                message: err.message,
                index: index,
                context: codeToHighlight.slice(index - 100, index + 100),
                mode: err.mode,
                resultSoFar: result
              },
              _emitter: emitter
            };
          } else if (SAFE_MODE) {
            return {
              language: languageName,
              value: escape$1(codeToHighlight),
              illegal: false,
              relevance: 0,
              errorRaised: err,
              _emitter: emitter,
              _top: top
            };
          } else {
            throw err;
          }
        }
      }

      /**
       * returns a valid highlight result, without actually doing any actual work,
       * auto highlight starts with this and it's possible for small snippets that
       * auto-detection may not find a better match
       * @param {string} code
       * @returns {HighlightResult}
       */
      function justTextHighlightResult(code) {
        const result = {
          value: escape$1(code),
          illegal: false,
          relevance: 0,
          _top: PLAINTEXT_LANGUAGE,
          _emitter: new options.__emitter(options)
        };
        result._emitter.addText(code);
        return result;
      }

      /**
      Highlighting with language detection. Accepts a string with the code to
      highlight. Returns an object with the following properties:

      - language (detected language)
      - relevance (int)
      - value (an HTML string with highlighting markup)
      - secondBest (object with the same structure for second-best heuristically
        detected language, may be absent)

        @param {string} code
        @param {Array<string>} [languageSubset]
        @returns {AutoHighlightResult}
      */
      function highlightAuto(code, languageSubset) {
        languageSubset = languageSubset || options.languages || Object.keys(languages);
        const plaintext = justTextHighlightResult(code);

        const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>
          _highlight(name, code, false)
        );
        results.unshift(plaintext); // plaintext is always an option

        const sorted = results.sort((a, b) => {
          // sort base on relevance
          if (a.relevance !== b.relevance) return b.relevance - a.relevance;

          // always award the tie to the base language
          // ie if C++ and Arduino are tied, it's more likely to be C++
          if (a.language && b.language) {
            if (getLanguage(a.language).supersetOf === b.language) {
              return 1;
            } else if (getLanguage(b.language).supersetOf === a.language) {
              return -1;
            }
          }

          // otherwise say they are equal, which has the effect of sorting on
          // relevance while preserving the original ordering - which is how ties
          // have historically been settled, ie the language that comes first always
          // wins in the case of a tie
          return 0;
        });

        const [best, secondBest] = sorted;

        /** @type {AutoHighlightResult} */
        const result = best;
        result.secondBest = secondBest;

        return result;
      }

      /**
       * Builds new class name for block given the language name
       *
       * @param {HTMLElement} element
       * @param {string} [currentLang]
       * @param {string} [resultLang]
       */
      function updateClassName(element, currentLang, resultLang) {
        const language = (currentLang && aliases[currentLang]) || resultLang;

        element.classList.add("hljs");
        element.classList.add(`language-${language}`);
      }

      /**
       * Applies highlighting to a DOM node containing code.
       *
       * @param {HighlightedHTMLElement} element - the HTML element to highlight
      */
      function highlightElement(element) {
        /** @type HTMLElement */
        let node = null;
        const language = blockLanguage(element);

        if (shouldNotHighlight(language)) return;

        fire("before:highlightElement",
          { el: element, language: language });

        // we should be all text, no child nodes (unescaped HTML) - this is possibly
        // an HTML injection attack - it's likely too late if this is already in
        // production (the code has likely already done its damage by the time
        // we're seeing it)... but we yell loudly about this so that hopefully it's
        // more likely to be caught in development before making it to production
        if (element.children.length > 0) {
          if (!options.ignoreUnescapedHTML) {
            console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
            console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
            console.warn("The element with unescaped HTML:");
            console.warn(element);
          }
          if (options.throwUnescapedHTML) {
            const err = new HTMLInjectionError(
              "One of your code blocks includes unescaped HTML.",
              element.innerHTML
            );
            throw err;
          }
        }

        node = element;
        const text = node.textContent;
        const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);

        element.innerHTML = result.value;
        updateClassName(element, language, result.language);
        element.result = {
          language: result.language,
          // TODO: remove with version 11.0
          re: result.relevance,
          relevance: result.relevance
        };
        if (result.secondBest) {
          element.secondBest = {
            language: result.secondBest.language,
            relevance: result.secondBest.relevance
          };
        }

        fire("after:highlightElement", { el: element, result, text });
      }

      /**
       * Updates highlight.js global options with the passed options
       *
       * @param {Partial<HLJSOptions>} userOptions
       */
      function configure(userOptions) {
        options = inherit(options, userOptions);
      }

      // TODO: remove v12, deprecated
      const initHighlighting = () => {
        highlightAll();
        deprecated$1("10.6.0", "initHighlighting() deprecated.  Use highlightAll() now.");
      };

      // TODO: remove v12, deprecated
      function initHighlightingOnLoad() {
        highlightAll();
        deprecated$1("10.6.0", "initHighlightingOnLoad() deprecated.  Use highlightAll() now.");
      }

      let wantsHighlight = false;

      /**
       * auto-highlights all pre>code elements on the page
       */
      function highlightAll() {
        // if we are called too early in the loading process
        if (document.readyState === "loading") {
          wantsHighlight = true;
          return;
        }

        const blocks = document.querySelectorAll(options.cssSelector);
        blocks.forEach(highlightElement);
      }

      function boot() {
        // if a highlight was requested before DOM was loaded, do now
        if (wantsHighlight) highlightAll();
      }

      // make sure we are in the browser environment
      if (typeof window !== 'undefined' && window.addEventListener) {
        window.addEventListener('DOMContentLoaded', boot, false);
      }

      /**
       * Register a language grammar module
       *
       * @param {string} languageName
       * @param {LanguageFn} languageDefinition
       */
      function registerLanguage(languageName, languageDefinition) {
        let lang = null;
        try {
          lang = languageDefinition(hljs);
        } catch (error$1$1) {
          error$1("Language definition for '{}' could not be registered.".replace("{}", languageName));
          // hard or soft error
          if (!SAFE_MODE) { throw error$1$1; } else { error$1(error$1$1); }
          // languages that have serious errors are replaced with essentially a
          // "plaintext" stand-in so that the code blocks will still get normal
          // css classes applied to them - and one bad language won't break the
          // entire highlighter
          lang = PLAINTEXT_LANGUAGE;
        }
        // give it a temporary name if it doesn't have one in the meta-data
        if (!lang.name) lang.name = languageName;
        languages[languageName] = lang;
        lang.rawDefinition = languageDefinition.bind(null, hljs);

        if (lang.aliases) {
          registerAliases(lang.aliases, { languageName });
        }
      }

      /**
       * Remove a language grammar module
       *
       * @param {string} languageName
       */
      function unregisterLanguage(languageName) {
        delete languages[languageName];
        for (const alias of Object.keys(aliases)) {
          if (aliases[alias] === languageName) {
            delete aliases[alias];
          }
        }
      }

      /**
       * @returns {string[]} List of language internal names
       */
      function listLanguages() {
        return Object.keys(languages);
      }

      /**
       * @param {string} name - name of the language to retrieve
       * @returns {Language | undefined}
       */
      function getLanguage(name) {
        name = (name || '').toLowerCase();
        return languages[name] || languages[aliases[name]];
      }

      /**
       *
       * @param {string|string[]} aliasList - single alias or list of aliases
       * @param {{languageName: string}} opts
       */
      function registerAliases(aliasList, { languageName }) {
        if (typeof aliasList === 'string') {
          aliasList = [aliasList];
        }
        aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });
      }

      /**
       * Determines if a given language has auto-detection enabled
       * @param {string} name - name of the language
       */
      function autoDetection(name) {
        const lang = getLanguage(name);
        return lang && !lang.disableAutodetect;
      }

      /**
       * Upgrades the old highlightBlock plugins to the new
       * highlightElement API
       * @param {HLJSPlugin} plugin
       */
      function upgradePluginAPI(plugin) {
        // TODO: remove with v12
        if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
          plugin["before:highlightElement"] = (data) => {
            plugin["before:highlightBlock"](
              Object.assign({ block: data.el }, data)
            );
          };
        }
        if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
          plugin["after:highlightElement"] = (data) => {
            plugin["after:highlightBlock"](
              Object.assign({ block: data.el }, data)
            );
          };
        }
      }

      /**
       * @param {HLJSPlugin} plugin
       */
      function addPlugin(plugin) {
        upgradePluginAPI(plugin);
        plugins.push(plugin);
      }

      /**
       *
       * @param {PluginEvent} event
       * @param {any} args
       */
      function fire(event, args) {
        const cb = event;
        plugins.forEach(function(plugin) {
          if (plugin[cb]) {
            plugin[cb](args);
          }
        });
      }

      /**
       * DEPRECATED
       * @param {HighlightedHTMLElement} el
       */
      function deprecateHighlightBlock(el) {
        deprecated$1("10.7.0", "highlightBlock will be removed entirely in v12.0");
        deprecated$1("10.7.0", "Please use highlightElement now.");

        return highlightElement(el);
      }

      /* Interface definition */
      Object.assign(hljs, {
        highlight,
        highlightAuto,
        highlightAll,
        highlightElement,
        // TODO: Remove with v12 API
        highlightBlock: deprecateHighlightBlock,
        configure,
        initHighlighting,
        initHighlightingOnLoad,
        registerLanguage,
        unregisterLanguage,
        listLanguages,
        getLanguage,
        registerAliases,
        autoDetection,
        inherit,
        addPlugin
      });

      hljs.debugMode = function() { SAFE_MODE = false; };
      hljs.safeMode = function() { SAFE_MODE = true; };
      hljs.versionString = version$3;

      hljs.regex = {
        concat: concat$1,
        lookahead: lookahead,
        either: either,
        optional: optional,
        anyNumberOfTimes: anyNumberOfTimes
      };

      for (const key in MODES) {
        // @ts-ignore
        if (typeof MODES[key] === "object") {
          // @ts-ignore
          deepFreeze$1(MODES[key]);
        }
      }

      // merge all the modes/regexes into our main object
      Object.assign(hljs, MODES);

      return hljs;
    };

    // export an "instance" of the highlighter
    var highlight = HLJS({});

    var core = highlight;
    highlight.HighlightJS = highlight;
    highlight.default = highlight;

    /* node_modules/svelte-highlight/src/Highlight.svelte generated by Svelte v3.46.4 */
    const file$y = "node_modules/svelte-highlight/src/Highlight.svelte";
    const get_default_slot_changes$6 = dirty => ({ highlighted: dirty & /*highlighted*/ 8 });
    const get_default_slot_context$6 = ctx => ({ highlighted: /*highlighted*/ ctx[3] });

    // (40:90) {:else}
    function create_else_block$4(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text(/*code*/ ctx[1]);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*code*/ 2) set_data_dev(t, /*code*/ ctx[1]);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$4.name,
    		type: "else",
    		source: "(40:90) {:else}",
    		ctx
    	});

    	return block;
    }

    // (40:40) {#if highlighted !== undefined}
    function create_if_block$l(ctx) {
    	let html_tag;
    	let html_anchor;

    	const block = {
    		c: function create() {
    			html_tag = new HtmlTag();
    			html_anchor = empty$2();
    			html_tag.a = html_anchor;
    		},
    		m: function mount(target, anchor) {
    			html_tag.m(/*highlighted*/ ctx[3], target, anchor);
    			insert_dev(target, html_anchor, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*highlighted*/ 8) html_tag.p(/*highlighted*/ ctx[3]);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(html_anchor);
    			if (detaching) html_tag.d();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$l.name,
    		type: "if",
    		source: "(40:40) {#if highlighted !== undefined}",
    		ctx
    	});

    	return block;
    }

    // (35:20)    
    function fallback_block(ctx) {
    	let pre;
    	let code_1;
    	let pre_data_language_value;

    	function select_block_type(ctx, dirty) {
    		if (/*highlighted*/ ctx[3] !== undefined) return create_if_block$l;
    		return create_else_block$4;
    	}

    	let current_block_type = select_block_type(ctx);
    	let if_block = current_block_type(ctx);

    	let pre_levels = [
    		{
    			"data-language": pre_data_language_value = /*language*/ ctx[0].name && /*language*/ ctx[0].name || "plaintext"
    		},
    		/*$$restProps*/ ctx[4]
    	];

    	let pre_data = {};

    	for (let i = 0; i < pre_levels.length; i += 1) {
    		pre_data = assign$1(pre_data, pre_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			pre = element("pre");
    			code_1 = element("code");
    			if_block.c();
    			attr_dev(code_1, "class", "hljs");
    			add_location(code_1, file$y, 39, 21, 1015);
    			set_attributes(pre, pre_data);
    			toggle_class(pre, "langtag", /*langtag*/ ctx[2]);
    			toggle_class(pre, "svelte-1xjucv4", true);
    			add_location(pre, file$y, 36, 2, 903);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, pre, anchor);
    			append_dev(pre, code_1);
    			if_block.m(code_1, null);
    		},
    		p: function update(ctx, dirty) {
    			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
    				if_block.p(ctx, dirty);
    			} else {
    				if_block.d(1);
    				if_block = current_block_type(ctx);

    				if (if_block) {
    					if_block.c();
    					if_block.m(code_1, null);
    				}
    			}

    			set_attributes(pre, pre_data = get_spread_update(pre_levels, [
    				dirty & /*language*/ 1 && pre_data_language_value !== (pre_data_language_value = /*language*/ ctx[0].name && /*language*/ ctx[0].name || "plaintext") && { "data-language": pre_data_language_value },
    				dirty & /*$$restProps*/ 16 && /*$$restProps*/ ctx[4]
    			]));

    			toggle_class(pre, "langtag", /*langtag*/ ctx[2]);
    			toggle_class(pre, "svelte-1xjucv4", true);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(pre);
    			if_block.d();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: fallback_block.name,
    		type: "fallback",
    		source: "(35:20)    ",
    		ctx
    	});

    	return block;
    }

    function create_fragment$B(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], get_default_slot_context$6);
    	const default_slot_or_fallback = default_slot || fallback_block(ctx);

    	const block = {
    		c: function create() {
    			if (default_slot_or_fallback) default_slot_or_fallback.c();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (default_slot_or_fallback) {
    				default_slot_or_fallback.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope, highlighted*/ 40)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, get_default_slot_changes$6),
    						get_default_slot_context$6
    					);
    				}
    			} else {
    				if (default_slot_or_fallback && default_slot_or_fallback.p && (!current || dirty & /*language, $$restProps, langtag, highlighted, code*/ 31)) {
    					default_slot_or_fallback.p(ctx, !current ? -1 : dirty);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot_or_fallback, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot_or_fallback, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot_or_fallback) default_slot_or_fallback.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$B.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$z($$self, $$props, $$invalidate) {
    	const omit_props_names = ["language","code","langtag"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Highlight', slots, ['default']);
    	let { language = { name: undefined, register: undefined } } = $$props;
    	let { code = undefined } = $$props;
    	let { langtag = false } = $$props;
    	const dispatch = createEventDispatcher();
    	let highlighted = undefined;

    	afterUpdate(() => {
    		if (highlighted) dispatch("highlight", { highlighted });
    	});

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(4, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('language' in $$new_props) $$invalidate(0, language = $$new_props.language);
    		if ('code' in $$new_props) $$invalidate(1, code = $$new_props.code);
    		if ('langtag' in $$new_props) $$invalidate(2, langtag = $$new_props.langtag);
    		if ('$$scope' in $$new_props) $$invalidate(5, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		language,
    		code,
    		langtag,
    		hljs: core,
    		createEventDispatcher,
    		afterUpdate,
    		dispatch,
    		highlighted
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('language' in $$props) $$invalidate(0, language = $$new_props.language);
    		if ('code' in $$props) $$invalidate(1, code = $$new_props.code);
    		if ('langtag' in $$props) $$invalidate(2, langtag = $$new_props.langtag);
    		if ('highlighted' in $$props) $$invalidate(3, highlighted = $$new_props.highlighted);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*language, code*/ 3) {
    			if (language.name && language.register) {
    				core.registerLanguage(language.name, language.register);
    				$$invalidate(3, highlighted = core.highlight(code, { language: language.name }).value);
    			}
    		}
    	};

    	return [language, code, langtag, highlighted, $$restProps, $$scope, slots];
    }

    class Highlight extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$z, create_fragment$B, safe_not_equal, { language: 0, code: 1, langtag: 2 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Highlight",
    			options,
    			id: create_fragment$B.name
    		});
    	}

    	get language() {
    		throw new Error("<Highlight>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set language(value) {
    		throw new Error("<Highlight>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get code() {
    		throw new Error("<Highlight>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set code(value) {
    		throw new Error("<Highlight>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get langtag() {
    		throw new Error("<Highlight>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set langtag(value) {
    		throw new Error("<Highlight>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    var Highlight$1 = Highlight;

    /*
    Language: Python
    Description: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
    Website: https://www.python.org
    Category: common
    */

    function python$2(hljs) {
      const regex = hljs.regex;
      const IDENT_RE = /[\p{XID_Start}_]\p{XID_Continue}*/u;
      const RESERVED_WORDS = [
        'and',
        'as',
        'assert',
        'async',
        'await',
        'break',
        'class',
        'continue',
        'def',
        'del',
        'elif',
        'else',
        'except',
        'finally',
        'for',
        'from',
        'global',
        'if',
        'import',
        'in',
        'is',
        'lambda',
        'nonlocal|10',
        'not',
        'or',
        'pass',
        'raise',
        'return',
        'try',
        'while',
        'with',
        'yield'
      ];

      const BUILT_INS = [
        '__import__',
        'abs',
        'all',
        'any',
        'ascii',
        'bin',
        'bool',
        'breakpoint',
        'bytearray',
        'bytes',
        'callable',
        'chr',
        'classmethod',
        'compile',
        'complex',
        'delattr',
        'dict',
        'dir',
        'divmod',
        'enumerate',
        'eval',
        'exec',
        'filter',
        'float',
        'format',
        'frozenset',
        'getattr',
        'globals',
        'hasattr',
        'hash',
        'help',
        'hex',
        'id',
        'input',
        'int',
        'isinstance',
        'issubclass',
        'iter',
        'len',
        'list',
        'locals',
        'map',
        'max',
        'memoryview',
        'min',
        'next',
        'object',
        'oct',
        'open',
        'ord',
        'pow',
        'print',
        'property',
        'range',
        'repr',
        'reversed',
        'round',
        'set',
        'setattr',
        'slice',
        'sorted',
        'staticmethod',
        'str',
        'sum',
        'super',
        'tuple',
        'type',
        'vars',
        'zip'
      ];

      const LITERALS = [
        '__debug__',
        'Ellipsis',
        'False',
        'None',
        'NotImplemented',
        'True'
      ];

      // https://docs.python.org/3/library/typing.html
      // TODO: Could these be supplemented by a CamelCase matcher in certain
      // contexts, leaving these remaining only for relevance hinting?
      const TYPES = [
        "Any",
        "Callable",
        "Coroutine",
        "Dict",
        "List",
        "Literal",
        "Generic",
        "Optional",
        "Sequence",
        "Set",
        "Tuple",
        "Type",
        "Union"
      ];

      const KEYWORDS = {
        $pattern: /[A-Za-z]\w+|__\w+__/,
        keyword: RESERVED_WORDS,
        built_in: BUILT_INS,
        literal: LITERALS,
        type: TYPES
      };

      const PROMPT = {
        className: 'meta',
        begin: /^(>>>|\.\.\.) /
      };

      const SUBST = {
        className: 'subst',
        begin: /\{/,
        end: /\}/,
        keywords: KEYWORDS,
        illegal: /#/
      };

      const LITERAL_BRACKET = {
        begin: /\{\{/,
        relevance: 0
      };

      const STRING = {
        className: 'string',
        contains: [ hljs.BACKSLASH_ESCAPE ],
        variants: [
          {
            begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,
            end: /'''/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              PROMPT
            ],
            relevance: 10
          },
          {
            begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,
            end: /"""/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              PROMPT
            ],
            relevance: 10
          },
          {
            begin: /([fF][rR]|[rR][fF]|[fF])'''/,
            end: /'''/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              PROMPT,
              LITERAL_BRACKET,
              SUBST
            ]
          },
          {
            begin: /([fF][rR]|[rR][fF]|[fF])"""/,
            end: /"""/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              PROMPT,
              LITERAL_BRACKET,
              SUBST
            ]
          },
          {
            begin: /([uU]|[rR])'/,
            end: /'/,
            relevance: 10
          },
          {
            begin: /([uU]|[rR])"/,
            end: /"/,
            relevance: 10
          },
          {
            begin: /([bB]|[bB][rR]|[rR][bB])'/,
            end: /'/
          },
          {
            begin: /([bB]|[bB][rR]|[rR][bB])"/,
            end: /"/
          },
          {
            begin: /([fF][rR]|[rR][fF]|[fF])'/,
            end: /'/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              LITERAL_BRACKET,
              SUBST
            ]
          },
          {
            begin: /([fF][rR]|[rR][fF]|[fF])"/,
            end: /"/,
            contains: [
              hljs.BACKSLASH_ESCAPE,
              LITERAL_BRACKET,
              SUBST
            ]
          },
          hljs.APOS_STRING_MODE,
          hljs.QUOTE_STRING_MODE
        ]
      };

      // https://docs.python.org/3.9/reference/lexical_analysis.html#numeric-literals
      const digitpart = '[0-9](_?[0-9])*';
      const pointfloat = `(\\b(${digitpart}))?\\.(${digitpart})|\\b(${digitpart})\\.`;
      // Whitespace after a number (or any lexical token) is needed only if its absence
      // would change the tokenization
      // https://docs.python.org/3.9/reference/lexical_analysis.html#whitespace-between-tokens
      // We deviate slightly, requiring a word boundary or a keyword
      // to avoid accidentally recognizing *prefixes* (e.g., `0` in `0x41` or `08` or `0__1`)
      const lookahead = `\\b|${RESERVED_WORDS.join('|')}`;
      const NUMBER = {
        className: 'number',
        relevance: 0,
        variants: [
          // exponentfloat, pointfloat
          // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals
          // optionally imaginary
          // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
          // Note: no leading \b because floats can start with a decimal point
          // and we don't want to mishandle e.g. `fn(.5)`,
          // no trailing \b for pointfloat because it can end with a decimal point
          // and we don't want to mishandle e.g. `0..hex()`; this should be safe
          // because both MUST contain a decimal point and so cannot be confused with
          // the interior part of an identifier
          {
            begin: `(\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})`
          },
          {
            begin: `(${pointfloat})[jJ]?`
          },

          // decinteger, bininteger, octinteger, hexinteger
          // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
          // optionally "long" in Python 2
          // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals
          // decinteger is optionally imaginary
          // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
          {
            begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})`
          },
          {
            begin: `\\b0[bB](_?[01])+[lL]?(?=${lookahead})`
          },
          {
            begin: `\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})`
          },
          {
            begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})`
          },

          // imagnumber (digitpart-based)
          // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
          {
            begin: `\\b(${digitpart})[jJ](?=${lookahead})`
          }
        ]
      };
      const COMMENT_TYPE = {
        className: "comment",
        begin: regex.lookahead(/# type:/),
        end: /$/,
        keywords: KEYWORDS,
        contains: [
          { // prevent keywords from coloring `type`
            begin: /# type:/
          },
          // comment within a datatype comment includes no keywords
          {
            begin: /#/,
            end: /\b\B/,
            endsWithParent: true
          }
        ]
      };
      const PARAMS = {
        className: 'params',
        variants: [
          // Exclude params in functions without params
          {
            className: "",
            begin: /\(\s*\)/,
            skip: true
          },
          {
            begin: /\(/,
            end: /\)/,
            excludeBegin: true,
            excludeEnd: true,
            keywords: KEYWORDS,
            contains: [
              'self',
              PROMPT,
              NUMBER,
              STRING,
              hljs.HASH_COMMENT_MODE
            ]
          }
        ]
      };
      SUBST.contains = [
        STRING,
        NUMBER,
        PROMPT
      ];

      return {
        name: 'Python',
        aliases: [
          'py',
          'gyp',
          'ipython'
        ],
        unicodeRegex: true,
        keywords: KEYWORDS,
        illegal: /(<\/|->|\?)|=>/,
        contains: [
          PROMPT,
          NUMBER,
          {
            // very common convention
            begin: /\bself\b/
          },
          {
            // eat "if" prior to string so that it won't accidentally be
            // labeled as an f-string
            beginKeywords: "if",
            relevance: 0
          },
          STRING,
          COMMENT_TYPE,
          hljs.HASH_COMMENT_MODE,
          {
            match: [
              /\bdef/, /\s+/,
              IDENT_RE,
            ],
            scope: {
              1: "keyword",
              3: "title.function"
            },
            contains: [ PARAMS ]
          },
          {
            variants: [
              {
                match: [
                  /\bclass/, /\s+/,
                  IDENT_RE, /\s*/,
                  /\(\s*/, IDENT_RE,/\s*\)/
                ],
              },
              {
                match: [
                  /\bclass/, /\s+/,
                  IDENT_RE
                ],
              }
            ],
            scope: {
              1: "keyword",
              3: "title.class",
              6: "title.class.inherited",
            }
          },
          {
            className: 'meta',
            begin: /^[\t ]*@/,
            end: /(?=#)|$/,
            contains: [
              NUMBER,
              PARAMS,
              STRING
            ]
          }
        ]
      };
    }

    const python = { name: "python", register: python$2 };
    var python$1 = python;

    const reopenTimeouts = [2000, 5000, 10000, 30000, 60000];

    /**
     * Create a writable store based on a web-socket.
     * Data is transferred as JSON.
     * Keeps socket open (reopens if closed) as long as there are subscriptions.
     * @param {string} url the WebSocket url
     * @param {any} initialValue store value used before 1st. response from server is present
     * @param {string[]} socketOptions transparently passed to the WebSocket constructor
     * @return {Store}
     */
    function websocketStore(url, initialValue, socketOptions) {
      let socket, openPromise, reopenTimeoutHandler;
      let reopenCount = 0;
      const subscriptions = new Set();

      function reopenTimeout() {
        const n = reopenCount;
        reopenCount++;
        return reopenTimeouts[
          n >= reopenTimeouts.length - 1 ? reopenTimeouts.length - 1 : n
        ];
      }

      function close() {
        if (reopenTimeoutHandler) {
          clearTimeout(reopenTimeoutHandler);
        }

        if (socket) {
          socket.close();
          socket = undefined;
        }
      }

      function reopen() {
        close();
        if (subscriptions.size > 0) {
          reopenTimeoutHandler = setTimeout(() => open(), reopenTimeout());
        }
      }

      async function open() {
        if (reopenTimeoutHandler) {
          clearTimeout(reopenTimeoutHandler);
          reopenTimeoutHandler = undefined;
        }

        // we are still in the opening phase
        if(openPromise) {
          return openPromise;
        }

        socket = new WebSocket(url, socketOptions);

        socket.onmessage = event => {
          initialValue = JSON.parse(event.data);
          subscriptions.forEach(subscription => subscription(initialValue));
        };

        socket.onclose = event => reopen();

        openPromise = new Promise((resolve, reject) => {
          socket.onerror = error => {
            reject(error);
            openPromise = undefined;
          };
          socket.onopen = event => {
            reopenCount = 0;
            resolve();
            openPromise = undefined;
          };
        });
        return openPromise;
      }

      return {
        set(value) {
          const send = () => socket.send(JSON.stringify(value));
          if (socket.readyState !== WebSocket.OPEN) open().then(send);
          else send();
        },
        subscribe(subscription) {
          open();
          subscription(initialValue);
          subscriptions.add(subscription);
          return () => {
            subscriptions.delete(subscription);
            if (subscriptions.size === 0) {
              close();
            }
          };
        }
      };
    }

    const metrics = writable([]);
    const slicers = writable([]);
    const slices = writable(new Map());
    const wsResponse = websocketStore("ws://localhost:8000/api/results", { status: "connecting", results: [] });
    const status = derived(wsResponse, ($wsResponse) => $wsResponse.status, "connecting");
    const results = derived(wsResponse, ($r) => {
        if ($r.results.length > 0) {
            return $r.results;
        }
        else {
            return [];
        }
    }, []);
    const models = derived(results, (r) => {
        if (r.length > 0) {
            return r[0].modelNames;
        }
        else {
            return [];
        }
    }, []);

    /* src/Metrics.svelte generated by Svelte v3.46.4 */
    const file$x = "src/Metrics.svelte";

    function get_each_context$9(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[3] = list[i];
    	return child_ctx;
    }

    // (10:0) {#if $metrics.length > 0}
    function create_if_block$k(ctx) {
    	let each_1_anchor;
    	let current;

    	let each_value = /*params*/ ctx[0].metric
    	? /*$metrics*/ ctx[1].filter(/*func*/ ctx[2])
    	: /*$metrics*/ ctx[1];

    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$9(get_each_context$9(ctx, each_value, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*python, params, $metrics*/ 3) {
    				each_value = /*params*/ ctx[0].metric
    				? /*$metrics*/ ctx[1].filter(/*func*/ ctx[2])
    				: /*$metrics*/ ctx[1];

    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$9(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block$9(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$k.name,
    		type: "if",
    		source: "(10:0) {#if $metrics.length > 0}",
    		ctx
    	});

    	return block;
    }

    // (12:4) <Paper>
    function create_default_slot$e(ctx) {
    	let p;
    	let b;
    	let t0_value = /*test*/ ctx[3].name + "";
    	let t0;
    	let t1;
    	let a;
    	let t2;
    	let a_href_value;
    	let t3;
    	let highlight;
    	let current;

    	highlight = new Highlight$1({
    			props: {
    				language: python$1,
    				code: /*test*/ ctx[3].source
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			p = element("p");
    			b = element("b");
    			t0 = text(t0_value);
    			t1 = space();
    			a = element("a");
    			t2 = text("see results");
    			t3 = space();
    			create_component(highlight.$$.fragment);
    			add_location(b, file$x, 13, 8, 428);
    			attr_dev(a, "href", a_href_value = "/#/results?metrics=" + /*test*/ ctx[3].name);
    			add_location(a, file$x, 14, 8, 455);
    			add_location(p, file$x, 12, 6, 416);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p, anchor);
    			append_dev(p, b);
    			append_dev(b, t0);
    			append_dev(p, t1);
    			append_dev(p, a);
    			append_dev(a, t2);
    			insert_dev(target, t3, anchor);
    			mount_component(highlight, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty & /*params, $metrics*/ 3) && t0_value !== (t0_value = /*test*/ ctx[3].name + "")) set_data_dev(t0, t0_value);

    			if (!current || dirty & /*params, $metrics*/ 3 && a_href_value !== (a_href_value = "/#/results?metrics=" + /*test*/ ctx[3].name)) {
    				attr_dev(a, "href", a_href_value);
    			}

    			const highlight_changes = {};
    			if (dirty & /*params, $metrics*/ 3) highlight_changes.code = /*test*/ ctx[3].source;
    			highlight.$set(highlight_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(highlight.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(highlight.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p);
    			if (detaching) detach_dev(t3);
    			destroy_component(highlight, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$e.name,
    		type: "slot",
    		source: "(12:4) <Paper>",
    		ctx
    	});

    	return block;
    }

    // (11:2) {#each params.metric ? $metrics.filter((t) => t.name === params.metric) : $metrics as test}
    function create_each_block$9(ctx) {
    	let paper;
    	let t;
    	let br;
    	let current;

    	paper = new Paper({
    			props: {
    				$$slots: { default: [create_default_slot$e] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(paper.$$.fragment);
    			t = space();
    			br = element("br");
    			add_location(br, file$x, 18, 4, 597);
    		},
    		m: function mount(target, anchor) {
    			mount_component(paper, target, anchor);
    			insert_dev(target, t, anchor);
    			insert_dev(target, br, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const paper_changes = {};

    			if (dirty & /*$$scope, params, $metrics*/ 67) {
    				paper_changes.$$scope = { dirty, ctx };
    			}

    			paper.$set(paper_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(paper.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(paper.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(paper, detaching);
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(br);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$9.name,
    		type: "each",
    		source: "(11:2) {#each params.metric ? $metrics.filter((t) => t.name === params.metric) : $metrics as test}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$A(ctx) {
    	let h2;
    	let t1;
    	let h5;
    	let t3;
    	let if_block_anchor;
    	let current;
    	let if_block = /*$metrics*/ ctx[1].length > 0 && create_if_block$k(ctx);

    	const block = {
    		c: function create() {
    			h2 = element("h2");
    			h2.textContent = "Tests";
    			t1 = space();
    			h5 = element("h5");
    			h5.textContent = "Testing functions";
    			t3 = space();
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    			add_location(h2, file$x, 7, 0, 236);
    			add_location(h5, file$x, 8, 0, 251);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h2, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, h5, anchor);
    			insert_dev(target, t3, anchor);
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (/*$metrics*/ ctx[1].length > 0) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*$metrics*/ 2) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$k(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h2);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(h5);
    			if (detaching) detach_dev(t3);
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$A.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$y($$self, $$props, $$invalidate) {
    	let $metrics;
    	validate_store(metrics, 'metrics');
    	component_subscribe($$self, metrics, $$value => $$invalidate(1, $metrics = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Metrics', slots, []);
    	let { params = { metric: "" } } = $$props;
    	const writable_props = ['params'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Metrics> was created with unknown prop '${key}'`);
    	});

    	const func = t => t.name === params.metric;

    	$$self.$$set = $$props => {
    		if ('params' in $$props) $$invalidate(0, params = $$props.params);
    	};

    	$$self.$capture_state = () => ({
    		Paper,
    		Highlight: Highlight$1,
    		python: python$1,
    		metrics,
    		params,
    		$metrics
    	});

    	$$self.$inject_state = $$props => {
    		if ('params' in $$props) $$invalidate(0, params = $$props.params);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [params, $metrics, func];
    }

    class Metrics extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$y, create_fragment$A, safe_not_equal, { params: 0 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Metrics",
    			options,
    			id: create_fragment$A.name
    		});
    	}

    	get params() {
    		throw new Error("<Metrics>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set params(value) {
    		throw new Error("<Metrics>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /**
     * @license
     * Copyright 2019 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * CSS class names used in component.
     */
    var cssClasses$b = {
        CELL: 'mdc-data-table__cell',
        CELL_NUMERIC: 'mdc-data-table__cell--numeric',
        CONTENT: 'mdc-data-table__content',
        HEADER_CELL: 'mdc-data-table__header-cell',
        HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label',
        HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted',
        HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending',
        HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort',
        HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper',
        HEADER_ROW: 'mdc-data-table__header-row',
        HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
        IN_PROGRESS: 'mdc-data-table--in-progress',
        LINEAR_PROGRESS: 'mdc-data-table__linear-progress',
        PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label',
        PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select',
        PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator',
        ROOT: 'mdc-data-table',
        ROW: 'mdc-data-table__row',
        ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
        ROW_SELECTED: 'mdc-data-table__row--selected',
        SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button',
        SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label',
        TABLE_CONTAINER: 'mdc-data-table__table-container',
    };
    /**
     * DOM attributes used in component.
     */
    var attributes$1 = {
        ARIA_SELECTED: 'aria-selected',
        ARIA_SORT: 'aria-sort',
    };
    /**
     * List of data attributes used in component.
     */
    var dataAttributes = {
        COLUMN_ID: 'data-column-id',
        ROW_ID: 'data-row-id',
    };
    /**
     * CSS selectors used in component.
     */
    var selectors = {
        CONTENT: "." + cssClasses$b.CONTENT,
        HEADER_CELL: "." + cssClasses$b.HEADER_CELL,
        HEADER_CELL_WITH_SORT: "." + cssClasses$b.HEADER_CELL_WITH_SORT,
        HEADER_ROW: "." + cssClasses$b.HEADER_ROW,
        HEADER_ROW_CHECKBOX: "." + cssClasses$b.HEADER_ROW_CHECKBOX,
        PROGRESS_INDICATOR: "." + cssClasses$b.PROGRESS_INDICATOR,
        ROW: "." + cssClasses$b.ROW,
        ROW_CHECKBOX: "." + cssClasses$b.ROW_CHECKBOX,
        ROW_SELECTED: "." + cssClasses$b.ROW_SELECTED,
        SORT_ICON_BUTTON: "." + cssClasses$b.SORT_ICON_BUTTON,
        SORT_STATUS_LABEL: "." + cssClasses$b.SORT_STATUS_LABEL,
    };
    /**
     * Attributes and selectors used in component.
     * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead.
     */
    var strings$8 = {
        ARIA_SELECTED: attributes$1.ARIA_SELECTED,
        ARIA_SORT: attributes$1.ARIA_SORT,
        DATA_ROW_ID_ATTR: dataAttributes.ROW_ID,
        HEADER_ROW_CHECKBOX_SELECTOR: selectors.HEADER_ROW_CHECKBOX,
        ROW_CHECKBOX_SELECTOR: selectors.ROW_CHECKBOX,
        ROW_SELECTED_SELECTOR: selectors.ROW_SELECTED,
        ROW_SELECTOR: selectors.ROW,
    };
    /**
     * Sort values defined by ARIA.
     * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort
     */
    var SortValue;
    (function (SortValue) {
        // Items are sorted in ascending order by this column.
        SortValue["ASCENDING"] = "ascending";
        // Items are sorted in descending order by this column.
        SortValue["DESCENDING"] = "descending";
        // There is no defined sort applied to the column.
        SortValue["NONE"] = "none";
        // A sort algorithm other than ascending or descending has been applied.
        SortValue["OTHER"] = "other";
    })(SortValue || (SortValue = {}));

    /**
     * @license
     * Copyright 2019 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * The Foundation of data table component containing pure business logic, any
     * logic requiring DOM manipulation are delegated to adapter methods.
     */
    var MDCDataTableFoundation = /** @class */ (function (_super) {
        __extends(MDCDataTableFoundation, _super);
        function MDCDataTableFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClass: function () { return undefined; },
                    addClassAtRowIndex: function () { return undefined; },
                    getAttributeByHeaderCellIndex: function () { return ''; },
                    getHeaderCellCount: function () { return 0; },
                    getHeaderCellElements: function () { return []; },
                    getRowCount: function () { return 0; },
                    getRowElements: function () { return []; },
                    getRowIdAtIndex: function () { return ''; },
                    getRowIndexByChildElement: function () { return 0; },
                    getSelectedRowCount: function () { return 0; },
                    getTableContainerHeight: function () { return 0; },
                    getTableHeaderHeight: function () { return 0; },
                    isCheckboxAtRowIndexChecked: function () { return false; },
                    isHeaderRowCheckboxChecked: function () { return false; },
                    isRowsSelectable: function () { return false; },
                    notifyRowSelectionChanged: function () { return undefined; },
                    notifySelectedAll: function () { return undefined; },
                    notifySortAction: function () { return undefined; },
                    notifyUnselectedAll: function () { return undefined; },
                    notifyRowClick: function () { return undefined; },
                    registerHeaderRowCheckbox: function () { return undefined; },
                    registerRowCheckboxes: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    removeClassAtRowIndex: function () { return undefined; },
                    removeClassNameByHeaderCellIndex: function () { return undefined; },
                    setAttributeAtRowIndex: function () { return undefined; },
                    setAttributeByHeaderCellIndex: function () { return undefined; },
                    setClassNameByHeaderCellIndex: function () { return undefined; },
                    setHeaderRowCheckboxChecked: function () { return undefined; },
                    setHeaderRowCheckboxIndeterminate: function () { return undefined; },
                    setProgressIndicatorStyles: function () { return undefined; },
                    setRowCheckboxCheckedAtIndex: function () { return undefined; },
                    setSortStatusLabelByHeaderCellIndex: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        /**
         * Re-initializes header row checkbox and row checkboxes when selectable rows
         * are added or removed from table. Use this if registering checkbox is
         * synchronous.
         */
        MDCDataTableFoundation.prototype.layout = function () {
            if (this.adapter.isRowsSelectable()) {
                this.adapter.registerHeaderRowCheckbox();
                this.adapter.registerRowCheckboxes();
                this.setHeaderRowCheckboxState();
            }
        };
        /**
         * Re-initializes header row checkbox and row checkboxes when selectable rows
         * are added or removed from table. Use this if registering checkbox is
         * asynchronous.
         */
        MDCDataTableFoundation.prototype.layoutAsync = function () {
            return __awaiter(this, void 0, void 0, function () {
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3];
                            return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()];
                        case 1:
                            _a.sent();
                            return [4 /*yield*/, this.adapter.registerRowCheckboxes()];
                        case 2:
                            _a.sent();
                            this.setHeaderRowCheckboxState();
                            _a.label = 3;
                        case 3: return [2 /*return*/];
                    }
                });
            });
        };
        /**
         * @return Returns array of row elements.
         */
        MDCDataTableFoundation.prototype.getRows = function () {
            return this.adapter.getRowElements();
        };
        /**
         * @return Array of header cell elements.
         */
        MDCDataTableFoundation.prototype.getHeaderCells = function () {
            return this.adapter.getHeaderCellElements();
        };
        /**
         * Sets selected row ids. Overwrites previously selected rows.
         * @param rowIds Array of row ids that needs to be selected.
         */
        MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
            for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
                var rowId = this.adapter.getRowIdAtIndex(rowIndex);
                var isSelected = false;
                if (rowId && rowIds.indexOf(rowId) >= 0) {
                    isSelected = true;
                }
                this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
                this.selectRowAtIndex(rowIndex, isSelected);
            }
            this.setHeaderRowCheckboxState();
        };
        /**
         * @return Returns array of all row ids.
         */
        MDCDataTableFoundation.prototype.getRowIds = function () {
            var rowIds = [];
            for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
                rowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
            }
            return rowIds;
        };
        /**
         * @return Returns array of selected row ids.
         */
        MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
            var selectedRowIds = [];
            for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
                if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) {
                    selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
                }
            }
            return selectedRowIds;
        };
        /**
         * Handles header row checkbox change event.
         */
        MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
            var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked();
            for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
                this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
                this.selectRowAtIndex(rowIndex, isHeaderChecked);
            }
            if (isHeaderChecked) {
                this.adapter.notifySelectedAll();
            }
            else {
                this.adapter.notifyUnselectedAll();
            }
        };
        /**
         * Handles change event originated from row checkboxes.
         */
        MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
            var rowIndex = this.adapter.getRowIndexByChildElement(event.target);
            if (rowIndex === -1) {
                return;
            }
            var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex);
            this.selectRowAtIndex(rowIndex, selected);
            this.setHeaderRowCheckboxState();
            var rowId = this.adapter.getRowIdAtIndex(rowIndex);
            this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
        };
        /**
         * Handles sort action on sortable header cell.
         */
        MDCDataTableFoundation.prototype.handleSortAction = function (eventData) {
            var columnId = eventData.columnId, columnIndex = eventData.columnIndex, headerCell = eventData.headerCell;
            // Reset sort attributes / classes on other header cells.
            for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) {
                if (index === columnIndex) {
                    continue;
                }
                this.adapter.removeClassNameByHeaderCellIndex(index, cssClasses$b.HEADER_CELL_SORTED);
                this.adapter.removeClassNameByHeaderCellIndex(index, cssClasses$b.HEADER_CELL_SORTED_DESCENDING);
                this.adapter.setAttributeByHeaderCellIndex(index, strings$8.ARIA_SORT, SortValue.NONE);
                this.adapter.setSortStatusLabelByHeaderCellIndex(index, SortValue.NONE);
            }
            // Set appropriate sort attributes / classes on target header cell.
            this.adapter.setClassNameByHeaderCellIndex(columnIndex, cssClasses$b.HEADER_CELL_SORTED);
            var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, strings$8.ARIA_SORT);
            var sortValue = SortValue.NONE;
            // Set to descending if sorted on ascending order.
            if (currentSortValue === SortValue.ASCENDING) {
                this.adapter.setClassNameByHeaderCellIndex(columnIndex, cssClasses$b.HEADER_CELL_SORTED_DESCENDING);
                this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings$8.ARIA_SORT, SortValue.DESCENDING);
                sortValue = SortValue.DESCENDING;
                // Set to ascending if sorted on descending order.
            }
            else if (currentSortValue === SortValue.DESCENDING) {
                this.adapter.removeClassNameByHeaderCellIndex(columnIndex, cssClasses$b.HEADER_CELL_SORTED_DESCENDING);
                this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings$8.ARIA_SORT, SortValue.ASCENDING);
                sortValue = SortValue.ASCENDING;
            }
            else {
                // Set to ascending by default when not sorted.
                this.adapter.setAttributeByHeaderCellIndex(columnIndex, strings$8.ARIA_SORT, SortValue.ASCENDING);
                sortValue = SortValue.ASCENDING;
            }
            this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue);
            this.adapter.notifySortAction({
                columnId: columnId,
                columnIndex: columnIndex,
                headerCell: headerCell,
                sortValue: sortValue,
            });
        };
        /**
         * Handles data table row click event.
         */
        MDCDataTableFoundation.prototype.handleRowClick = function (_a) {
            var rowId = _a.rowId, row = _a.row;
            this.adapter.notifyRowClick({
                rowId: rowId,
                row: row,
            });
        };
        /**
         * Shows progress indicator blocking only the table body content when in
         * loading state.
         */
        MDCDataTableFoundation.prototype.showProgress = function () {
            var tableHeaderHeight = this.adapter.getTableHeaderHeight();
            // Calculate the height of table content (Not scroll content) excluding
            // header row height.
            var height = this.adapter.getTableContainerHeight() - tableHeaderHeight;
            var top = tableHeaderHeight;
            this.adapter.setProgressIndicatorStyles({
                height: height + "px",
                top: top + "px",
            });
            this.adapter.addClass(cssClasses$b.IN_PROGRESS);
        };
        /**
         * Hides progress indicator when data table is finished loading.
         */
        MDCDataTableFoundation.prototype.hideProgress = function () {
            this.adapter.removeClass(cssClasses$b.IN_PROGRESS);
        };
        /**
         * Updates header row checkbox state based on number of rows selected.
         */
        MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () {
            if (this.adapter.getSelectedRowCount() === 0) {
                this.adapter.setHeaderRowCheckboxChecked(false);
                this.adapter.setHeaderRowCheckboxIndeterminate(false);
            }
            else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) {
                this.adapter.setHeaderRowCheckboxChecked(true);
                this.adapter.setHeaderRowCheckboxIndeterminate(false);
            }
            else {
                this.adapter.setHeaderRowCheckboxIndeterminate(true);
                this.adapter.setHeaderRowCheckboxChecked(false);
            }
        };
        /**
         * Sets the attributes of row element based on selection state.
         */
        MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) {
            if (selected) {
                this.adapter.addClassAtRowIndex(rowIndex, cssClasses$b.ROW_SELECTED);
                this.adapter.setAttributeAtRowIndex(rowIndex, strings$8.ARIA_SELECTED, 'true');
            }
            else {
                this.adapter.removeClassAtRowIndex(rowIndex, cssClasses$b.ROW_SELECTED);
                this.adapter.setAttributeAtRowIndex(rowIndex, strings$8.ARIA_SELECTED, 'false');
            }
        };
        return MDCDataTableFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/data-table/dist/DataTable.svelte generated by Svelte v3.46.4 */

    const { Error: Error_1$2 } = globals;

    const file$w = "node_modules/@smui/data-table/dist/DataTable.svelte";
    const get_paginate_slot_changes = dirty => ({});
    const get_paginate_slot_context = ctx => ({});
    const get_progress_slot_changes = dirty => ({});
    const get_progress_slot_context = ctx => ({});

    // (45:2) {#if $$slots.progress}
    function create_if_block$j(ctx) {
    	let div1;
    	let div0;
    	let t;
    	let div1_style_value;
    	let current;
    	const progress_slot_template = /*#slots*/ ctx[33].progress;
    	const progress_slot = create_slot(progress_slot_template, ctx, /*$$scope*/ ctx[32], get_progress_slot_context);

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			div0 = element("div");
    			t = space();
    			if (progress_slot) progress_slot.c();
    			attr_dev(div0, "class", "mdc-data-table__scrim");
    			add_location(div0, file$w, 51, 6, 1604);
    			attr_dev(div1, "class", "mdc-data-table__progress-indicator");
    			attr_dev(div1, "style", div1_style_value = Object.entries(/*progressIndicatorStyles*/ ctx[13]).map(func$d).join(' '));
    			add_location(div1, file$w, 45, 4, 1411);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			append_dev(div1, div0);
    			append_dev(div1, t);

    			if (progress_slot) {
    				progress_slot.m(div1, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (progress_slot) {
    				if (progress_slot.p && (!current || dirty[1] & /*$$scope*/ 2)) {
    					update_slot_base(
    						progress_slot,
    						progress_slot_template,
    						ctx,
    						/*$$scope*/ ctx[32],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[32])
    						: get_slot_changes(progress_slot_template, /*$$scope*/ ctx[32], dirty, get_progress_slot_changes),
    						get_progress_slot_context
    					);
    				}
    			}

    			if (!current || dirty[0] & /*progressIndicatorStyles*/ 8192 && div1_style_value !== (div1_style_value = Object.entries(/*progressIndicatorStyles*/ ctx[13]).map(func$d).join(' '))) {
    				attr_dev(div1, "style", div1_style_value);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(progress_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(progress_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (progress_slot) progress_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$j.name,
    		type: "if",
    		source: "(45:2) {#if $$slots.progress}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$z(ctx) {
    	let div1;
    	let div0;
    	let table;
    	let table_class_value;
    	let useActions_action;
    	let div0_class_value;
    	let useActions_action_1;
    	let t0;
    	let t1;
    	let div1_class_value;
    	let useActions_action_2;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[33].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[32], null);

    	let table_levels = [
    		{
    			class: table_class_value = classMap({
    				[/*table$class*/ ctx[6]]: true,
    				'mdc-data-table__table': true
    			})
    		},
    		prefixFilter(/*$$restProps*/ ctx[22], 'table$')
    	];

    	let table_data = {};

    	for (let i = 0; i < table_levels.length; i += 1) {
    		table_data = assign$1(table_data, table_levels[i]);
    	}

    	let div0_levels = [
    		{
    			class: div0_class_value = classMap({
    				[/*container$class*/ ctx[4]]: true,
    				'mdc-data-table__table-container': true
    			})
    		},
    		prefixFilter(/*$$restProps*/ ctx[22], 'container$')
    	];

    	let div0_data = {};

    	for (let i = 0; i < div0_levels.length; i += 1) {
    		div0_data = assign$1(div0_data, div0_levels[i]);
    	}

    	let if_block = /*$$slots*/ ctx[21].progress && create_if_block$j(ctx);
    	const paginate_slot_template = /*#slots*/ ctx[33].paginate;
    	const paginate_slot = create_slot(paginate_slot_template, ctx, /*$$scope*/ ctx[32], get_paginate_slot_context);

    	let div1_levels = [
    		{
    			class: div1_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-data-table': true,
    				'mdc-data-table--sticky-header': /*stickyHeader*/ ctx[2],
    				.../*internalClasses*/ ctx[12]
    			})
    		},
    		exclude(/*$$restProps*/ ctx[22], ['container$', 'table$'])
    	];

    	let div1_data = {};

    	for (let i = 0; i < div1_levels.length; i += 1) {
    		div1_data = assign$1(div1_data, div1_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			div0 = element("div");
    			table = element("table");
    			if (default_slot) default_slot.c();
    			t0 = space();
    			if (if_block) if_block.c();
    			t1 = space();
    			if (paginate_slot) paginate_slot.c();
    			set_attributes(table, table_data);
    			add_location(table, file$w, 32, 4, 1149);
    			set_attributes(div0, div0_data);
    			add_location(div0, file$w, 23, 2, 918);
    			set_attributes(div1, div1_data);
    			add_location(div1, file$w, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error_1$2("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			append_dev(div1, div0);
    			append_dev(div0, table);

    			if (default_slot) {
    				default_slot.m(table, null);
    			}

    			/*div0_binding*/ ctx[34](div0);
    			append_dev(div1, t0);
    			if (if_block) if_block.m(div1, null);
    			append_dev(div1, t1);

    			if (paginate_slot) {
    				paginate_slot.m(div1, null);
    			}

    			/*div1_binding*/ ctx[35](div1);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, table, /*table$use*/ ctx[5])),
    					action_destroyer(useActions_action_1 = useActions.call(null, div0, /*container$use*/ ctx[3])),
    					action_destroyer(useActions_action_2 = useActions.call(null, div1, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[15].call(null, div1)),
    					listen_dev(div1, "SMUICheckbox:mount", /*SMUICheckbox_mount_handler*/ ctx[36], false, false, false),
    					listen_dev(div1, "SMUIDataTableHeader:mount", /*SMUIDataTableHeader_mount_handler*/ ctx[37], false, false, false),
    					listen_dev(div1, "SMUIDataTableHeader:unmount", /*SMUIDataTableHeader_unmount_handler*/ ctx[38], false, false, false),
    					listen_dev(div1, "SMUIDataTableBody:mount", /*SMUIDataTableBody_mount_handler*/ ctx[39], false, false, false),
    					listen_dev(div1, "SMUIDataTableBody:unmount", /*SMUIDataTableBody_unmount_handler*/ ctx[40], false, false, false),
    					listen_dev(div1, "SMUIDataTableHeaderCheckbox:change", /*SMUIDataTableHeaderCheckbox_change_handler*/ ctx[41], false, false, false),
    					listen_dev(div1, "SMUIDataTableHeader:click", /*handleHeaderRowClick*/ ctx[19], false, false, false),
    					listen_dev(div1, "SMUIDataTableRow:click", /*handleRowClick*/ ctx[20], false, false, false),
    					listen_dev(div1, "SMUIDataTableBodyCheckbox:change", /*SMUIDataTableBodyCheckbox_change_handler*/ ctx[42], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 2)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[32],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[32])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[32], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(table, table_data = get_spread_update(table_levels, [
    				(!current || dirty[0] & /*table$class*/ 64 && table_class_value !== (table_class_value = classMap({
    					[/*table$class*/ ctx[6]]: true,
    					'mdc-data-table__table': true
    				}))) && { class: table_class_value },
    				dirty[0] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[22], 'table$')
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*table$use*/ 32) useActions_action.update.call(null, /*table$use*/ ctx[5]);

    			set_attributes(div0, div0_data = get_spread_update(div0_levels, [
    				(!current || dirty[0] & /*container$class*/ 16 && div0_class_value !== (div0_class_value = classMap({
    					[/*container$class*/ ctx[4]]: true,
    					'mdc-data-table__table-container': true
    				}))) && { class: div0_class_value },
    				dirty[0] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[22], 'container$')
    			]));

    			if (useActions_action_1 && is_function(useActions_action_1.update) && dirty[0] & /*container$use*/ 8) useActions_action_1.update.call(null, /*container$use*/ ctx[3]);

    			if (/*$$slots*/ ctx[21].progress) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*$$slots*/ 2097152) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$j(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(div1, t1);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}

    			if (paginate_slot) {
    				if (paginate_slot.p && (!current || dirty[1] & /*$$scope*/ 2)) {
    					update_slot_base(
    						paginate_slot,
    						paginate_slot_template,
    						ctx,
    						/*$$scope*/ ctx[32],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[32])
    						: get_slot_changes(paginate_slot_template, /*$$scope*/ ctx[32], dirty, get_paginate_slot_changes),
    						get_paginate_slot_context
    					);
    				}
    			}

    			set_attributes(div1, div1_data = get_spread_update(div1_levels, [
    				(!current || dirty[0] & /*className, stickyHeader, internalClasses*/ 4102 && div1_class_value !== (div1_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-data-table': true,
    					'mdc-data-table--sticky-header': /*stickyHeader*/ ctx[2],
    					.../*internalClasses*/ ctx[12]
    				}))) && { class: div1_class_value },
    				dirty[0] & /*$$restProps*/ 4194304 && exclude(/*$$restProps*/ ctx[22], ['container$', 'table$'])
    			]));

    			if (useActions_action_2 && is_function(useActions_action_2.update) && dirty[0] & /*use*/ 1) useActions_action_2.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			transition_in(if_block);
    			transition_in(paginate_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			transition_out(if_block);
    			transition_out(paginate_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (default_slot) default_slot.d(detaching);
    			/*div0_binding*/ ctx[34](null);
    			if (if_block) if_block.d();
    			if (paginate_slot) paginate_slot.d(detaching);
    			/*div1_binding*/ ctx[35](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$z.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$d = ([name, value]) => `${name}: ${value};`;

    function instance_1$b($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","stickyHeader","sortable","sort","sortDirection","sortAscendingAriaLabel","sortDescendingAriaLabel","container$use","container$class","table$use","table$class","layout","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $progressClosed;
    	let $sortDirectionStore;
    	let $sortStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('DataTable', slots, ['default','progress','paginate']);
    	const $$slots = compute_slots(slots);
    	const { closest } = ponyfill;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { stickyHeader = false } = $$props;
    	let { sortable = false } = $$props;
    	let { sort = null } = $$props;
    	let { sortDirection = 'ascending' } = $$props;
    	let { sortAscendingAriaLabel = 'sorted, ascending' } = $$props;
    	let { sortDescendingAriaLabel = 'sorted, descending' } = $$props;
    	let { container$use = [] } = $$props;
    	let { container$class = '' } = $$props;
    	let { table$use = [] } = $$props;
    	let { table$class = '' } = $$props;
    	let element;
    	let instance;
    	let container;
    	let header = undefined;
    	let body = undefined;
    	let internalClasses = {};
    	let progressIndicatorStyles = { height: 'auto', top: 'initial' };
    	let addLayoutListener = getContext('SMUI:addLayoutListener');
    	let removeLayoutListener;
    	let postMount = false;
    	let progressClosed = writable(false);
    	validate_store(progressClosed, 'progressClosed');
    	component_subscribe($$self, progressClosed, value => $$invalidate(31, $progressClosed = value));
    	let sortStore = writable(sort);
    	validate_store(sortStore, 'sortStore');
    	component_subscribe($$self, sortStore, value => $$invalidate(45, $sortStore = value));
    	let sortDirectionStore = writable(sortDirection);
    	validate_store(sortDirectionStore, 'sortDirectionStore');
    	component_subscribe($$self, sortDirectionStore, value => $$invalidate(44, $sortDirectionStore = value));
    	setContext('SMUI:checkbox:context', 'data-table');
    	setContext('SMUI:linear-progress:context', 'data-table');
    	setContext('SMUI:linear-progress:closed', progressClosed);
    	setContext('SMUI:data-table:sortable', sortable);
    	setContext('SMUI:data-table:sort', sortStore);
    	setContext('SMUI:data-table:sortDirection', sortDirectionStore);
    	setContext('SMUI:data-table:sortAscendingAriaLabel', sortAscendingAriaLabel);
    	setContext('SMUI:data-table:sortDescendingAriaLabel', sortDescendingAriaLabel);

    	if (addLayoutListener) {
    		removeLayoutListener = addLayoutListener(layout);
    	}

    	let previousProgressClosed = undefined;

    	onMount(() => {
    		$$invalidate(7, instance = new MDCDataTableFoundation({
    				addClass,
    				removeClass,
    				getHeaderCellElements: () => {
    					var _a;

    					return (_a = header === null || header === void 0
    					? void 0
    					: header.cells.map(accessor => accessor.element)) !== null && _a !== void 0
    					? _a
    					: [];
    				},
    				getHeaderCellCount: () => {
    					var _a;

    					return (_a = header === null || header === void 0
    					? void 0
    					: header.cells.length) !== null && _a !== void 0
    					? _a
    					: 0;
    				},
    				getAttributeByHeaderCellIndex: (index, name) => {
    					var _a;

    					return (_a = header === null || header === void 0
    					? void 0
    					: header.orderedCells[index].getAttr(name)) !== null && _a !== void 0
    					? _a
    					: null;
    				},
    				setAttributeByHeaderCellIndex: (index, name, value) => {
    					header === null || header === void 0
    					? void 0
    					: header.orderedCells[index].addAttr(name, value);
    				},
    				setClassNameByHeaderCellIndex: (index, className) => {
    					header === null || header === void 0
    					? void 0
    					: header.orderedCells[index].addClass(className);
    				},
    				removeClassNameByHeaderCellIndex: (index, className) => {
    					header === null || header === void 0
    					? void 0
    					: header.orderedCells[index].removeClass(className);
    				},
    				notifySortAction: data => {
    					$$invalidate(23, sort = data.columnId);
    					$$invalidate(24, sortDirection = data.sortValue);
    					dispatch$1(getElement(), 'SMUIDataTable:sorted', data, undefined, true);
    				},
    				getTableContainerHeight: () => container.getBoundingClientRect().height,
    				getTableHeaderHeight: () => {
    					const tableHeader = getElement().querySelector('.mdc-data-table__header-row');

    					if (!tableHeader) {
    						throw new Error('MDCDataTable: Table header element not found.');
    					}

    					return tableHeader.getBoundingClientRect().height;
    				},
    				setProgressIndicatorStyles: styles => {
    					$$invalidate(13, progressIndicatorStyles = styles);
    				},
    				addClassAtRowIndex: (rowIndex, className) => {
    					body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].addClass(className);
    				},
    				getRowCount: () => {
    					var _a;

    					return (_a = body === null || body === void 0
    					? void 0
    					: body.rows.length) !== null && _a !== void 0
    					? _a
    					: 0;
    				},
    				getRowElements: () => {
    					var _a;

    					return (_a = body === null || body === void 0
    					? void 0
    					: body.rows.map(accessor => accessor.element)) !== null && _a !== void 0
    					? _a
    					: [];
    				},
    				getRowIdAtIndex: rowIndex => {
    					var _a;

    					return (_a = body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].rowId) !== null && _a !== void 0
    					? _a
    					: null;
    				},
    				getRowIndexByChildElement: el => {
    					var _a;

    					return (_a = body === null || body === void 0
    					? void 0
    					: body.orderedRows.map(accessor => accessor.element).indexOf(closest(el, '.mdc-data-table__row'))) !== null && _a !== void 0
    					? _a
    					: -1;
    				},
    				getSelectedRowCount: () => {
    					var _a;

    					return (_a = body === null || body === void 0
    					? void 0
    					: body.rows.filter(accessor => accessor.selected).length) !== null && _a !== void 0
    					? _a
    					: 0;
    				},
    				isCheckboxAtRowIndexChecked: rowIndex => {
    					const checkbox = body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].checkbox;

    					if (checkbox) {
    						return checkbox.checked;
    					}

    					return false;
    				},
    				isHeaderRowCheckboxChecked: () => {
    					const checkbox = header === null || header === void 0
    					? void 0
    					: header.checkbox;

    					if (checkbox) {
    						return checkbox.checked;
    					}

    					return false;
    				},
    				isRowsSelectable: () => !!getElement().querySelector('.mdc-data-table__row-checkbox') || !!getElement().querySelector('.mdc-data-table__header-row-checkbox'),
    				notifyRowSelectionChanged: data => {
    					const row = body === null || body === void 0
    					? void 0
    					: body.orderedRows[data.rowIndex];

    					if (row) {
    						dispatch$1(
    							getElement(),
    							'SMUIDataTable:rowSelectionChanged',
    							{
    								row: row.element,
    								rowId: row.rowId,
    								rowIndex: data.rowIndex,
    								selected: data.selected
    							},
    							undefined,
    							true
    						);
    					}
    				},
    				notifySelectedAll: () => {
    					setHeaderRowCheckboxIndeterminate(false);
    					dispatch$1(getElement(), 'SMUIDataTable:selectedAll', undefined, undefined, true);
    				},
    				notifyUnselectedAll: () => {
    					setHeaderRowCheckboxIndeterminate(false);
    					dispatch$1(getElement(), 'SMUIDataTable:unselectedAll', undefined, undefined, true);
    				},
    				notifyRowClick: detail => {
    					dispatch$1(getElement(), 'SMUIDataTable:rowClick', detail, undefined, true);
    				},
    				registerHeaderRowCheckbox: () => {
    					
    				}, // Handled automatically.
    				registerRowCheckboxes: () => {
    					
    				}, // Handled automatically.
    				removeClassAtRowIndex: (rowIndex, className) => {
    					body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].removeClass(className);
    				},
    				setAttributeAtRowIndex: (rowIndex, name, value) => {
    					body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].addAttr(name, value);
    				},
    				setHeaderRowCheckboxChecked: checked => {
    					const checkbox = header === null || header === void 0
    					? void 0
    					: header.checkbox;

    					if (checkbox) {
    						checkbox.checked = checked;
    					}
    				},
    				setHeaderRowCheckboxIndeterminate,
    				setRowCheckboxCheckedAtIndex: (rowIndex, checked) => {
    					const checkbox = body === null || body === void 0
    					? void 0
    					: body.orderedRows[rowIndex].checkbox;

    					if (checkbox) {
    						checkbox.checked = checked;
    					}
    				},
    				setSortStatusLabelByHeaderCellIndex: (_columnIndex, _sortValue) => {
    					
    				}, // Handled automatically.
    				
    			}));

    		instance.init();
    		instance.layout();
    		$$invalidate(14, postMount = true);

    		return () => {
    			instance.destroy();
    		};
    	});

    	onDestroy(() => {
    		if (removeLayoutListener) {
    			removeLayoutListener();
    		}
    	});

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(12, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(12, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function setHeaderRowCheckboxIndeterminate(indeterminate) {
    		const checkbox = header === null || header === void 0
    		? void 0
    		: header.checkbox;

    		if (checkbox) {
    			checkbox.indeterminate = indeterminate;
    		}
    	}

    	function handleHeaderRowClick(event) {
    		if (!instance || !event.detail.target) {
    			return;
    		}

    		const headerCell = closest(event.detail.target, '.mdc-data-table__header-cell--with-sort');

    		if (headerCell) {
    			handleSortAction(headerCell);
    		}
    	}

    	function handleRowClick(event) {
    		if (!instance || !event.detail.target) {
    			return;
    		}

    		const row = closest(event.detail.target, '.mdc-data-table__row');

    		if (row && instance) {
    			instance.handleRowClick({ rowId: event.detail.rowId, row });
    		}
    	}

    	function handleSortAction(headerCell) {
    		var _a, _b;

    		const orderedCells = (_a = header === null || header === void 0
    		? void 0
    		: header.orderedCells) !== null && _a !== void 0
    		? _a
    		: [];

    		const columnIndex = orderedCells.map(accessor => accessor.element).indexOf(headerCell);

    		if (columnIndex === -1) {
    			return;
    		}

    		const columnId = (_b = orderedCells[columnIndex].columnId) !== null && _b !== void 0
    		? _b
    		: null;

    		instance.handleSortAction({ columnId, columnIndex, headerCell });
    	}

    	function layout() {
    		return instance.layout();
    	}

    	function getElement() {
    		return element;
    	}

    	function div0_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			container = $$value;
    			$$invalidate(9, container);
    		});
    	}

    	function div1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(8, element);
    		});
    	}

    	const SMUICheckbox_mount_handler = () => instance && postMount && instance.layout();
    	const SMUIDataTableHeader_mount_handler = event => $$invalidate(10, header = event.detail);
    	const SMUIDataTableHeader_unmount_handler = () => $$invalidate(10, header = undefined);
    	const SMUIDataTableBody_mount_handler = event => $$invalidate(11, body = event.detail);
    	const SMUIDataTableBody_unmount_handler = () => $$invalidate(11, body = undefined);
    	const SMUIDataTableHeaderCheckbox_change_handler = () => instance && instance.handleHeaderRowCheckboxChange();
    	const SMUIDataTableBodyCheckbox_change_handler = event => instance && instance.handleRowCheckboxChange(event);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(22, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('stickyHeader' in $$new_props) $$invalidate(2, stickyHeader = $$new_props.stickyHeader);
    		if ('sortable' in $$new_props) $$invalidate(25, sortable = $$new_props.sortable);
    		if ('sort' in $$new_props) $$invalidate(23, sort = $$new_props.sort);
    		if ('sortDirection' in $$new_props) $$invalidate(24, sortDirection = $$new_props.sortDirection);
    		if ('sortAscendingAriaLabel' in $$new_props) $$invalidate(26, sortAscendingAriaLabel = $$new_props.sortAscendingAriaLabel);
    		if ('sortDescendingAriaLabel' in $$new_props) $$invalidate(27, sortDescendingAriaLabel = $$new_props.sortDescendingAriaLabel);
    		if ('container$use' in $$new_props) $$invalidate(3, container$use = $$new_props.container$use);
    		if ('container$class' in $$new_props) $$invalidate(4, container$class = $$new_props.container$class);
    		if ('table$use' in $$new_props) $$invalidate(5, table$use = $$new_props.table$use);
    		if ('table$class' in $$new_props) $$invalidate(6, table$class = $$new_props.table$class);
    		if ('$$scope' in $$new_props) $$invalidate(32, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCDataTableFoundation,
    		ponyfill,
    		onMount,
    		onDestroy,
    		getContext,
    		setContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		exclude,
    		prefixFilter,
    		useActions,
    		dispatch: dispatch$1,
    		closest,
    		forwardEvents,
    		use,
    		className,
    		stickyHeader,
    		sortable,
    		sort,
    		sortDirection,
    		sortAscendingAriaLabel,
    		sortDescendingAriaLabel,
    		container$use,
    		container$class,
    		table$use,
    		table$class,
    		element,
    		instance,
    		container,
    		header,
    		body,
    		internalClasses,
    		progressIndicatorStyles,
    		addLayoutListener,
    		removeLayoutListener,
    		postMount,
    		progressClosed,
    		sortStore,
    		sortDirectionStore,
    		previousProgressClosed,
    		addClass,
    		removeClass,
    		setHeaderRowCheckboxIndeterminate,
    		handleHeaderRowClick,
    		handleRowClick,
    		handleSortAction,
    		layout,
    		getElement,
    		$progressClosed,
    		$sortDirectionStore,
    		$sortStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('stickyHeader' in $$props) $$invalidate(2, stickyHeader = $$new_props.stickyHeader);
    		if ('sortable' in $$props) $$invalidate(25, sortable = $$new_props.sortable);
    		if ('sort' in $$props) $$invalidate(23, sort = $$new_props.sort);
    		if ('sortDirection' in $$props) $$invalidate(24, sortDirection = $$new_props.sortDirection);
    		if ('sortAscendingAriaLabel' in $$props) $$invalidate(26, sortAscendingAriaLabel = $$new_props.sortAscendingAriaLabel);
    		if ('sortDescendingAriaLabel' in $$props) $$invalidate(27, sortDescendingAriaLabel = $$new_props.sortDescendingAriaLabel);
    		if ('container$use' in $$props) $$invalidate(3, container$use = $$new_props.container$use);
    		if ('container$class' in $$props) $$invalidate(4, container$class = $$new_props.container$class);
    		if ('table$use' in $$props) $$invalidate(5, table$use = $$new_props.table$use);
    		if ('table$class' in $$props) $$invalidate(6, table$class = $$new_props.table$class);
    		if ('element' in $$props) $$invalidate(8, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(7, instance = $$new_props.instance);
    		if ('container' in $$props) $$invalidate(9, container = $$new_props.container);
    		if ('header' in $$props) $$invalidate(10, header = $$new_props.header);
    		if ('body' in $$props) $$invalidate(11, body = $$new_props.body);
    		if ('internalClasses' in $$props) $$invalidate(12, internalClasses = $$new_props.internalClasses);
    		if ('progressIndicatorStyles' in $$props) $$invalidate(13, progressIndicatorStyles = $$new_props.progressIndicatorStyles);
    		if ('addLayoutListener' in $$props) addLayoutListener = $$new_props.addLayoutListener;
    		if ('removeLayoutListener' in $$props) removeLayoutListener = $$new_props.removeLayoutListener;
    		if ('postMount' in $$props) $$invalidate(14, postMount = $$new_props.postMount);
    		if ('progressClosed' in $$props) $$invalidate(16, progressClosed = $$new_props.progressClosed);
    		if ('sortStore' in $$props) $$invalidate(17, sortStore = $$new_props.sortStore);
    		if ('sortDirectionStore' in $$props) $$invalidate(18, sortDirectionStore = $$new_props.sortDirectionStore);
    		if ('previousProgressClosed' in $$props) $$invalidate(30, previousProgressClosed = $$new_props.previousProgressClosed);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*sort*/ 8388608) {
    			set_store_value(sortStore, $sortStore = sort, $sortStore);
    		}

    		if ($$self.$$.dirty[0] & /*sortDirection*/ 16777216) {
    			set_store_value(sortDirectionStore, $sortDirectionStore = sortDirection, $sortDirectionStore);
    		}

    		if ($$self.$$.dirty[0] & /*instance, previousProgressClosed*/ 1073741952 | $$self.$$.dirty[1] & /*$progressClosed*/ 1) {
    			if ($$slots.progress && instance && previousProgressClosed !== $progressClosed) {
    				$$invalidate(30, previousProgressClosed = $progressClosed);

    				if ($progressClosed) {
    					instance.hideProgress();
    				} else {
    					instance.showProgress();
    				}
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		stickyHeader,
    		container$use,
    		container$class,
    		table$use,
    		table$class,
    		instance,
    		element,
    		container,
    		header,
    		body,
    		internalClasses,
    		progressIndicatorStyles,
    		postMount,
    		forwardEvents,
    		progressClosed,
    		sortStore,
    		sortDirectionStore,
    		handleHeaderRowClick,
    		handleRowClick,
    		$$slots,
    		$$restProps,
    		sort,
    		sortDirection,
    		sortable,
    		sortAscendingAriaLabel,
    		sortDescendingAriaLabel,
    		layout,
    		getElement,
    		previousProgressClosed,
    		$progressClosed,
    		$$scope,
    		slots,
    		div0_binding,
    		div1_binding,
    		SMUICheckbox_mount_handler,
    		SMUIDataTableHeader_mount_handler,
    		SMUIDataTableHeader_unmount_handler,
    		SMUIDataTableBody_mount_handler,
    		SMUIDataTableBody_unmount_handler,
    		SMUIDataTableHeaderCheckbox_change_handler,
    		SMUIDataTableBodyCheckbox_change_handler
    	];
    }

    class DataTable extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$b,
    			create_fragment$z,
    			safe_not_equal,
    			{
    				use: 0,
    				class: 1,
    				stickyHeader: 2,
    				sortable: 25,
    				sort: 23,
    				sortDirection: 24,
    				sortAscendingAriaLabel: 26,
    				sortDescendingAriaLabel: 27,
    				container$use: 3,
    				container$class: 4,
    				table$use: 5,
    				table$class: 6,
    				layout: 28,
    				getElement: 29
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "DataTable",
    			options,
    			id: create_fragment$z.name
    		});
    	}

    	get use() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get stickyHeader() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set stickyHeader(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sortable() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sortable(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sort() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sort(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sortDirection() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sortDirection(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sortAscendingAriaLabel() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sortAscendingAriaLabel(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sortDescendingAriaLabel() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sortDescendingAriaLabel(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get container$use() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set container$use(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get container$class() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set container$class(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get table$use() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set table$use(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get table$class() {
    		throw new Error_1$2("<DataTable>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set table$class(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get layout() {
    		return this.$$.ctx[28];
    	}

    	set layout(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[29];
    	}

    	set getElement(value) {
    		throw new Error_1$2("<DataTable>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/data-table/dist/Head.svelte generated by Svelte v3.46.4 */
    const file$v = "node_modules/@smui/data-table/dist/Head.svelte";

    function create_fragment$y(ctx) {
    	let thead;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[9].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], null);
    	let thead_levels = [/*$$restProps*/ ctx[6]];
    	let thead_data = {};

    	for (let i = 0; i < thead_levels.length; i += 1) {
    		thead_data = assign$1(thead_data, thead_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			thead = element("thead");
    			if (default_slot) default_slot.c();
    			set_attributes(thead, thead_data);
    			add_location(thead, file$v, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, thead, anchor);

    			if (default_slot) {
    				default_slot.m(thead, null);
    			}

    			/*thead_binding*/ ctx[10](thead);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, thead, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[3].call(null, thead)),
    					listen_dev(thead, "SMUICheckbox:mount", /*SMUICheckbox_mount_handler*/ ctx[11], false, false, false),
    					listen_dev(thead, "SMUICheckbox:unmount", /*SMUICheckbox_unmount_handler*/ ctx[12], false, false, false),
    					listen_dev(thead, "SMUIDataTableCell:mount", /*handleCellMount*/ ctx[4], false, false, false),
    					listen_dev(thead, "SMUIDataTableCell:unmount", /*handleCellUnmount*/ ctx[5], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 256)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[8],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[8])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[8], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(thead, thead_data = get_spread_update(thead_levels, [dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6]]));
    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(thead);
    			if (default_slot) default_slot.d(detaching);
    			/*thead_binding*/ ctx[10](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$y.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$x($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Head', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let element;
    	let checkbox = undefined;
    	let cells = [];
    	const cellAccessorMap = new WeakMap();
    	setContext('SMUI:data-table:row:header', true);

    	onMount(() => {
    		const accessor = {
    			get cells() {
    				return cells;
    			},
    			get orderedCells() {
    				return getOrderedCells();
    			},
    			get checkbox() {
    				return checkbox;
    			}
    		};

    		dispatch$1(getElement(), 'SMUIDataTableHeader:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIDataTableHeader:unmount', accessor);
    		};
    	});

    	function handleCellMount(event) {
    		cells.push(event.detail);
    		cellAccessorMap.set(event.detail.element, event.detail);
    		event.stopPropagation();
    	}

    	function handleCellUnmount(event) {
    		const idx = cells.indexOf(event.detail);

    		if (idx !== -1) {
    			cells.splice(idx, 1);
    			cells = cells;
    		}

    		cellAccessorMap.delete(event.detail.element);
    		event.stopPropagation();
    	}

    	function getOrderedCells() {
    		return [...getElement().querySelectorAll('.mdc-data-table__header-cell')].map(element => cellAccessorMap.get(element)).filter(accessor => accessor && accessor._smui_data_table_header_cell_accessor);
    	}

    	function getElement() {
    		return element;
    	}

    	function thead_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	const SMUICheckbox_mount_handler = event => $$invalidate(2, checkbox = event.detail);
    	const SMUICheckbox_unmount_handler = () => $$invalidate(2, checkbox = undefined);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('$$scope' in $$new_props) $$invalidate(8, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onMount,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		element,
    		checkbox,
    		cells,
    		cellAccessorMap,
    		handleCellMount,
    		handleCellUnmount,
    		getOrderedCells,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    		if ('checkbox' in $$props) $$invalidate(2, checkbox = $$new_props.checkbox);
    		if ('cells' in $$props) cells = $$new_props.cells;
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		element,
    		checkbox,
    		forwardEvents,
    		handleCellMount,
    		handleCellUnmount,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		thead_binding,
    		SMUICheckbox_mount_handler,
    		SMUICheckbox_unmount_handler
    	];
    }

    class Head$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$x, create_fragment$y, safe_not_equal, { use: 0, getElement: 7 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Head",
    			options,
    			id: create_fragment$y.name
    		});
    	}

    	get use() {
    		throw new Error("<Head>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Head>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[7];
    	}

    	set getElement(value) {
    		throw new Error("<Head>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/data-table/dist/Body.svelte generated by Svelte v3.46.4 */

    const file$u = "node_modules/@smui/data-table/dist/Body.svelte";

    function create_fragment$x(ctx) {
    	let tbody;
    	let tbody_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[9].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], null);

    	let tbody_levels = [
    		{
    			class: tbody_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-data-table__content': true
    			})
    		},
    		/*$$restProps*/ ctx[6]
    	];

    	let tbody_data = {};

    	for (let i = 0; i < tbody_levels.length; i += 1) {
    		tbody_data = assign$1(tbody_data, tbody_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			tbody = element("tbody");
    			if (default_slot) default_slot.c();
    			set_attributes(tbody, tbody_data);
    			add_location(tbody, file$u, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, tbody, anchor);

    			if (default_slot) {
    				default_slot.m(tbody, null);
    			}

    			/*tbody_binding*/ ctx[10](tbody);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, tbody, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[3].call(null, tbody)),
    					listen_dev(tbody, "SMUIDataTableRow:mount", /*handleRowMount*/ ctx[4], false, false, false),
    					listen_dev(tbody, "SMUIDataTableRow:unmount", /*handleRowUnmount*/ ctx[5], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 256)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[8],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[8])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[8], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(tbody, tbody_data = get_spread_update(tbody_levels, [
    				(!current || dirty & /*className*/ 2 && tbody_class_value !== (tbody_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-data-table__content': true
    				}))) && { class: tbody_class_value },
    				dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(tbody);
    			if (default_slot) default_slot.d(detaching);
    			/*tbody_binding*/ ctx[10](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$x.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$w($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Body', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let element;
    	let rows = [];
    	const rowAccessorMap = new WeakMap();
    	setContext('SMUI:data-table:row:header', false);

    	onMount(() => {
    		const accessor = {
    			get rows() {
    				return rows;
    			},
    			get orderedRows() {
    				return getOrderedRows();
    			}
    		};

    		dispatch$1(getElement(), 'SMUIDataTableBody:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIDataTableBody:unmount', accessor);
    		};
    	});

    	function handleRowMount(event) {
    		rows.push(event.detail);
    		rowAccessorMap.set(event.detail.element, event.detail);
    		event.stopPropagation();
    	}

    	function handleRowUnmount(event) {
    		const idx = rows.indexOf(event.detail);

    		if (idx !== -1) {
    			rows.splice(idx, 1);
    			rows = rows;
    		}

    		rowAccessorMap.delete(event.detail.element);
    		event.stopPropagation();
    	}

    	function getOrderedRows() {
    		return [...getElement().querySelectorAll('.mdc-data-table__row')].map(element => rowAccessorMap.get(element)).filter(accessor => accessor && accessor._smui_data_table_row_accessor);
    	}

    	function getElement() {
    		return element;
    	}

    	function tbody_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('$$scope' in $$new_props) $$invalidate(8, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onMount,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		className,
    		element,
    		rows,
    		rowAccessorMap,
    		handleRowMount,
    		handleRowUnmount,
    		getOrderedRows,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    		if ('rows' in $$props) rows = $$new_props.rows;
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		element,
    		forwardEvents,
    		handleRowMount,
    		handleRowUnmount,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		tbody_binding
    	];
    }

    class Body$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$w, create_fragment$x, safe_not_equal, { use: 0, class: 1, getElement: 7 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Body",
    			options,
    			id: create_fragment$x.name
    		});
    	}

    	get use() {
    		throw new Error("<Body>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Body>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Body>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Body>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[7];
    	}

    	set getElement(value) {
    		throw new Error("<Body>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/data-table/dist/Row.svelte generated by Svelte v3.46.4 */

    const file$t = "node_modules/@smui/data-table/dist/Row.svelte";

    function create_fragment$w(ctx) {
    	let tr;
    	let tr_class_value;
    	let tr_aria_selected_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[14].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null);

    	let tr_levels = [
    		{
    			class: tr_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-data-table__header-row': /*header*/ ctx[7],
    				'mdc-data-table__row': !/*header*/ ctx[7],
    				'mdc-data-table__row--selected': !/*header*/ ctx[7] && /*checkbox*/ ctx[3] && /*checkbox*/ ctx[3].checked,
    				.../*internalClasses*/ ctx[4]
    			})
    		},
    		{
    			"aria-selected": tr_aria_selected_value = /*checkbox*/ ctx[3]
    			? /*checkbox*/ ctx[3].checked ? 'true' : 'false'
    			: undefined
    		},
    		/*internalAttrs*/ ctx[5],
    		/*$$restProps*/ ctx[10]
    	];

    	let tr_data = {};

    	for (let i = 0; i < tr_levels.length; i += 1) {
    		tr_data = assign$1(tr_data, tr_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			tr = element("tr");
    			if (default_slot) default_slot.c();
    			set_attributes(tr, tr_data);
    			add_location(tr, file$t, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, tr, anchor);

    			if (default_slot) {
    				default_slot.m(tr, null);
    			}

    			/*tr_binding*/ ctx[15](tr);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, tr, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[6].call(null, tr)),
    					listen_dev(tr, "click", /*click_handler*/ ctx[16], false, false, false),
    					listen_dev(tr, "SMUICheckbox:mount", /*SMUICheckbox_mount_handler*/ ctx[17], false, false, false),
    					listen_dev(tr, "SMUICheckbox:unmount", /*SMUICheckbox_unmount_handler*/ ctx[18], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[13],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[13])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(tr, tr_data = get_spread_update(tr_levels, [
    				(!current || dirty & /*className, checkbox, internalClasses*/ 26 && tr_class_value !== (tr_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-data-table__header-row': /*header*/ ctx[7],
    					'mdc-data-table__row': !/*header*/ ctx[7],
    					'mdc-data-table__row--selected': !/*header*/ ctx[7] && /*checkbox*/ ctx[3] && /*checkbox*/ ctx[3].checked,
    					.../*internalClasses*/ ctx[4]
    				}))) && { class: tr_class_value },
    				(!current || dirty & /*checkbox*/ 8 && tr_aria_selected_value !== (tr_aria_selected_value = /*checkbox*/ ctx[3]
    				? /*checkbox*/ ctx[3].checked ? 'true' : 'false'
    				: undefined)) && { "aria-selected": tr_aria_selected_value },
    				dirty & /*internalAttrs*/ 32 && /*internalAttrs*/ ctx[5],
    				dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(tr);
    			if (default_slot) default_slot.d(detaching);
    			/*tr_binding*/ ctx[15](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$w.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter$3 = 0;

    function instance$v($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","rowId","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Row', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { rowId = 'SMUI-data-table-row-' + counter$3++ } = $$props;
    	let element;
    	let checkbox = undefined;
    	let internalClasses = {};
    	let internalAttrs = {};
    	let header = getContext('SMUI:data-table:row:header');

    	onMount(() => {
    		const accessor = header
    		? {
    				_smui_data_table_row_accessor: false,
    				get element() {
    					return getElement();
    				},
    				get checkbox() {
    					return checkbox;
    				},
    				get rowId() {
    					return undefined;
    				},
    				get selected() {
    					var _a;

    					return (_a = checkbox && checkbox.checked) !== null && _a !== void 0
    					? _a
    					: false;
    				},
    				addClass,
    				removeClass,
    				getAttr,
    				addAttr
    			}
    		: {
    				_smui_data_table_row_accessor: true,
    				get element() {
    					return getElement();
    				},
    				get checkbox() {
    					return checkbox;
    				},
    				get rowId() {
    					return rowId;
    				},
    				get selected() {
    					var _a;

    					return (_a = checkbox && checkbox.checked) !== null && _a !== void 0
    					? _a
    					: false;
    				},
    				addClass,
    				removeClass,
    				getAttr,
    				addAttr
    			};

    		dispatch$1(getElement(), 'SMUIDataTableRow:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIDataTableRow:unmount', accessor);
    		};
    	});

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(4, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(4, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(5, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function notifyHeaderClick(event) {
    		dispatch$1(getElement(), 'SMUIDataTableHeader:click', event);
    	}

    	function notifyRowClick(event) {
    		dispatch$1(getElement(), 'SMUIDataTableRow:click', { rowId, target: event.target });
    	}

    	function getElement() {
    		return element;
    	}

    	function tr_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	const click_handler = event => header
    	? notifyHeaderClick(event)
    	: notifyRowClick(event);

    	const SMUICheckbox_mount_handler = event => $$invalidate(3, checkbox = event.detail);
    	const SMUICheckbox_unmount_handler = () => $$invalidate(3, checkbox = undefined);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('rowId' in $$new_props) $$invalidate(11, rowId = $$new_props.rowId);
    		if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter: counter$3,
    		onMount,
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		className,
    		rowId,
    		element,
    		checkbox,
    		internalClasses,
    		internalAttrs,
    		header,
    		addClass,
    		removeClass,
    		getAttr,
    		addAttr,
    		notifyHeaderClick,
    		notifyRowClick,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('rowId' in $$props) $$invalidate(11, rowId = $$new_props.rowId);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    		if ('checkbox' in $$props) $$invalidate(3, checkbox = $$new_props.checkbox);
    		if ('internalClasses' in $$props) $$invalidate(4, internalClasses = $$new_props.internalClasses);
    		if ('internalAttrs' in $$props) $$invalidate(5, internalAttrs = $$new_props.internalAttrs);
    		if ('header' in $$props) $$invalidate(7, header = $$new_props.header);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		element,
    		checkbox,
    		internalClasses,
    		internalAttrs,
    		forwardEvents,
    		header,
    		notifyHeaderClick,
    		notifyRowClick,
    		$$restProps,
    		rowId,
    		getElement,
    		$$scope,
    		slots,
    		tr_binding,
    		click_handler,
    		SMUICheckbox_mount_handler,
    		SMUICheckbox_unmount_handler
    	];
    }

    class Row$2 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$v, create_fragment$w, safe_not_equal, {
    			use: 0,
    			class: 1,
    			rowId: 11,
    			getElement: 12
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Row",
    			options,
    			id: create_fragment$w.name
    		});
    	}

    	get use() {
    		throw new Error("<Row>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Row>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Row>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Row>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rowId() {
    		throw new Error("<Row>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rowId(value) {
    		throw new Error("<Row>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[12];
    	}

    	set getElement(value) {
    		throw new Error("<Row>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/data-table/dist/Cell.svelte generated by Svelte v3.46.4 */

    const file$s = "node_modules/@smui/data-table/dist/Cell.svelte";

    // (43:0) {:else}
    function create_else_block_1(ctx) {
    	let td;
    	let td_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[22].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	let td_levels = [
    		{
    			class: td_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-data-table__cell': true,
    				'mdc-data-table__cell--numeric': /*numeric*/ ctx[2],
    				'mdc-data-table__cell--checkbox': /*checkbox*/ ctx[3],
    				.../*internalClasses*/ ctx[7]
    			})
    		},
    		/*internalAttrs*/ ctx[8],
    		/*$$restProps*/ ctx[19]
    	];

    	let td_data = {};

    	for (let i = 0; i < td_levels.length; i += 1) {
    		td_data = assign$1(td_data, td_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			td = element("td");
    			if (default_slot) default_slot.c();
    			set_attributes(td, td_data);
    			add_location(td, file$s, 43, 2, 1231);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, td, anchor);

    			if (default_slot) {
    				default_slot.m(td, null);
    			}

    			/*td_binding*/ ctx[25](td);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, td, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[11].call(null, td)),
    					listen_dev(td, "change", /*change_handler_1*/ ctx[26], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(td, td_data = get_spread_update(td_levels, [
    				(!current || dirty & /*className, numeric, checkbox, internalClasses*/ 142 && td_class_value !== (td_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-data-table__cell': true,
    					'mdc-data-table__cell--numeric': /*numeric*/ ctx[2],
    					'mdc-data-table__cell--checkbox': /*checkbox*/ ctx[3],
    					.../*internalClasses*/ ctx[7]
    				}))) && { class: td_class_value },
    				dirty & /*internalAttrs*/ 256 && /*internalAttrs*/ ctx[8],
    				dirty & /*$$restProps*/ 524288 && /*$$restProps*/ ctx[19]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(td);
    			if (default_slot) default_slot.d(detaching);
    			/*td_binding*/ ctx[25](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block_1.name,
    		type: "else",
    		source: "(43:0) {:else}",
    		ctx
    	});

    	return block;
    }

    // (1:0) {#if header}
    function create_if_block$i(ctx) {
    	let th;
    	let current_block_type_index;
    	let if_block;
    	let th_class_value;
    	let th_aria_sort_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const if_block_creators = [create_if_block_1$9, create_else_block$3];
    	const if_blocks = [];

    	function select_block_type_1(ctx, dirty) {
    		if (/*sortable*/ ctx[5]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type_1(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	let th_levels = [
    		{
    			class: th_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-data-table__header-cell': true,
    				'mdc-data-table__header-cell--numeric': /*numeric*/ ctx[2],
    				'mdc-data-table__header-cell--checkbox': /*checkbox*/ ctx[3],
    				'mdc-data-table__header-cell--with-sort': /*sortable*/ ctx[5],
    				'mdc-data-table__header-cell--sorted': /*sortable*/ ctx[5] && /*$sort*/ ctx[9] === /*columnId*/ ctx[4],
    				.../*internalClasses*/ ctx[7]
    			})
    		},
    		{ role: "columnheader" },
    		{ scope: "col" },
    		{ "data-column-id": /*columnId*/ ctx[4] },
    		{
    			"aria-sort": th_aria_sort_value = /*sortable*/ ctx[5]
    			? /*$sort*/ ctx[9] === /*columnId*/ ctx[4]
    				? /*$sortDirection*/ ctx[10]
    				: 'none'
    			: undefined
    		},
    		/*internalAttrs*/ ctx[8],
    		/*$$restProps*/ ctx[19]
    	];

    	let th_data = {};

    	for (let i = 0; i < th_levels.length; i += 1) {
    		th_data = assign$1(th_data, th_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			th = element("th");
    			if_block.c();
    			set_attributes(th, th_data);
    			add_location(th, file$s, 1, 2, 15);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, th, anchor);
    			if_blocks[current_block_type_index].m(th, null);
    			/*th_binding*/ ctx[23](th);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, th, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[11].call(null, th)),
    					listen_dev(th, "change", /*change_handler*/ ctx[24], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type_1(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block = if_blocks[current_block_type_index];

    				if (!if_block) {
    					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block.c();
    				} else {
    					if_block.p(ctx, dirty);
    				}

    				transition_in(if_block, 1);
    				if_block.m(th, null);
    			}

    			set_attributes(th, th_data = get_spread_update(th_levels, [
    				(!current || dirty & /*className, numeric, checkbox, sortable, $sort, columnId, internalClasses*/ 702 && th_class_value !== (th_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-data-table__header-cell': true,
    					'mdc-data-table__header-cell--numeric': /*numeric*/ ctx[2],
    					'mdc-data-table__header-cell--checkbox': /*checkbox*/ ctx[3],
    					'mdc-data-table__header-cell--with-sort': /*sortable*/ ctx[5],
    					'mdc-data-table__header-cell--sorted': /*sortable*/ ctx[5] && /*$sort*/ ctx[9] === /*columnId*/ ctx[4],
    					.../*internalClasses*/ ctx[7]
    				}))) && { class: th_class_value },
    				{ role: "columnheader" },
    				{ scope: "col" },
    				(!current || dirty & /*columnId*/ 16) && { "data-column-id": /*columnId*/ ctx[4] },
    				(!current || dirty & /*sortable, $sort, columnId, $sortDirection*/ 1584 && th_aria_sort_value !== (th_aria_sort_value = /*sortable*/ ctx[5]
    				? /*$sort*/ ctx[9] === /*columnId*/ ctx[4]
    					? /*$sortDirection*/ ctx[10]
    					: 'none'
    				: undefined)) && { "aria-sort": th_aria_sort_value },
    				dirty & /*internalAttrs*/ 256 && /*internalAttrs*/ ctx[8],
    				dirty & /*$$restProps*/ 524288 && /*$$restProps*/ ctx[19]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(th);
    			if_blocks[current_block_type_index].d();
    			/*th_binding*/ ctx[23](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$i.name,
    		type: "if",
    		source: "(1:0) {#if header}",
    		ctx
    	});

    	return block;
    }

    // (41:4) {:else}
    function create_else_block$3(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[22].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$3.name,
    		type: "else",
    		source: "(41:4) {:else}",
    		ctx
    	});

    	return block;
    }

    // (26:5) {#if sortable}
    function create_if_block_1$9(ctx) {
    	let div1;
    	let t0;
    	let div0;

    	let t1_value = (/*$sort*/ ctx[9] === /*columnId*/ ctx[4]
    	? /*$sortDirection*/ ctx[10] === 'ascending'
    		? /*sortAscendingAriaLabel*/ ctx[15]
    		: /*sortDescendingAriaLabel*/ ctx[16]
    	: '') + "";

    	let t1;
    	let div0_id_value;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[22].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			if (default_slot) default_slot.c();
    			t0 = space();
    			div0 = element("div");
    			t1 = text(t1_value);
    			attr_dev(div0, "class", "mdc-data-table__sort-status-label");
    			attr_dev(div0, "aria-hidden", "true");
    			attr_dev(div0, "id", div0_id_value = "" + (/*columnId*/ ctx[4] + "-status-label"));
    			add_location(div0, file$s, 28, 8, 853);
    			attr_dev(div1, "class", "mdc-data-table__header-cell-wrapper");
    			add_location(div1, file$s, 26, 6, 778);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);

    			if (default_slot) {
    				default_slot.m(div1, null);
    			}

    			append_dev(div1, t0);
    			append_dev(div1, div0);
    			append_dev(div0, t1);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}

    			if ((!current || dirty & /*$sort, columnId, $sortDirection*/ 1552) && t1_value !== (t1_value = (/*$sort*/ ctx[9] === /*columnId*/ ctx[4]
    			? /*$sortDirection*/ ctx[10] === 'ascending'
    				? /*sortAscendingAriaLabel*/ ctx[15]
    				: /*sortDescendingAriaLabel*/ ctx[16]
    			: '') + "")) set_data_dev(t1, t1_value);

    			if (!current || dirty & /*columnId*/ 16 && div0_id_value !== (div0_id_value = "" + (/*columnId*/ ctx[4] + "-status-label"))) {
    				attr_dev(div0, "id", div0_id_value);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$9.name,
    		type: "if",
    		source: "(26:5) {#if sortable}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$v(ctx) {
    	let current_block_type_index;
    	let if_block;
    	let if_block_anchor;
    	let current;
    	const if_block_creators = [create_if_block$i, create_else_block_1];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*header*/ ctx[12]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	const block = {
    		c: function create() {
    			if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if_blocks[current_block_type_index].m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if_block.p(ctx, dirty);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if_blocks[current_block_type_index].d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$v.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter$2 = 0;

    function instance$u($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","numeric","checkbox","columnId","sortable","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $sort;
    	let $sortDirection;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Cell', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let header = getContext('SMUI:data-table:row:header');
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { numeric = false } = $$props;
    	let { checkbox = false } = $$props;

    	let { columnId = header
    	? 'SMUI-data-table-column-' + counter$2++
    	: 'SMUI-data-table-unused' } = $$props;

    	let { sortable = getContext('SMUI:data-table:sortable') } = $$props;
    	let element;
    	let internalClasses = {};
    	let internalAttrs = {};
    	let sort = getContext('SMUI:data-table:sort');
    	validate_store(sort, 'sort');
    	component_subscribe($$self, sort, value => $$invalidate(9, $sort = value));
    	let sortDirection = getContext('SMUI:data-table:sortDirection');
    	validate_store(sortDirection, 'sortDirection');
    	component_subscribe($$self, sortDirection, value => $$invalidate(10, $sortDirection = value));
    	let sortAscendingAriaLabel = getContext('SMUI:data-table:sortAscendingAriaLabel');
    	let sortDescendingAriaLabel = getContext('SMUI:data-table:sortDescendingAriaLabel');

    	if (sortable) {
    		setContext('SMUI:label:context', 'data-table:sortable-header-cell');
    		setContext('SMUI:icon-button:context', 'data-table:sortable-header-cell');
    		setContext('SMUI:icon-button:aria-describedby', columnId + '-status-label');
    	}

    	onMount(() => {
    		const accessor = header
    		? {
    				_smui_data_table_header_cell_accessor: true,
    				get element() {
    					return getElement();
    				},
    				get columnId() {
    					return columnId;
    				},
    				addClass,
    				removeClass,
    				getAttr,
    				addAttr
    			}
    		: {
    				_smui_data_table_header_cell_accessor: false,
    				get element() {
    					return getElement();
    				},
    				get columnId() {
    					return undefined;
    				},
    				addClass,
    				removeClass,
    				getAttr,
    				addAttr
    			};

    		dispatch$1(getElement(), 'SMUIDataTableCell:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIDataTableCell:unmount', accessor);
    		};
    	});

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(7, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(7, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(8, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function notifyHeaderChange(event) {
    		dispatch$1(getElement(), 'SMUIDataTableHeaderCheckbox:change', event);
    	}

    	function notifyBodyChange(event) {
    		dispatch$1(getElement(), 'SMUIDataTableBodyCheckbox:change', event);
    	}

    	function getElement() {
    		return element;
    	}

    	function th_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(6, element);
    		});
    	}

    	const change_handler = event => checkbox && notifyHeaderChange(event);

    	function td_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(6, element);
    		});
    	}

    	const change_handler_1 = event => checkbox && notifyBodyChange(event);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(19, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('numeric' in $$new_props) $$invalidate(2, numeric = $$new_props.numeric);
    		if ('checkbox' in $$new_props) $$invalidate(3, checkbox = $$new_props.checkbox);
    		if ('columnId' in $$new_props) $$invalidate(4, columnId = $$new_props.columnId);
    		if ('sortable' in $$new_props) $$invalidate(5, sortable = $$new_props.sortable);
    		if ('$$scope' in $$new_props) $$invalidate(21, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter: counter$2,
    		onMount,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		header,
    		use,
    		className,
    		numeric,
    		checkbox,
    		columnId,
    		sortable,
    		element,
    		internalClasses,
    		internalAttrs,
    		sort,
    		sortDirection,
    		sortAscendingAriaLabel,
    		sortDescendingAriaLabel,
    		addClass,
    		removeClass,
    		getAttr,
    		addAttr,
    		notifyHeaderChange,
    		notifyBodyChange,
    		getElement,
    		$sort,
    		$sortDirection
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('header' in $$props) $$invalidate(12, header = $$new_props.header);
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('numeric' in $$props) $$invalidate(2, numeric = $$new_props.numeric);
    		if ('checkbox' in $$props) $$invalidate(3, checkbox = $$new_props.checkbox);
    		if ('columnId' in $$props) $$invalidate(4, columnId = $$new_props.columnId);
    		if ('sortable' in $$props) $$invalidate(5, sortable = $$new_props.sortable);
    		if ('element' in $$props) $$invalidate(6, element = $$new_props.element);
    		if ('internalClasses' in $$props) $$invalidate(7, internalClasses = $$new_props.internalClasses);
    		if ('internalAttrs' in $$props) $$invalidate(8, internalAttrs = $$new_props.internalAttrs);
    		if ('sort' in $$props) $$invalidate(13, sort = $$new_props.sort);
    		if ('sortDirection' in $$props) $$invalidate(14, sortDirection = $$new_props.sortDirection);
    		if ('sortAscendingAriaLabel' in $$props) $$invalidate(15, sortAscendingAriaLabel = $$new_props.sortAscendingAriaLabel);
    		if ('sortDescendingAriaLabel' in $$props) $$invalidate(16, sortDescendingAriaLabel = $$new_props.sortDescendingAriaLabel);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		numeric,
    		checkbox,
    		columnId,
    		sortable,
    		element,
    		internalClasses,
    		internalAttrs,
    		$sort,
    		$sortDirection,
    		forwardEvents,
    		header,
    		sort,
    		sortDirection,
    		sortAscendingAriaLabel,
    		sortDescendingAriaLabel,
    		notifyHeaderChange,
    		notifyBodyChange,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		th_binding,
    		change_handler,
    		td_binding,
    		change_handler_1
    	];
    }

    class Cell$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$u, create_fragment$v, safe_not_equal, {
    			use: 0,
    			class: 1,
    			numeric: 2,
    			checkbox: 3,
    			columnId: 4,
    			sortable: 5,
    			getElement: 20
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Cell",
    			options,
    			id: create_fragment$v.name
    		});
    	}

    	get use() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get numeric() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set numeric(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get checkbox() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set checkbox(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get columnId() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set columnId(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get sortable() {
    		throw new Error("<Cell>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set sortable(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[20];
    	}

    	set getElement(value) {
    		throw new Error("<Cell>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Head = Head$1;
    const Body = Body$1;
    const Row$1 = Row$2;
    const Cell = Cell$1;

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * Style classes for segmented-button
     */
    var cssClasses$a = {
        SINGLE_SELECT: 'mdc-segmented-button--single-select'
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCSegmentedButtonFoundation = /** @class */ (function (_super) {
        __extends(MDCSegmentedButtonFoundation, _super);
        function MDCSegmentedButtonFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCSegmentedButtonFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCSegmentedButtonFoundation, "defaultAdapter", {
            get: function () {
                return {
                    hasClass: function () { return false; }, getSegments: function () { return []; },
                    selectSegment: function () { return undefined; },
                    unselectSegment: function () { return undefined; },
                    notifySelectedChange: function () { return undefined; }
                };
            },
            enumerable: false,
            configurable: true
        });
        /**
         * Sets identified child segment to be selected
         *
         * @param indexOrSegmentId Number index or string segmentId that identifies
         * child segment
         */
        MDCSegmentedButtonFoundation.prototype.selectSegment = function (indexOrSegmentId) {
            this.adapter.selectSegment(indexOrSegmentId);
        };
        /**
         * Sets identified child segment to be not selected
         *
         * @param indexOrSegmentId Number index or string segmentId that identifies
         * child segment
         */
        MDCSegmentedButtonFoundation.prototype.unselectSegment = function (indexOrSegmentId) {
            this.adapter.unselectSegment(indexOrSegmentId);
        };
        /**
         * @return Returns currently selected child segments as readonly list of
         * SegmentDetails
         */
        MDCSegmentedButtonFoundation.prototype.getSelectedSegments = function () {
            return this.adapter.getSegments().filter(function (segmentDetail) { return segmentDetail.selected; });
        };
        /**
         * @param indexOrSegmentId Number index or string segmentId that identifies
         * child segment
         * @return Returns true if identified child segment is currently selected,
         * otherwise returns false
         */
        MDCSegmentedButtonFoundation.prototype.isSegmentSelected = function (indexOrSegmentId) {
            return this.adapter.getSegments().some(function (segmentDetail) { return (segmentDetail.index === indexOrSegmentId ||
                segmentDetail.segmentId === indexOrSegmentId) &&
                segmentDetail.selected; });
        };
        /**
         * @return Returns true if segmented button is single select, otherwise
         * returns false
         */
        MDCSegmentedButtonFoundation.prototype.isSingleSelect = function () {
            return this.adapter.hasClass(cssClasses$a.SINGLE_SELECT);
        };
        /**
         * Called when child segment's selected status may have changed. If segmented
         * button is single select, unselects all child segments other than identified
         * child segment. Finally, emits event to client.
         *
         * @param detail Child segment affected represented as SegmentDetail
         * @event change With detail - SegmentDetail
         */
        MDCSegmentedButtonFoundation.prototype.handleSelected = function (detail) {
            if (this.isSingleSelect()) {
                this.unselectPrevSelected(detail.index);
            }
            this.adapter.notifySelectedChange(detail);
        };
        /**
         * Sets all child segments to be not selected except for child segment
         * identified by index
         *
         * @param index Index of child segment to not unselect
         */
        MDCSegmentedButtonFoundation.prototype.unselectPrevSelected = function (index) {
            var e_1, _a;
            try {
                for (var _b = __values(this.getSelectedSegments()), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var selectedSegment = _c.value;
                    if (selectedSegment.index !== index) {
                        this.unselectSegment(selectedSegment.index);
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
        };
        return MDCSegmentedButtonFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/segmented-button/dist/SegmentedButton.svelte generated by Svelte v3.46.4 */
    const file$r = "node_modules/@smui/segmented-button/dist/SegmentedButton.svelte";

    function get_each_context$8(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[30] = list[i];
    	child_ctx[32] = i;
    	return child_ctx;
    }

    const get_default_slot_changes$5 = dirty => ({ segment: dirty[0] & /*segments*/ 4 });
    const get_default_slot_context$5 = ctx => ({ segment: /*segment*/ ctx[30] });

    // (18:6) <ContextFragment         key="SMUI:segmented-button:segment:initialSelected"         value={initialSelected[i]}       >
    function create_default_slot_1$7(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[16].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], get_default_slot_context$5);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*$$scope, segments*/ 2097156)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, get_default_slot_changes$5),
    						get_default_slot_context$5
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$7.name,
    		type: "slot",
    		source: "(18:6) <ContextFragment         key=\\\"SMUI:segmented-button:segment:initialSelected\\\"         value={initialSelected[i]}       >",
    		ctx
    	});

    	return block;
    }

    // (17:4) <ContextFragment key="SMUI:segmented-button:segment:index" value={i}>
    function create_default_slot$d(ctx) {
    	let contextfragment;
    	let t;
    	let current;

    	contextfragment = new ContextFragment({
    			props: {
    				key: "SMUI:segmented-button:segment:initialSelected",
    				value: /*initialSelected*/ ctx[8][/*i*/ ctx[32]],
    				$$slots: { default: [create_default_slot_1$7] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(contextfragment.$$.fragment);
    			t = space();
    		},
    		m: function mount(target, anchor) {
    			mount_component(contextfragment, target, anchor);
    			insert_dev(target, t, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const contextfragment_changes = {};
    			if (dirty[0] & /*segments*/ 4) contextfragment_changes.value = /*initialSelected*/ ctx[8][/*i*/ ctx[32]];

    			if (dirty[0] & /*$$scope, segments*/ 2097156) {
    				contextfragment_changes.$$scope = { dirty, ctx };
    			}

    			contextfragment.$set(contextfragment_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(contextfragment.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(contextfragment.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(contextfragment, detaching);
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$d.name,
    		type: "slot",
    		source: "(17:4) <ContextFragment key=\\\"SMUI:segmented-button:segment:index\\\" value={i}>",
    		ctx
    	});

    	return block;
    }

    // (16:2) {#each segments as segment, i (key(segment))}
    function create_each_block$8(key_2, ctx) {
    	let first;
    	let contextfragment;
    	let current;

    	contextfragment = new ContextFragment({
    			props: {
    				key: "SMUI:segmented-button:segment:index",
    				value: /*i*/ ctx[32],
    				$$slots: { default: [create_default_slot$d] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		key: key_2,
    		first: null,
    		c: function create() {
    			first = empty$2();
    			create_component(contextfragment.$$.fragment);
    			this.first = first;
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, first, anchor);
    			mount_component(contextfragment, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			const contextfragment_changes = {};
    			if (dirty[0] & /*segments*/ 4) contextfragment_changes.value = /*i*/ ctx[32];

    			if (dirty[0] & /*$$scope, segments*/ 2097156) {
    				contextfragment_changes.$$scope = { dirty, ctx };
    			}

    			contextfragment.$set(contextfragment_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(contextfragment.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(contextfragment.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(first);
    			destroy_component(contextfragment, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$8.name,
    		type: "each",
    		source: "(16:2) {#each segments as segment, i (key(segment))}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$u(ctx) {
    	let div;
    	let each_blocks = [];
    	let each_1_lookup = new Map();
    	let div_class_value;
    	let div_role_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	let each_value = /*segments*/ ctx[2];
    	validate_each_argument(each_value);
    	const get_key = ctx => /*key*/ ctx[3](/*segment*/ ctx[30]);
    	validate_each_keys(ctx, each_value, get_each_context$8, get_key);

    	for (let i = 0; i < each_value.length; i += 1) {
    		let child_ctx = get_each_context$8(ctx, each_value, i);
    		let key = get_key(child_ctx);
    		each_1_lookup.set(key, each_blocks[i] = create_each_block$8(key, child_ctx));
    	}

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-segmented-button': true,
    				'mdc-segmented-button--single-select': /*singleSelect*/ ctx[4]
    			})
    		},
    		{
    			role: div_role_value = /*singleSelect*/ ctx[4] ? 'radiogroup' : 'group'
    		},
    		/*$$restProps*/ ctx[12]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			set_attributes(div, div_data);
    			add_location(div, file$r, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(div, null);
    			}

    			/*div_binding*/ ctx[17](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[7].call(null, div)),
    					listen_dev(div, "SMUISegmentedButtonSegment:mount", /*SMUISegmentedButtonSegment_mount_handler*/ ctx[18], false, false, false),
    					listen_dev(div, "SMUISegmentedButtonSegment:unmount", /*SMUISegmentedButtonSegment_unmount_handler*/ ctx[19], false, false, false),
    					listen_dev(div, "selected", /*selected_handler*/ ctx[20], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*segments, initialSelected, $$scope, key*/ 2097420) {
    				each_value = /*segments*/ ctx[2];
    				validate_each_argument(each_value);
    				group_outros();
    				validate_each_keys(ctx, each_value, get_each_context$8, get_key);
    				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, outro_and_destroy_block, create_each_block$8, null, get_each_context$8);
    				check_outros();
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty[0] & /*className, singleSelect*/ 18 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-segmented-button': true,
    					'mdc-segmented-button--single-select': /*singleSelect*/ ctx[4]
    				}))) && { class: div_class_value },
    				(!current || dirty[0] & /*singleSelect*/ 16 && div_role_value !== (div_role_value = /*singleSelect*/ ctx[4] ? 'radiogroup' : 'group')) && { role: div_role_value },
    				dirty[0] & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].d();
    			}

    			/*div_binding*/ ctx[17](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$u.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function setDifference$1(setA, setB) {
    	let _difference = new Set(setA);

    	for (let elem of setB) {
    		_difference.delete(elem);
    	}

    	return _difference;
    }

    function instance_1$a($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","segments","key","singleSelect","selected","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $singleSelectStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('SegmentedButton', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { segments = [] } = $$props;
    	let { key = segment => segment } = $$props;
    	let { singleSelect = false } = $$props;
    	let { selected = singleSelect ? undefined : [] } = $$props;
    	let element;
    	let instance;
    	let segmentAccessorMap = {};
    	let segmentAccessorWeakMap = new WeakMap();
    	let initialSelected = segments.map(segmentId => singleSelect && selected === segmentId || !singleSelect && selected.indexOf(segmentId) !== -1);
    	setContext('SMUI:icon:context', 'segmented-button');
    	setContext('SMUI:label:context', 'segmented-button');
    	const singleSelectStore = writable(singleSelect);
    	validate_store(singleSelectStore, 'singleSelectStore');
    	component_subscribe($$self, singleSelectStore, value => $$invalidate(23, $singleSelectStore = value));
    	setContext('SMUI:segmented-button:singleSelect', singleSelectStore);
    	let previousSelected = singleSelect ? selected : new Set(selected);

    	onMount(() => {
    		$$invalidate(5, instance = new MDCSegmentedButtonFoundation({
    				hasClass: className => {
    					return getElement().classList.contains(className);
    				},
    				getSegments: () => {
    					return segments.map((segment, index) => ({
    						index,
    						selected: singleSelect
    						? selected === segment
    						: selected.indexOf(segment) !== -1
    					})); // segmentId: segment, // Not necessarily a string.
    				},
    				selectSegment,
    				unselectSegment,
    				notifySelectedChange: detail => {
    					if (detail.selected) {
    						selectSegment(detail.index);
    					} else {
    						unselectSegment(detail.index);
    					}

    					dispatch$1(getElement(), 'change', detail);
    				}
    			}));

    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	function handleSegmentMount(event) {
    		const accessor = event.detail;
    		addAccessor(accessor.segmentId, accessor);
    	}

    	function handleSegmentUnmount(event) {
    		const accessor = event.detail;
    		removeAccessor(accessor.segmentId);
    	}

    	function getAccessor(segmentId) {
    		return segmentId instanceof Object
    		? segmentAccessorWeakMap.get(segmentId)
    		: segmentAccessorMap[segmentId];
    	}

    	function addAccessor(segmentId, accessor) {
    		if (segmentId instanceof Object) {
    			segmentAccessorWeakMap.set(segmentId, accessor);
    		} else {
    			segmentAccessorMap[segmentId] = accessor;
    		}
    	}

    	function removeAccessor(segmentId) {
    		if (segmentId instanceof Object) {
    			segmentAccessorWeakMap.delete(segmentId);
    		} else {
    			delete segmentAccessorMap[segmentId];
    		}
    	}

    	function selectSegment(indexOrSegmentId) {
    		let index = segments.indexOf(indexOrSegmentId);

    		if (index === -1) {
    			index = indexOrSegmentId;
    		}

    		if (!singleSelect) {
    			const selIndex = selected.indexOf(segments[index]);

    			if (selIndex === -1) {
    				selected.push(segments[index]);
    				$$invalidate(13, selected);
    			}
    		} else if (selected !== segments[index]) {
    			$$invalidate(13, selected = segments[index]);
    		}

    		const accessor = getAccessor(segments[index]);

    		if (accessor) {
    			accessor.selected = true;
    		}
    	}

    	function unselectSegment(indexOrSegmentId) {
    		let index = segments.indexOf(indexOrSegmentId);

    		if (index === -1) {
    			index = indexOrSegmentId;
    		}

    		if (!singleSelect) {
    			const selIndex = selected.indexOf(segments[index]);

    			if (selIndex !== -1) {
    				selected.splice(selIndex, 1);
    				$$invalidate(13, selected);
    			}
    		} else if (selected === segments[index]) {
    			$$invalidate(13, selected = null);
    		}

    		const accessor = getAccessor(segments[index]);

    		if (accessor) {
    			accessor.selected = false;
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(6, element);
    		});
    	}

    	const SMUISegmentedButtonSegment_mount_handler = event => handleSegmentMount(event);
    	const SMUISegmentedButtonSegment_unmount_handler = event => handleSegmentUnmount(event);
    	const selected_handler = event => instance && instance.handleSelected(event.detail);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('segments' in $$new_props) $$invalidate(2, segments = $$new_props.segments);
    		if ('key' in $$new_props) $$invalidate(3, key = $$new_props.key);
    		if ('singleSelect' in $$new_props) $$invalidate(4, singleSelect = $$new_props.singleSelect);
    		if ('selected' in $$new_props) $$invalidate(13, selected = $$new_props.selected);
    		if ('$$scope' in $$new_props) $$invalidate(21, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCSegmentedButtonFoundation,
    		onMount,
    		setContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		ContextFragment,
    		forwardEvents,
    		use,
    		className,
    		segments,
    		key,
    		singleSelect,
    		selected,
    		element,
    		instance,
    		segmentAccessorMap,
    		segmentAccessorWeakMap,
    		initialSelected,
    		singleSelectStore,
    		previousSelected,
    		setDifference: setDifference$1,
    		handleSegmentMount,
    		handleSegmentUnmount,
    		getAccessor,
    		addAccessor,
    		removeAccessor,
    		selectSegment,
    		unselectSegment,
    		getElement,
    		$singleSelectStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('segments' in $$props) $$invalidate(2, segments = $$new_props.segments);
    		if ('key' in $$props) $$invalidate(3, key = $$new_props.key);
    		if ('singleSelect' in $$props) $$invalidate(4, singleSelect = $$new_props.singleSelect);
    		if ('selected' in $$props) $$invalidate(13, selected = $$new_props.selected);
    		if ('element' in $$props) $$invalidate(6, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(5, instance = $$new_props.instance);
    		if ('segmentAccessorMap' in $$props) segmentAccessorMap = $$new_props.segmentAccessorMap;
    		if ('segmentAccessorWeakMap' in $$props) segmentAccessorWeakMap = $$new_props.segmentAccessorWeakMap;
    		if ('initialSelected' in $$props) $$invalidate(8, initialSelected = $$new_props.initialSelected);
    		if ('previousSelected' in $$props) $$invalidate(15, previousSelected = $$new_props.previousSelected);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*singleSelect*/ 16) {
    			set_store_value(singleSelectStore, $singleSelectStore = singleSelect, $singleSelectStore);
    		}

    		if ($$self.$$.dirty[0] & /*instance, singleSelect, previousSelected, selected*/ 41008) {
    			if (instance && singleSelect && previousSelected !== selected) {
    				if (previousSelected != null) {
    					instance.unselectSegment(previousSelected);
    				}

    				$$invalidate(15, previousSelected = selected);

    				if (selected != null) {
    					instance.selectSegment(selected);
    				}
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, singleSelect, selected, previousSelected, segments*/ 41012) {
    			if (instance && !singleSelect) {
    				const setSelected = new Set(selected);
    				const unSelected = setDifference$1(previousSelected, setSelected);
    				const newSelected = setDifference$1(setSelected, previousSelected);

    				if (unSelected.size || newSelected.size) {
    					$$invalidate(15, previousSelected = setSelected);

    					for (let segmentId of unSelected) {
    						const idx = segments.indexOf(segmentId);

    						if (idx !== -1) {
    							instance.unselectSegment(idx);
    						}
    					}

    					for (let segmentId of newSelected) {
    						instance.selectSegment(segments.indexOf(segmentId));
    					}
    				}
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		segments,
    		key,
    		singleSelect,
    		instance,
    		element,
    		forwardEvents,
    		initialSelected,
    		singleSelectStore,
    		handleSegmentMount,
    		handleSegmentUnmount,
    		$$restProps,
    		selected,
    		getElement,
    		previousSelected,
    		slots,
    		div_binding,
    		SMUISegmentedButtonSegment_mount_handler,
    		SMUISegmentedButtonSegment_unmount_handler,
    		selected_handler,
    		$$scope
    	];
    }

    class SegmentedButton extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$a,
    			create_fragment$u,
    			safe_not_equal,
    			{
    				use: 0,
    				class: 1,
    				segments: 2,
    				key: 3,
    				singleSelect: 4,
    				selected: 13,
    				getElement: 14
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "SegmentedButton",
    			options,
    			id: create_fragment$u.name
    		});
    	}

    	get use() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get segments() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set segments(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get key() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set key(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get singleSelect() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set singleSelect(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selected() {
    		throw new Error("<SegmentedButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selected(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[14];
    	}

    	set getElement(value) {
    		throw new Error("<SegmentedButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * Boolean strings for segment
     */
    var booleans = {
        TRUE: 'true',
        FALSE: 'false'
    };
    /**
     * Attributes referenced by segment
     */
    var attributes = {
        ARIA_CHECKED: 'aria-checked',
        ARIA_PRESSED: 'aria-pressed',
        DATA_SEGMENT_ID: 'data-segment-id'
    };
    /**
     * Style classes for segment
     */
    var cssClasses$9 = {
        SELECTED: 'mdc-segmented-button__segment--selected'
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var emptyClientRect$1 = {
        bottom: 0,
        height: 0,
        left: 0,
        right: 0,
        top: 0,
        width: 0,
    };
    var MDCSegmentedButtonSegmentFoundation = /** @class */ (function (_super) {
        __extends(MDCSegmentedButtonSegmentFoundation, _super);
        function MDCSegmentedButtonSegmentFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCSegmentedButtonSegmentFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCSegmentedButtonSegmentFoundation, "defaultAdapter", {
            get: function () {
                return {
                    isSingleSelect: function () { return false; }, getAttr: function () { return ''; }, setAttr: function () { return undefined; },
                    addClass: function () { return undefined; }, removeClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    notifySelectedChange: function () { return undefined; },
                    getRootBoundingClientRect: function () { return emptyClientRect$1; },
                };
            },
            enumerable: false,
            configurable: true
        });
        /**
         * @return Returns true if segment is currently selected, otherwise returns
         * false
         */
        MDCSegmentedButtonSegmentFoundation.prototype.isSelected = function () {
            return this.adapter.hasClass(cssClasses$9.SELECTED);
        };
        /**
         * Sets segment to be selected
         */
        MDCSegmentedButtonSegmentFoundation.prototype.setSelected = function () {
            this.adapter.addClass(cssClasses$9.SELECTED);
            this.setAriaAttr(booleans.TRUE);
        };
        /**
         * Sets segment to be not selected
         */
        MDCSegmentedButtonSegmentFoundation.prototype.setUnselected = function () {
            this.adapter.removeClass(cssClasses$9.SELECTED);
            this.setAriaAttr(booleans.FALSE);
        };
        /**
         * @return Returns segment's segmentId if it was set by client
         */
        MDCSegmentedButtonSegmentFoundation.prototype.getSegmentId = function () {
            var _a;
            return (_a = this.adapter.getAttr(attributes.DATA_SEGMENT_ID)) !== null && _a !== void 0 ? _a : undefined;
        };
        /**
         * Called when segment is clicked. If the wrapping segmented button is single
         * select, doesn't allow segment to be set to not selected. Otherwise, toggles
         * segment's selected status. Finally, emits event to wrapping segmented
         * button.
         *
         * @event selected With detail - SegmentDetail
         */
        MDCSegmentedButtonSegmentFoundation.prototype.handleClick = function () {
            if (this.adapter.isSingleSelect()) {
                this.setSelected();
            }
            else {
                this.toggleSelection();
            }
            this.adapter.notifySelectedChange(this.isSelected());
        };
        /**
         * @return Returns bounding rectangle for ripple effect
         */
        MDCSegmentedButtonSegmentFoundation.prototype.getDimensions = function () {
            return this.adapter.getRootBoundingClientRect();
        };
        /**
         * Sets segment from not selected to selected, or selected to not selected
         */
        MDCSegmentedButtonSegmentFoundation.prototype.toggleSelection = function () {
            if (this.isSelected()) {
                this.setUnselected();
            }
            else {
                this.setSelected();
            }
        };
        /**
         * Sets appropriate aria attribute, based on wrapping segmented button's
         * single selected value, to new value
         *
         * @param value Value that represents selected status
         */
        MDCSegmentedButtonSegmentFoundation.prototype.setAriaAttr = function (value) {
            if (this.adapter.isSingleSelect()) {
                this.adapter.setAttr(attributes.ARIA_CHECKED, value);
            }
            else {
                this.adapter.setAttr(attributes.ARIA_PRESSED, value);
            }
        };
        return MDCSegmentedButtonSegmentFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/segmented-button/dist/Segment.svelte generated by Svelte v3.46.4 */

    const { Error: Error_1$1 } = globals;
    const file$q = "node_modules/@smui/segmented-button/dist/Segment.svelte";

    // (33:3) {#if ripple}
    function create_if_block_1$8(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-segmented-button__ripple");
    			add_location(div, file$q, 32, 15, 894);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$8.name,
    		type: "if",
    		source: "(33:3) {#if ripple}",
    		ctx
    	});

    	return block;
    }

    // (34:4) {#if touch}
    function create_if_block$h(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-segmented-button__segment__touch");
    			add_location(div, file$q, 33, 15, 964);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$h.name,
    		type: "if",
    		source: "(34:4) {#if touch}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$t(ctx) {
    	let button;
    	let if_block0_anchor;
    	let button_class_value;
    	let button_style_value;
    	let button_role_value;
    	let button_aria_pressed_value;
    	let button_aria_checked_value;
    	let Ripple_action;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	let if_block0 = /*ripple*/ ctx[4] && create_if_block_1$8(ctx);
    	const default_slot_template = /*#slots*/ ctx[23].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[22], null);
    	let if_block1 = /*touch*/ ctx[5] && create_if_block$h(ctx);

    	let button_levels = [
    		{
    			class: button_class_value = classMap({
    				[/*className*/ ctx[2]]: true,
    				'mdc-segmented-button__segment': true,
    				'mdc-segmented-button__segment--touch': /*touch*/ ctx[5],
    				'mdc-segmented-button__segment--selected': /*selected*/ ctx[0],
    				.../*internalClasses*/ ctx[8]
    			})
    		},
    		{
    			style: button_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func$c).concat([/*style*/ ctx[3]]).join(' ')
    		},
    		{
    			role: button_role_value = /*singleSelect*/ ctx[14] ? 'radio' : undefined
    		},
    		{
    			"aria-pressed": button_aria_pressed_value = !/*singleSelect*/ ctx[14]
    			? /*selected*/ ctx[0] ? 'true' : 'false'
    			: undefined
    		},
    		{
    			"aria-checked": button_aria_checked_value = /*singleSelect*/ ctx[14]
    			? /*selected*/ ctx[0] ? 'true' : 'false'
    			: undefined
    		},
    		/*internalAttrs*/ ctx[10],
    		/*$$restProps*/ ctx[19]
    	];

    	let button_data = {};

    	for (let i = 0; i < button_levels.length; i += 1) {
    		button_data = assign$1(button_data, button_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			button = element("button");
    			if (if_block0) if_block0.c();
    			if_block0_anchor = empty$2();
    			if (default_slot) default_slot.c();
    			if (if_block1) if_block1.c();
    			set_attributes(button, button_data);
    			add_location(button, file$q, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error_1$1("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, button, anchor);
    			if (if_block0) if_block0.m(button, null);
    			append_dev(button, if_block0_anchor);

    			if (default_slot) {
    				default_slot.m(button, null);
    			}

    			if (if_block1) if_block1.m(button, null);
    			if (button.autofocus) button.focus();
    			/*button_binding*/ ctx[24](button);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(Ripple_action = Ripple.call(null, button, {
    						ripple: /*ripple*/ ctx[4],
    						unbounded: false,
    						addClass: /*addClass*/ ctx[16],
    						removeClass: /*removeClass*/ ctx[17],
    						addStyle: /*addStyle*/ ctx[18]
    					})),
    					action_destroyer(/*forwardEvents*/ ctx[11].call(null, button)),
    					action_destroyer(useActions_action = useActions.call(null, button, /*use*/ ctx[1])),
    					listen_dev(button, "click", /*click_handler*/ ctx[25], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (/*ripple*/ ctx[4]) {
    				if (if_block0) ; else {
    					if_block0 = create_if_block_1$8(ctx);
    					if_block0.c();
    					if_block0.m(button, if_block0_anchor);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 4194304)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[22],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[22])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[22], dirty, null),
    						null
    					);
    				}
    			}

    			if (/*touch*/ ctx[5]) {
    				if (if_block1) ; else {
    					if_block1 = create_if_block$h(ctx);
    					if_block1.c();
    					if_block1.m(button, null);
    				}
    			} else if (if_block1) {
    				if_block1.d(1);
    				if_block1 = null;
    			}

    			set_attributes(button, button_data = get_spread_update(button_levels, [
    				(!current || dirty[0] & /*className, touch, selected, internalClasses*/ 293 && button_class_value !== (button_class_value = classMap({
    					[/*className*/ ctx[2]]: true,
    					'mdc-segmented-button__segment': true,
    					'mdc-segmented-button__segment--touch': /*touch*/ ctx[5],
    					'mdc-segmented-button__segment--selected': /*selected*/ ctx[0],
    					.../*internalClasses*/ ctx[8]
    				}))) && { class: button_class_value },
    				(!current || dirty[0] & /*internalStyles, style*/ 520 && button_style_value !== (button_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func$c).concat([/*style*/ ctx[3]]).join(' '))) && { style: button_style_value },
    				{ role: button_role_value },
    				(!current || dirty[0] & /*selected*/ 1 && button_aria_pressed_value !== (button_aria_pressed_value = !/*singleSelect*/ ctx[14]
    				? /*selected*/ ctx[0] ? 'true' : 'false'
    				: undefined)) && {
    					"aria-pressed": button_aria_pressed_value
    				},
    				(!current || dirty[0] & /*selected*/ 1 && button_aria_checked_value !== (button_aria_checked_value = /*singleSelect*/ ctx[14]
    				? /*selected*/ ctx[0] ? 'true' : 'false'
    				: undefined)) && {
    					"aria-checked": button_aria_checked_value
    				},
    				dirty[0] & /*internalAttrs*/ 1024 && /*internalAttrs*/ ctx[10],
    				dirty[0] & /*$$restProps*/ 524288 && /*$$restProps*/ ctx[19]
    			]));

    			if (Ripple_action && is_function(Ripple_action.update) && dirty[0] & /*ripple*/ 16) Ripple_action.update.call(null, {
    				ripple: /*ripple*/ ctx[4],
    				unbounded: false,
    				addClass: /*addClass*/ ctx[16],
    				removeClass: /*removeClass*/ ctx[17],
    				addStyle: /*addStyle*/ ctx[18]
    			});

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*use*/ 2) useActions_action.update.call(null, /*use*/ ctx[1]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(button);
    			if (if_block0) if_block0.d();
    			if (default_slot) default_slot.d(detaching);
    			if (if_block1) if_block1.d();
    			/*button_binding*/ ctx[24](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$t.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$c = ([name, value]) => `${name}: ${value};`;

    function instance_1$9($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","style","segment","ripple","touch","selected","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $index;
    	let $singleSelect;
    	let $initialSelectedStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Segment', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());

    	let uninitializedValue = () => {
    		
    	};

    	function isUninitializedValue(value) {
    		return value === uninitializedValue;
    	}

    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { segment: segmentId } = $$props;
    	let { ripple = true } = $$props;
    	let { touch = false } = $$props;
    	const initialSelectedStore = getContext('SMUI:segmented-button:segment:initialSelected');
    	validate_store(initialSelectedStore, 'initialSelectedStore');
    	component_subscribe($$self, initialSelectedStore, value => $$invalidate(28, $initialSelectedStore = value));
    	let { selected = uninitializedValue } = $$props;
    	let manualSelection = !isUninitializedValue(selected);

    	if (isUninitializedValue(selected)) {
    		selected = $initialSelectedStore;
    	}

    	// Done with the trickery.
    	let element;

    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};
    	let internalAttrs = {};
    	const singleSelect = getContext('SMUI:segmented-button:singleSelect');
    	validate_store(singleSelect, 'singleSelect');
    	component_subscribe($$self, singleSelect, value => $$invalidate(27, $singleSelect = value));
    	const index = getContext('SMUI:segmented-button:segment:index');
    	validate_store(index, 'index');
    	component_subscribe($$self, index, value => $$invalidate(26, $index = value));

    	if (!segmentId) {
    		throw new Error('The segment property is required! It should be passed down from the SegmentedButton to the Segment.');
    	}

    	onMount(() => {
    		$$invalidate(6, instance = new MDCSegmentedButtonSegmentFoundation({
    				isSingleSelect: () => {
    					return $singleSelect;
    				},
    				getAttr,
    				setAttr: addAttr,
    				addClass,
    				removeClass,
    				hasClass,
    				notifySelectedChange: value => {
    					$$invalidate(0, selected = value);
    					dispatch$1(getElement(), 'selected', { index: $index, selected, segmentId });
    				},
    				getRootBoundingClientRect: () => {
    					return getElement().getBoundingClientRect();
    				}
    			}));

    		const accessor = {
    			segmentId,
    			get selected() {
    				return selected;
    			},
    			set selected(value) {
    				if (selected !== value) {
    					$$invalidate(0, selected = value);
    				}
    			}
    		};

    		dispatch$1(getElement(), 'SMUISegmentedButtonSegment:mount', accessor);
    		instance.init();

    		return () => {
    			dispatch$1(getElement(), 'SMUISegmentedButtonSegment:unmount', accessor);
    			instance.destroy();
    		};
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(8, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(8, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(10, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(9, internalStyles);
    			} else {
    				$$invalidate(9, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function button_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(7, element);
    		});
    	}

    	const click_handler = event => !event.defaultPrevented && instance && !manualSelection && instance.handleClick();

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(19, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(1, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(3, style = $$new_props.style);
    		if ('segment' in $$new_props) $$invalidate(20, segmentId = $$new_props.segment);
    		if ('ripple' in $$new_props) $$invalidate(4, ripple = $$new_props.ripple);
    		if ('touch' in $$new_props) $$invalidate(5, touch = $$new_props.touch);
    		if ('selected' in $$new_props) $$invalidate(0, selected = $$new_props.selected);
    		if ('$$scope' in $$new_props) $$invalidate(22, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCSegmentedButtonSegmentFoundation,
    		onMount,
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		Ripple,
    		forwardEvents,
    		uninitializedValue,
    		isUninitializedValue,
    		use,
    		className,
    		style,
    		segmentId,
    		ripple,
    		touch,
    		initialSelectedStore,
    		selected,
    		manualSelection,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		singleSelect,
    		index,
    		hasClass,
    		addClass,
    		removeClass,
    		getAttr,
    		addAttr,
    		addStyle,
    		getElement,
    		$index,
    		$singleSelect,
    		$initialSelectedStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('uninitializedValue' in $$props) uninitializedValue = $$new_props.uninitializedValue;
    		if ('use' in $$props) $$invalidate(1, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(2, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(3, style = $$new_props.style);
    		if ('segmentId' in $$props) $$invalidate(20, segmentId = $$new_props.segmentId);
    		if ('ripple' in $$props) $$invalidate(4, ripple = $$new_props.ripple);
    		if ('touch' in $$props) $$invalidate(5, touch = $$new_props.touch);
    		if ('selected' in $$props) $$invalidate(0, selected = $$new_props.selected);
    		if ('manualSelection' in $$props) $$invalidate(13, manualSelection = $$new_props.manualSelection);
    		if ('element' in $$props) $$invalidate(7, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(6, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(8, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(9, internalStyles = $$new_props.internalStyles);
    		if ('internalAttrs' in $$props) $$invalidate(10, internalAttrs = $$new_props.internalAttrs);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*instance, selected*/ 65) {
    			if (instance && instance.isSelected() && !selected) {
    				instance.setUnselected();
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, selected*/ 65) {
    			if (instance && !instance.isSelected() && selected) {
    				instance.setSelected();
    			}
    		}
    	};

    	return [
    		selected,
    		use,
    		className,
    		style,
    		ripple,
    		touch,
    		instance,
    		element,
    		internalClasses,
    		internalStyles,
    		internalAttrs,
    		forwardEvents,
    		initialSelectedStore,
    		manualSelection,
    		singleSelect,
    		index,
    		addClass,
    		removeClass,
    		addStyle,
    		$$restProps,
    		segmentId,
    		getElement,
    		$$scope,
    		slots,
    		button_binding,
    		click_handler
    	];
    }

    class Segment$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$9,
    			create_fragment$t,
    			safe_not_equal,
    			{
    				use: 1,
    				class: 2,
    				style: 3,
    				segment: 20,
    				ripple: 4,
    				touch: 5,
    				selected: 0,
    				getElement: 21
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Segment",
    			options,
    			id: create_fragment$t.name
    		});

    		const { ctx } = this.$$;
    		const props = options.props || {};

    		if (/*segmentId*/ ctx[20] === undefined && !('segment' in props)) {
    			console.warn("<Segment> was created without expected prop 'segment'");
    		}
    	}

    	get use() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get segment() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set segment(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get touch() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set touch(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selected() {
    		throw new Error_1$1("<Segment>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selected(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[21];
    	}

    	set getElement(value) {
    		throw new Error_1$1("<Segment>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Segment = Segment$1;

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$8 = {
        LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
        LABEL_REQUIRED: 'mdc-floating-label--required',
        LABEL_SHAKE: 'mdc-floating-label--shake',
        ROOT: 'mdc-floating-label',
    };

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
        __extends(MDCFloatingLabelFoundation, _super);
        function MDCFloatingLabelFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
            _this.shakeAnimationEndHandler = function () {
                _this.handleShakeAnimationEnd();
            };
            return _this;
        }
        Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
            get: function () {
                return cssClasses$8;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
            /**
             * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    getWidth: function () { return 0; },
                    registerInteractionHandler: function () { return undefined; },
                    deregisterInteractionHandler: function () { return undefined; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        MDCFloatingLabelFoundation.prototype.init = function () {
            this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
        };
        MDCFloatingLabelFoundation.prototype.destroy = function () {
            this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
        };
        /**
         * Returns the width of the label element.
         */
        MDCFloatingLabelFoundation.prototype.getWidth = function () {
            return this.adapter.getWidth();
        };
        /**
         * Styles the label to produce a shake animation to indicate an error.
         * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
         */
        MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
            var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
            if (shouldShake) {
                this.adapter.addClass(LABEL_SHAKE);
            }
            else {
                this.adapter.removeClass(LABEL_SHAKE);
            }
        };
        /**
         * Styles the label to float or dock.
         * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
         */
        MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
            var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;
            if (shouldFloat) {
                this.adapter.addClass(LABEL_FLOAT_ABOVE);
            }
            else {
                this.adapter.removeClass(LABEL_FLOAT_ABOVE);
                this.adapter.removeClass(LABEL_SHAKE);
            }
        };
        /**
         * Styles the label as required.
         * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
         */
        MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
            var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
            if (isRequired) {
                this.adapter.addClass(LABEL_REQUIRED);
            }
            else {
                this.adapter.removeClass(LABEL_REQUIRED);
            }
        };
        MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
            var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
            this.adapter.removeClass(LABEL_SHAKE);
        };
        return MDCFloatingLabelFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$7 = {
        LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
        LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',
    };

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCLineRippleFoundation = /** @class */ (function (_super) {
        __extends(MDCLineRippleFoundation, _super);
        function MDCLineRippleFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
            _this.transitionEndHandler = function (evt) {
                _this.handleTransitionEnd(evt);
            };
            return _this;
        }
        Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
            get: function () {
                return cssClasses$7;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
            /**
             * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    setStyle: function () { return undefined; },
                    registerEventHandler: function () { return undefined; },
                    deregisterEventHandler: function () { return undefined; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        MDCLineRippleFoundation.prototype.init = function () {
            this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
        };
        MDCLineRippleFoundation.prototype.destroy = function () {
            this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
        };
        MDCLineRippleFoundation.prototype.activate = function () {
            this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
            this.adapter.addClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
        };
        MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
            this.adapter.setStyle('transform-origin', xCoordinate + "px center");
        };
        MDCLineRippleFoundation.prototype.deactivate = function () {
            this.adapter.addClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
        };
        MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
            // Wait for the line ripple to be either transparent or opaque
            // before emitting the animation end event
            var isDeactivating = this.adapter.hasClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
            if (evt.propertyName === 'opacity') {
                if (isDeactivating) {
                    this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
                    this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
                }
            }
        };
        return MDCLineRippleFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$6 = {
        ANCHOR: 'mdc-menu-surface--anchor',
        ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
        ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
        FIXED: 'mdc-menu-surface--fixed',
        IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
        OPEN: 'mdc-menu-surface--open',
        ROOT: 'mdc-menu-surface',
    };
    // tslint:disable:object-literal-sort-keys
    var strings$7 = {
        CLOSED_EVENT: 'MDCMenuSurface:closed',
        CLOSING_EVENT: 'MDCMenuSurface:closing',
        OPENED_EVENT: 'MDCMenuSurface:opened',
        FOCUSABLE_ELEMENTS: [
            'button:not(:disabled)',
            '[href]:not([aria-disabled="true"])',
            'input:not(:disabled)',
            'select:not(:disabled)',
            'textarea:not(:disabled)',
            '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])',
        ].join(', '),
    };
    // tslint:enable:object-literal-sort-keys
    var numbers$3 = {
        /** Total duration of menu-surface open animation. */
        TRANSITION_OPEN_DURATION: 120,
        /** Total duration of menu-surface close animation. */
        TRANSITION_CLOSE_DURATION: 75,
        /**
         * Margin left to the edge of the viewport when menu-surface is at maximum
         * possible height. Also used as a viewport margin.
         */
        MARGIN_TO_EDGE: 32,
        /**
         * Ratio of anchor width to menu-surface width for switching from corner
         * positioning to center positioning.
         */
        ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
        /**
         * Amount of time to wait before restoring focus when closing the menu
         * surface. This is important because if a touch event triggered the menu
         * close, and the subsequent mouse event occurs after focus is restored, then
         * the restored focus would be lost.
         */
        TOUCH_EVENT_WAIT_MS: 30,
    };
    /**
     * Enum for bits in the {@see Corner) bitmap.
     */
    var CornerBit;
    (function (CornerBit) {
        CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
        CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
        CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
        CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
    })(CornerBit || (CornerBit = {}));
    /**
     * Enum for representing an element corner for positioning the menu-surface.
     *
     * The START constants map to LEFT if element directionality is left
     * to right and RIGHT if the directionality is right to left.
     * Likewise END maps to RIGHT or LEFT depending on the directionality.
     */
    var Corner;
    (function (Corner) {
        Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
        Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
        Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
        Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
        Corner[Corner["TOP_START"] = 8] = "TOP_START";
        Corner[Corner["TOP_END"] = 12] = "TOP_END";
        Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
        Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
    })(Corner || (Corner = {}));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
        __extends(MDCMenuSurfaceFoundation, _super);
        function MDCMenuSurfaceFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
            _this.isSurfaceOpen = false;
            _this.isQuickOpen = false;
            _this.isHoistedElement = false;
            _this.isFixedPosition = false;
            _this.isHorizontallyCenteredOnViewport = false;
            _this.maxHeight = 0;
            _this.openAnimationEndTimerId = 0;
            _this.closeAnimationEndTimerId = 0;
            _this.animationRequestId = 0;
            _this.anchorCorner = Corner.TOP_START;
            /**
             * Corner of the menu surface to which menu surface is attached to anchor.
             *
             *  Anchor corner --->+----------+
             *                    |  ANCHOR  |
             *                    +----------+
             *  Origin corner --->+--------------+
             *                    |              |
             *                    |              |
             *                    | MENU SURFACE |
             *                    |              |
             *                    |              |
             *                    +--------------+
             */
            _this.originCorner = Corner.TOP_START;
            _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };
            _this.position = { x: 0, y: 0 };
            return _this;
        }
        Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
            get: function () {
                return cssClasses$6;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
            get: function () {
                return strings$7;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
            get: function () {
                return numbers$3;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
            get: function () {
                return Corner;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
            /**
             * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    hasAnchor: function () { return false; },
                    isElementInContainer: function () { return false; },
                    isFocused: function () { return false; },
                    isRtl: function () { return false; },
                    getInnerDimensions: function () { return ({ height: 0, width: 0 }); },
                    getAnchorDimensions: function () { return null; },
                    getWindowDimensions: function () { return ({ height: 0, width: 0 }); },
                    getBodyDimensions: function () { return ({ height: 0, width: 0 }); },
                    getWindowScroll: function () { return ({ x: 0, y: 0 }); },
                    setPosition: function () { return undefined; },
                    setMaxHeight: function () { return undefined; },
                    setTransformOrigin: function () { return undefined; },
                    saveFocus: function () { return undefined; },
                    restoreFocus: function () { return undefined; },
                    notifyClose: function () { return undefined; },
                    notifyOpen: function () { return undefined; },
                    notifyClosing: function () { return undefined; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        MDCMenuSurfaceFoundation.prototype.init = function () {
            var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN;
            if (!this.adapter.hasClass(ROOT)) {
                throw new Error(ROOT + " class required in root element.");
            }
            if (this.adapter.hasClass(OPEN)) {
                this.isSurfaceOpen = true;
            }
        };
        MDCMenuSurfaceFoundation.prototype.destroy = function () {
            clearTimeout(this.openAnimationEndTimerId);
            clearTimeout(this.closeAnimationEndTimerId);
            // Cancel any currently running animations.
            cancelAnimationFrame(this.animationRequestId);
        };
        /**
         * @param corner Default anchor corner alignment of top-left menu surface
         *     corner.
         */
        MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
            this.anchorCorner = corner;
        };
        /**
         * Flip menu corner horizontally.
         */
        MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {
            this.originCorner = this.originCorner ^ CornerBit.RIGHT;
        };
        /**
         * @param margin Set of margin values from anchor.
         */
        MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
            this.anchorMargin.top = margin.top || 0;
            this.anchorMargin.right = margin.right || 0;
            this.anchorMargin.bottom = margin.bottom || 0;
            this.anchorMargin.left = margin.left || 0;
        };
        /** Used to indicate if the menu-surface is hoisted to the body. */
        MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
            this.isHoistedElement = isHoisted;
        };
        /**
         * Used to set the menu-surface calculations based on a fixed position menu.
         */
        MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
            this.isFixedPosition = isFixedPosition;
        };
        /**
         * @return Returns true if menu is in fixed (`position: fixed`) position.
         */
        MDCMenuSurfaceFoundation.prototype.isFixed = function () {
            return this.isFixedPosition;
        };
        /** Sets the menu-surface position on the page. */
        MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
            this.position.x = this.isFinite(x) ? x : 0;
            this.position.y = this.isFinite(y) ? y : 0;
        };
        /** Sets whether menu-surface should be horizontally centered to viewport. */
        MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) {
            this.isHorizontallyCenteredOnViewport = isCentered;
        };
        MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
            this.isQuickOpen = quickOpen;
        };
        /**
         * Sets maximum menu-surface height on open.
         * @param maxHeight The desired max-height. Set to 0 (default) to
         *     automatically calculate max height based on available viewport space.
         */
        MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) {
            this.maxHeight = maxHeight;
        };
        MDCMenuSurfaceFoundation.prototype.isOpen = function () {
            return this.isSurfaceOpen;
        };
        /**
         * Open the menu surface.
         */
        MDCMenuSurfaceFoundation.prototype.open = function () {
            var _this = this;
            if (this.isSurfaceOpen) {
                return;
            }
            this.adapter.saveFocus();
            if (this.isQuickOpen) {
                this.isSurfaceOpen = true;
                this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
                this.dimensions = this.adapter.getInnerDimensions();
                this.autoposition();
                this.adapter.notifyOpen();
            }
            else {
                this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
                this.animationRequestId = requestAnimationFrame(function () {
                    _this.dimensions = _this.adapter.getInnerDimensions();
                    _this.autoposition();
                    _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
                    _this.openAnimationEndTimerId = setTimeout(function () {
                        _this.openAnimationEndTimerId = 0;
                        _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
                        _this.adapter.notifyOpen();
                    }, numbers$3.TRANSITION_OPEN_DURATION);
                });
                this.isSurfaceOpen = true;
            }
        };
        /**
         * Closes the menu surface.
         */
        MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
            var _this = this;
            if (skipRestoreFocus === void 0) { skipRestoreFocus = false; }
            if (!this.isSurfaceOpen) {
                return;
            }
            this.adapter.notifyClosing();
            if (this.isQuickOpen) {
                this.isSurfaceOpen = false;
                if (!skipRestoreFocus) {
                    this.maybeRestoreFocus();
                }
                this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
                this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
                this.adapter.notifyClose();
                return;
            }
            this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
            requestAnimationFrame(function () {
                _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
                _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
                _this.closeAnimationEndTimerId = setTimeout(function () {
                    _this.closeAnimationEndTimerId = 0;
                    _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
                    _this.adapter.notifyClose();
                }, numbers$3.TRANSITION_CLOSE_DURATION);
            });
            this.isSurfaceOpen = false;
            if (!skipRestoreFocus) {
                this.maybeRestoreFocus();
            }
        };
        /** Handle clicks and close if not within menu-surface element. */
        MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
            var el = evt.target;
            if (this.adapter.isElementInContainer(el)) {
                return;
            }
            this.close();
        };
        /** Handle keys that close the surface. */
        MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
            var keyCode = evt.keyCode, key = evt.key;
            var isEscape = key === 'Escape' || keyCode === 27;
            if (isEscape) {
                this.close();
            }
        };
        MDCMenuSurfaceFoundation.prototype.autoposition = function () {
            var _a;
            // Compute measurements for autoposition methods reuse.
            this.measurements = this.getAutoLayoutmeasurements();
            var corner = this.getoriginCorner();
            var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
            var verticalAlignment = this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';
            var horizontalAlignment = this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';
            var horizontalOffset = this.getHorizontalOriginOffset(corner);
            var verticalOffset = this.getVerticalOriginOffset(corner);
            var _b = this.measurements, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize;
            var position = (_a = {},
                _a[horizontalAlignment] = horizontalOffset,
                _a[verticalAlignment] = verticalOffset,
                _a);
            // Center align when anchor width is comparable or greater than menu
            // surface, otherwise keep corner.
            if (anchorSize.width / surfaceSize.width >
                numbers$3.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
                horizontalAlignment = 'center';
            }
            // If the menu-surface has been hoisted to the body, it's no longer relative
            // to the anchor element
            if (this.isHoistedElement || this.isFixedPosition) {
                this.adjustPositionForHoistedElement(position);
            }
            this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
            this.adapter.setPosition(position);
            this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
            // If it is opened from the top then add is-open-below class
            if (!this.hasBit(corner, CornerBit.BOTTOM)) {
                this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
            }
        };
        /**
         * @return Measurements used to position menu surface popup.
         */
        MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {
            var anchorRect = this.adapter.getAnchorDimensions();
            var bodySize = this.adapter.getBodyDimensions();
            var viewportSize = this.adapter.getWindowDimensions();
            var windowScroll = this.adapter.getWindowScroll();
            if (!anchorRect) {
                // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
                anchorRect = {
                    top: this.position.y,
                    right: this.position.x,
                    bottom: this.position.y,
                    left: this.position.x,
                    width: 0,
                    height: 0,
                };
                // tslint:enable:object-literal-sort-keys
            }
            return {
                anchorSize: anchorRect,
                bodySize: bodySize,
                surfaceSize: this.dimensions,
                viewportDistance: {
                    // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
                    top: anchorRect.top,
                    right: viewportSize.width - anchorRect.right,
                    bottom: viewportSize.height - anchorRect.bottom,
                    left: anchorRect.left,
                    // tslint:enable:object-literal-sort-keys
                },
                viewportSize: viewportSize,
                windowScroll: windowScroll,
            };
        };
        /**
         * Computes the corner of the anchor from which to animate and position the
         * menu surface.
         *
         * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL
         * context. E.g., menu surface will be positioned from right side on TOP_END.
         */
        MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {
            var corner = this.originCorner;
            var _a = this.measurements, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize;
            var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
            var isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
            var availableTop;
            var availableBottom;
            if (isAnchoredToBottom) {
                availableTop =
                    viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;
                availableBottom =
                    viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
            }
            else {
                availableTop =
                    viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
                availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE +
                    anchorSize.height - this.anchorMargin.top;
            }
            var isAvailableBottom = availableBottom - surfaceSize.height > 0;
            if (!isAvailableBottom && availableTop > availableBottom) {
                // Attach bottom side of surface to the anchor.
                corner = this.setBit(corner, CornerBit.BOTTOM);
            }
            var isRtl = this.adapter.isRtl();
            var isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);
            var hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) ||
                this.hasBit(corner, CornerBit.RIGHT);
            // Whether surface attached to right side of anchor element.
            var isAnchoredToRight = false;
            // Anchored to start
            if (isRtl && isFlipRtl) {
                isAnchoredToRight = !hasRightBit;
            }
            else {
                // Anchored to right
                isAnchoredToRight = hasRightBit;
            }
            var availableLeft;
            var availableRight;
            if (isAnchoredToRight) {
                availableLeft =
                    viewportDistance.left + anchorSize.width + this.anchorMargin.right;
                availableRight = viewportDistance.right - this.anchorMargin.right;
            }
            else {
                availableLeft = viewportDistance.left + this.anchorMargin.left;
                availableRight =
                    viewportDistance.right + anchorSize.width - this.anchorMargin.left;
            }
            var isAvailableLeft = availableLeft - surfaceSize.width > 0;
            var isAvailableRight = availableRight - surfaceSize.width > 0;
            var isOriginCornerAlignedToEnd = this.hasBit(corner, CornerBit.FLIP_RTL) &&
                this.hasBit(corner, CornerBit.RIGHT);
            if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl ||
                !isAvailableLeft && isOriginCornerAlignedToEnd) {
                // Attach left side of surface to the anchor.
                corner = this.unsetBit(corner, CornerBit.RIGHT);
            }
            else if (isAvailableLeft && isAnchoredToRight && isRtl ||
                (isAvailableLeft && !isAnchoredToRight && hasRightBit) ||
                (!isAvailableRight && availableLeft >= availableRight)) {
                // Attach right side of surface to the anchor.
                corner = this.setBit(corner, CornerBit.RIGHT);
            }
            return corner;
        };
        /**
         * @param corner Origin corner of the menu surface.
         * @return Maximum height of the menu surface, based on available space. 0
         *     indicates should not be set.
         */
        MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
            if (this.maxHeight > 0) {
                return this.maxHeight;
            }
            var viewportDistance = this.measurements.viewportDistance;
            var maxHeight = 0;
            var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
            var isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
            var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
            // When maximum height is not specified, it is handled from CSS.
            if (isBottomAligned) {
                maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
                if (!isBottomAnchored) {
                    maxHeight += this.measurements.anchorSize.height;
                }
            }
            else {
                maxHeight = viewportDistance.bottom - this.anchorMargin.bottom +
                    this.measurements.anchorSize.height - MARGIN_TO_EDGE;
                if (isBottomAnchored) {
                    maxHeight -= this.measurements.anchorSize.height;
                }
            }
            return maxHeight;
        };
        /**
         * @param corner Origin corner of the menu surface.
         * @return Horizontal offset of menu surface origin corner from corresponding
         *     anchor corner.
         */
        MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
            var anchorSize = this.measurements.anchorSize;
            // isRightAligned corresponds to using the 'right' property on the surface.
            var isRightAligned = this.hasBit(corner, CornerBit.RIGHT);
            var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, CornerBit.RIGHT);
            if (isRightAligned) {
                var rightOffset = avoidHorizontalOverlap ?
                    anchorSize.width - this.anchorMargin.left :
                    this.anchorMargin.right;
                // For hoisted or fixed elements, adjust the offset by the difference
                // between viewport width and body width so when we calculate the right
                // value (`adjustPositionForHoistedElement`) based on the element
                // position, the right property is correct.
                if (this.isHoistedElement || this.isFixedPosition) {
                    return rightOffset -
                        (this.measurements.viewportSize.width -
                            this.measurements.bodySize.width);
                }
                return rightOffset;
            }
            return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right :
                this.anchorMargin.left;
        };
        /**
         * @param corner Origin corner of the menu surface.
         * @return Vertical offset of menu surface origin corner from corresponding
         *     anchor corner.
         */
        MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
            var anchorSize = this.measurements.anchorSize;
            var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
            var avoidVerticalOverlap = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
            var y = 0;
            if (isBottomAligned) {
                y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top :
                    -this.anchorMargin.bottom;
            }
            else {
                y = avoidVerticalOverlap ?
                    (anchorSize.height + this.anchorMargin.bottom) :
                    this.anchorMargin.top;
            }
            return y;
        };
        /**
         * Calculates the offsets for positioning the menu-surface when the
         * menu-surface has been hoisted to the body.
         */
        MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
            var e_1, _a;
            var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;
            var props = Object.keys(position);
            try {
                for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
                    var prop = props_1_1.value;
                    var value = position[prop] || 0;
                    if (this.isHorizontallyCenteredOnViewport &&
                        (prop === 'left' || prop === 'right')) {
                        position[prop] = (viewportSize.width - surfaceSize.width) / 2;
                        continue;
                    }
                    // Hoisted surfaces need to have the anchor elements location on the page
                    // added to the position properties for proper alignment on the body.
                    value += viewportDistance[prop];
                    // Surfaces that are absolutely positioned need to have additional
                    // calculations for scroll and bottom positioning.
                    if (!this.isFixedPosition) {
                        if (prop === 'top') {
                            value += windowScroll.y;
                        }
                        else if (prop === 'bottom') {
                            value -= windowScroll.y;
                        }
                        else if (prop === 'left') {
                            value += windowScroll.x;
                        }
                        else { // prop === 'right'
                            value -= windowScroll.x;
                        }
                    }
                    position[prop] = value;
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
                }
                finally { if (e_1) throw e_1.error; }
            }
        };
        /**
         * The last focused element when the menu surface was opened should regain
         * focus, if the user is focused on or within the menu surface when it is
         * closed.
         */
        MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
            var _this = this;
            var isRootFocused = this.adapter.isFocused();
            var childHasFocus = document.activeElement &&
                this.adapter.isElementInContainer(document.activeElement);
            if (isRootFocused || childHasFocus) {
                // Wait before restoring focus when closing the menu surface. This is
                // important because if a touch event triggered the menu close, and the
                // subsequent mouse event occurs after focus is restored, then the
                // restored focus would be lost.
                setTimeout(function () {
                    _this.adapter.restoreFocus();
                }, numbers$3.TOUCH_EVENT_WAIT_MS);
            }
        };
        MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
            return Boolean(corner & bit); // tslint:disable-line:no-bitwise
        };
        MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {
            return corner | bit; // tslint:disable-line:no-bitwise
        };
        MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {
            return corner ^ bit;
        };
        /**
         * isFinite that doesn't force conversion to number type.
         * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
         */
        MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {
            return typeof num === 'number' && isFinite(num);
        };
        return MDCMenuSurfaceFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$5 = {
        MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
        MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
        ROOT: 'mdc-menu',
    };
    var strings$6 = {
        ARIA_CHECKED_ATTR: 'aria-checked',
        ARIA_DISABLED_ATTR: 'aria-disabled',
        CHECKBOX_SELECTOR: 'input[type="checkbox"]',
        LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
        SELECTED_EVENT: 'MDCMenu:selected',
        SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',
    };
    var numbers$2 = {
        FOCUS_ROOT_INDEX: -1,
    };
    var DefaultFocusState;
    (function (DefaultFocusState) {
        DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
        DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
        DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
        DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
    })(DefaultFocusState || (DefaultFocusState = {}));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCMenuFoundation = /** @class */ (function (_super) {
        __extends(MDCMenuFoundation, _super);
        function MDCMenuFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
            _this.closeAnimationEndTimerId = 0;
            _this.defaultFocusState = DefaultFocusState.LIST_ROOT;
            _this.selectedIndex = -1;
            return _this;
        }
        Object.defineProperty(MDCMenuFoundation, "cssClasses", {
            get: function () {
                return cssClasses$5;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuFoundation, "strings", {
            get: function () {
                return strings$6;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuFoundation, "numbers", {
            get: function () {
                return numbers$2;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
            /**
             * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClassToElementAtIndex: function () { return undefined; },
                    removeClassFromElementAtIndex: function () { return undefined; },
                    addAttributeToElementAtIndex: function () { return undefined; },
                    removeAttributeFromElementAtIndex: function () { return undefined; },
                    getAttributeFromElementAtIndex: function () { return null; },
                    elementContainsClass: function () { return false; },
                    closeSurface: function () { return undefined; },
                    getElementIndex: function () { return -1; },
                    notifySelected: function () { return undefined; },
                    getMenuItemCount: function () { return 0; },
                    focusItemAtIndex: function () { return undefined; },
                    focusListRoot: function () { return undefined; },
                    getSelectedSiblingOfItemAtIndex: function () { return -1; },
                    isSelectableItemAtIndex: function () { return false; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        MDCMenuFoundation.prototype.destroy = function () {
            if (this.closeAnimationEndTimerId) {
                clearTimeout(this.closeAnimationEndTimerId);
            }
            this.adapter.closeSurface();
        };
        MDCMenuFoundation.prototype.handleKeydown = function (evt) {
            var key = evt.key, keyCode = evt.keyCode;
            var isTab = key === 'Tab' || keyCode === 9;
            if (isTab) {
                this.adapter.closeSurface(/** skipRestoreFocus */ true);
            }
        };
        MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
            var _this = this;
            var index = this.adapter.getElementIndex(listItem);
            if (index < 0) {
                return;
            }
            this.adapter.notifySelected({ index: index });
            var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$6.SKIP_RESTORE_FOCUS) === 'true';
            this.adapter.closeSurface(skipRestoreFocus);
            // Wait for the menu to close before adding/removing classes that affect styles.
            this.closeAnimationEndTimerId = setTimeout(function () {
                // Recompute the index in case the menu contents have changed.
                var recomputedIndex = _this.adapter.getElementIndex(listItem);
                if (recomputedIndex >= 0 &&
                    _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
                    _this.setSelectedIndex(recomputedIndex);
                }
            }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
        };
        MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
            switch (this.defaultFocusState) {
                case DefaultFocusState.FIRST_ITEM:
                    this.adapter.focusItemAtIndex(0);
                    break;
                case DefaultFocusState.LAST_ITEM:
                    this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
                    break;
                case DefaultFocusState.NONE:
                    // Do nothing.
                    break;
                default:
                    this.adapter.focusListRoot();
                    break;
            }
        };
        /**
         * Sets default focus state where the menu should focus every time when menu
         * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
         * default.
         */
        MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
            this.defaultFocusState = focusState;
        };
        /** @return Index of the currently selected list item within the menu. */
        MDCMenuFoundation.prototype.getSelectedIndex = function () {
            return this.selectedIndex;
        };
        /**
         * Selects the list item at `index` within the menu.
         * @param index Index of list item within the menu.
         */
        MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
            this.validatedIndex(index);
            if (!this.adapter.isSelectableItemAtIndex(index)) {
                throw new Error('MDCMenuFoundation: No selection group at specified index.');
            }
            var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
            if (prevSelectedIndex >= 0) {
                this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$6.ARIA_CHECKED_ATTR);
                this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$5.MENU_SELECTED_LIST_ITEM);
            }
            this.adapter.addClassToElementAtIndex(index, cssClasses$5.MENU_SELECTED_LIST_ITEM);
            this.adapter.addAttributeToElementAtIndex(index, strings$6.ARIA_CHECKED_ATTR, 'true');
            this.selectedIndex = index;
        };
        /**
         * Sets the enabled state to isEnabled for the menu item at the given index.
         * @param index Index of the menu item
         * @param isEnabled The desired enabled state of the menu item.
         */
        MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
            this.validatedIndex(index);
            if (isEnabled) {
                this.adapter.removeClassFromElementAtIndex(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS);
                this.adapter.addAttributeToElementAtIndex(index, strings$6.ARIA_DISABLED_ATTR, 'false');
            }
            else {
                this.adapter.addClassToElementAtIndex(index, cssClasses$c.LIST_ITEM_DISABLED_CLASS);
                this.adapter.addAttributeToElementAtIndex(index, strings$6.ARIA_DISABLED_ATTR, 'true');
            }
        };
        MDCMenuFoundation.prototype.validatedIndex = function (index) {
            var menuSize = this.adapter.getMenuItemCount();
            var isIndexInRange = index >= 0 && index < menuSize;
            if (!isIndexInRange) {
                throw new Error('MDCMenuFoundation: No list item at specified index.');
            }
        };
        return MDCMenuFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var strings$5 = {
        NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',
    };
    var numbers$1 = {
        // This should stay in sync with $mdc-notched-outline-padding * 2.
        NOTCH_ELEMENT_PADDING: 8,
    };
    var cssClasses$4 = {
        NO_LABEL: 'mdc-notched-outline--no-label',
        OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
        OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',
    };

    /**
     * @license
     * Copyright 2017 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCNotchedOutlineFoundation = /** @class */ (function (_super) {
        __extends(MDCNotchedOutlineFoundation, _super);
        function MDCNotchedOutlineFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
            get: function () {
                return strings$5;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
            get: function () {
                return cssClasses$4;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
            get: function () {
                return numbers$1;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
            /**
             * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    setNotchWidthProperty: function () { return undefined; },
                    removeNotchWidthProperty: function () { return undefined; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        /**
         * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
         */
        MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
            var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
            if (notchWidth > 0) {
                notchWidth += numbers$1.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
            }
            this.adapter.setNotchWidthProperty(notchWidth);
            this.adapter.addClass(OUTLINE_NOTCHED);
        };
        /**
         * Removes notched outline selector to close the notch in the outline.
         */
        MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
            var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
            this.adapter.removeClass(OUTLINE_NOTCHED);
            this.adapter.removeNotchWidthProperty();
        };
        return MDCNotchedOutlineFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var cssClasses$3 = {
        ACTIVATED: 'mdc-select--activated',
        DISABLED: 'mdc-select--disabled',
        FOCUSED: 'mdc-select--focused',
        INVALID: 'mdc-select--invalid',
        MENU_INVALID: 'mdc-select__menu--invalid',
        OUTLINED: 'mdc-select--outlined',
        REQUIRED: 'mdc-select--required',
        ROOT: 'mdc-select',
        WITH_LEADING_ICON: 'mdc-select--with-leading-icon',
    };
    var strings$4 = {
        ARIA_CONTROLS: 'aria-controls',
        ARIA_DESCRIBEDBY: 'aria-describedby',
        ARIA_SELECTED_ATTR: 'aria-selected',
        CHANGE_EVENT: 'MDCSelect:change',
        HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]',
        LABEL_SELECTOR: '.mdc-floating-label',
        LEADING_ICON_SELECTOR: '.mdc-select__icon',
        LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
        MENU_SELECTOR: '.mdc-select__menu',
        OUTLINE_SELECTOR: '.mdc-notched-outline',
        SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text',
        SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor',
        VALUE_ATTR: 'data-value',
    };
    var numbers = {
        LABEL_SCALE: 0.75,
        UNSET_INDEX: -1,
        CLICK_DEBOUNCE_TIMEOUT_MS: 330,
    };

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCSelectFoundation = /** @class */ (function (_super) {
        __extends(MDCSelectFoundation, _super);
        /* istanbul ignore next: optional argument is not a branch statement */
        /**
         * @param adapter
         * @param foundationMap Map from subcomponent names to their subfoundations.
         */
        function MDCSelectFoundation(adapter, foundationMap) {
            if (foundationMap === void 0) { foundationMap = {}; }
            var _this = _super.call(this, __assign(__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this;
            // Disabled state
            _this.disabled = false;
            // isMenuOpen is used to track the state of the menu by listening to the
            // MDCMenuSurface:closed event For reference, menu.open will return false if
            // the menu is still closing, but isMenuOpen returns false only after the menu
            // has closed
            _this.isMenuOpen = false;
            // By default, select is invalid if it is required but no value is selected.
            _this.useDefaultValidation = true;
            _this.customValidity = true;
            _this.lastSelectedIndex = numbers.UNSET_INDEX;
            _this.clickDebounceTimeout = 0;
            _this.recentlyClicked = false;
            _this.leadingIcon = foundationMap.leadingIcon;
            _this.helperText = foundationMap.helperText;
            return _this;
        }
        Object.defineProperty(MDCSelectFoundation, "cssClasses", {
            get: function () {
                return cssClasses$3;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCSelectFoundation, "numbers", {
            get: function () {
                return numbers;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCSelectFoundation, "strings", {
            get: function () {
                return strings$4;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
            /**
             * See {@link MDCSelectAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    activateBottomLine: function () { return undefined; },
                    deactivateBottomLine: function () { return undefined; },
                    getSelectedIndex: function () { return -1; },
                    setSelectedIndex: function () { return undefined; },
                    hasLabel: function () { return false; },
                    floatLabel: function () { return undefined; },
                    getLabelWidth: function () { return 0; },
                    setLabelRequired: function () { return undefined; },
                    hasOutline: function () { return false; },
                    notchOutline: function () { return undefined; },
                    closeOutline: function () { return undefined; },
                    setRippleCenter: function () { return undefined; },
                    notifyChange: function () { return undefined; },
                    setSelectedText: function () { return undefined; },
                    isSelectAnchorFocused: function () { return false; },
                    getSelectAnchorAttr: function () { return ''; },
                    setSelectAnchorAttr: function () { return undefined; },
                    removeSelectAnchorAttr: function () { return undefined; },
                    addMenuClass: function () { return undefined; },
                    removeMenuClass: function () { return undefined; },
                    openMenu: function () { return undefined; },
                    closeMenu: function () { return undefined; },
                    getAnchorElement: function () { return null; },
                    setMenuAnchorElement: function () { return undefined; },
                    setMenuAnchorCorner: function () { return undefined; },
                    setMenuWrapFocus: function () { return undefined; },
                    focusMenuItemAtIndex: function () { return undefined; },
                    getMenuItemCount: function () { return 0; },
                    getMenuItemValues: function () { return []; },
                    getMenuItemTextAtIndex: function () { return ''; },
                    isTypeaheadInProgress: function () { return false; },
                    typeaheadMatchItem: function () { return -1; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        /** Returns the index of the currently selected menu item, or -1 if none. */
        MDCSelectFoundation.prototype.getSelectedIndex = function () {
            return this.adapter.getSelectedIndex();
        };
        MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu, skipNotify) {
            if (closeMenu === void 0) { closeMenu = false; }
            if (skipNotify === void 0) { skipNotify = false; }
            if (index >= this.adapter.getMenuItemCount()) {
                return;
            }
            if (index === numbers.UNSET_INDEX) {
                this.adapter.setSelectedText('');
            }
            else {
                this.adapter.setSelectedText(this.adapter.getMenuItemTextAtIndex(index).trim());
            }
            this.adapter.setSelectedIndex(index);
            if (closeMenu) {
                this.adapter.closeMenu();
            }
            if (!skipNotify && this.lastSelectedIndex !== index) {
                this.handleChange();
            }
            this.lastSelectedIndex = index;
        };
        MDCSelectFoundation.prototype.setValue = function (value, skipNotify) {
            if (skipNotify === void 0) { skipNotify = false; }
            var index = this.adapter.getMenuItemValues().indexOf(value);
            this.setSelectedIndex(index, /** closeMenu */ false, skipNotify);
        };
        MDCSelectFoundation.prototype.getValue = function () {
            var index = this.adapter.getSelectedIndex();
            var menuItemValues = this.adapter.getMenuItemValues();
            return index !== numbers.UNSET_INDEX ? menuItemValues[index] : '';
        };
        MDCSelectFoundation.prototype.getDisabled = function () {
            return this.disabled;
        };
        MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
            this.disabled = isDisabled;
            if (this.disabled) {
                this.adapter.addClass(cssClasses$3.DISABLED);
                this.adapter.closeMenu();
            }
            else {
                this.adapter.removeClass(cssClasses$3.DISABLED);
            }
            if (this.leadingIcon) {
                this.leadingIcon.setDisabled(this.disabled);
            }
            if (this.disabled) {
                // Prevent click events from focusing select. Simply pointer-events: none
                // is not enough since screenreader clicks may bypass this.
                this.adapter.removeSelectAnchorAttr('tabindex');
            }
            else {
                this.adapter.setSelectAnchorAttr('tabindex', '0');
            }
            this.adapter.setSelectAnchorAttr('aria-disabled', this.disabled.toString());
        };
        /** Opens the menu. */
        MDCSelectFoundation.prototype.openMenu = function () {
            this.adapter.addClass(cssClasses$3.ACTIVATED);
            this.adapter.openMenu();
            this.isMenuOpen = true;
            this.adapter.setSelectAnchorAttr('aria-expanded', 'true');
        };
        /**
         * @param content Sets the content of the helper text.
         */
        MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
            if (this.helperText) {
                this.helperText.setContent(content);
            }
        };
        /**
         * Re-calculates if the notched outline should be notched and if the label
         * should float.
         */
        MDCSelectFoundation.prototype.layout = function () {
            if (this.adapter.hasLabel()) {
                var optionHasValue = this.getValue().length > 0;
                var isFocused = this.adapter.hasClass(cssClasses$3.FOCUSED);
                var shouldFloatAndNotch = optionHasValue || isFocused;
                var isRequired = this.adapter.hasClass(cssClasses$3.REQUIRED);
                this.notchOutline(shouldFloatAndNotch);
                this.adapter.floatLabel(shouldFloatAndNotch);
                this.adapter.setLabelRequired(isRequired);
            }
        };
        /**
         * Synchronizes the list of options with the state of the foundation. Call
         * this whenever menu options are dynamically updated.
         */
        MDCSelectFoundation.prototype.layoutOptions = function () {
            var menuItemValues = this.adapter.getMenuItemValues();
            var selectedIndex = menuItemValues.indexOf(this.getValue());
            this.setSelectedIndex(selectedIndex, /** closeMenu */ false, /** skipNotify */ true);
        };
        MDCSelectFoundation.prototype.handleMenuOpened = function () {
            if (this.adapter.getMenuItemValues().length === 0) {
                return;
            }
            // Menu should open to the last selected element, should open to first menu item otherwise.
            var selectedIndex = this.getSelectedIndex();
            var focusItemIndex = selectedIndex >= 0 ? selectedIndex : 0;
            this.adapter.focusMenuItemAtIndex(focusItemIndex);
        };
        MDCSelectFoundation.prototype.handleMenuClosing = function () {
            this.adapter.setSelectAnchorAttr('aria-expanded', 'false');
        };
        MDCSelectFoundation.prototype.handleMenuClosed = function () {
            this.adapter.removeClass(cssClasses$3.ACTIVATED);
            this.isMenuOpen = false;
            // Unfocus the select if menu is closed without a selection
            if (!this.adapter.isSelectAnchorFocused()) {
                this.blur();
            }
        };
        /**
         * Handles value changes, via change event or programmatic updates.
         */
        MDCSelectFoundation.prototype.handleChange = function () {
            this.layout();
            this.adapter.notifyChange(this.getValue());
            var isRequired = this.adapter.hasClass(cssClasses$3.REQUIRED);
            if (isRequired && this.useDefaultValidation) {
                this.setValid(this.isValid());
            }
        };
        MDCSelectFoundation.prototype.handleMenuItemAction = function (index) {
            this.setSelectedIndex(index, /** closeMenu */ true);
        };
        /**
         * Handles focus events from select element.
         */
        MDCSelectFoundation.prototype.handleFocus = function () {
            this.adapter.addClass(cssClasses$3.FOCUSED);
            this.layout();
            this.adapter.activateBottomLine();
        };
        /**
         * Handles blur events from select element.
         */
        MDCSelectFoundation.prototype.handleBlur = function () {
            if (this.isMenuOpen) {
                return;
            }
            this.blur();
        };
        MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
            if (this.disabled || this.recentlyClicked) {
                return;
            }
            this.setClickDebounceTimeout();
            if (this.isMenuOpen) {
                this.adapter.closeMenu();
                return;
            }
            this.adapter.setRippleCenter(normalizedX);
            this.openMenu();
        };
        /**
         * Handles keydown events on select element. Depending on the type of
         * character typed, does typeahead matching or opens menu.
         */
        MDCSelectFoundation.prototype.handleKeydown = function (event) {
            if (this.isMenuOpen || !this.adapter.hasClass(cssClasses$3.FOCUSED)) {
                return;
            }
            var isEnter = normalizeKey(event) === KEY.ENTER;
            var isSpace = normalizeKey(event) === KEY.SPACEBAR;
            var arrowUp = normalizeKey(event) === KEY.ARROW_UP;
            var arrowDown = normalizeKey(event) === KEY.ARROW_DOWN;
            var isModifier = event.ctrlKey || event.metaKey;
            // Typeahead
            if (!isModifier &&
                (!isSpace && event.key && event.key.length === 1 ||
                    isSpace && this.adapter.isTypeaheadInProgress())) {
                var key = isSpace ? ' ' : event.key;
                var typeaheadNextIndex = this.adapter.typeaheadMatchItem(key, this.getSelectedIndex());
                if (typeaheadNextIndex >= 0) {
                    this.setSelectedIndex(typeaheadNextIndex);
                }
                event.preventDefault();
                return;
            }
            if (!isEnter && !isSpace && !arrowUp && !arrowDown) {
                return;
            }
            // Increment/decrement index as necessary and open menu.
            if (arrowUp && this.getSelectedIndex() > 0) {
                this.setSelectedIndex(this.getSelectedIndex() - 1);
            }
            else if (arrowDown &&
                this.getSelectedIndex() < this.adapter.getMenuItemCount() - 1) {
                this.setSelectedIndex(this.getSelectedIndex() + 1);
            }
            this.openMenu();
            event.preventDefault();
        };
        /**
         * Opens/closes the notched outline.
         */
        MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
            if (!this.adapter.hasOutline()) {
                return;
            }
            var isFocused = this.adapter.hasClass(cssClasses$3.FOCUSED);
            if (openNotch) {
                var labelScale = numbers.LABEL_SCALE;
                var labelWidth = this.adapter.getLabelWidth() * labelScale;
                this.adapter.notchOutline(labelWidth);
            }
            else if (!isFocused) {
                this.adapter.closeOutline();
            }
        };
        /**
         * Sets the aria label of the leading icon.
         */
        MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
            if (this.leadingIcon) {
                this.leadingIcon.setAriaLabel(label);
            }
        };
        /**
         * Sets the text content of the leading icon.
         */
        MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
            if (this.leadingIcon) {
                this.leadingIcon.setContent(content);
            }
        };
        MDCSelectFoundation.prototype.getUseDefaultValidation = function () {
            return this.useDefaultValidation;
        };
        MDCSelectFoundation.prototype.setUseDefaultValidation = function (useDefaultValidation) {
            this.useDefaultValidation = useDefaultValidation;
        };
        MDCSelectFoundation.prototype.setValid = function (isValid) {
            if (!this.useDefaultValidation) {
                this.customValidity = isValid;
            }
            this.adapter.setSelectAnchorAttr('aria-invalid', (!isValid).toString());
            if (isValid) {
                this.adapter.removeClass(cssClasses$3.INVALID);
                this.adapter.removeMenuClass(cssClasses$3.MENU_INVALID);
            }
            else {
                this.adapter.addClass(cssClasses$3.INVALID);
                this.adapter.addMenuClass(cssClasses$3.MENU_INVALID);
            }
            this.syncHelperTextValidity(isValid);
        };
        MDCSelectFoundation.prototype.isValid = function () {
            if (this.useDefaultValidation &&
                this.adapter.hasClass(cssClasses$3.REQUIRED) &&
                !this.adapter.hasClass(cssClasses$3.DISABLED)) {
                // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element
                // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value.
                return this.getSelectedIndex() !== numbers.UNSET_INDEX &&
                    (this.getSelectedIndex() !== 0 || Boolean(this.getValue()));
            }
            return this.customValidity;
        };
        MDCSelectFoundation.prototype.setRequired = function (isRequired) {
            if (isRequired) {
                this.adapter.addClass(cssClasses$3.REQUIRED);
            }
            else {
                this.adapter.removeClass(cssClasses$3.REQUIRED);
            }
            this.adapter.setSelectAnchorAttr('aria-required', isRequired.toString());
            this.adapter.setLabelRequired(isRequired);
        };
        MDCSelectFoundation.prototype.getRequired = function () {
            return this.adapter.getSelectAnchorAttr('aria-required') === 'true';
        };
        MDCSelectFoundation.prototype.init = function () {
            var anchorEl = this.adapter.getAnchorElement();
            if (anchorEl) {
                this.adapter.setMenuAnchorElement(anchorEl);
                this.adapter.setMenuAnchorCorner(Corner.BOTTOM_START);
            }
            this.adapter.setMenuWrapFocus(false);
            this.setDisabled(this.adapter.hasClass(cssClasses$3.DISABLED));
            this.syncHelperTextValidity(!this.adapter.hasClass(cssClasses$3.INVALID));
            this.layout();
            this.layoutOptions();
        };
        /**
         * Unfocuses the select component.
         */
        MDCSelectFoundation.prototype.blur = function () {
            this.adapter.removeClass(cssClasses$3.FOCUSED);
            this.layout();
            this.adapter.deactivateBottomLine();
            var isRequired = this.adapter.hasClass(cssClasses$3.REQUIRED);
            if (isRequired && this.useDefaultValidation) {
                this.setValid(this.isValid());
            }
        };
        MDCSelectFoundation.prototype.syncHelperTextValidity = function (isValid) {
            if (!this.helperText) {
                return;
            }
            this.helperText.setValidity(isValid);
            var helperTextVisible = this.helperText.isVisible();
            var helperTextId = this.helperText.getId();
            if (helperTextVisible && helperTextId) {
                this.adapter.setSelectAnchorAttr(strings$4.ARIA_DESCRIBEDBY, helperTextId);
            }
            else {
                // Needed because screenreaders will read labels pointed to by
                // `aria-describedby` even if they are `aria-hidden`.
                this.adapter.removeSelectAnchorAttr(strings$4.ARIA_DESCRIBEDBY);
            }
        };
        MDCSelectFoundation.prototype.setClickDebounceTimeout = function () {
            var _this = this;
            clearTimeout(this.clickDebounceTimeout);
            this.clickDebounceTimeout = setTimeout(function () {
                _this.recentlyClicked = false;
            }, numbers.CLICK_DEBOUNCE_TIMEOUT_MS);
            this.recentlyClicked = true;
        };
        return MDCSelectFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var strings$3 = {
        ARIA_HIDDEN: 'aria-hidden',
        ROLE: 'role',
    };
    var cssClasses$2 = {
        HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg',
        HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent',
    };

    /**
     * @license
     * Copyright 2018 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCSelectHelperTextFoundation = /** @class */ (function (_super) {
        __extends(MDCSelectHelperTextFoundation, _super);
        function MDCSelectHelperTextFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
            get: function () {
                return cssClasses$2;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
            get: function () {
                return strings$3;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
            /**
             * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.
             */
            get: function () {
                // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
                return {
                    addClass: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    hasClass: function () { return false; },
                    setAttr: function () { return undefined; },
                    getAttr: function () { return null; },
                    removeAttr: function () { return undefined; },
                    setContent: function () { return undefined; },
                };
                // tslint:enable:object-literal-sort-keys
            },
            enumerable: false,
            configurable: true
        });
        /**
         * @return The ID of the helper text, or null if none is set.
         */
        MDCSelectHelperTextFoundation.prototype.getId = function () {
            return this.adapter.getAttr('id');
        };
        /**
         * @return Whether the helper text is currently visible.
         */
        MDCSelectHelperTextFoundation.prototype.isVisible = function () {
            return this.adapter.getAttr(strings$3.ARIA_HIDDEN) !== 'true';
        };
        /**
         * Sets the content of the helper text field.
         */
        MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
            this.adapter.setContent(content);
        };
        /**
         * Sets the helper text to act as a validation message.
         * By default, validation messages are hidden when the select is valid and
         * visible when the select is invalid.
         *
         * @param isValidation True to make the helper text act as an error validation
         *     message.
         */
        MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
            if (isValidation) {
                this.adapter.addClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
            }
            else {
                this.adapter.removeClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
            }
        };
        /**
         * Sets the persistency of the validation helper text.
         * This keeps the validation message visible even if the select is valid,
         * though it will be displayed in the normal (grey) color.
         */
        MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) {
            if (isPersistent) {
                this.adapter.addClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
            }
            else {
                this.adapter.removeClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
            }
        };
        /**
         * When acting as a validation message, shows/hides the helper text and
         * triggers alerts as necessary based on the select's validity.
         */
        MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
            var isValidationMsg = this.adapter.hasClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
            if (!isValidationMsg) {
                // Non-validating helper-text is always displayed and does not participate
                // in validation logic.
                return;
            }
            var isPersistentValidationMsg = this.adapter.hasClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
            // Validating helper text is displayed if select is invalid, unless it is
            // set as persistent, in which case it always displays.
            var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg;
            if (msgShouldDisplay) {
                this.showToScreenReader();
                // In addition to displaying, also trigger an alert if the select
                // has become invalid.
                if (!selectIsValid) {
                    this.adapter.setAttr(strings$3.ROLE, 'alert');
                }
                else {
                    this.adapter.removeAttr(strings$3.ROLE);
                }
                return;
            }
            // Hide everything.
            this.adapter.removeAttr(strings$3.ROLE);
            this.hide();
        };
        /**
         * Makes the helper text visible to screen readers.
         */
        MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
            this.adapter.removeAttr(strings$3.ARIA_HIDDEN);
        };
        /**
         * Hides the help text from screen readers.
         */
        MDCSelectHelperTextFoundation.prototype.hide = function () {
            this.adapter.setAttr(strings$3.ARIA_HIDDEN, 'true');
        };
        return MDCSelectHelperTextFoundation;
    }(MDCFoundation));

    /* node_modules/@smui/menu-surface/dist/MenuSurface.svelte generated by Svelte v3.46.4 */

    const { document: document_1 } = globals;
    const file$p = "node_modules/@smui/menu-surface/dist/MenuSurface.svelte";

    function create_fragment$s(ctx) {
    	let t;
    	let div;
    	let div_class_value;
    	let div_style_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[31].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[30], null);

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[2]]: true,
    				'mdc-menu-surface': true,
    				'mdc-menu-surface--fixed': /*fixed*/ ctx[5],
    				'mdc-menu-surface--open': /*isStatic*/ ctx[4],
    				'smui-menu-surface--static': /*isStatic*/ ctx[4],
    				'mdc-menu-surface--fullwidth': /*fullWidth*/ ctx[7],
    				.../*internalClasses*/ ctx[10]
    			})
    		},
    		{
    			style: div_style_value = Object.entries(/*internalStyles*/ ctx[11]).map(func$b).concat([/*style*/ ctx[3]]).join(' ')
    		},
    		/*$$restProps*/ ctx[13]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			t = space();
    			div = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div, div_data);
    			add_location(div, file$p, 4, 0, 117);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[33](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					listen_dev(document_1.body, "click", /*click_handler*/ ctx[32], true, false, false),
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[1])),
    					action_destroyer(/*forwardEvents*/ ctx[12].call(null, div)),
    					listen_dev(div, "keydown", /*keydown_handler*/ ctx[34], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 1073741824)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[30],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[30])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[30], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty[0] & /*className, fixed, isStatic, fullWidth, internalClasses*/ 1204 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[2]]: true,
    					'mdc-menu-surface': true,
    					'mdc-menu-surface--fixed': /*fixed*/ ctx[5],
    					'mdc-menu-surface--open': /*isStatic*/ ctx[4],
    					'smui-menu-surface--static': /*isStatic*/ ctx[4],
    					'mdc-menu-surface--fullwidth': /*fullWidth*/ ctx[7],
    					.../*internalClasses*/ ctx[10]
    				}))) && { class: div_class_value },
    				(!current || dirty[0] & /*internalStyles, style*/ 2056 && div_style_value !== (div_style_value = Object.entries(/*internalStyles*/ ctx[11]).map(func$b).concat([/*style*/ ctx[3]]).join(' '))) && { style: div_style_value },
    				dirty[0] & /*$$restProps*/ 8192 && /*$$restProps*/ ctx[13]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*use*/ 2) useActions_action.update.call(null, /*use*/ ctx[1]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[33](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$s.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$b = ([name, value]) => `${name}: ${value};`;

    function instance_1$8($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","static","anchor","fixed","open","managed","fullWidth","quickOpen","anchorElement","anchorCorner","anchorMargin","maxHeight","horizontallyCenteredOnViewport","isOpen","setOpen","setAbsolutePosition","setIsHoisted","isFixed","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('MenuSurface', slots, ['default']);
    	var _a, _b, _c;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { static: isStatic = false } = $$props;
    	let { anchor = true } = $$props;
    	let { fixed = false } = $$props;
    	let { open = isStatic } = $$props;
    	let { managed = false } = $$props;
    	let { fullWidth = false } = $$props;
    	let { quickOpen = false } = $$props;
    	let { anchorElement = undefined } = $$props;
    	let { anchorCorner = undefined } = $$props;
    	let { anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 } } = $$props;
    	let { maxHeight = 0 } = $$props;
    	let { horizontallyCenteredOnViewport = false } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};
    	let previousFocus = undefined;
    	setContext('SMUI:list:role', 'menu');
    	setContext('SMUI:list:item:role', 'menuitem');
    	const iCorner = Corner;

    	onMount(() => {
    		$$invalidate(9, instance = new MDCMenuSurfaceFoundation({
    				addClass,
    				removeClass,
    				hasClass,
    				hasAnchor: () => !!anchorElement,
    				notifyClose: () => {
    					if (!managed) {
    						$$invalidate(0, open = isStatic);
    					}

    					if (!open) {
    						dispatch$1(element, 'SMUIMenuSurface:closed', undefined, undefined, true);
    					}
    				},
    				notifyClosing: () => {
    					if (!managed) {
    						$$invalidate(0, open = isStatic);
    					}

    					if (!open) {
    						dispatch$1(element, 'SMUIMenuSurface:closing', undefined, undefined, true);
    					}
    				},
    				notifyOpen: () => {
    					if (!managed) {
    						$$invalidate(0, open = true);
    					}

    					if (open) {
    						dispatch$1(element, 'SMUIMenuSurface:opened', undefined, undefined, true);
    					}
    				},
    				isElementInContainer: el => element.contains(el),
    				isRtl: () => getComputedStyle(element).getPropertyValue('direction') === 'rtl',
    				setTransformOrigin: origin => {
    					$$invalidate(11, internalStyles['transform-origin'] = origin, internalStyles);
    				},
    				isFocused: () => document.activeElement === element,
    				saveFocus: () => {
    					var _a;

    					previousFocus = (_a = document.activeElement) !== null && _a !== void 0
    					? _a
    					: undefined;
    				},
    				restoreFocus: () => {
    					if (element.contains(document.activeElement) && previousFocus && 'focus' in previousFocus) {
    						previousFocus.focus();
    					}
    				},
    				getInnerDimensions: () => {
    					return {
    						width: element.offsetWidth,
    						height: element.offsetHeight
    					};
    				},
    				getAnchorDimensions: () => anchorElement
    				? anchorElement.getBoundingClientRect()
    				: null,
    				getWindowDimensions: () => {
    					return {
    						width: window.innerWidth,
    						height: window.innerHeight
    					};
    				},
    				getBodyDimensions: () => {
    					return {
    						width: document.body.clientWidth,
    						height: document.body.clientHeight
    					};
    				},
    				getWindowScroll: () => {
    					return {
    						x: window.pageXOffset,
    						y: window.pageYOffset
    					};
    				},
    				setPosition: position => {
    					$$invalidate(11, internalStyles.left = 'left' in position ? `${position.left}px` : '', internalStyles);
    					$$invalidate(11, internalStyles.right = 'right' in position ? `${position.right}px` : '', internalStyles);
    					$$invalidate(11, internalStyles.top = 'top' in position ? `${position.top}px` : '', internalStyles);
    					$$invalidate(11, internalStyles.bottom = 'bottom' in position ? `${position.bottom}px` : '', internalStyles);
    				},
    				setMaxHeight: height => {
    					$$invalidate(11, internalStyles.maxHeight = height, internalStyles);
    				}
    			}));

    		const accessor = {
    			get open() {
    				return open;
    			},
    			set open(value) {
    				$$invalidate(0, open = value);
    			},
    			closeProgrammatic
    		};

    		dispatch$1(element, 'SMUIMenuSurface:mount', accessor);
    		instance.init();

    		return () => {
    			var _a;
    			const isHoisted = instance.isHoistedElement;
    			instance.destroy();

    			if (isHoisted) {
    				(_a = element.parentNode) === null || _a === void 0
    				? void 0
    				: _a.removeChild(element);
    			}
    		};
    	});

    	onDestroy(() => {
    		var _a;

    		if (anchor) {
    			element && ((_a = element.parentElement) === null || _a === void 0
    			? void 0
    			: _a.classList.remove('mdc-menu-surface--anchor'));
    		}
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(10, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(10, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function closeProgrammatic(skipRestoreFocus) {
    		instance.close(skipRestoreFocus);
    		$$invalidate(0, open = false);
    	}

    	function isOpen() {
    		return open;
    	}

    	function setOpen(value) {
    		$$invalidate(0, open = value);
    	}

    	function setAbsolutePosition(x, y) {
    		return instance.setAbsolutePosition(x, y);
    	}

    	function setIsHoisted(isHoisted) {
    		return instance.setIsHoisted(isHoisted);
    	}

    	function isFixed() {
    		return instance.isFixed();
    	}

    	function getElement() {
    		return element;
    	}

    	const click_handler = event => instance && open && !managed && instance.handleBodyClick(event);

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(8, element);
    		});
    	}

    	const keydown_handler = event => instance && instance.handleKeydown(event);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(13, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(1, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(3, style = $$new_props.style);
    		if ('static' in $$new_props) $$invalidate(4, isStatic = $$new_props.static);
    		if ('anchor' in $$new_props) $$invalidate(15, anchor = $$new_props.anchor);
    		if ('fixed' in $$new_props) $$invalidate(5, fixed = $$new_props.fixed);
    		if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open);
    		if ('managed' in $$new_props) $$invalidate(6, managed = $$new_props.managed);
    		if ('fullWidth' in $$new_props) $$invalidate(7, fullWidth = $$new_props.fullWidth);
    		if ('quickOpen' in $$new_props) $$invalidate(16, quickOpen = $$new_props.quickOpen);
    		if ('anchorElement' in $$new_props) $$invalidate(14, anchorElement = $$new_props.anchorElement);
    		if ('anchorCorner' in $$new_props) $$invalidate(17, anchorCorner = $$new_props.anchorCorner);
    		if ('anchorMargin' in $$new_props) $$invalidate(18, anchorMargin = $$new_props.anchorMargin);
    		if ('maxHeight' in $$new_props) $$invalidate(19, maxHeight = $$new_props.maxHeight);
    		if ('horizontallyCenteredOnViewport' in $$new_props) $$invalidate(20, horizontallyCenteredOnViewport = $$new_props.horizontallyCenteredOnViewport);
    		if ('$$scope' in $$new_props) $$invalidate(30, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		_a,
    		_b,
    		_c,
    		MDCMenuSurfaceFoundation,
    		onMount,
    		onDestroy,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		Corner,
    		forwardEvents,
    		use,
    		className,
    		style,
    		isStatic,
    		anchor,
    		fixed,
    		open,
    		managed,
    		fullWidth,
    		quickOpen,
    		anchorElement,
    		anchorCorner,
    		anchorMargin,
    		maxHeight,
    		horizontallyCenteredOnViewport,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		previousFocus,
    		iCorner,
    		hasClass,
    		addClass,
    		removeClass,
    		closeProgrammatic,
    		isOpen,
    		setOpen,
    		setAbsolutePosition,
    		setIsHoisted,
    		isFixed,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('_a' in $$props) $$invalidate(27, _a = $$new_props._a);
    		if ('_b' in $$props) $$invalidate(28, _b = $$new_props._b);
    		if ('_c' in $$props) $$invalidate(29, _c = $$new_props._c);
    		if ('use' in $$props) $$invalidate(1, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(2, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(3, style = $$new_props.style);
    		if ('isStatic' in $$props) $$invalidate(4, isStatic = $$new_props.isStatic);
    		if ('anchor' in $$props) $$invalidate(15, anchor = $$new_props.anchor);
    		if ('fixed' in $$props) $$invalidate(5, fixed = $$new_props.fixed);
    		if ('open' in $$props) $$invalidate(0, open = $$new_props.open);
    		if ('managed' in $$props) $$invalidate(6, managed = $$new_props.managed);
    		if ('fullWidth' in $$props) $$invalidate(7, fullWidth = $$new_props.fullWidth);
    		if ('quickOpen' in $$props) $$invalidate(16, quickOpen = $$new_props.quickOpen);
    		if ('anchorElement' in $$props) $$invalidate(14, anchorElement = $$new_props.anchorElement);
    		if ('anchorCorner' in $$props) $$invalidate(17, anchorCorner = $$new_props.anchorCorner);
    		if ('anchorMargin' in $$props) $$invalidate(18, anchorMargin = $$new_props.anchorMargin);
    		if ('maxHeight' in $$props) $$invalidate(19, maxHeight = $$new_props.maxHeight);
    		if ('horizontallyCenteredOnViewport' in $$props) $$invalidate(20, horizontallyCenteredOnViewport = $$new_props.horizontallyCenteredOnViewport);
    		if ('element' in $$props) $$invalidate(8, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(9, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(10, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(11, internalStyles = $$new_props.internalStyles);
    		if ('previousFocus' in $$props) previousFocus = $$new_props.previousFocus;
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*element, anchor, _a, _b, _c*/ 939557120) {
    			if (element && anchor && !($$invalidate(27, _a = element.parentElement) === null || _a === void 0
    			? void 0
    			: _a.classList.contains('mdc-menu-surface--anchor'))) {
    				$$invalidate(28, _b = element.parentElement) === null || _b === void 0
    				? void 0
    				: _b.classList.add('mdc-menu-surface--anchor');

    				$$invalidate(14, anchorElement = $$invalidate(29, _c = element.parentElement) !== null && _c !== void 0
    				? _c
    				: undefined);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, open*/ 513) {
    			if (instance && instance.isOpen() !== open) {
    				if (open) {
    					instance.open();
    				} else {
    					instance.close();
    				}
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, quickOpen*/ 66048) {
    			if (instance) {
    				instance.setQuickOpen(quickOpen);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, fixed*/ 544) {
    			if (instance) {
    				instance.setFixedPosition(fixed);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, maxHeight*/ 524800) {
    			if (instance && maxHeight > 0) {
    				instance.setMaxHeight(maxHeight);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, horizontallyCenteredOnViewport*/ 1049088) {
    			if (instance) {
    				instance.setIsHorizontallyCenteredOnViewport(horizontallyCenteredOnViewport);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, anchorCorner*/ 131584) {
    			if (instance && anchorCorner != null) {
    				if (typeof anchorCorner === 'string') {
    					instance.setAnchorCorner(iCorner[anchorCorner]);
    				} else {
    					instance.setAnchorCorner(anchorCorner);
    				}
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, anchorMargin*/ 262656) {
    			if (instance) {
    				instance.setAnchorMargin(anchorMargin);
    			}
    		}
    	};

    	return [
    		open,
    		use,
    		className,
    		style,
    		isStatic,
    		fixed,
    		managed,
    		fullWidth,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		forwardEvents,
    		$$restProps,
    		anchorElement,
    		anchor,
    		quickOpen,
    		anchorCorner,
    		anchorMargin,
    		maxHeight,
    		horizontallyCenteredOnViewport,
    		isOpen,
    		setOpen,
    		setAbsolutePosition,
    		setIsHoisted,
    		isFixed,
    		getElement,
    		_a,
    		_b,
    		_c,
    		$$scope,
    		slots,
    		click_handler,
    		div_binding,
    		keydown_handler
    	];
    }

    class MenuSurface extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$8,
    			create_fragment$s,
    			safe_not_equal,
    			{
    				use: 1,
    				class: 2,
    				style: 3,
    				static: 4,
    				anchor: 15,
    				fixed: 5,
    				open: 0,
    				managed: 6,
    				fullWidth: 7,
    				quickOpen: 16,
    				anchorElement: 14,
    				anchorCorner: 17,
    				anchorMargin: 18,
    				maxHeight: 19,
    				horizontallyCenteredOnViewport: 20,
    				isOpen: 21,
    				setOpen: 22,
    				setAbsolutePosition: 23,
    				setIsHoisted: 24,
    				isFixed: 25,
    				getElement: 26
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "MenuSurface",
    			options,
    			id: create_fragment$s.name
    		});
    	}

    	get use() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get static() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set static(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchor() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchor(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get fixed() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set fixed(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get open() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set open(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get managed() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set managed(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get fullWidth() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set fullWidth(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get quickOpen() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set quickOpen(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchorElement() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchorElement(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchorCorner() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchorCorner(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchorMargin() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchorMargin(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get maxHeight() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set maxHeight(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get horizontallyCenteredOnViewport() {
    		throw new Error("<MenuSurface>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set horizontallyCenteredOnViewport(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get isOpen() {
    		return this.$$.ctx[21];
    	}

    	set isOpen(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setOpen() {
    		return this.$$.ctx[22];
    	}

    	set setOpen(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setAbsolutePosition() {
    		return this.$$.ctx[23];
    	}

    	set setAbsolutePosition(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setIsHoisted() {
    		return this.$$.ctx[24];
    	}

    	set setIsHoisted(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get isFixed() {
    		return this.$$.ctx[25];
    	}

    	set isFixed(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[26];
    	}

    	set getElement(value) {
    		throw new Error("<MenuSurface>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    function Anchor(node, { addClass = (className) => node.classList.add(className), removeClass = (className) => node.classList.remove(className), } = {}) {
        addClass('mdc-menu-surface--anchor');
        return {
            destroy() {
                removeClass('mdc-menu-surface--anchor');
            },
        };
    }

    /* node_modules/@smui/menu/dist/Menu.svelte generated by Svelte v3.46.4 */

    // (1:0) <MenuSurface   bind:this={element}   use={usePass}   class={classMap({     [className]: true,     'mdc-menu': true,   })}   bind:open   on:SMUIMenuSurface:mount={handleMenuSurfaceAccessor}   on:SMUIList:mount={handleListAccessor}   on:SMUIMenuSurface:opened={() =>     instance && instance.handleMenuSurfaceOpened()}   on:keydown={handleKeydown}   on:SMUIList:action={(event) =>     instance &&     instance.handleItemAction(       listAccessor.getOrderedList()[event.detail.index].element     )}   {...$$restProps}>
    function create_default_slot$c(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[16].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$c.name,
    		type: "slot",
    		source: "(1:0) <MenuSurface   bind:this={element}   use={usePass}   class={classMap({     [className]: true,     'mdc-menu': true,   })}   bind:open   on:SMUIMenuSurface:mount={handleMenuSurfaceAccessor}   on:SMUIList:mount={handleListAccessor}   on:SMUIMenuSurface:opened={() =>     instance && instance.handleMenuSurfaceOpened()}   on:keydown={handleKeydown}   on:SMUIList:action={(event) =>     instance &&     instance.handleItemAction(       listAccessor.getOrderedList()[event.detail.index].element     )}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$r(ctx) {
    	let menusurface;
    	let updating_open;
    	let current;

    	const menusurface_spread_levels = [
    		{ use: /*usePass*/ ctx[5] },
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-menu': true
    			})
    		},
    		/*$$restProps*/ ctx[9]
    	];

    	function menusurface_open_binding(value) {
    		/*menusurface_open_binding*/ ctx[18](value);
    	}

    	let menusurface_props = {
    		$$slots: { default: [create_default_slot$c] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < menusurface_spread_levels.length; i += 1) {
    		menusurface_props = assign$1(menusurface_props, menusurface_spread_levels[i]);
    	}

    	if (/*open*/ ctx[0] !== void 0) {
    		menusurface_props.open = /*open*/ ctx[0];
    	}

    	menusurface = new MenuSurface({ props: menusurface_props, $$inline: true });
    	/*menusurface_binding*/ ctx[17](menusurface);
    	binding_callbacks.push(() => bind(menusurface, 'open', menusurface_open_binding));
    	menusurface.$on("SMUIMenuSurface:mount", /*handleMenuSurfaceAccessor*/ ctx[7]);
    	menusurface.$on("SMUIList:mount", /*handleListAccessor*/ ctx[8]);
    	menusurface.$on("SMUIMenuSurface:opened", /*SMUIMenuSurface_opened_handler*/ ctx[19]);
    	menusurface.$on("keydown", /*handleKeydown*/ ctx[6]);
    	menusurface.$on("SMUIList:action", /*SMUIList_action_handler*/ ctx[20]);

    	const block = {
    		c: function create() {
    			create_component(menusurface.$$.fragment);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			mount_component(menusurface, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const menusurface_changes = (dirty & /*usePass, classMap, className, $$restProps*/ 546)
    			? get_spread_update(menusurface_spread_levels, [
    					dirty & /*usePass*/ 32 && { use: /*usePass*/ ctx[5] },
    					dirty & /*classMap, className*/ 2 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-menu': true
    						})
    					},
    					dirty & /*$$restProps*/ 512 && get_spread_object(/*$$restProps*/ ctx[9])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 2097152) {
    				menusurface_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_open && dirty & /*open*/ 1) {
    				updating_open = true;
    				menusurface_changes.open = /*open*/ ctx[0];
    				add_flush_callback(() => updating_open = false);
    			}

    			menusurface.$set(menusurface_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(menusurface.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(menusurface.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*menusurface_binding*/ ctx[17](null);
    			destroy_component(menusurface, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$r.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance_1$7($$self, $$props, $$invalidate) {
    	let usePass;

    	const omit_props_names = [
    		"use","class","open","isOpen","setOpen","setDefaultFocusState","getSelectedIndex","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Menu', slots, ['default']);
    	const { closest } = ponyfill;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { open = false } = $$props;
    	let element;
    	let instance;
    	let menuSurfaceAccessor;
    	let listAccessor;

    	onMount(() => {
    		$$invalidate(3, instance = new MDCMenuFoundation({
    				addClassToElementAtIndex: (index, className) => {
    					listAccessor.addClassForElementIndex(index, className);
    				},
    				removeClassFromElementAtIndex: (index, className) => {
    					listAccessor.removeClassForElementIndex(index, className);
    				},
    				addAttributeToElementAtIndex: (index, attr, value) => {
    					listAccessor.setAttributeForElementIndex(index, attr, value);
    				},
    				removeAttributeFromElementAtIndex: (index, attr) => {
    					listAccessor.removeAttributeForElementIndex(index, attr);
    				},
    				getAttributeFromElementAtIndex: (index, attr) => listAccessor.getAttributeFromElementIndex(index, attr),
    				elementContainsClass: (element, className) => element.classList.contains(className),
    				closeSurface: skipRestoreFocus => menuSurfaceAccessor.closeProgrammatic(skipRestoreFocus),
    				getElementIndex: element => listAccessor.getOrderedList().map(accessor => accessor.element).indexOf(element),
    				notifySelected: evtData => dispatch$1(
    					getElement(),
    					'SMUIMenu:selected',
    					{
    						index: evtData.index,
    						item: listAccessor.getOrderedList()[evtData.index].element
    					},
    					undefined,
    					true
    				),
    				getMenuItemCount: () => listAccessor.items.length,
    				focusItemAtIndex: index => listAccessor.focusItemAtIndex(index),
    				focusListRoot: () => 'focus' in listAccessor.element && listAccessor.element.focus(),
    				isSelectableItemAtIndex: index => !!closest(listAccessor.getOrderedList()[index].element, `.${cssClasses$5.MENU_SELECTION_GROUP}`),
    				getSelectedSiblingOfItemAtIndex: index => {
    					const orderedList = listAccessor.getOrderedList();
    					const selectionGroupEl = closest(orderedList[index].element, `.${cssClasses$5.MENU_SELECTION_GROUP}`);

    					const selectedItemEl = selectionGroupEl === null || selectionGroupEl === void 0
    					? void 0
    					: selectionGroupEl.querySelector(`.${cssClasses$5.MENU_SELECTED_LIST_ITEM}`);

    					return selectedItemEl
    					? orderedList.map(item => item.element).indexOf(selectedItemEl)
    					: -1;
    				}
    			}));

    		dispatch$1(getElement(), 'SMUIMenu:mount', instance);
    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	function handleKeydown(event) {
    		instance && instance.handleKeydown(event);
    	}

    	function handleMenuSurfaceAccessor(event) {
    		if (!menuSurfaceAccessor) {
    			menuSurfaceAccessor = event.detail;
    		}
    	}

    	function handleListAccessor(event) {
    		if (!listAccessor) {
    			$$invalidate(4, listAccessor = event.detail);
    		}
    	}

    	function isOpen() {
    		return open;
    	}

    	function setOpen(value) {
    		$$invalidate(0, open = value);
    	}

    	function setDefaultFocusState(focusState) {
    		instance.setDefaultFocusState(focusState);
    	}

    	function getSelectedIndex() {
    		return instance.getSelectedIndex();
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function menusurface_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	function menusurface_open_binding(value) {
    		open = value;
    		$$invalidate(0, open);
    	}

    	const SMUIMenuSurface_opened_handler = () => instance && instance.handleMenuSurfaceOpened();
    	const SMUIList_action_handler = event => instance && instance.handleItemAction(listAccessor.getOrderedList()[event.detail.index].element);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(9, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(10, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open);
    		if ('$$scope' in $$new_props) $$invalidate(21, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCMenuFoundation,
    		cssClasses: cssClasses$5,
    		ponyfill,
    		onMount,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		MenuSurface,
    		closest,
    		forwardEvents,
    		use,
    		className,
    		open,
    		element,
    		instance,
    		menuSurfaceAccessor,
    		listAccessor,
    		handleKeydown,
    		handleMenuSurfaceAccessor,
    		handleListAccessor,
    		isOpen,
    		setOpen,
    		setDefaultFocusState,
    		getSelectedIndex,
    		getElement,
    		usePass
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(10, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('open' in $$props) $$invalidate(0, open = $$new_props.open);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(3, instance = $$new_props.instance);
    		if ('menuSurfaceAccessor' in $$props) menuSurfaceAccessor = $$new_props.menuSurfaceAccessor;
    		if ('listAccessor' in $$props) $$invalidate(4, listAccessor = $$new_props.listAccessor);
    		if ('usePass' in $$props) $$invalidate(5, usePass = $$new_props.usePass);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*use*/ 1024) {
    			$$invalidate(5, usePass = [forwardEvents, ...use]);
    		}
    	};

    	return [
    		open,
    		className,
    		element,
    		instance,
    		listAccessor,
    		usePass,
    		handleKeydown,
    		handleMenuSurfaceAccessor,
    		handleListAccessor,
    		$$restProps,
    		use,
    		isOpen,
    		setOpen,
    		setDefaultFocusState,
    		getSelectedIndex,
    		getElement,
    		slots,
    		menusurface_binding,
    		menusurface_open_binding,
    		SMUIMenuSurface_opened_handler,
    		SMUIList_action_handler,
    		$$scope
    	];
    }

    class Menu extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$7, create_fragment$r, safe_not_equal, {
    			use: 10,
    			class: 1,
    			open: 0,
    			isOpen: 11,
    			setOpen: 12,
    			setDefaultFocusState: 13,
    			getSelectedIndex: 14,
    			getElement: 15
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Menu",
    			options,
    			id: create_fragment$r.name
    		});
    	}

    	get use() {
    		throw new Error("<Menu>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Menu>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get open() {
    		throw new Error("<Menu>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set open(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get isOpen() {
    		return this.$$.ctx[11];
    	}

    	set isOpen(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setOpen() {
    		return this.$$.ctx[12];
    	}

    	set setOpen(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setDefaultFocusState() {
    		return this.$$.ctx[13];
    	}

    	set setDefaultFocusState(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getSelectedIndex() {
    		return this.$$.ctx[14];
    	}

    	set getSelectedIndex(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[15];
    	}

    	set getElement(value) {
    		throw new Error("<Menu>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    classAdderBuilder({
        class: 'mdc-menu__selection-group-icon',
        component: Graphic,
    });

    /* node_modules/@smui/floating-label/dist/FloatingLabel.svelte generated by Svelte v3.46.4 */

    const file$o = "node_modules/@smui/floating-label/dist/FloatingLabel.svelte";

    // (19:0) {:else}
    function create_else_block$2(ctx) {
    	let label;
    	let label_class_value;
    	let label_style_value;
    	let label_for_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[22].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	let label_levels = [
    		{
    			class: label_class_value = classMap({
    				[/*className*/ ctx[3]]: true,
    				'mdc-floating-label': true,
    				'mdc-floating-label--float-above': /*floatAbove*/ ctx[0],
    				'mdc-floating-label--required': /*required*/ ctx[1],
    				.../*internalClasses*/ ctx[8]
    			})
    		},
    		{
    			style: label_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func_1$1).concat([/*style*/ ctx[4]]).join(' ')
    		},
    		{
    			for: label_for_value = /*forId*/ ctx[5] || (/*inputProps*/ ctx[11]
    			? /*inputProps*/ ctx[11].id
    			: undefined)
    		},
    		/*$$restProps*/ ctx[12]
    	];

    	let label_data = {};

    	for (let i = 0; i < label_levels.length; i += 1) {
    		label_data = assign$1(label_data, label_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			label = element("label");
    			if (default_slot) default_slot.c();
    			set_attributes(label, label_data);
    			add_location(label, file$o, 19, 2, 494);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, label, anchor);

    			if (default_slot) {
    				default_slot.m(label, null);
    			}

    			/*label_binding*/ ctx[24](label);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, label, /*use*/ ctx[2])),
    					action_destroyer(/*forwardEvents*/ ctx[10].call(null, label))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(label, label_data = get_spread_update(label_levels, [
    				(!current || dirty & /*className, floatAbove, required, internalClasses*/ 267 && label_class_value !== (label_class_value = classMap({
    					[/*className*/ ctx[3]]: true,
    					'mdc-floating-label': true,
    					'mdc-floating-label--float-above': /*floatAbove*/ ctx[0],
    					'mdc-floating-label--required': /*required*/ ctx[1],
    					.../*internalClasses*/ ctx[8]
    				}))) && { class: label_class_value },
    				(!current || dirty & /*internalStyles, style*/ 528 && label_style_value !== (label_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func_1$1).concat([/*style*/ ctx[4]]).join(' '))) && { style: label_style_value },
    				(!current || dirty & /*forId*/ 32 && label_for_value !== (label_for_value = /*forId*/ ctx[5] || (/*inputProps*/ ctx[11]
    				? /*inputProps*/ ctx[11].id
    				: undefined))) && { for: label_for_value },
    				dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 4) useActions_action.update.call(null, /*use*/ ctx[2]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(label);
    			if (default_slot) default_slot.d(detaching);
    			/*label_binding*/ ctx[24](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$2.name,
    		type: "else",
    		source: "(19:0) {:else}",
    		ctx
    	});

    	return block;
    }

    // (1:0) {#if wrapped}
    function create_if_block$g(ctx) {
    	let span;
    	let span_class_value;
    	let span_style_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[22].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[21], null);

    	let span_levels = [
    		{
    			class: span_class_value = classMap({
    				[/*className*/ ctx[3]]: true,
    				'mdc-floating-label': true,
    				'mdc-floating-label--float-above': /*floatAbove*/ ctx[0],
    				'mdc-floating-label--required': /*required*/ ctx[1],
    				.../*internalClasses*/ ctx[8]
    			})
    		},
    		{
    			style: span_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func$a).concat([/*style*/ ctx[4]]).join(' ')
    		},
    		/*$$restProps*/ ctx[12]
    	];

    	let span_data = {};

    	for (let i = 0; i < span_levels.length; i += 1) {
    		span_data = assign$1(span_data, span_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			span = element("span");
    			if (default_slot) default_slot.c();
    			set_attributes(span, span_data);
    			add_location(span, file$o, 1, 2, 16);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);

    			if (default_slot) {
    				default_slot.m(span, null);
    			}

    			/*span_binding*/ ctx[23](span);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, span, /*use*/ ctx[2])),
    					action_destroyer(/*forwardEvents*/ ctx[10].call(null, span))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 2097152)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[21],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[21], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(span, span_data = get_spread_update(span_levels, [
    				(!current || dirty & /*className, floatAbove, required, internalClasses*/ 267 && span_class_value !== (span_class_value = classMap({
    					[/*className*/ ctx[3]]: true,
    					'mdc-floating-label': true,
    					'mdc-floating-label--float-above': /*floatAbove*/ ctx[0],
    					'mdc-floating-label--required': /*required*/ ctx[1],
    					.../*internalClasses*/ ctx[8]
    				}))) && { class: span_class_value },
    				(!current || dirty & /*internalStyles, style*/ 528 && span_style_value !== (span_style_value = Object.entries(/*internalStyles*/ ctx[9]).map(func$a).concat([/*style*/ ctx[4]]).join(' '))) && { style: span_style_value },
    				dirty & /*$$restProps*/ 4096 && /*$$restProps*/ ctx[12]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 4) useActions_action.update.call(null, /*use*/ ctx[2]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    			if (default_slot) default_slot.d(detaching);
    			/*span_binding*/ ctx[23](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$g.name,
    		type: "if",
    		source: "(1:0) {#if wrapped}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$q(ctx) {
    	let current_block_type_index;
    	let if_block;
    	let if_block_anchor;
    	let current;
    	const if_block_creators = [create_if_block$g, create_else_block$2];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*wrapped*/ ctx[6]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	const block = {
    		c: function create() {
    			if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if_blocks[current_block_type_index].m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block = if_blocks[current_block_type_index];

    				if (!if_block) {
    					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block.c();
    				} else {
    					if_block.p(ctx, dirty);
    				}

    				transition_in(if_block, 1);
    				if_block.m(if_block_anchor.parentNode, if_block_anchor);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if_blocks[current_block_type_index].d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$q.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$a = ([name, value]) => `${name}: ${value};`;
    const func_1$1 = ([name, value]) => `${name}: ${value};`;

    function instance_1$6($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","for","floatAbove","required","wrapped","shake","float","setRequired","getWidth","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('FloatingLabel', slots, ['default']);
    	var _a;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { for: forId = undefined } = $$props;
    	let { floatAbove = false } = $$props;
    	let { required = false } = $$props;
    	let { wrapped = false } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};

    	let inputProps = (_a = getContext('SMUI:generic:input:props')) !== null && _a !== void 0
    	? _a
    	: {};

    	let previousFloatAbove = floatAbove;
    	let previousRequired = required;

    	onMount(() => {
    		$$invalidate(18, instance = new MDCFloatingLabelFoundation({
    				addClass,
    				removeClass,
    				getWidth: () => {
    					var _a, _b;
    					const el = getElement();
    					const clone = el.cloneNode(true);

    					(_a = el.parentNode) === null || _a === void 0
    					? void 0
    					: _a.appendChild(clone);

    					clone.classList.add('smui-floating-label--remove-transition');
    					clone.classList.add('smui-floating-label--force-size');
    					clone.classList.remove('mdc-floating-label--float-above');
    					const scrollWidth = clone.scrollWidth;

    					(_b = el.parentNode) === null || _b === void 0
    					? void 0
    					: _b.removeChild(clone);

    					return scrollWidth;
    				},
    				registerInteractionHandler: (evtType, handler) => getElement().addEventListener(evtType, handler),
    				deregisterInteractionHandler: (evtType, handler) => getElement().removeEventListener(evtType, handler)
    			}));

    		const accessor = {
    			get element() {
    				return getElement();
    			},
    			addStyle,
    			removeStyle
    		};

    		dispatch$1(element, 'SMUIFloatingLabel:mount', accessor);
    		instance.init();

    		return () => {
    			dispatch$1(element, 'SMUIFloatingLabel:unmount', accessor);
    			instance.destroy();
    		};
    	});

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(8, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(8, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(9, internalStyles);
    			} else {
    				$$invalidate(9, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function removeStyle(name) {
    		if (name in internalStyles) {
    			delete internalStyles[name];
    			$$invalidate(9, internalStyles);
    		}
    	}

    	function shake(shouldShake) {
    		instance.shake(shouldShake);
    	}

    	function float(shouldFloat) {
    		$$invalidate(0, floatAbove = shouldFloat);
    	}

    	function setRequired(isRequired) {
    		$$invalidate(1, required = isRequired);
    	}

    	function getWidth() {
    		return instance.getWidth();
    	}

    	function getElement() {
    		return element;
    	}

    	function span_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(7, element);
    		});
    	}

    	function label_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(7, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(12, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(2, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(3, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(4, style = $$new_props.style);
    		if ('for' in $$new_props) $$invalidate(5, forId = $$new_props.for);
    		if ('floatAbove' in $$new_props) $$invalidate(0, floatAbove = $$new_props.floatAbove);
    		if ('required' in $$new_props) $$invalidate(1, required = $$new_props.required);
    		if ('wrapped' in $$new_props) $$invalidate(6, wrapped = $$new_props.wrapped);
    		if ('$$scope' in $$new_props) $$invalidate(21, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		_a,
    		MDCFloatingLabelFoundation,
    		onMount,
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		className,
    		style,
    		forId,
    		floatAbove,
    		required,
    		wrapped,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		inputProps,
    		previousFloatAbove,
    		previousRequired,
    		addClass,
    		removeClass,
    		addStyle,
    		removeStyle,
    		shake,
    		float,
    		setRequired,
    		getWidth,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('_a' in $$props) _a = $$new_props._a;
    		if ('use' in $$props) $$invalidate(2, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(3, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(4, style = $$new_props.style);
    		if ('forId' in $$props) $$invalidate(5, forId = $$new_props.forId);
    		if ('floatAbove' in $$props) $$invalidate(0, floatAbove = $$new_props.floatAbove);
    		if ('required' in $$props) $$invalidate(1, required = $$new_props.required);
    		if ('wrapped' in $$props) $$invalidate(6, wrapped = $$new_props.wrapped);
    		if ('element' in $$props) $$invalidate(7, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(18, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(8, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(9, internalStyles = $$new_props.internalStyles);
    		if ('inputProps' in $$props) $$invalidate(11, inputProps = $$new_props.inputProps);
    		if ('previousFloatAbove' in $$props) $$invalidate(19, previousFloatAbove = $$new_props.previousFloatAbove);
    		if ('previousRequired' in $$props) $$invalidate(20, previousRequired = $$new_props.previousRequired);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*instance, previousFloatAbove, floatAbove*/ 786433) {
    			if (instance && previousFloatAbove !== floatAbove) {
    				$$invalidate(19, previousFloatAbove = floatAbove);
    				instance.float(floatAbove);
    			}
    		}

    		if ($$self.$$.dirty & /*instance, previousRequired, required*/ 1310722) {
    			if (instance && previousRequired !== required) {
    				$$invalidate(20, previousRequired = required);
    				instance.setRequired(required);
    			}
    		}
    	};

    	return [
    		floatAbove,
    		required,
    		use,
    		className,
    		style,
    		forId,
    		wrapped,
    		element,
    		internalClasses,
    		internalStyles,
    		forwardEvents,
    		inputProps,
    		$$restProps,
    		shake,
    		float,
    		setRequired,
    		getWidth,
    		getElement,
    		instance,
    		previousFloatAbove,
    		previousRequired,
    		$$scope,
    		slots,
    		span_binding,
    		label_binding
    	];
    }

    class FloatingLabel extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$6, create_fragment$q, safe_not_equal, {
    			use: 2,
    			class: 3,
    			style: 4,
    			for: 5,
    			floatAbove: 0,
    			required: 1,
    			wrapped: 6,
    			shake: 13,
    			float: 14,
    			setRequired: 15,
    			getWidth: 16,
    			getElement: 17
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "FloatingLabel",
    			options,
    			id: create_fragment$q.name
    		});
    	}

    	get use() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get for() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set for(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get floatAbove() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set floatAbove(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get required() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set required(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get wrapped() {
    		throw new Error("<FloatingLabel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set wrapped(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get shake() {
    		return this.$$.ctx[13];
    	}

    	set shake(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get float() {
    		return this.$$.ctx[14];
    	}

    	set float(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setRequired() {
    		return this.$$.ctx[15];
    	}

    	set setRequired(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getWidth() {
    		return this.$$.ctx[16];
    	}

    	set getWidth(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[17];
    	}

    	set getElement(value) {
    		throw new Error("<FloatingLabel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/line-ripple/dist/LineRipple.svelte generated by Svelte v3.46.4 */
    const file$n = "node_modules/@smui/line-ripple/dist/LineRipple.svelte";

    function create_fragment$p(ctx) {
    	let div;
    	let div_class_value;
    	let div_style_value;
    	let useActions_action;
    	let mounted;
    	let dispose;

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-line-ripple': true,
    				'mdc-line-ripple--active': /*active*/ ctx[3],
    				.../*internalClasses*/ ctx[5]
    			})
    		},
    		{
    			style: div_style_value = Object.entries(/*internalStyles*/ ctx[6]).map(func$9).concat([/*style*/ ctx[2]]).join(' ')
    		},
    		/*$$restProps*/ ctx[8]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			set_attributes(div, div_data);
    			add_location(div, file$n, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			/*div_binding*/ ctx[13](div);

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[7].call(null, div))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				dirty & /*className, active, internalClasses*/ 42 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-line-ripple': true,
    					'mdc-line-ripple--active': /*active*/ ctx[3],
    					.../*internalClasses*/ ctx[5]
    				})) && { class: div_class_value },
    				dirty & /*internalStyles, style*/ 68 && div_style_value !== (div_style_value = Object.entries(/*internalStyles*/ ctx[6]).map(func$9).concat([/*style*/ ctx[2]]).join(' ')) && { style: div_style_value },
    				dirty & /*$$restProps*/ 256 && /*$$restProps*/ ctx[8]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			/*div_binding*/ ctx[13](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$p.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$9 = ([name, value]) => `${name}: ${value};`;

    function instance_1$5($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","active","activate","deactivate","setRippleCenter","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('LineRipple', slots, []);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { active = false } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};

    	onMount(() => {
    		instance = new MDCLineRippleFoundation({
    				addClass,
    				removeClass,
    				hasClass,
    				setStyle: addStyle,
    				registerEventHandler: (evtType, handler) => getElement().addEventListener(evtType, handler),
    				deregisterEventHandler: (evtType, handler) => getElement().removeEventListener(evtType, handler)
    			});

    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(5, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(5, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(6, internalStyles);
    			} else {
    				$$invalidate(6, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function activate() {
    		instance.activate();
    	}

    	function deactivate() {
    		instance.deactivate();
    	}

    	function setRippleCenter(xCoordinate) {
    		instance.setRippleCenter(xCoordinate);
    	}

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(4, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(8, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(2, style = $$new_props.style);
    		if ('active' in $$new_props) $$invalidate(3, active = $$new_props.active);
    	};

    	$$self.$capture_state = () => ({
    		MDCLineRippleFoundation,
    		onMount,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		style,
    		active,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		hasClass,
    		addClass,
    		removeClass,
    		addStyle,
    		activate,
    		deactivate,
    		setRippleCenter,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(2, style = $$new_props.style);
    		if ('active' in $$props) $$invalidate(3, active = $$new_props.active);
    		if ('element' in $$props) $$invalidate(4, element = $$new_props.element);
    		if ('instance' in $$props) instance = $$new_props.instance;
    		if ('internalClasses' in $$props) $$invalidate(5, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(6, internalStyles = $$new_props.internalStyles);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		style,
    		active,
    		element,
    		internalClasses,
    		internalStyles,
    		forwardEvents,
    		$$restProps,
    		activate,
    		deactivate,
    		setRippleCenter,
    		getElement,
    		div_binding
    	];
    }

    class LineRipple extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$5, create_fragment$p, safe_not_equal, {
    			use: 0,
    			class: 1,
    			style: 2,
    			active: 3,
    			activate: 9,
    			deactivate: 10,
    			setRippleCenter: 11,
    			getElement: 12
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "LineRipple",
    			options,
    			id: create_fragment$p.name
    		});
    	}

    	get use() {
    		throw new Error("<LineRipple>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<LineRipple>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<LineRipple>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get active() {
    		throw new Error("<LineRipple>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set active(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get activate() {
    		return this.$$.ctx[9];
    	}

    	set activate(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get deactivate() {
    		return this.$$.ctx[10];
    	}

    	set deactivate(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setRippleCenter() {
    		return this.$$.ctx[11];
    	}

    	set setRippleCenter(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[12];
    	}

    	set getElement(value) {
    		throw new Error("<LineRipple>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/notched-outline/dist/NotchedOutline.svelte generated by Svelte v3.46.4 */
    const file$m = "node_modules/@smui/notched-outline/dist/NotchedOutline.svelte";

    // (17:2) {#if !noLabel}
    function create_if_block$f(ctx) {
    	let div;
    	let div_style_value;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[14].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			attr_dev(div, "class", "mdc-notched-outline__notch");
    			attr_dev(div, "style", div_style_value = Object.entries(/*notchStyles*/ ctx[7]).map(func$8).join(' '));
    			add_location(div, file$m, 17, 4, 496);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[13],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[13])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null),
    						null
    					);
    				}
    			}

    			if (!current || dirty & /*notchStyles*/ 128 && div_style_value !== (div_style_value = Object.entries(/*notchStyles*/ ctx[7]).map(func$8).join(' '))) {
    				attr_dev(div, "style", div_style_value);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$f.name,
    		type: "if",
    		source: "(17:2) {#if !noLabel}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$o(ctx) {
    	let div2;
    	let div0;
    	let t0;
    	let t1;
    	let div1;
    	let div2_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	let if_block = !/*noLabel*/ ctx[3] && create_if_block$f(ctx);

    	let div2_levels = [
    		{
    			class: div2_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-notched-outline': true,
    				'mdc-notched-outline--notched': /*notched*/ ctx[2],
    				'mdc-notched-outline--no-label': /*noLabel*/ ctx[3],
    				.../*internalClasses*/ ctx[6]
    			})
    		},
    		/*$$restProps*/ ctx[9]
    	];

    	let div2_data = {};

    	for (let i = 0; i < div2_levels.length; i += 1) {
    		div2_data = assign$1(div2_data, div2_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div2 = element("div");
    			div0 = element("div");
    			t0 = space();
    			if (if_block) if_block.c();
    			t1 = space();
    			div1 = element("div");
    			attr_dev(div0, "class", "mdc-notched-outline__leading");
    			add_location(div0, file$m, 15, 2, 430);
    			attr_dev(div1, "class", "mdc-notched-outline__trailing");
    			add_location(div1, file$m, 26, 2, 699);
    			set_attributes(div2, div2_data);
    			add_location(div2, file$m, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div2, anchor);
    			append_dev(div2, div0);
    			append_dev(div2, t0);
    			if (if_block) if_block.m(div2, null);
    			append_dev(div2, t1);
    			append_dev(div2, div1);
    			/*div2_binding*/ ctx[15](div2);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div2, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[8].call(null, div2)),
    					listen_dev(div2, "SMUIFloatingLabel:mount", /*SMUIFloatingLabel_mount_handler*/ ctx[16], false, false, false),
    					listen_dev(div2, "SMUIFloatingLabel:unmount", /*SMUIFloatingLabel_unmount_handler*/ ctx[17], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (!/*noLabel*/ ctx[3]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*noLabel*/ 8) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$f(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(div2, t1);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}

    			set_attributes(div2, div2_data = get_spread_update(div2_levels, [
    				(!current || dirty & /*className, notched, noLabel, internalClasses*/ 78 && div2_class_value !== (div2_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-notched-outline': true,
    					'mdc-notched-outline--notched': /*notched*/ ctx[2],
    					'mdc-notched-outline--no-label': /*noLabel*/ ctx[3],
    					.../*internalClasses*/ ctx[6]
    				}))) && { class: div2_class_value },
    				dirty & /*$$restProps*/ 512 && /*$$restProps*/ ctx[9]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div2);
    			if (if_block) if_block.d();
    			/*div2_binding*/ ctx[15](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$o.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$8 = ([name, value]) => `${name}: ${value};`;

    function instance_1$4($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","notched","noLabel","notch","closeNotch","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('NotchedOutline', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { notched = false } = $$props;
    	let { noLabel = false } = $$props;
    	let element;
    	let instance;
    	let floatingLabel;
    	let internalClasses = {};
    	let notchStyles = {};

    	onMount(() => {
    		instance = new MDCNotchedOutlineFoundation({
    				addClass,
    				removeClass,
    				setNotchWidthProperty: width => addNotchStyle('width', width + 'px'),
    				removeNotchWidthProperty: () => removeNotchStyle('width')
    			});

    		instance.init();

    		return () => {
    			instance.destroy();
    		};
    	});

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(6, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(6, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addNotchStyle(name, value) {
    		if (notchStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete notchStyles[name];
    				$$invalidate(7, notchStyles);
    			} else {
    				$$invalidate(7, notchStyles[name] = value, notchStyles);
    			}
    		}
    	}

    	function removeNotchStyle(name) {
    		if (name in notchStyles) {
    			delete notchStyles[name];
    			$$invalidate(7, notchStyles);
    		}
    	}

    	function notch(notchWidth) {
    		instance.notch(notchWidth);
    	}

    	function closeNotch() {
    		instance.closeNotch();
    	}

    	function getElement() {
    		return element;
    	}

    	function div2_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(5, element);
    		});
    	}

    	const SMUIFloatingLabel_mount_handler = event => $$invalidate(4, floatingLabel = event.detail);
    	const SMUIFloatingLabel_unmount_handler = () => $$invalidate(4, floatingLabel = undefined);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(9, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('notched' in $$new_props) $$invalidate(2, notched = $$new_props.notched);
    		if ('noLabel' in $$new_props) $$invalidate(3, noLabel = $$new_props.noLabel);
    		if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		MDCNotchedOutlineFoundation,
    		onMount,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		notched,
    		noLabel,
    		element,
    		instance,
    		floatingLabel,
    		internalClasses,
    		notchStyles,
    		addClass,
    		removeClass,
    		addNotchStyle,
    		removeNotchStyle,
    		notch,
    		closeNotch,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('notched' in $$props) $$invalidate(2, notched = $$new_props.notched);
    		if ('noLabel' in $$props) $$invalidate(3, noLabel = $$new_props.noLabel);
    		if ('element' in $$props) $$invalidate(5, element = $$new_props.element);
    		if ('instance' in $$props) instance = $$new_props.instance;
    		if ('floatingLabel' in $$props) $$invalidate(4, floatingLabel = $$new_props.floatingLabel);
    		if ('internalClasses' in $$props) $$invalidate(6, internalClasses = $$new_props.internalClasses);
    		if ('notchStyles' in $$props) $$invalidate(7, notchStyles = $$new_props.notchStyles);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*floatingLabel*/ 16) {
    			if (floatingLabel) {
    				floatingLabel.addStyle('transition-duration', '0s');
    				addClass('mdc-notched-outline--upgraded');

    				requestAnimationFrame(() => {
    					if (floatingLabel) {
    						floatingLabel.removeStyle('transition-duration');
    					}
    				});
    			} else {
    				removeClass('mdc-notched-outline--upgraded');
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		notched,
    		noLabel,
    		floatingLabel,
    		element,
    		internalClasses,
    		notchStyles,
    		forwardEvents,
    		$$restProps,
    		notch,
    		closeNotch,
    		getElement,
    		$$scope,
    		slots,
    		div2_binding,
    		SMUIFloatingLabel_mount_handler,
    		SMUIFloatingLabel_unmount_handler
    	];
    }

    class NotchedOutline extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$4, create_fragment$o, safe_not_equal, {
    			use: 0,
    			class: 1,
    			notched: 2,
    			noLabel: 3,
    			notch: 10,
    			closeNotch: 11,
    			getElement: 12
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "NotchedOutline",
    			options,
    			id: create_fragment$o.name
    		});
    	}

    	get use() {
    		throw new Error("<NotchedOutline>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<NotchedOutline>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get notched() {
    		throw new Error("<NotchedOutline>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set notched(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get noLabel() {
    		throw new Error("<NotchedOutline>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set noLabel(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get notch() {
    		return this.$$.ctx[10];
    	}

    	set notch(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get closeNotch() {
    		return this.$$.ctx[11];
    	}

    	set closeNotch(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[12];
    	}

    	set getElement(value) {
    		throw new Error("<NotchedOutline>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/select/dist/helper-text/HelperText.svelte generated by Svelte v3.46.4 */

    const file$l = "node_modules/@smui/select/dist/helper-text/HelperText.svelte";

    // (17:31) {:else}
    function create_else_block$1(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text(/*content*/ ctx[8]);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*content*/ 256) set_data_dev(t, /*content*/ ctx[8]);
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block$1.name,
    		type: "else",
    		source: "(17:31) {:else}",
    		ctx
    	});

    	return block;
    }

    // (17:2) {#if content == null}
    function create_if_block$e(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[13].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[12],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[12])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$e.name,
    		type: "if",
    		source: "(17:2) {#if content == null}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$n(ctx) {
    	let div;
    	let current_block_type_index;
    	let if_block;
    	let div_class_value;
    	let div_aria_hidden_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const if_block_creators = [create_if_block$e, create_else_block$1];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*content*/ ctx[8] == null) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-select-helper-text': true,
    				'mdc-select-helper-text--validation-msg': /*validationMsg*/ ctx[4],
    				'mdc-select-helper-text--validation-msg-persistent': /*persistent*/ ctx[3],
    				.../*internalClasses*/ ctx[6]
    			})
    		},
    		{
    			"aria-hidden": div_aria_hidden_value = /*persistent*/ ctx[3] ? undefined : 'true'
    		},
    		{ id: /*id*/ ctx[2] },
    		/*internalAttrs*/ ctx[7],
    		/*$$restProps*/ ctx[10]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			if_block.c();
    			set_attributes(div, div_data);
    			add_location(div, file$l, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			if_blocks[current_block_type_index].m(div, null);
    			/*div_binding*/ ctx[14](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[9].call(null, div))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block = if_blocks[current_block_type_index];

    				if (!if_block) {
    					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block.c();
    				} else {
    					if_block.p(ctx, dirty);
    				}

    				transition_in(if_block, 1);
    				if_block.m(div, null);
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty & /*className, validationMsg, persistent, internalClasses*/ 90 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-select-helper-text': true,
    					'mdc-select-helper-text--validation-msg': /*validationMsg*/ ctx[4],
    					'mdc-select-helper-text--validation-msg-persistent': /*persistent*/ ctx[3],
    					.../*internalClasses*/ ctx[6]
    				}))) && { class: div_class_value },
    				(!current || dirty & /*persistent*/ 8 && div_aria_hidden_value !== (div_aria_hidden_value = /*persistent*/ ctx[3] ? undefined : 'true')) && { "aria-hidden": div_aria_hidden_value },
    				(!current || dirty & /*id*/ 4) && { id: /*id*/ ctx[2] },
    				dirty & /*internalAttrs*/ 128 && /*internalAttrs*/ ctx[7],
    				dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if_blocks[current_block_type_index].d();
    			/*div_binding*/ ctx[14](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$n.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter$1 = 0;

    function instance_1$3($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","id","persistent","validationMsg","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('HelperText', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { id = 'SMUI-select-helper-text-' + counter$1++ } = $$props;
    	let { persistent = false } = $$props;
    	let { validationMsg = false } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalAttrs = {};
    	let content = undefined;

    	onMount(() => {
    		instance = new MDCSelectHelperTextFoundation({
    				addClass,
    				removeClass,
    				hasClass,
    				getAttr,
    				setAttr: addAttr,
    				removeAttr,
    				setContent: value => {
    					$$invalidate(8, content = value);
    				}
    			});

    		if (id.startsWith('SMUI-select-helper-text-')) {
    			dispatch$1(getElement(), 'SMUISelectHelperText:id', id);
    		}

    		dispatch$1(getElement(), 'SMUISelectHelperText:mount', instance);
    		instance.init();

    		return () => {
    			dispatch$1(getElement(), 'SMUISelectHelperText:unmount', instance);
    			instance.destroy();
    		};
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(6, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(6, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function getAttr(name) {
    		var _a;

    		return name in internalAttrs
    		? (_a = internalAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(7, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function removeAttr(name) {
    		if (!(name in internalAttrs) || internalAttrs[name] != null) {
    			$$invalidate(7, internalAttrs[name] = undefined, internalAttrs);
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(5, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('id' in $$new_props) $$invalidate(2, id = $$new_props.id);
    		if ('persistent' in $$new_props) $$invalidate(3, persistent = $$new_props.persistent);
    		if ('validationMsg' in $$new_props) $$invalidate(4, validationMsg = $$new_props.validationMsg);
    		if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter: counter$1,
    		MDCSelectHelperTextFoundation,
    		onMount,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		forwardEvents,
    		use,
    		className,
    		id,
    		persistent,
    		validationMsg,
    		element,
    		instance,
    		internalClasses,
    		internalAttrs,
    		content,
    		hasClass,
    		addClass,
    		removeClass,
    		getAttr,
    		addAttr,
    		removeAttr,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('id' in $$props) $$invalidate(2, id = $$new_props.id);
    		if ('persistent' in $$props) $$invalidate(3, persistent = $$new_props.persistent);
    		if ('validationMsg' in $$props) $$invalidate(4, validationMsg = $$new_props.validationMsg);
    		if ('element' in $$props) $$invalidate(5, element = $$new_props.element);
    		if ('instance' in $$props) instance = $$new_props.instance;
    		if ('internalClasses' in $$props) $$invalidate(6, internalClasses = $$new_props.internalClasses);
    		if ('internalAttrs' in $$props) $$invalidate(7, internalAttrs = $$new_props.internalAttrs);
    		if ('content' in $$props) $$invalidate(8, content = $$new_props.content);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		id,
    		persistent,
    		validationMsg,
    		element,
    		internalClasses,
    		internalAttrs,
    		content,
    		forwardEvents,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		div_binding
    	];
    }

    class HelperText extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance_1$3, create_fragment$n, safe_not_equal, {
    			use: 0,
    			class: 1,
    			id: 2,
    			persistent: 3,
    			validationMsg: 4,
    			getElement: 11
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "HelperText",
    			options,
    			id: create_fragment$n.name
    		});
    	}

    	get use() {
    		throw new Error("<HelperText>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<HelperText>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get id() {
    		throw new Error("<HelperText>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set id(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get persistent() {
    		throw new Error("<HelperText>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set persistent(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get validationMsg() {
    		throw new Error("<HelperText>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set validationMsg(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[11];
    	}

    	set getElement(value) {
    		throw new Error("<HelperText>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/select/dist/Select.svelte generated by Svelte v3.46.4 */
    const file$k = "node_modules/@smui/select/dist/Select.svelte";
    const get_helperText_slot_changes = dirty => ({});
    const get_helperText_slot_context = ctx => ({});
    const get_leadingIcon_slot_changes = dirty => ({});
    const get_leadingIcon_slot_context = ctx => ({});
    const get_label_slot_changes_1 = dirty => ({});
    const get_label_slot_context_1 = ctx => ({});
    const get_label_slot_changes = dirty => ({});
    const get_label_slot_context = ctx => ({});

    // (51:2) {#if hiddenInput}
    function create_if_block_6(ctx) {
    	let input;

    	let input_levels = [
    		{ type: "hidden" },
    		{ required: /*required*/ ctx[10] },
    		{ disabled: /*disabled*/ ctx[6] },
    		{ value: /*value*/ ctx[0] },
    		prefixFilter(/*$$restProps*/ ctx[53], 'input$')
    	];

    	let input_data = {};

    	for (let i = 0; i < input_levels.length; i += 1) {
    		input_data = assign$1(input_data, input_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			input = element("input");
    			set_attributes(input, input_data);
    			add_location(input, file$k, 51, 4, 1457);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, input, anchor);
    			if (input.autofocus) input.focus();
    		},
    		p: function update(ctx, dirty) {
    			set_attributes(input, input_data = get_spread_update(input_levels, [
    				{ type: "hidden" },
    				dirty[0] & /*required*/ 1024 && { required: /*required*/ ctx[10] },
    				dirty[0] & /*disabled*/ 64 && { disabled: /*disabled*/ ctx[6] },
    				dirty[0] & /*value*/ 1 && { value: /*value*/ ctx[0] },
    				dirty[1] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[53], 'input$')
    			]));
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(input);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_6.name,
    		type: "if",
    		source: "(51:2) {#if hiddenInput}",
    		ctx
    	});

    	return block;
    }

    // (85:4) {#if variant === 'filled'}
    function create_if_block_5$1(ctx) {
    	let span;

    	const block = {
    		c: function create() {
    			span = element("span");
    			attr_dev(span, "class", "mdc-select__ripple");
    			add_location(span, file$k, 85, 6, 2389);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_5$1.name,
    		type: "if",
    		source: "(85:4) {#if variant === 'filled'}",
    		ctx
    	});

    	return block;
    }

    // (88:4) {#if variant !== 'outlined' && !noLabel && (label != null || $$slots.label)}
    function create_if_block_4$2(ctx) {
    	let floatinglabel;
    	let current;

    	const floatinglabel_spread_levels = [
    		{ id: /*inputId*/ ctx[11] + '-smui-label' },
    		{
    			floatAbove: /*$selectedTextStore*/ ctx[43] !== ''
    		},
    		{ required: /*required*/ ctx[10] },
    		prefixFilter(/*$$restProps*/ ctx[53], 'label$')
    	];

    	let floatinglabel_props = {
    		$$slots: { default: [create_default_slot_5$3] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < floatinglabel_spread_levels.length; i += 1) {
    		floatinglabel_props = assign$1(floatinglabel_props, floatinglabel_spread_levels[i]);
    	}

    	floatinglabel = new FloatingLabel({
    			props: floatinglabel_props,
    			$$inline: true
    		});

    	/*floatinglabel_binding*/ ctx[66](floatinglabel);

    	const block = {
    		c: function create() {
    			create_component(floatinglabel.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(floatinglabel, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const floatinglabel_changes = (dirty[0] & /*inputId, required*/ 3072 | dirty[1] & /*$selectedTextStore, $$restProps*/ 4198400)
    			? get_spread_update(floatinglabel_spread_levels, [
    					dirty[0] & /*inputId*/ 2048 && { id: /*inputId*/ ctx[11] + '-smui-label' },
    					dirty[1] & /*$selectedTextStore*/ 4096 && {
    						floatAbove: /*$selectedTextStore*/ ctx[43] !== ''
    					},
    					dirty[0] & /*required*/ 1024 && { required: /*required*/ ctx[10] },
    					dirty[1] & /*$$restProps*/ 4194304 && get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'label$'))
    				])
    			: {};

    			if (dirty[0] & /*label*/ 512 | dirty[2] & /*$$scope*/ 134217728) {
    				floatinglabel_changes.$$scope = { dirty, ctx };
    			}

    			floatinglabel.$set(floatinglabel_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(floatinglabel.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(floatinglabel.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*floatinglabel_binding*/ ctx[66](null);
    			destroy_component(floatinglabel, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_4$2.name,
    		type: "if",
    		source: "(88:4) {#if variant !== 'outlined' && !noLabel && (label != null || $$slots.label)}",
    		ctx
    	});

    	return block;
    }

    // (89:6) <FloatingLabel         bind:this={floatingLabel}         id={inputId + '-smui-label'}         floatAbove={$selectedTextStore !== ''}         {required}         {...prefixFilter($$restProps, 'label$')}         >
    function create_default_slot_5$3(ctx) {
    	let t_value = (/*label*/ ctx[9] == null ? '' : /*label*/ ctx[9]) + "";
    	let t;
    	let current;
    	const label_slot_template = /*#slots*/ ctx[63].label;
    	const label_slot = create_slot(label_slot_template, ctx, /*$$scope*/ ctx[89], get_label_slot_context);

    	const block = {
    		c: function create() {
    			t = text(t_value);
    			if (label_slot) label_slot.c();
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);

    			if (label_slot) {
    				label_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty[0] & /*label*/ 512) && t_value !== (t_value = (/*label*/ ctx[9] == null ? '' : /*label*/ ctx[9]) + "")) set_data_dev(t, t_value);

    			if (label_slot) {
    				if (label_slot.p && (!current || dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						label_slot,
    						label_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(label_slot_template, /*$$scope*/ ctx[89], dirty, get_label_slot_changes),
    						get_label_slot_context
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(label_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(label_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    			if (label_slot) label_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_5$3.name,
    		type: "slot",
    		source: "(89:6) <FloatingLabel         bind:this={floatingLabel}         id={inputId + '-smui-label'}         floatAbove={$selectedTextStore !== ''}         {required}         {...prefixFilter($$restProps, 'label$')}         >",
    		ctx
    	});

    	return block;
    }

    // (98:4) {#if variant === 'outlined'}
    function create_if_block_2$4(ctx) {
    	let notchedoutline;
    	let current;

    	const notchedoutline_spread_levels = [
    		{
    			noLabel: /*noLabel*/ ctx[8] || /*label*/ ctx[9] == null && !/*$$slots*/ ctx[52].label
    		},
    		prefixFilter(/*$$restProps*/ ctx[53], 'outline$')
    	];

    	let notchedoutline_props = {
    		$$slots: { default: [create_default_slot_3$4] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < notchedoutline_spread_levels.length; i += 1) {
    		notchedoutline_props = assign$1(notchedoutline_props, notchedoutline_spread_levels[i]);
    	}

    	notchedoutline = new NotchedOutline({
    			props: notchedoutline_props,
    			$$inline: true
    		});

    	/*notchedoutline_binding*/ ctx[68](notchedoutline);

    	const block = {
    		c: function create() {
    			create_component(notchedoutline.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(notchedoutline, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const notchedoutline_changes = (dirty[0] & /*noLabel, label*/ 768 | dirty[1] & /*$$slots, $$restProps*/ 6291456)
    			? get_spread_update(notchedoutline_spread_levels, [
    					dirty[0] & /*noLabel, label*/ 768 | dirty[1] & /*$$slots*/ 2097152 && {
    						noLabel: /*noLabel*/ ctx[8] || /*label*/ ctx[9] == null && !/*$$slots*/ ctx[52].label
    					},
    					dirty[1] & /*$$restProps*/ 4194304 && get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'outline$'))
    				])
    			: {};

    			if (dirty[0] & /*inputId, required, label, noLabel*/ 3840 | dirty[1] & /*$selectedTextStore, $$restProps, floatingLabel, $$slots*/ 6296064 | dirty[2] & /*$$scope*/ 134217728) {
    				notchedoutline_changes.$$scope = { dirty, ctx };
    			}

    			notchedoutline.$set(notchedoutline_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(notchedoutline.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(notchedoutline.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*notchedoutline_binding*/ ctx[68](null);
    			destroy_component(notchedoutline, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_2$4.name,
    		type: "if",
    		source: "(98:4) {#if variant === 'outlined'}",
    		ctx
    	});

    	return block;
    }

    // (104:8) {#if !noLabel && (label != null || $$slots.label)}
    function create_if_block_3$2(ctx) {
    	let floatinglabel;
    	let current;

    	const floatinglabel_spread_levels = [
    		{ id: /*inputId*/ ctx[11] + '-smui-label' },
    		{
    			floatAbove: /*$selectedTextStore*/ ctx[43] !== ''
    		},
    		{ required: /*required*/ ctx[10] },
    		prefixFilter(/*$$restProps*/ ctx[53], 'label$')
    	];

    	let floatinglabel_props = {
    		$$slots: { default: [create_default_slot_4$3] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < floatinglabel_spread_levels.length; i += 1) {
    		floatinglabel_props = assign$1(floatinglabel_props, floatinglabel_spread_levels[i]);
    	}

    	floatinglabel = new FloatingLabel({
    			props: floatinglabel_props,
    			$$inline: true
    		});

    	/*floatinglabel_binding_1*/ ctx[67](floatinglabel);

    	const block = {
    		c: function create() {
    			create_component(floatinglabel.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(floatinglabel, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const floatinglabel_changes = (dirty[0] & /*inputId, required*/ 3072 | dirty[1] & /*$selectedTextStore, $$restProps*/ 4198400)
    			? get_spread_update(floatinglabel_spread_levels, [
    					dirty[0] & /*inputId*/ 2048 && { id: /*inputId*/ ctx[11] + '-smui-label' },
    					dirty[1] & /*$selectedTextStore*/ 4096 && {
    						floatAbove: /*$selectedTextStore*/ ctx[43] !== ''
    					},
    					dirty[0] & /*required*/ 1024 && { required: /*required*/ ctx[10] },
    					dirty[1] & /*$$restProps*/ 4194304 && get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'label$'))
    				])
    			: {};

    			if (dirty[0] & /*label*/ 512 | dirty[2] & /*$$scope*/ 134217728) {
    				floatinglabel_changes.$$scope = { dirty, ctx };
    			}

    			floatinglabel.$set(floatinglabel_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(floatinglabel.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(floatinglabel.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*floatinglabel_binding_1*/ ctx[67](null);
    			destroy_component(floatinglabel, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_3$2.name,
    		type: "if",
    		source: "(104:8) {#if !noLabel && (label != null || $$slots.label)}",
    		ctx
    	});

    	return block;
    }

    // (105:10) <FloatingLabel             bind:this={floatingLabel}             id={inputId + '-smui-label'}             floatAbove={$selectedTextStore !== ''}             {required}             {...prefixFilter($$restProps, 'label$')}             >
    function create_default_slot_4$3(ctx) {
    	let t_value = (/*label*/ ctx[9] == null ? '' : /*label*/ ctx[9]) + "";
    	let t;
    	let current;
    	const label_slot_template = /*#slots*/ ctx[63].label;
    	const label_slot = create_slot(label_slot_template, ctx, /*$$scope*/ ctx[89], get_label_slot_context_1);

    	const block = {
    		c: function create() {
    			t = text(t_value);
    			if (label_slot) label_slot.c();
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);

    			if (label_slot) {
    				label_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty[0] & /*label*/ 512) && t_value !== (t_value = (/*label*/ ctx[9] == null ? '' : /*label*/ ctx[9]) + "")) set_data_dev(t, t_value);

    			if (label_slot) {
    				if (label_slot.p && (!current || dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						label_slot,
    						label_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(label_slot_template, /*$$scope*/ ctx[89], dirty, get_label_slot_changes_1),
    						get_label_slot_context_1
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(label_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(label_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    			if (label_slot) label_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_4$3.name,
    		type: "slot",
    		source: "(105:10) <FloatingLabel             bind:this={floatingLabel}             id={inputId + '-smui-label'}             floatAbove={$selectedTextStore !== ''}             {required}             {...prefixFilter($$restProps, 'label$')}             >",
    		ctx
    	});

    	return block;
    }

    // (99:6) <NotchedOutline         bind:this={notchedOutline}         noLabel={noLabel || (label == null && !$$slots.label)}         {...prefixFilter($$restProps, 'outline$')}       >
    function create_default_slot_3$4(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = !/*noLabel*/ ctx[8] && (/*label*/ ctx[9] != null || /*$$slots*/ ctx[52].label) && create_if_block_3$2(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (!/*noLabel*/ ctx[8] && (/*label*/ ctx[9] != null || /*$$slots*/ ctx[52].label)) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*noLabel, label*/ 768 | dirty[1] & /*$$slots*/ 2097152) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block_3$2(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_3$4.name,
    		type: "slot",
    		source: "(99:6) <NotchedOutline         bind:this={notchedOutline}         noLabel={noLabel || (label == null && !$$slots.label)}         {...prefixFilter($$restProps, 'outline$')}       >",
    		ctx
    	});

    	return block;
    }

    // (168:4) {#if variant !== 'outlined' && ripple}
    function create_if_block_1$7(ctx) {
    	let lineripple;
    	let current;
    	const lineripple_spread_levels = [prefixFilter(/*$$restProps*/ ctx[53], 'ripple$')];
    	let lineripple_props = {};

    	for (let i = 0; i < lineripple_spread_levels.length; i += 1) {
    		lineripple_props = assign$1(lineripple_props, lineripple_spread_levels[i]);
    	}

    	lineripple = new LineRipple({ props: lineripple_props, $$inline: true });
    	/*lineripple_binding*/ ctx[70](lineripple);

    	const block = {
    		c: function create() {
    			create_component(lineripple.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(lineripple, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const lineripple_changes = (dirty[1] & /*$$restProps*/ 4194304)
    			? get_spread_update(lineripple_spread_levels, [get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'ripple$'))])
    			: {};

    			lineripple.$set(lineripple_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(lineripple.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(lineripple.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*lineripple_binding*/ ctx[70](null);
    			destroy_component(lineripple, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$7.name,
    		type: "if",
    		source: "(168:4) {#if variant !== 'outlined' && ripple}",
    		ctx
    	});

    	return block;
    }

    // (194:4) <List       role="listbox"       {wrapFocus}       bind:selectedIndex       on:SMUIList:mount={(event) => (list = event.detail)}       {...prefixFilter($$restProps, 'list$')}>
    function create_default_slot_2$5(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[63].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[89], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[89], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2$5.name,
    		type: "slot",
    		source: "(194:4) <List       role=\\\"listbox\\\"       {wrapFocus}       bind:selectedIndex       on:SMUIList:mount={(event) => (list = event.detail)}       {...prefixFilter($$restProps, 'list$')}>",
    		ctx
    	});

    	return block;
    }

    // (176:2) <Menu     class={classMap({       [menu$class]: true,       'mdc-select__menu': true,       ...menuClasses,     })}     fullWidth     anchor={false}     {anchorElement}     {anchorCorner}     bind:open={menuOpen}     on:SMUIMenu:selected={(event) =>       instance && instance.handleMenuItemAction(event.detail.index)}     on:SMUIMenuSurface:closing={() => instance && instance.handleMenuClosing()}     on:SMUIMenuSurface:closed={() => instance && instance.handleMenuClosed()}     on:SMUIMenuSurface:opened={() => instance && instance.handleMenuOpened()}     {...prefixFilter($$restProps, 'menu$')}   >
    function create_default_slot_1$6(ctx) {
    	let list_1;
    	let updating_selectedIndex;
    	let current;

    	const list_1_spread_levels = [
    		{ role: "listbox" },
    		{ wrapFocus: /*wrapFocus*/ ctx[36] },
    		prefixFilter(/*$$restProps*/ ctx[53], 'list$')
    	];

    	function list_1_selectedIndex_binding(value) {
    		/*list_1_selectedIndex_binding*/ ctx[76](value);
    	}

    	let list_1_props = {
    		$$slots: { default: [create_default_slot_2$5] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < list_1_spread_levels.length; i += 1) {
    		list_1_props = assign$1(list_1_props, list_1_spread_levels[i]);
    	}

    	if (/*selectedIndex*/ ctx[24] !== void 0) {
    		list_1_props.selectedIndex = /*selectedIndex*/ ctx[24];
    	}

    	list_1 = new List$2({ props: list_1_props, $$inline: true });
    	binding_callbacks.push(() => bind(list_1, 'selectedIndex', list_1_selectedIndex_binding));
    	list_1.$on("SMUIList:mount", /*SMUIList_mount_handler*/ ctx[77]);

    	const block = {
    		c: function create() {
    			create_component(list_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(list_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const list_1_changes = (dirty[1] & /*wrapFocus, $$restProps*/ 4194336)
    			? get_spread_update(list_1_spread_levels, [
    					list_1_spread_levels[0],
    					dirty[1] & /*wrapFocus*/ 32 && { wrapFocus: /*wrapFocus*/ ctx[36] },
    					dirty[1] & /*$$restProps*/ 4194304 && get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'list$'))
    				])
    			: {};

    			if (dirty[2] & /*$$scope*/ 134217728) {
    				list_1_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_selectedIndex && dirty[0] & /*selectedIndex*/ 16777216) {
    				updating_selectedIndex = true;
    				list_1_changes.selectedIndex = /*selectedIndex*/ ctx[24];
    				add_flush_callback(() => updating_selectedIndex = false);
    			}

    			list_1.$set(list_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(list_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(list_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(list_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$6.name,
    		type: "slot",
    		source: "(176:2) <Menu     class={classMap({       [menu$class]: true,       'mdc-select__menu': true,       ...menuClasses,     })}     fullWidth     anchor={false}     {anchorElement}     {anchorCorner}     bind:open={menuOpen}     on:SMUIMenu:selected={(event) =>       instance && instance.handleMenuItemAction(event.detail.index)}     on:SMUIMenuSurface:closing={() => instance && instance.handleMenuClosing()}     on:SMUIMenuSurface:closed={() => instance && instance.handleMenuClosed()}     on:SMUIMenuSurface:opened={() => instance && instance.handleMenuOpened()}     {...prefixFilter($$restProps, 'menu$')}   >",
    		ctx
    	});

    	return block;
    }

    // (203:0) {#if $$slots.helperText}
    function create_if_block$d(ctx) {
    	let helpertext;
    	let current;
    	const helpertext_spread_levels = [prefixFilter(/*$$restProps*/ ctx[53], 'helperText$')];

    	let helpertext_props = {
    		$$slots: { default: [create_default_slot$b] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < helpertext_spread_levels.length; i += 1) {
    		helpertext_props = assign$1(helpertext_props, helpertext_spread_levels[i]);
    	}

    	helpertext = new HelperText({ props: helpertext_props, $$inline: true });
    	helpertext.$on("SMUISelectHelperText:id", /*SMUISelectHelperText_id_handler*/ ctx[86]);
    	helpertext.$on("SMUISelectHelperText:mount", /*SMUISelectHelperText_mount_handler*/ ctx[87]);
    	helpertext.$on("SMUISelectHelperText:unmount", /*SMUISelectHelperText_unmount_handler*/ ctx[88]);

    	const block = {
    		c: function create() {
    			create_component(helpertext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(helpertext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const helpertext_changes = (dirty[1] & /*$$restProps*/ 4194304)
    			? get_spread_update(helpertext_spread_levels, [get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'helperText$'))])
    			: {};

    			if (dirty[2] & /*$$scope*/ 134217728) {
    				helpertext_changes.$$scope = { dirty, ctx };
    			}

    			helpertext.$set(helpertext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(helpertext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(helpertext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(helpertext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$d.name,
    		type: "if",
    		source: "(203:0) {#if $$slots.helperText}",
    		ctx
    	});

    	return block;
    }

    // (204:2) <HelperText     on:SMUISelectHelperText:id={(event) => (helperId = event.detail)}     on:SMUISelectHelperText:mount={(event) => (helperText = event.detail)}     on:SMUISelectHelperText:unmount={() => {       helperId = undefined;       helperText = undefined;     }}     {...prefixFilter($$restProps, 'helperText$')}     >
    function create_default_slot$b(ctx) {
    	let current;
    	const helperText_slot_template = /*#slots*/ ctx[63].helperText;
    	const helperText_slot = create_slot(helperText_slot_template, ctx, /*$$scope*/ ctx[89], get_helperText_slot_context);

    	const block = {
    		c: function create() {
    			if (helperText_slot) helperText_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (helperText_slot) {
    				helperText_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (helperText_slot) {
    				if (helperText_slot.p && (!current || dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						helperText_slot,
    						helperText_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(helperText_slot_template, /*$$scope*/ ctx[89], dirty, get_helperText_slot_changes),
    						get_helperText_slot_context
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(helperText_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(helperText_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (helperText_slot) helperText_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$b.name,
    		type: "slot",
    		source: "(204:2) <HelperText     on:SMUISelectHelperText:id={(event) => (helperId = event.detail)}     on:SMUISelectHelperText:mount={(event) => (helperText = event.detail)}     on:SMUISelectHelperText:unmount={() => {       helperId = undefined;       helperText = undefined;     }}     {...prefixFilter($$restProps, 'helperText$')}     >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$m(ctx) {
    	let div1;
    	let t0;
    	let div0;
    	let t1;
    	let t2;
    	let t3;
    	let t4;
    	let span1;
    	let span0;
    	let t5;
    	let span0_id_value;
    	let span0_class_value;
    	let span0_aria_labelledby_value;
    	let useActions_action;
    	let span1_class_value;
    	let useActions_action_1;
    	let t6;
    	let span2;
    	let svg;
    	let polygon0;
    	let polygon1;
    	let span2_class_value;
    	let useActions_action_2;
    	let t7;
    	let div0_class_value;
    	let div0_aria_required_value;
    	let div0_aria_disabled_value;
    	let useActions_action_3;
    	let t8;
    	let menu;
    	let updating_open;
    	let div1_class_value;
    	let div1_style_value;
    	let Ripple_action;
    	let useActions_action_4;
    	let t9;
    	let if_block5_anchor;
    	let current;
    	let mounted;
    	let dispose;
    	let if_block0 = /*hiddenInput*/ ctx[12] && create_if_block_6(ctx);
    	let if_block1 = /*variant*/ ctx[7] === 'filled' && create_if_block_5$1(ctx);
    	let if_block2 = /*variant*/ ctx[7] !== 'outlined' && !/*noLabel*/ ctx[8] && (/*label*/ ctx[9] != null || /*$$slots*/ ctx[52].label) && create_if_block_4$2(ctx);
    	let if_block3 = /*variant*/ ctx[7] === 'outlined' && create_if_block_2$4(ctx);
    	const leadingIcon_slot_template = /*#slots*/ ctx[63].leadingIcon;
    	const leadingIcon_slot = create_slot(leadingIcon_slot_template, ctx, /*$$scope*/ ctx[89], get_leadingIcon_slot_context);

    	let span0_levels = [
    		{
    			id: span0_id_value = /*inputId*/ ctx[11] + '-smui-selected-text'
    		},
    		{
    			class: span0_class_value = classMap({
    				[/*selectedText$class*/ ctx[19]]: true,
    				'mdc-select__selected-text': true
    			})
    		},
    		{ role: "button" },
    		{ "aria-haspopup": "listbox" },
    		{
    			"aria-labelledby": span0_aria_labelledby_value = /*inputId*/ ctx[11] + '-smui-label'
    		},
    		prefixFilter(/*$$restProps*/ ctx[53], 'selectedText$')
    	];

    	let span0_data = {};

    	for (let i = 0; i < span0_levels.length; i += 1) {
    		span0_data = assign$1(span0_data, span0_levels[i]);
    	}

    	let span1_levels = [
    		{
    			class: span1_class_value = classMap({
    				[/*selectedTextContainer$class*/ ctx[17]]: true,
    				'mdc-select__selected-text-container': true
    			})
    		},
    		prefixFilter(/*$$restProps*/ ctx[53], 'selectedTextContainer$')
    	];

    	let span1_data = {};

    	for (let i = 0; i < span1_levels.length; i += 1) {
    		span1_data = assign$1(span1_data, span1_levels[i]);
    	}

    	let span2_levels = [
    		{
    			class: span2_class_value = classMap({
    				[/*dropdownIcon$class*/ ctx[21]]: true,
    				'mdc-select__dropdown-icon': true
    			})
    		},
    		prefixFilter(/*$$restProps*/ ctx[53], 'dropdownIcon$')
    	];

    	let span2_data = {};

    	for (let i = 0; i < span2_levels.length; i += 1) {
    		span2_data = assign$1(span2_data, span2_levels[i]);
    	}

    	let if_block4 = /*variant*/ ctx[7] !== 'outlined' && /*ripple*/ ctx[5] && create_if_block_1$7(ctx);

    	let div0_levels = [
    		{
    			class: div0_class_value = classMap({
    				[/*anchor$class*/ ctx[15]]: true,
    				'mdc-select__anchor': true
    			})
    		},
    		{
    			"aria-required": div0_aria_required_value = /*required*/ ctx[10] ? 'true' : undefined
    		},
    		{
    			"aria-disabled": div0_aria_disabled_value = /*disabled*/ ctx[6] ? 'true' : undefined
    		},
    		{ "aria-controls": /*helperId*/ ctx[31] },
    		{ "aria-describedby": /*helperId*/ ctx[31] },
    		/*selectAnchorAttrs*/ ctx[29],
    		prefixFilter(/*$$restProps*/ ctx[53], 'anchor$')
    	];

    	let div0_data = {};

    	for (let i = 0; i < div0_levels.length; i += 1) {
    		div0_data = assign$1(div0_data, div0_levels[i]);
    	}

    	const menu_spread_levels = [
    		{
    			class: classMap({
    				[/*menu$class*/ ctx[22]]: true,
    				'mdc-select__menu': true,
    				.../*menuClasses*/ ctx[33]
    			})
    		},
    		{ fullWidth: true },
    		{ anchor: false },
    		{ anchorElement: /*anchorElement*/ ctx[34] },
    		{ anchorCorner: /*anchorCorner*/ ctx[35] },
    		prefixFilter(/*$$restProps*/ ctx[53], 'menu$')
    	];

    	function menu_open_binding(value) {
    		/*menu_open_binding*/ ctx[78](value);
    	}

    	let menu_props = {
    		$$slots: { default: [create_default_slot_1$6] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < menu_spread_levels.length; i += 1) {
    		menu_props = assign$1(menu_props, menu_spread_levels[i]);
    	}

    	if (/*menuOpen*/ ctx[32] !== void 0) {
    		menu_props.open = /*menuOpen*/ ctx[32];
    	}

    	menu = new Menu({ props: menu_props, $$inline: true });
    	binding_callbacks.push(() => bind(menu, 'open', menu_open_binding));
    	menu.$on("SMUIMenu:selected", /*SMUIMenu_selected_handler*/ ctx[79]);
    	menu.$on("SMUIMenuSurface:closing", /*SMUIMenuSurface_closing_handler*/ ctx[80]);
    	menu.$on("SMUIMenuSurface:closed", /*SMUIMenuSurface_closed_handler*/ ctx[81]);
    	menu.$on("SMUIMenuSurface:opened", /*SMUIMenuSurface_opened_handler*/ ctx[82]);

    	let div1_levels = [
    		{
    			class: div1_class_value = classMap({
    				[/*className*/ ctx[3]]: true,
    				'mdc-select': true,
    				'mdc-select--required': /*required*/ ctx[10],
    				'mdc-select--disabled': /*disabled*/ ctx[6],
    				'mdc-select--filled': /*variant*/ ctx[7] === 'filled',
    				'mdc-select--outlined': /*variant*/ ctx[7] === 'outlined',
    				'smui-select--standard': /*variant*/ ctx[7] === 'standard',
    				'mdc-select--with-leading-icon': /*isUninitializedValue*/ ctx[45](/*withLeadingIcon*/ ctx[13])
    				? /*$$slots*/ ctx[52].leadingIcon
    				: /*withLeadingIcon*/ ctx[13],
    				'mdc-select--no-label': /*noLabel*/ ctx[8] || /*label*/ ctx[9] == null && !/*$$slots*/ ctx[52].label,
    				'mdc-select--invalid': /*invalid*/ ctx[1],
    				'mdc-select--activated': /*menuOpen*/ ctx[32],
    				'mdc-data-table__pagination-rows-per-page-select': /*context*/ ctx[46] === 'data-table:pagination',
    				.../*internalClasses*/ ctx[26]
    			})
    		},
    		{
    			style: div1_style_value = Object.entries(/*internalStyles*/ ctx[27]).map(func$7).concat([/*style*/ ctx[4]]).join(' ')
    		},
    		exclude(/*$$restProps*/ ctx[53], [
    			'input$',
    			'anchor$',
    			'label$',
    			'outline$',
    			'selectedTextContainer$',
    			'selectedText$',
    			'dropdownIcon$',
    			'ripple$',
    			'menu$',
    			'list$',
    			'helperText$'
    		])
    	];

    	let div1_data = {};

    	for (let i = 0; i < div1_levels.length; i += 1) {
    		div1_data = assign$1(div1_data, div1_levels[i]);
    	}

    	let if_block5 = /*$$slots*/ ctx[52].helperText && create_if_block$d(ctx);

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			if (if_block0) if_block0.c();
    			t0 = space();
    			div0 = element("div");
    			if (if_block1) if_block1.c();
    			t1 = space();
    			if (if_block2) if_block2.c();
    			t2 = space();
    			if (if_block3) if_block3.c();
    			t3 = space();
    			if (leadingIcon_slot) leadingIcon_slot.c();
    			t4 = space();
    			span1 = element("span");
    			span0 = element("span");
    			t5 = text(/*$selectedTextStore*/ ctx[43]);
    			t6 = space();
    			span2 = element("span");
    			svg = svg_element("svg");
    			polygon0 = svg_element("polygon");
    			polygon1 = svg_element("polygon");
    			t7 = space();
    			if (if_block4) if_block4.c();
    			t8 = space();
    			create_component(menu.$$.fragment);
    			t9 = space();
    			if (if_block5) if_block5.c();
    			if_block5_anchor = empty$2();
    			set_attributes(span0, span0_data);
    			add_location(span0, file$k, 124, 6, 3753);
    			set_attributes(span1, span1_data);
    			add_location(span1, file$k, 116, 4, 3491);
    			attr_dev(polygon0, "class", "mdc-select__dropdown-icon-inactive");
    			attr_dev(polygon0, "stroke", "none");
    			attr_dev(polygon0, "fill-rule", "evenodd");
    			attr_dev(polygon0, "points", "7 10 12 15 17 10");
    			add_location(polygon0, file$k, 153, 8, 4575);
    			attr_dev(polygon1, "class", "mdc-select__dropdown-icon-active");
    			attr_dev(polygon1, "stroke", "none");
    			attr_dev(polygon1, "fill-rule", "evenodd");
    			attr_dev(polygon1, "points", "7 15 12 10 17 15");
    			add_location(polygon1, file$k, 159, 8, 4746);
    			attr_dev(svg, "class", "mdc-select__dropdown-icon-graphic");
    			attr_dev(svg, "viewBox", "7 10 10 5");
    			attr_dev(svg, "focusable", "false");
    			add_location(svg, file$k, 148, 6, 4450);
    			set_attributes(span2, span2_data);
    			add_location(span2, file$k, 140, 4, 4225);
    			set_attributes(div0, div0_data);
    			add_location(div0, file$k, 59, 2, 1596);
    			set_attributes(div1, div1_data);
    			add_location(div1, file$k, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			if (if_block0) if_block0.m(div1, null);
    			append_dev(div1, t0);
    			append_dev(div1, div0);
    			if (if_block1) if_block1.m(div0, null);
    			append_dev(div0, t1);
    			if (if_block2) if_block2.m(div0, null);
    			append_dev(div0, t2);
    			if (if_block3) if_block3.m(div0, null);
    			append_dev(div0, t3);

    			if (leadingIcon_slot) {
    				leadingIcon_slot.m(div0, null);
    			}

    			append_dev(div0, t4);
    			append_dev(div0, span1);
    			append_dev(span1, span0);
    			append_dev(span0, t5);
    			/*span0_binding*/ ctx[69](span0);
    			append_dev(div0, t6);
    			append_dev(div0, span2);
    			append_dev(span2, svg);
    			append_dev(svg, polygon0);
    			append_dev(svg, polygon1);
    			append_dev(div0, t7);
    			if (if_block4) if_block4.m(div0, null);
    			/*div0_binding*/ ctx[71](div0);
    			append_dev(div1, t8);
    			mount_component(menu, div1, null);
    			/*div1_binding*/ ctx[83](div1);
    			insert_dev(target, t9, anchor);
    			if (if_block5) if_block5.m(target, anchor);
    			insert_dev(target, if_block5_anchor, anchor);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, span0, /*selectedText$use*/ ctx[18])),
    					action_destroyer(useActions_action_1 = useActions.call(null, span1, /*selectedTextContainer$use*/ ctx[16])),
    					action_destroyer(useActions_action_2 = useActions.call(null, span2, /*dropdownIcon$use*/ ctx[20])),
    					action_destroyer(useActions_action_3 = useActions.call(null, div0, /*anchor$use*/ ctx[14])),
    					listen_dev(div0, "focus", /*focus_handler_1*/ ctx[72], false, false, false),
    					listen_dev(div0, "blur", /*blur_handler_1*/ ctx[73], false, false, false),
    					listen_dev(div0, "click", /*click_handler*/ ctx[74], false, false, false),
    					listen_dev(div0, "keydown", /*keydown_handler*/ ctx[75], false, false, false),
    					listen_dev(div0, "focus", /*focus_handler*/ ctx[64], false, false, false),
    					listen_dev(div0, "blur", /*blur_handler*/ ctx[65], false, false, false),
    					action_destroyer(Ripple_action = Ripple.call(null, div1, {
    						ripple: /*variant*/ ctx[7] === 'filled',
    						unbounded: false,
    						addClass: /*addClass*/ ctx[49],
    						removeClass: /*removeClass*/ ctx[50],
    						addStyle: /*addStyle*/ ctx[51]
    					})),
    					action_destroyer(Anchor.call(null, div1, {
    						addClass: /*addClass*/ ctx[49],
    						removeClass: /*removeClass*/ ctx[50]
    					})),
    					action_destroyer(useActions_action_4 = useActions.call(null, div1, /*use*/ ctx[2])),
    					action_destroyer(/*forwardEvents*/ ctx[44].call(null, div1)),
    					listen_dev(div1, "SMUISelectLeadingIcon:mount", /*SMUISelectLeadingIcon_mount_handler*/ ctx[84], false, false, false),
    					listen_dev(div1, "SMUISelectLeadingIcon:unmount", /*SMUISelectLeadingIcon_unmount_handler*/ ctx[85], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (/*hiddenInput*/ ctx[12]) {
    				if (if_block0) {
    					if_block0.p(ctx, dirty);
    				} else {
    					if_block0 = create_if_block_6(ctx);
    					if_block0.c();
    					if_block0.m(div1, t0);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (/*variant*/ ctx[7] === 'filled') {
    				if (if_block1) ; else {
    					if_block1 = create_if_block_5$1(ctx);
    					if_block1.c();
    					if_block1.m(div0, t1);
    				}
    			} else if (if_block1) {
    				if_block1.d(1);
    				if_block1 = null;
    			}

    			if (/*variant*/ ctx[7] !== 'outlined' && !/*noLabel*/ ctx[8] && (/*label*/ ctx[9] != null || /*$$slots*/ ctx[52].label)) {
    				if (if_block2) {
    					if_block2.p(ctx, dirty);

    					if (dirty[0] & /*variant, noLabel, label*/ 896 | dirty[1] & /*$$slots*/ 2097152) {
    						transition_in(if_block2, 1);
    					}
    				} else {
    					if_block2 = create_if_block_4$2(ctx);
    					if_block2.c();
    					transition_in(if_block2, 1);
    					if_block2.m(div0, t2);
    				}
    			} else if (if_block2) {
    				group_outros();

    				transition_out(if_block2, 1, 1, () => {
    					if_block2 = null;
    				});

    				check_outros();
    			}

    			if (/*variant*/ ctx[7] === 'outlined') {
    				if (if_block3) {
    					if_block3.p(ctx, dirty);

    					if (dirty[0] & /*variant*/ 128) {
    						transition_in(if_block3, 1);
    					}
    				} else {
    					if_block3 = create_if_block_2$4(ctx);
    					if_block3.c();
    					transition_in(if_block3, 1);
    					if_block3.m(div0, t3);
    				}
    			} else if (if_block3) {
    				group_outros();

    				transition_out(if_block3, 1, 1, () => {
    					if_block3 = null;
    				});

    				check_outros();
    			}

    			if (leadingIcon_slot) {
    				if (leadingIcon_slot.p && (!current || dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						leadingIcon_slot,
    						leadingIcon_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(leadingIcon_slot_template, /*$$scope*/ ctx[89], dirty, get_leadingIcon_slot_changes),
    						get_leadingIcon_slot_context
    					);
    				}
    			}

    			if (!current || dirty[1] & /*$selectedTextStore*/ 4096) set_data_dev(t5, /*$selectedTextStore*/ ctx[43]);

    			set_attributes(span0, span0_data = get_spread_update(span0_levels, [
    				(!current || dirty[0] & /*inputId*/ 2048 && span0_id_value !== (span0_id_value = /*inputId*/ ctx[11] + '-smui-selected-text')) && { id: span0_id_value },
    				(!current || dirty[0] & /*selectedText$class*/ 524288 && span0_class_value !== (span0_class_value = classMap({
    					[/*selectedText$class*/ ctx[19]]: true,
    					'mdc-select__selected-text': true
    				}))) && { class: span0_class_value },
    				{ role: "button" },
    				{ "aria-haspopup": "listbox" },
    				(!current || dirty[0] & /*inputId*/ 2048 && span0_aria_labelledby_value !== (span0_aria_labelledby_value = /*inputId*/ ctx[11] + '-smui-label')) && {
    					"aria-labelledby": span0_aria_labelledby_value
    				},
    				dirty[1] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[53], 'selectedText$')
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*selectedText$use*/ 262144) useActions_action.update.call(null, /*selectedText$use*/ ctx[18]);

    			set_attributes(span1, span1_data = get_spread_update(span1_levels, [
    				(!current || dirty[0] & /*selectedTextContainer$class*/ 131072 && span1_class_value !== (span1_class_value = classMap({
    					[/*selectedTextContainer$class*/ ctx[17]]: true,
    					'mdc-select__selected-text-container': true
    				}))) && { class: span1_class_value },
    				dirty[1] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[53], 'selectedTextContainer$')
    			]));

    			if (useActions_action_1 && is_function(useActions_action_1.update) && dirty[0] & /*selectedTextContainer$use*/ 65536) useActions_action_1.update.call(null, /*selectedTextContainer$use*/ ctx[16]);

    			set_attributes(span2, span2_data = get_spread_update(span2_levels, [
    				(!current || dirty[0] & /*dropdownIcon$class*/ 2097152 && span2_class_value !== (span2_class_value = classMap({
    					[/*dropdownIcon$class*/ ctx[21]]: true,
    					'mdc-select__dropdown-icon': true
    				}))) && { class: span2_class_value },
    				dirty[1] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[53], 'dropdownIcon$')
    			]));

    			if (useActions_action_2 && is_function(useActions_action_2.update) && dirty[0] & /*dropdownIcon$use*/ 1048576) useActions_action_2.update.call(null, /*dropdownIcon$use*/ ctx[20]);

    			if (/*variant*/ ctx[7] !== 'outlined' && /*ripple*/ ctx[5]) {
    				if (if_block4) {
    					if_block4.p(ctx, dirty);

    					if (dirty[0] & /*variant, ripple*/ 160) {
    						transition_in(if_block4, 1);
    					}
    				} else {
    					if_block4 = create_if_block_1$7(ctx);
    					if_block4.c();
    					transition_in(if_block4, 1);
    					if_block4.m(div0, null);
    				}
    			} else if (if_block4) {
    				group_outros();

    				transition_out(if_block4, 1, 1, () => {
    					if_block4 = null;
    				});

    				check_outros();
    			}

    			set_attributes(div0, div0_data = get_spread_update(div0_levels, [
    				(!current || dirty[0] & /*anchor$class*/ 32768 && div0_class_value !== (div0_class_value = classMap({
    					[/*anchor$class*/ ctx[15]]: true,
    					'mdc-select__anchor': true
    				}))) && { class: div0_class_value },
    				(!current || dirty[0] & /*required*/ 1024 && div0_aria_required_value !== (div0_aria_required_value = /*required*/ ctx[10] ? 'true' : undefined)) && {
    					"aria-required": div0_aria_required_value
    				},
    				(!current || dirty[0] & /*disabled*/ 64 && div0_aria_disabled_value !== (div0_aria_disabled_value = /*disabled*/ ctx[6] ? 'true' : undefined)) && {
    					"aria-disabled": div0_aria_disabled_value
    				},
    				(!current || dirty[1] & /*helperId*/ 1) && { "aria-controls": /*helperId*/ ctx[31] },
    				(!current || dirty[1] & /*helperId*/ 1) && { "aria-describedby": /*helperId*/ ctx[31] },
    				dirty[0] & /*selectAnchorAttrs*/ 536870912 && /*selectAnchorAttrs*/ ctx[29],
    				dirty[1] & /*$$restProps*/ 4194304 && prefixFilter(/*$$restProps*/ ctx[53], 'anchor$')
    			]));

    			if (useActions_action_3 && is_function(useActions_action_3.update) && dirty[0] & /*anchor$use*/ 16384) useActions_action_3.update.call(null, /*anchor$use*/ ctx[14]);

    			const menu_changes = (dirty[0] & /*menu$class*/ 4194304 | dirty[1] & /*menuClasses, anchorElement, anchorCorner, $$restProps*/ 4194332)
    			? get_spread_update(menu_spread_levels, [
    					dirty[0] & /*menu$class*/ 4194304 | dirty[1] & /*menuClasses*/ 4 && {
    						class: classMap({
    							[/*menu$class*/ ctx[22]]: true,
    							'mdc-select__menu': true,
    							.../*menuClasses*/ ctx[33]
    						})
    					},
    					menu_spread_levels[1],
    					menu_spread_levels[2],
    					dirty[1] & /*anchorElement*/ 8 && { anchorElement: /*anchorElement*/ ctx[34] },
    					dirty[1] & /*anchorCorner*/ 16 && { anchorCorner: /*anchorCorner*/ ctx[35] },
    					dirty[1] & /*$$restProps*/ 4194304 && get_spread_object(prefixFilter(/*$$restProps*/ ctx[53], 'menu$'))
    				])
    			: {};

    			if (dirty[0] & /*selectedIndex*/ 16777216 | dirty[1] & /*wrapFocus, $$restProps, list*/ 4194400 | dirty[2] & /*$$scope*/ 134217728) {
    				menu_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_open && dirty[1] & /*menuOpen*/ 2) {
    				updating_open = true;
    				menu_changes.open = /*menuOpen*/ ctx[32];
    				add_flush_callback(() => updating_open = false);
    			}

    			menu.$set(menu_changes);

    			set_attributes(div1, div1_data = get_spread_update(div1_levels, [
    				(!current || dirty[0] & /*className, required, disabled, variant, withLeadingIcon, noLabel, label, invalid, internalClasses*/ 67119050 | dirty[1] & /*$$slots, menuOpen*/ 2097154 && div1_class_value !== (div1_class_value = classMap({
    					[/*className*/ ctx[3]]: true,
    					'mdc-select': true,
    					'mdc-select--required': /*required*/ ctx[10],
    					'mdc-select--disabled': /*disabled*/ ctx[6],
    					'mdc-select--filled': /*variant*/ ctx[7] === 'filled',
    					'mdc-select--outlined': /*variant*/ ctx[7] === 'outlined',
    					'smui-select--standard': /*variant*/ ctx[7] === 'standard',
    					'mdc-select--with-leading-icon': /*isUninitializedValue*/ ctx[45](/*withLeadingIcon*/ ctx[13])
    					? /*$$slots*/ ctx[52].leadingIcon
    					: /*withLeadingIcon*/ ctx[13],
    					'mdc-select--no-label': /*noLabel*/ ctx[8] || /*label*/ ctx[9] == null && !/*$$slots*/ ctx[52].label,
    					'mdc-select--invalid': /*invalid*/ ctx[1],
    					'mdc-select--activated': /*menuOpen*/ ctx[32],
    					'mdc-data-table__pagination-rows-per-page-select': /*context*/ ctx[46] === 'data-table:pagination',
    					.../*internalClasses*/ ctx[26]
    				}))) && { class: div1_class_value },
    				(!current || dirty[0] & /*internalStyles, style*/ 134217744 && div1_style_value !== (div1_style_value = Object.entries(/*internalStyles*/ ctx[27]).map(func$7).concat([/*style*/ ctx[4]]).join(' '))) && { style: div1_style_value },
    				dirty[1] & /*$$restProps*/ 4194304 && exclude(/*$$restProps*/ ctx[53], [
    					'input$',
    					'anchor$',
    					'label$',
    					'outline$',
    					'selectedTextContainer$',
    					'selectedText$',
    					'dropdownIcon$',
    					'ripple$',
    					'menu$',
    					'list$',
    					'helperText$'
    				])
    			]));

    			if (Ripple_action && is_function(Ripple_action.update) && dirty[0] & /*variant*/ 128) Ripple_action.update.call(null, {
    				ripple: /*variant*/ ctx[7] === 'filled',
    				unbounded: false,
    				addClass: /*addClass*/ ctx[49],
    				removeClass: /*removeClass*/ ctx[50],
    				addStyle: /*addStyle*/ ctx[51]
    			});

    			if (useActions_action_4 && is_function(useActions_action_4.update) && dirty[0] & /*use*/ 4) useActions_action_4.update.call(null, /*use*/ ctx[2]);

    			if (/*$$slots*/ ctx[52].helperText) {
    				if (if_block5) {
    					if_block5.p(ctx, dirty);

    					if (dirty[1] & /*$$slots*/ 2097152) {
    						transition_in(if_block5, 1);
    					}
    				} else {
    					if_block5 = create_if_block$d(ctx);
    					if_block5.c();
    					transition_in(if_block5, 1);
    					if_block5.m(if_block5_anchor.parentNode, if_block5_anchor);
    				}
    			} else if (if_block5) {
    				group_outros();

    				transition_out(if_block5, 1, 1, () => {
    					if_block5 = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block2);
    			transition_in(if_block3);
    			transition_in(leadingIcon_slot, local);
    			transition_in(if_block4);
    			transition_in(menu.$$.fragment, local);
    			transition_in(if_block5);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block2);
    			transition_out(if_block3);
    			transition_out(leadingIcon_slot, local);
    			transition_out(if_block4);
    			transition_out(menu.$$.fragment, local);
    			transition_out(if_block5);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (if_block0) if_block0.d();
    			if (if_block1) if_block1.d();
    			if (if_block2) if_block2.d();
    			if (if_block3) if_block3.d();
    			if (leadingIcon_slot) leadingIcon_slot.d(detaching);
    			/*span0_binding*/ ctx[69](null);
    			if (if_block4) if_block4.d();
    			/*div0_binding*/ ctx[71](null);
    			destroy_component(menu);
    			/*div1_binding*/ ctx[83](null);
    			if (detaching) detach_dev(t9);
    			if (if_block5) if_block5.d(detaching);
    			if (detaching) detach_dev(if_block5_anchor);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$m.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }
    let counter = 0;

    function getNormalizedXCoordinate(evt) {
    	const targetClientRect = evt.currentTarget.getBoundingClientRect();
    	const xCoordinate = isTouchEvent(evt) ? evt.touches[0].clientX : evt.clientX;
    	return xCoordinate - targetClientRect.left;
    }

    function isTouchEvent(evt) {
    	return 'touches' in evt;
    }

    const func$7 = ([name, value]) => `${name}: ${value};`;

    function instance_1$2($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","ripple","disabled","variant","noLabel","label","value","key","dirty","invalid","updateInvalid","required","inputId","hiddenInput","withLeadingIcon","anchor$use","anchor$class","selectedTextContainer$use","selectedTextContainer$class","selectedText$use","selectedText$class","dropdownIcon$use","dropdownIcon$class","menu$class","getUseDefaultValidation","setUseDefaultValidation","focus","layout","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $selectedTextStore;
    	let $valueStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Select', slots, ['label','leadingIcon','default','helperText']);
    	const $$slots = compute_slots(slots);
    	const forwardEvents = forwardEventsBuilder(get_current_component());

    	let uninitializedValue = () => {
    		
    	};

    	function isUninitializedValue(value) {
    		return value === uninitializedValue;
    	}

    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { ripple = true } = $$props;
    	let { disabled = false } = $$props;
    	let { variant = 'standard' } = $$props;
    	let { noLabel = false } = $$props;
    	let { label = undefined } = $$props;
    	let { value = '' } = $$props;
    	let { key = item => item } = $$props;
    	let { dirty = false } = $$props;
    	let { invalid = uninitializedValue } = $$props;
    	let { updateInvalid = isUninitializedValue(invalid) } = $$props;
    	const useDefaultValidation = isUninitializedValue(invalid);

    	if (isUninitializedValue(invalid)) {
    		invalid = false;
    	}

    	let { required = false } = $$props;
    	let { inputId = 'SMUI-select-' + counter++ } = $$props;
    	let { hiddenInput = false } = $$props;
    	let { withLeadingIcon = uninitializedValue } = $$props;
    	let { anchor$use = [] } = $$props;
    	let { anchor$class = '' } = $$props;
    	let { selectedTextContainer$use = [] } = $$props;
    	let { selectedTextContainer$class = '' } = $$props;
    	let { selectedText$use = [] } = $$props;
    	let { selectedText$class = '' } = $$props;
    	let { dropdownIcon$use = [] } = $$props;
    	let { dropdownIcon$class = '' } = $$props;
    	let { menu$class = '' } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let internalStyles = {};
    	let selectAnchor;
    	let selectAnchorAttrs = {};
    	let selectText;
    	let selectedIndex = -1;
    	let helperId = undefined;
    	let addLayoutListener = getContext('SMUI:addLayoutListener');
    	let removeLayoutListener;
    	let menuOpen = false;
    	let menuClasses = {};
    	let anchorElement = undefined;
    	let anchorCorner = undefined;
    	let wrapFocus = false;
    	let list;
    	let context = getContext('SMUI:select:context');

    	// These are instances, not accessors.
    	let leadingIcon = undefined;

    	let helperText = undefined;

    	// Components
    	let floatingLabel = undefined;

    	let lineRipple = undefined;
    	let notchedOutline = undefined;
    	setContext('SMUI:list:role', '');
    	setContext('SMUI:list:nav', false);

    	// Only needed on initialization.
    	const selectedTextStore = writable('');

    	validate_store(selectedTextStore, 'selectedTextStore');
    	component_subscribe($$self, selectedTextStore, value => $$invalidate(43, $selectedTextStore = value));
    	setContext('SMUI:select:selectedText', selectedTextStore);
    	const valueStore = writable(value);
    	validate_store(valueStore, 'valueStore');
    	component_subscribe($$self, valueStore, value => $$invalidate(91, $valueStore = value));
    	setContext('SMUI:select:value', valueStore);
    	let previousSelectedIndex = selectedIndex;

    	if (addLayoutListener) {
    		removeLayoutListener = addLayoutListener(layout);
    	}

    	onMount(() => {
    		$$invalidate(23, instance = new MDCSelectFoundation({
    				// getSelectAdapterMethods
    				// getMenuItemAttr: (menuItem: Element, attr: string) =>
    				//   menuItem.getAttribute(attr),
    				setSelectedText: text => {
    					set_store_value(selectedTextStore, $selectedTextStore = text, $selectedTextStore);
    				},
    				isSelectAnchorFocused: () => document.activeElement === selectAnchor,
    				getSelectAnchorAttr,
    				setSelectAnchorAttr: addSelectAnchorAttr,
    				removeSelectAnchorAttr,
    				addMenuClass,
    				removeMenuClass,
    				openMenu: () => {
    					$$invalidate(32, menuOpen = true);
    				},
    				closeMenu: () => {
    					$$invalidate(32, menuOpen = false);
    				},
    				getAnchorElement: () => selectAnchor,
    				setMenuAnchorElement: value => {
    					$$invalidate(34, anchorElement = value);
    				},
    				setMenuAnchorCorner: value => {
    					$$invalidate(35, anchorCorner = value);
    				},
    				setMenuWrapFocus: value => {
    					$$invalidate(36, wrapFocus = value);
    				},
    				getSelectedIndex: () => selectedIndex,
    				setSelectedIndex: index => {
    					// Don't update the instance again.
    					$$invalidate(62, previousSelectedIndex = index);

    					$$invalidate(24, selectedIndex = index);
    					$$invalidate(0, value = getMenuItemValues()[selectedIndex]);
    				},
    				focusMenuItemAtIndex: index => {
    					list.focusItemAtIndex(index);
    				},
    				getMenuItemCount: () => list.items.length,
    				getMenuItemValues: () => getMenuItemValues().map(key),
    				getMenuItemTextAtIndex: index => list.getPrimaryTextAtIndex(index),
    				isTypeaheadInProgress: () => list.typeaheadInProgress,
    				typeaheadMatchItem: (nextChar, startingIndex) => list.typeaheadMatchItem(nextChar, startingIndex),
    				// getCommonAdapterMethods
    				addClass,
    				removeClass,
    				hasClass,
    				setRippleCenter: normalizedX => lineRipple && lineRipple.setRippleCenter(normalizedX),
    				activateBottomLine: () => lineRipple && lineRipple.activate(),
    				deactivateBottomLine: () => lineRipple && lineRipple.deactivate(),
    				notifyChange: _selectedValue => {
    					$$invalidate(54, dirty = true);

    					if (updateInvalid) {
    						$$invalidate(1, invalid = !instance.isValid());
    					}

    					dispatch$1(getElement(), 'SMUISelect:change', { value, index: selectedIndex }, undefined, true);
    				},
    				// getOutlineAdapterMethods
    				hasOutline: () => !!notchedOutline,
    				notchOutline: labelWidth => notchedOutline && notchedOutline.notch(labelWidth),
    				closeOutline: () => notchedOutline && notchedOutline.closeNotch(),
    				// getLabelAdapterMethods
    				hasLabel: () => !!floatingLabel,
    				floatLabel: shouldFloat => floatingLabel && floatingLabel.float(shouldFloat),
    				getLabelWidth: () => floatingLabel ? floatingLabel.getWidth() : 0,
    				setLabelRequired: isRequired => floatingLabel && floatingLabel.setRequired(isRequired)
    			},
    		{
    				get helperText() {
    					return helperText;
    				},
    				get leadingIcon() {
    					return leadingIcon;
    				}
    			}));

    		$$invalidate(24, selectedIndex = getMenuItemValues().indexOf(value));
    		instance.init();
    		setUseDefaultValidation(useDefaultValidation);

    		return () => {
    			instance.destroy();
    		};
    	});

    	onDestroy(() => {
    		if (removeLayoutListener) {
    			removeLayoutListener();
    		}
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(26, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(26, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(27, internalStyles);
    			} else {
    				$$invalidate(27, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function addMenuClass(className) {
    		if (!menuClasses[className]) {
    			$$invalidate(33, menuClasses[className] = true, menuClasses);
    		}
    	}

    	function removeMenuClass(className) {
    		if (!(className in menuClasses) || menuClasses[className]) {
    			$$invalidate(33, menuClasses[className] = false, menuClasses);
    		}
    	}

    	function getSelectAnchorAttr(name) {
    		var _a;

    		return name in selectAnchorAttrs
    		? (_a = selectAnchorAttrs[name]) !== null && _a !== void 0
    			? _a
    			: null
    		: getElement().getAttribute(name);
    	}

    	function addSelectAnchorAttr(name, value) {
    		if (selectAnchorAttrs[name] !== value) {
    			$$invalidate(29, selectAnchorAttrs[name] = value, selectAnchorAttrs);
    		}
    	}

    	function removeSelectAnchorAttr(name) {
    		if (!(name in selectAnchorAttrs) || selectAnchorAttrs[name] != null) {
    			$$invalidate(29, selectAnchorAttrs[name] = undefined, selectAnchorAttrs);
    		}
    	}

    	function getMenuItemValues() {
    		return list.getOrderedList().map(accessor => accessor.getValue());
    	}

    	function getUseDefaultValidation() {
    		return instance.getUseDefaultValidation();
    	}

    	function setUseDefaultValidation(useDefaultValidation) {
    		instance.setUseDefaultValidation(useDefaultValidation);
    	}

    	function focus() {
    		selectAnchor.focus();
    	}

    	function layout() {
    		instance.layout();
    	}

    	function getElement() {
    		return element;
    	}

    	function focus_handler(event) {
    		bubble.call(this, $$self, event);
    	}

    	function blur_handler(event) {
    		bubble.call(this, $$self, event);
    	}

    	function floatinglabel_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			floatingLabel = $$value;
    			$$invalidate(40, floatingLabel);
    		});
    	}

    	function floatinglabel_binding_1($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			floatingLabel = $$value;
    			$$invalidate(40, floatingLabel);
    		});
    	}

    	function notchedoutline_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			notchedOutline = $$value;
    			$$invalidate(42, notchedOutline);
    		});
    	}

    	function span0_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			selectText = $$value;
    			$$invalidate(30, selectText);
    		});
    	}

    	function lineripple_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			lineRipple = $$value;
    			$$invalidate(41, lineRipple);
    		});
    	}

    	function div0_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			selectAnchor = $$value;
    			$$invalidate(28, selectAnchor);
    		});
    	}

    	const focus_handler_1 = () => instance && instance.handleFocus();
    	const blur_handler_1 = () => instance && instance.handleBlur();

    	const click_handler = event => {
    		selectAnchor.focus();

    		if (instance) {
    			instance.handleClick(getNormalizedXCoordinate(event));
    		}
    	};

    	const keydown_handler = event => instance && instance.handleKeydown(event);

    	function list_1_selectedIndex_binding(value) {
    		selectedIndex = value;
    		$$invalidate(24, selectedIndex);
    	}

    	const SMUIList_mount_handler = event => $$invalidate(37, list = event.detail);

    	function menu_open_binding(value) {
    		menuOpen = value;
    		$$invalidate(32, menuOpen);
    	}

    	const SMUIMenu_selected_handler = event => instance && instance.handleMenuItemAction(event.detail.index);
    	const SMUIMenuSurface_closing_handler = () => instance && instance.handleMenuClosing();
    	const SMUIMenuSurface_closed_handler = () => instance && instance.handleMenuClosed();
    	const SMUIMenuSurface_opened_handler = () => instance && instance.handleMenuOpened();

    	function div1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(25, element);
    		});
    	}

    	const SMUISelectLeadingIcon_mount_handler = event => $$invalidate(38, leadingIcon = event.detail);
    	const SMUISelectLeadingIcon_unmount_handler = () => $$invalidate(38, leadingIcon = undefined);
    	const SMUISelectHelperText_id_handler = event => $$invalidate(31, helperId = event.detail);
    	const SMUISelectHelperText_mount_handler = event => $$invalidate(39, helperText = event.detail);

    	const SMUISelectHelperText_unmount_handler = () => {
    		$$invalidate(31, helperId = undefined);
    		$$invalidate(39, helperText = undefined);
    	};

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(53, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(2, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(3, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(4, style = $$new_props.style);
    		if ('ripple' in $$new_props) $$invalidate(5, ripple = $$new_props.ripple);
    		if ('disabled' in $$new_props) $$invalidate(6, disabled = $$new_props.disabled);
    		if ('variant' in $$new_props) $$invalidate(7, variant = $$new_props.variant);
    		if ('noLabel' in $$new_props) $$invalidate(8, noLabel = $$new_props.noLabel);
    		if ('label' in $$new_props) $$invalidate(9, label = $$new_props.label);
    		if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
    		if ('key' in $$new_props) $$invalidate(55, key = $$new_props.key);
    		if ('dirty' in $$new_props) $$invalidate(54, dirty = $$new_props.dirty);
    		if ('invalid' in $$new_props) $$invalidate(1, invalid = $$new_props.invalid);
    		if ('updateInvalid' in $$new_props) $$invalidate(56, updateInvalid = $$new_props.updateInvalid);
    		if ('required' in $$new_props) $$invalidate(10, required = $$new_props.required);
    		if ('inputId' in $$new_props) $$invalidate(11, inputId = $$new_props.inputId);
    		if ('hiddenInput' in $$new_props) $$invalidate(12, hiddenInput = $$new_props.hiddenInput);
    		if ('withLeadingIcon' in $$new_props) $$invalidate(13, withLeadingIcon = $$new_props.withLeadingIcon);
    		if ('anchor$use' in $$new_props) $$invalidate(14, anchor$use = $$new_props.anchor$use);
    		if ('anchor$class' in $$new_props) $$invalidate(15, anchor$class = $$new_props.anchor$class);
    		if ('selectedTextContainer$use' in $$new_props) $$invalidate(16, selectedTextContainer$use = $$new_props.selectedTextContainer$use);
    		if ('selectedTextContainer$class' in $$new_props) $$invalidate(17, selectedTextContainer$class = $$new_props.selectedTextContainer$class);
    		if ('selectedText$use' in $$new_props) $$invalidate(18, selectedText$use = $$new_props.selectedText$use);
    		if ('selectedText$class' in $$new_props) $$invalidate(19, selectedText$class = $$new_props.selectedText$class);
    		if ('dropdownIcon$use' in $$new_props) $$invalidate(20, dropdownIcon$use = $$new_props.dropdownIcon$use);
    		if ('dropdownIcon$class' in $$new_props) $$invalidate(21, dropdownIcon$class = $$new_props.dropdownIcon$class);
    		if ('menu$class' in $$new_props) $$invalidate(22, menu$class = $$new_props.menu$class);
    		if ('$$scope' in $$new_props) $$invalidate(89, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		counter,
    		MDCSelectFoundation,
    		onMount,
    		onDestroy,
    		getContext,
    		setContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		exclude,
    		prefixFilter,
    		useActions,
    		dispatch: dispatch$1,
    		Ripple,
    		Anchor,
    		Menu,
    		List: List$2,
    		FloatingLabel,
    		LineRipple,
    		NotchedOutline,
    		HelperText,
    		forwardEvents,
    		uninitializedValue,
    		isUninitializedValue,
    		use,
    		className,
    		style,
    		ripple,
    		disabled,
    		variant,
    		noLabel,
    		label,
    		value,
    		key,
    		dirty,
    		invalid,
    		updateInvalid,
    		useDefaultValidation,
    		required,
    		inputId,
    		hiddenInput,
    		withLeadingIcon,
    		anchor$use,
    		anchor$class,
    		selectedTextContainer$use,
    		selectedTextContainer$class,
    		selectedText$use,
    		selectedText$class,
    		dropdownIcon$use,
    		dropdownIcon$class,
    		menu$class,
    		element,
    		instance,
    		internalClasses,
    		internalStyles,
    		selectAnchor,
    		selectAnchorAttrs,
    		selectText,
    		selectedIndex,
    		helperId,
    		addLayoutListener,
    		removeLayoutListener,
    		menuOpen,
    		menuClasses,
    		anchorElement,
    		anchorCorner,
    		wrapFocus,
    		list,
    		context,
    		leadingIcon,
    		helperText,
    		floatingLabel,
    		lineRipple,
    		notchedOutline,
    		selectedTextStore,
    		valueStore,
    		previousSelectedIndex,
    		hasClass,
    		addClass,
    		removeClass,
    		addStyle,
    		addMenuClass,
    		removeMenuClass,
    		getSelectAnchorAttr,
    		addSelectAnchorAttr,
    		removeSelectAnchorAttr,
    		getMenuItemValues,
    		getNormalizedXCoordinate,
    		isTouchEvent,
    		getUseDefaultValidation,
    		setUseDefaultValidation,
    		focus,
    		layout,
    		getElement,
    		$selectedTextStore,
    		$valueStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('uninitializedValue' in $$props) uninitializedValue = $$new_props.uninitializedValue;
    		if ('use' in $$props) $$invalidate(2, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(3, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(4, style = $$new_props.style);
    		if ('ripple' in $$props) $$invalidate(5, ripple = $$new_props.ripple);
    		if ('disabled' in $$props) $$invalidate(6, disabled = $$new_props.disabled);
    		if ('variant' in $$props) $$invalidate(7, variant = $$new_props.variant);
    		if ('noLabel' in $$props) $$invalidate(8, noLabel = $$new_props.noLabel);
    		if ('label' in $$props) $$invalidate(9, label = $$new_props.label);
    		if ('value' in $$props) $$invalidate(0, value = $$new_props.value);
    		if ('key' in $$props) $$invalidate(55, key = $$new_props.key);
    		if ('dirty' in $$props) $$invalidate(54, dirty = $$new_props.dirty);
    		if ('invalid' in $$props) $$invalidate(1, invalid = $$new_props.invalid);
    		if ('updateInvalid' in $$props) $$invalidate(56, updateInvalid = $$new_props.updateInvalid);
    		if ('required' in $$props) $$invalidate(10, required = $$new_props.required);
    		if ('inputId' in $$props) $$invalidate(11, inputId = $$new_props.inputId);
    		if ('hiddenInput' in $$props) $$invalidate(12, hiddenInput = $$new_props.hiddenInput);
    		if ('withLeadingIcon' in $$props) $$invalidate(13, withLeadingIcon = $$new_props.withLeadingIcon);
    		if ('anchor$use' in $$props) $$invalidate(14, anchor$use = $$new_props.anchor$use);
    		if ('anchor$class' in $$props) $$invalidate(15, anchor$class = $$new_props.anchor$class);
    		if ('selectedTextContainer$use' in $$props) $$invalidate(16, selectedTextContainer$use = $$new_props.selectedTextContainer$use);
    		if ('selectedTextContainer$class' in $$props) $$invalidate(17, selectedTextContainer$class = $$new_props.selectedTextContainer$class);
    		if ('selectedText$use' in $$props) $$invalidate(18, selectedText$use = $$new_props.selectedText$use);
    		if ('selectedText$class' in $$props) $$invalidate(19, selectedText$class = $$new_props.selectedText$class);
    		if ('dropdownIcon$use' in $$props) $$invalidate(20, dropdownIcon$use = $$new_props.dropdownIcon$use);
    		if ('dropdownIcon$class' in $$props) $$invalidate(21, dropdownIcon$class = $$new_props.dropdownIcon$class);
    		if ('menu$class' in $$props) $$invalidate(22, menu$class = $$new_props.menu$class);
    		if ('element' in $$props) $$invalidate(25, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(23, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(26, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(27, internalStyles = $$new_props.internalStyles);
    		if ('selectAnchor' in $$props) $$invalidate(28, selectAnchor = $$new_props.selectAnchor);
    		if ('selectAnchorAttrs' in $$props) $$invalidate(29, selectAnchorAttrs = $$new_props.selectAnchorAttrs);
    		if ('selectText' in $$props) $$invalidate(30, selectText = $$new_props.selectText);
    		if ('selectedIndex' in $$props) $$invalidate(24, selectedIndex = $$new_props.selectedIndex);
    		if ('helperId' in $$props) $$invalidate(31, helperId = $$new_props.helperId);
    		if ('addLayoutListener' in $$props) addLayoutListener = $$new_props.addLayoutListener;
    		if ('removeLayoutListener' in $$props) removeLayoutListener = $$new_props.removeLayoutListener;
    		if ('menuOpen' in $$props) $$invalidate(32, menuOpen = $$new_props.menuOpen);
    		if ('menuClasses' in $$props) $$invalidate(33, menuClasses = $$new_props.menuClasses);
    		if ('anchorElement' in $$props) $$invalidate(34, anchorElement = $$new_props.anchorElement);
    		if ('anchorCorner' in $$props) $$invalidate(35, anchorCorner = $$new_props.anchorCorner);
    		if ('wrapFocus' in $$props) $$invalidate(36, wrapFocus = $$new_props.wrapFocus);
    		if ('list' in $$props) $$invalidate(37, list = $$new_props.list);
    		if ('context' in $$props) $$invalidate(46, context = $$new_props.context);
    		if ('leadingIcon' in $$props) $$invalidate(38, leadingIcon = $$new_props.leadingIcon);
    		if ('helperText' in $$props) $$invalidate(39, helperText = $$new_props.helperText);
    		if ('floatingLabel' in $$props) $$invalidate(40, floatingLabel = $$new_props.floatingLabel);
    		if ('lineRipple' in $$props) $$invalidate(41, lineRipple = $$new_props.lineRipple);
    		if ('notchedOutline' in $$props) $$invalidate(42, notchedOutline = $$new_props.notchedOutline);
    		if ('previousSelectedIndex' in $$props) $$invalidate(62, previousSelectedIndex = $$new_props.previousSelectedIndex);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*selectedIndex, instance, value*/ 25165825 | $$self.$$.dirty[2] & /*previousSelectedIndex*/ 1) {
    			if (previousSelectedIndex !== selectedIndex) {
    				$$invalidate(62, previousSelectedIndex = selectedIndex);

    				if (instance) {
    					instance.setSelectedIndex(
    						selectedIndex,
    						/* closeMenu */
    						false,
    						/* skipNotify */
    						true
    					);
    				} else {
    					const values = getMenuItemValues();

    					if (value !== values[selectedIndex]) {
    						$$invalidate(0, value = values[selectedIndex]);
    					}
    				}
    			}
    		}

    		if ($$self.$$.dirty[0] & /*value*/ 1) {
    			set_store_value(valueStore, $valueStore = value, $valueStore);
    		}

    		if ($$self.$$.dirty[0] & /*instance, value*/ 8388609 | $$self.$$.dirty[1] & /*key*/ 16777216) {
    			if (instance && instance.getValue() !== key(value)) {
    				instance.setValue(key(value));
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, disabled*/ 8388672) {
    			if (instance && instance.getDisabled() !== disabled) {
    				instance.setDisabled(disabled);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, invalid*/ 8388610 | $$self.$$.dirty[1] & /*dirty, updateInvalid*/ 41943040) {
    			if (instance && dirty && instance.isValid() !== !invalid) {
    				if (updateInvalid) {
    					$$invalidate(1, invalid = !instance.isValid());
    				} else {
    					instance.setValid(!invalid);
    				}
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, required*/ 8389632) {
    			if (instance && instance.getRequired() !== required) {
    				instance.setRequired(required);
    			}
    		}
    	};

    	return [
    		value,
    		invalid,
    		use,
    		className,
    		style,
    		ripple,
    		disabled,
    		variant,
    		noLabel,
    		label,
    		required,
    		inputId,
    		hiddenInput,
    		withLeadingIcon,
    		anchor$use,
    		anchor$class,
    		selectedTextContainer$use,
    		selectedTextContainer$class,
    		selectedText$use,
    		selectedText$class,
    		dropdownIcon$use,
    		dropdownIcon$class,
    		menu$class,
    		instance,
    		selectedIndex,
    		element,
    		internalClasses,
    		internalStyles,
    		selectAnchor,
    		selectAnchorAttrs,
    		selectText,
    		helperId,
    		menuOpen,
    		menuClasses,
    		anchorElement,
    		anchorCorner,
    		wrapFocus,
    		list,
    		leadingIcon,
    		helperText,
    		floatingLabel,
    		lineRipple,
    		notchedOutline,
    		$selectedTextStore,
    		forwardEvents,
    		isUninitializedValue,
    		context,
    		selectedTextStore,
    		valueStore,
    		addClass,
    		removeClass,
    		addStyle,
    		$$slots,
    		$$restProps,
    		dirty,
    		key,
    		updateInvalid,
    		getUseDefaultValidation,
    		setUseDefaultValidation,
    		focus,
    		layout,
    		getElement,
    		previousSelectedIndex,
    		slots,
    		focus_handler,
    		blur_handler,
    		floatinglabel_binding,
    		floatinglabel_binding_1,
    		notchedoutline_binding,
    		span0_binding,
    		lineripple_binding,
    		div0_binding,
    		focus_handler_1,
    		blur_handler_1,
    		click_handler,
    		keydown_handler,
    		list_1_selectedIndex_binding,
    		SMUIList_mount_handler,
    		menu_open_binding,
    		SMUIMenu_selected_handler,
    		SMUIMenuSurface_closing_handler,
    		SMUIMenuSurface_closed_handler,
    		SMUIMenuSurface_opened_handler,
    		div1_binding,
    		SMUISelectLeadingIcon_mount_handler,
    		SMUISelectLeadingIcon_unmount_handler,
    		SMUISelectHelperText_id_handler,
    		SMUISelectHelperText_mount_handler,
    		SMUISelectHelperText_unmount_handler,
    		$$scope
    	];
    }

    class Select extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$2,
    			create_fragment$m,
    			safe_not_equal,
    			{
    				use: 2,
    				class: 3,
    				style: 4,
    				ripple: 5,
    				disabled: 6,
    				variant: 7,
    				noLabel: 8,
    				label: 9,
    				value: 0,
    				key: 55,
    				dirty: 54,
    				invalid: 1,
    				updateInvalid: 56,
    				required: 10,
    				inputId: 11,
    				hiddenInput: 12,
    				withLeadingIcon: 13,
    				anchor$use: 14,
    				anchor$class: 15,
    				selectedTextContainer$use: 16,
    				selectedTextContainer$class: 17,
    				selectedText$use: 18,
    				selectedText$class: 19,
    				dropdownIcon$use: 20,
    				dropdownIcon$class: 21,
    				menu$class: 22,
    				getUseDefaultValidation: 57,
    				setUseDefaultValidation: 58,
    				focus: 59,
    				layout: 60,
    				getElement: 61
    			},
    			null,
    			[-1, -1, -1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Select",
    			options,
    			id: create_fragment$m.name
    		});
    	}

    	get use() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get disabled() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set disabled(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get variant() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set variant(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get noLabel() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set noLabel(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get label() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set label(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get value() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set value(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get key() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set key(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get dirty() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set dirty(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get invalid() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set invalid(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get updateInvalid() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set updateInvalid(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get required() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set required(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get inputId() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set inputId(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get hiddenInput() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set hiddenInput(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get withLeadingIcon() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set withLeadingIcon(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchor$use() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchor$use(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get anchor$class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set anchor$class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selectedTextContainer$use() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selectedTextContainer$use(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selectedTextContainer$class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selectedTextContainer$class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selectedText$use() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selectedText$use(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selectedText$class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selectedText$class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get dropdownIcon$use() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set dropdownIcon$use(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get dropdownIcon$class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set dropdownIcon$class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get menu$class() {
    		throw new Error("<Select>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set menu$class(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getUseDefaultValidation() {
    		return this.$$.ctx[57];
    	}

    	set getUseDefaultValidation(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setUseDefaultValidation() {
    		return this.$$.ctx[58];
    	}

    	set setUseDefaultValidation(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get focus() {
    		return this.$$.ctx[59];
    	}

    	set focus(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get layout() {
    		return this.$$.ctx[60];
    	}

    	set layout(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[61];
    	}

    	set getElement(value) {
    		throw new Error("<Select>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/select/dist/Option.svelte generated by Svelte v3.46.4 */

    // (1:0) <Item   bind:this={element}   use={usePass}   data-value={value}   {value}   {selected}   {...$$restProps}>
    function create_default_slot$a(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[11].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[13],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[13])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$a.name,
    		type: "slot",
    		source: "(1:0) <Item   bind:this={element}   use={usePass}   data-value={value}   {value}   {selected}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$l(ctx) {
    	let item;
    	let current;

    	const item_spread_levels = [
    		{ use: /*usePass*/ ctx[3] },
    		{ "data-value": /*value*/ ctx[0] },
    		{ value: /*value*/ ctx[0] },
    		{ selected: /*selected*/ ctx[2] },
    		/*$$restProps*/ ctx[6]
    	];

    	let item_props = {
    		$$slots: { default: [create_default_slot$a] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < item_spread_levels.length; i += 1) {
    		item_props = assign$1(item_props, item_spread_levels[i]);
    	}

    	item = new Item({ props: item_props, $$inline: true });
    	/*item_binding*/ ctx[12](item);

    	const block = {
    		c: function create() {
    			create_component(item.$$.fragment);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			mount_component(item, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const item_changes = (dirty & /*usePass, value, selected, $$restProps*/ 77)
    			? get_spread_update(item_spread_levels, [
    					dirty & /*usePass*/ 8 && { use: /*usePass*/ ctx[3] },
    					dirty & /*value*/ 1 && { "data-value": /*value*/ ctx[0] },
    					dirty & /*value*/ 1 && { value: /*value*/ ctx[0] },
    					dirty & /*selected*/ 4 && { selected: /*selected*/ ctx[2] },
    					dirty & /*$$restProps*/ 64 && get_spread_object(/*$$restProps*/ ctx[6])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 8192) {
    				item_changes.$$scope = { dirty, ctx };
    			}

    			item.$set(item_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(item.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(item.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*item_binding*/ ctx[12](null);
    			destroy_component(item, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$l.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$t($$self, $$props, $$invalidate) {
    	let usePass;
    	let selected;
    	const omit_props_names = ["use","class","value","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $selectedText;
    	let $selectedValue;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Option', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	const className = '';
    	let { value = '' } = $$props;
    	let element;
    	const selectedText = getContext('SMUI:select:selectedText');
    	validate_store(selectedText, 'selectedText');
    	component_subscribe($$self, selectedText, value => $$invalidate(14, $selectedText = value));
    	const selectedValue = getContext('SMUI:select:value');
    	validate_store(selectedValue, 'selectedValue');
    	component_subscribe($$self, selectedValue, value => $$invalidate(10, $selectedValue = value));
    	setContext('SMUI:list:item:role', 'option');
    	onMount(setSelectedText);
    	onDestroy(setSelectedText);

    	function setSelectedText() {
    		if (selected && element) {
    			set_store_value(selectedText, $selectedText = element.getPrimaryText(), $selectedText);
    		}
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function item_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(1, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(7, use = $$new_props.use);
    		if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
    		if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onMount,
    		onDestroy,
    		getContext,
    		setContext,
    		get_current_component,
    		forwardEventsBuilder,
    		Item,
    		forwardEvents,
    		use,
    		className,
    		value,
    		element,
    		selectedText,
    		selectedValue,
    		setSelectedText,
    		getElement,
    		selected,
    		usePass,
    		$selectedText,
    		$selectedValue
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(7, use = $$new_props.use);
    		if ('value' in $$props) $$invalidate(0, value = $$new_props.value);
    		if ('element' in $$props) $$invalidate(1, element = $$new_props.element);
    		if ('selected' in $$props) $$invalidate(2, selected = $$new_props.selected);
    		if ('usePass' in $$props) $$invalidate(3, usePass = $$new_props.usePass);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*use*/ 128) {
    			$$invalidate(3, usePass = [forwardEvents, ...use]);
    		}

    		if ($$self.$$.dirty & /*value, $selectedValue*/ 1025) {
    			$$invalidate(2, selected = value != null && value !== '' && $selectedValue === value);
    		}
    	};

    	return [
    		value,
    		element,
    		selected,
    		usePass,
    		selectedText,
    		selectedValue,
    		$$restProps,
    		use,
    		className,
    		getElement,
    		$selectedValue,
    		slots,
    		item_binding,
    		$$scope
    	];
    }

    class Option$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$t, create_fragment$l, safe_not_equal, {
    			use: 7,
    			class: 8,
    			value: 0,
    			getElement: 9
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Option",
    			options,
    			id: create_fragment$l.name
    		});
    	}

    	get use() {
    		throw new Error("<Option>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Option>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		return this.$$.ctx[8];
    	}

    	set class(value) {
    		throw new Error("<Option>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get value() {
    		throw new Error("<Option>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set value(value) {
    		throw new Error("<Option>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[9];
    	}

    	set getElement(value) {
    		throw new Error("<Option>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Option = Option$1;

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    /**
     * Priorities for the announce function.
     */
    var AnnouncerPriority;
    (function (AnnouncerPriority) {
        AnnouncerPriority["POLITE"] = "polite";
        AnnouncerPriority["ASSERTIVE"] = "assertive";
    })(AnnouncerPriority || (AnnouncerPriority = {}));
    /**
     * Data attribute added to live region element.
     */
    var DATA_MDC_DOM_ANNOUNCE = 'data-mdc-dom-announce';
    /**
     * Announces the given message with optional priority, defaulting to "polite"
     */
    function announce(message, options) {
        Announcer.getInstance().say(message, options);
    }
    var Announcer = /** @class */ (function () {
        // Constructor made private to ensure only the singleton is used
        function Announcer() {
            this.liveRegions = new Map();
        }
        Announcer.getInstance = function () {
            if (!Announcer.instance) {
                Announcer.instance = new Announcer();
            }
            return Announcer.instance;
        };
        Announcer.prototype.say = function (message, options) {
            var _a, _b;
            var priority = (_a = options === null || options === void 0 ? void 0 : options.priority) !== null && _a !== void 0 ? _a : AnnouncerPriority.POLITE;
            var ownerDocument = (_b = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _b !== void 0 ? _b : document;
            var liveRegion = this.getLiveRegion(priority, ownerDocument);
            // Reset the region to pick up the message, even if the message is the
            // exact same as before.
            liveRegion.textContent = '';
            // Timeout is necessary for screen readers like NVDA and VoiceOver.
            setTimeout(function () {
                liveRegion.textContent = message;
                ownerDocument.addEventListener('click', clearLiveRegion);
            }, 1);
            function clearLiveRegion() {
                liveRegion.textContent = '';
                ownerDocument.removeEventListener('click', clearLiveRegion);
            }
        };
        Announcer.prototype.getLiveRegion = function (priority, ownerDocument) {
            var documentLiveRegions = this.liveRegions.get(ownerDocument);
            if (!documentLiveRegions) {
                documentLiveRegions = new Map();
                this.liveRegions.set(ownerDocument, documentLiveRegions);
            }
            var existingLiveRegion = documentLiveRegions.get(priority);
            if (existingLiveRegion &&
                ownerDocument.body.contains(existingLiveRegion)) {
                return existingLiveRegion;
            }
            var liveRegion = this.createLiveRegion(priority, ownerDocument);
            documentLiveRegions.set(priority, liveRegion);
            return liveRegion;
        };
        Announcer.prototype.createLiveRegion = function (priority, ownerDocument) {
            var el = ownerDocument.createElement('div');
            el.style.position = 'absolute';
            el.style.top = '-9999px';
            el.style.left = '-9999px';
            el.style.height = '1px';
            el.style.overflow = 'hidden';
            el.setAttribute('aria-atomic', 'true');
            el.setAttribute('aria-live', priority);
            el.setAttribute(DATA_MDC_DOM_ANNOUNCE, 'true');
            ownerDocument.body.appendChild(el);
            return el;
        };
        return Announcer;
    }());

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var InteractionTrigger;
    (function (InteractionTrigger) {
        InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED";
        InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK";
        InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY";
        InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY";
        InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY";
        InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY";
    })(InteractionTrigger || (InteractionTrigger = {}));
    var strings$2 = {
        ARIA_HIDDEN: 'aria-hidden',
        INTERACTION_EVENT: 'MDCChipTrailingAction:interaction',
        NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation',
        TAB_INDEX: 'tabindex',
    };

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCChipTrailingActionFoundation = /** @class */ (function (_super) {
        __extends(MDCChipTrailingActionFoundation, _super);
        function MDCChipTrailingActionFoundation(adapter) {
            return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this;
        }
        Object.defineProperty(MDCChipTrailingActionFoundation, "strings", {
            get: function () {
                return strings$2;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", {
            get: function () {
                return {
                    focus: function () { return undefined; },
                    getAttribute: function () { return null; },
                    setAttribute: function () { return undefined; },
                    notifyInteraction: function () { return undefined; },
                    notifyNavigation: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) {
            evt.stopPropagation();
            this.adapter.notifyInteraction(InteractionTrigger.CLICK);
        };
        MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) {
            evt.stopPropagation();
            var key = normalizeKey(evt);
            if (this.shouldNotifyInteractionFromKey(key)) {
                var trigger = this.getTriggerFromKey(key);
                this.adapter.notifyInteraction(trigger);
                return;
            }
            if (isNavigationEvent(evt)) {
                this.adapter.notifyNavigation(key);
                return;
            }
        };
        MDCChipTrailingActionFoundation.prototype.removeFocus = function () {
            this.adapter.setAttribute(strings$2.TAB_INDEX, '-1');
        };
        MDCChipTrailingActionFoundation.prototype.focus = function () {
            this.adapter.setAttribute(strings$2.TAB_INDEX, '0');
            this.adapter.focus();
        };
        MDCChipTrailingActionFoundation.prototype.isNavigable = function () {
            return this.adapter.getAttribute(strings$2.ARIA_HIDDEN) !== 'true';
        };
        MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey = function (key) {
            var isFromActionKey = key === KEY.ENTER || key === KEY.SPACEBAR;
            var isFromDeleteKey = key === KEY.BACKSPACE || key === KEY.DELETE;
            return isFromActionKey || isFromDeleteKey;
        };
        MDCChipTrailingActionFoundation.prototype.getTriggerFromKey = function (key) {
            if (key === KEY.SPACEBAR) {
                return InteractionTrigger.SPACEBAR_KEY;
            }
            if (key === KEY.ENTER) {
                return InteractionTrigger.ENTER_KEY;
            }
            if (key === KEY.DELETE) {
                return InteractionTrigger.DELETE_KEY;
            }
            if (key === KEY.BACKSPACE) {
                return InteractionTrigger.BACKSPACE_KEY;
            }
            // Default case, should never be returned
            return InteractionTrigger.UNSPECIFIED;
        };
        return MDCChipTrailingActionFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2020 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCChipTrailingAction = /** @class */ (function (_super) {
        __extends(MDCChipTrailingAction, _super);
        function MDCChipTrailingAction() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", {
            get: function () {
                return this.rippleSurface;
            },
            enumerable: false,
            configurable: true
        });
        MDCChipTrailingAction.attachTo = function (root) {
            return new MDCChipTrailingAction(root);
        };
        MDCChipTrailingAction.prototype.initialize = function (rippleFactory) {
            if (rippleFactory === void 0) { rippleFactory = function (el, foundation) {
                return new MDCRipple(el, foundation);
            }; }
            // DO NOT INLINE this variable. For backward compatibility, foundations take
            // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
            // methods, we need a separate, strongly typed adapter variable.
            var rippleAdapter = MDCRipple.createAdapter(this);
            this.rippleSurface =
                rippleFactory(this.root, new MDCRippleFoundation(rippleAdapter));
        };
        MDCChipTrailingAction.prototype.initialSyncWithDOM = function () {
            var _this = this;
            this.handleClick = function (evt) {
                _this.foundation.handleClick(evt);
            };
            this.handleKeydown = function (evt) {
                _this.foundation.handleKeydown(evt);
            };
            this.listen('click', this.handleClick);
            this.listen('keydown', this.handleKeydown);
        };
        MDCChipTrailingAction.prototype.destroy = function () {
            this.rippleSurface.destroy();
            this.unlisten('click', this.handleClick);
            this.unlisten('keydown', this.handleKeydown);
            _super.prototype.destroy.call(this);
        };
        MDCChipTrailingAction.prototype.getDefaultFoundation = function () {
            var _this = this;
            // DO NOT INLINE this variable. For backward compatibility, foundations take
            // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
            // methods, we need a separate, strongly typed adapter variable.
            var adapter = {
                focus: function () {
                    // TODO(b/157231863): Migate MDCComponent#root to HTMLElement
                    _this.root.focus();
                },
                getAttribute: function (attr) { return _this.root.getAttribute(attr); },
                notifyInteraction: function (trigger) {
                    return _this.emit(strings$2.INTERACTION_EVENT, { trigger: trigger }, true /* shouldBubble */);
                },
                notifyNavigation: function (key) {
                    _this.emit(strings$2.NAVIGATION_EVENT, { key: key }, true /* shouldBubble */);
                },
                setAttribute: function (attr, value) {
                    _this.root.setAttribute(attr, value);
                },
            };
            return new MDCChipTrailingActionFoundation(adapter);
        };
        MDCChipTrailingAction.prototype.isNavigable = function () {
            return this.foundation.isNavigable();
        };
        MDCChipTrailingAction.prototype.focus = function () {
            this.foundation.focus();
        };
        MDCChipTrailingAction.prototype.removeFocus = function () {
            this.foundation.removeFocus();
        };
        return MDCChipTrailingAction;
    }(MDCComponent));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var Direction;
    (function (Direction) {
        Direction["LEFT"] = "left";
        Direction["RIGHT"] = "right";
    })(Direction || (Direction = {}));
    var EventSource;
    (function (EventSource) {
        EventSource["PRIMARY"] = "primary";
        EventSource["TRAILING"] = "trailing";
        EventSource["NONE"] = "none";
    })(EventSource || (EventSource = {}));
    var strings$1 = {
        ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement',
        ARIA_CHECKED: 'aria-checked',
        ARROW_DOWN_KEY: 'ArrowDown',
        ARROW_LEFT_KEY: 'ArrowLeft',
        ARROW_RIGHT_KEY: 'ArrowRight',
        ARROW_UP_KEY: 'ArrowUp',
        BACKSPACE_KEY: 'Backspace',
        CHECKMARK_SELECTOR: '.mdc-chip__checkmark',
        DELETE_KEY: 'Delete',
        END_KEY: 'End',
        ENTER_KEY: 'Enter',
        ENTRY_ANIMATION_NAME: 'mdc-chip-entry',
        HOME_KEY: 'Home',
        IE_ARROW_DOWN_KEY: 'Down',
        IE_ARROW_LEFT_KEY: 'Left',
        IE_ARROW_RIGHT_KEY: 'Right',
        IE_ARROW_UP_KEY: 'Up',
        IE_DELETE_KEY: 'Del',
        INTERACTION_EVENT: 'MDCChip:interaction',
        LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading',
        NAVIGATION_EVENT: 'MDCChip:navigation',
        PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action',
        REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement',
        REMOVAL_EVENT: 'MDCChip:removal',
        SELECTION_EVENT: 'MDCChip:selection',
        SPACEBAR_KEY: ' ',
        TAB_INDEX: 'tabindex',
        TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action',
        TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction',
        TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing',
    };
    var cssClasses$1 = {
        CHECKMARK: 'mdc-chip__checkmark',
        CHIP_EXIT: 'mdc-chip--exit',
        DELETABLE: 'mdc-chip--deletable',
        EDITABLE: 'mdc-chip--editable',
        EDITING: 'mdc-chip--editing',
        HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden',
        LEADING_ICON: 'mdc-chip__icon--leading',
        PRIMARY_ACTION: 'mdc-chip__primary-action',
        PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused',
        SELECTED: 'mdc-chip--selected',
        TEXT: 'mdc-chip__text',
        TRAILING_ACTION: 'mdc-chip__trailing-action',
        TRAILING_ICON: 'mdc-chip__icon--trailing',
    };
    var navigationKeys = new Set();
    // IE11 has no support for new Set with iterable so we need to initialize this by hand
    navigationKeys.add(strings$1.ARROW_LEFT_KEY);
    navigationKeys.add(strings$1.ARROW_RIGHT_KEY);
    navigationKeys.add(strings$1.ARROW_DOWN_KEY);
    navigationKeys.add(strings$1.ARROW_UP_KEY);
    navigationKeys.add(strings$1.END_KEY);
    navigationKeys.add(strings$1.HOME_KEY);
    navigationKeys.add(strings$1.IE_ARROW_LEFT_KEY);
    navigationKeys.add(strings$1.IE_ARROW_RIGHT_KEY);
    navigationKeys.add(strings$1.IE_ARROW_DOWN_KEY);
    navigationKeys.add(strings$1.IE_ARROW_UP_KEY);
    var jumpChipKeys = new Set();
    // IE11 has no support for new Set with iterable so we need to initialize this by hand
    jumpChipKeys.add(strings$1.ARROW_UP_KEY);
    jumpChipKeys.add(strings$1.ARROW_DOWN_KEY);
    jumpChipKeys.add(strings$1.HOME_KEY);
    jumpChipKeys.add(strings$1.END_KEY);
    jumpChipKeys.add(strings$1.IE_ARROW_UP_KEY);
    jumpChipKeys.add(strings$1.IE_ARROW_DOWN_KEY);

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var emptyClientRect = {
        bottom: 0,
        height: 0,
        left: 0,
        right: 0,
        top: 0,
        width: 0,
    };
    var FocusBehavior;
    (function (FocusBehavior) {
        FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS";
        FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS";
    })(FocusBehavior || (FocusBehavior = {}));
    var MDCChipFoundation = /** @class */ (function (_super) {
        __extends(MDCChipFoundation, _super);
        function MDCChipFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this;
            /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */
            _this.shouldRemoveOnTrailingIconClick = true;
            /**
             * Whether the primary action should receive focus on click. Should only be
             * set to true for clients who programmatically give focus to a different
             * element on the page when a chip is clicked (like a menu).
             */
            _this.shouldFocusPrimaryActionOnClick = true;
            return _this;
        }
        Object.defineProperty(MDCChipFoundation, "strings", {
            get: function () {
                return strings$1;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipFoundation, "cssClasses", {
            get: function () {
                return cssClasses$1;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipFoundation, "defaultAdapter", {
            get: function () {
                return {
                    addClass: function () { return undefined; },
                    addClassToLeadingIcon: function () { return undefined; },
                    eventTargetHasClass: function () { return false; },
                    focusPrimaryAction: function () { return undefined; },
                    focusTrailingAction: function () { return undefined; },
                    getAttribute: function () { return null; },
                    getCheckmarkBoundingClientRect: function () { return emptyClientRect; },
                    getComputedStyleValue: function () { return ''; },
                    getRootBoundingClientRect: function () { return emptyClientRect; },
                    hasClass: function () { return false; },
                    hasLeadingIcon: function () { return false; },
                    isRTL: function () { return false; },
                    isTrailingActionNavigable: function () { return false; },
                    notifyEditFinish: function () { return undefined; },
                    notifyEditStart: function () { return undefined; },
                    notifyInteraction: function () { return undefined; },
                    notifyNavigation: function () { return undefined; },
                    notifyRemoval: function () { return undefined; },
                    notifySelection: function () { return undefined; },
                    notifyTrailingIconInteraction: function () { return undefined; },
                    removeClass: function () { return undefined; },
                    removeClassFromLeadingIcon: function () { return undefined; },
                    removeTrailingActionFocus: function () { return undefined; },
                    setPrimaryActionAttr: function () { return undefined; },
                    setStyleProperty: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        MDCChipFoundation.prototype.isSelected = function () {
            return this.adapter.hasClass(cssClasses$1.SELECTED);
        };
        MDCChipFoundation.prototype.isEditable = function () {
            return this.adapter.hasClass(cssClasses$1.EDITABLE);
        };
        MDCChipFoundation.prototype.isEditing = function () {
            return this.adapter.hasClass(cssClasses$1.EDITING);
        };
        MDCChipFoundation.prototype.setSelected = function (selected) {
            this.setSelectedImpl(selected);
            this.notifySelection(selected);
        };
        MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
            this.setSelectedImpl(selected);
            if (shouldNotifyClients) {
                this.notifyIgnoredSelection(selected);
            }
        };
        MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () {
            return this.shouldRemoveOnTrailingIconClick;
        };
        MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) {
            this.shouldRemoveOnTrailingIconClick = shouldRemove;
        };
        MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) {
            this.shouldFocusPrimaryActionOnClick = shouldFocus;
        };
        MDCChipFoundation.prototype.getDimensions = function () {
            var _this = this;
            var getRootRect = function () { return _this.adapter.getRootBoundingClientRect(); };
            var getCheckmarkRect = function () {
                return _this.adapter.getCheckmarkBoundingClientRect();
            };
            // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current
            // size of the checkmark.
            if (!this.adapter.hasLeadingIcon()) {
                var checkmarkRect = getCheckmarkRect();
                if (checkmarkRect) {
                    var rootRect = getRootRect();
                    // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes.
                    // However, the checkbox is initially hidden by setting the width to 0.
                    // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width)
                    // when adding it to the root client rect's width.
                    return {
                        bottom: rootRect.bottom,
                        height: rootRect.height,
                        left: rootRect.left,
                        right: rootRect.right,
                        top: rootRect.top,
                        width: rootRect.width + checkmarkRect.height,
                    };
                }
            }
            return getRootRect();
        };
        /**
         * Begins the exit animation which leads to removal of the chip.
         */
        MDCChipFoundation.prototype.beginExit = function () {
            this.adapter.addClass(cssClasses$1.CHIP_EXIT);
        };
        MDCChipFoundation.prototype.handleClick = function () {
            this.adapter.notifyInteraction();
            this.setPrimaryActionFocusable(this.getFocusBehavior());
        };
        MDCChipFoundation.prototype.handleDoubleClick = function () {
            if (this.isEditable()) {
                this.startEditing();
            }
        };
        /**
         * Handles a transition end event on the root element.
         */
        MDCChipFoundation.prototype.handleTransitionEnd = function (evt) {
            var _this = this;
            // Handle transition end event on the chip when it is about to be removed.
            var shouldHandle = this.adapter.eventTargetHasClass(evt.target, cssClasses$1.CHIP_EXIT);
            var widthIsAnimating = evt.propertyName === 'width';
            var opacityIsAnimating = evt.propertyName === 'opacity';
            if (shouldHandle && opacityIsAnimating) {
                // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5
                var chipWidth_1 = this.adapter.getComputedStyleValue('width');
                // On the next frame (once we get the computed width), explicitly set the chip's width
                // to its current pixel width, so we aren't transitioning out of 'auto'.
                requestAnimationFrame(function () {
                    _this.adapter.setStyleProperty('width', chipWidth_1);
                    // To mitigate jitter, start transitioning padding and margin before width.
                    _this.adapter.setStyleProperty('padding', '0');
                    _this.adapter.setStyleProperty('margin', '0');
                    // On the next frame (once width is explicitly set), transition width to 0.
                    requestAnimationFrame(function () {
                        _this.adapter.setStyleProperty('width', '0');
                    });
                });
                return;
            }
            if (shouldHandle && widthIsAnimating) {
                this.removeFocus();
                var removedAnnouncement = this.adapter.getAttribute(strings$1.REMOVED_ANNOUNCEMENT_ATTRIBUTE);
                this.adapter.notifyRemoval(removedAnnouncement);
            }
            // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles.
            if (!opacityIsAnimating) {
                return;
            }
            var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, cssClasses$1.LEADING_ICON) &&
                this.adapter.hasClass(cssClasses$1.SELECTED);
            var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, cssClasses$1.CHECKMARK) &&
                !this.adapter.hasClass(cssClasses$1.SELECTED);
            if (shouldHideLeadingIcon) {
                this.adapter.addClassToLeadingIcon(cssClasses$1.HIDDEN_LEADING_ICON);
                return;
            }
            if (shouldShowLeadingIcon) {
                this.adapter.removeClassFromLeadingIcon(cssClasses$1.HIDDEN_LEADING_ICON);
                return;
            }
        };
        MDCChipFoundation.prototype.handleFocusIn = function (evt) {
            // Early exit if the event doesn't come from the primary action
            if (!this.eventFromPrimaryAction(evt)) {
                return;
            }
            this.adapter.addClass(cssClasses$1.PRIMARY_ACTION_FOCUSED);
        };
        MDCChipFoundation.prototype.handleFocusOut = function (evt) {
            // Early exit if the event doesn't come from the primary action
            if (!this.eventFromPrimaryAction(evt)) {
                return;
            }
            if (this.isEditing()) {
                this.finishEditing();
            }
            this.adapter.removeClass(cssClasses$1.PRIMARY_ACTION_FOCUSED);
        };
        /**
         * Handles an interaction event on the trailing icon element. This is used to
         * prevent the ripple from activating on interaction with the trailing icon.
         */
        MDCChipFoundation.prototype.handleTrailingActionInteraction = function () {
            this.adapter.notifyTrailingIconInteraction();
            this.removeChip();
        };
        /**
         * Handles a keydown event from the root element.
         */
        MDCChipFoundation.prototype.handleKeydown = function (evt) {
            if (this.isEditing()) {
                if (this.shouldFinishEditing(evt)) {
                    evt.preventDefault();
                    this.finishEditing();
                }
                // When editing, the foundation should only handle key events that finish
                // the editing process.
                return;
            }
            if (this.isEditable()) {
                if (this.shouldStartEditing(evt)) {
                    evt.preventDefault();
                    this.startEditing();
                }
            }
            if (this.shouldNotifyInteraction(evt)) {
                this.adapter.notifyInteraction();
                this.setPrimaryActionFocusable(this.getFocusBehavior());
                return;
            }
            if (this.isDeleteAction(evt)) {
                evt.preventDefault();
                this.removeChip();
                return;
            }
            // Early exit if the key is not usable
            if (!navigationKeys.has(evt.key)) {
                return;
            }
            // Prevent default behavior for movement keys which could include scrolling
            evt.preventDefault();
            this.focusNextAction(evt.key, EventSource.PRIMARY);
        };
        MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) {
            this.focusNextAction(evt.detail.key, EventSource.TRAILING);
        };
        /**
         * Called by the chip set to remove focus from the chip actions.
         */
        MDCChipFoundation.prototype.removeFocus = function () {
            this.adapter.setPrimaryActionAttr(strings$1.TAB_INDEX, '-1');
            this.adapter.removeTrailingActionFocus();
        };
        /**
         * Called by the chip set to focus the primary action.
         *
         */
        MDCChipFoundation.prototype.focusPrimaryAction = function () {
            this.setPrimaryActionFocusable(FocusBehavior.SHOULD_FOCUS);
        };
        /**
         * Called by the chip set to focus the trailing action (if present), otherwise
         * gives focus to the trailing action.
         */
        MDCChipFoundation.prototype.focusTrailingAction = function () {
            var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable();
            if (trailingActionIsNavigable) {
                this.adapter.setPrimaryActionAttr(strings$1.TAB_INDEX, '-1');
                this.adapter.focusTrailingAction();
                return;
            }
            this.focusPrimaryAction();
        };
        MDCChipFoundation.prototype.setPrimaryActionFocusable = function (focusBehavior) {
            this.adapter.setPrimaryActionAttr(strings$1.TAB_INDEX, '0');
            if (focusBehavior === FocusBehavior.SHOULD_FOCUS) {
                this.adapter.focusPrimaryAction();
            }
            this.adapter.removeTrailingActionFocus();
        };
        MDCChipFoundation.prototype.getFocusBehavior = function () {
            if (this.shouldFocusPrimaryActionOnClick) {
                return FocusBehavior.SHOULD_FOCUS;
            }
            return FocusBehavior.SHOULD_NOT_FOCUS;
        };
        MDCChipFoundation.prototype.focusNextAction = function (key, source) {
            var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable();
            var dir = this.getDirection(key);
            // Early exit if the key should jump chips
            if (jumpChipKeys.has(key) || !isTrailingActionNavigable) {
                this.adapter.notifyNavigation(key, source);
                return;
            }
            if (source === EventSource.PRIMARY && dir === Direction.RIGHT) {
                this.focusTrailingAction();
                return;
            }
            if (source === EventSource.TRAILING && dir === Direction.LEFT) {
                this.focusPrimaryAction();
                return;
            }
            this.adapter.notifyNavigation(key, EventSource.NONE);
        };
        MDCChipFoundation.prototype.getDirection = function (key) {
            var isRTL = this.adapter.isRTL();
            var isLeftKey = key === strings$1.ARROW_LEFT_KEY || key === strings$1.IE_ARROW_LEFT_KEY;
            var isRightKey = key === strings$1.ARROW_RIGHT_KEY || key === strings$1.IE_ARROW_RIGHT_KEY;
            if (!isRTL && isLeftKey || isRTL && isRightKey) {
                return Direction.LEFT;
            }
            return Direction.RIGHT;
        };
        MDCChipFoundation.prototype.removeChip = function () {
            if (this.shouldRemoveOnTrailingIconClick) {
                this.beginExit();
            }
        };
        MDCChipFoundation.prototype.shouldStartEditing = function (evt) {
            return this.eventFromPrimaryAction(evt) && evt.key === strings$1.ENTER_KEY;
        };
        MDCChipFoundation.prototype.shouldFinishEditing = function (evt) {
            return evt.key === strings$1.ENTER_KEY;
        };
        MDCChipFoundation.prototype.shouldNotifyInteraction = function (evt) {
            return evt.key === strings$1.ENTER_KEY || evt.key === strings$1.SPACEBAR_KEY;
        };
        MDCChipFoundation.prototype.isDeleteAction = function (evt) {
            var isDeletable = this.adapter.hasClass(cssClasses$1.DELETABLE);
            return isDeletable &&
                (evt.key === strings$1.BACKSPACE_KEY || evt.key === strings$1.DELETE_KEY ||
                    evt.key === strings$1.IE_DELETE_KEY);
        };
        MDCChipFoundation.prototype.setSelectedImpl = function (selected) {
            if (selected) {
                this.adapter.addClass(cssClasses$1.SELECTED);
                this.adapter.setPrimaryActionAttr(strings$1.ARIA_CHECKED, 'true');
            }
            else {
                this.adapter.removeClass(cssClasses$1.SELECTED);
                this.adapter.setPrimaryActionAttr(strings$1.ARIA_CHECKED, 'false');
            }
        };
        MDCChipFoundation.prototype.notifySelection = function (selected) {
            this.adapter.notifySelection(selected, false);
        };
        MDCChipFoundation.prototype.notifyIgnoredSelection = function (selected) {
            this.adapter.notifySelection(selected, true);
        };
        MDCChipFoundation.prototype.eventFromPrimaryAction = function (evt) {
            return this.adapter.eventTargetHasClass(evt.target, cssClasses$1.PRIMARY_ACTION);
        };
        MDCChipFoundation.prototype.startEditing = function () {
            this.adapter.addClass(cssClasses$1.EDITING);
            this.adapter.notifyEditStart();
        };
        MDCChipFoundation.prototype.finishEditing = function () {
            this.adapter.removeClass(cssClasses$1.EDITING);
            this.adapter.notifyEditFinish();
        };
        return MDCChipFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCChip = /** @class */ (function (_super) {
        __extends(MDCChip, _super);
        function MDCChip() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Object.defineProperty(MDCChip.prototype, "selected", {
            /**
             * @return Whether the chip is selected.
             */
            get: function () {
                return this.foundation.isSelected();
            },
            /**
             * Sets selected state on the chip.
             */
            set: function (selected) {
                this.foundation.setSelected(selected);
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", {
            /**
             * @return Whether a trailing icon click should trigger exit/removal of the chip.
             */
            get: function () {
                return this.foundation.getShouldRemoveOnTrailingIconClick();
            },
            /**
             * Sets whether a trailing icon click should trigger exit/removal of the chip.
             */
            set: function (shouldRemove) {
                this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove);
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", {
            /**
             * Sets whether a clicking on the chip should focus the primary action.
             */
            set: function (shouldFocus) {
                this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus);
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChip.prototype, "ripple", {
            get: function () {
                return this.rippleSurface;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChip.prototype, "id", {
            get: function () {
                return this.root.id;
            },
            enumerable: false,
            configurable: true
        });
        MDCChip.attachTo = function (root) {
            return new MDCChip(root);
        };
        MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) {
            var _this = this;
            if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new MDCRipple(el, foundation); }; }
            if (trailingActionFactory === void 0) { trailingActionFactory = function (el) { return new MDCChipTrailingAction(el); }; }
            this.leadingIcon = this.root.querySelector(strings$1.LEADING_ICON_SELECTOR);
            this.checkmark = this.root.querySelector(strings$1.CHECKMARK_SELECTOR);
            this.primaryAction =
                this.root.querySelector(strings$1.PRIMARY_ACTION_SELECTOR);
            var trailingActionEl = this.root.querySelector(strings$1.TRAILING_ACTION_SELECTOR);
            if (trailingActionEl) {
                this.trailingAction = trailingActionFactory(trailingActionEl);
            }
            // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
            // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
            var rippleAdapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { computeBoundingRect: function () { return _this.foundation.getDimensions(); } });
            this.rippleSurface =
                rippleFactory(this.root, new MDCRippleFoundation(rippleAdapter));
        };
        MDCChip.prototype.initialSyncWithDOM = function () {
            var _this = this;
            // Custom events
            this.handleTrailingActionInteraction = function () {
                _this.foundation.handleTrailingActionInteraction();
            };
            this.handleTrailingActionNavigation =
                function (evt) {
                    _this.foundation.handleTrailingActionNavigation(evt);
                };
            // Native events
            this.handleClick = function () {
                _this.foundation.handleClick();
            };
            this.handleKeydown = function (evt) {
                _this.foundation.handleKeydown(evt);
            };
            this.handleTransitionEnd = function (evt) {
                _this.foundation.handleTransitionEnd(evt);
            };
            this.handleFocusIn = function (evt) {
                _this.foundation.handleFocusIn(evt);
            };
            this.handleFocusOut = function (evt) {
                _this.foundation.handleFocusOut(evt);
            };
            this.listen('transitionend', this.handleTransitionEnd);
            this.listen('click', this.handleClick);
            this.listen('keydown', this.handleKeydown);
            this.listen('focusin', this.handleFocusIn);
            this.listen('focusout', this.handleFocusOut);
            if (this.trailingAction) {
                this.listen(strings$2.INTERACTION_EVENT, this.handleTrailingActionInteraction);
                this.listen(strings$2.NAVIGATION_EVENT, this.handleTrailingActionNavigation);
            }
        };
        MDCChip.prototype.destroy = function () {
            this.rippleSurface.destroy();
            this.unlisten('transitionend', this.handleTransitionEnd);
            this.unlisten('keydown', this.handleKeydown);
            this.unlisten('click', this.handleClick);
            this.unlisten('focusin', this.handleFocusIn);
            this.unlisten('focusout', this.handleFocusOut);
            if (this.trailingAction) {
                this.unlisten(strings$2.INTERACTION_EVENT, this.handleTrailingActionInteraction);
                this.unlisten(strings$2.NAVIGATION_EVENT, this.handleTrailingActionNavigation);
            }
            _super.prototype.destroy.call(this);
        };
        /**
         * Begins the exit animation which leads to removal of the chip.
         */
        MDCChip.prototype.beginExit = function () {
            this.foundation.beginExit();
        };
        MDCChip.prototype.getDefaultFoundation = function () {
            var _this = this;
            // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
            // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
            var adapter = {
                addClass: function (className) { return _this.root.classList.add(className); },
                addClassToLeadingIcon: function (className) {
                    if (_this.leadingIcon) {
                        _this.leadingIcon.classList.add(className);
                    }
                },
                eventTargetHasClass: function (target, className) {
                    return target ? target.classList.contains(className) : false;
                },
                focusPrimaryAction: function () {
                    if (_this.primaryAction) {
                        _this.primaryAction.focus();
                    }
                },
                focusTrailingAction: function () {
                    if (_this.trailingAction) {
                        _this.trailingAction.focus();
                    }
                },
                getAttribute: function (attr) { return _this.root.getAttribute(attr); },
                getCheckmarkBoundingClientRect: function () {
                    return _this.checkmark ? _this.checkmark.getBoundingClientRect() : null;
                },
                getComputedStyleValue: function (propertyName) {
                    return window.getComputedStyle(_this.root).getPropertyValue(propertyName);
                },
                getRootBoundingClientRect: function () { return _this.root.getBoundingClientRect(); },
                hasClass: function (className) { return _this.root.classList.contains(className); },
                hasLeadingIcon: function () { return !!_this.leadingIcon; },
                isRTL: function () { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; },
                isTrailingActionNavigable: function () {
                    if (_this.trailingAction) {
                        return _this.trailingAction.isNavigable();
                    }
                    return false;
                },
                notifyInteraction: function () { return _this.emit(strings$1.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); },
                notifyNavigation: function (key, source) {
                    return _this.emit(strings$1.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */);
                },
                notifyRemoval: function (removedAnnouncement) {
                    _this.emit(strings$1.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */);
                },
                notifySelection: function (selected, shouldIgnore) {
                    return _this.emit(strings$1.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */);
                },
                notifyTrailingIconInteraction: function () {
                    return _this.emit(strings$1.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
                },
                notifyEditStart: function () { },
                notifyEditFinish: function () { },
                removeClass: function (className) { return _this.root.classList.remove(className); },
                removeClassFromLeadingIcon: function (className) {
                    if (_this.leadingIcon) {
                        _this.leadingIcon.classList.remove(className);
                    }
                },
                removeTrailingActionFocus: function () {
                    if (_this.trailingAction) {
                        _this.trailingAction.removeFocus();
                    }
                },
                setPrimaryActionAttr: function (attr, value) {
                    if (_this.primaryAction) {
                        _this.primaryAction.setAttribute(attr, value);
                    }
                },
                setStyleProperty: function (propertyName, value) {
                    return _this.root.style.setProperty(propertyName, value);
                },
            };
            return new MDCChipFoundation(adapter);
        };
        MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
            this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients);
        };
        MDCChip.prototype.focusPrimaryAction = function () {
            this.foundation.focusPrimaryAction();
        };
        MDCChip.prototype.focusTrailingAction = function () {
            this.foundation.focusTrailingAction();
        };
        MDCChip.prototype.removeFocus = function () {
            this.foundation.removeFocus();
        };
        MDCChip.prototype.remove = function () {
            var parent = this.root.parentNode;
            if (parent !== null) {
                parent.removeChild(this.root);
            }
        };
        return MDCChip;
    }(MDCComponent));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var strings = {
        CHIP_SELECTOR: '.mdc-chip',
    };
    var cssClasses = {
        CHOICE: 'mdc-chip-set--choice',
        FILTER: 'mdc-chip-set--filter',
    };

    /**
     * @license
     * Copyright 2017 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var MDCChipSetFoundation = /** @class */ (function (_super) {
        __extends(MDCChipSetFoundation, _super);
        function MDCChipSetFoundation(adapter) {
            var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this;
            /**
             * The ids of the selected chips in the set. Only used for choice chip set or filter chip set.
             */
            _this.selectedChipIds = [];
            return _this;
        }
        Object.defineProperty(MDCChipSetFoundation, "strings", {
            get: function () {
                return strings;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipSetFoundation, "cssClasses", {
            get: function () {
                return cssClasses;
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", {
            get: function () {
                return {
                    announceMessage: function () { return undefined; },
                    focusChipPrimaryActionAtIndex: function () { return undefined; },
                    focusChipTrailingActionAtIndex: function () { return undefined; },
                    getChipListCount: function () { return -1; },
                    getIndexOfChipById: function () { return -1; },
                    hasClass: function () { return false; },
                    isRTL: function () { return false; },
                    removeChipAtIndex: function () { return undefined; },
                    removeFocusFromChipAtIndex: function () { return undefined; },
                    selectChipAtIndex: function () { return undefined; },
                };
            },
            enumerable: false,
            configurable: true
        });
        /**
         * Returns an array of the IDs of all selected chips.
         */
        MDCChipSetFoundation.prototype.getSelectedChipIds = function () {
            return this.selectedChipIds.slice();
        };
        /**
         * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant.
         * Does not notify clients of the updated selection state.
         */
        MDCChipSetFoundation.prototype.select = function (chipId) {
            this.selectImpl(chipId, false);
        };
        /**
         * Handles a chip interaction event
         */
        MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) {
            var chipId = _a.chipId;
            var index = this.adapter.getIndexOfChipById(chipId);
            this.removeFocusFromChipsExcept(index);
            if (this.adapter.hasClass(cssClasses.CHOICE) ||
                this.adapter.hasClass(cssClasses.FILTER)) {
                this.toggleSelect(chipId);
            }
        };
        /**
         * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip.
         */
        MDCChipSetFoundation.prototype.handleChipSelection = function (_a) {
            var chipId = _a.chipId, selected = _a.selected, shouldIgnore = _a.shouldIgnore;
            // Early exit if we should ignore the event
            if (shouldIgnore) {
                return;
            }
            var chipIsSelected = this.selectedChipIds.indexOf(chipId) >= 0;
            if (selected && !chipIsSelected) {
                this.select(chipId);
            }
            else if (!selected && chipIsSelected) {
                this.deselectImpl(chipId);
            }
        };
        /**
         * Handles the event when a chip is removed.
         */
        MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) {
            var chipId = _a.chipId, removedAnnouncement = _a.removedAnnouncement;
            if (removedAnnouncement) {
                this.adapter.announceMessage(removedAnnouncement);
            }
            var index = this.adapter.getIndexOfChipById(chipId);
            this.deselectAndNotifyClients(chipId);
            this.adapter.removeChipAtIndex(index);
            var maxIndex = this.adapter.getChipListCount() - 1;
            if (maxIndex < 0) {
                return;
            }
            var nextIndex = Math.min(index, maxIndex);
            this.removeFocusFromChipsExcept(nextIndex);
            // After removing a chip, we should focus the trailing action for the next chip.
            this.adapter.focusChipTrailingActionAtIndex(nextIndex);
        };
        /**
         * Handles a chip navigation event.
         */
        MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) {
            var chipId = _a.chipId, key = _a.key, source = _a.source;
            var maxIndex = this.adapter.getChipListCount() - 1;
            var index = this.adapter.getIndexOfChipById(chipId);
            // Early exit if the index is out of range or the key is unusable
            if (index === -1 || !navigationKeys.has(key)) {
                return;
            }
            var isRTL = this.adapter.isRTL();
            var isLeftKey = key === strings$1.ARROW_LEFT_KEY ||
                key === strings$1.IE_ARROW_LEFT_KEY;
            var isRightKey = key === strings$1.ARROW_RIGHT_KEY ||
                key === strings$1.IE_ARROW_RIGHT_KEY;
            var isDownKey = key === strings$1.ARROW_DOWN_KEY ||
                key === strings$1.IE_ARROW_DOWN_KEY;
            var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey;
            var isHome = key === strings$1.HOME_KEY;
            var isEnd = key === strings$1.END_KEY;
            if (shouldIncrement) {
                index++;
            }
            else if (isHome) {
                index = 0;
            }
            else if (isEnd) {
                index = maxIndex;
            }
            else {
                index--;
            }
            // Early exit if the index is out of bounds
            if (index < 0 || index > maxIndex) {
                return;
            }
            this.removeFocusFromChipsExcept(index);
            this.focusChipAction(index, key, source);
        };
        MDCChipSetFoundation.prototype.focusChipAction = function (index, key, source) {
            var shouldJumpChips = jumpChipKeys.has(key);
            if (shouldJumpChips && source === EventSource.PRIMARY) {
                return this.adapter.focusChipPrimaryActionAtIndex(index);
            }
            if (shouldJumpChips && source === EventSource.TRAILING) {
                return this.adapter.focusChipTrailingActionAtIndex(index);
            }
            var dir = this.getDirection(key);
            if (dir === Direction.LEFT) {
                return this.adapter.focusChipTrailingActionAtIndex(index);
            }
            if (dir === Direction.RIGHT) {
                return this.adapter.focusChipPrimaryActionAtIndex(index);
            }
        };
        MDCChipSetFoundation.prototype.getDirection = function (key) {
            var isRTL = this.adapter.isRTL();
            var isLeftKey = key === strings$1.ARROW_LEFT_KEY ||
                key === strings$1.IE_ARROW_LEFT_KEY;
            var isRightKey = key === strings$1.ARROW_RIGHT_KEY ||
                key === strings$1.IE_ARROW_RIGHT_KEY;
            if (!isRTL && isLeftKey || isRTL && isRightKey) {
                return Direction.LEFT;
            }
            return Direction.RIGHT;
        };
        /**
         * Deselects the chip with the given id and optionally notifies clients.
         */
        MDCChipSetFoundation.prototype.deselectImpl = function (chipId, shouldNotifyClients) {
            if (shouldNotifyClients === void 0) { shouldNotifyClients = false; }
            var index = this.selectedChipIds.indexOf(chipId);
            if (index >= 0) {
                this.selectedChipIds.splice(index, 1);
                var chipIndex = this.adapter.getIndexOfChipById(chipId);
                this.adapter.selectChipAtIndex(chipIndex, /** isSelected */ false, shouldNotifyClients);
            }
        };
        /**
         * Deselects the chip with the given id and notifies clients.
         */
        MDCChipSetFoundation.prototype.deselectAndNotifyClients = function (chipId) {
            this.deselectImpl(chipId, true);
        };
        /**
         * Toggles selection of the chip with the given id.
         */
        MDCChipSetFoundation.prototype.toggleSelect = function (chipId) {
            if (this.selectedChipIds.indexOf(chipId) >= 0) {
                this.deselectAndNotifyClients(chipId);
            }
            else {
                this.selectAndNotifyClients(chipId);
            }
        };
        MDCChipSetFoundation.prototype.removeFocusFromChipsExcept = function (index) {
            var chipCount = this.adapter.getChipListCount();
            for (var i = 0; i < chipCount; i++) {
                if (i !== index) {
                    this.adapter.removeFocusFromChipAtIndex(i);
                }
            }
        };
        MDCChipSetFoundation.prototype.selectAndNotifyClients = function (chipId) {
            this.selectImpl(chipId, true);
        };
        MDCChipSetFoundation.prototype.selectImpl = function (chipId, shouldNotifyClients) {
            if (this.selectedChipIds.indexOf(chipId) >= 0) {
                return;
            }
            if (this.adapter.hasClass(cssClasses.CHOICE) &&
                this.selectedChipIds.length > 0) {
                var previouslySelectedChip = this.selectedChipIds[0];
                var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip);
                this.selectedChipIds = [];
                this.adapter.selectChipAtIndex(previouslySelectedIndex, /** isSelected */ false, shouldNotifyClients);
            }
            this.selectedChipIds.push(chipId);
            var index = this.adapter.getIndexOfChipById(chipId);
            this.adapter.selectChipAtIndex(index, /** isSelected */ true, shouldNotifyClients);
        };
        return MDCChipSetFoundation;
    }(MDCFoundation));

    /**
     * @license
     * Copyright 2016 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    var _a = MDCChipFoundation.strings, INTERACTION_EVENT = _a.INTERACTION_EVENT, SELECTION_EVENT = _a.SELECTION_EVENT, REMOVAL_EVENT = _a.REMOVAL_EVENT, NAVIGATION_EVENT = _a.NAVIGATION_EVENT;
    var CHIP_SELECTOR = MDCChipSetFoundation.strings.CHIP_SELECTOR;
    var idCounter = 0;
    var MDCChipSet = /** @class */ (function (_super) {
        __extends(MDCChipSet, _super);
        function MDCChipSet() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        MDCChipSet.attachTo = function (root) {
            return new MDCChipSet(root);
        };
        Object.defineProperty(MDCChipSet.prototype, "chips", {
            get: function () {
                return this.chipsList.slice();
            },
            enumerable: false,
            configurable: true
        });
        Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", {
            /**
             * @return An array of the IDs of all selected chips.
             */
            get: function () {
                return this.foundation.getSelectedChipIds();
            },
            enumerable: false,
            configurable: true
        });
        /**
         * @param chipFactory A function which creates a new MDCChip.
         */
        MDCChipSet.prototype.initialize = function (chipFactory) {
            if (chipFactory === void 0) { chipFactory = function (el) { return new MDCChip(el); }; }
            this.chipFactory = chipFactory;
            this.chipsList = this.instantiateChips(this.chipFactory);
        };
        MDCChipSet.prototype.initialSyncWithDOM = function () {
            var e_1, _a;
            var _this = this;
            try {
                for (var _b = __values(this.chipsList), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var chip = _c.value;
                    if (chip.id && chip.selected) {
                        this.foundation.select(chip.id);
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
            this.handleChipInteraction = function (evt) {
                return _this.foundation.handleChipInteraction(evt.detail);
            };
            this.handleChipSelection = function (evt) {
                return _this.foundation.handleChipSelection(evt.detail);
            };
            this.handleChipRemoval = function (evt) {
                return _this.foundation.handleChipRemoval(evt.detail);
            };
            this.handleChipNavigation = function (evt) {
                return _this.foundation.handleChipNavigation(evt.detail);
            };
            this.listen(INTERACTION_EVENT, this.handleChipInteraction);
            this.listen(SELECTION_EVENT, this.handleChipSelection);
            this.listen(REMOVAL_EVENT, this.handleChipRemoval);
            this.listen(NAVIGATION_EVENT, this.handleChipNavigation);
        };
        MDCChipSet.prototype.destroy = function () {
            var e_2, _a;
            try {
                for (var _b = __values(this.chipsList), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var chip = _c.value;
                    chip.destroy();
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_2) throw e_2.error; }
            }
            this.unlisten(INTERACTION_EVENT, this.handleChipInteraction);
            this.unlisten(SELECTION_EVENT, this.handleChipSelection);
            this.unlisten(REMOVAL_EVENT, this.handleChipRemoval);
            this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation);
            _super.prototype.destroy.call(this);
        };
        /**
         * Adds a new chip object to the chip set from the given chip element.
         */
        MDCChipSet.prototype.addChip = function (chipEl) {
            chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter;
            this.chipsList.push(this.chipFactory(chipEl));
        };
        MDCChipSet.prototype.getDefaultFoundation = function () {
            var _this = this;
            // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
            // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
            var adapter = {
                announceMessage: function (message) {
                    announce(message);
                },
                focusChipPrimaryActionAtIndex: function (index) {
                    _this.chipsList[index].focusPrimaryAction();
                },
                focusChipTrailingActionAtIndex: function (index) {
                    _this.chipsList[index].focusTrailingAction();
                },
                getChipListCount: function () { return _this.chips.length; },
                getIndexOfChipById: function (chipId) {
                    return _this.findChipIndex(chipId);
                },
                hasClass: function (className) { return _this.root.classList.contains(className); },
                isRTL: function () { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; },
                removeChipAtIndex: function (index) {
                    if (index >= 0 && index < _this.chips.length) {
                        _this.chipsList[index].destroy();
                        _this.chipsList[index].remove();
                        _this.chipsList.splice(index, 1);
                    }
                },
                removeFocusFromChipAtIndex: function (index) {
                    _this.chipsList[index].removeFocus();
                },
                selectChipAtIndex: function (index, selected, shouldNotifyClients) {
                    if (index >= 0 && index < _this.chips.length) {
                        _this.chipsList[index].setSelectedFromChipSet(selected, shouldNotifyClients);
                    }
                },
            };
            return new MDCChipSetFoundation(adapter);
        };
        /**
         * Instantiates chip components on all of the chip set's child chip elements.
         */
        MDCChipSet.prototype.instantiateChips = function (chipFactory) {
            var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR));
            return chipElements.map(function (el) {
                el.id = el.id || "mdc-chip-" + ++idCounter;
                return chipFactory(el);
            });
        };
        /**
         * Returns the index of the chip with the given id, or -1 if the chip does not exist.
         */
        MDCChipSet.prototype.findChipIndex = function (chipId) {
            for (var i = 0; i < this.chips.length; i++) {
                if (this.chipsList[i].id === chipId) {
                    return i;
                }
            }
            return -1;
        };
        return MDCChipSet;
    }(MDCComponent));

    /**
     * @license
     * Copyright 2019 Google Inc.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */

    var deprecated = /*#__PURE__*/Object.freeze({
        __proto__: null,
        trailingActionStrings: strings$2,
        MDCChipTrailingAction: MDCChipTrailingAction,
        MDCChipTrailingActionFoundation: MDCChipTrailingActionFoundation,
        chipCssClasses: cssClasses$1,
        chipStrings: strings$1,
        MDCChip: MDCChip,
        MDCChipFoundation: MDCChipFoundation,
        chipSetCssClasses: cssClasses,
        chipSetStrings: strings,
        MDCChipSet: MDCChipSet,
        MDCChipSetFoundation: MDCChipSetFoundation
    });

    /* node_modules/@smui/chips/dist/Chip.svelte generated by Svelte v3.46.4 */

    const { Error: Error_1 } = globals;
    const file$j = "node_modules/@smui/chips/dist/Chip.svelte";

    // (49:2) {#if ripple && !$nonInteractive}
    function create_if_block_1$6(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-chip__ripple");
    			add_location(div, file$j, 49, 4, 1566);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$6.name,
    		type: "if",
    		source: "(49:2) {#if ripple && !$nonInteractive}",
    		ctx
    	});

    	return block;
    }

    // (53:2) {#if touch}
    function create_if_block$c(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-chip__touch");
    			add_location(div, file$j, 53, 4, 1636);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$c.name,
    		type: "if",
    		source: "(53:2) {#if touch}",
    		ctx
    	});

    	return block;
    }

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple: ripple && !$nonInteractive,         unbounded: false,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-chip': true,     'mdc-chip--selected': selected,     'mdc-chip--touch': touch,     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   role="row"   on:transitionend={(event) => instance && instance.handleTransitionEnd(event)}   on:click={() => instance && instance.handleClick()}   on:keydown={(event) => instance && instance.handleKeydown(event)}   on:focusin={(event) => instance && instance.handleFocusIn(event)}   on:focusout={(event) => instance && instance.handleFocusOut(event)}   on:SMUIChipTrailingAction:interaction={() =>     instance && instance.handleTrailingActionInteraction()}   on:SMUIChipTrailingAction:navigation={(event) =>     instance && instance.handleTrailingActionNavigation(event)}   on:SMUIChipsChipPrimaryAction:mount={(event) =>     (primaryActionAccessor = event.detail)}   on:SMUIChipsChipPrimaryAction:unmount={() =>     (primaryActionAccessor = undefined)}   on:SMUIChipsChipTrailingAction:mount={(event) =>     (trailingActionAccessor = event.detail)}   on:SMUIChipsChipTrailingAction:unmount={() =>     (trailingActionAccessor = undefined)}   {...$$restProps} >
    function create_default_slot$9(ctx) {
    	let t0;
    	let t1;
    	let if_block1_anchor;
    	let current;
    	let if_block0 = /*ripple*/ ctx[3] && !/*$nonInteractive*/ ctx[13] && create_if_block_1$6(ctx);
    	const default_slot_template = /*#slots*/ ctx[31].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[44], null);
    	let if_block1 = /*touch*/ ctx[4] && create_if_block$c(ctx);

    	const block = {
    		c: function create() {
    			if (if_block0) if_block0.c();
    			t0 = space();
    			if (default_slot) default_slot.c();
    			t1 = space();
    			if (if_block1) if_block1.c();
    			if_block1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block0) if_block0.m(target, anchor);
    			insert_dev(target, t0, anchor);

    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			insert_dev(target, t1, anchor);
    			if (if_block1) if_block1.m(target, anchor);
    			insert_dev(target, if_block1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*ripple*/ ctx[3] && !/*$nonInteractive*/ ctx[13]) {
    				if (if_block0) ; else {
    					if_block0 = create_if_block_1$6(ctx);
    					if_block0.c();
    					if_block0.m(t0.parentNode, t0);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 8192)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[44],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[44])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[44], dirty, null),
    						null
    					);
    				}
    			}

    			if (/*touch*/ ctx[4]) {
    				if (if_block1) ; else {
    					if_block1 = create_if_block$c(ctx);
    					if_block1.c();
    					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
    				}
    			} else if (if_block1) {
    				if_block1.d(1);
    				if_block1 = null;
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block0) if_block0.d(detaching);
    			if (detaching) detach_dev(t0);
    			if (default_slot) default_slot.d(detaching);
    			if (detaching) detach_dev(t1);
    			if (if_block1) if_block1.d(detaching);
    			if (detaching) detach_dev(if_block1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$9.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple: ripple && !$nonInteractive,         unbounded: false,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-chip': true,     'mdc-chip--selected': selected,     'mdc-chip--touch': touch,     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   role=\\\"row\\\"   on:transitionend={(event) => instance && instance.handleTransitionEnd(event)}   on:click={() => instance && instance.handleClick()}   on:keydown={(event) => instance && instance.handleKeydown(event)}   on:focusin={(event) => instance && instance.handleFocusIn(event)}   on:focusout={(event) => instance && instance.handleFocusOut(event)}   on:SMUIChipTrailingAction:interaction={() =>     instance && instance.handleTrailingActionInteraction()}   on:SMUIChipTrailingAction:navigation={(event) =>     instance && instance.handleTrailingActionNavigation(event)}   on:SMUIChipsChipPrimaryAction:mount={(event) =>     (primaryActionAccessor = event.detail)}   on:SMUIChipsChipPrimaryAction:unmount={() =>     (primaryActionAccessor = undefined)}   on:SMUIChipsChipTrailingAction:mount={(event) =>     (trailingActionAccessor = event.detail)}   on:SMUIChipsChipTrailingAction:unmount={() =>     (trailingActionAccessor = undefined)}   {...$$restProps} >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$k(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [
    				[
    					Ripple,
    					{
    						ripple: /*ripple*/ ctx[3] && !/*$nonInteractive*/ ctx[13],
    						unbounded: false,
    						addClass: /*addClass*/ ctx[22],
    						removeClass: /*removeClass*/ ctx[23],
    						addStyle: /*addStyle*/ ctx[24]
    					}
    				],
    				/*forwardEvents*/ ctx[14],
    				.../*use*/ ctx[0]
    			]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-chip': true,
    				'mdc-chip--selected': /*selected*/ ctx[7],
    				'mdc-chip--touch': /*touch*/ ctx[4],
    				.../*internalClasses*/ ctx[9]
    			})
    		},
    		{
    			style: Object.entries(/*internalStyles*/ ctx[10]).map(func$6).concat([/*style*/ ctx[2]]).join(' ')
    		},
    		{ role: "row" },
    		/*$$restProps*/ ctx[25]
    	];

    	var switch_value = /*component*/ ctx[5];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$9] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[32](switch_instance);
    		switch_instance.$on("transitionend", /*transitionend_handler*/ ctx[33]);
    		switch_instance.$on("click", /*click_handler*/ ctx[34]);
    		switch_instance.$on("keydown", /*keydown_handler*/ ctx[35]);
    		switch_instance.$on("focusin", /*focusin_handler*/ ctx[36]);
    		switch_instance.$on("focusout", /*focusout_handler*/ ctx[37]);
    		switch_instance.$on("SMUIChipTrailingAction:interaction", /*SMUIChipTrailingAction_interaction_handler*/ ctx[38]);
    		switch_instance.$on("SMUIChipTrailingAction:navigation", /*SMUIChipTrailingAction_navigation_handler*/ ctx[39]);
    		switch_instance.$on("SMUIChipsChipPrimaryAction:mount", /*SMUIChipsChipPrimaryAction_mount_handler*/ ctx[40]);
    		switch_instance.$on("SMUIChipsChipPrimaryAction:unmount", /*SMUIChipsChipPrimaryAction_unmount_handler*/ ctx[41]);
    		switch_instance.$on("SMUIChipsChipTrailingAction:mount", /*SMUIChipsChipTrailingAction_mount_handler*/ ctx[42]);
    		switch_instance.$on("SMUIChipsChipTrailingAction:unmount", /*SMUIChipsChipTrailingAction_unmount_handler*/ ctx[43]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error_1("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const switch_instance_changes = (dirty[0] & /*ripple, $nonInteractive, addClass, removeClass, addStyle, forwardEvents, use, className, selected, touch, internalClasses, internalStyles, style, $$restProps*/ 62940831)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty[0] & /*ripple, $nonInteractive, addClass, removeClass, addStyle, forwardEvents, use*/ 29384713 && {
    						use: [
    							[
    								Ripple,
    								{
    									ripple: /*ripple*/ ctx[3] && !/*$nonInteractive*/ ctx[13],
    									unbounded: false,
    									addClass: /*addClass*/ ctx[22],
    									removeClass: /*removeClass*/ ctx[23],
    									addStyle: /*addStyle*/ ctx[24]
    								}
    							],
    							/*forwardEvents*/ ctx[14],
    							.../*use*/ ctx[0]
    						]
    					},
    					dirty[0] & /*className, selected, touch, internalClasses*/ 658 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-chip': true,
    							'mdc-chip--selected': /*selected*/ ctx[7],
    							'mdc-chip--touch': /*touch*/ ctx[4],
    							.../*internalClasses*/ ctx[9]
    						})
    					},
    					dirty[0] & /*internalStyles, style*/ 1028 && {
    						style: Object.entries(/*internalStyles*/ ctx[10]).map(func$6).concat([/*style*/ ctx[2]]).join(' ')
    					},
    					switch_instance_spread_levels[3],
    					dirty[0] & /*$$restProps*/ 33554432 && get_spread_object(/*$$restProps*/ ctx[25])
    				])
    			: {};

    			if (dirty[0] & /*touch, ripple, $nonInteractive*/ 8216 | dirty[1] & /*$$scope*/ 8192) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[5])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[32](switch_instance);
    					switch_instance.$on("transitionend", /*transitionend_handler*/ ctx[33]);
    					switch_instance.$on("click", /*click_handler*/ ctx[34]);
    					switch_instance.$on("keydown", /*keydown_handler*/ ctx[35]);
    					switch_instance.$on("focusin", /*focusin_handler*/ ctx[36]);
    					switch_instance.$on("focusout", /*focusout_handler*/ ctx[37]);
    					switch_instance.$on("SMUIChipTrailingAction:interaction", /*SMUIChipTrailingAction_interaction_handler*/ ctx[38]);
    					switch_instance.$on("SMUIChipTrailingAction:navigation", /*SMUIChipTrailingAction_navigation_handler*/ ctx[39]);
    					switch_instance.$on("SMUIChipsChipPrimaryAction:mount", /*SMUIChipsChipPrimaryAction_mount_handler*/ ctx[40]);
    					switch_instance.$on("SMUIChipsChipPrimaryAction:unmount", /*SMUIChipsChipPrimaryAction_unmount_handler*/ ctx[41]);
    					switch_instance.$on("SMUIChipsChipTrailingAction:mount", /*SMUIChipsChipTrailingAction_mount_handler*/ ctx[42]);
    					switch_instance.$on("SMUIChipsChipTrailingAction:unmount", /*SMUIChipsChipTrailingAction_unmount_handler*/ ctx[43]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[32](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$k.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$6 = ([name, value]) => `${name}: ${value};`;

    function instance_1$1($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","style","chip","ripple","touch","shouldRemoveOnTrailingIconClick","shouldFocusPrimaryActionOnClick","component","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $index;
    	let $choice;
    	let $leadingIconClassesStore;
    	let $isSelectedStore;
    	let $shouldRemoveOnTrailingIconClickStore;
    	let $initialSelectedStore;
    	let $nonInteractive;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Chip', slots, ['default']);
    	const { MDCChipFoundation } = deprecated;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { chip: chipId } = $$props;
    	let { ripple = true } = $$props;
    	let { touch = false } = $$props;
    	let { shouldRemoveOnTrailingIconClick = true } = $$props;
    	let { shouldFocusPrimaryActionOnClick = true } = $$props;
    	let element;
    	let instance;
    	let internalClasses = {};
    	let leadingIconClasses = {};
    	let internalStyles = {};
    	const initialSelectedStore = getContext('SMUI:chips:chip:initialSelected');
    	validate_store(initialSelectedStore, 'initialSelectedStore');
    	component_subscribe($$self, initialSelectedStore, value => $$invalidate(50, $initialSelectedStore = value));
    	let selected = $initialSelectedStore;
    	let primaryActionAccessor = undefined;
    	let trailingActionAccessor = undefined;
    	const nonInteractive = getContext('SMUI:chips:nonInteractive');
    	validate_store(nonInteractive, 'nonInteractive');
    	component_subscribe($$self, nonInteractive, value => $$invalidate(13, $nonInteractive = value));
    	const choice = getContext('SMUI:chips:choice');
    	validate_store(choice, 'choice');
    	component_subscribe($$self, choice, value => $$invalidate(46, $choice = value));
    	const index = getContext('SMUI:chips:chip:index');
    	validate_store(index, 'index');
    	component_subscribe($$self, index, value => $$invalidate(45, $index = value));
    	let { component = Div } = $$props;
    	const shouldRemoveOnTrailingIconClickStore = writable(shouldRemoveOnTrailingIconClick);
    	validate_store(shouldRemoveOnTrailingIconClickStore, 'shouldRemoveOnTrailingIconClickStore');
    	component_subscribe($$self, shouldRemoveOnTrailingIconClickStore, value => $$invalidate(49, $shouldRemoveOnTrailingIconClickStore = value));
    	setContext('SMUI:chips:chip:shouldRemoveOnTrailingIconClick', shouldRemoveOnTrailingIconClickStore);
    	const isSelectedStore = writable(selected);
    	validate_store(isSelectedStore, 'isSelectedStore');
    	component_subscribe($$self, isSelectedStore, value => $$invalidate(48, $isSelectedStore = value));
    	setContext('SMUI:chips:chip:isSelected', isSelectedStore);
    	const leadingIconClassesStore = writable(leadingIconClasses);
    	validate_store(leadingIconClassesStore, 'leadingIconClassesStore');
    	component_subscribe($$self, leadingIconClassesStore, value => $$invalidate(47, $leadingIconClassesStore = value));
    	setContext('SMUI:chips:chip:leadingIconClasses', leadingIconClassesStore);
    	setContext('SMUI:chips:chip:focusable', $choice && selected || $index === 0);

    	if (!chipId) {
    		throw new Error('The chip property is required! It should be passed down from the Set to the Chip.');
    	}

    	onMount(() => {
    		$$invalidate(6, instance = new MDCChipFoundation({
    				addClass,
    				addClassToLeadingIcon: addLeadingIconClass,
    				eventTargetHasClass: (target, className) => target && 'classList' in target
    				? target.classList.contains(className)
    				: false,
    				focusPrimaryAction: () => {
    					if (primaryActionAccessor) {
    						primaryActionAccessor.focus();
    					}
    				},
    				focusTrailingAction: () => {
    					if (trailingActionAccessor) {
    						trailingActionAccessor.focus();
    					}
    				},
    				getAttribute: attr => getElement().getAttribute(attr),
    				getCheckmarkBoundingClientRect: () => {
    					const target = getElement().querySelector('.mdc-chip__checkmark');

    					if (target) {
    						return target.getBoundingClientRect();
    					}

    					return null;
    				},
    				getComputedStyleValue: getStyle,
    				getRootBoundingClientRect: () => getElement().getBoundingClientRect(),
    				hasClass,
    				hasLeadingIcon: () => {
    					const target = getElement().querySelector('.mdc-chip__icon--leading');
    					return !!target;
    				},
    				isRTL: () => getComputedStyle(getElement()).getPropertyValue('direction') === 'rtl',
    				isTrailingActionNavigable: () => {
    					if (trailingActionAccessor) {
    						return trailingActionAccessor.isNavigable();
    					}

    					return false;
    				},
    				notifyInteraction: () => dispatch$1(getElement(), 'SMUIChip:interaction', { chipId }, undefined, true),
    				notifyNavigation: (key, source) => dispatch$1(getElement(), 'SMUIChip:navigation', { chipId, key, source }, undefined, true),
    				notifyRemoval: removedAnnouncement => {
    					dispatch$1(getElement(), 'SMUIChip:removal', { chipId, removedAnnouncement }, undefined, true);
    				},
    				notifySelection: (selected, shouldIgnore) => dispatch$1(getElement(), 'SMUIChip:selection', { chipId, selected, shouldIgnore }, undefined, true),
    				notifyTrailingIconInteraction: () => dispatch$1(getElement(), 'SMUIChip:trailingIconInteraction', { chipId }, undefined, true),
    				notifyEditStart: () => {
    					
    				}, /* Not Implemented. */
    				notifyEditFinish: () => {
    					
    				}, /* Not Implemented. */
    				removeClass,
    				removeClassFromLeadingIcon: removeLeadingIconClass,
    				removeTrailingActionFocus: () => {
    					if (trailingActionAccessor) {
    						trailingActionAccessor.removeFocus();
    					}
    				},
    				setPrimaryActionAttr: (attr, value) => {
    					if (primaryActionAccessor) {
    						primaryActionAccessor.addAttr(attr, value);
    					}
    				},
    				setStyleProperty: addStyle
    			}));

    		const accessor = {
    			chipId,
    			get selected() {
    				return selected;
    			},
    			focusPrimaryAction,
    			focusTrailingAction,
    			removeFocus,
    			setSelectedFromChipSet
    		};

    		dispatch$1(getElement(), 'SMUIChipsChip:mount', accessor);
    		instance.init();

    		return () => {
    			dispatch$1(getElement(), 'SMUIChipsChip:unmount', accessor);
    			instance.destroy();
    		};
    	});

    	function hasClass(className) {
    		return className in internalClasses
    		? internalClasses[className]
    		: getElement().classList.contains(className);
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(9, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(9, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addLeadingIconClass(className) {
    		if (!leadingIconClasses[className]) {
    			$$invalidate(30, leadingIconClasses[className] = true, leadingIconClasses);
    		}
    	}

    	function removeLeadingIconClass(className) {
    		if (!(className in leadingIconClasses) || leadingIconClasses[className]) {
    			$$invalidate(30, leadingIconClasses[className] = false, leadingIconClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(10, internalStyles);
    			} else {
    				$$invalidate(10, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function getStyle(name) {
    		return name in internalStyles
    		? internalStyles[name]
    		: getComputedStyle(getElement()).getPropertyValue(name);
    	}

    	function setSelectedFromChipSet(value, shouldNotifyClients) {
    		$$invalidate(7, selected = value);
    		instance.setSelectedFromChipSet(selected, shouldNotifyClients);
    	}

    	function focusPrimaryAction() {
    		instance.focusPrimaryAction();
    	}

    	function focusTrailingAction() {
    		instance.focusTrailingAction();
    	}

    	function removeFocus() {
    		instance.removeFocus();
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(8, element);
    		});
    	}

    	const transitionend_handler = event => instance && instance.handleTransitionEnd(event);
    	const click_handler = () => instance && instance.handleClick();
    	const keydown_handler = event => instance && instance.handleKeydown(event);
    	const focusin_handler = event => instance && instance.handleFocusIn(event);
    	const focusout_handler = event => instance && instance.handleFocusOut(event);
    	const SMUIChipTrailingAction_interaction_handler = () => instance && instance.handleTrailingActionInteraction();
    	const SMUIChipTrailingAction_navigation_handler = event => instance && instance.handleTrailingActionNavigation(event);
    	const SMUIChipsChipPrimaryAction_mount_handler = event => $$invalidate(11, primaryActionAccessor = event.detail);
    	const SMUIChipsChipPrimaryAction_unmount_handler = () => $$invalidate(11, primaryActionAccessor = undefined);
    	const SMUIChipsChipTrailingAction_mount_handler = event => $$invalidate(12, trailingActionAccessor = event.detail);
    	const SMUIChipsChipTrailingAction_unmount_handler = () => $$invalidate(12, trailingActionAccessor = undefined);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(25, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(2, style = $$new_props.style);
    		if ('chip' in $$new_props) $$invalidate(26, chipId = $$new_props.chip);
    		if ('ripple' in $$new_props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('touch' in $$new_props) $$invalidate(4, touch = $$new_props.touch);
    		if ('shouldRemoveOnTrailingIconClick' in $$new_props) $$invalidate(27, shouldRemoveOnTrailingIconClick = $$new_props.shouldRemoveOnTrailingIconClick);
    		if ('shouldFocusPrimaryActionOnClick' in $$new_props) $$invalidate(28, shouldFocusPrimaryActionOnClick = $$new_props.shouldFocusPrimaryActionOnClick);
    		if ('component' in $$new_props) $$invalidate(5, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(44, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		deprecated,
    		onMount,
    		setContext,
    		getContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Ripple,
    		Div,
    		MDCChipFoundation,
    		forwardEvents,
    		use,
    		className,
    		style,
    		chipId,
    		ripple,
    		touch,
    		shouldRemoveOnTrailingIconClick,
    		shouldFocusPrimaryActionOnClick,
    		element,
    		instance,
    		internalClasses,
    		leadingIconClasses,
    		internalStyles,
    		initialSelectedStore,
    		selected,
    		primaryActionAccessor,
    		trailingActionAccessor,
    		nonInteractive,
    		choice,
    		index,
    		component,
    		shouldRemoveOnTrailingIconClickStore,
    		isSelectedStore,
    		leadingIconClassesStore,
    		hasClass,
    		addClass,
    		removeClass,
    		addLeadingIconClass,
    		removeLeadingIconClass,
    		addStyle,
    		getStyle,
    		setSelectedFromChipSet,
    		focusPrimaryAction,
    		focusTrailingAction,
    		removeFocus,
    		getElement,
    		$index,
    		$choice,
    		$leadingIconClassesStore,
    		$isSelectedStore,
    		$shouldRemoveOnTrailingIconClickStore,
    		$initialSelectedStore,
    		$nonInteractive
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(2, style = $$new_props.style);
    		if ('chipId' in $$props) $$invalidate(26, chipId = $$new_props.chipId);
    		if ('ripple' in $$props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('touch' in $$props) $$invalidate(4, touch = $$new_props.touch);
    		if ('shouldRemoveOnTrailingIconClick' in $$props) $$invalidate(27, shouldRemoveOnTrailingIconClick = $$new_props.shouldRemoveOnTrailingIconClick);
    		if ('shouldFocusPrimaryActionOnClick' in $$props) $$invalidate(28, shouldFocusPrimaryActionOnClick = $$new_props.shouldFocusPrimaryActionOnClick);
    		if ('element' in $$props) $$invalidate(8, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(6, instance = $$new_props.instance);
    		if ('internalClasses' in $$props) $$invalidate(9, internalClasses = $$new_props.internalClasses);
    		if ('leadingIconClasses' in $$props) $$invalidate(30, leadingIconClasses = $$new_props.leadingIconClasses);
    		if ('internalStyles' in $$props) $$invalidate(10, internalStyles = $$new_props.internalStyles);
    		if ('selected' in $$props) $$invalidate(7, selected = $$new_props.selected);
    		if ('primaryActionAccessor' in $$props) $$invalidate(11, primaryActionAccessor = $$new_props.primaryActionAccessor);
    		if ('trailingActionAccessor' in $$props) $$invalidate(12, trailingActionAccessor = $$new_props.trailingActionAccessor);
    		if ('component' in $$props) $$invalidate(5, component = $$new_props.component);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*shouldRemoveOnTrailingIconClick*/ 134217728) {
    			set_store_value(shouldRemoveOnTrailingIconClickStore, $shouldRemoveOnTrailingIconClickStore = shouldRemoveOnTrailingIconClick, $shouldRemoveOnTrailingIconClickStore);
    		}

    		if ($$self.$$.dirty[0] & /*selected*/ 128) {
    			set_store_value(isSelectedStore, $isSelectedStore = selected, $isSelectedStore);
    		}

    		if ($$self.$$.dirty[0] & /*leadingIconClasses*/ 1073741824) {
    			set_store_value(leadingIconClassesStore, $leadingIconClassesStore = leadingIconClasses, $leadingIconClassesStore);
    		}

    		if ($$self.$$.dirty[0] & /*instance, shouldRemoveOnTrailingIconClick*/ 134217792) {
    			if (instance && instance.getShouldRemoveOnTrailingIconClick() !== shouldRemoveOnTrailingIconClick) {
    				instance.setShouldRemoveOnTrailingIconClick(shouldRemoveOnTrailingIconClick);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, shouldFocusPrimaryActionOnClick*/ 268435520) {
    			if (instance) {
    				instance.setShouldFocusPrimaryActionOnClick(shouldFocusPrimaryActionOnClick);
    			}
    		}
    	};

    	return [
    		use,
    		className,
    		style,
    		ripple,
    		touch,
    		component,
    		instance,
    		selected,
    		element,
    		internalClasses,
    		internalStyles,
    		primaryActionAccessor,
    		trailingActionAccessor,
    		$nonInteractive,
    		forwardEvents,
    		initialSelectedStore,
    		nonInteractive,
    		choice,
    		index,
    		shouldRemoveOnTrailingIconClickStore,
    		isSelectedStore,
    		leadingIconClassesStore,
    		addClass,
    		removeClass,
    		addStyle,
    		$$restProps,
    		chipId,
    		shouldRemoveOnTrailingIconClick,
    		shouldFocusPrimaryActionOnClick,
    		getElement,
    		leadingIconClasses,
    		slots,
    		switch_instance_binding,
    		transitionend_handler,
    		click_handler,
    		keydown_handler,
    		focusin_handler,
    		focusout_handler,
    		SMUIChipTrailingAction_interaction_handler,
    		SMUIChipTrailingAction_navigation_handler,
    		SMUIChipsChipPrimaryAction_mount_handler,
    		SMUIChipsChipPrimaryAction_unmount_handler,
    		SMUIChipsChipTrailingAction_mount_handler,
    		SMUIChipsChipTrailingAction_unmount_handler,
    		$$scope
    	];
    }

    class Chip extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1$1,
    			create_fragment$k,
    			safe_not_equal,
    			{
    				use: 0,
    				class: 1,
    				style: 2,
    				chip: 26,
    				ripple: 3,
    				touch: 4,
    				shouldRemoveOnTrailingIconClick: 27,
    				shouldFocusPrimaryActionOnClick: 28,
    				component: 5,
    				getElement: 29
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Chip",
    			options,
    			id: create_fragment$k.name
    		});

    		const { ctx } = this.$$;
    		const props = options.props || {};

    		if (/*chipId*/ ctx[26] === undefined && !('chip' in props)) {
    			console.warn("<Chip> was created without expected prop 'chip'");
    		}
    	}

    	get use() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get chip() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set chip(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get touch() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set touch(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get shouldRemoveOnTrailingIconClick() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set shouldRemoveOnTrailingIconClick(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get shouldFocusPrimaryActionOnClick() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set shouldFocusPrimaryActionOnClick(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error_1("<Chip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[29];
    	}

    	set getElement(value) {
    		throw new Error_1("<Chip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/chips/dist/Set.svelte generated by Svelte v3.46.4 */
    const file$i = "node_modules/@smui/chips/dist/Set.svelte";

    function get_each_context$7(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[37] = list[i];
    	child_ctx[39] = i;
    	return child_ctx;
    }

    const get_default_slot_changes$4 = dirty => ({ chip: dirty[0] & /*chips*/ 1 });
    const get_default_slot_context$4 = ctx => ({ chip: /*chip*/ ctx[37] });

    // (24:6) <ContextFragment         key="SMUI:chips:chip:initialSelected"         value={initialSelected[i]}       >
    function create_default_slot_1$5(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[25].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[27], get_default_slot_context$4);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*$$scope, chips*/ 134217729)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[27],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[27])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[27], dirty, get_default_slot_changes$4),
    						get_default_slot_context$4
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$5.name,
    		type: "slot",
    		source: "(24:6) <ContextFragment         key=\\\"SMUI:chips:chip:initialSelected\\\"         value={initialSelected[i]}       >",
    		ctx
    	});

    	return block;
    }

    // (23:4) <ContextFragment key="SMUI:chips:chip:index" value={i}>
    function create_default_slot$8(ctx) {
    	let contextfragment;
    	let t;
    	let current;

    	contextfragment = new ContextFragment({
    			props: {
    				key: "SMUI:chips:chip:initialSelected",
    				value: /*initialSelected*/ ctx[10][/*i*/ ctx[39]],
    				$$slots: { default: [create_default_slot_1$5] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(contextfragment.$$.fragment);
    			t = space();
    		},
    		m: function mount(target, anchor) {
    			mount_component(contextfragment, target, anchor);
    			insert_dev(target, t, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const contextfragment_changes = {};
    			if (dirty[0] & /*chips*/ 1) contextfragment_changes.value = /*initialSelected*/ ctx[10][/*i*/ ctx[39]];

    			if (dirty[0] & /*$$scope, chips*/ 134217729) {
    				contextfragment_changes.$$scope = { dirty, ctx };
    			}

    			contextfragment.$set(contextfragment_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(contextfragment.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(contextfragment.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(contextfragment, detaching);
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$8.name,
    		type: "slot",
    		source: "(23:4) <ContextFragment key=\\\"SMUI:chips:chip:index\\\" value={i}>",
    		ctx
    	});

    	return block;
    }

    // (22:2) {#each chips as chip, i (key(chip))}
    function create_each_block$7(key_2, ctx) {
    	let first;
    	let contextfragment;
    	let current;

    	contextfragment = new ContextFragment({
    			props: {
    				key: "SMUI:chips:chip:index",
    				value: /*i*/ ctx[39],
    				$$slots: { default: [create_default_slot$8] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		key: key_2,
    		first: null,
    		c: function create() {
    			first = empty$2();
    			create_component(contextfragment.$$.fragment);
    			this.first = first;
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, first, anchor);
    			mount_component(contextfragment, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			const contextfragment_changes = {};
    			if (dirty[0] & /*chips*/ 1) contextfragment_changes.value = /*i*/ ctx[39];

    			if (dirty[0] & /*$$scope, chips*/ 134217729) {
    				contextfragment_changes.$$scope = { dirty, ctx };
    			}

    			contextfragment.$set(contextfragment_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(contextfragment.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(contextfragment.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(first);
    			destroy_component(contextfragment, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$7.name,
    		type: "each",
    		source: "(22:2) {#each chips as chip, i (key(chip))}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$j(ctx) {
    	let div;
    	let each_blocks = [];
    	let each_1_lookup = new Map();
    	let div_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	let each_value = /*chips*/ ctx[0];
    	validate_each_argument(each_value);
    	const get_key = ctx => /*key*/ ctx[3](/*chip*/ ctx[37]);
    	validate_each_keys(ctx, each_value, get_each_context$7, get_key);

    	for (let i = 0; i < each_value.length; i += 1) {
    		let child_ctx = get_each_context$7(ctx, each_value, i);
    		let key = get_key(child_ctx);
    		each_1_lookup.set(key, each_blocks[i] = create_each_block$7(key, child_ctx));
    	}

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[2]]: true,
    				'mdc-chip-set': true,
    				'smui-chip-set--non-interactive': /*nonInteractive*/ ctx[4],
    				'mdc-chip-set--choice': /*choice*/ ctx[5],
    				'mdc-chip-set--filter': /*filter*/ ctx[6],
    				'mdc-chip-set--input': /*input*/ ctx[7]
    			})
    		},
    		{ role: "grid" },
    		/*$$restProps*/ ctx[20]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			set_attributes(div, div_data);
    			add_location(div, file$i, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(div, null);
    			}

    			/*div_binding*/ ctx[26](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[1])),
    					action_destroyer(/*forwardEvents*/ ctx[9].call(null, div)),
    					listen_dev(div, "SMUIChipsChip:mount", /*handleChipMount*/ ctx[14], false, false, false),
    					listen_dev(div, "SMUIChipsChip:unmount", /*handleChipUnmount*/ ctx[15], false, false, false),
    					listen_dev(div, "SMUIChip:interaction", /*handleChipInteraction*/ ctx[16], false, false, false),
    					listen_dev(div, "SMUIChip:selection", /*handleChipSelection*/ ctx[17], false, false, false),
    					listen_dev(div, "SMUIChip:removal", /*handleChipRemoval*/ ctx[18], false, false, false),
    					listen_dev(div, "SMUIChip:navigation", /*handleChipNavigation*/ ctx[19], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*chips, initialSelected, $$scope, key*/ 134218761) {
    				each_value = /*chips*/ ctx[0];
    				validate_each_argument(each_value);
    				group_outros();
    				validate_each_keys(ctx, each_value, get_each_context$7, get_key);
    				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, outro_and_destroy_block, create_each_block$7, null, get_each_context$7);
    				check_outros();
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty[0] & /*className, nonInteractive, choice, filter, input*/ 244 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[2]]: true,
    					'mdc-chip-set': true,
    					'smui-chip-set--non-interactive': /*nonInteractive*/ ctx[4],
    					'mdc-chip-set--choice': /*choice*/ ctx[5],
    					'mdc-chip-set--filter': /*filter*/ ctx[6],
    					'mdc-chip-set--input': /*input*/ ctx[7]
    				}))) && { class: div_class_value },
    				{ role: "grid" },
    				dirty[0] & /*$$restProps*/ 1048576 && /*$$restProps*/ ctx[20]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty[0] & /*use*/ 2) useActions_action.update.call(null, /*use*/ ctx[1]);
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].d();
    			}

    			/*div_binding*/ ctx[26](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$j.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function setDifference(setA, setB) {
    	let _difference = new Set(setA);

    	for (let elem of setB) {
    		_difference.delete(elem);
    	}

    	return _difference;
    }

    function instance_1($$self, $$props, $$invalidate) {
    	const omit_props_names = [
    		"use","class","chips","key","selected","nonInteractive","choice","filter","input","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $filterStore;
    	let $choiceStore;
    	let $nonInteractiveStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Set', slots, ['default']);
    	const { MDCChipSetFoundation } = deprecated;
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { chips = [] } = $$props;
    	let { key = chip => chip } = $$props;
    	let { selected = undefined } = $$props;
    	let { nonInteractive = false } = $$props;
    	let { choice = false } = $$props;
    	let { filter = false } = $$props;
    	let { input = false } = $$props;
    	let element;
    	let instance;
    	let chipAccessorMap = {};
    	let chipAccessorWeakMap = new WeakMap();
    	let initialSelected = chips.map(chipId => choice && selected === chipId || filter && selected.indexOf(chipId) !== -1);
    	const nonInteractiveStore = writable(nonInteractive);
    	validate_store(nonInteractiveStore, 'nonInteractiveStore');
    	component_subscribe($$self, nonInteractiveStore, value => $$invalidate(31, $nonInteractiveStore = value));
    	setContext('SMUI:chips:nonInteractive', nonInteractiveStore);
    	const choiceStore = writable(choice);
    	validate_store(choiceStore, 'choiceStore');
    	component_subscribe($$self, choiceStore, value => $$invalidate(30, $choiceStore = value));
    	setContext('SMUI:chips:choice', choiceStore);
    	const filterStore = writable(filter);
    	validate_store(filterStore, 'filterStore');
    	component_subscribe($$self, filterStore, value => $$invalidate(29, $filterStore = value));
    	setContext('SMUI:chips:filter', filterStore);
    	let previousSelected = filter ? new Set(selected) : selected;

    	onMount(() => {
    		$$invalidate(23, instance = new MDCChipSetFoundation({
    				announceMessage: announce$1,
    				focusChipPrimaryActionAtIndex: index => {
    					var _a;

    					(_a = getAccessor(chips[index])) === null || _a === void 0
    					? void 0
    					: _a.focusPrimaryAction();
    				},
    				focusChipTrailingActionAtIndex: index => {
    					var _a;

    					(_a = getAccessor(chips[index])) === null || _a === void 0
    					? void 0
    					: _a.focusTrailingAction();
    				},
    				getChipListCount: () => chips.length,
    				getIndexOfChipById: chipId => chips.indexOf(chipId),
    				hasClass: className => getElement().classList.contains(className),
    				isRTL: () => getComputedStyle(getElement()).getPropertyValue('direction') === 'rtl',
    				removeChipAtIndex: index => {
    					if (index >= 0 && index < chips.length) {
    						if (choice && selected === chips[index]) {
    							$$invalidate(21, selected = null);
    						} else if (filter && selected.indexOf(chips[index]) !== -1) {
    							selected.splice(selected.indexOf(chips[index]), 1);
    							$$invalidate(21, selected);
    						}

    						chips.splice(index, 1);
    						$$invalidate(0, chips);
    					}
    				},
    				removeFocusFromChipAtIndex: index => {
    					var _a;

    					(_a = getAccessor(chips[index])) === null || _a === void 0
    					? void 0
    					: _a.removeFocus();
    				},
    				selectChipAtIndex: (index, selectedValue, shouldNotifyClients) => {
    					var _a;

    					if (index >= 0 && index < chips.length) {
    						if (filter) {
    							const selIndex = selected.indexOf(chips[index]);

    							if (selectedValue && selIndex === -1) {
    								selected.push(chips[index]);
    								$$invalidate(21, selected);
    							} else if (!selectedValue && selIndex !== -1) {
    								selected.splice(selIndex, 1);
    								$$invalidate(21, selected);
    							}
    						} else if (choice && (selectedValue || selected === chips[index])) {
    							$$invalidate(21, selected = selectedValue ? chips[index] : null);
    						}

    						(_a = getAccessor(chips[index])) === null || _a === void 0
    						? void 0
    						: _a.setSelectedFromChipSet(selectedValue, shouldNotifyClients);
    					}
    				}
    			}));

    		instance.init();

    		if (choice && selected != null) {
    			instance.select(selected);
    		} else if (filter && selected.length) {
    			for (const chipId of selected) {
    				instance.select(chipId);
    			}
    		}

    		return () => {
    			instance.destroy();
    		};
    	});

    	function handleChipMount(event) {
    		const accessor = event.detail;
    		addAccessor(accessor.chipId, accessor);
    	}

    	function handleChipUnmount(event) {
    		const accessor = event.detail;
    		removeAccessor(accessor.chipId);
    	}

    	function handleChipInteraction(event) {
    		if (instance) {
    			instance.handleChipInteraction(event.detail);
    		}
    	}

    	function handleChipSelection(event) {
    		if (instance) {
    			instance.handleChipSelection(event.detail);
    		}
    	}

    	function handleChipRemoval(event) {
    		if (instance) {
    			instance.handleChipRemoval(event.detail);
    		}
    	}

    	function handleChipNavigation(event) {
    		if (instance) {
    			instance.handleChipNavigation(event.detail);
    		}
    	}

    	function getAccessor(chipId) {
    		return chipId instanceof Object
    		? chipAccessorWeakMap.get(chipId)
    		: chipAccessorMap[chipId];
    	}

    	function addAccessor(chipId, accessor) {
    		if (chipId instanceof Object) {
    			chipAccessorWeakMap.set(chipId, accessor);
    		} else {
    			chipAccessorMap[chipId] = accessor;
    		}
    	}

    	function removeAccessor(chipId) {
    		if (chipId instanceof Object) {
    			chipAccessorWeakMap.delete(chipId);
    		} else {
    			delete chipAccessorMap[chipId];
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(8, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(20, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(1, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(2, className = $$new_props.class);
    		if ('chips' in $$new_props) $$invalidate(0, chips = $$new_props.chips);
    		if ('key' in $$new_props) $$invalidate(3, key = $$new_props.key);
    		if ('selected' in $$new_props) $$invalidate(21, selected = $$new_props.selected);
    		if ('nonInteractive' in $$new_props) $$invalidate(4, nonInteractive = $$new_props.nonInteractive);
    		if ('choice' in $$new_props) $$invalidate(5, choice = $$new_props.choice);
    		if ('filter' in $$new_props) $$invalidate(6, filter = $$new_props.filter);
    		if ('input' in $$new_props) $$invalidate(7, input = $$new_props.input);
    		if ('$$scope' in $$new_props) $$invalidate(27, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		deprecated,
    		onMount,
    		setContext,
    		writable,
    		get_current_component,
    		announce: announce$1,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		ContextFragment,
    		MDCChipSetFoundation,
    		forwardEvents,
    		use,
    		className,
    		chips,
    		key,
    		selected,
    		nonInteractive,
    		choice,
    		filter,
    		input,
    		element,
    		instance,
    		chipAccessorMap,
    		chipAccessorWeakMap,
    		initialSelected,
    		nonInteractiveStore,
    		choiceStore,
    		filterStore,
    		previousSelected,
    		setDifference,
    		handleChipMount,
    		handleChipUnmount,
    		handleChipInteraction,
    		handleChipSelection,
    		handleChipRemoval,
    		handleChipNavigation,
    		getAccessor,
    		addAccessor,
    		removeAccessor,
    		getElement,
    		$filterStore,
    		$choiceStore,
    		$nonInteractiveStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(1, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(2, className = $$new_props.className);
    		if ('chips' in $$props) $$invalidate(0, chips = $$new_props.chips);
    		if ('key' in $$props) $$invalidate(3, key = $$new_props.key);
    		if ('selected' in $$props) $$invalidate(21, selected = $$new_props.selected);
    		if ('nonInteractive' in $$props) $$invalidate(4, nonInteractive = $$new_props.nonInteractive);
    		if ('choice' in $$props) $$invalidate(5, choice = $$new_props.choice);
    		if ('filter' in $$props) $$invalidate(6, filter = $$new_props.filter);
    		if ('input' in $$props) $$invalidate(7, input = $$new_props.input);
    		if ('element' in $$props) $$invalidate(8, element = $$new_props.element);
    		if ('instance' in $$props) $$invalidate(23, instance = $$new_props.instance);
    		if ('chipAccessorMap' in $$props) chipAccessorMap = $$new_props.chipAccessorMap;
    		if ('chipAccessorWeakMap' in $$props) chipAccessorWeakMap = $$new_props.chipAccessorWeakMap;
    		if ('initialSelected' in $$props) $$invalidate(10, initialSelected = $$new_props.initialSelected);
    		if ('previousSelected' in $$props) $$invalidate(24, previousSelected = $$new_props.previousSelected);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*nonInteractive*/ 16) {
    			set_store_value(nonInteractiveStore, $nonInteractiveStore = nonInteractive, $nonInteractiveStore);
    		}

    		if ($$self.$$.dirty[0] & /*choice*/ 32) {
    			set_store_value(choiceStore, $choiceStore = choice, $choiceStore);
    		}

    		if ($$self.$$.dirty[0] & /*filter*/ 64) {
    			set_store_value(filterStore, $filterStore = filter, $filterStore);
    		}

    		if ($$self.$$.dirty[0] & /*instance, choice, previousSelected, selected*/ 27263008) {
    			if (instance && choice && previousSelected !== selected) {
    				$$invalidate(24, previousSelected = selected);
    				instance.select(selected);
    			}
    		}

    		if ($$self.$$.dirty[0] & /*instance, filter, selected, previousSelected, chips*/ 27263041) {
    			if (instance && filter) {
    				const setSelected = new Set(selected);
    				const unSelected = setDifference(previousSelected, setSelected);
    				const newSelected = setDifference(setSelected, previousSelected);

    				if (unSelected.size || newSelected.size) {
    					$$invalidate(24, previousSelected = setSelected);

    					for (let chipId of unSelected) {
    						if (chips.indexOf(chipId) !== -1) {
    							instance.handleChipSelection({ chipId, selected: false });
    						}
    					}

    					for (let chipId of newSelected) {
    						instance.handleChipSelection({ chipId, selected: true });
    					}
    				}
    			}
    		}
    	};

    	return [
    		chips,
    		use,
    		className,
    		key,
    		nonInteractive,
    		choice,
    		filter,
    		input,
    		element,
    		forwardEvents,
    		initialSelected,
    		nonInteractiveStore,
    		choiceStore,
    		filterStore,
    		handleChipMount,
    		handleChipUnmount,
    		handleChipInteraction,
    		handleChipSelection,
    		handleChipRemoval,
    		handleChipNavigation,
    		$$restProps,
    		selected,
    		getElement,
    		instance,
    		previousSelected,
    		slots,
    		div_binding,
    		$$scope
    	];
    }

    class Set_1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance_1,
    			create_fragment$j,
    			safe_not_equal,
    			{
    				use: 1,
    				class: 2,
    				chips: 0,
    				key: 3,
    				selected: 21,
    				nonInteractive: 4,
    				choice: 5,
    				filter: 6,
    				input: 7,
    				getElement: 22
    			},
    			null,
    			[-1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Set_1",
    			options,
    			id: create_fragment$j.name
    		});
    	}

    	get use() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get chips() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set chips(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get key() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set key(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get selected() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set selected(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get nonInteractive() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set nonInteractive(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get choice() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set choice(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get filter() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set filter(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get input() {
    		throw new Error("<Set>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set input(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[22];
    	}

    	set getElement(value) {
    		throw new Error("<Set>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/chips/dist/Checkmark.svelte generated by Svelte v3.46.4 */
    const file$h = "node_modules/@smui/chips/dist/Checkmark.svelte";

    function create_fragment$i(ctx) {
    	let span;
    	let svg;
    	let path;
    	let span_class_value;
    	let useActions_action;
    	let mounted;
    	let dispose;

    	let span_levels = [
    		{
    			class: span_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-chip__checkmark': true
    			})
    		},
    		/*$$restProps*/ ctx[3]
    	];

    	let span_data = {};

    	for (let i = 0; i < span_levels.length; i += 1) {
    		span_data = assign$1(span_data, span_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			span = element("span");
    			svg = svg_element("svg");
    			path = svg_element("path");
    			attr_dev(path, "class", "mdc-chip__checkmark-path");
    			attr_dev(path, "fill", "none");
    			attr_dev(path, "stroke", "black");
    			attr_dev(path, "d", "M1.73,12.91 8.1,19.28 22.79,4.59");
    			add_location(path, file$h, 10, 4, 220);
    			attr_dev(svg, "class", "mdc-chip__checkmark-svg");
    			attr_dev(svg, "viewBox", "-2 -3 30 30");
    			add_location(svg, file$h, 9, 2, 156);
    			set_attributes(span, span_data);
    			add_location(span, file$h, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);
    			append_dev(span, svg);
    			append_dev(svg, path);
    			/*span_binding*/ ctx[5](span);

    			if (!mounted) {
    				dispose = action_destroyer(useActions_action = useActions.call(null, span, /*use*/ ctx[0]));
    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			set_attributes(span, span_data = get_spread_update(span_levels, [
    				dirty & /*className*/ 2 && span_class_value !== (span_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-chip__checkmark': true
    				})) && { class: span_class_value },
    				dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    			/*span_binding*/ ctx[5](null);
    			mounted = false;
    			dispose();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$i.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$s($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Checkmark', slots, []);
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let element;

    	function getElement() {
    		return element;
    	}

    	function span_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    	};

    	$$self.$capture_state = () => ({
    		classMap,
    		useActions,
    		use,
    		className,
    		element,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('element' in $$props) $$invalidate(2, element = $$new_props.element);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [use, className, element, $$restProps, getElement, span_binding];
    }

    class Checkmark extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$s, create_fragment$i, safe_not_equal, { use: 0, class: 1, getElement: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Checkmark",
    			options,
    			id: create_fragment$i.name
    		});
    	}

    	get use() {
    		throw new Error("<Checkmark>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Checkmark>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Checkmark>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Checkmark>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[4];
    	}

    	set getElement(value) {
    		throw new Error("<Checkmark>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui/chips/dist/Text.svelte generated by Svelte v3.46.4 */
    const file$g = "node_modules/@smui/chips/dist/Text.svelte";

    // (1:0) {#if $filter}
    function create_if_block_1$5(ctx) {
    	let checkmark;
    	let current;
    	let checkmark_props = {};
    	checkmark = new Checkmark({ props: checkmark_props, $$inline: true });
    	/*checkmark_binding*/ ctx[22](checkmark);

    	const block = {
    		c: function create() {
    			create_component(checkmark.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(checkmark, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const checkmark_changes = {};
    			checkmark.$set(checkmark_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(checkmark.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(checkmark.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*checkmark_binding*/ ctx[22](null);
    			destroy_component(checkmark, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$5.name,
    		type: "if",
    		source: "(1:0) {#if $filter}",
    		ctx
    	});

    	return block;
    }

    // (12:2) {:else}
    function create_else_block(ctx) {
    	let span1;
    	let span0;
    	let span1_class_value;
    	let span1_role_value;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[21].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[20], null);

    	let span1_levels = [
    		{
    			class: span1_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-chip__primary-action': true
    			})
    		},
    		{
    			role: span1_role_value = /*$filter*/ ctx[7]
    			? 'checkbox'
    			: /*$choice*/ ctx[9] ? 'radio' : 'button'
    		},
    		/*$filter*/ ctx[7] || /*$choice*/ ctx[9]
    		? {
    				'aria-selected': /*$isSelected*/ ctx[10] ? 'true' : 'false'
    			}
    		: {},
    		{ tabindex: /*tabindex*/ ctx[2] },
    		/*internalAttrs*/ ctx[6],
    		/*$$restProps*/ ctx[16]
    	];

    	let span1_data = {};

    	for (let i = 0; i < span1_levels.length; i += 1) {
    		span1_data = assign$1(span1_data, span1_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			span1 = element("span");
    			span0 = element("span");
    			if (default_slot) default_slot.c();
    			attr_dev(span0, "class", "mdc-chip__text");
    			add_location(span0, file$g, 24, 23, 608);
    			set_attributes(span1, span1_data);
    			add_location(span1, file$g, 12, 4, 232);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span1, anchor);
    			append_dev(span1, span0);

    			if (default_slot) {
    				default_slot.m(span0, null);
    			}

    			/*span1_binding*/ ctx[23](span1);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 1048576)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[20],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[20])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[20], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(span1, span1_data = get_spread_update(span1_levels, [
    				(!current || dirty & /*className*/ 2 && span1_class_value !== (span1_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'mdc-chip__primary-action': true
    				}))) && { class: span1_class_value },
    				(!current || dirty & /*$filter, $choice*/ 640 && span1_role_value !== (span1_role_value = /*$filter*/ ctx[7]
    				? 'checkbox'
    				: /*$choice*/ ctx[9] ? 'radio' : 'button')) && { role: span1_role_value },
    				dirty & /*$filter, $choice, $isSelected*/ 1664 && (/*$filter*/ ctx[7] || /*$choice*/ ctx[9]
    				? {
    						'aria-selected': /*$isSelected*/ ctx[10] ? 'true' : 'false'
    					}
    				: {}),
    				(!current || dirty & /*tabindex*/ 4) && { tabindex: /*tabindex*/ ctx[2] },
    				dirty & /*internalAttrs*/ 64 && /*internalAttrs*/ ctx[6],
    				dirty & /*$$restProps*/ 65536 && /*$$restProps*/ ctx[16]
    			]));
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span1);
    			if (default_slot) default_slot.d(detaching);
    			/*span1_binding*/ ctx[23](null);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_else_block.name,
    		type: "else",
    		source: "(12:2) {:else}",
    		ctx
    	});

    	return block;
    }

    // (10:2) {#if $nonInteractive}
    function create_if_block$b(ctx) {
    	let span;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[21].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[20], null);

    	const block = {
    		c: function create() {
    			span = element("span");
    			if (default_slot) default_slot.c();
    			attr_dev(span, "class", "mdc-chip__text");
    			add_location(span, file$g, 10, 4, 173);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);

    			if (default_slot) {
    				default_slot.m(span, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 1048576)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[20],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[20])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[20], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$b.name,
    		type: "if",
    		source: "(10:2) {#if $nonInteractive}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$h(ctx) {
    	let t;
    	let span;
    	let current_block_type_index;
    	let if_block1;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	let if_block0 = /*$filter*/ ctx[7] && create_if_block_1$5(ctx);
    	const if_block_creators = [create_if_block$b, create_else_block];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*$nonInteractive*/ ctx[8]) return 0;
    		return 1;
    	}

    	current_block_type_index = select_block_type(ctx);
    	if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);

    	const block = {
    		c: function create() {
    			if (if_block0) if_block0.c();
    			t = space();
    			span = element("span");
    			if_block1.c();
    			attr_dev(span, "role", "gridcell");
    			add_location(span, file$g, 3, 0, 54);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (if_block0) if_block0.m(target, anchor);
    			insert_dev(target, t, anchor);
    			insert_dev(target, span, anchor);
    			if_blocks[current_block_type_index].m(span, null);
    			/*span_binding*/ ctx[24](span);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, span, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[11].call(null, span))
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (/*$filter*/ ctx[7]) {
    				if (if_block0) {
    					if_block0.p(ctx, dirty);

    					if (dirty & /*$filter*/ 128) {
    						transition_in(if_block0, 1);
    					}
    				} else {
    					if_block0 = create_if_block_1$5(ctx);
    					if_block0.c();
    					transition_in(if_block0, 1);
    					if_block0.m(t.parentNode, t);
    				}
    			} else if (if_block0) {
    				group_outros();

    				transition_out(if_block0, 1, 1, () => {
    					if_block0 = null;
    				});

    				check_outros();
    			}

    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if_blocks[current_block_type_index].p(ctx, dirty);
    			} else {
    				group_outros();

    				transition_out(if_blocks[previous_block_index], 1, 1, () => {
    					if_blocks[previous_block_index] = null;
    				});

    				check_outros();
    				if_block1 = if_blocks[current_block_type_index];

    				if (!if_block1) {
    					if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    					if_block1.c();
    				} else {
    					if_block1.p(ctx, dirty);
    				}

    				transition_in(if_block1, 1);
    				if_block1.m(span, null);
    			}

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block0);
    			transition_in(if_block1);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block0);
    			transition_out(if_block1);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block0) if_block0.d(detaching);
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(span);
    			if_blocks[current_block_type_index].d();
    			/*span_binding*/ ctx[24](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$h.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$r($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","tabindex","focus","getInput","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $filter;
    	let $nonInteractive;
    	let $choice;
    	let $isSelected;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Text', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { tabindex = getContext('SMUI:chips:chip:focusable') ? 0 : -1 } = $$props;
    	let element;
    	let input = undefined;
    	let primaryAction = undefined;
    	let internalAttrs = {};
    	const nonInteractive = getContext('SMUI:chips:nonInteractive');
    	validate_store(nonInteractive, 'nonInteractive');
    	component_subscribe($$self, nonInteractive, value => $$invalidate(8, $nonInteractive = value));
    	const choice = getContext('SMUI:chips:choice');
    	validate_store(choice, 'choice');
    	component_subscribe($$self, choice, value => $$invalidate(9, $choice = value));
    	const filter = getContext('SMUI:chips:filter');
    	validate_store(filter, 'filter');
    	component_subscribe($$self, filter, value => $$invalidate(7, $filter = value));
    	const isSelected = getContext('SMUI:chips:chip:isSelected');
    	validate_store(isSelected, 'isSelected');
    	component_subscribe($$self, isSelected, value => $$invalidate(10, $isSelected = value));

    	onMount(() => {
    		let accessor = { focus, addAttr };
    		dispatch$1(getElement(), 'SMUIChipsChipPrimaryAction:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIChipsChipPrimaryAction:unmount', accessor);
    		};
    	});

    	function addAttr(name, value) {
    		if (internalAttrs[name] !== value) {
    			$$invalidate(6, internalAttrs[name] = value, internalAttrs);
    		}
    	}

    	function waitForTabindex(fn) {
    		if (internalAttrs['tabindex'] !== element.getAttribute('tabindex')) {
    			tick().then(fn);
    		} else {
    			fn();
    		}
    	}

    	function focus() {
    		// Let the tabindex change propagate.
    		waitForTabindex(() => {
    			primaryAction && primaryAction.focus();
    		});
    	}

    	function getInput() {
    		return input && input.getElement();
    	}

    	function getElement() {
    		return element;
    	}

    	function checkmark_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			input = $$value;
    			$$invalidate(4, input);
    		});
    	}

    	function span1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			primaryAction = $$value;
    			$$invalidate(5, primaryAction);
    		});
    	}

    	function span_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(3, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(16, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('tabindex' in $$new_props) $$invalidate(2, tabindex = $$new_props.tabindex);
    		if ('$$scope' in $$new_props) $$invalidate(20, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onMount,
    		getContext,
    		tick,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		Checkmark,
    		forwardEvents,
    		use,
    		className,
    		tabindex,
    		element,
    		input,
    		primaryAction,
    		internalAttrs,
    		nonInteractive,
    		choice,
    		filter,
    		isSelected,
    		addAttr,
    		waitForTabindex,
    		focus,
    		getInput,
    		getElement,
    		$filter,
    		$nonInteractive,
    		$choice,
    		$isSelected
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('tabindex' in $$props) $$invalidate(2, tabindex = $$new_props.tabindex);
    		if ('element' in $$props) $$invalidate(3, element = $$new_props.element);
    		if ('input' in $$props) $$invalidate(4, input = $$new_props.input);
    		if ('primaryAction' in $$props) $$invalidate(5, primaryAction = $$new_props.primaryAction);
    		if ('internalAttrs' in $$props) $$invalidate(6, internalAttrs = $$new_props.internalAttrs);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		tabindex,
    		element,
    		input,
    		primaryAction,
    		internalAttrs,
    		$filter,
    		$nonInteractive,
    		$choice,
    		$isSelected,
    		forwardEvents,
    		nonInteractive,
    		choice,
    		filter,
    		isSelected,
    		$$restProps,
    		focus,
    		getInput,
    		getElement,
    		$$scope,
    		slots,
    		checkmark_binding,
    		span1_binding,
    		span_binding
    	];
    }

    class Text$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$r, create_fragment$h, safe_not_equal, {
    			use: 0,
    			class: 1,
    			tabindex: 2,
    			focus: 17,
    			getInput: 18,
    			getElement: 19
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Text",
    			options,
    			id: create_fragment$h.name
    		});
    	}

    	get use() {
    		throw new Error("<Text>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Text>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get tabindex() {
    		throw new Error("<Text>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set tabindex(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get focus() {
    		return this.$$.ctx[17];
    	}

    	set focus(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getInput() {
    		return this.$$.ctx[18];
    	}

    	set getInput(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[19];
    	}

    	set getElement(value) {
    		throw new Error("<Text>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Set$1 = Set_1;
    const Text = Text$1;

    /**
    	A function to help truth test values. Returns a `true` if zero.
    	@type {number} val The value to test.
    	@returns {boolean}
    */
    function canBeZero (val) {
    	if (val === 0) {
    		return true;
    	}
    	return val;
    }

    /**
    	Make an accessor from a string, number, function or an array of the combination of any
    	@param {String|Number|Function|Array} acc The accessor function, key or list of them.
    	@returns {Function} An accessor function.
    */
    function makeAccessor (acc) {
    	if (!canBeZero(acc)) return null;
    	if (Array.isArray(acc)) {
    		return d => acc.map(k => {
    			return typeof k !== 'function' ? d[k] : k(d);
    		});
    	} else if (typeof acc !== 'function') { // eslint-disable-line no-else-return
    		return d => d[acc];
    	}
    	return acc;
    }

    /**
    	Remove undefined fields from an object
    	@type {object} obj The object to filter
    	@type {object} [comparisonObj={}] TK
    	@returns {object}
    */

    // From Object.fromEntries polyfill https://github.com/tc39/proposal-object-from-entries/blob/master/polyfill.js#L1
    function fromEntries(iter) {
    	const obj = {};

    	for (const pair of iter) {
    		if (Object(pair) !== pair) {
    			throw new TypeError("iterable for fromEntries should yield objects");
    		}

    		// Consistency with Map: contract is that entry has "0" and "1" keys, not
    		// that it is an array or iterable.

    		const { "0": key, "1": val } = pair;

    		Object.defineProperty(obj, key, {
    			configurable: true,
    			enumerable: true,
    			writable: true,
    			value: val,
    		});
    	}

    	return obj;
    }

    function filterObject (obj, comparisonObj = {}) {
    	return fromEntries(Object.entries(obj).filter(([key, value]) => {
    		return value !== undefined
    			&& comparisonObj[key] === undefined;
    	}));
    }

    /**
    	Calculate the extents of desired fields
    	For example, data like this:
    	[{ x: 0, y: -10 }, { x: 10, y: 0 }, { x: 5, y: 10 }]
    	and a fields object like this:
    	`{'x': d => d.x, 'y': d => d.y}`
    	returns an object like this:
    	`{ x: [0, 10], y: [-10, 10] }`
    	@param {Array} data A flat array of objects.
    	@param {{x?: Function, y?: Function, z?: Function, r?: Function}} fields An object containing `x`, `y`, `r` or `z` keys that equal an accessor function.
    	@returns {{x?: [min: Number, max: Number]|[min: String, max: String], y?: [min: Number, max: Number]|[min: String, max: String], z?: [min: Number, max: Number]|[min: String, max: String], r?: [min: Number, max: Number]|[min: String, max: String]}} An object with the same structure as `fields` but instead of an accessor, each key contains an array of a min and a max.
    */
    function calcExtents (data, fields) {
    	if (!Array.isArray(data)) {
    		throw new TypeError('The first argument of calcExtents() must be an array. If you got this error using the <LayerCake> component, consider passing a flat array to the `flatData` prop. More info: https://layercake.graphics/guide/#flatdata');
    	}

    	if (
    		Array.isArray(fields)
    		|| fields === undefined
    		|| fields === null
    	) {
    		throw new TypeError('The second argument of calcExtents() must be an '
    		+ 'object with field names as keys as accessor functions as values.');
    	}

    	const extents = {};

    	const keys = Object.keys(fields);
    	const kl = keys.length;
    	let i;
    	let j;
    	let k;
    	let s;
    	let min;
    	let max;
    	let acc;
    	let val;

    	const dl = data.length;
    	for (i = 0; i < kl; i += 1) {
    		s = keys[i];
    		acc = fields[s];
    		min = null;
    		max = null;
    		for (j = 0; j < dl; j += 1) {
    			val = acc(data[j]);
    			if (Array.isArray(val)) {
    				const vl = val.length;
    				for (k = 0; k < vl; k += 1) {
    					if (val[k] !== undefined && val[k] !== null && Number.isNaN(val[k]) === false) {
    						if (min === null || val[k] < min) {
    							min = val[k];
    						}
    						if (max === null || val[k] > max) {
    							max = val[k];
    						}
    					}
    				}
    			} else if (val !== undefined && val !== null && Number.isNaN(val) === false) {
    				if (min === null || val < min) {
    					min = val;
    				}
    				if (max === null || val > max) {
    					max = val;
    				}
    			}
    		}
    		extents[s] = [min, max];
    	}

    	return extents;
    }

    /* --------------------------------------------
     * If we have a domain from settings, fill in
     * any null values with ones from our measured extents
     * otherwise, return the measured extent
     */
    function partialDomain (domain = [], directive) {
    	if (Array.isArray(directive) === true) {
    		return directive.map((d, i) => {
    			if (d === null) {
    				return domain[i];
    			}
    			return d;
    		});
    	}
    	return domain;
    }

    function calcDomain (s) {
    	return function domainCalc ([$extents, $domain]) {
    		return $extents ? partialDomain($extents[s], $domain) : $domain;
    	};
    }

    function ascending$1(a, b) {
      return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
    }

    function bisector$1(f) {
      let delta = f;
      let compare1 = f;
      let compare2 = f;

      if (f.length !== 2) {
        delta = (d, x) => f(d) - x;
        compare1 = ascending$1;
        compare2 = (d, x) => ascending$1(f(d), x);
      }

      function left(a, x, lo = 0, hi = a.length) {
        if (lo < hi) {
          if (compare1(x, x) !== 0) return hi;
          do {
            const mid = (lo + hi) >>> 1;
            if (compare2(a[mid], x) < 0) lo = mid + 1;
            else hi = mid;
          } while (lo < hi);
        }
        return lo;
      }

      function right(a, x, lo = 0, hi = a.length) {
        if (lo < hi) {
          if (compare1(x, x) !== 0) return hi;
          do {
            const mid = (lo + hi) >>> 1;
            if (compare2(a[mid], x) <= 0) lo = mid + 1;
            else hi = mid;
          } while (lo < hi);
        }
        return lo;
      }

      function center(a, x, lo = 0, hi = a.length) {
        const i = left(a, x, lo, hi - 1);
        return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
      }

      return {left, center, right};
    }

    function number$1(x) {
      return x === null ? NaN : +x;
    }

    const ascendingBisect = bisector$1(ascending$1);
    const bisectRight = ascendingBisect.right;
    bisector$1(number$1).center;
    var bisect$1 = bisectRight;

    var e10 = Math.sqrt(50),
        e5 = Math.sqrt(10),
        e2 = Math.sqrt(2);

    function ticks(start, stop, count) {
      var reverse,
          i = -1,
          n,
          ticks,
          step;

      stop = +stop, start = +start, count = +count;
      if (start === stop && count > 0) return [start];
      if (reverse = stop < start) n = start, start = stop, stop = n;
      if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];

      if (step > 0) {
        let r0 = Math.round(start / step), r1 = Math.round(stop / step);
        if (r0 * step < start) ++r0;
        if (r1 * step > stop) --r1;
        ticks = new Array(n = r1 - r0 + 1);
        while (++i < n) ticks[i] = (r0 + i) * step;
      } else {
        step = -step;
        let r0 = Math.round(start * step), r1 = Math.round(stop * step);
        if (r0 / step < start) ++r0;
        if (r1 / step > stop) --r1;
        ticks = new Array(n = r1 - r0 + 1);
        while (++i < n) ticks[i] = (r0 + i) / step;
      }

      if (reverse) ticks.reverse();

      return ticks;
    }

    function tickIncrement(start, stop, count) {
      var step = (stop - start) / Math.max(0, count),
          power = Math.floor(Math.log(step) / Math.LN10),
          error = step / Math.pow(10, power);
      return power >= 0
          ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
          : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
    }

    function tickStep(start, stop, count) {
      var step0 = Math.abs(stop - start) / Math.max(0, count),
          step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
          error = step0 / step1;
      if (error >= e10) step1 *= 10;
      else if (error >= e5) step1 *= 5;
      else if (error >= e2) step1 *= 2;
      return stop < start ? -step1 : step1;
    }

    function initRange(domain, range) {
      switch (arguments.length) {
        case 0: break;
        case 1: this.range(domain); break;
        default: this.range(range).domain(domain); break;
      }
      return this;
    }

    function define(constructor, factory, prototype) {
      constructor.prototype = factory.prototype = prototype;
      prototype.constructor = constructor;
    }

    function extend(parent, definition) {
      var prototype = Object.create(parent.prototype);
      for (var key in definition) prototype[key] = definition[key];
      return prototype;
    }

    function Color() {}

    var darker = 0.7;
    var brighter = 1 / darker;

    var reI = "\\s*([+-]?\\d+)\\s*",
        reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
        reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
        reHex = /^#([0-9a-f]{3,8})$/,
        reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
        reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
        reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
        reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
        reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
        reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");

    var named = {
      aliceblue: 0xf0f8ff,
      antiquewhite: 0xfaebd7,
      aqua: 0x00ffff,
      aquamarine: 0x7fffd4,
      azure: 0xf0ffff,
      beige: 0xf5f5dc,
      bisque: 0xffe4c4,
      black: 0x000000,
      blanchedalmond: 0xffebcd,
      blue: 0x0000ff,
      blueviolet: 0x8a2be2,
      brown: 0xa52a2a,
      burlywood: 0xdeb887,
      cadetblue: 0x5f9ea0,
      chartreuse: 0x7fff00,
      chocolate: 0xd2691e,
      coral: 0xff7f50,
      cornflowerblue: 0x6495ed,
      cornsilk: 0xfff8dc,
      crimson: 0xdc143c,
      cyan: 0x00ffff,
      darkblue: 0x00008b,
      darkcyan: 0x008b8b,
      darkgoldenrod: 0xb8860b,
      darkgray: 0xa9a9a9,
      darkgreen: 0x006400,
      darkgrey: 0xa9a9a9,
      darkkhaki: 0xbdb76b,
      darkmagenta: 0x8b008b,
      darkolivegreen: 0x556b2f,
      darkorange: 0xff8c00,
      darkorchid: 0x9932cc,
      darkred: 0x8b0000,
      darksalmon: 0xe9967a,
      darkseagreen: 0x8fbc8f,
      darkslateblue: 0x483d8b,
      darkslategray: 0x2f4f4f,
      darkslategrey: 0x2f4f4f,
      darkturquoise: 0x00ced1,
      darkviolet: 0x9400d3,
      deeppink: 0xff1493,
      deepskyblue: 0x00bfff,
      dimgray: 0x696969,
      dimgrey: 0x696969,
      dodgerblue: 0x1e90ff,
      firebrick: 0xb22222,
      floralwhite: 0xfffaf0,
      forestgreen: 0x228b22,
      fuchsia: 0xff00ff,
      gainsboro: 0xdcdcdc,
      ghostwhite: 0xf8f8ff,
      gold: 0xffd700,
      goldenrod: 0xdaa520,
      gray: 0x808080,
      green: 0x008000,
      greenyellow: 0xadff2f,
      grey: 0x808080,
      honeydew: 0xf0fff0,
      hotpink: 0xff69b4,
      indianred: 0xcd5c5c,
      indigo: 0x4b0082,
      ivory: 0xfffff0,
      khaki: 0xf0e68c,
      lavender: 0xe6e6fa,
      lavenderblush: 0xfff0f5,
      lawngreen: 0x7cfc00,
      lemonchiffon: 0xfffacd,
      lightblue: 0xadd8e6,
      lightcoral: 0xf08080,
      lightcyan: 0xe0ffff,
      lightgoldenrodyellow: 0xfafad2,
      lightgray: 0xd3d3d3,
      lightgreen: 0x90ee90,
      lightgrey: 0xd3d3d3,
      lightpink: 0xffb6c1,
      lightsalmon: 0xffa07a,
      lightseagreen: 0x20b2aa,
      lightskyblue: 0x87cefa,
      lightslategray: 0x778899,
      lightslategrey: 0x778899,
      lightsteelblue: 0xb0c4de,
      lightyellow: 0xffffe0,
      lime: 0x00ff00,
      limegreen: 0x32cd32,
      linen: 0xfaf0e6,
      magenta: 0xff00ff,
      maroon: 0x800000,
      mediumaquamarine: 0x66cdaa,
      mediumblue: 0x0000cd,
      mediumorchid: 0xba55d3,
      mediumpurple: 0x9370db,
      mediumseagreen: 0x3cb371,
      mediumslateblue: 0x7b68ee,
      mediumspringgreen: 0x00fa9a,
      mediumturquoise: 0x48d1cc,
      mediumvioletred: 0xc71585,
      midnightblue: 0x191970,
      mintcream: 0xf5fffa,
      mistyrose: 0xffe4e1,
      moccasin: 0xffe4b5,
      navajowhite: 0xffdead,
      navy: 0x000080,
      oldlace: 0xfdf5e6,
      olive: 0x808000,
      olivedrab: 0x6b8e23,
      orange: 0xffa500,
      orangered: 0xff4500,
      orchid: 0xda70d6,
      palegoldenrod: 0xeee8aa,
      palegreen: 0x98fb98,
      paleturquoise: 0xafeeee,
      palevioletred: 0xdb7093,
      papayawhip: 0xffefd5,
      peachpuff: 0xffdab9,
      peru: 0xcd853f,
      pink: 0xffc0cb,
      plum: 0xdda0dd,
      powderblue: 0xb0e0e6,
      purple: 0x800080,
      rebeccapurple: 0x663399,
      red: 0xff0000,
      rosybrown: 0xbc8f8f,
      royalblue: 0x4169e1,
      saddlebrown: 0x8b4513,
      salmon: 0xfa8072,
      sandybrown: 0xf4a460,
      seagreen: 0x2e8b57,
      seashell: 0xfff5ee,
      sienna: 0xa0522d,
      silver: 0xc0c0c0,
      skyblue: 0x87ceeb,
      slateblue: 0x6a5acd,
      slategray: 0x708090,
      slategrey: 0x708090,
      snow: 0xfffafa,
      springgreen: 0x00ff7f,
      steelblue: 0x4682b4,
      tan: 0xd2b48c,
      teal: 0x008080,
      thistle: 0xd8bfd8,
      tomato: 0xff6347,
      turquoise: 0x40e0d0,
      violet: 0xee82ee,
      wheat: 0xf5deb3,
      white: 0xffffff,
      whitesmoke: 0xf5f5f5,
      yellow: 0xffff00,
      yellowgreen: 0x9acd32
    };

    define(Color, color, {
      copy: function(channels) {
        return Object.assign(new this.constructor, this, channels);
      },
      displayable: function() {
        return this.rgb().displayable();
      },
      hex: color_formatHex, // Deprecated! Use color.formatHex.
      formatHex: color_formatHex,
      formatHsl: color_formatHsl,
      formatRgb: color_formatRgb,
      toString: color_formatRgb
    });

    function color_formatHex() {
      return this.rgb().formatHex();
    }

    function color_formatHsl() {
      return hslConvert(this).formatHsl();
    }

    function color_formatRgb() {
      return this.rgb().formatRgb();
    }

    function color(format) {
      var m, l;
      format = (format + "").trim().toLowerCase();
      return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
          : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
          : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
          : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
          : null) // invalid hex
          : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
          : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
          : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
          : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
          : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
          : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
          : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
          : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
          : null;
    }

    function rgbn(n) {
      return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
    }

    function rgba(r, g, b, a) {
      if (a <= 0) r = g = b = NaN;
      return new Rgb(r, g, b, a);
    }

    function rgbConvert(o) {
      if (!(o instanceof Color)) o = color(o);
      if (!o) return new Rgb;
      o = o.rgb();
      return new Rgb(o.r, o.g, o.b, o.opacity);
    }

    function rgb$1(r, g, b, opacity) {
      return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
    }

    function Rgb(r, g, b, opacity) {
      this.r = +r;
      this.g = +g;
      this.b = +b;
      this.opacity = +opacity;
    }

    define(Rgb, rgb$1, extend(Color, {
      brighter: function(k) {
        k = k == null ? brighter : Math.pow(brighter, k);
        return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
      },
      darker: function(k) {
        k = k == null ? darker : Math.pow(darker, k);
        return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
      },
      rgb: function() {
        return this;
      },
      displayable: function() {
        return (-0.5 <= this.r && this.r < 255.5)
            && (-0.5 <= this.g && this.g < 255.5)
            && (-0.5 <= this.b && this.b < 255.5)
            && (0 <= this.opacity && this.opacity <= 1);
      },
      hex: rgb_formatHex, // Deprecated! Use color.formatHex.
      formatHex: rgb_formatHex,
      formatRgb: rgb_formatRgb,
      toString: rgb_formatRgb
    }));

    function rgb_formatHex() {
      return "#" + hex(this.r) + hex(this.g) + hex(this.b);
    }

    function rgb_formatRgb() {
      var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
      return (a === 1 ? "rgb(" : "rgba(")
          + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
          + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
          + Math.max(0, Math.min(255, Math.round(this.b) || 0))
          + (a === 1 ? ")" : ", " + a + ")");
    }

    function hex(value) {
      value = Math.max(0, Math.min(255, Math.round(value) || 0));
      return (value < 16 ? "0" : "") + value.toString(16);
    }

    function hsla(h, s, l, a) {
      if (a <= 0) h = s = l = NaN;
      else if (l <= 0 || l >= 1) h = s = NaN;
      else if (s <= 0) h = NaN;
      return new Hsl(h, s, l, a);
    }

    function hslConvert(o) {
      if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
      if (!(o instanceof Color)) o = color(o);
      if (!o) return new Hsl;
      if (o instanceof Hsl) return o;
      o = o.rgb();
      var r = o.r / 255,
          g = o.g / 255,
          b = o.b / 255,
          min = Math.min(r, g, b),
          max = Math.max(r, g, b),
          h = NaN,
          s = max - min,
          l = (max + min) / 2;
      if (s) {
        if (r === max) h = (g - b) / s + (g < b) * 6;
        else if (g === max) h = (b - r) / s + 2;
        else h = (r - g) / s + 4;
        s /= l < 0.5 ? max + min : 2 - max - min;
        h *= 60;
      } else {
        s = l > 0 && l < 1 ? 0 : h;
      }
      return new Hsl(h, s, l, o.opacity);
    }

    function hsl(h, s, l, opacity) {
      return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
    }

    function Hsl(h, s, l, opacity) {
      this.h = +h;
      this.s = +s;
      this.l = +l;
      this.opacity = +opacity;
    }

    define(Hsl, hsl, extend(Color, {
      brighter: function(k) {
        k = k == null ? brighter : Math.pow(brighter, k);
        return new Hsl(this.h, this.s, this.l * k, this.opacity);
      },
      darker: function(k) {
        k = k == null ? darker : Math.pow(darker, k);
        return new Hsl(this.h, this.s, this.l * k, this.opacity);
      },
      rgb: function() {
        var h = this.h % 360 + (this.h < 0) * 360,
            s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
            l = this.l,
            m2 = l + (l < 0.5 ? l : 1 - l) * s,
            m1 = 2 * l - m2;
        return new Rgb(
          hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
          hsl2rgb(h, m1, m2),
          hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
          this.opacity
        );
      },
      displayable: function() {
        return (0 <= this.s && this.s <= 1 || isNaN(this.s))
            && (0 <= this.l && this.l <= 1)
            && (0 <= this.opacity && this.opacity <= 1);
      },
      formatHsl: function() {
        var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
        return (a === 1 ? "hsl(" : "hsla(")
            + (this.h || 0) + ", "
            + (this.s || 0) * 100 + "%, "
            + (this.l || 0) * 100 + "%"
            + (a === 1 ? ")" : ", " + a + ")");
      }
    }));

    /* From FvD 13.37, CSS Color Module Level 3 */
    function hsl2rgb(h, m1, m2) {
      return (h < 60 ? m1 + (m2 - m1) * h / 60
          : h < 180 ? m2
          : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
          : m1) * 255;
    }

    var constant$1 = x => () => x;

    function linear$1(a, d) {
      return function(t) {
        return a + t * d;
      };
    }

    function exponential(a, b, y) {
      return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
        return Math.pow(a + t * b, y);
      };
    }

    function gamma(y) {
      return (y = +y) === 1 ? nogamma : function(a, b) {
        return b - a ? exponential(a, b, y) : constant$1(isNaN(a) ? b : a);
      };
    }

    function nogamma(a, b) {
      var d = b - a;
      return d ? linear$1(a, d) : constant$1(isNaN(a) ? b : a);
    }

    var rgb = (function rgbGamma(y) {
      var color = gamma(y);

      function rgb(start, end) {
        var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
            g = color(start.g, end.g),
            b = color(start.b, end.b),
            opacity = nogamma(start.opacity, end.opacity);
        return function(t) {
          start.r = r(t);
          start.g = g(t);
          start.b = b(t);
          start.opacity = opacity(t);
          return start + "";
        };
      }

      rgb.gamma = rgbGamma;

      return rgb;
    })(1);

    function numberArray(a, b) {
      if (!b) b = [];
      var n = a ? Math.min(b.length, a.length) : 0,
          c = b.slice(),
          i;
      return function(t) {
        for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
        return c;
      };
    }

    function isNumberArray(x) {
      return ArrayBuffer.isView(x) && !(x instanceof DataView);
    }

    function genericArray(a, b) {
      var nb = b ? b.length : 0,
          na = a ? Math.min(nb, a.length) : 0,
          x = new Array(na),
          c = new Array(nb),
          i;

      for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
      for (; i < nb; ++i) c[i] = b[i];

      return function(t) {
        for (i = 0; i < na; ++i) c[i] = x[i](t);
        return c;
      };
    }

    function date$1(a, b) {
      var d = new Date;
      return a = +a, b = +b, function(t) {
        return d.setTime(a * (1 - t) + b * t), d;
      };
    }

    function interpolateNumber(a, b) {
      return a = +a, b = +b, function(t) {
        return a * (1 - t) + b * t;
      };
    }

    function object$1(a, b) {
      var i = {},
          c = {},
          k;

      if (a === null || typeof a !== "object") a = {};
      if (b === null || typeof b !== "object") b = {};

      for (k in b) {
        if (k in a) {
          i[k] = interpolate(a[k], b[k]);
        } else {
          c[k] = b[k];
        }
      }

      return function(t) {
        for (k in i) c[k] = i[k](t);
        return c;
      };
    }

    var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
        reB = new RegExp(reA.source, "g");

    function zero(b) {
      return function() {
        return b;
      };
    }

    function one(b) {
      return function(t) {
        return b(t) + "";
      };
    }

    function string$1(a, b) {
      var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
          am, // current match in a
          bm, // current match in b
          bs, // string preceding current number in b, if any
          i = -1, // index in s
          s = [], // string constants and placeholders
          q = []; // number interpolators

      // Coerce inputs to strings.
      a = a + "", b = b + "";

      // Interpolate pairs of numbers in a & b.
      while ((am = reA.exec(a))
          && (bm = reB.exec(b))) {
        if ((bs = bm.index) > bi) { // a string precedes the next number in b
          bs = b.slice(bi, bs);
          if (s[i]) s[i] += bs; // coalesce with previous string
          else s[++i] = bs;
        }
        if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
          if (s[i]) s[i] += bm; // coalesce with previous string
          else s[++i] = bm;
        } else { // interpolate non-matching numbers
          s[++i] = null;
          q.push({i: i, x: interpolateNumber(am, bm)});
        }
        bi = reB.lastIndex;
      }

      // Add remains of b.
      if (bi < b.length) {
        bs = b.slice(bi);
        if (s[i]) s[i] += bs; // coalesce with previous string
        else s[++i] = bs;
      }

      // Special optimization for only a single match.
      // Otherwise, interpolate each of the numbers and rejoin the string.
      return s.length < 2 ? (q[0]
          ? one(q[0].x)
          : zero(b))
          : (b = q.length, function(t) {
              for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
              return s.join("");
            });
    }

    function interpolate(a, b) {
      var t = typeof b, c;
      return b == null || t === "boolean" ? constant$1(b)
          : (t === "number" ? interpolateNumber
          : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string$1)
          : b instanceof color ? rgb
          : b instanceof Date ? date$1
          : isNumberArray(b) ? numberArray
          : Array.isArray(b) ? genericArray
          : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object$1
          : interpolateNumber)(a, b);
    }

    function interpolateRound(a, b) {
      return a = +a, b = +b, function(t) {
        return Math.round(a * (1 - t) + b * t);
      };
    }

    function constants$1(x) {
      return function() {
        return x;
      };
    }

    function number(x) {
      return +x;
    }

    var unit = [0, 1];

    function identity$3(x) {
      return x;
    }

    function normalize(a, b) {
      return (b -= (a = +a))
          ? function(x) { return (x - a) / b; }
          : constants$1(isNaN(b) ? NaN : 0.5);
    }

    function clamper(a, b) {
      var t;
      if (a > b) t = a, a = b, b = t;
      return function(x) { return Math.max(a, Math.min(b, x)); };
    }

    // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
    // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
    function bimap(domain, range, interpolate) {
      var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
      if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
      else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
      return function(x) { return r0(d0(x)); };
    }

    function polymap(domain, range, interpolate) {
      var j = Math.min(domain.length, range.length) - 1,
          d = new Array(j),
          r = new Array(j),
          i = -1;

      // Reverse descending domains.
      if (domain[j] < domain[0]) {
        domain = domain.slice().reverse();
        range = range.slice().reverse();
      }

      while (++i < j) {
        d[i] = normalize(domain[i], domain[i + 1]);
        r[i] = interpolate(range[i], range[i + 1]);
      }

      return function(x) {
        var i = bisect$1(domain, x, 1, j) - 1;
        return r[i](d[i](x));
      };
    }

    function copy(source, target) {
      return target
          .domain(source.domain())
          .range(source.range())
          .interpolate(source.interpolate())
          .clamp(source.clamp())
          .unknown(source.unknown());
    }

    function transformer() {
      var domain = unit,
          range = unit,
          interpolate$1 = interpolate,
          transform,
          untransform,
          unknown,
          clamp = identity$3,
          piecewise,
          output,
          input;

      function rescale() {
        var n = Math.min(domain.length, range.length);
        if (clamp !== identity$3) clamp = clamper(domain[0], domain[n - 1]);
        piecewise = n > 2 ? polymap : bimap;
        output = input = null;
        return scale;
      }

      function scale(x) {
        return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
      }

      scale.invert = function(y) {
        return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
      };

      scale.domain = function(_) {
        return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
      };

      scale.range = function(_) {
        return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
      };

      scale.rangeRound = function(_) {
        return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
      };

      scale.clamp = function(_) {
        return arguments.length ? (clamp = _ ? true : identity$3, rescale()) : clamp !== identity$3;
      };

      scale.interpolate = function(_) {
        return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
      };

      scale.unknown = function(_) {
        return arguments.length ? (unknown = _, scale) : unknown;
      };

      return function(t, u) {
        transform = t, untransform = u;
        return rescale();
      };
    }

    function continuous() {
      return transformer()(identity$3, identity$3);
    }

    function formatDecimal(x) {
      return Math.abs(x = Math.round(x)) >= 1e21
          ? x.toLocaleString("en").replace(/,/g, "")
          : x.toString(10);
    }

    // Computes the decimal coefficient and exponent of the specified number x with
    // significant digits p, where x is positive and p is in [1, 21] or undefined.
    // For example, formatDecimalParts(1.23) returns ["123", 0].
    function formatDecimalParts(x, p) {
      if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
      var i, coefficient = x.slice(0, i);

      // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
      // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
      return [
        coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
        +x.slice(i + 1)
      ];
    }

    function exponent(x) {
      return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
    }

    function formatGroup(grouping, thousands) {
      return function(value, width) {
        var i = value.length,
            t = [],
            j = 0,
            g = grouping[0],
            length = 0;

        while (i > 0 && g > 0) {
          if (length + g + 1 > width) g = Math.max(1, width - length);
          t.push(value.substring(i -= g, i + g));
          if ((length += g + 1) > width) break;
          g = grouping[j = (j + 1) % grouping.length];
        }

        return t.reverse().join(thousands);
      };
    }

    function formatNumerals(numerals) {
      return function(value) {
        return value.replace(/[0-9]/g, function(i) {
          return numerals[+i];
        });
      };
    }

    // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
    var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;

    function formatSpecifier(specifier) {
      if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
      var match;
      return new FormatSpecifier({
        fill: match[1],
        align: match[2],
        sign: match[3],
        symbol: match[4],
        zero: match[5],
        width: match[6],
        comma: match[7],
        precision: match[8] && match[8].slice(1),
        trim: match[9],
        type: match[10]
      });
    }

    formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof

    function FormatSpecifier(specifier) {
      this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
      this.align = specifier.align === undefined ? ">" : specifier.align + "";
      this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
      this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
      this.zero = !!specifier.zero;
      this.width = specifier.width === undefined ? undefined : +specifier.width;
      this.comma = !!specifier.comma;
      this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
      this.trim = !!specifier.trim;
      this.type = specifier.type === undefined ? "" : specifier.type + "";
    }

    FormatSpecifier.prototype.toString = function() {
      return this.fill
          + this.align
          + this.sign
          + this.symbol
          + (this.zero ? "0" : "")
          + (this.width === undefined ? "" : Math.max(1, this.width | 0))
          + (this.comma ? "," : "")
          + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
          + (this.trim ? "~" : "")
          + this.type;
    };

    // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
    function formatTrim(s) {
      out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
        switch (s[i]) {
          case ".": i0 = i1 = i; break;
          case "0": if (i0 === 0) i0 = i; i1 = i; break;
          default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
        }
      }
      return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
    }

    var prefixExponent;

    function formatPrefixAuto(x, p) {
      var d = formatDecimalParts(x, p);
      if (!d) return x + "";
      var coefficient = d[0],
          exponent = d[1],
          i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
          n = coefficient.length;
      return i === n ? coefficient
          : i > n ? coefficient + new Array(i - n + 1).join("0")
          : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
          : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
    }

    function formatRounded(x, p) {
      var d = formatDecimalParts(x, p);
      if (!d) return x + "";
      var coefficient = d[0],
          exponent = d[1];
      return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
          : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
          : coefficient + new Array(exponent - coefficient.length + 2).join("0");
    }

    var formatTypes = {
      "%": (x, p) => (x * 100).toFixed(p),
      "b": (x) => Math.round(x).toString(2),
      "c": (x) => x + "",
      "d": formatDecimal,
      "e": (x, p) => x.toExponential(p),
      "f": (x, p) => x.toFixed(p),
      "g": (x, p) => x.toPrecision(p),
      "o": (x) => Math.round(x).toString(8),
      "p": (x, p) => formatRounded(x * 100, p),
      "r": formatRounded,
      "s": formatPrefixAuto,
      "X": (x) => Math.round(x).toString(16).toUpperCase(),
      "x": (x) => Math.round(x).toString(16)
    };

    function identity$2(x) {
      return x;
    }

    var map$1 = Array.prototype.map,
        prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];

    function formatLocale(locale) {
      var group = locale.grouping === undefined || locale.thousands === undefined ? identity$2 : formatGroup(map$1.call(locale.grouping, Number), locale.thousands + ""),
          currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
          currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
          decimal = locale.decimal === undefined ? "." : locale.decimal + "",
          numerals = locale.numerals === undefined ? identity$2 : formatNumerals(map$1.call(locale.numerals, String)),
          percent = locale.percent === undefined ? "%" : locale.percent + "",
          minus = locale.minus === undefined ? "−" : locale.minus + "",
          nan = locale.nan === undefined ? "NaN" : locale.nan + "";

      function newFormat(specifier) {
        specifier = formatSpecifier(specifier);

        var fill = specifier.fill,
            align = specifier.align,
            sign = specifier.sign,
            symbol = specifier.symbol,
            zero = specifier.zero,
            width = specifier.width,
            comma = specifier.comma,
            precision = specifier.precision,
            trim = specifier.trim,
            type = specifier.type;

        // The "n" type is an alias for ",g".
        if (type === "n") comma = true, type = "g";

        // The "" type, and any invalid type, is an alias for ".12~g".
        else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";

        // If zero fill is specified, padding goes after sign and before digits.
        if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";

        // Compute the prefix and suffix.
        // For SI-prefix, the suffix is lazily computed.
        var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
            suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";

        // What format function should we use?
        // Is this an integer type?
        // Can this type generate exponential notation?
        var formatType = formatTypes[type],
            maybeSuffix = /[defgprs%]/.test(type);

        // Set the default precision if not specified,
        // or clamp the specified precision to the supported range.
        // For significant precision, it must be in [1, 21].
        // For fixed precision, it must be in [0, 20].
        precision = precision === undefined ? 6
            : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
            : Math.max(0, Math.min(20, precision));

        function format(value) {
          var valuePrefix = prefix,
              valueSuffix = suffix,
              i, n, c;

          if (type === "c") {
            valueSuffix = formatType(value) + valueSuffix;
            value = "";
          } else {
            value = +value;

            // Determine the sign. -0 is not less than 0, but 1 / -0 is!
            var valueNegative = value < 0 || 1 / value < 0;

            // Perform the initial formatting.
            value = isNaN(value) ? nan : formatType(Math.abs(value), precision);

            // Trim insignificant zeros.
            if (trim) value = formatTrim(value);

            // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
            if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;

            // Compute the prefix and suffix.
            valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
            valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");

            // Break the formatted value into the integer “value” part that can be
            // grouped, and fractional or exponential “suffix” part that is not.
            if (maybeSuffix) {
              i = -1, n = value.length;
              while (++i < n) {
                if (c = value.charCodeAt(i), 48 > c || c > 57) {
                  valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
                  value = value.slice(0, i);
                  break;
                }
              }
            }
          }

          // If the fill character is not "0", grouping is applied before padding.
          if (comma && !zero) value = group(value, Infinity);

          // Compute the padding.
          var length = valuePrefix.length + value.length + valueSuffix.length,
              padding = length < width ? new Array(width - length + 1).join(fill) : "";

          // If the fill character is "0", grouping is applied after padding.
          if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";

          // Reconstruct the final output based on the desired alignment.
          switch (align) {
            case "<": value = valuePrefix + value + valueSuffix + padding; break;
            case "=": value = valuePrefix + padding + value + valueSuffix; break;
            case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
            default: value = padding + valuePrefix + value + valueSuffix; break;
          }

          return numerals(value);
        }

        format.toString = function() {
          return specifier + "";
        };

        return format;
      }

      function formatPrefix(specifier, value) {
        var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
            e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
            k = Math.pow(10, -e),
            prefix = prefixes[8 + e / 3];
        return function(value) {
          return f(k * value) + prefix;
        };
      }

      return {
        format: newFormat,
        formatPrefix: formatPrefix
      };
    }

    var locale;
    var format;
    var formatPrefix;

    defaultLocale({
      thousands: ",",
      grouping: [3],
      currency: ["$", ""]
    });

    function defaultLocale(definition) {
      locale = formatLocale(definition);
      format = locale.format;
      formatPrefix = locale.formatPrefix;
      return locale;
    }

    function precisionFixed(step) {
      return Math.max(0, -exponent(Math.abs(step)));
    }

    function precisionPrefix(step, value) {
      return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
    }

    function precisionRound(step, max) {
      step = Math.abs(step), max = Math.abs(max) - step;
      return Math.max(0, exponent(max) - exponent(step)) + 1;
    }

    function tickFormat(start, stop, count, specifier) {
      var step = tickStep(start, stop, count),
          precision;
      specifier = formatSpecifier(specifier == null ? ",f" : specifier);
      switch (specifier.type) {
        case "s": {
          var value = Math.max(Math.abs(start), Math.abs(stop));
          if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
          return formatPrefix(specifier, value);
        }
        case "":
        case "e":
        case "g":
        case "p":
        case "r": {
          if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
          break;
        }
        case "f":
        case "%": {
          if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
          break;
        }
      }
      return format(specifier);
    }

    function linearish(scale) {
      var domain = scale.domain;

      scale.ticks = function(count) {
        var d = domain();
        return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
      };

      scale.tickFormat = function(count, specifier) {
        var d = domain();
        return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
      };

      scale.nice = function(count) {
        if (count == null) count = 10;

        var d = domain();
        var i0 = 0;
        var i1 = d.length - 1;
        var start = d[i0];
        var stop = d[i1];
        var prestep;
        var step;
        var maxIter = 10;

        if (stop < start) {
          step = start, start = stop, stop = step;
          step = i0, i0 = i1, i1 = step;
        }
        
        while (maxIter-- > 0) {
          step = tickIncrement(start, stop, count);
          if (step === prestep) {
            d[i0] = start;
            d[i1] = stop;
            return domain(d);
          } else if (step > 0) {
            start = Math.floor(start / step) * step;
            stop = Math.ceil(stop / step) * step;
          } else if (step < 0) {
            start = Math.ceil(start * step) / step;
            stop = Math.floor(stop * step) / step;
          } else {
            break;
          }
          prestep = step;
        }

        return scale;
      };

      return scale;
    }

    function linear() {
      var scale = continuous();

      scale.copy = function() {
        return copy(scale, linear());
      };

      initRange.apply(scale, arguments);

      return linearish(scale);
    }

    function transformPow(exponent) {
      return function(x) {
        return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
      };
    }

    function transformSqrt(x) {
      return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
    }

    function transformSquare(x) {
      return x < 0 ? -x * x : x * x;
    }

    function powish(transform) {
      var scale = transform(identity$3, identity$3),
          exponent = 1;

      function rescale() {
        return exponent === 1 ? transform(identity$3, identity$3)
            : exponent === 0.5 ? transform(transformSqrt, transformSquare)
            : transform(transformPow(exponent), transformPow(1 / exponent));
      }

      scale.exponent = function(_) {
        return arguments.length ? (exponent = +_, rescale()) : exponent;
      };

      return linearish(scale);
    }

    function pow$1() {
      var scale = powish(transformer());

      scale.copy = function() {
        return copy(scale, pow$1()).exponent(scale.exponent());
      };

      initRange.apply(scale, arguments);

      return scale;
    }

    function sqrt() {
      return pow$1.apply(null, arguments).exponent(0.5);
    }

    var defaultScales = {
    	x: linear,
    	y: linear,
    	z: linear,
    	r: sqrt
    };

    /* --------------------------------------------
     *
     * Determine whether a scale is a log, symlog, power or other
     * This is not meant to be exhaustive of all the different types of
     * scales in d3-scale and focuses on continuous scales
     *
     * --------------------------------------------
     */
    function findScaleType(scale) {
    	if (scale.constant) {
    		return 'symlog';
    	}
    	if (scale.base) {
    		return 'log';
    	}
    	if (scale.exponent) {
    		if (scale.exponent() === 0.5) {
    			return 'sqrt';
    		}
    		return 'pow';
    	}
    	return 'other';
    }

    /**
    	An identity function
    	@type {*} d The value to return.
    	@returns {*}
    */
    function identity$1 (d) {
    	return d;
    }

    function log(sign) {
    	return x => Math.log(sign * x);
    }

    function exp(sign) {
    	return x => sign * Math.exp(x);
    }

    function symlog(c) {
    	return x => Math.sign(x) * Math.log1p(Math.abs(x / c));
    }

    function symexp(c) {
    	return x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
    }

    function pow(exponent) {
    	return function powFn(x) {
    		return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
    	};
    }

    function getPadFunctions(scale) {
    	const scaleType = findScaleType(scale);

    	if (scaleType === 'log') {
    		const sign = Math.sign(scale.domain()[0]);
    		return { lift: log(sign), ground: exp(sign), scaleType };
    	}
    	if (scaleType === 'pow') {
    		const exponent = 1;
    		return { lift: pow(exponent), ground: pow(1 / exponent), scaleType };
    	}
    	if (scaleType === 'sqrt') {
    		const exponent = 0.5;
    		return { lift: pow(exponent), ground: pow(1 / exponent), scaleType };
    	}
    	if (scaleType === 'symlog') {
    		const constant = 1;
    		return { lift: symlog(constant), ground: symexp(constant), scaleType };
    	}

    	return { lift: identity$1, ground: identity$1, scaleType };
    }

    /* --------------------------------------------
     *
     * Returns a modified scale domain by in/decreasing
     * the min/max by taking the desired difference
     * in pixels and converting it to units of data.
     * Returns an array that you can set as the new domain.
     * Padding contributed by @veltman.
     * See here for discussion of transforms: https://github.com/d3/d3-scale/issues/150
     *
     * --------------------------------------------
     */

    function padScale (scale, padding) {
    	if (typeof scale.range !== 'function') {
    		throw new Error('Scale method `range` must be a function');
    	}
    	if (typeof scale.domain !== 'function') {
    		throw new Error('Scale method `domain` must be a function');
    	}
    	if (!Array.isArray(padding)) {
    		return scale.domain();
    	}

    	if (scale.domain().length !== 2) {
    		console.warn('[LayerCake] The scale is expected to have a domain of length 2 to use padding. Are you sure you want to use padding? Your scale\'s domain is:', scale.domain());
    	}
    	if (scale.range().length !== 2) {
    		console.warn('[LayerCake] The scale is expected to have a range of length 2 to use padding. Are you sure you want to use padding? Your scale\'s range is:', scale.range());
    	}

    	const { lift, ground } = getPadFunctions(scale);

    	const d0 = scale.domain()[0];

    	const isTime = Object.prototype.toString.call(d0) === '[object Date]';

    	const [d1, d2] = scale.domain().map(d => {
    		return isTime ? lift(d.getTime()) : lift(d);
    	});
    	const [r1, r2] = scale.range();
    	const paddingLeft = padding[0] || 0;
    	const paddingRight = padding[1] || 0;

    	const step = (d2 - d1) / (Math.abs(r2 - r1) - paddingLeft - paddingRight); // Math.abs() to properly handle reversed scales

    	return [d1 - paddingLeft * step, paddingRight * step + d2].map(d => {
    		return isTime ? ground(new Date(d)) : ground(d);
    	});
    }

    /* eslint-disable no-nested-ternary */
    function calcBaseRange(s, width, height, reverse, percentRange) {
    	let min;
    	let max;
    	if (percentRange === true) {
    		min = 0;
    		max = 100;
    	} else {
    		min = s === 'r' ? 1 : 0;
    		max = s === 'y' ? height : s === 'r' ? 25 : width;
    	}
    	return reverse === true ? [max, min] : [min, max];
    }

    function getDefaultRange(s, width, height, reverse, range, percentRange) {
    	return !range
    		? calcBaseRange(s, width, height, reverse, percentRange)
    		: typeof range === 'function'
    			? range({ width, height })
    			: range;
    }

    function createScale (s) {
    	return function scaleCreator ([$scale, $extents, $domain, $padding, $nice, $reverse, $width, $height, $range, $percentScale]) {
    		if ($extents === null) {
    			return null;
    		}

    		const defaultRange = getDefaultRange(s, $width, $height, $reverse, $range, $percentScale);

    		const scale = $scale === defaultScales[s] ? $scale() : $scale.copy();

    		/* --------------------------------------------
    		 * On creation, `$domain` will already have any nulls filled in
    		 * But if we set it via the context it might not, so rerun it through partialDomain
    		 */
    		scale
    			.domain(partialDomain($extents[s], $domain))
    			.range(defaultRange);

    		if ($padding) {
    			scale.domain(padScale(scale, $padding));
    		}

    		if ($nice === true) {
    			if (typeof scale.nice === 'function') {
    				scale.nice();
    			} else {
    				console.error(`[Layer Cake] You set \`${s}Nice: true\` but the ${s}Scale does not have a \`.nice\` method. Ignoring...`);
    			}
    		}

    		return scale;
    	};
    }

    function createGetter ([$acc, $scale]) {
    	return d => {
    		const val = $acc(d);
    		if (Array.isArray(val)) {
    			return val.map(v => $scale(v));
    		}
    		return $scale(val);
    	};
    }

    function getRange([$scale]) {
    	if (typeof $scale === 'function') {
    		if (typeof $scale.range === 'function') {
    			return $scale.range();
    		}
    		console.error('[LayerCake] Your scale doesn\'t have a `.range` method?');
    	}
    	return null;
    }

    var defaultReverses = {
    	x: false,
    	y: true,
    	z: false,
    	r: false
    };

    /* node_modules/layercake/LayerCake.svelte generated by Svelte v3.46.4 */

    const { Object: Object_1$3, console: console_1$5 } = globals;
    const file$f = "node_modules/layercake/LayerCake.svelte";

    const get_default_slot_changes$3 = dirty => ({
    	element: dirty[0] & /*element*/ 4,
    	width: dirty[0] & /*$width_d*/ 256,
    	height: dirty[0] & /*$height_d*/ 512,
    	aspectRatio: dirty[0] & /*$aspectRatio_d*/ 1024,
    	containerWidth: dirty[0] & /*$_containerWidth*/ 128,
    	containerHeight: dirty[0] & /*$_containerHeight*/ 64
    });

    const get_default_slot_context$3 = ctx => ({
    	element: /*element*/ ctx[2],
    	width: /*$width_d*/ ctx[8],
    	height: /*$height_d*/ ctx[9],
    	aspectRatio: /*$aspectRatio_d*/ ctx[10],
    	containerWidth: /*$_containerWidth*/ ctx[7],
    	containerHeight: /*$_containerHeight*/ ctx[6]
    });

    // (370:0) {#if (ssr === true || typeof window !== 'undefined')}
    function create_if_block$a(ctx) {
    	let div;
    	let div_resize_listener;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[90].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[89], get_default_slot_context$3);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			attr_dev(div, "class", "layercake-container svelte-vhzpsp");
    			add_render_callback(() => /*div_elementresize_handler*/ ctx[92].call(div));
    			set_style(div, "position", /*position*/ ctx[5], false);
    			set_style(div, "top", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			set_style(div, "right", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			set_style(div, "bottom", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			set_style(div, "left", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			set_style(div, "pointer-events", /*pointerEvents*/ ctx[4] === false ? 'none' : null, false);
    			add_location(div, file$f, 370, 1, 19795);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[91](div);
    			div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[92].bind(div));
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty[0] & /*element, $width_d, $height_d, $aspectRatio_d, $_containerWidth, $_containerHeight*/ 1988 | dirty[2] & /*$$scope*/ 134217728)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[89],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[89])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[89], dirty, get_default_slot_changes$3),
    						get_default_slot_context$3
    					);
    				}
    			}

    			if (dirty[0] & /*position*/ 32) {
    				set_style(div, "position", /*position*/ ctx[5], false);
    			}

    			if (dirty[0] & /*position*/ 32) {
    				set_style(div, "top", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			}

    			if (dirty[0] & /*position*/ 32) {
    				set_style(div, "right", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			}

    			if (dirty[0] & /*position*/ 32) {
    				set_style(div, "bottom", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			}

    			if (dirty[0] & /*position*/ 32) {
    				set_style(div, "left", /*position*/ ctx[5] === 'absolute' ? '0' : null, false);
    			}

    			if (dirty[0] & /*pointerEvents*/ 16) {
    				set_style(div, "pointer-events", /*pointerEvents*/ ctx[4] === false ? 'none' : null, false);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[91](null);
    			div_resize_listener();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$a.name,
    		type: "if",
    		source: "(370:0) {#if (ssr === true || typeof window !== 'undefined')}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$g(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = (/*ssr*/ ctx[3] === true || typeof window !== 'undefined') && create_if_block$a(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*ssr*/ ctx[3] === true || typeof window !== 'undefined') {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*ssr*/ 8) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$a(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$g.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$q($$self, $$props, $$invalidate) {
    	let context;
    	let $_config;
    	let $_custom;
    	let $_rScale;
    	let $_zScale;
    	let $_yScale;
    	let $_xScale;
    	let $_rRange;
    	let $_zRange;
    	let $_yRange;
    	let $_xRange;
    	let $_rPadding;
    	let $_zPadding;
    	let $_yPadding;
    	let $_xPadding;
    	let $_rReverse;
    	let $_zReverse;
    	let $_yReverse;
    	let $_xReverse;
    	let $_rNice;
    	let $_zNice;
    	let $_yNice;
    	let $_xNice;
    	let $_rDomain;
    	let $_zDomain;
    	let $_yDomain;
    	let $_xDomain;
    	let $_r;
    	let $_z;
    	let $_y;
    	let $_x;
    	let $_padding;
    	let $_flatData;
    	let $_data;
    	let $_extents;
    	let $_containerHeight;
    	let $_containerWidth;
    	let $_percentRange;
    	let $width_d;
    	let $height_d;
    	let $aspectRatio_d;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('LayerCake', slots, ['default']);
    	let { ssr = false } = $$props;
    	let { pointerEvents = true } = $$props;
    	let { position = 'relative' } = $$props;
    	let { percentRange = false } = $$props;
    	let { width = undefined } = $$props;
    	let { height = undefined } = $$props;
    	let { containerWidth = width || 100 } = $$props;
    	let { containerHeight = height || 100 } = $$props;
    	let { element = undefined } = $$props;
    	let { x = undefined } = $$props;
    	let { y = undefined } = $$props;
    	let { z = undefined } = $$props;
    	let { r = undefined } = $$props;
    	let { data = [] } = $$props;
    	let { xDomain = undefined } = $$props;
    	let { yDomain = undefined } = $$props;
    	let { zDomain = undefined } = $$props;
    	let { rDomain = undefined } = $$props;
    	let { xNice = false } = $$props;
    	let { yNice = false } = $$props;
    	let { zNice = false } = $$props;
    	let { rNice = false } = $$props;
    	let { xReverse = defaultReverses.x } = $$props;
    	let { yReverse = defaultReverses.y } = $$props;
    	let { zReverse = defaultReverses.z } = $$props;
    	let { rReverse = defaultReverses.r } = $$props;
    	let { xPadding = undefined } = $$props;
    	let { yPadding = undefined } = $$props;
    	let { zPadding = undefined } = $$props;
    	let { rPadding = undefined } = $$props;
    	let { xScale = defaultScales.x } = $$props;
    	let { yScale = defaultScales.y } = $$props;
    	let { zScale = defaultScales.z } = $$props;
    	let { rScale = defaultScales.r } = $$props;
    	let { xRange = undefined } = $$props;
    	let { yRange = undefined } = $$props;
    	let { zRange = undefined } = $$props;
    	let { rRange = undefined } = $$props;
    	let { padding = {} } = $$props;
    	let { extents = {} } = $$props;
    	let { flatData = undefined } = $$props;
    	let { custom = {} } = $$props;

    	/* --------------------------------------------
     * Keep track of whethr the component has mounted
     * This is used to emit warnings once we have measured
     * the container object and it doesn't have proper dimensions
     */
    	let isMounted = false;

    	onMount(() => {
    		isMounted = true;
    	});

    	/* --------------------------------------------
     * Preserve a copy of our passed in settings before we modify them
     * Return this to the user's context so they can reference things if need be
     * Add the active keys since those aren't on our settings object.
     * This is mostly an escape-hatch
     */
    	const config = {};

    	/* --------------------------------------------
     * Make store versions of each parameter
     * Prefix these with `_` to keep things organized
     */
    	const _percentRange = writable(percentRange);

    	validate_store(_percentRange, '_percentRange');
    	component_subscribe($$self, _percentRange, value => $$invalidate(128, $_percentRange = value));
    	const _containerWidth = writable(containerWidth);
    	validate_store(_containerWidth, '_containerWidth');
    	component_subscribe($$self, _containerWidth, value => $$invalidate(7, $_containerWidth = value));
    	const _containerHeight = writable(containerHeight);
    	validate_store(_containerHeight, '_containerHeight');
    	component_subscribe($$self, _containerHeight, value => $$invalidate(6, $_containerHeight = value));
    	const _extents = writable(filterObject(extents));
    	validate_store(_extents, '_extents');
    	component_subscribe($$self, _extents, value => $$invalidate(127, $_extents = value));
    	const _data = writable(data);
    	validate_store(_data, '_data');
    	component_subscribe($$self, _data, value => $$invalidate(126, $_data = value));
    	const _flatData = writable(flatData || data);
    	validate_store(_flatData, '_flatData');
    	component_subscribe($$self, _flatData, value => $$invalidate(125, $_flatData = value));
    	const _padding = writable(padding);
    	validate_store(_padding, '_padding');
    	component_subscribe($$self, _padding, value => $$invalidate(124, $_padding = value));
    	const _x = writable(makeAccessor(x));
    	validate_store(_x, '_x');
    	component_subscribe($$self, _x, value => $$invalidate(123, $_x = value));
    	const _y = writable(makeAccessor(y));
    	validate_store(_y, '_y');
    	component_subscribe($$self, _y, value => $$invalidate(122, $_y = value));
    	const _z = writable(makeAccessor(z));
    	validate_store(_z, '_z');
    	component_subscribe($$self, _z, value => $$invalidate(121, $_z = value));
    	const _r = writable(makeAccessor(r));
    	validate_store(_r, '_r');
    	component_subscribe($$self, _r, value => $$invalidate(120, $_r = value));
    	const _xDomain = writable(xDomain);
    	validate_store(_xDomain, '_xDomain');
    	component_subscribe($$self, _xDomain, value => $$invalidate(119, $_xDomain = value));
    	const _yDomain = writable(yDomain);
    	validate_store(_yDomain, '_yDomain');
    	component_subscribe($$self, _yDomain, value => $$invalidate(118, $_yDomain = value));
    	const _zDomain = writable(zDomain);
    	validate_store(_zDomain, '_zDomain');
    	component_subscribe($$self, _zDomain, value => $$invalidate(117, $_zDomain = value));
    	const _rDomain = writable(rDomain);
    	validate_store(_rDomain, '_rDomain');
    	component_subscribe($$self, _rDomain, value => $$invalidate(116, $_rDomain = value));
    	const _xNice = writable(xNice);
    	validate_store(_xNice, '_xNice');
    	component_subscribe($$self, _xNice, value => $$invalidate(115, $_xNice = value));
    	const _yNice = writable(yNice);
    	validate_store(_yNice, '_yNice');
    	component_subscribe($$self, _yNice, value => $$invalidate(114, $_yNice = value));
    	const _zNice = writable(zNice);
    	validate_store(_zNice, '_zNice');
    	component_subscribe($$self, _zNice, value => $$invalidate(113, $_zNice = value));
    	const _rNice = writable(rNice);
    	validate_store(_rNice, '_rNice');
    	component_subscribe($$self, _rNice, value => $$invalidate(112, $_rNice = value));
    	const _xReverse = writable(xReverse);
    	validate_store(_xReverse, '_xReverse');
    	component_subscribe($$self, _xReverse, value => $$invalidate(111, $_xReverse = value));
    	const _yReverse = writable(yReverse);
    	validate_store(_yReverse, '_yReverse');
    	component_subscribe($$self, _yReverse, value => $$invalidate(110, $_yReverse = value));
    	const _zReverse = writable(zReverse);
    	validate_store(_zReverse, '_zReverse');
    	component_subscribe($$self, _zReverse, value => $$invalidate(109, $_zReverse = value));
    	const _rReverse = writable(rReverse);
    	validate_store(_rReverse, '_rReverse');
    	component_subscribe($$self, _rReverse, value => $$invalidate(108, $_rReverse = value));
    	const _xPadding = writable(xPadding);
    	validate_store(_xPadding, '_xPadding');
    	component_subscribe($$self, _xPadding, value => $$invalidate(107, $_xPadding = value));
    	const _yPadding = writable(yPadding);
    	validate_store(_yPadding, '_yPadding');
    	component_subscribe($$self, _yPadding, value => $$invalidate(106, $_yPadding = value));
    	const _zPadding = writable(zPadding);
    	validate_store(_zPadding, '_zPadding');
    	component_subscribe($$self, _zPadding, value => $$invalidate(105, $_zPadding = value));
    	const _rPadding = writable(rPadding);
    	validate_store(_rPadding, '_rPadding');
    	component_subscribe($$self, _rPadding, value => $$invalidate(104, $_rPadding = value));
    	const _xRange = writable(xRange);
    	validate_store(_xRange, '_xRange');
    	component_subscribe($$self, _xRange, value => $$invalidate(103, $_xRange = value));
    	const _yRange = writable(yRange);
    	validate_store(_yRange, '_yRange');
    	component_subscribe($$self, _yRange, value => $$invalidate(102, $_yRange = value));
    	const _zRange = writable(zRange);
    	validate_store(_zRange, '_zRange');
    	component_subscribe($$self, _zRange, value => $$invalidate(101, $_zRange = value));
    	const _rRange = writable(rRange);
    	validate_store(_rRange, '_rRange');
    	component_subscribe($$self, _rRange, value => $$invalidate(100, $_rRange = value));
    	const _xScale = writable(xScale);
    	validate_store(_xScale, '_xScale');
    	component_subscribe($$self, _xScale, value => $$invalidate(99, $_xScale = value));
    	const _yScale = writable(yScale);
    	validate_store(_yScale, '_yScale');
    	component_subscribe($$self, _yScale, value => $$invalidate(98, $_yScale = value));
    	const _zScale = writable(zScale);
    	validate_store(_zScale, '_zScale');
    	component_subscribe($$self, _zScale, value => $$invalidate(97, $_zScale = value));
    	const _rScale = writable(rScale);
    	validate_store(_rScale, '_rScale');
    	component_subscribe($$self, _rScale, value => $$invalidate(96, $_rScale = value));
    	const _config = writable(config);
    	validate_store(_config, '_config');
    	component_subscribe($$self, _config, value => $$invalidate(94, $_config = value));
    	const _custom = writable(custom);
    	validate_store(_custom, '_custom');
    	component_subscribe($$self, _custom, value => $$invalidate(95, $_custom = value));

    	/* --------------------------------------------
     * Create derived values
     * Suffix these with `_d`
     */
    	const activeGetters_d = derived([_x, _y, _z, _r], ([$x, $y, $z, $r]) => {
    		const obj = {};

    		if ($x) {
    			obj.x = $x;
    		}

    		if ($y) {
    			obj.y = $y;
    		}

    		if ($z) {
    			obj.z = $z;
    		}

    		if ($r) {
    			obj.r = $r;
    		}

    		return obj;
    	});

    	const padding_d = derived([_padding, _containerWidth, _containerHeight], ([$padding]) => {
    		const defaultPadding = { top: 0, right: 0, bottom: 0, left: 0 };
    		return Object.assign(defaultPadding, $padding);
    	});

    	const box_d = derived([_containerWidth, _containerHeight, padding_d], ([$containerWidth, $containerHeight, $padding]) => {
    		const b = {};
    		b.top = $padding.top;
    		b.right = $containerWidth - $padding.right;
    		b.bottom = $containerHeight - $padding.bottom;
    		b.left = $padding.left;
    		b.width = b.right - b.left;
    		b.height = b.bottom - b.top;

    		if (b.width <= 0 && isMounted === true) {
    			console.warn('[LayerCake] Target div has zero or negative width. Did you forget to set an explicit width in CSS on the container?');
    		}

    		if (b.height <= 0 && isMounted === true) {
    			console.warn('[LayerCake] Target div has zero or negative height. Did you forget to set an explicit height in CSS on the container?');
    		}

    		return b;
    	});

    	const width_d = derived([box_d], ([$box]) => {
    		return $box.width;
    	});

    	validate_store(width_d, 'width_d');
    	component_subscribe($$self, width_d, value => $$invalidate(8, $width_d = value));

    	const height_d = derived([box_d], ([$box]) => {
    		return $box.height;
    	});

    	validate_store(height_d, 'height_d');
    	component_subscribe($$self, height_d, value => $$invalidate(9, $height_d = value));

    	/* --------------------------------------------
     * Calculate extents by taking the extent of the data
     * and filling that in with anything set by the user
     */
    	const extents_d = derived([_flatData, activeGetters_d, _extents], ([$flatData, $activeGetters, $extents]) => {
    		const getters = filterObject($activeGetters, $extents);

    		if (Object.keys(getters).length > 0) {
    			return {
    				...calcExtents($flatData, getters),
    				...$extents
    			};
    		} else {
    			return {};
    		}
    	});

    	const xDomain_d = derived([extents_d, _xDomain], calcDomain('x'));
    	const yDomain_d = derived([extents_d, _yDomain], calcDomain('y'));
    	const zDomain_d = derived([extents_d, _zDomain], calcDomain('z'));
    	const rDomain_d = derived([extents_d, _rDomain], calcDomain('r'));

    	const xScale_d = derived(
    		[
    			_xScale,
    			extents_d,
    			xDomain_d,
    			_xPadding,
    			_xNice,
    			_xReverse,
    			width_d,
    			height_d,
    			_xRange,
    			_percentRange
    		],
    		createScale('x')
    	);

    	const xGet_d = derived([_x, xScale_d], createGetter);

    	const yScale_d = derived(
    		[
    			_yScale,
    			extents_d,
    			yDomain_d,
    			_yPadding,
    			_yNice,
    			_yReverse,
    			width_d,
    			height_d,
    			_yRange,
    			_percentRange
    		],
    		createScale('y')
    	);

    	const yGet_d = derived([_y, yScale_d], createGetter);

    	const zScale_d = derived(
    		[
    			_zScale,
    			extents_d,
    			zDomain_d,
    			_zPadding,
    			_zNice,
    			_zReverse,
    			width_d,
    			height_d,
    			_zRange,
    			_percentRange
    		],
    		createScale('z')
    	);

    	const zGet_d = derived([_z, zScale_d], createGetter);

    	const rScale_d = derived(
    		[
    			_rScale,
    			extents_d,
    			rDomain_d,
    			_rPadding,
    			_rNice,
    			_rReverse,
    			width_d,
    			height_d,
    			_rRange,
    			_percentRange
    		],
    		createScale('r')
    	);

    	const rGet_d = derived([_r, rScale_d], createGetter);
    	const xRange_d = derived([xScale_d], getRange);
    	const yRange_d = derived([yScale_d], getRange);
    	const zRange_d = derived([zScale_d], getRange);
    	const rRange_d = derived([rScale_d], getRange);

    	const aspectRatio_d = derived([width_d, height_d], ([$width, $height]) => {
    		return $width / $height;
    	});

    	validate_store(aspectRatio_d, 'aspectRatio_d');
    	component_subscribe($$self, aspectRatio_d, value => $$invalidate(10, $aspectRatio_d = value));

    	const writable_props = [
    		'ssr',
    		'pointerEvents',
    		'position',
    		'percentRange',
    		'width',
    		'height',
    		'containerWidth',
    		'containerHeight',
    		'element',
    		'x',
    		'y',
    		'z',
    		'r',
    		'data',
    		'xDomain',
    		'yDomain',
    		'zDomain',
    		'rDomain',
    		'xNice',
    		'yNice',
    		'zNice',
    		'rNice',
    		'xReverse',
    		'yReverse',
    		'zReverse',
    		'rReverse',
    		'xPadding',
    		'yPadding',
    		'zPadding',
    		'rPadding',
    		'xScale',
    		'yScale',
    		'zScale',
    		'rScale',
    		'xRange',
    		'yRange',
    		'zRange',
    		'rRange',
    		'padding',
    		'extents',
    		'flatData',
    		'custom'
    	];

    	Object_1$3.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$5.warn(`<LayerCake> was created with unknown prop '${key}'`);
    	});

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(2, element);
    		});
    	}

    	function div_elementresize_handler() {
    		containerWidth = this.clientWidth;
    		containerHeight = this.clientHeight;
    		$$invalidate(0, containerWidth);
    		$$invalidate(1, containerHeight);
    	}

    	$$self.$$set = $$props => {
    		if ('ssr' in $$props) $$invalidate(3, ssr = $$props.ssr);
    		if ('pointerEvents' in $$props) $$invalidate(4, pointerEvents = $$props.pointerEvents);
    		if ('position' in $$props) $$invalidate(5, position = $$props.position);
    		if ('percentRange' in $$props) $$invalidate(51, percentRange = $$props.percentRange);
    		if ('width' in $$props) $$invalidate(52, width = $$props.width);
    		if ('height' in $$props) $$invalidate(53, height = $$props.height);
    		if ('containerWidth' in $$props) $$invalidate(0, containerWidth = $$props.containerWidth);
    		if ('containerHeight' in $$props) $$invalidate(1, containerHeight = $$props.containerHeight);
    		if ('element' in $$props) $$invalidate(2, element = $$props.element);
    		if ('x' in $$props) $$invalidate(54, x = $$props.x);
    		if ('y' in $$props) $$invalidate(55, y = $$props.y);
    		if ('z' in $$props) $$invalidate(56, z = $$props.z);
    		if ('r' in $$props) $$invalidate(57, r = $$props.r);
    		if ('data' in $$props) $$invalidate(58, data = $$props.data);
    		if ('xDomain' in $$props) $$invalidate(59, xDomain = $$props.xDomain);
    		if ('yDomain' in $$props) $$invalidate(60, yDomain = $$props.yDomain);
    		if ('zDomain' in $$props) $$invalidate(61, zDomain = $$props.zDomain);
    		if ('rDomain' in $$props) $$invalidate(62, rDomain = $$props.rDomain);
    		if ('xNice' in $$props) $$invalidate(63, xNice = $$props.xNice);
    		if ('yNice' in $$props) $$invalidate(64, yNice = $$props.yNice);
    		if ('zNice' in $$props) $$invalidate(65, zNice = $$props.zNice);
    		if ('rNice' in $$props) $$invalidate(66, rNice = $$props.rNice);
    		if ('xReverse' in $$props) $$invalidate(67, xReverse = $$props.xReverse);
    		if ('yReverse' in $$props) $$invalidate(68, yReverse = $$props.yReverse);
    		if ('zReverse' in $$props) $$invalidate(69, zReverse = $$props.zReverse);
    		if ('rReverse' in $$props) $$invalidate(70, rReverse = $$props.rReverse);
    		if ('xPadding' in $$props) $$invalidate(71, xPadding = $$props.xPadding);
    		if ('yPadding' in $$props) $$invalidate(72, yPadding = $$props.yPadding);
    		if ('zPadding' in $$props) $$invalidate(73, zPadding = $$props.zPadding);
    		if ('rPadding' in $$props) $$invalidate(74, rPadding = $$props.rPadding);
    		if ('xScale' in $$props) $$invalidate(75, xScale = $$props.xScale);
    		if ('yScale' in $$props) $$invalidate(76, yScale = $$props.yScale);
    		if ('zScale' in $$props) $$invalidate(77, zScale = $$props.zScale);
    		if ('rScale' in $$props) $$invalidate(78, rScale = $$props.rScale);
    		if ('xRange' in $$props) $$invalidate(79, xRange = $$props.xRange);
    		if ('yRange' in $$props) $$invalidate(80, yRange = $$props.yRange);
    		if ('zRange' in $$props) $$invalidate(81, zRange = $$props.zRange);
    		if ('rRange' in $$props) $$invalidate(82, rRange = $$props.rRange);
    		if ('padding' in $$props) $$invalidate(83, padding = $$props.padding);
    		if ('extents' in $$props) $$invalidate(84, extents = $$props.extents);
    		if ('flatData' in $$props) $$invalidate(85, flatData = $$props.flatData);
    		if ('custom' in $$props) $$invalidate(86, custom = $$props.custom);
    		if ('$$scope' in $$props) $$invalidate(89, $$scope = $$props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		setContext,
    		onMount,
    		writable,
    		derived,
    		makeAccessor,
    		filterObject,
    		calcExtents,
    		calcDomain,
    		createScale,
    		createGetter,
    		getRange,
    		defaultScales,
    		defaultReverses,
    		ssr,
    		pointerEvents,
    		position,
    		percentRange,
    		width,
    		height,
    		containerWidth,
    		containerHeight,
    		element,
    		x,
    		y,
    		z,
    		r,
    		data,
    		xDomain,
    		yDomain,
    		zDomain,
    		rDomain,
    		xNice,
    		yNice,
    		zNice,
    		rNice,
    		xReverse,
    		yReverse,
    		zReverse,
    		rReverse,
    		xPadding,
    		yPadding,
    		zPadding,
    		rPadding,
    		xScale,
    		yScale,
    		zScale,
    		rScale,
    		xRange,
    		yRange,
    		zRange,
    		rRange,
    		padding,
    		extents,
    		flatData,
    		custom,
    		isMounted,
    		config,
    		_percentRange,
    		_containerWidth,
    		_containerHeight,
    		_extents,
    		_data,
    		_flatData,
    		_padding,
    		_x,
    		_y,
    		_z,
    		_r,
    		_xDomain,
    		_yDomain,
    		_zDomain,
    		_rDomain,
    		_xNice,
    		_yNice,
    		_zNice,
    		_rNice,
    		_xReverse,
    		_yReverse,
    		_zReverse,
    		_rReverse,
    		_xPadding,
    		_yPadding,
    		_zPadding,
    		_rPadding,
    		_xRange,
    		_yRange,
    		_zRange,
    		_rRange,
    		_xScale,
    		_yScale,
    		_zScale,
    		_rScale,
    		_config,
    		_custom,
    		activeGetters_d,
    		padding_d,
    		box_d,
    		width_d,
    		height_d,
    		extents_d,
    		xDomain_d,
    		yDomain_d,
    		zDomain_d,
    		rDomain_d,
    		xScale_d,
    		xGet_d,
    		yScale_d,
    		yGet_d,
    		zScale_d,
    		zGet_d,
    		rScale_d,
    		rGet_d,
    		xRange_d,
    		yRange_d,
    		zRange_d,
    		rRange_d,
    		aspectRatio_d,
    		context,
    		$_config,
    		$_custom,
    		$_rScale,
    		$_zScale,
    		$_yScale,
    		$_xScale,
    		$_rRange,
    		$_zRange,
    		$_yRange,
    		$_xRange,
    		$_rPadding,
    		$_zPadding,
    		$_yPadding,
    		$_xPadding,
    		$_rReverse,
    		$_zReverse,
    		$_yReverse,
    		$_xReverse,
    		$_rNice,
    		$_zNice,
    		$_yNice,
    		$_xNice,
    		$_rDomain,
    		$_zDomain,
    		$_yDomain,
    		$_xDomain,
    		$_r,
    		$_z,
    		$_y,
    		$_x,
    		$_padding,
    		$_flatData,
    		$_data,
    		$_extents,
    		$_containerHeight,
    		$_containerWidth,
    		$_percentRange,
    		$width_d,
    		$height_d,
    		$aspectRatio_d
    	});

    	$$self.$inject_state = $$props => {
    		if ('ssr' in $$props) $$invalidate(3, ssr = $$props.ssr);
    		if ('pointerEvents' in $$props) $$invalidate(4, pointerEvents = $$props.pointerEvents);
    		if ('position' in $$props) $$invalidate(5, position = $$props.position);
    		if ('percentRange' in $$props) $$invalidate(51, percentRange = $$props.percentRange);
    		if ('width' in $$props) $$invalidate(52, width = $$props.width);
    		if ('height' in $$props) $$invalidate(53, height = $$props.height);
    		if ('containerWidth' in $$props) $$invalidate(0, containerWidth = $$props.containerWidth);
    		if ('containerHeight' in $$props) $$invalidate(1, containerHeight = $$props.containerHeight);
    		if ('element' in $$props) $$invalidate(2, element = $$props.element);
    		if ('x' in $$props) $$invalidate(54, x = $$props.x);
    		if ('y' in $$props) $$invalidate(55, y = $$props.y);
    		if ('z' in $$props) $$invalidate(56, z = $$props.z);
    		if ('r' in $$props) $$invalidate(57, r = $$props.r);
    		if ('data' in $$props) $$invalidate(58, data = $$props.data);
    		if ('xDomain' in $$props) $$invalidate(59, xDomain = $$props.xDomain);
    		if ('yDomain' in $$props) $$invalidate(60, yDomain = $$props.yDomain);
    		if ('zDomain' in $$props) $$invalidate(61, zDomain = $$props.zDomain);
    		if ('rDomain' in $$props) $$invalidate(62, rDomain = $$props.rDomain);
    		if ('xNice' in $$props) $$invalidate(63, xNice = $$props.xNice);
    		if ('yNice' in $$props) $$invalidate(64, yNice = $$props.yNice);
    		if ('zNice' in $$props) $$invalidate(65, zNice = $$props.zNice);
    		if ('rNice' in $$props) $$invalidate(66, rNice = $$props.rNice);
    		if ('xReverse' in $$props) $$invalidate(67, xReverse = $$props.xReverse);
    		if ('yReverse' in $$props) $$invalidate(68, yReverse = $$props.yReverse);
    		if ('zReverse' in $$props) $$invalidate(69, zReverse = $$props.zReverse);
    		if ('rReverse' in $$props) $$invalidate(70, rReverse = $$props.rReverse);
    		if ('xPadding' in $$props) $$invalidate(71, xPadding = $$props.xPadding);
    		if ('yPadding' in $$props) $$invalidate(72, yPadding = $$props.yPadding);
    		if ('zPadding' in $$props) $$invalidate(73, zPadding = $$props.zPadding);
    		if ('rPadding' in $$props) $$invalidate(74, rPadding = $$props.rPadding);
    		if ('xScale' in $$props) $$invalidate(75, xScale = $$props.xScale);
    		if ('yScale' in $$props) $$invalidate(76, yScale = $$props.yScale);
    		if ('zScale' in $$props) $$invalidate(77, zScale = $$props.zScale);
    		if ('rScale' in $$props) $$invalidate(78, rScale = $$props.rScale);
    		if ('xRange' in $$props) $$invalidate(79, xRange = $$props.xRange);
    		if ('yRange' in $$props) $$invalidate(80, yRange = $$props.yRange);
    		if ('zRange' in $$props) $$invalidate(81, zRange = $$props.zRange);
    		if ('rRange' in $$props) $$invalidate(82, rRange = $$props.rRange);
    		if ('padding' in $$props) $$invalidate(83, padding = $$props.padding);
    		if ('extents' in $$props) $$invalidate(84, extents = $$props.extents);
    		if ('flatData' in $$props) $$invalidate(85, flatData = $$props.flatData);
    		if ('custom' in $$props) $$invalidate(86, custom = $$props.custom);
    		if ('isMounted' in $$props) isMounted = $$props.isMounted;
    		if ('context' in $$props) $$invalidate(88, context = $$props.context);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[1] & /*x*/ 8388608) {
    			if (x) $$invalidate(87, config.x = x, config);
    		}

    		if ($$self.$$.dirty[1] & /*y*/ 16777216) {
    			if (y) $$invalidate(87, config.y = y, config);
    		}

    		if ($$self.$$.dirty[1] & /*z*/ 33554432) {
    			if (z) $$invalidate(87, config.z = z, config);
    		}

    		if ($$self.$$.dirty[1] & /*r*/ 67108864) {
    			if (r) $$invalidate(87, config.r = r, config);
    		}

    		if ($$self.$$.dirty[1] & /*xDomain*/ 268435456) {
    			if (xDomain) $$invalidate(87, config.xDomain = xDomain, config);
    		}

    		if ($$self.$$.dirty[1] & /*yDomain*/ 536870912) {
    			if (yDomain) $$invalidate(87, config.yDomain = yDomain, config);
    		}

    		if ($$self.$$.dirty[1] & /*zDomain*/ 1073741824) {
    			if (zDomain) $$invalidate(87, config.zDomain = zDomain, config);
    		}

    		if ($$self.$$.dirty[2] & /*rDomain*/ 1) {
    			if (rDomain) $$invalidate(87, config.rDomain = rDomain, config);
    		}

    		if ($$self.$$.dirty[2] & /*xRange*/ 131072) {
    			if (xRange) $$invalidate(87, config.xRange = xRange, config);
    		}

    		if ($$self.$$.dirty[2] & /*yRange*/ 262144) {
    			if (yRange) $$invalidate(87, config.yRange = yRange, config);
    		}

    		if ($$self.$$.dirty[2] & /*zRange*/ 524288) {
    			if (zRange) $$invalidate(87, config.zRange = zRange, config);
    		}

    		if ($$self.$$.dirty[2] & /*rRange*/ 1048576) {
    			if (rRange) $$invalidate(87, config.rRange = rRange, config);
    		}

    		if ($$self.$$.dirty[1] & /*percentRange*/ 1048576) {
    			set_store_value(_percentRange, $_percentRange = percentRange, $_percentRange);
    		}

    		if ($$self.$$.dirty[0] & /*containerWidth*/ 1) {
    			set_store_value(_containerWidth, $_containerWidth = containerWidth, $_containerWidth);
    		}

    		if ($$self.$$.dirty[0] & /*containerHeight*/ 2) {
    			set_store_value(_containerHeight, $_containerHeight = containerHeight, $_containerHeight);
    		}

    		if ($$self.$$.dirty[2] & /*extents*/ 4194304) {
    			set_store_value(_extents, $_extents = filterObject(extents), $_extents);
    		}

    		if ($$self.$$.dirty[1] & /*data*/ 134217728) {
    			set_store_value(_data, $_data = data, $_data);
    		}

    		if ($$self.$$.dirty[1] & /*data*/ 134217728 | $$self.$$.dirty[2] & /*flatData*/ 8388608) {
    			set_store_value(_flatData, $_flatData = flatData || data, $_flatData);
    		}

    		if ($$self.$$.dirty[2] & /*padding*/ 2097152) {
    			set_store_value(_padding, $_padding = padding, $_padding);
    		}

    		if ($$self.$$.dirty[1] & /*x*/ 8388608) {
    			set_store_value(_x, $_x = makeAccessor(x), $_x);
    		}

    		if ($$self.$$.dirty[1] & /*y*/ 16777216) {
    			set_store_value(_y, $_y = makeAccessor(y), $_y);
    		}

    		if ($$self.$$.dirty[1] & /*z*/ 33554432) {
    			set_store_value(_z, $_z = makeAccessor(z), $_z);
    		}

    		if ($$self.$$.dirty[1] & /*r*/ 67108864) {
    			set_store_value(_r, $_r = makeAccessor(r), $_r);
    		}

    		if ($$self.$$.dirty[1] & /*xDomain*/ 268435456) {
    			set_store_value(_xDomain, $_xDomain = xDomain, $_xDomain);
    		}

    		if ($$self.$$.dirty[1] & /*yDomain*/ 536870912) {
    			set_store_value(_yDomain, $_yDomain = yDomain, $_yDomain);
    		}

    		if ($$self.$$.dirty[1] & /*zDomain*/ 1073741824) {
    			set_store_value(_zDomain, $_zDomain = zDomain, $_zDomain);
    		}

    		if ($$self.$$.dirty[2] & /*rDomain*/ 1) {
    			set_store_value(_rDomain, $_rDomain = rDomain, $_rDomain);
    		}

    		if ($$self.$$.dirty[2] & /*xNice*/ 2) {
    			set_store_value(_xNice, $_xNice = xNice, $_xNice);
    		}

    		if ($$self.$$.dirty[2] & /*yNice*/ 4) {
    			set_store_value(_yNice, $_yNice = yNice, $_yNice);
    		}

    		if ($$self.$$.dirty[2] & /*zNice*/ 8) {
    			set_store_value(_zNice, $_zNice = zNice, $_zNice);
    		}

    		if ($$self.$$.dirty[2] & /*rNice*/ 16) {
    			set_store_value(_rNice, $_rNice = rNice, $_rNice);
    		}

    		if ($$self.$$.dirty[2] & /*xReverse*/ 32) {
    			set_store_value(_xReverse, $_xReverse = xReverse, $_xReverse);
    		}

    		if ($$self.$$.dirty[2] & /*yReverse*/ 64) {
    			set_store_value(_yReverse, $_yReverse = yReverse, $_yReverse);
    		}

    		if ($$self.$$.dirty[2] & /*zReverse*/ 128) {
    			set_store_value(_zReverse, $_zReverse = zReverse, $_zReverse);
    		}

    		if ($$self.$$.dirty[2] & /*rReverse*/ 256) {
    			set_store_value(_rReverse, $_rReverse = rReverse, $_rReverse);
    		}

    		if ($$self.$$.dirty[2] & /*xPadding*/ 512) {
    			set_store_value(_xPadding, $_xPadding = xPadding, $_xPadding);
    		}

    		if ($$self.$$.dirty[2] & /*yPadding*/ 1024) {
    			set_store_value(_yPadding, $_yPadding = yPadding, $_yPadding);
    		}

    		if ($$self.$$.dirty[2] & /*zPadding*/ 2048) {
    			set_store_value(_zPadding, $_zPadding = zPadding, $_zPadding);
    		}

    		if ($$self.$$.dirty[2] & /*rPadding*/ 4096) {
    			set_store_value(_rPadding, $_rPadding = rPadding, $_rPadding);
    		}

    		if ($$self.$$.dirty[2] & /*xRange*/ 131072) {
    			set_store_value(_xRange, $_xRange = xRange, $_xRange);
    		}

    		if ($$self.$$.dirty[2] & /*yRange*/ 262144) {
    			set_store_value(_yRange, $_yRange = yRange, $_yRange);
    		}

    		if ($$self.$$.dirty[2] & /*zRange*/ 524288) {
    			set_store_value(_zRange, $_zRange = zRange, $_zRange);
    		}

    		if ($$self.$$.dirty[2] & /*rRange*/ 1048576) {
    			set_store_value(_rRange, $_rRange = rRange, $_rRange);
    		}

    		if ($$self.$$.dirty[2] & /*xScale*/ 8192) {
    			set_store_value(_xScale, $_xScale = xScale, $_xScale);
    		}

    		if ($$self.$$.dirty[2] & /*yScale*/ 16384) {
    			set_store_value(_yScale, $_yScale = yScale, $_yScale);
    		}

    		if ($$self.$$.dirty[2] & /*zScale*/ 32768) {
    			set_store_value(_zScale, $_zScale = zScale, $_zScale);
    		}

    		if ($$self.$$.dirty[2] & /*rScale*/ 65536) {
    			set_store_value(_rScale, $_rScale = rScale, $_rScale);
    		}

    		if ($$self.$$.dirty[2] & /*custom*/ 16777216) {
    			set_store_value(_custom, $_custom = custom, $_custom);
    		}

    		if ($$self.$$.dirty[2] & /*config*/ 33554432) {
    			set_store_value(_config, $_config = config, $_config);
    		}

    		if ($$self.$$.dirty[2] & /*context*/ 67108864) {
    			setContext('LayerCake', context);
    		}
    	};

    	$$invalidate(88, context = {
    		activeGetters: activeGetters_d,
    		width: width_d,
    		height: height_d,
    		percentRange: _percentRange,
    		aspectRatio: aspectRatio_d,
    		containerWidth: _containerWidth,
    		containerHeight: _containerHeight,
    		x: _x,
    		y: _y,
    		z: _z,
    		r: _r,
    		custom: _custom,
    		data: _data,
    		xNice: _xNice,
    		yNice: _yNice,
    		zNice: _zNice,
    		rNice: _rNice,
    		xReverse: _xReverse,
    		yReverse: _yReverse,
    		zReverse: _zReverse,
    		rReverse: _rReverse,
    		xPadding: _xPadding,
    		yPadding: _yPadding,
    		zPadding: _zPadding,
    		rPadding: _rPadding,
    		padding: padding_d,
    		flatData: _flatData,
    		extents: extents_d,
    		xDomain: xDomain_d,
    		yDomain: yDomain_d,
    		zDomain: zDomain_d,
    		rDomain: rDomain_d,
    		xRange: xRange_d,
    		yRange: yRange_d,
    		zRange: zRange_d,
    		rRange: rRange_d,
    		config: _config,
    		xScale: xScale_d,
    		xGet: xGet_d,
    		yScale: yScale_d,
    		yGet: yGet_d,
    		zScale: zScale_d,
    		zGet: zGet_d,
    		rScale: rScale_d,
    		rGet: rGet_d
    	});

    	return [
    		containerWidth,
    		containerHeight,
    		element,
    		ssr,
    		pointerEvents,
    		position,
    		$_containerHeight,
    		$_containerWidth,
    		$width_d,
    		$height_d,
    		$aspectRatio_d,
    		_percentRange,
    		_containerWidth,
    		_containerHeight,
    		_extents,
    		_data,
    		_flatData,
    		_padding,
    		_x,
    		_y,
    		_z,
    		_r,
    		_xDomain,
    		_yDomain,
    		_zDomain,
    		_rDomain,
    		_xNice,
    		_yNice,
    		_zNice,
    		_rNice,
    		_xReverse,
    		_yReverse,
    		_zReverse,
    		_rReverse,
    		_xPadding,
    		_yPadding,
    		_zPadding,
    		_rPadding,
    		_xRange,
    		_yRange,
    		_zRange,
    		_rRange,
    		_xScale,
    		_yScale,
    		_zScale,
    		_rScale,
    		_config,
    		_custom,
    		width_d,
    		height_d,
    		aspectRatio_d,
    		percentRange,
    		width,
    		height,
    		x,
    		y,
    		z,
    		r,
    		data,
    		xDomain,
    		yDomain,
    		zDomain,
    		rDomain,
    		xNice,
    		yNice,
    		zNice,
    		rNice,
    		xReverse,
    		yReverse,
    		zReverse,
    		rReverse,
    		xPadding,
    		yPadding,
    		zPadding,
    		rPadding,
    		xScale,
    		yScale,
    		zScale,
    		rScale,
    		xRange,
    		yRange,
    		zRange,
    		rRange,
    		padding,
    		extents,
    		flatData,
    		custom,
    		config,
    		context,
    		$$scope,
    		slots,
    		div_binding,
    		div_elementresize_handler
    	];
    }

    class LayerCake extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(
    			this,
    			options,
    			instance$q,
    			create_fragment$g,
    			safe_not_equal,
    			{
    				ssr: 3,
    				pointerEvents: 4,
    				position: 5,
    				percentRange: 51,
    				width: 52,
    				height: 53,
    				containerWidth: 0,
    				containerHeight: 1,
    				element: 2,
    				x: 54,
    				y: 55,
    				z: 56,
    				r: 57,
    				data: 58,
    				xDomain: 59,
    				yDomain: 60,
    				zDomain: 61,
    				rDomain: 62,
    				xNice: 63,
    				yNice: 64,
    				zNice: 65,
    				rNice: 66,
    				xReverse: 67,
    				yReverse: 68,
    				zReverse: 69,
    				rReverse: 70,
    				xPadding: 71,
    				yPadding: 72,
    				zPadding: 73,
    				rPadding: 74,
    				xScale: 75,
    				yScale: 76,
    				zScale: 77,
    				rScale: 78,
    				xRange: 79,
    				yRange: 80,
    				zRange: 81,
    				rRange: 82,
    				padding: 83,
    				extents: 84,
    				flatData: 85,
    				custom: 86
    			},
    			null,
    			[-1, -1, -1, -1, -1]
    		);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "LayerCake",
    			options,
    			id: create_fragment$g.name
    		});
    	}

    	get ssr() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ssr(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get pointerEvents() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set pointerEvents(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get position() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set position(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get percentRange() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set percentRange(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get width() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set width(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get height() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set height(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get containerWidth() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set containerWidth(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get containerHeight() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set containerHeight(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get element() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set element(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get x() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set x(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get y() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set y(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get z() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set z(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get r() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set r(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get data() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set data(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xDomain() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xDomain(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yDomain() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yDomain(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zDomain() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zDomain(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rDomain() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rDomain(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xNice() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xNice(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yNice() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yNice(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zNice() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zNice(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rNice() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rNice(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xReverse() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xReverse(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yReverse() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yReverse(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zReverse() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zReverse(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rReverse() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rReverse(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xPadding() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xPadding(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yPadding() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yPadding(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zPadding() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zPadding(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rPadding() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rPadding(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xScale() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xScale(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yScale() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yScale(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zScale() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zScale(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rScale() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rScale(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xRange() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xRange(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yRange() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yRange(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zRange() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zRange(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get rRange() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set rRange(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get padding() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set padding(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get extents() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set extents(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get flatData() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set flatData(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get custom() {
    		throw new Error("<LayerCake>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set custom(value) {
    		throw new Error("<LayerCake>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/layercake/layouts/Html.svelte generated by Svelte v3.46.4 */
    const file$e = "node_modules/layercake/layouts/Html.svelte";
    const get_default_slot_changes$2 = dirty => ({ element: dirty & /*element*/ 1 });
    const get_default_slot_context$2 = ctx => ({ element: /*element*/ ctx[0] });

    function create_fragment$f(ctx) {
    	let div;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[6].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[5], get_default_slot_context$2);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			attr_dev(div, "class", "layercake-layout-html svelte-1bu60uu");
    			set_style(div, "z-index", /*zIndex*/ ctx[1], false);
    			set_style(div, "pointer-events", /*pointerEvents*/ ctx[2] === false ? 'none' : null, false);
    			set_style(div, "top", /*$padding*/ ctx[3].top + 'px', false);
    			set_style(div, "right", /*$padding*/ ctx[3].right + 'px', false);
    			set_style(div, "bottom", /*$padding*/ ctx[3].bottom + 'px', false);
    			set_style(div, "left", /*$padding*/ ctx[3].left + 'px', false);
    			add_location(div, file$e, 19, 0, 512);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[7](div);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope, element*/ 33)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[5],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[5])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[5], dirty, get_default_slot_changes$2),
    						get_default_slot_context$2
    					);
    				}
    			}

    			if (dirty & /*zIndex*/ 2) {
    				set_style(div, "z-index", /*zIndex*/ ctx[1], false);
    			}

    			if (dirty & /*pointerEvents*/ 4) {
    				set_style(div, "pointer-events", /*pointerEvents*/ ctx[2] === false ? 'none' : null, false);
    			}

    			if (dirty & /*$padding*/ 8) {
    				set_style(div, "top", /*$padding*/ ctx[3].top + 'px', false);
    			}

    			if (dirty & /*$padding*/ 8) {
    				set_style(div, "right", /*$padding*/ ctx[3].right + 'px', false);
    			}

    			if (dirty & /*$padding*/ 8) {
    				set_style(div, "bottom", /*$padding*/ ctx[3].bottom + 'px', false);
    			}

    			if (dirty & /*$padding*/ 8) {
    				set_style(div, "left", /*$padding*/ ctx[3].left + 'px', false);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[7](null);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$f.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$p($$self, $$props, $$invalidate) {
    	let $padding;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Html', slots, ['default']);
    	let { element = undefined } = $$props;
    	let { zIndex = undefined } = $$props;
    	let { pointerEvents = undefined } = $$props;
    	const { padding } = getContext('LayerCake');
    	validate_store(padding, 'padding');
    	component_subscribe($$self, padding, value => $$invalidate(3, $padding = value));
    	const writable_props = ['element', 'zIndex', 'pointerEvents'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Html> was created with unknown prop '${key}'`);
    	});

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(0, element);
    		});
    	}

    	$$self.$$set = $$props => {
    		if ('element' in $$props) $$invalidate(0, element = $$props.element);
    		if ('zIndex' in $$props) $$invalidate(1, zIndex = $$props.zIndex);
    		if ('pointerEvents' in $$props) $$invalidate(2, pointerEvents = $$props.pointerEvents);
    		if ('$$scope' in $$props) $$invalidate(5, $$scope = $$props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		element,
    		zIndex,
    		pointerEvents,
    		padding,
    		$padding
    	});

    	$$self.$inject_state = $$props => {
    		if ('element' in $$props) $$invalidate(0, element = $$props.element);
    		if ('zIndex' in $$props) $$invalidate(1, zIndex = $$props.zIndex);
    		if ('pointerEvents' in $$props) $$invalidate(2, pointerEvents = $$props.pointerEvents);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [element, zIndex, pointerEvents, $padding, padding, $$scope, slots, div_binding];
    }

    class Html extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$p, create_fragment$f, safe_not_equal, { element: 0, zIndex: 1, pointerEvents: 2 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Html",
    			options,
    			id: create_fragment$f.name
    		});
    	}

    	get element() {
    		throw new Error("<Html>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set element(value) {
    		throw new Error("<Html>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zIndex() {
    		throw new Error("<Html>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zIndex(value) {
    		throw new Error("<Html>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get pointerEvents() {
    		throw new Error("<Html>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set pointerEvents(value) {
    		throw new Error("<Html>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/layercake/layouts/Svg.svelte generated by Svelte v3.46.4 */
    const file$d = "node_modules/layercake/layouts/Svg.svelte";
    const get_default_slot_changes$1 = dirty => ({ element: dirty & /*element*/ 1 });
    const get_default_slot_context$1 = ctx => ({ element: /*element*/ ctx[0] });
    const get_defs_slot_changes = dirty => ({ element: dirty & /*element*/ 1 });
    const get_defs_slot_context = ctx => ({ element: /*element*/ ctx[0] });

    function create_fragment$e(ctx) {
    	let svg;
    	let defs;
    	let g;
    	let g_transform_value;
    	let current;
    	const defs_slot_template = /*#slots*/ ctx[12].defs;
    	const defs_slot = create_slot(defs_slot_template, ctx, /*$$scope*/ ctx[11], get_defs_slot_context);
    	const default_slot_template = /*#slots*/ ctx[12].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], get_default_slot_context$1);

    	const block = {
    		c: function create() {
    			svg = svg_element("svg");
    			defs = svg_element("defs");
    			if (defs_slot) defs_slot.c();
    			g = svg_element("g");
    			if (default_slot) default_slot.c();
    			add_location(defs, file$d, 33, 1, 992);
    			attr_dev(g, "class", "layercake-layout-svg_g");
    			attr_dev(g, "transform", g_transform_value = "translate(" + /*$padding*/ ctx[7].left + ", " + /*$padding*/ ctx[7].top + ")");
    			add_location(g, file$d, 36, 1, 1037);
    			attr_dev(svg, "class", "layercake-layout-svg svelte-u84d8d");
    			attr_dev(svg, "viewBox", /*viewBox*/ ctx[4]);
    			attr_dev(svg, "width", /*$containerWidth*/ ctx[5]);
    			attr_dev(svg, "height", /*$containerHeight*/ ctx[6]);
    			set_style(svg, "z-index", /*zIndex*/ ctx[2], false);
    			set_style(svg, "pointer-events", /*pointerEvents*/ ctx[3] === false ? 'none' : null, false);
    			add_location(svg, file$d, 24, 0, 782);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, svg, anchor);
    			append_dev(svg, defs);

    			if (defs_slot) {
    				defs_slot.m(defs, null);
    			}

    			append_dev(svg, g);

    			if (default_slot) {
    				default_slot.m(g, null);
    			}

    			/*g_binding*/ ctx[13](g);
    			/*svg_binding*/ ctx[14](svg);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (defs_slot) {
    				if (defs_slot.p && (!current || dirty & /*$$scope, element*/ 2049)) {
    					update_slot_base(
    						defs_slot,
    						defs_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(defs_slot_template, /*$$scope*/ ctx[11], dirty, get_defs_slot_changes),
    						get_defs_slot_context
    					);
    				}
    			}

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope, element*/ 2049)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[11],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[11])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[11], dirty, get_default_slot_changes$1),
    						get_default_slot_context$1
    					);
    				}
    			}

    			if (!current || dirty & /*$padding*/ 128 && g_transform_value !== (g_transform_value = "translate(" + /*$padding*/ ctx[7].left + ", " + /*$padding*/ ctx[7].top + ")")) {
    				attr_dev(g, "transform", g_transform_value);
    			}

    			if (!current || dirty & /*viewBox*/ 16) {
    				attr_dev(svg, "viewBox", /*viewBox*/ ctx[4]);
    			}

    			if (!current || dirty & /*$containerWidth*/ 32) {
    				attr_dev(svg, "width", /*$containerWidth*/ ctx[5]);
    			}

    			if (!current || dirty & /*$containerHeight*/ 64) {
    				attr_dev(svg, "height", /*$containerHeight*/ ctx[6]);
    			}

    			if (dirty & /*zIndex*/ 4) {
    				set_style(svg, "z-index", /*zIndex*/ ctx[2], false);
    			}

    			if (dirty & /*pointerEvents*/ 8) {
    				set_style(svg, "pointer-events", /*pointerEvents*/ ctx[3] === false ? 'none' : null, false);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(defs_slot, local);
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(defs_slot, local);
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(svg);
    			if (defs_slot) defs_slot.d(detaching);
    			if (default_slot) default_slot.d(detaching);
    			/*g_binding*/ ctx[13](null);
    			/*svg_binding*/ ctx[14](null);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$e.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$o($$self, $$props, $$invalidate) {
    	let $containerWidth;
    	let $containerHeight;
    	let $padding;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Svg', slots, ['defs','default']);
    	let { element = undefined } = $$props;
    	let { innerElement = undefined } = $$props;
    	let { zIndex = undefined } = $$props;
    	let { pointerEvents = undefined } = $$props;
    	let { viewBox = undefined } = $$props;
    	const { containerWidth, containerHeight, padding } = getContext('LayerCake');
    	validate_store(containerWidth, 'containerWidth');
    	component_subscribe($$self, containerWidth, value => $$invalidate(5, $containerWidth = value));
    	validate_store(containerHeight, 'containerHeight');
    	component_subscribe($$self, containerHeight, value => $$invalidate(6, $containerHeight = value));
    	validate_store(padding, 'padding');
    	component_subscribe($$self, padding, value => $$invalidate(7, $padding = value));
    	const writable_props = ['element', 'innerElement', 'zIndex', 'pointerEvents', 'viewBox'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Svg> was created with unknown prop '${key}'`);
    	});

    	function g_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			innerElement = $$value;
    			$$invalidate(1, innerElement);
    		});
    	}

    	function svg_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(0, element);
    		});
    	}

    	$$self.$$set = $$props => {
    		if ('element' in $$props) $$invalidate(0, element = $$props.element);
    		if ('innerElement' in $$props) $$invalidate(1, innerElement = $$props.innerElement);
    		if ('zIndex' in $$props) $$invalidate(2, zIndex = $$props.zIndex);
    		if ('pointerEvents' in $$props) $$invalidate(3, pointerEvents = $$props.pointerEvents);
    		if ('viewBox' in $$props) $$invalidate(4, viewBox = $$props.viewBox);
    		if ('$$scope' in $$props) $$invalidate(11, $$scope = $$props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		element,
    		innerElement,
    		zIndex,
    		pointerEvents,
    		viewBox,
    		containerWidth,
    		containerHeight,
    		padding,
    		$containerWidth,
    		$containerHeight,
    		$padding
    	});

    	$$self.$inject_state = $$props => {
    		if ('element' in $$props) $$invalidate(0, element = $$props.element);
    		if ('innerElement' in $$props) $$invalidate(1, innerElement = $$props.innerElement);
    		if ('zIndex' in $$props) $$invalidate(2, zIndex = $$props.zIndex);
    		if ('pointerEvents' in $$props) $$invalidate(3, pointerEvents = $$props.pointerEvents);
    		if ('viewBox' in $$props) $$invalidate(4, viewBox = $$props.viewBox);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		element,
    		innerElement,
    		zIndex,
    		pointerEvents,
    		viewBox,
    		$containerWidth,
    		$containerHeight,
    		$padding,
    		containerWidth,
    		containerHeight,
    		padding,
    		$$scope,
    		slots,
    		g_binding,
    		svg_binding
    	];
    }

    class Svg extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$o, create_fragment$e, safe_not_equal, {
    			element: 0,
    			innerElement: 1,
    			zIndex: 2,
    			pointerEvents: 3,
    			viewBox: 4
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Svg",
    			options,
    			id: create_fragment$e.name
    		});
    	}

    	get element() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set element(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get innerElement() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set innerElement(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get zIndex() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set zIndex(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get pointerEvents() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set pointerEvents(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get viewBox() {
    		throw new Error("<Svg>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set viewBox(value) {
    		throw new Error("<Svg>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    function tree_add(d) {
      const x = +this._x.call(null, d),
          y = +this._y.call(null, d);
      return add(this.cover(x, y), x, y, d);
    }

    function add(tree, x, y, d) {
      if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points

      var parent,
          node = tree._root,
          leaf = {data: d},
          x0 = tree._x0,
          y0 = tree._y0,
          x1 = tree._x1,
          y1 = tree._y1,
          xm,
          ym,
          xp,
          yp,
          right,
          bottom,
          i,
          j;

      // If the tree is empty, initialize the root as a leaf.
      if (!node) return tree._root = leaf, tree;

      // Find the existing leaf for the new point, or add it.
      while (node.length) {
        if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
        if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
        if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
      }

      // Is the new point is exactly coincident with the existing point?
      xp = +tree._x.call(null, node.data);
      yp = +tree._y.call(null, node.data);
      if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;

      // Otherwise, split the leaf node until the old and new point are separated.
      do {
        parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
        if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
        if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
      } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));
      return parent[j] = node, parent[i] = leaf, tree;
    }

    function addAll(data) {
      var d, i, n = data.length,
          x,
          y,
          xz = new Array(n),
          yz = new Array(n),
          x0 = Infinity,
          y0 = Infinity,
          x1 = -Infinity,
          y1 = -Infinity;

      // Compute the points and their extent.
      for (i = 0; i < n; ++i) {
        if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
        xz[i] = x;
        yz[i] = y;
        if (x < x0) x0 = x;
        if (x > x1) x1 = x;
        if (y < y0) y0 = y;
        if (y > y1) y1 = y;
      }

      // If there were no (valid) points, abort.
      if (x0 > x1 || y0 > y1) return this;

      // Expand the tree to cover the new points.
      this.cover(x0, y0).cover(x1, y1);

      // Add the new points.
      for (i = 0; i < n; ++i) {
        add(this, xz[i], yz[i], data[i]);
      }

      return this;
    }

    function tree_cover(x, y) {
      if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points

      var x0 = this._x0,
          y0 = this._y0,
          x1 = this._x1,
          y1 = this._y1;

      // If the quadtree has no extent, initialize them.
      // Integer extent are necessary so that if we later double the extent,
      // the existing quadrant boundaries don’t change due to floating point error!
      if (isNaN(x0)) {
        x1 = (x0 = Math.floor(x)) + 1;
        y1 = (y0 = Math.floor(y)) + 1;
      }

      // Otherwise, double repeatedly to cover.
      else {
        var z = x1 - x0 || 1,
            node = this._root,
            parent,
            i;

        while (x0 > x || x >= x1 || y0 > y || y >= y1) {
          i = (y < y0) << 1 | (x < x0);
          parent = new Array(4), parent[i] = node, node = parent, z *= 2;
          switch (i) {
            case 0: x1 = x0 + z, y1 = y0 + z; break;
            case 1: x0 = x1 - z, y1 = y0 + z; break;
            case 2: x1 = x0 + z, y0 = y1 - z; break;
            case 3: x0 = x1 - z, y0 = y1 - z; break;
          }
        }

        if (this._root && this._root.length) this._root = node;
      }

      this._x0 = x0;
      this._y0 = y0;
      this._x1 = x1;
      this._y1 = y1;
      return this;
    }

    function tree_data() {
      var data = [];
      this.visit(function(node) {
        if (!node.length) do data.push(node.data); while (node = node.next)
      });
      return data;
    }

    function tree_extent(_) {
      return arguments.length
          ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
          : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
    }

    function Quad(node, x0, y0, x1, y1) {
      this.node = node;
      this.x0 = x0;
      this.y0 = y0;
      this.x1 = x1;
      this.y1 = y1;
    }

    function tree_find(x, y, radius) {
      var data,
          x0 = this._x0,
          y0 = this._y0,
          x1,
          y1,
          x2,
          y2,
          x3 = this._x1,
          y3 = this._y1,
          quads = [],
          node = this._root,
          q,
          i;

      if (node) quads.push(new Quad(node, x0, y0, x3, y3));
      if (radius == null) radius = Infinity;
      else {
        x0 = x - radius, y0 = y - radius;
        x3 = x + radius, y3 = y + radius;
        radius *= radius;
      }

      while (q = quads.pop()) {

        // Stop searching if this quadrant can’t contain a closer node.
        if (!(node = q.node)
            || (x1 = q.x0) > x3
            || (y1 = q.y0) > y3
            || (x2 = q.x1) < x0
            || (y2 = q.y1) < y0) continue;

        // Bisect the current quadrant.
        if (node.length) {
          var xm = (x1 + x2) / 2,
              ym = (y1 + y2) / 2;

          quads.push(
            new Quad(node[3], xm, ym, x2, y2),
            new Quad(node[2], x1, ym, xm, y2),
            new Quad(node[1], xm, y1, x2, ym),
            new Quad(node[0], x1, y1, xm, ym)
          );

          // Visit the closest quadrant first.
          if (i = (y >= ym) << 1 | (x >= xm)) {
            q = quads[quads.length - 1];
            quads[quads.length - 1] = quads[quads.length - 1 - i];
            quads[quads.length - 1 - i] = q;
          }
        }

        // Visit this point. (Visiting coincident points isn’t necessary!)
        else {
          var dx = x - +this._x.call(null, node.data),
              dy = y - +this._y.call(null, node.data),
              d2 = dx * dx + dy * dy;
          if (d2 < radius) {
            var d = Math.sqrt(radius = d2);
            x0 = x - d, y0 = y - d;
            x3 = x + d, y3 = y + d;
            data = node.data;
          }
        }
      }

      return data;
    }

    function tree_remove(d) {
      if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points

      var parent,
          node = this._root,
          retainer,
          previous,
          next,
          x0 = this._x0,
          y0 = this._y0,
          x1 = this._x1,
          y1 = this._y1,
          x,
          y,
          xm,
          ym,
          right,
          bottom,
          i,
          j;

      // If the tree is empty, initialize the root as a leaf.
      if (!node) return this;

      // Find the leaf node for the point.
      // While descending, also retain the deepest parent with a non-removed sibling.
      if (node.length) while (true) {
        if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
        if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
        if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
        if (!node.length) break;
        if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;
      }

      // Find the point to remove.
      while (node.data !== d) if (!(previous = node, node = node.next)) return this;
      if (next = node.next) delete node.next;

      // If there are multiple coincident points, remove just the point.
      if (previous) return (next ? previous.next = next : delete previous.next), this;

      // If this is the root point, remove it.
      if (!parent) return this._root = next, this;

      // Remove this leaf.
      next ? parent[i] = next : delete parent[i];

      // If the parent now contains exactly one leaf, collapse superfluous parents.
      if ((node = parent[0] || parent[1] || parent[2] || parent[3])
          && node === (parent[3] || parent[2] || parent[1] || parent[0])
          && !node.length) {
        if (retainer) retainer[j] = node;
        else this._root = node;
      }

      return this;
    }

    function removeAll(data) {
      for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
      return this;
    }

    function tree_root() {
      return this._root;
    }

    function tree_size() {
      var size = 0;
      this.visit(function(node) {
        if (!node.length) do ++size; while (node = node.next)
      });
      return size;
    }

    function tree_visit(callback) {
      var quads = [], q, node = this._root, child, x0, y0, x1, y1;
      if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));
      while (q = quads.pop()) {
        if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
          var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
          if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
          if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
          if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
          if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
        }
      }
      return this;
    }

    function tree_visitAfter(callback) {
      var quads = [], next = [], q;
      if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
      while (q = quads.pop()) {
        var node = q.node;
        if (node.length) {
          var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
          if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
          if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
          if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
          if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
        }
        next.push(q);
      }
      while (q = next.pop()) {
        callback(q.node, q.x0, q.y0, q.x1, q.y1);
      }
      return this;
    }

    function defaultX(d) {
      return d[0];
    }

    function tree_x(_) {
      return arguments.length ? (this._x = _, this) : this._x;
    }

    function defaultY(d) {
      return d[1];
    }

    function tree_y(_) {
      return arguments.length ? (this._y = _, this) : this._y;
    }

    function quadtree(nodes, x, y) {
      var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
      return nodes == null ? tree : tree.addAll(nodes);
    }

    function Quadtree(x, y, x0, y0, x1, y1) {
      this._x = x;
      this._y = y;
      this._x0 = x0;
      this._y0 = y0;
      this._x1 = x1;
      this._y1 = y1;
      this._root = undefined;
    }

    function leaf_copy(leaf) {
      var copy = {data: leaf.data}, next = copy;
      while (leaf = leaf.next) next = next.next = {data: leaf.data};
      return copy;
    }

    var treeProto = quadtree.prototype = Quadtree.prototype;

    treeProto.copy = function() {
      var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
          node = this._root,
          nodes,
          child;

      if (!node) return copy;

      if (!node.length) return copy._root = leaf_copy(node), copy;

      nodes = [{source: node, target: copy._root = new Array(4)}];
      while (node = nodes.pop()) {
        for (var i = 0; i < 4; ++i) {
          if (child = node.source[i]) {
            if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});
            else node.target[i] = leaf_copy(child);
          }
        }
      }

      return copy;
    };

    treeProto.add = tree_add;
    treeProto.addAll = addAll;
    treeProto.cover = tree_cover;
    treeProto.data = tree_data;
    treeProto.extent = tree_extent;
    treeProto.find = tree_find;
    treeProto.remove = tree_remove;
    treeProto.removeAll = removeAll;
    treeProto.root = tree_root;
    treeProto.size = tree_size;
    treeProto.visit = tree_visit;
    treeProto.visitAfter = tree_visitAfter;
    treeProto.x = tree_x;
    treeProto.y = tree_y;

    function constant(x) {
      return function() {
        return x;
      };
    }

    function jiggle(random) {
      return (random() - 0.5) * 1e-6;
    }

    function x(d) {
      return d.x + d.vx;
    }

    function y(d) {
      return d.y + d.vy;
    }

    function forceCollide(radius) {
      var nodes,
          radii,
          random,
          strength = 1,
          iterations = 1;

      if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius);

      function force() {
        var i, n = nodes.length,
            tree,
            node,
            xi,
            yi,
            ri,
            ri2;

        for (var k = 0; k < iterations; ++k) {
          tree = quadtree(nodes, x, y).visitAfter(prepare);
          for (i = 0; i < n; ++i) {
            node = nodes[i];
            ri = radii[node.index], ri2 = ri * ri;
            xi = node.x + node.vx;
            yi = node.y + node.vy;
            tree.visit(apply);
          }
        }

        function apply(quad, x0, y0, x1, y1) {
          var data = quad.data, rj = quad.r, r = ri + rj;
          if (data) {
            if (data.index > node.index) {
              var x = xi - data.x - data.vx,
                  y = yi - data.y - data.vy,
                  l = x * x + y * y;
              if (l < r * r) {
                if (x === 0) x = jiggle(random), l += x * x;
                if (y === 0) y = jiggle(random), l += y * y;
                l = (r - (l = Math.sqrt(l))) / l * strength;
                node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
                node.vy += (y *= l) * r;
                data.vx -= x * (r = 1 - r);
                data.vy -= y * r;
              }
            }
            return;
          }
          return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
        }
      }

      function prepare(quad) {
        if (quad.data) return quad.r = radii[quad.data.index];
        for (var i = quad.r = 0; i < 4; ++i) {
          if (quad[i] && quad[i].r > quad.r) {
            quad.r = quad[i].r;
          }
        }
      }

      function initialize() {
        if (!nodes) return;
        var i, n = nodes.length, node;
        radii = new Array(n);
        for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
      }

      force.initialize = function(_nodes, _random) {
        nodes = _nodes;
        random = _random;
        initialize();
      };

      force.iterations = function(_) {
        return arguments.length ? (iterations = +_, force) : iterations;
      };

      force.strength = function(_) {
        return arguments.length ? (strength = +_, force) : strength;
      };

      force.radius = function(_) {
        return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius;
      };

      return force;
    }

    var noop$1 = {value: () => {}};

    function dispatch() {
      for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
        if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
        _[t] = [];
      }
      return new Dispatch(_);
    }

    function Dispatch(_) {
      this._ = _;
    }

    function parseTypenames(typenames, types) {
      return typenames.trim().split(/^|\s+/).map(function(t) {
        var name = "", i = t.indexOf(".");
        if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
        if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
        return {type: t, name: name};
      });
    }

    Dispatch.prototype = dispatch.prototype = {
      constructor: Dispatch,
      on: function(typename, callback) {
        var _ = this._,
            T = parseTypenames(typename + "", _),
            t,
            i = -1,
            n = T.length;

        // If no callback was specified, return the callback of the given type and name.
        if (arguments.length < 2) {
          while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
          return;
        }

        // If a type was specified, set the callback for the given type and name.
        // Otherwise, if a null callback was specified, remove callbacks of the given name.
        if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
        while (++i < n) {
          if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
          else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
        }

        return this;
      },
      copy: function() {
        var copy = {}, _ = this._;
        for (var t in _) copy[t] = _[t].slice();
        return new Dispatch(copy);
      },
      call: function(type, that) {
        if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
        if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
        for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
      },
      apply: function(type, that, args) {
        if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
        for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
      }
    };

    function get$1(type, name) {
      for (var i = 0, n = type.length, c; i < n; ++i) {
        if ((c = type[i]).name === name) {
          return c.value;
        }
      }
    }

    function set(type, name, callback) {
      for (var i = 0, n = type.length; i < n; ++i) {
        if (type[i].name === name) {
          type[i] = noop$1, type = type.slice(0, i).concat(type.slice(i + 1));
          break;
        }
      }
      if (callback != null) type.push({name: name, value: callback});
      return type;
    }

    var frame = 0, // is an animation frame pending?
        timeout = 0, // is a timeout pending?
        interval = 0, // are any timers active?
        pokeDelay = 1000, // how frequently we check for clock skew
        taskHead,
        taskTail,
        clockLast = 0,
        clockNow = 0,
        clockSkew = 0,
        clock = typeof performance === "object" && performance.now ? performance : Date,
        setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };

    function now() {
      return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
    }

    function clearNow() {
      clockNow = 0;
    }

    function Timer() {
      this._call =
      this._time =
      this._next = null;
    }

    Timer.prototype = timer.prototype = {
      constructor: Timer,
      restart: function(callback, delay, time) {
        if (typeof callback !== "function") throw new TypeError("callback is not a function");
        time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
        if (!this._next && taskTail !== this) {
          if (taskTail) taskTail._next = this;
          else taskHead = this;
          taskTail = this;
        }
        this._call = callback;
        this._time = time;
        sleep();
      },
      stop: function() {
        if (this._call) {
          this._call = null;
          this._time = Infinity;
          sleep();
        }
      }
    };

    function timer(callback, delay, time) {
      var t = new Timer;
      t.restart(callback, delay, time);
      return t;
    }

    function timerFlush() {
      now(); // Get the current time, if not already set.
      ++frame; // Pretend we’ve set an alarm, if we haven’t already.
      var t = taskHead, e;
      while (t) {
        if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
        t = t._next;
      }
      --frame;
    }

    function wake() {
      clockNow = (clockLast = clock.now()) + clockSkew;
      frame = timeout = 0;
      try {
        timerFlush();
      } finally {
        frame = 0;
        nap();
        clockNow = 0;
      }
    }

    function poke() {
      var now = clock.now(), delay = now - clockLast;
      if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
    }

    function nap() {
      var t0, t1 = taskHead, t2, time = Infinity;
      while (t1) {
        if (t1._call) {
          if (time > t1._time) time = t1._time;
          t0 = t1, t1 = t1._next;
        } else {
          t2 = t1._next, t1._next = null;
          t1 = t0 ? t0._next = t2 : taskHead = t2;
        }
      }
      taskTail = t0;
      sleep(time);
    }

    function sleep(time) {
      if (frame) return; // Soonest alarm already set, or will be.
      if (timeout) timeout = clearTimeout(timeout);
      var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
      if (delay > 24) {
        if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
        if (interval) interval = clearInterval(interval);
      } else {
        if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
        frame = 1, setFrame(wake);
      }
    }

    // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
    const a = 1664525;
    const c = 1013904223;
    const m = 4294967296; // 2^32

    function lcg$1() {
      let s = 1;
      return () => (s = (a * s + c) % m) / m;
    }

    var initialRadius = 10,
        initialAngle = Math.PI * (3 - Math.sqrt(5));

    function forceSimulation(nodes) {
      var simulation,
          alpha = 1,
          alphaMin = 0.001,
          alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
          alphaTarget = 0,
          velocityDecay = 0.6,
          forces = new Map(),
          stepper = timer(step),
          event = dispatch("tick", "end"),
          random = lcg$1();

      if (nodes == null) nodes = [];

      function step() {
        tick();
        event.call("tick", simulation);
        if (alpha < alphaMin) {
          stepper.stop();
          event.call("end", simulation);
        }
      }

      function tick(iterations) {
        var i, n = nodes.length, node;

        if (iterations === undefined) iterations = 1;

        for (var k = 0; k < iterations; ++k) {
          alpha += (alphaTarget - alpha) * alphaDecay;

          forces.forEach(function(force) {
            force(alpha);
          });

          for (i = 0; i < n; ++i) {
            node = nodes[i];
            if (node.fx == null) node.x += node.vx *= velocityDecay;
            else node.x = node.fx, node.vx = 0;
            if (node.fy == null) node.y += node.vy *= velocityDecay;
            else node.y = node.fy, node.vy = 0;
          }
        }

        return simulation;
      }

      function initializeNodes() {
        for (var i = 0, n = nodes.length, node; i < n; ++i) {
          node = nodes[i], node.index = i;
          if (node.fx != null) node.x = node.fx;
          if (node.fy != null) node.y = node.fy;
          if (isNaN(node.x) || isNaN(node.y)) {
            var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;
            node.x = radius * Math.cos(angle);
            node.y = radius * Math.sin(angle);
          }
          if (isNaN(node.vx) || isNaN(node.vy)) {
            node.vx = node.vy = 0;
          }
        }
      }

      function initializeForce(force) {
        if (force.initialize) force.initialize(nodes, random);
        return force;
      }

      initializeNodes();

      return simulation = {
        tick: tick,

        restart: function() {
          return stepper.restart(step), simulation;
        },

        stop: function() {
          return stepper.stop(), simulation;
        },

        nodes: function(_) {
          return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
        },

        alpha: function(_) {
          return arguments.length ? (alpha = +_, simulation) : alpha;
        },

        alphaMin: function(_) {
          return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
        },

        alphaDecay: function(_) {
          return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
        },

        alphaTarget: function(_) {
          return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
        },

        velocityDecay: function(_) {
          return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
        },

        randomSource: function(_) {
          return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
        },

        force: function(name, _) {
          return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
        },

        find: function(x, y, radius) {
          var i = 0,
              n = nodes.length,
              dx,
              dy,
              d2,
              node,
              closest;

          if (radius == null) radius = Infinity;
          else radius *= radius;

          for (i = 0; i < n; ++i) {
            node = nodes[i];
            dx = x - node.x;
            dy = y - node.y;
            d2 = dx * dx + dy * dy;
            if (d2 < radius) closest = node, radius = d2;
          }

          return closest;
        },

        on: function(name, _) {
          return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
        }
      };
    }

    function forceX(x) {
      var strength = constant(0.1),
          nodes,
          strengths,
          xz;

      if (typeof x !== "function") x = constant(x == null ? 0 : +x);

      function force(alpha) {
        for (var i = 0, n = nodes.length, node; i < n; ++i) {
          node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
        }
      }

      function initialize() {
        if (!nodes) return;
        var i, n = nodes.length;
        strengths = new Array(n);
        xz = new Array(n);
        for (i = 0; i < n; ++i) {
          strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
        }
      }

      force.initialize = function(_) {
        nodes = _;
        initialize();
      };

      force.strength = function(_) {
        return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
      };

      force.x = function(_) {
        return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x;
      };

      return force;
    }

    function forceY(y) {
      var strength = constant(0.1),
          nodes,
          strengths,
          yz;

      if (typeof y !== "function") y = constant(y == null ? 0 : +y);

      function force(alpha) {
        for (var i = 0, n = nodes.length, node; i < n; ++i) {
          node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
        }
      }

      function initialize() {
        if (!nodes) return;
        var i, n = nodes.length;
        strengths = new Array(n);
        yz = new Array(n);
        for (i = 0; i < n; ++i) {
          strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
        }
      }

      force.initialize = function(_) {
        nodes = _;
        initialize();
      };

      force.strength = function(_) {
        return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
      };

      force.y = function(_) {
        return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y;
      };

      return force;
    }

    /* src/LayerCakeComponents/BeeswarmForce.svelte generated by Svelte v3.46.4 */
    const file$c = "src/LayerCakeComponents/BeeswarmForce.svelte";

    function get_each_context$6(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[20] = list[i];
    	child_ctx[22] = i;
    	return child_ctx;
    }

    // (79:6) {#if getTitle}
    function create_if_block$9(ctx) {
    	let title;
    	let t_value = /*getTitle*/ ctx[2](/*node*/ ctx[20]) + "";
    	let t;

    	const block = {
    		c: function create() {
    			title = svg_element("title");
    			t = text(t_value);
    			add_location(title, file$c, 79, 8, 2298);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, title, anchor);
    			append_dev(title, t);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*getTitle, simulation*/ 12 && t_value !== (t_value = /*getTitle*/ ctx[2](/*node*/ ctx[20]) + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(title);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$9.name,
    		type: "if",
    		source: "(79:6) {#if getTitle}",
    		ctx
    	});

    	return block;
    }

    // (66:2) {#each simulation.nodes() as node, i}
    function create_each_block$6(ctx) {
    	let circle;
    	let circle_cx_value;
    	let circle_cy_value;
    	let circle_r_value;
    	let mounted;
    	let dispose;
    	let if_block = /*getTitle*/ ctx[2] && create_if_block$9(ctx);

    	function mouseover_handler(...args) {
    		return /*mouseover_handler*/ ctx[15](/*i*/ ctx[22], ...args);
    	}

    	function focus_handler(...args) {
    		return /*focus_handler*/ ctx[16](/*i*/ ctx[22], ...args);
    	}

    	const block = {
    		c: function create() {
    			circle = svg_element("circle");
    			if (if_block) if_block.c();
    			attr_dev(circle, "fill", "black");
    			attr_dev(circle, "stroke", /*stroke*/ ctx[1]);
    			attr_dev(circle, "stroke-width", /*strokeWidth*/ ctx[0]);
    			attr_dev(circle, "cx", circle_cx_value = /*node*/ ctx[20].x);
    			attr_dev(circle, "cy", circle_cy_value = /*node*/ ctx[20].y);
    			attr_dev(circle, "r", circle_r_value = /*$zGet*/ ctx[4](/*node*/ ctx[20]));
    			add_location(circle, file$c, 66, 4, 1888);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, circle, anchor);
    			if (if_block) if_block.m(circle, null);

    			if (!mounted) {
    				dispose = [
    					listen_dev(circle, "mouseover", mouseover_handler, false, false, false),
    					listen_dev(circle, "focus", focus_handler, false, false, false),
    					listen_dev(circle, "mouseout", /*mouseout_handler*/ ctx[17], false, false, false),
    					listen_dev(circle, "blur", /*blur_handler*/ ctx[18], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;

    			if (/*getTitle*/ ctx[2]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);
    				} else {
    					if_block = create_if_block$9(ctx);
    					if_block.c();
    					if_block.m(circle, null);
    				}
    			} else if (if_block) {
    				if_block.d(1);
    				if_block = null;
    			}

    			if (dirty & /*stroke*/ 2) {
    				attr_dev(circle, "stroke", /*stroke*/ ctx[1]);
    			}

    			if (dirty & /*strokeWidth*/ 1) {
    				attr_dev(circle, "stroke-width", /*strokeWidth*/ ctx[0]);
    			}

    			if (dirty & /*simulation*/ 8 && circle_cx_value !== (circle_cx_value = /*node*/ ctx[20].x)) {
    				attr_dev(circle, "cx", circle_cx_value);
    			}

    			if (dirty & /*simulation*/ 8 && circle_cy_value !== (circle_cy_value = /*node*/ ctx[20].y)) {
    				attr_dev(circle, "cy", circle_cy_value);
    			}

    			if (dirty & /*$zGet, simulation*/ 24 && circle_r_value !== (circle_r_value = /*$zGet*/ ctx[4](/*node*/ ctx[20]))) {
    				attr_dev(circle, "r", circle_r_value);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(circle);
    			if (if_block) if_block.d();
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$6.name,
    		type: "each",
    		source: "(66:2) {#each simulation.nodes() as node, i}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$d(ctx) {
    	let g;
    	let each_value = /*simulation*/ ctx[3].nodes();
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$6(get_each_context$6(ctx, each_value, i));
    	}

    	const block = {
    		c: function create() {
    			g = svg_element("g");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			attr_dev(g, "class", "bee-group");
    			add_location(g, file$c, 64, 0, 1822);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, g, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(g, null);
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (dirty & /*stroke, strokeWidth, simulation, $zGet, dispatch, $data, getTitle*/ 1087) {
    				each_value = /*simulation*/ ctx[3].nodes();
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$6(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    					} else {
    						each_blocks[i] = create_each_block$6(child_ctx);
    						each_blocks[i].c();
    						each_blocks[i].m(g, null);
    					}
    				}

    				for (; i < each_blocks.length; i += 1) {
    					each_blocks[i].d(1);
    				}

    				each_blocks.length = each_value.length;
    			}
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(g);
    			destroy_each(each_blocks, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$d.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$n($$self, $$props, $$invalidate) {
    	let simulation;
    	let $zGet;
    	let $height;
    	let $xGet;
    	let $data;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('BeeswarmForce', slots, []);
    	const { data, xGet, zGet, height } = getContext("LayerCake");
    	validate_store(data, 'data');
    	component_subscribe($$self, data, value => $$invalidate(5, $data = value));
    	validate_store(xGet, 'xGet');
    	component_subscribe($$self, xGet, value => $$invalidate(14, $xGet = value));
    	validate_store(zGet, 'zGet');
    	component_subscribe($$self, zGet, value => $$invalidate(4, $zGet = value));
    	validate_store(height, 'height');
    	component_subscribe($$self, height, value => $$invalidate(13, $height = value));
    	const nodes = $data.map(d => ({ ...d }));
    	let { strokeWidth = 1 } = $$props;
    	let { stroke = "#fff" } = $$props;
    	let { xStrength = 0.95 } = $$props;
    	let { yStrength = 0.075 } = $$props;
    	let { getTitle = undefined } = $$props;
    	const dispatch = createEventDispatcher();
    	const writable_props = ['strokeWidth', 'stroke', 'xStrength', 'yStrength', 'getTitle'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<BeeswarmForce> was created with unknown prop '${key}'`);
    	});

    	const mouseover_handler = (i, e) => dispatch("mousemove", { e, props: $data[i] });
    	const focus_handler = (i, e) => dispatch("mousemove", { e, props: $data[i] });
    	const mouseout_handler = () => dispatch("mouseout", {});
    	const blur_handler = () => dispatch("mouseout", {});

    	$$self.$$set = $$props => {
    		if ('strokeWidth' in $$props) $$invalidate(0, strokeWidth = $$props.strokeWidth);
    		if ('stroke' in $$props) $$invalidate(1, stroke = $$props.stroke);
    		if ('xStrength' in $$props) $$invalidate(11, xStrength = $$props.xStrength);
    		if ('yStrength' in $$props) $$invalidate(12, yStrength = $$props.yStrength);
    		if ('getTitle' in $$props) $$invalidate(2, getTitle = $$props.getTitle);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		forceSimulation,
    		forceX,
    		forceY,
    		forceCollide,
    		createEventDispatcher,
    		data,
    		xGet,
    		zGet,
    		height,
    		nodes,
    		strokeWidth,
    		stroke,
    		xStrength,
    		yStrength,
    		getTitle,
    		dispatch,
    		simulation,
    		$zGet,
    		$height,
    		$xGet,
    		$data
    	});

    	$$self.$inject_state = $$props => {
    		if ('strokeWidth' in $$props) $$invalidate(0, strokeWidth = $$props.strokeWidth);
    		if ('stroke' in $$props) $$invalidate(1, stroke = $$props.stroke);
    		if ('xStrength' in $$props) $$invalidate(11, xStrength = $$props.xStrength);
    		if ('yStrength' in $$props) $$invalidate(12, yStrength = $$props.yStrength);
    		if ('getTitle' in $$props) $$invalidate(2, getTitle = $$props.getTitle);
    		if ('simulation' in $$props) $$invalidate(3, simulation = $$props.simulation);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*$xGet, xStrength, $height, yStrength, $zGet*/ 30736) {
    			$$invalidate(3, simulation = forceSimulation(nodes).force("x", forceX().x(d => $xGet(d)).strength(xStrength)).force("y", forceY().y($height / 2).strength(yStrength)).force("collide", forceCollide().radius(d => $zGet(d))).stop());
    		}

    		if ($$self.$$.dirty & /*simulation*/ 8) {
    			{
    				for (let i = 0,
    					n = Math.ceil(Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())); i < n; ++i) {
    					simulation.tick();
    				}
    			}
    		}
    	};

    	return [
    		strokeWidth,
    		stroke,
    		getTitle,
    		simulation,
    		$zGet,
    		$data,
    		data,
    		xGet,
    		zGet,
    		height,
    		dispatch,
    		xStrength,
    		yStrength,
    		$height,
    		$xGet,
    		mouseover_handler,
    		focus_handler,
    		mouseout_handler,
    		blur_handler
    	];
    }

    class BeeswarmForce extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$n, create_fragment$d, safe_not_equal, {
    			strokeWidth: 0,
    			stroke: 1,
    			xStrength: 11,
    			yStrength: 12,
    			getTitle: 2
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "BeeswarmForce",
    			options,
    			id: create_fragment$d.name
    		});
    	}

    	get strokeWidth() {
    		throw new Error("<BeeswarmForce>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set strokeWidth(value) {
    		throw new Error("<BeeswarmForce>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get stroke() {
    		throw new Error("<BeeswarmForce>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set stroke(value) {
    		throw new Error("<BeeswarmForce>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xStrength() {
    		throw new Error("<BeeswarmForce>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xStrength(value) {
    		throw new Error("<BeeswarmForce>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yStrength() {
    		throw new Error("<BeeswarmForce>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yStrength(value) {
    		throw new Error("<BeeswarmForce>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getTitle() {
    		throw new Error("<BeeswarmForce>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set getTitle(value) {
    		throw new Error("<BeeswarmForce>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/LayerCakeComponents/AxisX.svelte generated by Svelte v3.46.4 */
    const file$b = "src/LayerCakeComponents/AxisX.svelte";

    function get_each_context$5(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[19] = list[i];
    	child_ctx[21] = i;
    	return child_ctx;
    }

    // (64:6) {#if gridlines !== false}
    function create_if_block_2$3(ctx) {
    	let line;
    	let line_y__value;

    	const block = {
    		c: function create() {
    			line = svg_element("line");
    			attr_dev(line, "class", "gridline svelte-wr6453");
    			attr_dev(line, "y1", line_y__value = /*$height*/ ctx[11] * -1);
    			attr_dev(line, "y2", "0");
    			attr_dev(line, "x1", "0");
    			attr_dev(line, "x2", "0");
    			add_location(line, file$b, 64, 8, 2358);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, line, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*$height*/ 2048 && line_y__value !== (line_y__value = /*$height*/ ctx[11] * -1)) {
    				attr_dev(line, "y1", line_y__value);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(line);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_2$3.name,
    		type: "if",
    		source: "(64:6) {#if gridlines !== false}",
    		ctx
    	});

    	return block;
    }

    // (67:6) {#if tickMarks === true}
    function create_if_block_1$4(ctx) {
    	let line;
    	let line_x__value;
    	let line_x__value_1;

    	const block = {
    		c: function create() {
    			line = svg_element("line");
    			attr_dev(line, "class", "tick-mark svelte-wr6453");
    			attr_dev(line, "y1", 0);
    			attr_dev(line, "y2", 6);

    			attr_dev(line, "x1", line_x__value = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0);

    			attr_dev(line, "x2", line_x__value_1 = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0);

    			add_location(line, file$b, 67, 8, 2474);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, line, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*xTick, isBandwidth, $xScale*/ 416 && line_x__value !== (line_x__value = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0)) {
    				attr_dev(line, "x1", line_x__value);
    			}

    			if (dirty & /*xTick, isBandwidth, $xScale*/ 416 && line_x__value_1 !== (line_x__value_1 = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0)) {
    				attr_dev(line, "x2", line_x__value_1);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(line);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$4.name,
    		type: "if",
    		source: "(67:6) {#if tickMarks === true}",
    		ctx
    	});

    	return block;
    }

    // (59:2) {#each tickVals as tick, i}
    function create_each_block$5(ctx) {
    	let g;
    	let if_block0_anchor;
    	let text_1;
    	let t_value = /*formatTick*/ ctx[4](/*tick*/ ctx[19]) + "";
    	let t;
    	let text_1_x_value;
    	let g_transform_value;
    	let if_block0 = /*gridlines*/ ctx[0] !== false && create_if_block_2$3(ctx);
    	let if_block1 = /*tickMarks*/ ctx[1] === true && create_if_block_1$4(ctx);

    	const block = {
    		c: function create() {
    			g = svg_element("g");
    			if (if_block0) if_block0.c();
    			if_block0_anchor = empty$2();
    			if (if_block1) if_block1.c();
    			text_1 = svg_element("text");
    			t = text(t_value);

    			attr_dev(text_1, "x", text_1_x_value = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0);

    			attr_dev(text_1, "y", /*yTick*/ ctx[6]);
    			attr_dev(text_1, "dx", "");
    			attr_dev(text_1, "dy", "");
    			attr_dev(text_1, "text-anchor", /*textAnchor*/ ctx[17](/*i*/ ctx[21]));
    			attr_dev(text_1, "class", "svelte-wr6453");
    			add_location(text_1, file$b, 75, 6, 2703);
    			attr_dev(g, "class", "tick tick-" + /*i*/ ctx[21] + " svelte-wr6453");
    			attr_dev(g, "transform", g_transform_value = "translate(" + /*$xScale*/ ctx[8](/*tick*/ ctx[19]) + "," + /*$yRange*/ ctx[10][0] + ")");
    			add_location(g, file$b, 59, 4, 2223);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, g, anchor);
    			if (if_block0) if_block0.m(g, null);
    			append_dev(g, if_block0_anchor);
    			if (if_block1) if_block1.m(g, null);
    			append_dev(g, text_1);
    			append_dev(text_1, t);
    		},
    		p: function update(ctx, dirty) {
    			if (/*gridlines*/ ctx[0] !== false) {
    				if (if_block0) {
    					if_block0.p(ctx, dirty);
    				} else {
    					if_block0 = create_if_block_2$3(ctx);
    					if_block0.c();
    					if_block0.m(g, if_block0_anchor);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (/*tickMarks*/ ctx[1] === true) {
    				if (if_block1) {
    					if_block1.p(ctx, dirty);
    				} else {
    					if_block1 = create_if_block_1$4(ctx);
    					if_block1.c();
    					if_block1.m(g, text_1);
    				}
    			} else if (if_block1) {
    				if_block1.d(1);
    				if_block1 = null;
    			}

    			if (dirty & /*formatTick, tickVals*/ 528 && t_value !== (t_value = /*formatTick*/ ctx[4](/*tick*/ ctx[19]) + "")) set_data_dev(t, t_value);

    			if (dirty & /*xTick, isBandwidth, $xScale*/ 416 && text_1_x_value !== (text_1_x_value = /*xTick*/ ctx[5] || /*isBandwidth*/ ctx[7]
    			? /*$xScale*/ ctx[8].bandwidth() / 2
    			: 0)) {
    				attr_dev(text_1, "x", text_1_x_value);
    			}

    			if (dirty & /*yTick*/ 64) {
    				attr_dev(text_1, "y", /*yTick*/ ctx[6]);
    			}

    			if (dirty & /*$xScale, tickVals, $yRange*/ 1792 && g_transform_value !== (g_transform_value = "translate(" + /*$xScale*/ ctx[8](/*tick*/ ctx[19]) + "," + /*$yRange*/ ctx[10][0] + ")")) {
    				attr_dev(g, "transform", g_transform_value);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(g);
    			if (if_block0) if_block0.d();
    			if (if_block1) if_block1.d();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$5.name,
    		type: "each",
    		source: "(59:2) {#each tickVals as tick, i}",
    		ctx
    	});

    	return block;
    }

    // (85:2) {#if baseline === true}
    function create_if_block$8(ctx) {
    	let line;
    	let line_y__value;
    	let line_y__value_1;

    	const block = {
    		c: function create() {
    			line = svg_element("line");
    			attr_dev(line, "class", "baseline svelte-wr6453");
    			attr_dev(line, "y1", line_y__value = parseFloat(/*$height*/ ctx[11]) + 0.5);
    			attr_dev(line, "y2", line_y__value_1 = parseFloat(/*$height*/ ctx[11]) + 0.5);
    			attr_dev(line, "x1", "0");
    			attr_dev(line, "x2", /*$width*/ ctx[12]);
    			add_location(line, file$b, 85, 4, 2936);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, line, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*$height*/ 2048 && line_y__value !== (line_y__value = parseFloat(/*$height*/ ctx[11]) + 0.5)) {
    				attr_dev(line, "y1", line_y__value);
    			}

    			if (dirty & /*$height*/ 2048 && line_y__value_1 !== (line_y__value_1 = parseFloat(/*$height*/ ctx[11]) + 0.5)) {
    				attr_dev(line, "y2", line_y__value_1);
    			}

    			if (dirty & /*$width*/ 4096) {
    				attr_dev(line, "x2", /*$width*/ ctx[12]);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(line);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$8.name,
    		type: "if",
    		source: "(85:2) {#if baseline === true}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$c(ctx) {
    	let t;
    	let g;
    	let each_1_anchor;
    	let each_value = /*tickVals*/ ctx[9];
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$5(get_each_context$5(ctx, each_value, i));
    	}

    	let if_block = /*baseline*/ ctx[2] === true && create_if_block$8(ctx);

    	const block = {
    		c: function create() {
    			t = text("/** eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n");
    			g = svg_element("g");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    			if (if_block) if_block.c();
    			attr_dev(g, "class", "axis x-axis svelte-wr6453");
    			toggle_class(g, "snapTicks", /*snapTicks*/ ctx[3]);
    			add_location(g, file$b, 57, 0, 2149);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    			insert_dev(target, g, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(g, null);
    			}

    			append_dev(g, each_1_anchor);
    			if (if_block) if_block.m(g, null);
    		},
    		p: function update(ctx, [dirty]) {
    			if (dirty & /*$xScale, tickVals, $yRange, xTick, isBandwidth, yTick, textAnchor, formatTick, tickMarks, $height, gridlines*/ 135155) {
    				each_value = /*tickVals*/ ctx[9];
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$5(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    					} else {
    						each_blocks[i] = create_each_block$5(child_ctx);
    						each_blocks[i].c();
    						each_blocks[i].m(g, each_1_anchor);
    					}
    				}

    				for (; i < each_blocks.length; i += 1) {
    					each_blocks[i].d(1);
    				}

    				each_blocks.length = each_value.length;
    			}

    			if (/*baseline*/ ctx[2] === true) {
    				if (if_block) {
    					if_block.p(ctx, dirty);
    				} else {
    					if_block = create_if_block$8(ctx);
    					if_block.c();
    					if_block.m(g, null);
    				}
    			} else if (if_block) {
    				if_block.d(1);
    				if_block = null;
    			}

    			if (dirty & /*snapTicks*/ 8) {
    				toggle_class(g, "snapTicks", /*snapTicks*/ ctx[3]);
    			}
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(g);
    			destroy_each(each_blocks, detaching);
    			if (if_block) if_block.d();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$c.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$m($$self, $$props, $$invalidate) {
    	let isBandwidth;
    	let tickVals;
    	let $xScale;
    	let $yRange;
    	let $height;
    	let $width;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('AxisX', slots, []);
    	const { width, height, xScale, yRange } = getContext("LayerCake");
    	validate_store(width, 'width');
    	component_subscribe($$self, width, value => $$invalidate(12, $width = value));
    	validate_store(height, 'height');
    	component_subscribe($$self, height, value => $$invalidate(11, $height = value));
    	validate_store(xScale, 'xScale');
    	component_subscribe($$self, xScale, value => $$invalidate(8, $xScale = value));
    	validate_store(yRange, 'yRange');
    	component_subscribe($$self, yRange, value => $$invalidate(10, $yRange = value));
    	let { gridlines = true } = $$props;
    	let { tickMarks = false } = $$props;
    	let { baseline = false } = $$props;
    	let { snapTicks = false } = $$props;
    	let { formatTick = d => d } = $$props;
    	let { ticks = undefined } = $$props;
    	let { xTick = 0 } = $$props;
    	let { yTick = 16 } = $$props;

    	function textAnchor(i) {
    		if (snapTicks === true) {
    			if (i === 0) {
    				return "start";
    			}

    			if (i === tickVals.length - 1) {
    				return "end";
    			}
    		}

    		return "middle";
    	}

    	const writable_props = [
    		'gridlines',
    		'tickMarks',
    		'baseline',
    		'snapTicks',
    		'formatTick',
    		'ticks',
    		'xTick',
    		'yTick'
    	];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<AxisX> was created with unknown prop '${key}'`);
    	});

    	$$self.$$set = $$props => {
    		if ('gridlines' in $$props) $$invalidate(0, gridlines = $$props.gridlines);
    		if ('tickMarks' in $$props) $$invalidate(1, tickMarks = $$props.tickMarks);
    		if ('baseline' in $$props) $$invalidate(2, baseline = $$props.baseline);
    		if ('snapTicks' in $$props) $$invalidate(3, snapTicks = $$props.snapTicks);
    		if ('formatTick' in $$props) $$invalidate(4, formatTick = $$props.formatTick);
    		if ('ticks' in $$props) $$invalidate(18, ticks = $$props.ticks);
    		if ('xTick' in $$props) $$invalidate(5, xTick = $$props.xTick);
    		if ('yTick' in $$props) $$invalidate(6, yTick = $$props.yTick);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		width,
    		height,
    		xScale,
    		yRange,
    		gridlines,
    		tickMarks,
    		baseline,
    		snapTicks,
    		formatTick,
    		ticks,
    		xTick,
    		yTick,
    		textAnchor,
    		tickVals,
    		isBandwidth,
    		$xScale,
    		$yRange,
    		$height,
    		$width
    	});

    	$$self.$inject_state = $$props => {
    		if ('gridlines' in $$props) $$invalidate(0, gridlines = $$props.gridlines);
    		if ('tickMarks' in $$props) $$invalidate(1, tickMarks = $$props.tickMarks);
    		if ('baseline' in $$props) $$invalidate(2, baseline = $$props.baseline);
    		if ('snapTicks' in $$props) $$invalidate(3, snapTicks = $$props.snapTicks);
    		if ('formatTick' in $$props) $$invalidate(4, formatTick = $$props.formatTick);
    		if ('ticks' in $$props) $$invalidate(18, ticks = $$props.ticks);
    		if ('xTick' in $$props) $$invalidate(5, xTick = $$props.xTick);
    		if ('yTick' in $$props) $$invalidate(6, yTick = $$props.yTick);
    		if ('tickVals' in $$props) $$invalidate(9, tickVals = $$props.tickVals);
    		if ('isBandwidth' in $$props) $$invalidate(7, isBandwidth = $$props.isBandwidth);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*$xScale*/ 256) {
    			$$invalidate(7, isBandwidth = typeof $xScale.bandwidth === "function");
    		}

    		if ($$self.$$.dirty & /*ticks, isBandwidth, $xScale*/ 262528) {
    			$$invalidate(9, tickVals = Array.isArray(ticks)
    			? ticks
    			: isBandwidth
    				? $xScale.domain()
    				: typeof ticks === "function"
    					? ticks($xScale.ticks())
    					: $xScale.ticks(ticks));
    		}
    	};

    	return [
    		gridlines,
    		tickMarks,
    		baseline,
    		snapTicks,
    		formatTick,
    		xTick,
    		yTick,
    		isBandwidth,
    		$xScale,
    		tickVals,
    		$yRange,
    		$height,
    		$width,
    		width,
    		height,
    		xScale,
    		yRange,
    		textAnchor,
    		ticks
    	];
    }

    class AxisX extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$m, create_fragment$c, safe_not_equal, {
    			gridlines: 0,
    			tickMarks: 1,
    			baseline: 2,
    			snapTicks: 3,
    			formatTick: 4,
    			ticks: 18,
    			xTick: 5,
    			yTick: 6
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "AxisX",
    			options,
    			id: create_fragment$c.name
    		});
    	}

    	get gridlines() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set gridlines(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get tickMarks() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set tickMarks(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get baseline() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set baseline(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get snapTicks() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set snapTicks(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get formatTick() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set formatTick(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ticks() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ticks(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get xTick() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set xTick(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get yTick() {
    		throw new Error("<AxisX>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set yTick(value) {
    		throw new Error("<AxisX>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/LayerCakeComponents/Tooltip.svelte generated by Svelte v3.46.4 */

    const file$a = "src/LayerCakeComponents/Tooltip.svelte";
    const get_default_slot_changes = dirty => ({ detail: dirty & /*evt*/ 1 });
    const get_default_slot_context = ctx => ({ detail: /*evt*/ ctx[0].detail });

    // (13:0) {#if evt.detail}
    function create_if_block$7(ctx) {
    	let div;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[3].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], get_default_slot_context);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			attr_dev(div, "class", "tooltip svelte-1d48k8j");
    			set_style(div, "top", parseInt(/*evt*/ ctx[0].detail.e.layerY) + /*offset*/ ctx[1] + "px");
    			set_style(div, "left", /*evt*/ ctx[0].detail.e.layerX + "px");
    			add_location(div, file$a, 13, 2, 576);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope, evt*/ 5)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[2],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[2])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[2], dirty, get_default_slot_changes),
    						get_default_slot_context
    					);
    				}
    			}

    			if (!current || dirty & /*evt, offset*/ 3) {
    				set_style(div, "top", parseInt(/*evt*/ ctx[0].detail.e.layerY) + /*offset*/ ctx[1] + "px");
    			}

    			if (!current || dirty & /*evt*/ 1) {
    				set_style(div, "left", /*evt*/ ctx[0].detail.e.layerX + "px");
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$7.name,
    		type: "if",
    		source: "(13:0) {#if evt.detail}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$b(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*evt*/ ctx[0].detail && create_if_block$7(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (/*evt*/ ctx[0].detail) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*evt*/ 1) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$7(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$b.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$l($$self, $$props, $$invalidate) {
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Tooltip', slots, ['default']);
    	let { evt = {} } = $$props;
    	let { offset = -35 } = $$props;
    	const writable_props = ['evt', 'offset'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Tooltip> was created with unknown prop '${key}'`);
    	});

    	$$self.$$set = $$props => {
    		if ('evt' in $$props) $$invalidate(0, evt = $$props.evt);
    		if ('offset' in $$props) $$invalidate(1, offset = $$props.offset);
    		if ('$$scope' in $$props) $$invalidate(2, $$scope = $$props.$$scope);
    	};

    	$$self.$capture_state = () => ({ evt, offset });

    	$$self.$inject_state = $$props => {
    		if ('evt' in $$props) $$invalidate(0, evt = $$props.evt);
    		if ('offset' in $$props) $$invalidate(1, offset = $$props.offset);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [evt, offset, $$scope, slots];
    }

    class Tooltip extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$l, create_fragment$b, safe_not_equal, { evt: 0, offset: 1 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Tooltip",
    			options,
    			id: create_fragment$b.name
    		});
    	}

    	get evt() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set evt(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get offset() {
    		throw new Error("<Tooltip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set offset(value) {
    		throw new Error("<Tooltip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/LayerCakeComponents/Strip.svelte generated by Svelte v3.46.4 */
    const file$9 = "src/LayerCakeComponents/Strip.svelte";

    function get_each_context$4(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[16] = list[i];
    	child_ctx[18] = i;
    	return child_ctx;
    }

    // (15:2) {#each $data as d, i}
    function create_each_block$4(ctx) {
    	let rect;
    	let rect_x_value;
    	let rect_height_value;
    	let rect_fill_value;
    	let mounted;
    	let dispose;

    	function mouseover_handler(...args) {
    		return /*mouseover_handler*/ ctx[11](/*i*/ ctx[18], ...args);
    	}

    	function focus_handler(...args) {
    		return /*focus_handler*/ ctx[12](/*i*/ ctx[18], ...args);
    	}

    	function click_handler() {
    		return /*click_handler*/ ctx[15](/*d*/ ctx[16], /*i*/ ctx[18]);
    	}

    	const block = {
    		c: function create() {
    			rect = svg_element("rect");
    			attr_dev(rect, "x", rect_x_value = /*$xGet*/ ctx[3](/*d*/ ctx[16]));
    			attr_dev(rect, "y", 10);
    			attr_dev(rect, "width", /*strokeWidth*/ ctx[1]);
    			attr_dev(rect, "height", rect_height_value = /*$height*/ ctx[4] - 20);

    			attr_dev(rect, "fill", rect_fill_value = /*clicked*/ ctx[0][0] === /*$z*/ ctx[5](/*d*/ ctx[16])
    			? "red"
    			: /*clicked*/ ctx[0][1] === /*$z*/ ctx[5](/*d*/ ctx[16])
    				? "purple"
    				: "rgba(0, 0, 0, 0.5)");

    			add_location(rect, file$9, 15, 4, 501);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, rect, anchor);

    			if (!mounted) {
    				dispose = [
    					listen_dev(rect, "mouseover", mouseover_handler, false, false, false),
    					listen_dev(rect, "focus", focus_handler, false, false, false),
    					listen_dev(rect, "mouseout", /*mouseout_handler*/ ctx[13], false, false, false),
    					listen_dev(rect, "blur", /*blur_handler*/ ctx[14], false, false, false),
    					listen_dev(rect, "click", click_handler, false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;

    			if (dirty & /*$xGet, $data*/ 12 && rect_x_value !== (rect_x_value = /*$xGet*/ ctx[3](/*d*/ ctx[16]))) {
    				attr_dev(rect, "x", rect_x_value);
    			}

    			if (dirty & /*strokeWidth*/ 2) {
    				attr_dev(rect, "width", /*strokeWidth*/ ctx[1]);
    			}

    			if (dirty & /*$height*/ 16 && rect_height_value !== (rect_height_value = /*$height*/ ctx[4] - 20)) {
    				attr_dev(rect, "height", rect_height_value);
    			}

    			if (dirty & /*clicked, $z, $data*/ 37 && rect_fill_value !== (rect_fill_value = /*clicked*/ ctx[0][0] === /*$z*/ ctx[5](/*d*/ ctx[16])
    			? "red"
    			: /*clicked*/ ctx[0][1] === /*$z*/ ctx[5](/*d*/ ctx[16])
    				? "purple"
    				: "rgba(0, 0, 0, 0.5)")) {
    				attr_dev(rect, "fill", rect_fill_value);
    			}
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(rect);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$4.name,
    		type: "each",
    		source: "(15:2) {#each $data as d, i}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$a(ctx) {
    	let g;
    	let each_value = /*$data*/ ctx[2];
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i));
    	}

    	const block = {
    		c: function create() {
    			g = svg_element("g");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			attr_dev(g, "class", "bee-group");
    			add_location(g, file$9, 13, 0, 451);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, g, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(g, null);
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (dirty & /*$xGet, $data, strokeWidth, $height, clicked, $z, dispatch*/ 1087) {
    				each_value = /*$data*/ ctx[2];
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$4(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    					} else {
    						each_blocks[i] = create_each_block$4(child_ctx);
    						each_blocks[i].c();
    						each_blocks[i].m(g, null);
    					}
    				}

    				for (; i < each_blocks.length; i += 1) {
    					each_blocks[i].d(1);
    				}

    				each_blocks.length = each_value.length;
    			}
    		},
    		i: noop$2,
    		o: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(g);
    			destroy_each(each_blocks, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$a.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$k($$self, $$props, $$invalidate) {
    	let $data;
    	let $xGet;
    	let $height;
    	let $z;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Strip', slots, []);
    	const { data, xGet, z, height } = getContext("LayerCake");
    	validate_store(data, 'data');
    	component_subscribe($$self, data, value => $$invalidate(2, $data = value));
    	validate_store(xGet, 'xGet');
    	component_subscribe($$self, xGet, value => $$invalidate(3, $xGet = value));
    	validate_store(z, 'z');
    	component_subscribe($$self, z, value => $$invalidate(5, $z = value));
    	validate_store(height, 'height');
    	component_subscribe($$self, height, value => $$invalidate(4, $height = value));
    	let { strokeWidth = 5 } = $$props;
    	let { clicked = [] } = $$props;
    	const dispatch = createEventDispatcher();
    	const writable_props = ['strokeWidth', 'clicked'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Strip> was created with unknown prop '${key}'`);
    	});

    	const mouseover_handler = (i, e) => dispatch("mousemove", { e, props: $data[i] });
    	const focus_handler = (i, e) => dispatch("mousemove", { e, props: $data[i] });
    	const mouseout_handler = () => dispatch("mouseout", {});
    	const blur_handler = () => dispatch("mouseout", {});

    	const click_handler = (d, i) => {
    		if (clicked.includes($z(d))) {
    			clicked.splice(clicked.indexOf($z(d)), 1);
    		} else {
    			clicked.push($z(d));
    		}

    		$$invalidate(0, clicked = [...clicked]);
    		dispatch("click", { props: $data[i] });
    	};

    	$$self.$$set = $$props => {
    		if ('strokeWidth' in $$props) $$invalidate(1, strokeWidth = $$props.strokeWidth);
    		if ('clicked' in $$props) $$invalidate(0, clicked = $$props.clicked);
    	};

    	$$self.$capture_state = () => ({
    		createEventDispatcher,
    		getContext,
    		data,
    		xGet,
    		z,
    		height,
    		strokeWidth,
    		clicked,
    		dispatch,
    		$data,
    		$xGet,
    		$height,
    		$z
    	});

    	$$self.$inject_state = $$props => {
    		if ('strokeWidth' in $$props) $$invalidate(1, strokeWidth = $$props.strokeWidth);
    		if ('clicked' in $$props) $$invalidate(0, clicked = $$props.clicked);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		clicked,
    		strokeWidth,
    		$data,
    		$xGet,
    		$height,
    		$z,
    		data,
    		xGet,
    		z,
    		height,
    		dispatch,
    		mouseover_handler,
    		focus_handler,
    		mouseout_handler,
    		blur_handler,
    		click_handler
    	];
    }

    class Strip extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$k, create_fragment$a, safe_not_equal, { strokeWidth: 1, clicked: 0 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Strip",
    			options,
    			id: create_fragment$a.name
    		});
    	}

    	get strokeWidth() {
    		throw new Error("<Strip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set strokeWidth(value) {
    		throw new Error("<Strip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get clicked() {
    		throw new Error("<Strip>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set clicked(value) {
    		throw new Error("<Strip>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/Results.svelte generated by Svelte v3.46.4 */

    const { Object: Object_1$2, console: console_1$4 } = globals;
    const file$8 = "src/Results.svelte";

    function get_each_context_4(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[27] = list[i];
    	child_ctx[31] = i;
    	return child_ctx;
    }

    function get_each_context_3(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[27] = list[i];
    	child_ctx[31] = i;
    	return child_ctx;
    }

    function get_each_context$3(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[20] = list[i];
    	return child_ctx;
    }

    function get_each_context_1$1(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[23] = list[i];
    	return child_ctx;
    }

    function get_each_context_2(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[27] = list[i];
    	return child_ctx;
    }

    function get_each_context_5(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[27] = list[i];
    	return child_ctx;
    }

    // (30:8) <Option value={m}>
    function create_default_slot_30(ctx) {
    	let t_value = /*m*/ ctx[27] + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*metric_names*/ 2 && t_value !== (t_value = /*m*/ ctx[27] + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_30.name,
    		type: "slot",
    		source: "(30:8) <Option value={m}>",
    		ctx
    	});

    	return block;
    }

    // (29:6) {#each metric_names as m}
    function create_each_block_5(ctx) {
    	let option;
    	let current;

    	option = new Option({
    			props: {
    				value: /*m*/ ctx[27],
    				$$slots: { default: [create_default_slot_30] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(option.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(option, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const option_changes = {};
    			if (dirty[0] & /*metric_names*/ 2) option_changes.value = /*m*/ ctx[27];

    			if (dirty[0] & /*metric_names*/ 2 | dirty[1] & /*$$scope*/ 64) {
    				option_changes.$$scope = { dirty, ctx };
    			}

    			option.$set(option_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(option.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(option.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(option, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_5.name,
    		type: "each",
    		source: "(29:6) {#each metric_names as m}",
    		ctx
    	});

    	return block;
    }

    // (24:4) <Select       bind:value={selectedMetric}       label="Select Metric"       style="margin-right: 20px;"     >
    function create_default_slot_29(ctx) {
    	let each_1_anchor;
    	let current;
    	let each_value_5 = /*metric_names*/ ctx[1];
    	validate_each_argument(each_value_5);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_5.length; i += 1) {
    		each_blocks[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*metric_names*/ 2) {
    				each_value_5 = /*metric_names*/ ctx[1];
    				validate_each_argument(each_value_5);
    				let i;

    				for (i = 0; i < each_value_5.length; i += 1) {
    					const child_ctx = get_each_context_5(ctx, each_value_5, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block_5(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value_5.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value_5.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_29.name,
    		type: "slot",
    		source: "(24:4) <Select       bind:value={selectedMetric}       label=\\\"Select Metric\\\"       style=\\\"margin-right: 20px;\\\"     >",
    		ctx
    	});

    	return block;
    }

    // (40:8) <Label>
    function create_default_slot_28$1(ctx) {
    	let t_value = /*segment*/ ctx[34] + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[1] & /*segment*/ 8 && t_value !== (t_value = /*segment*/ ctx[34] + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_28$1.name,
    		type: "slot",
    		source: "(40:8) <Label>",
    		ctx
    	});

    	return block;
    }

    // (39:6) <Segment {segment}>
    function create_default_slot_27$1(ctx) {
    	let label;
    	let current;

    	label = new Label({
    			props: {
    				$$slots: { default: [create_default_slot_28$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(label.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(label, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const label_changes = {};

    			if (dirty[1] & /*$$scope, segment*/ 72) {
    				label_changes.$$scope = { dirty, ctx };
    			}

    			label.$set(label_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(label.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(label.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(label, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_27$1.name,
    		type: "slot",
    		source: "(39:6) <Segment {segment}>",
    		ctx
    	});

    	return block;
    }

    // (33:4) <SegmentedButton       segments={choices}       let:segment       singleSelect       bind:selected={choice}     >
    function create_default_slot_26$1(ctx) {
    	let segment;
    	let current;

    	segment = new Segment({
    			props: {
    				segment: /*segment*/ ctx[34],
    				$$slots: { default: [create_default_slot_27$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(segment.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(segment, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const segment_changes = {};
    			if (dirty[1] & /*segment*/ 8) segment_changes.segment = /*segment*/ ctx[34];

    			if (dirty[1] & /*$$scope, segment*/ 72) {
    				segment_changes.$$scope = { dirty, ctx };
    			}

    			segment.$set(segment_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(segment.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(segment.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(segment, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_26$1.name,
    		type: "slot",
    		source: "(33:4) <SegmentedButton       segments={choices}       let:segment       singleSelect       bind:selected={choice}     >",
    		ctx
    	});

    	return block;
    }

    // (126:32) 
    function create_if_block_4$1(ctx) {
    	let each_1_anchor;
    	let current;
    	let each_value_4 = /*$models*/ ctx[4];
    	validate_each_argument(each_value_4);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_4.length; i += 1) {
    		each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric, evt, $models*/ 57 | dirty[1] & /*detail*/ 2) {
    				each_value_4 = /*$models*/ ctx[4];
    				validate_each_argument(each_value_4);
    				let i;

    				for (i = 0; i < each_value_4.length; i += 1) {
    					const child_ctx = get_each_context_4(ctx, each_value_4, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block_4(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value_4.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value_4.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_4$1.name,
    		type: "if",
    		source: "(126:32) ",
    		ctx
    	});

    	return block;
    }

    // (86:29) 
    function create_if_block_2$2(ctx) {
    	let each_1_anchor;
    	let current;
    	let each_value_3 = /*$models*/ ctx[4];
    	validate_each_argument(each_value_3);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_3.length; i += 1) {
    		each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric, evt, $models*/ 57 | dirty[1] & /*detail*/ 2) {
    				each_value_3 = /*$models*/ ctx[4];
    				validate_each_argument(each_value_3);
    				let i;

    				for (i = 0; i < each_value_3.length; i += 1) {
    					const child_ctx = get_each_context_3(ctx, each_value_3, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block_3(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value_3.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value_3.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_2$2.name,
    		type: "if",
    		source: "(86:29) ",
    		ctx
    	});

    	return block;
    }

    // (46:0) {#if choice === "table"}
    function create_if_block$6(ctx) {
    	let div;
    	let datatable;
    	let current;

    	datatable = new DataTable({
    			props: {
    				sortable: true,
    				"table$aria-label": "People list",
    				style: "max-width: 100%;",
    				$$slots: { default: [create_default_slot$7] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			div = element("div");
    			create_component(datatable.$$.fragment);
    			attr_dev(div, "class", "table-container svelte-1wfszr0");
    			add_location(div, file$8, 46, 2, 1435);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			mount_component(datatable, div, null);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const datatable_changes = {};

    			if (dirty[0] & /*$results, selectedMetric, $models*/ 49 | dirty[1] & /*$$scope*/ 64) {
    				datatable_changes.$$scope = { dirty, ctx };
    			}

    			datatable.$set(datatable_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(datatable.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(datatable.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			destroy_component(datatable);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$6.name,
    		type: "if",
    		source: "(46:0) {#if choice === \\\"table\\\"}",
    		ctx
    	});

    	return block;
    }

    // (147:10) {#if evt[i]}
    function create_if_block_5(ctx) {
    	let tooltip;
    	let current;

    	tooltip = new Tooltip({
    			props: {
    				evt: /*evt*/ ctx[3][/*i*/ ctx[31]],
    				$$slots: {
    					default: [
    						create_default_slot_25$1,
    						({ detail }) => ({ 32: detail }),
    						({ detail }) => [0, detail ? 2 : 0]
    					]
    				},
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(tooltip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const tooltip_changes = {};
    			if (dirty[0] & /*evt*/ 8) tooltip_changes.evt = /*evt*/ ctx[3][/*i*/ ctx[31]];

    			if (dirty[1] & /*$$scope, detail*/ 66) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_5.name,
    		type: "if",
    		source: "(147:10) {#if evt[i]}",
    		ctx
    	});

    	return block;
    }

    // (148:12) <Tooltip evt={evt[i]} let:detail>
    function create_default_slot_25$1(ctx) {
    	let p0;
    	let t0;
    	let t1_value = /*detail*/ ctx[32].props.slice + "";
    	let t1;
    	let t2;
    	let p1;
    	let t3;
    	let t4_value = /*detail*/ ctx[32].props.size + "";
    	let t4;

    	const block = {
    		c: function create() {
    			p0 = element("p");
    			t0 = text("slice: ");
    			t1 = text(t1_value);
    			t2 = space();
    			p1 = element("p");
    			t3 = text("instances: ");
    			t4 = text(t4_value);
    			add_location(p0, file$8, 148, 14, 4520);
    			add_location(p1, file$8, 149, 14, 4569);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p0, anchor);
    			append_dev(p0, t0);
    			append_dev(p0, t1);
    			insert_dev(target, t2, anchor);
    			insert_dev(target, p1, anchor);
    			append_dev(p1, t3);
    			append_dev(p1, t4);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[1] & /*detail*/ 2 && t1_value !== (t1_value = /*detail*/ ctx[32].props.slice + "")) set_data_dev(t1, t1_value);
    			if (dirty[1] & /*detail*/ 2 && t4_value !== (t4_value = /*detail*/ ctx[32].props.size + "")) set_data_dev(t4, t4_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p0);
    			if (detaching) detach_dev(t2);
    			if (detaching) detach_dev(p1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_25$1.name,
    		type: "slot",
    		source: "(148:12) <Tooltip evt={evt[i]} let:detail>",
    		ctx
    	});

    	return block;
    }

    // (146:8) <Html>
    function create_default_slot_24$1(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*evt*/ ctx[3][/*i*/ ctx[31]] && create_if_block_5(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*evt*/ ctx[3][/*i*/ ctx[31]]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*evt*/ 8) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block_5(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_24$1.name,
    		type: "slot",
    		source: "(146:8) <Html>",
    		ctx
    	});

    	return block;
    }

    // (154:8) <Svg>
    function create_default_slot_23$1(ctx) {
    	let beeswarmforce;
    	let t;
    	let axisx;
    	let current;

    	function mousemove_handler_1(...args) {
    		return /*mousemove_handler_1*/ ctx[17](/*i*/ ctx[31], ...args);
    	}

    	beeswarmforce = new BeeswarmForce({ $$inline: true });
    	beeswarmforce.$on("mouseout", /*mouseout_handler_1*/ ctx[16]);
    	beeswarmforce.$on("mousemove", mousemove_handler_1);

    	axisx = new AxisX({
    			props: {
    				baseline: true,
    				tickMarks: true,
    				formatTick: func_4
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(beeswarmforce.$$.fragment);
    			t = space();
    			create_component(axisx.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(beeswarmforce, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(axisx, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(beeswarmforce.$$.fragment, local);
    			transition_in(axisx.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(beeswarmforce.$$.fragment, local);
    			transition_out(axisx.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(beeswarmforce, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(axisx, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_23$1.name,
    		type: "slot",
    		source: "(154:8) <Svg>",
    		ctx
    	});

    	return block;
    }

    // (130:6) <LayerCake         data={$results           .filter((r) => r.metric === selectedMetric)           .map((r) => ({             slice: r.slice,             value: r.modelIds[i]               ? r.modelResults[r.modelIds[i]].toFixed(2) / 100               : -1,             size: r.sliceSize,           }))}         x="value"         z="size"         xDomain={[0, 1]}         zDomain={[null, null]}         zRange={[5, 10]}       >
    function create_default_slot_22$1(ctx) {
    	let html;
    	let t;
    	let svg;
    	let current;

    	html = new Html({
    			props: {
    				$$slots: { default: [create_default_slot_24$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	svg = new Svg({
    			props: {
    				$$slots: { default: [create_default_slot_23$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(html.$$.fragment);
    			t = space();
    			create_component(svg.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(html, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(svg, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const html_changes = {};

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				html_changes.$$scope = { dirty, ctx };
    			}

    			html.$set(html_changes);
    			const svg_changes = {};

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				svg_changes.$$scope = { dirty, ctx };
    			}

    			svg.$set(svg_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(html.$$.fragment, local);
    			transition_in(svg.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(html.$$.fragment, local);
    			transition_out(svg.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(html, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(svg, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_22$1.name,
    		type: "slot",
    		source: "(130:6) <LayerCake         data={$results           .filter((r) => r.metric === selectedMetric)           .map((r) => ({             slice: r.slice,             value: r.modelIds[i]               ? r.modelResults[r.modelIds[i]].toFixed(2) / 100               : -1,             size: r.sliceSize,           }))}         x=\\\"value\\\"         z=\\\"size\\\"         xDomain={[0, 1]}         zDomain={[null, null]}         zRange={[5, 10]}       >",
    		ctx
    	});

    	return block;
    }

    // (127:2) {#each $models as m, i}
    function create_each_block_4(ctx) {
    	let div;
    	let h5;
    	let t0_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "";
    	let t0;
    	let t1;
    	let layercake;
    	let t2;
    	let current;

    	function func_6(...args) {
    		return /*func_6*/ ctx[19](/*i*/ ctx[31], ...args);
    	}

    	layercake = new LayerCake({
    			props: {
    				data: /*$results*/ ctx[5].filter(/*func_5*/ ctx[18]).map(func_6),
    				x: "value",
    				z: "size",
    				xDomain: [0, 1],
    				zDomain: [null, null],
    				zRange: [5, 10],
    				$$slots: { default: [create_default_slot_22$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			div = element("div");
    			h5 = element("h5");
    			t0 = text(t0_value);
    			t1 = space();
    			create_component(layercake.$$.fragment);
    			t2 = space();
    			add_location(h5, file$8, 128, 6, 3955);
    			attr_dev(div, "id", "bee-container");
    			attr_dev(div, "class", "svelte-1wfszr0");
    			add_location(div, file$8, 127, 4, 3924);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			append_dev(div, h5);
    			append_dev(h5, t0);
    			append_dev(div, t1);
    			mount_component(layercake, div, null);
    			append_dev(div, t2);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			if ((!current || dirty[0] & /*$models*/ 16) && t0_value !== (t0_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "")) set_data_dev(t0, t0_value);
    			const layercake_changes = {};
    			if (dirty[0] & /*$results, selectedMetric*/ 33) layercake_changes.data = /*$results*/ ctx[5].filter(/*func_5*/ ctx[18]).map(func_6);

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				layercake_changes.$$scope = { dirty, ctx };
    			}

    			layercake.$set(layercake_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(layercake.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(layercake.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			destroy_component(layercake);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_4.name,
    		type: "each",
    		source: "(127:2) {#each $models as m, i}",
    		ctx
    	});

    	return block;
    }

    // (105:10) {#if evt[i]}
    function create_if_block_3$1(ctx) {
    	let tooltip;
    	let current;

    	tooltip = new Tooltip({
    			props: {
    				evt: /*evt*/ ctx[3][/*i*/ ctx[31]],
    				$$slots: {
    					default: [
    						create_default_slot_21$1,
    						({ detail }) => ({ 32: detail }),
    						({ detail }) => [0, detail ? 2 : 0]
    					]
    				},
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(tooltip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const tooltip_changes = {};
    			if (dirty[0] & /*evt*/ 8) tooltip_changes.evt = /*evt*/ ctx[3][/*i*/ ctx[31]];

    			if (dirty[1] & /*$$scope, detail*/ 66) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_3$1.name,
    		type: "if",
    		source: "(105:10) {#if evt[i]}",
    		ctx
    	});

    	return block;
    }

    // (106:12) <Tooltip evt={evt[i]} let:detail>
    function create_default_slot_21$1(ctx) {
    	let p0;
    	let t0;
    	let t1_value = /*detail*/ ctx[32].props.slice + "";
    	let t1;
    	let t2;
    	let p1;
    	let t3;
    	let t4_value = /*detail*/ ctx[32].props.size + "";
    	let t4;

    	const block = {
    		c: function create() {
    			p0 = element("p");
    			t0 = text("slice: ");
    			t1 = text(t1_value);
    			t2 = space();
    			p1 = element("p");
    			t3 = text("instances: ");
    			t4 = text(t4_value);
    			add_location(p0, file$8, 106, 14, 3397);
    			add_location(p1, file$8, 107, 14, 3446);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p0, anchor);
    			append_dev(p0, t0);
    			append_dev(p0, t1);
    			insert_dev(target, t2, anchor);
    			insert_dev(target, p1, anchor);
    			append_dev(p1, t3);
    			append_dev(p1, t4);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[1] & /*detail*/ 2 && t1_value !== (t1_value = /*detail*/ ctx[32].props.slice + "")) set_data_dev(t1, t1_value);
    			if (dirty[1] & /*detail*/ 2 && t4_value !== (t4_value = /*detail*/ ctx[32].props.size + "")) set_data_dev(t4, t4_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p0);
    			if (detaching) detach_dev(t2);
    			if (detaching) detach_dev(p1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_21$1.name,
    		type: "slot",
    		source: "(106:12) <Tooltip evt={evt[i]} let:detail>",
    		ctx
    	});

    	return block;
    }

    // (104:8) <Html>
    function create_default_slot_20$1(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*evt*/ ctx[3][/*i*/ ctx[31]] && create_if_block_3$1(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*evt*/ ctx[3][/*i*/ ctx[31]]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*evt*/ 8) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block_3$1(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_20$1.name,
    		type: "slot",
    		source: "(104:8) <Html>",
    		ctx
    	});

    	return block;
    }

    // (112:8) <Svg>
    function create_default_slot_19$1(ctx) {
    	let strip;
    	let t;
    	let axisx;
    	let current;

    	function mousemove_handler(...args) {
    		return /*mousemove_handler*/ ctx[13](/*i*/ ctx[31], ...args);
    	}

    	strip = new Strip({ $$inline: true });
    	strip.$on("mouseout", /*mouseout_handler*/ ctx[12]);
    	strip.$on("mousemove", mousemove_handler);

    	axisx = new AxisX({
    			props: {
    				baseline: true,
    				tickMarks: true,
    				formatTick: func_1
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(strip.$$.fragment);
    			t = space();
    			create_component(axisx.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(strip, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(axisx, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(strip.$$.fragment, local);
    			transition_in(axisx.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(strip.$$.fragment, local);
    			transition_out(axisx.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(strip, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(axisx, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_19$1.name,
    		type: "slot",
    		source: "(112:8) <Svg>",
    		ctx
    	});

    	return block;
    }

    // (90:6) <LayerCake         data={$results           .filter((r) => r.metric === selectedMetric)           .map((r) => ({             slice: r.slice,             value: r.modelIds[i]               ? r.modelResults[r.modelIds[i]].toFixed(2) / 100               : -1,             size: r.sliceSize,           }))}         x="value"         z="slice"         xDomain={[0, 1]}       >
    function create_default_slot_18$1(ctx) {
    	let html;
    	let t;
    	let svg;
    	let current;

    	html = new Html({
    			props: {
    				$$slots: { default: [create_default_slot_20$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	svg = new Svg({
    			props: {
    				$$slots: { default: [create_default_slot_19$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(html.$$.fragment);
    			t = space();
    			create_component(svg.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(html, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(svg, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const html_changes = {};

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				html_changes.$$scope = { dirty, ctx };
    			}

    			html.$set(html_changes);
    			const svg_changes = {};

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				svg_changes.$$scope = { dirty, ctx };
    			}

    			svg.$set(svg_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(html.$$.fragment, local);
    			transition_in(svg.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(html.$$.fragment, local);
    			transition_out(svg.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(html, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(svg, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_18$1.name,
    		type: "slot",
    		source: "(90:6) <LayerCake         data={$results           .filter((r) => r.metric === selectedMetric)           .map((r) => ({             slice: r.slice,             value: r.modelIds[i]               ? r.modelResults[r.modelIds[i]].toFixed(2) / 100               : -1,             size: r.sliceSize,           }))}         x=\\\"value\\\"         z=\\\"slice\\\"         xDomain={[0, 1]}       >",
    		ctx
    	});

    	return block;
    }

    // (87:2) {#each $models as m, i}
    function create_each_block_3(ctx) {
    	let div;
    	let h5;
    	let t0_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "";
    	let t0;
    	let t1;
    	let layercake;
    	let t2;
    	let current;

    	function func_3(...args) {
    		return /*func_3*/ ctx[15](/*i*/ ctx[31], ...args);
    	}

    	layercake = new LayerCake({
    			props: {
    				data: /*$results*/ ctx[5].filter(/*func_2*/ ctx[14]).map(func_3),
    				x: "value",
    				z: "slice",
    				xDomain: [0, 1],
    				$$slots: { default: [create_default_slot_18$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			div = element("div");
    			h5 = element("h5");
    			t0 = text(t0_value);
    			t1 = space();
    			create_component(layercake.$$.fragment);
    			t2 = space();
    			add_location(h5, file$8, 88, 6, 2887);
    			attr_dev(div, "id", "bee-container");
    			attr_dev(div, "class", "svelte-1wfszr0");
    			add_location(div, file$8, 87, 4, 2856);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			append_dev(div, h5);
    			append_dev(h5, t0);
    			append_dev(div, t1);
    			mount_component(layercake, div, null);
    			append_dev(div, t2);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			if ((!current || dirty[0] & /*$models*/ 16) && t0_value !== (t0_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "")) set_data_dev(t0, t0_value);
    			const layercake_changes = {};
    			if (dirty[0] & /*$results, selectedMetric*/ 33) layercake_changes.data = /*$results*/ ctx[5].filter(/*func_2*/ ctx[14]).map(func_3);

    			if (dirty[0] & /*evt*/ 8 | dirty[1] & /*$$scope*/ 64) {
    				layercake_changes.$$scope = { dirty, ctx };
    			}

    			layercake.$set(layercake_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(layercake.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(layercake.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			destroy_component(layercake);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_3.name,
    		type: "each",
    		source: "(87:2) {#each $models as m, i}",
    		ctx
    	});

    	return block;
    }

    // (51:10) <Cell>
    function create_default_slot_17$1(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Slice");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_17$1.name,
    		type: "slot",
    		source: "(51:10) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (52:10) <Cell>
    function create_default_slot_16$1(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Transform");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_16$1.name,
    		type: "slot",
    		source: "(52:10) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (53:10) <Cell>
    function create_default_slot_15$1(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Test");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_15$1.name,
    		type: "slot",
    		source: "(53:10) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (54:10) <Cell>
    function create_default_slot_14$1(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Size");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_14$1.name,
    		type: "slot",
    		source: "(54:10) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (56:12) <Cell numeric>
    function create_default_slot_13$1(ctx) {
    	let b;
    	let t1_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "";
    	let t1;

    	const block = {
    		c: function create() {
    			b = element("b");
    			b.textContent = "m:";
    			t1 = text(t1_value);
    			add_location(b, file$8, 55, 26, 1748);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, b, anchor);
    			insert_dev(target, t1, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$models*/ 16 && t1_value !== (t1_value = /*m*/ ctx[27].split(/[\\/]/).pop() + "")) set_data_dev(t1, t1_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(b);
    			if (detaching) detach_dev(t1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_13$1.name,
    		type: "slot",
    		source: "(56:12) <Cell numeric>",
    		ctx
    	});

    	return block;
    }

    // (55:10) {#each $models as m}
    function create_each_block_2(ctx) {
    	let cell;
    	let current;

    	cell = new Cell({
    			props: {
    				numeric: true,
    				$$slots: { default: [create_default_slot_13$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(cell.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(cell, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const cell_changes = {};

    			if (dirty[0] & /*$models*/ 16 | dirty[1] & /*$$scope*/ 64) {
    				cell_changes.$$scope = { dirty, ctx };
    			}

    			cell.$set(cell_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(cell.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(cell.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(cell, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_2.name,
    		type: "each",
    		source: "(55:10) {#each $models as m}",
    		ctx
    	});

    	return block;
    }

    // (50:8) <Row>
    function create_default_slot_12$1(ctx) {
    	let cell0;
    	let t0;
    	let cell1;
    	let t1;
    	let cell2;
    	let t2;
    	let cell3;
    	let t3;
    	let each_1_anchor;
    	let current;

    	cell0 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_17$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell1 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_16$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell2 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_15$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell3 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_14$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	let each_value_2 = /*$models*/ ctx[4];
    	validate_each_argument(each_value_2);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_2.length; i += 1) {
    		each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			create_component(cell0.$$.fragment);
    			t0 = space();
    			create_component(cell1.$$.fragment);
    			t1 = space();
    			create_component(cell2.$$.fragment);
    			t2 = space();
    			create_component(cell3.$$.fragment);
    			t3 = space();

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			mount_component(cell0, target, anchor);
    			insert_dev(target, t0, anchor);
    			mount_component(cell1, target, anchor);
    			insert_dev(target, t1, anchor);
    			mount_component(cell2, target, anchor);
    			insert_dev(target, t2, anchor);
    			mount_component(cell3, target, anchor);
    			insert_dev(target, t3, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const cell0_changes = {};

    			if (dirty[1] & /*$$scope*/ 64) {
    				cell0_changes.$$scope = { dirty, ctx };
    			}

    			cell0.$set(cell0_changes);
    			const cell1_changes = {};

    			if (dirty[1] & /*$$scope*/ 64) {
    				cell1_changes.$$scope = { dirty, ctx };
    			}

    			cell1.$set(cell1_changes);
    			const cell2_changes = {};

    			if (dirty[1] & /*$$scope*/ 64) {
    				cell2_changes.$$scope = { dirty, ctx };
    			}

    			cell2.$set(cell2_changes);
    			const cell3_changes = {};

    			if (dirty[1] & /*$$scope*/ 64) {
    				cell3_changes.$$scope = { dirty, ctx };
    			}

    			cell3.$set(cell3_changes);

    			if (dirty[0] & /*$models*/ 16) {
    				each_value_2 = /*$models*/ ctx[4];
    				validate_each_argument(each_value_2);
    				let i;

    				for (i = 0; i < each_value_2.length; i += 1) {
    					const child_ctx = get_each_context_2(ctx, each_value_2, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block_2(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value_2.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(cell0.$$.fragment, local);
    			transition_in(cell1.$$.fragment, local);
    			transition_in(cell2.$$.fragment, local);
    			transition_in(cell3.$$.fragment, local);

    			for (let i = 0; i < each_value_2.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(cell0.$$.fragment, local);
    			transition_out(cell1.$$.fragment, local);
    			transition_out(cell2.$$.fragment, local);
    			transition_out(cell3.$$.fragment, local);
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(cell0, detaching);
    			if (detaching) detach_dev(t0);
    			destroy_component(cell1, detaching);
    			if (detaching) detach_dev(t1);
    			destroy_component(cell2, detaching);
    			if (detaching) detach_dev(t2);
    			destroy_component(cell3, detaching);
    			if (detaching) detach_dev(t3);
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_12$1.name,
    		type: "slot",
    		source: "(50:8) <Row>",
    		ctx
    	});

    	return block;
    }

    // (49:6) <Head>
    function create_default_slot_11$1(ctx) {
    	let row;
    	let current;

    	row = new Row$1({
    			props: {
    				$$slots: { default: [create_default_slot_12$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(row.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(row, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const row_changes = {};

    			if (dirty[0] & /*$models*/ 16 | dirty[1] & /*$$scope*/ 64) {
    				row_changes.$$scope = { dirty, ctx };
    			}

    			row.$set(row_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(row.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(row.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(row, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_11$1.name,
    		type: "slot",
    		source: "(49:6) <Head>",
    		ctx
    	});

    	return block;
    }

    // (61:8) {#if $results.length > 0}
    function create_if_block_1$3(ctx) {
    	let each_1_anchor;
    	let current;
    	let each_value = /*$results*/ ctx[5].filter(/*func*/ ctx[10]);
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric, chip*/ 67108897) {
    				each_value = /*$results*/ ctx[5].filter(/*func*/ ctx[10]);
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$3(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block$3(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$3.name,
    		type: "if",
    		source: "(61:8) {#if $results.length > 0}",
    		ctx
    	});

    	return block;
    }

    // (68:20) <Text>
    function create_default_slot_10$1(ctx) {
    	let t_value = /*chip*/ ctx[26] + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*chip*/ 67108864 && t_value !== (t_value = /*chip*/ ctx[26] + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_10$1.name,
    		type: "slot",
    		source: "(68:20) <Text>",
    		ctx
    	});

    	return block;
    }

    // (67:18) <Chip {chip} on:click={(e) => e.stopPropagation()}>
    function create_default_slot_9$1(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text({
    			props: {
    				$$slots: { default: [create_default_slot_10$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty[0] & /*chip*/ 67108864 | dirty[1] & /*$$scope*/ 64) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_9$1.name,
    		type: "slot",
    		source: "(67:18) <Chip {chip} on:click={(e) => e.stopPropagation()}>",
    		ctx
    	});

    	return block;
    }

    // (66:16) <ChipSet chips={r.slice} let:chip>
    function create_default_slot_8$1(ctx) {
    	let chip;
    	let current;

    	chip = new Chip({
    			props: {
    				chip: /*chip*/ ctx[26],
    				$$slots: { default: [create_default_slot_9$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	chip.$on("click", click_handler$1);

    	const block = {
    		c: function create() {
    			create_component(chip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(chip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const chip_changes = {};
    			if (dirty[0] & /*chip*/ 67108864) chip_changes.chip = /*chip*/ ctx[26];

    			if (dirty[0] & /*chip*/ 67108864 | dirty[1] & /*$$scope*/ 64) {
    				chip_changes.$$scope = { dirty, ctx };
    			}

    			chip.$set(chip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(chip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(chip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(chip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_8$1.name,
    		type: "slot",
    		source: "(66:16) <ChipSet chips={r.slice} let:chip>",
    		ctx
    	});

    	return block;
    }

    // (65:14) <Cell>
    function create_default_slot_7$1(ctx) {
    	let chipset;
    	let current;

    	chipset = new Set$1({
    			props: {
    				chips: /*r*/ ctx[20].slice,
    				$$slots: {
    					default: [
    						create_default_slot_8$1,
    						({ chip }) => ({ 26: chip }),
    						({ chip }) => [chip ? 67108864 : 0]
    					]
    				},
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(chipset.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(chipset, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const chipset_changes = {};
    			if (dirty[0] & /*$results, selectedMetric*/ 33) chipset_changes.chips = /*r*/ ctx[20].slice;

    			if (dirty[0] & /*chip*/ 67108864 | dirty[1] & /*$$scope*/ 64) {
    				chipset_changes.$$scope = { dirty, ctx };
    			}

    			chipset.$set(chipset_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(chipset.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(chipset.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(chipset, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_7$1.name,
    		type: "slot",
    		source: "(65:14) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (74:14) <Cell>
    function create_default_slot_6$2(ctx) {
    	let t_value = /*r*/ ctx[20].transform + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric*/ 33 && t_value !== (t_value = /*r*/ ctx[20].transform + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_6$2.name,
    		type: "slot",
    		source: "(74:14) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (75:14) <Cell>
    function create_default_slot_5$2(ctx) {
    	let t_value = /*r*/ ctx[20].metric + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric*/ 33 && t_value !== (t_value = /*r*/ ctx[20].metric + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_5$2.name,
    		type: "slot",
    		source: "(75:14) <Cell>",
    		ctx
    	});

    	return block;
    }

    // (76:14) <Cell numeric>
    function create_default_slot_4$2(ctx) {
    	let t_value = /*r*/ ctx[20].sliceSize + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric*/ 33 && t_value !== (t_value = /*r*/ ctx[20].sliceSize + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_4$2.name,
    		type: "slot",
    		source: "(76:14) <Cell numeric>",
    		ctx
    	});

    	return block;
    }

    // (78:16) <Cell numeric>
    function create_default_slot_3$3(ctx) {
    	let t0_value = /*r*/ ctx[20].modelResults[/*ent*/ ctx[23]].toFixed(2) + "";
    	let t0;
    	let t1;

    	const block = {
    		c: function create() {
    			t0 = text(t0_value);
    			t1 = text("%");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t0, anchor);
    			insert_dev(target, t1, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty[0] & /*$results, selectedMetric*/ 33 && t0_value !== (t0_value = /*r*/ ctx[20].modelResults[/*ent*/ ctx[23]].toFixed(2) + "")) set_data_dev(t0, t0_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(t1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_3$3.name,
    		type: "slot",
    		source: "(78:16) <Cell numeric>",
    		ctx
    	});

    	return block;
    }

    // (77:14) {#each Object.keys(r.modelResults) as ent}
    function create_each_block_1$1(ctx) {
    	let cell;
    	let current;

    	cell = new Cell({
    			props: {
    				numeric: true,
    				$$slots: { default: [create_default_slot_3$3] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(cell.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(cell, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const cell_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				cell_changes.$$scope = { dirty, ctx };
    			}

    			cell.$set(cell_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(cell.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(cell.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(cell, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_1$1.name,
    		type: "each",
    		source: "(77:14) {#each Object.keys(r.modelResults) as ent}",
    		ctx
    	});

    	return block;
    }

    // (63:12) <Row on:click={() => (window.location.hash = "#/result/" + r.id)}>
    function create_default_slot_2$4(ctx) {
    	let cell0;
    	let t0;
    	let cell1;
    	let t1;
    	let cell2;
    	let t2;
    	let cell3;
    	let t3;
    	let t4;
    	let current;

    	cell0 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_7$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell1 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_6$2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell2 = new Cell({
    			props: {
    				$$slots: { default: [create_default_slot_5$2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	cell3 = new Cell({
    			props: {
    				numeric: true,
    				$$slots: { default: [create_default_slot_4$2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	let each_value_1 = Object.keys(/*r*/ ctx[20].modelResults);
    	validate_each_argument(each_value_1);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_1.length; i += 1) {
    		each_blocks[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			create_component(cell0.$$.fragment);
    			t0 = space();
    			create_component(cell1.$$.fragment);
    			t1 = space();
    			create_component(cell2.$$.fragment);
    			t2 = space();
    			create_component(cell3.$$.fragment);
    			t3 = space();

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			t4 = space();
    		},
    		m: function mount(target, anchor) {
    			mount_component(cell0, target, anchor);
    			insert_dev(target, t0, anchor);
    			mount_component(cell1, target, anchor);
    			insert_dev(target, t1, anchor);
    			mount_component(cell2, target, anchor);
    			insert_dev(target, t2, anchor);
    			mount_component(cell3, target, anchor);
    			insert_dev(target, t3, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, t4, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const cell0_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				cell0_changes.$$scope = { dirty, ctx };
    			}

    			cell0.$set(cell0_changes);
    			const cell1_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				cell1_changes.$$scope = { dirty, ctx };
    			}

    			cell1.$set(cell1_changes);
    			const cell2_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				cell2_changes.$$scope = { dirty, ctx };
    			}

    			cell2.$set(cell2_changes);
    			const cell3_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				cell3_changes.$$scope = { dirty, ctx };
    			}

    			cell3.$set(cell3_changes);

    			if (dirty[0] & /*$results, selectedMetric*/ 33) {
    				each_value_1 = Object.keys(/*r*/ ctx[20].modelResults);
    				validate_each_argument(each_value_1);
    				let i;

    				for (i = 0; i < each_value_1.length; i += 1) {
    					const child_ctx = get_each_context_1$1(ctx, each_value_1, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block_1$1(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(t4.parentNode, t4);
    					}
    				}

    				group_outros();

    				for (i = each_value_1.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(cell0.$$.fragment, local);
    			transition_in(cell1.$$.fragment, local);
    			transition_in(cell2.$$.fragment, local);
    			transition_in(cell3.$$.fragment, local);

    			for (let i = 0; i < each_value_1.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(cell0.$$.fragment, local);
    			transition_out(cell1.$$.fragment, local);
    			transition_out(cell2.$$.fragment, local);
    			transition_out(cell3.$$.fragment, local);
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(cell0, detaching);
    			if (detaching) detach_dev(t0);
    			destroy_component(cell1, detaching);
    			if (detaching) detach_dev(t1);
    			destroy_component(cell2, detaching);
    			if (detaching) detach_dev(t2);
    			destroy_component(cell3, detaching);
    			if (detaching) detach_dev(t3);
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(t4);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2$4.name,
    		type: "slot",
    		source: "(63:12) <Row on:click={() => (window.location.hash = \\\"#/result/\\\" + r.id)}>",
    		ctx
    	});

    	return block;
    }

    // (62:10) {#each $results.filter((d) => d.metric === selectedMetric) as r}
    function create_each_block$3(ctx) {
    	let row;
    	let current;

    	function click_handler_1() {
    		return /*click_handler_1*/ ctx[11](/*r*/ ctx[20]);
    	}

    	row = new Row$1({
    			props: {
    				$$slots: { default: [create_default_slot_2$4] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	row.$on("click", click_handler_1);

    	const block = {
    		c: function create() {
    			create_component(row.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(row, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			const row_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				row_changes.$$scope = { dirty, ctx };
    			}

    			row.$set(row_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(row.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(row.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(row, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$3.name,
    		type: "each",
    		source: "(62:10) {#each $results.filter((d) => d.metric === selectedMetric) as r}",
    		ctx
    	});

    	return block;
    }

    // (60:6) <Body>
    function create_default_slot_1$4(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*$results*/ ctx[5].length > 0 && create_if_block_1$3(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*$results*/ ctx[5].length > 0) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty[0] & /*$results*/ 32) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block_1$3(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$4.name,
    		type: "slot",
    		source: "(60:6) <Body>",
    		ctx
    	});

    	return block;
    }

    // (48:4) <DataTable sortable table$aria-label="People list" style="max-width: 100%;">
    function create_default_slot$7(ctx) {
    	let head;
    	let t;
    	let body;
    	let current;

    	head = new Head({
    			props: {
    				$$slots: { default: [create_default_slot_11$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	body = new Body({
    			props: {
    				$$slots: { default: [create_default_slot_1$4] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(head.$$.fragment);
    			t = space();
    			create_component(body.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(head, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(body, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const head_changes = {};

    			if (dirty[0] & /*$models*/ 16 | dirty[1] & /*$$scope*/ 64) {
    				head_changes.$$scope = { dirty, ctx };
    			}

    			head.$set(head_changes);
    			const body_changes = {};

    			if (dirty[0] & /*$results, selectedMetric*/ 33 | dirty[1] & /*$$scope*/ 64) {
    				body_changes.$$scope = { dirty, ctx };
    			}

    			body.$set(body_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(head.$$.fragment, local);
    			transition_in(body.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(head.$$.fragment, local);
    			transition_out(body.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(head, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(body, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$7.name,
    		type: "slot",
    		source: "(48:4) <DataTable sortable table$aria-label=\\\"People list\\\" style=\\\"max-width: 100%;\\\">",
    		ctx
    	});

    	return block;
    }

    function create_fragment$9(ctx) {
    	let div1;
    	let h2;
    	let t1;
    	let div0;
    	let select;
    	let updating_value;
    	let t2;
    	let segmentedbutton;
    	let updating_selected;
    	let t3;
    	let current_block_type_index;
    	let if_block;
    	let if_block_anchor;
    	let current;

    	function select_value_binding(value) {
    		/*select_value_binding*/ ctx[8](value);
    	}

    	let select_props = {
    		label: "Select Metric",
    		style: "margin-right: 20px;",
    		$$slots: { default: [create_default_slot_29] },
    		$$scope: { ctx }
    	};

    	if (/*selectedMetric*/ ctx[0] !== void 0) {
    		select_props.value = /*selectedMetric*/ ctx[0];
    	}

    	select = new Select({ props: select_props, $$inline: true });
    	binding_callbacks.push(() => bind(select, 'value', select_value_binding));

    	function segmentedbutton_selected_binding(value) {
    		/*segmentedbutton_selected_binding*/ ctx[9](value);
    	}

    	let segmentedbutton_props = {
    		segments: /*choices*/ ctx[6],
    		singleSelect: true,
    		$$slots: {
    			default: [
    				create_default_slot_26$1,
    				({ segment }) => ({ 34: segment }),
    				({ segment }) => [0, segment ? 8 : 0]
    			]
    		},
    		$$scope: { ctx }
    	};

    	if (/*choice*/ ctx[2] !== void 0) {
    		segmentedbutton_props.selected = /*choice*/ ctx[2];
    	}

    	segmentedbutton = new SegmentedButton({
    			props: segmentedbutton_props,
    			$$inline: true
    		});

    	binding_callbacks.push(() => bind(segmentedbutton, 'selected', segmentedbutton_selected_binding));
    	const if_block_creators = [create_if_block$6, create_if_block_2$2, create_if_block_4$1];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*choice*/ ctx[2] === "table") return 0;
    		if (/*choice*/ ctx[2] === "strip") return 1;
    		if (/*choice*/ ctx[2] === "beeswarm") return 2;
    		return -1;
    	}

    	if (~(current_block_type_index = select_block_type(ctx))) {
    		if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    	}

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			h2 = element("h2");
    			h2.textContent = "Results";
    			t1 = space();
    			div0 = element("div");
    			create_component(select.$$.fragment);
    			t2 = space();
    			create_component(segmentedbutton.$$.fragment);
    			t3 = space();
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    			add_location(h2, file$8, 21, 2, 910);
    			attr_dev(div0, "class", "buttons-container svelte-1wfszr0");
    			add_location(div0, file$8, 22, 2, 929);
    			attr_dev(div1, "class", "results-header svelte-1wfszr0");
    			add_location(div1, file$8, 20, 0, 879);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			append_dev(div1, h2);
    			append_dev(div1, t1);
    			append_dev(div1, div0);
    			mount_component(select, div0, null);
    			append_dev(div0, t2);
    			mount_component(segmentedbutton, div0, null);
    			insert_dev(target, t3, anchor);

    			if (~current_block_type_index) {
    				if_blocks[current_block_type_index].m(target, anchor);
    			}

    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const select_changes = {};

    			if (dirty[0] & /*metric_names*/ 2 | dirty[1] & /*$$scope*/ 64) {
    				select_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_value && dirty[0] & /*selectedMetric*/ 1) {
    				updating_value = true;
    				select_changes.value = /*selectedMetric*/ ctx[0];
    				add_flush_callback(() => updating_value = false);
    			}

    			select.$set(select_changes);
    			const segmentedbutton_changes = {};

    			if (dirty[1] & /*$$scope, segment*/ 72) {
    				segmentedbutton_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_selected && dirty[0] & /*choice*/ 4) {
    				updating_selected = true;
    				segmentedbutton_changes.selected = /*choice*/ ctx[2];
    				add_flush_callback(() => updating_selected = false);
    			}

    			segmentedbutton.$set(segmentedbutton_changes);
    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if (~current_block_type_index) {
    					if_blocks[current_block_type_index].p(ctx, dirty);
    				}
    			} else {
    				if (if_block) {
    					group_outros();

    					transition_out(if_blocks[previous_block_index], 1, 1, () => {
    						if_blocks[previous_block_index] = null;
    					});

    					check_outros();
    				}

    				if (~current_block_type_index) {
    					if_block = if_blocks[current_block_type_index];

    					if (!if_block) {
    						if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    						if_block.c();
    					} else {
    						if_block.p(ctx, dirty);
    					}

    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				} else {
    					if_block = null;
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(select.$$.fragment, local);
    			transition_in(segmentedbutton.$$.fragment, local);
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(select.$$.fragment, local);
    			transition_out(segmentedbutton.$$.fragment, local);
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			destroy_component(select);
    			destroy_component(segmentedbutton);
    			if (detaching) detach_dev(t3);

    			if (~current_block_type_index) {
    				if_blocks[current_block_type_index].d(detaching);
    			}

    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$9.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const click_handler$1 = e => e.stopPropagation();
    const func_1 = d => d * 100 + "%";
    const func_4 = d => d * 100 + "%";

    function instance$j($$self, $$props, $$invalidate) {
    	let metric_names;
    	let selectedMetric;
    	let $metrics;
    	let $models;
    	let $results;
    	validate_store(metrics, 'metrics');
    	component_subscribe($$self, metrics, $$value => $$invalidate(7, $metrics = $$value));
    	validate_store(models, 'models');
    	component_subscribe($$self, models, $$value => $$invalidate(4, $models = $$value));
    	validate_store(results, 'results');
    	component_subscribe($$self, results, $$value => $$invalidate(5, $results = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Results', slots, []);
    	let choices = ["table", "strip", "beeswarm"];
    	let choice = "table";
    	let evt = [];
    	const writable_props = [];

    	Object_1$2.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$4.warn(`<Results> was created with unknown prop '${key}'`);
    	});

    	function select_value_binding(value) {
    		selectedMetric = value;
    		(($$invalidate(0, selectedMetric), $$invalidate(1, metric_names)), $$invalidate(7, $metrics));
    	}

    	function segmentedbutton_selected_binding(value) {
    		choice = value;
    		$$invalidate(2, choice);
    	}

    	const func = d => d.metric === selectedMetric;
    	const click_handler_1 = r => window.location.hash = "#/result/" + r.id;
    	const mouseout_handler = () => $$invalidate(3, evt = []);
    	const mousemove_handler = (i, e) => $$invalidate(3, evt[i] = e, evt);
    	const func_2 = r => r.metric === selectedMetric;

    	const func_3 = (i, r) => ({
    		slice: r.slice,
    		value: r.modelIds[i]
    		? r.modelResults[r.modelIds[i]].toFixed(2) / 100
    		: -1,
    		size: r.sliceSize
    	});

    	const mouseout_handler_1 = () => $$invalidate(3, evt = []);
    	const mousemove_handler_1 = (i, e) => $$invalidate(3, evt[i] = e, evt);
    	const func_5 = r => r.metric === selectedMetric;

    	const func_6 = (i, r) => ({
    		slice: r.slice,
    		value: r.modelIds[i]
    		? r.modelResults[r.modelIds[i]].toFixed(2) / 100
    		: -1,
    		size: r.sliceSize
    	});

    	$$self.$capture_state = () => ({
    		DataTable,
    		Head,
    		Body,
    		Row: Row$1,
    		Cell,
    		SegmentedButton,
    		Segment,
    		Select,
    		Option,
    		Label,
    		Chip,
    		Text,
    		ChipSet: Set$1,
    		LayerCake,
    		Svg,
    		Html,
    		results,
    		models,
    		metrics,
    		BeeswarmForce,
    		AxisX,
    		Tooltip,
    		Strip,
    		choices,
    		choice,
    		evt,
    		selectedMetric,
    		metric_names,
    		$metrics,
    		$models,
    		$results
    	});

    	$$self.$inject_state = $$props => {
    		if ('choices' in $$props) $$invalidate(6, choices = $$props.choices);
    		if ('choice' in $$props) $$invalidate(2, choice = $$props.choice);
    		if ('evt' in $$props) $$invalidate(3, evt = $$props.evt);
    		if ('selectedMetric' in $$props) $$invalidate(0, selectedMetric = $$props.selectedMetric);
    		if ('metric_names' in $$props) $$invalidate(1, metric_names = $$props.metric_names);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty[0] & /*$metrics*/ 128) {
    			$$invalidate(1, metric_names = $metrics.map(m => m.name));
    		}

    		if ($$self.$$.dirty[0] & /*metric_names*/ 2) {
    			$$invalidate(0, selectedMetric = metric_names[0]);
    		}

    		if ($$self.$$.dirty[0] & /*selectedMetric*/ 1) {
    			console.log(selectedMetric);
    		}

    		if ($$self.$$.dirty[0] & /*$metrics*/ 128) {
    			console.log($metrics);
    		}
    	};

    	return [
    		selectedMetric,
    		metric_names,
    		choice,
    		evt,
    		$models,
    		$results,
    		choices,
    		$metrics,
    		select_value_binding,
    		segmentedbutton_selected_binding,
    		func,
    		click_handler_1,
    		mouseout_handler,
    		mousemove_handler,
    		func_2,
    		func_3,
    		mouseout_handler_1,
    		mousemove_handler_1,
    		func_5,
    		func_6
    	];
    }

    class Results extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$j, create_fragment$9, safe_not_equal, {}, null, [-1, -1]);

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Results",
    			options,
    			id: create_fragment$9.name
    		});
    	}
    }

    /* node_modules/@smui/button/dist/Button.svelte generated by Svelte v3.46.4 */
    const file$7 = "node_modules/@smui/button/dist/Button.svelte";

    // (50:10) {#if touch}
    function create_if_block$5(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "mdc-button__touch");
    			add_location(div, file$7, 49, 21, 1522);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$5.name,
    		type: "if",
    		source: "(50:10) {#if touch}",
    		ctx
    	});

    	return block;
    }

    // (1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple,         unbounded: false,         color,         disabled: !!$$restProps.disabled,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-button': true,     'mdc-button--raised': variant === 'raised',     'mdc-button--unelevated': variant === 'unelevated',     'mdc-button--outlined': variant === 'outlined',     'smui-button--color-secondary': color === 'secondary',     'mdc-button--touch': touch,     'mdc-card__action': context === 'card:action',     'mdc-card__action--button': context === 'card:action',     'mdc-dialog__button': context === 'dialog:action',     'mdc-top-app-bar__navigation-icon': context === 'top-app-bar:navigation',     'mdc-top-app-bar__action-item': context === 'top-app-bar:action',     'mdc-snackbar__action': context === 'snackbar:actions',     'mdc-banner__secondary-action': context === 'banner' && secondary,     'mdc-banner__primary-action': context === 'banner' && !secondary,     'mdc-tooltip__action': context === 'tooltip:rich-actions',     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   {...actionProp}   {...defaultProp}   {...secondaryProp}   {href}   on:click={handleClick}   {...$$restProps}   >
    function create_default_slot$6(ctx) {
    	let div;
    	let t;
    	let if_block_anchor;
    	let current;
    	const default_slot_template = /*#slots*/ ctx[27].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[29], null);
    	let if_block = /*touch*/ ctx[6] && create_if_block$5(ctx);

    	const block = {
    		c: function create() {
    			div = element("div");
    			t = space();
    			if (default_slot) default_slot.c();
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    			attr_dev(div, "class", "mdc-button__ripple");
    			add_location(div, file$7, 48, 3, 1466);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			insert_dev(target, t, anchor);

    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 536870912)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[29],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[29])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[29], dirty, null),
    						null
    					);
    				}
    			}

    			if (/*touch*/ ctx[6]) {
    				if (if_block) ; else {
    					if_block = create_if_block$5(ctx);
    					if_block.c();
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				if_block.d(1);
    				if_block = null;
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (detaching) detach_dev(t);
    			if (default_slot) default_slot.d(detaching);
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$6.name,
    		type: "slot",
    		source: "(1:0) <svelte:component   this={component}   bind:this={element}   use={[     [       Ripple,       {         ripple,         unbounded: false,         color,         disabled: !!$$restProps.disabled,         addClass,         removeClass,         addStyle,       },     ],     forwardEvents,     ...use,   ]}   class={classMap({     [className]: true,     'mdc-button': true,     'mdc-button--raised': variant === 'raised',     'mdc-button--unelevated': variant === 'unelevated',     'mdc-button--outlined': variant === 'outlined',     'smui-button--color-secondary': color === 'secondary',     'mdc-button--touch': touch,     'mdc-card__action': context === 'card:action',     'mdc-card__action--button': context === 'card:action',     'mdc-dialog__button': context === 'dialog:action',     'mdc-top-app-bar__navigation-icon': context === 'top-app-bar:navigation',     'mdc-top-app-bar__action-item': context === 'top-app-bar:action',     'mdc-snackbar__action': context === 'snackbar:actions',     'mdc-banner__secondary-action': context === 'banner' && secondary,     'mdc-banner__primary-action': context === 'banner' && !secondary,     'mdc-tooltip__action': context === 'tooltip:rich-actions',     ...internalClasses,   })}   style={Object.entries(internalStyles)     .map(([name, value]) => `${name}: ${value};`)     .concat([style])     .join(' ')}   {...actionProp}   {...defaultProp}   {...secondaryProp}   {href}   on:click={handleClick}   {...$$restProps}   >",
    		ctx
    	});

    	return block;
    }

    function create_fragment$8(ctx) {
    	let switch_instance;
    	let switch_instance_anchor;
    	let current;

    	const switch_instance_spread_levels = [
    		{
    			use: [
    				[
    					Ripple,
    					{
    						ripple: /*ripple*/ ctx[3],
    						unbounded: false,
    						color: /*color*/ ctx[4],
    						disabled: !!/*$$restProps*/ ctx[22].disabled,
    						addClass: /*addClass*/ ctx[18],
    						removeClass: /*removeClass*/ ctx[19],
    						addStyle: /*addStyle*/ ctx[20]
    					}
    				],
    				/*forwardEvents*/ ctx[16],
    				.../*use*/ ctx[0]
    			]
    		},
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'mdc-button': true,
    				'mdc-button--raised': /*variant*/ ctx[5] === 'raised',
    				'mdc-button--unelevated': /*variant*/ ctx[5] === 'unelevated',
    				'mdc-button--outlined': /*variant*/ ctx[5] === 'outlined',
    				'smui-button--color-secondary': /*color*/ ctx[4] === 'secondary',
    				'mdc-button--touch': /*touch*/ ctx[6],
    				'mdc-card__action': /*context*/ ctx[17] === 'card:action',
    				'mdc-card__action--button': /*context*/ ctx[17] === 'card:action',
    				'mdc-dialog__button': /*context*/ ctx[17] === 'dialog:action',
    				'mdc-top-app-bar__navigation-icon': /*context*/ ctx[17] === 'top-app-bar:navigation',
    				'mdc-top-app-bar__action-item': /*context*/ ctx[17] === 'top-app-bar:action',
    				'mdc-snackbar__action': /*context*/ ctx[17] === 'snackbar:actions',
    				'mdc-banner__secondary-action': /*context*/ ctx[17] === 'banner' && /*secondary*/ ctx[8],
    				'mdc-banner__primary-action': /*context*/ ctx[17] === 'banner' && !/*secondary*/ ctx[8],
    				'mdc-tooltip__action': /*context*/ ctx[17] === 'tooltip:rich-actions',
    				.../*internalClasses*/ ctx[11]
    			})
    		},
    		{
    			style: Object.entries(/*internalStyles*/ ctx[12]).map(func$5).concat([/*style*/ ctx[2]]).join(' ')
    		},
    		/*actionProp*/ ctx[15],
    		/*defaultProp*/ ctx[14],
    		/*secondaryProp*/ ctx[13],
    		{ href: /*href*/ ctx[7] },
    		/*$$restProps*/ ctx[22]
    	];

    	var switch_value = /*component*/ ctx[9];

    	function switch_props(ctx) {
    		let switch_instance_props = {
    			$$slots: { default: [create_default_slot$6] },
    			$$scope: { ctx }
    		};

    		for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
    			switch_instance_props = assign$1(switch_instance_props, switch_instance_spread_levels[i]);
    		}

    		return {
    			props: switch_instance_props,
    			$$inline: true
    		};
    	}

    	if (switch_value) {
    		switch_instance = new switch_value(switch_props(ctx));
    		/*switch_instance_binding*/ ctx[28](switch_instance);
    		switch_instance.$on("click", /*handleClick*/ ctx[21]);
    	}

    	const block = {
    		c: function create() {
    			if (switch_instance) create_component(switch_instance.$$.fragment);
    			switch_instance_anchor = empty$2();
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (switch_instance) {
    				mount_component(switch_instance, target, anchor);
    			}

    			insert_dev(target, switch_instance_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const switch_instance_changes = (dirty & /*Ripple, ripple, color, $$restProps, addClass, removeClass, addStyle, forwardEvents, use, classMap, className, variant, touch, context, secondary, internalClasses, Object, internalStyles, style, actionProp, defaultProp, secondaryProp, href*/ 6289919)
    			? get_spread_update(switch_instance_spread_levels, [
    					dirty & /*Ripple, ripple, color, $$restProps, addClass, removeClass, addStyle, forwardEvents, use*/ 6094873 && {
    						use: [
    							[
    								Ripple,
    								{
    									ripple: /*ripple*/ ctx[3],
    									unbounded: false,
    									color: /*color*/ ctx[4],
    									disabled: !!/*$$restProps*/ ctx[22].disabled,
    									addClass: /*addClass*/ ctx[18],
    									removeClass: /*removeClass*/ ctx[19],
    									addStyle: /*addStyle*/ ctx[20]
    								}
    							],
    							/*forwardEvents*/ ctx[16],
    							.../*use*/ ctx[0]
    						]
    					},
    					dirty & /*classMap, className, variant, color, touch, context, secondary, internalClasses*/ 133490 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'mdc-button': true,
    							'mdc-button--raised': /*variant*/ ctx[5] === 'raised',
    							'mdc-button--unelevated': /*variant*/ ctx[5] === 'unelevated',
    							'mdc-button--outlined': /*variant*/ ctx[5] === 'outlined',
    							'smui-button--color-secondary': /*color*/ ctx[4] === 'secondary',
    							'mdc-button--touch': /*touch*/ ctx[6],
    							'mdc-card__action': /*context*/ ctx[17] === 'card:action',
    							'mdc-card__action--button': /*context*/ ctx[17] === 'card:action',
    							'mdc-dialog__button': /*context*/ ctx[17] === 'dialog:action',
    							'mdc-top-app-bar__navigation-icon': /*context*/ ctx[17] === 'top-app-bar:navigation',
    							'mdc-top-app-bar__action-item': /*context*/ ctx[17] === 'top-app-bar:action',
    							'mdc-snackbar__action': /*context*/ ctx[17] === 'snackbar:actions',
    							'mdc-banner__secondary-action': /*context*/ ctx[17] === 'banner' && /*secondary*/ ctx[8],
    							'mdc-banner__primary-action': /*context*/ ctx[17] === 'banner' && !/*secondary*/ ctx[8],
    							'mdc-tooltip__action': /*context*/ ctx[17] === 'tooltip:rich-actions',
    							.../*internalClasses*/ ctx[11]
    						})
    					},
    					dirty & /*Object, internalStyles, style*/ 4100 && {
    						style: Object.entries(/*internalStyles*/ ctx[12]).map(func$5).concat([/*style*/ ctx[2]]).join(' ')
    					},
    					dirty & /*actionProp*/ 32768 && get_spread_object(/*actionProp*/ ctx[15]),
    					dirty & /*defaultProp*/ 16384 && get_spread_object(/*defaultProp*/ ctx[14]),
    					dirty & /*secondaryProp*/ 8192 && get_spread_object(/*secondaryProp*/ ctx[13]),
    					dirty & /*href*/ 128 && { href: /*href*/ ctx[7] },
    					dirty & /*$$restProps*/ 4194304 && get_spread_object(/*$$restProps*/ ctx[22])
    				])
    			: {};

    			if (dirty & /*$$scope, touch*/ 536870976) {
    				switch_instance_changes.$$scope = { dirty, ctx };
    			}

    			if (switch_value !== (switch_value = /*component*/ ctx[9])) {
    				if (switch_instance) {
    					group_outros();
    					const old_component = switch_instance;

    					transition_out(old_component.$$.fragment, 1, 0, () => {
    						destroy_component(old_component, 1);
    					});

    					check_outros();
    				}

    				if (switch_value) {
    					switch_instance = new switch_value(switch_props(ctx));
    					/*switch_instance_binding*/ ctx[28](switch_instance);
    					switch_instance.$on("click", /*handleClick*/ ctx[21]);
    					create_component(switch_instance.$$.fragment);
    					transition_in(switch_instance.$$.fragment, 1);
    					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
    				} else {
    					switch_instance = null;
    				}
    			} else if (switch_value) {
    				switch_instance.$set(switch_instance_changes);
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*switch_instance_binding*/ ctx[28](null);
    			if (detaching) detach_dev(switch_instance_anchor);
    			if (switch_instance) destroy_component(switch_instance, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$8.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$5 = ([name, value]) => `${name}: ${value};`;

    function instance$i($$self, $$props, $$invalidate) {
    	let actionProp;
    	let defaultProp;
    	let secondaryProp;

    	const omit_props_names = [
    		"use","class","style","ripple","color","variant","touch","href","action","defaultAction","secondary","component","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Button', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { ripple = true } = $$props;
    	let { color = 'primary' } = $$props;
    	let { variant = 'text' } = $$props;
    	let { touch = false } = $$props;
    	let { href = undefined } = $$props;
    	let { action = 'close' } = $$props;
    	let { defaultAction = false } = $$props;
    	let { secondary = false } = $$props;
    	let element;
    	let internalClasses = {};
    	let internalStyles = {};
    	let context = getContext('SMUI:button:context');
    	let { component = href == null ? Button : A } = $$props;
    	let previousDisabled = $$restProps.disabled;
    	setContext('SMUI:label:context', 'button');
    	setContext('SMUI:icon:context', 'button');

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(11, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(11, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(12, internalStyles);
    			} else {
    				$$invalidate(12, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function handleClick() {
    		if (context === 'banner') {
    			dispatch$1(getElement(), secondary
    			? 'SMUIBannerButton:secondaryActionClick'
    			: 'SMUIBannerButton:primaryActionClick');
    		}
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function switch_instance_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(10, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$invalidate(30, $$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props)));
    		$$invalidate(22, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(2, style = $$new_props.style);
    		if ('ripple' in $$new_props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('color' in $$new_props) $$invalidate(4, color = $$new_props.color);
    		if ('variant' in $$new_props) $$invalidate(5, variant = $$new_props.variant);
    		if ('touch' in $$new_props) $$invalidate(6, touch = $$new_props.touch);
    		if ('href' in $$new_props) $$invalidate(7, href = $$new_props.href);
    		if ('action' in $$new_props) $$invalidate(23, action = $$new_props.action);
    		if ('defaultAction' in $$new_props) $$invalidate(24, defaultAction = $$new_props.defaultAction);
    		if ('secondary' in $$new_props) $$invalidate(8, secondary = $$new_props.secondary);
    		if ('component' in $$new_props) $$invalidate(9, component = $$new_props.component);
    		if ('$$scope' in $$new_props) $$invalidate(29, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		setContext,
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Ripple,
    		A,
    		Button,
    		forwardEvents,
    		use,
    		className,
    		style,
    		ripple,
    		color,
    		variant,
    		touch,
    		href,
    		action,
    		defaultAction,
    		secondary,
    		element,
    		internalClasses,
    		internalStyles,
    		context,
    		component,
    		previousDisabled,
    		addClass,
    		removeClass,
    		addStyle,
    		handleClick,
    		getElement,
    		secondaryProp,
    		defaultProp,
    		actionProp
    	});

    	$$self.$inject_state = $$new_props => {
    		$$invalidate(30, $$props = assign$1(assign$1({}, $$props), $$new_props));
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(2, style = $$new_props.style);
    		if ('ripple' in $$props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('color' in $$props) $$invalidate(4, color = $$new_props.color);
    		if ('variant' in $$props) $$invalidate(5, variant = $$new_props.variant);
    		if ('touch' in $$props) $$invalidate(6, touch = $$new_props.touch);
    		if ('href' in $$props) $$invalidate(7, href = $$new_props.href);
    		if ('action' in $$props) $$invalidate(23, action = $$new_props.action);
    		if ('defaultAction' in $$props) $$invalidate(24, defaultAction = $$new_props.defaultAction);
    		if ('secondary' in $$props) $$invalidate(8, secondary = $$new_props.secondary);
    		if ('element' in $$props) $$invalidate(10, element = $$new_props.element);
    		if ('internalClasses' in $$props) $$invalidate(11, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(12, internalStyles = $$new_props.internalStyles);
    		if ('context' in $$props) $$invalidate(17, context = $$new_props.context);
    		if ('component' in $$props) $$invalidate(9, component = $$new_props.component);
    		if ('previousDisabled' in $$props) $$invalidate(26, previousDisabled = $$new_props.previousDisabled);
    		if ('secondaryProp' in $$props) $$invalidate(13, secondaryProp = $$new_props.secondaryProp);
    		if ('defaultProp' in $$props) $$invalidate(14, defaultProp = $$new_props.defaultProp);
    		if ('actionProp' in $$props) $$invalidate(15, actionProp = $$new_props.actionProp);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		$$invalidate(15, actionProp = context === 'dialog:action' && action != null
    		? { 'data-mdc-dialog-action': action }
    		: { action: $$props.action });

    		$$invalidate(14, defaultProp = context === 'dialog:action' && defaultAction
    		? { 'data-mdc-dialog-button-default': '' }
    		: { default: $$props.default });

    		$$invalidate(13, secondaryProp = context === 'banner'
    		? {}
    		: { secondary: $$props.secondary });

    		if (previousDisabled !== $$restProps.disabled) {
    			getElement().blur();
    			$$invalidate(26, previousDisabled = $$restProps.disabled);
    		}
    	};

    	$$props = exclude_internal_props($$props);

    	return [
    		use,
    		className,
    		style,
    		ripple,
    		color,
    		variant,
    		touch,
    		href,
    		secondary,
    		component,
    		element,
    		internalClasses,
    		internalStyles,
    		secondaryProp,
    		defaultProp,
    		actionProp,
    		forwardEvents,
    		context,
    		addClass,
    		removeClass,
    		addStyle,
    		handleClick,
    		$$restProps,
    		action,
    		defaultAction,
    		getElement,
    		previousDisabled,
    		slots,
    		switch_instance_binding,
    		$$scope
    	];
    }

    class Button_1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$i, create_fragment$8, safe_not_equal, {
    			use: 0,
    			class: 1,
    			style: 2,
    			ripple: 3,
    			color: 4,
    			variant: 5,
    			touch: 6,
    			href: 7,
    			action: 23,
    			defaultAction: 24,
    			secondary: 8,
    			component: 9,
    			getElement: 25
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Button_1",
    			options,
    			id: create_fragment$8.name
    		});
    	}

    	get use() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get color() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set color(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get variant() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set variant(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get touch() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set touch(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get href() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set href(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get action() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set action(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get defaultAction() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set defaultAction(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get secondary() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set secondary(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get component() {
    		throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set component(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[25];
    	}

    	set getElement(value) {
    		throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/samples/Samples.svelte generated by Svelte v3.46.4 */

    const { Object: Object_1$1 } = globals;
    const file$6 = "src/samples/Samples.svelte";

    function get_each_context$2(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[7] = list[i];
    	return child_ctx;
    }

    function get_each_context_1(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[10] = list[i];
    	return child_ctx;
    }

    // (11:0) <Button   on:click={() => (n += 10)}   variant="outlined"   style="margin-bottom: 20px;">
    function create_default_slot_2$3(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("See more");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2$3.name,
    		type: "slot",
    		source: "(11:0) <Button   on:click={() => (n += 10)}   variant=\\\"outlined\\\"   style=\\\"margin-bottom: 20px;\\\">",
    		ctx
    	});

    	return block;
    }

    // (25:10) {#each Object.keys(row) as key}
    function create_each_block_1(ctx) {
    	let t0_value = /*key*/ ctx[10] + "";
    	let t0;
    	let t1;
    	let t2_value = /*row*/ ctx[7][/*key*/ ctx[10]] + "";
    	let t2;
    	let t3;
    	let br;

    	const block = {
    		c: function create() {
    			t0 = text(t0_value);
    			t1 = text(" : ");
    			t2 = text(t2_value);
    			t3 = space();
    			br = element("br");
    			add_location(br, file$6, 26, 12, 687);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t0, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, t2, anchor);
    			insert_dev(target, t3, anchor);
    			insert_dev(target, br, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*table, n*/ 48 && t0_value !== (t0_value = /*key*/ ctx[10] + "")) set_data_dev(t0, t0_value);
    			if (dirty & /*table, n*/ 48 && t2_value !== (t2_value = /*row*/ ctx[7][/*key*/ ctx[10]] + "")) set_data_dev(t2, t2_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(t2);
    			if (detaching) detach_dev(t3);
    			if (detaching) detach_dev(br);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block_1.name,
    		type: "each",
    		source: "(25:10) {#each Object.keys(row) as key}",
    		ctx
    	});

    	return block;
    }

    // (24:8) <Tooltip>
    function create_default_slot_1$3(ctx) {
    	let each_1_anchor;
    	let each_value_1 = Object.keys(/*row*/ ctx[7]);
    	validate_each_argument(each_value_1);
    	let each_blocks = [];

    	for (let i = 0; i < each_value_1.length; i += 1) {
    		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
    	}

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*table, n, Object*/ 48) {
    				each_value_1 = Object.keys(/*row*/ ctx[7]);
    				validate_each_argument(each_value_1);
    				let i;

    				for (i = 0; i < each_value_1.length; i += 1) {
    					const child_ctx = get_each_context_1(ctx, each_value_1, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    					} else {
    						each_blocks[i] = create_each_block_1(child_ctx);
    						each_blocks[i].c();
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				for (; i < each_blocks.length; i += 1) {
    					each_blocks[i].d(1);
    				}

    				each_blocks.length = each_value_1.length;
    			}
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$3.name,
    		type: "slot",
    		source: "(24:8) <Tooltip>",
    		ctx
    	});

    	return block;
    }

    // (19:6) <Wrapper>
    function create_default_slot$5(ctx) {
    	let img;
    	let img_src_value;
    	let img_alt_value;
    	let t;
    	let tooltip;
    	let current;

    	tooltip = new Tooltip$1({
    			props: {
    				$$slots: { default: [create_default_slot_1$3] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			img = element("img");
    			t = space();
    			create_component(tooltip.$$.fragment);
    			if (!src_url_equal(img.src, img_src_value = "/static/" + /*row*/ ctx[7][/*id_col*/ ctx[0]])) attr_dev(img, "src", img_src_value);
    			attr_dev(img, "alt", img_alt_value = "Image thumbnail for instance " + /*row*/ ctx[7][/*id_col*/ ctx[0]]);
    			add_location(img, file$6, 19, 8, 471);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, img, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (!current || dirty & /*table, n, id_col*/ 49 && !src_url_equal(img.src, img_src_value = "/static/" + /*row*/ ctx[7][/*id_col*/ ctx[0]])) {
    				attr_dev(img, "src", img_src_value);
    			}

    			if (!current || dirty & /*table, n, id_col*/ 49 && img_alt_value !== (img_alt_value = "Image thumbnail for instance " + /*row*/ ctx[7][/*id_col*/ ctx[0]])) {
    				attr_dev(img, "alt", img_alt_value);
    			}

    			const tooltip_changes = {};

    			if (dirty & /*$$scope, table, n*/ 8240) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(img);
    			if (detaching) detach_dev(t);
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$5.name,
    		type: "slot",
    		source: "(19:6) <Wrapper>",
    		ctx
    	});

    	return block;
    }

    // (33:6) {#if output_col}
    function create_if_block_1$2(ctx) {
    	let br;
    	let t0;
    	let span;
    	let t1_value = /*row*/ ctx[7][/*output_col*/ ctx[2]] + "";
    	let t1;

    	const block = {
    		c: function create() {
    			br = element("br");
    			t0 = space();
    			span = element("span");
    			t1 = text(t1_value);
    			add_location(br, file$6, 33, 8, 843);
    			attr_dev(span, "class", "output svelte-rj4j5n");
    			add_location(span, file$6, 34, 8, 858);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, br, anchor);
    			insert_dev(target, t0, anchor);
    			insert_dev(target, span, anchor);
    			append_dev(span, t1);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*table, n, output_col*/ 52 && t1_value !== (t1_value = /*row*/ ctx[7][/*output_col*/ ctx[2]] + "")) set_data_dev(t1, t1_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(br);
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(span);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$2.name,
    		type: "if",
    		source: "(33:6) {#if output_col}",
    		ctx
    	});

    	return block;
    }

    // (37:6) {#if second_output_col}
    function create_if_block$4(ctx) {
    	let br;
    	let t0;
    	let span;
    	let t1_value = /*row*/ ctx[7][/*second_output_col*/ ctx[3]] + "";
    	let t1;

    	const block = {
    		c: function create() {
    			br = element("br");
    			t0 = space();
    			span = element("span");
    			t1 = text(t1_value);
    			add_location(br, file$6, 37, 8, 955);
    			attr_dev(span, "class", "second_output svelte-rj4j5n");
    			add_location(span, file$6, 38, 8, 970);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, br, anchor);
    			insert_dev(target, t0, anchor);
    			insert_dev(target, span, anchor);
    			append_dev(span, t1);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*table, n, second_output_col*/ 56 && t1_value !== (t1_value = /*row*/ ctx[7][/*second_output_col*/ ctx[3]] + "")) set_data_dev(t1, t1_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(br);
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(span);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$4.name,
    		type: "if",
    		source: "(37:6) {#if second_output_col}",
    		ctx
    	});

    	return block;
    }

    // (17:2) {#each table.slice(0, n).objects() as row}
    function create_each_block$2(ctx) {
    	let div;
    	let wrapper;
    	let t0;
    	let br;
    	let t1;
    	let span;
    	let t2_value = /*row*/ ctx[7][/*label_col*/ ctx[1]] + "";
    	let t2;
    	let t3;
    	let t4;
    	let t5;
    	let current;

    	wrapper = new Wrapper$1({
    			props: {
    				$$slots: { default: [create_default_slot$5] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	let if_block0 = /*output_col*/ ctx[2] && create_if_block_1$2(ctx);
    	let if_block1 = /*second_output_col*/ ctx[3] && create_if_block$4(ctx);

    	const block = {
    		c: function create() {
    			div = element("div");
    			create_component(wrapper.$$.fragment);
    			t0 = space();
    			br = element("br");
    			t1 = space();
    			span = element("span");
    			t2 = text(t2_value);
    			t3 = space();
    			if (if_block0) if_block0.c();
    			t4 = space();
    			if (if_block1) if_block1.c();
    			t5 = space();
    			add_location(br, file$6, 30, 6, 754);
    			attr_dev(span, "class", "label svelte-rj4j5n");
    			add_location(span, file$6, 31, 6, 767);
    			attr_dev(div, "class", "box svelte-rj4j5n");
    			add_location(div, file$6, 17, 4, 429);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    			mount_component(wrapper, div, null);
    			append_dev(div, t0);
    			append_dev(div, br);
    			append_dev(div, t1);
    			append_dev(div, span);
    			append_dev(span, t2);
    			append_dev(div, t3);
    			if (if_block0) if_block0.m(div, null);
    			append_dev(div, t4);
    			if (if_block1) if_block1.m(div, null);
    			append_dev(div, t5);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const wrapper_changes = {};

    			if (dirty & /*$$scope, table, n, id_col*/ 8241) {
    				wrapper_changes.$$scope = { dirty, ctx };
    			}

    			wrapper.$set(wrapper_changes);
    			if ((!current || dirty & /*table, n, label_col*/ 50) && t2_value !== (t2_value = /*row*/ ctx[7][/*label_col*/ ctx[1]] + "")) set_data_dev(t2, t2_value);

    			if (/*output_col*/ ctx[2]) {
    				if (if_block0) {
    					if_block0.p(ctx, dirty);
    				} else {
    					if_block0 = create_if_block_1$2(ctx);
    					if_block0.c();
    					if_block0.m(div, t4);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (/*second_output_col*/ ctx[3]) {
    				if (if_block1) {
    					if_block1.p(ctx, dirty);
    				} else {
    					if_block1 = create_if_block$4(ctx);
    					if_block1.c();
    					if_block1.m(div, t5);
    				}
    			} else if (if_block1) {
    				if_block1.d(1);
    				if_block1 = null;
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(wrapper.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(wrapper.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			destroy_component(wrapper);
    			if (if_block0) if_block0.d();
    			if (if_block1) if_block1.d();
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$2.name,
    		type: "each",
    		source: "(17:2) {#each table.slice(0, n).objects() as row}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$7(ctx) {
    	let button;
    	let t;
    	let div;
    	let current;

    	button = new Button_1({
    			props: {
    				variant: "outlined",
    				style: "margin-bottom: 20px;",
    				$$slots: { default: [create_default_slot_2$3] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	button.$on("click", /*click_handler*/ ctx[6]);
    	let each_value = /*table*/ ctx[4].slice(0, /*n*/ ctx[5]).objects();
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			create_component(button.$$.fragment);
    			t = space();
    			div = element("div");

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			attr_dev(div, "class", "container svelte-rj4j5n");
    			add_location(div, file$6, 15, 0, 356);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			mount_component(button, target, anchor);
    			insert_dev(target, t, anchor);
    			insert_dev(target, div, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(div, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const button_changes = {};

    			if (dirty & /*$$scope*/ 8192) {
    				button_changes.$$scope = { dirty, ctx };
    			}

    			button.$set(button_changes);

    			if (dirty & /*table, n, second_output_col, output_col, label_col, Object, id_col*/ 63) {
    				each_value = /*table*/ ctx[4].slice(0, /*n*/ ctx[5]).objects();
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$2(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block$2(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(div, null);
    					}
    				}

    				group_outros();

    				for (i = each_value.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(button.$$.fragment, local);

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(button.$$.fragment, local);
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(button, detaching);
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(div);
    			destroy_each(each_blocks, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$7.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$h($$self, $$props, $$invalidate) {
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Samples', slots, []);
    	let { id_col } = $$props;
    	let { label_col } = $$props;
    	let { output_col = "" } = $$props;
    	let { second_output_col = "" } = $$props;
    	let { table } = $$props;
    	let n = 20;
    	const writable_props = ['id_col', 'label_col', 'output_col', 'second_output_col', 'table'];

    	Object_1$1.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Samples> was created with unknown prop '${key}'`);
    	});

    	const click_handler = () => $$invalidate(5, n += 10);

    	$$self.$$set = $$props => {
    		if ('id_col' in $$props) $$invalidate(0, id_col = $$props.id_col);
    		if ('label_col' in $$props) $$invalidate(1, label_col = $$props.label_col);
    		if ('output_col' in $$props) $$invalidate(2, output_col = $$props.output_col);
    		if ('second_output_col' in $$props) $$invalidate(3, second_output_col = $$props.second_output_col);
    		if ('table' in $$props) $$invalidate(4, table = $$props.table);
    	};

    	$$self.$capture_state = () => ({
    		Tooltip: Tooltip$1,
    		Wrapper: Wrapper$1,
    		Button: Button_1,
    		id_col,
    		label_col,
    		output_col,
    		second_output_col,
    		table,
    		n
    	});

    	$$self.$inject_state = $$props => {
    		if ('id_col' in $$props) $$invalidate(0, id_col = $$props.id_col);
    		if ('label_col' in $$props) $$invalidate(1, label_col = $$props.label_col);
    		if ('output_col' in $$props) $$invalidate(2, output_col = $$props.output_col);
    		if ('second_output_col' in $$props) $$invalidate(3, second_output_col = $$props.second_output_col);
    		if ('table' in $$props) $$invalidate(4, table = $$props.table);
    		if ('n' in $$props) $$invalidate(5, n = $$props.n);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [id_col, label_col, output_col, second_output_col, table, n, click_handler];
    }

    class Samples extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$h, create_fragment$7, safe_not_equal, {
    			id_col: 0,
    			label_col: 1,
    			output_col: 2,
    			second_output_col: 3,
    			table: 4
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Samples",
    			options,
    			id: create_fragment$7.name
    		});

    		const { ctx } = this.$$;
    		const props = options.props || {};

    		if (/*id_col*/ ctx[0] === undefined && !('id_col' in props)) {
    			console.warn("<Samples> was created without expected prop 'id_col'");
    		}

    		if (/*label_col*/ ctx[1] === undefined && !('label_col' in props)) {
    			console.warn("<Samples> was created without expected prop 'label_col'");
    		}

    		if (/*table*/ ctx[4] === undefined && !('table' in props)) {
    			console.warn("<Samples> was created without expected prop 'table'");
    		}
    	}

    	get id_col() {
    		throw new Error("<Samples>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set id_col(value) {
    		throw new Error("<Samples>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get label_col() {
    		throw new Error("<Samples>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set label_col(value) {
    		throw new Error("<Samples>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get output_col() {
    		throw new Error("<Samples>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set output_col(value) {
    		throw new Error("<Samples>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get second_output_col() {
    		throw new Error("<Samples>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set second_output_col(value) {
    		throw new Error("<Samples>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get table() {
    		throw new Error("<Samples>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set table(value) {
    		throw new Error("<Samples>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    var isArray$2 = Array.isArray;

    function toArray(value) {
      return value != null
        ? (isArray$2(value) ? value : [value])
        : [];
    }

    /**
     * Generate a table expression that filters a table based on ordered row
     * indices from start to end (end not included), where start and end
     * represent per-group ordered row numbers in the table. The resulting
     * string can be used as the input to the filter verb.
     * @param {number} [start] Zero-based index at which to start extraction.
     *  A negative index indicates an offset from the end of the group.
     *  If start is undefined, slice starts from the index 0.
     * @param {number} [end] Zero-based index before which to end extraction.
     *  A negative index indicates an offset from the end of the group.
     *  If end is omitted, slice extracts through the end of the group.
     * @return {string} A table expression string for slicing values.
     * @example slice(1, -1)
     */
    function slice(start = 0, end = Infinity) {
      return `${prep(start)} < row_number() && row_number() <= ${prep(end)}`;
    }

    function prep(index) {
      return index < 0 ? `count() + ${index}` : index;
    }

    /**
     * Abstract base class for transforming data.
     */
    class Transformable {

      /**
       * Instantiate a new Transformable instance.
       * @param {Params} [params] The parameter values.
       */
      constructor(params) {
        if (params) this._params = params;
      }

      /**
       * Get or set table expression parameter values.
       * If called with no arguments, returns the current parameter values
       * as an object. Otherwise, adds the provided parameters to this
       * table's parameter set and returns the table. Any prior parameters
       * with names matching the input parameters are overridden.
       * @param {Params} [values] The parameter values.
       * @return {this|Params} The current parameters values (if called with
       *  no arguments) or this table.
       */
      params(values) {
        if (arguments.length) {
          if (values) {
            this._params = { ...this._params, ...values };
          }
          return this;
        } else {
          return this._params;
        }
      }

      /**
       * Create a new fully-materialized instance of this table.
       * All filter and orderby settings are removed from the new table.
       * Instead, the backing data itself is filtered and ordered as needed.
       * @param {number[]} [indices] Ordered row indices to materialize.
       *  If unspecified, all rows passing the table filter are used.
       * @return {this} A reified table.
       */
      reify(indices) {
        return this.__reify(this, indices);
      }

      // -- Transformation Verbs ------------------------------------------------

      /**
       * Count the number of values in a group. This method is a shorthand
       * for {@link Transformable#rollup} with a count aggregate function.
       * @param {CountOptions} [options] Options for the count.
       * @return {this} A new table with groupby and count columns.
       * @example table.groupby('colA').count()
       * @example table.groupby('colA').count({ as: 'num' })
       */
      count(options) {
        return this.__count(this, options);
      }

      /**
       * Derive new column values based on the provided expressions. By default,
       * new columns are added after (higher indices than) existing columns. Use
       * the before or after options to place new columns elsewhere.
       * @param {ExprObject} values Object of name-value pairs defining the
       *  columns to derive. The input object should have output column
       *  names for keys and table expressions for values.
       * @param {DeriveOptions} [options] Options for dropping or relocating
       *  derived columns. Use either a before or after property to indicate
       *  where to place derived columns. Specifying both before and after is an
       *  error. Unlike the relocate verb, this option affects only new columns;
       *  updated columns with existing names are excluded from relocation.
       * @return {this} A new table with derived columns added.
       * @example table.derive({ sumXY: d => d.x + d.y })
       * @example table.derive({ z: d => d.x * d.y }, { before: 'x' })
       */
      derive(values, options) {
        return this.__derive(this, values, options);
      }

      /**
       * Filter a table to a subset of rows based on the input criteria.
       * The resulting table provides a filtered view over the original data; no
       * data copy is made. To create a table that copies only filtered data to
       * new data structures, call {@link Transformable#reify} on the output table.
       * @param {TableExpr} criteria Filter criteria as a table expression.
       *  Both aggregate and window functions are permitted, taking into account
       *  {@link Transformable#groupby} or {@link Transformable#orderby} settings.
       * @return {this} A new table with filtered rows.
       * @example table.filter(d => abs(d.value) < 5)
       */
      filter(criteria) {
        return this.__filter(this, criteria);
      }

      /**
       * Extract rows with indices from start to end (end not included), where
       * start and end represent per-group ordered row numbers in the table.
       * @param {number} [start] Zero-based index at which to start extraction.
       *  A negative index indicates an offset from the end of the group.
       *  If start is undefined, slice starts from the index 0.
       * @param {number} [end] Zero-based index before which to end extraction.
       *  A negative index indicates an offset from the end of the group.
       *  If end is omitted, slice extracts through the end of the group.
       * @return {this} A new table with sliced rows.
       * @example table.slice(1, -1)
       */
      slice(start, end) {
        return this.filter(slice(start, end)).reify();
      }

      /**
       * Group table rows based on a set of column values.
       * Subsequent operations that are sensitive to grouping (such as
       * aggregate functions) will operate over the grouped rows.
       * To undo grouping, use {@link Transformable#ungroup}.
       * @param  {...ExprList} keys Key column values to group by.
       *  The keys may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @return {this} A new table with grouped rows.
       * @example table.groupby('colA', 'colB')
       * @example table.groupby({ key: d => d.colA + d.colB })
       */
      groupby(...keys) {
        return this.__groupby(this, keys.flat());
      }

      /**
       * Order table rows based on a set of column values.
       * Subsequent operations sensitive to ordering (such as window functions)
       * will operate over sorted values.
       * The resulting table provides an view over the original data, without
       * any copying. To create a table with sorted data copied to new data
       * strucures, call {@link Transformable#reify} on the result of this method.
       * To undo ordering, use {@link Transformable#unorder}.
       * @param  {...OrderKeys} keys Key values to sort by, in precedence order.
       *  By default, sorting is done in ascending order.
       *  To sort in descending order, wrap values using {@link desc}.
       *  If a string, order by the column with that name.
       *  If a number, order by the column with that index.
       *  If a function, must be a valid table expression; aggregate functions
       *  are permitted, but window functions are not.
       *  If an object, object values must be valid values parameters
       *  with output column names for keys and table expressions
       *  for values (the output names will be ignored).
       *  If an array, array values must be valid key parameters.
       * @return {this} A new ordered table.
       * @example table.orderby('a', desc('b'))
       * @example table.orderby({ a: 'a', b: desc('b') )})
       * @example table.orderby(desc(d => d.a))
       */
      orderby(...keys) {
        return this.__orderby(this, keys.flat());
      }

      /**
       * Relocate a subset of columns to change their positions, also
       * potentially renaming them.
       * @param {Selection} columns An ordered selection of columns to relocate.
       *  The input may consist of column name strings, column integer indices,
       *  rename objects with current column names as keys and new column names
       *  as values, or functions that take a table as input and returns a valid
       *  selection parameter (typically the output of selection helper functions
       *  such as {@link all}, {@link not}, or {@link range}).
       * @param {RelocateOptions} options Options for relocating. Must include
       *  either the before or after property to indicate where to place the
       *  relocated columns. Specifying both before and after is an error.
       * @return {this} A new table with relocated columns.
       * @example table.relocate(['colY', 'colZ'], { after: 'colX' })
       * @example table.relocate(not('colB', 'colC'), { before: 'colA' })
       * @example table.relocate({ colA: 'newA', colB: 'newB' }, { after: 'colC' })
       */
      relocate(columns, options) {
        return this.__relocate(this, toArray(columns), options);
      }

      /**
       * Rename one or more columns, preserving column order.
       * @param {...Select} columns One or more rename objects with current
       *  column names as keys and new column names as values.
       * @return {this} A new table with renamed columns.
       * @example table.rename({ oldName: 'newName' })
       * @example table.rename({ a: 'a2', b: 'b2' })
       */
      rename(...columns) {
        return this.__rename(this, columns.flat());
      }

      /**
       * Rollup a table to produce an aggregate summary.
       * Often used in conjunction with {@link Transformable#groupby}.
       * To produce counts only, {@link Transformable#count} is a shortcut.
       * @param {ExprObject} [values] Object of name-value pairs defining aggregate
       *  output columns. The input object should have output column names for
       *  keys and table expressions for values. The expressions must be valid
       *  aggregate expressions: window functions are not allowed and column
       *  references must be arguments to aggregate functions.
       * @return {this} A new table of aggregate summary values.
       * @example table.groupby('colA').rollup({ mean: d => mean(d.colB) })
       * @example table.groupby('colA').rollup({ mean: op.median('colB') })
       */
      rollup(values) {
        return this.__rollup(this, values);
      }

      /**
       * Generate a table from a random sample of rows.
       * If the table is grouped, performs a stratified sample by
       * sampling from each group separately.
       * @param {number|TableExpr} size The number of samples to draw per group.
       *  If number-valued, the same sample size is used for each group.
       *  If function-valued, the input should be an aggregate table
       *  expression compatible with {@link Transformable#rollup}.
       * @param {SampleOptions} [options] Options for sampling.
       * @return {this} A new table with sampled rows.
       * @example table.sample(50)
       * @example table.sample(100, { replace: true })
       * @example table.groupby('colA').sample(() => op.floor(0.5 * op.count()))
       */
      sample(size, options) {
        return this.__sample(this, size, options);
      }

      /**
       * Select a subset of columns into a new table, potentially renaming them.
       * @param {...Select} columns An ordered selection of columns.
       *  The input may consist of column name strings, column integer indices,
       *  rename objects with current column names as keys and new column names
       *  as values, or functions that take a table as input and returns a valid
       *  selection parameter (typically the output of selection helper functions
       *  such as {@link all}, {@link not}, or {@link range}).
       * @return {this} A new table of selected columns.
       * @example table.select('colA', 'colB')
       * @example table.select(not('colB', 'colC'))
       * @example table.select({ colA: 'newA', colB: 'newB' })
       */
      select(...columns) {
        return this.__select(this, columns.flat());
      }

      /**
       * Ungroup a table, removing any grouping criteria.
       * Undoes the effects of {@link Transformable#groupby}.
       * @return {this} A new ungrouped table, or this table if not grouped.
       * @example table.ungroup()
       */
      ungroup() {
        return this.__ungroup(this);
      }

      /**
       * Unorder a table, removing any sorting criteria.
       * Undoes the effects of {@link Transformable#orderby}.
       * @return {this} A new unordered table, or this table if not ordered.
       * @example table.unorder()
       */
      unorder() {
        return this.__unorder(this);
      }

      // -- Cleaning Verbs ------------------------------------------------------

      /**
       * De-duplicate table rows by removing repeated row values.
       * @param {...ExprList} keys Key columns to check for duplicates.
       *  Two rows are considered duplicates if they have matching values for
       *  all keys. If keys are unspecified, all columns are used.
       *  The keys may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @return {this} A new de-duplicated table.
       * @example table.dedupe()
       * @example table.dedupe('a', 'b')
       * @example table.dedupe({ abs: d => op.abs(d.a) })
       */
      dedupe(...keys) {
        return this.__dedupe(this, keys.flat());
      }

      /**
       * Impute missing values or rows. Accepts a set of column-expression pairs
       * and evaluates the expressions to replace any missing (null, undefined,
       * or NaN) values in the original column.
       * If the expand option is specified, imputes new rows for missing
       * combinations of values. All combinations of key values (a full cross
       * product) are considered for each level of grouping (specified by
       * {@link Transformable#groupby}). New rows will be added for any combination
       * of key and groupby values not already contained in the table. For all
       * non-key and non-group columns the new rows are populated with imputation
       * values (first argument) if specified, otherwise undefined.
       * If the expand option is specified, any filter or orderby settings are
       * removed from the output table, but groupby settings persist.
       * @param {ExprObject} values Object of name-value pairs for the column values
       *  to impute. The input object should have existing column names for keys
       *  and table expressions for values. The expressions will be evaluated to
       *  determine replacements for any missing values.
       * @param {ImputeOptions} [options] Imputation options. The expand
       *  property specifies a set of column values to consider for imputing
       *  missing rows. All combinations of expanded values are considered, and
       *  new rows are added for each combination that does not appear in the
       *  input table.
       * @return {this} A new table with imputed values and/or rows.
       * @example table.impute({ v: () => 0 })
       * @example table.impute({ v: d => op.mean(d.v) })
       * @example table.impute({ v: () => 0 }, { expand: ['x', 'y'] })
       */
      impute(values, options) {
        return this.__impute(this, values, options);
      }

      // -- Reshaping Verbs -----------------------------------------------------

      /**
       * Fold one or more columns into two key-value pair columns.
       * The fold transform is an inverse of the {@link Transformable#pivot} transform.
       * The resulting table has two new columns, one containing the column
       * names (named "key") and the other the column values (named "value").
       * The number of output rows equals the original row count multiplied
       * by the number of folded columns.
       * @param {ExprList} values The columns to fold.
       *  The columns may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @param {FoldOptions} [options] Options for folding.
       * @return {this} A new folded table.
       * @example table.fold('colA')
       * @example table.fold(['colA', 'colB'])
       * @example table.fold(range(5, 8))
       */
      fold(values, options) {
        return this.__fold(this, values, options);
      }

      /**
       * Pivot columns into a cross-tabulation.
       * The pivot transform is an inverse of the {@link Transformable#fold} transform.
       * The resulting table has new columns for each unique combination
       * of the provided *keys*, populated with the provided *values*.
       * The provided *values* must be aggregates, as a single set of keys may
       * include more than one row. If string-valued, the *any* aggregate is used.
       * If only one *values* column is defined, the new pivoted columns will
       * be named using key values directly. Otherwise, input value column names
       * will be included as a component of the output column names.
       * @param {ExprList} keys Key values to map to new column names.
       *  The keys may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @param {ExprList} values Output values for pivoted columns.
       *  Column references will be wrapped in an *any* aggregate.
       *  If object-valued, the input object should have output value
       *  names for keys and aggregate table expressions for values.
       * @param {PivotOptions} [options] Options for pivoting.
       * @return {this} A new pivoted table.
       * @example table.pivot('key', 'value')
       * @example table.pivot(['keyA', 'keyB'], ['valueA', 'valueB'])
       * @example table.pivot({ key: d => d.key }, { value: d => sum(d.value) })
       */
      pivot(keys, values, options) {
        return this.__pivot(this, keys, values, options);
      }

      /**
       * Spread array elements into a set of new columns.
       * Output columns are named based on the value key and array index.
       * @param {ExprList} values The column values to spread.
       *  The values may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @param {SpreadOptions} [options] Options for spreading.
       * @return {this} A new table with the spread columns added.
       * @example table.spread({ a: split(d.text, '') })
       * @example table.spread('arrayCol', { limit: 100 })
       */
      spread(values, options) {
        return this.__spread(this, values, options);
      }

      /**
       * Unroll one or more array-valued columns into new rows.
       * If more than one array value is used, the number of new rows
       * is the smaller of the limit and the largest length.
       * Values for all other columns are copied over.
       * @param {ExprList} values The column values to unroll.
       *  The values may be specified using column name strings, column index
       *  numbers, value objects with output column names for keys and table
       *  expressions for values, or selection helper functions.
       * @param {UnrollOptions} [options] Options for unrolling.
       * @return {this} A new unrolled table.
       * @example table.unroll('colA', { limit: 1000 })
       */
      unroll(values, options) {
        return this.__unroll(this, values, options);
      }

      // -- Joins ---------------------------------------------------------------

      /**
       * Lookup values from a secondary table and add them as new columns.
       * A lookup occurs upon matching key values for rows in both tables.
       * If the secondary table has multiple rows with the same key, only
       * the last observed instance will be considered in the lookup.
       * Lookup is similar to {@link Transformable#join_left}, but with a simpler
       * syntax and the added constraint of allowing at most one match only.
       * @param {TableRef} other The secondary table to look up values from.
       * @param {JoinKeys} [on] Lookup keys (column name strings or table
       *  expressions) for this table and the secondary table, respectively.
       * @param {...ExprList} values The column values to add from the
       *  secondary table. Can be column name strings or objects with column
       *  names as keys and table expressions as values.
       * @return {this} A new table with lookup values added.
       * @example table.lookup(other, ['key1', 'key2'], 'value1', 'value2')
       */
      lookup(other, on, ...values) {
        return this.__lookup(this, other, on, values.flat());
      }

      /**
       * Join two tables, extending the columns of one table with
       * values from the other table. The current table is considered
       * the "left" table in the join, and the new table input is
       * considered the "right" table in the join. By default an inner
       * join is performed, removing all rows that do not match the
       * join criteria. To perform left, right, or full outer joins, use
       * the {@link Transformable#join_left}, {@link Transformable#join_right}, or
       * {@link Transformable#join_full} methods, or provide an options argument.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @param {JoinValues} [values] The columns to include in the join output.
       *  If unspecified, all columns from both tables are included; paired
       *  join keys sharing the same column name are included only once.
       *  If array-valued, a two element array should be provided, containing
       *  the columns to include for the left and right tables, respectively.
       *  Array input may consist of column name strings, objects with output
       *  names as keys and single-table table expressions as values, or the
       *  selection helper functions {@link all}, {@link not}, or {@link range}.
       *  If object-valued, specifies the key-value pairs for each output,
       *  defined using two-table table expressions.
       * @param {JoinOptions} [options] Options for the join.
       * @return {this} A new joined table.
       * @example table.join(other, ['keyL', 'keyR'])
       * @example table.join(other, (a, b) => equal(a.keyL, b.keyR))
       */
      join(other, on, values, options) {
        return this.__join(this, other, on, values, options);
      }

      /**
       * Perform a left outer join on two tables. Rows in the left table
       * that do not match a row in the right table will be preserved.
       * This is a convenience method with fixed options for {@link Transformable#join}.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @param {JoinValues} [values] The columns to include in the join output.
       *  If unspecified, all columns from both tables are included; paired
       *  join keys sharing the same column name are included only once.
       *  If array-valued, a two element array should be provided, containing
       *  the columns to include for the left and right tables, respectively.
       *  Array input may consist of column name strings, objects with output
       *  names as keys and single-table table expressions as values, or the
       *  selection helper functions {@link all}, {@link not}, or {@link range}.
       *  If object-valued, specifies the key-value pairs for each output,
       *  defined using two-table table expressions.
       * @param {JoinOptions} [options] Options for the join. With this method,
       *  any options will be overridden with {left: true, right: false}.
       * @return {this} A new joined table.
       * @example table.join_left(other, ['keyL', 'keyR'])
       * @example table.join_left(other, (a, b) => equal(a.keyL, b.keyR))
       */
      join_left(other, on, values, options) {
        const opt = { ...options, left: true, right: false };
        return this.__join(this, other, on, values, opt);
      }

      /**
       * Perform a right outer join on two tables. Rows in the right table
       * that do not match a row in the left table will be preserved.
       * This is a convenience method with fixed options for {@link Transformable#join}.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @param {JoinValues} [values] The columns to include in the join output.
       *  If unspecified, all columns from both tables are included; paired
       *  join keys sharing the same column name are included only once.
       *  If array-valued, a two element array should be provided, containing
       *  the columns to include for the left and right tables, respectively.
       *  Array input may consist of column name strings, objects with output
       *  names as keys and single-table table expressions as values, or the
       *  selection helper functions {@link all}, {@link not}, or {@link range}.
       *  If object-valued, specifies the key-value pairs for each output,
       *  defined using two-table table expressions.
       * @param {JoinOptions} [options] Options for the join. With this method,
       *  any options will be overridden with {left: false, right: true}.
       * @return {this} A new joined table.
       * @example table.join_right(other, ['keyL', 'keyR'])
       * @example table.join_right(other, (a, b) => equal(a.keyL, b.keyR))
       */
      join_right(other, on, values, options) {
        const opt = { ...options, left: false, right: true };
        return this.__join(this, other, on, values, opt);
      }

      /**
       * Perform a full outer join on two tables. Rows in either the left or
       * right table that do not match a row in the other will be preserved.
       * This is a convenience method with fixed options for {@link Transformable#join}.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @param {JoinValues} [values] The columns to include in the join output.
       *  If unspecified, all columns from both tables are included; paired
       *  join keys sharing the same column name are included only once.
       *  If array-valued, a two element array should be provided, containing
       *  the columns to include for the left and right tables, respectively.
       *  Array input may consist of column name strings, objects with output
       *  names as keys and single-table table expressions as values, or the
       *  selection helper functions {@link all}, {@link not}, or {@link range}.
       *  If object-valued, specifies the key-value pairs for each output,
       *  defined using two-table table expressions.
       * @param {JoinOptions} [options] Options for the join. With this method,
       *  any options will be overridden with {left: true, right: true}.
       * @return {this} A new joined table.
       * @example table.join_full(other, ['keyL', 'keyR'])
       * @example table.join_full(other, (a, b) => equal(a.keyL, b.keyR))
       */
      join_full(other, on, values, options) {
        const opt = { ...options, left: true, right: true };
        return this.__join(this, other, on, values, opt);
      }

      /**
       * Produce the Cartesian cross product of two tables. The output table
       * has one row for every pair of input table rows. Beware that outputs
       * may be quite large, as the number of output rows is the product of
       * the input row counts.
       * This is a convenience method for {@link Transformable#join} in which the
       * join criteria is always true.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinValues} [values] The columns to include in the output.
       *  If unspecified, all columns from both tables are included.
       *  If array-valued, a two element array should be provided, containing
       *  the columns to include for the left and right tables, respectively.
       *  Array input may consist of column name strings, objects with output
       *  names as keys and single-table table expressions as values, or the
       *  selection helper functions {@link all}, {@link not}, or {@link range}.
       *  If object-valued, specifies the key-value pairs for each output,
       *  defined using two-table table expressions.
       * @param {JoinOptions} [options] Options for the join.
       * @return {this} A new joined table.
       * @example table.cross(other)
       * @example table.cross(other, [['leftKey', 'leftVal'], ['rightVal']])
       */
      cross(other, values, options) {
        return this.__cross(this, other, values, options);
      }

      /**
       * Perform a semi-join, filtering the left table to only rows that
       * match a row in the right table.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @return {this} A new filtered table.
       * @example table.semijoin(other)
       * @example table.semijoin(other, ['keyL', 'keyR'])
       * @example table.semijoin(other, (a, b) => equal(a.keyL, b.keyR))
       */
      semijoin(other, on) {
        return this.__semijoin(this, other, on);
      }

      /**
       * Perform an anti-join, filtering the left table to only rows that
       * do *not* match a row in the right table.
       * @param {TableRef} other The other (right) table to join with.
       * @param {JoinPredicate} [on] The join criteria for matching table rows.
       *  If unspecified, the values of all columns with matching names
       *  are compared.
       *  If array-valued, a two-element array should be provided, containing
       *  the columns to compare for the left and right tables, respectively.
       *  If a one-element array or a string value is provided, the same
       *  column names will be drawn from both tables.
       *  If function-valued, should be a two-table table expression that
       *  returns a boolean value. When providing a custom predicate, note that
       *  join key values can be arrays or objects, and that normal join
       *  semantics do not consider null or undefined values to be equal (that is,
       *  null !== null). Use the op.equal function to handle these cases.
       * @return {this} A new filtered table.
       * @example table.antijoin(other)
       * @example table.antijoin(other, ['keyL', 'keyR'])
       * @example table.antijoin(other, (a, b) => equal(a.keyL, b.keyR))
       */
      antijoin(other, on) {
        return this.__antijoin(this, other, on);
      }

      // -- Set Operations ------------------------------------------------------

      /**
       * Concatenate multiple tables into a single table, preserving all rows.
       * This transformation mirrors the UNION_ALL operation in SQL.
       * Only named columns in this table are included in the output.
       * @see Transformable#union
       * @param  {...TableRef} tables A list of tables to concatenate.
       * @return {this} A new concatenated table.
       * @example table.concat(other)
       * @example table.concat(other1, other2)
       * @example table.concat([other1, other2])
       */
      concat(...tables) {
        return this.__concat(this, tables.flat());
      }

      /**
       * Union multiple tables into a single table, deduplicating all rows.
       * This transformation mirrors the UNION operation in SQL. It is
       * similar to {@link Transformable#concat} but suppresses duplicate rows with
       * values identical to another row.
       * Only named columns in this table are included in the output.
       * @see Transformable#concat
       * @param  {...TableRef} tables A list of tables to union.
       * @return {this} A new unioned table.
       * @example table.union(other)
       * @example table.union(other1, other2)
       * @example table.union([other1, other2])
       */
      union(...tables) {
        return this.__union(this, tables.flat());
      }

      /**
       * Intersect multiple tables, keeping only rows whose with identical
       * values for all columns in all tables, and deduplicates the rows.
       * This transformation is similar to a series of {@link Transformable#semijoin}
       * calls, but additionally suppresses duplicate rows.
       * @see Transformable#semijoin
       * @param  {...TableRef} tables A list of tables to intersect.
       * @return {this} A new filtered table.
       * @example table.intersect(other)
       * @example table.intersect(other1, other2)
       * @example table.intersect([other1, other2])
       */
      intersect(...tables) {
        return this.__intersect(this, tables.flat());
      }

      /**
       * Compute the set difference with multiple tables, keeping only rows in
       * this table that whose values do not occur in the other tables.
       * This transformation is similar to a series of {@link Transformable#antijoin}
       * calls, but additionally suppresses duplicate rows.
       * @see Transformable#antijoin
       * @param  {...TableRef} tables A list of tables to difference.
       * @return {this} A new filtered table.
       * @example table.except(other)
       * @example table.except(other1, other2)
       * @example table.except([other1, other2])
       */
      except(...tables) {
        return this.__except(this, tables.flat());
      }
    }

    // -- Parameter Types -------------------------------------------------------

    /**
     * Table expression parameters.
     * @typedef {Object.<string, *>} Params
     */

    /**
     * A reference to a column by string name or integer index.
     * @typedef {string|number} ColumnRef
     */

    /**
     * A value that can be coerced to a string.
     * @typedef {object} Stringable
     * @property {() => string} toString String coercion method.
     */

    /**
     * A table expression provided as a string or string-coercible value.
     * @typedef {string|Stringable} TableExprString
     */

    /**
     * A struct object with arbitraty named properties.
     * @typedef {Object.<string, *>} Struct
     */

    /**
     * A function defined over a table row.
     * @typedef {(d?: Struct, $?: Params) => any} TableExprFunc
     */

    /**
     * A table expression defined over a single table.
     * @typedef {TableExprFunc|TableExprString} TableExpr
     */

    /**
     * A function defined over rows from two tables.
     * @typedef {(a?: Struct, b?: Struct, $?: Params) => any} TableFunc2
     */

    /**
     * A table expression defined over two tables.
     * @typedef {TableExprFunc2|TableExprString} TableExpr2
     */

    /**
     * An object that maps current column names to new column names.
     * @typedef {{ [name: string]: string }} RenameMap
     */

    /**
     * A selection helper function.
     * @typedef {(table: any) => string[]} SelectHelper
     */

    /**
     * One or more column selections, potentially with renaming.
     * The input may consist of a column name string, column integer index, a
     * rename map object with current column names as keys and new column names
     * as values, or a select helper function that takes a table as input and
     * returns a valid selection parameter.
     * @typedef {ColumnRef|RenameMap|SelectHelper} SelectEntry
     */

    /**
     * An ordered set of column selections, potentially with renaming.
     * @typedef {SelectEntry|SelectEntry[]} Select
     */

    /**
     * An object of column name / table expression pairs.
     * @typedef {{ [name: string]: TableExpr }} ExprObject
     */

    /**
     * An object of column name / two-table expression pairs.
     * @typedef {{ [name: string]: TableExpr2 }} Expr2Object
     */

    /**
     * An ordered set of one or more column values.
     * @typedef {ColumnRef|SelectHelper|ExprObject} ListEntry
     */

    /**
     * An ordered set of column values.
     * Entries may be column name strings, column index numbers, value objects
     * with output column names for keys and table expressions for values,
     * or a selection helper function.
     * @typedef {ListEntry|ListEntry[]} ExprList
     */

    /**
     * A reference to a data table or transformable instance.
     * @typedef {Transformable|string} TableRef
     */

    /**
     * One or more orderby sort criteria.
     * If a string, order by the column with that name.
     * If a number, order by the column with that index.
     * If a function, must be a valid table expression; aggregate functions
     *  are permitted, but window functions are not.
     * If an object, object values must be valid values parameters
     *  with output column names for keys and table expressions
     *  for values. The output name keys will subsequently be ignored.
     * @typedef {ColumnRef|TableExpr|ExprObject} OrderKey
     */

    /**
     * An ordered set of orderby sort criteria, in precedence order.
     * @typedef {OrderKey|OrderKey[]} OrderKeys
     */

    /**
     * Column values to use as a join key.
     * @typedef {ColumnRef|TableExprFunc} JoinKey
     */

    /**
     * An ordered set of join keys.
     * @typedef {JoinKey|[JoinKey[]]|[JoinKey[], JoinKey[]]} JoinKeys
     */

    /**
     * A predicate specification for joining two tables.
     * @typedef {JoinKeys|TableExprFunc2|null} JoinPredicate
     */

    /**
     * An array of per-table join values to extract.
     * @typedef {[ExprList]|[ExprList, ExprList]|[ExprList, ExprList, Expr2Object]} JoinList
     */

    /**
     * A specification of join values to extract.
     * @typedef {JoinList|Expr2Object} JoinValues
     */

    // -- Transform Options -----------------------------------------------------

    /**
     * Options for count transformations.
     * @typedef {object} CountOptions
     * @property {string} [as='count'] The name of the output count column.
     */

    /**
     * Options for derive transformations.
     * @typedef {object} DeriveOptions
     * @property {boolean} [drop=false] A flag indicating if the original
     *  columns should be dropped, leaving only the derived columns. If true,
     *  the before and after options are ignored.
     * @property {Select} [before]
     *  An anchor column that relocated columns should be placed before.
     *  The value can be any legal column selection. If multiple columns are
     *  selected, only the first column will be used as an anchor.
     *  It is an error to specify both before and after options.
     * @property {Select} [after]
     *  An anchor column that relocated columns should be placed after.
     *  The value can be any legal column selection. If multiple columns are
     *  selected, only the last column will be used as an anchor.
     *  It is an error to specify both before and after options.
     */

    /**
     * Options for relocate transformations.
     * @typedef {object} RelocateOptions
     * @property {Selection} [before]
     *  An anchor column that relocated columns should be placed before.
     *  The value can be any legal column selection. If multiple columns are
     *  selected, only the first column will be used as an anchor.
     *  It is an error to specify both before and after options.
     * @property {Selection} [after]
     *  An anchor column that relocated columns should be placed after.
     *  The value can be any legal column selection. If multiple columns are
     *  selected, only the last column will be used as an anchor.
     *  It is an error to specify both before and after options.
     */

    /**
     * Options for sample transformations.
     * @typedef {object} SampleOptions
     * @property {boolean} [replace=false] Flag for sampling with replacement.
     * @property {boolean} [shuffle=true] Flag to ensure randomly ordered rows.
     * @property {string|TableExprFunc} [weight] Column values to use as weights
     *  for sampling. Rows will be sampled with probability proportional to
     *  their relative weight. The input should be a column name string or
     *  a table expression compatible with {@link Transformable#derive}.
     */

    /**
     * Options for impute transformations.
     * @typedef {object} ImputeOptions
     * @property {ExprList} [expand] Column values to combine to impute missing
     *  rows. For column names and indices, all unique column values are
     *  considered. Otherwise, each entry should be an object of name-expresion
     *  pairs, with valid table expressions for {@link Transformable#rollup}.
     *  All combinations of values are checked for each set of unique groupby
     *  values.
     */

    /**
     * Options for fold transformations.
     * @typedef {object} FoldOptions
     * @property {string[]} [as=['key', 'value']] An array indicating the
     *  output column names to use for the key and value columns, respectively.
     */

    /**
     * Options for pivot transformations.
     * @typedef {object} PivotOptions
     * @property {number} [limit=Infinity] The maximum number of new columns to generate.
     * @property {string} [keySeparator='_'] A string to place between multiple key names.
     * @property {string} [valueSeparator='_'] A string to place between key and value names.
     * @property {boolean} [sort=true] Flag for alphabetical sorting of new column names.
     */

    /**
     * Options for spread transformations.
     * @typedef {object} SpreadOptions
     * @property {boolean} [drop=true] Flag indicating if input columns to the
     *  spread operation should be dropped in the output table.
     * @property {number} [limit=Infinity] The maximum number of new columns to
     *  generate.
     * @property {string[]} [as] Output column names to use. This option only
     *  applies when a single column is spread. If the given array of names is
     *  shorter than the number of generated columns and no limit option is
     *  specified, the additional generated columns will be dropped.
     */

    /**
     * Options for unroll transformations.
     * @typedef {object} UnrollOptions
     * @property {number} [limit=Infinity] The maximum number of new rows
     *  to generate per array value.
     * @property {boolean|string} [index=false] Flag or column name for adding
     *  zero-based array index values as an output column. If true, a new column
     *  named "index" will be included. If string-valued, a new column with
     *  the given name will be added.
     * @property {Select} [drop] Columns to drop from the output. The input may
     *  consist of column name strings, column integer indices, objects with
     *  column names as keys, or functions that take a table as input and
     *  return a valid selection parameter (typically the output of selection
     *  helper functions such as {@link all}, {@link not}, or {@link range}).
     */

    /**
     * Options for join transformations.
     * @typedef {object} JoinOptions
     * @property {boolean} [left=false] Flag indicating a left outer join.
     *  If both the *left* and *right* are true, indicates a full outer join.
     * @property {boolean} [right=false] Flag indicating a right outer join.
     *  If both the *left* and *right* are true, indicates a full outer join.
     * @property {string[]} [suffix=['_1', '_2']] Column name suffixes to
     *  append if two columns with the same name are produced by the join.
     */

    function error(message) {
      throw Error(message);
    }

    function isNumber$1(value) {
      return typeof value === 'number';
    }

    function isFunction$1(value) {
      return typeof value === 'function';
    }

    function repeat(reps, value) {
      const result = Array(reps);
      if (isFunction$1(value)) {
        for (let i = 0; i < reps; ++i) {
          result[i] = value(i);
        }
      } else {
        result.fill(value);
      }
      return result;
    }

    /**
     * Abstract class representing a data table.
     */
    class Table$1 extends Transformable {

      /**
       * Instantiate a new Table instance.
       * @param {string[]} names An ordered list of column names.
       * @param {number} nrows The number of rows.
       * @param {TableData} data The backing data, which can vary by implementation.
       * @param {BitSet} [filter] A bit mask for which rows to include.
       * @param {GroupBySpec} [groups] A groupby specification for grouping ows.
       * @param {RowComparator} [order] A comparator function for sorting rows.
       * @param {Params} [params] Parameter values for table expressions.
       */
      constructor(names, nrows, data, filter, groups, order, params) {
        super(params);
        this._names = Object.freeze(names);
        this._data = data;
        this._total = nrows;
        this._nrows = filter ? filter.count() : nrows;
        this._mask = (nrows !== this._nrows && filter) || null;
        this._group = groups || null;
        this._order = order || null;
      }

      /**
       * Create a new table with the same type as this table.
       * The new table may have different data, filter, grouping, or ordering
       * based on the values of the optional configuration argument. If a
       * setting is not specified, it is inherited from the current table.
       * @param {CreateOptions} [options] Creation options for the new table.
       * @return {this} A newly created table.
       */
      create(options) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Provide an informative object string tag.
       */
      get [Symbol.toStringTag]() {
        if (!this._names) return 'Object'; // bail if called on prototype
        const nr = this.numRows() + ' row' + (this.numRows() !== 1 ? 's' : '');
        const nc = this.numCols() + ' col' + (this.numCols() !== 1 ? 's' : '');
        return `Table: ${nc} x ${nr}`
          + (this.isFiltered() ? ` (${this.totalRows()} backing)` : '')
          + (this.isGrouped() ? `, ${this._group.size} groups` : '')
          + (this.isOrdered() ? ', ordered' : '');
      }

      /**
       * Indicates if the table has a filter applied.
       * @return {boolean} True if filtered, false otherwise.
       */
      isFiltered() {
        return !!this._mask;
      }

      /**
       * Indicates if the table has a groupby specification.
       * @return {boolean} True if grouped, false otherwise.
       */
      isGrouped() {
        return !!this._group;
      }

      /**
       * Indicates if the table has a row order comparator.
       * @return {boolean} True if ordered, false otherwise.
       */
      isOrdered() {
        return !!this._order;
      }

      /**
       * Returns the internal table storage data structure.
       * @return {TableData} The backing table storage data structure.
       */
      data() {
        return this._data;
      }

      /**
       * Returns the filter bitset mask, if defined.
       * @return {BitSet} The filter bitset mask.
       */
      mask() {
        return this._mask;
      }

      /**
       * Returns the groupby specification, if defined.
       * @return {GroupBySpec} The groupby specification.
       */
      groups() {
        return this._group;
      }

      /**
       * Returns the row order comparator function, if specified.
       * @return {RowComparator} The row order comparator function.
       */
      comparator() {
        return this._order;
      }

      /**
       * The total number of rows in this table, counting both
       * filtered and unfiltered rows.
       * @return {number} The number of total rows.
       */
      totalRows() {
        return this._total;
      }

      /**
       * The number of active rows in this table. This number may be
       * less than the total rows if the table has been filtered.
       * @see Table.totalRows
       * @return {number} The number of rows.
       */
      numRows() {
        return this._nrows;
      }

      /**
       * The number of active rows in this table. This number may be
       * less than the total rows if the table has been filtered.
       * @see Table.totalRows
       * @return {number} The number of rows.
       */
      get size() {
        return this._nrows;
      }

      /**
       * The number of columns in this table.
       * @return {number} The number of columns.
       */
      numCols() {
        return this._names.length;
      }

      /**
       * Filter function invoked for each column name.
       * @callback NameFilter
       * @param {string} name The column name.
       * @param {number} index The column index.
       * @param {string[]} array The array of names.
       * @return {boolean} Returns true to retain the column name.
       */

      /**
       * The table column names, optionally filtered.
       * @param {NameFilter} [filter] An optional filter function.
       *  If unspecified, all column names are returned.
       * @return {string[]} An array of matching column names.
       */
      columnNames(filter) {
        return filter ? this._names.filter(filter) : this._names.slice();
      }

      /**
       * The column name at the given index.
       * @param {number} index The column index.
       * @return {string} The column name,
       *  or undefined if the index is out of range.
       */
      columnName(index) {
        return this._names[index];
      }

      /**
       * The column index for the given name.
       * @param {string} name The column name.
       * @return {number} The column index, or -1 if the name is not found.
       */
      columnIndex(name) {
        return this._names.indexOf(name);
      }

      /**
       * Deprecated alias for the table array() method: use table.array()
       * instead. Get an array of values contained in a column. The resulting
       * array respects any table filter or orderby criteria.
       * @param {string} name The column name.
       * @param {ArrayConstructor|TypedArrayConstructor} [constructor=Array]
       *  The array constructor for instantiating the output array.
       * @return {DataValue[]|TypedArray} The array of column values.
       */
      columnArray(name, constructor) {
        return this.array(name, constructor);
      }

      /**
       * Get an array of values contained in a column. The resulting array
       * respects any table filter or orderby criteria.
       * @param {string} name The column name.
       * @param {ArrayConstructor|TypedArrayConstructor} [constructor=Array]
       *  The array constructor for instantiating the output array.
       * @return {DataValue[]|TypedArray} The array of column values.
       */
      array(name, constructor) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Returns an iterator over column values.
       * @return {Iterator<object>} An iterator over row objects.
       */
      *values(name) {
        const get = this.getter(name);
        const n = this.numRows();
        for (let i = 0; i < n; ++i) {
          yield get(i);
        }
      }

      /**
       * Get the value for the given column and row.
       * @param {string} name The column name.
       * @param {number} [row=0] The row index, defaults to zero if not specified.
       * @return {DataValue} The data value at (column, row).
       */
      get(name, row = 0) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Returns an accessor ("getter") function for a column. The returned
       * function takes a row index as its single argument and returns the
       * corresponding column value.
       * @param {string} name The column name.
       * @return {ColumnGetter} The column getter function.
       */
      getter(name) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Returns an array of objects representing table rows.
       * @param {ObjectsOptions} [options] The options for row object generation.
       * @return {RowObject[]} An array of row objects.
       */
      objects(options) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Returns an object representing a table row.
       * @param {number} [row=0] The row index, defaults to zero if not specified.
       * @return {object} A row object with named properties for each column.
       */
       object(row) { // eslint-disable-line no-unused-vars
        error('Not implemented');
      }

      /**
       * Returns an iterator over objects representing table rows.
       * @return {Iterator<object>} An iterator over row objects.
       */
      [Symbol.iterator]() {
        error('Not implemented');
      }

      /**
       * Print the contents of this table using the console.table() method.
       * @param {PrintOptions|number} options The options for row object
       *  generation, determining which rows and columns are printed. If
       *  number-valued, specifies the row limit.
       */
      print(options = {}) {
        if (isNumber$1(options)) {
          options = { limit: options };
        } else if (options.limit == null) {
          options.limit = 10;
        }

        const obj = this.objects({ ...options, grouped: false });
        const msg = `${this[Symbol.toStringTag]}. Showing ${obj.length} rows.`;

        console.log(msg);   // eslint-disable-line no-console
        console.table(obj); // eslint-disable-line no-console
      }

      /**
       * Returns an array of indices for all rows passing the table filter.
       * @param {boolean} [order=true] A flag indicating if the returned
       *  indices should be sorted if this table is ordered. If false, the
       *  returned indices may or may not be sorted.
       * @return {Uint32Array} An array of row indices.
       */
      indices(order = true) {
        if (this._index) return this._index;

        const n = this.numRows();
        const index = new Uint32Array(n);
        const ordered = this.isOrdered();
        const bits = this.mask();
        let row = -1;

        // inline the following for performance:
        // this.scan(row => index[++i] = row);
        if (bits) {
          for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
            index[++row] = i;
          }
        } else {
          for (let i = 0; i < n; ++i) {
            index[++row] = i;
          }
        }

        // sort index vector
        if (order && ordered) {
          const compare = this._order;
          const data = this._data;
          index.sort((a, b) => compare(a, b, data));
        }

        // save indices if they reflect table metadata
        if (order || !ordered) {
          this._index = index;
        }

        return index;
      }

      /**
       * Returns an array of indices for each group in the table.
       * If the table is not grouped, the result is the same as
       * {@link indices}, but wrapped within an array.
       * @param {boolean} [order=true] A flag indicating if the returned
       *  indices should be sorted if this table is ordered. If false, the
       *  returned indices may or may not be sorted.
       * @return {number[][]} An array of row index arrays, one per group.
       *  The indices will be filtered if the table is filtered.
       */
      partitions(order = true) {
        // return partitions if already generated
        if (this._partitions) {
          return this._partitions;
        }

        // if not grouped, return a single partition
        if (!this.isGrouped()) {
          return [ this.indices(order) ];
        }

        // generate partitions
        const { keys, size } = this._group;
        const part = repeat(size, () => []);

        // populate partitions, don't sort if indices don't exist
        // inline the following for performance:
        // this.scan(row => part[keys[row]].push(row), sort);
        const sort = this._index;
        const bits = this.mask();
        const n = this.numRows();
        if (sort && this.isOrdered()) {
          for (let i = 0, r; i < n; ++i) {
            r = sort[i];
            part[keys[r]].push(r);
          }
        } else if (bits) {
          for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
            part[keys[i]].push(i);
          }
        } else {
          for (let i = 0; i < n; ++i) {
            part[keys[i]].push(i);
          }
        }

        // if ordered but not yet sorted, sort partitions directly
        if (order && !sort && this.isOrdered()) {
          const compare = this._order;
          const data = this._data;
          for (let i = 0; i < size; ++i) {
            part[i].sort((a, b) => compare(a, b, data));
          }
        }

        // save partitions if they reflect table metadata
        if (order || !this.isOrdered()) {
          this._partitions = part;
        }

        return part;
      }

      /**
       * Callback function to cancel a table scan.
       * @callback ScanStop
       * @return {void}
       */

      /**
       * Callback function invoked for each row of a table scan.
       * @callback ScanVisitor
       * @param {number} [row] The table row index.
       * @param {TableData} [data] The backing table data store.
       * @param {ScanStop} [stop] Function to stop the scan early.
       *  Callees can invoke this function to prevent future calls.
       * @return {void}
       */

      /**
       * Perform a table scan, visiting each row of the table.
       * If this table is filtered, only rows passing the filter are visited.
       * @param {ScanVisitor} fn Callback invoked for each row of the table.
       * @param {boolean} [order=false] Indicates if the table should be
       *  scanned in the order determined by {@link Table#orderby}. This
       *  argument has no effect if the table is unordered.
       * @property {number} [limit=Infinity] The maximum number of objects to create.
       * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
       */
      scan(fn, order, limit = Infinity, offset = 0) {
        const filter = this._mask;
        const nrows = this._nrows;
        const data = this._data;

        let i = offset || 0;
        if (i > nrows) return;

        const n = Math.min(nrows, i + limit);
        const stop = () => i = this._total;

        if (order && this.isOrdered() || filter && this._index) {
          const index = this.indices();
          const data = this._data;
          for (; i < n; ++i) {
            fn(index[i], data, stop);
          }
        } else if (filter) {
          let c = n - i + 1;
          for (i = filter.nth(i); --c && i > -1; i = filter.next(i + 1)) {
            fn(i, data, stop);
          }
        } else {
          for (; i < n; ++i) {
            fn(i, data, stop);
          }
        }
      }

      /**
       * Extract rows with indices from start to end (end not included), where
       * start and end represent per-group ordered row numbers in the table.
       * @param {number} [start] Zero-based index at which to start extraction.
       *  A negative index indicates an offset from the end of the group.
       *  If start is undefined, slice starts from the index 0.
       * @param {number} [end] Zero-based index before which to end extraction.
       *  A negative index indicates an offset from the end of the group.
       *  If end is omitted, slice extracts through the end of the group.
       * @return {this} A new table with sliced rows.
       * @example table.slice(1, -1)
       */
      slice(start = 0, end = Infinity) {
        if (this.isGrouped()) return super.slice(start, end);

        // if not grouped, scan table directly
        const indices = [];
        const nrows = this.numRows();
        start = Math.max(0, start + (start < 0 ? nrows : 0));
        end = Math.min(nrows, Math.max(0, end + (end < 0 ? nrows : 0)));
        this.scan(row => indices.push(row), true, end - start, start);
        return this.reify(indices);
      }

      /**
       * Reduce a table, processing all rows to produce a new table.
       * To produce standard aggregate summaries, use {@link rollup}.
       * This method allows the use of custom reducer implementations,
       * for example to produce multiple rows for an aggregate.
       * @param {Reducer} reducer The reducer to apply.
       * @return {Table} A new table of reducer outputs.
       */
      reduce(reducer) {
        return this.__reduce(this, reducer);
      }
    }

    /**
     * A typed array constructor.
     * @typedef {Uint8ArrayConstructor|Uint16ArrayConstructor|Uint32ArrayConstructor|BigUint64ArrayConstructor|Int8ArrayConstructor|Int16ArrayConstructor|Int32ArrayConstructor|BigInt64ArrayConstructor|Float32ArrayConstructor|Float64ArrayConstructor} TypedArrayConstructor
     */

    /**
     * A typed array instance.
     * @typedef {Uint8Array|Uint16Array|Uint32Array|BigUint64Array|Int8Array|Int16Array|Int32Array|BigInt64Array|Float32Array|Float64Array} TypedArray
     */

    /**
     * Backing table data.
     * @typedef {object|Array} TableData
     */

    /**
     * Table value.
     * @typedef {*} DataValue
     */

    /**
     * Table row object.
     * @typedef {Object.<string, DataValue>} RowObject
     */

    /**
     * Table expression parameters.
     * @typedef {import('./transformable').Params} Params
     */

    /**
     * Proxy type for BitSet class.
     * @typedef {import('./bit-set').default} BitSet
     */

    /**
     * A table groupby specification.
     * @typedef {object} GroupBySpec
     * @property {number} size The number of groups.
     * @property {string[]} names Column names for each group.
     * @property {RowExpression[]} get Value accessor functions for each group.
     * @property {number[]} rows Indices of an example table row for each group.
     * @property {number[]} keys Per-row group indices, length is total rows of table.
     */

    /**
     * Column value accessor.
     * @callback ColumnGetter
     * @param {number} [row] The table row.
     * @return {DataValue}
     */

    /**
     * An expression evaluated over a table row.
     * @callback RowExpression
     * @param {number} [row] The table row.
     * @param {TableData} [data] The backing table data store.
     * @return {DataValue}
     */

    /**
     * Comparator function for sorting table rows.
     * @callback RowComparator
     * @param {number} rowA The table row index for the first row.
     * @param {number} rowB The table row index for the second row.
     * @param {TableData} data The backing table data store.
     * @return {number} Negative if rowA < rowB, positive if
     *  rowA > rowB, otherwise zero.
     */

    /**
     * Options for derived table creation.
     * @typedef {object} CreateOptions
     * @property {TableData} [data] The backing column data.
     * @property {string[]} [names] An ordered list of column names.
     * @property {BitSet} [filter] An additional filter BitSet to apply.
     * @property {GroupBySpec} [groups] The groupby specification to use, or null for no groups.
     * @property {RowComparator} [order] The orderby comparator function to use, or null for no order.
     */

    /**
     * Options for generating row objects.
     * @typedef {object} PrintOptions
     * @property {number} [limit=Infinity] The maximum number of objects to create.
     * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
     * @property {import('../table/transformable').Select} [columns]
     *  An ordered set of columns to include. The input may consist of column name
     *  strings, column integer indices, objects with current column names as keys
     *  and new column names as values (for renaming), or selection helper
     *  functions such as {@link all}, {@link not}, or {@link range}.
     */

    /**
     * Options for generating row objects.
     * @typedef {object} ObjectsOptions
     * @property {number} [limit=Infinity] The maximum number of objects to create.
     * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
     * @property {import('../table/transformable').Select} [columns]
     *  An ordered set of columns to include. The input may consist of column name
     *  strings, column integer indices, objects with current column names as keys
     *  and new column names as values (for renaming), or selection helper
     *  functions such as {@link all}, {@link not}, or {@link range}.
     * @property {'map'|'entries'|'object'|boolean} [grouped=false]
     *  The export format for groups of rows. The default (false) is to ignore
     *  groups, returning a flat array of objects. The valid values are 'map' or
     *  true (for Map instances), 'object' (for standard objects), or 'entries'
     *  (for arrays in the style of Object.entries). For the 'object' format,
     *  groupby keys are coerced to strings to use as object property names; note
     *  that this can lead to undesirable behavior if the groupby keys are object
     *  values. The 'map' and 'entries' options preserve the groupby key values.
     */

    /**
     * Class representing an array-backed data column.
     */
    class Column$2 {
      /**
       * Create a new column instance.
       * @param {Array} data The backing array (or array-like object)
       *  containing the column data.
       */
      constructor(data) {
        this.data = data;
      }

      /**
       * Get the length (number of rows) of the column.
       * @return {number} The length of the column array.
       */
      get length() {
        return this.data.length;
      }

      /**
       * Get the column value at the given row index.
       * @param {number} row The row index of the value to retrieve.
       * @return {import('./table').DataValue} The column value.
       */
      get(row) {
        return this.data[row];
      }

      /**
       * Returns an iterator over the column values.
       * @return {Iterator<object>} An iterator over column values.
       */
      [Symbol.iterator]() {
        return this.data[Symbol.iterator]();
      }
    }

    /**
     * Column interface. Any object that adheres to this interface
     * can be used as a data column within a {@link ColumnTable}.
     * @typedef {object} ColumnType
     * @property {number} length
     *  The length (number of rows) of the column.
     * @property {import('./table').ColumnGetter} get
     *  Column value getter.
     */

    /**
     * Column factory function interface.
     * @callback ColumnFactory
     * @param {*} data The input column data.
     * @return {ColumnType} A column instance.
     */

    /**
     * Create a new column from the given input data.
     * @param {any} data The backing column data. If the value conforms to
     *  the Column interface it is returned directly. If the value is an
     *  array, it will be wrapped in a new Column instance.
     * @return {ColumnType} A compatible column instance.
     */
    let defaultColumnFactory = function(data) {
      return data && isFunction$1(data.get) ? data : new Column$2(data);
    };

    /**
     * Get or set the default factory function for instantiating table columns.
     * @param {ColumnFactory} [factory] The new default factory.
     * @return {ColumnFactory} The current default column factory.
     */
    function columnFactory(factory) {
      return arguments.length
        ? (defaultColumnFactory = factory)
        : defaultColumnFactory;
    }

    function isDate(value) {
      return value instanceof Date;
    }

    function isObject$1(value) {
      return value === Object(value);
    }

    function isRegExp(value) {
      return value instanceof RegExp;
    }

    function isString(value) {
      return typeof value === 'string';
    }

    function columnsFrom(values, names) {
      const raise = type => error(`Illegal argument type: ${type || typeof values}`);
      return values instanceof Map ? fromKeyValuePairs(values.entries(), names)
        : isDate(values) ? raise('Date')
        : isRegExp(values) ? raise('RegExp')
        : isString(values) ? raise()
        : isArray$2(values) ? fromArray(values, names)
        : isFunction$1(values[Symbol.iterator]) ? fromIterable$1(values, names)
        : isObject$1(values) ? fromKeyValuePairs(Object.entries(values), names)
        : raise();
    }

    function fromKeyValuePairs(entries, names = ['key', 'value']) {
      const keys = [];
      const vals = [];

      for (const [key, val] of entries) {
        keys.push(key);
        vals.push(val);
      }

      const columns = {};
      if (names[0]) columns[names[0]] = keys;
      if (names[1]) columns[names[1]] = vals;
      return columns;
    }

    function fromArray(values, names) {
      const len = values.length;
      const columns = {};
      const add = name => columns[name] = Array(len);

      if (len) {
        names = names || Object.keys(values[0]);
        const cols = names.map(add);
        const n = cols.length;
        for (let idx = 0; idx < len; ++idx) {
          const row = values[idx];
          for (let i = 0; i < n; ++i) {
            cols[i][idx] = row[names[i]];
          }
        }
      } else if (names) {
        names.forEach(add);
      }

      return columns;
    }

    function fromIterable$1(values, names) {
      const columns = {};
      const add = name => columns[name] = [];

      let cols;
      let n;
      for (const row of values) {
        if (!cols) {
          names = names || Object.keys(row);
          cols = names.map(add);
          n = cols.length;
        }
        for (let i = 0; i < n; ++i) {
          cols[i].push(row[names[i]]);
        }
      }

      if (!cols && names) {
        names.forEach(add);
      }

      return columns;
    }

    const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;

    function has(object, property) {
      return hasOwnProperty$1.call(object, property);
    }

    function columnSet(table) {
      return table
        ? new ColumnSet({ ...table.data() }, table.columnNames())
        : new ColumnSet();
    }

    class ColumnSet {
      constructor(data, names) {
        this.data = data || {};
        this.names = names || [];
      }

      add(name, values) {
        if (!this.has(name)) this.names.push(name + '');
        return this.data[name] = values;
      }

      has(name) {
        return has(this.data, name);
      }

      new() {
        this.filter = null;
        this.groups = this.groups || null;
        this.order = null;
        return this;
      }

      groupby(groups) {
        this.groups = groups;
        return this;
      }
    }

    /**
     * Default NULL (missing) value to use.
     */
    var NULL = undefined;

    const TypedArray = Object.getPrototypeOf(Int8Array);

    function isTypedArray(value) {
      return value instanceof TypedArray;
    }

    function isArrayType(value) {
      return isArray$2(value) || isTypedArray(value);
    }

    function isValid(value) {
      return value != null && value === value;
    }

    const isSeq = (seq) => isArrayType(seq) || isString(seq);

    var array$2 = {
      compact:      (arr) => isArrayType(arr) ? arr.filter(v => isValid(v)) : arr,
      concat:       (...values) => [].concat(...values),
      includes:     (seq, value, index) => isSeq(seq)
                      ? seq.includes(value, index)
                      : false,
      indexof:      (seq, value) => isSeq(seq) ? seq.indexOf(value) : -1,
      join:         (arr, delim) => isArrayType(arr) ? arr.join(delim) : NULL,
      lastindexof:  (seq, value) => isSeq(seq) ? seq.lastIndexOf(value) : -1,
      length:       (seq) => isSeq(seq) ? seq.length : 0,
      pluck:        (arr, prop) => isArrayType(arr)
                      ? arr.map(v => isValid(v) ? v[prop] : NULL)
                      : NULL,
      reverse:      (seq) => isArrayType(seq) ? seq.slice().reverse()
                      : isString(seq) ? seq.split('').reverse().join('')
                      : NULL,
      slice:        (seq, start, end) => isSeq(seq) ? seq.slice(start, end) : NULL
    };

    /**
     * Truncate a value to a bin boundary.
     * Useful for creating equal-width histograms.
     * Values outside the [min, max] range will be mapped to
     * -Infinity (< min) or +Infinity (> max).
     * @param {number} value - The value to bin.
     * @param {number} min - The minimum bin boundary.
     * @param {number} max - The maximum bin boundary.
     * @param {number} step - The step size between bin boundaries.
     * @param {number} [offset=0] - Offset in steps by which to adjust
     *  the bin value. An offset of 1 will return the next boundary.
     */
    function bin$1(value, min, max, step, offset) {
      return value == null ? null
        : value < min ? -Infinity
        : value > max ? +Infinity
        : (
            value = Math.max(min, Math.min(value, max)),
            min + step * Math.floor(1e-14 + (value - min) / step + (offset || 0))
          );
    }

    function pad(value, width, char = '0') {
      const s = value + '';
      const len = s.length;
      return len < width ? Array(width - len + 1).join(char) + s : s;
    }

    const pad2 = v => (v < 10 ? '0' : '') + v;

    const formatYear = year => year < 0 ? '-' + pad(-year, 6)
      : year > 9999 ? '+' + pad(year, 6)
      : pad(year, 4);

    function formatISO(year, month, date, hours, min, sec, ms, utc, short) {
      const suffix = utc ? 'Z' : '';
      return formatYear(year) + '-' + pad2(month + 1) + '-' + pad2(date) + (
        !short || ms ? 'T' + pad2(hours) + ':' + pad2(min) + ':' + pad2(sec) + '.' + pad(ms, 3) + suffix
        : sec ? 'T' + pad2(hours) + ':' + pad2(min) + ':' + pad2(sec) + suffix
        : min || hours || !utc ? 'T' + pad2(hours) + ':' + pad2(min) + suffix
        : ''
      );
    }

    function formatDate(d, short) {
      return isNaN(d)
        ? 'Invalid Date'
        : formatISO(
          d.getFullYear(),
          d.getMonth(),
          d.getDate(),
          d.getHours(),
          d.getMinutes(),
          d.getSeconds(),
          d.getMilliseconds(),
          false, short
        );
    }

    function formatUTCDate(d, short) {
      return isNaN(d)
        ? 'Invalid Date'
        : formatISO(
          d.getUTCFullYear(),
          d.getUTCMonth(),
          d.getUTCDate(),
          d.getUTCHours(),
          d.getUTCMinutes(),
          d.getUTCSeconds(),
          d.getUTCMilliseconds(),
          true, short
        );
    }

    const iso_re = /^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/;

    function isISODateString(value) {
      return value.match(iso_re);
    }

    function parseIsoDate(value, parse = Date.parse) {
      return isISODateString(value) ? parse(value) : value;
    }

    const msMinute = 6e4;
    const msDay = 864e5;
    const msWeek = 6048e5;

    const t0 = new Date();
    const t1 = new Date();
    const t = d => (
      t0.setTime(typeof d === 'string' ? parseIsoDate(d) : d),
      t0
    );

    /**
     * Function to create a new Date value.
     * If no arguments are provided, the current time is used.
     * @param {number} [year] The year.
     * @param {number} [month=0] The (zero-based) month.
     * @param {number} [date=1] The date within the month.
     * @param {number} [hours=0] The hour within the day.
     * @param {number} [minutes=0] The minute within the hour.
     * @param {number} [seconds=0] The second within the minute.
     * @param {number} [milliseconds=0] The milliseconds within the second.
     * @return {date} The resuting Date value.
     */
    function datetime(year, month, date, hours, minutes, seconds, milliseconds) {
      return !arguments.length
        ? new Date(Date.now())
        : new Date(
            year,
            month || 0,
            date == null ? 1 : date,
            hours || 0,
            minutes || 0,
            seconds || 0,
            milliseconds || 0
          );
    }

    /**
     * Function to create a new Date value according to UTC time.
     * If no arguments are provided, the current time is used.
     * @param {number} [year] The year.
     * @param {number} [month=0] The (zero-based) month.
     * @param {number} [date=1] The date within the month.
     * @param {number} [hours=0] The hour within the day.
     * @param {number} [minutes=0] The minute within the hour.
     * @param {number} [seconds=0] The second within the minute.
     * @param {number} [milliseconds=0] The milliseconds within the second.
     * @return {date} The resuting Date value.
     */
    function utcdatetime(year, month, date, hours, minutes, seconds, milliseconds) {
      return !arguments.length
        ? new Date(Date.now())
        : new Date(Date.UTC(
            year,
            month || 0,
            date == null ? 1 : date,
            hours || 0,
            minutes || 0,
            seconds || 0,
            milliseconds || 0
          ));
    }

    function dayofyear(date) {
      t1.setTime(+date);
      t1.setHours(0, 0, 0, 0);
      t0.setTime(+t1);
      t0.setMonth(0);
      t0.setDate(1);
      const tz = (t1.getTimezoneOffset() - t0.getTimezoneOffset()) * msMinute;
      return Math.floor(1 + ((t1 - t0) - tz) / msDay);
    }

    function utcdayofyear(date) {
      t1.setTime(+date);
      t1.setUTCHours(0, 0, 0, 0);
      const t0 = Date.UTC(t1.getUTCFullYear(), 0, 1);
      return Math.floor(1 + (t1 - t0) / msDay);
    }

    function week(date, firstday) {
      const i = firstday || 0;
      t1.setTime(+date);
      t1.setDate(t1.getDate() - (t1.getDay() + 7 - i) % 7);
      t1.setHours(0, 0, 0, 0);
      t0.setTime(+date);
      t0.setMonth(0);
      t0.setDate(1);
      t0.setDate(1 - (t0.getDay() + 7 - i) % 7);
      t0.setHours(0, 0, 0, 0);
      const tz = (t1.getTimezoneOffset() - t0.getTimezoneOffset()) * msMinute;
      return Math.floor((1 + (t1 - t0) - tz) / msWeek);
    }

    function utcweek(date, firstday) {
      const i = firstday || 0;
      t1.setTime(+date);
      t1.setUTCDate(t1.getUTCDate() - (t1.getUTCDay() + 7 - i) % 7);
      t1.setUTCHours(0, 0, 0, 0);
      t0.setTime(+date);
      t0.setUTCMonth(0);
      t0.setUTCDate(1);
      t0.setUTCDate(1 - (t0.getUTCDay() + 7 - i) % 7);
      t0.setUTCHours(0, 0, 0, 0);
      return Math.floor((1 + (t1 - t0)) / msWeek);
    }

    var date = {
      format_date:     (date, shorten) => formatDate(t(date), !shorten),
      format_utcdate:  (date, shorten) => formatUTCDate(t(date), !shorten),
      timestamp:       (date) => +t(date),
      year:            (date) => t(date).getFullYear(),
      quarter:         (date) => Math.floor(t(date).getMonth() / 3),
      month:           (date) => t(date).getMonth(),
      date:            (date) => t(date).getDate(),
      dayofweek:       (date) => t(date).getDay(),
      hours:           (date) => t(date).getHours(),
      minutes:         (date) => t(date).getMinutes(),
      seconds:         (date) => t(date).getSeconds(),
      milliseconds:    (date) => t(date).getMilliseconds(),
      utcyear:         (date) => t(date).getUTCFullYear(),
      utcquarter:      (date) => Math.floor(t(date).getUTCMonth() / 3),
      utcmonth:        (date) => t(date).getUTCMonth(),
      utcdate:         (date) => t(date).getUTCDate(),
      utcdayofweek:    (date) => t(date).getUTCDay(),
      utchours:        (date) => t(date).getUTCHours(),
      utcminutes:      (date) => t(date).getUTCMinutes(),
      utcseconds:      (date) => t(date).getUTCSeconds(),
      utcmilliseconds: (date) => t(date).getUTCMilliseconds(),
      datetime,
      dayofyear,
      week,
      utcdatetime,
      utcdayofyear,
      utcweek,
      now: Date.now
    };

    /**
     * Compare two values for equality, using join semantics in which null
     * !== null. If the inputs are object-valued, a deep equality check
     * of array entries or object key-value pairs is performed.
     * @param {*} a The first input.
     * @param {*} b The second input.
     * @return {boolean} True if equal, false if not.
     */
    function equal(a, b) {
      return (a == null || b == null || a !== a || b !== b) ? false
        : a === b ? true
        : (isDate(a) || isDate(b)) ? +a === +b
        : (isRegExp(a) && isRegExp(b)) ? a + '' === b + ''
        : (isObject$1(a) && isObject$1(b)) ? deepEqual(a, b)
        : false;
    }

    function deepEqual(a, b) {
      if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) {
        return false;
      }

      if (a.length || b.length) {
        return arrayEqual(a, b);
      }

      const keysA = Object.keys(a);
      const keysB = Object.keys(b);
      if (keysA.length !== keysB.length) {
        return false;
      }
      keysA.sort();
      keysB.sort();

      if (!arrayEqual(keysA, keysB, (a, b) => a === b)) {
        return false;
      }

      const n = keysA.length;
      for (let i = 0; i < n; ++i) {
        const k = keysA[i];
        if (!equal(a[k], b[k])) {
          return false;
        }
      }

      return true;
    }

    function arrayEqual(a, b, test = equal) {
      const n = a.length;
      if (n !== b.length) return false;

      for (let i = 0; i < n; ++i) {
        if (!test(a[i], b[i])) {
          return false;
        }
      }

      return true;
    }

    var json = {
      parse_json: (str) => JSON.parse(str),
      to_json:    (val) => JSON.stringify(val)
    };

    let source = Math.random;

    function random() {
      return source();
    }

    /**
     * Set a seed value for random number generation.
     * If the seed is a valid number, a 32-bit linear congruential generator
     * with the given seed will be used to generate random values.
     * If the seed is null, undefined, or not a valid number, the random
     * number generator will revert to Math.random.
     * @param {number} seed The random seed value. Should either be an
     *  integer or a fraction between 0 and 1.
     */
    function seed(seed) {
      source = isValid(seed) && isFinite(seed = +seed) ? lcg(seed) : Math.random;
    }

    function lcg(seed) {
      const a = 0x19660D;
      const c = 0x3C6EF35F;
      const m = 1 / 0x100000000;
      seed = (0 <= seed && seed < 1 ? seed / m : Math.abs(seed)) | 0;

      // Random numbers using a Linear Congruential Generator with seed value
      // https://en.wikipedia.org/wiki/Linear_congruential_generator
      return () => (seed = a * seed + c | 0, m * (seed >>> 0));
    }

    var math = {
      random,
      is_nan:    Number.isNaN,
      is_finite: Number.isFinite,

      abs:      Math.abs,
      cbrt:     Math.cbrt,
      ceil:     Math.ceil,
      clz32:    Math.clz32,
      exp:      Math.exp,
      expm1:    Math.expm1,
      floor:    Math.floor,
      fround:   Math.fround,
      greatest: Math.max,
      least:    Math.min,
      log:      Math.log,
      log10:    Math.log10,
      log1p:    Math.log1p,
      log2:     Math.log2,
      pow:      Math.pow,
      round:    Math.round,
      sign:     Math.sign,
      sqrt:     Math.sqrt,
      trunc:    Math.trunc,

      degrees:  (rad) => 180 * rad / Math.PI,
      radians:  (deg) => Math.PI * deg / 180,
      acos:     Math.acos,
      acosh:    Math.acosh,
      asin:     Math.asin,
      asinh:    Math.asinh,
      atan:     Math.atan,
      atan2:    Math.atan2,
      atanh:    Math.atanh,
      cos:      Math.cos,
      cosh:     Math.cosh,
      sin:      Math.sin,
      sinh:     Math.sinh,
      tan:      Math.tan,
      tanh:     Math.tanh
    };

    function isMap(value) {
      return value instanceof Map;
    }

    function isSet(value) {
      return value instanceof Set;
    }

    function isMapOrSet(value) {
      return isMap(value) || isSet(value);
    }

    function array$1(iter) {
      return Array.from(iter);
    }

    var object = {
      has:      (obj, key) => isMapOrSet(obj) ? obj.has(key)
                  : obj != null ? has(obj, key)
                  : false,
      keys:     (obj) => isMap(obj) ? array$1(obj.keys())
                  : obj != null ? Object.keys(obj)
                  : [],
      values:   (obj) => isMapOrSet(obj) ? array$1(obj.values())
                  : obj != null ? Object.values(obj)
                  : [],
      entries:  (obj) => isMapOrSet(obj) ? array$1(obj.entries())
                  : obj != null ? Object.entries(obj)
                  : [],
      object:   (entries) => entries ? Object.fromEntries(entries) : NULL
    };

    /**
     * Recodes an input value to an alternative value, based on a provided
     * value map. If a fallback value is specified, it will be returned when
     * a matching value is not found in the map; otherwise, the input value
     * is returned unchanged.
     * @param {*} value The value to recode. The value must be safely
     *  coercible to a string for lookup against the value map.
     * @param {object|Map} map An object or Map with input values for keys and
     *  output recoded values as values. If a non-Map object, only the object's
     *  own properties will be considered.
     * @param {*} [fallback] A default fallback value to use if the input
     *  value is not found in the value map.
     * @return {*} The recoded value.
     */
    function recode(value, map, fallback) {
      if (map instanceof Map) {
        if (map.has(value)) return map.get(value);
      } else if (has(map, value)) {
        return map[value];
      }
      return fallback !== undefined ? fallback : value;
    }

    /**
     * Returns an array containing an arithmetic sequence from the start value
     * to the stop value, in step increments. If step is positive, the last
     * element is the largest start + i * step less than stop; if step is
     * negative, the last element is the smallest start + i * step greater
     * than stop. If the returned array would contain an infinite number of
     * values, an empty range is returned.
     * @param {number} [start=0] The starting value of the sequence.
     * @param {number} [stop] The stopping value of the sequence.
     *  The stop value is exclusive; it is not included in the result.
     * @param {number} [step=1] The step increment between sequence values.
     * @return {number[]} The generated sequence.
     */
    function sequence(start, stop, step) {
      let n = arguments.length;
      start = +start;
      stop = +stop;
      step = n < 2
        ? (stop = start, start = 0, 1)
        : n < 3 ? 1 : +step;

      n = Math.max(0, Math.ceil((stop - start) / step)) | 0;
      const seq = new Array(n);

      for (let i = 0; i < n; ++i) {
        seq[i] = start + i * step;
      }

      return seq;
    }

    var string = {
      parse_date:   (str) => str == null ? str : new Date(str),
      parse_float:  (str) => str == null ? str : Number.parseFloat(str),
      parse_int:    (str, radix) => str == null ? str : Number.parseInt(str, radix),
      endswith:     (str, search, length) => str == null ? false
                      : String(str).endsWith(search, length),
      match:        (str, regexp, index) => {
                      const m = str == null ? str : String(str).match(regexp);
                      return index == null || m == null ? m
                        : typeof index === 'number' ? m[index]
                        : m.groups ? m.groups[index]
                        : null;
                    },
      normalize:    (str, form) => str == null ? str
                      : String(str).normalize(form),
      padend:       (str, len, fill) => str == null ? str
                      : String(str).padEnd(len, fill),
      padstart:     (str, len, fill) => str == null ? str
                      : String(str).padStart(len, fill),
      upper:        (str) => str == null ? str
                      : String(str).toUpperCase(),
      lower:        (str) => str == null ? str
                      : String(str).toLowerCase(),
      repeat:       (str, num) => str == null ? str
                      : String(str).repeat(num),
      replace:      (str, pattern, replacement) => str == null ? str
                      : String(str).replace(pattern, String(replacement)),
      substring:    (str, start, end) => str == null ? str
                      : String(str).substring(start, end),
      split:        (str, separator, limit) => str == null ? []
                      : String(str).split(separator, limit),
      startswith:   (str, search, length) => str == null ? false
                      : String(str).startsWith(search, length),
      trim:         (str) => str == null ? str
                      : String(str).trim()
    };

    var functions = {
      bin: bin$1,
      equal,
      recode,
      sequence,
      ...array$2,
      ...date,
      ...json,
      ...math,
      ...object,
      ...string
    };

    function isBigInt(value) {
      return typeof value === 'bigint';
    }

    function toString$1(v) {
      return v === undefined ? v + ''
        : isBigInt(v) ? v + 'n'
        : JSON.stringify(v);
    }

    function op(name, fields = [], params = []) {
      return new Op$1(name, toArray(fields), toArray(params));
    }

    class Op$1 {
      constructor(name, fields, params) {
        this.name = name;
        this.fields = fields;
        this.params = params;
      }
      toString() {
        const args = [
          ...this.fields.map(f => `d[${toString$1(f)}]`),
          ...this.params.map(toString$1)
        ];
        return `d => op.${this.name}(${args})`;
      }
      toObject() {
        return { expr: this.toString(), func: true };
      }
    }

    const any = (field) => op('any', field);
    const count = () => op('count');
    const array_agg = (field) => op('array_agg', field);
    const array_agg_distinct = (field) => op('array_agg_distinct', field);
    const map_agg = (key, value) => op('map_agg', [key, value]);
    const object_agg = (key, value) => op('object_agg', [key, value]);
    const entries_agg = (key, value) => op('entries_agg', [key, value]);

    /**
     * @typedef {import('../table/transformable').Struct} Struct
     */

    /**
     * All table expression operations including normal functions,
     * aggregate functions, and window functions.
     */
    var ops = {
      ...functions,

      /**
       * Generate an object representing the current table row.
       * @param {...string} names The column names to include in the object.
       *  If unspecified, all columns are included.
       * @return {Struct} The generated row object.
       */
      row_object: (...names) => op('row_object', null, names.flat()),

      /**
       * Aggregate function to count the number of records (rows).
       * @returns {number} The count of records.
       */
      count,

      /**
       * Aggregate function returning an arbitrary observed value.
       * @param {*} field The data field.
       * @return {*} An arbitrary observed value.
       */
      any,

      /**
       * Aggregate function to collect an array of values.
       * @param {*} field The data field.
       * @return {Array} A list of values.
       */
      array_agg,

      /**
       * Aggregate function to collect an array of distinct (unique) values.
       * @param {*} field The data field.
       * @return {Array} An array of unique values.
       */
      array_agg_distinct,

      /**
       * Aggregate function to create an object given input key and value fields.
       * @param {*} key The object key field.
       * @param {*} value The object value field.
       * @return {Struct} An object of key-value pairs.
       */
      object_agg,

      /**
       * Aggregate function to create a Map given input key and value fields.
       * @param {*} key The object key field.
       * @param {*} value The object value field.
       * @return {Map} A Map of key-value pairs.
       */
      map_agg,

      /**
       * Aggregate function to create an array in the style of Object.entries()
       * given input key and value fields.
       * @param {*} key The object key field.
       * @param {*} value The object value field.
       * @return {[[any, any]]} An array of [key, value] arrays.
       */
      entries_agg,

      /**
       * Aggregate function to count the number of valid values.
       * Invalid values are null, undefined, or NaN.
       * @param {*} field The data field.
       * @return {number} The count of valid values.
       */
      valid: (field) => op('valid', field),

      /**
       * Aggregate function to count the number of invalid values.
       * Invalid values are null, undefined, or NaN.
       * @param {*} field The data field.
       * @return {number} The count of invalid values.
       */
      invalid: (field) => op('invalid', field),

      /**
       * Aggregate function to count the number of distinct values.
       * @param {*} field The data field.
       * @return {number} The count of distinct values.
       */
      distinct: (field) => op('distinct', field),

      /**
       * Aggregate function to determine the mode (most frequent) value.
       * @param {*} field The data field.
       * @return {number} The mode value.
       */
      mode: (field) => op('mode', field),

      /**
       * Aggregate function to sum values.
       * @param {string} field The data field.
       * @return {number} The sum of the values.
       */
      sum: (field) => op('sum', field),

      /**
       * Aggregate function to multiply values.
       * @param {*} field The data field.
       * @return {number} The product of the values.
       */
      product: (field) => op('product', field),

      /**
       * Aggregate function for the mean (average) value.
       * @param {*} field The data field.
       * @return {number} The mean (average) of the values.
       */
      mean: (field) => op('mean', field),

      /**
       * Aggregate function for the average (mean) value.
       * @param {*} field The data field.
       * @return {number} The average (mean) of the values.
       */
      average: (field) => op('average', field),

      /**
       * Aggregate function for the sample variance.
       * @param {*} field The data field.
       * @return {number} The sample variance of the values.
       */
      variance: (field) => op('variance', field),

      /**
       * Aggregate function for the population variance.
       * @param {*} field The data field.
       * @return {number} The population variance of the values.
       */
      variancep: (field) => op('variancep', field),

      /**
       * Aggregate function for the sample standard deviation.
       * @param {*} field The data field.
       * @return {number} The sample standard deviation of the values.
       */
      stdev: (field) => op('stdev', field),

      /**
       * Aggregate function for the population standard deviation.
       * @param {*} field The data field.
       * @return {number} The population standard deviation of the values.
       */
      stdevp: (field) => op('stdevp', field),

      /**
       * Aggregate function for the minimum value.
       * @param {*} field The data field.
       * @return {number} The minimum value.
       */
      min: (field) => op('min', field),

      /**
       * Aggregate function for the maximum value.
       * @param {*} field The data field.
       * @return {number} The maximum value.
       */
      max: (field) => op('max', field),

      /**
       * Aggregate function to compute the quantile boundary
       * of a data field for a probability threshold.
       * @param {*} field The data field.
       * @param {number} p The probability threshold.
       * @return {number} The quantile value.
       */
      quantile: (field, p) => op('quantile', field, p),

      /**
       * Aggregate function for the median value.
       * This is a shorthand for the 0.5 quantile value.
       * @param {*} field The data field.
       * @return {number} The median value.
       */
      median: (field) => op('median', field),

      /**
       * Aggregate function for the sample covariance between two variables.
       * @param {*} field1 The first data field.
       * @param {*} field2 The second data field.
       * @return {number} The sample covariance of the values.
       */
      covariance: (field1, field2) => op('covariance', [field1, field2]),

      /**
       * Aggregate function for the population covariance between two variables.
       * @param {*} field1 The first data field.
       * @param {*} field2 The second data field.
       * @return {number} The population covariance of the values.
       */
      covariancep: (field1, field2) => op('covariancep', [field1, field2]),

      /**
       * Aggregate function for the product-moment correlation between two variables.
       * To instead compute a rank correlation, compute the average ranks for each
       * variable and then apply this function to the result.
       * @param {*} field1 The first data field.
       * @param {*} field2 The second data field.
       * @return {number} The correlation between the field values.
       */
      corr: (field1, field2) => op('corr', [field1, field2]),

      /**
       * Aggregate function for calculating a binning scheme in terms of
       * the minimum bin boundary, maximum bin boundary, and step size.
       * @param {*} field The data field.
       * @param {number} [maxbins=15] The maximum number of allowed bins.
       * @param {boolean} [nice=true] Flag indicating if the bin min and max
       *  should snap to "nice" human-friendly values.
       * @param {number} [minstep] The minimum allowed step size between bins.
       * @param {number} [step] The exact step size to use between bins.
       *  If specified, the maxbins and minstep arguments are ignored.
       * @return {[number, number, number]} The bin [min, max, and step] values.
       */
      bins: (field, maxbins, nice, minstep) =>
        op('bins', field, [maxbins, nice, minstep]),

      /**
       * Window function to assign consecutive row numbers, starting from 1.
       * @return {number} The row number value.
       */
      row_number: () => op('row_number'),

      /**
       * Window function to assign a rank to each value in a group, starting
       * from 1. Peer values are assigned the same rank. Subsequent ranks
       * reflect the number of prior values: if the first two values tie for
       * rank 1, the third value is assigned rank 3.
       * @return {number} The rank value.
       */
      rank: () => op('rank'),

      /**
       * Window function to assign a fractional (average) rank to each value in
       * a group, starting from 1. Peer values are assigned the average of their
       * indices: if the first two values tie, both will be assigned rank 1.5.
       * @return {number} The peer-averaged rank value.
       */
      avg_rank: () => op('avg_rank'),

      /**
       * Window function to assign a dense rank to each value in a group,
       * starting from 1. Peer values are assigned the same rank. Subsequent
       * ranks do not reflect the number of prior values: if the first two
       * values tie for rank 1, the third value is assigned rank 2.
       * @return {number} The dense rank value.
       */
      dense_rank: () => op('dense_rank'),

      /**
       * Window function to assign a percentage rank to each value in a group.
       * The percent is calculated as (rank - 1) / (group_size - 1).
       * @return {number} The percentage rank value.
       */
      percent_rank: () => op('percent_rank'),

      /**
       * Window function to assign a cumulative distribution value between 0 and 1
       * to each value in a group.
       * @return {number} The cumulative distribution value.
       */
      cume_dist: () => op('cume_dist'),

      /**
       * Window function to assign a quantile (e.g., percentile) value to each
       * value in a group. Accepts an integer parameter indicating the number of
       * buckets to use (e.g., 100 for percentiles, 5 for quintiles).
       * @param {number} num The number of buckets for ntile calculation.
       * @return {number} The quantile value.
       */
      ntile: (num) => op('ntile', null, num),

      /**
       * Window function to assign a value that precedes the current value by
       * a specified number of positions. If no such value exists, returns a
       * default value instead.
       * @param {*} field The data field.
       * @param {number} [offset=1] The lag offset from the current value.
       * @param {*} [defaultValue=undefined] The default value.
       * @return {*} The lagging value.
       */
      lag: (field, offset, defaultValue) => op('lag', field, [offset, defaultValue]),

      /**
       * Window function to assign a value that follows the current value by
       * a specified number of positions. If no such value exists, returns a
       * default value instead.
       * @param {*} field The data field.
       * @param {number} [offset=1] The lead offset from the current value.
       * @param {*} [defaultValue=undefined] The default value.
       * @return {*} The leading value.
       */
      lead: (field, offset, defaultValue) => op('lead', field, [offset, defaultValue]),

      /**
       * Window function to assign the first value in a sliding window frame.
       * @param {*} field The data field.
       * @return {*} The first value in the current frame.
       */
      first_value: (field) => op('first_value', field),

      /**
       * Window function to assign the last value in a sliding window frame.
       * @param {*} field The data field.
       * @return {*} The last value in the current frame.
       */
      last_value: (field) => op('last_value', field),

      /**
       * Window function to assign the nth value in a sliding window frame
       * (counting from 1), or undefined if no such value exists.
       * @param {*} field The data field.
       * @param {number} nth The nth position, starting from 1.
       * @return {*} The nth value in the current frame.
       */
      nth_value: (field, nth) => op('nth_value', field, nth),

      /**
       * Window function to fill in missing values with preceding values.
       * @param {*} field The data field.
       * @param {*} [defaultValue=undefined] The default value.
       * @return {*} The current value if valid, otherwise the first preceding
       *  valid value. If no such value exists, returns the default value.
       */
      fill_down: (field, defaultValue) => op('fill_down', field, defaultValue),

      /**
       * Window function to fill in missing values with subsequent values.
       * @param {*} field The data field.
       * @param {*} [defaultValue=undefined] The default value.
       * @return {*} The current value if valid, otherwise the first subsequent
       *  valid value. If no such value exists, returns the default value.
       */
      fill_up: (field, defaultValue) => op('fill_up', field, defaultValue)
    };

    function uniqueName(names, name) {
      names = isMapOrSet(names) ? names : new Set(names);
      let uname = name;
      let index = 0;

      while (names.has(uname)) {
        uname = name + ++index;
      }

      return uname;
    }

    /**
     * Regroup table rows in response to a BitSet filter.
     * @param {GroupBySpec} groups The current groupby specification.
     * @param {BitSet} filter The filter to apply.
     */
    function regroup(groups, filter) {
      if (!groups || !filter) return groups;

      // check for presence of rows for each group
      const { keys, rows, size } = groups;
      const map = new Int32Array(size);
      filter.scan(row => map[keys[row]] = 1);

      // check sum, exit early if all groups occur
      const sum = map.reduce((sum, val) => sum + val, 0);
      if (sum === size) return groups;

      // create group index map, filter exemplar rows
      const _rows = Array(sum);
      let _size = 0;
      for (let i = 0; i < size; ++i) {
        if (map[i]) _rows[map[i] = _size++] = rows[i];
      }

      // re-index the group keys
      const _keys = new Uint32Array(keys.length);
      filter.scan(row => _keys[row] = map[keys[row]]);

      return { ...groups, keys: _keys, rows: _rows, size: _size };
    }

    /**
     * Regroup table rows in response to a re-indexing.
     * This operation may or may not involve filtering of rows.
     * @param {GroupBySpec} groups The current groupby specification.
     * @param {Function} scan Function to scan new row indices.
     * @param {boolean} filter Flag indicating if filtering may occur.
     * @param {number} nrows The number of rows in the new table.
     */
    function reindex(groups, scan, filter, nrows) {
      const { keys, rows, size } = groups;
      let _rows = rows;
      let _size = size;
      let map = null;

      if (filter) {
        // check for presence of rows for each group
        map = new Int32Array(size);
        scan(row => map[keys[row]] = 1);

        // check sum, regroup if not all groups occur
        const sum = map.reduce((sum, val) => sum + val, 0);
        if (sum !== size) {
          // create group index map, filter exemplar rows
          _rows = Array(sum);
          _size = 0;
          for (let i = 0; i < size; ++i) {
            if (map[i]) _rows[map[i] = _size++] = rows[i];
          }
        }
      }

      // re-index the group keys
      let r = -1;
      const _keys = new Uint32Array(nrows);
      const fn = _size !== size
        ? row => _keys[++r] = map[keys[row]]
        : row => _keys[++r] = keys[row];
      scan(fn);

      return { ...groups, keys: _keys, rows: _rows, size: _size };
    }

    function nest(table, idx, obj, type) {
      const agg = type === 'map' || type === true ? map_agg
        : type === 'entries' ? entries_agg
        : type === 'object' ? object_agg
        : error('groups option must be "map", "entries", or "object".');

      const { names } = table.groups();
      const col = uniqueName(table.columnNames(), '_');

      // create table with one column of row objects
      // then aggregate into per-group arrays
      let t = table
        .select()
        .reify(idx)
        .create({ data: { [col]: obj } })
        .rollup({ [col]: array_agg(col) });

      // create nested structures for each level of grouping
      for (let i = names.length; --i >= 0;) {
        t = t
          .groupby(names.slice(0, i))
          .rollup({ [col]: agg(names[i], col) });
      }

      // return the final aggregated structure
      return t.get(col);
    }

    const ArrayPattern = 'ArrayPattern';
    const ArrowFunctionExpression = 'ArrowFunctionExpression';
    const FunctionExpression = 'FunctionExpression';
    const Identifier = 'Identifier';
    const Literal$1 = 'Literal';
    const MemberExpression = 'MemberExpression';
    const ObjectExpression = 'ObjectExpression';
    const ObjectPattern = 'ObjectPattern';
    const Property = 'Property';

    const Column$1 = 'Column';
    const Constant = 'Constant';
    const Dictionary$1 = 'Dictionary';
    const Function$1 = 'Function';
    const Parameter = 'Parameter';
    const Op = 'Op';

    const visit = (node, opt) => {
      const f = visitors$1[node.type];
      return f
        ? f(node, opt)
        : error(`Unsupported expression construct: ${node.type}`);
    };

    const binary$1 = (node, opt) => {
      return '(' + visit(node.left, opt) + ' ' + node.operator + ' ' + visit(node.right, opt) + ')';
    };

    const func$4 = (node, opt) => {
      return '(' + list$2(node.params, opt) + ')=>' + visit(node.body, opt);
    };

    const call$1 = (node, opt) => {
      return visit(node.callee, opt) + '(' + list$2(node.arguments, opt) + ')';
    };

    const list$2 = (array, opt, delim = ',') => {
      return array.map(node => visit(node, opt)).join(delim);
    };

    const name$1 = node => node.computed
      ? `[${toString$1(node.name)}]`
      : `.${node.name}`;

    const ref$1 = (node, opt, method) => {
      const table = node.table || '';
      return `data${table}${name$1(node)}.${method}(${opt.index}${table})`;
    };

    const visitors$1 = {
      Constant: node => node.raw,
      Column: (node, opt) => ref$1(node, opt, 'get'),
      Dictionary: (node, opt) => ref$1(node, opt, 'key'),
      Function: node => `fn.${node.name}`,
      Parameter: node => `$${name$1(node)}`,
      Op: (node, opt) => `op(${toString$1(node.name)},${opt.op || opt.index})`,
      Literal: node => node.raw,
      Identifier: node => node.name,
      TemplateLiteral: (node, opt) => {
        const { quasis, expressions } = node;
        const n = expressions.length;
        let t = quasis[0].value.raw;
        for (let i = 0; i < n;) {
          t += '${' + visit(expressions[i], opt) + '}' + quasis[++i].value.raw;
        }
        return '`' + t + '`';
      },
      MemberExpression: (node, opt) => {
        const d = !node.computed;
        const o = visit(node.object, opt);
        const p = visit(node.property, opt);
        return o + (d ? '.' + p : '[' + p + ']');
      },
      CallExpression: call$1,
      NewExpression: (node, opt) => {
        return 'new ' + call$1(node, opt);
      },
      ArrayExpression: (node, opt) => {
        return '[' + list$2(node.elements, opt) + ']';
      },
      AssignmentExpression: binary$1,
      BinaryExpression: binary$1,
      LogicalExpression: binary$1,
      UnaryExpression: (node, opt) => {
        return '(' + node.operator + visit(node.argument, opt) + ')';
      },
      ConditionalExpression: (node, opt) => {
        return '(' + visit(node.test, opt) +
          '?' + visit(node.consequent, opt) +
          ':' + visit(node.alternate, opt) + ')';
      },
      ObjectExpression: (node, opt) => {
        return '({' + list$2(node.properties, opt) + '})';
      },
      Property: (node, opt) => {
        const key = visit(node.key, opt);
        return (node.computed ? `[${key}]` : key) + ':' + visit(node.value, opt);
      },

      ArrowFunctionExpression: func$4,
      FunctionExpression: func$4,
      FunctionDeclaration: func$4,

      ArrayPattern: (node, opt) => {
        return '[' + list$2(node.elements, opt) + ']';
      },
      ObjectPattern: (node, opt) => {
        return '{' + list$2(node.properties, opt) + '}';
      },
      VariableDeclaration: (node, opt) => {
        return node.kind + ' ' + list$2(node.declarations, opt, ',');
      },
      VariableDeclarator: (node, opt) => {
        return visit(node.id, opt) + '=' + visit(node.init, opt);
      },
      SpreadElement: (node, opt) => {
        return '...' + visit(node.argument, opt);
      },

      BlockStatement: (node, opt) => {
        return '{' + list$2(node.body, opt, ';') + ';}';
      },
      BreakStatement: () => {
        return 'break';
      },
      ExpressionStatement: (node, opt) => {
        return visit(node.expression, opt);
      },
      IfStatement: (node, opt) => {
        return 'if (' + visit(node.test, opt) + ')'
          + visit(node.consequent, opt)
          + (node.alternate ? ' else ' + visit(node.alternate, opt) : '');
      },
      SwitchStatement: (node, opt) => {
        return 'switch (' + visit(node.discriminant, opt) + ') {'
         + list$2(node.cases, opt, '')
         + '}';
      },
      SwitchCase: (node, opt) => {
        return (node.test ? 'case ' + visit(node.test, opt) : 'default')
          + ': '
          + list$2(node.consequent, opt, ';') + ';';
      },
      ReturnStatement: (node, opt) => {
        return 'return ' + visit(node.argument, opt);
      },
      Program: (node, opt) => visit(node.body[0], opt)
    };

    function codegen(node, opt = { index: 'row' }) {
      return visit(node, opt);
    }

    function bins(min, max, maxbins = 15, nice = true, minstep = 0, step) {
      const base = 10;
      const logb = Math.LN10;

      if (step == null) {
        const level = Math.ceil(Math.log(maxbins) / logb);
        const span = (max - min) || Math.abs(min) || 1;
        const div = [5, 2];

        step = Math.max(
          minstep,
          Math.pow(base, Math.round(Math.log(span) / logb) - level)
        );

        // increase step size if too many bins
        while (Math.ceil(span / step) > maxbins) {
          step *= base;
        }

        // decrease step size if it stays within maxbins
        const n = div.length;
        for (let i = 0; i < n; ++i) {
          const v = step / div[i];
          if (v >= minstep && span / v <= maxbins) {
            step = v;
          }
        }
      }

      // snap to "nice" boundaries
      if (nice) {
        let v = Math.log(step);
        const precision = v >= 0 ? 0 : ~~(-v / logb) + 1;
        const eps = Math.pow(base, -precision - 1);
        v = Math.floor(min / step + eps) * step;
        min = min < v ? v - step : v;
        max = Math.ceil(max / step) * step;
      }

      return [
        min,
        max === min ? min + step : max,
        step
      ];
    }

    function key(value) {
      const type = typeof value;
      return type === 'string' ? `"${value}"`
        : type !== 'object' || !value ? value
        : isDate(value) ? +value
        : isArray$2(value) || isTypedArray(value) ? `[${value.map(key)}]`
        : isRegExp(value) ? value + ''
        : objectKey(value);
    }

    function objectKey(value) {
      let s = '{';
      let i = -1;
      for (const k in value) {
        if (++i > 0) s += ',';
        s += `"${k}":${key(value[k])}`;
      }
      s += '}';
      return s;
    }

    function keyFunction(get, nulls) {
      const n = get.length;
      return n === 1
        ? (row, data) => key(get[0](row, data))
        : (row, data) => {
            let s = '';
            for (let i = 0; i < n; ++i) {
              if (i > 0) s += '|';
              const v = get[i](row, data);
              if (nulls && (v == null || v !== v)) return null;
              s += key(v);
            }
            return s;
          };
    }

    function distinctMap() {
      const map = new Map();
      return {
        count() {
          return map.size;
        },
        values() {
          return Array.from(map.values(), _ => _.v);
        },
        increment(v) {
          const k = key(v);
          const e = map.get(k);
          e ? ++e.n : map.set(k, { v, n: 1 });
        },
        decrement(v) {
          const k = key(v);
          const e = map.get(k);
          e.n === 1 ? map.delete(k) : --e.n;
        },
        forEach(fn) {
          map.forEach(({ v, n }) => fn(v, n));
        }
      };
    }

    function noop() {}

    function product(values, start = 0, stop = values.length) {
      let prod = values[start++];

      for (let i = start; i < stop; ++i) {
        prod *= values[i];
      }

      return prod;
    }

    /**
     * Initialize an aggregate operator.
     */
    function initOp(op) {
      op.init = op.init || noop;
      op.add = op.add || noop;
      op.rem = op.rem || noop;
      return op;
    }

    function initProduct(s, value) {
      s.product_v = false;
      return s.product = value;
    }

    /**
     * Initialize an aggregate operator.
     * @callback AggregateInit
     * @param {object} state The aggregate state object.
     * @return {void}
     */

    /**
     * Add a value to an aggregate operator.
     * @callback AggregateAdd
     * @param {object} state The aggregate state object.
     * @param {*} value The value to add.
     * @return {void}
     */

    /**
     * Remove a value from an aggregate operator.
     * @callback AggregateRem
     * @param {object} state The aggregate state object.
     * @param {*} value The value to remove.
     * @return {void}
     */

    /**
     * Retrive an output value from an aggregate operator.
     * @callback AggregateValue
     * @param {object} state The aggregate state object.
     * @return {*} The output value.
     */

    /**
     * An operator instance for an aggregate function.
     * @typedef {object} AggregateOperator
     * @property {AggregateInit} init Initialize the operator.
     * @property {AggregateAdd} add Add a value to the operator state.
     * @property {AggregateRem} rem Remove a value from the operator state.
     * @property {AggregateValue} value Retrieve an output value.
     */

    /**
     * Create a new aggregate operator instance.
     * @callback AggregateCreate
     * @param {...any} params The aggregate operator parameters.
     * @return {AggregateOperator} The instantiated aggregate operator.
     */

    /**
     * An operator definition for an aggregate function.
     * @typedef {object} AggregateDef
     * @property {AggregateCreate} create Create a new operator instance.
     * @property {number[]} param Two-element array containing the
     *  counts of input fields and additional parameters.
     * @property {string[]} [req] Names of operators required by this one.
     * @property {string[]} [stream] Names of operators required by this one
     *  for streaming operations (value removes).
     */

    /**
     * Aggregate operator definitions.
     */
    var aggregateFunctions = {
      /** @type {AggregateDef} */
      count: {
        create: () => initOp({
          value: s => s.count
        }),
        param: []
      },

      /** @type {AggregateDef} */
      array_agg: {
        create: () => initOp({
          init: s => s.values = true,
          value: s => s.list.values(s.stream)
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      object_agg: {
        create: () => initOp({
          init:  s => s.values = true,
          value: s => Object.fromEntries(s.list.values())
        }),
        param: [2]
      },

      /** @type {AggregateDef} */
      map_agg: {
        create: () => initOp({
          init:  s => s.values = true,
          value: s => new Map(s.list.values())
        }),
        param: [2]
      },

      /** @type {AggregateDef} */
      entries_agg: {
        create: () => initOp({
          init:  s => s.values = true,
          value: s => s.list.values(s.stream)
        }),
        param: [2]
      },

      /** @type {AggregateDef} */
      any: {
        create: () => initOp({
          add: (s, v) => { if (s.any == null) s.any = v; },
          value: s => s.valid ? s.any : NULL
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      valid: {
        create: () => initOp({
          value: s => s.valid
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      invalid: {
        create: () => initOp({
          value: s => s.count - s.valid
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      distinct: {
        create: () => ({
          init: s => s.distinct = distinctMap(),
          value: s => s.distinct.count() + (s.valid === s.count ? 0 : 1),
          add: (s, v) => s.distinct.increment(v),
          rem: (s, v) => s.distinct.decrement(v)
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      array_agg_distinct: {
        create: () => initOp({
          value: s => s.distinct.values()
        }),
        param: [1],
        req: ['distinct']
      },

      /** @type {AggregateDef} */
      mode: {
        create: () => initOp({
          value: s => {
            let mode = NULL;
            let max = 0;
            s.distinct.forEach((value, count) => {
              if (count > max) {
                max = count;
                mode = value;
              }
            });
            return mode;
          }
        }),
        param: [1],
        req: ['distinct']
      },

      /** @type {AggregateDef} */
      sum: {
        create: () => ({
          init:  s => s.sum = 0,
          value: s => s.valid ? s.sum : NULL,
          add: (s, v) => isBigInt(v)
            ? (s.sum === 0 ? s.sum = v : s.sum += v)
            : s.sum += +v,
          rem: (s, v) => s.sum -= v
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      product: {
        create: () => ({
          init:  s => initProduct(s, 1),
          value: s => s.valid
            ? (
                s.product_v
                  ? initProduct(s, product(s.list.values()))
                  : s.product
              )
            : undefined,
          add: (s, v) => isBigInt(v)
            ? (s.product === 1 ? s.product = v : s.product *= v)
            : s.product *= v,
          rem: (s, v) => (v == 0 || v === Infinity || v === -Infinity)
            ? s.product_v = true
            : s.product /= v
        }),
        param: [1],
        stream: ['array_agg']
      },

      /** @type {AggregateDef} */
      mean: {
        create: () => ({
          init: s => s.mean = 0,
          value: s => s.valid ? s.mean : NULL,
          add: (s, v) => {
            s.mean_d = v - s.mean;
            s.mean += s.mean_d / s.valid;
          },
          rem: (s, v) => {
            s.mean_d = v - s.mean;
            s.mean -= s.valid ? s.mean_d / s.valid : s.mean;
          }
        }),
        param: [1]
      },

      /** @type {AggregateDef} */
      average: {
        create: () => initOp({
          value: s => s.valid ? s.mean : NULL
        }),
        param: [1],
        req: ['mean']
      },

      /** @type {AggregateDef} */
      variance: {
        create: () => ({
          init:  s => s.dev = 0,
          value: s => s.valid > 1 ? s.dev / (s.valid - 1) : NULL,
          add: (s, v) => s.dev += s.mean_d * (v - s.mean),
          rem: (s, v) => s.dev -= s.mean_d * (v - s.mean)
        }),
        param: [1],
        req: ['mean']
      },

      /** @type {AggregateDef} */
      variancep: {
        create: () => initOp({
          value: s => s.valid > 1 ? s.dev / s.valid : NULL
        }),
        param: [1],
        req: ['variance']
      },

      /** @type {AggregateDef} */
      stdev: {
        create: () => initOp({
          value: s => s.valid > 1 ? Math.sqrt(s.dev / (s.valid - 1)) : NULL
        }),
        param: [1],
        req: ['variance']
      },

      /** @type {AggregateDef} */
      stdevp: {
        create: () => initOp({
          value: s => s.valid > 1 ? Math.sqrt(s.dev / s.valid) : NULL
        }),
        param: [1],
        req: ['variance']
      },

      /** @type {AggregateDef} */
      min: {
        create: () => ({
          init:  s => s.min = NULL,
          value: s => s.min = (Number.isNaN(s.min) ? s.list.min() : s.min),
          add: (s, v) => { if (v < s.min || s.min === NULL) s.min = v; },
          rem: (s, v) => { if (v <= s.min) s.min = NaN; }
        }),
        param: [1],
        stream: ['array_agg']
      },

      /** @type {AggregateDef} */
      max: {
        create: () => ({
          init:  s => s.max = NULL,
          value: s => s.max = (Number.isNaN(s.max) ? s.list.max() : s.max),
          add: (s, v) => { if (v > s.max || s.max === NULL) s.max = v; },
          rem: (s, v) => { if (v >= s.max) s.max = NaN; }
        }),
        param: [1],
        stream: ['array_agg']
      },

      /** @type {AggregateDef} */
      quantile: {
        create: (p) => initOp({
          value: s => s.list.quantile(p)
        }),
        param: [1, 1],
        req: ['array_agg']
      },

      /** @type {AggregateDef} */
      median: {
        create: () => initOp({
          value: s => s.list.quantile(0.5)
        }),
        param: [1],
        req: ['array_agg']
      },

      /** @type {AggregateDef} */
      covariance: {
        create: () => ({
          init:  s => {
            s.cov = s.mean_x = s.mean_y = s.dev_x = s.dev_y = 0;
          },
          value: s => s.valid > 1 ? s.cov / (s.valid - 1) : NULL,
          add: (s, x, y) => {
            const dx = x - s.mean_x;
            const dy = y - s.mean_y;
            s.mean_x += dx / s.valid;
            s.mean_y += dy / s.valid;
            const dy2 = y - s.mean_y;
            s.dev_x += dx * (x - s.mean_x);
            s.dev_y += dy * dy2;
            s.cov += dx * dy2;
          },
          rem: (s, x, y) => {
            const dx = x - s.mean_x;
            const dy = y - s.mean_y;
            s.mean_x -= s.valid ? dx / s.valid : s.mean_x;
            s.mean_y -= s.valid ? dy / s.valid : s.mean_y;
            const dy2 = y - s.mean_y;
            s.dev_x -= dx * (x - s.mean_x);
            s.dev_y -= dy * dy2;
            s.cov -= dx * dy2;
          }
        }),
        param: [2]
      },

      /** @type {AggregateDef} */
      covariancep: {
        create: () => initOp({
          value: s => s.valid > 1 ? s.cov / s.valid : NULL
        }),
        param: [2],
        req: ['covariance']
      },

      /** @type {AggregateDef} */
      corr: {
        create: () => initOp({
          value: s => s.valid > 1
            ? s.cov / (Math.sqrt(s.dev_x) * Math.sqrt(s.dev_y))
            : NULL
        }),
        param: [2],
        req: ['covariance']
      },

      /** @type {AggregateDef} */
      bins: {
        create: (maxbins, nice, minstep, step) => initOp({
          value: s => bins(s.min, s.max, maxbins, nice, minstep, step)
        }),
        param: [1, 4],
        req: ['min', 'max']
      }
    };

    /**
     * Initialize a window operator.
     * @callback WindowInit
     * @return {void}
     */

    /**
     * Retrieve an output value from a window operator.
     * @callback WindowValue
     * @param {WindowState} state The window state object.
     * @return {*} The output value.
     */

    /**
     * An operator instance for a window function.
     * @typedef {object} WindowOperator
     * @property {AggregateInit} init Initialize the operator.
     * @property {AggregateValue} value Retrieve an output value.
     */

    /**
     * Create a new window operator instance.
     * @callback WindowCreate
     * @param {...any} params The aggregate operator parameters.
     * @return {WindowOperator} The instantiated window operator.
     */

    /**
     * An operator definition for a window function.
     * @typedef {object} WindowDef
     * @property {AggregateCreate} create Create a new operator instance.
     * @property {number[]} param Two-element array containing the
     *  counts of input fields and additional parameters.
     */

    const rank = {
      create() {
        let rank;
        return {
          init: () => rank = 1,
          value: w => {
            const i = w.index;
            return (i && !w.peer(i)) ? (rank = i + 1) : rank;
          }
        };
      },
      param: []
    };

    const cume_dist = {
      create() {
        let cume;
        return {
          init: () => cume = 0,
          value: w => {
            const { index, peer, size } = w;
            let i = index;
            if (cume < i) {
              while (i + 1 < size && peer(i + 1)) ++i;
              cume = i;
            }
            return (1 + cume) / size;
          }
        };
      },
      param: []
    };

    /**
     * Window operator definitions.
     */
    var windowFunctions = {
      /** @type {WindowDef} */
      row_number: {
        create() {
          return {
            init: noop,
            value: w => w.index + 1
          };
        },
        param: []
      },

      /** @type {WindowDef} */
      rank,

      /** @type {WindowDef} */
      avg_rank: {
        create() {
          let j, rank;
          return {
            init: () => (j = -1, rank = 1),
            value: w => {
              const i = w.index;
              if (i >= j) {
                for (rank = j = i + 1; w.peer(j); rank += ++j);
                rank /= (j - i);
              }
              return rank;
            }
          };
        },
        param: []
      },

      /** @type {WindowDef} */
      dense_rank: {
        create() {
          let drank;
          return {
            init: () => drank = 1,
            value: w => {
              const i = w.index;
              return (i && !w.peer(i)) ? ++drank : drank;
            }
          };
        },
        param: []
      },

      /** @type {WindowDef} */
      percent_rank: {
        create() {
          const { init, value } = rank.create();
          return {
            init,
            value: w => (value(w) - 1) / (w.size - 1)
          };
        },
        param: []
      },

      /** @type {WindowDef} */
      cume_dist,

      /** @type {WindowDef} */
      ntile: {
        create(num) {
          num = +num;
          if (!(num > 0)) error('ntile num must be greater than zero.');
          const { init, value } = cume_dist.create();
          return {
            init,
            value: w => Math.ceil(num * value(w))
          };
        },
        param: [0, 1]
      },

      /** @type {WindowDef} */
      lag: {
        create(offset, defaultValue = NULL) {
          offset = +offset || 1;
          return {
            init: noop,
            value: (w, f) => {
              const i = w.index - offset;
              return i >= 0 ? w.value(i, f) : defaultValue;
            }
          };
        },
        param: [1, 2]
      },

      /** @type {WindowDef} */
      lead: {
        create(offset, defaultValue = NULL) {
          offset = +offset || 1;
          return {
            init: noop,
            value: (w, f) => {
              const i = w.index + offset;
              return i < w.size ? w.value(i, f) : defaultValue;
            }
          };
        },
        param: [1, 2]
      },

      /** @type {WindowDef} */
      first_value: {
        create() {
          return {
            init: noop,
            value: (w, f) => w.value(w.i0, f)
          };
        },
        param: [1]
      },

      /** @type {WindowDef} */
      last_value: {
        create() {
          return {
            init: noop,
            value: (w, f) => w.value(w.i1 - 1, f)
          };
        },
        param: [1]
      },

      /** @type {WindowDef} */
      nth_value: {
        create(nth) {
          nth = +nth;
          if (!(nth > 0)) error('nth_value nth must be greater than zero.');
          return {
            init: noop,
            value: (w, f) => {
              const i = w.i0 + (nth - 1);
              return i < w.i1 ? w.value(i, f) : NULL;
            }
          };
        },
        param: [1, 1]
      },

      /** @type {WindowDef} */
      fill_down: {
        create(defaultValue = NULL) {
          let value;
          return {
            init: () => value = defaultValue,
            value: (w, f) => {
              const v = w.value(w.index, f);
              return isValid(v) ? (value = v) : value;
            }
          };
        },
        param: [1, 1]
      },

      /** @type {WindowDef} */
      fill_up: {
        create(defaultValue = NULL) {
          let value, idx;
          return {
            init: () => (value = defaultValue, idx = -1),
            value: (w, f) => w.index <= idx ? value
              : (idx = find(w, f, w.index)) >= 0 ? (value = w.value(idx, f))
              : (idx = w.size, value = defaultValue)
          };
        },
        param: [1, 1]
      }
    };

    function find(w, f, i) {
      for (const n = w.size; i < n; ++i) {
        if (isValid(w.value(i, f))) return i;
      }
      return -1;
    }

    /**
     * Check if an aggregate function with the given name exists.
     * @param {string} name The name of the aggregate function.
     * @return {boolean} True if found, false otherwise.
     */
    function hasAggregate(name) {
      return has(aggregateFunctions, name);
    }

    /**
     * Check if a window function with the given name exists.
     * @param {string} name The name of the window function.
     * @return {boolean} True if found, false otherwise.
     */
    function hasWindow(name) {
      return has(windowFunctions, name);
    }

    /**
     * Check if an expression function with the given name exists.
     * @param {string} name The name of the function.
     * @return {boolean} True if found, false otherwise.
     */
     function hasFunction(name) {
      return has(functions, name) || name === 'row_object';
    }

    /**
     * Get an aggregate function definition.
     * @param {string} name The name of the aggregate function.
     * @return {AggregateDef} The aggregate function definition,
     *  or undefined if not found.
     */
    function getAggregate(name) {
      return hasAggregate(name) && aggregateFunctions[name];
    }

    /**
     * Get a window function definition.
     * @param {string} name The name of the window function.
     * @return {WindowDef} The window function definition,
     *  or undefined if not found.
     */
    function getWindow(name) {
      return hasWindow(name) && windowFunctions[name];
    }

    function compile(code, fn, params) {
      code = `"use strict"; return ${code};`;
      return (Function('fn', '$', code))(fn, params);
    }

    var compile$1 = {
      escape: (code, func, params) => compile(code, func, params),
      expr:   (code, params) => compile(`(row,data,op)=>${code}`, functions, params),
      expr2:  (code, params) => compile(`(row0,data0,row,data)=>${code}`, functions, params),
      join:   (code, params) => compile(`(row1,data1,row2,data2)=>${code}`, functions, params),
      param:  (code, params) => compile(code, functions, params)
    };

    const dictOps = {
      '==': 1,
      '!=': 1,
      '===': 1,
      '!==': 1
    };

    /**
     * Rewrite AST node to be a table column reference.
     * Additionally optimizes dictionary column operations.
     * @param {object} ref AST node to rewrite to a column reference.
     * @param {string} name The name of the column.
     * @param {number} index The table index of the column.
     * @param {object} col The actual table column instance.
     * @param {object} op Parent AST node operating on the column reference.
     */
    function rewrite(ref, name, index = 0, col, op) {
      ref.type = Column$1;
      ref.name = name;
      ref.table = index;

      // proceed only if has parent op and is a dictionary column
      if (op && col && isFunction$1(col.keyFor)) {
        // get other arg if op is an optimizeable operation
        const lit = dictOps[op.operator]
          ? op.left === ref ? op.right : op.left
          : op.callee && op.callee.name === 'equal'
          ? op.arguments[op.arguments[0] === ref ? 1 : 0]
          : null;

        // rewrite as dictionary lookup if other arg is a literal
        if (lit && lit.type === Literal$1) {
          rewriteDictionary(op, ref, lit, col.keyFor(lit.value));
        }
      }

      return ref;
    }

    function rewriteDictionary(op, ref, lit, key) {
      if (key < 0) {
        // value not in dictionary, rewrite op as false literal
        op.type = Literal$1;
        op.value = false;
        op.raw = 'false';
      } else {
        // rewrite ref as dict key access
        ref.type = Dictionary$1;

        // rewrite literal as target dict key
        lit.value = key;
        lit.raw = key + '';
      }

      return true;
    }

    function entries(value) {
      return isArray$2(value) ? value
        : isMap(value) ? value.entries()
        : value ? Object.entries(value)
        : [];
    }

    const ROW_OBJECT = 'row_object';

    function rowObjectExpression(node, props) {
      node.type = ObjectExpression;

      const p = node.properties = [];
      for (const prop of entries(props)) {
        const [name, key] = isArray$2(prop) ? prop : [prop, prop];
        p.push({
          type: Property,
          key: { type: Literal$1, raw: toString$1(key) },
          value: rewrite({ computed: true }, name)
        });
      }

      return node;
    }

    function rowObjectCode(props) {
      return codegen(rowObjectExpression({}, props));
    }

    function rowObjectBuilder(props) {
      return compile$1.expr(rowObjectCode(props));
    }

    /// @file
    /// @addtogroup flatbuffers_javascript_api
    /// @{
    /// @cond FLATBUFFERS_INTERNAL

    /**
     * @fileoverview
     *
     * Need to suppress 'global this' error so the Node.js export line doesn't cause
     * closure compile to error out.
     * @suppress {globalThis}
     */

    /**
     * @const
     * @namespace
     */
    var flatbuffers = {};

    /**
     * @type {number}
     * @const
     */
    flatbuffers.SIZEOF_SHORT = 2;

    /**
     * @type {number}
     * @const
     */
    flatbuffers.SIZEOF_INT = 4;

    /**
     * @type {number}
     * @const
     */
    flatbuffers.FILE_IDENTIFIER_LENGTH = 4;

    /**
     * @enum {number}
     */
    flatbuffers.Encoding = {
      UTF8_BYTES: 1,
      UTF16_STRING: 2
    };

    /**
     * @type {Int32Array}
     * @const
     */
    flatbuffers.int32 = new Int32Array(2);

    /**
     * @type {Float32Array}
     * @const
     */
    flatbuffers.float32 = new Float32Array(flatbuffers.int32.buffer);

    /**
     * @type {Float64Array}
     * @const
     */
    flatbuffers.float64 = new Float64Array(flatbuffers.int32.buffer);

    /**
     * @type {boolean}
     * @const
     */
    flatbuffers.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;

    ////////////////////////////////////////////////////////////////////////////////

    /**
     * @constructor
     * @param {number} low
     * @param {number} high
     */
    flatbuffers.Long = function(low, high) {
      /**
       * @type {number}
       * @const
       */
      this.low = low | 0;

      /**
       * @type {number}
       * @const
       */
      this.high = high | 0;
    };

    /**
     * @param {number} low
     * @param {number} high
     * @returns {flatbuffers.Long}
     */
    flatbuffers.Long.create = function(low, high) {
      // Special-case zero to avoid GC overhead for default values
      return low == 0 && high == 0 ? flatbuffers.Long.ZERO : new flatbuffers.Long(low, high);
    };

    /**
     * @returns {number}
     */
    flatbuffers.Long.prototype.toFloat64 = function() {
      return (this.low >>> 0) + this.high * 0x100000000;
    };

    /**
     * @param {flatbuffers.Long} other
     * @returns {boolean}
     */
    flatbuffers.Long.prototype.equals = function(other) {
      return this.low == other.low && this.high == other.high;
    };

    /**
     * @type {flatbuffers.Long}
     * @const
     */
    flatbuffers.Long.ZERO = new flatbuffers.Long(0, 0);

    /// @endcond
    ////////////////////////////////////////////////////////////////////////////////
    /**
     * Create a FlatBufferBuilder.
     *
     * @constructor
     * @param {number=} opt_initial_size
     */
    flatbuffers.Builder = function(opt_initial_size) {
      if (!opt_initial_size) {
        var initial_size = 1024;
      } else {
        var initial_size = opt_initial_size;
      }

      /**
       * @type {flatbuffers.ByteBuffer}
       * @private
       */
      this.bb = flatbuffers.ByteBuffer.allocate(initial_size);

      /**
       * Remaining space in the ByteBuffer.
       *
       * @type {number}
       * @private
       */
      this.space = initial_size;

      /**
       * Minimum alignment encountered so far.
       *
       * @type {number}
       * @private
       */
      this.minalign = 1;

      /**
       * The vtable for the current table.
       *
       * @type {Array.<number>}
       * @private
       */
      this.vtable = null;

      /**
       * The amount of fields we're actually using.
       *
       * @type {number}
       * @private
       */
      this.vtable_in_use = 0;

      /**
       * Whether we are currently serializing a table.
       *
       * @type {boolean}
       * @private
       */
      this.isNested = false;

      /**
       * Starting offset of the current struct/table.
       *
       * @type {number}
       * @private
       */
      this.object_start = 0;

      /**
       * List of offsets of all vtables.
       *
       * @type {Array.<number>}
       * @private
       */
      this.vtables = [];

      /**
       * For the current vector being built.
       *
       * @type {number}
       * @private
       */
      this.vector_num_elems = 0;

      /**
       * False omits default values from the serialized data
       *
       * @type {boolean}
       * @private
       */
      this.force_defaults = false;
    };

    flatbuffers.Builder.prototype.clear = function() {
      this.bb.clear();
      this.space = this.bb.capacity();
      this.minalign = 1;
      this.vtable = null;
      this.vtable_in_use = 0;
      this.isNested = false;
      this.object_start = 0;
      this.vtables = [];
      this.vector_num_elems = 0;
      this.force_defaults = false;
    };

    /**
     * In order to save space, fields that are set to their default value
     * don't get serialized into the buffer. Forcing defaults provides a
     * way to manually disable this optimization.
     *
     * @param {boolean} forceDefaults true always serializes default values
     */
    flatbuffers.Builder.prototype.forceDefaults = function(forceDefaults) {
      this.force_defaults = forceDefaults;
    };

    /**
     * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
     * called finish(). The actual data starts at the ByteBuffer's current position,
     * not necessarily at 0.
     *
     * @returns {flatbuffers.ByteBuffer}
     */
    flatbuffers.Builder.prototype.dataBuffer = function() {
      return this.bb;
    };

    /**
     * Get the bytes representing the FlatBuffer. Only call this after you've
     * called finish().
     *
     * @returns {Uint8Array}
     */
    flatbuffers.Builder.prototype.asUint8Array = function() {
      return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
    };

    /// @cond FLATBUFFERS_INTERNAL
    /**
     * Prepare to write an element of `size` after `additional_bytes` have been
     * written, e.g. if you write a string, you need to align such the int length
     * field is aligned to 4 bytes, and the string data follows it directly. If all
     * you need to do is alignment, `additional_bytes` will be 0.
     *
     * @param {number} size This is the of the new element to write
     * @param {number} additional_bytes The padding size
     */
    flatbuffers.Builder.prototype.prep = function(size, additional_bytes) {
      // Track the biggest thing we've ever aligned to.
      if (size > this.minalign) {
        this.minalign = size;
      }

      // Find the amount of alignment needed such that `size` is properly
      // aligned after `additional_bytes`
      var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);

      // Reallocate the buffer if needed.
      while (this.space < align_size + size + additional_bytes) {
        var old_buf_size = this.bb.capacity();
        this.bb = flatbuffers.Builder.growByteBuffer(this.bb);
        this.space += this.bb.capacity() - old_buf_size;
      }

      this.pad(align_size);
    };

    /**
     * @param {number} byte_size
     */
    flatbuffers.Builder.prototype.pad = function(byte_size) {
      for (var i = 0; i < byte_size; i++) {
        this.bb.writeInt8(--this.space, 0);
      }
    };

    /**
     * @param {number} value
     */
    flatbuffers.Builder.prototype.writeInt8 = function(value) {
      this.bb.writeInt8(this.space -= 1, value);
    };

    /**
     * @param {number} value
     */
    flatbuffers.Builder.prototype.writeInt16 = function(value) {
      this.bb.writeInt16(this.space -= 2, value);
    };

    /**
     * @param {number} value
     */
    flatbuffers.Builder.prototype.writeInt32 = function(value) {
      this.bb.writeInt32(this.space -= 4, value);
    };

    /**
     * @param {flatbuffers.Long} value
     */
    flatbuffers.Builder.prototype.writeInt64 = function(value) {
      this.bb.writeInt64(this.space -= 8, value);
    };

    /**
     * @param {number} value
     */
    flatbuffers.Builder.prototype.writeFloat32 = function(value) {
      this.bb.writeFloat32(this.space -= 4, value);
    };

    /**
     * @param {number} value
     */
    flatbuffers.Builder.prototype.writeFloat64 = function(value) {
      this.bb.writeFloat64(this.space -= 8, value);
    };
    /// @endcond

    /**
     * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {number} value The `int8` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addInt8 = function(value) {
      this.prep(1, 0);
      this.writeInt8(value);
    };

    /**
     * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {number} value The `int16` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addInt16 = function(value) {
      this.prep(2, 0);
      this.writeInt16(value);
    };

    /**
     * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {number} value The `int32` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addInt32 = function(value) {
      this.prep(4, 0);
      this.writeInt32(value);
    };

    /**
     * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {flatbuffers.Long} value The `int64` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addInt64 = function(value) {
      this.prep(8, 0);
      this.writeInt64(value);
    };

    /**
     * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {number} value The `float32` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addFloat32 = function(value) {
      this.prep(4, 0);
      this.writeFloat32(value);
    };

    /**
     * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
     * @param {number} value The `float64` to add the the buffer.
     */
    flatbuffers.Builder.prototype.addFloat64 = function(value) {
      this.prep(8, 0);
      this.writeFloat64(value);
    };

    /// @cond FLATBUFFERS_INTERNAL
    /**
     * @param {number} voffset
     * @param {number} value
     * @param {number} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldInt8 = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addInt8(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {number} value
     * @param {number} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldInt16 = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addInt16(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {number} value
     * @param {number} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldInt32 = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addInt32(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {flatbuffers.Long} value
     * @param {flatbuffers.Long} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldInt64 = function(voffset, value, defaultValue) {
      if (this.force_defaults || !value.equals(defaultValue)) {
        this.addInt64(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {number} value
     * @param {number} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldFloat32 = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addFloat32(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {number} value
     * @param {number} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldFloat64 = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addFloat64(value);
        this.slot(voffset);
      }
    };

    /**
     * @param {number} voffset
     * @param {flatbuffers.Offset} value
     * @param {flatbuffers.Offset} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldOffset = function(voffset, value, defaultValue) {
      if (this.force_defaults || value != defaultValue) {
        this.addOffset(value);
        this.slot(voffset);
      }
    };

    /**
     * Structs are stored inline, so nothing additional is being added. `d` is always 0.
     *
     * @param {number} voffset
     * @param {flatbuffers.Offset} value
     * @param {flatbuffers.Offset} defaultValue
     */
    flatbuffers.Builder.prototype.addFieldStruct = function(voffset, value, defaultValue) {
      if (value != defaultValue) {
        this.nested(value);
        this.slot(voffset);
      }
    };

    /**
     * Structures are always stored inline, they need to be created right
     * where they're used.  You'll get this assertion failure if you
     * created it elsewhere.
     *
     * @param {flatbuffers.Offset} obj The offset of the created object
     */
    flatbuffers.Builder.prototype.nested = function(obj) {
      if (obj != this.offset()) {
        throw new Error('FlatBuffers: struct must be serialized inline.');
      }
    };

    /**
     * Should not be creating any other object, string or vector
     * while an object is being constructed
     */
    flatbuffers.Builder.prototype.notNested = function() {
      if (this.isNested) {
        throw new Error('FlatBuffers: object serialization must not be nested.');
      }
    };

    /**
     * Set the current vtable at `voffset` to the current location in the buffer.
     *
     * @param {number} voffset
     */
    flatbuffers.Builder.prototype.slot = function(voffset) {
      this.vtable[voffset] = this.offset();
    };

    /**
     * @returns {flatbuffers.Offset} Offset relative to the end of the buffer.
     */
    flatbuffers.Builder.prototype.offset = function() {
      return this.bb.capacity() - this.space;
    };

    /**
     * Doubles the size of the backing ByteBuffer and copies the old data towards
     * the end of the new buffer (since we build the buffer backwards).
     *
     * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data
     * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied
     * to it. The data is located at the end of the buffer.
     *
     * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
     * it a uint8Array we need to suppress the type check:
     * @suppress {checkTypes}
     */
    flatbuffers.Builder.growByteBuffer = function(bb) {
      var old_buf_size = bb.capacity();

      // Ensure we don't grow beyond what fits in an int.
      if (old_buf_size & 0xC0000000) {
        throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
      }

      var new_buf_size = old_buf_size << 1;
      var nbb = flatbuffers.ByteBuffer.allocate(new_buf_size);
      nbb.setPosition(new_buf_size - old_buf_size);
      nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
      return nbb;
    };
    /// @endcond

    /**
     * Adds on offset, relative to where it will be written.
     *
     * @param {flatbuffers.Offset} offset The offset to add.
     */
    flatbuffers.Builder.prototype.addOffset = function(offset) {
      this.prep(flatbuffers.SIZEOF_INT, 0); // Ensure alignment is already done.
      this.writeInt32(this.offset() - offset + flatbuffers.SIZEOF_INT);
    };

    /// @cond FLATBUFFERS_INTERNAL
    /**
     * Start encoding a new object in the buffer.  Users will not usually need to
     * call this directly. The FlatBuffers compiler will generate helper methods
     * that call this method internally.
     *
     * @param {number} numfields
     */
    flatbuffers.Builder.prototype.startObject = function(numfields) {
      this.notNested();
      if (this.vtable == null) {
        this.vtable = [];
      }
      this.vtable_in_use = numfields;
      for (var i = 0; i < numfields; i++) {
        this.vtable[i] = 0; // This will push additional elements as needed
      }
      this.isNested = true;
      this.object_start = this.offset();
    };

    /**
     * Finish off writing the object that is under construction.
     *
     * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer`
     */
    flatbuffers.Builder.prototype.endObject = function() {
      if (this.vtable == null || !this.isNested) {
        throw new Error('FlatBuffers: endObject called without startObject');
      }

      this.addInt32(0);
      var vtableloc = this.offset();

      // Trim trailing zeroes.
      var i = this.vtable_in_use - 1;
      for (; i >= 0 && this.vtable[i] == 0; i--) {}
      var trimmed_size = i + 1;

      // Write out the current vtable.
      for (; i >= 0; i--) {
        // Offset relative to the start of the table.
        this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
      }

      var standard_fields = 2; // The fields below:
      this.addInt16(vtableloc - this.object_start);
      var len = (trimmed_size + standard_fields) * flatbuffers.SIZEOF_SHORT;
      this.addInt16(len);

      // Search for an existing vtable that matches the current one.
      var existing_vtable = 0;
      var vt1 = this.space;
    outer_loop:
      for (i = 0; i < this.vtables.length; i++) {
        var vt2 = this.bb.capacity() - this.vtables[i];
        if (len == this.bb.readInt16(vt2)) {
          for (var j = flatbuffers.SIZEOF_SHORT; j < len; j += flatbuffers.SIZEOF_SHORT) {
            if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
              continue outer_loop;
            }
          }
          existing_vtable = this.vtables[i];
          break;
        }
      }

      if (existing_vtable) {
        // Found a match:
        // Remove the current vtable.
        this.space = this.bb.capacity() - vtableloc;

        // Point table to existing vtable.
        this.bb.writeInt32(this.space, existing_vtable - vtableloc);
      } else {
        // No match:
        // Add the location of the current vtable to the list of vtables.
        this.vtables.push(this.offset());

        // Point table to current vtable.
        this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
      }

      this.isNested = false;
      return vtableloc;
    };
    /// @endcond

    /**
     * Finalize a buffer, poiting to the given `root_table`.
     *
     * @param {flatbuffers.Offset} root_table
     * @param {string=} opt_file_identifier
     */
    flatbuffers.Builder.prototype.finish = function(root_table, opt_file_identifier) {
      if (opt_file_identifier) {
        var file_identifier = opt_file_identifier;
        this.prep(this.minalign, flatbuffers.SIZEOF_INT +
          flatbuffers.FILE_IDENTIFIER_LENGTH);
        if (file_identifier.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {
          throw new Error('FlatBuffers: file identifier must be length ' +
            flatbuffers.FILE_IDENTIFIER_LENGTH);
        }
        for (var i = flatbuffers.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
          this.writeInt8(file_identifier.charCodeAt(i));
        }
      }
      this.prep(this.minalign, flatbuffers.SIZEOF_INT);
      this.addOffset(root_table);
      this.bb.setPosition(this.space);
    };

    /// @cond FLATBUFFERS_INTERNAL
    /**
     * This checks a required field has been set in a given table that has
     * just been constructed.
     *
     * @param {flatbuffers.Offset} table
     * @param {number} field
     */
    flatbuffers.Builder.prototype.requiredField = function(table, field) {
      var table_start = this.bb.capacity() - table;
      var vtable_start = table_start - this.bb.readInt32(table_start);
      var ok = this.bb.readInt16(vtable_start + field) != 0;

      // If this fails, the caller will show what field needs to be set.
      if (!ok) {
        throw new Error('FlatBuffers: field ' + field + ' must be set');
      }
    };

    /**
     * Start a new array/vector of objects.  Users usually will not call
     * this directly. The FlatBuffers compiler will create a start/end
     * method for vector types in generated code.
     *
     * @param {number} elem_size The size of each element in the array
     * @param {number} num_elems The number of elements in the array
     * @param {number} alignment The alignment of the array
     */
    flatbuffers.Builder.prototype.startVector = function(elem_size, num_elems, alignment) {
      this.notNested();
      this.vector_num_elems = num_elems;
      this.prep(flatbuffers.SIZEOF_INT, elem_size * num_elems);
      this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
    };

    /**
     * Finish off the creation of an array and all its elements. The array must be
     * created with `startVector`.
     *
     * @returns {flatbuffers.Offset} The offset at which the newly created array
     * starts.
     */
    flatbuffers.Builder.prototype.endVector = function() {
      this.writeInt32(this.vector_num_elems);
      return this.offset();
    };
    /// @endcond

    /**
     * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
     * instead of a string, it is assumed to contain valid UTF-8 encoded data.
     *
     * @param {string|Uint8Array} s The string to encode
     * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts
     */
    flatbuffers.Builder.prototype.createString = function(s) {
      if (s instanceof Uint8Array) {
        var utf8 = s;
      } else {
        var utf8 = [];
        var i = 0;

        while (i < s.length) {
          var codePoint;

          // Decode UTF-16
          var a = s.charCodeAt(i++);
          if (a < 0xD800 || a >= 0xDC00) {
            codePoint = a;
          } else {
            var b = s.charCodeAt(i++);
            codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);
          }

          // Encode UTF-8
          if (codePoint < 0x80) {
            utf8.push(codePoint);
          } else {
            if (codePoint < 0x800) {
              utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);
            } else {
              if (codePoint < 0x10000) {
                utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);
              } else {
                utf8.push(
                  ((codePoint >> 18) & 0x07) | 0xF0,
                  ((codePoint >> 12) & 0x3F) | 0x80);
              }
              utf8.push(((codePoint >> 6) & 0x3F) | 0x80);
            }
            utf8.push((codePoint & 0x3F) | 0x80);
          }
        }
      }

      this.addInt8(0);
      this.startVector(1, utf8.length, 1);
      this.bb.setPosition(this.space -= utf8.length);
      for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {
        bytes[offset++] = utf8[i];
      }
      return this.endVector();
    };

    /**
     * A helper function to avoid generated code depending on this file directly.
     *
     * @param {number} low
     * @param {number} high
     * @returns {flatbuffers.Long}
     */
    flatbuffers.Builder.prototype.createLong = function(low, high) {
      return flatbuffers.Long.create(low, high);
    };
    ////////////////////////////////////////////////////////////////////////////////
    /// @cond FLATBUFFERS_INTERNAL
    /**
     * Create a new ByteBuffer with a given array of bytes (`Uint8Array`).
     *
     * @constructor
     * @param {Uint8Array} bytes
     */
    flatbuffers.ByteBuffer = function(bytes) {
      /**
       * @type {Uint8Array}
       * @private
       */
      this.bytes_ = bytes;

      /**
       * @type {number}
       * @private
       */
      this.position_ = 0;
    };

    /**
     * Create and allocate a new ByteBuffer with a given size.
     *
     * @param {number} byte_size
     * @returns {flatbuffers.ByteBuffer}
     */
    flatbuffers.ByteBuffer.allocate = function(byte_size) {
      return new flatbuffers.ByteBuffer(new Uint8Array(byte_size));
    };

    flatbuffers.ByteBuffer.prototype.clear = function() {
      this.position_ = 0;
    };

    /**
     * Get the underlying `Uint8Array`.
     *
     * @returns {Uint8Array}
     */
    flatbuffers.ByteBuffer.prototype.bytes = function() {
      return this.bytes_;
    };

    /**
     * Get the buffer's position.
     *
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.position = function() {
      return this.position_;
    };

    /**
     * Set the buffer's position.
     *
     * @param {number} position
     */
    flatbuffers.ByteBuffer.prototype.setPosition = function(position) {
      this.position_ = position;
    };

    /**
     * Get the buffer's capacity.
     *
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.capacity = function() {
      return this.bytes_.length;
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readInt8 = function(offset) {
      return this.readUint8(offset) << 24 >> 24;
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readUint8 = function(offset) {
      return this.bytes_[offset];
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readInt16 = function(offset) {
      return this.readUint16(offset) << 16 >> 16;
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readUint16 = function(offset) {
      return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readInt32 = function(offset) {
      return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readUint32 = function(offset) {
      return this.readInt32(offset) >>> 0;
    };

    /**
     * @param {number} offset
     * @returns {flatbuffers.Long}
     */
    flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) {
      return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4));
    };

    /**
     * @param {number} offset
     * @returns {flatbuffers.Long}
     */
    flatbuffers.ByteBuffer.prototype.readUint64 = function(offset) {
      return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4));
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readFloat32 = function(offset) {
      flatbuffers.int32[0] = this.readInt32(offset);
      return flatbuffers.float32[0];
    };

    /**
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.readFloat64 = function(offset) {
      flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1] = this.readInt32(offset);
      flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
      return flatbuffers.float64[0];
    };

    /**
     * @param {number} offset
     * @param {number|boolean} value
     */
    flatbuffers.ByteBuffer.prototype.writeInt8 = function(offset, value) {
      this.bytes_[offset] = /** @type {number} */(value);
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeUint8 = function(offset, value) {
      this.bytes_[offset] = value;
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeInt16 = function(offset, value) {
      this.bytes_[offset] = value;
      this.bytes_[offset + 1] = value >> 8;
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeUint16 = function(offset, value) {
        this.bytes_[offset] = value;
        this.bytes_[offset + 1] = value >> 8;
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeInt32 = function(offset, value) {
      this.bytes_[offset] = value;
      this.bytes_[offset + 1] = value >> 8;
      this.bytes_[offset + 2] = value >> 16;
      this.bytes_[offset + 3] = value >> 24;
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeUint32 = function(offset, value) {
        this.bytes_[offset] = value;
        this.bytes_[offset + 1] = value >> 8;
        this.bytes_[offset + 2] = value >> 16;
        this.bytes_[offset + 3] = value >> 24;
    };

    /**
     * @param {number} offset
     * @param {flatbuffers.Long} value
     */
    flatbuffers.ByteBuffer.prototype.writeInt64 = function(offset, value) {
      this.writeInt32(offset, value.low);
      this.writeInt32(offset + 4, value.high);
    };

    /**
     * @param {number} offset
     * @param {flatbuffers.Long} value
     */
    flatbuffers.ByteBuffer.prototype.writeUint64 = function(offset, value) {
        this.writeUint32(offset, value.low);
        this.writeUint32(offset + 4, value.high);
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeFloat32 = function(offset, value) {
      flatbuffers.float32[0] = value;
      this.writeInt32(offset, flatbuffers.int32[0]);
    };

    /**
     * @param {number} offset
     * @param {number} value
     */
    flatbuffers.ByteBuffer.prototype.writeFloat64 = function(offset, value) {
      flatbuffers.float64[0] = value;
      this.writeInt32(offset, flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1]);
      this.writeInt32(offset + 4, flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0]);
    };

    /**
     * Return the file identifier.   Behavior is undefined for FlatBuffers whose
     * schema does not include a file_identifier (likely points at padding or the
     * start of a the root vtable).
     * @returns {string}
     */
    flatbuffers.ByteBuffer.prototype.getBufferIdentifier = function() {
      if (this.bytes_.length < this.position_ + flatbuffers.SIZEOF_INT +
          flatbuffers.FILE_IDENTIFIER_LENGTH) {
        throw new Error(
            'FlatBuffers: ByteBuffer is too short to contain an identifier.');
      }
      var result = "";
      for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {
        result += String.fromCharCode(
            this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i));
      }
      return result;
    };

    /**
     * Look up a field in the vtable, return an offset into the object, or 0 if the
     * field is not present.
     *
     * @param {number} bb_pos
     * @param {number} vtable_offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.__offset = function(bb_pos, vtable_offset) {
      var vtable = bb_pos - this.readInt32(bb_pos);
      return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
    };

    /**
     * Initialize any Table-derived type to point to the union at the given offset.
     *
     * @param {flatbuffers.Table} t
     * @param {number} offset
     * @returns {flatbuffers.Table}
     */
    flatbuffers.ByteBuffer.prototype.__union = function(t, offset) {
      t.bb_pos = offset + this.readInt32(offset);
      t.bb = this;
      return t;
    };

    /**
     * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
     * This allocates a new string and converts to wide chars upon each access.
     *
     * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as
     * the "optionalEncoding" argument. This is useful for avoiding conversion to
     * and from UTF-16 when the data will just be packaged back up in another
     * FlatBuffer later on.
     *
     * @param {number} offset
     * @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING
     * @returns {string|Uint8Array}
     */
    flatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) {
      offset += this.readInt32(offset);

      var length = this.readInt32(offset);
      var result = '';
      var i = 0;

      offset += flatbuffers.SIZEOF_INT;

      if (opt_encoding === flatbuffers.Encoding.UTF8_BYTES) {
        return this.bytes_.subarray(offset, offset + length);
      }

      while (i < length) {
        var codePoint;

        // Decode UTF-8
        var a = this.readUint8(offset + i++);
        if (a < 0xC0) {
          codePoint = a;
        } else {
          var b = this.readUint8(offset + i++);
          if (a < 0xE0) {
            codePoint =
              ((a & 0x1F) << 6) |
              (b & 0x3F);
          } else {
            var c = this.readUint8(offset + i++);
            if (a < 0xF0) {
              codePoint =
                ((a & 0x0F) << 12) |
                ((b & 0x3F) << 6) |
                (c & 0x3F);
            } else {
              var d = this.readUint8(offset + i++);
              codePoint =
                ((a & 0x07) << 18) |
                ((b & 0x3F) << 12) |
                ((c & 0x3F) << 6) |
                (d & 0x3F);
            }
          }
        }

        // Encode UTF-16
        if (codePoint < 0x10000) {
          result += String.fromCharCode(codePoint);
        } else {
          codePoint -= 0x10000;
          result += String.fromCharCode(
            (codePoint >> 10) + 0xD800,
            (codePoint & ((1 << 10) - 1)) + 0xDC00);
        }
      }

      return result;
    };

    /**
     * Retrieve the relative offset stored at "offset"
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.__indirect = function(offset) {
      return offset + this.readInt32(offset);
    };

    /**
     * Get the start of data of a vector whose offset is stored at "offset" in this object.
     *
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.__vector = function(offset) {
      return offset + this.readInt32(offset) + flatbuffers.SIZEOF_INT; // data starts after the length
    };

    /**
     * Get the length of a vector whose offset is stored at "offset" in this object.
     *
     * @param {number} offset
     * @returns {number}
     */
    flatbuffers.ByteBuffer.prototype.__vector_len = function(offset) {
      return this.readInt32(offset + this.readInt32(offset));
    };

    /**
     * @param {string} ident
     * @returns {boolean}
     */
    flatbuffers.ByteBuffer.prototype.__has_identifier = function(ident) {
      if (ident.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {
        throw new Error('FlatBuffers: file identifier must be length ' +
                        flatbuffers.FILE_IDENTIFIER_LENGTH);
      }
      for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {
        if (ident.charCodeAt(i) != this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i)) {
          return false;
        }
      }
      return true;
    };

    /**
     * A helper function to avoid generated code depending on this file directly.
     *
     * @param {number} low
     * @param {number} high
     * @returns {flatbuffers.Long}
     */
    flatbuffers.ByteBuffer.prototype.createLong = function(low, high) {
      return flatbuffers.Long.create(low, high);
    };

    /// @endcond
    /// @}

    // This is free and unencumbered software released into the public domain.
    // See LICENSE.md for more information.

    //
    // Utilities
    //

    /**
     * @param {number} a The number to test.
     * @param {number} min The minimum value in the range, inclusive.
     * @param {number} max The maximum value in the range, inclusive.
     * @return {boolean} True if a >= min and a <= max.
     */
    function inRange(a, min, max) {
      return min <= a && a <= max;
    }

    /**
     * @param {*} o
     * @return {Object}
     */
    function ToDictionary(o) {
      if (o === undefined) return {};
      if (o === Object(o)) return o;
      throw TypeError('Could not convert argument to dictionary');
    }

    /**
     * @param {string} string Input string of UTF-16 code units.
     * @return {!Array.<number>} Code points.
     */
    function stringToCodePoints(string) {
      // https://heycam.github.io/webidl/#dfn-obtain-unicode

      // 1. Let S be the DOMString value.
      var s = String(string);

      // 2. Let n be the length of S.
      var n = s.length;

      // 3. Initialize i to 0.
      var i = 0;

      // 4. Initialize U to be an empty sequence of Unicode characters.
      var u = [];

      // 5. While i < n:
      while (i < n) {

        // 1. Let c be the code unit in S at index i.
        var c = s.charCodeAt(i);

        // 2. Depending on the value of c:

        // c < 0xD800 or c > 0xDFFF
        if (c < 0xD800 || c > 0xDFFF) {
          // Append to U the Unicode character with code point c.
          u.push(c);
        }

        // 0xDC00 ≤ c ≤ 0xDFFF
        else if (0xDC00 <= c && c <= 0xDFFF) {
          // Append to U a U+FFFD REPLACEMENT CHARACTER.
          u.push(0xFFFD);
        }

        // 0xD800 ≤ c ≤ 0xDBFF
        else if (0xD800 <= c && c <= 0xDBFF) {
          // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT
          // CHARACTER.
          if (i === n - 1) {
            u.push(0xFFFD);
          }
          // 2. Otherwise, i < n−1:
          else {
            // 1. Let d be the code unit in S at index i+1.
            var d = string.charCodeAt(i + 1);

            // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
            if (0xDC00 <= d && d <= 0xDFFF) {
              // 1. Let a be c & 0x3FF.
              var a = c & 0x3FF;

              // 2. Let b be d & 0x3FF.
              var b = d & 0x3FF;

              // 3. Append to U the Unicode character with code point
              // 2^16+2^10*a+b.
              u.push(0x10000 + (a << 10) + b);

              // 4. Set i to i+1.
              i += 1;
            }

            // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a
            // U+FFFD REPLACEMENT CHARACTER.
            else  {
              u.push(0xFFFD);
            }
          }
        }

        // 3. Set i to i+1.
        i += 1;
      }

      // 6. Return U.
      return u;
    }

    /**
     * @param {!Array.<number>} code_points Array of code points.
     * @return {string} string String of UTF-16 code units.
     */
    function codePointsToString(code_points) {
      var s = '';
      for (var i = 0; i < code_points.length; ++i) {
        var cp = code_points[i];
        if (cp <= 0xFFFF) {
          s += String.fromCharCode(cp);
        } else {
          cp -= 0x10000;
          s += String.fromCharCode((cp >> 10) + 0xD800,
                                   (cp & 0x3FF) + 0xDC00);
        }
      }
      return s;
    }


    //
    // Implementation of Encoding specification
    // https://encoding.spec.whatwg.org/
    //

    //
    // 3. Terminology
    //

    /**
     * End-of-stream is a special token that signifies no more tokens
     * are in the stream.
     * @const
     */ var end_of_stream = -1;

    /**
     * A stream represents an ordered sequence of tokens.
     *
     * @constructor
     * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide the
     * stream.
     */
    function Stream(tokens) {
      /** @type {!Array.<number>} */
      this.tokens = [].slice.call(tokens);
    }

    Stream.prototype = {
      /**
       * @return {boolean} True if end-of-stream has been hit.
       */
      endOfStream: function() {
        return !this.tokens.length;
      },

      /**
       * When a token is read from a stream, the first token in the
       * stream must be returned and subsequently removed, and
       * end-of-stream must be returned otherwise.
       *
       * @return {number} Get the next token from the stream, or
       * end_of_stream.
       */
       read: function() {
        if (!this.tokens.length)
          return end_of_stream;
         return this.tokens.shift();
       },

      /**
       * When one or more tokens are prepended to a stream, those tokens
       * must be inserted, in given order, before the first token in the
       * stream.
       *
       * @param {(number|!Array.<number>)} token The token(s) to prepend to the stream.
       */
      prepend: function(token) {
        if (Array.isArray(token)) {
          var tokens = /**@type {!Array.<number>}*/(token);
          while (tokens.length)
            this.tokens.unshift(tokens.pop());
        } else {
          this.tokens.unshift(token);
        }
      },

      /**
       * When one or more tokens are pushed to a stream, those tokens
       * must be inserted, in given order, after the last token in the
       * stream.
       *
       * @param {(number|!Array.<number>)} token The tokens(s) to prepend to the stream.
       */
      push: function(token) {
        if (Array.isArray(token)) {
          var tokens = /**@type {!Array.<number>}*/(token);
          while (tokens.length)
            this.tokens.push(tokens.shift());
        } else {
          this.tokens.push(token);
        }
      }
    };

    //
    // 4. Encodings
    //

    // 4.1 Encoders and decoders

    /** @const */
    var finished = -1;

    /**
     * @param {boolean} fatal If true, decoding errors raise an exception.
     * @param {number=} opt_code_point Override the standard fallback code point.
     * @return {number} The code point to insert on a decoding error.
     */
    function decoderError(fatal, opt_code_point) {
      if (fatal)
        throw TypeError('Decoder error');
      return opt_code_point || 0xFFFD;
    }

    //
    // 7. API
    //

    /** @const */ var DEFAULT_ENCODING = 'utf-8';

    // 7.1 Interface TextDecoder

    /**
     * @constructor
     * @param {string=} encoding The label of the encoding;
     *     defaults to 'utf-8'.
     * @param {Object=} options
     */
    function TextDecoder$1(encoding, options) {
      if (!(this instanceof TextDecoder$1)) {
        return new TextDecoder$1(encoding, options);
      }
      encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;
      if (encoding !== DEFAULT_ENCODING) {
        throw new Error('Encoding not supported. Only utf-8 is supported');
      }
      options = ToDictionary(options);

      /** @private @type {boolean} */
      this._streaming = false;
      /** @private @type {boolean} */
      this._BOMseen = false;
      /** @private @type {?Decoder} */
      this._decoder = null;
      /** @private @type {boolean} */
      this._fatal = Boolean(options['fatal']);
      /** @private @type {boolean} */
      this._ignoreBOM = Boolean(options['ignoreBOM']);

      Object.defineProperty(this, 'encoding', {value: 'utf-8'});
      Object.defineProperty(this, 'fatal', {value: this._fatal});
      Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});
    }

    TextDecoder$1.prototype = {
      /**
       * @param {ArrayBufferView=} input The buffer of bytes to decode.
       * @param {Object=} options
       * @return {string} The decoded string.
       */
      decode: function decode(input, options) {
        var bytes;
        if (typeof input === 'object' && input instanceof ArrayBuffer) {
          bytes = new Uint8Array(input);
        } else if (typeof input === 'object' && 'buffer' in input &&
                   input.buffer instanceof ArrayBuffer) {
          bytes = new Uint8Array(input.buffer,
                                 input.byteOffset,
                                 input.byteLength);
        } else {
          bytes = new Uint8Array(0);
        }

        options = ToDictionary(options);

        if (!this._streaming) {
          this._decoder = new UTF8Decoder({fatal: this._fatal});
          this._BOMseen = false;
        }
        this._streaming = Boolean(options['stream']);

        var input_stream = new Stream(bytes);

        var code_points = [];

        /** @type {?(number|!Array.<number>)} */
        var result;

        while (!input_stream.endOfStream()) {
          result = this._decoder.handler(input_stream, input_stream.read());
          if (result === finished)
            break;
          if (result === null)
            continue;
          if (Array.isArray(result))
            code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));
          else
            code_points.push(result);
        }
        if (!this._streaming) {
          do {
            result = this._decoder.handler(input_stream, input_stream.read());
            if (result === finished)
              break;
            if (result === null)
              continue;
            if (Array.isArray(result))
              code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));
            else
              code_points.push(result);
          } while (!input_stream.endOfStream());
          this._decoder = null;
        }

        if (code_points.length) {
          // If encoding is one of utf-8, utf-16be, and utf-16le, and
          // ignore BOM flag and BOM seen flag are unset, run these
          // subsubsteps:
          if (['utf-8'].indexOf(this.encoding) !== -1 &&
              !this._ignoreBOM && !this._BOMseen) {
            // If token is U+FEFF, set BOM seen flag.
            if (code_points[0] === 0xFEFF) {
              this._BOMseen = true;
              code_points.shift();
            } else {
              // Otherwise, if token is not end-of-stream, set BOM seen
              // flag and append token to output.
              this._BOMseen = true;
            }
          }
        }

        return codePointsToString(code_points);
      }
    };

    // 7.2 Interface TextEncoder

    /**
     * @constructor
     * @param {string=} encoding The label of the encoding;
     *     defaults to 'utf-8'.
     * @param {Object=} options
     */
    function TextEncoder$1(encoding, options) {
      if (!(this instanceof TextEncoder$1))
        return new TextEncoder$1(encoding, options);
      encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;
      if (encoding !== DEFAULT_ENCODING) {
        throw new Error('Encoding not supported. Only utf-8 is supported');
      }
      options = ToDictionary(options);

      /** @private @type {boolean} */
      this._streaming = false;
      /** @private @type {?Encoder} */
      this._encoder = null;
      /** @private @type {{fatal: boolean}} */
      this._options = {fatal: Boolean(options['fatal'])};

      Object.defineProperty(this, 'encoding', {value: 'utf-8'});
    }

    TextEncoder$1.prototype = {
      /**
       * @param {string=} opt_string The string to encode.
       * @param {Object=} options
       * @return {Uint8Array} Encoded bytes, as a Uint8Array.
       */
      encode: function encode(opt_string, options) {
        opt_string = opt_string ? String(opt_string) : '';
        options = ToDictionary(options);

        // NOTE: This option is nonstandard. None of the encodings
        // permitted for encoding (i.e. UTF-8, UTF-16) are stateful,
        // so streaming is not necessary.
        if (!this._streaming)
          this._encoder = new UTF8Encoder(this._options);
        this._streaming = Boolean(options['stream']);

        var bytes = [];
        var input_stream = new Stream(stringToCodePoints(opt_string));
        /** @type {?(number|!Array.<number>)} */
        var result;
        while (!input_stream.endOfStream()) {
          result = this._encoder.handler(input_stream, input_stream.read());
          if (result === finished)
            break;
          if (Array.isArray(result))
            bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));
          else
            bytes.push(result);
        }
        if (!this._streaming) {
          while (true) {
            result = this._encoder.handler(input_stream, input_stream.read());
            if (result === finished)
              break;
            if (Array.isArray(result))
              bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));
            else
              bytes.push(result);
          }
          this._encoder = null;
        }
        return new Uint8Array(bytes);
      }
    };

    //
    // 8. The encoding
    //

    // 8.1 utf-8

    /**
     * @constructor
     * @implements {Decoder}
     * @param {{fatal: boolean}} options
     */
    function UTF8Decoder(options) {
      var fatal = options.fatal;

      // utf-8's decoder's has an associated utf-8 code point, utf-8
      // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8
      // lower boundary (initially 0x80), and a utf-8 upper boundary
      // (initially 0xBF).
      var /** @type {number} */ utf8_code_point = 0,
          /** @type {number} */ utf8_bytes_seen = 0,
          /** @type {number} */ utf8_bytes_needed = 0,
          /** @type {number} */ utf8_lower_boundary = 0x80,
          /** @type {number} */ utf8_upper_boundary = 0xBF;

      /**
       * @param {Stream} stream The stream of bytes being decoded.
       * @param {number} bite The next byte read from the stream.
       * @return {?(number|!Array.<number>)} The next code point(s)
       *     decoded, or null if not enough data exists in the input
       *     stream to decode a complete code point.
       */
      this.handler = function(stream, bite) {
        // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
        // set utf-8 bytes needed to 0 and return error.
        if (bite === end_of_stream && utf8_bytes_needed !== 0) {
          utf8_bytes_needed = 0;
          return decoderError(fatal);
        }

        // 2. If byte is end-of-stream, return finished.
        if (bite === end_of_stream)
          return finished;

        // 3. If utf-8 bytes needed is 0, based on byte:
        if (utf8_bytes_needed === 0) {

          // 0x00 to 0x7F
          if (inRange(bite, 0x00, 0x7F)) {
            // Return a code point whose value is byte.
            return bite;
          }

          // 0xC2 to 0xDF
          if (inRange(bite, 0xC2, 0xDF)) {
            // Set utf-8 bytes needed to 1 and utf-8 code point to byte
            // − 0xC0.
            utf8_bytes_needed = 1;
            utf8_code_point = bite - 0xC0;
          }

          // 0xE0 to 0xEF
          else if (inRange(bite, 0xE0, 0xEF)) {
            // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.
            if (bite === 0xE0)
              utf8_lower_boundary = 0xA0;
            // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.
            if (bite === 0xED)
              utf8_upper_boundary = 0x9F;
            // 3. Set utf-8 bytes needed to 2 and utf-8 code point to
            // byte − 0xE0.
            utf8_bytes_needed = 2;
            utf8_code_point = bite - 0xE0;
          }

          // 0xF0 to 0xF4
          else if (inRange(bite, 0xF0, 0xF4)) {
            // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.
            if (bite === 0xF0)
              utf8_lower_boundary = 0x90;
            // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.
            if (bite === 0xF4)
              utf8_upper_boundary = 0x8F;
            // 3. Set utf-8 bytes needed to 3 and utf-8 code point to
            // byte − 0xF0.
            utf8_bytes_needed = 3;
            utf8_code_point = bite - 0xF0;
          }

          // Otherwise
          else {
            // Return error.
            return decoderError(fatal);
          }

          // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code
          // point to utf-8 code point << (6 × utf-8 bytes needed) and
          // return continue.
          utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed);
          return null;
        }

        // 4. If byte is not in the range utf-8 lower boundary to utf-8
        // upper boundary, run these substeps:
        if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {

          // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8
          // bytes seen to 0, set utf-8 lower boundary to 0x80, and set
          // utf-8 upper boundary to 0xBF.
          utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
          utf8_lower_boundary = 0x80;
          utf8_upper_boundary = 0xBF;

          // 2. Prepend byte to stream.
          stream.prepend(bite);

          // 3. Return error.
          return decoderError(fatal);
        }

        // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary
        // to 0xBF.
        utf8_lower_boundary = 0x80;
        utf8_upper_boundary = 0xBF;

        // 6. Increase utf-8 bytes seen by one and set utf-8 code point
        // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes
        // needed − utf-8 bytes seen)).
        utf8_bytes_seen += 1;
        utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen));

        // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed,
        // continue.
        if (utf8_bytes_seen !== utf8_bytes_needed)
          return null;

        // 8. Let code point be utf-8 code point.
        var code_point = utf8_code_point;

        // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes
        // seen to 0.
        utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;

        // 10. Return a code point whose value is code point.
        return code_point;
      };
    }

    /**
     * @constructor
     * @implements {Encoder}
     * @param {{fatal: boolean}} options
     */
    function UTF8Encoder(options) {
      options.fatal;
      /**
       * @param {Stream} stream Input stream.
       * @param {number} code_point Next code point read from the stream.
       * @return {(number|!Array.<number>)} Byte(s) to emit.
       */
      this.handler = function(stream, code_point) {
        // 1. If code point is end-of-stream, return finished.
        if (code_point === end_of_stream)
          return finished;

        // 2. If code point is in the range U+0000 to U+007F, return a
        // byte whose value is code point.
        if (inRange(code_point, 0x0000, 0x007f))
          return code_point;

        // 3. Set count and offset based on the range code point is in:
        var count, offset;
        // U+0080 to U+07FF:    1 and 0xC0
        if (inRange(code_point, 0x0080, 0x07FF)) {
          count = 1;
          offset = 0xC0;
        }
        // U+0800 to U+FFFF:    2 and 0xE0
        else if (inRange(code_point, 0x0800, 0xFFFF)) {
          count = 2;
          offset = 0xE0;
        }
        // U+10000 to U+10FFFF: 3 and 0xF0
        else if (inRange(code_point, 0x10000, 0x10FFFF)) {
          count = 3;
          offset = 0xF0;
        }

        // 4.Let bytes be a byte sequence whose first byte is (code
        // point >> (6 × count)) + offset.
        var bytes = [(code_point >> (6 * count)) + offset];

        // 5. Run these substeps while count is greater than 0:
        while (count > 0) {

          // 1. Set temp to code point >> (6 × (count − 1)).
          var temp = code_point >> (6 * (count - 1));

          // 2. Append to bytes 0x80 | (temp & 0x3F).
          bytes.push(0x80 | (temp & 0x3F));

          // 3. Decrease count by one.
          count -= 1;
        }

        // 6. Return bytes bytes, in order.
        return bytes;
      };
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore @suppress {missingRequire} */
    const _Buffer$1 = typeof Buffer === 'function' ? Buffer : null;
    /** @ignore */
    const useNativeEncoders = typeof TextDecoder === 'function' && typeof TextEncoder === 'function';
    /** @ignore */
    const decodeUtf8 = ((TextDecoder) => {
        if (useNativeEncoders || !_Buffer$1) {
            const decoder = new TextDecoder('utf-8');
            return (buffer) => decoder.decode(buffer);
        }
        return (input) => {
            const { buffer, byteOffset, length } = toUint8Array(input);
            return _Buffer$1.from(buffer, byteOffset, length).toString();
        };
    })(typeof TextDecoder !== 'undefined' ? TextDecoder : TextDecoder$1);
    /** @ignore */
    const encodeUtf8 = ((TextEncoder) => {
        if (useNativeEncoders || !_Buffer$1) {
            const encoder = new TextEncoder();
            return (value) => encoder.encode(value);
        }
        return (input = '') => toUint8Array(_Buffer$1.from(input, 'utf8'));
    })(typeof TextEncoder !== 'undefined' ? TextEncoder : TextEncoder$1);

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    const ITERATOR_DONE = Object.freeze({ done: true, value: void (0) });
    /** @ignore */
    class ArrowJSON {
        // @ts-ignore
        constructor(_json) {
            this._json = _json;
        }
        get schema() { return this._json['schema']; }
        get batches() { return (this._json['batches'] || []); }
        get dictionaries() { return (this._json['dictionaries'] || []); }
    }
    /** @ignore */
    class ReadableInterop {
        tee() {
            return this._getDOMStream().tee();
        }
        pipe(writable, options) {
            return this._getNodeStream().pipe(writable, options);
        }
        pipeTo(writable, options) { return this._getDOMStream().pipeTo(writable, options); }
        pipeThrough(duplex, options) {
            return this._getDOMStream().pipeThrough(duplex, options);
        }
        _getDOMStream() {
            return this._DOMStream || (this._DOMStream = this.toDOMStream());
        }
        _getNodeStream() {
            return this._nodeStream || (this._nodeStream = this.toNodeStream());
        }
    }
    /** @ignore */
    class AsyncQueue extends ReadableInterop {
        constructor() {
            super();
            this._values = [];
            this.resolvers = [];
            this._closedPromise = new Promise((r) => this._closedPromiseResolve = r);
        }
        get closed() { return this._closedPromise; }
        async cancel(reason) { await this.return(reason); }
        write(value) {
            if (this._ensureOpen()) {
                this.resolvers.length <= 0
                    ? (this._values.push(value))
                    : (this.resolvers.shift().resolve({ done: false, value }));
            }
        }
        abort(value) {
            if (this._closedPromiseResolve) {
                this.resolvers.length <= 0
                    ? (this._error = { error: value })
                    : (this.resolvers.shift().reject({ done: true, value }));
            }
        }
        close() {
            if (this._closedPromiseResolve) {
                const { resolvers } = this;
                while (resolvers.length > 0) {
                    resolvers.shift().resolve(ITERATOR_DONE);
                }
                this._closedPromiseResolve();
                this._closedPromiseResolve = undefined;
            }
        }
        [Symbol.asyncIterator]() { return this; }
        toDOMStream(options) {
            return streamAdapters.toDOMStream((this._closedPromiseResolve || this._error)
                ? this
                : this._values, options);
        }
        toNodeStream(options) {
            return streamAdapters.toNodeStream((this._closedPromiseResolve || this._error)
                ? this
                : this._values, options);
        }
        async throw(_) { await this.abort(_); return ITERATOR_DONE; }
        async return(_) { await this.close(); return ITERATOR_DONE; }
        async read(size) { return (await this.next(size, 'read')).value; }
        async peek(size) { return (await this.next(size, 'peek')).value; }
        next(..._args) {
            if (this._values.length > 0) {
                return Promise.resolve({ done: false, value: this._values.shift() });
            }
            else if (this._error) {
                return Promise.reject({ done: true, value: this._error.error });
            }
            else if (!this._closedPromiseResolve) {
                return Promise.resolve(ITERATOR_DONE);
            }
            else {
                return new Promise((resolve, reject) => {
                    this.resolvers.push({ resolve, reject });
                });
            }
        }
        _ensureOpen() {
            if (this._closedPromiseResolve) {
                return true;
            }
            throw new Error(`${this} is closed`);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    const [BigIntCtor, BigIntAvailable] = (() => {
        const BigIntUnavailableError = () => { throw new Error('BigInt is not available in this environment'); };
        function BigIntUnavailable() { throw BigIntUnavailableError(); }
        BigIntUnavailable.asIntN = () => { throw BigIntUnavailableError(); };
        BigIntUnavailable.asUintN = () => { throw BigIntUnavailableError(); };
        return typeof BigInt !== 'undefined' ? [BigInt, true] : [BigIntUnavailable, false];
    })();
    /** @ignore */
    const [BigInt64ArrayCtor, BigInt64ArrayAvailable] = (() => {
        const BigInt64ArrayUnavailableError = () => { throw new Error('BigInt64Array is not available in this environment'); };
        class BigInt64ArrayUnavailable {
            static get BYTES_PER_ELEMENT() { return 8; }
            static of() { throw BigInt64ArrayUnavailableError(); }
            static from() { throw BigInt64ArrayUnavailableError(); }
            constructor() { throw BigInt64ArrayUnavailableError(); }
        }
        return typeof BigInt64Array !== 'undefined' ? [BigInt64Array, true] : [BigInt64ArrayUnavailable, false];
    })();
    /** @ignore */
    const [BigUint64ArrayCtor, BigUint64ArrayAvailable] = (() => {
        const BigUint64ArrayUnavailableError = () => { throw new Error('BigUint64Array is not available in this environment'); };
        class BigUint64ArrayUnavailable {
            static get BYTES_PER_ELEMENT() { return 8; }
            static of() { throw BigUint64ArrayUnavailableError(); }
            static from() { throw BigUint64ArrayUnavailableError(); }
            constructor() { throw BigUint64ArrayUnavailableError(); }
        }
        return typeof BigUint64Array !== 'undefined' ? [BigUint64Array, true] : [BigUint64ArrayUnavailable, false];
    })();
    /** @ignore */ const isNumber = (x) => typeof x === 'number';
    /** @ignore */ const isBoolean = (x) => typeof x === 'boolean';
    /** @ignore */ const isFunction = (x) => typeof x === 'function';
    /** @ignore */
    const isObject = (x) => x != null && Object(x) === x;
    /** @ignore */
    const isPromise = (x) => {
        return isObject(x) && isFunction(x.then);
    };
    /** @ignore */
    const isIterable = (x) => {
        return isObject(x) && isFunction(x[Symbol.iterator]);
    };
    /** @ignore */
    const isAsyncIterable = (x) => {
        return isObject(x) && isFunction(x[Symbol.asyncIterator]);
    };
    /** @ignore */
    const isArrowJSON = (x) => {
        return isObject(x) && isObject(x['schema']);
    };
    /** @ignore */
    const isIteratorResult = (x) => {
        return isObject(x) && ('done' in x) && ('value' in x);
    };
    /** @ignore */
    const isFileHandle = (x) => {
        return isObject(x) && isFunction(x['stat']) && isNumber(x['fd']);
    };
    /** @ignore */
    const isFetchResponse = (x) => {
        return isObject(x) && isReadableDOMStream(x['body']);
    };
    /** @ignore */
    const isWritableDOMStream = (x) => {
        return isObject(x) &&
            isFunction(x['abort']) &&
            isFunction(x['getWriter']) &&
            !(x instanceof ReadableInterop);
    };
    /** @ignore */
    const isReadableDOMStream = (x) => {
        return isObject(x) &&
            isFunction(x['cancel']) &&
            isFunction(x['getReader']) &&
            !(x instanceof ReadableInterop);
    };
    /** @ignore */
    const isWritableNodeStream = (x) => {
        return isObject(x) &&
            isFunction(x['end']) &&
            isFunction(x['write']) &&
            isBoolean(x['writable']) &&
            !(x instanceof ReadableInterop);
    };
    /** @ignore */
    const isReadableNodeStream = (x) => {
        return isObject(x) &&
            isFunction(x['read']) &&
            isFunction(x['pipe']) &&
            isBoolean(x['readable']) &&
            !(x instanceof ReadableInterop);
    };

    // Licensed to the Apache Software Foundation (ASF) under one
    var ByteBuffer$3 = flatbuffers.ByteBuffer;
    /** @ignore */
    const SharedArrayBuf = (typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : ArrayBuffer);
    /** @ignore */
    function collapseContiguousByteRanges(chunks) {
        let result = chunks[0] ? [chunks[0]] : [];
        let xOffset, yOffset, xLen, yLen;
        for (let x, y, i = 0, j = 0, n = chunks.length; ++i < n;) {
            x = result[j];
            y = chunks[i];
            // continue if x and y don't share the same underlying ArrayBuffer, or if x isn't before y
            if (!x || !y || x.buffer !== y.buffer || y.byteOffset < x.byteOffset) {
                y && (result[++j] = y);
                continue;
            }
            ({ byteOffset: xOffset, byteLength: xLen } = x);
            ({ byteOffset: yOffset, byteLength: yLen } = y);
            // continue if the byte ranges of x and y aren't contiguous
            if ((xOffset + xLen) < yOffset || (yOffset + yLen) < xOffset) {
                y && (result[++j] = y);
                continue;
            }
            result[j] = new Uint8Array(x.buffer, xOffset, yOffset - xOffset + yLen);
        }
        return result;
    }
    /** @ignore */
    function memcpy(target, source, targetByteOffset = 0, sourceByteLength = source.byteLength) {
        const targetByteLength = target.byteLength;
        const dst = new Uint8Array(target.buffer, target.byteOffset, targetByteLength);
        const src = new Uint8Array(source.buffer, source.byteOffset, Math.min(sourceByteLength, targetByteLength));
        dst.set(src, targetByteOffset);
        return target;
    }
    /** @ignore */
    function joinUint8Arrays(chunks, size) {
        // collapse chunks that share the same underlying ArrayBuffer and whose byte ranges overlap,
        // to avoid unnecessarily copying the bytes to do this buffer join. This is a common case during
        // streaming, where we may be reading partial byte ranges out of the same underlying ArrayBuffer
        let result = collapseContiguousByteRanges(chunks);
        let byteLength = result.reduce((x, b) => x + b.byteLength, 0);
        let source, sliced, buffer;
        let offset = 0, index = -1, length = Math.min(size || Infinity, byteLength);
        for (let n = result.length; ++index < n;) {
            source = result[index];
            sliced = source.subarray(0, Math.min(source.length, length - offset));
            if (length <= (offset + sliced.length)) {
                if (sliced.length < source.length) {
                    result[index] = source.subarray(sliced.length);
                }
                else if (sliced.length === source.length) {
                    index++;
                }
                buffer ? memcpy(buffer, sliced, offset) : (buffer = sliced);
                break;
            }
            memcpy(buffer || (buffer = new Uint8Array(length)), sliced, offset);
            offset += sliced.length;
        }
        return [buffer || new Uint8Array(0), result.slice(index), byteLength - (buffer ? buffer.byteLength : 0)];
    }
    function toArrayBufferView(ArrayBufferViewCtor, input) {
        let value = isIteratorResult(input) ? input.value : input;
        if (value instanceof ArrayBufferViewCtor) {
            if (ArrayBufferViewCtor === Uint8Array) {
                // Node's `Buffer` class passes the `instanceof Uint8Array` check, but we need
                // a real Uint8Array, since Buffer#slice isn't the same as Uint8Array#slice :/
                return new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength);
            }
            return value;
        }
        if (!value) {
            return new ArrayBufferViewCtor(0);
        }
        if (typeof value === 'string') {
            value = encodeUtf8(value);
        }
        if (value instanceof ArrayBuffer) {
            return new ArrayBufferViewCtor(value);
        }
        if (value instanceof SharedArrayBuf) {
            return new ArrayBufferViewCtor(value);
        }
        if (value instanceof ByteBuffer$3) {
            return toArrayBufferView(ArrayBufferViewCtor, value.bytes());
        }
        return !ArrayBuffer.isView(value) ? ArrayBufferViewCtor.from(value) : value.byteLength <= 0 ? new ArrayBufferViewCtor(0)
            : new ArrayBufferViewCtor(value.buffer, value.byteOffset, value.byteLength / ArrayBufferViewCtor.BYTES_PER_ELEMENT);
    }
    /** @ignore */ const toInt8Array = (input) => toArrayBufferView(Int8Array, input);
    /** @ignore */ const toInt16Array = (input) => toArrayBufferView(Int16Array, input);
    /** @ignore */ const toInt32Array = (input) => toArrayBufferView(Int32Array, input);
    /** @ignore */ const toBigInt64Array = (input) => toArrayBufferView(BigInt64ArrayCtor, input);
    /** @ignore */ const toUint8Array = (input) => toArrayBufferView(Uint8Array, input);
    /** @ignore */ const toUint16Array = (input) => toArrayBufferView(Uint16Array, input);
    /** @ignore */ const toUint32Array = (input) => toArrayBufferView(Uint32Array, input);
    /** @ignore */ const toBigUint64Array = (input) => toArrayBufferView(BigUint64ArrayCtor, input);
    /** @ignore */ const toFloat32Array = (input) => toArrayBufferView(Float32Array, input);
    /** @ignore */ const toFloat64Array = (input) => toArrayBufferView(Float64Array, input);
    /** @ignore */ const toUint8ClampedArray = (input) => toArrayBufferView(Uint8ClampedArray, input);
    /** @ignore */
    const pump$1 = (iterator) => { iterator.next(); return iterator; };
    /** @ignore */
    function* toArrayBufferViewIterator(ArrayCtor, source) {
        const wrap = function* (x) { yield x; };
        const buffers = (typeof source === 'string') ? wrap(source)
            : (ArrayBuffer.isView(source)) ? wrap(source)
                : (source instanceof ArrayBuffer) ? wrap(source)
                    : (source instanceof SharedArrayBuf) ? wrap(source)
                        : !isIterable(source) ? wrap(source) : source;
        yield* pump$1((function* (it) {
            let r = null;
            do {
                r = it.next(yield toArrayBufferView(ArrayCtor, r));
            } while (!r.done);
        })(buffers[Symbol.iterator]()));
        return new ArrayCtor();
    }
    /** @ignore */ const toInt8ArrayIterator = (input) => toArrayBufferViewIterator(Int8Array, input);
    /** @ignore */ const toInt16ArrayIterator = (input) => toArrayBufferViewIterator(Int16Array, input);
    /** @ignore */ const toInt32ArrayIterator = (input) => toArrayBufferViewIterator(Int32Array, input);
    /** @ignore */ const toUint8ArrayIterator = (input) => toArrayBufferViewIterator(Uint8Array, input);
    /** @ignore */ const toUint16ArrayIterator = (input) => toArrayBufferViewIterator(Uint16Array, input);
    /** @ignore */ const toUint32ArrayIterator = (input) => toArrayBufferViewIterator(Uint32Array, input);
    /** @ignore */ const toFloat32ArrayIterator = (input) => toArrayBufferViewIterator(Float32Array, input);
    /** @ignore */ const toFloat64ArrayIterator = (input) => toArrayBufferViewIterator(Float64Array, input);
    /** @ignore */ const toUint8ClampedArrayIterator = (input) => toArrayBufferViewIterator(Uint8ClampedArray, input);
    /** @ignore */
    async function* toArrayBufferViewAsyncIterator(ArrayCtor, source) {
        // if a Promise, unwrap the Promise and iterate the resolved value
        if (isPromise(source)) {
            return yield* toArrayBufferViewAsyncIterator(ArrayCtor, await source);
        }
        const wrap = async function* (x) { yield await x; };
        const emit = async function* (source) {
            yield* pump$1((function* (it) {
                let r = null;
                do {
                    r = it.next(yield r && r.value);
                } while (!r.done);
            })(source[Symbol.iterator]()));
        };
        const buffers = (typeof source === 'string') ? wrap(source) // if string, wrap in an AsyncIterableIterator
            : (ArrayBuffer.isView(source)) ? wrap(source) // if TypedArray, wrap in an AsyncIterableIterator
                : (source instanceof ArrayBuffer) ? wrap(source) // if ArrayBuffer, wrap in an AsyncIterableIterator
                    : (source instanceof SharedArrayBuf) ? wrap(source) // if SharedArrayBuffer, wrap in an AsyncIterableIterator
                        : isIterable(source) ? emit(source) // If Iterable, wrap in an AsyncIterableIterator and compose the `next` values
                            : !isAsyncIterable(source) ? wrap(source) // If not an AsyncIterable, treat as a sentinel and wrap in an AsyncIterableIterator
                                : source; // otherwise if AsyncIterable, use it
        yield* pump$1((async function* (it) {
            let r = null;
            do {
                r = await it.next(yield toArrayBufferView(ArrayCtor, r));
            } while (!r.done);
        })(buffers[Symbol.asyncIterator]()));
        return new ArrayCtor();
    }
    /** @ignore */ const toInt8ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Int8Array, input);
    /** @ignore */ const toInt16ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Int16Array, input);
    /** @ignore */ const toInt32ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Int32Array, input);
    /** @ignore */ const toUint8ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Uint8Array, input);
    /** @ignore */ const toUint16ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Uint16Array, input);
    /** @ignore */ const toUint32ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Uint32Array, input);
    /** @ignore */ const toFloat32ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Float32Array, input);
    /** @ignore */ const toFloat64ArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Float64Array, input);
    /** @ignore */ const toUint8ClampedArrayAsyncIterator = (input) => toArrayBufferViewAsyncIterator(Uint8ClampedArray, input);
    /** @ignore */
    function rebaseValueOffsets(offset, length, valueOffsets) {
        // If we have a non-zero offset, create a new offsets array with the values
        // shifted by the start offset, such that the new start offset is 0
        if (offset !== 0) {
            valueOffsets = valueOffsets.slice(0, length + 1);
            for (let i = -1; ++i <= length;) {
                valueOffsets[i] += offset;
            }
        }
        return valueOffsets;
    }
    /** @ignore */
    function compareArrayLike(a, b) {
        let i = 0, n = a.length;
        if (n !== b.length) {
            return false;
        }
        if (n > 0) {
            do {
                if (a[i] !== b[i]) {
                    return false;
                }
            } while (++i < n);
        }
        return true;
    }

    var util_buffer_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        memcpy: memcpy,
        joinUint8Arrays: joinUint8Arrays,
        toArrayBufferView: toArrayBufferView,
        toInt8Array: toInt8Array,
        toInt16Array: toInt16Array,
        toInt32Array: toInt32Array,
        toBigInt64Array: toBigInt64Array,
        toUint8Array: toUint8Array,
        toUint16Array: toUint16Array,
        toUint32Array: toUint32Array,
        toBigUint64Array: toBigUint64Array,
        toFloat32Array: toFloat32Array,
        toFloat64Array: toFloat64Array,
        toUint8ClampedArray: toUint8ClampedArray,
        toArrayBufferViewIterator: toArrayBufferViewIterator,
        toInt8ArrayIterator: toInt8ArrayIterator,
        toInt16ArrayIterator: toInt16ArrayIterator,
        toInt32ArrayIterator: toInt32ArrayIterator,
        toUint8ArrayIterator: toUint8ArrayIterator,
        toUint16ArrayIterator: toUint16ArrayIterator,
        toUint32ArrayIterator: toUint32ArrayIterator,
        toFloat32ArrayIterator: toFloat32ArrayIterator,
        toFloat64ArrayIterator: toFloat64ArrayIterator,
        toUint8ClampedArrayIterator: toUint8ClampedArrayIterator,
        toArrayBufferViewAsyncIterator: toArrayBufferViewAsyncIterator,
        toInt8ArrayAsyncIterator: toInt8ArrayAsyncIterator,
        toInt16ArrayAsyncIterator: toInt16ArrayAsyncIterator,
        toInt32ArrayAsyncIterator: toInt32ArrayAsyncIterator,
        toUint8ArrayAsyncIterator: toUint8ArrayAsyncIterator,
        toUint16ArrayAsyncIterator: toUint16ArrayAsyncIterator,
        toUint32ArrayAsyncIterator: toUint32ArrayAsyncIterator,
        toFloat32ArrayAsyncIterator: toFloat32ArrayAsyncIterator,
        toFloat64ArrayAsyncIterator: toFloat64ArrayAsyncIterator,
        toUint8ClampedArrayAsyncIterator: toUint8ClampedArrayAsyncIterator,
        rebaseValueOffsets: rebaseValueOffsets,
        compareArrayLike: compareArrayLike
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    var streamAdapters = {
        fromIterable(source) {
            return pump(fromIterable(source));
        },
        fromAsyncIterable(source) {
            return pump(fromAsyncIterable(source));
        },
        fromDOMStream(source) {
            return pump(fromDOMStream(source));
        },
        fromNodeStream(stream) {
            return pump(fromNodeStream(stream));
        },
        // @ts-ignore
        toDOMStream(source, options) {
            throw new Error(`"toDOMStream" not available in this environment`);
        },
        // @ts-ignore
        toNodeStream(source, options) {
            throw new Error(`"toNodeStream" not available in this environment`);
        },
    };
    /** @ignore */
    const pump = (iterator) => { iterator.next(); return iterator; };
    /** @ignore */
    function* fromIterable(source) {
        let done, threw = false;
        let buffers = [], buffer;
        let cmd, size, bufferLength = 0;
        function byteRange() {
            if (cmd === 'peek') {
                return joinUint8Arrays(buffers, size)[0];
            }
            [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
            return buffer;
        }
        // Yield so the caller can inject the read command before creating the source Iterator
        ({ cmd, size } = yield null);
        // initialize the iterator
        let it = toUint8ArrayIterator(source)[Symbol.iterator]();
        try {
            do {
                // read the next value
                ({ done, value: buffer } = isNaN(size - bufferLength) ?
                    it.next(undefined) : it.next(size - bufferLength));
                // if chunk is not null or empty, push it onto the queue
                if (!done && buffer.byteLength > 0) {
                    buffers.push(buffer);
                    bufferLength += buffer.byteLength;
                }
                // If we have enough bytes in our buffer, yield chunks until we don't
                if (done || size <= bufferLength) {
                    do {
                        ({ cmd, size } = yield byteRange());
                    } while (size < bufferLength);
                }
            } while (!done);
        }
        catch (e) {
            (threw = true) && (typeof it.throw === 'function') && (it.throw(e));
        }
        finally {
            (threw === false) && (typeof it.return === 'function') && (it.return(null));
        }
        return null;
    }
    /** @ignore */
    async function* fromAsyncIterable(source) {
        let done, threw = false;
        let buffers = [], buffer;
        let cmd, size, bufferLength = 0;
        function byteRange() {
            if (cmd === 'peek') {
                return joinUint8Arrays(buffers, size)[0];
            }
            [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
            return buffer;
        }
        // Yield so the caller can inject the read command before creating the source AsyncIterator
        ({ cmd, size } = (yield null));
        // initialize the iterator
        let it = toUint8ArrayAsyncIterator(source)[Symbol.asyncIterator]();
        try {
            do {
                // read the next value
                ({ done, value: buffer } = isNaN(size - bufferLength)
                    ? await it.next(undefined)
                    : await it.next(size - bufferLength));
                // if chunk is not null or empty, push it onto the queue
                if (!done && buffer.byteLength > 0) {
                    buffers.push(buffer);
                    bufferLength += buffer.byteLength;
                }
                // If we have enough bytes in our buffer, yield chunks until we don't
                if (done || size <= bufferLength) {
                    do {
                        ({ cmd, size } = yield byteRange());
                    } while (size < bufferLength);
                }
            } while (!done);
        }
        catch (e) {
            (threw = true) && (typeof it.throw === 'function') && (await it.throw(e));
        }
        finally {
            (threw === false) && (typeof it.return === 'function') && (await it.return(new Uint8Array(0)));
        }
        return null;
    }
    // All this manual Uint8Array chunk management can be avoided if/when engines
    // add support for ArrayBuffer.transfer() or ArrayBuffer.prototype.realloc():
    // https://github.com/domenic/proposal-arraybuffer-transfer
    /** @ignore */
    async function* fromDOMStream(source) {
        let done = false, threw = false;
        let buffers = [], buffer;
        let cmd, size, bufferLength = 0;
        function byteRange() {
            if (cmd === 'peek') {
                return joinUint8Arrays(buffers, size)[0];
            }
            [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
            return buffer;
        }
        // Yield so the caller can inject the read command before we establish the ReadableStream lock
        ({ cmd, size } = yield null);
        // initialize the reader and lock the stream
        let it = new AdaptiveByteReader(source);
        try {
            do {
                // read the next value
                ({ done, value: buffer } = isNaN(size - bufferLength)
                    ? await it['read'](undefined)
                    : await it['read'](size - bufferLength));
                // if chunk is not null or empty, push it onto the queue
                if (!done && buffer.byteLength > 0) {
                    buffers.push(toUint8Array(buffer));
                    bufferLength += buffer.byteLength;
                }
                // If we have enough bytes in our buffer, yield chunks until we don't
                if (done || size <= bufferLength) {
                    do {
                        ({ cmd, size } = yield byteRange());
                    } while (size < bufferLength);
                }
            } while (!done);
        }
        catch (e) {
            (threw = true) && (await it['cancel'](e));
        }
        finally {
            (threw === false) ? (await it['cancel']())
                : source['locked'] && it.releaseLock();
        }
        return null;
    }
    /** @ignore */
    class AdaptiveByteReader {
        constructor(source) {
            this.source = source;
            this.byobReader = null;
            this.defaultReader = null;
            try {
                this.supportsBYOB = !!(this.reader = this.getBYOBReader());
            }
            catch (e) {
                this.supportsBYOB = !!!(this.reader = this.getDefaultReader());
            }
        }
        get closed() {
            return this.reader ? this.reader['closed'].catch(() => { }) : Promise.resolve();
        }
        releaseLock() {
            if (this.reader) {
                this.reader.releaseLock();
            }
            this.reader = this.byobReader = this.defaultReader = null;
        }
        async cancel(reason) {
            const { reader, source } = this;
            reader && (await reader['cancel'](reason).catch(() => { }));
            source && (source['locked'] && this.releaseLock());
        }
        async read(size) {
            if (size === 0) {
                return { done: this.reader == null, value: new Uint8Array(0) };
            }
            const result = !this.supportsBYOB || typeof size !== 'number'
                ? await this.getDefaultReader().read()
                : await this.readFromBYOBReader(size);
            !result.done && (result.value = toUint8Array(result));
            return result;
        }
        getDefaultReader() {
            if (this.byobReader) {
                this.releaseLock();
            }
            if (!this.defaultReader) {
                this.defaultReader = this.source['getReader']();
                // We have to catch and swallow errors here to avoid uncaught promise rejection exceptions
                // that seem to be raised when we call `releaseLock()` on this reader. I'm still mystified
                // about why these errors are raised, but I'm sure there's some important spec reason that
                // I haven't considered. I hate to employ such an anti-pattern here, but it seems like the
                // only solution in this case :/
                this.defaultReader['closed'].catch(() => { });
            }
            return (this.reader = this.defaultReader);
        }
        getBYOBReader() {
            if (this.defaultReader) {
                this.releaseLock();
            }
            if (!this.byobReader) {
                this.byobReader = this.source['getReader']({ mode: 'byob' });
                // We have to catch and swallow errors here to avoid uncaught promise rejection exceptions
                // that seem to be raised when we call `releaseLock()` on this reader. I'm still mystified
                // about why these errors are raised, but I'm sure there's some important spec reason that
                // I haven't considered. I hate to employ such an anti-pattern here, but it seems like the
                // only solution in this case :/
                this.byobReader['closed'].catch(() => { });
            }
            return (this.reader = this.byobReader);
        }
        // This strategy plucked from the example in the streams spec:
        // https://streams.spec.whatwg.org/#example-manual-read-bytes
        async readFromBYOBReader(size) {
            return await readInto(this.getBYOBReader(), new ArrayBuffer(size), 0, size);
        }
    }
    /** @ignore */
    async function readInto(reader, buffer, offset, size) {
        if (offset >= size) {
            return { done: false, value: new Uint8Array(buffer, 0, size) };
        }
        const { done, value } = await reader.read(new Uint8Array(buffer, offset, size - offset));
        if (((offset += value.byteLength) < size) && !done) {
            return await readInto(reader, value.buffer, offset, size);
        }
        return { done, value: new Uint8Array(value.buffer, 0, offset) };
    }
    /** @ignore */
    const onEvent = (stream, event) => {
        let handler = (_) => resolve([event, _]);
        let resolve;
        return [event, handler, new Promise((r) => (resolve = r) && stream['once'](event, handler))];
    };
    /** @ignore */
    async function* fromNodeStream(stream) {
        let events = [];
        let event = 'error';
        let done = false, err = null;
        let cmd, size, bufferLength = 0;
        let buffers = [], buffer;
        function byteRange() {
            if (cmd === 'peek') {
                return joinUint8Arrays(buffers, size)[0];
            }
            [buffer, buffers, bufferLength] = joinUint8Arrays(buffers, size);
            return buffer;
        }
        // Yield so the caller can inject the read command before we
        // add the listener for the source stream's 'readable' event.
        ({ cmd, size } = yield null);
        // ignore stdin if it's a TTY
        if (stream['isTTY']) {
            yield new Uint8Array(0);
            return null;
        }
        try {
            // initialize the stream event handlers
            events[0] = onEvent(stream, 'end');
            events[1] = onEvent(stream, 'error');
            do {
                events[2] = onEvent(stream, 'readable');
                // wait on the first message event from the stream
                [event, err] = await Promise.race(events.map((x) => x[2]));
                // if the stream emitted an Error, rethrow it
                if (event === 'error') {
                    break;
                }
                if (!(done = event === 'end')) {
                    // If the size is NaN, request to read everything in the stream's internal buffer
                    if (!isFinite(size - bufferLength)) {
                        buffer = toUint8Array(stream['read'](undefined));
                    }
                    else {
                        buffer = toUint8Array(stream['read'](size - bufferLength));
                        // If the byteLength is 0, then the requested amount is more than the stream has
                        // in its internal buffer. In this case the stream needs a "kick" to tell it to
                        // continue emitting readable events, so request to read everything the stream
                        // has in its internal buffer right now.
                        if (buffer.byteLength < (size - bufferLength)) {
                            buffer = toUint8Array(stream['read'](undefined));
                        }
                    }
                    // if chunk is not null or empty, push it onto the queue
                    if (buffer.byteLength > 0) {
                        buffers.push(buffer);
                        bufferLength += buffer.byteLength;
                    }
                }
                // If we have enough bytes in our buffer, yield chunks until we don't
                if (done || size <= bufferLength) {
                    do {
                        ({ cmd, size } = yield byteRange());
                    } while (size < bufferLength);
                }
            } while (!done);
        }
        finally {
            await cleanup(events, event === 'error' ? err : null);
        }
        return null;
        function cleanup(events, err) {
            buffer = buffers = null;
            return new Promise(async (resolve, reject) => {
                for (const [evt, fn] of events) {
                    stream['off'](evt, fn);
                }
                try {
                    // Some stream implementations don't call the destroy callback,
                    // because it's really a node-internal API. Just calling `destroy`
                    // here should be enough to conform to the ReadableStream contract
                    const destroy = stream['destroy'];
                    destroy && destroy.call(stream, err);
                    err = undefined;
                }
                catch (e) {
                    err = e || err;
                }
                finally {
                    err != null ? reject(err) : resolve();
                }
            });
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    class AbstractVector {
    }
    AbstractVector.prototype.data = null;

    /* tslint:disable:class-name */
    /**
     * @enum {number}
     */
    var org$2;
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (MetadataVersion) {
                        /**
                         * 0.1.0
                         */
                        MetadataVersion[MetadataVersion["V1"] = 0] = "V1";
                        /**
                         * 0.2.0
                         */
                        MetadataVersion[MetadataVersion["V2"] = 1] = "V2";
                        /**
                         * 0.3.0 -> 0.7.1
                         */
                        MetadataVersion[MetadataVersion["V3"] = 2] = "V3";
                        /**
                         * >= 0.8.0
                         */
                        MetadataVersion[MetadataVersion["V4"] = 3] = "V4";
                    })(flatbuf.MetadataVersion || (flatbuf.MetadataVersion = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (UnionMode) {
                        UnionMode[UnionMode["Sparse"] = 0] = "Sparse";
                        UnionMode[UnionMode["Dense"] = 1] = "Dense";
                    })(flatbuf.UnionMode || (flatbuf.UnionMode = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (Precision) {
                        Precision[Precision["HALF"] = 0] = "HALF";
                        Precision[Precision["SINGLE"] = 1] = "SINGLE";
                        Precision[Precision["DOUBLE"] = 2] = "DOUBLE";
                    })(flatbuf.Precision || (flatbuf.Precision = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (DateUnit) {
                        DateUnit[DateUnit["DAY"] = 0] = "DAY";
                        DateUnit[DateUnit["MILLISECOND"] = 1] = "MILLISECOND";
                    })(flatbuf.DateUnit || (flatbuf.DateUnit = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (TimeUnit) {
                        TimeUnit[TimeUnit["SECOND"] = 0] = "SECOND";
                        TimeUnit[TimeUnit["MILLISECOND"] = 1] = "MILLISECOND";
                        TimeUnit[TimeUnit["MICROSECOND"] = 2] = "MICROSECOND";
                        TimeUnit[TimeUnit["NANOSECOND"] = 3] = "NANOSECOND";
                    })(flatbuf.TimeUnit || (flatbuf.TimeUnit = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (IntervalUnit) {
                        IntervalUnit[IntervalUnit["YEAR_MONTH"] = 0] = "YEAR_MONTH";
                        IntervalUnit[IntervalUnit["DAY_TIME"] = 1] = "DAY_TIME";
                    })(flatbuf.IntervalUnit || (flatbuf.IntervalUnit = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * Top-level Type value, enabling extensible type-specific metadata. We can
     * add new logical types to Type without breaking backwards compatibility
     *
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (Type) {
                        Type[Type["NONE"] = 0] = "NONE";
                        Type[Type["Null"] = 1] = "Null";
                        Type[Type["Int"] = 2] = "Int";
                        Type[Type["FloatingPoint"] = 3] = "FloatingPoint";
                        Type[Type["Binary"] = 4] = "Binary";
                        Type[Type["Utf8"] = 5] = "Utf8";
                        Type[Type["Bool"] = 6] = "Bool";
                        Type[Type["Decimal"] = 7] = "Decimal";
                        Type[Type["Date"] = 8] = "Date";
                        Type[Type["Time"] = 9] = "Time";
                        Type[Type["Timestamp"] = 10] = "Timestamp";
                        Type[Type["Interval"] = 11] = "Interval";
                        Type[Type["List"] = 12] = "List";
                        Type[Type["Struct_"] = 13] = "Struct_";
                        Type[Type["Union"] = 14] = "Union";
                        Type[Type["FixedSizeBinary"] = 15] = "FixedSizeBinary";
                        Type[Type["FixedSizeList"] = 16] = "FixedSizeList";
                        Type[Type["Map"] = 17] = "Map";
                        Type[Type["Duration"] = 18] = "Duration";
                        Type[Type["LargeBinary"] = 19] = "LargeBinary";
                        Type[Type["LargeUtf8"] = 20] = "LargeUtf8";
                        Type[Type["LargeList"] = 21] = "LargeList";
                    })(flatbuf.Type || (flatbuf.Type = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * Endianness of the platform producing the data
     *
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (Endianness) {
                        Endianness[Endianness["Little"] = 0] = "Little";
                        Endianness[Endianness["Big"] = 1] = "Big";
                    })(flatbuf.Endianness || (flatbuf.Endianness = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * These are stored in the flatbuffer in the Type union below
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Null {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Null
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Null= obj
                         * @returns Null
                         */
                        static getRootAsNull(bb, obj) {
                            return (obj || new Null).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startNull(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endNull(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createNull(builder) {
                            Null.startNull(builder);
                            return Null.endNull(builder);
                        }
                    }
                    flatbuf.Null = Null;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * A Struct_ in the flatbuffer metadata is the same as an Arrow Struct
     * (according to the physical memory layout). We used Struct_ here as
     * Struct is a reserved word in Flatbuffers
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Struct_ {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Struct_
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Struct_= obj
                         * @returns Struct_
                         */
                        static getRootAsStruct_(bb, obj) {
                            return (obj || new Struct_).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startStruct_(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endStruct_(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createStruct_(builder) {
                            Struct_.startStruct_(builder);
                            return Struct_.endStruct_(builder);
                        }
                    }
                    flatbuf.Struct_ = Struct_;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class List {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns List
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param List= obj
                         * @returns List
                         */
                        static getRootAsList(bb, obj) {
                            return (obj || new List).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startList(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endList(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createList(builder) {
                            List.startList(builder);
                            return List.endList(builder);
                        }
                    }
                    flatbuf.List = List;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Same as List, but with 64-bit offsets, allowing to represent
     * extremely large data values.
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class LargeList {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns LargeList
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param LargeList= obj
                         * @returns LargeList
                         */
                        static getRootAsLargeList(bb, obj) {
                            return (obj || new LargeList).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startLargeList(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endLargeList(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createLargeList(builder) {
                            LargeList.startLargeList(builder);
                            return LargeList.endLargeList(builder);
                        }
                    }
                    flatbuf.LargeList = LargeList;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class FixedSizeList {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns FixedSizeList
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param FixedSizeList= obj
                         * @returns FixedSizeList
                         */
                        static getRootAsFixedSizeList(bb, obj) {
                            return (obj || new FixedSizeList).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * Number of list items per value
                         *
                         * @returns number
                         */
                        listSize() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startFixedSizeList(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number listSize
                         */
                        static addListSize(builder, listSize) {
                            builder.addFieldInt32(0, listSize, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endFixedSizeList(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createFixedSizeList(builder, listSize) {
                            FixedSizeList.startFixedSizeList(builder);
                            FixedSizeList.addListSize(builder, listSize);
                            return FixedSizeList.endFixedSizeList(builder);
                        }
                    }
                    flatbuf.FixedSizeList = FixedSizeList;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * A Map is a logical nested type that is represented as
     *
     * List<entry: Struct<key: K, value: V>>
     *
     * In this layout, the keys and values are each respectively contiguous. We do
     * not constrain the key and value types, so the application is responsible
     * for ensuring that the keys are hashable and unique. Whether the keys are sorted
     * may be set in the metadata for this field
     *
     * In a Field with Map type, the Field has a child Struct field, which then
     * has two children: key type and the second the value type. The names of the
     * child fields may be respectively "entry", "key", and "value", but this is
     * not enforced
     *
     * Map
     *   - child[0] entry: Struct
     *     - child[0] key: K
     *     - child[1] value: V
     *
     * Neither the "entry" field nor the "key" field may be nullable.
     *
     * The metadata is structured so that Arrow systems without special handling
     * for Map can make Map an alias for List. The "layout" attribute for the Map
     * field must have the same contents as a List.
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Map {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Map
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Map= obj
                         * @returns Map
                         */
                        static getRootAsMap(bb, obj) {
                            return (obj || new Map).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * Set to true if the keys within each value are sorted
                         *
                         * @returns boolean
                         */
                        keysSorted() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startMap(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param boolean keysSorted
                         */
                        static addKeysSorted(builder, keysSorted) {
                            builder.addFieldInt8(0, +keysSorted, +false);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endMap(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createMap(builder, keysSorted) {
                            Map.startMap(builder);
                            Map.addKeysSorted(builder, keysSorted);
                            return Map.endMap(builder);
                        }
                    }
                    flatbuf.Map = Map;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * A union is a complex type with children in Field
     * By default ids in the type vector refer to the offsets in the children
     * optionally typeIds provides an indirection between the child offset and the type id
     * for each child typeIds[offset] is the id used in the type vector
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Union {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Union
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Union= obj
                         * @returns Union
                         */
                        static getRootAsUnion(bb, obj) {
                            return (obj || new Union).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.UnionMode
                         */
                        mode() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.UnionMode.Sparse;
                        }
                        /**
                         * @param number index
                         * @returns number
                         */
                        typeIds(index) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.readInt32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
                        }
                        /**
                         * @returns number
                         */
                        typeIdsLength() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @returns Int32Array
                         */
                        typeIdsArray() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startUnion(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.UnionMode mode
                         */
                        static addMode(builder, mode) {
                            builder.addFieldInt16(0, mode, org.apache.arrow.flatbuf.UnionMode.Sparse);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset typeIdsOffset
                         */
                        static addTypeIds(builder, typeIdsOffset) {
                            builder.addFieldOffset(1, typeIdsOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<number> data
                         * @returns flatbuffers.Offset
                         */
                        static createTypeIdsVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addInt32(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startTypeIdsVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endUnion(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createUnion(builder, mode, typeIdsOffset) {
                            Union.startUnion(builder);
                            Union.addMode(builder, mode);
                            Union.addTypeIds(builder, typeIdsOffset);
                            return Union.endUnion(builder);
                        }
                    }
                    flatbuf.Union = Union;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Int {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Int
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Int= obj
                         * @returns Int
                         */
                        static getRootAsInt(bb, obj) {
                            return (obj || new Int).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns number
                         */
                        bitWidth() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @returns boolean
                         */
                        isSigned() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startInt(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number bitWidth
                         */
                        static addBitWidth(builder, bitWidth) {
                            builder.addFieldInt32(0, bitWidth, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param boolean isSigned
                         */
                        static addIsSigned(builder, isSigned) {
                            builder.addFieldInt8(1, +isSigned, +false);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endInt(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createInt(builder, bitWidth, isSigned) {
                            Int.startInt(builder);
                            Int.addBitWidth(builder, bitWidth);
                            Int.addIsSigned(builder, isSigned);
                            return Int.endInt(builder);
                        }
                    }
                    flatbuf.Int = Int;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class FloatingPoint {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns FloatingPoint
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param FloatingPoint= obj
                         * @returns FloatingPoint
                         */
                        static getRootAsFloatingPoint(bb, obj) {
                            return (obj || new FloatingPoint).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.Precision
                         */
                        precision() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Precision.HALF;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startFloatingPoint(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.Precision precision
                         */
                        static addPrecision(builder, precision) {
                            builder.addFieldInt16(0, precision, org.apache.arrow.flatbuf.Precision.HALF);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endFloatingPoint(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createFloatingPoint(builder, precision) {
                            FloatingPoint.startFloatingPoint(builder);
                            FloatingPoint.addPrecision(builder, precision);
                            return FloatingPoint.endFloatingPoint(builder);
                        }
                    }
                    flatbuf.FloatingPoint = FloatingPoint;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Unicode with UTF-8 encoding
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Utf8 {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Utf8
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Utf8= obj
                         * @returns Utf8
                         */
                        static getRootAsUtf8(bb, obj) {
                            return (obj || new Utf8).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startUtf8(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endUtf8(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createUtf8(builder) {
                            Utf8.startUtf8(builder);
                            return Utf8.endUtf8(builder);
                        }
                    }
                    flatbuf.Utf8 = Utf8;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Opaque binary data
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Binary {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Binary
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Binary= obj
                         * @returns Binary
                         */
                        static getRootAsBinary(bb, obj) {
                            return (obj || new Binary).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startBinary(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endBinary(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createBinary(builder) {
                            Binary.startBinary(builder);
                            return Binary.endBinary(builder);
                        }
                    }
                    flatbuf.Binary = Binary;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Same as Utf8, but with 64-bit offsets, allowing to represent
     * extremely large data values.
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class LargeUtf8 {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns LargeUtf8
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param LargeUtf8= obj
                         * @returns LargeUtf8
                         */
                        static getRootAsLargeUtf8(bb, obj) {
                            return (obj || new LargeUtf8).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startLargeUtf8(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endLargeUtf8(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createLargeUtf8(builder) {
                            LargeUtf8.startLargeUtf8(builder);
                            return LargeUtf8.endLargeUtf8(builder);
                        }
                    }
                    flatbuf.LargeUtf8 = LargeUtf8;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Same as Binary, but with 64-bit offsets, allowing to represent
     * extremely large data values.
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class LargeBinary {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns LargeBinary
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param LargeBinary= obj
                         * @returns LargeBinary
                         */
                        static getRootAsLargeBinary(bb, obj) {
                            return (obj || new LargeBinary).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startLargeBinary(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endLargeBinary(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createLargeBinary(builder) {
                            LargeBinary.startLargeBinary(builder);
                            return LargeBinary.endLargeBinary(builder);
                        }
                    }
                    flatbuf.LargeBinary = LargeBinary;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class FixedSizeBinary {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns FixedSizeBinary
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param FixedSizeBinary= obj
                         * @returns FixedSizeBinary
                         */
                        static getRootAsFixedSizeBinary(bb, obj) {
                            return (obj || new FixedSizeBinary).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * Number of bytes per value
                         *
                         * @returns number
                         */
                        byteWidth() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startFixedSizeBinary(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number byteWidth
                         */
                        static addByteWidth(builder, byteWidth) {
                            builder.addFieldInt32(0, byteWidth, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endFixedSizeBinary(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createFixedSizeBinary(builder, byteWidth) {
                            FixedSizeBinary.startFixedSizeBinary(builder);
                            FixedSizeBinary.addByteWidth(builder, byteWidth);
                            return FixedSizeBinary.endFixedSizeBinary(builder);
                        }
                    }
                    flatbuf.FixedSizeBinary = FixedSizeBinary;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Bool {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Bool
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Bool= obj
                         * @returns Bool
                         */
                        static getRootAsBool(bb, obj) {
                            return (obj || new Bool).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startBool(builder) {
                            builder.startObject(0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endBool(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createBool(builder) {
                            Bool.startBool(builder);
                            return Bool.endBool(builder);
                        }
                    }
                    flatbuf.Bool = Bool;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Decimal {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Decimal
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Decimal= obj
                         * @returns Decimal
                         */
                        static getRootAsDecimal(bb, obj) {
                            return (obj || new Decimal).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * Total number of decimal digits
                         *
                         * @returns number
                         */
                        precision() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
                        }
                        /**
                         * Number of digits after the decimal point "."
                         *
                         * @returns number
                         */
                        scale() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startDecimal(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number precision
                         */
                        static addPrecision(builder, precision) {
                            builder.addFieldInt32(0, precision, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number scale
                         */
                        static addScale(builder, scale) {
                            builder.addFieldInt32(1, scale, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endDecimal(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createDecimal(builder, precision, scale) {
                            Decimal.startDecimal(builder);
                            Decimal.addPrecision(builder, precision);
                            Decimal.addScale(builder, scale);
                            return Decimal.endDecimal(builder);
                        }
                    }
                    flatbuf.Decimal = Decimal;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Date is either a 32-bit or 64-bit type representing elapsed time since UNIX
     * epoch (1970-01-01), stored in either of two units:
     *
     * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
     *   leap seconds), where the values are evenly divisible by 86400000
     * * Days (32 bits) since the UNIX epoch
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Date {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Date
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Date= obj
                         * @returns Date
                         */
                        static getRootAsDate(bb, obj) {
                            return (obj || new Date).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.DateUnit
                         */
                        unit() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.DateUnit.MILLISECOND;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startDate(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.DateUnit unit
                         */
                        static addUnit(builder, unit) {
                            builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.DateUnit.MILLISECOND);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endDate(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createDate(builder, unit) {
                            Date.startDate(builder);
                            Date.addUnit(builder, unit);
                            return Date.endDate(builder);
                        }
                    }
                    flatbuf.Date = Date;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Time type. The physical storage type depends on the unit
     * - SECOND and MILLISECOND: 32 bits
     * - MICROSECOND and NANOSECOND: 64 bits
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Time {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Time
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Time= obj
                         * @returns Time
                         */
                        static getRootAsTime(bb, obj) {
                            return (obj || new Time).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.TimeUnit
                         */
                        unit() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.MILLISECOND;
                        }
                        /**
                         * @returns number
                         */
                        bitWidth() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.readInt32(this.bb_pos + offset) : 32;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startTime(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.TimeUnit unit
                         */
                        static addUnit(builder, unit) {
                            builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.MILLISECOND);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number bitWidth
                         */
                        static addBitWidth(builder, bitWidth) {
                            builder.addFieldInt32(1, bitWidth, 32);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endTime(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createTime(builder, unit, bitWidth) {
                            Time.startTime(builder);
                            Time.addUnit(builder, unit);
                            Time.addBitWidth(builder, bitWidth);
                            return Time.endTime(builder);
                        }
                    }
                    flatbuf.Time = Time;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * Time elapsed from the Unix epoch, 00:00:00.000 on 1 January 1970, excluding
     * leap seconds, as a 64-bit integer. Note that UNIX time does not include
     * leap seconds.
     *
     * The Timestamp metadata supports both "time zone naive" and "time zone
     * aware" timestamps. Read about the timezone attribute for more detail
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Timestamp {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Timestamp
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Timestamp= obj
                         * @returns Timestamp
                         */
                        static getRootAsTimestamp(bb, obj) {
                            return (obj || new Timestamp).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.TimeUnit
                         */
                        unit() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.SECOND;
                        }
                        timezone(optionalEncoding) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startTimestamp(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.TimeUnit unit
                         */
                        static addUnit(builder, unit) {
                            builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.SECOND);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset timezoneOffset
                         */
                        static addTimezone(builder, timezoneOffset) {
                            builder.addFieldOffset(1, timezoneOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endTimestamp(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createTimestamp(builder, unit, timezoneOffset) {
                            Timestamp.startTimestamp(builder);
                            Timestamp.addUnit(builder, unit);
                            Timestamp.addTimezone(builder, timezoneOffset);
                            return Timestamp.endTimestamp(builder);
                        }
                    }
                    flatbuf.Timestamp = Timestamp;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Interval {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Interval
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Interval= obj
                         * @returns Interval
                         */
                        static getRootAsInterval(bb, obj) {
                            return (obj || new Interval).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.IntervalUnit
                         */
                        unit() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startInterval(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.IntervalUnit unit
                         */
                        static addUnit(builder, unit) {
                            builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endInterval(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createInterval(builder, unit) {
                            Interval.startInterval(builder);
                            Interval.addUnit(builder, unit);
                            return Interval.endInterval(builder);
                        }
                    }
                    flatbuf.Interval = Interval;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Duration {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Duration
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Duration= obj
                         * @returns Duration
                         */
                        static getRootAsDuration(bb, obj) {
                            return (obj || new Duration).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.TimeUnit
                         */
                        unit() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.TimeUnit.MILLISECOND;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startDuration(builder) {
                            builder.startObject(1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.TimeUnit unit
                         */
                        static addUnit(builder, unit) {
                            builder.addFieldInt16(0, unit, org.apache.arrow.flatbuf.TimeUnit.MILLISECOND);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endDuration(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createDuration(builder, unit) {
                            Duration.startDuration(builder);
                            Duration.addUnit(builder, unit);
                            return Duration.endDuration(builder);
                        }
                    }
                    flatbuf.Duration = Duration;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * user defined key value pairs to add custom metadata to arrow
     * key namespacing is the responsibility of the user
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class KeyValue {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns KeyValue
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param KeyValue= obj
                         * @returns KeyValue
                         */
                        static getRootAsKeyValue(bb, obj) {
                            return (obj || new KeyValue).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        key(optionalEncoding) {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
                        }
                        value(optionalEncoding) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startKeyValue(builder) {
                            builder.startObject(2);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset keyOffset
                         */
                        static addKey(builder, keyOffset) {
                            builder.addFieldOffset(0, keyOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset valueOffset
                         */
                        static addValue(builder, valueOffset) {
                            builder.addFieldOffset(1, valueOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endKeyValue(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createKeyValue(builder, keyOffset, valueOffset) {
                            KeyValue.startKeyValue(builder);
                            KeyValue.addKey(builder, keyOffset);
                            KeyValue.addValue(builder, valueOffset);
                            return KeyValue.endKeyValue(builder);
                        }
                    }
                    flatbuf.KeyValue = KeyValue;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * Dictionary encoding metadata
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class DictionaryEncoding {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns DictionaryEncoding
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param DictionaryEncoding= obj
                         * @returns DictionaryEncoding
                         */
                        static getRootAsDictionaryEncoding(bb, obj) {
                            return (obj || new DictionaryEncoding).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * The known dictionary id in the application where this data is used. In
                         * the file or streaming formats, the dictionary ids are found in the
                         * DictionaryBatch messages
                         *
                         * @returns flatbuffers.Long
                         */
                        id() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
                        }
                        /**
                         * The dictionary indices are constrained to be positive integers. If this
                         * field is null, the indices must be signed int32
                         *
                         * @param org.apache.arrow.flatbuf.Int= obj
                         * @returns org.apache.arrow.flatbuf.Int|null
                         */
                        indexType(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? (obj || new org.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
                        }
                        /**
                         * By default, dictionaries are not ordered, or the order does not have
                         * semantic meaning. In some statistical, applications, dictionary-encoding
                         * is used to represent ordered categorical data, and we provide a way to
                         * preserve that metadata here
                         *
                         * @returns boolean
                         */
                        isOrdered() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startDictionaryEncoding(builder) {
                            builder.startObject(3);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long id
                         */
                        static addId(builder, id) {
                            builder.addFieldInt64(0, id, builder.createLong(0, 0));
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset indexTypeOffset
                         */
                        static addIndexType(builder, indexTypeOffset) {
                            builder.addFieldOffset(1, indexTypeOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param boolean isOrdered
                         */
                        static addIsOrdered(builder, isOrdered) {
                            builder.addFieldInt8(2, +isOrdered, +false);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endDictionaryEncoding(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createDictionaryEncoding(builder, id, indexTypeOffset, isOrdered) {
                            DictionaryEncoding.startDictionaryEncoding(builder);
                            DictionaryEncoding.addId(builder, id);
                            DictionaryEncoding.addIndexType(builder, indexTypeOffset);
                            DictionaryEncoding.addIsOrdered(builder, isOrdered);
                            return DictionaryEncoding.endDictionaryEncoding(builder);
                        }
                    }
                    flatbuf.DictionaryEncoding = DictionaryEncoding;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * A field represents a named column in a record / row batch or child of a
     * nested type.
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Field {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Field
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Field= obj
                         * @returns Field
                         */
                        static getRootAsField(bb, obj) {
                            return (obj || new Field).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        name(optionalEncoding) {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
                        }
                        /**
                         * Whether or not this field can contain nulls. Should be true in general.
                         *
                         * @returns boolean
                         */
                        nullable() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.Type
                         */
                        typeType() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? /**  */ (this.bb.readUint8(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Type.NONE;
                        }
                        /**
                         * This is the type of the decoded value if the field is dictionary encoded.
                         *
                         * @param flatbuffers.Table obj
                         * @returns ?flatbuffers.Table
                         */
                        type(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 10);
                            return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
                        }
                        /**
                         * Present only if the field is dictionary encoded.
                         *
                         * @param org.apache.arrow.flatbuf.DictionaryEncoding= obj
                         * @returns org.apache.arrow.flatbuf.DictionaryEncoding|null
                         */
                        dictionary(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 12);
                            return offset ? (obj || new org.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
                        }
                        /**
                         * children apply only to nested data types like Struct, List and Union. For
                         * primitive types children will have length 0.
                         *
                         * @param number index
                         * @param org.apache.arrow.flatbuf.Field= obj
                         * @returns org.apache.arrow.flatbuf.Field
                         */
                        children(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 14);
                            return offset ? (obj || new org.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        childrenLength() {
                            let offset = this.bb.__offset(this.bb_pos, 14);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * User-defined metadata
                         *
                         * @param number index
                         * @param org.apache.arrow.flatbuf.KeyValue= obj
                         * @returns org.apache.arrow.flatbuf.KeyValue
                         */
                        customMetadata(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 16);
                            return offset ? (obj || new org.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        customMetadataLength() {
                            let offset = this.bb.__offset(this.bb_pos, 16);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startField(builder) {
                            builder.startObject(7);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset nameOffset
                         */
                        static addName(builder, nameOffset) {
                            builder.addFieldOffset(0, nameOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param boolean nullable
                         */
                        static addNullable(builder, nullable) {
                            builder.addFieldInt8(1, +nullable, +false);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.Type typeType
                         */
                        static addTypeType(builder, typeType) {
                            builder.addFieldInt8(2, typeType, org.apache.arrow.flatbuf.Type.NONE);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset typeOffset
                         */
                        static addType(builder, typeOffset) {
                            builder.addFieldOffset(3, typeOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset dictionaryOffset
                         */
                        static addDictionary(builder, dictionaryOffset) {
                            builder.addFieldOffset(4, dictionaryOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset childrenOffset
                         */
                        static addChildren(builder, childrenOffset) {
                            builder.addFieldOffset(5, childrenOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<flatbuffers.Offset> data
                         * @returns flatbuffers.Offset
                         */
                        static createChildrenVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addOffset(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startChildrenVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset customMetadataOffset
                         */
                        static addCustomMetadata(builder, customMetadataOffset) {
                            builder.addFieldOffset(6, customMetadataOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<flatbuffers.Offset> data
                         * @returns flatbuffers.Offset
                         */
                        static createCustomMetadataVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addOffset(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startCustomMetadataVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endField(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createField(builder, nameOffset, nullable, typeType, typeOffset, dictionaryOffset, childrenOffset, customMetadataOffset) {
                            Field.startField(builder);
                            Field.addName(builder, nameOffset);
                            Field.addNullable(builder, nullable);
                            Field.addTypeType(builder, typeType);
                            Field.addType(builder, typeOffset);
                            Field.addDictionary(builder, dictionaryOffset);
                            Field.addChildren(builder, childrenOffset);
                            Field.addCustomMetadata(builder, customMetadataOffset);
                            return Field.endField(builder);
                        }
                    }
                    flatbuf.Field = Field;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * A Buffer represents a single contiguous memory segment
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Buffer {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Buffer
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * The relative offset into the shared memory page where the bytes for this
                         * buffer starts
                         *
                         * @returns flatbuffers.Long
                         */
                        offset() {
                            return this.bb.readInt64(this.bb_pos);
                        }
                        /**
                         * The absolute length (in bytes) of the memory buffer. The memory is found
                         * from offset (inclusive) to offset + length (non-inclusive).
                         *
                         * @returns flatbuffers.Long
                         */
                        length() {
                            return this.bb.readInt64(this.bb_pos + 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long offset
                         * @param flatbuffers.Long length
                         * @returns flatbuffers.Offset
                         */
                        static createBuffer(builder, offset, length) {
                            builder.prep(8, 16);
                            builder.writeInt64(length);
                            builder.writeInt64(offset);
                            return builder.offset();
                        }
                    }
                    flatbuf.Buffer = Buffer;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));
    /**
     * ----------------------------------------------------------------------
     * A Schema describes the columns in a row batch
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Schema {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Schema
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Schema= obj
                         * @returns Schema
                         */
                        static getRootAsSchema(bb, obj) {
                            return (obj || new Schema).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * endianness of the buffer
                         * it is Little Endian by default
                         * if endianness doesn't match the underlying system then the vectors need to be converted
                         *
                         * @returns org.apache.arrow.flatbuf.Endianness
                         */
                        endianness() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org.apache.arrow.flatbuf.Endianness.Little;
                        }
                        /**
                         * @param number index
                         * @param org.apache.arrow.flatbuf.Field= obj
                         * @returns org.apache.arrow.flatbuf.Field
                         */
                        fields(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? (obj || new org.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        fieldsLength() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param number index
                         * @param org.apache.arrow.flatbuf.KeyValue= obj
                         * @returns org.apache.arrow.flatbuf.KeyValue
                         */
                        customMetadata(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? (obj || new org.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        customMetadataLength() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startSchema(builder) {
                            builder.startObject(3);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.Endianness endianness
                         */
                        static addEndianness(builder, endianness) {
                            builder.addFieldInt16(0, endianness, org.apache.arrow.flatbuf.Endianness.Little);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset fieldsOffset
                         */
                        static addFields(builder, fieldsOffset) {
                            builder.addFieldOffset(1, fieldsOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<flatbuffers.Offset> data
                         * @returns flatbuffers.Offset
                         */
                        static createFieldsVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addOffset(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startFieldsVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset customMetadataOffset
                         */
                        static addCustomMetadata(builder, customMetadataOffset) {
                            builder.addFieldOffset(2, customMetadataOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<flatbuffers.Offset> data
                         * @returns flatbuffers.Offset
                         */
                        static createCustomMetadataVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addOffset(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startCustomMetadataVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endSchema(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset offset
                         */
                        static finishSchemaBuffer(builder, offset) {
                            builder.finish(offset);
                        }
                        static createSchema(builder, endianness, fieldsOffset, customMetadataOffset) {
                            Schema.startSchema(builder);
                            Schema.addEndianness(builder, endianness);
                            Schema.addFields(builder, fieldsOffset);
                            Schema.addCustomMetadata(builder, customMetadataOffset);
                            return Schema.endSchema(builder);
                        }
                    }
                    flatbuf.Schema = Schema;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$2 || (org$2 = {}));

    // automatically generated by the FlatBuffers compiler, do not modify
    var org$1;
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    flatbuf.Schema = org$2.apache.arrow.flatbuf.Schema;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));
    /**
     * ----------------------------------------------------------------------
     * The root Message type
     * This union enables us to easily send different message types without
     * redundant storage, and in the future we can easily add new message types.
     *
     * Arrow implementations do not need to implement all of the message types,
     * which may include experimental metadata types. For maximum compatibility,
     * it is best to send data using RecordBatch
     *
     * @enum {number}
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    (function (MessageHeader) {
                        MessageHeader[MessageHeader["NONE"] = 0] = "NONE";
                        MessageHeader[MessageHeader["Schema"] = 1] = "Schema";
                        MessageHeader[MessageHeader["DictionaryBatch"] = 2] = "DictionaryBatch";
                        MessageHeader[MessageHeader["RecordBatch"] = 3] = "RecordBatch";
                        MessageHeader[MessageHeader["Tensor"] = 4] = "Tensor";
                        MessageHeader[MessageHeader["SparseTensor"] = 5] = "SparseTensor";
                    })(flatbuf.MessageHeader || (flatbuf.MessageHeader = {}));
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));
    /**
     * ----------------------------------------------------------------------
     * Data structures for describing a table row batch (a collection of
     * equal-length Arrow arrays)
     * Metadata about a field at some level of a nested type tree (but not
     * its children).
     *
     * For example, a List<Int16> with values [[1, 2, 3], null, [4], [5, 6], null]
     * would have {length: 5, null_count: 2} for its List node, and {length: 6,
     * null_count: 0} for its Int16 node, as separate FieldNode structs
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class FieldNode {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns FieldNode
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * The number of value slots in the Arrow array at this level of a nested
                         * tree
                         *
                         * @returns flatbuffers.Long
                         */
                        length() {
                            return this.bb.readInt64(this.bb_pos);
                        }
                        /**
                         * The number of observed nulls. Fields with null_count == 0 may choose not
                         * to write their physical validity bitmap out as a materialized buffer,
                         * instead setting the length of the bitmap buffer to 0.
                         *
                         * @returns flatbuffers.Long
                         */
                        nullCount() {
                            return this.bb.readInt64(this.bb_pos + 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long length
                         * @param flatbuffers.Long null_count
                         * @returns flatbuffers.Offset
                         */
                        static createFieldNode(builder, length, null_count) {
                            builder.prep(8, 16);
                            builder.writeInt64(null_count);
                            builder.writeInt64(length);
                            return builder.offset();
                        }
                    }
                    flatbuf.FieldNode = FieldNode;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));
    /**
     * A data header describing the shared memory layout of a "record" or "row"
     * batch. Some systems call this a "row batch" internally and others a "record
     * batch".
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class RecordBatch {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns RecordBatch
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param RecordBatch= obj
                         * @returns RecordBatch
                         */
                        static getRootAsRecordBatch(bb, obj) {
                            return (obj || new RecordBatch).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * number of records / rows. The arrays in the batch should all have this
                         * length
                         *
                         * @returns flatbuffers.Long
                         */
                        length() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
                        }
                        /**
                         * Nodes correspond to the pre-ordered flattened logical schema
                         *
                         * @param number index
                         * @param org.apache.arrow.flatbuf.FieldNode= obj
                         * @returns org.apache.arrow.flatbuf.FieldNode
                         */
                        nodes(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? (obj || new org.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos + offset) + index * 16, this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        nodesLength() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * Buffers correspond to the pre-ordered flattened buffer tree
                         *
                         * The number of buffers appended to this list depends on the schema. For
                         * example, most primitive arrays will have 2 buffers, 1 for the validity
                         * bitmap and 1 for the values. For struct arrays, there will only be a
                         * single buffer for the validity (nulls) bitmap
                         *
                         * @param number index
                         * @param org.apache.arrow.flatbuf.Buffer= obj
                         * @returns org.apache.arrow.flatbuf.Buffer
                         */
                        buffers(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? (obj || new org$2.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos + offset) + index * 16, this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        buffersLength() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startRecordBatch(builder) {
                            builder.startObject(3);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long length
                         */
                        static addLength(builder, length) {
                            builder.addFieldInt64(0, length, builder.createLong(0, 0));
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset nodesOffset
                         */
                        static addNodes(builder, nodesOffset) {
                            builder.addFieldOffset(1, nodesOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startNodesVector(builder, numElems) {
                            builder.startVector(16, numElems, 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset buffersOffset
                         */
                        static addBuffers(builder, buffersOffset) {
                            builder.addFieldOffset(2, buffersOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startBuffersVector(builder, numElems) {
                            builder.startVector(16, numElems, 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endRecordBatch(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createRecordBatch(builder, length, nodesOffset, buffersOffset) {
                            RecordBatch.startRecordBatch(builder);
                            RecordBatch.addLength(builder, length);
                            RecordBatch.addNodes(builder, nodesOffset);
                            RecordBatch.addBuffers(builder, buffersOffset);
                            return RecordBatch.endRecordBatch(builder);
                        }
                    }
                    flatbuf.RecordBatch = RecordBatch;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));
    /**
     * For sending dictionary encoding information. Any Field can be
     * dictionary-encoded, but in this case none of its children may be
     * dictionary-encoded.
     * There is one vector / column per dictionary, but that vector / column
     * may be spread across multiple dictionary batches by using the isDelta
     * flag
     *
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class DictionaryBatch {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns DictionaryBatch
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param DictionaryBatch= obj
                         * @returns DictionaryBatch
                         */
                        static getRootAsDictionaryBatch(bb, obj) {
                            return (obj || new DictionaryBatch).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns flatbuffers.Long
                         */
                        id() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
                        }
                        /**
                         * @param org.apache.arrow.flatbuf.RecordBatch= obj
                         * @returns org.apache.arrow.flatbuf.RecordBatch|null
                         */
                        data(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? (obj || new org.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
                        }
                        /**
                         * If isDelta is true the values in the dictionary are to be appended to a
                         * dictionary with the indicated id
                         *
                         * @returns boolean
                         */
                        isDelta() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startDictionaryBatch(builder) {
                            builder.startObject(3);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long id
                         */
                        static addId(builder, id) {
                            builder.addFieldInt64(0, id, builder.createLong(0, 0));
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset dataOffset
                         */
                        static addData(builder, dataOffset) {
                            builder.addFieldOffset(1, dataOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param boolean isDelta
                         */
                        static addIsDelta(builder, isDelta) {
                            builder.addFieldInt8(2, +isDelta, +false);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endDictionaryBatch(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        static createDictionaryBatch(builder, id, dataOffset, isDelta) {
                            DictionaryBatch.startDictionaryBatch(builder);
                            DictionaryBatch.addId(builder, id);
                            DictionaryBatch.addData(builder, dataOffset);
                            DictionaryBatch.addIsDelta(builder, isDelta);
                            return DictionaryBatch.endDictionaryBatch(builder);
                        }
                    }
                    flatbuf.DictionaryBatch = DictionaryBatch;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Message {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Message
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Message= obj
                         * @returns Message
                         */
                        static getRootAsMessage(bb, obj) {
                            return (obj || new Message).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.MetadataVersion
                         */
                        version() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org$2.apache.arrow.flatbuf.MetadataVersion.V1;
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.MessageHeader
                         */
                        headerType() {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? /**  */ (this.bb.readUint8(this.bb_pos + offset)) : org.apache.arrow.flatbuf.MessageHeader.NONE;
                        }
                        /**
                         * @param flatbuffers.Table obj
                         * @returns ?flatbuffers.Table
                         */
                        header(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
                        }
                        /**
                         * @returns flatbuffers.Long
                         */
                        bodyLength() {
                            let offset = this.bb.__offset(this.bb_pos, 10);
                            return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
                        }
                        /**
                         * @param number index
                         * @param org.apache.arrow.flatbuf.KeyValue= obj
                         * @returns org.apache.arrow.flatbuf.KeyValue
                         */
                        customMetadata(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 12);
                            return offset ? (obj || new org$2.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        customMetadataLength() {
                            let offset = this.bb.__offset(this.bb_pos, 12);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startMessage(builder) {
                            builder.startObject(5);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.MetadataVersion version
                         */
                        static addVersion(builder, version) {
                            builder.addFieldInt16(0, version, org$2.apache.arrow.flatbuf.MetadataVersion.V1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.MessageHeader headerType
                         */
                        static addHeaderType(builder, headerType) {
                            builder.addFieldInt8(1, headerType, org.apache.arrow.flatbuf.MessageHeader.NONE);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset headerOffset
                         */
                        static addHeader(builder, headerOffset) {
                            builder.addFieldOffset(2, headerOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long bodyLength
                         */
                        static addBodyLength(builder, bodyLength) {
                            builder.addFieldInt64(3, bodyLength, builder.createLong(0, 0));
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset customMetadataOffset
                         */
                        static addCustomMetadata(builder, customMetadataOffset) {
                            builder.addFieldOffset(4, customMetadataOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param Array.<flatbuffers.Offset> data
                         * @returns flatbuffers.Offset
                         */
                        static createCustomMetadataVector(builder, data) {
                            builder.startVector(4, data.length, 4);
                            for (let i = data.length - 1; i >= 0; i--) {
                                builder.addOffset(data[i]);
                            }
                            return builder.endVector();
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startCustomMetadataVector(builder, numElems) {
                            builder.startVector(4, numElems, 4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endMessage(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset offset
                         */
                        static finishMessageBuffer(builder, offset) {
                            builder.finish(offset);
                        }
                        static createMessage(builder, version, headerType, headerOffset, bodyLength, customMetadataOffset) {
                            Message.startMessage(builder);
                            Message.addVersion(builder, version);
                            Message.addHeaderType(builder, headerType);
                            Message.addHeader(builder, headerOffset);
                            Message.addBodyLength(builder, bodyLength);
                            Message.addCustomMetadata(builder, customMetadataOffset);
                            return Message.endMessage(builder);
                        }
                    }
                    flatbuf.Message = Message;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org$1 || (org$1 = {}));

    // Licensed to the Apache Software Foundation (ASF) under one
    org$2.apache.arrow.flatbuf.Type;
    var DateUnit = org$2.apache.arrow.flatbuf.DateUnit;
    var TimeUnit = org$2.apache.arrow.flatbuf.TimeUnit;
    var Precision = org$2.apache.arrow.flatbuf.Precision;
    var UnionMode = org$2.apache.arrow.flatbuf.UnionMode;
    var IntervalUnit = org$2.apache.arrow.flatbuf.IntervalUnit;
    var MessageHeader = org$1.apache.arrow.flatbuf.MessageHeader;
    var MetadataVersion = org$2.apache.arrow.flatbuf.MetadataVersion;
    /**
     * Main data type enumeration.
     *
     * Data types in this library are all *logical*. They can be expressed as
     * either a primitive physical type (bytes or bits of some fixed size), a
     * nested type consisting of other data types, or another data type (e.g. a
     * timestamp encoded as an int64).
     *
     * **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow
     * IPC payload.
     *
     * The rest of the values are specified here so TypeScript can narrow the type
     * signatures further beyond the base Arrow Types. The Arrow DataTypes include
     * metadata like `bitWidth` that impact the type signatures of the values we
     * accept and return.
     *
     * For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an
     * `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`
     * reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the
     * underlying `Int32Array`.
     *
     * Library consumers benefit by knowing the narrowest type, since we can ensure
     * the types across all public methods are propagated, and never bail to `any`.
     * These values are _never_ used at runtime, and they will _never_ be written
     * to the flatbuffers metadata of serialized Arrow IPC payloads.
     */
    var Type$2;
    (function (Type) {
        /** The default placeholder type */
        Type[Type["NONE"] = 0] = "NONE";
        /** A NULL type having no physical storage */
        Type[Type["Null"] = 1] = "Null";
        /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */
        Type[Type["Int"] = 2] = "Int";
        /** 2, 4, or 8-byte floating point value */
        Type[Type["Float"] = 3] = "Float";
        /** Variable-length bytes (no guarantee of UTF8-ness) */
        Type[Type["Binary"] = 4] = "Binary";
        /** UTF8 variable-length string as List<Char> */
        Type[Type["Utf8"] = 5] = "Utf8";
        /** Boolean as 1 bit, LSB bit-packed ordering */
        Type[Type["Bool"] = 6] = "Bool";
        /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */
        Type[Type["Decimal"] = 7] = "Decimal";
        /** int32_t days or int64_t milliseconds since the UNIX epoch */
        Type[Type["Date"] = 8] = "Date";
        /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */
        Type[Type["Time"] = 9] = "Time";
        /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */
        Type[Type["Timestamp"] = 10] = "Timestamp";
        /** YEAR_MONTH or DAY_TIME interval in SQL style */
        Type[Type["Interval"] = 11] = "Interval";
        /** A list of some logical data type */
        Type[Type["List"] = 12] = "List";
        /** Struct of logical types */
        Type[Type["Struct"] = 13] = "Struct";
        /** Union of logical types */
        Type[Type["Union"] = 14] = "Union";
        /** Fixed-size binary. Each value occupies the same number of bytes */
        Type[Type["FixedSizeBinary"] = 15] = "FixedSizeBinary";
        /** Fixed-size list. Each value occupies the same number of bytes */
        Type[Type["FixedSizeList"] = 16] = "FixedSizeList";
        /** Map of named logical types */
        Type[Type["Map"] = 17] = "Map";
        /** Dictionary aka Category type */
        Type[Type["Dictionary"] = -1] = "Dictionary";
        Type[Type["Int8"] = -2] = "Int8";
        Type[Type["Int16"] = -3] = "Int16";
        Type[Type["Int32"] = -4] = "Int32";
        Type[Type["Int64"] = -5] = "Int64";
        Type[Type["Uint8"] = -6] = "Uint8";
        Type[Type["Uint16"] = -7] = "Uint16";
        Type[Type["Uint32"] = -8] = "Uint32";
        Type[Type["Uint64"] = -9] = "Uint64";
        Type[Type["Float16"] = -10] = "Float16";
        Type[Type["Float32"] = -11] = "Float32";
        Type[Type["Float64"] = -12] = "Float64";
        Type[Type["DateDay"] = -13] = "DateDay";
        Type[Type["DateMillisecond"] = -14] = "DateMillisecond";
        Type[Type["TimestampSecond"] = -15] = "TimestampSecond";
        Type[Type["TimestampMillisecond"] = -16] = "TimestampMillisecond";
        Type[Type["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
        Type[Type["TimestampNanosecond"] = -18] = "TimestampNanosecond";
        Type[Type["TimeSecond"] = -19] = "TimeSecond";
        Type[Type["TimeMillisecond"] = -20] = "TimeMillisecond";
        Type[Type["TimeMicrosecond"] = -21] = "TimeMicrosecond";
        Type[Type["TimeNanosecond"] = -22] = "TimeNanosecond";
        Type[Type["DenseUnion"] = -23] = "DenseUnion";
        Type[Type["SparseUnion"] = -24] = "SparseUnion";
        Type[Type["IntervalDayTime"] = -25] = "IntervalDayTime";
        Type[Type["IntervalYearMonth"] = -26] = "IntervalYearMonth";
    })(Type$2 || (Type$2 = {}));
    var BufferType;
    (function (BufferType) {
        /**
         * used in List type, Dense Union and variable length primitive types (String, Binary)
         */
        BufferType[BufferType["OFFSET"] = 0] = "OFFSET";
        /**
         * actual data, either wixed width primitive types in slots or variable width delimited by an OFFSET vector
         */
        BufferType[BufferType["DATA"] = 1] = "DATA";
        /**
         * Bit vector indicating if each value is null
         */
        BufferType[BufferType["VALIDITY"] = 2] = "VALIDITY";
        /**
         * Type vector used in Union type
         */
        BufferType[BufferType["TYPE"] = 3] = "TYPE";
    })(BufferType || (BufferType = {}));

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    /** @ignore */
    function getBool$1(_data, _index, byte, bit) {
        return (byte & 1 << bit) !== 0;
    }
    /** @ignore */
    function getBit(_data, _index, byte, bit) {
        return (byte & 1 << bit) >> bit;
    }
    /** @ignore */
    function setBool$1(bytes, index, value) {
        return value ?
            !!(bytes[index >> 3] |= (1 << (index % 8))) || true :
            !(bytes[index >> 3] &= ~(1 << (index % 8))) && false;
    }
    /** @ignore */
    function truncateBitmap(offset, length, bitmap) {
        const alignedSize = (bitmap.byteLength + 7) & ~7;
        if (offset > 0 || bitmap.byteLength < alignedSize) {
            const bytes = new Uint8Array(alignedSize);
            // If the offset is a multiple of 8 bits, it's safe to slice the bitmap
            bytes.set(offset % 8 === 0 ? bitmap.subarray(offset >> 3) :
                // Otherwise iterate each bit from the offset and return a new one
                packBools(iterateBits(bitmap, offset, length, null, getBool$1)).subarray(0, alignedSize));
            return bytes;
        }
        return bitmap;
    }
    /** @ignore */
    function packBools(values) {
        let xs = [];
        let i = 0, bit = 0, byte = 0;
        for (const value of values) {
            value && (byte |= 1 << bit);
            if (++bit === 8) {
                xs[i++] = byte;
                byte = bit = 0;
            }
        }
        if (i === 0 || bit > 0) {
            xs[i++] = byte;
        }
        let b = new Uint8Array((xs.length + 7) & ~7);
        b.set(xs);
        return b;
    }
    /** @ignore */
    function* iterateBits(bytes, begin, length, context, get) {
        let bit = begin % 8;
        let byteIndex = begin >> 3;
        let index = 0, remaining = length;
        for (; remaining > 0; bit = 0) {
            let byte = bytes[byteIndex++];
            do {
                yield get(context, index++, byte, bit);
            } while (--remaining > 0 && ++bit < 8);
        }
    }
    /**
     * Compute the population count (the number of bits set to 1) for a range of bits in a Uint8Array.
     * @param vector The Uint8Array of bits for which to compute the population count.
     * @param lhs The range's left-hand side (or start) bit
     * @param rhs The range's right-hand side (or end) bit
     */
    /** @ignore */
    function popcnt_bit_range(data, lhs, rhs) {
        if (rhs - lhs <= 0) {
            return 0;
        }
        // If the bit range is less than one byte, sum the 1 bits in the bit range
        if (rhs - lhs < 8) {
            let sum = 0;
            for (const bit of iterateBits(data, lhs, rhs - lhs, data, getBit)) {
                sum += bit;
            }
            return sum;
        }
        // Get the next lowest multiple of 8 from the right hand side
        const rhsInside = rhs >> 3 << 3;
        // Get the next highest multiple of 8 from the left hand side
        const lhsInside = lhs + (lhs % 8 === 0 ? 0 : 8 - lhs % 8);
        return (
        // Get the popcnt of bits between the left hand side, and the next highest multiple of 8
        popcnt_bit_range(data, lhs, lhsInside) +
            // Get the popcnt of bits between the right hand side, and the next lowest multiple of 8
            popcnt_bit_range(data, rhsInside, rhs) +
            // Get the popcnt of all bits between the left and right hand sides' multiples of 8
            popcnt_array(data, lhsInside >> 3, (rhsInside - lhsInside) >> 3));
    }
    /** @ignore */
    function popcnt_array(arr, byteOffset, byteLength) {
        let cnt = 0, pos = byteOffset | 0;
        const view = new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
        const len = byteLength === void 0 ? arr.byteLength : pos + byteLength;
        while (len - pos >= 4) {
            cnt += popcnt_uint32(view.getUint32(pos));
            pos += 4;
        }
        while (len - pos >= 2) {
            cnt += popcnt_uint32(view.getUint16(pos));
            pos += 2;
        }
        while (len - pos >= 1) {
            cnt += popcnt_uint32(view.getUint8(pos));
            pos += 1;
        }
        return cnt;
    }
    /** @ignore */
    function popcnt_uint32(uint32) {
        let i = uint32 | 0;
        i = i - ((i >>> 1) & 0x55555555);
        i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
        return (((i + (i >>> 4)) & 0x0F0F0F0F) * 0x01010101) >>> 24;
    }

    var util_bit_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        getBool: getBool$1,
        getBit: getBit,
        setBool: setBool$1,
        truncateBitmap: truncateBitmap,
        packBools: packBools,
        iterateBits: iterateBits,
        popcnt_bit_range: popcnt_bit_range,
        popcnt_array: popcnt_array,
        popcnt_uint32: popcnt_uint32
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    class Visitor {
        visitMany(nodes, ...args) {
            return nodes.map((node, i) => this.visit(node, ...args.map((x) => x[i])));
        }
        visit(...args) {
            return this.getVisitFn(args[0], false).apply(this, args);
        }
        getVisitFn(node, throwIfNotFound = true) {
            return getVisitFn(this, node, throwIfNotFound);
        }
        visitNull(_node, ..._args) { return null; }
        visitBool(_node, ..._args) { return null; }
        visitInt(_node, ..._args) { return null; }
        visitFloat(_node, ..._args) { return null; }
        visitUtf8(_node, ..._args) { return null; }
        visitBinary(_node, ..._args) { return null; }
        visitFixedSizeBinary(_node, ..._args) { return null; }
        visitDate(_node, ..._args) { return null; }
        visitTimestamp(_node, ..._args) { return null; }
        visitTime(_node, ..._args) { return null; }
        visitDecimal(_node, ..._args) { return null; }
        visitList(_node, ..._args) { return null; }
        visitStruct(_node, ..._args) { return null; }
        visitUnion(_node, ..._args) { return null; }
        visitDictionary(_node, ..._args) { return null; }
        visitInterval(_node, ..._args) { return null; }
        visitFixedSizeList(_node, ..._args) { return null; }
        visitMap(_node, ..._args) { return null; }
    }
    /** @ignore */
    function getVisitFn(visitor, node, throwIfNotFound = true) {
        let fn = null;
        let dtype = Type$2.NONE;
        // tslint:disable
        if (node instanceof Data) {
            dtype = inferDType(node.type);
        }
        else if (node instanceof AbstractVector) {
            dtype = inferDType(node.type);
        }
        else if (node instanceof DataType) {
            dtype = inferDType(node);
        }
        else if (typeof (dtype = node) !== 'number') {
            dtype = Type$2[node];
        }
        switch (dtype) {
            case Type$2.Null:
                fn = visitor.visitNull;
                break;
            case Type$2.Bool:
                fn = visitor.visitBool;
                break;
            case Type$2.Int:
                fn = visitor.visitInt;
                break;
            case Type$2.Int8:
                fn = visitor.visitInt8 || visitor.visitInt;
                break;
            case Type$2.Int16:
                fn = visitor.visitInt16 || visitor.visitInt;
                break;
            case Type$2.Int32:
                fn = visitor.visitInt32 || visitor.visitInt;
                break;
            case Type$2.Int64:
                fn = visitor.visitInt64 || visitor.visitInt;
                break;
            case Type$2.Uint8:
                fn = visitor.visitUint8 || visitor.visitInt;
                break;
            case Type$2.Uint16:
                fn = visitor.visitUint16 || visitor.visitInt;
                break;
            case Type$2.Uint32:
                fn = visitor.visitUint32 || visitor.visitInt;
                break;
            case Type$2.Uint64:
                fn = visitor.visitUint64 || visitor.visitInt;
                break;
            case Type$2.Float:
                fn = visitor.visitFloat;
                break;
            case Type$2.Float16:
                fn = visitor.visitFloat16 || visitor.visitFloat;
                break;
            case Type$2.Float32:
                fn = visitor.visitFloat32 || visitor.visitFloat;
                break;
            case Type$2.Float64:
                fn = visitor.visitFloat64 || visitor.visitFloat;
                break;
            case Type$2.Utf8:
                fn = visitor.visitUtf8;
                break;
            case Type$2.Binary:
                fn = visitor.visitBinary;
                break;
            case Type$2.FixedSizeBinary:
                fn = visitor.visitFixedSizeBinary;
                break;
            case Type$2.Date:
                fn = visitor.visitDate;
                break;
            case Type$2.DateDay:
                fn = visitor.visitDateDay || visitor.visitDate;
                break;
            case Type$2.DateMillisecond:
                fn = visitor.visitDateMillisecond || visitor.visitDate;
                break;
            case Type$2.Timestamp:
                fn = visitor.visitTimestamp;
                break;
            case Type$2.TimestampSecond:
                fn = visitor.visitTimestampSecond || visitor.visitTimestamp;
                break;
            case Type$2.TimestampMillisecond:
                fn = visitor.visitTimestampMillisecond || visitor.visitTimestamp;
                break;
            case Type$2.TimestampMicrosecond:
                fn = visitor.visitTimestampMicrosecond || visitor.visitTimestamp;
                break;
            case Type$2.TimestampNanosecond:
                fn = visitor.visitTimestampNanosecond || visitor.visitTimestamp;
                break;
            case Type$2.Time:
                fn = visitor.visitTime;
                break;
            case Type$2.TimeSecond:
                fn = visitor.visitTimeSecond || visitor.visitTime;
                break;
            case Type$2.TimeMillisecond:
                fn = visitor.visitTimeMillisecond || visitor.visitTime;
                break;
            case Type$2.TimeMicrosecond:
                fn = visitor.visitTimeMicrosecond || visitor.visitTime;
                break;
            case Type$2.TimeNanosecond:
                fn = visitor.visitTimeNanosecond || visitor.visitTime;
                break;
            case Type$2.Decimal:
                fn = visitor.visitDecimal;
                break;
            case Type$2.List:
                fn = visitor.visitList;
                break;
            case Type$2.Struct:
                fn = visitor.visitStruct;
                break;
            case Type$2.Union:
                fn = visitor.visitUnion;
                break;
            case Type$2.DenseUnion:
                fn = visitor.visitDenseUnion || visitor.visitUnion;
                break;
            case Type$2.SparseUnion:
                fn = visitor.visitSparseUnion || visitor.visitUnion;
                break;
            case Type$2.Dictionary:
                fn = visitor.visitDictionary;
                break;
            case Type$2.Interval:
                fn = visitor.visitInterval;
                break;
            case Type$2.IntervalDayTime:
                fn = visitor.visitIntervalDayTime || visitor.visitInterval;
                break;
            case Type$2.IntervalYearMonth:
                fn = visitor.visitIntervalYearMonth || visitor.visitInterval;
                break;
            case Type$2.FixedSizeList:
                fn = visitor.visitFixedSizeList;
                break;
            case Type$2.Map:
                fn = visitor.visitMap;
                break;
        }
        if (typeof fn === 'function')
            return fn;
        if (!throwIfNotFound)
            return () => null;
        throw new Error(`Unrecognized type '${Type$2[dtype]}'`);
    }
    /** @ignore */
    function inferDType(type) {
        switch (type.typeId) {
            case Type$2.Null: return Type$2.Null;
            case Type$2.Int:
                const { bitWidth, isSigned } = type;
                switch (bitWidth) {
                    case 8: return isSigned ? Type$2.Int8 : Type$2.Uint8;
                    case 16: return isSigned ? Type$2.Int16 : Type$2.Uint16;
                    case 32: return isSigned ? Type$2.Int32 : Type$2.Uint32;
                    case 64: return isSigned ? Type$2.Int64 : Type$2.Uint64;
                }
                // @ts-ignore
                return Type$2.Int;
            case Type$2.Float:
                switch (type.precision) {
                    case Precision.HALF: return Type$2.Float16;
                    case Precision.SINGLE: return Type$2.Float32;
                    case Precision.DOUBLE: return Type$2.Float64;
                }
                // @ts-ignore
                return Type$2.Float;
            case Type$2.Binary: return Type$2.Binary;
            case Type$2.Utf8: return Type$2.Utf8;
            case Type$2.Bool: return Type$2.Bool;
            case Type$2.Decimal: return Type$2.Decimal;
            case Type$2.Time:
                switch (type.unit) {
                    case TimeUnit.SECOND: return Type$2.TimeSecond;
                    case TimeUnit.MILLISECOND: return Type$2.TimeMillisecond;
                    case TimeUnit.MICROSECOND: return Type$2.TimeMicrosecond;
                    case TimeUnit.NANOSECOND: return Type$2.TimeNanosecond;
                }
                // @ts-ignore
                return Type$2.Time;
            case Type$2.Timestamp:
                switch (type.unit) {
                    case TimeUnit.SECOND: return Type$2.TimestampSecond;
                    case TimeUnit.MILLISECOND: return Type$2.TimestampMillisecond;
                    case TimeUnit.MICROSECOND: return Type$2.TimestampMicrosecond;
                    case TimeUnit.NANOSECOND: return Type$2.TimestampNanosecond;
                }
                // @ts-ignore
                return Type$2.Timestamp;
            case Type$2.Date:
                switch (type.unit) {
                    case DateUnit.DAY: return Type$2.DateDay;
                    case DateUnit.MILLISECOND: return Type$2.DateMillisecond;
                }
                // @ts-ignore
                return Type$2.Date;
            case Type$2.Interval:
                switch (type.unit) {
                    case IntervalUnit.DAY_TIME: return Type$2.IntervalDayTime;
                    case IntervalUnit.YEAR_MONTH: return Type$2.IntervalYearMonth;
                }
                // @ts-ignore
                return Type$2.Interval;
            case Type$2.Map: return Type$2.Map;
            case Type$2.List: return Type$2.List;
            case Type$2.Struct: return Type$2.Struct;
            case Type$2.Union:
                switch (type.mode) {
                    case UnionMode.Dense: return Type$2.DenseUnion;
                    case UnionMode.Sparse: return Type$2.SparseUnion;
                }
                // @ts-ignore
                return Type$2.Union;
            case Type$2.FixedSizeBinary: return Type$2.FixedSizeBinary;
            case Type$2.FixedSizeList: return Type$2.FixedSizeList;
            case Type$2.Dictionary: return Type$2.Dictionary;
        }
        throw new Error(`Unrecognized type '${Type$2[type.typeId]}'`);
    }
    // Add these here so they're picked up by the externs creator
    // in the build, and closure-compiler doesn't minify them away
    Visitor.prototype.visitInt8 = null;
    Visitor.prototype.visitInt16 = null;
    Visitor.prototype.visitInt32 = null;
    Visitor.prototype.visitInt64 = null;
    Visitor.prototype.visitUint8 = null;
    Visitor.prototype.visitUint16 = null;
    Visitor.prototype.visitUint32 = null;
    Visitor.prototype.visitUint64 = null;
    Visitor.prototype.visitFloat16 = null;
    Visitor.prototype.visitFloat32 = null;
    Visitor.prototype.visitFloat64 = null;
    Visitor.prototype.visitDateDay = null;
    Visitor.prototype.visitDateMillisecond = null;
    Visitor.prototype.visitTimestampSecond = null;
    Visitor.prototype.visitTimestampMillisecond = null;
    Visitor.prototype.visitTimestampMicrosecond = null;
    Visitor.prototype.visitTimestampNanosecond = null;
    Visitor.prototype.visitTimeSecond = null;
    Visitor.prototype.visitTimeMillisecond = null;
    Visitor.prototype.visitTimeMicrosecond = null;
    Visitor.prototype.visitTimeNanosecond = null;
    Visitor.prototype.visitDenseUnion = null;
    Visitor.prototype.visitSparseUnion = null;
    Visitor.prototype.visitIntervalDayTime = null;
    Visitor.prototype.visitIntervalYearMonth = null;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class TypeComparator extends Visitor {
        compareSchemas(schema, other) {
            return (schema === other) || (other instanceof schema.constructor &&
                instance$g.compareFields(schema.fields, other.fields));
        }
        compareFields(fields, others) {
            return (fields === others) || (Array.isArray(fields) &&
                Array.isArray(others) &&
                fields.length === others.length &&
                fields.every((f, i) => instance$g.compareField(f, others[i])));
        }
        compareField(field, other) {
            return (field === other) || (other instanceof field.constructor &&
                field.name === other.name &&
                field.nullable === other.nullable &&
                instance$g.visit(field.type, other.type));
        }
    }
    function compareConstructor(type, other) {
        return other instanceof type.constructor;
    }
    function compareAny(type, other) {
        return (type === other) || compareConstructor(type, other);
    }
    function compareInt(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.bitWidth === other.bitWidth &&
            type.isSigned === other.isSigned);
    }
    function compareFloat(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.precision === other.precision);
    }
    function compareFixedSizeBinary(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.byteWidth === other.byteWidth);
    }
    function compareDate(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.unit === other.unit);
    }
    function compareTimestamp(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.unit === other.unit &&
            type.timezone === other.timezone);
    }
    function compareTime(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.unit === other.unit &&
            type.bitWidth === other.bitWidth);
    }
    function compareList(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.children.length === other.children.length &&
            instance$g.compareFields(type.children, other.children));
    }
    function compareStruct(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.children.length === other.children.length &&
            instance$g.compareFields(type.children, other.children));
    }
    function compareUnion(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.mode === other.mode &&
            type.typeIds.every((x, i) => x === other.typeIds[i]) &&
            instance$g.compareFields(type.children, other.children));
    }
    function compareDictionary(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.id === other.id &&
            type.isOrdered === other.isOrdered &&
            instance$g.visit(type.indices, other.indices) &&
            instance$g.visit(type.dictionary, other.dictionary));
    }
    function compareInterval(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.unit === other.unit);
    }
    function compareFixedSizeList(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.listSize === other.listSize &&
            type.children.length === other.children.length &&
            instance$g.compareFields(type.children, other.children));
    }
    function compareMap(type, other) {
        return (type === other) || (compareConstructor(type, other) &&
            type.keysSorted === other.keysSorted &&
            type.children.length === other.children.length &&
            instance$g.compareFields(type.children, other.children));
    }
    TypeComparator.prototype.visitNull = compareAny;
    TypeComparator.prototype.visitBool = compareAny;
    TypeComparator.prototype.visitInt = compareInt;
    TypeComparator.prototype.visitInt8 = compareInt;
    TypeComparator.prototype.visitInt16 = compareInt;
    TypeComparator.prototype.visitInt32 = compareInt;
    TypeComparator.prototype.visitInt64 = compareInt;
    TypeComparator.prototype.visitUint8 = compareInt;
    TypeComparator.prototype.visitUint16 = compareInt;
    TypeComparator.prototype.visitUint32 = compareInt;
    TypeComparator.prototype.visitUint64 = compareInt;
    TypeComparator.prototype.visitFloat = compareFloat;
    TypeComparator.prototype.visitFloat16 = compareFloat;
    TypeComparator.prototype.visitFloat32 = compareFloat;
    TypeComparator.prototype.visitFloat64 = compareFloat;
    TypeComparator.prototype.visitUtf8 = compareAny;
    TypeComparator.prototype.visitBinary = compareAny;
    TypeComparator.prototype.visitFixedSizeBinary = compareFixedSizeBinary;
    TypeComparator.prototype.visitDate = compareDate;
    TypeComparator.prototype.visitDateDay = compareDate;
    TypeComparator.prototype.visitDateMillisecond = compareDate;
    TypeComparator.prototype.visitTimestamp = compareTimestamp;
    TypeComparator.prototype.visitTimestampSecond = compareTimestamp;
    TypeComparator.prototype.visitTimestampMillisecond = compareTimestamp;
    TypeComparator.prototype.visitTimestampMicrosecond = compareTimestamp;
    TypeComparator.prototype.visitTimestampNanosecond = compareTimestamp;
    TypeComparator.prototype.visitTime = compareTime;
    TypeComparator.prototype.visitTimeSecond = compareTime;
    TypeComparator.prototype.visitTimeMillisecond = compareTime;
    TypeComparator.prototype.visitTimeMicrosecond = compareTime;
    TypeComparator.prototype.visitTimeNanosecond = compareTime;
    TypeComparator.prototype.visitDecimal = compareAny;
    TypeComparator.prototype.visitList = compareList;
    TypeComparator.prototype.visitStruct = compareStruct;
    TypeComparator.prototype.visitUnion = compareUnion;
    TypeComparator.prototype.visitDenseUnion = compareUnion;
    TypeComparator.prototype.visitSparseUnion = compareUnion;
    TypeComparator.prototype.visitDictionary = compareDictionary;
    TypeComparator.prototype.visitInterval = compareInterval;
    TypeComparator.prototype.visitIntervalDayTime = compareInterval;
    TypeComparator.prototype.visitIntervalYearMonth = compareInterval;
    TypeComparator.prototype.visitFixedSizeList = compareFixedSizeList;
    TypeComparator.prototype.visitMap = compareMap;
    /** @ignore */
    const instance$g = new TypeComparator();

    // Licensed to the Apache Software Foundation (ASF) under one
    /**
     * An abstract base class for classes that encapsulate metadata about each of
     * the logical types that Arrow can represent.
     */
    class DataType {
        /** @nocollapse */ static isNull(x) { return x && x.typeId === Type$2.Null; }
        /** @nocollapse */ static isInt(x) { return x && x.typeId === Type$2.Int; }
        /** @nocollapse */ static isFloat(x) { return x && x.typeId === Type$2.Float; }
        /** @nocollapse */ static isBinary(x) { return x && x.typeId === Type$2.Binary; }
        /** @nocollapse */ static isUtf8(x) { return x && x.typeId === Type$2.Utf8; }
        /** @nocollapse */ static isBool(x) { return x && x.typeId === Type$2.Bool; }
        /** @nocollapse */ static isDecimal(x) { return x && x.typeId === Type$2.Decimal; }
        /** @nocollapse */ static isDate(x) { return x && x.typeId === Type$2.Date; }
        /** @nocollapse */ static isTime(x) { return x && x.typeId === Type$2.Time; }
        /** @nocollapse */ static isTimestamp(x) { return x && x.typeId === Type$2.Timestamp; }
        /** @nocollapse */ static isInterval(x) { return x && x.typeId === Type$2.Interval; }
        /** @nocollapse */ static isList(x) { return x && x.typeId === Type$2.List; }
        /** @nocollapse */ static isStruct(x) { return x && x.typeId === Type$2.Struct; }
        /** @nocollapse */ static isUnion(x) { return x && x.typeId === Type$2.Union; }
        /** @nocollapse */ static isFixedSizeBinary(x) { return x && x.typeId === Type$2.FixedSizeBinary; }
        /** @nocollapse */ static isFixedSizeList(x) { return x && x.typeId === Type$2.FixedSizeList; }
        /** @nocollapse */ static isMap(x) { return x && x.typeId === Type$2.Map; }
        /** @nocollapse */ static isDictionary(x) { return x && x.typeId === Type$2.Dictionary; }
        get typeId() { return Type$2.NONE; }
        compareTo(other) {
            return instance$g.visit(this, other);
        }
    }
    DataType[Symbol.toStringTag] = ((proto) => {
        proto.children = null;
        proto.ArrayType = Array;
        return proto[Symbol.toStringTag] = 'DataType';
    })(DataType.prototype);
    /** @ignore */
    class Null$1 extends DataType {
        toString() { return `Null`; }
        get typeId() { return Type$2.Null; }
    }
    Null$1[Symbol.toStringTag] = ((proto) => {
        return proto[Symbol.toStringTag] = 'Null';
    })(Null$1.prototype);
    /** @ignore */
    class Int_ extends DataType {
        constructor(isSigned, bitWidth) {
            super();
            this.isSigned = isSigned;
            this.bitWidth = bitWidth;
        }
        get typeId() { return Type$2.Int; }
        get ArrayType() {
            switch (this.bitWidth) {
                case 8: return this.isSigned ? Int8Array : Uint8Array;
                case 16: return this.isSigned ? Int16Array : Uint16Array;
                case 32: return this.isSigned ? Int32Array : Uint32Array;
                case 64: return this.isSigned ? Int32Array : Uint32Array;
            }
            throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
        }
        toString() { return `${this.isSigned ? `I` : `Ui`}nt${this.bitWidth}`; }
    }
    Int_[Symbol.toStringTag] = ((proto) => {
        proto.isSigned = null;
        proto.bitWidth = null;
        return proto[Symbol.toStringTag] = 'Int';
    })(Int_.prototype);
    /** @ignore */
    class Int8 extends Int_ {
        constructor() { super(true, 8); }
    }
    /** @ignore */
    class Int16 extends Int_ {
        constructor() { super(true, 16); }
    }
    /** @ignore */
    class Int32 extends Int_ {
        constructor() { super(true, 32); }
    }
    /** @ignore */
    class Int64$1 extends Int_ {
        constructor() { super(true, 64); }
    }
    /** @ignore */
    class Uint8 extends Int_ {
        constructor() { super(false, 8); }
    }
    /** @ignore */
    class Uint16 extends Int_ {
        constructor() { super(false, 16); }
    }
    /** @ignore */
    class Uint32 extends Int_ {
        constructor() { super(false, 32); }
    }
    /** @ignore */
    class Uint64$1 extends Int_ {
        constructor() { super(false, 64); }
    }
    Object.defineProperty(Int8.prototype, 'ArrayType', { value: Int8Array });
    Object.defineProperty(Int16.prototype, 'ArrayType', { value: Int16Array });
    Object.defineProperty(Int32.prototype, 'ArrayType', { value: Int32Array });
    Object.defineProperty(Int64$1.prototype, 'ArrayType', { value: Int32Array });
    Object.defineProperty(Uint8.prototype, 'ArrayType', { value: Uint8Array });
    Object.defineProperty(Uint16.prototype, 'ArrayType', { value: Uint16Array });
    Object.defineProperty(Uint32.prototype, 'ArrayType', { value: Uint32Array });
    Object.defineProperty(Uint64$1.prototype, 'ArrayType', { value: Uint32Array });
    /** @ignore */
    class Float extends DataType {
        constructor(precision) {
            super();
            this.precision = precision;
        }
        get typeId() { return Type$2.Float; }
        get ArrayType() {
            switch (this.precision) {
                case Precision.HALF: return Uint16Array;
                case Precision.SINGLE: return Float32Array;
                case Precision.DOUBLE: return Float64Array;
            }
            // @ts-ignore
            throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
        }
        toString() { return `Float${(this.precision << 5) || 16}`; }
    }
    Float[Symbol.toStringTag] = ((proto) => {
        proto.precision = null;
        return proto[Symbol.toStringTag] = 'Float';
    })(Float.prototype);
    /** @ignore */
    class Float16 extends Float {
        constructor() { super(Precision.HALF); }
    }
    /** @ignore */
    class Float32 extends Float {
        constructor() { super(Precision.SINGLE); }
    }
    /** @ignore */
    class Float64 extends Float {
        constructor() { super(Precision.DOUBLE); }
    }
    Object.defineProperty(Float16.prototype, 'ArrayType', { value: Uint16Array });
    Object.defineProperty(Float32.prototype, 'ArrayType', { value: Float32Array });
    Object.defineProperty(Float64.prototype, 'ArrayType', { value: Float64Array });
    /** @ignore */
    class Binary$1 extends DataType {
        constructor() {
            super();
        }
        get typeId() { return Type$2.Binary; }
        toString() { return `Binary`; }
    }
    Binary$1[Symbol.toStringTag] = ((proto) => {
        proto.ArrayType = Uint8Array;
        return proto[Symbol.toStringTag] = 'Binary';
    })(Binary$1.prototype);
    /** @ignore */
    class Utf8$1 extends DataType {
        constructor() {
            super();
        }
        get typeId() { return Type$2.Utf8; }
        toString() { return `Utf8`; }
    }
    Utf8$1[Symbol.toStringTag] = ((proto) => {
        proto.ArrayType = Uint8Array;
        return proto[Symbol.toStringTag] = 'Utf8';
    })(Utf8$1.prototype);
    /** @ignore */
    class Bool$1 extends DataType {
        constructor() {
            super();
        }
        get typeId() { return Type$2.Bool; }
        toString() { return `Bool`; }
    }
    Bool$1[Symbol.toStringTag] = ((proto) => {
        proto.ArrayType = Uint8Array;
        return proto[Symbol.toStringTag] = 'Bool';
    })(Bool$1.prototype);
    /** @ignore */
    class Decimal$1 extends DataType {
        constructor(scale, precision) {
            super();
            this.scale = scale;
            this.precision = precision;
        }
        get typeId() { return Type$2.Decimal; }
        toString() { return `Decimal[${this.precision}e${this.scale > 0 ? `+` : ``}${this.scale}]`; }
    }
    Decimal$1[Symbol.toStringTag] = ((proto) => {
        proto.scale = null;
        proto.precision = null;
        proto.ArrayType = Uint32Array;
        return proto[Symbol.toStringTag] = 'Decimal';
    })(Decimal$1.prototype);
    /** @ignore */
    class Date_ extends DataType {
        constructor(unit) {
            super();
            this.unit = unit;
        }
        get typeId() { return Type$2.Date; }
        toString() { return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`; }
    }
    Date_[Symbol.toStringTag] = ((proto) => {
        proto.unit = null;
        proto.ArrayType = Int32Array;
        return proto[Symbol.toStringTag] = 'Date';
    })(Date_.prototype);
    /** @ignore */
    class DateDay extends Date_ {
        constructor() { super(DateUnit.DAY); }
    }
    /** @ignore */
    class DateMillisecond extends Date_ {
        constructor() { super(DateUnit.MILLISECOND); }
    }
    /** @ignore */
    class Time_ extends DataType {
        constructor(unit, bitWidth) {
            super();
            this.unit = unit;
            this.bitWidth = bitWidth;
        }
        get typeId() { return Type$2.Time; }
        toString() { return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`; }
    }
    Time_[Symbol.toStringTag] = ((proto) => {
        proto.unit = null;
        proto.bitWidth = null;
        proto.ArrayType = Int32Array;
        return proto[Symbol.toStringTag] = 'Time';
    })(Time_.prototype);
    /** @ignore */
    class TimeSecond extends Time_ {
        constructor() { super(TimeUnit.SECOND, 32); }
    }
    /** @ignore */
    class TimeMillisecond extends Time_ {
        constructor() { super(TimeUnit.MILLISECOND, 32); }
    }
    /** @ignore */
    class TimeMicrosecond extends Time_ {
        constructor() { super(TimeUnit.MICROSECOND, 64); }
    }
    /** @ignore */
    class TimeNanosecond extends Time_ {
        constructor() { super(TimeUnit.NANOSECOND, 64); }
    }
    /** @ignore */
    class Timestamp_ extends DataType {
        constructor(unit, timezone) {
            super();
            this.unit = unit;
            this.timezone = timezone;
        }
        get typeId() { return Type$2.Timestamp; }
        toString() { return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ``}>`; }
    }
    Timestamp_[Symbol.toStringTag] = ((proto) => {
        proto.unit = null;
        proto.timezone = null;
        proto.ArrayType = Int32Array;
        return proto[Symbol.toStringTag] = 'Timestamp';
    })(Timestamp_.prototype);
    /** @ignore */
    class Interval_ extends DataType {
        constructor(unit) {
            super();
            this.unit = unit;
        }
        get typeId() { return Type$2.Interval; }
        toString() { return `Interval<${IntervalUnit[this.unit]}>`; }
    }
    Interval_[Symbol.toStringTag] = ((proto) => {
        proto.unit = null;
        proto.ArrayType = Int32Array;
        return proto[Symbol.toStringTag] = 'Interval';
    })(Interval_.prototype);
    /** @ignore */
    class IntervalDayTime extends Interval_ {
        constructor() { super(IntervalUnit.DAY_TIME); }
    }
    /** @ignore */
    class IntervalYearMonth extends Interval_ {
        constructor() { super(IntervalUnit.YEAR_MONTH); }
    }
    /** @ignore */
    class List$1 extends DataType {
        constructor(child) {
            super();
            this.children = [child];
        }
        get typeId() { return Type$2.List; }
        toString() { return `List<${this.valueType}>`; }
        get valueType() { return this.children[0].type; }
        get valueField() { return this.children[0]; }
        get ArrayType() { return this.valueType.ArrayType; }
    }
    List$1[Symbol.toStringTag] = ((proto) => {
        proto.children = null;
        return proto[Symbol.toStringTag] = 'List';
    })(List$1.prototype);
    /** @ignore */
    class Struct$1 extends DataType {
        constructor(children) {
            super();
            this.children = children;
        }
        get typeId() { return Type$2.Struct; }
        toString() { return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`; }
    }
    Struct$1[Symbol.toStringTag] = ((proto) => {
        proto.children = null;
        return proto[Symbol.toStringTag] = 'Struct';
    })(Struct$1.prototype);
    /** @ignore */
    class Union_ extends DataType {
        constructor(mode, typeIds, children) {
            super();
            this.mode = mode;
            this.children = children;
            this.typeIds = typeIds = Int32Array.from(typeIds);
            this.typeIdToChildIndex = typeIds.reduce((typeIdToChildIndex, typeId, idx) => {
                return (typeIdToChildIndex[typeId] = idx) && typeIdToChildIndex || typeIdToChildIndex;
            }, Object.create(null));
        }
        get typeId() { return Type$2.Union; }
        toString() {
            return `${this[Symbol.toStringTag]}<${this.children.map((x) => `${x.type}`).join(` | `)}>`;
        }
    }
    Union_[Symbol.toStringTag] = ((proto) => {
        proto.mode = null;
        proto.typeIds = null;
        proto.children = null;
        proto.typeIdToChildIndex = null;
        proto.ArrayType = Int8Array;
        return proto[Symbol.toStringTag] = 'Union';
    })(Union_.prototype);
    /** @ignore */
    class FixedSizeBinary$1 extends DataType {
        constructor(byteWidth) {
            super();
            this.byteWidth = byteWidth;
        }
        get typeId() { return Type$2.FixedSizeBinary; }
        toString() { return `FixedSizeBinary[${this.byteWidth}]`; }
    }
    FixedSizeBinary$1[Symbol.toStringTag] = ((proto) => {
        proto.byteWidth = null;
        proto.ArrayType = Uint8Array;
        return proto[Symbol.toStringTag] = 'FixedSizeBinary';
    })(FixedSizeBinary$1.prototype);
    /** @ignore */
    class FixedSizeList$1 extends DataType {
        constructor(listSize, child) {
            super();
            this.listSize = listSize;
            this.children = [child];
        }
        get typeId() { return Type$2.FixedSizeList; }
        get valueType() { return this.children[0].type; }
        get valueField() { return this.children[0]; }
        get ArrayType() { return this.valueType.ArrayType; }
        toString() { return `FixedSizeList[${this.listSize}]<${this.valueType}>`; }
    }
    FixedSizeList$1[Symbol.toStringTag] = ((proto) => {
        proto.children = null;
        proto.listSize = null;
        return proto[Symbol.toStringTag] = 'FixedSizeList';
    })(FixedSizeList$1.prototype);
    /** @ignore */
    class Map_$1 extends DataType {
        constructor(child, keysSorted = false) {
            super();
            this.children = [child];
            this.keysSorted = keysSorted;
        }
        get typeId() { return Type$2.Map; }
        get keyType() { return this.children[0].type.children[0].type; }
        get valueType() { return this.children[0].type.children[1].type; }
        toString() { return `Map<{${this.children[0].type.children.map((f) => `${f.name}:${f.type}`).join(`, `)}}>`; }
    }
    Map_$1[Symbol.toStringTag] = ((proto) => {
        proto.children = null;
        proto.keysSorted = null;
        return proto[Symbol.toStringTag] = 'Map_';
    })(Map_$1.prototype);
    /** @ignore */
    const getId = ((atomicDictionaryId) => () => ++atomicDictionaryId)(-1);
    /** @ignore */
    class Dictionary extends DataType {
        constructor(dictionary, indices, id, isOrdered) {
            super();
            this.indices = indices;
            this.dictionary = dictionary;
            this.isOrdered = isOrdered || false;
            this.id = id == null ? getId() : typeof id === 'number' ? id : id.low;
        }
        get typeId() { return Type$2.Dictionary; }
        get children() { return this.dictionary.children; }
        get valueType() { return this.dictionary; }
        get ArrayType() { return this.dictionary.ArrayType; }
        toString() { return `Dictionary<${this.indices}, ${this.dictionary}>`; }
    }
    Dictionary[Symbol.toStringTag] = ((proto) => {
        proto.id = null;
        proto.indices = null;
        proto.isOrdered = null;
        proto.dictionary = null;
        return proto[Symbol.toStringTag] = 'Dictionary';
    })(Dictionary.prototype);
    /** @ignore */
    function strideForType(type) {
        let t = type;
        switch (type.typeId) {
            case Type$2.Decimal: return 4;
            case Type$2.Timestamp: return 2;
            case Type$2.Date: return 1 + t.unit;
            case Type$2.Interval: return 1 + t.unit;
            case Type$2.Int: return 1 + +(t.bitWidth > 32);
            case Type$2.Time: return 1 + +(t.bitWidth > 32);
            case Type$2.FixedSizeList: return t.listSize;
            case Type$2.FixedSizeBinary: return t.byteWidth;
            default: return 1;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */ const kUnknownNullCount = -1;
    /** @ignore */
    class Data {
        constructor(type, offset, length, nullCount, buffers, childData, dictionary) {
            this.type = type;
            this.dictionary = dictionary;
            this.offset = Math.floor(Math.max(offset || 0, 0));
            this.length = Math.floor(Math.max(length || 0, 0));
            this._nullCount = Math.floor(Math.max(nullCount || 0, -1));
            this.childData = (childData || []).map((x) => x instanceof Data ? x : x.data);
            let buffer;
            if (buffers instanceof Data) {
                this.stride = buffers.stride;
                this.values = buffers.values;
                this.typeIds = buffers.typeIds;
                this.nullBitmap = buffers.nullBitmap;
                this.valueOffsets = buffers.valueOffsets;
            }
            else {
                this.stride = strideForType(type);
                if (buffers) {
                    (buffer = buffers[0]) && (this.valueOffsets = buffer);
                    (buffer = buffers[1]) && (this.values = buffer);
                    (buffer = buffers[2]) && (this.nullBitmap = buffer);
                    (buffer = buffers[3]) && (this.typeIds = buffer);
                }
            }
        }
        get typeId() { return this.type.typeId; }
        get ArrayType() { return this.type.ArrayType; }
        get buffers() {
            return [this.valueOffsets, this.values, this.nullBitmap, this.typeIds];
        }
        get byteLength() {
            let byteLength = 0;
            let { valueOffsets, values, nullBitmap, typeIds } = this;
            valueOffsets && (byteLength += valueOffsets.byteLength);
            values && (byteLength += values.byteLength);
            nullBitmap && (byteLength += nullBitmap.byteLength);
            typeIds && (byteLength += typeIds.byteLength);
            return this.childData.reduce((byteLength, child) => byteLength + child.byteLength, byteLength);
        }
        get nullCount() {
            let nullCount = this._nullCount;
            let nullBitmap;
            if (nullCount <= kUnknownNullCount && (nullBitmap = this.nullBitmap)) {
                this._nullCount = nullCount = this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
            }
            return nullCount;
        }
        clone(type, offset = this.offset, length = this.length, nullCount = this._nullCount, buffers = this, childData = this.childData) {
            return new Data(type, offset, length, nullCount, buffers, childData, this.dictionary);
        }
        slice(offset, length) {
            const { stride, typeId, childData } = this;
            // +true === 1, +false === 0, so this means
            // we keep nullCount at 0 if it's already 0,
            // otherwise set to the invalidated flag -1
            const nullCount = +(this._nullCount === 0) - 1;
            const childStride = typeId === 16 /* FixedSizeList */ ? stride : 1;
            const buffers = this._sliceBuffers(offset, length, stride, typeId);
            return this.clone(this.type, this.offset + offset, length, nullCount, buffers, 
            // Don't slice children if we have value offsets (the variable-width types)
            (!childData.length || this.valueOffsets) ? childData : this._sliceChildren(childData, childStride * offset, childStride * length));
        }
        _changeLengthAndBackfillNullBitmap(newLength) {
            if (this.typeId === Type$2.Null) {
                return this.clone(this.type, 0, newLength, 0);
            }
            const { length, nullCount } = this;
            // start initialized with 0s (nulls), then fill from 0 to length with 1s (not null)
            const bitmap = new Uint8Array(((newLength + 63) & ~63) >> 3).fill(255, 0, length >> 3);
            // set all the bits in the last byte (up to bit `length - length % 8`) to 1 (not null)
            bitmap[length >> 3] = (1 << (length - (length & ~7))) - 1;
            // if we have a nullBitmap, truncate + slice and set it over the pre-filled 1s
            if (nullCount > 0) {
                bitmap.set(truncateBitmap(this.offset, length, this.nullBitmap), 0);
            }
            const buffers = this.buffers;
            buffers[BufferType.VALIDITY] = bitmap;
            return this.clone(this.type, 0, newLength, nullCount + (newLength - length), buffers);
        }
        _sliceBuffers(offset, length, stride, typeId) {
            let arr, { buffers } = this;
            // If typeIds exist, slice the typeIds buffer
            (arr = buffers[BufferType.TYPE]) && (buffers[BufferType.TYPE] = arr.subarray(offset, offset + length));
            // If offsets exist, only slice the offsets buffer
            (arr = buffers[BufferType.OFFSET]) && (buffers[BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) ||
                // Otherwise if no offsets, slice the data buffer. Don't slice the data vector for Booleans, since the offset goes by bits not bytes
                (arr = buffers[BufferType.DATA]) && (buffers[BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));
            return buffers;
        }
        _sliceChildren(childData, offset, length) {
            return childData.map((child) => child.slice(offset, length));
        }
        //
        // Convenience methods for creating Data instances for each of the Arrow Vector types
        //
        /** @nocollapse */
        static new(type, offset, length, nullCount, buffers, childData, dictionary) {
            if (buffers instanceof Data) {
                buffers = buffers.buffers;
            }
            else if (!buffers) {
                buffers = [];
            }
            switch (type.typeId) {
                case Type$2.Null: return Data.Null(type, offset, length);
                case Type$2.Int: return Data.Int(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Dictionary: return Data.Dictionary(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || [], dictionary);
                case Type$2.Float: return Data.Float(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Bool: return Data.Bool(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Decimal: return Data.Decimal(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Date: return Data.Date(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Time: return Data.Time(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Timestamp: return Data.Timestamp(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Interval: return Data.Interval(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.FixedSizeBinary: return Data.FixedSizeBinary(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.DATA] || []);
                case Type$2.Binary: return Data.Binary(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], buffers[BufferType.DATA] || []);
                case Type$2.Utf8: return Data.Utf8(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], buffers[BufferType.DATA] || []);
                case Type$2.List: return Data.List(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], (childData || [])[0]);
                case Type$2.FixedSizeList: return Data.FixedSizeList(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], (childData || [])[0]);
                case Type$2.Struct: return Data.Struct(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], childData || []);
                case Type$2.Map: return Data.Map(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.OFFSET] || [], (childData || [])[0]);
                case Type$2.Union: return Data.Union(type, offset, length, nullCount || 0, buffers[BufferType.VALIDITY], buffers[BufferType.TYPE] || [], buffers[BufferType.OFFSET] || childData, childData);
            }
            throw new Error(`Unrecognized typeId ${type.typeId}`);
        }
        /** @nocollapse */
        static Null(type, offset, length) {
            return new Data(type, offset, length, 0);
        }
        /** @nocollapse */
        static Int(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Dictionary(type, offset, length, nullCount, nullBitmap, data, dictionary) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.indices.ArrayType, data), toUint8Array(nullBitmap)], [], dictionary);
        }
        /** @nocollapse */
        static Float(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Bool(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Decimal(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Date(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Time(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Timestamp(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Interval(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static FixedSizeBinary(type, offset, length, nullCount, nullBitmap, data) {
            return new Data(type, offset, length, nullCount, [undefined, toArrayBufferView(type.ArrayType, data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Binary(type, offset, length, nullCount, nullBitmap, valueOffsets, data) {
            return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), toUint8Array(data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static Utf8(type, offset, length, nullCount, nullBitmap, valueOffsets, data) {
            return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), toUint8Array(data), toUint8Array(nullBitmap)]);
        }
        /** @nocollapse */
        static List(type, offset, length, nullCount, nullBitmap, valueOffsets, child) {
            return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), undefined, toUint8Array(nullBitmap)], child ? [child] : []);
        }
        /** @nocollapse */
        static FixedSizeList(type, offset, length, nullCount, nullBitmap, child) {
            return new Data(type, offset, length, nullCount, [undefined, undefined, toUint8Array(nullBitmap)], child ? [child] : []);
        }
        /** @nocollapse */
        static Struct(type, offset, length, nullCount, nullBitmap, children) {
            return new Data(type, offset, length, nullCount, [undefined, undefined, toUint8Array(nullBitmap)], children);
        }
        /** @nocollapse */
        static Map(type, offset, length, nullCount, nullBitmap, valueOffsets, child) {
            return new Data(type, offset, length, nullCount, [toInt32Array(valueOffsets), undefined, toUint8Array(nullBitmap)], child ? [child] : []);
        }
        /** @nocollapse */
        static Union(type, offset, length, nullCount, nullBitmap, typeIds, valueOffsetsOrChildren, children) {
            const buffers = [
                undefined, undefined,
                toUint8Array(nullBitmap),
                toArrayBufferView(type.ArrayType, typeIds)
            ];
            if (type.mode === UnionMode.Sparse) {
                return new Data(type, offset, length, nullCount, buffers, valueOffsetsOrChildren);
            }
            buffers[BufferType.OFFSET] = toInt32Array(valueOffsetsOrChildren);
            return new Data(type, offset, length, nullCount, buffers, children);
        }
    }
    Data.prototype.childData = Object.freeze([]);

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    /** @ignore */ const undf = void (0);
    /** @ignore */
    function valueToString(x) {
        if (x === null) {
            return 'null';
        }
        if (x === undf) {
            return 'undefined';
        }
        switch (typeof x) {
            case 'number': return `${x}`;
            case 'bigint': return `${x}`;
            case 'string': return `"${x}"`;
        }
        // If [Symbol.toPrimitive] is implemented (like in BN)
        // use it instead of JSON.stringify(). This ensures we
        // print BigInts, Decimals, and Binary in their native
        // representation
        if (typeof x[Symbol.toPrimitive] === 'function') {
            return x[Symbol.toPrimitive]('string');
        }
        return ArrayBuffer.isView(x) ? `[${x}]` : JSON.stringify(x);
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /**
     * Dynamically compile the null values into an `isValid()` function whose
     * implementation is a switch statement. Microbenchmarks in v8 indicate
     * this approach is 25% faster than using an ES6 Map.
     *
     * @example
     * console.log(createIsValidFunction([null, 'N/A', NaN]));
     * `function (x) {
     *     if (x !== x) return false;
     *     switch (x) {
     *         case null:
     *         case "N/A":
     *             return false;
     *     }
     *     return true;
     * }`
     *
     * @ignore
     * @param nullValues
     */
    function createIsValidFunction(nullValues) {
        if (!nullValues || nullValues.length <= 0) {
            // @ts-ignore
            return function isValid(value) { return true; };
        }
        let fnBody = '';
        let noNaNs = nullValues.filter((x) => x === x);
        if (noNaNs.length > 0) {
            fnBody = `
    switch (x) {${noNaNs.map((x) => `
        case ${valueToCase(x)}:`).join('')}
            return false;
    }`;
        }
        // NaN doesn't equal anything including itself, so it doesn't work as a
        // switch case. Instead we must explicitly check for NaN before the switch.
        if (nullValues.length !== noNaNs.length) {
            fnBody = `if (x !== x) return false;\n${fnBody}`;
        }
        return new Function(`x`, `${fnBody}\nreturn true;`);
    }
    /** @ignore */
    function valueToCase(x) {
        if (typeof x !== 'bigint') {
            return valueToString(x);
        }
        else if (BigIntAvailable) {
            return `${valueToString(x)}n`;
        }
        return `"${valueToString(x)}"`;
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    const roundLengthUpToNearest64Bytes = (len, BPE) => ((((len * BPE) + 63) & ~63) || 64) / BPE;
    /** @ignore */
    const sliceOrExtendArray = (arr, len = 0) => (arr.length >= len ? arr.subarray(0, len) : memcpy(new arr.constructor(len), arr, 0));
    /** @ignore */
    class BufferBuilder {
        constructor(buffer, stride = 1) {
            this.buffer = buffer;
            this.stride = stride;
            this.BYTES_PER_ELEMENT = buffer.BYTES_PER_ELEMENT;
            this.ArrayType = buffer.constructor;
            this._resize(this.length = buffer.length / stride | 0);
        }
        get byteLength() { return this.length * this.stride * this.BYTES_PER_ELEMENT | 0; }
        get reservedLength() { return this.buffer.length / this.stride; }
        get reservedByteLength() { return this.buffer.byteLength; }
        // @ts-ignore
        set(index, value) { return this; }
        append(value) { return this.set(this.length, value); }
        reserve(extra) {
            if (extra > 0) {
                this.length += extra;
                const stride = this.stride;
                const length = this.length * stride;
                const reserved = this.buffer.length;
                if (length >= reserved) {
                    this._resize(reserved === 0
                        ? roundLengthUpToNearest64Bytes(length * 1, this.BYTES_PER_ELEMENT)
                        : roundLengthUpToNearest64Bytes(length * 2, this.BYTES_PER_ELEMENT));
                }
            }
            return this;
        }
        flush(length = this.length) {
            length = roundLengthUpToNearest64Bytes(length * this.stride, this.BYTES_PER_ELEMENT);
            const array = sliceOrExtendArray(this.buffer, length);
            this.clear();
            return array;
        }
        clear() {
            this.length = 0;
            this._resize(0);
            return this;
        }
        _resize(newLength) {
            return this.buffer = memcpy(new this.ArrayType(newLength), this.buffer);
        }
    }
    BufferBuilder.prototype.offset = 0;
    /** @ignore */
    class DataBufferBuilder extends BufferBuilder {
        last() { return this.get(this.length - 1); }
        get(index) { return this.buffer[index]; }
        set(index, value) {
            this.reserve(index - this.length + 1);
            this.buffer[index * this.stride] = value;
            return this;
        }
    }
    /** @ignore */
    class BitmapBufferBuilder extends DataBufferBuilder {
        constructor(data = new Uint8Array(0)) {
            super(data, 1 / 8);
            this.numValid = 0;
        }
        get numInvalid() { return this.length - this.numValid; }
        get(idx) { return this.buffer[idx >> 3] >> idx % 8 & 1; }
        set(idx, val) {
            const { buffer } = this.reserve(idx - this.length + 1);
            const byte = idx >> 3, bit = idx % 8, cur = buffer[byte] >> bit & 1;
            // If `val` is truthy and the current bit is 0, flip it to 1 and increment `numValid`.
            // If `val` is falsey and the current bit is 1, flip it to 0 and decrement `numValid`.
            val ? cur === 0 && ((buffer[byte] |= (1 << bit)), ++this.numValid)
                : cur === 1 && ((buffer[byte] &= ~(1 << bit)), --this.numValid);
            return this;
        }
        clear() {
            this.numValid = 0;
            return super.clear();
        }
    }
    /** @ignore */
    class OffsetsBufferBuilder extends DataBufferBuilder {
        constructor(data = new Int32Array(1)) { super(data, 1); }
        append(value) {
            return this.set(this.length - 1, value);
        }
        set(index, value) {
            const offset = this.length - 1;
            const buffer = this.reserve(index - offset + 1).buffer;
            if (offset < index++) {
                buffer.fill(buffer[offset], offset, index);
            }
            buffer[index] = buffer[index - 1] + value;
            return this;
        }
        flush(length = this.length - 1) {
            if (length > this.length) {
                this.set(length - 1, 0);
            }
            return super.flush(length + 1);
        }
    }
    /** @ignore */
    class WideBufferBuilder extends BufferBuilder {
        get ArrayType64() {
            return this._ArrayType64 || (this._ArrayType64 = (this.buffer instanceof Int32Array ? BigInt64ArrayCtor : BigUint64ArrayCtor));
        }
        set(index, value) {
            this.reserve(index - this.length + 1);
            switch (typeof value) {
                case 'bigint':
                    this.buffer64[index] = value;
                    break;
                case 'number':
                    this.buffer[index * this.stride] = value;
                    break;
                default: this.buffer.set(value, index * this.stride);
            }
            return this;
        }
        _resize(newLength) {
            const data = super._resize(newLength);
            const length = data.byteLength / (this.BYTES_PER_ELEMENT * this.stride);
            if (BigIntAvailable) {
                this.buffer64 = new this.ArrayType64(data.buffer, data.byteOffset, length);
            }
            return data;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /**
     * An abstract base class for types that construct Arrow Vectors from arbitrary JavaScript values.
     *
     * A `Builder` is responsible for writing arbitrary JavaScript values
     * to ArrayBuffers and/or child Builders according to the Arrow specification
     * for each DataType, creating or resizing the underlying ArrayBuffers as necessary.
     *
     * The `Builder` for each Arrow `DataType` handles converting and appending
     * values for a given `DataType`. The high-level {@link Builder.new `Builder.new()`} convenience
     * method creates the specific `Builder` subclass for the supplied `DataType`.
     *
     * Once created, `Builder` instances support both appending values to the end
     * of the `Builder`, and random-access writes to specific indices
     * (`Builder.prototype.append(value)` is a convenience method for
     * `builder.set(builder.length, value)`). Appending or setting values beyond the
     * Builder's current length may cause the builder to grow its underlying buffers
     * or child Builders (if applicable) to accommodate the new values.
     *
     * After enough values have been written to a `Builder`, `Builder.prototype.flush()`
     * will commit the values to the underlying ArrayBuffers (or child Builders). The
     * internal Builder state will be reset, and an instance of `Data<T>` is returned.
     * Alternatively, `Builder.prototype.toVector()` will flush the `Builder` and return
     * an instance of `Vector<T>` instead.
     *
     * When there are no more values to write, use `Builder.prototype.finish()` to
     * finalize the `Builder`. This does not reset the internal state, so it is
     * necessary to call `Builder.prototype.flush()` or `toVector()` one last time
     * if there are still values queued to be flushed.
     *
     * Note: calling `Builder.prototype.finish()` is required when using a `DictionaryBuilder`,
     * because this is when it flushes the values that have been enqueued in its internal
     * dictionary's `Builder`, and creates the `dictionaryVector` for the `Dictionary` `DataType`.
     *
     * ```ts
     * import { Builder, Utf8 } from 'apache-arrow';
     *
     * const utf8Builder = Builder.new({
     *     type: new Utf8(),
     *     nullValues: [null, 'n/a']
     * });
     *
     * utf8Builder
     *     .append('hello')
     *     .append('n/a')
     *     .append('world')
     *     .append(null);
     *
     * const utf8Vector = utf8Builder.finish().toVector();
     *
     * console.log(utf8Vector.toJSON());
     * // > ["hello", null, "world", null]
     * ```
     *
     * @typeparam T The `DataType` of this `Builder`.
     * @typeparam TNull The type(s) of values which will be considered null-value sentinels.
     */
    class Builder$2 {
        /**
         * Construct a builder with the given Arrow DataType with optional null values,
         * which will be interpreted as "null" when set or appended to the `Builder`.
         * @param {{ type: T, nullValues?: any[] }} options A `BuilderOptions` object used to create this `Builder`.
         */
        constructor({ 'type': type, 'nullValues': nulls }) {
            /**
             * The number of values written to the `Builder` that haven't been flushed yet.
             * @readonly
             */
            this.length = 0;
            /**
             * A boolean indicating whether `Builder.prototype.finish()` has been called on this `Builder`.
             * @readonly
             */
            this.finished = false;
            this.type = type;
            this.children = [];
            this.nullValues = nulls;
            this.stride = strideForType(type);
            this._nulls = new BitmapBufferBuilder();
            if (nulls && nulls.length > 0) {
                this._isValid = createIsValidFunction(nulls);
            }
        }
        /**
         * Create a `Builder` instance based on the `type` property of the supplied `options` object.
         * @param {BuilderOptions<T, TNull>} options An object with a required `DataType` instance
         * and other optional parameters to be passed to the `Builder` subclass for the given `type`.
         *
         * @typeparam T The `DataType` of the `Builder` to create.
         * @typeparam TNull The type(s) of values which will be considered null-value sentinels.
         * @nocollapse
         */
        // @ts-ignore
        static new(options) { }
        /** @nocollapse */
        // @ts-ignore
        static throughNode(options) {
            throw new Error(`"throughNode" not available in this environment`);
        }
        /** @nocollapse */
        // @ts-ignore
        static throughDOM(options) {
            throw new Error(`"throughDOM" not available in this environment`);
        }
        /**
         * Transform a synchronous `Iterable` of arbitrary JavaScript values into a
         * sequence of Arrow Vector<T> following the chunking semantics defined in
         * the supplied `options` argument.
         *
         * This function returns a function that accepts an `Iterable` of values to
         * transform. When called, this function returns an Iterator of `Vector<T>`.
         *
         * The resulting `Iterator<Vector<T>>` yields Vectors based on the
         * `queueingStrategy` and `highWaterMark` specified in the `options` argument.
         *
         * * If `queueingStrategy` is `"count"` (or omitted), The `Iterator<Vector<T>>`
         *   will flush the underlying `Builder` (and yield a new `Vector<T>`) once the
         *   Builder's `length` reaches or exceeds the supplied `highWaterMark`.
         * * If `queueingStrategy` is `"bytes"`, the `Iterator<Vector<T>>` will flush
         *   the underlying `Builder` (and yield a new `Vector<T>`) once its `byteLength`
         *   reaches or exceeds the supplied `highWaterMark`.
         *
         * @param {IterableBuilderOptions<T, TNull>} options An object of properties which determine the `Builder` to create and the chunking semantics to use.
         * @returns A function which accepts a JavaScript `Iterable` of values to
         *          write, and returns an `Iterator` that yields Vectors according
         *          to the chunking semantics defined in the `options` argument.
         * @nocollapse
         */
        static throughIterable(options) {
            return throughIterable(options);
        }
        /**
         * Transform an `AsyncIterable` of arbitrary JavaScript values into a
         * sequence of Arrow Vector<T> following the chunking semantics defined in
         * the supplied `options` argument.
         *
         * This function returns a function that accepts an `AsyncIterable` of values to
         * transform. When called, this function returns an AsyncIterator of `Vector<T>`.
         *
         * The resulting `AsyncIterator<Vector<T>>` yields Vectors based on the
         * `queueingStrategy` and `highWaterMark` specified in the `options` argument.
         *
         * * If `queueingStrategy` is `"count"` (or omitted), The `AsyncIterator<Vector<T>>`
         *   will flush the underlying `Builder` (and yield a new `Vector<T>`) once the
         *   Builder's `length` reaches or exceeds the supplied `highWaterMark`.
         * * If `queueingStrategy` is `"bytes"`, the `AsyncIterator<Vector<T>>` will flush
         *   the underlying `Builder` (and yield a new `Vector<T>`) once its `byteLength`
         *   reaches or exceeds the supplied `highWaterMark`.
         *
         * @param {IterableBuilderOptions<T, TNull>} options An object of properties which determine the `Builder` to create and the chunking semantics to use.
         * @returns A function which accepts a JavaScript `AsyncIterable` of values
         *          to write, and returns an `AsyncIterator` that yields Vectors
         *          according to the chunking semantics defined in the `options`
         *          argument.
         * @nocollapse
         */
        static throughAsyncIterable(options) {
            return throughAsyncIterable(options);
        }
        /**
         * Flush the `Builder` and return a `Vector<T>`.
         * @returns {Vector<T>} A `Vector<T>` of the flushed values.
         */
        toVector() { return AbstractVector.new(this.flush()); }
        get ArrayType() { return this.type.ArrayType; }
        get nullCount() { return this._nulls.numInvalid; }
        get numChildren() { return this.children.length; }
        /**
         * @returns The aggregate length (in bytes) of the values that have been written.
         */
        get byteLength() {
            let size = 0;
            this._offsets && (size += this._offsets.byteLength);
            this._values && (size += this._values.byteLength);
            this._nulls && (size += this._nulls.byteLength);
            this._typeIds && (size += this._typeIds.byteLength);
            return this.children.reduce((size, child) => size + child.byteLength, size);
        }
        /**
         * @returns The aggregate number of rows that have been reserved to write new values.
         */
        get reservedLength() {
            return this._nulls.reservedLength;
        }
        /**
         * @returns The aggregate length (in bytes) that has been reserved to write new values.
         */
        get reservedByteLength() {
            let size = 0;
            this._offsets && (size += this._offsets.reservedByteLength);
            this._values && (size += this._values.reservedByteLength);
            this._nulls && (size += this._nulls.reservedByteLength);
            this._typeIds && (size += this._typeIds.reservedByteLength);
            return this.children.reduce((size, child) => size + child.reservedByteLength, size);
        }
        get valueOffsets() { return this._offsets ? this._offsets.buffer : null; }
        get values() { return this._values ? this._values.buffer : null; }
        get nullBitmap() { return this._nulls ? this._nulls.buffer : null; }
        get typeIds() { return this._typeIds ? this._typeIds.buffer : null; }
        /**
         * Appends a value (or null) to this `Builder`.
         * This is equivalent to `builder.set(builder.length, value)`.
         * @param {T['TValue'] | TNull } value The value to append.
         */
        append(value) { return this.set(this.length, value); }
        /**
         * Validates whether a value is valid (true), or null (false)
         * @param {T['TValue'] | TNull } value The value to compare against null the value representations
         */
        // @ts-ignore
        isValid(value) { return this._isValid(value); }
        /**
         * Write a value (or null-value sentinel) at the supplied index.
         * If the value matches one of the null-value representations, a 1-bit is
         * written to the null `BitmapBufferBuilder`. Otherwise, a 0 is written to
         * the null `BitmapBufferBuilder`, and the value is passed to
         * `Builder.prototype.setValue()`.
         * @param {number} index The index of the value to write.
         * @param {T['TValue'] | TNull } value The value to write at the supplied index.
         * @returns {this} The updated `Builder` instance.
         */
        set(index, value) {
            if (this.setValid(index, this.isValid(value))) {
                this.setValue(index, value);
            }
            return this;
        }
        /**
         * Write a value to the underlying buffers at the supplied index, bypassing
         * the null-value check. This is a low-level method that
         * @param {number} index
         * @param {T['TValue'] | TNull } value
         */
        // @ts-ignore
        setValue(index, value) { this._setValue(this, index, value); }
        setValid(index, valid) {
            this.length = this._nulls.set(index, +valid).length;
            return valid;
        }
        // @ts-ignore
        addChild(child, name = `${this.numChildren}`) {
            throw new Error(`Cannot append children to non-nested type "${this.type}"`);
        }
        /**
         * Retrieve the child `Builder` at the supplied `index`, or null if no child
         * exists at that index.
         * @param {number} index The index of the child `Builder` to retrieve.
         * @returns {Builder | null} The child Builder at the supplied index or null.
         */
        getChildAt(index) {
            return this.children[index] || null;
        }
        /**
         * Commit all the values that have been written to their underlying
         * ArrayBuffers, including any child Builders if applicable, and reset
         * the internal `Builder` state.
         * @returns A `Data<T>` of the buffers and childData representing the values written.
         */
        flush() {
            const buffers = [];
            const values = this._values;
            const offsets = this._offsets;
            const typeIds = this._typeIds;
            const { length, nullCount } = this;
            if (typeIds) { /* Unions */
                buffers[BufferType.TYPE] = typeIds.flush(length);
                // DenseUnions
                offsets && (buffers[BufferType.OFFSET] = offsets.flush(length));
            }
            else if (offsets) { /* Variable-width primitives (Binary, Utf8) and Lists */
                // Binary, Utf8
                values && (buffers[BufferType.DATA] = values.flush(offsets.last()));
                buffers[BufferType.OFFSET] = offsets.flush(length);
            }
            else if (values) { /* Fixed-width primitives (Int, Float, Decimal, Time, Timestamp, and Interval) */
                buffers[BufferType.DATA] = values.flush(length);
            }
            nullCount > 0 && (buffers[BufferType.VALIDITY] = this._nulls.flush(length));
            const data = Data.new(this.type, 0, length, nullCount, buffers, this.children.map((child) => child.flush()));
            this.clear();
            return data;
        }
        /**
         * Finalize this `Builder`, and child builders if applicable.
         * @returns {this} The finalized `Builder` instance.
         */
        finish() {
            this.finished = true;
            this.children.forEach((child) => child.finish());
            return this;
        }
        /**
         * Clear this Builder's internal state, including child Builders if applicable, and reset the length to 0.
         * @returns {this} The cleared `Builder` instance.
         */
        clear() {
            this.length = 0;
            this._offsets && (this._offsets.clear());
            this._values && (this._values.clear());
            this._nulls && (this._nulls.clear());
            this._typeIds && (this._typeIds.clear());
            this.children.forEach((child) => child.clear());
            return this;
        }
    }
    Builder$2.prototype.length = 1;
    Builder$2.prototype.stride = 1;
    Builder$2.prototype.children = null;
    Builder$2.prototype.finished = false;
    Builder$2.prototype.nullValues = null;
    Builder$2.prototype._isValid = () => true;
    /** @ignore */
    class FixedWidthBuilder extends Builder$2 {
        constructor(opts) {
            super(opts);
            this._values = new DataBufferBuilder(new this.ArrayType(0), this.stride);
        }
        setValue(index, value) {
            const values = this._values;
            values.reserve(index - values.length + 1);
            return super.setValue(index, value);
        }
    }
    /** @ignore */
    class VariableWidthBuilder extends Builder$2 {
        constructor(opts) {
            super(opts);
            this._pendingLength = 0;
            this._offsets = new OffsetsBufferBuilder();
        }
        setValue(index, value) {
            const pending = this._pending || (this._pending = new Map());
            const current = pending.get(index);
            current && (this._pendingLength -= current.length);
            this._pendingLength += value.length;
            pending.set(index, value);
        }
        setValid(index, isValid) {
            if (!super.setValid(index, isValid)) {
                (this._pending || (this._pending = new Map())).set(index, undefined);
                return false;
            }
            return true;
        }
        clear() {
            this._pendingLength = 0;
            this._pending = undefined;
            return super.clear();
        }
        flush() {
            this._flush();
            return super.flush();
        }
        finish() {
            this._flush();
            return super.finish();
        }
        _flush() {
            const pending = this._pending;
            const pendingLength = this._pendingLength;
            this._pendingLength = 0;
            this._pending = undefined;
            if (pending && pending.size > 0) {
                this._flushPending(pending, pendingLength);
            }
            return this;
        }
    }
    /** @ignore */
    function throughIterable(options) {
        const { ['queueingStrategy']: queueingStrategy = 'count' } = options;
        const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;
        const sizeProperty = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';
        return function* (source) {
            let numChunks = 0;
            let builder = Builder$2.new(options);
            for (const value of source) {
                if (builder.append(value)[sizeProperty] >= highWaterMark) {
                    ++numChunks && (yield builder.toVector());
                }
            }
            if (builder.finish().length > 0 || numChunks === 0) {
                yield builder.toVector();
            }
        };
    }
    /** @ignore */
    function throughAsyncIterable(options) {
        const { ['queueingStrategy']: queueingStrategy = 'count' } = options;
        const { ['highWaterMark']: highWaterMark = queueingStrategy !== 'bytes' ? 1000 : 2 ** 14 } = options;
        const sizeProperty = queueingStrategy !== 'bytes' ? 'length' : 'byteLength';
        return async function* (source) {
            let numChunks = 0;
            let builder = Builder$2.new(options);
            for await (const value of source) {
                if (builder.append(value)[sizeProperty] >= highWaterMark) {
                    ++numChunks && (yield builder.toVector());
                }
            }
            if (builder.finish().length > 0 || numChunks === 0) {
                yield builder.toVector();
            }
        };
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class BoolBuilder extends Builder$2 {
        constructor(options) {
            super(options);
            this._values = new BitmapBufferBuilder();
        }
        setValue(index, value) {
            this._values.set(index, +value);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class NullBuilder extends Builder$2 {
        // @ts-ignore
        setValue(index, value) { }
        setValid(index, valid) {
            this.length = Math.max(index + 1, this.length);
            return valid;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DateBuilder extends FixedWidthBuilder {
    }
    /** @ignore */
    class DateDayBuilder extends DateBuilder {
    }
    /** @ignore */
    class DateMillisecondBuilder extends DateBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DecimalBuilder extends FixedWidthBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DictionaryBuilder extends Builder$2 {
        constructor({ 'type': type, 'nullValues': nulls, 'dictionaryHashFunction': hashFn }) {
            super({ type: new Dictionary(type.dictionary, type.indices, type.id, type.isOrdered) });
            this._nulls = null;
            this._dictionaryOffset = 0;
            this._keysToIndices = Object.create(null);
            this.indices = Builder$2.new({ 'type': this.type.indices, 'nullValues': nulls });
            this.dictionary = Builder$2.new({ 'type': this.type.dictionary, 'nullValues': null });
            if (typeof hashFn === 'function') {
                this.valueToKey = hashFn;
            }
        }
        get values() { return this.indices.values; }
        get nullCount() { return this.indices.nullCount; }
        get nullBitmap() { return this.indices.nullBitmap; }
        get byteLength() { return this.indices.byteLength + this.dictionary.byteLength; }
        get reservedLength() { return this.indices.reservedLength + this.dictionary.reservedLength; }
        get reservedByteLength() { return this.indices.reservedByteLength + this.dictionary.reservedByteLength; }
        isValid(value) { return this.indices.isValid(value); }
        setValid(index, valid) {
            const indices = this.indices;
            valid = indices.setValid(index, valid);
            this.length = indices.length;
            return valid;
        }
        setValue(index, value) {
            let keysToIndices = this._keysToIndices;
            let key = this.valueToKey(value);
            let idx = keysToIndices[key];
            if (idx === undefined) {
                keysToIndices[key] = idx = this._dictionaryOffset + this.dictionary.append(value).length - 1;
            }
            return this.indices.setValue(index, idx);
        }
        flush() {
            const type = this.type;
            const prev = this._dictionary;
            const curr = this.dictionary.toVector();
            const data = this.indices.flush().clone(type);
            data.dictionary = prev ? prev.concat(curr) : curr;
            this.finished || (this._dictionaryOffset += curr.length);
            this._dictionary = data.dictionary;
            this.clear();
            return data;
        }
        finish() {
            this.indices.finish();
            this.dictionary.finish();
            this._dictionaryOffset = 0;
            this._keysToIndices = Object.create(null);
            return super.finish();
        }
        clear() {
            this.indices.clear();
            this.dictionary.clear();
            return super.clear();
        }
        valueToKey(val) {
            return typeof val === 'string' ? val : `${val}`;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FixedSizeBinaryBuilder extends FixedWidthBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    const f64 = new Float64Array(1);
    const u32 = new Uint32Array(f64.buffer);
    /**
     * Convert uint16 (logically a float16) to a JS float64. Inspired by numpy's `npy_half_to_double`:
     * https://github.com/numpy/numpy/blob/5a5987291dc95376bb098be8d8e5391e89e77a2c/numpy/core/src/npymath/halffloat.c#L29
     * @param h {number} the uint16 to convert
     * @private
     * @ignore
     */
    function uint16ToFloat64(h) {
        let expo = (h & 0x7C00) >> 10;
        let sigf = (h & 0x03FF) / 1024;
        let sign = (-1) ** ((h & 0x8000) >> 15);
        switch (expo) {
            case 0x1F: return sign * (sigf ? NaN : 1 / 0);
            case 0x00: return sign * (sigf ? 6.103515625e-5 * sigf : 0);
        }
        return sign * (2 ** (expo - 15)) * (1 + sigf);
    }
    /**
     * Convert a float64 to uint16 (assuming the float64 is logically a float16). Inspired by numpy's `npy_double_to_half`:
     * https://github.com/numpy/numpy/blob/5a5987291dc95376bb098be8d8e5391e89e77a2c/numpy/core/src/npymath/halffloat.c#L43
     * @param d {number} The float64 to convert
     * @private
     * @ignore
     */
    function float64ToUint16(d) {
        if (d !== d) {
            return 0x7E00;
        } // NaN
        f64[0] = d;
        // Magic numbers:
        // 0x80000000 = 10000000 00000000 00000000 00000000 -- masks the 32nd bit
        // 0x7ff00000 = 01111111 11110000 00000000 00000000 -- masks the 21st-31st bits
        // 0x000fffff = 00000000 00001111 11111111 11111111 -- masks the 1st-20th bit
        let sign = (u32[1] & 0x80000000) >> 16 & 0xFFFF;
        let expo = (u32[1] & 0x7ff00000), sigf = 0x0000;
        if (expo >= 0x40f00000) {
            //
            // If exponent overflowed, the float16 is either NaN or Infinity.
            // Rules to propagate the sign bit: mantissa > 0 ? NaN : +/-Infinity
            //
            // Magic numbers:
            // 0x40F00000 = 01000000 11110000 00000000 00000000 -- 6-bit exponent overflow
            // 0x7C000000 = 01111100 00000000 00000000 00000000 -- masks the 27th-31st bits
            //
            // returns:
            // qNaN, aka 32256 decimal, 0x7E00 hex, or 01111110 00000000 binary
            // sNaN, aka 32000 decimal, 0x7D00 hex, or 01111101 00000000 binary
            // +inf, aka 31744 decimal, 0x7C00 hex, or 01111100 00000000 binary
            // -inf, aka 64512 decimal, 0xFC00 hex, or 11111100 00000000 binary
            //
            // If mantissa is greater than 23 bits, set to +Infinity like numpy
            if (u32[0] > 0) {
                expo = 0x7C00;
            }
            else {
                expo = (expo & 0x7C000000) >> 16;
                sigf = (u32[1] & 0x000fffff) >> 10;
            }
        }
        else if (expo <= 0x3f000000) {
            //
            // If exponent underflowed, the float is either signed zero or subnormal.
            //
            // Magic numbers:
            // 0x3F000000 = 00111111 00000000 00000000 00000000 -- 6-bit exponent underflow
            //
            sigf = 0x100000 + (u32[1] & 0x000fffff);
            sigf = 0x100000 + (sigf << ((expo >> 20) - 998)) >> 21;
            expo = 0;
        }
        else {
            //
            // No overflow or underflow, rebase the exponent and round the mantissa
            // Magic numbers:
            // 0x200 = 00000010 00000000 -- masks off the 10th bit
            //
            // Ensure the first mantissa bit (the 10th one) is 1 and round
            expo = (expo - 0x3f000000) >> 10;
            sigf = ((u32[1] & 0x000fffff) + 0x200) >> 10;
        }
        return sign | expo | sigf & 0xFFFF;
    }

    var util_math_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        uint16ToFloat64: uint16ToFloat64,
        float64ToUint16: float64ToUint16
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FloatBuilder extends FixedWidthBuilder {
    }
    /** @ignore */
    class Float16Builder extends FloatBuilder {
        setValue(index, value) {
            // convert JS float64 to a uint16
            this._values.set(index, float64ToUint16(value));
        }
    }
    /** @ignore */
    class Float32Builder extends FloatBuilder {
        setValue(index, value) {
            this._values.set(index, value);
        }
    }
    /** @ignore */
    class Float64Builder extends FloatBuilder {
        setValue(index, value) {
            this._values.set(index, value);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    const isArrowBigNumSymbol = Symbol.for('isArrowBigNum');
    /** @ignore */
    function BigNum(x, ...xs) {
        if (xs.length === 0) {
            return Object.setPrototypeOf(toArrayBufferView(this['TypedArray'], x), this.constructor.prototype);
        }
        return Object.setPrototypeOf(new this['TypedArray'](x, ...xs), this.constructor.prototype);
    }
    BigNum.prototype[isArrowBigNumSymbol] = true;
    BigNum.prototype.toJSON = function () { return `"${bignumToString(this)}"`; };
    BigNum.prototype.valueOf = function () { return bignumToNumber(this); };
    BigNum.prototype.toString = function () { return bignumToString(this); };
    BigNum.prototype[Symbol.toPrimitive] = function (hint = 'default') {
        switch (hint) {
            case 'number': return bignumToNumber(this);
            case 'string': return bignumToString(this);
            case 'default': return bignumToBigInt(this);
        }
        // @ts-ignore
        return bignumToString(this);
    };
    /** @ignore */
    function SignedBigNum(...args) { return BigNum.apply(this, args); }
    /** @ignore */
    function UnsignedBigNum(...args) { return BigNum.apply(this, args); }
    /** @ignore */
    function DecimalBigNum(...args) { return BigNum.apply(this, args); }
    Object.setPrototypeOf(SignedBigNum.prototype, Object.create(Int32Array.prototype));
    Object.setPrototypeOf(UnsignedBigNum.prototype, Object.create(Uint32Array.prototype));
    Object.setPrototypeOf(DecimalBigNum.prototype, Object.create(Uint32Array.prototype));
    Object.assign(SignedBigNum.prototype, BigNum.prototype, { 'constructor': SignedBigNum, 'signed': true, 'TypedArray': Int32Array, 'BigIntArray': BigInt64ArrayCtor });
    Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { 'constructor': UnsignedBigNum, 'signed': false, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64ArrayCtor });
    Object.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64ArrayCtor });
    /** @ignore */
    function bignumToNumber(bn) {
        let { buffer, byteOffset, length, 'signed': signed } = bn;
        let words = new Int32Array(buffer, byteOffset, length);
        let number = 0, i = 0, n = words.length, hi, lo;
        while (i < n) {
            lo = words[i++];
            hi = words[i++];
            signed || (hi = hi >>> 0);
            number += (lo >>> 0) + (hi * (i ** 32));
        }
        return number;
    }
    /** @ignore */
    let bignumToString;
    /** @ignore */
    let bignumToBigInt;
    if (!BigIntAvailable) {
        bignumToString = decimalToString;
        bignumToBigInt = bignumToString;
    }
    else {
        bignumToBigInt = ((a) => a.byteLength === 8 ? new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0] : decimalToString(a));
        bignumToString = ((a) => a.byteLength === 8 ? `${new a['BigIntArray'](a.buffer, a.byteOffset, 1)[0]}` : decimalToString(a));
    }
    /** @ignore */
    function decimalToString(a) {
        let digits = '';
        let base64 = new Uint32Array(2);
        let base32 = new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2);
        let checks = new Uint32Array((base32 = new Uint16Array(base32).reverse()).buffer);
        let i = -1, n = base32.length - 1;
        do {
            for (base64[0] = base32[i = 0]; i < n;) {
                base32[i++] = base64[1] = base64[0] / 10;
                base64[0] = ((base64[0] - base64[1] * 10) << 16) + base32[i];
            }
            base32[i] = base64[1] = base64[0] / 10;
            base64[0] = base64[0] - base64[1] * 10;
            digits = `${base64[0]}${digits}`;
        } while (checks[0] || checks[1] || checks[2] || checks[3]);
        return digits ? digits : `0`;
    }
    /** @ignore */
    class BN {
        /** @nocollapse */
        static new(num, isSigned) {
            switch (isSigned) {
                case true: return new SignedBigNum(num);
                case false: return new UnsignedBigNum(num);
            }
            switch (num.constructor) {
                case Int8Array:
                case Int16Array:
                case Int32Array:
                case BigInt64ArrayCtor:
                    return new SignedBigNum(num);
            }
            if (num.byteLength === 16) {
                return new DecimalBigNum(num);
            }
            return new UnsignedBigNum(num);
        }
        /** @nocollapse */
        static signed(num) {
            return new SignedBigNum(num);
        }
        /** @nocollapse */
        static unsigned(num) {
            return new UnsignedBigNum(num);
        }
        /** @nocollapse */
        static decimal(num) {
            return new DecimalBigNum(num);
        }
        constructor(num, isSigned) {
            return BN.new(num, isSigned);
        }
    }

    var util_bn_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        isArrowBigNumSymbol: isArrowBigNumSymbol,
        get bignumToString () { return bignumToString; },
        get bignumToBigInt () { return bignumToBigInt; },
        BN: BN
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IntBuilder extends FixedWidthBuilder {
        setValue(index, value) {
            this._values.set(index, value);
        }
    }
    /** @ignore */
    class Int8Builder extends IntBuilder {
    }
    /** @ignore */
    class Int16Builder extends IntBuilder {
    }
    /** @ignore */
    class Int32Builder extends IntBuilder {
    }
    /** @ignore */
    class Int64Builder extends IntBuilder {
        constructor(options) {
            if (options['nullValues']) {
                options['nullValues'] = options['nullValues'].map(toBigInt);
            }
            super(options);
            this._values = new WideBufferBuilder(new Int32Array(0), 2);
        }
        get values64() { return this._values.buffer64; }
        isValid(value) { return super.isValid(toBigInt(value)); }
    }
    /** @ignore */
    class Uint8Builder extends IntBuilder {
    }
    /** @ignore */
    class Uint16Builder extends IntBuilder {
    }
    /** @ignore */
    class Uint32Builder extends IntBuilder {
    }
    /** @ignore */
    class Uint64Builder extends IntBuilder {
        constructor(options) {
            if (options['nullValues']) {
                options['nullValues'] = options['nullValues'].map(toBigInt);
            }
            super(options);
            this._values = new WideBufferBuilder(new Uint32Array(0), 2);
        }
        get values64() { return this._values.buffer64; }
        isValid(value) { return super.isValid(toBigInt(value)); }
    }
    const toBigInt = ((memo) => (value) => {
        if (ArrayBuffer.isView(value)) {
            memo.buffer = value.buffer;
            memo.byteOffset = value.byteOffset;
            memo.byteLength = value.byteLength;
            value = bignumToBigInt(memo);
            memo.buffer = null;
        }
        return value;
    })({ 'BigIntArray': BigInt64ArrayCtor });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class TimeBuilder extends FixedWidthBuilder {
    }
    /** @ignore */
    class TimeSecondBuilder extends TimeBuilder {
    }
    /** @ignore */
    class TimeMillisecondBuilder extends TimeBuilder {
    }
    /** @ignore */
    class TimeMicrosecondBuilder extends TimeBuilder {
    }
    /** @ignore */
    class TimeNanosecondBuilder extends TimeBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class TimestampBuilder extends FixedWidthBuilder {
    }
    /** @ignore */
    class TimestampSecondBuilder extends TimestampBuilder {
    }
    /** @ignore */
    class TimestampMillisecondBuilder extends TimestampBuilder {
    }
    /** @ignore */
    class TimestampMicrosecondBuilder extends TimestampBuilder {
    }
    /** @ignore */
    class TimestampNanosecondBuilder extends TimestampBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IntervalBuilder extends FixedWidthBuilder {
    }
    /** @ignore */
    class IntervalDayTimeBuilder extends IntervalBuilder {
    }
    /** @ignore */
    class IntervalYearMonthBuilder extends IntervalBuilder {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class BinaryBuilder extends VariableWidthBuilder {
        constructor(opts) {
            super(opts);
            this._values = new BufferBuilder(new Uint8Array(0));
        }
        get byteLength() {
            let size = this._pendingLength + (this.length * 4);
            this._offsets && (size += this._offsets.byteLength);
            this._values && (size += this._values.byteLength);
            this._nulls && (size += this._nulls.byteLength);
            return size;
        }
        setValue(index, value) {
            return super.setValue(index, toUint8Array(value));
        }
        _flushPending(pending, pendingLength) {
            const offsets = this._offsets;
            const data = this._values.reserve(pendingLength).buffer;
            let index = 0, length = 0, offset = 0, value;
            for ([index, value] of pending) {
                if (value === undefined) {
                    offsets.set(index, 0);
                }
                else {
                    length = value.length;
                    data.set(value, offset);
                    offsets.set(index, length);
                    offset += length;
                }
            }
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class Utf8Builder extends VariableWidthBuilder {
        constructor(opts) {
            super(opts);
            this._values = new BufferBuilder(new Uint8Array(0));
        }
        get byteLength() {
            let size = this._pendingLength + (this.length * 4);
            this._offsets && (size += this._offsets.byteLength);
            this._values && (size += this._values.byteLength);
            this._nulls && (size += this._nulls.byteLength);
            return size;
        }
        setValue(index, value) {
            return super.setValue(index, encodeUtf8(value));
        }
        // @ts-ignore
        _flushPending(pending, pendingLength) { }
    }
    Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class Run {
        get length() { return this._values.length; }
        get(index) { return this._values[index]; }
        clear() { this._values = null; return this; }
        bind(values) {
            if (values instanceof AbstractVector) {
                return values;
            }
            this._values = values;
            return this;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */ const kParent = Symbol.for('parent');
    /** @ignore */ const kRowIndex$1 = Symbol.for('rowIndex');
    /** @ignore */ const kKeyToIdx = Symbol.for('keyToIdx');
    /** @ignore */ const kIdxToVal = Symbol.for('idxToVal');
    /** @ignore */ const kCustomInspect = Symbol.for('nodejs.util.inspect.custom');
    class Row {
        constructor(parent, numKeys) {
            this[kParent] = parent;
            this.size = numKeys;
        }
        entries() { return this[Symbol.iterator](); }
        has(key) { return this.get(key) !== undefined; }
        get(key) {
            let val = undefined;
            if (key !== null && key !== undefined) {
                const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());
                let idx = ktoi.get(key);
                if (idx !== undefined) {
                    const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));
                    ((val = itov[idx]) !== undefined) || (itov[idx] = val = this.getValue(idx));
                }
                else if ((idx = this.getIndex(key)) > -1) {
                    ktoi.set(key, idx);
                    const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));
                    ((val = itov[idx]) !== undefined) || (itov[idx] = val = this.getValue(idx));
                }
            }
            return val;
        }
        set(key, val) {
            if (key !== null && key !== undefined) {
                const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());
                let idx = ktoi.get(key);
                if (idx === undefined) {
                    ktoi.set(key, idx = this.getIndex(key));
                }
                if (idx > -1) {
                    const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));
                    itov[idx] = this.setValue(idx, val);
                }
            }
            return this;
        }
        clear() { throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`); }
        delete(_) { throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`); }
        *[Symbol.iterator]() {
            const ki = this.keys();
            const vi = this.values();
            const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());
            const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));
            for (let k, v, i = 0, kr, vr; !((kr = ki.next()).done || (vr = vi.next()).done); ++i) {
                k = kr.value;
                v = vr.value;
                itov[i] = v;
                ktoi.has(k) || ktoi.set(k, i);
                yield [k, v];
            }
        }
        forEach(callbackfn, thisArg) {
            const ki = this.keys();
            const vi = this.values();
            const callback = thisArg === undefined ? callbackfn :
                (v, k, m) => callbackfn.call(thisArg, v, k, m);
            const ktoi = this[kKeyToIdx] || (this[kKeyToIdx] = new Map());
            const itov = this[kIdxToVal] || (this[kIdxToVal] = new Array(this.size));
            for (let k, v, i = 0, kr, vr; !((kr = ki.next()).done || (vr = vi.next()).done); ++i) {
                k = kr.value;
                v = vr.value;
                itov[i] = v;
                ktoi.has(k) || ktoi.set(k, i);
                callback(v, k, this);
            }
        }
        toArray() { return [...this.values()]; }
        toJSON() {
            const obj = {};
            this.forEach((val, key) => obj[key] = val);
            return obj;
        }
        inspect() { return this.toString(); }
        [kCustomInspect]() { return this.toString(); }
        toString() {
            const str = [];
            this.forEach((val, key) => {
                key = valueToString(key);
                val = valueToString(val);
                str.push(`${key}: ${val}`);
            });
            return `{ ${str.join(', ')} }`;
        }
    }
    Row[Symbol.toStringTag] = ((proto) => {
        Object.defineProperties(proto, {
            'size': { writable: true, enumerable: false, configurable: false, value: 0 },
            [kParent]: { writable: true, enumerable: false, configurable: false, value: null },
            [kRowIndex$1]: { writable: true, enumerable: false, configurable: false, value: -1 },
        });
        return proto[Symbol.toStringTag] = 'Row';
    })(Row.prototype);
    class MapRow extends Row {
        constructor(slice) {
            super(slice, slice.length);
            return createRowProxy(this);
        }
        keys() {
            return this[kParent].getChildAt(0)[Symbol.iterator]();
        }
        values() {
            return this[kParent].getChildAt(1)[Symbol.iterator]();
        }
        getKey(idx) {
            return this[kParent].getChildAt(0).get(idx);
        }
        getIndex(key) {
            return this[kParent].getChildAt(0).indexOf(key);
        }
        getValue(index) {
            return this[kParent].getChildAt(1).get(index);
        }
        setValue(index, value) {
            this[kParent].getChildAt(1).set(index, value);
        }
    }
    class StructRow extends Row {
        constructor(parent) {
            super(parent, parent.type.children.length);
            return defineRowProxyProperties(this);
        }
        *keys() {
            for (const field of this[kParent].type.children) {
                yield field.name;
            }
        }
        *values() {
            for (const field of this[kParent].type.children) {
                yield this[field.name];
            }
        }
        getKey(idx) {
            return this[kParent].type.children[idx].name;
        }
        getIndex(key) {
            return this[kParent].type.children.findIndex((f) => f.name === key);
        }
        getValue(index) {
            return this[kParent].getChildAt(index).get(this[kRowIndex$1]);
        }
        setValue(index, value) {
            return this[kParent].getChildAt(index).set(this[kRowIndex$1], value);
        }
    }
    Object.setPrototypeOf(Row.prototype, Map.prototype);
    /** @ignore */
    const defineRowProxyProperties = (() => {
        const desc = { enumerable: true, configurable: false, get: null, set: null };
        return (row) => {
            let idx = -1, ktoi = row[kKeyToIdx] || (row[kKeyToIdx] = new Map());
            const getter = (key) => function () { return this.get(key); };
            const setter = (key) => function (val) { return this.set(key, val); };
            for (const key of row.keys()) {
                ktoi.set(key, ++idx);
                desc.get = getter(key);
                desc.set = setter(key);
                row.hasOwnProperty(key) || (desc.enumerable = true, Object.defineProperty(row, key, desc));
                row.hasOwnProperty(idx) || (desc.enumerable = false, Object.defineProperty(row, idx, desc));
            }
            desc.get = desc.set = null;
            return row;
        };
    })();
    /** @ignore */
    const createRowProxy = (() => {
        if (typeof Proxy === 'undefined') {
            return defineRowProxyProperties;
        }
        const has = Row.prototype.has;
        const get = Row.prototype.get;
        const set = Row.prototype.set;
        const getKey = Row.prototype.getKey;
        const RowProxyHandler = {
            isExtensible() { return false; },
            deleteProperty() { return false; },
            preventExtensions() { return true; },
            ownKeys(row) { return [...row.keys()].map((x) => `${x}`); },
            has(row, key) {
                switch (key) {
                    case 'getKey':
                    case 'getIndex':
                    case 'getValue':
                    case 'setValue':
                    case 'toArray':
                    case 'toJSON':
                    case 'inspect':
                    case 'constructor':
                    case 'isPrototypeOf':
                    case 'propertyIsEnumerable':
                    case 'toString':
                    case 'toLocaleString':
                    case 'valueOf':
                    case 'size':
                    case 'has':
                    case 'get':
                    case 'set':
                    case 'clear':
                    case 'delete':
                    case 'keys':
                    case 'values':
                    case 'entries':
                    case 'forEach':
                    case '__proto__':
                    case '__defineGetter__':
                    case '__defineSetter__':
                    case 'hasOwnProperty':
                    case '__lookupGetter__':
                    case '__lookupSetter__':
                    case Symbol.iterator:
                    case Symbol.toStringTag:
                    case kParent:
                    case kRowIndex$1:
                    case kIdxToVal:
                    case kKeyToIdx:
                    case kCustomInspect:
                        return true;
                }
                if (typeof key === 'number' && !row.has(key)) {
                    key = row.getKey(key);
                }
                return row.has(key);
            },
            get(row, key, receiver) {
                switch (key) {
                    case 'getKey':
                    case 'getIndex':
                    case 'getValue':
                    case 'setValue':
                    case 'toArray':
                    case 'toJSON':
                    case 'inspect':
                    case 'constructor':
                    case 'isPrototypeOf':
                    case 'propertyIsEnumerable':
                    case 'toString':
                    case 'toLocaleString':
                    case 'valueOf':
                    case 'size':
                    case 'has':
                    case 'get':
                    case 'set':
                    case 'clear':
                    case 'delete':
                    case 'keys':
                    case 'values':
                    case 'entries':
                    case 'forEach':
                    case '__proto__':
                    case '__defineGetter__':
                    case '__defineSetter__':
                    case 'hasOwnProperty':
                    case '__lookupGetter__':
                    case '__lookupSetter__':
                    case Symbol.iterator:
                    case Symbol.toStringTag:
                    case kParent:
                    case kRowIndex$1:
                    case kIdxToVal:
                    case kKeyToIdx:
                    case kCustomInspect:
                        return Reflect.get(row, key, receiver);
                }
                if (typeof key === 'number' && !has.call(receiver, key)) {
                    key = getKey.call(receiver, key);
                }
                return get.call(receiver, key);
            },
            set(row, key, val, receiver) {
                switch (key) {
                    case kParent:
                    case kRowIndex$1:
                    case kIdxToVal:
                    case kKeyToIdx:
                        return Reflect.set(row, key, val, receiver);
                    case 'getKey':
                    case 'getIndex':
                    case 'getValue':
                    case 'setValue':
                    case 'toArray':
                    case 'toJSON':
                    case 'inspect':
                    case 'constructor':
                    case 'isPrototypeOf':
                    case 'propertyIsEnumerable':
                    case 'toString':
                    case 'toLocaleString':
                    case 'valueOf':
                    case 'size':
                    case 'has':
                    case 'get':
                    case 'set':
                    case 'clear':
                    case 'delete':
                    case 'keys':
                    case 'values':
                    case 'entries':
                    case 'forEach':
                    case '__proto__':
                    case '__defineGetter__':
                    case '__defineSetter__':
                    case 'hasOwnProperty':
                    case '__lookupGetter__':
                    case '__lookupSetter__':
                    case Symbol.iterator:
                    case Symbol.toStringTag:
                        return false;
                }
                if (typeof key === 'number' && !has.call(receiver, key)) {
                    key = getKey.call(receiver, key);
                }
                return has.call(receiver, key) ? !!set.call(receiver, key, val) : false;
            },
        };
        return (row) => new Proxy(row, RowProxyHandler);
    })();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function clampIndex(source, index, then) {
        const length = source.length;
        const adjust = index > -1 ? index : (length + (index % length));
        return then ? then(source, adjust) : adjust;
    }
    /** @ignore */
    let tmp;
    /** @ignore */
    function clampRange(source, begin, end, then) {
        // Adjust args similar to Array.prototype.slice. Normalize begin/end to
        // clamp between 0 and length, and wrap around on negative indices, e.g.
        // slice(-1, 5) or slice(5, -1)
        let { length: len = 0 } = source;
        let lhs = typeof begin !== 'number' ? 0 : begin;
        let rhs = typeof end !== 'number' ? len : end;
        // wrap around on negative start/end positions
        (lhs < 0) && (lhs = ((lhs % len) + len) % len);
        (rhs < 0) && (rhs = ((rhs % len) + len) % len);
        // ensure lhs <= rhs
        (rhs < lhs) && (tmp = lhs, lhs = rhs, rhs = tmp);
        // ensure rhs <= length
        (rhs > len) && (rhs = len);
        return then ? then(source, lhs, rhs) : [lhs, rhs];
    }
    const big0 = BigIntAvailable ? BigIntCtor(0) : 0;
    const isNaNFast = (value) => value !== value;
    /** @ignore */
    function createElementComparator(search) {
        let typeofSearch = typeof search;
        // Compare primitives
        if (typeofSearch !== 'object' || search === null) {
            // Compare NaN
            if (isNaNFast(search)) {
                return isNaNFast;
            }
            return typeofSearch !== 'bigint'
                ? (value) => value === search
                : (value) => (big0 + value) === search;
        }
        // Compare Dates
        if (search instanceof Date) {
            const valueOfSearch = search.valueOf();
            return (value) => value instanceof Date ? (value.valueOf() === valueOfSearch) : false;
        }
        // Compare TypedArrays
        if (ArrayBuffer.isView(search)) {
            return (value) => value ? compareArrayLike(search, value) : false;
        }
        // Compare Maps and Rows
        if (search instanceof Map) {
            return creatMapComparator(search);
        }
        // Compare Array-likes
        if (Array.isArray(search)) {
            return createArrayLikeComparator(search);
        }
        // Compare Vectors
        if (search instanceof AbstractVector) {
            return createVectorComparator(search);
        }
        // Compare non-empty Objects
        return createObjectComparator(search);
    }
    /** @ignore */
    function createArrayLikeComparator(lhs) {
        const comparators = [];
        for (let i = -1, n = lhs.length; ++i < n;) {
            comparators[i] = createElementComparator(lhs[i]);
        }
        return createSubElementsComparator(comparators);
    }
    /** @ignore */
    function creatMapComparator(lhs) {
        let i = -1;
        const comparators = [];
        lhs.forEach((v) => comparators[++i] = createElementComparator(v));
        return createSubElementsComparator(comparators);
    }
    /** @ignore */
    function createVectorComparator(lhs) {
        const comparators = [];
        for (let i = -1, n = lhs.length; ++i < n;) {
            comparators[i] = createElementComparator(lhs.get(i));
        }
        return createSubElementsComparator(comparators);
    }
    /** @ignore */
    function createObjectComparator(lhs) {
        const keys = Object.keys(lhs);
        // Only compare non-empty Objects
        if (keys.length === 0) {
            return () => false;
        }
        const comparators = [];
        for (let i = -1, n = keys.length; ++i < n;) {
            comparators[i] = createElementComparator(lhs[keys[i]]);
        }
        return createSubElementsComparator(comparators, keys);
    }
    function createSubElementsComparator(comparators, keys) {
        return (rhs) => {
            if (!rhs || typeof rhs !== 'object') {
                return false;
            }
            switch (rhs.constructor) {
                case Array: return compareArray(comparators, rhs);
                case Map:
                case MapRow:
                case StructRow:
                    return compareObject(comparators, rhs, rhs.keys());
                case Object:
                case undefined: // support `Object.create(null)` objects
                    return compareObject(comparators, rhs, keys || Object.keys(rhs));
            }
            return rhs instanceof AbstractVector ? compareVector(comparators, rhs) : false;
        };
    }
    function compareArray(comparators, arr) {
        const n = comparators.length;
        if (arr.length !== n) {
            return false;
        }
        for (let i = -1; ++i < n;) {
            if (!(comparators[i](arr[i]))) {
                return false;
            }
        }
        return true;
    }
    function compareVector(comparators, vec) {
        const n = comparators.length;
        if (vec.length !== n) {
            return false;
        }
        for (let i = -1; ++i < n;) {
            if (!(comparators[i](vec.get(i)))) {
                return false;
            }
        }
        return true;
    }
    function compareObject(comparators, obj, keys) {
        const lKeyItr = keys[Symbol.iterator]();
        const rKeyItr = obj instanceof Map ? obj.keys() : Object.keys(obj)[Symbol.iterator]();
        const rValItr = obj instanceof Map ? obj.values() : Object.values(obj)[Symbol.iterator]();
        let i = 0;
        let n = comparators.length;
        let rVal = rValItr.next();
        let lKey = lKeyItr.next();
        let rKey = rKeyItr.next();
        for (; i < n && !lKey.done && !rKey.done && !rVal.done; ++i, lKey = lKeyItr.next(), rKey = rKeyItr.next(), rVal = rValItr.next()) {
            if (lKey.value !== rKey.value || !comparators[i](rVal.value)) {
                break;
            }
        }
        if (i === n && lKey.done && rKey.done && rVal.done) {
            return true;
        }
        lKeyItr.return && lKeyItr.return();
        rKeyItr.return && rKeyItr.return();
        rValItr.return && rValItr.return();
        return false;
    }

    var util_vector_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        clampIndex: clampIndex,
        clampRange: clampRange,
        createElementComparator: createElementComparator
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class Chunked extends AbstractVector {
        constructor(type, chunks = [], offsets = calculateOffsets(chunks)) {
            super();
            this._nullCount = -1;
            this._type = type;
            this._chunks = chunks;
            this._chunkOffsets = offsets;
            this._length = offsets[offsets.length - 1];
            this._numChildren = (this._type.children || []).length;
        }
        /** @nocollapse */
        static flatten(...vectors) {
            return selectChunkArgs(AbstractVector, vectors);
        }
        /** @nocollapse */
        static concat(...vectors) {
            const chunks = Chunked.flatten(...vectors);
            return new Chunked(chunks[0].type, chunks);
        }
        get type() { return this._type; }
        get length() { return this._length; }
        get chunks() { return this._chunks; }
        get typeId() { return this._type.typeId; }
        get VectorName() { return `Chunked<${this._type}>`; }
        get data() {
            return this._chunks[0] ? this._chunks[0].data : null;
        }
        get ArrayType() { return this._type.ArrayType; }
        get numChildren() { return this._numChildren; }
        get stride() { return this._chunks[0] ? this._chunks[0].stride : 1; }
        get byteLength() {
            return this._chunks.reduce((byteLength, chunk) => byteLength + chunk.byteLength, 0);
        }
        get nullCount() {
            let nullCount = this._nullCount;
            if (nullCount < 0) {
                this._nullCount = nullCount = this._chunks.reduce((x, { nullCount }) => x + nullCount, 0);
            }
            return nullCount;
        }
        get indices() {
            if (DataType.isDictionary(this._type)) {
                if (!this._indices) {
                    const chunks = this._chunks;
                    this._indices = (chunks.length === 1
                        ? chunks[0].indices
                        : Chunked.concat(...chunks.map((x) => x.indices)));
                }
                return this._indices;
            }
            return null;
        }
        get dictionary() {
            if (DataType.isDictionary(this._type)) {
                return this._chunks[this._chunks.length - 1].data.dictionary;
            }
            return null;
        }
        *[Symbol.iterator]() {
            for (const chunk of this._chunks) {
                yield* chunk;
            }
        }
        clone(chunks = this._chunks) {
            return new Chunked(this._type, chunks);
        }
        concat(...others) {
            return this.clone(Chunked.flatten(this, ...others));
        }
        slice(begin, end) {
            return clampRange(this, begin, end, this._sliceInternal);
        }
        getChildAt(index) {
            if (index < 0 || index >= this._numChildren) {
                return null;
            }
            let columns = this._children || (this._children = []);
            let child, field, chunks;
            if (child = columns[index]) {
                return child;
            }
            if (field = (this._type.children || [])[index]) {
                chunks = this._chunks
                    .map((vector) => vector.getChildAt(index))
                    .filter((vec) => vec != null);
                if (chunks.length > 0) {
                    return (columns[index] = new Chunked(field.type, chunks));
                }
            }
            return null;
        }
        search(index, then) {
            let idx = index;
            // binary search to find the child vector and value indices
            let offsets = this._chunkOffsets, rhs = offsets.length - 1;
            // return early if out of bounds, or if there's just one child
            if (idx < 0) {
                return null;
            }
            if (idx >= offsets[rhs]) {
                return null;
            }
            if (rhs <= 1) {
                return then ? then(this, 0, idx) : [0, idx];
            }
            let lhs = 0, pos = 0, mid = 0;
            do {
                if (lhs + 1 === rhs) {
                    return then ? then(this, lhs, idx - pos) : [lhs, idx - pos];
                }
                mid = lhs + ((rhs - lhs) / 2) | 0;
                idx >= offsets[mid] ? (lhs = mid) : (rhs = mid);
            } while (idx < offsets[rhs] && idx >= (pos = offsets[lhs]));
            return null;
        }
        isValid(index) {
            return !!this.search(index, this.isValidInternal);
        }
        get(index) {
            return this.search(index, this.getInternal);
        }
        set(index, value) {
            this.search(index, ({ chunks }, i, j) => chunks[i].set(j, value));
        }
        indexOf(element, offset) {
            if (offset && typeof offset === 'number') {
                return this.search(offset, (self, i, j) => this.indexOfInternal(self, i, j, element));
            }
            return this.indexOfInternal(this, 0, Math.max(0, offset || 0), element);
        }
        toArray() {
            const { chunks } = this;
            const n = chunks.length;
            let ArrayType = this._type.ArrayType;
            if (n <= 0) {
                return new ArrayType(0);
            }
            if (n <= 1) {
                return chunks[0].toArray();
            }
            let len = 0, src = new Array(n);
            for (let i = -1; ++i < n;) {
                len += (src[i] = chunks[i].toArray()).length;
            }
            if (ArrayType !== src[0].constructor) {
                ArrayType = src[0].constructor;
            }
            let dst = new ArrayType(len);
            let set = ArrayType === Array ? arraySet : typedSet;
            for (let i = -1, idx = 0; ++i < n;) {
                idx = set(src[i], dst, idx);
            }
            return dst;
        }
        getInternal({ _chunks }, i, j) { return _chunks[i].get(j); }
        isValidInternal({ _chunks }, i, j) { return _chunks[i].isValid(j); }
        indexOfInternal({ _chunks }, chunkIndex, fromIndex, element) {
            let i = chunkIndex - 1, n = _chunks.length;
            let start = fromIndex, offset = 0, found = -1;
            while (++i < n) {
                if (~(found = _chunks[i].indexOf(element, start))) {
                    return offset + found;
                }
                start = 0;
                offset += _chunks[i].length;
            }
            return -1;
        }
        _sliceInternal(self, begin, end) {
            const slices = [];
            const { chunks, _chunkOffsets: chunkOffsets } = self;
            for (let i = -1, n = chunks.length; ++i < n;) {
                const chunk = chunks[i];
                const chunkLength = chunk.length;
                const chunkOffset = chunkOffsets[i];
                // If the child is to the right of the slice boundary, we can stop
                if (chunkOffset >= end) {
                    break;
                }
                // If the child is to the left of of the slice boundary, exclude
                if (begin >= chunkOffset + chunkLength) {
                    continue;
                }
                // If the child is between both left and right boundaries, include w/o slicing
                if (chunkOffset >= begin && (chunkOffset + chunkLength) <= end) {
                    slices.push(chunk);
                    continue;
                }
                // If the child overlaps one of the slice boundaries, include that slice
                const from = Math.max(0, begin - chunkOffset);
                const to = Math.min(end - chunkOffset, chunkLength);
                slices.push(chunk.slice(from, to));
            }
            return self.clone(slices);
        }
    }
    /** @ignore */
    function calculateOffsets(vectors) {
        let offsets = new Uint32Array((vectors || []).length + 1);
        let offset = offsets[0] = 0, length = offsets.length;
        for (let index = 0; ++index < length;) {
            offsets[index] = (offset += vectors[index - 1].length);
        }
        return offsets;
    }
    /** @ignore */
    const typedSet = (src, dst, offset) => {
        dst.set(src, offset);
        return (offset + src.length);
    };
    /** @ignore */
    const arraySet = (src, dst, offset) => {
        let idx = offset;
        for (let i = -1, n = src.length; ++i < n;) {
            dst[idx++] = src[i];
        }
        return idx;
    };

    // Licensed to the Apache Software Foundation (ASF) under one
    class Column extends Chunked {
        constructor(field, vectors = [], offsets) {
            vectors = Chunked.flatten(...vectors);
            super(field.type, vectors, offsets);
            this._field = field;
            if (vectors.length === 1 && !(this instanceof SingleChunkColumn)) {
                return new SingleChunkColumn(field, vectors[0], this._chunkOffsets);
            }
        }
        /** @nocollapse */
        static new(...args) {
            let [field, data, ...rest] = args;
            if (typeof field !== 'string' && !(field instanceof Field)) {
                data = field;
                field = '';
            }
            const chunks = Chunked.flatten(Array.isArray(data) ? [...data, ...rest] :
                data instanceof AbstractVector ? [data, ...rest] :
                    [AbstractVector.new(data, ...rest)]);
            if (typeof field === 'string') {
                const type = chunks[0].data.type;
                field = new Field(field, type, true);
            }
            else if (!field.nullable && chunks.some(({ nullCount }) => nullCount > 0)) {
                field = field.clone({ nullable: true });
            }
            return new Column(field, chunks);
        }
        get field() { return this._field; }
        get name() { return this._field.name; }
        get nullable() { return this._field.nullable; }
        get metadata() { return this._field.metadata; }
        clone(chunks = this._chunks) {
            return new Column(this._field, chunks);
        }
        getChildAt(index) {
            if (index < 0 || index >= this.numChildren) {
                return null;
            }
            let columns = this._children || (this._children = []);
            let column, field, chunks;
            if (column = columns[index]) {
                return column;
            }
            if (field = (this.type.children || [])[index]) {
                chunks = this._chunks
                    .map((vector) => vector.getChildAt(index))
                    .filter((vec) => vec != null);
                if (chunks.length > 0) {
                    return (columns[index] = new Column(field, chunks));
                }
            }
            return null;
        }
    }
    /** @ignore */
    class SingleChunkColumn extends Column {
        constructor(field, vector, offsets) {
            super(field, [vector], offsets);
            this._chunk = vector;
        }
        search(index, then) {
            return then ? then(this, 0, index) : [0, index];
        }
        isValid(index) {
            return this._chunk.isValid(index);
        }
        get(index) {
            return this._chunk.get(index);
        }
        set(index, value) {
            this._chunk.set(index, value);
        }
        indexOf(element, offset) {
            return this._chunk.indexOf(element, offset);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    const isArray$1 = Array.isArray;
    /** @ignore */
    const selectArgs = (Ctor, vals) => _selectArgs(Ctor, vals, [], 0);
    /** @ignore */
    const selectColumnArgs = (args) => {
        const [fields, values] = _selectFieldArgs(args, [[], []]);
        return values.map((x, i) => x instanceof Column ? Column.new(x.field.clone(fields[i]), x) :
            x instanceof AbstractVector ? Column.new(fields[i], x) :
                Column.new(fields[i], []));
    };
    /** @ignore */
    const selectFieldArgs = (args) => _selectFieldArgs(args, [[], []]);
    /** @ignore */
    const selectChunkArgs = (Ctor, vals) => _selectChunkArgs(Ctor, vals, [], 0);
    /** @ignore */
    const selectVectorChildrenArgs = (Ctor, vals) => _selectVectorChildrenArgs(Ctor, vals, [], 0);
    /** @ignore */
    function _selectArgs(Ctor, vals, res, idx) {
        let value, j = idx;
        let i = -1, n = vals.length;
        while (++i < n) {
            if (isArray$1(value = vals[i])) {
                j = _selectArgs(Ctor, value, res, j).length;
            }
            else if (value instanceof Ctor) {
                res[j++] = value;
            }
        }
        return res;
    }
    /** @ignore */
    function _selectChunkArgs(Ctor, vals, res, idx) {
        let value, j = idx;
        let i = -1, n = vals.length;
        while (++i < n) {
            if (isArray$1(value = vals[i])) {
                j = _selectChunkArgs(Ctor, value, res, j).length;
            }
            else if (value instanceof Chunked) {
                j = _selectChunkArgs(Ctor, value.chunks, res, j).length;
            }
            else if (value instanceof Ctor) {
                res[j++] = value;
            }
        }
        return res;
    }
    /** @ignore */
    function _selectVectorChildrenArgs(Ctor, vals, res, idx) {
        let value, j = idx;
        let i = -1, n = vals.length;
        while (++i < n) {
            if (isArray$1(value = vals[i])) {
                j = _selectVectorChildrenArgs(Ctor, value, res, j).length;
            }
            else if (value instanceof Ctor) {
                j = _selectArgs(AbstractVector, value.schema.fields.map((_, i) => value.getChildAt(i)), res, j).length;
            }
            else if (value instanceof AbstractVector) {
                res[j++] = value;
            }
        }
        return res;
    }
    /** @ignore */
    const toKeysAndValues = (xs, [k, v], i) => (xs[0][i] = k, xs[1][i] = v, xs);
    /** @ignore */
    function _selectFieldArgs(vals, ret) {
        let keys, n;
        switch (n = vals.length) {
            case 0: return ret;
            case 1:
                keys = ret[0];
                if (!(vals[0])) {
                    return ret;
                }
                if (isArray$1(vals[0])) {
                    return _selectFieldArgs(vals[0], ret);
                }
                if (!(vals[0] instanceof Data || vals[0] instanceof AbstractVector || vals[0] instanceof DataType)) {
                    [keys, vals] = Object.entries(vals[0]).reduce(toKeysAndValues, ret);
                }
                break;
            default:
                !isArray$1(keys = vals[n - 1])
                    ? (vals = isArray$1(vals[0]) ? vals[0] : vals, keys = [])
                    : (vals = isArray$1(vals[0]) ? vals[0] : vals.slice(0, n - 1));
        }
        let fieldIndex = -1;
        let valueIndex = -1;
        let idx = -1, len = vals.length;
        let field;
        let val;
        let [fields, values] = ret;
        while (++idx < len) {
            val = vals[idx];
            if (val instanceof Column && (values[++valueIndex] = val)) {
                fields[++fieldIndex] = val.field.clone(keys[idx], val.type, true);
            }
            else {
                ({ [idx]: field = idx } = keys);
                if (val instanceof DataType && (values[++valueIndex] = val)) {
                    fields[++fieldIndex] = Field.new(field, val, true);
                }
                else if (val && val.type && (values[++valueIndex] = val)) {
                    val instanceof Data && (values[valueIndex] = val = AbstractVector.new(val));
                    fields[++fieldIndex] = Field.new(field, val.type, true);
                }
            }
        }
        return ret;
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    class Schema {
        constructor(fields = [], metadata, dictionaries) {
            this.fields = (fields || []);
            this.metadata = metadata || new Map();
            if (!dictionaries) {
                dictionaries = generateDictionaryMap(fields);
            }
            this.dictionaries = dictionaries;
        }
        /** @nocollapse */
        static from(...args) {
            return Schema.new(args[0], args[1]);
        }
        /** @nocollapse */
        static new(...args) {
            return new Schema(selectFieldArgs(args)[0]);
        }
        get [Symbol.toStringTag]() { return 'Schema'; }
        toString() {
            return `Schema<{ ${this.fields.map((f, i) => `${i}: ${f}`).join(', ')} }>`;
        }
        compareTo(other) {
            return instance$g.compareSchemas(this, other);
        }
        select(...columnNames) {
            const names = columnNames.reduce((xs, x) => (xs[x] = true) && xs, Object.create(null));
            return new Schema(this.fields.filter((f) => names[f.name]), this.metadata);
        }
        selectAt(...columnIndices) {
            return new Schema(columnIndices.map((i) => this.fields[i]).filter(Boolean), this.metadata);
        }
        assign(...args) {
            const other = args[0] instanceof Schema ? args[0]
                : new Schema(selectArgs(Field, args));
            const curFields = [...this.fields];
            const metadata = mergeMaps(mergeMaps(new Map(), this.metadata), other.metadata);
            const newFields = other.fields.filter((f2) => {
                const i = curFields.findIndex((f) => f.name === f2.name);
                return ~i ? (curFields[i] = f2.clone({
                    metadata: mergeMaps(mergeMaps(new Map(), curFields[i].metadata), f2.metadata)
                })) && false : true;
            });
            const newDictionaries = generateDictionaryMap(newFields, new Map());
            return new Schema([...curFields, ...newFields], metadata, new Map([...this.dictionaries, ...newDictionaries]));
        }
    }
    class Field {
        constructor(name, type, nullable = false, metadata) {
            this.name = name;
            this.type = type;
            this.nullable = nullable;
            this.metadata = metadata || new Map();
        }
        /** @nocollapse */
        static new(...args) {
            let [name, type, nullable, metadata] = args;
            if (args[0] && typeof args[0] === 'object') {
                ({ name } = args[0]);
                (type === undefined) && (type = args[0].type);
                (nullable === undefined) && (nullable = args[0].nullable);
                (metadata === undefined) && (metadata = args[0].metadata);
            }
            return new Field(`${name}`, type, nullable, metadata);
        }
        get typeId() { return this.type.typeId; }
        get [Symbol.toStringTag]() { return 'Field'; }
        toString() { return `${this.name}: ${this.type}`; }
        compareTo(other) {
            return instance$g.compareField(this, other);
        }
        clone(...args) {
            let [name, type, nullable, metadata] = args;
            (!args[0] || typeof args[0] !== 'object')
                ? ([name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata] = args)
                : ({ name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata } = args[0]);
            return Field.new(name, type, nullable, metadata);
        }
    }
    /** @ignore */
    function mergeMaps(m1, m2) {
        return new Map([...(m1 || new Map()), ...(m2 || new Map())]);
    }
    /** @ignore */
    function generateDictionaryMap(fields, dictionaries = new Map()) {
        for (let i = -1, n = fields.length; ++i < n;) {
            const field = fields[i];
            const type = field.type;
            if (DataType.isDictionary(type)) {
                if (!dictionaries.has(type.id)) {
                    dictionaries.set(type.id, type.dictionary);
                }
                else if (dictionaries.get(type.id) !== type.dictionary) {
                    throw new Error(`Cannot create Schema containing two different dictionaries with the same Id`);
                }
            }
            if (type.children && type.children.length > 0) {
                generateDictionaryMap(type.children, dictionaries);
            }
        }
        return dictionaries;
    }
    // Add these here so they're picked up by the externs creator
    // in the build, and closure-compiler doesn't minify them away
    Schema.prototype.fields = null;
    Schema.prototype.metadata = null;
    Schema.prototype.dictionaries = null;
    Field.prototype.type = null;
    Field.prototype.name = null;
    Field.prototype.nullable = null;
    Field.prototype.metadata = null;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class ListBuilder extends VariableWidthBuilder {
        constructor(opts) {
            super(opts);
            this._run = new Run();
            this._offsets = new OffsetsBufferBuilder();
        }
        addChild(child, name = '0') {
            if (this.numChildren > 0) {
                throw new Error('ListBuilder can only have one child.');
            }
            this.children[this.numChildren] = child;
            this.type = new List$1(new Field(name, child.type, true));
            return this.numChildren - 1;
        }
        clear() {
            this._run.clear();
            return super.clear();
        }
        _flushPending(pending) {
            const run = this._run;
            const offsets = this._offsets;
            const setValue = this._setValue;
            let index = 0, value;
            for ([index, value] of pending) {
                if (value === undefined) {
                    offsets.set(index, 0);
                }
                else {
                    offsets.set(index, value.length);
                    setValue(this, index, run.bind(value));
                }
            }
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FixedSizeListBuilder extends Builder$2 {
        constructor() {
            super(...arguments);
            this._run = new Run();
        }
        setValue(index, value) {
            super.setValue(index, this._run.bind(value));
        }
        addChild(child, name = '0') {
            if (this.numChildren > 0) {
                throw new Error('FixedSizeListBuilder can only have one child.');
            }
            const childIndex = this.children.push(child);
            this.type = new FixedSizeList$1(this.type.listSize, new Field(name, child.type, true));
            return childIndex;
        }
        clear() {
            this._run.clear();
            return super.clear();
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class MapBuilder extends VariableWidthBuilder {
        set(index, value) {
            return super.set(index, value);
        }
        setValue(index, value) {
            value = value instanceof Map ? value : new Map(Object.entries(value));
            const pending = this._pending || (this._pending = new Map());
            const current = pending.get(index);
            current && (this._pendingLength -= current.size);
            this._pendingLength += value.size;
            pending.set(index, value);
        }
        addChild(child, name = `${this.numChildren}`) {
            if (this.numChildren > 0) {
                throw new Error('ListBuilder can only have one child.');
            }
            this.children[this.numChildren] = child;
            this.type = new Map_$1(new Field(name, child.type, true), this.type.keysSorted);
            return this.numChildren - 1;
        }
        _flushPending(pending) {
            const offsets = this._offsets;
            const setValue = this._setValue;
            pending.forEach((value, index) => {
                if (value === undefined) {
                    offsets.set(index, 0);
                }
                else {
                    offsets.set(index, value.size);
                    setValue(this, index, value);
                }
            });
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class StructBuilder extends Builder$2 {
        addChild(child, name = `${this.numChildren}`) {
            const childIndex = this.children.push(child);
            this.type = new Struct$1([...this.type.children, new Field(name, child.type, true)]);
            return childIndex;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class UnionBuilder extends Builder$2 {
        constructor(options) {
            super(options);
            this._typeIds = new DataBufferBuilder(new Int8Array(0), 1);
            if (typeof options['valueToChildTypeId'] === 'function') {
                this._valueToChildTypeId = options['valueToChildTypeId'];
            }
        }
        get typeIdToChildIndex() { return this.type.typeIdToChildIndex; }
        append(value, childTypeId) {
            return this.set(this.length, value, childTypeId);
        }
        set(index, value, childTypeId) {
            if (childTypeId === undefined) {
                childTypeId = this._valueToChildTypeId(this, value, index);
            }
            if (this.setValid(index, this.isValid(value))) {
                this.setValue(index, value, childTypeId);
            }
            return this;
        }
        // @ts-ignore
        setValue(index, value, childTypeId) {
            this._typeIds.set(index, childTypeId);
            super.setValue(index, value);
        }
        // @ts-ignore
        addChild(child, name = `${this.children.length}`) {
            const childTypeId = this.children.push(child);
            const { type: { children, mode, typeIds } } = this;
            const fields = [...children, new Field(name, child.type)];
            this.type = new Union_(mode, [...typeIds, childTypeId], fields);
            return childTypeId;
        }
        /** @ignore */
        // @ts-ignore
        _valueToChildTypeId(builder, value, offset) {
            throw new Error(`Cannot map UnionBuilder value to child typeId. \
Pass the \`childTypeId\` as the second argument to unionBuilder.append(), \
or supply a \`valueToChildTypeId\` function as part of the UnionBuilder constructor options.`);
        }
    }
    /** @ignore */
    class SparseUnionBuilder extends UnionBuilder {
    }
    /** @ignore */
    class DenseUnionBuilder extends UnionBuilder {
        constructor(options) {
            super(options);
            this._offsets = new DataBufferBuilder(new Int32Array(0));
        }
        /** @ignore */
        setValue(index, value, childTypeId) {
            const childIndex = this.type.typeIdToChildIndex[childTypeId];
            this._offsets.set(index, this.getChildAt(childIndex).length);
            return super.setValue(index, value, childTypeId);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class SetVisitor extends Visitor {
    }
    /** @ignore */
    const setEpochMsToDays = (data, index, epochMs) => { data[index] = (epochMs / 86400000) | 0; };
    /** @ignore */
    const setEpochMsToMillisecondsLong = (data, index, epochMs) => {
        data[index] = (epochMs % 4294967296) | 0;
        data[index + 1] = (epochMs / 4294967296) | 0;
    };
    /** @ignore */
    const setEpochMsToMicrosecondsLong = (data, index, epochMs) => {
        data[index] = ((epochMs * 1000) % 4294967296) | 0;
        data[index + 1] = ((epochMs * 1000) / 4294967296) | 0;
    };
    /** @ignore */
    const setEpochMsToNanosecondsLong = (data, index, epochMs) => {
        data[index] = ((epochMs * 1000000) % 4294967296) | 0;
        data[index + 1] = ((epochMs * 1000000) / 4294967296) | 0;
    };
    /** @ignore */
    const setVariableWidthBytes = (values, valueOffsets, index, value) => {
        const { [index]: x, [index + 1]: y } = valueOffsets;
        if (x != null && y != null) {
            values.set(value.subarray(0, y - x), x);
        }
    };
    /** @ignore */
    const setBool = ({ offset, values }, index, val) => {
        const idx = offset + index;
        val ? (values[idx >> 3] |= (1 << (idx % 8))) // true
            : (values[idx >> 3] &= ~(1 << (idx % 8))); // false
    };
    /** @ignore */
    const setDateDay = ({ values }, index, value) => { setEpochMsToDays(values, index, value.valueOf()); };
    /** @ignore */
    const setDateMillisecond = ({ values }, index, value) => { setEpochMsToMillisecondsLong(values, index * 2, value.valueOf()); };
    /** @ignore */
    const setNumeric = ({ stride, values }, index, value) => { values[stride * index] = value; };
    /** @ignore */
    const setFloat16 = ({ stride, values }, index, value) => { values[stride * index] = float64ToUint16(value); };
    /** @ignore */
    const setNumericX2 = (vector, index, value) => {
        switch (typeof value) {
            case 'bigint':
                vector.values64[index] = value;
                break;
            case 'number':
                vector.values[index * vector.stride] = value;
                break;
            default:
                const val = value;
                const { stride, ArrayType } = vector;
                const long = toArrayBufferView(ArrayType, val);
                vector.values.set(long.subarray(0, stride), stride * index);
        }
    };
    /** @ignore */
    const setFixedSizeBinary = ({ stride, values }, index, value) => { values.set(value.subarray(0, stride), stride * index); };
    /** @ignore */
    const setBinary = ({ values, valueOffsets }, index, value) => setVariableWidthBytes(values, valueOffsets, index, value);
    /** @ignore */
    const setUtf8 = ({ values, valueOffsets }, index, value) => {
        setVariableWidthBytes(values, valueOffsets, index, encodeUtf8(value));
    };
    /* istanbul ignore next */
    /** @ignore */
    const setInt = (vector, index, value) => {
        vector.type.bitWidth < 64
            ? setNumeric(vector, index, value)
            : setNumericX2(vector, index, value);
    };
    /* istanbul ignore next */
    /** @ignore */
    const setFloat = (vector, index, value) => {
        vector.type.precision !== Precision.HALF
            ? setNumeric(vector, index, value)
            : setFloat16(vector, index, value);
    };
    /* istanbul ignore next */
    const setDate = (vector, index, value) => {
        vector.type.unit === DateUnit.DAY
            ? setDateDay(vector, index, value)
            : setDateMillisecond(vector, index, value);
    };
    /** @ignore */
    const setTimestampSecond = ({ values }, index, value) => setEpochMsToMillisecondsLong(values, index * 2, value / 1000);
    /** @ignore */
    const setTimestampMillisecond = ({ values }, index, value) => setEpochMsToMillisecondsLong(values, index * 2, value);
    /** @ignore */
    const setTimestampMicrosecond = ({ values }, index, value) => setEpochMsToMicrosecondsLong(values, index * 2, value);
    /** @ignore */
    const setTimestampNanosecond = ({ values }, index, value) => setEpochMsToNanosecondsLong(values, index * 2, value);
    /* istanbul ignore next */
    /** @ignore */
    const setTimestamp = (vector, index, value) => {
        switch (vector.type.unit) {
            case TimeUnit.SECOND: return setTimestampSecond(vector, index, value);
            case TimeUnit.MILLISECOND: return setTimestampMillisecond(vector, index, value);
            case TimeUnit.MICROSECOND: return setTimestampMicrosecond(vector, index, value);
            case TimeUnit.NANOSECOND: return setTimestampNanosecond(vector, index, value);
        }
    };
    /** @ignore */
    const setTimeSecond = ({ values, stride }, index, value) => { values[stride * index] = value; };
    /** @ignore */
    const setTimeMillisecond = ({ values, stride }, index, value) => { values[stride * index] = value; };
    /** @ignore */
    const setTimeMicrosecond = ({ values }, index, value) => { values.set(value.subarray(0, 2), 2 * index); };
    /** @ignore */
    const setTimeNanosecond = ({ values }, index, value) => { values.set(value.subarray(0, 2), 2 * index); };
    /* istanbul ignore next */
    /** @ignore */
    const setTime = (vector, index, value) => {
        switch (vector.type.unit) {
            case TimeUnit.SECOND: return setTimeSecond(vector, index, value);
            case TimeUnit.MILLISECOND: return setTimeMillisecond(vector, index, value);
            case TimeUnit.MICROSECOND: return setTimeMicrosecond(vector, index, value);
            case TimeUnit.NANOSECOND: return setTimeNanosecond(vector, index, value);
        }
    };
    /** @ignore */
    const setDecimal = ({ values }, index, value) => { values.set(value.subarray(0, 4), 4 * index); };
    /** @ignore */
    const setList = (vector, index, value) => {
        const values = vector.getChildAt(0), valueOffsets = vector.valueOffsets;
        for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end;) {
            values.set(itr++, value.get(++idx));
        }
    };
    /** @ignore */
    const setMap = (vector, index, value) => {
        const values = vector.getChildAt(0), valueOffsets = vector.valueOffsets;
        const entries = value instanceof Map ? [...value] : Object.entries(value);
        for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end;) {
            values.set(itr++, entries[++idx]);
        }
    };
    /** @ignore */ const _setStructArrayValue = (o, v) => (c, _, i) => c && c.set(o, v[i]);
    /** @ignore */ const _setStructVectorValue = (o, v) => (c, _, i) => c && c.set(o, v.get(i));
    /** @ignore */ const _setStructMapValue = (o, v) => (c, f, _) => c && c.set(o, v.get(f.name));
    /** @ignore */ const _setStructObjectValue = (o, v) => (c, f, _) => c && c.set(o, v[f.name]);
    /** @ignore */
    const setStruct = (vector, index, value) => {
        const setValue = value instanceof Map ? _setStructMapValue(index, value) :
            value instanceof AbstractVector ? _setStructVectorValue(index, value) :
                Array.isArray(value) ? _setStructArrayValue(index, value) :
                    _setStructObjectValue(index, value);
        vector.type.children.forEach((f, i) => setValue(vector.getChildAt(i), f, i));
    };
    /* istanbul ignore next */
    /** @ignore */
    const setUnion = (vector, index, value) => {
        vector.type.mode === UnionMode.Dense ?
            setDenseUnion(vector, index, value) :
            setSparseUnion(vector, index, value);
    };
    /** @ignore */
    const setDenseUnion = (vector, index, value) => {
        const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];
        const child = vector.getChildAt(childIndex);
        child && child.set(vector.valueOffsets[index], value);
    };
    /** @ignore */
    const setSparseUnion = (vector, index, value) => {
        const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];
        const child = vector.getChildAt(childIndex);
        child && child.set(index, value);
    };
    /** @ignore */
    const setDictionary = (vector, index, value) => {
        const key = vector.getKey(index);
        if (key !== null) {
            vector.setValue(key, value);
        }
    };
    /* istanbul ignore next */
    /** @ignore */
    const setIntervalValue = (vector, index, value) => {
        (vector.type.unit === IntervalUnit.DAY_TIME)
            ? setIntervalDayTime(vector, index, value)
            : setIntervalYearMonth(vector, index, value);
    };
    /** @ignore */
    const setIntervalDayTime = ({ values }, index, value) => { values.set(value.subarray(0, 2), 2 * index); };
    /** @ignore */
    const setIntervalYearMonth = ({ values }, index, value) => { values[index] = (value[0] * 12) + (value[1] % 12); };
    /** @ignore */
    const setFixedSizeList = (vector, index, value) => {
        const child = vector.getChildAt(0), { stride } = vector;
        for (let idx = -1, offset = index * stride; ++idx < stride;) {
            child.set(offset + idx, value.get(idx));
        }
    };
    SetVisitor.prototype.visitBool = setBool;
    SetVisitor.prototype.visitInt = setInt;
    SetVisitor.prototype.visitInt8 = setNumeric;
    SetVisitor.prototype.visitInt16 = setNumeric;
    SetVisitor.prototype.visitInt32 = setNumeric;
    SetVisitor.prototype.visitInt64 = setNumericX2;
    SetVisitor.prototype.visitUint8 = setNumeric;
    SetVisitor.prototype.visitUint16 = setNumeric;
    SetVisitor.prototype.visitUint32 = setNumeric;
    SetVisitor.prototype.visitUint64 = setNumericX2;
    SetVisitor.prototype.visitFloat = setFloat;
    SetVisitor.prototype.visitFloat16 = setFloat16;
    SetVisitor.prototype.visitFloat32 = setNumeric;
    SetVisitor.prototype.visitFloat64 = setNumeric;
    SetVisitor.prototype.visitUtf8 = setUtf8;
    SetVisitor.prototype.visitBinary = setBinary;
    SetVisitor.prototype.visitFixedSizeBinary = setFixedSizeBinary;
    SetVisitor.prototype.visitDate = setDate;
    SetVisitor.prototype.visitDateDay = setDateDay;
    SetVisitor.prototype.visitDateMillisecond = setDateMillisecond;
    SetVisitor.prototype.visitTimestamp = setTimestamp;
    SetVisitor.prototype.visitTimestampSecond = setTimestampSecond;
    SetVisitor.prototype.visitTimestampMillisecond = setTimestampMillisecond;
    SetVisitor.prototype.visitTimestampMicrosecond = setTimestampMicrosecond;
    SetVisitor.prototype.visitTimestampNanosecond = setTimestampNanosecond;
    SetVisitor.prototype.visitTime = setTime;
    SetVisitor.prototype.visitTimeSecond = setTimeSecond;
    SetVisitor.prototype.visitTimeMillisecond = setTimeMillisecond;
    SetVisitor.prototype.visitTimeMicrosecond = setTimeMicrosecond;
    SetVisitor.prototype.visitTimeNanosecond = setTimeNanosecond;
    SetVisitor.prototype.visitDecimal = setDecimal;
    SetVisitor.prototype.visitList = setList;
    SetVisitor.prototype.visitStruct = setStruct;
    SetVisitor.prototype.visitUnion = setUnion;
    SetVisitor.prototype.visitDenseUnion = setDenseUnion;
    SetVisitor.prototype.visitSparseUnion = setSparseUnion;
    SetVisitor.prototype.visitDictionary = setDictionary;
    SetVisitor.prototype.visitInterval = setIntervalValue;
    SetVisitor.prototype.visitIntervalDayTime = setIntervalDayTime;
    SetVisitor.prototype.visitIntervalYearMonth = setIntervalYearMonth;
    SetVisitor.prototype.visitFixedSizeList = setFixedSizeList;
    SetVisitor.prototype.visitMap = setMap;
    /** @ignore */
    const instance$f = new SetVisitor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class GetBuilderCtor extends Visitor {
        visitNull() { return NullBuilder; }
        visitBool() { return BoolBuilder; }
        visitInt() { return IntBuilder; }
        visitInt8() { return Int8Builder; }
        visitInt16() { return Int16Builder; }
        visitInt32() { return Int32Builder; }
        visitInt64() { return Int64Builder; }
        visitUint8() { return Uint8Builder; }
        visitUint16() { return Uint16Builder; }
        visitUint32() { return Uint32Builder; }
        visitUint64() { return Uint64Builder; }
        visitFloat() { return FloatBuilder; }
        visitFloat16() { return Float16Builder; }
        visitFloat32() { return Float32Builder; }
        visitFloat64() { return Float64Builder; }
        visitUtf8() { return Utf8Builder; }
        visitBinary() { return BinaryBuilder; }
        visitFixedSizeBinary() { return FixedSizeBinaryBuilder; }
        visitDate() { return DateBuilder; }
        visitDateDay() { return DateDayBuilder; }
        visitDateMillisecond() { return DateMillisecondBuilder; }
        visitTimestamp() { return TimestampBuilder; }
        visitTimestampSecond() { return TimestampSecondBuilder; }
        visitTimestampMillisecond() { return TimestampMillisecondBuilder; }
        visitTimestampMicrosecond() { return TimestampMicrosecondBuilder; }
        visitTimestampNanosecond() { return TimestampNanosecondBuilder; }
        visitTime() { return TimeBuilder; }
        visitTimeSecond() { return TimeSecondBuilder; }
        visitTimeMillisecond() { return TimeMillisecondBuilder; }
        visitTimeMicrosecond() { return TimeMicrosecondBuilder; }
        visitTimeNanosecond() { return TimeNanosecondBuilder; }
        visitDecimal() { return DecimalBuilder; }
        visitList() { return ListBuilder; }
        visitStruct() { return StructBuilder; }
        visitUnion() { return UnionBuilder; }
        visitDenseUnion() { return DenseUnionBuilder; }
        visitSparseUnion() { return SparseUnionBuilder; }
        visitDictionary() { return DictionaryBuilder; }
        visitInterval() { return IntervalBuilder; }
        visitIntervalDayTime() { return IntervalDayTimeBuilder; }
        visitIntervalYearMonth() { return IntervalYearMonthBuilder; }
        visitFixedSizeList() { return FixedSizeListBuilder; }
        visitMap() { return MapBuilder; }
    }
    /** @ignore */
    const instance$e = new GetBuilderCtor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @nocollapse */
    Builder$2.new = newBuilder;
    function newBuilder(options) {
        const type = options.type;
        const builder = new (instance$e.getVisitFn(type)())(options);
        if (type.children && type.children.length > 0) {
            const children = options['children'] || [];
            const defaultOptions = { 'nullValues': options['nullValues'] };
            const getChildOptions = Array.isArray(children)
                ? ((_, i) => children[i] || defaultOptions)
                : (({ name }) => children[name] || defaultOptions);
            type.children.forEach((field, index) => {
                const { type } = field;
                const opts = getChildOptions(field, index);
                builder.children.push(newBuilder({ ...opts, type }));
            });
        }
        return builder;
    }
    Object.keys(Type$2)
        .map((T) => Type$2[T])
        .filter((T) => typeof T === 'number' && T !== Type$2.NONE)
        .forEach((typeId) => {
        const BuilderCtor = instance$e.visit(typeId);
        BuilderCtor.prototype._setValue = instance$f.getVisitFn(typeId);
    });
    Utf8Builder.prototype._setValue = instance$f.visitBinary;

    // automatically generated by the FlatBuffers compiler, do not modify
    /**
     * ----------------------------------------------------------------------
     * Arrow File metadata
     *
     *
     * @constructor
     */
    var org;
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Footer {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Footer
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * @param flatbuffers.ByteBuffer bb
                         * @param Footer= obj
                         * @returns Footer
                         */
                        static getRootAsFooter(bb, obj) {
                            return (obj || new Footer).__init(bb.readInt32(bb.position()) + bb.position(), bb);
                        }
                        /**
                         * @returns org.apache.arrow.flatbuf.MetadataVersion
                         */
                        version() {
                            let offset = this.bb.__offset(this.bb_pos, 4);
                            return offset ? /**  */ (this.bb.readInt16(this.bb_pos + offset)) : org$2.apache.arrow.flatbuf.MetadataVersion.V1;
                        }
                        /**
                         * @param org.apache.arrow.flatbuf.Schema= obj
                         * @returns org.apache.arrow.flatbuf.Schema|null
                         */
                        schema(obj) {
                            let offset = this.bb.__offset(this.bb_pos, 6);
                            return offset ? (obj || new org$2.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
                        }
                        /**
                         * @param number index
                         * @param org.apache.arrow.flatbuf.Block= obj
                         * @returns org.apache.arrow.flatbuf.Block
                         */
                        dictionaries(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? (obj || new org.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos + offset) + index * 24, this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        dictionariesLength() {
                            let offset = this.bb.__offset(this.bb_pos, 8);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param number index
                         * @param org.apache.arrow.flatbuf.Block= obj
                         * @returns org.apache.arrow.flatbuf.Block
                         */
                        recordBatches(index, obj) {
                            let offset = this.bb.__offset(this.bb_pos, 10);
                            return offset ? (obj || new org.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos + offset) + index * 24, this.bb) : null;
                        }
                        /**
                         * @returns number
                         */
                        recordBatchesLength() {
                            let offset = this.bb.__offset(this.bb_pos, 10);
                            return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         */
                        static startFooter(builder) {
                            builder.startObject(4);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param org.apache.arrow.flatbuf.MetadataVersion version
                         */
                        static addVersion(builder, version) {
                            builder.addFieldInt16(0, version, org$2.apache.arrow.flatbuf.MetadataVersion.V1);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset schemaOffset
                         */
                        static addSchema(builder, schemaOffset) {
                            builder.addFieldOffset(1, schemaOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset dictionariesOffset
                         */
                        static addDictionaries(builder, dictionariesOffset) {
                            builder.addFieldOffset(2, dictionariesOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startDictionariesVector(builder, numElems) {
                            builder.startVector(24, numElems, 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset recordBatchesOffset
                         */
                        static addRecordBatches(builder, recordBatchesOffset) {
                            builder.addFieldOffset(3, recordBatchesOffset, 0);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param number numElems
                         */
                        static startRecordBatchesVector(builder, numElems) {
                            builder.startVector(24, numElems, 8);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @returns flatbuffers.Offset
                         */
                        static endFooter(builder) {
                            let offset = builder.endObject();
                            return offset;
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Offset offset
                         */
                        static finishFooterBuffer(builder, offset) {
                            builder.finish(offset);
                        }
                        static createFooter(builder, version, schemaOffset, dictionariesOffset, recordBatchesOffset) {
                            Footer.startFooter(builder);
                            Footer.addVersion(builder, version);
                            Footer.addSchema(builder, schemaOffset);
                            Footer.addDictionaries(builder, dictionariesOffset);
                            Footer.addRecordBatches(builder, recordBatchesOffset);
                            return Footer.endFooter(builder);
                        }
                    }
                    flatbuf.Footer = Footer;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org || (org = {}));
    /**
     * @constructor
     */
    (function (org) {
        (function (apache) {
            (function (arrow) {
                (function (flatbuf) {
                    class Block {
                        constructor() {
                            this.bb = null;
                            this.bb_pos = 0;
                        }
                        /**
                         * @param number i
                         * @param flatbuffers.ByteBuffer bb
                         * @returns Block
                         */
                        __init(i, bb) {
                            this.bb_pos = i;
                            this.bb = bb;
                            return this;
                        }
                        /**
                         * Index to the start of the RecordBlock (note this is past the Message header)
                         *
                         * @returns flatbuffers.Long
                         */
                        offset() {
                            return this.bb.readInt64(this.bb_pos);
                        }
                        /**
                         * Length of the metadata
                         *
                         * @returns number
                         */
                        metaDataLength() {
                            return this.bb.readInt32(this.bb_pos + 8);
                        }
                        /**
                         * Length of the data (this is aligned so there can be a gap between this and
                         * the metatdata).
                         *
                         * @returns flatbuffers.Long
                         */
                        bodyLength() {
                            return this.bb.readInt64(this.bb_pos + 16);
                        }
                        /**
                         * @param flatbuffers.Builder builder
                         * @param flatbuffers.Long offset
                         * @param number metaDataLength
                         * @param flatbuffers.Long bodyLength
                         * @returns flatbuffers.Offset
                         */
                        static createBlock(builder, offset, metaDataLength, bodyLength) {
                            builder.prep(8, 24);
                            builder.writeInt64(bodyLength);
                            builder.pad(4);
                            builder.writeInt32(metaDataLength);
                            builder.writeInt64(offset);
                            return builder.offset();
                        }
                    }
                    flatbuf.Block = Block;
                })(arrow.flatbuf || (arrow.flatbuf = {}));
            })(apache.arrow || (apache.arrow = {}));
        })(org.apache || (org.apache = {}));
    })(org || (org = {}));

    // Licensed to the Apache Software Foundation (ASF) under one
    var Long$2 = flatbuffers.Long;
    var Builder$1 = flatbuffers.Builder;
    var ByteBuffer$2 = flatbuffers.ByteBuffer;
    var _Block = org.apache.arrow.flatbuf.Block;
    var _Footer = org.apache.arrow.flatbuf.Footer;
    /** @ignore */
    class Footer_ {
        constructor(schema, version = MetadataVersion.V4, recordBatches, dictionaryBatches) {
            this.schema = schema;
            this.version = version;
            recordBatches && (this._recordBatches = recordBatches);
            dictionaryBatches && (this._dictionaryBatches = dictionaryBatches);
        }
        /** @nocollapse */
        static decode(buf) {
            buf = new ByteBuffer$2(toUint8Array(buf));
            const footer = _Footer.getRootAsFooter(buf);
            const schema = Schema.decode(footer.schema());
            return new OffHeapFooter(schema, footer);
        }
        /** @nocollapse */
        static encode(footer) {
            const b = new Builder$1();
            const schemaOffset = Schema.encode(b, footer.schema);
            _Footer.startRecordBatchesVector(b, footer.numRecordBatches);
            [...footer.recordBatches()].slice().reverse().forEach((rb) => FileBlock.encode(b, rb));
            const recordBatchesOffset = b.endVector();
            _Footer.startDictionariesVector(b, footer.numDictionaries);
            [...footer.dictionaryBatches()].slice().reverse().forEach((db) => FileBlock.encode(b, db));
            const dictionaryBatchesOffset = b.endVector();
            _Footer.startFooter(b);
            _Footer.addSchema(b, schemaOffset);
            _Footer.addVersion(b, MetadataVersion.V4);
            _Footer.addRecordBatches(b, recordBatchesOffset);
            _Footer.addDictionaries(b, dictionaryBatchesOffset);
            _Footer.finishFooterBuffer(b, _Footer.endFooter(b));
            return b.asUint8Array();
        }
        get numRecordBatches() { return this._recordBatches.length; }
        get numDictionaries() { return this._dictionaryBatches.length; }
        *recordBatches() {
            for (let block, i = -1, n = this.numRecordBatches; ++i < n;) {
                if (block = this.getRecordBatch(i)) {
                    yield block;
                }
            }
        }
        *dictionaryBatches() {
            for (let block, i = -1, n = this.numDictionaries; ++i < n;) {
                if (block = this.getDictionaryBatch(i)) {
                    yield block;
                }
            }
        }
        getRecordBatch(index) {
            return index >= 0
                && index < this.numRecordBatches
                && this._recordBatches[index] || null;
        }
        getDictionaryBatch(index) {
            return index >= 0
                && index < this.numDictionaries
                && this._dictionaryBatches[index] || null;
        }
    }
    /** @ignore */
    class OffHeapFooter extends Footer_ {
        constructor(schema, _footer) {
            super(schema, _footer.version());
            this._footer = _footer;
        }
        get numRecordBatches() { return this._footer.recordBatchesLength(); }
        get numDictionaries() { return this._footer.dictionariesLength(); }
        getRecordBatch(index) {
            if (index >= 0 && index < this.numRecordBatches) {
                const fileBlock = this._footer.recordBatches(index);
                if (fileBlock) {
                    return FileBlock.decode(fileBlock);
                }
            }
            return null;
        }
        getDictionaryBatch(index) {
            if (index >= 0 && index < this.numDictionaries) {
                const fileBlock = this._footer.dictionaries(index);
                if (fileBlock) {
                    return FileBlock.decode(fileBlock);
                }
            }
            return null;
        }
    }
    /** @ignore */
    class FileBlock {
        constructor(metaDataLength, bodyLength, offset) {
            this.metaDataLength = metaDataLength;
            this.offset = typeof offset === 'number' ? offset : offset.low;
            this.bodyLength = typeof bodyLength === 'number' ? bodyLength : bodyLength.low;
        }
        /** @nocollapse */
        static decode(block) {
            return new FileBlock(block.metaDataLength(), block.bodyLength(), block.offset());
        }
        /** @nocollapse */
        static encode(b, fileBlock) {
            const { metaDataLength } = fileBlock;
            const offset = new Long$2(fileBlock.offset, 0);
            const bodyLength = new Long$2(fileBlock.bodyLength, 0);
            return _Block.createBlock(b, offset, metaDataLength, bodyLength);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class AsyncByteQueue extends AsyncQueue {
        write(value) {
            if ((value = toUint8Array(value)).byteLength > 0) {
                return super.write(value);
            }
        }
        toString(sync = false) {
            return sync
                ? decodeUtf8(this.toUint8Array(true))
                : this.toUint8Array(false).then(decodeUtf8);
        }
        toUint8Array(sync = false) {
            return sync ? joinUint8Arrays(this._values)[0] : (async () => {
                let buffers = [], byteLength = 0;
                for await (const chunk of this) {
                    buffers.push(chunk);
                    byteLength += chunk.byteLength;
                }
                return joinUint8Arrays(buffers, byteLength)[0];
            })();
        }
    }
    /** @ignore */
    class ByteStream {
        constructor(source) {
            if (source) {
                this.source = new ByteStreamSource(streamAdapters.fromIterable(source));
            }
        }
        [Symbol.iterator]() { return this; }
        next(value) { return this.source.next(value); }
        throw(value) { return this.source.throw(value); }
        return(value) { return this.source.return(value); }
        peek(size) { return this.source.peek(size); }
        read(size) { return this.source.read(size); }
    }
    /** @ignore */
    class AsyncByteStream {
        constructor(source) {
            if (source instanceof AsyncByteStream) {
                this.source = source.source;
            }
            else if (source instanceof AsyncByteQueue) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));
            }
            else if (isReadableNodeStream(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromNodeStream(source));
            }
            else if (isReadableDOMStream(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromDOMStream(source));
            }
            else if (isFetchResponse(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromDOMStream(source.body));
            }
            else if (isIterable(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromIterable(source));
            }
            else if (isPromise(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));
            }
            else if (isAsyncIterable(source)) {
                this.source = new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(source));
            }
        }
        [Symbol.asyncIterator]() { return this; }
        next(value) { return this.source.next(value); }
        throw(value) { return this.source.throw(value); }
        return(value) { return this.source.return(value); }
        get closed() { return this.source.closed; }
        cancel(reason) { return this.source.cancel(reason); }
        peek(size) { return this.source.peek(size); }
        read(size) { return this.source.read(size); }
    }
    /** @ignore */
    class ByteStreamSource {
        constructor(source) {
            this.source = source;
        }
        cancel(reason) { this.return(reason); }
        peek(size) { return this.next(size, 'peek').value; }
        read(size) { return this.next(size, 'read').value; }
        next(size, cmd = 'read') { return this.source.next({ cmd, size }); }
        throw(value) { return Object.create((this.source.throw && this.source.throw(value)) || ITERATOR_DONE); }
        return(value) { return Object.create((this.source.return && this.source.return(value)) || ITERATOR_DONE); }
    }
    /** @ignore */
    class AsyncByteStreamSource {
        constructor(source) {
            this.source = source;
            this._closedPromise = new Promise((r) => this._closedPromiseResolve = r);
        }
        async cancel(reason) { await this.return(reason); }
        get closed() { return this._closedPromise; }
        async read(size) { return (await this.next(size, 'read')).value; }
        async peek(size) { return (await this.next(size, 'peek')).value; }
        async next(size, cmd = 'read') { return (await this.source.next({ cmd, size })); }
        async throw(value) {
            const result = (this.source.throw && await this.source.throw(value)) || ITERATOR_DONE;
            this._closedPromiseResolve && this._closedPromiseResolve();
            this._closedPromiseResolve = undefined;
            return Object.create(result);
        }
        async return(value) {
            const result = (this.source.return && await this.source.return(value)) || ITERATOR_DONE;
            this._closedPromiseResolve && this._closedPromiseResolve();
            this._closedPromiseResolve = undefined;
            return Object.create(result);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class RandomAccessFile extends ByteStream {
        constructor(buffer, byteLength) {
            super();
            this.position = 0;
            this.buffer = toUint8Array(buffer);
            this.size = typeof byteLength === 'undefined' ? this.buffer.byteLength : byteLength;
        }
        readInt32(position) {
            const { buffer, byteOffset } = this.readAt(position, 4);
            return new DataView(buffer, byteOffset).getInt32(0, true);
        }
        seek(position) {
            this.position = Math.min(position, this.size);
            return position < this.size;
        }
        read(nBytes) {
            const { buffer, size, position } = this;
            if (buffer && position < size) {
                if (typeof nBytes !== 'number') {
                    nBytes = Infinity;
                }
                this.position = Math.min(size, position + Math.min(size - position, nBytes));
                return buffer.subarray(position, this.position);
            }
            return null;
        }
        readAt(position, nBytes) {
            const buf = this.buffer;
            const end = Math.min(this.size, position + nBytes);
            return buf ? buf.subarray(position, end) : new Uint8Array(nBytes);
        }
        close() { this.buffer && (this.buffer = null); }
        throw(value) { this.close(); return { done: true, value }; }
        return(value) { this.close(); return { done: true, value }; }
    }
    /** @ignore */
    class AsyncRandomAccessFile extends AsyncByteStream {
        constructor(file, byteLength) {
            super();
            this.position = 0;
            this._handle = file;
            if (typeof byteLength === 'number') {
                this.size = byteLength;
            }
            else {
                this._pending = (async () => {
                    this.size = (await file.stat()).size;
                    delete this._pending;
                })();
            }
        }
        async readInt32(position) {
            const { buffer, byteOffset } = await this.readAt(position, 4);
            return new DataView(buffer, byteOffset).getInt32(0, true);
        }
        async seek(position) {
            this._pending && await this._pending;
            this.position = Math.min(position, this.size);
            return position < this.size;
        }
        async read(nBytes) {
            this._pending && await this._pending;
            const { _handle: file, size, position } = this;
            if (file && position < size) {
                if (typeof nBytes !== 'number') {
                    nBytes = Infinity;
                }
                let pos = position, offset = 0, bytesRead = 0;
                let end = Math.min(size, pos + Math.min(size - pos, nBytes));
                let buffer = new Uint8Array(Math.max(0, (this.position = end) - pos));
                while ((pos += bytesRead) < end && (offset += bytesRead) < buffer.byteLength) {
                    ({ bytesRead } = await file.read(buffer, offset, buffer.byteLength - offset, pos));
                }
                return buffer;
            }
            return null;
        }
        async readAt(position, nBytes) {
            this._pending && await this._pending;
            const { _handle: file, size } = this;
            if (file && (position + nBytes) < size) {
                const end = Math.min(size, position + nBytes);
                const buffer = new Uint8Array(end - position);
                return (await file.read(buffer, 0, nBytes, position)).buffer;
            }
            return new Uint8Array(nBytes);
        }
        async close() { const f = this._handle; this._handle = null; f && await f.close(); }
        async throw(value) { await this.close(); return { done: true, value }; }
        async return(value) { await this.close(); return { done: true, value }; }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    /** @ignore */
    const carryBit16 = 1 << 16;
    /** @ignore */
    function intAsHex(value) {
        if (value < 0) {
            value = 0xFFFFFFFF + value + 1;
        }
        return `0x${value.toString(16)}`;
    }
    /** @ignore */
    const kInt32DecimalDigits = 8;
    /** @ignore */
    const kPowersOfTen = [1,
        10,
        100,
        1000,
        10000,
        100000,
        1000000,
        10000000,
        100000000];
    /** @ignore */
    class BaseInt64 {
        constructor(buffer) {
            this.buffer = buffer;
        }
        high() { return this.buffer[1]; }
        low() { return this.buffer[0]; }
        _times(other) {
            // Break the left and right numbers into 16 bit chunks
            // so that we can multiply them without overflow.
            const L = new Uint32Array([
                this.buffer[1] >>> 16,
                this.buffer[1] & 0xFFFF,
                this.buffer[0] >>> 16,
                this.buffer[0] & 0xFFFF
            ]);
            const R = new Uint32Array([
                other.buffer[1] >>> 16,
                other.buffer[1] & 0xFFFF,
                other.buffer[0] >>> 16,
                other.buffer[0] & 0xFFFF
            ]);
            let product = L[3] * R[3];
            this.buffer[0] = product & 0xFFFF;
            let sum = product >>> 16;
            product = L[2] * R[3];
            sum += product;
            product = (L[3] * R[2]) >>> 0;
            sum += product;
            this.buffer[0] += sum << 16;
            this.buffer[1] = (sum >>> 0 < product ? carryBit16 : 0);
            this.buffer[1] += sum >>> 16;
            this.buffer[1] += L[1] * R[3] + L[2] * R[2] + L[3] * R[1];
            this.buffer[1] += (L[0] * R[3] + L[1] * R[2] + L[2] * R[1] + L[3] * R[0]) << 16;
            return this;
        }
        _plus(other) {
            const sum = (this.buffer[0] + other.buffer[0]) >>> 0;
            this.buffer[1] += other.buffer[1];
            if (sum < (this.buffer[0] >>> 0)) {
                ++this.buffer[1];
            }
            this.buffer[0] = sum;
        }
        lessThan(other) {
            return this.buffer[1] < other.buffer[1] ||
                (this.buffer[1] === other.buffer[1] && this.buffer[0] < other.buffer[0]);
        }
        equals(other) {
            return this.buffer[1] === other.buffer[1] && this.buffer[0] == other.buffer[0];
        }
        greaterThan(other) {
            return other.lessThan(this);
        }
        hex() {
            return `${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`;
        }
    }
    /** @ignore */
    class Uint64 extends BaseInt64 {
        times(other) {
            this._times(other);
            return this;
        }
        plus(other) {
            this._plus(other);
            return this;
        }
        /** @nocollapse */
        static from(val, out_buffer = new Uint32Array(2)) {
            return Uint64.fromString(typeof (val) === 'string' ? val : val.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromNumber(num, out_buffer = new Uint32Array(2)) {
            // Always parse numbers as strings - pulling out high and low bits
            // directly seems to lose precision sometimes
            // For example:
            //     > -4613034156400212000 >>> 0
            //     721782784
            // The correct lower 32-bits are 721782752
            return Uint64.fromString(num.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromString(str, out_buffer = new Uint32Array(2)) {
            const length = str.length;
            let out = new Uint64(out_buffer);
            for (let posn = 0; posn < length;) {
                const group = kInt32DecimalDigits < length - posn ?
                    kInt32DecimalDigits : length - posn;
                const chunk = new Uint64(new Uint32Array([parseInt(str.substr(posn, group), 10), 0]));
                const multiple = new Uint64(new Uint32Array([kPowersOfTen[group], 0]));
                out.times(multiple);
                out.plus(chunk);
                posn += group;
            }
            return out;
        }
        /** @nocollapse */
        static convertArray(values) {
            const data = new Uint32Array(values.length * 2);
            for (let i = -1, n = values.length; ++i < n;) {
                Uint64.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 2 * i * 4, 2));
            }
            return data;
        }
        /** @nocollapse */
        static multiply(left, right) {
            let rtrn = new Uint64(new Uint32Array(left.buffer));
            return rtrn.times(right);
        }
        /** @nocollapse */
        static add(left, right) {
            let rtrn = new Uint64(new Uint32Array(left.buffer));
            return rtrn.plus(right);
        }
    }
    /** @ignore */
    class Int64 extends BaseInt64 {
        negate() {
            this.buffer[0] = ~this.buffer[0] + 1;
            this.buffer[1] = ~this.buffer[1];
            if (this.buffer[0] == 0) {
                ++this.buffer[1];
            }
            return this;
        }
        times(other) {
            this._times(other);
            return this;
        }
        plus(other) {
            this._plus(other);
            return this;
        }
        lessThan(other) {
            // force high bytes to be signed
            const this_high = this.buffer[1] << 0;
            const other_high = other.buffer[1] << 0;
            return this_high < other_high ||
                (this_high === other_high && this.buffer[0] < other.buffer[0]);
        }
        /** @nocollapse */
        static from(val, out_buffer = new Uint32Array(2)) {
            return Int64.fromString(typeof (val) === 'string' ? val : val.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromNumber(num, out_buffer = new Uint32Array(2)) {
            // Always parse numbers as strings - pulling out high and low bits
            // directly seems to lose precision sometimes
            // For example:
            //     > -4613034156400212000 >>> 0
            //     721782784
            // The correct lower 32-bits are 721782752
            return Int64.fromString(num.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromString(str, out_buffer = new Uint32Array(2)) {
            // TODO: Assert that out_buffer is 0 and length = 2
            const negate = str.startsWith('-');
            const length = str.length;
            let out = new Int64(out_buffer);
            for (let posn = negate ? 1 : 0; posn < length;) {
                const group = kInt32DecimalDigits < length - posn ?
                    kInt32DecimalDigits : length - posn;
                const chunk = new Int64(new Uint32Array([parseInt(str.substr(posn, group), 10), 0]));
                const multiple = new Int64(new Uint32Array([kPowersOfTen[group], 0]));
                out.times(multiple);
                out.plus(chunk);
                posn += group;
            }
            return negate ? out.negate() : out;
        }
        /** @nocollapse */
        static convertArray(values) {
            const data = new Uint32Array(values.length * 2);
            for (let i = -1, n = values.length; ++i < n;) {
                Int64.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 2 * i * 4, 2));
            }
            return data;
        }
        /** @nocollapse */
        static multiply(left, right) {
            let rtrn = new Int64(new Uint32Array(left.buffer));
            return rtrn.times(right);
        }
        /** @nocollapse */
        static add(left, right) {
            let rtrn = new Int64(new Uint32Array(left.buffer));
            return rtrn.plus(right);
        }
    }
    /** @ignore */
    class Int128 {
        constructor(buffer) {
            this.buffer = buffer;
            // buffer[3] MSB (high)
            // buffer[2]
            // buffer[1]
            // buffer[0] LSB (low)
        }
        high() {
            return new Int64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset + 8, 2));
        }
        low() {
            return new Int64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset, 2));
        }
        negate() {
            this.buffer[0] = ~this.buffer[0] + 1;
            this.buffer[1] = ~this.buffer[1];
            this.buffer[2] = ~this.buffer[2];
            this.buffer[3] = ~this.buffer[3];
            if (this.buffer[0] == 0) {
                ++this.buffer[1];
            }
            if (this.buffer[1] == 0) {
                ++this.buffer[2];
            }
            if (this.buffer[2] == 0) {
                ++this.buffer[3];
            }
            return this;
        }
        times(other) {
            // Break the left and right numbers into 32 bit chunks
            // so that we can multiply them without overflow.
            const L0 = new Uint64(new Uint32Array([this.buffer[3], 0]));
            const L1 = new Uint64(new Uint32Array([this.buffer[2], 0]));
            const L2 = new Uint64(new Uint32Array([this.buffer[1], 0]));
            const L3 = new Uint64(new Uint32Array([this.buffer[0], 0]));
            const R0 = new Uint64(new Uint32Array([other.buffer[3], 0]));
            const R1 = new Uint64(new Uint32Array([other.buffer[2], 0]));
            const R2 = new Uint64(new Uint32Array([other.buffer[1], 0]));
            const R3 = new Uint64(new Uint32Array([other.buffer[0], 0]));
            let product = Uint64.multiply(L3, R3);
            this.buffer[0] = product.low();
            let sum = new Uint64(new Uint32Array([product.high(), 0]));
            product = Uint64.multiply(L2, R3);
            sum.plus(product);
            product = Uint64.multiply(L3, R2);
            sum.plus(product);
            this.buffer[1] = sum.low();
            this.buffer[3] = (sum.lessThan(product) ? 1 : 0);
            this.buffer[2] = sum.high();
            let high = new Uint64(new Uint32Array(this.buffer.buffer, this.buffer.byteOffset + 8, 2));
            high.plus(Uint64.multiply(L1, R3))
                .plus(Uint64.multiply(L2, R2))
                .plus(Uint64.multiply(L3, R1));
            this.buffer[3] += Uint64.multiply(L0, R3)
                .plus(Uint64.multiply(L1, R2))
                .plus(Uint64.multiply(L2, R1))
                .plus(Uint64.multiply(L3, R0)).low();
            return this;
        }
        plus(other) {
            let sums = new Uint32Array(4);
            sums[3] = (this.buffer[3] + other.buffer[3]) >>> 0;
            sums[2] = (this.buffer[2] + other.buffer[2]) >>> 0;
            sums[1] = (this.buffer[1] + other.buffer[1]) >>> 0;
            sums[0] = (this.buffer[0] + other.buffer[0]) >>> 0;
            if (sums[0] < (this.buffer[0] >>> 0)) {
                ++sums[1];
            }
            if (sums[1] < (this.buffer[1] >>> 0)) {
                ++sums[2];
            }
            if (sums[2] < (this.buffer[2] >>> 0)) {
                ++sums[3];
            }
            this.buffer[3] = sums[3];
            this.buffer[2] = sums[2];
            this.buffer[1] = sums[1];
            this.buffer[0] = sums[0];
            return this;
        }
        hex() {
            return `${intAsHex(this.buffer[3])} ${intAsHex(this.buffer[2])} ${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`;
        }
        /** @nocollapse */
        static multiply(left, right) {
            let rtrn = new Int128(new Uint32Array(left.buffer));
            return rtrn.times(right);
        }
        /** @nocollapse */
        static add(left, right) {
            let rtrn = new Int128(new Uint32Array(left.buffer));
            return rtrn.plus(right);
        }
        /** @nocollapse */
        static from(val, out_buffer = new Uint32Array(4)) {
            return Int128.fromString(typeof (val) === 'string' ? val : val.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromNumber(num, out_buffer = new Uint32Array(4)) {
            // Always parse numbers as strings - pulling out high and low bits
            // directly seems to lose precision sometimes
            // For example:
            //     > -4613034156400212000 >>> 0
            //     721782784
            // The correct lower 32-bits are 721782752
            return Int128.fromString(num.toString(), out_buffer);
        }
        /** @nocollapse */
        static fromString(str, out_buffer = new Uint32Array(4)) {
            // TODO: Assert that out_buffer is 0 and length = 4
            const negate = str.startsWith('-');
            const length = str.length;
            let out = new Int128(out_buffer);
            for (let posn = negate ? 1 : 0; posn < length;) {
                const group = kInt32DecimalDigits < length - posn ?
                    kInt32DecimalDigits : length - posn;
                const chunk = new Int128(new Uint32Array([parseInt(str.substr(posn, group), 10), 0, 0, 0]));
                const multiple = new Int128(new Uint32Array([kPowersOfTen[group], 0, 0, 0]));
                out.times(multiple);
                out.plus(chunk);
                posn += group;
            }
            return negate ? out.negate() : out;
        }
        /** @nocollapse */
        static convertArray(values) {
            // TODO: Distinguish between string and number at compile-time
            const data = new Uint32Array(values.length * 4);
            for (let i = -1, n = values.length; ++i < n;) {
                Int128.from(values[i], new Uint32Array(data.buffer, data.byteOffset + 4 * 4 * i, 4));
            }
            return data;
        }
    }

    var util_int_ = /*#__PURE__*/Object.freeze({
        __proto__: null,
        BaseInt64: BaseInt64,
        Uint64: Uint64,
        Int64: Int64,
        Int128: Int128
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class VectorLoader extends Visitor {
        constructor(bytes, nodes, buffers, dictionaries) {
            super();
            this.nodesIndex = -1;
            this.buffersIndex = -1;
            this.bytes = bytes;
            this.nodes = nodes;
            this.buffers = buffers;
            this.dictionaries = dictionaries;
        }
        visit(node) {
            return super.visit(node instanceof Field ? node.type : node);
        }
        visitNull(type, { length, } = this.nextFieldNode()) { return Data.Null(type, 0, length); }
        visitBool(type, { length, nullCount } = this.nextFieldNode()) { return Data.Bool(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitInt(type, { length, nullCount } = this.nextFieldNode()) { return Data.Int(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitFloat(type, { length, nullCount } = this.nextFieldNode()) { return Data.Float(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitUtf8(type, { length, nullCount } = this.nextFieldNode()) { return Data.Utf8(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.readData(type)); }
        visitBinary(type, { length, nullCount } = this.nextFieldNode()) { return Data.Binary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.readData(type)); }
        visitFixedSizeBinary(type, { length, nullCount } = this.nextFieldNode()) { return Data.FixedSizeBinary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitDate(type, { length, nullCount } = this.nextFieldNode()) { return Data.Date(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitTimestamp(type, { length, nullCount } = this.nextFieldNode()) { return Data.Timestamp(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitTime(type, { length, nullCount } = this.nextFieldNode()) { return Data.Time(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitDecimal(type, { length, nullCount } = this.nextFieldNode()) { return Data.Decimal(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitList(type, { length, nullCount } = this.nextFieldNode()) { return Data.List(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.visit(type.children[0])); }
        visitStruct(type, { length, nullCount } = this.nextFieldNode()) { return Data.Struct(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.visitMany(type.children)); }
        visitUnion(type) { return type.mode === UnionMode.Sparse ? this.visitSparseUnion(type) : this.visitDenseUnion(type); }
        visitDenseUnion(type, { length, nullCount } = this.nextFieldNode()) { return Data.Union(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readTypeIds(type), this.readOffsets(type), this.visitMany(type.children)); }
        visitSparseUnion(type, { length, nullCount } = this.nextFieldNode()) { return Data.Union(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readTypeIds(type), this.visitMany(type.children)); }
        visitDictionary(type, { length, nullCount } = this.nextFieldNode()) { return Data.Dictionary(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type.indices), this.readDictionary(type)); }
        visitInterval(type, { length, nullCount } = this.nextFieldNode()) { return Data.Interval(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readData(type)); }
        visitFixedSizeList(type, { length, nullCount } = this.nextFieldNode()) { return Data.FixedSizeList(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.visit(type.children[0])); }
        visitMap(type, { length, nullCount } = this.nextFieldNode()) { return Data.Map(type, 0, length, nullCount, this.readNullBitmap(type, nullCount), this.readOffsets(type), this.visit(type.children[0])); }
        nextFieldNode() { return this.nodes[++this.nodesIndex]; }
        nextBufferRange() { return this.buffers[++this.buffersIndex]; }
        readNullBitmap(type, nullCount, buffer = this.nextBufferRange()) {
            return nullCount > 0 && this.readData(type, buffer) || new Uint8Array(0);
        }
        readOffsets(type, buffer) { return this.readData(type, buffer); }
        readTypeIds(type, buffer) { return this.readData(type, buffer); }
        readData(_type, { length, offset } = this.nextBufferRange()) {
            return this.bytes.subarray(offset, offset + length);
        }
        readDictionary(type) {
            return this.dictionaries.get(type.id);
        }
    }
    /** @ignore */
    class JSONVectorLoader extends VectorLoader {
        constructor(sources, nodes, buffers, dictionaries) {
            super(new Uint8Array(0), nodes, buffers, dictionaries);
            this.sources = sources;
        }
        readNullBitmap(_type, nullCount, { offset } = this.nextBufferRange()) {
            return nullCount <= 0 ? new Uint8Array(0) : packBools(this.sources[offset]);
        }
        readOffsets(_type, { offset } = this.nextBufferRange()) {
            return toArrayBufferView(Uint8Array, toArrayBufferView(Int32Array, this.sources[offset]));
        }
        readTypeIds(type, { offset } = this.nextBufferRange()) {
            return toArrayBufferView(Uint8Array, toArrayBufferView(type.ArrayType, this.sources[offset]));
        }
        readData(type, { offset } = this.nextBufferRange()) {
            const { sources } = this;
            if (DataType.isTimestamp(type)) {
                return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset]));
            }
            else if ((DataType.isInt(type) || DataType.isTime(type)) && type.bitWidth === 64) {
                return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset]));
            }
            else if (DataType.isDate(type) && type.unit === DateUnit.MILLISECOND) {
                return toArrayBufferView(Uint8Array, Int64.convertArray(sources[offset]));
            }
            else if (DataType.isDecimal(type)) {
                return toArrayBufferView(Uint8Array, Int128.convertArray(sources[offset]));
            }
            else if (DataType.isBinary(type) || DataType.isFixedSizeBinary(type)) {
                return binaryDataFromJSON(sources[offset]);
            }
            else if (DataType.isBool(type)) {
                return packBools(sources[offset]);
            }
            else if (DataType.isUtf8(type)) {
                return encodeUtf8(sources[offset].join(''));
            }
            return toArrayBufferView(Uint8Array, toArrayBufferView(type.ArrayType, sources[offset].map((x) => +x)));
        }
    }
    /** @ignore */
    function binaryDataFromJSON(values) {
        // "DATA": ["49BC7D5B6C47D2","3F5FB6D9322026"]
        // There are definitely more efficient ways to do this... but it gets the
        // job done.
        const joined = values.join('');
        const data = new Uint8Array(joined.length / 2);
        for (let i = 0; i < joined.length; i += 2) {
            data[i >> 1] = parseInt(joined.substr(i, 2), 16);
        }
        return data;
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    var Long$1 = flatbuffers.Long;
    var Null = org$2.apache.arrow.flatbuf.Null;
    var Int = org$2.apache.arrow.flatbuf.Int;
    var FloatingPoint = org$2.apache.arrow.flatbuf.FloatingPoint;
    var Binary = org$2.apache.arrow.flatbuf.Binary;
    var Bool = org$2.apache.arrow.flatbuf.Bool;
    var Utf8 = org$2.apache.arrow.flatbuf.Utf8;
    var Decimal = org$2.apache.arrow.flatbuf.Decimal;
    var Date$1 = org$2.apache.arrow.flatbuf.Date;
    var Time = org$2.apache.arrow.flatbuf.Time;
    var Timestamp = org$2.apache.arrow.flatbuf.Timestamp;
    var Interval = org$2.apache.arrow.flatbuf.Interval;
    var List = org$2.apache.arrow.flatbuf.List;
    var Struct = org$2.apache.arrow.flatbuf.Struct_;
    var Union = org$2.apache.arrow.flatbuf.Union;
    var DictionaryEncoding = org$2.apache.arrow.flatbuf.DictionaryEncoding;
    var FixedSizeBinary = org$2.apache.arrow.flatbuf.FixedSizeBinary;
    var FixedSizeList = org$2.apache.arrow.flatbuf.FixedSizeList;
    var Map_ = org$2.apache.arrow.flatbuf.Map;
    /** @ignore */
    class TypeAssembler extends Visitor {
        visit(node, builder) {
            return (node == null || builder == null) ? undefined : super.visit(node, builder);
        }
        visitNull(_node, b) {
            Null.startNull(b);
            return Null.endNull(b);
        }
        visitInt(node, b) {
            Int.startInt(b);
            Int.addBitWidth(b, node.bitWidth);
            Int.addIsSigned(b, node.isSigned);
            return Int.endInt(b);
        }
        visitFloat(node, b) {
            FloatingPoint.startFloatingPoint(b);
            FloatingPoint.addPrecision(b, node.precision);
            return FloatingPoint.endFloatingPoint(b);
        }
        visitBinary(_node, b) {
            Binary.startBinary(b);
            return Binary.endBinary(b);
        }
        visitBool(_node, b) {
            Bool.startBool(b);
            return Bool.endBool(b);
        }
        visitUtf8(_node, b) {
            Utf8.startUtf8(b);
            return Utf8.endUtf8(b);
        }
        visitDecimal(node, b) {
            Decimal.startDecimal(b);
            Decimal.addScale(b, node.scale);
            Decimal.addPrecision(b, node.precision);
            return Decimal.endDecimal(b);
        }
        visitDate(node, b) {
            Date$1.startDate(b);
            Date$1.addUnit(b, node.unit);
            return Date$1.endDate(b);
        }
        visitTime(node, b) {
            Time.startTime(b);
            Time.addUnit(b, node.unit);
            Time.addBitWidth(b, node.bitWidth);
            return Time.endTime(b);
        }
        visitTimestamp(node, b) {
            const timezone = (node.timezone && b.createString(node.timezone)) || undefined;
            Timestamp.startTimestamp(b);
            Timestamp.addUnit(b, node.unit);
            if (timezone !== undefined) {
                Timestamp.addTimezone(b, timezone);
            }
            return Timestamp.endTimestamp(b);
        }
        visitInterval(node, b) {
            Interval.startInterval(b);
            Interval.addUnit(b, node.unit);
            return Interval.endInterval(b);
        }
        visitList(_node, b) {
            List.startList(b);
            return List.endList(b);
        }
        visitStruct(_node, b) {
            Struct.startStruct_(b);
            return Struct.endStruct_(b);
        }
        visitUnion(node, b) {
            Union.startTypeIdsVector(b, node.typeIds.length);
            const typeIds = Union.createTypeIdsVector(b, node.typeIds);
            Union.startUnion(b);
            Union.addMode(b, node.mode);
            Union.addTypeIds(b, typeIds);
            return Union.endUnion(b);
        }
        visitDictionary(node, b) {
            const indexType = this.visit(node.indices, b);
            DictionaryEncoding.startDictionaryEncoding(b);
            DictionaryEncoding.addId(b, new Long$1(node.id, 0));
            DictionaryEncoding.addIsOrdered(b, node.isOrdered);
            if (indexType !== undefined) {
                DictionaryEncoding.addIndexType(b, indexType);
            }
            return DictionaryEncoding.endDictionaryEncoding(b);
        }
        visitFixedSizeBinary(node, b) {
            FixedSizeBinary.startFixedSizeBinary(b);
            FixedSizeBinary.addByteWidth(b, node.byteWidth);
            return FixedSizeBinary.endFixedSizeBinary(b);
        }
        visitFixedSizeList(node, b) {
            FixedSizeList.startFixedSizeList(b);
            FixedSizeList.addListSize(b, node.listSize);
            return FixedSizeList.endFixedSizeList(b);
        }
        visitMap(node, b) {
            Map_.startMap(b);
            Map_.addKeysSorted(b, node.keysSorted);
            return Map_.endMap(b);
        }
    }
    /** @ignore */
    const instance$d = new TypeAssembler();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function schemaFromJSON(_schema, dictionaries = new Map()) {
        return new Schema(schemaFieldsFromJSON(_schema, dictionaries), customMetadataFromJSON(_schema['customMetadata']), dictionaries);
    }
    /** @ignore */
    function recordBatchFromJSON(b) {
        return new RecordBatch$1(b['count'], fieldNodesFromJSON(b['columns']), buffersFromJSON(b['columns']));
    }
    /** @ignore */
    function dictionaryBatchFromJSON(b) {
        return new DictionaryBatch(recordBatchFromJSON(b['data']), b['id'], b['isDelta']);
    }
    /** @ignore */
    function schemaFieldsFromJSON(_schema, dictionaries) {
        return (_schema['fields'] || []).filter(Boolean).map((f) => Field.fromJSON(f, dictionaries));
    }
    /** @ignore */
    function fieldChildrenFromJSON(_field, dictionaries) {
        return (_field['children'] || []).filter(Boolean).map((f) => Field.fromJSON(f, dictionaries));
    }
    /** @ignore */
    function fieldNodesFromJSON(xs) {
        return (xs || []).reduce((fieldNodes, column) => [
            ...fieldNodes,
            new FieldNode(column['count'], nullCountFromJSON(column['VALIDITY'])),
            ...fieldNodesFromJSON(column['children'])
        ], []);
    }
    /** @ignore */
    function buffersFromJSON(xs, buffers = []) {
        for (let i = -1, n = (xs || []).length; ++i < n;) {
            const column = xs[i];
            column['VALIDITY'] && buffers.push(new BufferRegion(buffers.length, column['VALIDITY'].length));
            column['TYPE'] && buffers.push(new BufferRegion(buffers.length, column['TYPE'].length));
            column['OFFSET'] && buffers.push(new BufferRegion(buffers.length, column['OFFSET'].length));
            column['DATA'] && buffers.push(new BufferRegion(buffers.length, column['DATA'].length));
            buffers = buffersFromJSON(column['children'], buffers);
        }
        return buffers;
    }
    /** @ignore */
    function nullCountFromJSON(validity) {
        return (validity || []).reduce((sum, val) => sum + +(val === 0), 0);
    }
    /** @ignore */
    function fieldFromJSON(_field, dictionaries) {
        let id;
        let keys;
        let field;
        let dictMeta;
        let type;
        let dictType;
        // If no dictionary encoding
        if (!dictionaries || !(dictMeta = _field['dictionary'])) {
            type = typeFromJSON(_field, fieldChildrenFromJSON(_field, dictionaries));
            field = new Field(_field['name'], type, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));
        }
        // tslint:disable
        // If dictionary encoded and the first time we've seen this dictionary id, decode
        // the data type and child fields, then wrap in a Dictionary type and insert the
        // data type into the dictionary types map.
        else if (!dictionaries.has(id = dictMeta['id'])) {
            // a dictionary index defaults to signed 32 bit int if unspecified
            keys = (keys = dictMeta['indexType']) ? indexTypeFromJSON(keys) : new Int32();
            dictionaries.set(id, type = typeFromJSON(_field, fieldChildrenFromJSON(_field, dictionaries)));
            dictType = new Dictionary(type, keys, id, dictMeta['isOrdered']);
            field = new Field(_field['name'], dictType, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));
        }
        // If dictionary encoded, and have already seen this dictionary Id in the schema, then reuse the
        // data type and wrap in a new Dictionary type and field.
        else {
            // a dictionary index defaults to signed 32 bit int if unspecified
            keys = (keys = dictMeta['indexType']) ? indexTypeFromJSON(keys) : new Int32();
            dictType = new Dictionary(dictionaries.get(id), keys, id, dictMeta['isOrdered']);
            field = new Field(_field['name'], dictType, _field['nullable'], customMetadataFromJSON(_field['customMetadata']));
        }
        return field || null;
    }
    /** @ignore */
    function customMetadataFromJSON(_metadata) {
        return new Map(Object.entries(_metadata || {}));
    }
    /** @ignore */
    function indexTypeFromJSON(_type) {
        return new Int_(_type['isSigned'], _type['bitWidth']);
    }
    /** @ignore */
    function typeFromJSON(f, children) {
        const typeId = f['type']['name'];
        switch (typeId) {
            case 'NONE': return new Null$1();
            case 'null': return new Null$1();
            case 'binary': return new Binary$1();
            case 'utf8': return new Utf8$1();
            case 'bool': return new Bool$1();
            case 'list': return new List$1((children || [])[0]);
            case 'struct': return new Struct$1(children || []);
            case 'struct_': return new Struct$1(children || []);
        }
        switch (typeId) {
            case 'int': {
                const t = f['type'];
                return new Int_(t['isSigned'], t['bitWidth']);
            }
            case 'floatingpoint': {
                const t = f['type'];
                return new Float(Precision[t['precision']]);
            }
            case 'decimal': {
                const t = f['type'];
                return new Decimal$1(t['scale'], t['precision']);
            }
            case 'date': {
                const t = f['type'];
                return new Date_(DateUnit[t['unit']]);
            }
            case 'time': {
                const t = f['type'];
                return new Time_(TimeUnit[t['unit']], t['bitWidth']);
            }
            case 'timestamp': {
                const t = f['type'];
                return new Timestamp_(TimeUnit[t['unit']], t['timezone']);
            }
            case 'interval': {
                const t = f['type'];
                return new Interval_(IntervalUnit[t['unit']]);
            }
            case 'union': {
                const t = f['type'];
                return new Union_(UnionMode[t['mode']], (t['typeIds'] || []), children || []);
            }
            case 'fixedsizebinary': {
                const t = f['type'];
                return new FixedSizeBinary$1(t['byteWidth']);
            }
            case 'fixedsizelist': {
                const t = f['type'];
                return new FixedSizeList$1(t['listSize'], (children || [])[0]);
            }
            case 'map': {
                const t = f['type'];
                return new Map_$1((children || [])[0], t['keysSorted']);
            }
        }
        throw new Error(`Unrecognized type: "${typeId}"`);
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    var Long = flatbuffers.Long;
    var Builder = flatbuffers.Builder;
    var ByteBuffer$1 = flatbuffers.ByteBuffer;
    var Type$1 = org$2.apache.arrow.flatbuf.Type;
    var _Field = org$2.apache.arrow.flatbuf.Field;
    var _Schema = org$2.apache.arrow.flatbuf.Schema;
    var _Buffer = org$2.apache.arrow.flatbuf.Buffer;
    var _Message = org$1.apache.arrow.flatbuf.Message;
    var _KeyValue = org$2.apache.arrow.flatbuf.KeyValue;
    var _FieldNode = org$1.apache.arrow.flatbuf.FieldNode;
    var _Endianness = org$2.apache.arrow.flatbuf.Endianness;
    var _RecordBatch = org$1.apache.arrow.flatbuf.RecordBatch;
    var _DictionaryBatch = org$1.apache.arrow.flatbuf.DictionaryBatch;
    /**
     * @ignore
     * @private
     **/
    class Message {
        constructor(bodyLength, version, headerType, header) {
            this._version = version;
            this._headerType = headerType;
            this.body = new Uint8Array(0);
            header && (this._createHeader = () => header);
            this._bodyLength = typeof bodyLength === 'number' ? bodyLength : bodyLength.low;
        }
        /** @nocollapse */
        static fromJSON(msg, headerType) {
            const message = new Message(0, MetadataVersion.V4, headerType);
            message._createHeader = messageHeaderFromJSON(msg, headerType);
            return message;
        }
        /** @nocollapse */
        static decode(buf) {
            buf = new ByteBuffer$1(toUint8Array(buf));
            const _message = _Message.getRootAsMessage(buf);
            const bodyLength = _message.bodyLength();
            const version = _message.version();
            const headerType = _message.headerType();
            const message = new Message(bodyLength, version, headerType);
            message._createHeader = decodeMessageHeader(_message, headerType);
            return message;
        }
        /** @nocollapse */
        static encode(message) {
            let b = new Builder(), headerOffset = -1;
            if (message.isSchema()) {
                headerOffset = Schema.encode(b, message.header());
            }
            else if (message.isRecordBatch()) {
                headerOffset = RecordBatch$1.encode(b, message.header());
            }
            else if (message.isDictionaryBatch()) {
                headerOffset = DictionaryBatch.encode(b, message.header());
            }
            _Message.startMessage(b);
            _Message.addVersion(b, MetadataVersion.V4);
            _Message.addHeader(b, headerOffset);
            _Message.addHeaderType(b, message.headerType);
            _Message.addBodyLength(b, new Long(message.bodyLength, 0));
            _Message.finishMessageBuffer(b, _Message.endMessage(b));
            return b.asUint8Array();
        }
        /** @nocollapse */
        static from(header, bodyLength = 0) {
            if (header instanceof Schema) {
                return new Message(0, MetadataVersion.V4, MessageHeader.Schema, header);
            }
            if (header instanceof RecordBatch$1) {
                return new Message(bodyLength, MetadataVersion.V4, MessageHeader.RecordBatch, header);
            }
            if (header instanceof DictionaryBatch) {
                return new Message(bodyLength, MetadataVersion.V4, MessageHeader.DictionaryBatch, header);
            }
            throw new Error(`Unrecognized Message header: ${header}`);
        }
        get type() { return this.headerType; }
        get version() { return this._version; }
        get headerType() { return this._headerType; }
        get bodyLength() { return this._bodyLength; }
        header() { return this._createHeader(); }
        isSchema() { return this.headerType === MessageHeader.Schema; }
        isRecordBatch() { return this.headerType === MessageHeader.RecordBatch; }
        isDictionaryBatch() { return this.headerType === MessageHeader.DictionaryBatch; }
    }
    /**
     * @ignore
     * @private
     **/
    class RecordBatch$1 {
        constructor(length, nodes, buffers) {
            this._nodes = nodes;
            this._buffers = buffers;
            this._length = typeof length === 'number' ? length : length.low;
        }
        get nodes() { return this._nodes; }
        get length() { return this._length; }
        get buffers() { return this._buffers; }
    }
    /**
     * @ignore
     * @private
     **/
    class DictionaryBatch {
        constructor(data, id, isDelta = false) {
            this._data = data;
            this._isDelta = isDelta;
            this._id = typeof id === 'number' ? id : id.low;
        }
        get id() { return this._id; }
        get data() { return this._data; }
        get isDelta() { return this._isDelta; }
        get length() { return this.data.length; }
        get nodes() { return this.data.nodes; }
        get buffers() { return this.data.buffers; }
    }
    /**
     * @ignore
     * @private
     **/
    class BufferRegion {
        constructor(offset, length) {
            this.offset = typeof offset === 'number' ? offset : offset.low;
            this.length = typeof length === 'number' ? length : length.low;
        }
    }
    /**
     * @ignore
     * @private
     **/
    class FieldNode {
        constructor(length, nullCount) {
            this.length = typeof length === 'number' ? length : length.low;
            this.nullCount = typeof nullCount === 'number' ? nullCount : nullCount.low;
        }
    }
    /** @ignore */
    function messageHeaderFromJSON(message, type) {
        return (() => {
            switch (type) {
                case MessageHeader.Schema: return Schema.fromJSON(message);
                case MessageHeader.RecordBatch: return RecordBatch$1.fromJSON(message);
                case MessageHeader.DictionaryBatch: return DictionaryBatch.fromJSON(message);
            }
            throw new Error(`Unrecognized Message type: { name: ${MessageHeader[type]}, type: ${type} }`);
        });
    }
    /** @ignore */
    function decodeMessageHeader(message, type) {
        return (() => {
            switch (type) {
                case MessageHeader.Schema: return Schema.decode(message.header(new _Schema()));
                case MessageHeader.RecordBatch: return RecordBatch$1.decode(message.header(new _RecordBatch()), message.version());
                case MessageHeader.DictionaryBatch: return DictionaryBatch.decode(message.header(new _DictionaryBatch()), message.version());
            }
            throw new Error(`Unrecognized Message type: { name: ${MessageHeader[type]}, type: ${type} }`);
        });
    }
    Field['encode'] = encodeField;
    Field['decode'] = decodeField;
    Field['fromJSON'] = fieldFromJSON;
    Schema['encode'] = encodeSchema;
    Schema['decode'] = decodeSchema;
    Schema['fromJSON'] = schemaFromJSON;
    RecordBatch$1['encode'] = encodeRecordBatch;
    RecordBatch$1['decode'] = decodeRecordBatch;
    RecordBatch$1['fromJSON'] = recordBatchFromJSON;
    DictionaryBatch['encode'] = encodeDictionaryBatch;
    DictionaryBatch['decode'] = decodeDictionaryBatch;
    DictionaryBatch['fromJSON'] = dictionaryBatchFromJSON;
    FieldNode['encode'] = encodeFieldNode;
    FieldNode['decode'] = decodeFieldNode;
    BufferRegion['encode'] = encodeBufferRegion;
    BufferRegion['decode'] = decodeBufferRegion;
    /** @ignore */
    function decodeSchema(_schema, dictionaries = new Map()) {
        const fields = decodeSchemaFields(_schema, dictionaries);
        return new Schema(fields, decodeCustomMetadata(_schema), dictionaries);
    }
    /** @ignore */
    function decodeRecordBatch(batch, version = MetadataVersion.V4) {
        return new RecordBatch$1(batch.length(), decodeFieldNodes(batch), decodeBuffers(batch, version));
    }
    /** @ignore */
    function decodeDictionaryBatch(batch, version = MetadataVersion.V4) {
        return new DictionaryBatch(RecordBatch$1.decode(batch.data(), version), batch.id(), batch.isDelta());
    }
    /** @ignore */
    function decodeBufferRegion(b) {
        return new BufferRegion(b.offset(), b.length());
    }
    /** @ignore */
    function decodeFieldNode(f) {
        return new FieldNode(f.length(), f.nullCount());
    }
    /** @ignore */
    function decodeFieldNodes(batch) {
        const nodes = [];
        for (let f, i = -1, j = -1, n = batch.nodesLength(); ++i < n;) {
            if (f = batch.nodes(i)) {
                nodes[++j] = FieldNode.decode(f);
            }
        }
        return nodes;
    }
    /** @ignore */
    function decodeBuffers(batch, version) {
        const bufferRegions = [];
        for (let b, i = -1, j = -1, n = batch.buffersLength(); ++i < n;) {
            if (b = batch.buffers(i)) {
                // If this Arrow buffer was written before version 4,
                // advance the buffer's bb_pos 8 bytes to skip past
                // the now-removed page_id field
                if (version < MetadataVersion.V4) {
                    b.bb_pos += (8 * (i + 1));
                }
                bufferRegions[++j] = BufferRegion.decode(b);
            }
        }
        return bufferRegions;
    }
    /** @ignore */
    function decodeSchemaFields(schema, dictionaries) {
        const fields = [];
        for (let f, i = -1, j = -1, n = schema.fieldsLength(); ++i < n;) {
            if (f = schema.fields(i)) {
                fields[++j] = Field.decode(f, dictionaries);
            }
        }
        return fields;
    }
    /** @ignore */
    function decodeFieldChildren(field, dictionaries) {
        const children = [];
        for (let f, i = -1, j = -1, n = field.childrenLength(); ++i < n;) {
            if (f = field.children(i)) {
                children[++j] = Field.decode(f, dictionaries);
            }
        }
        return children;
    }
    /** @ignore */
    function decodeField(f, dictionaries) {
        let id;
        let field;
        let type;
        let keys;
        let dictType;
        let dictMeta;
        // If no dictionary encoding
        if (!dictionaries || !(dictMeta = f.dictionary())) {
            type = decodeFieldType(f, decodeFieldChildren(f, dictionaries));
            field = new Field(f.name(), type, f.nullable(), decodeCustomMetadata(f));
        }
        // tslint:disable
        // If dictionary encoded and the first time we've seen this dictionary id, decode
        // the data type and child fields, then wrap in a Dictionary type and insert the
        // data type into the dictionary types map.
        else if (!dictionaries.has(id = dictMeta.id().low)) {
            // a dictionary index defaults to signed 32 bit int if unspecified
            keys = (keys = dictMeta.indexType()) ? decodeIndexType(keys) : new Int32();
            dictionaries.set(id, type = decodeFieldType(f, decodeFieldChildren(f, dictionaries)));
            dictType = new Dictionary(type, keys, id, dictMeta.isOrdered());
            field = new Field(f.name(), dictType, f.nullable(), decodeCustomMetadata(f));
        }
        // If dictionary encoded, and have already seen this dictionary Id in the schema, then reuse the
        // data type and wrap in a new Dictionary type and field.
        else {
            // a dictionary index defaults to signed 32 bit int if unspecified
            keys = (keys = dictMeta.indexType()) ? decodeIndexType(keys) : new Int32();
            dictType = new Dictionary(dictionaries.get(id), keys, id, dictMeta.isOrdered());
            field = new Field(f.name(), dictType, f.nullable(), decodeCustomMetadata(f));
        }
        return field || null;
    }
    /** @ignore */
    function decodeCustomMetadata(parent) {
        const data = new Map();
        if (parent) {
            for (let entry, key, i = -1, n = parent.customMetadataLength() | 0; ++i < n;) {
                if ((entry = parent.customMetadata(i)) && (key = entry.key()) != null) {
                    data.set(key, entry.value());
                }
            }
        }
        return data;
    }
    /** @ignore */
    function decodeIndexType(_type) {
        return new Int_(_type.isSigned(), _type.bitWidth());
    }
    /** @ignore */
    function decodeFieldType(f, children) {
        const typeId = f.typeType();
        switch (typeId) {
            case Type$1.NONE: return new Null$1();
            case Type$1.Null: return new Null$1();
            case Type$1.Binary: return new Binary$1();
            case Type$1.Utf8: return new Utf8$1();
            case Type$1.Bool: return new Bool$1();
            case Type$1.List: return new List$1((children || [])[0]);
            case Type$1.Struct_: return new Struct$1(children || []);
        }
        switch (typeId) {
            case Type$1.Int: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Int());
                return new Int_(t.isSigned(), t.bitWidth());
            }
            case Type$1.FloatingPoint: {
                const t = f.type(new org$2.apache.arrow.flatbuf.FloatingPoint());
                return new Float(t.precision());
            }
            case Type$1.Decimal: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Decimal());
                return new Decimal$1(t.scale(), t.precision());
            }
            case Type$1.Date: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Date());
                return new Date_(t.unit());
            }
            case Type$1.Time: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Time());
                return new Time_(t.unit(), t.bitWidth());
            }
            case Type$1.Timestamp: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Timestamp());
                return new Timestamp_(t.unit(), t.timezone());
            }
            case Type$1.Interval: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Interval());
                return new Interval_(t.unit());
            }
            case Type$1.Union: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Union());
                return new Union_(t.mode(), t.typeIdsArray() || [], children || []);
            }
            case Type$1.FixedSizeBinary: {
                const t = f.type(new org$2.apache.arrow.flatbuf.FixedSizeBinary());
                return new FixedSizeBinary$1(t.byteWidth());
            }
            case Type$1.FixedSizeList: {
                const t = f.type(new org$2.apache.arrow.flatbuf.FixedSizeList());
                return new FixedSizeList$1(t.listSize(), (children || [])[0]);
            }
            case Type$1.Map: {
                const t = f.type(new org$2.apache.arrow.flatbuf.Map());
                return new Map_$1((children || [])[0], t.keysSorted());
            }
        }
        throw new Error(`Unrecognized type: "${Type$1[typeId]}" (${typeId})`);
    }
    /** @ignore */
    function encodeSchema(b, schema) {
        const fieldOffsets = schema.fields.map((f) => Field.encode(b, f));
        _Schema.startFieldsVector(b, fieldOffsets.length);
        const fieldsVectorOffset = _Schema.createFieldsVector(b, fieldOffsets);
        const metadataOffset = !(schema.metadata && schema.metadata.size > 0) ? -1 :
            _Schema.createCustomMetadataVector(b, [...schema.metadata].map(([k, v]) => {
                const key = b.createString(`${k}`);
                const val = b.createString(`${v}`);
                _KeyValue.startKeyValue(b);
                _KeyValue.addKey(b, key);
                _KeyValue.addValue(b, val);
                return _KeyValue.endKeyValue(b);
            }));
        _Schema.startSchema(b);
        _Schema.addFields(b, fieldsVectorOffset);
        _Schema.addEndianness(b, platformIsLittleEndian ? _Endianness.Little : _Endianness.Big);
        if (metadataOffset !== -1) {
            _Schema.addCustomMetadata(b, metadataOffset);
        }
        return _Schema.endSchema(b);
    }
    /** @ignore */
    function encodeField(b, field) {
        let nameOffset = -1;
        let typeOffset = -1;
        let dictionaryOffset = -1;
        let type = field.type;
        let typeId = field.typeId;
        if (!DataType.isDictionary(type)) {
            typeOffset = instance$d.visit(type, b);
        }
        else {
            typeId = type.dictionary.typeId;
            dictionaryOffset = instance$d.visit(type, b);
            typeOffset = instance$d.visit(type.dictionary, b);
        }
        const childOffsets = (type.children || []).map((f) => Field.encode(b, f));
        const childrenVectorOffset = _Field.createChildrenVector(b, childOffsets);
        const metadataOffset = !(field.metadata && field.metadata.size > 0) ? -1 :
            _Field.createCustomMetadataVector(b, [...field.metadata].map(([k, v]) => {
                const key = b.createString(`${k}`);
                const val = b.createString(`${v}`);
                _KeyValue.startKeyValue(b);
                _KeyValue.addKey(b, key);
                _KeyValue.addValue(b, val);
                return _KeyValue.endKeyValue(b);
            }));
        if (field.name) {
            nameOffset = b.createString(field.name);
        }
        _Field.startField(b);
        _Field.addType(b, typeOffset);
        _Field.addTypeType(b, typeId);
        _Field.addChildren(b, childrenVectorOffset);
        _Field.addNullable(b, !!field.nullable);
        if (nameOffset !== -1) {
            _Field.addName(b, nameOffset);
        }
        if (dictionaryOffset !== -1) {
            _Field.addDictionary(b, dictionaryOffset);
        }
        if (metadataOffset !== -1) {
            _Field.addCustomMetadata(b, metadataOffset);
        }
        return _Field.endField(b);
    }
    /** @ignore */
    function encodeRecordBatch(b, recordBatch) {
        const nodes = recordBatch.nodes || [];
        const buffers = recordBatch.buffers || [];
        _RecordBatch.startNodesVector(b, nodes.length);
        nodes.slice().reverse().forEach((n) => FieldNode.encode(b, n));
        const nodesVectorOffset = b.endVector();
        _RecordBatch.startBuffersVector(b, buffers.length);
        buffers.slice().reverse().forEach((b_) => BufferRegion.encode(b, b_));
        const buffersVectorOffset = b.endVector();
        _RecordBatch.startRecordBatch(b);
        _RecordBatch.addLength(b, new Long(recordBatch.length, 0));
        _RecordBatch.addNodes(b, nodesVectorOffset);
        _RecordBatch.addBuffers(b, buffersVectorOffset);
        return _RecordBatch.endRecordBatch(b);
    }
    /** @ignore */
    function encodeDictionaryBatch(b, dictionaryBatch) {
        const dataOffset = RecordBatch$1.encode(b, dictionaryBatch.data);
        _DictionaryBatch.startDictionaryBatch(b);
        _DictionaryBatch.addId(b, new Long(dictionaryBatch.id, 0));
        _DictionaryBatch.addIsDelta(b, dictionaryBatch.isDelta);
        _DictionaryBatch.addData(b, dataOffset);
        return _DictionaryBatch.endDictionaryBatch(b);
    }
    /** @ignore */
    function encodeFieldNode(b, node) {
        return _FieldNode.createFieldNode(b, new Long(node.length, 0), new Long(node.nullCount, 0));
    }
    /** @ignore */
    function encodeBufferRegion(b, node) {
        return _Buffer.createBuffer(b, new Long(node.offset, 0), new Long(node.length, 0));
    }
    /** @ignore */
    const platformIsLittleEndian = (function () {
        const buffer = new ArrayBuffer(2);
        new DataView(buffer).setInt16(0, 256, true /* littleEndian */);
        // Int16Array uses the platform's endianness.
        return new Int16Array(buffer)[0] === 256;
    })();

    // Licensed to the Apache Software Foundation (ASF) under one
    var ByteBuffer = flatbuffers.ByteBuffer;
    /** @ignore */ const invalidMessageType = (type) => `Expected ${MessageHeader[type]} Message in stream, but was null or length 0.`;
    /** @ignore */ const nullMessage = (type) => `Header pointer of flatbuffer-encoded ${MessageHeader[type]} Message is null or length 0.`;
    /** @ignore */ const invalidMessageMetadata = (expected, actual) => `Expected to read ${expected} metadata bytes, but only read ${actual}.`;
    /** @ignore */ const invalidMessageBodyLength = (expected, actual) => `Expected to read ${expected} bytes for message body, but only read ${actual}.`;
    /** @ignore */
    class MessageReader {
        constructor(source) {
            this.source = source instanceof ByteStream ? source : new ByteStream(source);
        }
        [Symbol.iterator]() { return this; }
        next() {
            let r;
            if ((r = this.readMetadataLength()).done) {
                return ITERATOR_DONE;
            }
            // ARROW-6313: If the first 4 bytes are continuation indicator (-1), read
            // the next 4 for the 32-bit metadata length. Otherwise, assume this is a
            // pre-v0.15 message, where the first 4 bytes are the metadata length.
            if ((r.value === -1) &&
                (r = this.readMetadataLength()).done) {
                return ITERATOR_DONE;
            }
            if ((r = this.readMetadata(r.value)).done) {
                return ITERATOR_DONE;
            }
            return r;
        }
        throw(value) { return this.source.throw(value); }
        return(value) { return this.source.return(value); }
        readMessage(type) {
            let r;
            if ((r = this.next()).done) {
                return null;
            }
            if ((type != null) && r.value.headerType !== type) {
                throw new Error(invalidMessageType(type));
            }
            return r.value;
        }
        readMessageBody(bodyLength) {
            if (bodyLength <= 0) {
                return new Uint8Array(0);
            }
            const buf = toUint8Array(this.source.read(bodyLength));
            if (buf.byteLength < bodyLength) {
                throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));
            }
            // 1. Work around bugs in fs.ReadStream's internal Buffer pooling, see: https://github.com/nodejs/node/issues/24817
            // 2. Work around https://github.com/whatwg/streams/blob/0ebe4b042e467d9876d80ae045de3843092ad797/reference-implementation/lib/helpers.js#L126
            return /* 1. */ (buf.byteOffset % 8 === 0) &&
                /* 2. */ (buf.byteOffset + buf.byteLength) <= buf.buffer.byteLength ? buf : buf.slice();
        }
        readSchema(throwIfNull = false) {
            const type = MessageHeader.Schema;
            const message = this.readMessage(type);
            const schema = message && message.header();
            if (throwIfNull && !schema) {
                throw new Error(nullMessage(type));
            }
            return schema;
        }
        readMetadataLength() {
            const buf = this.source.read(PADDING);
            const bb = buf && new ByteBuffer(buf);
            const len = bb && bb.readInt32(0) || 0;
            return { done: len === 0, value: len };
        }
        readMetadata(metadataLength) {
            const buf = this.source.read(metadataLength);
            if (!buf) {
                return ITERATOR_DONE;
            }
            if (buf.byteLength < metadataLength) {
                throw new Error(invalidMessageMetadata(metadataLength, buf.byteLength));
            }
            return { done: false, value: Message.decode(buf) };
        }
    }
    /** @ignore */
    class AsyncMessageReader {
        constructor(source, byteLength) {
            this.source = source instanceof AsyncByteStream ? source
                : isFileHandle(source)
                    ? new AsyncRandomAccessFile(source, byteLength)
                    : new AsyncByteStream(source);
        }
        [Symbol.asyncIterator]() { return this; }
        async next() {
            let r;
            if ((r = await this.readMetadataLength()).done) {
                return ITERATOR_DONE;
            }
            // ARROW-6313: If the first 4 bytes are continuation indicator (-1), read
            // the next 4 for the 32-bit metadata length. Otherwise, assume this is a
            // pre-v0.15 message, where the first 4 bytes are the metadata length.
            if ((r.value === -1) &&
                (r = await this.readMetadataLength()).done) {
                return ITERATOR_DONE;
            }
            if ((r = await this.readMetadata(r.value)).done) {
                return ITERATOR_DONE;
            }
            return r;
        }
        async throw(value) { return await this.source.throw(value); }
        async return(value) { return await this.source.return(value); }
        async readMessage(type) {
            let r;
            if ((r = await this.next()).done) {
                return null;
            }
            if ((type != null) && r.value.headerType !== type) {
                throw new Error(invalidMessageType(type));
            }
            return r.value;
        }
        async readMessageBody(bodyLength) {
            if (bodyLength <= 0) {
                return new Uint8Array(0);
            }
            const buf = toUint8Array(await this.source.read(bodyLength));
            if (buf.byteLength < bodyLength) {
                throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));
            }
            // 1. Work around bugs in fs.ReadStream's internal Buffer pooling, see: https://github.com/nodejs/node/issues/24817
            // 2. Work around https://github.com/whatwg/streams/blob/0ebe4b042e467d9876d80ae045de3843092ad797/reference-implementation/lib/helpers.js#L126
            return /* 1. */ (buf.byteOffset % 8 === 0) &&
                /* 2. */ (buf.byteOffset + buf.byteLength) <= buf.buffer.byteLength ? buf : buf.slice();
        }
        async readSchema(throwIfNull = false) {
            const type = MessageHeader.Schema;
            const message = await this.readMessage(type);
            const schema = message && message.header();
            if (throwIfNull && !schema) {
                throw new Error(nullMessage(type));
            }
            return schema;
        }
        async readMetadataLength() {
            const buf = await this.source.read(PADDING);
            const bb = buf && new ByteBuffer(buf);
            const len = bb && bb.readInt32(0) || 0;
            return { done: len === 0, value: len };
        }
        async readMetadata(metadataLength) {
            const buf = await this.source.read(metadataLength);
            if (!buf) {
                return ITERATOR_DONE;
            }
            if (buf.byteLength < metadataLength) {
                throw new Error(invalidMessageMetadata(metadataLength, buf.byteLength));
            }
            return { done: false, value: Message.decode(buf) };
        }
    }
    /** @ignore */
    class JSONMessageReader extends MessageReader {
        constructor(source) {
            super(new Uint8Array(0));
            this._schema = false;
            this._body = [];
            this._batchIndex = 0;
            this._dictionaryIndex = 0;
            this._json = source instanceof ArrowJSON ? source : new ArrowJSON(source);
        }
        next() {
            const { _json } = this;
            if (!this._schema) {
                this._schema = true;
                const message = Message.fromJSON(_json.schema, MessageHeader.Schema);
                return { done: false, value: message };
            }
            if (this._dictionaryIndex < _json.dictionaries.length) {
                const batch = _json.dictionaries[this._dictionaryIndex++];
                this._body = batch['data']['columns'];
                const message = Message.fromJSON(batch, MessageHeader.DictionaryBatch);
                return { done: false, value: message };
            }
            if (this._batchIndex < _json.batches.length) {
                const batch = _json.batches[this._batchIndex++];
                this._body = batch['columns'];
                const message = Message.fromJSON(batch, MessageHeader.RecordBatch);
                return { done: false, value: message };
            }
            this._body = [];
            return ITERATOR_DONE;
        }
        readMessageBody(_bodyLength) {
            return flattenDataSources(this._body);
            function flattenDataSources(xs) {
                return (xs || []).reduce((buffers, column) => [
                    ...buffers,
                    ...(column['VALIDITY'] && [column['VALIDITY']] || []),
                    ...(column['TYPE'] && [column['TYPE']] || []),
                    ...(column['OFFSET'] && [column['OFFSET']] || []),
                    ...(column['DATA'] && [column['DATA']] || []),
                    ...flattenDataSources(column['children'])
                ], []);
            }
        }
        readMessage(type) {
            let r;
            if ((r = this.next()).done) {
                return null;
            }
            if ((type != null) && r.value.headerType !== type) {
                throw new Error(invalidMessageType(type));
            }
            return r.value;
        }
        readSchema() {
            const type = MessageHeader.Schema;
            const message = this.readMessage(type);
            const schema = message && message.header();
            if (!message || !schema) {
                throw new Error(nullMessage(type));
            }
            return schema;
        }
    }
    /** @ignore */
    const PADDING = 4;
    /** @ignore */
    const MAGIC_STR = 'ARROW1';
    /** @ignore */
    const MAGIC = new Uint8Array(MAGIC_STR.length);
    for (let i = 0; i < MAGIC_STR.length; i += 1 | 0) {
        MAGIC[i] = MAGIC_STR.charCodeAt(i);
    }
    /** @ignore */
    function checkForMagicArrowString(buffer, index = 0) {
        for (let i = -1, n = MAGIC.length; ++i < n;) {
            if (MAGIC[i] !== buffer[index + i]) {
                return false;
            }
        }
        return true;
    }
    /** @ignore */
    const magicLength = MAGIC.length;
    /** @ignore */
    const magicAndPadding = magicLength + PADDING;
    /** @ignore */
    const magicX2AndPadding = magicLength * 2 + PADDING;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class VectorAssembler extends Visitor {
        constructor() {
            super();
            this._byteLength = 0;
            this._nodes = [];
            this._buffers = [];
            this._bufferRegions = [];
        }
        /** @nocollapse */
        static assemble(...args) {
            const assembler = new VectorAssembler();
            const vectorChildren = selectVectorChildrenArgs(RecordBatch, args);
            const [assembleResult = assembler] = assembler.visitMany(vectorChildren);
            return assembleResult;
        }
        visit(vector) {
            if (!DataType.isDictionary(vector.type)) {
                const { data, length, nullCount } = vector;
                if (length > 2147483647) {
                    /* istanbul ignore next */
                    throw new RangeError('Cannot write arrays larger than 2^31 - 1 in length');
                }
                if (!DataType.isNull(vector.type)) {
                    addBuffer.call(this, nullCount <= 0
                        ? new Uint8Array(0) // placeholder validity buffer
                        : truncateBitmap(data.offset, length, data.nullBitmap));
                }
                this.nodes.push(new FieldNode(length, nullCount));
            }
            return super.visit(vector);
        }
        visitNull(_nullV) {
            return this;
        }
        visitDictionary(vector) {
            // Assemble the indices here, Dictionary assembled separately.
            return this.visit(vector.indices);
        }
        get nodes() { return this._nodes; }
        get buffers() { return this._buffers; }
        get byteLength() { return this._byteLength; }
        get bufferRegions() { return this._bufferRegions; }
    }
    /** @ignore */
    function addBuffer(values) {
        const byteLength = (values.byteLength + 7) & ~7; // Round up to a multiple of 8
        this.buffers.push(values);
        this.bufferRegions.push(new BufferRegion(this._byteLength, byteLength));
        this._byteLength += byteLength;
        return this;
    }
    /** @ignore */
    function assembleUnion(vector) {
        const { type, length, typeIds, valueOffsets } = vector;
        // All Union Vectors have a typeIds buffer
        addBuffer.call(this, typeIds);
        // If this is a Sparse Union, treat it like all other Nested types
        if (type.mode === UnionMode.Sparse) {
            return assembleNestedVector.call(this, vector);
        }
        else if (type.mode === UnionMode.Dense) {
            // If this is a Dense Union, add the valueOffsets buffer and potentially slice the children
            if (vector.offset <= 0) {
                // If the Vector hasn't been sliced, write the existing valueOffsets
                addBuffer.call(this, valueOffsets);
                // We can treat this like all other Nested types
                return assembleNestedVector.call(this, vector);
            }
            else {
                // A sliced Dense Union is an unpleasant case. Because the offsets are different for
                // each child vector, we need to "rebase" the valueOffsets for each child
                // Union typeIds are not necessary 0-indexed
                const maxChildTypeId = typeIds.reduce((x, y) => Math.max(x, y), typeIds[0]);
                const childLengths = new Int32Array(maxChildTypeId + 1);
                // Set all to -1 to indicate that we haven't observed a first occurrence of a particular child yet
                const childOffsets = new Int32Array(maxChildTypeId + 1).fill(-1);
                const shiftedOffsets = new Int32Array(length);
                // If we have a non-zero offset, then the value offsets do not start at
                // zero. We must a) create a new offsets array with shifted offsets and
                // b) slice the values array accordingly
                const unshiftedOffsets = rebaseValueOffsets(-valueOffsets[0], length, valueOffsets);
                for (let typeId, shift, index = -1; ++index < length;) {
                    if ((shift = childOffsets[typeId = typeIds[index]]) === -1) {
                        shift = childOffsets[typeId] = unshiftedOffsets[typeId];
                    }
                    shiftedOffsets[index] = unshiftedOffsets[index] - shift;
                    ++childLengths[typeId];
                }
                addBuffer.call(this, shiftedOffsets);
                // Slice and visit children accordingly
                for (let child, childIndex = -1, numChildren = type.children.length; ++childIndex < numChildren;) {
                    if (child = vector.getChildAt(childIndex)) {
                        const typeId = type.typeIds[childIndex];
                        const childLength = Math.min(length, childLengths[typeId]);
                        this.visit(child.slice(childOffsets[typeId], childLength));
                    }
                }
            }
        }
        return this;
    }
    /** @ignore */
    function assembleBoolVector(vector) {
        // Bool vector is a special case of FlatVector, as its data buffer needs to stay packed
        let values;
        if (vector.nullCount >= vector.length) {
            // If all values are null, just insert a placeholder empty data buffer (fastest path)
            return addBuffer.call(this, new Uint8Array(0));
        }
        else if ((values = vector.values) instanceof Uint8Array) {
            // If values is already a Uint8Array, slice the bitmap (fast path)
            return addBuffer.call(this, truncateBitmap(vector.offset, vector.length, values));
        }
        // Otherwise if the underlying data *isn't* a Uint8Array, enumerate the
        // values as bools and re-pack them into a Uint8Array. This code isn't
        // reachable unless you're trying to manipulate the Data internals,
        // we we're only doing this for safety.
        /* istanbul ignore next */
        return addBuffer.call(this, packBools(vector));
    }
    /** @ignore */
    function assembleFlatVector(vector) {
        return addBuffer.call(this, vector.values.subarray(0, vector.length * vector.stride));
    }
    /** @ignore */
    function assembleFlatListVector(vector) {
        const { length, values, valueOffsets } = vector;
        const firstOffset = valueOffsets[0];
        const lastOffset = valueOffsets[length];
        const byteLength = Math.min(lastOffset - firstOffset, values.byteLength - firstOffset);
        // Push in the order FlatList types read their buffers
        addBuffer.call(this, rebaseValueOffsets(-valueOffsets[0], length, valueOffsets)); // valueOffsets buffer first
        addBuffer.call(this, values.subarray(firstOffset, firstOffset + byteLength)); // sliced values buffer second
        return this;
    }
    /** @ignore */
    function assembleListVector(vector) {
        const { length, valueOffsets } = vector;
        // If we have valueOffsets (MapVector, ListVector), push that buffer first
        if (valueOffsets) {
            addBuffer.call(this, rebaseValueOffsets(valueOffsets[0], length, valueOffsets));
        }
        // Then insert the List's values child
        return this.visit(vector.getChildAt(0));
    }
    /** @ignore */
    function assembleNestedVector(vector) {
        return this.visitMany(vector.type.children.map((_, i) => vector.getChildAt(i)).filter(Boolean))[0];
    }
    VectorAssembler.prototype.visitBool = assembleBoolVector;
    VectorAssembler.prototype.visitInt = assembleFlatVector;
    VectorAssembler.prototype.visitFloat = assembleFlatVector;
    VectorAssembler.prototype.visitUtf8 = assembleFlatListVector;
    VectorAssembler.prototype.visitBinary = assembleFlatListVector;
    VectorAssembler.prototype.visitFixedSizeBinary = assembleFlatVector;
    VectorAssembler.prototype.visitDate = assembleFlatVector;
    VectorAssembler.prototype.visitTimestamp = assembleFlatVector;
    VectorAssembler.prototype.visitTime = assembleFlatVector;
    VectorAssembler.prototype.visitDecimal = assembleFlatVector;
    VectorAssembler.prototype.visitList = assembleListVector;
    VectorAssembler.prototype.visitStruct = assembleNestedVector;
    VectorAssembler.prototype.visitUnion = assembleUnion;
    VectorAssembler.prototype.visitInterval = assembleFlatVector;
    VectorAssembler.prototype.visitFixedSizeList = assembleListVector;
    VectorAssembler.prototype.visitMap = assembleListVector;

    // Licensed to the Apache Software Foundation (ASF) under one
    class RecordBatchWriter extends ReadableInterop {
        constructor(options) {
            super();
            this._position = 0;
            this._started = false;
            // @ts-ignore
            this._sink = new AsyncByteQueue();
            this._schema = null;
            this._dictionaryBlocks = [];
            this._recordBatchBlocks = [];
            this._dictionaryDeltaOffsets = new Map();
            isObject(options) || (options = { autoDestroy: true, writeLegacyIpcFormat: false });
            this._autoDestroy = (typeof options.autoDestroy === 'boolean') ? options.autoDestroy : true;
            this._writeLegacyIpcFormat = (typeof options.writeLegacyIpcFormat === 'boolean') ? options.writeLegacyIpcFormat : false;
        }
        /** @nocollapse */
        // @ts-ignore
        static throughNode(options) {
            throw new Error(`"throughNode" not available in this environment`);
        }
        /** @nocollapse */
        static throughDOM(
        // @ts-ignore
        writableStrategy, 
        // @ts-ignore
        readableStrategy) {
            throw new Error(`"throughDOM" not available in this environment`);
        }
        toString(sync = false) {
            return this._sink.toString(sync);
        }
        toUint8Array(sync = false) {
            return this._sink.toUint8Array(sync);
        }
        writeAll(input) {
            if (isPromise(input)) {
                return input.then((x) => this.writeAll(x));
            }
            else if (isAsyncIterable(input)) {
                return writeAllAsync(this, input);
            }
            return writeAll(this, input);
        }
        get closed() { return this._sink.closed; }
        [Symbol.asyncIterator]() { return this._sink[Symbol.asyncIterator](); }
        toDOMStream(options) { return this._sink.toDOMStream(options); }
        toNodeStream(options) { return this._sink.toNodeStream(options); }
        close() {
            return this.reset()._sink.close();
        }
        abort(reason) {
            return this.reset()._sink.abort(reason);
        }
        finish() {
            this._autoDestroy ? this.close() : this.reset(this._sink, this._schema);
            return this;
        }
        reset(sink = this._sink, schema = null) {
            if ((sink === this._sink) || (sink instanceof AsyncByteQueue)) {
                this._sink = sink;
            }
            else {
                this._sink = new AsyncByteQueue();
                if (sink && isWritableDOMStream(sink)) {
                    this.toDOMStream({ type: 'bytes' }).pipeTo(sink);
                }
                else if (sink && isWritableNodeStream(sink)) {
                    this.toNodeStream({ objectMode: false }).pipe(sink);
                }
            }
            if (this._started && this._schema) {
                this._writeFooter(this._schema);
            }
            this._started = false;
            this._dictionaryBlocks = [];
            this._recordBatchBlocks = [];
            this._dictionaryDeltaOffsets = new Map();
            if (!schema || !(schema.compareTo(this._schema))) {
                if (schema === null) {
                    this._position = 0;
                    this._schema = null;
                }
                else {
                    this._started = true;
                    this._schema = schema;
                    this._writeSchema(schema);
                }
            }
            return this;
        }
        write(payload) {
            let schema = null;
            if (!this._sink) {
                throw new Error(`RecordBatchWriter is closed`);
            }
            else if (payload === null || payload === undefined) {
                return this.finish() && undefined;
            }
            else if (payload instanceof Table && !(schema = payload.schema)) {
                return this.finish() && undefined;
            }
            else if (payload instanceof RecordBatch && !(schema = payload.schema)) {
                return this.finish() && undefined;
            }
            if (schema && !schema.compareTo(this._schema)) {
                if (this._started && this._autoDestroy) {
                    return this.close();
                }
                this.reset(this._sink, schema);
            }
            if (payload instanceof RecordBatch) {
                if (!(payload instanceof _InternalEmptyPlaceholderRecordBatch)) {
                    this._writeRecordBatch(payload);
                }
            }
            else if (payload instanceof Table) {
                this.writeAll(payload.chunks);
            }
            else if (isIterable(payload)) {
                this.writeAll(payload);
            }
        }
        _writeMessage(message, alignment = 8) {
            const a = alignment - 1;
            const buffer = Message.encode(message);
            const flatbufferSize = buffer.byteLength;
            const prefixSize = !this._writeLegacyIpcFormat ? 8 : 4;
            const alignedSize = (flatbufferSize + prefixSize + a) & ~a;
            const nPaddingBytes = alignedSize - flatbufferSize - prefixSize;
            if (message.headerType === MessageHeader.RecordBatch) {
                this._recordBatchBlocks.push(new FileBlock(alignedSize, message.bodyLength, this._position));
            }
            else if (message.headerType === MessageHeader.DictionaryBatch) {
                this._dictionaryBlocks.push(new FileBlock(alignedSize, message.bodyLength, this._position));
            }
            // If not in legacy pre-0.15.0 mode, write the stream continuation indicator
            if (!this._writeLegacyIpcFormat) {
                this._write(Int32Array.of(-1));
            }
            // Write the flatbuffer size prefix including padding
            this._write(Int32Array.of(alignedSize - prefixSize));
            // Write the flatbuffer
            if (flatbufferSize > 0) {
                this._write(buffer);
            }
            // Write any padding
            return this._writePadding(nPaddingBytes);
        }
        _write(chunk) {
            if (this._started) {
                const buffer = toUint8Array(chunk);
                if (buffer && buffer.byteLength > 0) {
                    this._sink.write(buffer);
                    this._position += buffer.byteLength;
                }
            }
            return this;
        }
        _writeSchema(schema) {
            return this._writeMessage(Message.from(schema));
        }
        // @ts-ignore
        _writeFooter(schema) {
            // eos bytes
            return this._writeLegacyIpcFormat
                ? this._write(Int32Array.of(0))
                : this._write(Int32Array.of(-1, 0));
        }
        _writeMagic() {
            return this._write(MAGIC);
        }
        _writePadding(nBytes) {
            return nBytes > 0 ? this._write(new Uint8Array(nBytes)) : this;
        }
        _writeRecordBatch(batch) {
            const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(batch);
            const recordBatch = new RecordBatch$1(batch.length, nodes, bufferRegions);
            const message = Message.from(recordBatch, byteLength);
            return this
                ._writeDictionaries(batch)
                ._writeMessage(message)
                ._writeBodyBuffers(buffers);
        }
        _writeDictionaryBatch(dictionary, id, isDelta = false) {
            this._dictionaryDeltaOffsets.set(id, dictionary.length + (this._dictionaryDeltaOffsets.get(id) || 0));
            const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(dictionary);
            const recordBatch = new RecordBatch$1(dictionary.length, nodes, bufferRegions);
            const dictionaryBatch = new DictionaryBatch(recordBatch, id, isDelta);
            const message = Message.from(dictionaryBatch, byteLength);
            return this
                ._writeMessage(message)
                ._writeBodyBuffers(buffers);
        }
        _writeBodyBuffers(buffers) {
            let buffer;
            let size, padding;
            for (let i = -1, n = buffers.length; ++i < n;) {
                if ((buffer = buffers[i]) && (size = buffer.byteLength) > 0) {
                    this._write(buffer);
                    if ((padding = ((size + 7) & ~7) - size) > 0) {
                        this._writePadding(padding);
                    }
                }
            }
            return this;
        }
        _writeDictionaries(batch) {
            for (let [id, dictionary] of batch.dictionaries) {
                let offset = this._dictionaryDeltaOffsets.get(id) || 0;
                if (offset === 0 || (dictionary = dictionary.slice(offset)).length > 0) {
                    const chunks = 'chunks' in dictionary ? dictionary.chunks : [dictionary];
                    for (const chunk of chunks) {
                        this._writeDictionaryBatch(chunk, id, offset > 0);
                        offset += chunk.length;
                    }
                }
            }
            return this;
        }
    }
    /** @ignore */
    class RecordBatchStreamWriter extends RecordBatchWriter {
        /** @nocollapse */
        static writeAll(input, options) {
            const writer = new RecordBatchStreamWriter(options);
            if (isPromise(input)) {
                return input.then((x) => writer.writeAll(x));
            }
            else if (isAsyncIterable(input)) {
                return writeAllAsync(writer, input);
            }
            return writeAll(writer, input);
        }
    }
    /** @ignore */
    class RecordBatchFileWriter extends RecordBatchWriter {
        /** @nocollapse */
        static writeAll(input) {
            const writer = new RecordBatchFileWriter();
            if (isPromise(input)) {
                return input.then((x) => writer.writeAll(x));
            }
            else if (isAsyncIterable(input)) {
                return writeAllAsync(writer, input);
            }
            return writeAll(writer, input);
        }
        constructor() {
            super();
            this._autoDestroy = true;
        }
        // @ts-ignore
        _writeSchema(schema) {
            return this._writeMagic()._writePadding(2);
        }
        _writeFooter(schema) {
            const buffer = Footer_.encode(new Footer_(schema, MetadataVersion.V4, this._recordBatchBlocks, this._dictionaryBlocks));
            return super
                ._writeFooter(schema) // EOS bytes for sequential readers
                ._write(buffer) // Write the flatbuffer
                ._write(Int32Array.of(buffer.byteLength)) // then the footer size suffix
                ._writeMagic(); // then the magic suffix
        }
    }
    /** @ignore */
    function writeAll(writer, input) {
        let chunks = input;
        if (input instanceof Table) {
            chunks = input.chunks;
            writer.reset(undefined, input.schema);
        }
        for (const batch of chunks) {
            writer.write(batch);
        }
        return writer.finish();
    }
    /** @ignore */
    async function writeAllAsync(writer, batches) {
        for await (const batch of batches) {
            writer.write(batch);
        }
        return writer.finish();
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    const noopBuf = new Uint8Array(0);
    const nullBufs = (bitmapLength) => [
        noopBuf, noopBuf, new Uint8Array(bitmapLength), noopBuf
    ];
    /** @ignore */
    function ensureSameLengthData(schema, chunks, batchLength = chunks.reduce((l, c) => Math.max(l, c.length), 0)) {
        let data;
        let field;
        let i = -1, n = chunks.length;
        const fields = [...schema.fields];
        const batchData = [];
        const bitmapLength = ((batchLength + 63) & ~63) >> 3;
        while (++i < n) {
            if ((data = chunks[i]) && data.length === batchLength) {
                batchData[i] = data;
            }
            else {
                (field = fields[i]).nullable || (fields[i] = fields[i].clone({ nullable: true }));
                batchData[i] = data ? data._changeLengthAndBackfillNullBitmap(batchLength)
                    : Data.new(field.type, 0, batchLength, batchLength, nullBufs(bitmapLength));
            }
        }
        return [new Schema(fields), batchLength, batchData];
    }
    /** @ignore */
    function distributeColumnsIntoRecordBatches(columns) {
        return distributeVectorsIntoRecordBatches(new Schema(columns.map(({ field }) => field)), columns);
    }
    /** @ignore */
    function distributeVectorsIntoRecordBatches(schema, vecs) {
        return uniformlyDistributeChunksAcrossRecordBatches(schema, vecs.map((v) => v instanceof Chunked ? v.chunks.map((c) => c.data) : [v.data]));
    }
    /** @ignore */
    function uniformlyDistributeChunksAcrossRecordBatches(schema, columns) {
        const fields = [...schema.fields];
        const batchArgs = [];
        const memo = { numBatches: columns.reduce((n, c) => Math.max(n, c.length), 0) };
        let numBatches = 0, batchLength = 0;
        let i = -1, numColumns = columns.length;
        let child, childData = [];
        while (memo.numBatches-- > 0) {
            for (batchLength = Number.POSITIVE_INFINITY, i = -1; ++i < numColumns;) {
                childData[i] = child = columns[i].shift();
                batchLength = Math.min(batchLength, child ? child.length : batchLength);
            }
            if (isFinite(batchLength)) {
                childData = distributeChildData(fields, batchLength, childData, columns, memo);
                if (batchLength > 0) {
                    batchArgs[numBatches++] = [batchLength, childData.slice()];
                }
            }
        }
        return [
            schema = new Schema(fields, schema.metadata),
            batchArgs.map((xs) => new RecordBatch(schema, ...xs))
        ];
    }
    /** @ignore */
    function distributeChildData(fields, batchLength, childData, columns, memo) {
        let data;
        let field;
        let length = 0, i = -1, n = columns.length;
        const bitmapLength = ((batchLength + 63) & ~63) >> 3;
        while (++i < n) {
            if ((data = childData[i]) && ((length = data.length) >= batchLength)) {
                if (length === batchLength) {
                    childData[i] = data;
                }
                else {
                    childData[i] = data.slice(0, batchLength);
                    data = data.slice(batchLength, length - batchLength);
                    memo.numBatches = Math.max(memo.numBatches, columns[i].unshift(data));
                }
            }
            else {
                (field = fields[i]).nullable || (fields[i] = field.clone({ nullable: true }));
                childData[i] = data ? data._changeLengthAndBackfillNullBitmap(batchLength)
                    : Data.new(field.type, 0, batchLength, batchLength, nullBufs(bitmapLength));
            }
        }
        return childData;
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class BaseVector extends AbstractVector {
        constructor(data, children) {
            super();
            this._children = children;
            this.numChildren = data.childData.length;
            this._bindDataAccessors(this.data = data);
        }
        get type() { return this.data.type; }
        get typeId() { return this.data.typeId; }
        get length() { return this.data.length; }
        get offset() { return this.data.offset; }
        get stride() { return this.data.stride; }
        get nullCount() { return this.data.nullCount; }
        get byteLength() { return this.data.byteLength; }
        get VectorName() { return `${Type$2[this.typeId]}Vector`; }
        get ArrayType() { return this.type.ArrayType; }
        get values() { return this.data.values; }
        get typeIds() { return this.data.typeIds; }
        get nullBitmap() { return this.data.nullBitmap; }
        get valueOffsets() { return this.data.valueOffsets; }
        get [Symbol.toStringTag]() { return `${this.VectorName}<${this.type[Symbol.toStringTag]}>`; }
        clone(data, children = this._children) {
            return AbstractVector.new(data, children);
        }
        concat(...others) {
            return Chunked.concat(this, ...others);
        }
        slice(begin, end) {
            // Adjust args similar to Array.prototype.slice. Normalize begin/end to
            // clamp between 0 and length, and wrap around on negative indices, e.g.
            // slice(-1, 5) or slice(5, -1)
            return clampRange(this, begin, end, this._sliceInternal);
        }
        isValid(index) {
            if (this.nullCount > 0) {
                const idx = this.offset + index;
                const val = this.nullBitmap[idx >> 3];
                const mask = (val & (1 << (idx % 8)));
                return mask !== 0;
            }
            return true;
        }
        getChildAt(index) {
            return index < 0 || index >= this.numChildren ? null : ((this._children || (this._children = []))[index] ||
                (this._children[index] = AbstractVector.new(this.data.childData[index])));
        }
        toJSON() { return [...this]; }
        _sliceInternal(self, begin, end) {
            return self.clone(self.data.slice(begin, end - begin), null);
        }
        // @ts-ignore
        _bindDataAccessors(data) {
            // Implementation in src/vectors/index.ts due to circular dependency/packaging shenanigans
        }
    }
    BaseVector.prototype[Symbol.isConcatSpreadable] = true;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class BinaryVector extends BaseVector {
        asUtf8() {
            return AbstractVector.new(this.data.clone(new Utf8$1()));
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class BoolVector extends BaseVector {
        /** @nocollapse */
        static from(input) {
            return vectorFromValuesWithType(() => new Bool$1(), input);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DateVector extends BaseVector {
        /** @nocollapse */
        static from(...args) {
            if (args.length === 2) {
                return vectorFromValuesWithType(() => args[1] === DateUnit.DAY ? new DateDay() : new DateMillisecond(), args[0]);
            }
            return vectorFromValuesWithType(() => new DateMillisecond(), args[0]);
        }
    }
    /** @ignore */
    class DateDayVector extends DateVector {
    }
    /** @ignore */
    class DateMillisecondVector extends DateVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DecimalVector extends BaseVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class DictionaryVector extends BaseVector {
        constructor(data) {
            super(data);
            this.indices = AbstractVector.new(data.clone(this.type.indices));
        }
        /** @nocollapse */
        static from(...args) {
            if (args.length === 3) {
                const [values, indices, keys] = args;
                const type = new Dictionary(values.type, indices, null, null);
                return AbstractVector.new(Data.Dictionary(type, 0, keys.length, 0, null, keys, values));
            }
            return vectorFromValuesWithType(() => args[0].type, args[0]);
        }
        get dictionary() { return this.data.dictionary; }
        reverseLookup(value) { return this.dictionary.indexOf(value); }
        getKey(idx) { return this.indices.get(idx); }
        getValue(key) { return this.dictionary.get(key); }
        setKey(idx, key) { return this.indices.set(idx, key); }
        setValue(key, value) { return this.dictionary.set(key, value); }
    }
    DictionaryVector.prototype.indices = null;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FixedSizeBinaryVector extends BaseVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FixedSizeListVector extends BaseVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class FloatVector extends BaseVector {
        /** @nocollapse */
        static from(input) {
            let ArrowType = vectorTypeToDataType$1(this);
            if ((input instanceof ArrayBuffer) || ArrayBuffer.isView(input)) {
                let InputType = arrayTypeToDataType$1(input.constructor) || ArrowType;
                // Special case, infer the Arrow DataType from the input if calling the base
                // FloatVector.from with a TypedArray, e.g. `FloatVector.from(new Float32Array())`
                if (ArrowType === null) {
                    ArrowType = InputType;
                }
                // If the DataType inferred from the Vector constructor matches the
                // DataType inferred from the input arguments, return zero-copy view
                if (ArrowType && ArrowType === InputType) {
                    let type = new ArrowType();
                    let length = input.byteLength / type.ArrayType.BYTES_PER_ELEMENT;
                    // If the ArrowType is Float16 but the input type isn't a Uint16Array,
                    // let the Float16Builder handle casting the input values to Uint16s.
                    if (!convertTo16Bit(ArrowType, input.constructor)) {
                        return AbstractVector.new(Data.Float(type, 0, length, 0, null, input));
                    }
                }
            }
            if (ArrowType) {
                // If the DataType inferred from the Vector constructor is different than
                // the DataType inferred from the input TypedArray, or if input isn't a
                // TypedArray, use the Builders to construct the result Vector
                return vectorFromValuesWithType(() => new ArrowType(), input);
            }
            if ((input instanceof DataView) || (input instanceof ArrayBuffer)) {
                throw new TypeError(`Cannot infer float type from instance of ${input.constructor.name}`);
            }
            throw new TypeError('Unrecognized FloatVector input');
        }
    }
    /** @ignore */
    class Float16Vector extends FloatVector {
        // Since JS doesn't have half floats, `toArray()` returns a zero-copy slice
        // of the underlying Uint16Array data. This behavior ensures we don't incur
        // extra compute or copies if you're calling `toArray()` in order to create
        // a buffer for something like WebGL. Buf if you're using JS and want typed
        // arrays of 4-to-8-byte precision, these methods will enumerate the values
        // and clamp to the desired byte lengths.
        toFloat32Array() { return new Float32Array(this); }
        toFloat64Array() { return new Float64Array(this); }
    }
    /** @ignore */
    class Float32Vector extends FloatVector {
    }
    /** @ignore */
    class Float64Vector extends FloatVector {
    }
    const convertTo16Bit = (typeCtor, dataCtor) => {
        return (typeCtor === Float16) && (dataCtor !== Uint16Array);
    };
    /** @ignore */
    const arrayTypeToDataType$1 = (ctor) => {
        switch (ctor) {
            case Uint16Array: return Float16;
            case Float32Array: return Float32;
            case Float64Array: return Float64;
            default: return null;
        }
    };
    /** @ignore */
    const vectorTypeToDataType$1 = (ctor) => {
        switch (ctor) {
            case Float16Vector: return Float16;
            case Float32Vector: return Float32;
            case Float64Vector: return Float64;
            default: return null;
        }
    };

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IntervalVector extends BaseVector {
    }
    /** @ignore */
    class IntervalDayTimeVector extends IntervalVector {
    }
    /** @ignore */
    class IntervalYearMonthVector extends IntervalVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IntVector extends BaseVector {
        /** @nocollapse */
        static from(...args) {
            let [input, is64bit = false] = args;
            let ArrowType = vectorTypeToDataType(this, is64bit);
            if ((input instanceof ArrayBuffer) || ArrayBuffer.isView(input)) {
                let InputType = arrayTypeToDataType(input.constructor, is64bit) || ArrowType;
                // Special case, infer the Arrow DataType from the input if calling the base
                // IntVector.from with a TypedArray, e.g. `IntVector.from(new Int32Array())`
                if (ArrowType === null) {
                    ArrowType = InputType;
                }
                // If the DataType inferred from the Vector constructor matches the
                // DataType inferred from the input arguments, return zero-copy view
                if (ArrowType && ArrowType === InputType) {
                    let type = new ArrowType();
                    let length = input.byteLength / type.ArrayType.BYTES_PER_ELEMENT;
                    // If the ArrowType is 64bit but the input type is 32bit pairs, update the logical length
                    if (convert32To64Bit(ArrowType, input.constructor)) {
                        length *= 0.5;
                    }
                    return AbstractVector.new(Data.Int(type, 0, length, 0, null, input));
                }
            }
            if (ArrowType) {
                // If the DataType inferred from the Vector constructor is different than
                // the DataType inferred from the input TypedArray, or if input isn't a
                // TypedArray, use the Builders to construct the result Vector
                return vectorFromValuesWithType(() => new ArrowType(), input);
            }
            if ((input instanceof DataView) || (input instanceof ArrayBuffer)) {
                throw new TypeError(`Cannot infer integer type from instance of ${input.constructor.name}`);
            }
            throw new TypeError('Unrecognized IntVector input');
        }
    }
    /** @ignore */
    class Int8Vector extends IntVector {
    }
    /** @ignore */
    class Int16Vector extends IntVector {
    }
    /** @ignore */
    class Int32Vector extends IntVector {
    }
    /** @ignore */
    class Int64Vector extends IntVector {
        toBigInt64Array() {
            return toBigInt64Array(this.values);
        }
        get values64() {
            return this._values64 || (this._values64 = this.toBigInt64Array());
        }
    }
    /** @ignore */
    class Uint8Vector extends IntVector {
    }
    /** @ignore */
    class Uint16Vector extends IntVector {
    }
    /** @ignore */
    class Uint32Vector extends IntVector {
    }
    /** @ignore */
    class Uint64Vector extends IntVector {
        toBigUint64Array() {
            return toBigUint64Array(this.values);
        }
        get values64() {
            return this._values64 || (this._values64 = this.toBigUint64Array());
        }
    }
    const convert32To64Bit = (typeCtor, dataCtor) => {
        return (typeCtor === Int64$1 || typeCtor === Uint64$1) &&
            (dataCtor === Int32Array || dataCtor === Uint32Array);
    };
    /** @ignore */
    const arrayTypeToDataType = (ctor, is64bit) => {
        switch (ctor) {
            case Int8Array: return Int8;
            case Int16Array: return Int16;
            case Int32Array: return is64bit ? Int64$1 : Int32;
            case BigInt64ArrayCtor: return Int64$1;
            case Uint8Array: return Uint8;
            case Uint16Array: return Uint16;
            case Uint32Array: return is64bit ? Uint64$1 : Uint32;
            case BigUint64ArrayCtor: return Uint64$1;
            default: return null;
        }
    };
    /** @ignore */
    const vectorTypeToDataType = (ctor, is64bit) => {
        switch (ctor) {
            case Int8Vector: return Int8;
            case Int16Vector: return Int16;
            case Int32Vector: return is64bit ? Int64$1 : Int32;
            case Int64Vector: return Int64$1;
            case Uint8Vector: return Uint8;
            case Uint16Vector: return Uint16;
            case Uint32Vector: return is64bit ? Uint64$1 : Uint32;
            case Uint64Vector: return Uint64$1;
            default: return null;
        }
    };

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class ListVector extends BaseVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class MapVector extends BaseVector {
        asList() {
            const child = this.type.children[0];
            return AbstractVector.new(this.data.clone(new List$1(child)));
        }
        bind(index) {
            const child = this.getChildAt(0);
            const { [index]: begin, [index + 1]: end } = this.valueOffsets;
            return new MapRow(child.slice(begin, end));
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class NullVector extends BaseVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */ const kRowIndex = Symbol.for('rowIndex');
    /** @ignore */
    class StructVector extends BaseVector {
        bind(index) {
            const proto = this._row || (this._row = new StructRow(this));
            const bound = Object.create(proto);
            bound[kRowIndex] = index;
            return bound;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class TimestampVector extends BaseVector {
    }
    /** @ignore */
    class TimestampSecondVector extends TimestampVector {
    }
    /** @ignore */
    class TimestampMillisecondVector extends TimestampVector {
    }
    /** @ignore */
    class TimestampMicrosecondVector extends TimestampVector {
    }
    /** @ignore */
    class TimestampNanosecondVector extends TimestampVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class TimeVector extends BaseVector {
    }
    /** @ignore */
    class TimeSecondVector extends TimeVector {
    }
    /** @ignore */
    class TimeMillisecondVector extends TimeVector {
    }
    /** @ignore */
    class TimeMicrosecondVector extends TimeVector {
    }
    /** @ignore */
    class TimeNanosecondVector extends TimeVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class UnionVector extends BaseVector {
        get typeIdToChildIndex() { return this.data.type.typeIdToChildIndex; }
    }
    /** @ignore */
    class DenseUnionVector extends UnionVector {
        get valueOffsets() { return this.data.valueOffsets; }
    }
    /** @ignore */
    class SparseUnionVector extends UnionVector {
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class Utf8Vector extends BaseVector {
        /** @nocollapse */
        static from(input) {
            return vectorFromValuesWithType(() => new Utf8$1(), input);
        }
        asBinary() {
            return AbstractVector.new(this.data.clone(new Binary$1()));
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    // or more contributor license agreements.  See the NOTICE file
    // distributed with this work for additional information
    // regarding copyright ownership.  The ASF licenses this file
    // to you under the Apache License, Version 2.0 (the
    // "License"); you may not use this file except in compliance
    // with the License.  You may obtain a copy of the License at
    //
    //   http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing,
    // software distributed under the License is distributed on an
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    // KIND, either express or implied.  See the License for the
    // specific language governing permissions and limitations
    // under the License.
    /** @ignore */
    function partial0(visit) {
        return function () { return visit(this); };
    }
    /** @ignore */
    function partial1(visit) {
        return function (a) { return visit(this, a); };
    }
    /** @ignore */
    function partial2(visit) {
        return function (a, b) { return visit(this, a, b); };
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class GetVisitor extends Visitor {
    }
    /** @ignore */ const epochDaysToMs = (data, index) => 86400000 * data[index];
    /** @ignore */ const epochMillisecondsLongToMs = (data, index) => 4294967296 * (data[index + 1]) + (data[index] >>> 0);
    /** @ignore */ const epochMicrosecondsLongToMs = (data, index) => 4294967296 * (data[index + 1] / 1000) + ((data[index] >>> 0) / 1000);
    /** @ignore */ const epochNanosecondsLongToMs = (data, index) => 4294967296 * (data[index + 1] / 1000000) + ((data[index] >>> 0) / 1000000);
    /** @ignore */ const epochMillisecondsToDate = (epochMs) => new Date(epochMs);
    /** @ignore */ const epochDaysToDate = (data, index) => epochMillisecondsToDate(epochDaysToMs(data, index));
    /** @ignore */ const epochMillisecondsLongToDate = (data, index) => epochMillisecondsToDate(epochMillisecondsLongToMs(data, index));
    /** @ignore */
    const getNull = (_vector, _index) => null;
    /** @ignore */
    const getVariableWidthBytes = (values, valueOffsets, index) => {
        const { [index]: x, [index + 1]: y } = valueOffsets;
        return x != null && y != null ? values.subarray(x, y) : null;
    };
    /** @ignore */
    const getBool = ({ offset, values }, index) => {
        const idx = offset + index;
        const byte = values[idx >> 3];
        return (byte & 1 << (idx % 8)) !== 0;
    };
    /** @ignore */
    const getDateDay = ({ values }, index) => epochDaysToDate(values, index);
    /** @ignore */
    const getDateMillisecond = ({ values }, index) => epochMillisecondsLongToDate(values, index * 2);
    /** @ignore */
    const getNumeric = ({ stride, values }, index) => values[stride * index];
    /** @ignore */
    const getFloat16 = ({ stride, values }, index) => uint16ToFloat64(values[stride * index]);
    /** @ignore */
    const getBigInts = ({ stride, values, type }, index) => BN.new(values.subarray(stride * index, stride * (index + 1)), type.isSigned);
    /** @ignore */
    const getFixedSizeBinary = ({ stride, values }, index) => values.subarray(stride * index, stride * (index + 1));
    /** @ignore */
    const getBinary = ({ values, valueOffsets }, index) => getVariableWidthBytes(values, valueOffsets, index);
    /** @ignore */
    const getUtf8 = ({ values, valueOffsets }, index) => {
        const bytes = getVariableWidthBytes(values, valueOffsets, index);
        return bytes !== null ? decodeUtf8(bytes) : null;
    };
    /* istanbul ignore next */
    /** @ignore */
    const getInt = (vector, index) => (vector.type.bitWidth < 64
        ? getNumeric(vector, index)
        : getBigInts(vector, index));
    /* istanbul ignore next */
    /** @ignore */
    const getFloat = (vector, index) => (vector.type.precision !== Precision.HALF
        ? getNumeric(vector, index)
        : getFloat16(vector, index));
    /* istanbul ignore next */
    /** @ignore */
    const getDate = (vector, index) => (vector.type.unit === DateUnit.DAY
        ? getDateDay(vector, index)
        : getDateMillisecond(vector, index));
    /** @ignore */
    const getTimestampSecond = ({ values }, index) => 1000 * epochMillisecondsLongToMs(values, index * 2);
    /** @ignore */
    const getTimestampMillisecond = ({ values }, index) => epochMillisecondsLongToMs(values, index * 2);
    /** @ignore */
    const getTimestampMicrosecond = ({ values }, index) => epochMicrosecondsLongToMs(values, index * 2);
    /** @ignore */
    const getTimestampNanosecond = ({ values }, index) => epochNanosecondsLongToMs(values, index * 2);
    /* istanbul ignore next */
    /** @ignore */
    const getTimestamp = (vector, index) => {
        switch (vector.type.unit) {
            case TimeUnit.SECOND: return getTimestampSecond(vector, index);
            case TimeUnit.MILLISECOND: return getTimestampMillisecond(vector, index);
            case TimeUnit.MICROSECOND: return getTimestampMicrosecond(vector, index);
            case TimeUnit.NANOSECOND: return getTimestampNanosecond(vector, index);
        }
    };
    /** @ignore */
    const getTimeSecond = ({ values, stride }, index) => values[stride * index];
    /** @ignore */
    const getTimeMillisecond = ({ values, stride }, index) => values[stride * index];
    /** @ignore */
    const getTimeMicrosecond = ({ values }, index) => BN.signed(values.subarray(2 * index, 2 * (index + 1)));
    /** @ignore */
    const getTimeNanosecond = ({ values }, index) => BN.signed(values.subarray(2 * index, 2 * (index + 1)));
    /* istanbul ignore next */
    /** @ignore */
    const getTime = (vector, index) => {
        switch (vector.type.unit) {
            case TimeUnit.SECOND: return getTimeSecond(vector, index);
            case TimeUnit.MILLISECOND: return getTimeMillisecond(vector, index);
            case TimeUnit.MICROSECOND: return getTimeMicrosecond(vector, index);
            case TimeUnit.NANOSECOND: return getTimeNanosecond(vector, index);
        }
    };
    /** @ignore */
    const getDecimal = ({ values }, index) => BN.decimal(values.subarray(4 * index, 4 * (index + 1)));
    /** @ignore */
    const getList$1 = (vector, index) => {
        const child = vector.getChildAt(0), { valueOffsets, stride } = vector;
        return child.slice(valueOffsets[index * stride], valueOffsets[(index * stride) + 1]);
    };
    /** @ignore */
    const getMap = (vector, index) => {
        return vector.bind(index);
    };
    /** @ignore */
    const getStruct$1 = (vector, index) => {
        return vector.bind(index);
    };
    /* istanbul ignore next */
    /** @ignore */
    const getUnion = (vector, index) => {
        return vector.type.mode === UnionMode.Dense ?
            getDenseUnion(vector, index) :
            getSparseUnion(vector, index);
    };
    /** @ignore */
    const getDenseUnion = (vector, index) => {
        const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];
        const child = vector.getChildAt(childIndex);
        return child ? child.get(vector.valueOffsets[index]) : null;
    };
    /** @ignore */
    const getSparseUnion = (vector, index) => {
        const childIndex = vector.typeIdToChildIndex[vector.typeIds[index]];
        const child = vector.getChildAt(childIndex);
        return child ? child.get(index) : null;
    };
    /** @ignore */
    const getDictionary = (vector, index) => {
        return vector.getValue(vector.getKey(index));
    };
    /* istanbul ignore next */
    /** @ignore */
    const getInterval = (vector, index) => (vector.type.unit === IntervalUnit.DAY_TIME)
        ? getIntervalDayTime(vector, index)
        : getIntervalYearMonth(vector, index);
    /** @ignore */
    const getIntervalDayTime = ({ values }, index) => values.subarray(2 * index, 2 * (index + 1));
    /** @ignore */
    const getIntervalYearMonth = ({ values }, index) => {
        const interval = values[index];
        const int32s = new Int32Array(2);
        int32s[0] = interval / 12 | 0; /* years */
        int32s[1] = interval % 12 | 0; /* months */
        return int32s;
    };
    /** @ignore */
    const getFixedSizeList = (vector, index) => {
        const child = vector.getChildAt(0), { stride } = vector;
        return child.slice(index * stride, (index + 1) * stride);
    };
    GetVisitor.prototype.visitNull = getNull;
    GetVisitor.prototype.visitBool = getBool;
    GetVisitor.prototype.visitInt = getInt;
    GetVisitor.prototype.visitInt8 = getNumeric;
    GetVisitor.prototype.visitInt16 = getNumeric;
    GetVisitor.prototype.visitInt32 = getNumeric;
    GetVisitor.prototype.visitInt64 = getBigInts;
    GetVisitor.prototype.visitUint8 = getNumeric;
    GetVisitor.prototype.visitUint16 = getNumeric;
    GetVisitor.prototype.visitUint32 = getNumeric;
    GetVisitor.prototype.visitUint64 = getBigInts;
    GetVisitor.prototype.visitFloat = getFloat;
    GetVisitor.prototype.visitFloat16 = getFloat16;
    GetVisitor.prototype.visitFloat32 = getNumeric;
    GetVisitor.prototype.visitFloat64 = getNumeric;
    GetVisitor.prototype.visitUtf8 = getUtf8;
    GetVisitor.prototype.visitBinary = getBinary;
    GetVisitor.prototype.visitFixedSizeBinary = getFixedSizeBinary;
    GetVisitor.prototype.visitDate = getDate;
    GetVisitor.prototype.visitDateDay = getDateDay;
    GetVisitor.prototype.visitDateMillisecond = getDateMillisecond;
    GetVisitor.prototype.visitTimestamp = getTimestamp;
    GetVisitor.prototype.visitTimestampSecond = getTimestampSecond;
    GetVisitor.prototype.visitTimestampMillisecond = getTimestampMillisecond;
    GetVisitor.prototype.visitTimestampMicrosecond = getTimestampMicrosecond;
    GetVisitor.prototype.visitTimestampNanosecond = getTimestampNanosecond;
    GetVisitor.prototype.visitTime = getTime;
    GetVisitor.prototype.visitTimeSecond = getTimeSecond;
    GetVisitor.prototype.visitTimeMillisecond = getTimeMillisecond;
    GetVisitor.prototype.visitTimeMicrosecond = getTimeMicrosecond;
    GetVisitor.prototype.visitTimeNanosecond = getTimeNanosecond;
    GetVisitor.prototype.visitDecimal = getDecimal;
    GetVisitor.prototype.visitList = getList$1;
    GetVisitor.prototype.visitStruct = getStruct$1;
    GetVisitor.prototype.visitUnion = getUnion;
    GetVisitor.prototype.visitDenseUnion = getDenseUnion;
    GetVisitor.prototype.visitSparseUnion = getSparseUnion;
    GetVisitor.prototype.visitDictionary = getDictionary;
    GetVisitor.prototype.visitInterval = getInterval;
    GetVisitor.prototype.visitIntervalDayTime = getIntervalDayTime;
    GetVisitor.prototype.visitIntervalYearMonth = getIntervalYearMonth;
    GetVisitor.prototype.visitFixedSizeList = getFixedSizeList;
    GetVisitor.prototype.visitMap = getMap;
    /** @ignore */
    const instance$c = new GetVisitor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IndexOfVisitor extends Visitor {
    }
    /** @ignore */
    function nullIndexOf(vector, searchElement) {
        // if you're looking for nulls and the vector isn't empty, we've got 'em!
        return searchElement === null && vector.length > 0 ? 0 : -1;
    }
    /** @ignore */
    function indexOfNull(vector, fromIndex) {
        const { nullBitmap } = vector.data;
        if (!nullBitmap || vector.nullCount <= 0) {
            return -1;
        }
        let i = 0;
        for (const isValid of iterateBits(nullBitmap, vector.data.offset + (fromIndex || 0), vector.length, nullBitmap, getBool$1)) {
            if (!isValid) {
                return i;
            }
            ++i;
        }
        return -1;
    }
    /** @ignore */
    function indexOfValue(vector, searchElement, fromIndex) {
        if (searchElement === undefined) {
            return -1;
        }
        if (searchElement === null) {
            return indexOfNull(vector, fromIndex);
        }
        const compare = createElementComparator(searchElement);
        for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {
            if (compare(vector.get(i))) {
                return i;
            }
        }
        return -1;
    }
    /** @ignore */
    function indexOfUnion(vector, searchElement, fromIndex) {
        // Unions are special -- they do have a nullBitmap, but so can their children.
        // If the searchElement is null, we don't know whether it came from the Union's
        // bitmap or one of its childrens'. So we don't interrogate the Union's bitmap,
        // since that will report the wrong index if a child has a null before the Union.
        const compare = createElementComparator(searchElement);
        for (let i = (fromIndex || 0) - 1, n = vector.length; ++i < n;) {
            if (compare(vector.get(i))) {
                return i;
            }
        }
        return -1;
    }
    IndexOfVisitor.prototype.visitNull = nullIndexOf;
    IndexOfVisitor.prototype.visitBool = indexOfValue;
    IndexOfVisitor.prototype.visitInt = indexOfValue;
    IndexOfVisitor.prototype.visitInt8 = indexOfValue;
    IndexOfVisitor.prototype.visitInt16 = indexOfValue;
    IndexOfVisitor.prototype.visitInt32 = indexOfValue;
    IndexOfVisitor.prototype.visitInt64 = indexOfValue;
    IndexOfVisitor.prototype.visitUint8 = indexOfValue;
    IndexOfVisitor.prototype.visitUint16 = indexOfValue;
    IndexOfVisitor.prototype.visitUint32 = indexOfValue;
    IndexOfVisitor.prototype.visitUint64 = indexOfValue;
    IndexOfVisitor.prototype.visitFloat = indexOfValue;
    IndexOfVisitor.prototype.visitFloat16 = indexOfValue;
    IndexOfVisitor.prototype.visitFloat32 = indexOfValue;
    IndexOfVisitor.prototype.visitFloat64 = indexOfValue;
    IndexOfVisitor.prototype.visitUtf8 = indexOfValue;
    IndexOfVisitor.prototype.visitBinary = indexOfValue;
    IndexOfVisitor.prototype.visitFixedSizeBinary = indexOfValue;
    IndexOfVisitor.prototype.visitDate = indexOfValue;
    IndexOfVisitor.prototype.visitDateDay = indexOfValue;
    IndexOfVisitor.prototype.visitDateMillisecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimestamp = indexOfValue;
    IndexOfVisitor.prototype.visitTimestampSecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimestampMillisecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimestampMicrosecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimestampNanosecond = indexOfValue;
    IndexOfVisitor.prototype.visitTime = indexOfValue;
    IndexOfVisitor.prototype.visitTimeSecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimeMillisecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimeMicrosecond = indexOfValue;
    IndexOfVisitor.prototype.visitTimeNanosecond = indexOfValue;
    IndexOfVisitor.prototype.visitDecimal = indexOfValue;
    IndexOfVisitor.prototype.visitList = indexOfValue;
    IndexOfVisitor.prototype.visitStruct = indexOfValue;
    IndexOfVisitor.prototype.visitUnion = indexOfValue;
    IndexOfVisitor.prototype.visitDenseUnion = indexOfUnion;
    IndexOfVisitor.prototype.visitSparseUnion = indexOfUnion;
    IndexOfVisitor.prototype.visitDictionary = indexOfValue;
    IndexOfVisitor.prototype.visitInterval = indexOfValue;
    IndexOfVisitor.prototype.visitIntervalDayTime = indexOfValue;
    IndexOfVisitor.prototype.visitIntervalYearMonth = indexOfValue;
    IndexOfVisitor.prototype.visitFixedSizeList = indexOfValue;
    IndexOfVisitor.prototype.visitMap = indexOfValue;
    /** @ignore */
    const instance$b = new IndexOfVisitor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class IteratorVisitor extends Visitor {
    }
    /** @ignore */
    function nullableIterator(vector) {
        const getFn = instance$c.getVisitFn(vector);
        return iterateBits(vector.data.nullBitmap, vector.data.offset, vector.length, vector, (vec, idx, nullByte, nullBit) => ((nullByte & 1 << nullBit) !== 0) ? getFn(vec, idx) : null);
    }
    /** @ignore */
    function vectorIterator(vector) {
        // If nullable, iterate manually
        if (vector.nullCount > 0) {
            return nullableIterator(vector);
        }
        const { type, typeId, length } = vector;
        // Fast case, defer to native iterators if possible
        if (vector.stride === 1 && ((typeId === Type$2.Timestamp) ||
            (typeId === Type$2.Int && type.bitWidth !== 64) ||
            (typeId === Type$2.Time && type.bitWidth !== 64) ||
            (typeId === Type$2.Float && type.precision > 0 /* Precision.HALF */))) {
            return vector.data.values.subarray(0, length)[Symbol.iterator]();
        }
        // Otherwise, iterate manually
        return (function* (getFn) {
            for (let index = -1; ++index < length;) {
                yield getFn(vector, index);
            }
        })(instance$c.getVisitFn(vector));
    }
    IteratorVisitor.prototype.visitNull = vectorIterator;
    IteratorVisitor.prototype.visitBool = vectorIterator;
    IteratorVisitor.prototype.visitInt = vectorIterator;
    IteratorVisitor.prototype.visitInt8 = vectorIterator;
    IteratorVisitor.prototype.visitInt16 = vectorIterator;
    IteratorVisitor.prototype.visitInt32 = vectorIterator;
    IteratorVisitor.prototype.visitInt64 = vectorIterator;
    IteratorVisitor.prototype.visitUint8 = vectorIterator;
    IteratorVisitor.prototype.visitUint16 = vectorIterator;
    IteratorVisitor.prototype.visitUint32 = vectorIterator;
    IteratorVisitor.prototype.visitUint64 = vectorIterator;
    IteratorVisitor.prototype.visitFloat = vectorIterator;
    IteratorVisitor.prototype.visitFloat16 = vectorIterator;
    IteratorVisitor.prototype.visitFloat32 = vectorIterator;
    IteratorVisitor.prototype.visitFloat64 = vectorIterator;
    IteratorVisitor.prototype.visitUtf8 = vectorIterator;
    IteratorVisitor.prototype.visitBinary = vectorIterator;
    IteratorVisitor.prototype.visitFixedSizeBinary = vectorIterator;
    IteratorVisitor.prototype.visitDate = vectorIterator;
    IteratorVisitor.prototype.visitDateDay = vectorIterator;
    IteratorVisitor.prototype.visitDateMillisecond = vectorIterator;
    IteratorVisitor.prototype.visitTimestamp = vectorIterator;
    IteratorVisitor.prototype.visitTimestampSecond = vectorIterator;
    IteratorVisitor.prototype.visitTimestampMillisecond = vectorIterator;
    IteratorVisitor.prototype.visitTimestampMicrosecond = vectorIterator;
    IteratorVisitor.prototype.visitTimestampNanosecond = vectorIterator;
    IteratorVisitor.prototype.visitTime = vectorIterator;
    IteratorVisitor.prototype.visitTimeSecond = vectorIterator;
    IteratorVisitor.prototype.visitTimeMillisecond = vectorIterator;
    IteratorVisitor.prototype.visitTimeMicrosecond = vectorIterator;
    IteratorVisitor.prototype.visitTimeNanosecond = vectorIterator;
    IteratorVisitor.prototype.visitDecimal = vectorIterator;
    IteratorVisitor.prototype.visitList = vectorIterator;
    IteratorVisitor.prototype.visitStruct = vectorIterator;
    IteratorVisitor.prototype.visitUnion = vectorIterator;
    IteratorVisitor.prototype.visitDenseUnion = vectorIterator;
    IteratorVisitor.prototype.visitSparseUnion = vectorIterator;
    IteratorVisitor.prototype.visitDictionary = vectorIterator;
    IteratorVisitor.prototype.visitInterval = vectorIterator;
    IteratorVisitor.prototype.visitIntervalDayTime = vectorIterator;
    IteratorVisitor.prototype.visitIntervalYearMonth = vectorIterator;
    IteratorVisitor.prototype.visitFixedSizeList = vectorIterator;
    IteratorVisitor.prototype.visitMap = vectorIterator;
    /** @ignore */
    const instance$a = new IteratorVisitor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class ToArrayVisitor extends Visitor {
    }
    /** @ignore */
    function arrayOfVector(vector) {
        const { type, length, stride } = vector;
        // Fast case, return subarray if possible
        switch (type.typeId) {
            case Type$2.Int:
            case Type$2.Float:
            case Type$2.Decimal:
            case Type$2.Time:
            case Type$2.Timestamp:
                return vector.data.values.subarray(0, length * stride);
        }
        // Otherwise if not primitive, slow copy
        return [...instance$a.visit(vector)];
    }
    ToArrayVisitor.prototype.visitNull = arrayOfVector;
    ToArrayVisitor.prototype.visitBool = arrayOfVector;
    ToArrayVisitor.prototype.visitInt = arrayOfVector;
    ToArrayVisitor.prototype.visitInt8 = arrayOfVector;
    ToArrayVisitor.prototype.visitInt16 = arrayOfVector;
    ToArrayVisitor.prototype.visitInt32 = arrayOfVector;
    ToArrayVisitor.prototype.visitInt64 = arrayOfVector;
    ToArrayVisitor.prototype.visitUint8 = arrayOfVector;
    ToArrayVisitor.prototype.visitUint16 = arrayOfVector;
    ToArrayVisitor.prototype.visitUint32 = arrayOfVector;
    ToArrayVisitor.prototype.visitUint64 = arrayOfVector;
    ToArrayVisitor.prototype.visitFloat = arrayOfVector;
    ToArrayVisitor.prototype.visitFloat16 = arrayOfVector;
    ToArrayVisitor.prototype.visitFloat32 = arrayOfVector;
    ToArrayVisitor.prototype.visitFloat64 = arrayOfVector;
    ToArrayVisitor.prototype.visitUtf8 = arrayOfVector;
    ToArrayVisitor.prototype.visitBinary = arrayOfVector;
    ToArrayVisitor.prototype.visitFixedSizeBinary = arrayOfVector;
    ToArrayVisitor.prototype.visitDate = arrayOfVector;
    ToArrayVisitor.prototype.visitDateDay = arrayOfVector;
    ToArrayVisitor.prototype.visitDateMillisecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimestamp = arrayOfVector;
    ToArrayVisitor.prototype.visitTimestampSecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimestampMillisecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimestampMicrosecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimestampNanosecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTime = arrayOfVector;
    ToArrayVisitor.prototype.visitTimeSecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimeMillisecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimeMicrosecond = arrayOfVector;
    ToArrayVisitor.prototype.visitTimeNanosecond = arrayOfVector;
    ToArrayVisitor.prototype.visitDecimal = arrayOfVector;
    ToArrayVisitor.prototype.visitList = arrayOfVector;
    ToArrayVisitor.prototype.visitStruct = arrayOfVector;
    ToArrayVisitor.prototype.visitUnion = arrayOfVector;
    ToArrayVisitor.prototype.visitDenseUnion = arrayOfVector;
    ToArrayVisitor.prototype.visitSparseUnion = arrayOfVector;
    ToArrayVisitor.prototype.visitDictionary = arrayOfVector;
    ToArrayVisitor.prototype.visitInterval = arrayOfVector;
    ToArrayVisitor.prototype.visitIntervalDayTime = arrayOfVector;
    ToArrayVisitor.prototype.visitIntervalYearMonth = arrayOfVector;
    ToArrayVisitor.prototype.visitFixedSizeList = arrayOfVector;
    ToArrayVisitor.prototype.visitMap = arrayOfVector;
    /** @ignore */
    const instance$9 = new ToArrayVisitor();

    /* istanbul ignore file */
    /** @ignore */ const sum = (x, y) => x + y;
    /** @ignore */ const variableWidthColumnErrorMessage = (type) => `Cannot compute the byte width of variable-width column ${type}`;
    /** @ignore */
    class ByteWidthVisitor extends Visitor {
        visitNull(____) { return 0; }
        visitInt(type) { return type.bitWidth / 8; }
        visitFloat(type) { return type.ArrayType.BYTES_PER_ELEMENT; }
        visitBinary(type) { throw new Error(variableWidthColumnErrorMessage(type)); }
        visitUtf8(type) { throw new Error(variableWidthColumnErrorMessage(type)); }
        visitBool(____) { return 1 / 8; }
        visitDecimal(____) { return 16; }
        visitDate(type) { return (type.unit + 1) * 4; }
        visitTime(type) { return type.bitWidth / 8; }
        visitTimestamp(type) { return type.unit === TimeUnit.SECOND ? 4 : 8; }
        visitInterval(type) { return (type.unit + 1) * 4; }
        visitList(type) { throw new Error(variableWidthColumnErrorMessage(type)); }
        visitStruct(type) { return this.visitFields(type.children).reduce(sum, 0); }
        visitUnion(type) { return this.visitFields(type.children).reduce(sum, 0); }
        visitFixedSizeBinary(type) { return type.byteWidth; }
        visitFixedSizeList(type) { return type.listSize * this.visitFields(type.children).reduce(sum, 0); }
        visitMap(type) { return this.visitFields(type.children).reduce(sum, 0); }
        visitDictionary(type) { return this.visit(type.indices); }
        visitFields(fields) { return (fields || []).map((field) => this.visit(field.type)); }
        visitSchema(schema) { return this.visitFields(schema.fields).reduce(sum, 0); }
    }
    /** @ignore */
    const instance$8 = new ByteWidthVisitor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class GetVectorConstructor extends Visitor {
        visitNull() { return NullVector; }
        visitBool() { return BoolVector; }
        visitInt() { return IntVector; }
        visitInt8() { return Int8Vector; }
        visitInt16() { return Int16Vector; }
        visitInt32() { return Int32Vector; }
        visitInt64() { return Int64Vector; }
        visitUint8() { return Uint8Vector; }
        visitUint16() { return Uint16Vector; }
        visitUint32() { return Uint32Vector; }
        visitUint64() { return Uint64Vector; }
        visitFloat() { return FloatVector; }
        visitFloat16() { return Float16Vector; }
        visitFloat32() { return Float32Vector; }
        visitFloat64() { return Float64Vector; }
        visitUtf8() { return Utf8Vector; }
        visitBinary() { return BinaryVector; }
        visitFixedSizeBinary() { return FixedSizeBinaryVector; }
        visitDate() { return DateVector; }
        visitDateDay() { return DateDayVector; }
        visitDateMillisecond() { return DateMillisecondVector; }
        visitTimestamp() { return TimestampVector; }
        visitTimestampSecond() { return TimestampSecondVector; }
        visitTimestampMillisecond() { return TimestampMillisecondVector; }
        visitTimestampMicrosecond() { return TimestampMicrosecondVector; }
        visitTimestampNanosecond() { return TimestampNanosecondVector; }
        visitTime() { return TimeVector; }
        visitTimeSecond() { return TimeSecondVector; }
        visitTimeMillisecond() { return TimeMillisecondVector; }
        visitTimeMicrosecond() { return TimeMicrosecondVector; }
        visitTimeNanosecond() { return TimeNanosecondVector; }
        visitDecimal() { return DecimalVector; }
        visitList() { return ListVector; }
        visitStruct() { return StructVector; }
        visitUnion() { return UnionVector; }
        visitDenseUnion() { return DenseUnionVector; }
        visitSparseUnion() { return SparseUnionVector; }
        visitDictionary() { return DictionaryVector; }
        visitInterval() { return IntervalVector; }
        visitIntervalDayTime() { return IntervalDayTimeVector; }
        visitIntervalYearMonth() { return IntervalYearMonthVector; }
        visitFixedSizeList() { return FixedSizeListVector; }
        visitMap() { return MapVector; }
    }
    /** @ignore */
    const instance$7 = new GetVectorConstructor();

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @nocollapse */
    AbstractVector.new = newVector;
    /** @nocollapse */
    AbstractVector.from = vectorFrom;
    /** @ignore */
    function newVector(data, ...args) {
        return new (instance$7.getVisitFn(data)())(data, ...args);
    }
    /** @ignore */
    function vectorFromValuesWithType(newDataType, input) {
        if (isIterable(input)) {
            return AbstractVector.from({ 'nullValues': [null, undefined], type: newDataType(), 'values': input });
        }
        else if (isAsyncIterable(input)) {
            return AbstractVector.from({ 'nullValues': [null, undefined], type: newDataType(), 'values': input });
        }
        const { 'values': values = [], 'type': type = newDataType(), 'nullValues': nullValues = [null, undefined], } = { ...input };
        return isIterable(values)
            ? AbstractVector.from({ nullValues, ...input, type })
            : AbstractVector.from({ nullValues, ...input, type });
    }
    function vectorFrom(input) {
        const { 'values': values = [], ...options } = { 'nullValues': [null, undefined], ...input };
        if (isIterable(values)) {
            const chunks = [...Builder$2.throughIterable(options)(values)];
            return (chunks.length === 1 ? chunks[0] : Chunked.concat(chunks));
        }
        return (async (chunks) => {
            const transform = Builder$2.throughAsyncIterable(options);
            for await (const chunk of transform(values)) {
                chunks.push(chunk);
            }
            return (chunks.length === 1 ? chunks[0] : Chunked.concat(chunks));
        })([]);
    }
    //
    // We provide the following method implementations for code navigability purposes only.
    // They're overridden at runtime below with the specific Visitor implementation for each type,
    // short-circuiting the usual Visitor traversal and reducing intermediate lookups and calls.
    // This comment is here to remind you to not set breakpoints in these function bodies, or to inform
    // you why the breakpoints you have already set are not being triggered. Have a great day!
    //
    BaseVector.prototype.get = function baseVectorGet(index) {
        return instance$c.visit(this, index);
    };
    BaseVector.prototype.set = function baseVectorSet(index, value) {
        return instance$f.visit(this, index, value);
    };
    BaseVector.prototype.indexOf = function baseVectorIndexOf(value, fromIndex) {
        return instance$b.visit(this, value, fromIndex);
    };
    BaseVector.prototype.toArray = function baseVectorToArray() {
        return instance$9.visit(this);
    };
    BaseVector.prototype.getByteWidth = function baseVectorGetByteWidth() {
        return instance$8.visit(this.type);
    };
    BaseVector.prototype[Symbol.iterator] = function baseVectorSymbolIterator() {
        return instance$a.visit(this);
    };
    BaseVector.prototype._bindDataAccessors = bindBaseVectorDataAccessors;
    // Perf: bind and assign the operator Visitor methods to each of the Vector subclasses for each Type
    Object.keys(Type$2)
        .map((T) => Type$2[T])
        .filter((T) => typeof T === 'number')
        .filter((typeId) => typeId !== Type$2.NONE)
        .forEach((typeId) => {
        const VectorCtor = instance$7.visit(typeId);
        VectorCtor.prototype['get'] = partial1(instance$c.getVisitFn(typeId));
        VectorCtor.prototype['set'] = partial2(instance$f.getVisitFn(typeId));
        VectorCtor.prototype['indexOf'] = partial2(instance$b.getVisitFn(typeId));
        VectorCtor.prototype['toArray'] = partial0(instance$9.getVisitFn(typeId));
        VectorCtor.prototype['getByteWidth'] = partialType0(instance$8.getVisitFn(typeId));
        VectorCtor.prototype[Symbol.iterator] = partial0(instance$a.getVisitFn(typeId));
    });
    /** @ignore */
    function partialType0(visit) {
        return function () { return visit(this.type); };
    }
    /** @ignore */
    function wrapNullableGet(fn) {
        return function (i) { return this.isValid(i) ? fn.call(this, i) : null; };
    }
    /** @ignore */
    function wrapNullableSet(fn) {
        return function (i, a) {
            if (setBool$1(this.nullBitmap, this.offset + i, !(a === null || a === undefined))) {
                fn.call(this, i, a);
            }
        };
    }
    /** @ignore */
    function bindBaseVectorDataAccessors() {
        const nullBitmap = this.nullBitmap;
        if (nullBitmap && nullBitmap.byteLength > 0) {
            this.get = wrapNullableGet(this.get);
            this.set = wrapNullableSet(this.set);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    class Table extends Chunked {
        constructor(...args) {
            let schema = null;
            if (args[0] instanceof Schema) {
                schema = args.shift();
            }
            let chunks = selectArgs(RecordBatch, args);
            if (!schema && !(schema = chunks[0] && chunks[0].schema)) {
                throw new TypeError('Table must be initialized with a Schema or at least one RecordBatch');
            }
            chunks[0] || (chunks[0] = new _InternalEmptyPlaceholderRecordBatch(schema));
            super(new Struct$1(schema.fields), chunks);
            this._schema = schema;
            this._chunks = chunks;
        }
        /** @nocollapse */
        static empty(schema = new Schema([])) { return new Table(schema, []); }
        /** @nocollapse */
        static from(input) {
            if (!input) {
                return Table.empty();
            }
            if (typeof input === 'object') {
                let table = isIterable(input['values']) ? tableFromIterable(input)
                    : isAsyncIterable(input['values']) ? tableFromAsyncIterable(input)
                        : null;
                if (table !== null) {
                    return table;
                }
            }
            let reader = RecordBatchReader.from(input);
            if (isPromise(reader)) {
                return (async () => await Table.from(await reader))();
            }
            if (reader.isSync() && (reader = reader.open())) {
                return !reader.schema ? Table.empty() : new Table(reader.schema, [...reader]);
            }
            return (async (opening) => {
                const reader = await opening;
                const schema = reader.schema;
                const batches = [];
                if (schema) {
                    for await (let batch of reader) {
                        batches.push(batch);
                    }
                    return new Table(schema, batches);
                }
                return Table.empty();
            })(reader.open());
        }
        /** @nocollapse */
        static async fromAsync(source) {
            return await Table.from(source);
        }
        /** @nocollapse */
        static fromStruct(vector) {
            return Table.new(vector.data.childData, vector.type.children);
        }
        /** @nocollapse */
        static new(...cols) {
            return new Table(...distributeColumnsIntoRecordBatches(selectColumnArgs(cols)));
        }
        get schema() { return this._schema; }
        get length() { return this._length; }
        get chunks() { return this._chunks; }
        get numCols() { return this._numChildren; }
        clone(chunks = this._chunks) {
            return new Table(this._schema, chunks);
        }
        getColumn(name) {
            return this.getColumnAt(this.getColumnIndex(name));
        }
        getColumnAt(index) {
            return this.getChildAt(index);
        }
        getColumnIndex(name) {
            return this._schema.fields.findIndex((f) => f.name === name);
        }
        getChildAt(index) {
            if (index < 0 || index >= this.numChildren) {
                return null;
            }
            let field, child;
            const fields = this._schema.fields;
            const columns = this._children || (this._children = []);
            if (child = columns[index]) {
                return child;
            }
            if (field = fields[index]) {
                const chunks = this._chunks
                    .map((chunk) => chunk.getChildAt(index))
                    .filter((vec) => vec != null);
                if (chunks.length > 0) {
                    return (columns[index] = new Column(field, chunks));
                }
            }
            return null;
        }
        // @ts-ignore
        serialize(encoding = 'binary', stream = true) {
            const Writer = !stream
                ? RecordBatchFileWriter
                : RecordBatchStreamWriter;
            return Writer.writeAll(this).toUint8Array(true);
        }
        count() {
            return this._length;
        }
        select(...columnNames) {
            const nameToIndex = this._schema.fields.reduce((m, f, i) => m.set(f.name, i), new Map());
            return this.selectAt(...columnNames.map((columnName) => nameToIndex.get(columnName)).filter((x) => x > -1));
        }
        selectAt(...columnIndices) {
            const schema = this._schema.selectAt(...columnIndices);
            return new Table(schema, this._chunks.map(({ length, data: { childData } }) => {
                return new RecordBatch(schema, length, columnIndices.map((i) => childData[i]).filter(Boolean));
            }));
        }
        assign(other) {
            const fields = this._schema.fields;
            const [indices, oldToNew] = other.schema.fields.reduce((memo, f2, newIdx) => {
                const [indices, oldToNew] = memo;
                const i = fields.findIndex((f) => f.name === f2.name);
                ~i ? (oldToNew[i] = newIdx) : indices.push(newIdx);
                return memo;
            }, [[], []]);
            const schema = this._schema.assign(other.schema);
            const columns = [
                ...fields.map((_f, i, _fs, j = oldToNew[i]) => (j === undefined ? this.getColumnAt(i) : other.getColumnAt(j))),
                ...indices.map((i) => other.getColumnAt(i))
            ].filter(Boolean);
            return new Table(...distributeVectorsIntoRecordBatches(schema, columns));
        }
    }
    function tableFromIterable(input) {
        const { type } = input;
        if (type instanceof Struct$1) {
            return Table.fromStruct(StructVector.from(input));
        }
        return null;
    }
    function tableFromAsyncIterable(input) {
        const { type } = input;
        if (type instanceof Struct$1) {
            return StructVector.from(input).then((vector) => Table.fromStruct(vector));
        }
        return null;
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    class RecordBatch extends StructVector {
        constructor(...args) {
            let data;
            let schema = args[0];
            let children;
            if (args[1] instanceof Data) {
                [, data, children] = args;
            }
            else {
                const fields = schema.fields;
                const [, length, childData] = args;
                data = Data.Struct(new Struct$1(fields), 0, length, 0, null, childData);
            }
            super(data, children);
            this._schema = schema;
        }
        /** @nocollapse */
        static from(options) {
            if (isIterable(options['values'])) {
                return Table.from(options);
            }
            return Table.from(options);
        }
        /** @nocollapse */
        static new(...args) {
            const [fs, xs] = selectFieldArgs(args);
            const vs = xs.filter((x) => x instanceof AbstractVector);
            return new RecordBatch(...ensureSameLengthData(new Schema(fs), vs.map((x) => x.data)));
        }
        clone(data, children = this._children) {
            return new RecordBatch(this._schema, data, children);
        }
        concat(...others) {
            const schema = this._schema, chunks = Chunked.flatten(this, ...others);
            return new Table(schema, chunks.map(({ data }) => new RecordBatch(schema, data)));
        }
        get schema() { return this._schema; }
        get numCols() { return this._schema.fields.length; }
        get dictionaries() {
            return this._dictionaries || (this._dictionaries = DictionaryCollector.collect(this));
        }
        select(...columnNames) {
            const nameToIndex = this._schema.fields.reduce((m, f, i) => m.set(f.name, i), new Map());
            return this.selectAt(...columnNames.map((columnName) => nameToIndex.get(columnName)).filter((x) => x > -1));
        }
        selectAt(...columnIndices) {
            const schema = this._schema.selectAt(...columnIndices);
            const childData = columnIndices.map((i) => this.data.childData[i]).filter(Boolean);
            return new RecordBatch(schema, this.length, childData);
        }
    }
    /**
     * An internal class used by the `RecordBatchReader` and `RecordBatchWriter`
     * implementations to differentiate between a stream with valid zero-length
     * RecordBatches, and a stream with a Schema message, but no RecordBatches.
     * @see https://github.com/apache/arrow/pull/4373
     * @ignore
     * @private
     */
    /* tslint:disable:class-name */
    class _InternalEmptyPlaceholderRecordBatch extends RecordBatch {
        constructor(schema) {
            super(schema, 0, schema.fields.map((f) => Data.new(f.type, 0, 0, 0)));
        }
    }
    /** @ignore */
    class DictionaryCollector extends Visitor {
        constructor() {
            super(...arguments);
            this.dictionaries = new Map();
        }
        static collect(batch) {
            return new DictionaryCollector().visit(batch.data, new Struct$1(batch.schema.fields)).dictionaries;
        }
        visit(data, type) {
            if (DataType.isDictionary(type)) {
                return this.visitDictionary(data, type);
            }
            else {
                data.childData.forEach((child, i) => this.visit(child, type.children[i].type));
            }
            return this;
        }
        visitDictionary(data, type) {
            const dictionary = data.dictionary;
            if (dictionary && dictionary.length > 0) {
                this.dictionaries.set(type.id, dictionary);
            }
            return this;
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    class RecordBatchReader extends ReadableInterop {
        constructor(impl) {
            super();
            this._impl = impl;
        }
        get closed() { return this._impl.closed; }
        get schema() { return this._impl.schema; }
        get autoDestroy() { return this._impl.autoDestroy; }
        get dictionaries() { return this._impl.dictionaries; }
        get numDictionaries() { return this._impl.numDictionaries; }
        get numRecordBatches() { return this._impl.numRecordBatches; }
        get footer() { return this._impl.isFile() ? this._impl.footer : null; }
        isSync() { return this._impl.isSync(); }
        isAsync() { return this._impl.isAsync(); }
        isFile() { return this._impl.isFile(); }
        isStream() { return this._impl.isStream(); }
        next() {
            return this._impl.next();
        }
        throw(value) {
            return this._impl.throw(value);
        }
        return(value) {
            return this._impl.return(value);
        }
        cancel() {
            return this._impl.cancel();
        }
        reset(schema) {
            this._impl.reset(schema);
            this._DOMStream = undefined;
            this._nodeStream = undefined;
            return this;
        }
        open(options) {
            const opening = this._impl.open(options);
            return isPromise(opening) ? opening.then(() => this) : this;
        }
        readRecordBatch(index) {
            return this._impl.isFile() ? this._impl.readRecordBatch(index) : null;
        }
        [Symbol.iterator]() {
            return this._impl[Symbol.iterator]();
        }
        [Symbol.asyncIterator]() {
            return this._impl[Symbol.asyncIterator]();
        }
        toDOMStream() {
            return streamAdapters.toDOMStream((this.isSync()
                ? { [Symbol.iterator]: () => this }
                : { [Symbol.asyncIterator]: () => this }));
        }
        toNodeStream() {
            return streamAdapters.toNodeStream((this.isSync()
                ? { [Symbol.iterator]: () => this }
                : { [Symbol.asyncIterator]: () => this }), { objectMode: true });
        }
        /** @nocollapse */
        // @ts-ignore
        static throughNode(options) {
            throw new Error(`"throughNode" not available in this environment`);
        }
        /** @nocollapse */
        static throughDOM(
        // @ts-ignore
        writableStrategy, 
        // @ts-ignore
        readableStrategy) {
            throw new Error(`"throughDOM" not available in this environment`);
        }
        /** @nocollapse */
        static from(source) {
            if (source instanceof RecordBatchReader) {
                return source;
            }
            else if (isArrowJSON(source)) {
                return fromArrowJSON(source);
            }
            else if (isFileHandle(source)) {
                return fromFileHandle(source);
            }
            else if (isPromise(source)) {
                return (async () => await RecordBatchReader.from(await source))();
            }
            else if (isFetchResponse(source) || isReadableDOMStream(source) || isReadableNodeStream(source) || isAsyncIterable(source)) {
                return fromAsyncByteStream(new AsyncByteStream(source));
            }
            return fromByteStream(new ByteStream(source));
        }
        /** @nocollapse */
        static readAll(source) {
            if (source instanceof RecordBatchReader) {
                return source.isSync() ? readAllSync(source) : readAllAsync(source);
            }
            else if (isArrowJSON(source) || ArrayBuffer.isView(source) || isIterable(source) || isIteratorResult(source)) {
                return readAllSync(source);
            }
            return readAllAsync(source);
        }
    }
    //
    // Since TS is a structural type system, we define the following subclass stubs
    // so that concrete types exist to associate with with the interfaces below.
    //
    // The implementation for each RecordBatchReader is hidden away in the set of
    // `RecordBatchReaderImpl` classes in the second half of this file. This allows
    // us to export a single RecordBatchReader class, and swap out the impl based
    // on the io primitives or underlying arrow (JSON, file, or stream) at runtime.
    //
    // Async/await makes our job a bit harder, since it forces everything to be
    // either fully sync or fully async. This is why the logic for the reader impls
    // has been duplicated into both sync and async variants. Since the RBR
    // delegates to its impl, an RBR with an AsyncRecordBatchFileReaderImpl for
    // example will return async/await-friendly Promises, but one with a (sync)
    // RecordBatchStreamReaderImpl will always return values. Nothing should be
    // different about their logic, aside from the async handling. This is also why
    // this code looks highly structured, as it should be nearly identical and easy
    // to follow.
    //
    /** @ignore */
    class RecordBatchStreamReader extends RecordBatchReader {
        constructor(_impl) {
            super(_impl);
            this._impl = _impl;
        }
        [Symbol.iterator]() { return this._impl[Symbol.iterator](); }
        async *[Symbol.asyncIterator]() { yield* this[Symbol.iterator](); }
    }
    /** @ignore */
    class AsyncRecordBatchStreamReader extends RecordBatchReader {
        constructor(_impl) {
            super(_impl);
            this._impl = _impl;
        }
        [Symbol.iterator]() { throw new Error(`AsyncRecordBatchStreamReader is not Iterable`); }
        [Symbol.asyncIterator]() { return this._impl[Symbol.asyncIterator](); }
    }
    /** @ignore */
    class RecordBatchFileReader extends RecordBatchStreamReader {
        constructor(_impl) {
            super(_impl);
            this._impl = _impl;
        }
    }
    /** @ignore */
    class AsyncRecordBatchFileReader extends AsyncRecordBatchStreamReader {
        constructor(_impl) {
            super(_impl);
            this._impl = _impl;
        }
    }
    /** @ignore */
    class RecordBatchReaderImpl {
        constructor(dictionaries = new Map()) {
            this.closed = false;
            this.autoDestroy = true;
            this._dictionaryIndex = 0;
            this._recordBatchIndex = 0;
            this.dictionaries = dictionaries;
        }
        get numDictionaries() { return this._dictionaryIndex; }
        get numRecordBatches() { return this._recordBatchIndex; }
        isSync() { return false; }
        isAsync() { return false; }
        isFile() { return false; }
        isStream() { return false; }
        reset(schema) {
            this._dictionaryIndex = 0;
            this._recordBatchIndex = 0;
            this.schema = schema;
            this.dictionaries = new Map();
            return this;
        }
        _loadRecordBatch(header, body) {
            return new RecordBatch(this.schema, header.length, this._loadVectors(header, body, this.schema.fields));
        }
        _loadDictionaryBatch(header, body) {
            const { id, isDelta, data } = header;
            const { dictionaries, schema } = this;
            const dictionary = dictionaries.get(id);
            if (isDelta || !dictionary) {
                const type = schema.dictionaries.get(id);
                return (dictionary && isDelta ? dictionary.concat(AbstractVector.new(this._loadVectors(data, body, [type])[0])) :
                    AbstractVector.new(this._loadVectors(data, body, [type])[0]));
            }
            return dictionary;
        }
        _loadVectors(header, body, types) {
            return new VectorLoader(body, header.nodes, header.buffers, this.dictionaries).visitMany(types);
        }
    }
    /** @ignore */
    class RecordBatchStreamReaderImpl extends RecordBatchReaderImpl {
        constructor(source, dictionaries) {
            super(dictionaries);
            this._reader = !isArrowJSON(source)
                ? new MessageReader(this._handle = source)
                : new JSONMessageReader(this._handle = source);
        }
        isSync() { return true; }
        isStream() { return true; }
        [Symbol.iterator]() {
            return this;
        }
        cancel() {
            if (!this.closed && (this.closed = true)) {
                this.reset()._reader.return();
                this._reader = null;
                this.dictionaries = null;
            }
        }
        open(options) {
            if (!this.closed) {
                this.autoDestroy = shouldAutoDestroy(this, options);
                if (!(this.schema || (this.schema = this._reader.readSchema()))) {
                    this.cancel();
                }
            }
            return this;
        }
        throw(value) {
            if (!this.closed && this.autoDestroy && (this.closed = true)) {
                return this.reset()._reader.throw(value);
            }
            return ITERATOR_DONE;
        }
        return(value) {
            if (!this.closed && this.autoDestroy && (this.closed = true)) {
                return this.reset()._reader.return(value);
            }
            return ITERATOR_DONE;
        }
        next() {
            if (this.closed) {
                return ITERATOR_DONE;
            }
            let message, { _reader: reader } = this;
            while (message = this._readNextMessageAndValidate()) {
                if (message.isSchema()) {
                    this.reset(message.header());
                }
                else if (message.isRecordBatch()) {
                    this._recordBatchIndex++;
                    const header = message.header();
                    const buffer = reader.readMessageBody(message.bodyLength);
                    const recordBatch = this._loadRecordBatch(header, buffer);
                    return { done: false, value: recordBatch };
                }
                else if (message.isDictionaryBatch()) {
                    this._dictionaryIndex++;
                    const header = message.header();
                    const buffer = reader.readMessageBody(message.bodyLength);
                    const vector = this._loadDictionaryBatch(header, buffer);
                    this.dictionaries.set(header.id, vector);
                }
            }
            if (this.schema && this._recordBatchIndex === 0) {
                this._recordBatchIndex++;
                return { done: false, value: new _InternalEmptyPlaceholderRecordBatch(this.schema) };
            }
            return this.return();
        }
        _readNextMessageAndValidate(type) {
            return this._reader.readMessage(type);
        }
    }
    /** @ignore */
    class AsyncRecordBatchStreamReaderImpl extends RecordBatchReaderImpl {
        constructor(source, dictionaries) {
            super(dictionaries);
            this._reader = new AsyncMessageReader(this._handle = source);
        }
        isAsync() { return true; }
        isStream() { return true; }
        [Symbol.asyncIterator]() {
            return this;
        }
        async cancel() {
            if (!this.closed && (this.closed = true)) {
                await this.reset()._reader.return();
                this._reader = null;
                this.dictionaries = null;
            }
        }
        async open(options) {
            if (!this.closed) {
                this.autoDestroy = shouldAutoDestroy(this, options);
                if (!(this.schema || (this.schema = (await this._reader.readSchema())))) {
                    await this.cancel();
                }
            }
            return this;
        }
        async throw(value) {
            if (!this.closed && this.autoDestroy && (this.closed = true)) {
                return await this.reset()._reader.throw(value);
            }
            return ITERATOR_DONE;
        }
        async return(value) {
            if (!this.closed && this.autoDestroy && (this.closed = true)) {
                return await this.reset()._reader.return(value);
            }
            return ITERATOR_DONE;
        }
        async next() {
            if (this.closed) {
                return ITERATOR_DONE;
            }
            let message, { _reader: reader } = this;
            while (message = await this._readNextMessageAndValidate()) {
                if (message.isSchema()) {
                    await this.reset(message.header());
                }
                else if (message.isRecordBatch()) {
                    this._recordBatchIndex++;
                    const header = message.header();
                    const buffer = await reader.readMessageBody(message.bodyLength);
                    const recordBatch = this._loadRecordBatch(header, buffer);
                    return { done: false, value: recordBatch };
                }
                else if (message.isDictionaryBatch()) {
                    this._dictionaryIndex++;
                    const header = message.header();
                    const buffer = await reader.readMessageBody(message.bodyLength);
                    const vector = this._loadDictionaryBatch(header, buffer);
                    this.dictionaries.set(header.id, vector);
                }
            }
            if (this.schema && this._recordBatchIndex === 0) {
                this._recordBatchIndex++;
                return { done: false, value: new _InternalEmptyPlaceholderRecordBatch(this.schema) };
            }
            return await this.return();
        }
        async _readNextMessageAndValidate(type) {
            return await this._reader.readMessage(type);
        }
    }
    /** @ignore */
    class RecordBatchFileReaderImpl extends RecordBatchStreamReaderImpl {
        constructor(source, dictionaries) {
            super(source instanceof RandomAccessFile ? source : new RandomAccessFile(source), dictionaries);
        }
        get footer() { return this._footer; }
        get numDictionaries() { return this._footer ? this._footer.numDictionaries : 0; }
        get numRecordBatches() { return this._footer ? this._footer.numRecordBatches : 0; }
        isSync() { return true; }
        isFile() { return true; }
        open(options) {
            if (!this.closed && !this._footer) {
                this.schema = (this._footer = this._readFooter()).schema;
                for (const block of this._footer.dictionaryBatches()) {
                    block && this._readDictionaryBatch(this._dictionaryIndex++);
                }
            }
            return super.open(options);
        }
        readRecordBatch(index) {
            if (this.closed) {
                return null;
            }
            if (!this._footer) {
                this.open();
            }
            const block = this._footer && this._footer.getRecordBatch(index);
            if (block && this._handle.seek(block.offset)) {
                const message = this._reader.readMessage(MessageHeader.RecordBatch);
                if (message && message.isRecordBatch()) {
                    const header = message.header();
                    const buffer = this._reader.readMessageBody(message.bodyLength);
                    const recordBatch = this._loadRecordBatch(header, buffer);
                    return recordBatch;
                }
            }
            return null;
        }
        _readDictionaryBatch(index) {
            const block = this._footer && this._footer.getDictionaryBatch(index);
            if (block && this._handle.seek(block.offset)) {
                const message = this._reader.readMessage(MessageHeader.DictionaryBatch);
                if (message && message.isDictionaryBatch()) {
                    const header = message.header();
                    const buffer = this._reader.readMessageBody(message.bodyLength);
                    const vector = this._loadDictionaryBatch(header, buffer);
                    this.dictionaries.set(header.id, vector);
                }
            }
        }
        _readFooter() {
            const { _handle } = this;
            const offset = _handle.size - magicAndPadding;
            const length = _handle.readInt32(offset);
            const buffer = _handle.readAt(offset - length, length);
            return Footer_.decode(buffer);
        }
        _readNextMessageAndValidate(type) {
            if (!this._footer) {
                this.open();
            }
            if (this._footer && this._recordBatchIndex < this.numRecordBatches) {
                const block = this._footer && this._footer.getRecordBatch(this._recordBatchIndex);
                if (block && this._handle.seek(block.offset)) {
                    return this._reader.readMessage(type);
                }
            }
            return null;
        }
    }
    /** @ignore */
    class AsyncRecordBatchFileReaderImpl extends AsyncRecordBatchStreamReaderImpl {
        constructor(source, ...rest) {
            const byteLength = typeof rest[0] !== 'number' ? rest.shift() : undefined;
            const dictionaries = rest[0] instanceof Map ? rest.shift() : undefined;
            super(source instanceof AsyncRandomAccessFile ? source : new AsyncRandomAccessFile(source, byteLength), dictionaries);
        }
        get footer() { return this._footer; }
        get numDictionaries() { return this._footer ? this._footer.numDictionaries : 0; }
        get numRecordBatches() { return this._footer ? this._footer.numRecordBatches : 0; }
        isFile() { return true; }
        isAsync() { return true; }
        async open(options) {
            if (!this.closed && !this._footer) {
                this.schema = (this._footer = await this._readFooter()).schema;
                for (const block of this._footer.dictionaryBatches()) {
                    block && await this._readDictionaryBatch(this._dictionaryIndex++);
                }
            }
            return await super.open(options);
        }
        async readRecordBatch(index) {
            if (this.closed) {
                return null;
            }
            if (!this._footer) {
                await this.open();
            }
            const block = this._footer && this._footer.getRecordBatch(index);
            if (block && (await this._handle.seek(block.offset))) {
                const message = await this._reader.readMessage(MessageHeader.RecordBatch);
                if (message && message.isRecordBatch()) {
                    const header = message.header();
                    const buffer = await this._reader.readMessageBody(message.bodyLength);
                    const recordBatch = this._loadRecordBatch(header, buffer);
                    return recordBatch;
                }
            }
            return null;
        }
        async _readDictionaryBatch(index) {
            const block = this._footer && this._footer.getDictionaryBatch(index);
            if (block && (await this._handle.seek(block.offset))) {
                const message = await this._reader.readMessage(MessageHeader.DictionaryBatch);
                if (message && message.isDictionaryBatch()) {
                    const header = message.header();
                    const buffer = await this._reader.readMessageBody(message.bodyLength);
                    const vector = this._loadDictionaryBatch(header, buffer);
                    this.dictionaries.set(header.id, vector);
                }
            }
        }
        async _readFooter() {
            const { _handle } = this;
            _handle._pending && await _handle._pending;
            const offset = _handle.size - magicAndPadding;
            const length = await _handle.readInt32(offset);
            const buffer = await _handle.readAt(offset - length, length);
            return Footer_.decode(buffer);
        }
        async _readNextMessageAndValidate(type) {
            if (!this._footer) {
                await this.open();
            }
            if (this._footer && this._recordBatchIndex < this.numRecordBatches) {
                const block = this._footer.getRecordBatch(this._recordBatchIndex);
                if (block && await this._handle.seek(block.offset)) {
                    return await this._reader.readMessage(type);
                }
            }
            return null;
        }
    }
    /** @ignore */
    class RecordBatchJSONReaderImpl extends RecordBatchStreamReaderImpl {
        constructor(source, dictionaries) {
            super(source, dictionaries);
        }
        _loadVectors(header, body, types) {
            return new JSONVectorLoader(body, header.nodes, header.buffers, this.dictionaries).visitMany(types);
        }
    }
    //
    // Define some helper functions and static implementations down here. There's
    // a bit of branching in the static methods that can lead to the same routines
    // being executed, so we've broken those out here for readability.
    //
    /** @ignore */
    function shouldAutoDestroy(self, options) {
        return options && (typeof options['autoDestroy'] === 'boolean') ? options['autoDestroy'] : self['autoDestroy'];
    }
    /** @ignore */
    function* readAllSync(source) {
        const reader = RecordBatchReader.from(source);
        try {
            if (!reader.open({ autoDestroy: false }).closed) {
                do {
                    yield reader;
                } while (!(reader.reset().open()).closed);
            }
        }
        finally {
            reader.cancel();
        }
    }
    /** @ignore */
    async function* readAllAsync(source) {
        const reader = await RecordBatchReader.from(source);
        try {
            if (!(await reader.open({ autoDestroy: false })).closed) {
                do {
                    yield reader;
                } while (!(await reader.reset().open()).closed);
            }
        }
        finally {
            await reader.cancel();
        }
    }
    /** @ignore */
    function fromArrowJSON(source) {
        return new RecordBatchStreamReader(new RecordBatchJSONReaderImpl(source));
    }
    /** @ignore */
    function fromByteStream(source) {
        const bytes = source.peek((magicLength + 7) & ~7);
        return bytes && bytes.byteLength >= 4 ? !checkForMagicArrowString(bytes)
            ? new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(source))
            : new RecordBatchFileReader(new RecordBatchFileReaderImpl(source.read()))
            : new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(function* () { }()));
    }
    /** @ignore */
    async function fromAsyncByteStream(source) {
        const bytes = await source.peek((magicLength + 7) & ~7);
        return bytes && bytes.byteLength >= 4 ? !checkForMagicArrowString(bytes)
            ? new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(source))
            : new RecordBatchFileReader(new RecordBatchFileReaderImpl(await source.read()))
            : new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(async function* () { }()));
    }
    /** @ignore */
    async function fromFileHandle(source) {
        const { size } = await source.stat();
        const file = new AsyncRandomAccessFile(source, size);
        if (size >= magicX2AndPadding) {
            if (checkForMagicArrowString(await file.readAt(0, (magicLength + 7) & ~7))) {
                return new AsyncRecordBatchFileReader(new AsyncRecordBatchFileReaderImpl(file));
            }
        }
        return new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(file));
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function toDOMStream(source, options) {
        if (isAsyncIterable(source)) {
            return asyncIterableAsReadableDOMStream(source, options);
        }
        if (isIterable(source)) {
            return iterableAsReadableDOMStream(source, options);
        }
        /* istanbul ignore next */
        throw new Error(`toDOMStream() must be called with an Iterable or AsyncIterable`);
    }
    /** @ignore */
    function iterableAsReadableDOMStream(source, options) {
        let it = null;
        const bm = (options && options.type === 'bytes') || false;
        const hwm = options && options.highWaterMark || (2 ** 24);
        return new ReadableStream({
            ...options,
            start(controller) { next(controller, it || (it = source[Symbol.iterator]())); },
            pull(controller) { it ? (next(controller, it)) : controller.close(); },
            cancel() { (it && (it.return && it.return()) || true) && (it = null); }
        }, { highWaterMark: bm ? hwm : undefined, ...options });
        function next(controller, it) {
            let buf;
            let r = null;
            let size = controller.desiredSize || null;
            while (!(r = it.next(bm ? size : null)).done) {
                if (ArrayBuffer.isView(r.value) && (buf = toUint8Array(r.value))) {
                    size != null && bm && (size = size - buf.byteLength + 1);
                    r.value = buf;
                }
                controller.enqueue(r.value);
                if (size != null && --size <= 0) {
                    return;
                }
            }
            controller.close();
        }
    }
    /** @ignore */
    function asyncIterableAsReadableDOMStream(source, options) {
        let it = null;
        const bm = (options && options.type === 'bytes') || false;
        const hwm = options && options.highWaterMark || (2 ** 24);
        return new ReadableStream({
            ...options,
            async start(controller) { await next(controller, it || (it = source[Symbol.asyncIterator]())); },
            async pull(controller) { it ? (await next(controller, it)) : controller.close(); },
            async cancel() { (it && (it.return && await it.return()) || true) && (it = null); },
        }, { highWaterMark: bm ? hwm : undefined, ...options });
        async function next(controller, it) {
            let buf;
            let r = null;
            let size = controller.desiredSize || null;
            while (!(r = await it.next(bm ? size : null)).done) {
                if (ArrayBuffer.isView(r.value) && (buf = toUint8Array(r.value))) {
                    size != null && bm && (size = size - buf.byteLength + 1);
                    r.value = buf;
                }
                controller.enqueue(r.value);
                if (size != null && --size <= 0) {
                    return;
                }
            }
            controller.close();
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function builderThroughDOMStream(options) {
        return new BuilderTransform(options);
    }
    /** @ignore */
    class BuilderTransform {
        constructor(options) {
            // Access properties by string indexers to defeat closure compiler
            this._numChunks = 0;
            this._finished = false;
            this._bufferedSize = 0;
            const { ['readableStrategy']: readableStrategy, ['writableStrategy']: writableStrategy, ['queueingStrategy']: queueingStrategy = 'count', ...builderOptions } = options;
            this._controller = null;
            this._builder = Builder$2.new(builderOptions);
            this._getSize = queueingStrategy !== 'bytes' ? chunkLength : chunkByteLength;
            const { ['highWaterMark']: readableHighWaterMark = queueingStrategy === 'bytes' ? 2 ** 14 : 1000 } = { ...readableStrategy };
            const { ['highWaterMark']: writableHighWaterMark = queueingStrategy === 'bytes' ? 2 ** 14 : 1000 } = { ...writableStrategy };
            this['readable'] = new ReadableStream({
                ['cancel']: () => { this._builder.clear(); },
                ['pull']: (c) => { this._maybeFlush(this._builder, this._controller = c); },
                ['start']: (c) => { this._maybeFlush(this._builder, this._controller = c); },
            }, {
                'highWaterMark': readableHighWaterMark,
                'size': queueingStrategy !== 'bytes' ? chunkLength : chunkByteLength,
            });
            this['writable'] = new WritableStream({
                ['abort']: () => { this._builder.clear(); },
                ['write']: () => { this._maybeFlush(this._builder, this._controller); },
                ['close']: () => { this._maybeFlush(this._builder.finish(), this._controller); },
            }, {
                'highWaterMark': writableHighWaterMark,
                'size': (value) => this._writeValueAndReturnChunkSize(value),
            });
        }
        _writeValueAndReturnChunkSize(value) {
            const bufferedSize = this._bufferedSize;
            this._bufferedSize = this._getSize(this._builder.append(value));
            return this._bufferedSize - bufferedSize;
        }
        _maybeFlush(builder, controller) {
            if (controller === null) {
                return;
            }
            if (this._bufferedSize >= controller.desiredSize) {
                ++this._numChunks && this._enqueue(controller, builder.toVector());
            }
            if (builder.finished) {
                if (builder.length > 0 || this._numChunks === 0) {
                    ++this._numChunks && this._enqueue(controller, builder.toVector());
                }
                if (!this._finished && (this._finished = true)) {
                    this._enqueue(controller, null);
                }
            }
        }
        _enqueue(controller, chunk) {
            this._bufferedSize = 0;
            this._controller = null;
            chunk === null ? controller.close() : controller.enqueue(chunk);
        }
    }
    /** @ignore */ const chunkLength = (chunk) => chunk.length;
    /** @ignore */ const chunkByteLength = (chunk) => chunk.byteLength;

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function recordBatchReaderThroughDOMStream(writableStrategy, readableStrategy) {
        const queue = new AsyncByteQueue();
        let reader = null;
        const readable = new ReadableStream({
            async cancel() { await queue.close(); },
            async start(controller) { await next(controller, reader || (reader = await open())); },
            async pull(controller) { reader ? await next(controller, reader) : controller.close(); }
        });
        return { writable: new WritableStream(queue, { 'highWaterMark': 2 ** 14, ...writableStrategy }), readable };
        async function open() {
            return await (await RecordBatchReader.from(queue)).open(readableStrategy);
        }
        async function next(controller, reader) {
            let size = controller.desiredSize;
            let r = null;
            while (!(r = await reader.next()).done) {
                controller.enqueue(r.value);
                if (size != null && --size <= 0) {
                    return;
                }
            }
            controller.close();
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    function recordBatchWriterThroughDOMStream(writableStrategy, readableStrategy) {
        const writer = new this(writableStrategy);
        const reader = new AsyncByteStream(writer);
        const readable = new ReadableStream({
            type: 'bytes',
            async cancel() { await reader.cancel(); },
            async pull(controller) { await next(controller); },
            async start(controller) { await next(controller); },
        }, { 'highWaterMark': 2 ** 14, ...readableStrategy });
        return { writable: new WritableStream(writer, writableStrategy), readable };
        async function next(controller) {
            let buf = null;
            let size = controller.desiredSize;
            while (buf = await reader.read(size || null)) {
                controller.enqueue(buf);
                if (size != null && (size -= buf.byteLength) <= 0) {
                    return;
                }
            }
            controller.close();
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    class Value {
        eq(other) {
            if (!(other instanceof Value)) {
                other = new Literal(other);
            }
            return new Equals(this, other);
        }
        le(other) {
            if (!(other instanceof Value)) {
                other = new Literal(other);
            }
            return new LTeq(this, other);
        }
        ge(other) {
            if (!(other instanceof Value)) {
                other = new Literal(other);
            }
            return new GTeq(this, other);
        }
        lt(other) {
            return new Not(this.ge(other));
        }
        gt(other) {
            return new Not(this.le(other));
        }
        ne(other) {
            return new Not(this.eq(other));
        }
    }
    /** @ignore */
    class Literal extends Value {
        constructor(v) {
            super();
            this.v = v;
        }
    }
    /** @ignore */
    class Col extends Value {
        constructor(name) {
            super();
            this.name = name;
        }
        bind(batch) {
            if (!this.colidx) {
                // Assume column index doesn't change between calls to bind
                //this.colidx = cols.findIndex(v => v.name.indexOf(this.name) != -1);
                this.colidx = -1;
                const fields = batch.schema.fields;
                for (let idx = -1; ++idx < fields.length;) {
                    if (fields[idx].name === this.name) {
                        this.colidx = idx;
                        break;
                    }
                }
                if (this.colidx < 0) {
                    throw new Error(`Failed to bind Col "${this.name}"`);
                }
            }
            const vec = this.vector = batch.getChildAt(this.colidx);
            return (idx) => vec.get(idx);
        }
    }
    /** @ignore */
    class Predicate {
        and(...expr) { return new And(this, ...expr); }
        or(...expr) { return new Or(this, ...expr); }
        not() { return new Not(this); }
    }
    /** @ignore */
    class ComparisonPredicate extends Predicate {
        constructor(left, right) {
            super();
            this.left = left;
            this.right = right;
        }
        bind(batch) {
            if (this.left instanceof Literal) {
                if (this.right instanceof Literal) {
                    return this._bindLitLit(batch, this.left, this.right);
                }
                else { // right is a Col
                    return this._bindLitCol(batch, this.left, this.right);
                }
            }
            else { // left is a Col
                if (this.right instanceof Literal) {
                    return this._bindColLit(batch, this.left, this.right);
                }
                else { // right is a Col
                    return this._bindColCol(batch, this.left, this.right);
                }
            }
        }
    }
    /** @ignore */
    class CombinationPredicate extends Predicate {
        constructor(...children) {
            super();
            this.children = children;
        }
    }
    // add children to prototype so it doesn't get mangled in es2015/umd
    CombinationPredicate.prototype.children = Object.freeze([]); // freeze for safety
    /** @ignore */
    class And extends CombinationPredicate {
        constructor(...children) {
            // Flatten any Ands
            children = children.reduce((accum, p) => {
                return accum.concat(p instanceof And ? p.children : p);
            }, []);
            super(...children);
        }
        bind(batch) {
            const bound = this.children.map((p) => p.bind(batch));
            return (idx, batch) => bound.every((p) => p(idx, batch));
        }
    }
    /** @ignore */
    class Or extends CombinationPredicate {
        constructor(...children) {
            // Flatten any Ors
            children = children.reduce((accum, p) => {
                return accum.concat(p instanceof Or ? p.children : p);
            }, []);
            super(...children);
        }
        bind(batch) {
            const bound = this.children.map((p) => p.bind(batch));
            return (idx, batch) => bound.some((p) => p(idx, batch));
        }
    }
    /** @ignore */
    class Equals extends ComparisonPredicate {
        _bindLitLit(_batch, left, right) {
            const rtrn = left.v == right.v;
            return () => rtrn;
        }
        _bindColCol(batch, left, right) {
            const left_func = left.bind(batch);
            const right_func = right.bind(batch);
            return (idx, batch) => left_func(idx, batch) == right_func(idx, batch);
        }
        _bindColLit(batch, col, lit) {
            const col_func = col.bind(batch);
            if (col.vector instanceof DictionaryVector) {
                let key;
                const vector = col.vector;
                if (vector.dictionary !== this.lastDictionary) {
                    key = vector.reverseLookup(lit.v);
                    this.lastDictionary = vector.dictionary;
                    this.lastKey = key;
                }
                else {
                    key = this.lastKey;
                }
                if (key === -1) {
                    // the value doesn't exist in the dictionary - always return
                    // false
                    // TODO: special-case of PredicateFunc that encapsulates this
                    // "always false" behavior. That way filtering operations don't
                    // have to bother checking
                    return () => false;
                }
                else {
                    return (idx) => {
                        return vector.getKey(idx) === key;
                    };
                }
            }
            else {
                return (idx, cols) => col_func(idx, cols) == lit.v;
            }
        }
        _bindLitCol(batch, lit, col) {
            // Equals is commutative
            return this._bindColLit(batch, col, lit);
        }
    }
    /** @ignore */
    class LTeq extends ComparisonPredicate {
        _bindLitLit(_batch, left, right) {
            const rtrn = left.v <= right.v;
            return () => rtrn;
        }
        _bindColCol(batch, left, right) {
            const left_func = left.bind(batch);
            const right_func = right.bind(batch);
            return (idx, cols) => left_func(idx, cols) <= right_func(idx, cols);
        }
        _bindColLit(batch, col, lit) {
            const col_func = col.bind(batch);
            return (idx, cols) => col_func(idx, cols) <= lit.v;
        }
        _bindLitCol(batch, lit, col) {
            const col_func = col.bind(batch);
            return (idx, cols) => lit.v <= col_func(idx, cols);
        }
    }
    /** @ignore */
    class GTeq extends ComparisonPredicate {
        _bindLitLit(_batch, left, right) {
            const rtrn = left.v >= right.v;
            return () => rtrn;
        }
        _bindColCol(batch, left, right) {
            const left_func = left.bind(batch);
            const right_func = right.bind(batch);
            return (idx, cols) => left_func(idx, cols) >= right_func(idx, cols);
        }
        _bindColLit(batch, col, lit) {
            const col_func = col.bind(batch);
            return (idx, cols) => col_func(idx, cols) >= lit.v;
        }
        _bindLitCol(batch, lit, col) {
            const col_func = col.bind(batch);
            return (idx, cols) => lit.v >= col_func(idx, cols);
        }
    }
    /** @ignore */
    class Not extends Predicate {
        constructor(child) {
            super();
            this.child = child;
        }
        bind(batch) {
            const func = this.child.bind(batch);
            return (idx, batch) => !func(idx, batch);
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    Table.prototype.countBy = function (name) { return new DataFrame(this.chunks).countBy(name); };
    Table.prototype.scan = function (next, bind) { return new DataFrame(this.chunks).scan(next, bind); };
    Table.prototype.scanReverse = function (next, bind) { return new DataFrame(this.chunks).scanReverse(next, bind); };
    Table.prototype.filter = function (predicate) { return new DataFrame(this.chunks).filter(predicate); };
    class DataFrame extends Table {
        filter(predicate) {
            return new FilteredDataFrame(this.chunks, predicate);
        }
        scan(next, bind) {
            const batches = this.chunks, numBatches = batches.length;
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                if (bind) {
                    bind(batch);
                }
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    next(index, batch);
                }
            }
        }
        scanReverse(next, bind) {
            const batches = this.chunks, numBatches = batches.length;
            for (let batchIndex = numBatches; --batchIndex >= 0;) {
                // load batches
                const batch = batches[batchIndex];
                if (bind) {
                    bind(batch);
                }
                // yield all indices
                for (let index = batch.length; --index >= 0;) {
                    next(index, batch);
                }
            }
        }
        countBy(name) {
            const batches = this.chunks, numBatches = batches.length;
            const count_by = typeof name === 'string' ? new Col(name) : name;
            // Assume that all dictionary batches are deltas, which means that the
            // last record batch has the most complete dictionary
            count_by.bind(batches[numBatches - 1]);
            const vector = count_by.vector;
            if (!DataType.isDictionary(vector.type)) {
                throw new Error('countBy currently only supports dictionary-encoded columns');
            }
            const countByteLength = Math.ceil(Math.log(vector.length) / Math.log(256));
            const CountsArrayType = countByteLength == 4 ? Uint32Array :
                countByteLength >= 2 ? Uint16Array : Uint8Array;
            const counts = new CountsArrayType(vector.dictionary.length);
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                // rebind the countBy Col
                count_by.bind(batch);
                const keys = count_by.vector.indices;
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    let key = keys.get(index);
                    if (key !== null) {
                        counts[key]++;
                    }
                }
            }
            return new CountByResult(vector.dictionary, IntVector.from(counts));
        }
    }
    /** @ignore */
    class CountByResult extends Table {
        constructor(values, counts) {
            const schema = new Schema([
                new Field('values', values.type),
                new Field('counts', counts.type)
            ]);
            super(new RecordBatch(schema, counts.length, [values, counts]));
        }
        toJSON() {
            const values = this.getColumnAt(0);
            const counts = this.getColumnAt(1);
            const result = {};
            for (let i = -1; ++i < this.length;) {
                result[values.get(i)] = counts.get(i);
            }
            return result;
        }
    }
    /** @ignore */
    class FilteredDataFrame extends DataFrame {
        constructor(batches, predicate) {
            super(batches);
            this._predicate = predicate;
        }
        scan(next, bind) {
            // inlined version of this:
            // this.parent.scan((idx, columns) => {
            //     if (this.predicate(idx, columns)) next(idx, columns);
            // });
            const batches = this._chunks;
            const numBatches = batches.length;
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                const predicate = this._predicate.bind(batch);
                let isBound = false;
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    if (predicate(index, batch)) {
                        // bind batches lazily - if predicate doesn't match anything
                        // in the batch we don't need to call bind on the batch
                        if (bind && !isBound) {
                            bind(batch);
                            isBound = true;
                        }
                        next(index, batch);
                    }
                }
            }
        }
        scanReverse(next, bind) {
            const batches = this._chunks;
            const numBatches = batches.length;
            for (let batchIndex = numBatches; --batchIndex >= 0;) {
                // load batches
                const batch = batches[batchIndex];
                const predicate = this._predicate.bind(batch);
                let isBound = false;
                // yield all indices
                for (let index = batch.length; --index >= 0;) {
                    if (predicate(index, batch)) {
                        // bind batches lazily - if predicate doesn't match anything
                        // in the batch we don't need to call bind on the batch
                        if (bind && !isBound) {
                            bind(batch);
                            isBound = true;
                        }
                        next(index, batch);
                    }
                }
            }
        }
        count() {
            // inlined version of this:
            // let sum = 0;
            // this.parent.scan((idx, columns) => {
            //     if (this.predicate(idx, columns)) ++sum;
            // });
            // return sum;
            let sum = 0;
            const batches = this._chunks;
            const numBatches = batches.length;
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                const predicate = this._predicate.bind(batch);
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    if (predicate(index, batch)) {
                        ++sum;
                    }
                }
            }
            return sum;
        }
        *[Symbol.iterator]() {
            // inlined version of this:
            // this.parent.scan((idx, columns) => {
            //     if (this.predicate(idx, columns)) next(idx, columns);
            // });
            const batches = this._chunks;
            const numBatches = batches.length;
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                // TODO: bind batches lazily
                // If predicate doesn't match anything in the batch we don't need
                // to bind the callback
                const predicate = this._predicate.bind(batch);
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    if (predicate(index, batch)) {
                        yield batch.get(index);
                    }
                }
            }
        }
        filter(predicate) {
            return new FilteredDataFrame(this._chunks, this._predicate.and(predicate));
        }
        countBy(name) {
            const batches = this._chunks, numBatches = batches.length;
            const count_by = typeof name === 'string' ? new Col(name) : name;
            // Assume that all dictionary batches are deltas, which means that the
            // last record batch has the most complete dictionary
            count_by.bind(batches[numBatches - 1]);
            const vector = count_by.vector;
            if (!DataType.isDictionary(vector.type)) {
                throw new Error('countBy currently only supports dictionary-encoded columns');
            }
            const countByteLength = Math.ceil(Math.log(vector.length) / Math.log(256));
            const CountsArrayType = countByteLength == 4 ? Uint32Array :
                countByteLength >= 2 ? Uint16Array : Uint8Array;
            const counts = new CountsArrayType(vector.dictionary.length);
            for (let batchIndex = -1; ++batchIndex < numBatches;) {
                // load batches
                const batch = batches[batchIndex];
                const predicate = this._predicate.bind(batch);
                // rebind the countBy Col
                count_by.bind(batch);
                const keys = count_by.vector.indices;
                // yield all indices
                for (let index = -1, numRows = batch.length; ++index < numRows;) {
                    let key = keys.get(index);
                    if (key !== null && predicate(index, batch)) {
                        counts[key]++;
                    }
                }
            }
            return new CountByResult(vector.dictionary, IntVector.from(counts));
        }
    }

    // Licensed to the Apache Software Foundation (ASF) under one
    /** @ignore */
    ({
        ...util_bn_,
        ...util_int_,
        ...util_bit_,
        ...util_math_,
        ...util_buffer_,
        ...util_vector_
    });

    // Licensed to the Apache Software Foundation (ASF) under one
    streamAdapters.toDOMStream = toDOMStream;
    Builder$2['throughDOM'] = builderThroughDOMStream;
    RecordBatchReader['throughDOM'] = recordBatchReaderThroughDOMStream;
    RecordBatchWriter['throughDOM'] = recordBatchWriterThroughDOMStream;

    // Hardwire Arrow type ids to sidestep dependency
    // https://github.com/apache/arrow/blob/master/js/src/enum.ts

    var Type = {
      /** The default placeholder type */
      NONE: 0,
      /** A NULL type having no physical storage */
      Null: 1,
      /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */
      Int: 2,
      /** 2, 4, or 8-byte floating point value */
      Float: 3,
      /** Variable-length bytes (no guarantee of UTF8-ness) */
      Binary: 4,
      /** UTF8 variable-length string as List<Char> */
      Utf8: 5,
      /** Boolean as 1 bit, LSB bit-packed ordering */
      Bool: 6,
      /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */
      Decimal: 7,
      /** int32_t days or int64_t milliseconds since the UNIX epoch */
      Date: 8,
      /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */
      Time: 9,
      /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */
      Timestamp: 10,
      /** YEAR_MONTH or DAY_TIME interval in SQL style */
      Interval: 11,
      /** A list of some logical data type */
      List: 12,
      /** Struct of logical types */
      Struct: 13,
      /** Union of logical types */
      Union: 14,
      /** Fixed-size binary. Each value occupies the same number of bytes */
      FixedSizeBinary: 15,
      /** Fixed-size list. Each value occupies the same number of bytes */
      FixedSizeList: 16,
      /** Map of named logical types */
      Map: 17,

      /** Dictionary aka Category type */
      Dictionary: -1,
      Int8: -2,
      Int16: -3,
      Int32: -4,
      Int64: -5,
      Uint8: -6,
      Uint16: -7,
      Uint32: -8,
      Uint64: -9,
      Float16: -10,
      Float32: -11,
      Float64: -12,
      DateDay: -13,
      DateMillisecond: -14,
      TimestampSecond: -15,
      TimestampMillisecond: -16,
      TimestampMicrosecond: -17,
      TimestampNanosecond: -18,
      TimeSecond: -19,
      TimeMillisecond: -20,
      TimeMicrosecond: -21,
      TimeNanosecond: -22,
      DenseUnion: -23,
      SparseUnion: -24,
      IntervalDayTime: -25,
      IntervalYearMonth: -26
    };

    function ceil64Bytes(length, bpe = 1) {
      return ((((length * bpe) + 63) & ~63) || 64) / bpe;
    }

    function array(Type, length, bpe = Type.BYTES_PER_ELEMENT) {
      return new Type(ceil64Bytes(length, bpe));
    }

    function arrowData(d) {
      return d instanceof Data
        ? d
        : Data.new(d.type, 0, d.length, d.nulls, d.buffers, null, d.dict);
    }

    function arrowVector$1(data) {
      return AbstractVector.new(arrowData(data));
    }

    const encoder = new TextEncoder();

    function encode(data, idx, str) {
      const bytes = encoder.encode(str);
      data.set(bytes, idx);
      return bytes.length;
    }

    function encodeInto(data, idx, str) {
      return encoder.encodeInto(str, data.subarray(idx)).written;
    }

    const writeUtf8 = encoder.encodeInto ? encodeInto : encode;

    function arrayBuilder(type, length) {
      const data = array(type.ArrayType, length);
      return {
        set(value, index) { data[index] = value; },
        data: () => ({ type, length, buffers: [null, data] })
      };
    }

    function boolBuilder(type, length) {
      const data = array(type.ArrayType, length / 8);
      return {
        set(value, index) {
          if (value) data[index >> 3] |= (1 << (index % 8));
        },
        data: () => ({ type, length, buffers: [null, data] })
      };
    }

    function dateDayBuilder(type, length) {
      const data = array(type.ArrayType, length);
      return {
        set(value, index) { data[index] = (value / 86400000) | 0; },
        data: () => ({ type, length, buffers: [null, data] })
      };
    }

    function dateMillisBuilder(type, length) {
      const data = array(type.ArrayType, length << 1);
      return {
        set(value, index) {
          const i = index << 1;
          data[  i] = (value % 4294967296) | 0;
          data[i+1] = (value / 4294967296) | 0;
        },
        data: () => ({ type, length, buffers: [null, data] })
      };
    }

    function defaultBuilder(type) {
      const b = Builder$2.new({
        type,
        nullValues: [null, undefined],
        highWaterMark: Infinity
      });
      return {
        set(value, index) { b.set(index, value); },
        data: () => b.finish().flush()
      };
    }

    function utf8Builder(type, length, strlen) {
      const offset = array(Int32Array, length + 1);
      const buf = array(Uint8Array, 3 * strlen);

      let idx = 0;

      return {
        set(value, index) {
          idx += writeUtf8(buf, idx, value);
          offset[index + 1] = idx;
        },
        data: () => {
          // slice utf buffer if over-allocated
          const dlen = ceil64Bytes(idx);
          const data = buf.length > dlen ? buf.subarray(0, dlen) : buf;
          return { type, length, buffers: [offset, data] };
        }
      };
    }

    function dictionaryBuilder(type, length) {
      const values = [];
      const data = array(type.indices.ArrayType, length);
      const keys = Object.create(null);

      let next = -1;
      let strlen = 0;

      return {
        set(value, index) {
          const v = String(value);
          let k = keys[v];
          if (k === undefined) {
            strlen += v.length;
            keys[v] = k = ++next;
            values.push(v);
          }
          data[index] = k;
        },
        data: () => ({
          type,
          length,
          buffers: [null, data],
          dict: dictionary(type.dictionary, values, strlen)
        })
      };
    }

    function dictionary(type, values, strlen) {
      const b = utf8Builder(type, values.length, strlen);
      values.forEach(b.set);
      return arrowVector$1(b.data());
    }

    function validBuilder(builder, length) {
      const valid = array(Uint8Array, length / 8);
      let nulls = 0;

      return {
        set(value, index) {
          if (value == null) {
            ++nulls;
          } else {
            builder.set(value, index);
            valid[index >> 3] |= (1 << (index % 8));
          }
        },
        data: () => {
          const d = builder.data();
          if (nulls) {
            d.nulls = nulls;
            d.buffers[2] = valid;
          }
          return d;
        }
      };
    }

    function builder(type, nrows, nullable = true) {
      let method;

      switch (type.typeId) {
        case Type.Int:
          method = type.bitWidth < 64 ? arrayBuilder : null;
          break;
        case Type.Float:
          method = type.precision > 0 ? arrayBuilder : null;
          break;
        case Type.Dictionary:
          // check sub-types against builder assumptions
          // if check fails, fallback to default builder
          method = (
            type.dictionary.typeId === Type.Utf8 &&
            type.indices.typeId === Type.Int &&
            type.indices.bitWidth < 64
          ) ? dictionaryBuilder : null;
          break;
        case Type.Bool:
          method = boolBuilder;
          break;
        case Type.Date:
          method = type.unit ? dateMillisBuilder : dateDayBuilder;
          break;
      }

      return method == null ? defaultBuilder(type)
        : nullable ? validBuilder(method(type, nrows), nrows)
        : method(type, nrows);
    }

    function dataFromArray(array, type) {
      const length = array.length;
      const size = ceil64Bytes(length, array.BYTES_PER_ELEMENT);

      let data = array;
      if (length !== size) {
        data = new array.constructor(size);
        data.set(array);
      }

      return arrowData({ type, length, buffers: [null, data] });
    }

    function dataFromScan(nrows, scan, column, type, nullable = true) {
      const b = builder(type, nrows, nullable);
      scan(column, b.set);
      return arrowData(b.data());
    }

    function resolveType(type) {
      if (type instanceof DataType || type == null) {
        return type;
      }

      switch (type) {
        case Type.Binary:
          return new Binary$1();
        case Type.Bool:
          return new Bool$1();
        case Type.DateDay:
          return new DateDay();
        case Type.DateMillisecond:
        case Type.Date:
          return new DateMillisecond();
        case Type.Dictionary:
          return new Dictionary(new Utf8$1(), new Int32());
        case Type.Float16:
          return new Float16();
        case Type.Float32:
          return new Float32();
        case Type.Float64:
        case Type.Float:
          return new Float64();
        case Type.Int8:
          return new Int8();
        case Type.Int16:
          return new Int16();
        case Type.Int32:
        case Type.Int:
          return new Int32();
        case Type.Int64:
          return new Int64$1();
        case Type.IntervalDayTime:
          return new IntervalDayTime();
        case Type.Interval:
        case Type.IntervalYearMonth:
          return new IntervalYearMonth();
        case Type.Null:
          return new Null$1();
        case Type.TimeMicrosecond:
          return new TimeMicrosecond();
        case Type.TimeMillisecond:
        case Type.Time:
          return new TimeMillisecond();
        case Type.TimeNanosecond:
          return new TimeNanosecond();
        case Type.TimeSecond:
          return new TimeSecond();
        case Type.Uint8:
          return new Uint8();
        case Type.Uint16:
          return new Uint16();
        case Type.Uint32:
          return new Uint32();
        case Type.Uint64:
          return new Uint64$1();
        case Type.Utf8:
          return new Utf8$1();
        default:
          error(
            `Unsupported type code: ${toString$1(type)}. ` +
            'Use a data type constructor instead?'
          );
      }
    }

    function isExactUTCDate(d) {
      return d.getUTCHours() === 0
        && d.getUTCMinutes() === 0
        && d.getUTCSeconds() === 0
        && d.getUTCMilliseconds() === 0;
    }

    function profile(scan, column) {
      const p = profiler();
      scan(column, p.add);
      return p;
    }

    function profiler() {
      const p = {
        count: 0,
        nulls: 0,
        bools: 0,
        nums: 0,
        ints: 0,
        bigints: 0,
        min: Infinity,
        max: -Infinity,
        digits: 0,
        dates: 0,
        utcdays: 0,
        strings: 0,
        strlen: 0,
        arrays: 0,
        minlen: Infinity,
        maxlen: 0,
        structs: 0,

        add(value) {
          ++p.count;
          if (value == null) {
            ++p.nulls;
            return;
          }

          const type = typeof value;
          if (type === 'string') {
            ++p.strings;
          } else if (type === 'number') {
            ++p.nums;
            if (value < p.min) p.min = value;
            if (value > p.max) p.max = value;
            if (Number.isInteger(value)) ++p.ints;
          } else if (type === 'boolean') {
            ++p.bools;
          } else if (type === 'object') {
            if (isDate(value)) {
              ++p.dates;
              if (isExactUTCDate(value)) {
                ++p.utcdays;
              }
            } else if (isArrayType(value)) {
              ++p.arrays;
              if (value.length < p.minlen) p.minlen = value.length;
              if (value.length > p.maxlen) p.maxlen = value.length;
              const ap = p.array_prof || (p.array_prof = profiler());
              value.forEach(ap.add);
            } else {
              ++p.structs;
              const sp = p.struct_prof || (p.struct_prof = {});
              for (const key in value) {
                const fp = sp[key] || (sp[key] = profiler());
                fp.add(value[key]);
              }
            }
          } else if (type === 'bigint') {
            ++p.bigints;
            if (value < p.min) p.min = value;
            if (value > p.max) p.max = value;
          }
        },
        type() {
          return resolveType(infer(p));
        }
      };

      return p;
    }

    function infer(p) {
      const valid = p.count - p.nulls;

      if (valid === 0) {
        return Type.Null;
      }
      else if (p.ints === valid) {
        const v = Math.max(Math.abs(p.min) - 1, p.max);
        return p.min < 0
          ? v >= 2 ** 31 ? Type.Float64
            : v < (1 << 7) ? Type.Int8 : v < (1 << 15) ? Type.Int16 : Type.Int32
          : v >= 2 ** 32 ? Type.Float64
            : v < (1 << 8) ? Type.Uint8 : v < (1 << 16) ? Type.Uint16 : Type.Uint32;
      }
      else if (p.nums === valid) {
        return Type.Float64;
      }
      else if (p.bigints === valid) {
        const v = -p.min > p.max ? -p.min - 1n : p.max;
        return p.min < 0
          ? v < 2 ** 63 ? Type.Int64
            : error(`BigInt exceeds 64 bits: ${v}`)
          : p.max < 2 ** 64 ? Type.Uint64
            : error(`BigInt exceeds 64 bits: ${p.max}`);
      }
      else if (p.bools === valid) {
        return Type.Bool;
      }
      else if (p.utcdays === valid) {
        return Type.DateDay;
      }
      else if (p.dates === valid) {
        return Type.DateMillisecond;
      }
      else if (p.arrays === valid) {
        const type = Field.new('value', p.array_prof.type(), true);
        return p.minlen === p.maxlen
          ? new FixedSizeList$1(p.minlen, type)
          : new List$1(type);
      }
      else if (p.structs === valid) {
        const sp = p.struct_prof;
        return new Struct$1(
          Object.keys(sp).map(name => Field.new(name, sp[name].type(), true))
        );
      }
      else if (p.strings > 0) {
        return Type.Dictionary;
      }
      else {
        error('Type inference failure');
      }
    }

    function dataFromObjects(data, name, nrows, scan, type, nullable = true) {
      type = resolveType(type);

      // perform type inference if needed
      if (!type) {
        const p = profile(scan, name);
        nullable = p.nulls > 0;
        type = p.type();
      }

      return dataFromScan(nrows, scan, name, type, nullable);
    }

    function dataFromTable(table, name, nrows, scan, type, nullable = true) {
      type = resolveType(type);
      const column = table.column(name);
      const reified = !(table.isFiltered() || table.isOrdered());

      // use existing arrow data if types match
      const vec = arrowVector(column);
      if (vec && reified && typeCompatible(vec.type, type)) {
        return vec;
      }

      // if backing data is a typed array, leverage that
      const data = column.data;
      if (isTypedArray(data)) {
        const dtype = typeFromArray(data);
        if (reified && dtype && typeCompatible(dtype, type)) {
          return dataFromArray(data, dtype);
        } else {
          type = type || dtype;
          nullable = false;
        }
      }

      // perform type inference if needed
      if (!type) {
        const p = profile(scan, column);
        nullable = p.nulls > 0;
        type = p.type();
      }

      return dataFromScan(nrows, scan, column, type, nullable);
    }

    function arrowVector(value) {
      return value instanceof AbstractVector ? value
        : value.vector instanceof AbstractVector ? value.vector
        : null;
    }

    function typeFromArray(data) {
      const types = {
        Float32Array:    Float32,
        Float64Array:    Float64,
        Int8Array:       Int8,
        Int16Array:      Int16,
        Int32Array:      Int32,
        Uint8Array:      Uint8,
        Uint16Array:     Uint16,
        Uint32Array:     Uint32,
        BigInt64Array:   Int64$1,
        BigUint64Array:  Uint64$1
      };
      const Type = types[data.constructor.name];
      return Type ? new Type() : null;
    }

    function typeCompatible(a, b) {
      return !a || !b ? true : a.compareTo(b);
    }

    function scanArray(data, limit, offset) {
      const n = Math.min(data.length, offset + limit);
      return (name, visit) => {
        for (let i = offset; i < n; ++i) {
          visit(data[i][name], i);
        }
      };
    }

    function scanTable(table, limit, offset) {
      const scanAll = offset === 0 && table.numRows() <= limit
                   && !table.isFiltered() && !table.isOrdered();

      return (column, visit) => {
        let i = -1;
        scanAll && isArrayType(column.data)
          ? column.data.forEach(visit)
          : table.scan(
              row => visit(column.get(row), ++i),
              true, limit, offset
            );
      };
    }

    function table$1() {
      // trap Table access to provide a helpful message
      // when Apache Arrow has not been imported
      try {
        return Table;
      } catch (err) {
        error(
          'Apache Arrow not imported, ' +
          'see https://github.com/uwdata/arquero#usage'
        );
      }
    }

    function from$1(arrow) {
      return arrow && arrow.chunks ? arrow : table$1().from(arrow);
    }

    /**
     * Options for Arrow encoding.
     * @typedef {object} ArrowFormatOptions
     * @property {number} [limit=Infinity] The maximum number of rows to include.
     * @property {number} [offset=0] The row offset indicating how many initial
     *  rows to skip.
     * @property {string[]|(data: object) => string[]} [columns] Ordered list of
     *  column names to include. If function-valued, the function should accept
     *  a dataset as input and return an array of column name strings.
     * @property {object} [types] The Arrow data types to use. If specified,
     *  the input should be an object with column names for keys and Arrow data
     *  types for values. If a column type is not explicitly provided, type
     *  inference will be performed to guess an appropriate type.
     */

    /**
     * Create an Apache Arrow table for an input dataset.
     * @param {Array|object} data An input dataset to convert to Arrow format.
     *  If array-valued, the data should consist of an array of objects where
     *  each entry represents a row and named properties represent columns.
     *  Otherwise, the input data should be an Arquero table.
     * @param {ArrowFormatOptions} [options] Encoding options, including
     *  column data types.
     * @return {Table} An Apache Arrow Table instance.
     */
    function toArrow(data, options = {}) {
      const { types = {} } = options;
      const { dataFrom, names, nrows, scan } = init(data, options);
      return table$1().new(
        names.map(name => {
          const col = dataFrom(data, name, nrows, scan, types[name]);
          return col.length === nrows
            ? col
            : error('Column length mismatch');
        }),
        names
      );
    }

    function init(data, options) {
      const { columns, limit = Infinity, offset = 0 } = options;
      const names = isFunction$1(columns) ? columns(data)
        : isArray$2(columns) ? columns
        : null;
      if (isArray$2(data)) {
        return {
          dataFrom: dataFromObjects,
          names: names || Object.keys(data[0]),
          nrows: Math.min(limit, data.length - offset),
          scan: scanArray(data, limit, offset)
        };
      } else if (isTable(data)) {
        return {
          dataFrom: dataFromTable,
          names: names || data.columnNames(),
          nrows: Math.min(limit, data.numRows() - offset),
          scan: scanTable(data, limit, offset)
        };
      } else {
        error('Unsupported input data type');
      }
    }

    function isTable(data) {
      return data && isFunction$1(data.reify);
    }

    function isExactDateUTC(d) {
      return d.getUTCHours() === 0
        && d.getUTCMinutes() === 0
        && d.getUTCSeconds() === 0
        && d.getUTCMilliseconds() === 0;
    }

    function inferFormat(scan, options = {}) {
      let count = 0;
      let nulls = 0;
      let dates = 0;
      let dutcs = 0;
      let nums = 0;
      let digits = 0;

      scan(value => {
        ++count;
        if (value == null) {
          ++nulls;
          return;
        }

        const type = typeof value;
        if (type === 'object' && isDate(value)) {
          ++dates;
          if (isExactDateUTC(value)) ++dutcs;
        } else if (type === 'number') {
          ++nums;
          if (value === value &&  (value | 0) !== value) {
            const s = value + '';
            const p = s.indexOf('.');
            if (p >= 0) {
              const e = s.indexOf('e');
              const l = e > 0 ? e : s.length;
              digits = Math.max(digits, l - p - 1);
            }
          }
        }
      });

      return {
        align:  (nulls + nums + dates) / count > 0.5 ? 'r' : 'l',
        format: {
          utc:    dates === dutcs,
          digits: Math.min(digits, options.maxdigits || 6)
        }
      };
    }

    /**
     * Column selection function.
     * @typedef {(table: Table) => string[]} ColumnSelectFunction
     */

    /**
     * Column selection options.
     * @typedef {string[]|ColumnSelectFunction} ColumnSelectOptions
     */

    /**
     * Column format options. The object keys should be column names.
     * The object values should be formatting functions or objects.
     * If specified, these override any automatically inferred options.
     * @typedef {Object.<string, import('./value').ValueFormatOptions} ColumnFormatOptions
     */

    /**
     * Column alignment options. The object keys should be column names.
     * The object values should be aligment strings, one of 'l' (left),
     * 'c' (center), or 'r' (right).
     * If specified, these override any automatically inferred options.
     * @typedef {Object.<string, 'l'|'c'|'r'>} ColumnAlignOptions
     */

    function columns(table, names) {
      return isFunction$1(names)
        ? names(table)
        : names || table.columnNames();
    }

    function formats(table, names, options) {
      const formatOpt = options.format || {};
      const alignOpt = options.align || {};
      const format = {};
      const align = {};

      names.forEach(name => {
        const auto = inferFormat(values(table, name), options);
        align[name] = alignOpt[name] || auto.align;
        format[name] = formatOpt[name] || auto.format;
      });

      return { align, format };
    }

    function values(table, columnName) {
      const column = table.column(columnName);
      return fn => table.scan(row => fn(column.get(row)));
    }

    function scan(table, names, limit = 100, offset, ctx) {
      const data = table.data();
      const n = names.length;
      table.scan(row => {
        ctx.row(row);
        for (let i = 0; i < n; ++i) {
          const name = names[i];
          ctx.cell(data[names[i]].get(row), name, i);
        }
      }, true, limit, offset);
    }

    /**
     * Options for CSV formatting.
     * @typedef {object} CSVFormatOptions
     * @property {string} [delimiter=','] The delimiter between values.
     * @property {number} [limit=Infinity] The maximum number of rows to print.
     * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
     * @property {import('./util').ColumnSelectOptions} [columns] Ordered list
     *  of column names to include. If function-valued, the function should
     *  accept a table as input and return an array of column name strings.
     * @property {Object.<string, (value: any) => any>} [format] Object of column
     *  format options. The object keys should be column names. The object values
     *  should be formatting functions to invoke to transform column values prior
     *  to output. If specified, these override automatically inferred options.
     */

    /**
     * Format a table as a comma-separated values (CSV) string. Other
     * delimiters, such as tabs or pipes ('|'), can be specified using
     * the options argument.
     * @param {ColumnTable} table The table to format.
     * @param {CSVFormatOptions} options The formatting options.
     * @return {string} A delimited-value format string.
     */
    function toCSV(table, options = {}) {
      const names = columns(table, options.columns);
      const format = options.format || {};
      const delim = options.delimiter || ',';
      const reFormat = new RegExp(`["${delim}\n\r]`);

      const formatValue = value => value == null ? ''
        : isDate(value) ? formatUTCDate(value, true)
        : reFormat.test(value += '') ? '"' + value.replace(/"/g, '""') + '"'
        : value;

      const vals = names.map(formatValue);
      let text = '';

      scan(table, names, options.limit || Infinity, options.offset, {
        row() {
          text += vals.join(delim) + '\n';
        },
        cell(value, name, index) {
          vals[index] = formatValue(format[name] ? format[name](value) : value);
        }
      });

      return text + vals.join(delim);
    }

    /**
     * Column format object.
     * @typedef {object} ValueFormatObject
     * @property {boolean} [utc=false] If true, format dates in UTC time.
     * @property {number} [digits=0] The number of fractional digits to include
     *  when formatting numbers.
     * @property {number} [maxlen=30] The maximum string length for formatting
     *  nested object or array values.
     */

    /**
     * @callback ValueFormatFunction
     * @param {*} value The value to format.
     * @return {*} A string-coercible or JSON-compatible formatted value.
     */

    /**
     * Value format options.
     * @typedef {ValueFormatObject|ValueFormatFunction} ValueFormatOptions
     */

    /**
     * Format a value as a string.
     * @param {*} v The value to format.
     * @param {ValueFormatOptions} options Formatting options.
     * @return {string} The formatted string.
     */
    function formatValue(v, options = {}) {
      if (isFunction$1(options)) {
        return options(v) + '';
      }

      const type = typeof v;

      if (type === 'object') {
        if (isDate(v)) {
          return options.utc ? formatUTCDate(v) : formatDate(v);
        } else {
          const s = JSON.stringify(
            v,
            (k, v) => isTypedArray(v) ? Array.from(v) : v
          );
          const maxlen = options.maxlen || 30;
          return s.length > maxlen
            ? s.slice(0, 28) + '\u2026' + (s[0] === '[' ? ']' : '}')
            : s;
        }
      } else if (type === 'number') {
        const digits = options.digits || 0;
        let a;
        return v !== 0 && ((a = Math.abs(v)) >= 1e18 || a < Math.pow(10, -digits))
          ? v.toExponential(digits)
          : v.toFixed(digits);
      } else {
        return v + '';
      }
    }

    function map(obj, fn, output = {}) {
      for (const key in obj) {
        output[key] = fn(obj[key], key);
      }
      return output;
    }

    /**
     * Null format function.
     * @callback NullFormat
     * @param {null|undefined} [value] The value to format.
     * @return {string} The formatted HTML string.
     */

    /**
     * CSS style function.
     * @callback StyleFunction
     * @param {string} name The column name.
     * @param {number} row The table row index.
     * @return {string} A CSS style string.
     */

    /**
     * CSS style options.
     * @typedef {Object.<string, string | StyleFunction>} StyleOptions
     */

    /**
     * Options for HTML formatting.
     * @typedef {object} HTMLFormatOptions
     * @property {number} [limit=Infinity] The maximum number of rows to print.
     * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
     * @property {import('./util').ColumnSelectOptions} [columns] Ordered list
     *  of column names to include. If function-valued, the function should
     *  accept a table as input and return an array of column name strings.
     * @property {import('./util').ColumnAlignOptions} [align] Object of column
     *  alignment options. The object keys should be column names. The object
     *  values should be aligment strings, one of 'l' (left), 'c' (center), or
     *  'r' (right). If specified, these override automatically inferred options.
     * @property {import('./util').ColumnFormatOptions} [format] Object of column
     *  format options. The object keys should be column names. The object values
     *  should be formatting functions or specification objects. If specified,
     *  these override automatically inferred options.
     * @property {NullFormat} [null] Format function for null or undefined values.
     *  If specified, this function will be invoked with the null or undefined
     *  value as the sole input, and the return value will be used as the HTML
     *  output for the value.
     * @property {StyleOptions} [style] CSS styles to include in HTML output.
     *  The object keys should be HTML table tag names: 'table', 'thead',
     *  'tbody', 'tr', 'th', or 'td'. The object values should be strings of
     *  valid CSS style directives (such as "font-weight: bold;") or functions
     *  that take a column name and row as inputs and return a CSS string.
     * @property {number} [maxdigits=6] The maximum number of fractional digits
     *  to include when formatting numbers. This option is passed to the format
     *  inference method and is overridden by any explicit format options.
     */

    /**
     * Format a table as an HTML table string.
     * @param {ColumnTable} table The table to format.
     * @param {HTMLFormatOptions} options The formatting options.
     * @return {string} An HTML table string.
     */
    function toHTML(table, options = {}) {
      const names = columns(table, options.columns);
      const { align, format } = formats(table, names, options);
      const style = styles(options);
      const nullish = options.null;

      const alignValue = a => a === 'c' ? 'center' : a === 'r' ? 'right' : 'left';
      const escape = s => s.replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;');
      const baseFormat = (value, opt) => escape(formatValue(value, opt));
      const formatter = nullish
        ? (value, opt) => value == null ? nullish(value) : baseFormat(value, opt)
        : baseFormat;

      let r = -1;
      let idx = -1;

      const tag = (tag, name, shouldAlign) => {
        const a = shouldAlign ? alignValue(align[name]) : '';
        const s = style[tag] ? (style[tag](name, idx, r) || '') : '';
        const css = (a ? (`text-align: ${a};` + (s ? ' ' : '')) : '') + s;
        return `<${tag}${css ? ` style="${css}"` : ''}>`;
      };

      let text = tag('table')
        + tag('thead')
        + tag('tr', r)
        + names.map(name => `${tag('th', name, 1)}${name}</th>`).join('')
        + '</tr></thead>'
        + tag('tbody');

      scan(table, names, options.limit, options.offset, {
        row(row) {
          r = row;
          text += (++idx ? '</tr>' : '') + tag('tr');
        },
        cell(value, name) {
          text += tag('td', name, 1)
            + formatter(value, format[name])
            + '</td>';
        }
      });

      return text + '</tr></tbody></table>';
    }

    function styles(options) {
      return map(
        options.style,
        value => isFunction$1(value) ? value : () => value
      );
    }

    function defaultTrue(value, trueValue = true, falseValue = false) {
      return (value === undefined || value) ? trueValue : falseValue;
    }

    /**
     * Options for JSON formatting.
     * @typedef {object} JSONFormatOptions
     * @property {number} [limit=Infinity] The maximum number of rows to print.
     * @property {number} [offset=0] The row offset indicating how many initial
     *  rows to skip.
     * @property {boolean} [schema=true] Flag indicating if table schema metadata
     *  should be included in the JSON output. If false, only the data payload
     *  is included.
     * @property {import('./util').ColumnSelectOptions} [columns] Ordered list
     *  of column names to include. If function-valued, the function should
     *  accept a table as input and return an array of column name strings.
     * @property {Object.<string, (value: any) => any>} [format] Object of column
     *  format options. The object keys should be column names. The object values
     *  should be formatting functions to invoke to transform column values prior
     *  to output. If specified, these override automatically inferred options.
     */

    const defaultFormatter = value => isDate(value)
      ? formatUTCDate(value, true)
      : value;

    /**
     * Format a table as a JavaScript Object Notation (JSON) string.
     * @param {ColumnTable} table The table to format.
     * @param {JSONFormatOptions} options The formatting options.
     * @return {string} A JSON string.
     */
    function toJSON(table, options = {}) {
      const schema = defaultTrue(options.schema);
      const format = options.format || {};
      const names = columns(table, options.columns);
      let text = '{';

      if (schema) {
        text += '"schema":{"fields":'
          + JSON.stringify(names.map(name => ({ name })))
          + '},"data":{';
      }

      names.forEach((name, i) => {
        text += (i ? ',' : '') + JSON.stringify(name) + ':[';

        const column = table.column(name);
        const formatter = format[name] || defaultFormatter;
        let r = -1;
        table.scan(row => {
          const value = column.get(row);
          text += (++r ? ',' : '') + JSON.stringify(formatter(value));
        }, true, options.limit, options.offset);

        text += ']';
      });

      return text + '}' + (schema ? '}' : '');
    }

    /**
     * Options for Markdown formatting.
     * @typedef {object} MarkdownFormatOptions
     * @property {number} [limit=Infinity] The maximum number of rows to print.
     * @property {number} [offset=0] The row offset indicating how many initial rows to skip.
     * @property {import('./util').ColumnSelectOptions} [columns] Ordered list
     *  of column names to include. If function-valued, the function should
     *  accept a table as input and return an array of column name strings.
     * @property {import('./util').ColumnAlignOptions} [align] Object of column
     *  alignment options. The object keys should be column names. The object
     *  values should be aligment strings, one of 'l' (left), 'c' (center), or
     *  'r' (right). If specified, these override automatically inferred options.
     * @property {import('./util').ColumnFormatOptions} [format] Object of column
     *  format options. The object keys should be column names. The object values
     *  should be formatting functions or specification objects. If specified,
     *  these override automatically inferred options.
     * @property {number} [maxdigits=6] The maximum number of fractional digits
     *  to include when formatting numbers. This option is passed to the format
     *  inference method and is overridden by any explicit format options.
     */

    /**
     * Format a table as a GitHub-Flavored Markdown table string.
     * @param {ColumnTable} table The table to format.
     * @param {MarkdownFormatOptions} options The formatting options.
     * @return {string} A GitHub-Flavored Markdown table string.
     */
    function toMarkdown(table, options = {}) {
      const names = columns(table, options.columns);
      const { align, format } = formats(table, names, options);

      const alignValue = a => a === 'c' ? ':-:' : a === 'r' ? '-:' : ':-';
      const escape = s => s.replace(/\|/g, '\\|');

      let text = '|'
        + names.map(escape).join('|')
        + '|\n|'
        + names.map(name => alignValue(align[name])).join('|')
        + '|';

      scan(table, names, options.limit, options.offset, {
        row() {
          text += '\n|';
        },
        cell(value, name) {
          text += escape(formatValue(value, format[name])) + '|';
        }
      });

      return text + '\n';
    }

    function assign(map, pairs) {
      for (const [key, value] of entries(pairs)) {
        map.set(key, value);
      }
      return map;
    }

    function escapeRegExp(str) {
      return str.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
    }

    function resolve(table, sel, map = new Map()) {
      sel = isNumber$1(sel) ? table.columnName(sel) : sel;

      if (isString(sel)) {
        map.set(sel, sel);
      } else if (isArray$2(sel)) {
        sel.forEach(r => resolve(table, r, map));
      } else if (isFunction$1(sel)) {
        resolve(table, sel(table), map);
      } else if (isObject$1(sel)) {
        assign(map, sel);
      } else {
        error(`Invalid column selection: ${toString$1(sel)}`);
      }

      return map;
    }

    function decorate(value, toObject) {
      value.toObject = toObject;
      return value;
    }

    function toObject$1(value) {
      return isArray$2(value) ? value.map(toObject$1)
        : value && value.toObject ? value.toObject()
        : value;
    }

    /**
     * Proxy type for SelectHelper function.
     * @typedef {import('../table/transformable').SelectHelper} SelectHelper
     */

    /**
     * Select all columns in a table.
     * Returns a function-valued selection compatible with {@link Table#select}.
     * @return {SelectHelper} Selection function compatible with select().
     */
    function all() {
      return decorate(
        table => table.columnNames(),
        () => ({ all: [] })
      );
    }

    /**
     * Negate a column selection, selecting all other columns in a table.
     * Returns a function-valued selection compatible with {@link Table#select}.
     * @param {...any} selection The selection to negate. May be a column name,
     *  column index, array of either, or a selection function (e.g., from range).
     * @return {SelectHelper} Selection function compatible with select().
     */
    function not(...selection) {
      selection = selection.flat();
      return decorate(
        table => {
          const drop = resolve(table, selection);
          return table.columnNames(name => !drop.has(name));
        },
        () => ({ not: toObject$1(selection) })
      );
    }

    /**
     * Select a contiguous range of columns.
     * @param {string|number} start The name/index of the first selected column.
     * @param {string|number} end The name/index of the last selected column.
     * @return {SelectHelper} Selection function compatible with select().
     */
    function range(start, end) {
      return decorate(
        table => {
          let i = isNumber$1(start) ? start : table.columnIndex(start);
          let j = isNumber$1(end) ? end : table.columnIndex(end);
          if (j < i) { const t = j; j = i; i = t; }
          return table.columnNames().slice(i, j + 1);
        },
        () => ({ range: [start, end] })
      );
    }

    /**
     * Select all columns whose names match a pattern.
     * @param {string|RegExp} pattern A string or regular expression pattern to match.
     * @return {SelectHelper} Selection function compatible with select().
     */
    function matches(pattern) {
      if (isString(pattern)) pattern = RegExp(escapeRegExp(pattern));
      return decorate(
        table => table.columnNames(name => pattern.test(name)),
        () => ({ matches: [pattern.source, pattern.flags] })
      );
    }

    /**
     * Select all columns whose names start with a string.
     * @param {string} string The string to match at the start of the column name.
     * @return {SelectHelper} Selection function compatible with select().
     */
    function startswith(string) {
      return matches(RegExp('^' + escapeRegExp(string)));
    }

    /**
     * Select all columns whose names end with a string.
     * @param {string} string The string to match at the end of the column name.
     * @return {SelectHelper} Selection function compatible with select().
     */
    function endswith(string) {
      return matches(RegExp(escapeRegExp(string) + '$'));
    }

    function arrayType(column) {
      return isTypedArray(column.data) ? column.data.constructor : Array;
    }

    /**
     * Class representing a table backed by a named set of columns.
     */
    class ColumnTable extends Table$1 {

      /**
       * Create a new ColumnTable from existing input data.
       * @param {object[]|Iterable<object>|object|Map} values The backing table data values.
       *  If array-valued, should be a list of JavaScript objects with
       *  key-value properties for each column value.
       *  If object- or Map-valued, a table with two columns (one for keys,
       *  one for values) will be created.
       * @param {string[]} [names] The named columns to include.
       * @return {ColumnTable} A new ColumnTable instance.
       */
      static from(values, names) {
        return new ColumnTable(columnsFrom(values, names), names);
      }

      /**
       * Create a new table for a set of named columns.
       * @param {object|Map} columns
       *  The set of named column arrays. Keys are column names.
       *  The enumeration order of the keys determines the column indices,
       *  unless the names parameter is specified.
       *  Values must be arrays (or array-like values) of identical length.
       * @param {string[]} [names] Ordered list of column names. If specified,
       *  this array determines the column indices. If not specified, the
       *  key enumeration order of the columns object is used.
       * @return {ColumnTable} the instantiated ColumnTable instance.
       */
      static new(columns, names) {
        if (columns instanceof ColumnTable) return columns;
        const data = {};
        const keys = [];
        for (const [key, value] of entries(columns)) {
          data[key] = value;
          keys.push(key);
        }
        return new ColumnTable(data, names || keys);
      }

      /**
       * Instantiate a new ColumnTable instance.
       * @param {object} columns An object mapping column names to values.
       * @param {string[]} [names] An ordered list of column names.
       * @param {BitSet} [filter] A filtering BitSet.
       * @param {GroupBySpec} [group] A groupby specification.
       * @param {RowComparator} [order] A row comparator function.
       * @param {Params} [params] An object mapping parameter names to values.
       */
      constructor(columns, names, filter, group, order, params) {
        map(columns, defaultColumnFactory, columns);
        names = names || Object.keys(columns);
        const nrows = names.length ? columns[names[0]].length : 0;
        super(names, nrows, columns, filter, group, order, params);
      }

      /**
       * Create a new table with the same type as this table.
       * The new table may have different data, filter, grouping, or ordering
       * based on the values of the optional configuration argument. If a
       * setting is not specified, it is inherited from the current table.
       * @param {CreateOptions} [options] Creation options for the new table.
       * @return {ColumnTable} A newly created table.
       */
      create({ data, names, filter, groups, order }) {
        const f = filter !== undefined ? filter : this.mask();

        return new ColumnTable(
          data || this._data,
          names || (!data ? this._names : null),
          f,
          groups !== undefined ? groups : regroup(this._group, filter && f),
          order !== undefined ? order : this._order,
          this._params
        );
      }

      /**
       * Create a new table with additional columns drawn from one or more input
       * tables. All tables must have the same numer of rows and are reified
       * prior to assignment. In the case of repeated column names, input table
       * columns overwrite existing columns.
       * @param {...ColumnTable} tables The tables to merge with this table.
       * @return {ColumnTable} A new table with merged columns.
       * @example table.assign(table1, table2)
       */
      assign(...tables) {
        const nrows = this.numRows();
        const base = this.reify();
        const cset = columnSet(base).groupby(base.groups());
        tables.forEach(input => {
          input = ColumnTable.new(input);
          if (input.numRows() !== nrows) error('Assign row counts do not match');
          input = input.reify();
          input.columnNames(name => cset.add(name, input.column(name)));
        });
        return this.create(cset.new());
      }

      /**
       * Get the backing set of columns for this table.
       * @return {ColumnData} Object of named column instances.
       */
      columns() {
        return this._data;
      }

      /**
       * Get the column instance with the given name.
       * @param {string} name The column name.
       * @return {ColumnType | undefined} The named column, or undefined if it does not exist.
       */
      column(name) {
        return this._data[name];
      }

      /**
       * Get the column instance at the given index position.
       * @param {number} index The zero-based column index.
       * @return {ColumnType | undefined} The column, or undefined if it does not exist.
       */
      columnAt(index) {
        return this._data[this._names[index]];
      }

      /**
       * Get an array of values contained in a column. The resulting array
       * respects any table filter or orderby criteria.
       * @param {string} name The column name.
       * @param {ArrayConstructor|import('./table').TypedArrayConstructor} [constructor=Array]
       *  The array constructor for instantiating the output array.
       * @return {import('./table').DataValue[]|import('./table).TypedArray} The array of column values.
       */
      array(name, constructor = Array) {
        const column = this.column(name);
        const array = new constructor(this.numRows());
        let idx = -1;
        this.scan(row => array[++idx] = column.get(row), true);
        return array;
      }

      /**
       * Get the value for the given column and row.
       * @param {string} name The column name.
       * @param {number} [row=0] The row index, defaults to zero if not specified.
       * @return {import('./table').DataValue} The table value at (column, row).
       */
      get(name, row = 0) {
        const column = this.column(name);
        return this.isFiltered() || this.isOrdered()
          ? column.get(this.indices()[row])
          : column.get(row);
      }

      /**
       * Returns an accessor ("getter") function for a column. The returned
       * function takes a row index as its single argument and returns the
       * corresponding column value.
       * @param {string} name The column name.
       * @return {import('./table').ColumnGetter} The column getter function.
       */
      getter(name) {
        const column = this.column(name);
        const indices = this.isFiltered() || this.isOrdered() ? this.indices() : null;
        return indices ? row => column.get(indices[row])
          : column ? row => column.get(row)
          : error(`Unrecognized column: ${name}`);
      }

      /**
       * Returns an object representing a table row.
       * @param {number} [row=0] The row index, defaults to zero if not specified.
       * @return {object} A row object with named properties for each column.
       */
      object(row = 0) {
        return objectBuilder(this)(row);
      }

      /**
       * Returns an array of objects representing table rows.
       * @param {ObjectsOptions} [options] The options for row object generation.
       * @return {object[]} An array of row objects.
       */
      objects(options = {}) {
        const { grouped, limit, offset } = options;

        // generate array of row objects
        const names = resolve(this, options.columns || all());
        const create = rowObjectBuilder(names);
        const obj = [];
        this.scan(
          (row, data) => obj.push(create(row, data)),
          true, limit, offset
        );

        // produce nested output as requested
        if (grouped && this.isGrouped()) {
          const idx = [];
          this.scan(row => idx.push(row), true, limit, offset);
          return nest(this, idx, obj, grouped);
        }

        return obj;
      }

      /**
       * Returns an iterator over objects representing table rows.
       * @return {Iterator<object>} An iterator over row objects.
       */
      *[Symbol.iterator]() {
        const create = objectBuilder(this);
        const n = this.numRows();
        for (let i = 0; i < n; ++i) {
          yield create(i);
        }
      }

      /**
       * Create a new fully-materialized instance of this table.
       * All filter and orderby settings are removed from the new table.
       * Instead, the backing data itself is filtered and ordered as needed.
       * @param {number[]} [indices] Ordered row indices to materialize.
       *  If unspecified, all rows passing the table filter are used.
       * @return {ColumnTable} A reified table.
       */
      reify(indices) {
        const nrows = indices ? indices.length : this.numRows();
        const names = this._names;
        let data, groups;

        if (!indices && !this.isOrdered()) {
          if (!this.isFiltered()) {
            return this; // data already reified
          } else if (nrows === this.totalRows()) {
            data = this.data(); // all rows pass filter, skip copy
          }
        }

        if (!data) {
          const scan = indices ? f => indices.forEach(f) : f => this.scan(f, true);
          const ncols = names.length;
          data = {};

          for (let i = 0; i < ncols; ++i) {
            const name = names[i];
            const prev = this.column(name);
            const curr = data[name] = new (arrayType(prev))(nrows);
            let r = -1;
            scan(row => curr[++r] = prev.get(row));
          }

          if (this.isGrouped()) {
            groups = reindex(this.groups(), scan, !!indices, nrows);
          }
        }

        return this.create({ data, names, groups, filter: null, order: null });
      }

      /**
       * Apply a sequence of transformations to this table. The output
       * of each transform is passed as input to the next transform, and
       * the output of the last transform is then returned.
       * @param {...(Transform|Transform[])} transforms Transformation
       *  functions to apply to the table in sequence. Each function should
       *  take a single table as input and return a table as output.
       * @return {ColumnTable} The output of the last transform.
       */
      transform(...transforms) {
        return transforms.flat().reduce((t, f) => f(t), this);
      }

      /**
       * Format this table as an Apache Arrow table.
       * @param {ArrowFormatOptions} [options] The formatting options.
       * @return {import('apache-arrow').Table} An Apache Arrow table.
       */
      toArrow(options) {
        return toArrow(this, options);
      }

      /**
       * Format this table as binary data in the Apache Arrow IPC format.
       * @param {ArrowFormatOptions} [options] The formatting options.
       * @return {Uint8Array} A new Uint8Array of Arrow-encoded binary data.
       */
      toArrowBuffer(options) {
        return toArrow(this, options).serialize();
      }

      /**
       * Format this table as a comma-separated values (CSV) string. Other
       * delimiters, such as tabs or pipes ('|'), can be specified using
       * the options argument.
       * @param {CSVFormatOptions} [options] The formatting options.
       * @return {string} A delimited value string.
       */
      toCSV(options) {
        return toCSV(this, options);
      }

      /**
       * Format this table as an HTML table string.
       * @param {HTMLFormatOptions} [options] The formatting options.
       * @return {string} An HTML table string.
       */
      toHTML(options) {
        return toHTML(this, options);
      }

      /**
       * Format this table as a JavaScript Object Notation (JSON) string.
       * @param {JSONFormatOptions} [options] The formatting options.
       * @return {string} A JSON string.
       */
      toJSON(options) {
        return toJSON(this, options);
      }

      /**
       * Format this table as a GitHub-Flavored Markdown table string.
       * @param {MarkdownFormatOptions} [options] The formatting options.
       * @return {string} A GitHub-Flavored Markdown table string.
       */
      toMarkdown(options) {
        return toMarkdown(this, options);
      }
    }

    function objectBuilder(table) {
      let b = table._builder;

      if (!b) {
        const create = rowObjectBuilder(table.columnNames());
        const data = table.data();
        if (table.isOrdered() || table.isFiltered()) {
          const indices = table.indices();
          b = row => create(indices[row], data);
        } else {
          b = row => create(row, data);
        }
        table._builder = b;
      }

      return b;
    }

    /**
     * A table transformation.
     * @typedef {(table: ColumnTable) => ColumnTable} Transform
     */

    /**
     * Proxy type for BitSet class.
     * @typedef {import('./table').BitSet} BitSet
     */

    /**
     * Proxy type for ColumnType interface.
     * @typedef {import('./column').ColumnType} ColumnType
     */

    /**
     * A named collection of columns.
     * @typedef {{[key: string]: ColumnType}} ColumnData
     */

    /**
     * Proxy type for GroupBySpec.
     * @typedef {import('./table').GroupBySpec} GroupBySpec
     */

    /**
     * Proxy type for RowComparator.
     * @typedef {import('./table').RowComparator} RowComparator
     */

    /**
     * Proxy type for Params.
     * @typedef {import('./table').Params} Params
     */

    /**
     * Options for Arrow formatting.
     * @typedef {import('../arrow/encode').ArrowFormatOptions} ArrowFormatOptions
     */

    /**
     * Options for CSV formatting.
     * @typedef {import('../format/to-csv').CSVFormatOptions} CSVFormatOptions
     */

    /**
     * Options for HTML formatting.
     * @typedef {import('../format/to-html').HTMLFormatOptions} HTMLFormatOptions
     */

    /**
     * Options for JSON formatting.
     * @typedef {import('../format/to-json').JSONFormatOptions} JSONFormatOptions
     */

    /**
     * Options for Markdown formatting.
     * @typedef {import('../format/to-markdown').MarkdownFormatOptions} MarkdownFormatOptions
     */

    /**
     * Abstract class for custom aggregation operations.
     */
    class Reducer {
      constructor(outputs) {
        this._outputs = outputs;
      }

      size() {
        return this._outputs.length;
      }

      outputs() {
        return this._outputs;
      }

      init(/* columns */) {
        return {};
      }

      add(/* state, row, data */) {
        // no-op, subclasses should override
      }

      rem(/* state, row, data */) {
        // no-op, subclasses should override
      }

      write(/* state, values, index */) {
      }
    }

    function walk(node, ctx, visitors, parent) {
      const visit = visitors[node.type] || visitors['Default'];
      if (visit && visit(node, ctx, parent) === false) return;

      const walker = walkers[node.type];
      if (walker) walker(node, ctx, visitors);
    }

    const unary = (node, ctx, visitors) => {
      walk(node.argument, ctx, visitors, node);
    };

    const binary = (node, ctx, visitors) => {
      walk(node.left, ctx, visitors, node);
      walk(node.right, ctx, visitors, node);
    };

    const ternary = (node, ctx, visitors) => {
      walk(node.test, ctx, visitors, node);
      walk(node.consequent, ctx, visitors, node);
      if (node.alternate) walk(node.alternate, ctx, visitors, node);
    };

    const func$3 = (node, ctx, visitors) => {
      list$1(node.params, ctx, visitors, node);
      walk(node.body, ctx, visitors, node);
    };

    const call = (node, ctx, visitors) => {
      walk(node.callee, ctx, visitors, node);
      list$1(node.arguments, ctx, visitors, node);
    };

    const list$1 = (nodes, ctx, visitors, node) => {
      nodes.forEach(item => walk(item, ctx, visitors, node));
    };

    const walkers = {
      TemplateLiteral: (node, ctx, visitors) => {
        list$1(node.expressions, ctx, visitors, node);
        list$1(node.quasis, ctx, visitors, node);
      },
      MemberExpression: (node, ctx, visitors) => {
        walk(node.object, ctx, visitors, node);
        walk(node.property, ctx, visitors, node);
      },
      CallExpression: call,
      NewExpression: call,
      ArrayExpression: (node, ctx, visitors) => {
        list$1(node.elements, ctx, visitors, node);
      },
      AssignmentExpression: binary,
      AwaitExpression: unary,
      BinaryExpression: binary,
      LogicalExpression: binary,
      UnaryExpression: unary,
      UpdateExpression: unary,
      ConditionalExpression: ternary,
      ObjectExpression: (node, ctx, visitors) => {
        list$1(node.properties, ctx, visitors, node);
      },
      Property: (node, ctx, visitors) => {
        walk(node.key, ctx, visitors, node);
        walk(node.value, ctx, visitors, node);
      },

      ArrowFunctionExpression: func$3,
      FunctionExpression: func$3,
      FunctionDeclaration: func$3,

      VariableDeclaration: (node, ctx, visitors) => {
        list$1(node.declarations, ctx, visitors, node);
      },
      VariableDeclarator: (node, ctx, visitors) => {
        walk(node.id, ctx, visitors, node);
        walk(node.init, ctx, visitors, node);
      },
      SpreadElement: (node, ctx, visitors) => {
        walk(node.argument, ctx, visitors, node);
      },

      BlockStatement: (node, ctx, visitors) => {
        list$1(node.body, ctx, visitors, node);
      },
      ExpressionStatement: (node, ctx, visitors) => {
        walk(node.expression, ctx, visitors, node);
      },
      IfStatement: ternary,
      ForStatement: (node, ctx, visitors) => {
        walk(node.init, ctx, visitors, node);
        walk(node.test, ctx, visitors, node);
        walk(node.update, ctx, visitors, node);
        walk(node.body, ctx, visitors, node);
      },
      WhileStatement: (node, ctx, visitors) => {
        walk(node.test, ctx, visitors, node);
        walk(node.body, ctx, visitors, node);
      },
      DoWhileStatement: (node, ctx, visitors) => {
        walk(node.body, ctx, visitors, node);
        walk(node.test, ctx, visitors, node);
      },
      SwitchStatement: (node, ctx, visitors) => {
        walk(node.discriminant, ctx, visitors, node);
        list$1(node.cases, ctx, visitors, node);
      },
      SwitchCase: (node, ctx, visitors) => {
        if (node.test) walk(node.test, ctx, visitors, node);
        list$1(node.consequent, ctx, visitors, node);
      },
      ReturnStatement: unary,

      Program: (node, ctx, visitors) => {
        walk(node.body[0], ctx, visitors, node);
      }
    };

    function strip(node) {
      delete node.start;
      delete node.end;
      delete node.optional;
    }

    function stripMember(node) {
      strip(node);
      delete node.object;
      delete node.property;
      delete node.computed;
      if (!node.table) delete node.table;
    }

    function clean(ast) {
      walk(ast, null, {
        Column: stripMember,
        Constant: stripMember,
        Default: strip
      });
      return ast;
    }

    function is(type, node) {
      return node && node.type === type;
    }

    function isFunctionExpression(node) {
      return is(FunctionExpression, node)
        || is(ArrowFunctionExpression, node);
    }

    function toFunction(value) {
      return isFunction$1(value) ? value : () => value;
    }

    const ERROR_ESC_AGGRONLY = 'Escaped functions are not valid as rollup or pivot values.';

    function parseEscape(ctx, spec, params) {
      if (ctx.aggronly) error(ERROR_ESC_AGGRONLY);

      // generate escaped function invocation code
      const code = '(row,data)=>fn('
        + rowObjectCode(ctx.table.columnNames())
        + ',$)';

      return { escape: compile$1.escape(code, toFunction(spec.expr), params) };
    }

    // Reserved word lists for various dialects of the language

    var reservedWords = {
      3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
      5: "class enum extends super const export import",
      6: "enum",
      strict: "implements interface let package private protected public static yield",
      strictBind: "eval arguments"
    };

    // And the keywords

    var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";

    var keywords$1 = {
      5: ecma5AndLessKeywords,
      "5module": ecma5AndLessKeywords + " export import",
      6: ecma5AndLessKeywords + " const class extends export import super"
    };

    var keywordRelationalOperator = /^in(stanceof)?$/;

    // ## Character categories

    // Big ugly regular expressions that match characters in the
    // whitespace, identifier, and identifier-start categories. These
    // are only applied when a character is found to actually have a
    // code point above 128.
    // Generated by `bin/generate-identifier-regex.js`.
    var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
    var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";

    var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
    var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");

    nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;

    // These are a run-length and offset encoded representation of the
    // >0xffff code points that are a valid part of identifiers. The
    // offset starts at 0x10000, and each pair of numbers represents an
    // offset to the next range, and then a size of the range. They were
    // generated by bin/generate-identifier-regex.js

    // eslint-disable-next-line comma-spacing
    var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,46,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,482,44,11,6,17,0,322,29,19,43,1269,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4152,8,221,3,5761,15,7472,3104,541,1507,4938];

    // eslint-disable-next-line comma-spacing
    var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239];

    // This has a complexity linear to the value of the code. The
    // assumption is that looking up astral identifier characters is
    // rare.
    function isInAstralSet(code, set) {
      var pos = 0x10000;
      for (var i = 0; i < set.length; i += 2) {
        pos += set[i];
        if (pos > code) { return false }
        pos += set[i + 1];
        if (pos >= code) { return true }
      }
    }

    // Test whether a given character code starts an identifier.

    function isIdentifierStart(code, astral) {
      if (code < 65) { return code === 36 }
      if (code < 91) { return true }
      if (code < 97) { return code === 95 }
      if (code < 123) { return true }
      if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
      if (astral === false) { return false }
      return isInAstralSet(code, astralIdentifierStartCodes)
    }

    // Test whether a given character is part of an identifier.

    function isIdentifierChar(code, astral) {
      if (code < 48) { return code === 36 }
      if (code < 58) { return true }
      if (code < 65) { return false }
      if (code < 91) { return true }
      if (code < 97) { return code === 95 }
      if (code < 123) { return true }
      if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
      if (astral === false) { return false }
      return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
    }

    // ## Token types

    // The assignment of fine-grained, information-carrying type objects
    // allows the tokenizer to store the information it has about a
    // token in a way that is very cheap for the parser to look up.

    // All token type variables start with an underscore, to make them
    // easy to recognize.

    // The `beforeExpr` property is used to disambiguate between regular
    // expressions and divisions. It is set on all token types that can
    // be followed by an expression (thus, a slash after them would be a
    // regular expression).
    //
    // The `startsExpr` property is used to check if the token ends a
    // `yield` expression. It is set on all token types that either can
    // directly start an expression (like a quotation mark) or can
    // continue an expression (like the body of a string).
    //
    // `isLoop` marks a keyword as starting a loop, which is important
    // to know when parsing a label, in order to allow or disallow
    // continue jumps to that label.

    var TokenType = function TokenType(label, conf) {
      if ( conf === void 0 ) conf = {};

      this.label = label;
      this.keyword = conf.keyword;
      this.beforeExpr = !!conf.beforeExpr;
      this.startsExpr = !!conf.startsExpr;
      this.isLoop = !!conf.isLoop;
      this.isAssign = !!conf.isAssign;
      this.prefix = !!conf.prefix;
      this.postfix = !!conf.postfix;
      this.binop = conf.binop || null;
      this.updateContext = null;
    };

    function binop(name, prec) {
      return new TokenType(name, {beforeExpr: true, binop: prec})
    }
    var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};

    // Map keyword names to token types.

    var keywords$2 = {};

    // Succinct definitions of keyword token types
    function kw(name, options) {
      if ( options === void 0 ) options = {};

      options.keyword = name;
      return keywords$2[name] = new TokenType(name, options)
    }

    var types$1 = {
      num: new TokenType("num", startsExpr),
      regexp: new TokenType("regexp", startsExpr),
      string: new TokenType("string", startsExpr),
      name: new TokenType("name", startsExpr),
      privateId: new TokenType("privateId", startsExpr),
      eof: new TokenType("eof"),

      // Punctuation token types.
      bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
      bracketR: new TokenType("]"),
      braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
      braceR: new TokenType("}"),
      parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
      parenR: new TokenType(")"),
      comma: new TokenType(",", beforeExpr),
      semi: new TokenType(";", beforeExpr),
      colon: new TokenType(":", beforeExpr),
      dot: new TokenType("."),
      question: new TokenType("?", beforeExpr),
      questionDot: new TokenType("?."),
      arrow: new TokenType("=>", beforeExpr),
      template: new TokenType("template"),
      invalidTemplate: new TokenType("invalidTemplate"),
      ellipsis: new TokenType("...", beforeExpr),
      backQuote: new TokenType("`", startsExpr),
      dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),

      // Operators. These carry several kinds of properties to help the
      // parser use them properly (the presence of these properties is
      // what categorizes them as operators).
      //
      // `binop`, when present, specifies that this operator is a binary
      // operator, and will refer to its precedence.
      //
      // `prefix` and `postfix` mark the operator as a prefix or postfix
      // unary operator.
      //
      // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
      // binary operators with a very low precedence, that should result
      // in AssignmentExpression nodes.

      eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
      assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
      incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
      prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
      logicalOR: binop("||", 1),
      logicalAND: binop("&&", 2),
      bitwiseOR: binop("|", 3),
      bitwiseXOR: binop("^", 4),
      bitwiseAND: binop("&", 5),
      equality: binop("==/!=/===/!==", 6),
      relational: binop("</>/<=/>=", 7),
      bitShift: binop("<</>>/>>>", 8),
      plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
      modulo: binop("%", 10),
      star: binop("*", 10),
      slash: binop("/", 10),
      starstar: new TokenType("**", {beforeExpr: true}),
      coalesce: binop("??", 1),

      // Keyword token types.
      _break: kw("break"),
      _case: kw("case", beforeExpr),
      _catch: kw("catch"),
      _continue: kw("continue"),
      _debugger: kw("debugger"),
      _default: kw("default", beforeExpr),
      _do: kw("do", {isLoop: true, beforeExpr: true}),
      _else: kw("else", beforeExpr),
      _finally: kw("finally"),
      _for: kw("for", {isLoop: true}),
      _function: kw("function", startsExpr),
      _if: kw("if"),
      _return: kw("return", beforeExpr),
      _switch: kw("switch"),
      _throw: kw("throw", beforeExpr),
      _try: kw("try"),
      _var: kw("var"),
      _const: kw("const"),
      _while: kw("while", {isLoop: true}),
      _with: kw("with"),
      _new: kw("new", {beforeExpr: true, startsExpr: true}),
      _this: kw("this", startsExpr),
      _super: kw("super", startsExpr),
      _class: kw("class", startsExpr),
      _extends: kw("extends", beforeExpr),
      _export: kw("export"),
      _import: kw("import", startsExpr),
      _null: kw("null", startsExpr),
      _true: kw("true", startsExpr),
      _false: kw("false", startsExpr),
      _in: kw("in", {beforeExpr: true, binop: 7}),
      _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
      _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
      _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
      _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
    };

    // Matches a whole line break (where CRLF is considered a single
    // line break). Used to count lines.

    var lineBreak = /\r\n?|\n|\u2028|\u2029/;
    var lineBreakG = new RegExp(lineBreak.source, "g");

    function isNewLine(code) {
      return code === 10 || code === 13 || code === 0x2028 || code === 0x2029
    }

    function nextLineBreak(code, from, end) {
      if ( end === void 0 ) end = code.length;

      for (var i = from; i < end; i++) {
        var next = code.charCodeAt(i);
        if (isNewLine(next))
          { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }
      }
      return -1
    }

    var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;

    var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;

    var ref = Object.prototype;
    var hasOwnProperty = ref.hasOwnProperty;
    var toString = ref.toString;

    var hasOwn = Object.hasOwn || (function (obj, propName) { return (
      hasOwnProperty.call(obj, propName)
    ); });

    var isArray = Array.isArray || (function (obj) { return (
      toString.call(obj) === "[object Array]"
    ); });

    function wordsRegexp(words) {
      return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
    }

    var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;

    // These are used when `options.locations` is on, for the
    // `startLoc` and `endLoc` properties.

    var Position = function Position(line, col) {
      this.line = line;
      this.column = col;
    };

    Position.prototype.offset = function offset (n) {
      return new Position(this.line, this.column + n)
    };

    var SourceLocation = function SourceLocation(p, start, end) {
      this.start = start;
      this.end = end;
      if (p.sourceFile !== null) { this.source = p.sourceFile; }
    };

    // The `getLineInfo` function is mostly useful when the
    // `locations` option is off (for performance reasons) and you
    // want to find the line/column position for a given character
    // offset. `input` should be the code string that the offset refers
    // into.

    function getLineInfo(input, offset) {
      for (var line = 1, cur = 0;;) {
        var nextBreak = nextLineBreak(input, cur, offset);
        if (nextBreak < 0) { return new Position(line, offset - cur) }
        ++line;
        cur = nextBreak;
      }
    }

    // A second argument must be given to configure the parser process.
    // These options are recognized (only `ecmaVersion` is required):

    var defaultOptions = {
      // `ecmaVersion` indicates the ECMAScript version to parse. Must be
      // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
      // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the
      // latest version the library supports). This influences support
      // for strict mode, the set of reserved words, and support for
      // new syntax features.
      ecmaVersion: null,
      // `sourceType` indicates the mode the code should be parsed in.
      // Can be either `"script"` or `"module"`. This influences global
      // strict mode and parsing of `import` and `export` declarations.
      sourceType: "script",
      // `onInsertedSemicolon` can be a callback that will be called
      // when a semicolon is automatically inserted. It will be passed
      // the position of the comma as an offset, and if `locations` is
      // enabled, it is given the location as a `{line, column}` object
      // as second argument.
      onInsertedSemicolon: null,
      // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
      // trailing commas.
      onTrailingComma: null,
      // By default, reserved words are only enforced if ecmaVersion >= 5.
      // Set `allowReserved` to a boolean value to explicitly turn this on
      // an off. When this option has the value "never", reserved words
      // and keywords can also not be used as property names.
      allowReserved: null,
      // When enabled, a return at the top level is not considered an
      // error.
      allowReturnOutsideFunction: false,
      // When enabled, import/export statements are not constrained to
      // appearing at the top of the program, and an import.meta expression
      // in a script isn't considered an error.
      allowImportExportEverywhere: false,
      // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
      // When enabled, await identifiers are allowed to appear at the top-level scope,
      // but they are still not allowed in non-async functions.
      allowAwaitOutsideFunction: null,
      // When enabled, super identifiers are not constrained to
      // appearing in methods and do not raise an error when they appear elsewhere.
      allowSuperOutsideMethod: null,
      // When enabled, hashbang directive in the beginning of file
      // is allowed and treated as a line comment.
      allowHashBang: false,
      // When `locations` is on, `loc` properties holding objects with
      // `start` and `end` properties in `{line, column}` form (with
      // line being 1-based and column 0-based) will be attached to the
      // nodes.
      locations: false,
      // A function can be passed as `onToken` option, which will
      // cause Acorn to call that function with object in the same
      // format as tokens returned from `tokenizer().getToken()`. Note
      // that you are not allowed to call the parser from the
      // callback—that will corrupt its internal state.
      onToken: null,
      // A function can be passed as `onComment` option, which will
      // cause Acorn to call that function with `(block, text, start,
      // end)` parameters whenever a comment is skipped. `block` is a
      // boolean indicating whether this is a block (`/* */`) comment,
      // `text` is the content of the comment, and `start` and `end` are
      // character offsets that denote the start and end of the comment.
      // When the `locations` option is on, two more parameters are
      // passed, the full `{line, column}` locations of the start and
      // end of the comments. Note that you are not allowed to call the
      // parser from the callback—that will corrupt its internal state.
      onComment: null,
      // Nodes have their start and end characters offsets recorded in
      // `start` and `end` properties (directly on the node, rather than
      // the `loc` object, which holds line/column data. To also add a
      // [semi-standardized][range] `range` property holding a `[start,
      // end]` array with the same numbers, set the `ranges` option to
      // `true`.
      //
      // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
      ranges: false,
      // It is possible to parse multiple files into a single AST by
      // passing the tree produced by parsing the first file as
      // `program` option in subsequent parses. This will add the
      // toplevel forms of the parsed file to the `Program` (top) node
      // of an existing parse tree.
      program: null,
      // When `locations` is on, you can pass this to record the source
      // file in every node's `loc` object.
      sourceFile: null,
      // This value, if given, is stored in every node, whether
      // `locations` is on or off.
      directSourceFile: null,
      // When enabled, parenthesized expressions are represented by
      // (non-standard) ParenthesizedExpression nodes
      preserveParens: false
    };

    // Interpret and default an options object

    var warnedAboutEcmaVersion = false;

    function getOptions(opts) {
      var options = {};

      for (var opt in defaultOptions)
        { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }

      if (options.ecmaVersion === "latest") {
        options.ecmaVersion = 1e8;
      } else if (options.ecmaVersion == null) {
        if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
          warnedAboutEcmaVersion = true;
          console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
        }
        options.ecmaVersion = 11;
      } else if (options.ecmaVersion >= 2015) {
        options.ecmaVersion -= 2009;
      }

      if (options.allowReserved == null)
        { options.allowReserved = options.ecmaVersion < 5; }

      if (isArray(options.onToken)) {
        var tokens = options.onToken;
        options.onToken = function (token) { return tokens.push(token); };
      }
      if (isArray(options.onComment))
        { options.onComment = pushComment(options, options.onComment); }

      return options
    }

    function pushComment(options, array) {
      return function(block, text, start, end, startLoc, endLoc) {
        var comment = {
          type: block ? "Block" : "Line",
          value: text,
          start: start,
          end: end
        };
        if (options.locations)
          { comment.loc = new SourceLocation(this, startLoc, endLoc); }
        if (options.ranges)
          { comment.range = [start, end]; }
        array.push(comment);
      }
    }

    // Each scope gets a bitset that may contain these flags
    var
        SCOPE_TOP = 1,
        SCOPE_FUNCTION = 2,
        SCOPE_ASYNC = 4,
        SCOPE_GENERATOR = 8,
        SCOPE_ARROW = 16,
        SCOPE_SIMPLE_CATCH = 32,
        SCOPE_SUPER = 64,
        SCOPE_DIRECT_SUPER = 128,
        SCOPE_CLASS_STATIC_BLOCK = 256,
        SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;

    function functionFlags(async, generator) {
      return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
    }

    // Used in checkLVal* and declareName to determine the type of a binding
    var
        BIND_NONE = 0, // Not a binding
        BIND_VAR = 1, // Var-style binding
        BIND_LEXICAL = 2, // Let- or const-style binding
        BIND_FUNCTION = 3, // Function declaration
        BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
        BIND_OUTSIDE = 5; // Special case for function names as bound inside the function

    var Parser = function Parser(options, input, startPos) {
      this.options = options = getOptions(options);
      this.sourceFile = options.sourceFile;
      this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
      var reserved = "";
      if (options.allowReserved !== true) {
        reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
        if (options.sourceType === "module") { reserved += " await"; }
      }
      this.reservedWords = wordsRegexp(reserved);
      var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
      this.reservedWordsStrict = wordsRegexp(reservedStrict);
      this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
      this.input = String(input);

      // Used to signal to callers of `readWord1` whether the word
      // contained any escape sequences. This is needed because words with
      // escape sequences must not be interpreted as keywords.
      this.containsEsc = false;

      // Set up token state

      // The current position of the tokenizer in the input.
      if (startPos) {
        this.pos = startPos;
        this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
        this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
      } else {
        this.pos = this.lineStart = 0;
        this.curLine = 1;
      }

      // Properties of the current token:
      // Its type
      this.type = types$1.eof;
      // For tokens that include more information than their type, the value
      this.value = null;
      // Its start and end offset
      this.start = this.end = this.pos;
      // And, if locations are used, the {line, column} object
      // corresponding to those offsets
      this.startLoc = this.endLoc = this.curPosition();

      // Position information for the previous token
      this.lastTokEndLoc = this.lastTokStartLoc = null;
      this.lastTokStart = this.lastTokEnd = this.pos;

      // The context stack is used to superficially track syntactic
      // context to predict whether a regular expression is allowed in a
      // given position.
      this.context = this.initialContext();
      this.exprAllowed = true;

      // Figure out if it's a module code.
      this.inModule = options.sourceType === "module";
      this.strict = this.inModule || this.strictDirective(this.pos);

      // Used to signify the start of a potential arrow function
      this.potentialArrowAt = -1;
      this.potentialArrowInForAwait = false;

      // Positions to delayed-check that yield/await does not exist in default parameters.
      this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
      // Labels in scope.
      this.labels = [];
      // Thus-far undefined exports.
      this.undefinedExports = Object.create(null);

      // If enabled, skip leading hashbang line.
      if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
        { this.skipLineComment(2); }

      // Scope tracking for duplicate variable names (see scope.js)
      this.scopeStack = [];
      this.enterScope(SCOPE_TOP);

      // For RegExp validation
      this.regexpState = null;

      // The stack of private names.
      // Each element has two properties: 'declared' and 'used'.
      // When it exited from the outermost class definition, all used private names must be declared.
      this.privateNameStack = [];
    };

    var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };

    Parser.prototype.parse = function parse () {
      var node = this.options.program || this.startNode();
      this.nextToken();
      return this.parseTopLevel(node)
    };

    prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };

    prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };

    prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };

    prototypeAccessors.canAwait.get = function () {
      for (var i = this.scopeStack.length - 1; i >= 0; i--) {
        var scope = this.scopeStack[i];
        if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
        if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 }
      }
      return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
    };

    prototypeAccessors.allowSuper.get = function () {
      var ref = this.currentThisScope();
        var flags = ref.flags;
        var inClassFieldInit = ref.inClassFieldInit;
      return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
    };

    prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };

    prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };

    prototypeAccessors.allowNewDotTarget.get = function () {
      var ref = this.currentThisScope();
        var flags = ref.flags;
        var inClassFieldInit = ref.inClassFieldInit;
      return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
    };

    prototypeAccessors.inClassStaticBlock.get = function () {
      return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
    };

    Parser.extend = function extend () {
        var plugins = [], len = arguments.length;
        while ( len-- ) plugins[ len ] = arguments[ len ];

      var cls = this;
      for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
      return cls
    };

    Parser.parse = function parse (input, options) {
      return new this(options, input).parse()
    };

    Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) {
      var parser = new this(options, input, pos);
      parser.nextToken();
      return parser.parseExpression()
    };

    Parser.tokenizer = function tokenizer (input, options) {
      return new this(options, input)
    };

    Object.defineProperties( Parser.prototype, prototypeAccessors );

    var pp$9 = Parser.prototype;

    // ## Parser utilities

    var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
    pp$9.strictDirective = function(start) {
      for (;;) {
        // Try to find string literal.
        skipWhiteSpace.lastIndex = start;
        start += skipWhiteSpace.exec(this.input)[0].length;
        var match = literal.exec(this.input.slice(start));
        if (!match) { return false }
        if ((match[1] || match[2]) === "use strict") {
          skipWhiteSpace.lastIndex = start + match[0].length;
          var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
          var next = this.input.charAt(end);
          return next === ";" || next === "}" ||
            (lineBreak.test(spaceAfter[0]) &&
             !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
        }
        start += match[0].length;

        // Skip semicolon, if any.
        skipWhiteSpace.lastIndex = start;
        start += skipWhiteSpace.exec(this.input)[0].length;
        if (this.input[start] === ";")
          { start++; }
      }
    };

    // Predicate that tests whether the next token is of the given
    // type, and if yes, consumes it as a side effect.

    pp$9.eat = function(type) {
      if (this.type === type) {
        this.next();
        return true
      } else {
        return false
      }
    };

    // Tests whether parsed token is a contextual keyword.

    pp$9.isContextual = function(name) {
      return this.type === types$1.name && this.value === name && !this.containsEsc
    };

    // Consumes contextual keyword if possible.

    pp$9.eatContextual = function(name) {
      if (!this.isContextual(name)) { return false }
      this.next();
      return true
    };

    // Asserts that following token is given contextual keyword.

    pp$9.expectContextual = function(name) {
      if (!this.eatContextual(name)) { this.unexpected(); }
    };

    // Test whether a semicolon can be inserted at the current position.

    pp$9.canInsertSemicolon = function() {
      return this.type === types$1.eof ||
        this.type === types$1.braceR ||
        lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
    };

    pp$9.insertSemicolon = function() {
      if (this.canInsertSemicolon()) {
        if (this.options.onInsertedSemicolon)
          { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
        return true
      }
    };

    // Consume a semicolon, or, failing that, see if we are allowed to
    // pretend that there is a semicolon at this position.

    pp$9.semicolon = function() {
      if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
    };

    pp$9.afterTrailingComma = function(tokType, notNext) {
      if (this.type === tokType) {
        if (this.options.onTrailingComma)
          { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
        if (!notNext)
          { this.next(); }
        return true
      }
    };

    // Expect a token of a given type. If found, consume it, otherwise,
    // raise an unexpected token error.

    pp$9.expect = function(type) {
      this.eat(type) || this.unexpected();
    };

    // Raise an unexpected token error.

    pp$9.unexpected = function(pos) {
      this.raise(pos != null ? pos : this.start, "Unexpected token");
    };

    function DestructuringErrors() {
      this.shorthandAssign =
      this.trailingComma =
      this.parenthesizedAssign =
      this.parenthesizedBind =
      this.doubleProto =
        -1;
    }

    pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
      if (!refDestructuringErrors) { return }
      if (refDestructuringErrors.trailingComma > -1)
        { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
      var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
      if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
    };

    pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
      if (!refDestructuringErrors) { return false }
      var shorthandAssign = refDestructuringErrors.shorthandAssign;
      var doubleProto = refDestructuringErrors.doubleProto;
      if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
      if (shorthandAssign >= 0)
        { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
      if (doubleProto >= 0)
        { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
    };

    pp$9.checkYieldAwaitInDefaultParams = function() {
      if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
        { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
      if (this.awaitPos)
        { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
    };

    pp$9.isSimpleAssignTarget = function(expr) {
      if (expr.type === "ParenthesizedExpression")
        { return this.isSimpleAssignTarget(expr.expression) }
      return expr.type === "Identifier" || expr.type === "MemberExpression"
    };

    var pp$8 = Parser.prototype;

    // ### Statement parsing

    // Parse a program. Initializes the parser, reads any number of
    // statements, and wraps them in a Program node.  Optionally takes a
    // `program` argument.  If present, the statements will be appended
    // to its body instead of creating a new node.

    pp$8.parseTopLevel = function(node) {
      var exports = Object.create(null);
      if (!node.body) { node.body = []; }
      while (this.type !== types$1.eof) {
        var stmt = this.parseStatement(null, true, exports);
        node.body.push(stmt);
      }
      if (this.inModule)
        { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
          {
            var name = list[i];

            this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
          } }
      this.adaptDirectivePrologue(node.body);
      this.next();
      node.sourceType = this.options.sourceType;
      return this.finishNode(node, "Program")
    };

    var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};

    pp$8.isLet = function(context) {
      if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
      skipWhiteSpace.lastIndex = this.pos;
      var skip = skipWhiteSpace.exec(this.input);
      var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
      // For ambiguous cases, determine if a LexicalDeclaration (or only a
      // Statement) is allowed here. If context is not empty then only a Statement
      // is allowed. However, `let [` is an explicit negative lookahead for
      // ExpressionStatement, so special-case it first.
      if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '[', '/', astral
      if (context) { return false }

      if (nextCh === 123) { return true } // '{'
      if (isIdentifierStart(nextCh, true)) {
        var pos = next + 1;
        while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
        if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
        var ident = this.input.slice(next, pos);
        if (!keywordRelationalOperator.test(ident)) { return true }
      }
      return false
    };

    // check 'async [no LineTerminator here] function'
    // - 'async /*foo*/ function' is OK.
    // - 'async /*\n*/ function' is invalid.
    pp$8.isAsyncFunction = function() {
      if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
        { return false }

      skipWhiteSpace.lastIndex = this.pos;
      var skip = skipWhiteSpace.exec(this.input);
      var next = this.pos + skip[0].length, after;
      return !lineBreak.test(this.input.slice(this.pos, next)) &&
        this.input.slice(next, next + 8) === "function" &&
        (next + 8 === this.input.length ||
         !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
    };

    // Parse a single statement.
    //
    // If expecting a statement and finding a slash operator, parse a
    // regular expression literal. This is to handle cases like
    // `if (foo) /blah/.exec(foo)`, where looking at the previous token
    // does not help.

    pp$8.parseStatement = function(context, topLevel, exports) {
      var starttype = this.type, node = this.startNode(), kind;

      if (this.isLet(context)) {
        starttype = types$1._var;
        kind = "let";
      }

      // Most types of statements are recognized by the keyword they
      // start with. Many are trivial to parse, some require a bit of
      // complexity.

      switch (starttype) {
      case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
      case types$1._debugger: return this.parseDebuggerStatement(node)
      case types$1._do: return this.parseDoStatement(node)
      case types$1._for: return this.parseForStatement(node)
      case types$1._function:
        // Function as sole body of either an if statement or a labeled statement
        // works, but not when it is part of a labeled statement that is the sole
        // body of an if statement.
        if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
        return this.parseFunctionStatement(node, false, !context)
      case types$1._class:
        if (context) { this.unexpected(); }
        return this.parseClass(node, true)
      case types$1._if: return this.parseIfStatement(node)
      case types$1._return: return this.parseReturnStatement(node)
      case types$1._switch: return this.parseSwitchStatement(node)
      case types$1._throw: return this.parseThrowStatement(node)
      case types$1._try: return this.parseTryStatement(node)
      case types$1._const: case types$1._var:
        kind = kind || this.value;
        if (context && kind !== "var") { this.unexpected(); }
        return this.parseVarStatement(node, kind)
      case types$1._while: return this.parseWhileStatement(node)
      case types$1._with: return this.parseWithStatement(node)
      case types$1.braceL: return this.parseBlock(true, node)
      case types$1.semi: return this.parseEmptyStatement(node)
      case types$1._export:
      case types$1._import:
        if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
          skipWhiteSpace.lastIndex = this.pos;
          var skip = skipWhiteSpace.exec(this.input);
          var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
          if (nextCh === 40 || nextCh === 46) // '(' or '.'
            { return this.parseExpressionStatement(node, this.parseExpression()) }
        }

        if (!this.options.allowImportExportEverywhere) {
          if (!topLevel)
            { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
          if (!this.inModule)
            { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
        }
        return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)

        // If the statement does not start with a statement keyword or a
        // brace, it's an ExpressionStatement or LabeledStatement. We
        // simply start parsing an expression, and afterwards, if the
        // next token is a colon and the expression was a simple
        // Identifier node, we switch to interpreting it as a label.
      default:
        if (this.isAsyncFunction()) {
          if (context) { this.unexpected(); }
          this.next();
          return this.parseFunctionStatement(node, true, !context)
        }

        var maybeName = this.value, expr = this.parseExpression();
        if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
          { return this.parseLabeledStatement(node, maybeName, expr, context) }
        else { return this.parseExpressionStatement(node, expr) }
      }
    };

    pp$8.parseBreakContinueStatement = function(node, keyword) {
      var isBreak = keyword === "break";
      this.next();
      if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
      else if (this.type !== types$1.name) { this.unexpected(); }
      else {
        node.label = this.parseIdent();
        this.semicolon();
      }

      // Verify that there is an actual destination to break or
      // continue to.
      var i = 0;
      for (; i < this.labels.length; ++i) {
        var lab = this.labels[i];
        if (node.label == null || lab.name === node.label.name) {
          if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
          if (node.label && isBreak) { break }
        }
      }
      if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
      return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
    };

    pp$8.parseDebuggerStatement = function(node) {
      this.next();
      this.semicolon();
      return this.finishNode(node, "DebuggerStatement")
    };

    pp$8.parseDoStatement = function(node) {
      this.next();
      this.labels.push(loopLabel);
      node.body = this.parseStatement("do");
      this.labels.pop();
      this.expect(types$1._while);
      node.test = this.parseParenExpression();
      if (this.options.ecmaVersion >= 6)
        { this.eat(types$1.semi); }
      else
        { this.semicolon(); }
      return this.finishNode(node, "DoWhileStatement")
    };

    // Disambiguating between a `for` and a `for`/`in` or `for`/`of`
    // loop is non-trivial. Basically, we have to parse the init `var`
    // statement or expression, disallowing the `in` operator (see
    // the second parameter to `parseExpression`), and then check
    // whether the next token is `in` or `of`. When there is no init
    // part (semicolon immediately after the opening parenthesis), it
    // is a regular `for` loop.

    pp$8.parseForStatement = function(node) {
      this.next();
      var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
      this.labels.push(loopLabel);
      this.enterScope(0);
      this.expect(types$1.parenL);
      if (this.type === types$1.semi) {
        if (awaitAt > -1) { this.unexpected(awaitAt); }
        return this.parseFor(node, null)
      }
      var isLet = this.isLet();
      if (this.type === types$1._var || this.type === types$1._const || isLet) {
        var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
        this.next();
        this.parseVar(init$1, true, kind);
        this.finishNode(init$1, "VariableDeclaration");
        if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
          if (this.options.ecmaVersion >= 9) {
            if (this.type === types$1._in) {
              if (awaitAt > -1) { this.unexpected(awaitAt); }
            } else { node.await = awaitAt > -1; }
          }
          return this.parseForIn(node, init$1)
        }
        if (awaitAt > -1) { this.unexpected(awaitAt); }
        return this.parseFor(node, init$1)
      }
      var startsWithLet = this.isContextual("let"), isForOf = false;
      var refDestructuringErrors = new DestructuringErrors;
      var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
      if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
        if (this.options.ecmaVersion >= 9) {
          if (this.type === types$1._in) {
            if (awaitAt > -1) { this.unexpected(awaitAt); }
          } else { node.await = awaitAt > -1; }
        }
        if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
        this.toAssignable(init, false, refDestructuringErrors);
        this.checkLValPattern(init);
        return this.parseForIn(node, init)
      } else {
        this.checkExpressionErrors(refDestructuringErrors, true);
      }
      if (awaitAt > -1) { this.unexpected(awaitAt); }
      return this.parseFor(node, init)
    };

    pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
      this.next();
      return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
    };

    pp$8.parseIfStatement = function(node) {
      this.next();
      node.test = this.parseParenExpression();
      // allow function declarations in branches, but only in non-strict mode
      node.consequent = this.parseStatement("if");
      node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
      return this.finishNode(node, "IfStatement")
    };

    pp$8.parseReturnStatement = function(node) {
      if (!this.inFunction && !this.options.allowReturnOutsideFunction)
        { this.raise(this.start, "'return' outside of function"); }
      this.next();

      // In `return` (and `break`/`continue`), the keywords with
      // optional arguments, we eagerly look for a semicolon or the
      // possibility to insert one.

      if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
      else { node.argument = this.parseExpression(); this.semicolon(); }
      return this.finishNode(node, "ReturnStatement")
    };

    pp$8.parseSwitchStatement = function(node) {
      this.next();
      node.discriminant = this.parseParenExpression();
      node.cases = [];
      this.expect(types$1.braceL);
      this.labels.push(switchLabel);
      this.enterScope(0);

      // Statements under must be grouped (by label) in SwitchCase
      // nodes. `cur` is used to keep the node that we are currently
      // adding statements to.

      var cur;
      for (var sawDefault = false; this.type !== types$1.braceR;) {
        if (this.type === types$1._case || this.type === types$1._default) {
          var isCase = this.type === types$1._case;
          if (cur) { this.finishNode(cur, "SwitchCase"); }
          node.cases.push(cur = this.startNode());
          cur.consequent = [];
          this.next();
          if (isCase) {
            cur.test = this.parseExpression();
          } else {
            if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
            sawDefault = true;
            cur.test = null;
          }
          this.expect(types$1.colon);
        } else {
          if (!cur) { this.unexpected(); }
          cur.consequent.push(this.parseStatement(null));
        }
      }
      this.exitScope();
      if (cur) { this.finishNode(cur, "SwitchCase"); }
      this.next(); // Closing brace
      this.labels.pop();
      return this.finishNode(node, "SwitchStatement")
    };

    pp$8.parseThrowStatement = function(node) {
      this.next();
      if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
        { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
      node.argument = this.parseExpression();
      this.semicolon();
      return this.finishNode(node, "ThrowStatement")
    };

    // Reused empty array added for node fields that are always empty.

    var empty$1 = [];

    pp$8.parseTryStatement = function(node) {
      this.next();
      node.block = this.parseBlock();
      node.handler = null;
      if (this.type === types$1._catch) {
        var clause = this.startNode();
        this.next();
        if (this.eat(types$1.parenL)) {
          clause.param = this.parseBindingAtom();
          var simple = clause.param.type === "Identifier";
          this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
          this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
          this.expect(types$1.parenR);
        } else {
          if (this.options.ecmaVersion < 10) { this.unexpected(); }
          clause.param = null;
          this.enterScope(0);
        }
        clause.body = this.parseBlock(false);
        this.exitScope();
        node.handler = this.finishNode(clause, "CatchClause");
      }
      node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
      if (!node.handler && !node.finalizer)
        { this.raise(node.start, "Missing catch or finally clause"); }
      return this.finishNode(node, "TryStatement")
    };

    pp$8.parseVarStatement = function(node, kind) {
      this.next();
      this.parseVar(node, false, kind);
      this.semicolon();
      return this.finishNode(node, "VariableDeclaration")
    };

    pp$8.parseWhileStatement = function(node) {
      this.next();
      node.test = this.parseParenExpression();
      this.labels.push(loopLabel);
      node.body = this.parseStatement("while");
      this.labels.pop();
      return this.finishNode(node, "WhileStatement")
    };

    pp$8.parseWithStatement = function(node) {
      if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
      this.next();
      node.object = this.parseParenExpression();
      node.body = this.parseStatement("with");
      return this.finishNode(node, "WithStatement")
    };

    pp$8.parseEmptyStatement = function(node) {
      this.next();
      return this.finishNode(node, "EmptyStatement")
    };

    pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
      for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
        {
        var label = list[i$1];

        if (label.name === maybeName)
          { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
      } }
      var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
      for (var i = this.labels.length - 1; i >= 0; i--) {
        var label$1 = this.labels[i];
        if (label$1.statementStart === node.start) {
          // Update information about previous labels on this node
          label$1.statementStart = this.start;
          label$1.kind = kind;
        } else { break }
      }
      this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
      node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
      this.labels.pop();
      node.label = expr;
      return this.finishNode(node, "LabeledStatement")
    };

    pp$8.parseExpressionStatement = function(node, expr) {
      node.expression = expr;
      this.semicolon();
      return this.finishNode(node, "ExpressionStatement")
    };

    // Parse a semicolon-enclosed block of statements, handling `"use
    // strict"` declarations when `allowStrict` is true (used for
    // function bodies).

    pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
      if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
      if ( node === void 0 ) node = this.startNode();

      node.body = [];
      this.expect(types$1.braceL);
      if (createNewLexicalScope) { this.enterScope(0); }
      while (this.type !== types$1.braceR) {
        var stmt = this.parseStatement(null);
        node.body.push(stmt);
      }
      if (exitStrict) { this.strict = false; }
      this.next();
      if (createNewLexicalScope) { this.exitScope(); }
      return this.finishNode(node, "BlockStatement")
    };

    // Parse a regular `for` loop. The disambiguation code in
    // `parseStatement` will already have parsed the init statement or
    // expression.

    pp$8.parseFor = function(node, init) {
      node.init = init;
      this.expect(types$1.semi);
      node.test = this.type === types$1.semi ? null : this.parseExpression();
      this.expect(types$1.semi);
      node.update = this.type === types$1.parenR ? null : this.parseExpression();
      this.expect(types$1.parenR);
      node.body = this.parseStatement("for");
      this.exitScope();
      this.labels.pop();
      return this.finishNode(node, "ForStatement")
    };

    // Parse a `for`/`in` and `for`/`of` loop, which are almost
    // same from parser's perspective.

    pp$8.parseForIn = function(node, init) {
      var isForIn = this.type === types$1._in;
      this.next();

      if (
        init.type === "VariableDeclaration" &&
        init.declarations[0].init != null &&
        (
          !isForIn ||
          this.options.ecmaVersion < 8 ||
          this.strict ||
          init.kind !== "var" ||
          init.declarations[0].id.type !== "Identifier"
        )
      ) {
        this.raise(
          init.start,
          ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
        );
      }
      node.left = init;
      node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
      this.expect(types$1.parenR);
      node.body = this.parseStatement("for");
      this.exitScope();
      this.labels.pop();
      return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
    };

    // Parse a list of variable declarations.

    pp$8.parseVar = function(node, isFor, kind) {
      node.declarations = [];
      node.kind = kind;
      for (;;) {
        var decl = this.startNode();
        this.parseVarId(decl, kind);
        if (this.eat(types$1.eq)) {
          decl.init = this.parseMaybeAssign(isFor);
        } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
          this.unexpected();
        } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
          this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
        } else {
          decl.init = null;
        }
        node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
        if (!this.eat(types$1.comma)) { break }
      }
      return node
    };

    pp$8.parseVarId = function(decl, kind) {
      decl.id = this.parseBindingAtom();
      this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
    };

    var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;

    // Parse a function declaration or literal (depending on the
    // `statement & FUNC_STATEMENT`).

    // Remove `allowExpressionBody` for 7.0.0, as it is only called with false
    pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
      this.initFunction(node);
      if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
        if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
          { this.unexpected(); }
        node.generator = this.eat(types$1.star);
      }
      if (this.options.ecmaVersion >= 8)
        { node.async = !!isAsync; }

      if (statement & FUNC_STATEMENT) {
        node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
        if (node.id && !(statement & FUNC_HANGING_STATEMENT))
          // If it is a regular function declaration in sloppy mode, then it is
          // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
          // mode depends on properties of the current scope (see
          // treatFunctionsAsVar).
          { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
      }

      var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
      this.yieldPos = 0;
      this.awaitPos = 0;
      this.awaitIdentPos = 0;
      this.enterScope(functionFlags(node.async, node.generator));

      if (!(statement & FUNC_STATEMENT))
        { node.id = this.type === types$1.name ? this.parseIdent() : null; }

      this.parseFunctionParams(node);
      this.parseFunctionBody(node, allowExpressionBody, false, forInit);

      this.yieldPos = oldYieldPos;
      this.awaitPos = oldAwaitPos;
      this.awaitIdentPos = oldAwaitIdentPos;
      return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
    };

    pp$8.parseFunctionParams = function(node) {
      this.expect(types$1.parenL);
      node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
      this.checkYieldAwaitInDefaultParams();
    };

    // Parse a class declaration or literal (depending on the
    // `isStatement` parameter).

    pp$8.parseClass = function(node, isStatement) {
      this.next();

      // ecma-262 14.6 Class Definitions
      // A class definition is always strict mode code.
      var oldStrict = this.strict;
      this.strict = true;

      this.parseClassId(node, isStatement);
      this.parseClassSuper(node);
      var privateNameMap = this.enterClassBody();
      var classBody = this.startNode();
      var hadConstructor = false;
      classBody.body = [];
      this.expect(types$1.braceL);
      while (this.type !== types$1.braceR) {
        var element = this.parseClassElement(node.superClass !== null);
        if (element) {
          classBody.body.push(element);
          if (element.type === "MethodDefinition" && element.kind === "constructor") {
            if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
            hadConstructor = true;
          } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
            this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
          }
        }
      }
      this.strict = oldStrict;
      this.next();
      node.body = this.finishNode(classBody, "ClassBody");
      this.exitClassBody();
      return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
    };

    pp$8.parseClassElement = function(constructorAllowsSuper) {
      if (this.eat(types$1.semi)) { return null }

      var ecmaVersion = this.options.ecmaVersion;
      var node = this.startNode();
      var keyName = "";
      var isGenerator = false;
      var isAsync = false;
      var kind = "method";
      var isStatic = false;

      if (this.eatContextual("static")) {
        // Parse static init block
        if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
          this.parseClassStaticBlock(node);
          return node
        }
        if (this.isClassElementNameStart() || this.type === types$1.star) {
          isStatic = true;
        } else {
          keyName = "static";
        }
      }
      node.static = isStatic;
      if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
        if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
          isAsync = true;
        } else {
          keyName = "async";
        }
      }
      if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
        isGenerator = true;
      }
      if (!keyName && !isAsync && !isGenerator) {
        var lastValue = this.value;
        if (this.eatContextual("get") || this.eatContextual("set")) {
          if (this.isClassElementNameStart()) {
            kind = lastValue;
          } else {
            keyName = lastValue;
          }
        }
      }

      // Parse element name
      if (keyName) {
        // 'async', 'get', 'set', or 'static' were not a keyword contextually.
        // The last token is any of those. Make it the element name.
        node.computed = false;
        node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
        node.key.name = keyName;
        this.finishNode(node.key, "Identifier");
      } else {
        this.parseClassElementName(node);
      }

      // Parse element value
      if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
        var isConstructor = !node.static && checkKeyName(node, "constructor");
        var allowsDirectSuper = isConstructor && constructorAllowsSuper;
        // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
        if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
        node.kind = isConstructor ? "constructor" : kind;
        this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
      } else {
        this.parseClassField(node);
      }

      return node
    };

    pp$8.isClassElementNameStart = function() {
      return (
        this.type === types$1.name ||
        this.type === types$1.privateId ||
        this.type === types$1.num ||
        this.type === types$1.string ||
        this.type === types$1.bracketL ||
        this.type.keyword
      )
    };

    pp$8.parseClassElementName = function(element) {
      if (this.type === types$1.privateId) {
        if (this.value === "constructor") {
          this.raise(this.start, "Classes can't have an element named '#constructor'");
        }
        element.computed = false;
        element.key = this.parsePrivateIdent();
      } else {
        this.parsePropertyName(element);
      }
    };

    pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
      // Check key and flags
      var key = method.key;
      if (method.kind === "constructor") {
        if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
        if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
      } else if (method.static && checkKeyName(method, "prototype")) {
        this.raise(key.start, "Classes may not have a static property named prototype");
      }

      // Parse value
      var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);

      // Check value
      if (method.kind === "get" && value.params.length !== 0)
        { this.raiseRecoverable(value.start, "getter should have no params"); }
      if (method.kind === "set" && value.params.length !== 1)
        { this.raiseRecoverable(value.start, "setter should have exactly one param"); }
      if (method.kind === "set" && value.params[0].type === "RestElement")
        { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }

      return this.finishNode(method, "MethodDefinition")
    };

    pp$8.parseClassField = function(field) {
      if (checkKeyName(field, "constructor")) {
        this.raise(field.key.start, "Classes can't have a field named 'constructor'");
      } else if (field.static && checkKeyName(field, "prototype")) {
        this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
      }

      if (this.eat(types$1.eq)) {
        // To raise SyntaxError if 'arguments' exists in the initializer.
        var scope = this.currentThisScope();
        var inClassFieldInit = scope.inClassFieldInit;
        scope.inClassFieldInit = true;
        field.value = this.parseMaybeAssign();
        scope.inClassFieldInit = inClassFieldInit;
      } else {
        field.value = null;
      }
      this.semicolon();

      return this.finishNode(field, "PropertyDefinition")
    };

    pp$8.parseClassStaticBlock = function(node) {
      node.body = [];

      var oldLabels = this.labels;
      this.labels = [];
      this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
      while (this.type !== types$1.braceR) {
        var stmt = this.parseStatement(null);
        node.body.push(stmt);
      }
      this.next();
      this.exitScope();
      this.labels = oldLabels;

      return this.finishNode(node, "StaticBlock")
    };

    pp$8.parseClassId = function(node, isStatement) {
      if (this.type === types$1.name) {
        node.id = this.parseIdent();
        if (isStatement)
          { this.checkLValSimple(node.id, BIND_LEXICAL, false); }
      } else {
        if (isStatement === true)
          { this.unexpected(); }
        node.id = null;
      }
    };

    pp$8.parseClassSuper = function(node) {
      node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
    };

    pp$8.enterClassBody = function() {
      var element = {declared: Object.create(null), used: []};
      this.privateNameStack.push(element);
      return element.declared
    };

    pp$8.exitClassBody = function() {
      var ref = this.privateNameStack.pop();
      var declared = ref.declared;
      var used = ref.used;
      var len = this.privateNameStack.length;
      var parent = len === 0 ? null : this.privateNameStack[len - 1];
      for (var i = 0; i < used.length; ++i) {
        var id = used[i];
        if (!hasOwn(declared, id.name)) {
          if (parent) {
            parent.used.push(id);
          } else {
            this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
          }
        }
      }
    };

    function isPrivateNameConflicted(privateNameMap, element) {
      var name = element.key.name;
      var curr = privateNameMap[name];

      var next = "true";
      if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
        next = (element.static ? "s" : "i") + element.kind;
      }

      // `class { get #a(){}; static set #a(_){} }` is also conflict.
      if (
        curr === "iget" && next === "iset" ||
        curr === "iset" && next === "iget" ||
        curr === "sget" && next === "sset" ||
        curr === "sset" && next === "sget"
      ) {
        privateNameMap[name] = "true";
        return false
      } else if (!curr) {
        privateNameMap[name] = next;
        return false
      } else {
        return true
      }
    }

    function checkKeyName(node, name) {
      var computed = node.computed;
      var key = node.key;
      return !computed && (
        key.type === "Identifier" && key.name === name ||
        key.type === "Literal" && key.value === name
      )
    }

    // Parses module export declaration.

    pp$8.parseExport = function(node, exports) {
      this.next();
      // export * from '...'
      if (this.eat(types$1.star)) {
        if (this.options.ecmaVersion >= 11) {
          if (this.eatContextual("as")) {
            node.exported = this.parseModuleExportName();
            this.checkExport(exports, node.exported.name, this.lastTokStart);
          } else {
            node.exported = null;
          }
        }
        this.expectContextual("from");
        if (this.type !== types$1.string) { this.unexpected(); }
        node.source = this.parseExprAtom();
        this.semicolon();
        return this.finishNode(node, "ExportAllDeclaration")
      }
      if (this.eat(types$1._default)) { // export default ...
        this.checkExport(exports, "default", this.lastTokStart);
        var isAsync;
        if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
          var fNode = this.startNode();
          this.next();
          if (isAsync) { this.next(); }
          node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
        } else if (this.type === types$1._class) {
          var cNode = this.startNode();
          node.declaration = this.parseClass(cNode, "nullableID");
        } else {
          node.declaration = this.parseMaybeAssign();
          this.semicolon();
        }
        return this.finishNode(node, "ExportDefaultDeclaration")
      }
      // export var|const|let|function|class ...
      if (this.shouldParseExportStatement()) {
        node.declaration = this.parseStatement(null);
        if (node.declaration.type === "VariableDeclaration")
          { this.checkVariableExport(exports, node.declaration.declarations); }
        else
          { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
        node.specifiers = [];
        node.source = null;
      } else { // export { x, y as z } [from '...']
        node.declaration = null;
        node.specifiers = this.parseExportSpecifiers(exports);
        if (this.eatContextual("from")) {
          if (this.type !== types$1.string) { this.unexpected(); }
          node.source = this.parseExprAtom();
        } else {
          for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
            // check for keywords used as local names
            var spec = list[i];

            this.checkUnreserved(spec.local);
            // check if export is defined
            this.checkLocalExport(spec.local);

            if (spec.local.type === "Literal") {
              this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
            }
          }

          node.source = null;
        }
        this.semicolon();
      }
      return this.finishNode(node, "ExportNamedDeclaration")
    };

    pp$8.checkExport = function(exports, name, pos) {
      if (!exports) { return }
      if (hasOwn(exports, name))
        { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
      exports[name] = true;
    };

    pp$8.checkPatternExport = function(exports, pat) {
      var type = pat.type;
      if (type === "Identifier")
        { this.checkExport(exports, pat.name, pat.start); }
      else if (type === "ObjectPattern")
        { for (var i = 0, list = pat.properties; i < list.length; i += 1)
          {
            var prop = list[i];

            this.checkPatternExport(exports, prop);
          } }
      else if (type === "ArrayPattern")
        { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
          var elt = list$1[i$1];

            if (elt) { this.checkPatternExport(exports, elt); }
        } }
      else if (type === "Property")
        { this.checkPatternExport(exports, pat.value); }
      else if (type === "AssignmentPattern")
        { this.checkPatternExport(exports, pat.left); }
      else if (type === "RestElement")
        { this.checkPatternExport(exports, pat.argument); }
      else if (type === "ParenthesizedExpression")
        { this.checkPatternExport(exports, pat.expression); }
    };

    pp$8.checkVariableExport = function(exports, decls) {
      if (!exports) { return }
      for (var i = 0, list = decls; i < list.length; i += 1)
        {
        var decl = list[i];

        this.checkPatternExport(exports, decl.id);
      }
    };

    pp$8.shouldParseExportStatement = function() {
      return this.type.keyword === "var" ||
        this.type.keyword === "const" ||
        this.type.keyword === "class" ||
        this.type.keyword === "function" ||
        this.isLet() ||
        this.isAsyncFunction()
    };

    // Parses a comma-separated list of module exports.

    pp$8.parseExportSpecifiers = function(exports) {
      var nodes = [], first = true;
      // export { x, y as z } [from '...']
      this.expect(types$1.braceL);
      while (!this.eat(types$1.braceR)) {
        if (!first) {
          this.expect(types$1.comma);
          if (this.afterTrailingComma(types$1.braceR)) { break }
        } else { first = false; }

        var node = this.startNode();
        node.local = this.parseModuleExportName();
        node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
        this.checkExport(
          exports,
          node.exported[node.exported.type === "Identifier" ? "name" : "value"],
          node.exported.start
        );
        nodes.push(this.finishNode(node, "ExportSpecifier"));
      }
      return nodes
    };

    // Parses import declaration.

    pp$8.parseImport = function(node) {
      this.next();
      // import '...'
      if (this.type === types$1.string) {
        node.specifiers = empty$1;
        node.source = this.parseExprAtom();
      } else {
        node.specifiers = this.parseImportSpecifiers();
        this.expectContextual("from");
        node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
      }
      this.semicolon();
      return this.finishNode(node, "ImportDeclaration")
    };

    // Parses a comma-separated list of module imports.

    pp$8.parseImportSpecifiers = function() {
      var nodes = [], first = true;
      if (this.type === types$1.name) {
        // import defaultObj, { x, y as z } from '...'
        var node = this.startNode();
        node.local = this.parseIdent();
        this.checkLValSimple(node.local, BIND_LEXICAL);
        nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
        if (!this.eat(types$1.comma)) { return nodes }
      }
      if (this.type === types$1.star) {
        var node$1 = this.startNode();
        this.next();
        this.expectContextual("as");
        node$1.local = this.parseIdent();
        this.checkLValSimple(node$1.local, BIND_LEXICAL);
        nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
        return nodes
      }
      this.expect(types$1.braceL);
      while (!this.eat(types$1.braceR)) {
        if (!first) {
          this.expect(types$1.comma);
          if (this.afterTrailingComma(types$1.braceR)) { break }
        } else { first = false; }

        var node$2 = this.startNode();
        node$2.imported = this.parseModuleExportName();
        if (this.eatContextual("as")) {
          node$2.local = this.parseIdent();
        } else {
          this.checkUnreserved(node$2.imported);
          node$2.local = node$2.imported;
        }
        this.checkLValSimple(node$2.local, BIND_LEXICAL);
        nodes.push(this.finishNode(node$2, "ImportSpecifier"));
      }
      return nodes
    };

    pp$8.parseModuleExportName = function() {
      if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
        var stringLiteral = this.parseLiteral(this.value);
        if (loneSurrogate.test(stringLiteral.value)) {
          this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
        }
        return stringLiteral
      }
      return this.parseIdent(true)
    };

    // Set `ExpressionStatement#directive` property for directive prologues.
    pp$8.adaptDirectivePrologue = function(statements) {
      for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
        statements[i].directive = statements[i].expression.raw.slice(1, -1);
      }
    };
    pp$8.isDirectiveCandidate = function(statement) {
      return (
        statement.type === "ExpressionStatement" &&
        statement.expression.type === "Literal" &&
        typeof statement.expression.value === "string" &&
        // Reject parenthesized strings.
        (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
      )
    };

    var pp$7 = Parser.prototype;

    // Convert existing expression atom to assignable pattern
    // if possible.

    pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
      if (this.options.ecmaVersion >= 6 && node) {
        switch (node.type) {
        case "Identifier":
          if (this.inAsync && node.name === "await")
            { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
          break

        case "ObjectPattern":
        case "ArrayPattern":
        case "AssignmentPattern":
        case "RestElement":
          break

        case "ObjectExpression":
          node.type = "ObjectPattern";
          if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
          for (var i = 0, list = node.properties; i < list.length; i += 1) {
            var prop = list[i];

          this.toAssignable(prop, isBinding);
            // Early error:
            //   AssignmentRestProperty[Yield, Await] :
            //     `...` DestructuringAssignmentTarget[Yield, Await]
            //
            //   It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
            if (
              prop.type === "RestElement" &&
              (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
            ) {
              this.raise(prop.argument.start, "Unexpected token");
            }
          }
          break

        case "Property":
          // AssignmentProperty has type === "Property"
          if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
          this.toAssignable(node.value, isBinding);
          break

        case "ArrayExpression":
          node.type = "ArrayPattern";
          if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
          this.toAssignableList(node.elements, isBinding);
          break

        case "SpreadElement":
          node.type = "RestElement";
          this.toAssignable(node.argument, isBinding);
          if (node.argument.type === "AssignmentPattern")
            { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
          break

        case "AssignmentExpression":
          if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
          node.type = "AssignmentPattern";
          delete node.operator;
          this.toAssignable(node.left, isBinding);
          break

        case "ParenthesizedExpression":
          this.toAssignable(node.expression, isBinding, refDestructuringErrors);
          break

        case "ChainExpression":
          this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
          break

        case "MemberExpression":
          if (!isBinding) { break }

        default:
          this.raise(node.start, "Assigning to rvalue");
        }
      } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
      return node
    };

    // Convert list of expression atoms to binding list.

    pp$7.toAssignableList = function(exprList, isBinding) {
      var end = exprList.length;
      for (var i = 0; i < end; i++) {
        var elt = exprList[i];
        if (elt) { this.toAssignable(elt, isBinding); }
      }
      if (end) {
        var last = exprList[end - 1];
        if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
          { this.unexpected(last.argument.start); }
      }
      return exprList
    };

    // Parses spread element.

    pp$7.parseSpread = function(refDestructuringErrors) {
      var node = this.startNode();
      this.next();
      node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
      return this.finishNode(node, "SpreadElement")
    };

    pp$7.parseRestBinding = function() {
      var node = this.startNode();
      this.next();

      // RestElement inside of a function parameter must be an identifier
      if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
        { this.unexpected(); }

      node.argument = this.parseBindingAtom();

      return this.finishNode(node, "RestElement")
    };

    // Parses lvalue (assignable) atom.

    pp$7.parseBindingAtom = function() {
      if (this.options.ecmaVersion >= 6) {
        switch (this.type) {
        case types$1.bracketL:
          var node = this.startNode();
          this.next();
          node.elements = this.parseBindingList(types$1.bracketR, true, true);
          return this.finishNode(node, "ArrayPattern")

        case types$1.braceL:
          return this.parseObj(true)
        }
      }
      return this.parseIdent()
    };

    pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
      var elts = [], first = true;
      while (!this.eat(close)) {
        if (first) { first = false; }
        else { this.expect(types$1.comma); }
        if (allowEmpty && this.type === types$1.comma) {
          elts.push(null);
        } else if (allowTrailingComma && this.afterTrailingComma(close)) {
          break
        } else if (this.type === types$1.ellipsis) {
          var rest = this.parseRestBinding();
          this.parseBindingListItem(rest);
          elts.push(rest);
          if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
          this.expect(close);
          break
        } else {
          var elem = this.parseMaybeDefault(this.start, this.startLoc);
          this.parseBindingListItem(elem);
          elts.push(elem);
        }
      }
      return elts
    };

    pp$7.parseBindingListItem = function(param) {
      return param
    };

    // Parses assignment pattern around given atom if possible.

    pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
      left = left || this.parseBindingAtom();
      if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
      var node = this.startNodeAt(startPos, startLoc);
      node.left = left;
      node.right = this.parseMaybeAssign();
      return this.finishNode(node, "AssignmentPattern")
    };

    // The following three functions all verify that a node is an lvalue —
    // something that can be bound, or assigned to. In order to do so, they perform
    // a variety of checks:
    //
    // - Check that none of the bound/assigned-to identifiers are reserved words.
    // - Record name declarations for bindings in the appropriate scope.
    // - Check duplicate argument names, if checkClashes is set.
    //
    // If a complex binding pattern is encountered (e.g., object and array
    // destructuring), the entire pattern is recursively checked.
    //
    // There are three versions of checkLVal*() appropriate for different
    // circumstances:
    //
    // - checkLValSimple() shall be used if the syntactic construct supports
    //   nothing other than identifiers and member expressions. Parenthesized
    //   expressions are also correctly handled. This is generally appropriate for
    //   constructs for which the spec says
    //
    //   > It is a Syntax Error if AssignmentTargetType of [the production] is not
    //   > simple.
    //
    //   It is also appropriate for checking if an identifier is valid and not
    //   defined elsewhere, like import declarations or function/class identifiers.
    //
    //   Examples where this is used include:
    //     a += …;
    //     import a from '…';
    //   where a is the node to be checked.
    //
    // - checkLValPattern() shall be used if the syntactic construct supports
    //   anything checkLValSimple() supports, as well as object and array
    //   destructuring patterns. This is generally appropriate for constructs for
    //   which the spec says
    //
    //   > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
    //   > an ArrayLiteral and AssignmentTargetType of [the production] is not
    //   > simple.
    //
    //   Examples where this is used include:
    //     (a = …);
    //     const a = …;
    //     try { … } catch (a) { … }
    //   where a is the node to be checked.
    //
    // - checkLValInnerPattern() shall be used if the syntactic construct supports
    //   anything checkLValPattern() supports, as well as default assignment
    //   patterns, rest elements, and other constructs that may appear within an
    //   object or array destructuring pattern.
    //
    //   As a special case, function parameters also use checkLValInnerPattern(),
    //   as they also support defaults and rest constructs.
    //
    // These functions deliberately support both assignment and binding constructs,
    // as the logic for both is exceedingly similar. If the node is the target of
    // an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
    // should be set to the appropriate BIND_* constant, like BIND_VAR or
    // BIND_LEXICAL.
    //
    // If the function is called with a non-BIND_NONE bindingType, then
    // additionally a checkClashes object may be specified to allow checking for
    // duplicate argument names. checkClashes is ignored if the provided construct
    // is an assignment (i.e., bindingType is BIND_NONE).

    pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
      if ( bindingType === void 0 ) bindingType = BIND_NONE;

      var isBind = bindingType !== BIND_NONE;

      switch (expr.type) {
      case "Identifier":
        if (this.strict && this.reservedWordsStrictBind.test(expr.name))
          { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
        if (isBind) {
          if (bindingType === BIND_LEXICAL && expr.name === "let")
            { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
          if (checkClashes) {
            if (hasOwn(checkClashes, expr.name))
              { this.raiseRecoverable(expr.start, "Argument name clash"); }
            checkClashes[expr.name] = true;
          }
          if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
        }
        break

      case "ChainExpression":
        this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
        break

      case "MemberExpression":
        if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); }
        break

      case "ParenthesizedExpression":
        if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); }
        return this.checkLValSimple(expr.expression, bindingType, checkClashes)

      default:
        this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
      }
    };

    pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
      if ( bindingType === void 0 ) bindingType = BIND_NONE;

      switch (expr.type) {
      case "ObjectPattern":
        for (var i = 0, list = expr.properties; i < list.length; i += 1) {
          var prop = list[i];

        this.checkLValInnerPattern(prop, bindingType, checkClashes);
        }
        break

      case "ArrayPattern":
        for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
          var elem = list$1[i$1];

        if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }
        }
        break

      default:
        this.checkLValSimple(expr, bindingType, checkClashes);
      }
    };

    pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
      if ( bindingType === void 0 ) bindingType = BIND_NONE;

      switch (expr.type) {
      case "Property":
        // AssignmentProperty has type === "Property"
        this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
        break

      case "AssignmentPattern":
        this.checkLValPattern(expr.left, bindingType, checkClashes);
        break

      case "RestElement":
        this.checkLValPattern(expr.argument, bindingType, checkClashes);
        break

      default:
        this.checkLValPattern(expr, bindingType, checkClashes);
      }
    };

    // The algorithm used to determine whether a regexp can appear at a

    var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
      this.token = token;
      this.isExpr = !!isExpr;
      this.preserveSpace = !!preserveSpace;
      this.override = override;
      this.generator = !!generator;
    };

    var types$2 = {
      b_stat: new TokContext("{", false),
      b_expr: new TokContext("{", true),
      b_tmpl: new TokContext("${", false),
      p_stat: new TokContext("(", false),
      p_expr: new TokContext("(", true),
      q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
      f_stat: new TokContext("function", false),
      f_expr: new TokContext("function", true),
      f_expr_gen: new TokContext("function", true, false, null, true),
      f_gen: new TokContext("function", false, false, null, true)
    };

    var pp$6 = Parser.prototype;

    pp$6.initialContext = function() {
      return [types$2.b_stat]
    };

    pp$6.curContext = function() {
      return this.context[this.context.length - 1]
    };

    pp$6.braceIsBlock = function(prevType) {
      var parent = this.curContext();
      if (parent === types$2.f_expr || parent === types$2.f_stat)
        { return true }
      if (prevType === types$1.colon && (parent === types$2.b_stat || parent === types$2.b_expr))
        { return !parent.isExpr }

      // The check for `tt.name && exprAllowed` detects whether we are
      // after a `yield` or `of` construct. See the `updateContext` for
      // `tt.name`.
      if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
        { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
      if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
        { return true }
      if (prevType === types$1.braceL)
        { return parent === types$2.b_stat }
      if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
        { return false }
      return !this.exprAllowed
    };

    pp$6.inGeneratorContext = function() {
      for (var i = this.context.length - 1; i >= 1; i--) {
        var context = this.context[i];
        if (context.token === "function")
          { return context.generator }
      }
      return false
    };

    pp$6.updateContext = function(prevType) {
      var update, type = this.type;
      if (type.keyword && prevType === types$1.dot)
        { this.exprAllowed = false; }
      else if (update = type.updateContext)
        { update.call(this, prevType); }
      else
        { this.exprAllowed = type.beforeExpr; }
    };

    // Used to handle egde case when token context could not be inferred correctly in tokenize phase
    pp$6.overrideContext = function(tokenCtx) {
      if (this.curContext() !== tokenCtx) {
        this.context[this.context.length - 1] = tokenCtx;
      }
    };

    // Token-specific context update code

    types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
      if (this.context.length === 1) {
        this.exprAllowed = true;
        return
      }
      var out = this.context.pop();
      if (out === types$2.b_stat && this.curContext().token === "function") {
        out = this.context.pop();
      }
      this.exprAllowed = !out.isExpr;
    };

    types$1.braceL.updateContext = function(prevType) {
      this.context.push(this.braceIsBlock(prevType) ? types$2.b_stat : types$2.b_expr);
      this.exprAllowed = true;
    };

    types$1.dollarBraceL.updateContext = function() {
      this.context.push(types$2.b_tmpl);
      this.exprAllowed = true;
    };

    types$1.parenL.updateContext = function(prevType) {
      var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
      this.context.push(statementParens ? types$2.p_stat : types$2.p_expr);
      this.exprAllowed = true;
    };

    types$1.incDec.updateContext = function() {
      // tokExprAllowed stays unchanged
    };

    types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
      if (prevType.beforeExpr && prevType !== types$1._else &&
          !(prevType === types$1.semi && this.curContext() !== types$2.p_stat) &&
          !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
          !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types$2.b_stat))
        { this.context.push(types$2.f_expr); }
      else
        { this.context.push(types$2.f_stat); }
      this.exprAllowed = false;
    };

    types$1.backQuote.updateContext = function() {
      if (this.curContext() === types$2.q_tmpl)
        { this.context.pop(); }
      else
        { this.context.push(types$2.q_tmpl); }
      this.exprAllowed = false;
    };

    types$1.star.updateContext = function(prevType) {
      if (prevType === types$1._function) {
        var index = this.context.length - 1;
        if (this.context[index] === types$2.f_expr)
          { this.context[index] = types$2.f_expr_gen; }
        else
          { this.context[index] = types$2.f_gen; }
      }
      this.exprAllowed = true;
    };

    types$1.name.updateContext = function(prevType) {
      var allowed = false;
      if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
        if (this.value === "of" && !this.exprAllowed ||
            this.value === "yield" && this.inGeneratorContext())
          { allowed = true; }
      }
      this.exprAllowed = allowed;
    };

    // A recursive descent parser operates by defining functions for all

    var pp$5 = Parser.prototype;

    // Check if property name clashes with already added.
    // Object/class getters and setters are not allowed to clash —
    // either with each other or with an init property — and in
    // strict mode, init properties are also not allowed to be repeated.

    pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
      if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
        { return }
      if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
        { return }
      var key = prop.key;
      var name;
      switch (key.type) {
      case "Identifier": name = key.name; break
      case "Literal": name = String(key.value); break
      default: return
      }
      var kind = prop.kind;
      if (this.options.ecmaVersion >= 6) {
        if (name === "__proto__" && kind === "init") {
          if (propHash.proto) {
            if (refDestructuringErrors) {
              if (refDestructuringErrors.doubleProto < 0) {
                refDestructuringErrors.doubleProto = key.start;
              }
            } else {
              this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
            }
          }
          propHash.proto = true;
        }
        return
      }
      name = "$" + name;
      var other = propHash[name];
      if (other) {
        var redefinition;
        if (kind === "init") {
          redefinition = this.strict && other.init || other.get || other.set;
        } else {
          redefinition = other.init || other[kind];
        }
        if (redefinition)
          { this.raiseRecoverable(key.start, "Redefinition of property"); }
      } else {
        other = propHash[name] = {
          init: false,
          get: false,
          set: false
        };
      }
      other[kind] = true;
    };

    // ### Expression parsing

    // These nest, from the most general expression type at the top to
    // 'atomic', nondivisible expression types at the bottom. Most of
    // the functions will simply let the function(s) below them parse,
    // and, *if* the syntactic construct they handle is present, wrap
    // the AST node that the inner parser gave them in another node.

    // Parse a full expression. The optional arguments are used to
    // forbid the `in` operator (in for loops initalization expressions)
    // and provide reference for storing '=' operator inside shorthand
    // property assignment in contexts where both object expression
    // and object pattern might appear (so it's possible to raise
    // delayed syntax error at correct position).

    pp$5.parseExpression = function(forInit, refDestructuringErrors) {
      var startPos = this.start, startLoc = this.startLoc;
      var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
      if (this.type === types$1.comma) {
        var node = this.startNodeAt(startPos, startLoc);
        node.expressions = [expr];
        while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
        return this.finishNode(node, "SequenceExpression")
      }
      return expr
    };

    // Parse an assignment expression. This includes applications of
    // operators like `+=`.

    pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
      if (this.isContextual("yield")) {
        if (this.inGenerator) { return this.parseYield(forInit) }
        // The tokenizer will assume an expression is allowed after
        // `yield`, but this isn't that kind of yield
        else { this.exprAllowed = false; }
      }

      var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
      if (refDestructuringErrors) {
        oldParenAssign = refDestructuringErrors.parenthesizedAssign;
        oldTrailingComma = refDestructuringErrors.trailingComma;
        oldDoubleProto = refDestructuringErrors.doubleProto;
        refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
      } else {
        refDestructuringErrors = new DestructuringErrors;
        ownDestructuringErrors = true;
      }

      var startPos = this.start, startLoc = this.startLoc;
      if (this.type === types$1.parenL || this.type === types$1.name) {
        this.potentialArrowAt = this.start;
        this.potentialArrowInForAwait = forInit === "await";
      }
      var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
      if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
      if (this.type.isAssign) {
        var node = this.startNodeAt(startPos, startLoc);
        node.operator = this.value;
        if (this.type === types$1.eq)
          { left = this.toAssignable(left, false, refDestructuringErrors); }
        if (!ownDestructuringErrors) {
          refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
        }
        if (refDestructuringErrors.shorthandAssign >= left.start)
          { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
        if (this.type === types$1.eq)
          { this.checkLValPattern(left); }
        else
          { this.checkLValSimple(left); }
        node.left = left;
        this.next();
        node.right = this.parseMaybeAssign(forInit);
        if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
        return this.finishNode(node, "AssignmentExpression")
      } else {
        if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
      }
      if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
      if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
      return left
    };

    // Parse a ternary conditional (`?:`) operator.

    pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
      var startPos = this.start, startLoc = this.startLoc;
      var expr = this.parseExprOps(forInit, refDestructuringErrors);
      if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
      if (this.eat(types$1.question)) {
        var node = this.startNodeAt(startPos, startLoc);
        node.test = expr;
        node.consequent = this.parseMaybeAssign();
        this.expect(types$1.colon);
        node.alternate = this.parseMaybeAssign(forInit);
        return this.finishNode(node, "ConditionalExpression")
      }
      return expr
    };

    // Start the precedence parser.

    pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
      var startPos = this.start, startLoc = this.startLoc;
      var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
      if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
      return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
    };

    // Parse binary operators with the operator precedence parsing
    // algorithm. `left` is the left-hand side of the operator.
    // `minPrec` provides context that allows the function to stop and
    // defer further parser to one of its callers when it encounters an
    // operator that has a lower precedence than the set it is parsing.

    pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
      var prec = this.type.binop;
      if (prec != null && (!forInit || this.type !== types$1._in)) {
        if (prec > minPrec) {
          var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
          var coalesce = this.type === types$1.coalesce;
          if (coalesce) {
            // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
            // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
            prec = types$1.logicalAND.binop;
          }
          var op = this.value;
          this.next();
          var startPos = this.start, startLoc = this.startLoc;
          var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
          var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
          if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
            this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
          }
          return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
        }
      }
      return left
    };

    pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
      if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
      var node = this.startNodeAt(startPos, startLoc);
      node.left = left;
      node.operator = op;
      node.right = right;
      return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
    };

    // Parse unary operators, both prefix and postfix.

    pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
      var startPos = this.start, startLoc = this.startLoc, expr;
      if (this.isContextual("await") && this.canAwait) {
        expr = this.parseAwait(forInit);
        sawUnary = true;
      } else if (this.type.prefix) {
        var node = this.startNode(), update = this.type === types$1.incDec;
        node.operator = this.value;
        node.prefix = true;
        this.next();
        node.argument = this.parseMaybeUnary(null, true, update, forInit);
        this.checkExpressionErrors(refDestructuringErrors, true);
        if (update) { this.checkLValSimple(node.argument); }
        else if (this.strict && node.operator === "delete" &&
                 node.argument.type === "Identifier")
          { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
        else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
          { this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
        else { sawUnary = true; }
        expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
      } else if (!sawUnary && this.type === types$1.privateId) {
        if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
        expr = this.parsePrivateIdent();
        // only could be private fields in 'in', such as #x in obj
        if (this.type !== types$1._in) { this.unexpected(); }
      } else {
        expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
        if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
        while (this.type.postfix && !this.canInsertSemicolon()) {
          var node$1 = this.startNodeAt(startPos, startLoc);
          node$1.operator = this.value;
          node$1.prefix = false;
          node$1.argument = expr;
          this.checkLValSimple(expr);
          this.next();
          expr = this.finishNode(node$1, "UpdateExpression");
        }
      }

      if (!incDec && this.eat(types$1.starstar)) {
        if (sawUnary)
          { this.unexpected(this.lastTokStart); }
        else
          { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) }
      } else {
        return expr
      }
    };

    function isPrivateFieldAccess(node) {
      return (
        node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
        node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
      )
    }

    // Parse call, dot, and `[]`-subscript expressions.

    pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
      var startPos = this.start, startLoc = this.startLoc;
      var expr = this.parseExprAtom(refDestructuringErrors, forInit);
      if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
        { return expr }
      var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
      if (refDestructuringErrors && result.type === "MemberExpression") {
        if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
        if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
        if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
      }
      return result
    };

    pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
      var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
          this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
          this.potentialArrowAt === base.start;
      var optionalChained = false;

      while (true) {
        var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);

        if (element.optional) { optionalChained = true; }
        if (element === base || element.type === "ArrowFunctionExpression") {
          if (optionalChained) {
            var chainNode = this.startNodeAt(startPos, startLoc);
            chainNode.expression = element;
            element = this.finishNode(chainNode, "ChainExpression");
          }
          return element
        }

        base = element;
      }
    };

    pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
      var optionalSupported = this.options.ecmaVersion >= 11;
      var optional = optionalSupported && this.eat(types$1.questionDot);
      if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }

      var computed = this.eat(types$1.bracketL);
      if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
        var node = this.startNodeAt(startPos, startLoc);
        node.object = base;
        if (computed) {
          node.property = this.parseExpression();
          this.expect(types$1.bracketR);
        } else if (this.type === types$1.privateId && base.type !== "Super") {
          node.property = this.parsePrivateIdent();
        } else {
          node.property = this.parseIdent(this.options.allowReserved !== "never");
        }
        node.computed = !!computed;
        if (optionalSupported) {
          node.optional = optional;
        }
        base = this.finishNode(node, "MemberExpression");
      } else if (!noCalls && this.eat(types$1.parenL)) {
        var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
        this.yieldPos = 0;
        this.awaitPos = 0;
        this.awaitIdentPos = 0;
        var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
        if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
          this.checkPatternErrors(refDestructuringErrors, false);
          this.checkYieldAwaitInDefaultParams();
          if (this.awaitIdentPos > 0)
            { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
          this.yieldPos = oldYieldPos;
          this.awaitPos = oldAwaitPos;
          this.awaitIdentPos = oldAwaitIdentPos;
          return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
        }
        this.checkExpressionErrors(refDestructuringErrors, true);
        this.yieldPos = oldYieldPos || this.yieldPos;
        this.awaitPos = oldAwaitPos || this.awaitPos;
        this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
        var node$1 = this.startNodeAt(startPos, startLoc);
        node$1.callee = base;
        node$1.arguments = exprList;
        if (optionalSupported) {
          node$1.optional = optional;
        }
        base = this.finishNode(node$1, "CallExpression");
      } else if (this.type === types$1.backQuote) {
        if (optional || optionalChained) {
          this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
        }
        var node$2 = this.startNodeAt(startPos, startLoc);
        node$2.tag = base;
        node$2.quasi = this.parseTemplate({isTagged: true});
        base = this.finishNode(node$2, "TaggedTemplateExpression");
      }
      return base
    };

    // Parse an atomic expression — either a single token that is an
    // expression, an expression started by a keyword like `function` or
    // `new`, or an expression wrapped in punctuation like `()`, `[]`,
    // or `{}`.

    pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
      // If a division operator appears in an expression position, the
      // tokenizer got confused, and we force it to read a regexp instead.
      if (this.type === types$1.slash) { this.readRegexp(); }

      var node, canBeArrow = this.potentialArrowAt === this.start;
      switch (this.type) {
      case types$1._super:
        if (!this.allowSuper)
          { this.raise(this.start, "'super' keyword outside a method"); }
        node = this.startNode();
        this.next();
        if (this.type === types$1.parenL && !this.allowDirectSuper)
          { this.raise(node.start, "super() call outside constructor of a subclass"); }
        // The `super` keyword can appear at below:
        // SuperProperty:
        //     super [ Expression ]
        //     super . IdentifierName
        // SuperCall:
        //     super ( Arguments )
        if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
          { this.unexpected(); }
        return this.finishNode(node, "Super")

      case types$1._this:
        node = this.startNode();
        this.next();
        return this.finishNode(node, "ThisExpression")

      case types$1.name:
        var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
        var id = this.parseIdent(false);
        if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
          this.overrideContext(types$2.f_expr);
          return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
        }
        if (canBeArrow && !this.canInsertSemicolon()) {
          if (this.eat(types$1.arrow))
            { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
          if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
              (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
            id = this.parseIdent(false);
            if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
              { this.unexpected(); }
            return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
          }
        }
        return id

      case types$1.regexp:
        var value = this.value;
        node = this.parseLiteral(value.value);
        node.regex = {pattern: value.pattern, flags: value.flags};
        return node

      case types$1.num: case types$1.string:
        return this.parseLiteral(this.value)

      case types$1._null: case types$1._true: case types$1._false:
        node = this.startNode();
        node.value = this.type === types$1._null ? null : this.type === types$1._true;
        node.raw = this.type.keyword;
        this.next();
        return this.finishNode(node, "Literal")

      case types$1.parenL:
        var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
        if (refDestructuringErrors) {
          if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
            { refDestructuringErrors.parenthesizedAssign = start; }
          if (refDestructuringErrors.parenthesizedBind < 0)
            { refDestructuringErrors.parenthesizedBind = start; }
        }
        return expr

      case types$1.bracketL:
        node = this.startNode();
        this.next();
        node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
        return this.finishNode(node, "ArrayExpression")

      case types$1.braceL:
        this.overrideContext(types$2.b_expr);
        return this.parseObj(false, refDestructuringErrors)

      case types$1._function:
        node = this.startNode();
        this.next();
        return this.parseFunction(node, 0)

      case types$1._class:
        return this.parseClass(this.startNode(), false)

      case types$1._new:
        return this.parseNew()

      case types$1.backQuote:
        return this.parseTemplate()

      case types$1._import:
        if (this.options.ecmaVersion >= 11) {
          return this.parseExprImport()
        } else {
          return this.unexpected()
        }

      default:
        this.unexpected();
      }
    };

    pp$5.parseExprImport = function() {
      var node = this.startNode();

      // Consume `import` as an identifier for `import.meta`.
      // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
      if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
      var meta = this.parseIdent(true);

      switch (this.type) {
      case types$1.parenL:
        return this.parseDynamicImport(node)
      case types$1.dot:
        node.meta = meta;
        return this.parseImportMeta(node)
      default:
        this.unexpected();
      }
    };

    pp$5.parseDynamicImport = function(node) {
      this.next(); // skip `(`

      // Parse node.source.
      node.source = this.parseMaybeAssign();

      // Verify ending.
      if (!this.eat(types$1.parenR)) {
        var errorPos = this.start;
        if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
          this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
        } else {
          this.unexpected(errorPos);
        }
      }

      return this.finishNode(node, "ImportExpression")
    };

    pp$5.parseImportMeta = function(node) {
      this.next(); // skip `.`

      var containsEsc = this.containsEsc;
      node.property = this.parseIdent(true);

      if (node.property.name !== "meta")
        { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
      if (containsEsc)
        { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
      if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
        { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }

      return this.finishNode(node, "MetaProperty")
    };

    pp$5.parseLiteral = function(value) {
      var node = this.startNode();
      node.value = value;
      node.raw = this.input.slice(this.start, this.end);
      if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
      this.next();
      return this.finishNode(node, "Literal")
    };

    pp$5.parseParenExpression = function() {
      this.expect(types$1.parenL);
      var val = this.parseExpression();
      this.expect(types$1.parenR);
      return val
    };

    pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
      var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
      if (this.options.ecmaVersion >= 6) {
        this.next();

        var innerStartPos = this.start, innerStartLoc = this.startLoc;
        var exprList = [], first = true, lastIsComma = false;
        var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
        this.yieldPos = 0;
        this.awaitPos = 0;
        // Do not save awaitIdentPos to allow checking awaits nested in parameters
        while (this.type !== types$1.parenR) {
          first ? first = false : this.expect(types$1.comma);
          if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
            lastIsComma = true;
            break
          } else if (this.type === types$1.ellipsis) {
            spreadStart = this.start;
            exprList.push(this.parseParenItem(this.parseRestBinding()));
            if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
            break
          } else {
            exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
          }
        }
        var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
        this.expect(types$1.parenR);

        if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
          this.checkPatternErrors(refDestructuringErrors, false);
          this.checkYieldAwaitInDefaultParams();
          this.yieldPos = oldYieldPos;
          this.awaitPos = oldAwaitPos;
          return this.parseParenArrowList(startPos, startLoc, exprList, forInit)
        }

        if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
        if (spreadStart) { this.unexpected(spreadStart); }
        this.checkExpressionErrors(refDestructuringErrors, true);
        this.yieldPos = oldYieldPos || this.yieldPos;
        this.awaitPos = oldAwaitPos || this.awaitPos;

        if (exprList.length > 1) {
          val = this.startNodeAt(innerStartPos, innerStartLoc);
          val.expressions = exprList;
          this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
        } else {
          val = exprList[0];
        }
      } else {
        val = this.parseParenExpression();
      }

      if (this.options.preserveParens) {
        var par = this.startNodeAt(startPos, startLoc);
        par.expression = val;
        return this.finishNode(par, "ParenthesizedExpression")
      } else {
        return val
      }
    };

    pp$5.parseParenItem = function(item) {
      return item
    };

    pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
      return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
    };

    // New's precedence is slightly tricky. It must allow its argument to
    // be a `[]` or dot subscript expression, but not a call — at least,
    // not without wrapping it in parentheses. Thus, it uses the noCalls
    // argument to parseSubscripts to prevent it from consuming the
    // argument list.

    var empty = [];

    pp$5.parseNew = function() {
      if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
      var node = this.startNode();
      var meta = this.parseIdent(true);
      if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
        node.meta = meta;
        var containsEsc = this.containsEsc;
        node.property = this.parseIdent(true);
        if (node.property.name !== "target")
          { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
        if (containsEsc)
          { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
        if (!this.allowNewDotTarget)
          { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
        return this.finishNode(node, "MetaProperty")
      }
      var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
      node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
      if (isImport && node.callee.type === "ImportExpression") {
        this.raise(startPos, "Cannot use new with import()");
      }
      if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
      else { node.arguments = empty; }
      return this.finishNode(node, "NewExpression")
    };

    // Parse template expression.

    pp$5.parseTemplateElement = function(ref) {
      var isTagged = ref.isTagged;

      var elem = this.startNode();
      if (this.type === types$1.invalidTemplate) {
        if (!isTagged) {
          this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
        }
        elem.value = {
          raw: this.value,
          cooked: null
        };
      } else {
        elem.value = {
          raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
          cooked: this.value
        };
      }
      this.next();
      elem.tail = this.type === types$1.backQuote;
      return this.finishNode(elem, "TemplateElement")
    };

    pp$5.parseTemplate = function(ref) {
      if ( ref === void 0 ) ref = {};
      var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;

      var node = this.startNode();
      this.next();
      node.expressions = [];
      var curElt = this.parseTemplateElement({isTagged: isTagged});
      node.quasis = [curElt];
      while (!curElt.tail) {
        if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
        this.expect(types$1.dollarBraceL);
        node.expressions.push(this.parseExpression());
        this.expect(types$1.braceR);
        node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
      }
      this.next();
      return this.finishNode(node, "TemplateLiteral")
    };

    pp$5.isAsyncProp = function(prop) {
      return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
        (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
        !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
    };

    // Parse an object literal or binding pattern.

    pp$5.parseObj = function(isPattern, refDestructuringErrors) {
      var node = this.startNode(), first = true, propHash = {};
      node.properties = [];
      this.next();
      while (!this.eat(types$1.braceR)) {
        if (!first) {
          this.expect(types$1.comma);
          if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
        } else { first = false; }

        var prop = this.parseProperty(isPattern, refDestructuringErrors);
        if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
        node.properties.push(prop);
      }
      return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
    };

    pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
      var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
      if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
        if (isPattern) {
          prop.argument = this.parseIdent(false);
          if (this.type === types$1.comma) {
            this.raise(this.start, "Comma is not permitted after the rest element");
          }
          return this.finishNode(prop, "RestElement")
        }
        // To disallow parenthesized identifier via `this.toAssignable()`.
        if (this.type === types$1.parenL && refDestructuringErrors) {
          if (refDestructuringErrors.parenthesizedAssign < 0) {
            refDestructuringErrors.parenthesizedAssign = this.start;
          }
          if (refDestructuringErrors.parenthesizedBind < 0) {
            refDestructuringErrors.parenthesizedBind = this.start;
          }
        }
        // Parse argument.
        prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
        // To disallow trailing comma via `this.toAssignable()`.
        if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
          refDestructuringErrors.trailingComma = this.start;
        }
        // Finish
        return this.finishNode(prop, "SpreadElement")
      }
      if (this.options.ecmaVersion >= 6) {
        prop.method = false;
        prop.shorthand = false;
        if (isPattern || refDestructuringErrors) {
          startPos = this.start;
          startLoc = this.startLoc;
        }
        if (!isPattern)
          { isGenerator = this.eat(types$1.star); }
      }
      var containsEsc = this.containsEsc;
      this.parsePropertyName(prop);
      if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
        isAsync = true;
        isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
        this.parsePropertyName(prop, refDestructuringErrors);
      } else {
        isAsync = false;
      }
      this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
      return this.finishNode(prop, "Property")
    };

    pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
      if ((isGenerator || isAsync) && this.type === types$1.colon)
        { this.unexpected(); }

      if (this.eat(types$1.colon)) {
        prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
        prop.kind = "init";
      } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
        if (isPattern) { this.unexpected(); }
        prop.kind = "init";
        prop.method = true;
        prop.value = this.parseMethod(isGenerator, isAsync);
      } else if (!isPattern && !containsEsc &&
                 this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
                 (prop.key.name === "get" || prop.key.name === "set") &&
                 (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
        if (isGenerator || isAsync) { this.unexpected(); }
        prop.kind = prop.key.name;
        this.parsePropertyName(prop);
        prop.value = this.parseMethod(false);
        var paramCount = prop.kind === "get" ? 0 : 1;
        if (prop.value.params.length !== paramCount) {
          var start = prop.value.start;
          if (prop.kind === "get")
            { this.raiseRecoverable(start, "getter should have no params"); }
          else
            { this.raiseRecoverable(start, "setter should have exactly one param"); }
        } else {
          if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
            { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
        }
      } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
        if (isGenerator || isAsync) { this.unexpected(); }
        this.checkUnreserved(prop.key);
        if (prop.key.name === "await" && !this.awaitIdentPos)
          { this.awaitIdentPos = startPos; }
        prop.kind = "init";
        if (isPattern) {
          prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
        } else if (this.type === types$1.eq && refDestructuringErrors) {
          if (refDestructuringErrors.shorthandAssign < 0)
            { refDestructuringErrors.shorthandAssign = this.start; }
          prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
        } else {
          prop.value = this.copyNode(prop.key);
        }
        prop.shorthand = true;
      } else { this.unexpected(); }
    };

    pp$5.parsePropertyName = function(prop) {
      if (this.options.ecmaVersion >= 6) {
        if (this.eat(types$1.bracketL)) {
          prop.computed = true;
          prop.key = this.parseMaybeAssign();
          this.expect(types$1.bracketR);
          return prop.key
        } else {
          prop.computed = false;
        }
      }
      return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
    };

    // Initialize empty function node.

    pp$5.initFunction = function(node) {
      node.id = null;
      if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
      if (this.options.ecmaVersion >= 8) { node.async = false; }
    };

    // Parse object or class method.

    pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
      var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;

      this.initFunction(node);
      if (this.options.ecmaVersion >= 6)
        { node.generator = isGenerator; }
      if (this.options.ecmaVersion >= 8)
        { node.async = !!isAsync; }

      this.yieldPos = 0;
      this.awaitPos = 0;
      this.awaitIdentPos = 0;
      this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));

      this.expect(types$1.parenL);
      node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
      this.checkYieldAwaitInDefaultParams();
      this.parseFunctionBody(node, false, true, false);

      this.yieldPos = oldYieldPos;
      this.awaitPos = oldAwaitPos;
      this.awaitIdentPos = oldAwaitIdentPos;
      return this.finishNode(node, "FunctionExpression")
    };

    // Parse arrow function expression with given parameters.

    pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
      var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;

      this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
      this.initFunction(node);
      if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }

      this.yieldPos = 0;
      this.awaitPos = 0;
      this.awaitIdentPos = 0;

      node.params = this.toAssignableList(params, true);
      this.parseFunctionBody(node, true, false, forInit);

      this.yieldPos = oldYieldPos;
      this.awaitPos = oldAwaitPos;
      this.awaitIdentPos = oldAwaitIdentPos;
      return this.finishNode(node, "ArrowFunctionExpression")
    };

    // Parse function body and check parameters.

    pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
      var isExpression = isArrowFunction && this.type !== types$1.braceL;
      var oldStrict = this.strict, useStrict = false;

      if (isExpression) {
        node.body = this.parseMaybeAssign(forInit);
        node.expression = true;
        this.checkParams(node, false);
      } else {
        var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
        if (!oldStrict || nonSimple) {
          useStrict = this.strictDirective(this.end);
          // If this is a strict mode function, verify that argument names
          // are not repeated, and it does not try to bind the words `eval`
          // or `arguments`.
          if (useStrict && nonSimple)
            { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
        }
        // Start a new scope with regard to labels and the `inFunction`
        // flag (restore them to their old value afterwards).
        var oldLabels = this.labels;
        this.labels = [];
        if (useStrict) { this.strict = true; }

        // Add the params to varDeclaredNames to ensure that an error is thrown
        // if a let/const declaration in the function clashes with one of the params.
        this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
        // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
        if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }
        node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
        node.expression = false;
        this.adaptDirectivePrologue(node.body.body);
        this.labels = oldLabels;
      }
      this.exitScope();
    };

    pp$5.isSimpleParamList = function(params) {
      for (var i = 0, list = params; i < list.length; i += 1)
        {
        var param = list[i];

        if (param.type !== "Identifier") { return false
      } }
      return true
    };

    // Checks function params for various disallowed patterns such as using "eval"
    // or "arguments" and duplicate parameters.

    pp$5.checkParams = function(node, allowDuplicates) {
      var nameHash = Object.create(null);
      for (var i = 0, list = node.params; i < list.length; i += 1)
        {
        var param = list[i];

        this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
      }
    };

    // Parses a comma-separated list of expressions, and returns them as
    // an array. `close` is the token type that ends the list, and
    // `allowEmpty` can be turned on to allow subsequent commas with
    // nothing in between them to be parsed as `null` (which is needed
    // for array literals).

    pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
      var elts = [], first = true;
      while (!this.eat(close)) {
        if (!first) {
          this.expect(types$1.comma);
          if (allowTrailingComma && this.afterTrailingComma(close)) { break }
        } else { first = false; }

        var elt = (void 0);
        if (allowEmpty && this.type === types$1.comma)
          { elt = null; }
        else if (this.type === types$1.ellipsis) {
          elt = this.parseSpread(refDestructuringErrors);
          if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
            { refDestructuringErrors.trailingComma = this.start; }
        } else {
          elt = this.parseMaybeAssign(false, refDestructuringErrors);
        }
        elts.push(elt);
      }
      return elts
    };

    pp$5.checkUnreserved = function(ref) {
      var start = ref.start;
      var end = ref.end;
      var name = ref.name;

      if (this.inGenerator && name === "yield")
        { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
      if (this.inAsync && name === "await")
        { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
      if (this.currentThisScope().inClassFieldInit && name === "arguments")
        { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
      if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
        { this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
      if (this.keywords.test(name))
        { this.raise(start, ("Unexpected keyword '" + name + "'")); }
      if (this.options.ecmaVersion < 6 &&
        this.input.slice(start, end).indexOf("\\") !== -1) { return }
      var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
      if (re.test(name)) {
        if (!this.inAsync && name === "await")
          { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
        this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
      }
    };

    // Parse the next token as an identifier. If `liberal` is true (used
    // when parsing properties), it will also convert keywords into
    // identifiers.

    pp$5.parseIdent = function(liberal, isBinding) {
      var node = this.startNode();
      if (this.type === types$1.name) {
        node.name = this.value;
      } else if (this.type.keyword) {
        node.name = this.type.keyword;

        // To fix https://github.com/acornjs/acorn/issues/575
        // `class` and `function` keywords push new context into this.context.
        // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
        // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
        if ((node.name === "class" || node.name === "function") &&
            (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
          this.context.pop();
        }
      } else {
        this.unexpected();
      }
      this.next(!!liberal);
      this.finishNode(node, "Identifier");
      if (!liberal) {
        this.checkUnreserved(node);
        if (node.name === "await" && !this.awaitIdentPos)
          { this.awaitIdentPos = node.start; }
      }
      return node
    };

    pp$5.parsePrivateIdent = function() {
      var node = this.startNode();
      if (this.type === types$1.privateId) {
        node.name = this.value;
      } else {
        this.unexpected();
      }
      this.next();
      this.finishNode(node, "PrivateIdentifier");

      // For validating existence
      if (this.privateNameStack.length === 0) {
        this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
      } else {
        this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
      }

      return node
    };

    // Parses yield expression inside generator.

    pp$5.parseYield = function(forInit) {
      if (!this.yieldPos) { this.yieldPos = this.start; }

      var node = this.startNode();
      this.next();
      if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
        node.delegate = false;
        node.argument = null;
      } else {
        node.delegate = this.eat(types$1.star);
        node.argument = this.parseMaybeAssign(forInit);
      }
      return this.finishNode(node, "YieldExpression")
    };

    pp$5.parseAwait = function(forInit) {
      if (!this.awaitPos) { this.awaitPos = this.start; }

      var node = this.startNode();
      this.next();
      node.argument = this.parseMaybeUnary(null, true, false, forInit);
      return this.finishNode(node, "AwaitExpression")
    };

    var pp$4 = Parser.prototype;

    // This function is used to raise exceptions on parse errors. It
    // takes an offset integer (into the current `input`) to indicate
    // the location of the error, attaches the position to the end
    // of the error message, and then raises a `SyntaxError` with that
    // message.

    pp$4.raise = function(pos, message) {
      var loc = getLineInfo(this.input, pos);
      message += " (" + loc.line + ":" + loc.column + ")";
      var err = new SyntaxError(message);
      err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
      throw err
    };

    pp$4.raiseRecoverable = pp$4.raise;

    pp$4.curPosition = function() {
      if (this.options.locations) {
        return new Position(this.curLine, this.pos - this.lineStart)
      }
    };

    var pp$3 = Parser.prototype;

    var Scope = function Scope(flags) {
      this.flags = flags;
      // A list of var-declared names in the current lexical scope
      this.var = [];
      // A list of lexically-declared names in the current lexical scope
      this.lexical = [];
      // A list of lexically-declared FunctionDeclaration names in the current lexical scope
      this.functions = [];
      // A switch to disallow the identifier reference 'arguments'
      this.inClassFieldInit = false;
    };

    // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.

    pp$3.enterScope = function(flags) {
      this.scopeStack.push(new Scope(flags));
    };

    pp$3.exitScope = function() {
      this.scopeStack.pop();
    };

    // The spec says:
    // > At the top level of a function, or script, function declarations are
    // > treated like var declarations rather than like lexical declarations.
    pp$3.treatFunctionsAsVarInScope = function(scope) {
      return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
    };

    pp$3.declareName = function(name, bindingType, pos) {
      var redeclared = false;
      if (bindingType === BIND_LEXICAL) {
        var scope = this.currentScope();
        redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
        scope.lexical.push(name);
        if (this.inModule && (scope.flags & SCOPE_TOP))
          { delete this.undefinedExports[name]; }
      } else if (bindingType === BIND_SIMPLE_CATCH) {
        var scope$1 = this.currentScope();
        scope$1.lexical.push(name);
      } else if (bindingType === BIND_FUNCTION) {
        var scope$2 = this.currentScope();
        if (this.treatFunctionsAsVar)
          { redeclared = scope$2.lexical.indexOf(name) > -1; }
        else
          { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
        scope$2.functions.push(name);
      } else {
        for (var i = this.scopeStack.length - 1; i >= 0; --i) {
          var scope$3 = this.scopeStack[i];
          if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
              !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
            redeclared = true;
            break
          }
          scope$3.var.push(name);
          if (this.inModule && (scope$3.flags & SCOPE_TOP))
            { delete this.undefinedExports[name]; }
          if (scope$3.flags & SCOPE_VAR) { break }
        }
      }
      if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
    };

    pp$3.checkLocalExport = function(id) {
      // scope.functions must be empty as Module code is always strict.
      if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
          this.scopeStack[0].var.indexOf(id.name) === -1) {
        this.undefinedExports[id.name] = id;
      }
    };

    pp$3.currentScope = function() {
      return this.scopeStack[this.scopeStack.length - 1]
    };

    pp$3.currentVarScope = function() {
      for (var i = this.scopeStack.length - 1;; i--) {
        var scope = this.scopeStack[i];
        if (scope.flags & SCOPE_VAR) { return scope }
      }
    };

    // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
    pp$3.currentThisScope = function() {
      for (var i = this.scopeStack.length - 1;; i--) {
        var scope = this.scopeStack[i];
        if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
      }
    };

    var Node = function Node(parser, pos, loc) {
      this.type = "";
      this.start = pos;
      this.end = 0;
      if (parser.options.locations)
        { this.loc = new SourceLocation(parser, loc); }
      if (parser.options.directSourceFile)
        { this.sourceFile = parser.options.directSourceFile; }
      if (parser.options.ranges)
        { this.range = [pos, 0]; }
    };

    // Start an AST node, attaching a start offset.

    var pp$2 = Parser.prototype;

    pp$2.startNode = function() {
      return new Node(this, this.start, this.startLoc)
    };

    pp$2.startNodeAt = function(pos, loc) {
      return new Node(this, pos, loc)
    };

    // Finish an AST node, adding `type` and `end` properties.

    function finishNodeAt(node, type, pos, loc) {
      node.type = type;
      node.end = pos;
      if (this.options.locations)
        { node.loc.end = loc; }
      if (this.options.ranges)
        { node.range[1] = pos; }
      return node
    }

    pp$2.finishNode = function(node, type) {
      return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
    };

    // Finish node at given position

    pp$2.finishNodeAt = function(node, type, pos, loc) {
      return finishNodeAt.call(this, node, type, pos, loc)
    };

    pp$2.copyNode = function(node) {
      var newNode = new Node(this, node.start, this.startLoc);
      for (var prop in node) { newNode[prop] = node[prop]; }
      return newNode
    };

    // This file contains Unicode properties extracted from the ECMAScript
    // specification. The lists are extracted like so:
    // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)

    // #table-binary-unicode-properties
    var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
    var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
    var ecma11BinaryProperties = ecma10BinaryProperties;
    var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
    var ecma13BinaryProperties = ecma12BinaryProperties;
    var unicodeBinaryProperties = {
      9: ecma9BinaryProperties,
      10: ecma10BinaryProperties,
      11: ecma11BinaryProperties,
      12: ecma12BinaryProperties,
      13: ecma13BinaryProperties
    };

    // #table-unicode-general-category-values
    var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";

    // #table-unicode-script-values
    var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
    var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
    var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
    var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
    var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
    var unicodeScriptValues = {
      9: ecma9ScriptValues,
      10: ecma10ScriptValues,
      11: ecma11ScriptValues,
      12: ecma12ScriptValues,
      13: ecma13ScriptValues
    };

    var data = {};
    function buildUnicodeData(ecmaVersion) {
      var d = data[ecmaVersion] = {
        binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
        nonBinary: {
          General_Category: wordsRegexp(unicodeGeneralCategoryValues),
          Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
        }
      };
      d.nonBinary.Script_Extensions = d.nonBinary.Script;

      d.nonBinary.gc = d.nonBinary.General_Category;
      d.nonBinary.sc = d.nonBinary.Script;
      d.nonBinary.scx = d.nonBinary.Script_Extensions;
    }

    for (var i = 0, list = [9, 10, 11, 12, 13]; i < list.length; i += 1) {
      var ecmaVersion = list[i];

      buildUnicodeData(ecmaVersion);
    }

    var pp$1 = Parser.prototype;

    var RegExpValidationState = function RegExpValidationState(parser) {
      this.parser = parser;
      this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
      this.unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion];
      this.source = "";
      this.flags = "";
      this.start = 0;
      this.switchU = false;
      this.switchN = false;
      this.pos = 0;
      this.lastIntValue = 0;
      this.lastStringValue = "";
      this.lastAssertionIsQuantifiable = false;
      this.numCapturingParens = 0;
      this.maxBackReference = 0;
      this.groupNames = [];
      this.backReferenceNames = [];
    };

    RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
      var unicode = flags.indexOf("u") !== -1;
      this.start = start | 0;
      this.source = pattern + "";
      this.flags = flags;
      this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
      this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
    };

    RegExpValidationState.prototype.raise = function raise (message) {
      this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
    };

    // If u flag is given, this returns the code point at the index (it combines a surrogate pair).
    // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
    RegExpValidationState.prototype.at = function at (i, forceU) {
        if ( forceU === void 0 ) forceU = false;

      var s = this.source;
      var l = s.length;
      if (i >= l) {
        return -1
      }
      var c = s.charCodeAt(i);
      if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
        return c
      }
      var next = s.charCodeAt(i + 1);
      return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
    };

    RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
        if ( forceU === void 0 ) forceU = false;

      var s = this.source;
      var l = s.length;
      if (i >= l) {
        return l
      }
      var c = s.charCodeAt(i), next;
      if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
          (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
        return i + 1
      }
      return i + 2
    };

    RegExpValidationState.prototype.current = function current (forceU) {
        if ( forceU === void 0 ) forceU = false;

      return this.at(this.pos, forceU)
    };

    RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
        if ( forceU === void 0 ) forceU = false;

      return this.at(this.nextIndex(this.pos, forceU), forceU)
    };

    RegExpValidationState.prototype.advance = function advance (forceU) {
        if ( forceU === void 0 ) forceU = false;

      this.pos = this.nextIndex(this.pos, forceU);
    };

    RegExpValidationState.prototype.eat = function eat (ch, forceU) {
        if ( forceU === void 0 ) forceU = false;

      if (this.current(forceU) === ch) {
        this.advance(forceU);
        return true
      }
      return false
    };

    function codePointToString$1(ch) {
      if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
      ch -= 0x10000;
      return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
    }

    /**
     * Validate the flags part of a given RegExpLiteral.
     *
     * @param {RegExpValidationState} state The state to validate RegExp.
     * @returns {void}
     */
    pp$1.validateRegExpFlags = function(state) {
      var validFlags = state.validFlags;
      var flags = state.flags;

      for (var i = 0; i < flags.length; i++) {
        var flag = flags.charAt(i);
        if (validFlags.indexOf(flag) === -1) {
          this.raise(state.start, "Invalid regular expression flag");
        }
        if (flags.indexOf(flag, i + 1) > -1) {
          this.raise(state.start, "Duplicate regular expression flag");
        }
      }
    };

    /**
     * Validate the pattern part of a given RegExpLiteral.
     *
     * @param {RegExpValidationState} state The state to validate RegExp.
     * @returns {void}
     */
    pp$1.validateRegExpPattern = function(state) {
      this.regexp_pattern(state);

      // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
      // parsing contains a |GroupName|, reparse with the goal symbol
      // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
      // exception if _P_ did not conform to the grammar, if any elements of _P_
      // were not matched by the parse, or if any Early Error conditions exist.
      if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
        state.switchN = true;
        this.regexp_pattern(state);
      }
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
    pp$1.regexp_pattern = function(state) {
      state.pos = 0;
      state.lastIntValue = 0;
      state.lastStringValue = "";
      state.lastAssertionIsQuantifiable = false;
      state.numCapturingParens = 0;
      state.maxBackReference = 0;
      state.groupNames.length = 0;
      state.backReferenceNames.length = 0;

      this.regexp_disjunction(state);

      if (state.pos !== state.source.length) {
        // Make the same messages as V8.
        if (state.eat(0x29 /* ) */)) {
          state.raise("Unmatched ')'");
        }
        if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
          state.raise("Lone quantifier brackets");
        }
      }
      if (state.maxBackReference > state.numCapturingParens) {
        state.raise("Invalid escape");
      }
      for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
        var name = list[i];

        if (state.groupNames.indexOf(name) === -1) {
          state.raise("Invalid named capture referenced");
        }
      }
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
    pp$1.regexp_disjunction = function(state) {
      this.regexp_alternative(state);
      while (state.eat(0x7C /* | */)) {
        this.regexp_alternative(state);
      }

      // Make the same message as V8.
      if (this.regexp_eatQuantifier(state, true)) {
        state.raise("Nothing to repeat");
      }
      if (state.eat(0x7B /* { */)) {
        state.raise("Lone quantifier brackets");
      }
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
    pp$1.regexp_alternative = function(state) {
      while (state.pos < state.source.length && this.regexp_eatTerm(state))
        { }
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
    pp$1.regexp_eatTerm = function(state) {
      if (this.regexp_eatAssertion(state)) {
        // Handle `QuantifiableAssertion Quantifier` alternative.
        // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
        // is a QuantifiableAssertion.
        if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
          // Make the same message as V8.
          if (state.switchU) {
            state.raise("Invalid quantifier");
          }
        }
        return true
      }

      if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
        this.regexp_eatQuantifier(state);
        return true
      }

      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
    pp$1.regexp_eatAssertion = function(state) {
      var start = state.pos;
      state.lastAssertionIsQuantifiable = false;

      // ^, $
      if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
        return true
      }

      // \b \B
      if (state.eat(0x5C /* \ */)) {
        if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
          return true
        }
        state.pos = start;
      }

      // Lookahead / Lookbehind
      if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
        var lookbehind = false;
        if (this.options.ecmaVersion >= 9) {
          lookbehind = state.eat(0x3C /* < */);
        }
        if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
          this.regexp_disjunction(state);
          if (!state.eat(0x29 /* ) */)) {
            state.raise("Unterminated group");
          }
          state.lastAssertionIsQuantifiable = !lookbehind;
          return true
        }
      }

      state.pos = start;
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
    pp$1.regexp_eatQuantifier = function(state, noError) {
      if ( noError === void 0 ) noError = false;

      if (this.regexp_eatQuantifierPrefix(state, noError)) {
        state.eat(0x3F /* ? */);
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
    pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
      return (
        state.eat(0x2A /* * */) ||
        state.eat(0x2B /* + */) ||
        state.eat(0x3F /* ? */) ||
        this.regexp_eatBracedQuantifier(state, noError)
      )
    };
    pp$1.regexp_eatBracedQuantifier = function(state, noError) {
      var start = state.pos;
      if (state.eat(0x7B /* { */)) {
        var min = 0, max = -1;
        if (this.regexp_eatDecimalDigits(state)) {
          min = state.lastIntValue;
          if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
            max = state.lastIntValue;
          }
          if (state.eat(0x7D /* } */)) {
            // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
            if (max !== -1 && max < min && !noError) {
              state.raise("numbers out of order in {} quantifier");
            }
            return true
          }
        }
        if (state.switchU && !noError) {
          state.raise("Incomplete quantifier");
        }
        state.pos = start;
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
    pp$1.regexp_eatAtom = function(state) {
      return (
        this.regexp_eatPatternCharacters(state) ||
        state.eat(0x2E /* . */) ||
        this.regexp_eatReverseSolidusAtomEscape(state) ||
        this.regexp_eatCharacterClass(state) ||
        this.regexp_eatUncapturingGroup(state) ||
        this.regexp_eatCapturingGroup(state)
      )
    };
    pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
      var start = state.pos;
      if (state.eat(0x5C /* \ */)) {
        if (this.regexp_eatAtomEscape(state)) {
          return true
        }
        state.pos = start;
      }
      return false
    };
    pp$1.regexp_eatUncapturingGroup = function(state) {
      var start = state.pos;
      if (state.eat(0x28 /* ( */)) {
        if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
          this.regexp_disjunction(state);
          if (state.eat(0x29 /* ) */)) {
            return true
          }
          state.raise("Unterminated group");
        }
        state.pos = start;
      }
      return false
    };
    pp$1.regexp_eatCapturingGroup = function(state) {
      if (state.eat(0x28 /* ( */)) {
        if (this.options.ecmaVersion >= 9) {
          this.regexp_groupSpecifier(state);
        } else if (state.current() === 0x3F /* ? */) {
          state.raise("Invalid group");
        }
        this.regexp_disjunction(state);
        if (state.eat(0x29 /* ) */)) {
          state.numCapturingParens += 1;
          return true
        }
        state.raise("Unterminated group");
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
    pp$1.regexp_eatExtendedAtom = function(state) {
      return (
        state.eat(0x2E /* . */) ||
        this.regexp_eatReverseSolidusAtomEscape(state) ||
        this.regexp_eatCharacterClass(state) ||
        this.regexp_eatUncapturingGroup(state) ||
        this.regexp_eatCapturingGroup(state) ||
        this.regexp_eatInvalidBracedQuantifier(state) ||
        this.regexp_eatExtendedPatternCharacter(state)
      )
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
    pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
      if (this.regexp_eatBracedQuantifier(state, true)) {
        state.raise("Nothing to repeat");
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
    pp$1.regexp_eatSyntaxCharacter = function(state) {
      var ch = state.current();
      if (isSyntaxCharacter(ch)) {
        state.lastIntValue = ch;
        state.advance();
        return true
      }
      return false
    };
    function isSyntaxCharacter(ch) {
      return (
        ch === 0x24 /* $ */ ||
        ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
        ch === 0x2E /* . */ ||
        ch === 0x3F /* ? */ ||
        ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
        ch >= 0x7B /* { */ && ch <= 0x7D /* } */
      )
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
    // But eat eager.
    pp$1.regexp_eatPatternCharacters = function(state) {
      var start = state.pos;
      var ch = 0;
      while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
        state.advance();
      }
      return state.pos !== start
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
    pp$1.regexp_eatExtendedPatternCharacter = function(state) {
      var ch = state.current();
      if (
        ch !== -1 &&
        ch !== 0x24 /* $ */ &&
        !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
        ch !== 0x2E /* . */ &&
        ch !== 0x3F /* ? */ &&
        ch !== 0x5B /* [ */ &&
        ch !== 0x5E /* ^ */ &&
        ch !== 0x7C /* | */
      ) {
        state.advance();
        return true
      }
      return false
    };

    // GroupSpecifier ::
    //   [empty]
    //   `?` GroupName
    pp$1.regexp_groupSpecifier = function(state) {
      if (state.eat(0x3F /* ? */)) {
        if (this.regexp_eatGroupName(state)) {
          if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
            state.raise("Duplicate capture group name");
          }
          state.groupNames.push(state.lastStringValue);
          return
        }
        state.raise("Invalid group");
      }
    };

    // GroupName ::
    //   `<` RegExpIdentifierName `>`
    // Note: this updates `state.lastStringValue` property with the eaten name.
    pp$1.regexp_eatGroupName = function(state) {
      state.lastStringValue = "";
      if (state.eat(0x3C /* < */)) {
        if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
          return true
        }
        state.raise("Invalid capture group name");
      }
      return false
    };

    // RegExpIdentifierName ::
    //   RegExpIdentifierStart
    //   RegExpIdentifierName RegExpIdentifierPart
    // Note: this updates `state.lastStringValue` property with the eaten name.
    pp$1.regexp_eatRegExpIdentifierName = function(state) {
      state.lastStringValue = "";
      if (this.regexp_eatRegExpIdentifierStart(state)) {
        state.lastStringValue += codePointToString$1(state.lastIntValue);
        while (this.regexp_eatRegExpIdentifierPart(state)) {
          state.lastStringValue += codePointToString$1(state.lastIntValue);
        }
        return true
      }
      return false
    };

    // RegExpIdentifierStart ::
    //   UnicodeIDStart
    //   `$`
    //   `_`
    //   `\` RegExpUnicodeEscapeSequence[+U]
    pp$1.regexp_eatRegExpIdentifierStart = function(state) {
      var start = state.pos;
      var forceU = this.options.ecmaVersion >= 11;
      var ch = state.current(forceU);
      state.advance(forceU);

      if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
        ch = state.lastIntValue;
      }
      if (isRegExpIdentifierStart(ch)) {
        state.lastIntValue = ch;
        return true
      }

      state.pos = start;
      return false
    };
    function isRegExpIdentifierStart(ch) {
      return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
    }

    // RegExpIdentifierPart ::
    //   UnicodeIDContinue
    //   `$`
    //   `_`
    //   `\` RegExpUnicodeEscapeSequence[+U]
    //   <ZWNJ>
    //   <ZWJ>
    pp$1.regexp_eatRegExpIdentifierPart = function(state) {
      var start = state.pos;
      var forceU = this.options.ecmaVersion >= 11;
      var ch = state.current(forceU);
      state.advance(forceU);

      if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
        ch = state.lastIntValue;
      }
      if (isRegExpIdentifierPart(ch)) {
        state.lastIntValue = ch;
        return true
      }

      state.pos = start;
      return false
    };
    function isRegExpIdentifierPart(ch) {
      return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
    pp$1.regexp_eatAtomEscape = function(state) {
      if (
        this.regexp_eatBackReference(state) ||
        this.regexp_eatCharacterClassEscape(state) ||
        this.regexp_eatCharacterEscape(state) ||
        (state.switchN && this.regexp_eatKGroupName(state))
      ) {
        return true
      }
      if (state.switchU) {
        // Make the same message as V8.
        if (state.current() === 0x63 /* c */) {
          state.raise("Invalid unicode escape");
        }
        state.raise("Invalid escape");
      }
      return false
    };
    pp$1.regexp_eatBackReference = function(state) {
      var start = state.pos;
      if (this.regexp_eatDecimalEscape(state)) {
        var n = state.lastIntValue;
        if (state.switchU) {
          // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
          if (n > state.maxBackReference) {
            state.maxBackReference = n;
          }
          return true
        }
        if (n <= state.numCapturingParens) {
          return true
        }
        state.pos = start;
      }
      return false
    };
    pp$1.regexp_eatKGroupName = function(state) {
      if (state.eat(0x6B /* k */)) {
        if (this.regexp_eatGroupName(state)) {
          state.backReferenceNames.push(state.lastStringValue);
          return true
        }
        state.raise("Invalid named reference");
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
    pp$1.regexp_eatCharacterEscape = function(state) {
      return (
        this.regexp_eatControlEscape(state) ||
        this.regexp_eatCControlLetter(state) ||
        this.regexp_eatZero(state) ||
        this.regexp_eatHexEscapeSequence(state) ||
        this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
        (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
        this.regexp_eatIdentityEscape(state)
      )
    };
    pp$1.regexp_eatCControlLetter = function(state) {
      var start = state.pos;
      if (state.eat(0x63 /* c */)) {
        if (this.regexp_eatControlLetter(state)) {
          return true
        }
        state.pos = start;
      }
      return false
    };
    pp$1.regexp_eatZero = function(state) {
      if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
        state.lastIntValue = 0;
        state.advance();
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
    pp$1.regexp_eatControlEscape = function(state) {
      var ch = state.current();
      if (ch === 0x74 /* t */) {
        state.lastIntValue = 0x09; /* \t */
        state.advance();
        return true
      }
      if (ch === 0x6E /* n */) {
        state.lastIntValue = 0x0A; /* \n */
        state.advance();
        return true
      }
      if (ch === 0x76 /* v */) {
        state.lastIntValue = 0x0B; /* \v */
        state.advance();
        return true
      }
      if (ch === 0x66 /* f */) {
        state.lastIntValue = 0x0C; /* \f */
        state.advance();
        return true
      }
      if (ch === 0x72 /* r */) {
        state.lastIntValue = 0x0D; /* \r */
        state.advance();
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
    pp$1.regexp_eatControlLetter = function(state) {
      var ch = state.current();
      if (isControlLetter(ch)) {
        state.lastIntValue = ch % 0x20;
        state.advance();
        return true
      }
      return false
    };
    function isControlLetter(ch) {
      return (
        (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
        (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
      )
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
    pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
      if ( forceU === void 0 ) forceU = false;

      var start = state.pos;
      var switchU = forceU || state.switchU;

      if (state.eat(0x75 /* u */)) {
        if (this.regexp_eatFixedHexDigits(state, 4)) {
          var lead = state.lastIntValue;
          if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
            var leadSurrogateEnd = state.pos;
            if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
              var trail = state.lastIntValue;
              if (trail >= 0xDC00 && trail <= 0xDFFF) {
                state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
                return true
              }
            }
            state.pos = leadSurrogateEnd;
            state.lastIntValue = lead;
          }
          return true
        }
        if (
          switchU &&
          state.eat(0x7B /* { */) &&
          this.regexp_eatHexDigits(state) &&
          state.eat(0x7D /* } */) &&
          isValidUnicode(state.lastIntValue)
        ) {
          return true
        }
        if (switchU) {
          state.raise("Invalid unicode escape");
        }
        state.pos = start;
      }

      return false
    };
    function isValidUnicode(ch) {
      return ch >= 0 && ch <= 0x10FFFF
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
    pp$1.regexp_eatIdentityEscape = function(state) {
      if (state.switchU) {
        if (this.regexp_eatSyntaxCharacter(state)) {
          return true
        }
        if (state.eat(0x2F /* / */)) {
          state.lastIntValue = 0x2F; /* / */
          return true
        }
        return false
      }

      var ch = state.current();
      if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
        state.lastIntValue = ch;
        state.advance();
        return true
      }

      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
    pp$1.regexp_eatDecimalEscape = function(state) {
      state.lastIntValue = 0;
      var ch = state.current();
      if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
        do {
          state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
          state.advance();
        } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
    pp$1.regexp_eatCharacterClassEscape = function(state) {
      var ch = state.current();

      if (isCharacterClassEscape(ch)) {
        state.lastIntValue = -1;
        state.advance();
        return true
      }

      if (
        state.switchU &&
        this.options.ecmaVersion >= 9 &&
        (ch === 0x50 /* P */ || ch === 0x70 /* p */)
      ) {
        state.lastIntValue = -1;
        state.advance();
        if (
          state.eat(0x7B /* { */) &&
          this.regexp_eatUnicodePropertyValueExpression(state) &&
          state.eat(0x7D /* } */)
        ) {
          return true
        }
        state.raise("Invalid property name");
      }

      return false
    };
    function isCharacterClassEscape(ch) {
      return (
        ch === 0x64 /* d */ ||
        ch === 0x44 /* D */ ||
        ch === 0x73 /* s */ ||
        ch === 0x53 /* S */ ||
        ch === 0x77 /* w */ ||
        ch === 0x57 /* W */
      )
    }

    // UnicodePropertyValueExpression ::
    //   UnicodePropertyName `=` UnicodePropertyValue
    //   LoneUnicodePropertyNameOrValue
    pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
      var start = state.pos;

      // UnicodePropertyName `=` UnicodePropertyValue
      if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
        var name = state.lastStringValue;
        if (this.regexp_eatUnicodePropertyValue(state)) {
          var value = state.lastStringValue;
          this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
          return true
        }
      }
      state.pos = start;

      // LoneUnicodePropertyNameOrValue
      if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
        var nameOrValue = state.lastStringValue;
        this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
        return true
      }
      return false
    };
    pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
      if (!hasOwn(state.unicodeProperties.nonBinary, name))
        { state.raise("Invalid property name"); }
      if (!state.unicodeProperties.nonBinary[name].test(value))
        { state.raise("Invalid property value"); }
    };
    pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
      if (!state.unicodeProperties.binary.test(nameOrValue))
        { state.raise("Invalid property name"); }
    };

    // UnicodePropertyName ::
    //   UnicodePropertyNameCharacters
    pp$1.regexp_eatUnicodePropertyName = function(state) {
      var ch = 0;
      state.lastStringValue = "";
      while (isUnicodePropertyNameCharacter(ch = state.current())) {
        state.lastStringValue += codePointToString$1(ch);
        state.advance();
      }
      return state.lastStringValue !== ""
    };
    function isUnicodePropertyNameCharacter(ch) {
      return isControlLetter(ch) || ch === 0x5F /* _ */
    }

    // UnicodePropertyValue ::
    //   UnicodePropertyValueCharacters
    pp$1.regexp_eatUnicodePropertyValue = function(state) {
      var ch = 0;
      state.lastStringValue = "";
      while (isUnicodePropertyValueCharacter(ch = state.current())) {
        state.lastStringValue += codePointToString$1(ch);
        state.advance();
      }
      return state.lastStringValue !== ""
    };
    function isUnicodePropertyValueCharacter(ch) {
      return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
    }

    // LoneUnicodePropertyNameOrValue ::
    //   UnicodePropertyValueCharacters
    pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
      return this.regexp_eatUnicodePropertyValue(state)
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
    pp$1.regexp_eatCharacterClass = function(state) {
      if (state.eat(0x5B /* [ */)) {
        state.eat(0x5E /* ^ */);
        this.regexp_classRanges(state);
        if (state.eat(0x5D /* ] */)) {
          return true
        }
        // Unreachable since it threw "unterminated regular expression" error before.
        state.raise("Unterminated character class");
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
    // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
    // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
    pp$1.regexp_classRanges = function(state) {
      while (this.regexp_eatClassAtom(state)) {
        var left = state.lastIntValue;
        if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
          var right = state.lastIntValue;
          if (state.switchU && (left === -1 || right === -1)) {
            state.raise("Invalid character class");
          }
          if (left !== -1 && right !== -1 && left > right) {
            state.raise("Range out of order in character class");
          }
        }
      }
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
    // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
    pp$1.regexp_eatClassAtom = function(state) {
      var start = state.pos;

      if (state.eat(0x5C /* \ */)) {
        if (this.regexp_eatClassEscape(state)) {
          return true
        }
        if (state.switchU) {
          // Make the same message as V8.
          var ch$1 = state.current();
          if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
            state.raise("Invalid class escape");
          }
          state.raise("Invalid escape");
        }
        state.pos = start;
      }

      var ch = state.current();
      if (ch !== 0x5D /* ] */) {
        state.lastIntValue = ch;
        state.advance();
        return true
      }

      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
    pp$1.regexp_eatClassEscape = function(state) {
      var start = state.pos;

      if (state.eat(0x62 /* b */)) {
        state.lastIntValue = 0x08; /* <BS> */
        return true
      }

      if (state.switchU && state.eat(0x2D /* - */)) {
        state.lastIntValue = 0x2D; /* - */
        return true
      }

      if (!state.switchU && state.eat(0x63 /* c */)) {
        if (this.regexp_eatClassControlLetter(state)) {
          return true
        }
        state.pos = start;
      }

      return (
        this.regexp_eatCharacterClassEscape(state) ||
        this.regexp_eatCharacterEscape(state)
      )
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
    pp$1.regexp_eatClassControlLetter = function(state) {
      var ch = state.current();
      if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
        state.lastIntValue = ch % 0x20;
        state.advance();
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
    pp$1.regexp_eatHexEscapeSequence = function(state) {
      var start = state.pos;
      if (state.eat(0x78 /* x */)) {
        if (this.regexp_eatFixedHexDigits(state, 2)) {
          return true
        }
        if (state.switchU) {
          state.raise("Invalid escape");
        }
        state.pos = start;
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
    pp$1.regexp_eatDecimalDigits = function(state) {
      var start = state.pos;
      var ch = 0;
      state.lastIntValue = 0;
      while (isDecimalDigit(ch = state.current())) {
        state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
        state.advance();
      }
      return state.pos !== start
    };
    function isDecimalDigit(ch) {
      return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
    pp$1.regexp_eatHexDigits = function(state) {
      var start = state.pos;
      var ch = 0;
      state.lastIntValue = 0;
      while (isHexDigit(ch = state.current())) {
        state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
        state.advance();
      }
      return state.pos !== start
    };
    function isHexDigit(ch) {
      return (
        (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
        (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
        (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
      )
    }
    function hexToInt(ch) {
      if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
        return 10 + (ch - 0x41 /* A */)
      }
      if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
        return 10 + (ch - 0x61 /* a */)
      }
      return ch - 0x30 /* 0 */
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
    // Allows only 0-377(octal) i.e. 0-255(decimal).
    pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
      if (this.regexp_eatOctalDigit(state)) {
        var n1 = state.lastIntValue;
        if (this.regexp_eatOctalDigit(state)) {
          var n2 = state.lastIntValue;
          if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
            state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
          } else {
            state.lastIntValue = n1 * 8 + n2;
          }
        } else {
          state.lastIntValue = n1;
        }
        return true
      }
      return false
    };

    // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
    pp$1.regexp_eatOctalDigit = function(state) {
      var ch = state.current();
      if (isOctalDigit(ch)) {
        state.lastIntValue = ch - 0x30; /* 0 */
        state.advance();
        return true
      }
      state.lastIntValue = 0;
      return false
    };
    function isOctalDigit(ch) {
      return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
    }

    // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
    // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
    // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
    pp$1.regexp_eatFixedHexDigits = function(state, length) {
      var start = state.pos;
      state.lastIntValue = 0;
      for (var i = 0; i < length; ++i) {
        var ch = state.current();
        if (!isHexDigit(ch)) {
          state.pos = start;
          return false
        }
        state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
        state.advance();
      }
      return true
    };

    // Object type used to represent tokens. Note that normally, tokens
    // simply exist as properties on the parser object. This is only
    // used for the onToken callback and the external tokenizer.

    var Token = function Token(p) {
      this.type = p.type;
      this.value = p.value;
      this.start = p.start;
      this.end = p.end;
      if (p.options.locations)
        { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
      if (p.options.ranges)
        { this.range = [p.start, p.end]; }
    };

    // ## Tokenizer

    var pp = Parser.prototype;

    // Move to the next token

    pp.next = function(ignoreEscapeSequenceInKeyword) {
      if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
        { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
      if (this.options.onToken)
        { this.options.onToken(new Token(this)); }

      this.lastTokEnd = this.end;
      this.lastTokStart = this.start;
      this.lastTokEndLoc = this.endLoc;
      this.lastTokStartLoc = this.startLoc;
      this.nextToken();
    };

    pp.getToken = function() {
      this.next();
      return new Token(this)
    };

    // If we're in an ES6 environment, make parsers iterable
    if (typeof Symbol !== "undefined")
      { pp[Symbol.iterator] = function() {
        var this$1$1 = this;

        return {
          next: function () {
            var token = this$1$1.getToken();
            return {
              done: token.type === types$1.eof,
              value: token
            }
          }
        }
      }; }

    // Toggle strict mode. Re-reads the next number or string to please
    // pedantic tests (`"use strict"; 010;` should fail).

    // Read a single token, updating the parser object's token-related
    // properties.

    pp.nextToken = function() {
      var curContext = this.curContext();
      if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }

      this.start = this.pos;
      if (this.options.locations) { this.startLoc = this.curPosition(); }
      if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }

      if (curContext.override) { return curContext.override(this) }
      else { this.readToken(this.fullCharCodeAtPos()); }
    };

    pp.readToken = function(code) {
      // Identifier or keyword. '\uXXXX' sequences are allowed in
      // identifiers, so '\' also dispatches to that.
      if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
        { return this.readWord() }

      return this.getTokenFromCode(code)
    };

    pp.fullCharCodeAtPos = function() {
      var code = this.input.charCodeAt(this.pos);
      if (code <= 0xd7ff || code >= 0xdc00) { return code }
      var next = this.input.charCodeAt(this.pos + 1);
      return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
    };

    pp.skipBlockComment = function() {
      var startLoc = this.options.onComment && this.curPosition();
      var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
      if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
      this.pos = end + 2;
      if (this.options.locations) {
        for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
          ++this.curLine;
          pos = this.lineStart = nextBreak;
        }
      }
      if (this.options.onComment)
        { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
                               startLoc, this.curPosition()); }
    };

    pp.skipLineComment = function(startSkip) {
      var start = this.pos;
      var startLoc = this.options.onComment && this.curPosition();
      var ch = this.input.charCodeAt(this.pos += startSkip);
      while (this.pos < this.input.length && !isNewLine(ch)) {
        ch = this.input.charCodeAt(++this.pos);
      }
      if (this.options.onComment)
        { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
                               startLoc, this.curPosition()); }
    };

    // Called at the start of the parse and after every token. Skips
    // whitespace and comments, and.

    pp.skipSpace = function() {
      loop: while (this.pos < this.input.length) {
        var ch = this.input.charCodeAt(this.pos);
        switch (ch) {
        case 32: case 160: // ' '
          ++this.pos;
          break
        case 13:
          if (this.input.charCodeAt(this.pos + 1) === 10) {
            ++this.pos;
          }
        case 10: case 8232: case 8233:
          ++this.pos;
          if (this.options.locations) {
            ++this.curLine;
            this.lineStart = this.pos;
          }
          break
        case 47: // '/'
          switch (this.input.charCodeAt(this.pos + 1)) {
          case 42: // '*'
            this.skipBlockComment();
            break
          case 47:
            this.skipLineComment(2);
            break
          default:
            break loop
          }
          break
        default:
          if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
            ++this.pos;
          } else {
            break loop
          }
        }
      }
    };

    // Called at the end of every token. Sets `end`, `val`, and
    // maintains `context` and `exprAllowed`, and skips the space after
    // the token, so that the next one's `start` will point at the
    // right position.

    pp.finishToken = function(type, val) {
      this.end = this.pos;
      if (this.options.locations) { this.endLoc = this.curPosition(); }
      var prevType = this.type;
      this.type = type;
      this.value = val;

      this.updateContext(prevType);
    };

    // ### Token reading

    // This is the function that is called to fetch the next token. It
    // is somewhat obscure, because it works in character codes rather
    // than characters, and because operator parsing has been inlined
    // into it.
    //
    // All in the name of speed.
    //
    pp.readToken_dot = function() {
      var next = this.input.charCodeAt(this.pos + 1);
      if (next >= 48 && next <= 57) { return this.readNumber(true) }
      var next2 = this.input.charCodeAt(this.pos + 2);
      if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
        this.pos += 3;
        return this.finishToken(types$1.ellipsis)
      } else {
        ++this.pos;
        return this.finishToken(types$1.dot)
      }
    };

    pp.readToken_slash = function() { // '/'
      var next = this.input.charCodeAt(this.pos + 1);
      if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
      if (next === 61) { return this.finishOp(types$1.assign, 2) }
      return this.finishOp(types$1.slash, 1)
    };

    pp.readToken_mult_modulo_exp = function(code) { // '%*'
      var next = this.input.charCodeAt(this.pos + 1);
      var size = 1;
      var tokentype = code === 42 ? types$1.star : types$1.modulo;

      // exponentiation operator ** and **=
      if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
        ++size;
        tokentype = types$1.starstar;
        next = this.input.charCodeAt(this.pos + 2);
      }

      if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
      return this.finishOp(tokentype, size)
    };

    pp.readToken_pipe_amp = function(code) { // '|&'
      var next = this.input.charCodeAt(this.pos + 1);
      if (next === code) {
        if (this.options.ecmaVersion >= 12) {
          var next2 = this.input.charCodeAt(this.pos + 2);
          if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
        }
        return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
      }
      if (next === 61) { return this.finishOp(types$1.assign, 2) }
      return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
    };

    pp.readToken_caret = function() { // '^'
      var next = this.input.charCodeAt(this.pos + 1);
      if (next === 61) { return this.finishOp(types$1.assign, 2) }
      return this.finishOp(types$1.bitwiseXOR, 1)
    };

    pp.readToken_plus_min = function(code) { // '+-'
      var next = this.input.charCodeAt(this.pos + 1);
      if (next === code) {
        if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
            (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
          // A `-->` line comment
          this.skipLineComment(3);
          this.skipSpace();
          return this.nextToken()
        }
        return this.finishOp(types$1.incDec, 2)
      }
      if (next === 61) { return this.finishOp(types$1.assign, 2) }
      return this.finishOp(types$1.plusMin, 1)
    };

    pp.readToken_lt_gt = function(code) { // '<>'
      var next = this.input.charCodeAt(this.pos + 1);
      var size = 1;
      if (next === code) {
        size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
        if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
        return this.finishOp(types$1.bitShift, size)
      }
      if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
          this.input.charCodeAt(this.pos + 3) === 45) {
        // `<!--`, an XML-style comment that should be interpreted as a line comment
        this.skipLineComment(4);
        this.skipSpace();
        return this.nextToken()
      }
      if (next === 61) { size = 2; }
      return this.finishOp(types$1.relational, size)
    };

    pp.readToken_eq_excl = function(code) { // '=!'
      var next = this.input.charCodeAt(this.pos + 1);
      if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
      if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
        this.pos += 2;
        return this.finishToken(types$1.arrow)
      }
      return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
    };

    pp.readToken_question = function() { // '?'
      var ecmaVersion = this.options.ecmaVersion;
      if (ecmaVersion >= 11) {
        var next = this.input.charCodeAt(this.pos + 1);
        if (next === 46) {
          var next2 = this.input.charCodeAt(this.pos + 2);
          if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
        }
        if (next === 63) {
          if (ecmaVersion >= 12) {
            var next2$1 = this.input.charCodeAt(this.pos + 2);
            if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
          }
          return this.finishOp(types$1.coalesce, 2)
        }
      }
      return this.finishOp(types$1.question, 1)
    };

    pp.readToken_numberSign = function() { // '#'
      var ecmaVersion = this.options.ecmaVersion;
      var code = 35; // '#'
      if (ecmaVersion >= 13) {
        ++this.pos;
        code = this.fullCharCodeAtPos();
        if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
          return this.finishToken(types$1.privateId, this.readWord1())
        }
      }

      this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
    };

    pp.getTokenFromCode = function(code) {
      switch (code) {
      // The interpretation of a dot depends on whether it is followed
      // by a digit or another two dots.
      case 46: // '.'
        return this.readToken_dot()

      // Punctuation tokens.
      case 40: ++this.pos; return this.finishToken(types$1.parenL)
      case 41: ++this.pos; return this.finishToken(types$1.parenR)
      case 59: ++this.pos; return this.finishToken(types$1.semi)
      case 44: ++this.pos; return this.finishToken(types$1.comma)
      case 91: ++this.pos; return this.finishToken(types$1.bracketL)
      case 93: ++this.pos; return this.finishToken(types$1.bracketR)
      case 123: ++this.pos; return this.finishToken(types$1.braceL)
      case 125: ++this.pos; return this.finishToken(types$1.braceR)
      case 58: ++this.pos; return this.finishToken(types$1.colon)

      case 96: // '`'
        if (this.options.ecmaVersion < 6) { break }
        ++this.pos;
        return this.finishToken(types$1.backQuote)

      case 48: // '0'
        var next = this.input.charCodeAt(this.pos + 1);
        if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number
        if (this.options.ecmaVersion >= 6) {
          if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number
          if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number
        }

      // Anything else beginning with a digit is an integer, octal
      // number, or float.
      case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
        return this.readNumber(false)

      // Quotes produce strings.
      case 34: case 39: // '"', "'"
        return this.readString(code)

      // Operators are parsed inline in tiny state machines. '=' (61) is
      // often referred to. `finishOp` simply skips the amount of
      // characters it is given as second argument, and returns a token
      // of the type given by its first argument.
      case 47: // '/'
        return this.readToken_slash()

      case 37: case 42: // '%*'
        return this.readToken_mult_modulo_exp(code)

      case 124: case 38: // '|&'
        return this.readToken_pipe_amp(code)

      case 94: // '^'
        return this.readToken_caret()

      case 43: case 45: // '+-'
        return this.readToken_plus_min(code)

      case 60: case 62: // '<>'
        return this.readToken_lt_gt(code)

      case 61: case 33: // '=!'
        return this.readToken_eq_excl(code)

      case 63: // '?'
        return this.readToken_question()

      case 126: // '~'
        return this.finishOp(types$1.prefix, 1)

      case 35: // '#'
        return this.readToken_numberSign()
      }

      this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
    };

    pp.finishOp = function(type, size) {
      var str = this.input.slice(this.pos, this.pos + size);
      this.pos += size;
      return this.finishToken(type, str)
    };

    pp.readRegexp = function() {
      var escaped, inClass, start = this.pos;
      for (;;) {
        if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
        var ch = this.input.charAt(this.pos);
        if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
        if (!escaped) {
          if (ch === "[") { inClass = true; }
          else if (ch === "]" && inClass) { inClass = false; }
          else if (ch === "/" && !inClass) { break }
          escaped = ch === "\\";
        } else { escaped = false; }
        ++this.pos;
      }
      var pattern = this.input.slice(start, this.pos);
      ++this.pos;
      var flagsStart = this.pos;
      var flags = this.readWord1();
      if (this.containsEsc) { this.unexpected(flagsStart); }

      // Validate pattern
      var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
      state.reset(start, pattern, flags);
      this.validateRegExpFlags(state);
      this.validateRegExpPattern(state);

      // Create Literal#value property value.
      var value = null;
      try {
        value = new RegExp(pattern, flags);
      } catch (e) {
        // ESTree requires null if it failed to instantiate RegExp object.
        // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
      }

      return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
    };

    // Read an integer in the given radix. Return null if zero digits
    // were read, the integer value otherwise. When `len` is given, this
    // will return `null` unless the integer has exactly `len` digits.

    pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
      // `len` is used for character escape sequences. In that case, disallow separators.
      var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;

      // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
      // and isn't fraction part nor exponent part. In that case, if the first digit
      // is zero then disallow separators.
      var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;

      var start = this.pos, total = 0, lastCode = 0;
      for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
        var code = this.input.charCodeAt(this.pos), val = (void 0);

        if (allowSeparators && code === 95) {
          if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
          if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
          if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
          lastCode = code;
          continue
        }

        if (code >= 97) { val = code - 97 + 10; } // a
        else if (code >= 65) { val = code - 65 + 10; } // A
        else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
        else { val = Infinity; }
        if (val >= radix) { break }
        lastCode = code;
        total = total * radix + val;
      }

      if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
      if (this.pos === start || len != null && this.pos - start !== len) { return null }

      return total
    };

    function stringToNumber(str, isLegacyOctalNumericLiteral) {
      if (isLegacyOctalNumericLiteral) {
        return parseInt(str, 8)
      }

      // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
      return parseFloat(str.replace(/_/g, ""))
    }

    function stringToBigInt(str) {
      if (typeof BigInt !== "function") {
        return null
      }

      // `BigInt(value)` throws syntax error if the string contains numeric separators.
      return BigInt(str.replace(/_/g, ""))
    }

    pp.readRadixNumber = function(radix) {
      var start = this.pos;
      this.pos += 2; // 0x
      var val = this.readInt(radix);
      if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
      if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
        val = stringToBigInt(this.input.slice(start, this.pos));
        ++this.pos;
      } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
      return this.finishToken(types$1.num, val)
    };

    // Read an integer, octal integer, or floating-point number.

    pp.readNumber = function(startsWithDot) {
      var start = this.pos;
      if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
      var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
      if (octal && this.strict) { this.raise(start, "Invalid number"); }
      var next = this.input.charCodeAt(this.pos);
      if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
        var val$1 = stringToBigInt(this.input.slice(start, this.pos));
        ++this.pos;
        if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
        return this.finishToken(types$1.num, val$1)
      }
      if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
      if (next === 46 && !octal) { // '.'
        ++this.pos;
        this.readInt(10);
        next = this.input.charCodeAt(this.pos);
      }
      if ((next === 69 || next === 101) && !octal) { // 'eE'
        next = this.input.charCodeAt(++this.pos);
        if (next === 43 || next === 45) { ++this.pos; } // '+-'
        if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
      }
      if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }

      var val = stringToNumber(this.input.slice(start, this.pos), octal);
      return this.finishToken(types$1.num, val)
    };

    // Read a string value, interpreting backslash-escapes.

    pp.readCodePoint = function() {
      var ch = this.input.charCodeAt(this.pos), code;

      if (ch === 123) { // '{'
        if (this.options.ecmaVersion < 6) { this.unexpected(); }
        var codePos = ++this.pos;
        code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
        ++this.pos;
        if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
      } else {
        code = this.readHexChar(4);
      }
      return code
    };

    function codePointToString(code) {
      // UTF-16 Decoding
      if (code <= 0xFFFF) { return String.fromCharCode(code) }
      code -= 0x10000;
      return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
    }

    pp.readString = function(quote) {
      var out = "", chunkStart = ++this.pos;
      for (;;) {
        if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
        var ch = this.input.charCodeAt(this.pos);
        if (ch === quote) { break }
        if (ch === 92) { // '\'
          out += this.input.slice(chunkStart, this.pos);
          out += this.readEscapedChar(false);
          chunkStart = this.pos;
        } else if (ch === 0x2028 || ch === 0x2029) {
          if (this.options.ecmaVersion < 10) { this.raise(this.start, "Unterminated string constant"); }
          ++this.pos;
          if (this.options.locations) {
            this.curLine++;
            this.lineStart = this.pos;
          }
        } else {
          if (isNewLine(ch)) { this.raise(this.start, "Unterminated string constant"); }
          ++this.pos;
        }
      }
      out += this.input.slice(chunkStart, this.pos++);
      return this.finishToken(types$1.string, out)
    };

    // Reads template string tokens.

    var INVALID_TEMPLATE_ESCAPE_ERROR = {};

    pp.tryReadTemplateToken = function() {
      this.inTemplateElement = true;
      try {
        this.readTmplToken();
      } catch (err) {
        if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
          this.readInvalidTemplateToken();
        } else {
          throw err
        }
      }

      this.inTemplateElement = false;
    };

    pp.invalidStringToken = function(position, message) {
      if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
        throw INVALID_TEMPLATE_ESCAPE_ERROR
      } else {
        this.raise(position, message);
      }
    };

    pp.readTmplToken = function() {
      var out = "", chunkStart = this.pos;
      for (;;) {
        if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
        var ch = this.input.charCodeAt(this.pos);
        if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
          if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
            if (ch === 36) {
              this.pos += 2;
              return this.finishToken(types$1.dollarBraceL)
            } else {
              ++this.pos;
              return this.finishToken(types$1.backQuote)
            }
          }
          out += this.input.slice(chunkStart, this.pos);
          return this.finishToken(types$1.template, out)
        }
        if (ch === 92) { // '\'
          out += this.input.slice(chunkStart, this.pos);
          out += this.readEscapedChar(true);
          chunkStart = this.pos;
        } else if (isNewLine(ch)) {
          out += this.input.slice(chunkStart, this.pos);
          ++this.pos;
          switch (ch) {
          case 13:
            if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
          case 10:
            out += "\n";
            break
          default:
            out += String.fromCharCode(ch);
            break
          }
          if (this.options.locations) {
            ++this.curLine;
            this.lineStart = this.pos;
          }
          chunkStart = this.pos;
        } else {
          ++this.pos;
        }
      }
    };

    // Reads a template token to search for the end, without validating any escape sequences
    pp.readInvalidTemplateToken = function() {
      for (; this.pos < this.input.length; this.pos++) {
        switch (this.input[this.pos]) {
        case "\\":
          ++this.pos;
          break

        case "$":
          if (this.input[this.pos + 1] !== "{") {
            break
          }

        // falls through
        case "`":
          return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))

        // no default
        }
      }
      this.raise(this.start, "Unterminated template");
    };

    // Used to read escaped characters

    pp.readEscapedChar = function(inTemplate) {
      var ch = this.input.charCodeAt(++this.pos);
      ++this.pos;
      switch (ch) {
      case 110: return "\n" // 'n' -> '\n'
      case 114: return "\r" // 'r' -> '\r'
      case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
      case 117: return codePointToString(this.readCodePoint()) // 'u'
      case 116: return "\t" // 't' -> '\t'
      case 98: return "\b" // 'b' -> '\b'
      case 118: return "\u000b" // 'v' -> '\u000b'
      case 102: return "\f" // 'f' -> '\f'
      case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\r\n'
      case 10: // ' \n'
        if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
        return ""
      case 56:
      case 57:
        if (this.strict) {
          this.invalidStringToken(
            this.pos - 1,
            "Invalid escape sequence"
          );
        }
        if (inTemplate) {
          var codePos = this.pos - 1;

          this.invalidStringToken(
            codePos,
            "Invalid escape sequence in template string"
          );

          return null
        }
      default:
        if (ch >= 48 && ch <= 55) {
          var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
          var octal = parseInt(octalStr, 8);
          if (octal > 255) {
            octalStr = octalStr.slice(0, -1);
            octal = parseInt(octalStr, 8);
          }
          this.pos += octalStr.length - 1;
          ch = this.input.charCodeAt(this.pos);
          if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
            this.invalidStringToken(
              this.pos - 1 - octalStr.length,
              inTemplate
                ? "Octal literal in template string"
                : "Octal literal in strict mode"
            );
          }
          return String.fromCharCode(octal)
        }
        if (isNewLine(ch)) {
          // Unicode new line characters after \ get removed from output in both
          // template literals and strings
          return ""
        }
        return String.fromCharCode(ch)
      }
    };

    // Used to read character escape sequences ('\x', '\u', '\U').

    pp.readHexChar = function(len) {
      var codePos = this.pos;
      var n = this.readInt(16, len);
      if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
      return n
    };

    // Read an identifier, and return it as a string. Sets `this.containsEsc`
    // to whether the word contained a '\u' escape.
    //
    // Incrementally adds only escaped chars, adding other chunks as-is
    // as a micro-optimization.

    pp.readWord1 = function() {
      this.containsEsc = false;
      var word = "", first = true, chunkStart = this.pos;
      var astral = this.options.ecmaVersion >= 6;
      while (this.pos < this.input.length) {
        var ch = this.fullCharCodeAtPos();
        if (isIdentifierChar(ch, astral)) {
          this.pos += ch <= 0xffff ? 1 : 2;
        } else if (ch === 92) { // "\"
          this.containsEsc = true;
          word += this.input.slice(chunkStart, this.pos);
          var escStart = this.pos;
          if (this.input.charCodeAt(++this.pos) !== 117) // "u"
            { this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
          ++this.pos;
          var esc = this.readCodePoint();
          if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
            { this.invalidStringToken(escStart, "Invalid Unicode escape"); }
          word += codePointToString(esc);
          chunkStart = this.pos;
        } else {
          break
        }
        first = false;
      }
      return word + this.input.slice(chunkStart, this.pos)
    };

    // Read an identifier or keyword token. Will check for reserved
    // words when necessary.

    pp.readWord = function() {
      var word = this.readWord1();
      var type = types$1.name;
      if (this.keywords.test(word)) {
        type = keywords$2[word];
      }
      return this.finishToken(type, word)
    };

    // Acorn is a tiny, fast JavaScript parser written in JavaScript.

    var version$2 = "8.7.0";

    Parser.acorn = {
      Parser: Parser,
      version: version$2,
      defaultOptions: defaultOptions,
      Position: Position,
      SourceLocation: SourceLocation,
      getLineInfo: getLineInfo,
      Node: Node,
      TokenType: TokenType,
      tokTypes: types$1,
      keywordTypes: keywords$2,
      TokContext: TokContext,
      tokContexts: types$2,
      isIdentifierChar: isIdentifierChar,
      isIdentifierStart: isIdentifierStart,
      Token: Token,
      isNewLine: isNewLine,
      lineBreak: lineBreak,
      lineBreakG: lineBreakG,
      nonASCIIwhitespace: nonASCIIwhitespace
    };

    // The main exported interface (under `self.acorn` when in the
    // browser) is a `parse` function that takes a code string and
    // returns an abstract syntax tree as specified by [Mozilla parser
    // API][api].
    //
    // [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API

    function parse$3(input, options) {
      return Parser.parse(input, options)
    }

    var constants = {
      undefined: 'void(0)',
      Infinity:  'Number.POSITIVE_INFINITY',
      NaN:       'Number.NaN',
      E:         'Math.E',
      LN2:       'Math.LN2',
      LN10:      'Math.LN10',
      LOG2E:     'Math.LOG2E',
      LOG10E:    'Math.LOG10E',
      PI:        'Math.PI',
      SQRT1_2:   'Math.SQRT1_2',
      SQRT2:     'Math.SQRT2'
    };

    const PARSER_OPT = { ecmaVersion: 11 };
    const DEFAULT_PARAM_ID = '$';
    const DEFAULT_TUPLE_ID = 'd';
    const DEFAULT_TUPLE_ID1 = 'd1';
    const DEFAULT_TUPLE_ID2 = 'd2';

    const NO = msg => (node, ctx) => ctx.error(node, msg + ' not allowed');
    const ERROR_AGGREGATE = NO('Aggregate function');
    const ERROR_WINDOW = NO('Window function');
    const ERROR_ARGUMENT = 'Invalid argument';
    const ERROR_COLUMN = 'Invalid column reference';
    const ERROR_AGGRONLY = ERROR_COLUMN + ' (must be input to an aggregate function)';
    const ERROR_FUNCTION = 'Invalid function call';
    const ERROR_MEMBER = 'Invalid member expression';
    const ERROR_OP_PARAMETER = 'Invalid operator parameter';
    const ERROR_PARAM = 'Invalid param reference';
    const ERROR_VARIABLE = 'Invalid variable reference';
    const ERROR_VARIABLE_OP = 'Variable not accessible in operator call';
    const ERROR_DECLARATION = 'Unsupported variable declaration';
    const ERROR_DESTRUCTURE = 'Unsupported destructuring pattern';
    const ERROR_CLOSURE = 'Table expressions do not support closures';
    const ERROR_ESCAPE = 'Use aq.escape(fn) to use a function as-is (including closures)';
    const ERROR_USE_PARAMS = 'use table.params({ name: value }) to define dynamic parameters';
    const ERROR_ADD_FUNCTION = 'use aq.addFunction(name, fn) to add new op functions';
    const ERROR_VARIABLE_NOTE = `\nNote: ${ERROR_CLOSURE}. ${ERROR_ESCAPE}, or ${ERROR_USE_PARAMS}.`;
    const ERROR_FUNCTION_NOTE = `\nNote: ${ERROR_CLOSURE}. ${ERROR_ESCAPE}, or ${ERROR_ADD_FUNCTION}.`;
    const ERROR_ROW_OBJECT = `The ${ROW_OBJECT} method is not valid in multi-table expressions.`;

    function parseExpression(ctx, spec) {
      const ast = parseAST(spec);
      let node = ctx.root = ast;
      ctx.spec = spec;
      ctx.tuple = null;
      ctx.tuple1 = null;
      ctx.tuple2 = null;
      ctx.$param = null;
      ctx.$op = 0;
      ctx.scope = new Set();
      ctx.paramsRef = new Map();
      ctx.columnRef = new Map();

      // parse input column parameters
      // if no function def, assume default tuple identifiers
      if (isFunctionExpression(node)) {
        parseFunction(node, ctx);
        node = node.body;
      } else if (ctx.join) {
        ctx.scope.add(ctx.tuple1 = DEFAULT_TUPLE_ID1);
        ctx.scope.add(ctx.tuple2 = DEFAULT_TUPLE_ID2);
        ctx.scope.add(ctx.$param = DEFAULT_PARAM_ID);
      } else {
        ctx.scope.add(ctx.tuple = DEFAULT_TUPLE_ID);
        ctx.scope.add(ctx.$param = DEFAULT_PARAM_ID);
      }

      // rewrite column references & function calls
      walk(node, ctx, visitors);

      return ctx.root;
    }

    function parseAST(expr) {
      try {
        const code = expr.field ? fieldRef(expr)
          : isArray$2(expr) ? toString$1(expr)
          : expr;
        return parse$3(`expr=(${code})`, PARSER_OPT).body[0].expression.right;
      } catch (err) {
        error(`Expression parse error: ${expr+''}`);
      }
    }

    function fieldRef(expr) {
      const col = JSON.stringify(expr+'');
      return !(expr.table || 0) ? `d=>d[${col}]` : `(a,b)=>b[${col}]`;
    }

    const visitors = {
      FunctionDeclaration: NO('Function definitions'),
      ForStatement: NO('For loops'),
      ForOfStatement: NO('For-of loops'),
      ForInStatement: NO('For-in loops'),
      WhileStatement: NO('While loops'),
      DoWhileStatement: NO('Do-while loops'),
      AwaitExpression: NO('Await expressions'),
      ArrowFunctionExpression: NO('Function definitions'),
      AssignmentExpression: NO('Assignments'),
      FunctionExpression: NO('Function definitions'),
      NewExpression: NO('Use of "new"'),
      UpdateExpression: NO('Update expressions'),

      VariableDeclarator(node, ctx) {
        handleDeclaration(node.id, ctx);
      },
      Identifier(node, ctx, parent) {
        if (handleIdentifier(node, ctx, parent) && !ctx.scope.has(node.name)) {
          // handle identifier passed responsibility here
          // raise error if identifier not defined in scope
          ctx.error(node, ERROR_VARIABLE, ERROR_VARIABLE_NOTE);
        }
      },
      CallExpression(node, ctx) {
        const name = functionName(node.callee);
        const def = getAggregate(name) || getWindow(name);

        // parse operator and rewrite invocation
        if (def) {
          if ((ctx.join || ctx.aggregate === false) && hasAggregate(def)) {
            ERROR_AGGREGATE(node, ctx);
          }
          if ((ctx.join || ctx.window === false) && hasWindow(def)) {
            ERROR_WINDOW(node, ctx);
          }

          ctx.$op = 1;
          if (ctx.ast) {
            updateFunctionNode(node, name, ctx);
            node.arguments.forEach(arg => walk(arg, ctx, opVisitors));
          } else {
            const op = ctx.op(parseOperator(ctx, def, name, node.arguments));
            Object.assign(node, { type: Op, name: op.id });
          }
          ctx.$op = 0;
          return false;
        } else if (hasFunction(name)) {
          updateFunctionNode(node, name, ctx);
        } else {
          ctx.error(node, ERROR_FUNCTION, ERROR_FUNCTION_NOTE);
        }
      },
      MemberExpression(node, ctx, parent) {
        const { object, property } = node;

        // bail if left head is not an identifier
        // in this case we will recurse and handle it later
        if (!is(Identifier, object)) return;
        const { name } = object;

        // allow use of Math prefix to access constant values
        if (isMath(node) && is(Identifier, property)
            && has(constants, property.name)) {
          updateConstantNode(node, property.name);
          return;
        }

        const index = name === ctx.tuple ? 0
          : name === ctx.tuple1 ? 1
          : name === ctx.tuple2 ? 2
          : -1;

        if (index >= 0) {
          // replace member expression with column ref
          return spliceMember(node, index, ctx, checkColumn, parent);
        } else if (name === ctx.$param) {
          // replace member expression with param ref
          return spliceMember(node, index, ctx, checkParam);
        } else if (ctx.paramsRef.has(name)) {
          updateParameterNode(node, ctx.paramsRef.get(name));
        } else if (ctx.columnRef.has(name)) {
          updateColumnNode(object, name, ctx, node);
        } else if (has(ctx.params, name)) {
          updateParameterNode(object, name);
        }
      }
    };

    function spliceMember(node, index, ctx, check, parent) {
      const { property, computed } = node;
      let name;

      if (!computed) {
        name = property.name;
      } else if (is(Literal$1, property)) {
        name = property.value;
      } else try {
        name = ctx.param(property);
      } catch (e) {
        ctx.error(node, ERROR_MEMBER);
      }

      check(node, name, index, ctx, parent);
      return false;
    }

    const opVisitors = {
      ...visitors,
      VariableDeclarator: NO('Variable declaration in operator call'),
      Identifier(node, ctx, parent) {
        if (handleIdentifier(node, ctx, parent)) {
          ctx.error(node, ERROR_VARIABLE_OP);
        }
      },
      CallExpression(node, ctx) {
        const name = functionName(node.callee);

        // rewrite if built-in function
        if (hasFunction(name)) {
          updateFunctionNode(node, name, ctx);
        } else {
          ctx.error(node, ERROR_FUNCTION, ERROR_FUNCTION_NOTE);
        }
      }
    };

    function parseFunction(node, ctx) {
      if (node.generator) NO('Generator functions')(node, ctx);
      if (node.async) NO('Async functions')(node, ctx);

      const { params } = node;
      const len = params.length;
      const setc = index => (name, key) => ctx.columnRef.set(name, [key, index]);
      const setp = (name, key) => ctx.paramsRef.set(name, key);

      if (!len) ; else if (ctx.join) {
        parseRef(ctx, params[0], 'tuple1', setc(1));
        if (len > 1) parseRef(ctx, params[1], 'tuple2', setc(2));
        if (len > 2) parseRef(ctx, params[2], '$param', setp);
      } else {
        parseRef(ctx, params[0], 'tuple', setc(0));
        if (len > 1) parseRef(ctx, params[1], '$param', setp);
      }

      ctx.root = node.body;
    }

    function parseRef(ctx, node, refName, alias) {
      if (is(Identifier, node)) {
        ctx.scope.add(node.name);
        ctx[refName] = node.name;
      } else if (is(ObjectPattern, node)) {
        node.properties.forEach(p => {
          const key = is(Identifier, p.key) ? p.key.name
            : is(Literal$1, p.key) ? p.key.value
            : ctx.error(p, ERROR_ARGUMENT);
          if (!is(Identifier, p.value)) {
            ctx.error(p.value, ERROR_DESTRUCTURE);
          }
          alias(p.value.name, key);
        });
      }
    }

    function parseOperator(ctx, def, name, args) {
      const fields = [];
      const params = [];
      const idxFields = def.param[0] || 0;
      const idxParams = idxFields + (def.param[1] || 0);

      args.forEach((arg, index) => {
        if (index < idxFields) {
          walk(arg, ctx, opVisitors);
          fields.push(ctx.field(arg));
        } else if (index < idxParams) {
          walk(arg, ctx, opVisitors);
          params.push(ctx.param(arg));
        } else {
          ctx.error(arg, ERROR_OP_PARAMETER);
        }
      });

      return { name, fields, params, ...(ctx.spec.window || {}) };
    }

    function functionName(node) {
      return is(Identifier, node) ? node.name
        : !is(MemberExpression, node) ? null
        : isMath(node) ? rewriteMath(node.property.name)
        : node.property.name;
    }

    function isMath(node) {
      return is(Identifier, node.object) && node.object.name === 'Math';
    }

    function rewriteMath(name) {
      return name === 'max' ? 'greatest'
        : name === 'min' ? 'least'
        : name;
    }

    function handleIdentifier(node, ctx, parent) {
      const { name } = node;

      if (is(MemberExpression, parent) && parent.property === node) ; else if (is(Property, parent) && parent.key === node) ; else if (ctx.paramsRef.has(name)) {
        updateParameterNode(node, ctx.paramsRef.get(name));
      } else if (ctx.columnRef.has(name)) {
        updateColumnNode(node, name, ctx, parent);
      } else if (has(ctx.params, name)) {
        updateParameterNode(node, name);
      } else if (has(constants, name)) {
        updateConstantNode(node, name);
      } else {
        return true;
      }
    }

    function checkColumn(node, name, index, ctx, parent) {
      // check column existence if we have a backing table
      const table = index === 0 ? ctx.table
        : index > 0 ? ctx.join[index - 1]
        : null;
      const col = table && table.column(name);
      if (table && !col) {
        ctx.error(node, ERROR_COLUMN);
      }

      // check if column reference is valid in current context
      if (ctx.aggronly && !ctx.$op) {
        ctx.error(node, ERROR_AGGRONLY);
      }

      // rewrite ast node as a column access
      rewrite(node, name, index, col, parent);
    }

    function updateColumnNode(node, key, ctx, parent) {
      const [name, index] = ctx.columnRef.get(key);
      checkColumn(node, name, index, ctx, parent);
    }

    function checkParam(node, name, index, ctx) {
      if (ctx.params && !has(ctx.params, name)) {
        ctx.error(node, ERROR_PARAM);
      }
      updateParameterNode(node, name);
    }

    function updateParameterNode(node, name) {
      node.type = Parameter;
      node.name = name;
    }

    function updateConstantNode(node, name) {
      node.type = Constant;
      node.name = name;
      node.raw = constants[name];
    }

    function updateFunctionNode(node, name, ctx) {
      if (name === ROW_OBJECT) {
        const t = ctx.table;
        if (!t) ctx.error(node, ERROR_ROW_OBJECT);
        rowObjectExpression(node,
          node.arguments.length
            ? node.arguments.map(node => {
                const col = ctx.param(node);
                const name = isNumber$1(col) ? t.columnName(col) : col;
                if (!t.column(name)) ctx.error(node, ERROR_COLUMN);
                return name;
              })
            : t.columnNames()
        );
      } else {
        node.callee = { type: Function$1, name };
      }
    }

    function handleDeclaration(node, ctx) {
      if (is(Identifier, node)) {
        ctx.scope.add(node.name);
      } else if (is(ArrayPattern, node)) {
        node.elements.forEach(elm => handleDeclaration(elm, ctx));
      } else if (is(ObjectPattern, node)) {
        node.properties.forEach(prop => handleDeclaration(prop.value, ctx));
      } else {
        ctx.error(node.id, ERROR_DECLARATION);
      }
    }

    const ANNOTATE = { [Column$1]: 1, [Op]: 1 };

    function parse$2(input, opt = {}) {
      const generate = opt.generate || codegen;
      const compiler = opt.compiler || compile$1;
      const params = getParams(opt);
      const fields = {};
      const opcall = {};
      const names = [];
      const exprs = [];
      let fieldId = 0;
      let opId = -1;

      const compileExpr = opt.join ? compiler.join
        : opt.index == 1 ? compiler.expr2
        : compiler.expr;

      // parser context
      const ctx = {
        op(op) {
          const key = opKey(op);
          return opcall[key] || (op.id = ++opId, opcall[key] = op);
        },
        field(node) {
          const code = generate(node);
          return fields[code] || (fields[code] = ++fieldId);
        },
        param(node) {
          return is(Literal$1, node)
            ? node.value
            : compiler.param(generate(node), params);
        },
        value(name, node) {
          names.push(name);
          const e = node.escape || (opt.ast
            ? clean(node)
            : compileExpr(generate(node), params));
          exprs.push(e);
          // annotate expression if it is a direct column or op access
          // this permits downstream optimizations
          if (ANNOTATE[node.type] && e !== node && isObject$1(e)) {
            e.field = node.name;
          }
        },
        error(node, msg, note = '') {
          // both expresions and fields are parsed
          // with added code prefixes of length 6!
          const i = node.start - 6;
          const j = node.end - 6;
          const snippet = String(ctx.spec).slice(i, j);
          error(`${msg}: "${snippet}"${note}`);
        }
      };

      // copy all options to context, potentially overwriting methods
      Object.assign(ctx, opt, { params });

      // parse each expression
      for (const [name, value] of entries(input)) {
        ctx.value(
          name + '',
          value.escape
            ? parseEscape(ctx, value, params)
            : parseExpression(ctx, value)
        );
      }

      // return expression asts if requested
      if (opt.ast) {
        return { names, exprs };
      }

      // compile input field accessors
      const f = [];
      for (const key in fields) {
        f[fields[key]] = compiler.expr(key, params);
      }

      // resolve input fields to operations
      const ops = Object.values(opcall);
      ops.forEach(op => op.fields = op.fields.map(id => f[id]));

      return { names, exprs, ops };
    }

    function opKey(op) {
      let key = `${op.name}(${op.fields.concat(op.params).join(',')})`;
      if (op.frame) {
        const frame = op.frame.map(v => Number.isFinite(v) ? Math.abs(v) : -1);
        key += `[${frame},${!!op.peers}]`;
      }
      return key;
    }

    function getParams(opt) {
      return (opt.table ? getTableParams(opt.table)
        : opt.join ? {
            ...getTableParams(opt.join[1]),
            ...getTableParams(opt.join[0])
          }
        : {}) || {};
    }

    function getTableParams(table) {
      return table && isFunction$1(table.params) ? table.params() : {};
    }

    const Expr = 'Expr';
    const ExprList = 'ExprList';
    const ExprNumber = 'ExprNumber';
    const ExprObject = 'ExprObject';
    const JoinKeys = 'JoinKeys';
    const JoinValues = 'JoinValues';
    const Options = 'Options';
    const OrderbyKeys = 'OrderKeys';
    const SelectionList = 'SelectionList';
    const TableRef = 'TableRef';
    const TableRefList = 'TableRefList';

    const Descending = 'Descending';
    const Query$1 = 'Query';
    const Selection = 'Selection';
    const Verb$1 = 'Verb';
    const Window = 'Window';

    /**
     * Annotate an expression in an object wrapper.
     * @param {string|Function|object} expr An expression to annotate.
     * @param {object} properties The properties to annotate with.
     * @return {object} A new wrapped expression object.
     */
    function wrap(expr, properties) {
      return expr && expr.expr
        ? new Wrapper({ ...expr, ...properties })
        : new Wrapper(properties, expr);
    }

    class Wrapper {
      constructor(properties, expr) {
        this.expr = expr;
        Object.assign(this, properties);
      }
      toString() {
        return String(this.expr);
      }
      toObject() {
        return {
          ...this,
          expr: this.toString(),
          ...(isFunction$1(this.expr) ? { func: true } : {})
        };
      }
    }

    /**
     * Annotate a table expression to indicate descending sort order.
     * @param {string|Function|object} expr The table expression to annotate.
     * @return {object} A wrapped expression indicating descending sort.
     * @example desc('colA')
     * @example desc(d => d.colA)
     */
    function desc(expr) {
      return wrap(expr, { desc: true });
    }

    /**
     * Annotate an expression to indicate it is a string field reference.
     * @param {string|object} expr The column name, or an existing wrapped
     *  expression for a column name.
     * @param {string} [name] The column name to use. If provided, will
     *  overwrite the input expression value.
     * @param {number} [table=0] The table index of the field, in case of
     *  expressions over multiple tables.
     * @return A wrapped expression for a named column.
     * @example field('colA')
     */
    function field(expr, name, table = 0) {
      const props = table ? { field: true, table } : { field: true };
      return wrap(
        expr,
        name ? { expr: name, ...props } : props
      );
    }

    /**
     * Annotate a table expression to compute rolling aggregate or window
     * functions within a sliding window frame. For example, to specify a
     * rolling 7-day average centered on the current day, use rolling with
     * a frame value of [-3, 3].
     * @param {string|Function|object} expr The table expression to annotate.
     * @param {[number?, number?]} [frame=[-Infinity, 0]] The sliding window frame
     *  offsets. Each entry indicates an offset from the current value. If an
     *  entry is non-finite, the frame will be unbounded in that direction,
     *  including all preceding or following values. If unspecified, the frame
     *  will include the current values and all preceding values.
     * @param {boolean} [includePeers=false] Indicates if the sliding window frame
     *  should ignore peer (tied) values. If false (the default), the window frame
     *  boundaries are insensitive to peer values. If `true`, the window frame
     *  expands to include all peers. This parameter only affects operations that
     *  depend on the window frame: aggregate functions and the first_value,
     *  last_value, and nth_value window functions.
     * @return A new wrapped expression annotated with rolling window parameters.
     * @example rolling(d => mean(d.colA), [-3, 3])
     * @example rolling(d => last_value(d.colA), null, true)
     */
    function rolling(expr, frame, includePeers) {
      return wrap(expr, {
        window: {
          frame: frame || [-Infinity, 0],
          peers: !!includePeers
        }
      });
    }

    function func$2(expr) {
      const f = d => d;
      f.toString = () => expr;
      return f;
    }

    function getTable(catalog, ref) {
      ref = ref && isFunction$1(ref.query) ? ref.query() : ref;
      return ref && isFunction$1(ref.evaluate)
        ? ref.evaluate(null, catalog)
        : catalog(ref);
    }

    function isSelection(value) {
      return isObject$1(value) && (
        isArray$2(value.all) ||
        isArray$2(value.matches) ||
        isArray$2(value.not) ||
        isArray$2(value.range)
      );
    }

    function toObject(value) {
      return value && isFunction$1(value.toObject) ? value.toObject()
        : isFunction$1(value) ? { expr: String(value), func: true }
        : isArray$2(value) ? value.map(toObject)
        : isObject$1(value) ? map(value, _ => toObject(_))
        : value;
    }

    function fromObject(value) {
      return isArray$2(value) ? value.map(fromObject)
        : !isObject$1(value) ? value
        : isArray$2(value.verbs) ? Query.from(value)
        : isArray$2(value.all) ? all()
        : isArray$2(value.range) ? range(...value.range)
        : isArray$2(value.match) ? matches(RegExp(...value.match))
        : isArray$2(value.not) ? not(value.not.map(toObject))
        : fromExprObject(value);
    }

    function fromExprObject(value) {
      let output = value;
      let expr = value.expr;

      if (expr != null) {
        if (value.field === true) {
          output = expr = field(expr);
        } else if (value.func === true) {
          output = expr = func$2(expr);
        }

        if (isObject$1(value.window)) {
          const { frame, peers } = value.window;
          output = expr = rolling(expr, frame, peers);
        }

        if (value.desc === true) {
          output = desc(expr);
        }
      }

      return value === output
        ? map(value, _ => fromObject(_))
        : output;
    }

    function joinKeys(keys) {
      return isArray$2(keys) ? keys.map(parseJoinKeys)
        : keys;
    }

    function parseJoinKeys(keys) {
      const list = [];

      toArray(keys).forEach(param => {
        isNumber$1(param) ? list.push(param)
          : isString(param) ? list.push(field(param, null))
          : isObject$1(param) && param.expr ? list.push(param)
          : isFunction$1(param) ? list.push(param)
          : error(`Invalid key value: ${param+''}`);
      });

      return list;
    }

    function joinValues(values) {
      return isArray$2(values)
        ? values.map(parseJoinValues)
        : values;
    }

    function parseJoinValues(values, index) {
      return index < 2 ? toArray(values) : values;
    }

    function orderbyKeys(keys) {
      const list = [];

      keys.forEach(param => {
        const expr = param.expr != null ? param.expr : param;
        if (isObject$1(expr) && !isFunction$1(expr)) {
          for (const key in expr) {
            list.push(expr[key]);
          }
        } else {
          param = isNumber$1(expr) ? expr
            : isString(expr) ? field(param)
            : isFunction$1(expr) ? param
            : error(`Invalid orderby field: ${param+''}`);
          list.push(param);
        }
      });

      return list;
    }

    const Methods = {
      [Expr]: astExpr,
      [ExprList]: astExprList,
      [ExprNumber]: astExprNumber,
      [ExprObject]: astExprObject,
      [JoinKeys]: astJoinKeys,
      [JoinValues]: astJoinValues,
      [OrderbyKeys]: astExprList,
      [SelectionList]: astSelectionList
    };

    function toAST(value, type, propTypes) {
      return type === TableRef ? astTableRef(value)
        : type === TableRefList ? value.map(astTableRef)
        : ast(toObject(value), type, propTypes);
    }

    function ast(value, type, propTypes) {
      return type === Options
        ? (value ? astOptions(value, propTypes) : value)
        : Methods[type](value);
    }

    function astOptions(value, types = {}) {
      const output = {};
      for (const key in value) {
        const prop = value[key];
        output[key] = types[key] ? ast(prop, types[key]) : prop;
      }
      return output;
    }

    function astParse(expr, opt) {
      return parse$2({ expr }, { ...opt, ast: true }).exprs[0];
    }

    function astColumn(name) {
      return { type: Column$1, name };
    }

    function astColumnIndex(index) {
      return { type: Column$1, index };
    }

    function astExprObject(obj, opt) {
      if (isString(obj)) {
        return astParse(obj, opt);
      }

      if (obj.expr) {
        let ast;
        if (obj.field === true) {
          ast = astColumn(obj.expr);
        } else if (obj.func === true) {
          ast = astExprObject(obj.expr, opt);
        }
        if (ast) {
          if (obj.desc) {
            ast = { type: Descending, expr: ast };
          }
          if (obj.window) {
            ast = { type: Window, expr: ast, ...obj.window };
          }
          return ast;
        }
      }

      return Object.keys(obj)
        .map(key => ({
          ...astExprObject(obj[key], opt),
          as: key
        }));
    }

    function astSelection(sel) {
      const type = Selection;
      return sel.all ? { type, operator: 'all' }
        : sel.not ? { type, operator: 'not', arguments: astExprList(sel.not) }
        : sel.range ? { type, operator: 'range', arguments: astExprList(sel.range) }
        : sel.matches ? { type, operator: 'matches', arguments: sel.matches }
        : error('Invalid input');
    }

    function astSelectionList(arr) {
      return toArray(arr).map(astSelectionItem).flat();
    }

    function astSelectionItem(val) {
      return isSelection(val) ? astSelection(val)
        : isNumber$1(val) ? astColumnIndex(val)
        : isString(val) ? astColumn(val)
        : isObject$1(val) ? Object.keys(val)
          .map(name => ({ type: Column$1, name, as: val[name] }))
        : error('Invalid input');
    }

    function astExpr(val) {
      return isSelection(val) ? astSelection(val)
        : isNumber$1(val) ? astColumnIndex(val)
        : isString(val) ? astColumn(val)
        : isObject$1(val) ? astExprObject(val)
        : error('Invalid input');
    }

    function astExprList(arr) {
      return toArray(arr).map(astExpr).flat();
    }

    function astExprNumber(val) {
      return isNumber$1(val) ? val : astExprObject(val);
    }

    function astJoinKeys(val) {
      return isArray$2(val)
        ? val.map(astExprList)
        : astExprObject(val, { join: true });
    }

    function astJoinValues(val) {
      return isArray$2(val)
        ? val.map((v, i) => i < 2
            ? astExprList(v)
            : astExprObject(v, { join: true })
          )
        : astExprObject(val, { join: true });
    }

    function astTableRef(value) {
      return value && isFunction$1(value.toAST)
        ? value.toAST()
        : value;
    }

    /**
     * Model an Arquero verb as a serializable object.
     */
    class Verb {

      /**
       * Construct a new verb instance.
       * @param {string} verb The verb name.
       * @param {object[]} schema Schema describing verb parameters.
       * @param {any[]} params Array of parameter values.
       */
      constructor(verb, schema = [], params = []) {
        this.verb = verb;
        this.schema = schema;
        schema.forEach((s, index) => {
          const type = s.type;
          const param = params[index];
          const value = type === JoinKeys ? joinKeys(param)
            : type === JoinValues ? joinValues(param)
            : type === OrderbyKeys ? orderbyKeys(param)
            : param;
          this[s.name] = value !== undefined ? value : s.default;
        });
      }

      /**
       * Create new verb instance from the given serialized object.
       * @param {object} object A serialized verb representation, such as
       *  those generated by Verb.toObject.
       * @returns {Verb} The instantiated verb.
       */
      static from(object) {
        const verb = Verbs[object.verb];
        const params = (verb.schema || [])
          .map(({ name }) => fromObject(object[name]));
        return verb(...params);
      }

      /**
       * Evaluate this verb against a given table and catalog.
       * @param {Table} table The Arquero table to process.
       * @param {Function} catalog A table lookup function that accepts a table
       *  name string as input and returns a corresponding Arquero table.
       * @returns {Table} The resulting Arquero table.
       */
      evaluate(table, catalog) {
        const params = this.schema.map(({ name, type }) => {
          const value = this[name];
          return type === TableRef ? getTable(catalog, value)
            : type === TableRefList ? value.map(t => getTable(catalog, t))
            : value;
        });
        return table[this.verb](...params);
      }

      /**
       * Serialize this verb as a JSON-compatible object. The resulting
       * object can be passed to Verb.from to re-instantiate this verb.
       * @returns {object} A JSON-compatible object representing this verb.
       */
      toObject() {
        const obj = { verb: this.verb };
        this.schema.forEach(({ name }) => {
          obj[name] = toObject(this[name]);
        });
        return obj;
      }

      /**
       * Serialize this verb to a JSON-compatible abstract syntax tree.
       * All table expressions will be parsed and represented as AST instances
       * using a modified form of the Mozilla JavaScript AST format.
       * This method can be used to output parsed and serialized representations
       * to translate Arquero verbs to alternative data processing platforms.
       * @returns {object} A JSON-compatible abstract syntax tree object.
       */
      toAST() {
        const obj = { type: Verb$1, verb: this.verb };
        this.schema.forEach(({ name, type, props }) => {
          obj[name] = toAST(this[name], type, props);
        });
        return obj;
      }
    }

    /**
     * Verb parameter type.
     * @typedef {Expr|ExprList|ExprNumber|ExprObject|JoinKeys|JoinValues|Options|OrderbyKeys|SelectionList|TableRef|TableRefList} ParamType
     */

    /**
     * Verb parameter schema.
     * @typedef {object} ParamDef
     * @property {string} name The name of the parameter.
     * @property {ParamType} type The type of the parameter.
     * @property {{ [key: string]: ParamType }} [props] Types for non-literal properties.
     */

    /**
     * Create a new constructors.
     * @param {string} name The name of the verb.
     * @param {ParamDef[]} schema The verb parameter schema.
     * @return {Function} A verb constructor function.
     */
    function createVerb(name, schema) {
      return Object.assign(
        (...params) => new Verb(name, schema, params),
        { schema }
      );
    }

    /**
     * A lookup table of verb classes.
     */
    const Verbs = {
      count:      createVerb('count', [
                    { name: 'options', type: Options }
                  ]),
      derive:     createVerb('derive', [
                    { name: 'values', type: ExprObject },
                    { name: 'options', type: Options,
                      props: { before: SelectionList, after: SelectionList }
                    }
                  ]),
      filter:     createVerb('filter', [
                    { name: 'criteria', type: ExprObject }
                  ]),
      groupby:    createVerb('groupby', [
                    { name: 'keys', type: ExprList }
                  ]),
      orderby:    createVerb('orderby', [
                    { name: 'keys', type: OrderbyKeys }
                  ]),
      relocate:   createVerb('relocate', [
                    { name: 'columns', type: SelectionList },
                    { name: 'options', type: Options,
                      props: { before: SelectionList, after: SelectionList }
                    }
                  ]),
      rename:     createVerb('rename', [
                    { name: 'columns', type: SelectionList }
                  ]),
      rollup:     createVerb('rollup', [
                    { name: 'values', type: ExprObject }
                  ]),
      sample:     createVerb('sample', [
                    { name: 'size', type: ExprNumber },
                    { name: 'options', type: Options, props: { weight: Expr } }
                  ]),
      select:     createVerb('select', [
                    { name: 'columns', type: SelectionList }
                  ]),
      ungroup:    createVerb('ungroup'),
      unorder:    createVerb('unorder'),
      reify:      createVerb('reify'),
      dedupe:     createVerb('dedupe', [
                    { name: 'keys', type: ExprList, default: [] }
                  ]),
      impute:     createVerb('impute', [
                    { name: 'values', type: ExprObject },
                    { name: 'options', type: Options, props: { expand: ExprList } }
                  ]),
      fold:       createVerb('fold', [
                    { name: 'values', type: ExprList },
                    { name: 'options', type: Options }
                  ]),
      pivot:      createVerb('pivot', [
                    { name: 'keys', type: ExprList },
                    { name: 'values', type: ExprList },
                    { name: 'options', type: Options }
                  ]),
      spread:     createVerb('spread', [
                    { name: 'values', type: ExprList },
                    { name: 'options', type: Options }
                  ]),
      unroll:     createVerb('unroll', [
                    { name: 'values', type: ExprList },
                    { name: 'options', type: Options, props: { drop: ExprList } }
                  ]),
      lookup:     createVerb('lookup', [
                    { name: 'table', type: TableRef },
                    { name: 'on', type: JoinKeys },
                    { name: 'values', type: ExprList }
                  ]),
      join:       createVerb('join', [
                    { name: 'table', type: TableRef },
                    { name: 'on', type: JoinKeys },
                    { name: 'values', type: JoinValues },
                    { name: 'options', type: Options }
                  ]),
      cross:      createVerb('cross', [
                    { name: 'table', type: TableRef },
                    { name: 'values', type: JoinValues },
                    { name: 'options', type: Options }
                  ]),
      semijoin:   createVerb('semijoin', [
                    { name: 'table', type: TableRef },
                    { name: 'on', type: JoinKeys }
                  ]),
      antijoin:   createVerb('antijoin', [
                    { name: 'table', type: TableRef },
                    { name: 'on', type: JoinKeys }
                  ]),
      concat:     createVerb('concat', [
                    { name: 'tables', type: TableRefList }
                  ]),
      union:      createVerb('union', [
                    { name: 'tables', type: TableRefList }
                  ]),
      intersect:  createVerb('intersect', [
                    { name: 'tables', type: TableRefList }
                  ]),
      except:     createVerb('except', [
                    { name: 'tables', type: TableRefList }
                  ])
    };

    /**
     * Create a new query instance. The query interface provides
     * a table-like verb API to construct a query that can be
     * serialized or evaluated against Arquero tables.
     * @param {string} [tableName] The name of the table to query. If
     *  provided, will be used as the default input table to pull from
     *  a provided catalog to run the query against.
     * @return {Query} A new builder instance.
     */
    function query(tableName) {
      return new Query(null, null, tableName);
    }

    /**
     * Create a new query instance from a serialized object.
     * @param {object} object A serialized query representation, such as
     *  those generated by query(...).toObject().
     * @returns {Query} The instantiated query instance.
     */
    function queryFrom(object) {
      return Query.from(object);
    }

    /**
     * Model a query as a collection of serializble verbs.
     * Provides a table-like interface for constructing queries.
     */
    class Query extends Transformable {

      /**
       * Construct a new query instance.
       * @param {Verb[]} verbs An array of verb instances.
       * @param {object} [params] Optional query parameters, corresponding
       *  to parameter references in table expressions.
       * @param {string} [table] Optional name of the table to query.
       */
      constructor(verbs, params, table) {
        super(params);
        this._verbs = verbs || [];
        this._table = table;
      }

      /**
       * Create a new query instance from the given serialized object.
       * @param {QueryObject} object A serialized query representation, such as
       *  those generated by Query.toObject.
       * @returns {Query} The instantiated query.
       */
      static from({ verbs, table, params }) {
        return new Query(verbs.map(Verb.from), params, table);
      }

      /**
       * Provide an informative object string tag.
       */
      get [Symbol.toStringTag]() {
        if (!this._verbs) return 'Object'; // bail if called on prototype
        const ns = this._verbs.length;
        return `Query: ${ns} verbs` + (this._table ? ` on '${this._table}'` : '');
      }

      /**
       * Return the number of verbs in this query.
       */
      get length() {
        return this._verbs.length;
      }

      /**
       * Return the name of the table this query applies to.
       * @return {string} The name of the source table, or undefined.
       */
      get tableName() {
        return this._table;
      }

      /**
       * Get or set table expression parameter values.
       * If called with no arguments, returns the current parameter values
       * as an object. Otherwise, adds the provided parameters to this
       * query's parameter set and returns the table. Any prior parameters
       * with names matching the input parameters are overridden.
       * @param {object} values The parameter values.
       * @return {Query|object} The current parameter values (if called
       *  with no arguments) or this query.
       */
      params(values) {
        if (arguments.length) {
          this._params = { ...this._params, ...values };
          return this;
        } else {
          return this._params;
        }
      }

      /**
       * Evaluate this query against a given table and catalog.
       * @param {Table} table The Arquero table to process.
       * @param {Function} catalog A table lookup function that accepts a table
       *  name string as input and returns a corresponding Arquero table.
       * @returns {Table} The resulting Arquero table.
       */
      evaluate(table, catalog) {
        table = table || catalog(this._table);
        for (const verb of this._verbs) {
          table = verb.evaluate(table.params(this._params), catalog);
        }
        return table;
      }

      /**
       * Serialize this query as a JSON-compatible object. The resulting
       * object can be passed to Query.from to re-instantiate this query.
       * @returns {object} A JSON-compatible object representing this query.
       */
      toObject() {
        return serialize(this, 'toObject');
      }

      /**
       * Serialize this query as a JSON-compatible object. The resulting
       * object can be passed to Query.from to re-instantiate this query.
       * This method simply returns the result of toObject, but is provided
       * as a separate method to allow later customization of JSON export.
       * @returns {object} A JSON-compatible object representing this query.
       */
      toJSON() {
        return this.toObject();
      }

      /**
       * Serialize this query to a JSON-compatible abstract syntax tree.
       * All table expressions will be parsed and represented as AST instances
       * using a modified form of the Mozilla JavaScript AST format.
       * This method can be used to output parsed and serialized representations
       * to translate Arquero queries to alternative data processing platforms.
       * @returns {object} A JSON-compatible abstract syntax tree object.
       */
      toAST() {
        return serialize(this, 'toAST', { type: Query$1 });
      }
    }

    /**
     * Serialized object representation of a query.
     * @typedef {object} QueryObject
     * @property {object[]} verbs An array of verb definitions.
     * @property {object} [params] An object of parameter values.
     * @property {string} [table] The name of the table to query.
     */

    function serialize(query, method, props) {
      return {
        ...props,
        verbs: query._verbs.map(verb => verb[method]()),
        ...(query._params ? { params: query._params } : null),
        ...(query._table ? { table: query._table } : null)
      };
    }

    function append(qb, verb) {
      return new Query(
        qb._verbs.concat(verb),
        qb._params,
        qb._table
      );
    }

    function addQueryVerb(name, verb) {
      Query.prototype[name] = function(...args) {
        return append(this, verb(...args));
      };
    }

    // Internal verb handlers
    for (const name in Verbs) {
      const verb = Verbs[name];
      Query.prototype['__' + name] = function(qb, ...args) {
        return append(qb, verb(...args));
      };
    }

    var name = "arquero";
    var version$1 = "4.8.8";
    var description = "Query processing and transformation of array-backed data tables.";
    var keywords = [
    	"data",
    	"query",
    	"database",
    	"table",
    	"dataframe",
    	"transform",
    	"arrays"
    ];
    var license = "BSD-3-Clause";
    var author = "Jeffrey Heer (http://idl.cs.washington.edu)";
    var main = "dist/arquero.node.js";
    var module = "src/index-node.js";
    var unpkg = "dist/arquero.min.js";
    var jsdelivr = "dist/arquero.min.js";
    var types = "dist/types/index.d.ts";
    var browser = {
    	"./dist/arquero.node.js": "./dist/arquero.min.js",
    	"./src/index-node.js": "./src/index.js"
    };
    var repository = {
    	type: "git",
    	url: "https://github.com/uwdata/arquero.git"
    };
    var scripts = {
    	prebuild: "rimraf dist && mkdir dist",
    	build: "rollup -c",
    	postbuild: "tsc",
    	preperf: "yarn build",
    	perf: "TZ=America/Los_Angeles tape 'perf/**/*-perf.js'",
    	lint: "yarn eslint src test --ext .js",
    	test: "TZ=America/Los_Angeles tape 'test/**/*-test.js' --require esm",
    	prepublishOnly: "yarn test && yarn lint && yarn build"
    };
    var dependencies = {
    	acorn: "^8.7.0",
    	"apache-arrow": "^3.0.0",
    	"node-fetch": "^2.6.6"
    };
    var devDependencies = {
    	"@rollup/plugin-json": "^4.1.0",
    	"@rollup/plugin-node-resolve": "^13.1.3",
    	eslint: "^8.6.0",
    	esm: "^3.2.25",
    	rimraf: "^3.0.2",
    	rollup: "^2.63.0",
    	"rollup-plugin-bundle-size": "^1.0.3",
    	"rollup-plugin-terser": "^7.0.2",
    	tape: "^5.4.0",
    	typescript: "^4.5.4"
    };
    var esm = {
    	force: true,
    	mainFields: [
    		"module",
    		"main"
    	]
    };
    var pkg = {
    	name: name,
    	version: version$1,
    	description: description,
    	keywords: keywords,
    	license: license,
    	author: author,
    	main: main,
    	module: module,
    	unpkg: unpkg,
    	jsdelivr: jsdelivr,
    	types: types,
    	browser: browser,
    	repository: repository,
    	scripts: scripts,
    	dependencies: dependencies,
    	devDependencies: devDependencies,
    	esm: esm
    };

    /**
     * Create a new Arquero column that proxies access to an
     * Apache Arrow dictionary column.
     * @param {object} vector An Apache Arrow dictionary column.
     */
    function arrowDictionary(vector) {
      const { chunks, dictionary, length, nullCount } = vector;
      const size = dictionary.length;
      const keys = dictKeys(chunks || [vector], length, nullCount, size);
      const values = Array(size);

      const value = k => k == null || k < 0 || k >= size ? null
        : values[k] !== undefined ? values[k]
        : (values[k] = dictionary.get(k));

      return {
        vector,
        length,

        get: row => value(keys[row]),

        key: row => keys[row],

        keyFor(value) {
          if (value === null) return nullCount ? size : -1;
          for (let i = 0; i < size; ++i) {
            if (values[i] === undefined) values[i] = dictionary.get(i);
            if (values[i] === value) return i;
          }
          return -1;
        },

        groups(names) {
          const s = size + (nullCount ? 1 : 0);
          return { keys, get: [value], names, rows: sequence(0, s), size: s };
        },

        [Symbol.iterator]() {
          return vector[Symbol.iterator]();
        }
      };
    }

    /**
     * Generate a dictionary key array
     * @param {object[]} chunks Arrow column chunks
     * @param {number} length The length of the Arrow column
     * @param {number} nulls The count of column null values
     * @param {number} size The backing dictionary size
     */
    function dictKeys(chunks, length, nulls, size) {
      const v = chunks.length > 1 || nulls
        ? flatten(chunks, length, chunks[0].type.indices)
        : chunks[0].values;
      return nulls ? nullKeys(chunks, v, size) : v;
    }

    /**
     * Flatten Arrow column chunks into a single array.
     */
    function flatten(chunks, length, type) {
      const array = new type.ArrayType(length);
      const n = chunks.length;
      for (let i = 0, idx = 0, len; i < n; ++i) {
        len = chunks[i].length;
        array.set(chunks[i].values.subarray(0, len), idx);
        idx += len;
      }
      return array;
    }

    /**
     * Encode null values as an additional dictionary key.
     * Returns a new key array with null values added.
     * TODO: safeguard against integer overflow?
     */
    function nullKeys(chunks, keys, key) {
      // iterate over null bitmaps, encode null values as key
      const n = chunks.length;
      for (let i = 0, idx = 0, m, base, bits, byte; i < n; ++i) {
        bits = chunks[i].nullBitmap;
        m = chunks[i].length >> 3;
        if (bits && bits.length) {
          for (let j = 0; j <= m; ++j) {
            if ((byte = bits[j]) !== 255) {
              base = idx + (j << 3);
              if ((byte & (1 << 0)) === 0) keys[base + 0] = key;
              if ((byte & (1 << 1)) === 0) keys[base + 1] = key;
              if ((byte & (1 << 2)) === 0) keys[base + 2] = key;
              if ((byte & (1 << 3)) === 0) keys[base + 3] = key;
              if ((byte & (1 << 4)) === 0) keys[base + 4] = key;
              if ((byte & (1 << 5)) === 0) keys[base + 5] = key;
              if ((byte & (1 << 6)) === 0) keys[base + 6] = key;
              if ((byte & (1 << 7)) === 0) keys[base + 7] = key;
            }
          }
        }
        idx += chunks[i].length;
      }
      return keys;
    }

    function unroll(args, code, ...lists) {
      const v = ['_', '$'];
      const a = v.slice(0, lists.length);
      a.push('"use strict"; const '
        + lists
            .map((l, j) => l.map((_, i) => `${v[j]}${i} = ${v[j]}[${i}]`).join(', '))
            .join(', ')
        + `; return (${args}) => ${code};`
      );
      return Function(...a)(...lists);
    }

    const isList = id => id === Type.List || id === Type.FixedSizeList;

    /**
     * Create an Arquero column that proxies access to an Arrow column.
     * @param {object} arrow An Apache Arrow column.
     * @return {import('../table/column').ColumnType} An Arquero-compatible column.
     */
    function arrowColumn(arrow, nested) {
      if (arrow.dictionary) return arrowDictionary(arrow);
      const { typeId, chunks, length, numChildren } = arrow;
      const vector = chunks && chunks.length === 1 ? chunks[0] : arrow;
      const get = numChildren && nested ? getNested(vector)
        : numChildren ? memoize(getNested(vector))
        : typeId === Type.Utf8 ? memoize(row => vector.get(row))
        : null;

      return get
        ? { vector, length, get, [Symbol.iterator]: () => iterator(length, get) }
        : vector;
    }

    function memoize(get) {
      const values = [];
      return row => {
        const v = values[row];
        return v !== undefined ? v : (values[row] = get(row));
      };
    }

    function* iterator(n, get) {
      for (let i = 0; i < n; ++i) {
        yield get(i);
      }
    }

    const arrayFrom = vector => vector.numChildren
      ? repeat(vector.length, getNested(vector))
      : vector.nullCount ? [...vector]
      : vector.toArray();

    const getNested = vector => isList(vector.typeId) ? getList(vector)
      : vector.typeId === Type.Struct ? getStruct(vector)
      : error(`Unsupported Arrow type: ${toString$1(vector.VectorName)}`);

    const getList = vector => vector.nullCount
      ? row => vector.isValid(row) ? arrayFrom(vector.get(row)) : null
      : row => arrayFrom(vector.get(row));

    function getStruct(vector) {
      const props = [];
      const code = [];
      vector.type.children.forEach((field, i) => {
        props.push(arrowColumn(vector.getChildAt(i), true));
        code.push(`${toString$1(field.name)}:_${i}.get(row)`);
      });
      const get = unroll('row', '({' + code + '})', props);

      return vector.nullCount
        ? row => vector.isValid(row) ? get(row) : null
        : get;
    }

    const ONE = 0x80000000;
    const ALL = 0xFFFFFFFF;

    /**
     * Represent an indexable set of bits.
     */
    class BitSet {
      /**
       * Instantiate a new BitSet instance.
       * @param {number} size The number of bits.
       */
      constructor(size) {
        this._size = size;
        this._bits = new Uint32Array(Math.ceil(size / 32));
      }

      /**
       * The number of bits.
       * @return {number}
       */
      get length() {
        return this._size;
      }

      /**
       * The number of bits set to one.
       * https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
       * @return {number}
       */
      count() {
        const n = this._bits.length;
        let count = 0;
        for (let i = 0; i < n; ++i) {
          for (let b = this._bits[i]; b; ++count) {
            b &= b - 1;
          }
        }
        return count;
      }

      /**
       * Get the bit at a given index.
       * @param {number} i The bit index.
       */
      get(i) {
        return this._bits[i >> 5] & (ONE >>> i);
      }

      /**
       * Set the bit at a given index to one.
       * @param {number} i The bit index.
       */
      set(i) {
        this._bits[i >> 5] |= (ONE >>> i);
      }

      /**
       * Clear the bit at a given index to zero.
       * @param {number} i The bit index.
       */
      clear(i) {
        this._bits[i >> 5] &= ~(ONE >>> i);
      }

      /**
       * Scan the bits, invoking a callback function with the index of
       * each non-zero bit.
       * @param {(i: number) => void} fn A callback function.
       */
      scan(fn) {
        for (let i = this.next(0); i >= 0; i = this.next(i + 1)) {
          fn(i);
        }
      }

      /**
       * Get the next non-zero bit starting from a given index.
       * @param {number} i The bit index.
       */
      next(i) {
        const bits = this._bits;
        const n = bits.length;

        let index = i >> 5;
        let curr = bits[index] & (ALL >>> i);

        for (; index < n; curr = bits[++index]) {
          if (curr !== 0) {
            return (index << 5) + Math.clz32(curr);
          }
        }

        return -1;
      }

      /**
       * Return the index of the nth non-zero bit.
       * @param {number} n The number of non-zero bits to advance.
       * @return {number} The index of the nth non-zero bit.
       */
      nth(n) {
        let i = this.next(0);
        while (n-- && i >= 0) i = this.next(i + 1);
        return i;
      }

      /**
       * Negate all bits in this bitset.
       * Modifies this BitSet in place.
       * @return {this}
       */
      not() {
        const bits = this._bits;
        const n = bits.length;

        // invert all bits
        for (let i = 0; i < n; ++i) {
          bits[i] = ~bits[i];
        }

        // unset extraneous trailing bits
        const tail = this._size % 32;
        if (tail) {
          bits[n - 1] &= ONE >> (tail - 1);
        }

        return this;
      }

      /**
       * Compute the logical AND of this BitSet and another.
       * @param {BitSet} bitset The BitSet to combine with.
       * @return {BitSet} This BitSet updated with the logical AND.
       */
      and(bitset) {
        if (bitset) {
          const a = this._bits;
          const b = bitset._bits;
          const n = a.length;

          for (let i = 0; i < n; ++i) {
            a[i] &= b[i];
          }
        }
        return this;
      }

      /**
       * Compute the logical OR of this BitSet and another.
       * @param {BitSet} bitset The BitSet to combine with.
       * @return {BitSet} This BitSet updated with the logical OR.
       */
      or(bitset) {
        if (bitset) {
          const a = this._bits;
          const b = bitset._bits;
          const n = a.length;

          for (let i = 0; i < n; ++i) {
            a[i] |= b[i];
          }
        }
        return this;
      }
    }

    /**
     * Options for Apache Arrow import.
     * @typedef {object} ArrowOptions
     * @property {import('../table/transformable').Select} columns
     *  An ordered set of columns to import. The input may consist of column name
     *  strings, column integer indices, objects with current column names as keys
     *  and new column names as values (for renaming), or selection helper
     *  functions such as {@link all}, {@link not}, or {@link range}.
     */

    /**
     * Create a new table backed by an Apache Arrow table instance.
     * @param {object} arrow An Apache Arrow data table or byte buffer.
     * @param {ArrowOptions} options Options for Arrow import.
     * @return {ColumnTable} A new table containing the imported values.
     */
    function fromArrow(arrow, options = {}) {
      arrow = from$1(arrow);
      const { chunks, length, schema } = arrow;

      // resolve column selection
      const fields = schema.fields.map(f => f.name);
      const sel = resolve({
        columnNames: test => test ? fields.filter(test) : fields.slice(),
        columnIndex: name => fields.indexOf(name)
      }, options.columns || all());

      // build Arquero columns for backing Arrow columns
      const cols = columnSet();
      sel.forEach((name, key) => {
        cols.add(name, arrowColumn(arrow.getColumn(key)));
      });

      // build row filter bit mask as needed
      const bits = arrow.count() !== length ? new BitSet(length) : null;
      if (bits) {
        let b = 0;
        let c = 0;
        arrow.scan(
          idx => bits.set(b + idx),
          batch => { while (chunks[c] !== batch) b += chunks[c++].length; }
        );
      }

      return new ColumnTable(cols.data, cols.names, bits);
    }

    var identity = x => x;

    const parseBoolean = [ // boolean
      v => (v === 'true') || (v === 'false'),
      v => v === 'false' ? false : true
    ];

    const parseNumber = [ // number
      v => v === 'NaN' || (v = +v) === v,
      v => +v
    ];

    const parseDate = [ // iso date
      isISODateString,
      v => new Date(Date.parse(v))
    ];

    function numberParser(options) {
      const { decimal } = options;
      return decimal && decimal !== '.'
        ? parseNumber.map(f => s => f(s && s.replace(decimal, '.')))
        : parseNumber;
    }

    function valueParser(values, options) {
      const types = [parseBoolean, numberParser(options), parseDate];
      const n = types.length;
      for (let i = 0; i < n; ++i) {
        const [test, parser] = types[i];
        if (check$1(values, test)) {
          return parser;
        }
      }
      return identity;
    }

    function check$1(values, test) {
      const n = values.length;
      for (let i = 0; i < n; ++i) {
        const v = values[i];
        if (v != null && !test(v)) {
          return false;
        }
      }
      return true;
    }

    function defaultNames(n, off = 0) {
      return repeat(n - off, i => `col${i + off + 1}`);
    }

    function fromTextRows(next, names, options) {
      let row = next();
      const n = row.length;
      const automax = +options.autoMax || 1000;
      const values = repeat(n, () => []);
      names = names
        ? names.length < n ? [...names, defaultNames(n, names.length)] : names
        : defaultNames(n);

      // read in initial rows to guess types
      let idx = 0;
      for (; idx < automax && row; ++idx, row = next()) {
        for (let i = 0; i < n; ++i) {
          values[i].push(row[i] === '' ? null : row[i]);
        }
      }

      // initialize parsers
      const parsers = getParsers(names, values, options);

      // apply parsers
      parsers.forEach((parse, i) => {
        if (parse === identity) return;
        const v = values[i];
        for (let r = 0; r < idx; ++r) {
          if (v[r] != null) v[r] = parse(v[r]);
        }
      });

      // parse remainder of file
      for (; row; row = next()) {
        for (let i = 0; i < n; ++i) {
          values[i].push(row[i] ? parsers[i](row[i]) : null);
        }
      }

      const columns = {};
      names.forEach((name, i) => columns[name] = values[i]);
      return new ColumnTable(columns, names);
    }

    function getParsers(names, values, options) {
      const { parse = {} } = options;
      const noParse = options.autoType === false;

      return names.map(
        (name, i) => isFunction$1(parse[name]) ? parse[name]
          : noParse ? identity
          : valueParser(values[i], options)
      );
    }

    const EOL = {};
    const EOF = {};
    const QUOTE = 34;
    const NEWLINE = 10;
    const RETURN = 13;

    function filter(read, skip, drop) {
      // skip initial lines, if requested
      let s = +skip || 0;
      while (--s >= 0) read();

      // return filtered stream
      return drop ? () => {
        let line;
        while (!line) {
          if (drop(line = read())) line = null;
          else return line;
        }
      } : read;
    }

    // Adapted from d3-dsv: https://github.com/d3/d3-dsv/blob/master/src/dsv.js
    // Copyright 2013-2016 Mike Bostock
    // All rights reserved.
    // Redistribution and use in source and binary forms, with or without modification,
    // are permitted provided that the following conditions are met:
    // * Redistributions of source code must retain the above copyright notice, this
    //   list of conditions and the following disclaimer.
    // * Redistributions in binary form must reproduce the above copyright notice,
    //   this list of conditions and the following disclaimer in the documentation
    //   and/or other materials provided with the distribution.
    // * Neither the name of the author nor the names of contributors may be used to
    //   endorse or promote products derived from this software without specific prior
    //   written permission.
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    function parseDelimited(text, { delimiter = ',', skip, comment }) {
      if (delimiter.length !== 1) {
        error(`Text "delimiter" should be a single character, found "${delimiter}"`);
      }
      const delimCode = delimiter.charCodeAt(0);

      let N = text.length;
      let I = 0; // current character index
      let t; // current token
      let eof = N <= 0; // current token followed by EOF?
      let eol = false; // current token followed by EOL?

      // Strip the trailing newline.
      if (text.charCodeAt(N - 1) === NEWLINE) --N;
      if (text.charCodeAt(N - 1) === RETURN) --N;

      function token() {
        if (eof) return EOF;
        if (eol) return eol = false, EOL;

        // Unescape quotes.
        const j = I;
        let i, c;
        if (text.charCodeAt(j) === QUOTE) {
          while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);
          if ((i = I) >= N) eof = true;
          else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;
          else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
          return text.slice(j + 1, i - 1).replace(/""/g, '"');
        }

        // Find next delimiter or newline.
        while (I < N) {
          if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
          else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
          else if (c !== delimCode) continue;
          return text.slice(j, i);
        }

        // Return last token before EOF.
        return eof = true, text.slice(j, N);
      }

      function next() {
        if ((t = token()) !== EOF) {
          const row = [];
          while (t !== EOL && t !== EOF) row.push(t), t = token();
          return row;
        }
      }

      return filter(
        next, skip,
        comment && (x => (x && x[0] || '').startsWith(comment))
      );
    }

    /**
     * Options for CSV parsing.
     * @typedef {object} CSVParseOptions
     * @property {string} [delimiter=','] Single-character delimiter between values.
     * @property {string} [decimal='.'] Single-character numeric decimal separator.
     * @property {boolean} [header=true] Flag to specify presence of header row.
     *  If true, assumes the CSV contains a header row with column names. If false,
     *  indicates the CSV does not contain a header row; columns are given the
     *  names 'col1', 'col2', etc unless the *names* option is specified.
     * @property {string[]} [names] An array of column names to use for header-less
     *  CSV files. This option is ignored if the header option is true.
     * @property {number} [skip=0] The number of lines to skip before reading data.
     * @property {string} [comment] A string used to identify comment lines. Any
     *  lines that start with the comment pattern are skipped.
     * @property {boolean} [autoType=true] Flag for automatic type inference.
     * @property {number} [autoMax=1000] Maximum number of initial values to use
     *  for type inference.
     * @property {Object.<string, (value: string) => any>} [parse] Object of
     *  column parsing options. The object keys should be column names. The object
     *  values should be parsing functions that transform values upon input.
     */

    /**
     * Parse a comma-separated values (CSV) string into a table. Other
     * delimiters, such as tabs or pipes ('|'), can be specified using
     * the options argument. By default, automatic type inference is performed
     * for input values; string values that match the ISO standard
     * date format are parsed into JavaScript Date objects. To disable this
     * behavior, set the autoType option to false. To perform custom parsing
     * of input column values, use the parse option.
     * @param {string} text A string in a delimited-value format.
     * @param {CSVParseOptions} options The formatting options.
     * @return {ColumnTable} A new table containing the parsed values.
     */
    function fromCSV(text, options = {}) {
      const next = parseDelimited(text, options);
      return fromTextRows(
        next,
        options.header !== false ? next() : options.names,
        options
      );
    }

    function parseLines(text, { skip, comment }) {
      let N = text.length;
      let I = 0; // current character index

      // Strip the trailing newline.
      if (text.charCodeAt(N - 1) === NEWLINE) --N;
      if (text.charCodeAt(N - 1) === RETURN) --N;

      function read() {
        if (I >= N) return;

        const j = I;
        let eol = false;
        let i, c;

        // Find next newline.
        while (I < N) {
          if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
          else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
          if (eol) return text.slice(j, i);
        }

        // Return last line before EOF.
        return text.slice(j, N);
      }

      return filter(
        read, skip,
        comment && (x => (x || '').startsWith(comment))
      );
    }

    /**
     * Options for fixed width file parsing.
     * @typedef {object} FixedParseOptions
     * @property {[number, number][]} [positions] Array of start, end indices for
     *  fixed-width columns.
     * @property {number[]} [widths] Array of fixed column widths. This option is
     *  ignored if the positions property is specified.
     * @property {string[]} [names] An array of column names. The array length
     *  should match the length of the positions array. If not specified or
     *  shorter than the positions array, default column names are generated.
     * @property {string} [decimal='.'] Single-character numeric decimal separator.
     * @property {number} [skip=0] The number of lines to skip before reading data.
     * @property {string} [comment] A string used to identify comment lines. Any
     *  lines that start with the comment pattern are skipped.
     * @property {boolean} [autoType=true] Flag for automatic type inference.
     * @property {number} [autoMax=1000] Maximum number of initial values to use
     *  for type inference.
     * @property {Object.<string, (value: string) => any>} [parse] Object of
     *  column parsing options. The object keys should be column names. The object
     *  values should be parsing functions that transform values upon input.
     */

    /**
     * Parse a fixed-width file (FWF) string into a table. By default, automatic
     * type inference is performed for input values; string values that match the
     * ISO standard date format are parsed into JavaScript Date objects. To
     * disable this behavior, set the autoType option to false. To perform custom
     * parsing of input column values, use the parse option.
     * @param {string} text A string in a fixed-width file format.
     * @param {FixedParseOptions} options The formatting options.
     * @return {ColumnTable} A new table containing the parsed values.
     */
    function fromFixed(text, options = {}) {
      const read = parseLines(text, options);
      const p = positions(options);
      return fromTextRows(
        () => {
          const line = read();
          if (line) {
            return p.map(([i, j]) => line.slice(i, j).trim());
          }
        },
        options.names,
        options
      );
    }

    function positions({ positions, widths }) {
      if (!positions && !widths) {
        error('Fixed width files require a "positions" or "widths" option');
      }
      let i = 0;
      return positions || widths.map(w => [i, i += w]);
    }

    function isDigitString(value) {
      const n = value.length;
      for (let i = 0; i < n; ++i) {
        const c = value.charCodeAt(i);
        if (c < 48 || c > 57) return false;
      }
      return true;
    }

    /**
     * Options for JSON parsing.
     * @typedef {object} JSONParseOptions
     * @property {boolean} [autoType=true] Flag controlling automatic type
     *  inference. If false, date parsing for input JSON strings is disabled.
     * @property {Object.<string, (value: any) => any>} [parse] Object of column
     *  parsing options. The object keys should be column names. The object values
     *  should be parsing functions that transform values upon input.
     */

    /**
     * Parse JavaScript Object Notation (JSON) data into a table.
     * The expected JSON data format is an object with column names for keys
     * and column value arrays for values. By default string values that match
     * the ISO standard date format are parsed into JavaScript Date objects.
     * To disable this behavior, set the autoType option to false. To perform
     * custom parsing of input column values, use the parse option. Auto-type
     * parsing is not performed for columns with custom parse options.
     * The data payload can also be provided as the "data" property of an
     * enclosing object, with an optional "schema" property containing table
     * metadata such as a "fields" array of ordered column information.
     * @param {string|object} data A string in JSON format, or pre-parsed object.
     * @param {JSONParseOptions} options The formatting options.
     * @return {ColumnTable} A new table containing the parsed values.
     */
    function fromJSON(json, options = {}) {
      const autoType = defaultTrue(options.autoType);

      // parse string input
      if (isString(json)) {
        json = JSON.parse(json);
      }

      // separate schema and data, as needed
      let data = json.data, names;
      if (isObject$1(data) && !isArrayType(data)) {
        if (json.schema && json.schema.fields) {
          names = json.schema.fields.map(f => f.name);
        }
      } else {
        data = json;
      }

      // parse values as necessary
      if (autoType || options.parse) {
        const parsers = options.parse || {};
        for (const name in data) {
          const col = data[name];
          const len = col.length;
          if (parsers[name]) {
            // apply custom parser
            for (let i = 0; i < len; ++i) {
              col[i] = parsers[name](col[i]);
            }
          } else if (autoType) {
            // apply autoType parser
            for (let i = 0; i < len; ++i) {
              const val = col[i];
              if (isString(val) && isISODateString(val) && !isDigitString(val)) {
                col[i] = new Date(val);
              }
            }
          }
        }
      }

      return new ColumnTable(data, names);
    }

    function __dedupe(table, keys = []) {
      return table
        .groupby(keys.length ? keys : table.columnNames())
        .filter('row_number() === 1')
        .ungroup()
        .reify();
    }

    function _select(table, columns) {
      const cols = columnSet();

      columns.forEach((value, curr) => {
        const next = isString(value) ? value : curr;
        if (next) {
          const col = table.column(curr) || error(`Unrecognized column: ${curr}`);
          cols.add(next, col);
        }
      });

      return table.create(cols);
    }

    function __relocate(table, columns, { before, after } = {}) {
      const bef = before != null;
      const aft = after != null;

      if (!(bef || aft)) {
        error('relocate requires a before or after option.');
      }
      if (bef && aft) {
        error('relocate accepts only one of the before or after options.');
      }

      columns = resolve(table, columns);
      const anchors = [...resolve(table, bef ? before : after).keys()];
      const anchor = bef ? anchors[0] : anchors.pop();
      const select = new Map();

      // marshal inputs to select in desired order
      table.columnNames().forEach(name => {
        // check if we should assign the current column
        const assign = !columns.has(name);

        // at anchor column, insert relocated columns
        if (name === anchor) {
          if (aft && assign) select.set(name, name);
          for (const [key, value] of columns) {
            select.set(key, value);
          }
          if (aft) return; // exit if current column has been handled
        }

        if (assign) select.set(name, name);
      });

      return _select(table, select);
    }

    function concat(list, fn = (x => x), delim = '') {
      const n = list.length;
      if (!n) return '';

      let s = fn(list[0], 0);
      for (let i = 1; i < n; ++i) {
        s += delim + fn(list[i], i);
      }

      return s;
    }

    function ascending(a, b) {
      return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
    }

    function min(values, start = 0, stop = values.length) {
      let min = stop ? values[start++] : NULL;

      for (let i = start; i < stop; ++i) {
        if (min > values[i]) {
          min = values[i];
        }
      }

      return min;
    }

    function max(values, start = 0, stop = values.length) {
      let max = stop ? values[start++] : NULL;

      for (let i = start; i < stop; ++i) {
        if (max < values[i]) {
          max = values[i];
        }
      }

      return max;
    }

    function toNumeric(value) {
      return isBigInt(value) ? value : +value;
    }

    function quantile(values, p) {
      const n = values.length;

      if (!n) return NULL;
      if ((p = +p) <= 0 || n < 2) return toNumeric(values[0]);
      if (p >= 1) return toNumeric(values[n - 1]);

      const i = (n - 1) * p;
      const i0 = Math.floor(i);
      const v0 = toNumeric(values[i0]);
      return isBigInt(v0)
        ? v0
        : v0 + (toNumeric(values[i0 + 1]) - v0) * (i - i0);
    }

    class ValueList {
      constructor(values) {
        this._values = values || [];
        this._sorted = null;
        this._start = 0;
      }

      values(copy) {
        if (this._start) {
          this._values = this._values.slice(this._start);
          this._start = 0;
        }
        return copy
          ? this._values.slice()
          : this._values;
      }

      add(value) {
        this._values.push(value);
        this._sorted = null;
      }

      rem() {
        this._start += 1;
        this._sorted = null;
      }

      min() {
        return this._sorted && this._sorted.length
          ? this._sorted[0]
          : min(this._values, this._start);
      }

      max() {
        return this._sorted && this._sorted.length
          ? this._sorted[this._sorted.length - 1]
          : max(this._values, this._start);
      }

      quantile(p) {
        if (!this._sorted) {
          this._sorted = this.values(true);
          this._sorted.sort(ascending);
        }
        return quantile(this._sorted, p);
      }
    }

    const update = (ops, args, fn) => unroll(
      args,
      '{' + concat(ops, (_, i) => `_${i}.${fn}(${args});`) + '}',
      ops
    );

    function fieldReducer(oplist, stream) {
      const { ops, output } = expand$1(oplist, stream);
      const fields = oplist[0].fields;
      const n = fields.length;
      const cls = n === 0 ? FieldReducer
        : n === 1 ? Field1Reducer
        : n === 2 ? Field2Reducer
        : error('Unsupported field count: ' + n);
      return new cls(fields, ops, output, stream);
    }

    function expand$1(oplist, stream) {
      const has = {};
      const ops = [];

      function add(name, params = []) {
        // check key
        const key = name + ':' + params;
        if (has[key]) return has[key];

        // get op instance
        const def = getAggregate(name);
        const op = def.create(...params);

        // add required dependencies
        if (stream < 0 && def.stream) {
          def.stream.forEach(name => add(name, []));
        }
        if (def.req) {
          def.req.forEach(name => add(name, []));
        }

        // update state
        has[key] = op;
        ops.push(op);

        return op;
      }

      const output = oplist.map(item => {
        const op = add(item.name, item.params);
        op.output = item.id;
        return op;
      });

      return { ops, output };
    }

    class FieldReducer extends Reducer {
      constructor(fields, ops, outputs, stream) {
        super(outputs);
        this._op = ops;
        this._fields = fields;
        this._stream = !!stream;
      }

      init() {
        const state = { count: 0, valid: 0, stream: this._stream };
        this._op.forEach(op => op.init(state));

        // value list requested
        if (state.values) {
          state.list = new ValueList();
        }

        return state;
      }

      write(state, values, index) {
        const op = this._outputs;
        const n = op.length;
        for (let i = 0; i < n; ++i) {
          values[op[i].output][index] = op[i].value(state);
        }
        return 1;
      }

      _add() {
      }

      _rem() {
      }

      add(state) {
        ++state.count;
      }

      rem(state) {
        --state.count;
      }
    }

    class Field1Reducer extends FieldReducer {
      constructor(fields, ops, outputs, stream) {
        super(fields, ops, outputs, stream);

        // unroll op invocations for performance
        const args = ['state', 'v1', 'v2'];
        this._add = update(ops, args, 'add');
        this._rem = update(ops, args, 'rem');
      }

      add(state, row, data) {
        const value = this._fields[0](row, data);
        ++state.count;
        if (isValid(value)) {
          ++state.valid;
          if (state.list) state.list.add(value);
          this._add(state, value);
        }
      }

      rem(state, row, data) {
        const value = this._fields[0](row, data);
        --state.count;
        if (isValid(value)) {
          --state.valid;
          if (state.list) state.list.rem();
          this._rem(state, value);
        }
      }
    }

    class Field2Reducer extends FieldReducer {
      constructor(fields, ops, outputs, stream) {
        super(fields, ops, outputs, stream);

        // unroll op invocations for performance
        const args = ['state', 'v1', 'v2'];
        this._add = update(ops, args, 'add');
        this._rem = update(ops, args, 'rem');
      }

      add(state, row, data) {
        const value1 = this._fields[0](row, data);
        const value2 = this._fields[1](row, data);
        ++state.count;
        if (isValid(value1) && isValid(value2)) {
          ++state.valid;
          if (state.list) state.list.add([value1, value2]);
          this._add(state, value1, value2);
        }
      }

      rem(state, row, data) {
        const value1 = this._fields[0](row, data);
        const value2 = this._fields[1](row, data);
        --state.count;
        if (isValid(value1) && isValid(value2)) {
          --state.valid;
          if (state.list) state.list.rem();
          this._rem(state, value1, value2);
        }
      }
    }

    function aggregateGet(table, ops, get) {
      if (ops.length) {
        const data = table.data();
        const { keys } = table.groups() || {};
        const result = aggregate(table, ops);
        const op = keys
          ? (name, row) => result[name][keys[row]]
          : name => result[name][0];
        get = get.map(f => row => f(row, data, op));
      }

      return get;
    }

    function aggregate(table, ops, result) {
      if (!ops.length) return result; // early exit

      // instantiate aggregators and result store
      const aggrs = reducers(ops);
      const groups = table.groups();
      const size = groups ? groups.size : 1;
      result = result || repeat(ops.length, () => Array(size));

      // compute aggregates, extract results
      if (size > 1) {
        aggrs.forEach(aggr => {
          const cells = reduceGroups(table, aggr, groups);
          for (let i = 0; i < size; ++i) {
            aggr.write(cells[i], result, i);
          }
        });
      } else {
        aggrs.forEach(aggr => {
          const cell = reduceFlat(table, aggr);
          aggr.write(cell, result, 0);
        });
      }

      return result;
    }

    function reducers(ops, stream) {
      const aggrs = [];
      const fields = {};

      // group operators by field inputs
      for (const op of ops) {
        const key = op.fields.map(f => f + '').join(',');
        (fields[key] || (fields[key] = [])).push(op);
      }

      // generate a field reducer for each field
      for (const key in fields) {
        aggrs.push(fieldReducer(fields[key], stream));
      }

      return aggrs;
    }

    function reduceFlat(table, reducer) {
      // initialize aggregation cell
      const cell = reducer.init();

      // compute aggregate values
      // inline the following for performance:
      // table.scan((row, data) => reducer.add(cell, row, data));
      const n = table.totalRows();
      const data = table.data();
      const bits = table.mask();

      if (table.isOrdered()) {
        const idx = table.indices();
        for (let i = 0; i < n; ++i) {
          reducer.add(cell, idx[i], data);
        }
      } else if (bits) {
        for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
          reducer.add(cell, i, data);
        }
      } else {
        for (let i = 0; i < n; ++i) {
          reducer.add(cell, i, data);
        }
      }

      return cell;
    }

    function reduceGroups(table, reducer, groups) {
      const { keys, size } = groups;

      // initialize aggregation cells
      const cells = repeat(size, () => reducer.init());

      // compute aggregate values
      // inline the following for performance:
      // table.scan((row, data) => reducer.add(cells[keys[row]], row, data));
      const data = table.data();

      if (table.isOrdered()) {
        const idx = table.indices();
        const m = idx.length;
        for (let i = 0; i < m; ++i) {
          const row = idx[i];
          reducer.add(cells[keys[row]], row, data);
        }
      } else if (table.isFiltered()) {
        const bits = table.mask();
        for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
          reducer.add(cells[keys[i]], i, data);
        }
      } else {
        const n = table.totalRows();
        for (let i = 0; i < n; ++i) {
          reducer.add(cells[keys[i]], i, data);
        }
      }

      return cells;
    }

    function groupOutput(cols, groups) {
      const { get, names, rows, size } = groups;

      // write group values to output columns
      const m = names.length;
      for (let j = 0; j < m; ++j) {
        const col = cols.add(names[j], Array(size));
        const val = get[j];
        for (let i = 0; i < size; ++i) {
          col[i] = val(rows[i]);
        }
      }
    }

    function bisector(compare) {
      return {
        left(a, x, lo, hi) {
          if (lo == null) lo = 0;
          if (hi == null) hi = a.length;
          while (lo < hi) {
            const mid = lo + hi >>> 1;
            if (compare(a[mid], x) < 0) lo = mid + 1;
            else hi = mid;
          }
          return lo;
        },
        right(a, x, lo, hi) {
          if (lo == null) lo = 0;
          if (hi == null) hi = a.length;
          while (lo < hi) {
            const mid = lo + hi >>> 1;
            if (compare(a[mid], x) > 0) hi = mid;
            else lo = mid + 1;
          }
          return lo;
        }
      };
    }

    const bisect = bisector(ascending);

    function windowState(data, frame, adjust, ops, aggrs) {
      let rows, peer, cells, result, key;
      const isPeer = index => peer[index - 1] === peer[index];
      const numOps = ops.length;
      const numAgg = aggrs.length;

      const evaluate = ops.length
        ? unroll(
            ['w', 'r', 'k'],
            '{' + concat(ops, (_, i) => `r[_${i}.id][k]=_${i}.value(w,_${i}.get);`) + '}',
            ops
          )
        : () => {};

      const w = {
        i0: 0,
        i1: 0,
        index: 0,
        size: 0,
        peer: isPeer,

        init(partition, peers, results, group) {
          w.index = w.i0 = w.i1 = 0;
          w.size = peers.length;
          rows = partition;
          peer = peers;
          result = results;
          key = group;

          // initialize aggregates
          cells = aggrs ? aggrs.map(aggr => aggr.init()) : null;

          // initialize window ops
          for (let i = 0; i < numOps; ++i) {
            ops[i].init();
          }

          return w;
        },

        value(index, get) {
          return get(rows[index], data);
        },

        step(idx) {
          const [f0, f1] = frame;
          const n = w.size;
          const p0 = w.i0;
          const p1 = w.i1;

          w.i0 = f0 != null ? Math.max(0, idx - Math.abs(f0)) : 0;
          w.i1 = f1 != null ? Math.min(n, idx + Math.abs(f1) + 1) : n;
          w.index = idx;

          if (adjust) {
            if (w.i0 > 0 && isPeer(w.i0)) {
              w.i0 = bisect.left(peer, peer[w.i0]);
            }
            if (w.i1 < n && isPeer(w.i1)) {
              w.i1 = bisect.right(peer, peer[w.i1 - 1]);
            }
          }

          // evaluate aggregates
          for (let i = 0; i < numAgg; ++i) {
            const aggr = aggrs[i];
            const cell = cells[i];
            for (let j = p0; j < w.i0; ++j) {
              aggr.rem(cell, rows[j], data);
            }
            for (let j = p1; j < w.i1; ++j) {
              aggr.add(cell, rows[j], data);
            }
            aggr.write(cell, result, key);
          }

          // evaluate window ops
          evaluate(w, result, key);

          return result;
        }
      };

      return w;
    }

    const frameValue = op =>
      (op.frame || [null, null]).map(v => Number.isFinite(v) ? Math.abs(v) : null);

    const peersValue = op => !!op.peers;

    function windowOp(spec) {
      const { id, name, fields = [], params = [] } = spec;
      const op = getWindow(name).create(...params);
      if (fields.length) op.get = fields[0];
      op.id = id;
      return op;
    }

    function window$1(table, cols, exprs, result = {}, ops) {
      // instantiate window states
      const data = table.data();
      const states = windowStates(ops, data);
      const nstate = states.length;

      const write = unroll(
        ['r', 'd', 'op'],
        '{' + concat(cols, (_, i) => `_${i}[r] = $${i}(r, d, op);`) + '}',
        cols, exprs
      );

      // scan each ordered partition
      table.partitions().forEach((rows, key) => {
        const size = rows.length;
        const peers = windowPeers(table, rows);

        // initialize window states
        for (let i = 0; i < nstate; ++i) {
          states[i].init(rows, peers, result, key);
        }

        // calculate window values per-row
        const op = id => result[id][key];
        for (let index = 0; index < size; ++index) {
          // advance window frame, updates result object
          for (let i = 0; i < nstate; ++i) {
            states[i].step(index);
          }
          write(rows[index], data, op);
        }
      });
    }

    function windowStates(ops, data) {
      const map = {};

      // group operations by window frame parameters
      ops.forEach(op => {
        const frame = frameValue(op);
        const peers = peersValue(op);
        const key = `${frame},${peers}`;
        const { aggOps, winOps } = map[key] || (map[key] = {
          frame,
          peers,
          aggOps: [],
          winOps: []
        });
        hasAggregate(op.name)
          ? aggOps.push(op)
          : winOps.push(windowOp(op));
      });

      return Object.values(map).map(_ => windowState(
        data, _.frame, _.peers, _.winOps,
        reducers(_.aggOps, _.frame[0] != null ? -1 : 1)
      ));
    }

    function windowPeers(table, rows) {
      if (table.isOrdered()) {
        // generate peer ids for sort equality checking
        const compare = table.comparator();
        const data = table.data();
        const nrows = rows.length;
        const peers = new Uint32Array(nrows);
        for (let i = 1, index = 0; i < nrows; ++i) {
          peers[i] = compare(rows[i - 1], rows[i], data) ? ++index : index;
        }
        return peers;
      } else {
        // no sort, no peers: reuse row indices as peer ids
        return rows;
      }
    }

    function isWindowed(op) {
      return hasWindow(op.name) ||
        op.frame && (
          Number.isFinite(op.frame[0]) ||
          Number.isFinite(op.frame[1])
        );
    }

    function _derive(table, { names, exprs, ops }, options = {}) {
      // instantiate output data
      const total = table.totalRows();
      const cols = columnSet(options.drop ? null : table);
      const data = names.map(name => cols.add(name, Array(total)));

      // analyze operations, compute non-windowed aggregates
      const [ aggOps, winOps ] = segmentOps(ops);

      const size = table.isGrouped() ? table.groups().size : 1;
      const result = aggregate(
        table, aggOps,
        repeat(ops.length, () => Array(size))
      );

      // perform table scans to generate output values
      winOps.length
        ? window$1(table, data, exprs, result, winOps)
        : output$2(table, data, exprs, result);

      return table.create(cols);
    }

    function segmentOps(ops) {
      const aggOps = [];
      const winOps = [];
      const n = ops.length;

      for (let i = 0; i < n; ++i) {
        const op = ops[i];
        op.id = i;
        (isWindowed(op) ? winOps : aggOps).push(op);
      }

      return [aggOps, winOps];
    }

    function output$2(table, cols, exprs, result) {
      const bits = table.mask();
      const data = table.data();
      const { keys } = table.groups() || {};
      const op = keys
        ? (id, row) => result[id][keys[row]]
        : id => result[id][0];

      const m = cols.length;
      for (let j = 0; j < m; ++j) {
        const get = exprs[j];
        const col = cols[j];

        // inline the following for performance:
        // table.scan((i, data) => col[i] = get(i, data, op));
        if (bits) {
          for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
            col[i] = get(i, data, op);
          }
        } else {
          const n = table.totalRows();
          for (let i = 0; i < n; ++i) {
            col[i] = get(i, data, op);
          }
        }
      }
    }

    function __derive(table, values, options = {}) {
      const dt = _derive(table, parse$2(values, { table }), options);

      return options.drop || (options.before == null && options.after == null)
        ? dt
        : __relocate(dt,
            Object.keys(values).filter(name => !table.column(name)),
            options
          );
    }

    function __except(table, others) {
      if (others.length === 0) return table;
      const names = table.columnNames();
      return others.reduce((a, b) => a.antijoin(b.select(names)), table).dedupe();
    }

    function _filter(table, predicate) {
      const n = table.totalRows();
      const bits = table.mask();
      const data = table.data();
      const filter = new BitSet(n);

      // inline the following for performance:
      // table.scan((row, data) => { if (predicate(row, data)) filter.set(row); });
      if (bits) {
        for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
          if (predicate(i, data)) filter.set(i);
        }
      } else {
        for (let i = 0; i < n; ++i) {
          if (predicate(i, data)) filter.set(i);
        }
      }

      return table.create({ filter });
    }

    function __filter(table, criteria) {
      const test = parse$2({ p: criteria }, { table });
      let predicate = test.exprs[0];
      if (test.ops.length) {
        const { data } = _derive(table, test, { drop: true }).column('p');
        predicate = row => data[row];
      }
      return _filter(table, predicate);
    }

    function _unroll(table, { names = [], exprs = [], ops = [] }, options = {}) {
      if (!names.length) return table;

      const limit = options.limit > 0 ? +options.limit : Infinity;
      const index = options.index
        ? options.index === true ? 'index' : options.index + ''
        : null;
      const drop = new Set(options.drop);
      const get = aggregateGet(table, ops, exprs);

      // initialize output columns
      const cols = columnSet();
      const nset = new Set(names);
      const priors = [];
      const copies = [];
      const unroll = [];

      // original and copied columns
      table.columnNames().forEach(name => {
        if (!drop.has(name)) {
          const col = cols.add(name, []);
          if (!nset.has(name)) {
            priors.push(table.column(name));
            copies.push(col);
          }
        }
      });

      // unrolled output columns
      names.forEach(name => {
        if (!drop.has(name)) {
          if (!cols.has(name)) cols.add(name, []);
          unroll.push(cols.data[name]);
        }
      });

      // index column, if requested
      const icol = index ? cols.add(index, []) : null;

      let start = 0;
      const m = priors.length;
      const n = unroll.length;

      const copy = (row, maxlen) => {
        for (let i = 0; i < m; ++i) {
          copies[i].length = start + maxlen;
          copies[i].fill(priors[i].get(row), start, start + maxlen);
        }
      };

      const indices = icol
        ? (row, maxlen) => {
            for (let i = 0; i < maxlen; ++i) {
              icol[row + i] = i;
            }
          }
        : () => {};

      if (n === 1) {
        // optimize common case of one array-valued column
        const fn = get[0];
        const col = unroll[0];

        table.scan((row, data) => {
          // extract array data
          const array = toArray(fn(row, data));
          const maxlen = Math.min(array.length, limit);

          // copy original table data
          copy(row, maxlen);

          // copy unrolled array data
          for (let j = 0; j < maxlen; ++j) {
            col[start + j] = array[j];
          }

          // fill in array indices
          indices(start, maxlen);

          start += maxlen;
        });
      } else {
        table.scan((row, data) => {
          let maxlen = 0;

          // extract parallel array data
          const arrays = get.map(fn => {
            const value = toArray(fn(row, data));
            maxlen = Math.min(Math.max(maxlen, value.length), limit);
            return value;
          });

          // copy original table data
          copy(row, maxlen);

          // copy unrolled array data
          for (let i = 0; i < n; ++i) {
            const col = unroll[i];
            const arr = arrays[i];
            for (let j = 0; j < maxlen; ++j) {
              col[start + j] = arr[j];
            }
          }

          // fill in array indices
          indices(start, maxlen);

          start += maxlen;
        });
      }

      return table.create(cols.new());
    }

    function _fold(table, { names = [], exprs = [], ops = [] }, options = {}) {
      if (names.length === 0) return table;

      const [k = 'key', v = 'value'] = options.as || [];
      const vals = aggregateGet(table, ops, exprs);

      return _unroll(
        table,
        {
          names: [k, v],
          exprs: [() => names, (row, data) => vals.map(fn => fn(row, data))]
        },
        { ...options, drop: names }
      );
    }

    function parse$1(name, table, params, options = { window: false }) {
      const exprs = new Map();

      const marshal = param => {
        param = isNumber$1(param) ? table.columnName(param) : param;
        isString(param) ? exprs.set(param, field(param))
          : isFunction$1(param) ? resolve(table, param).forEach(marshal)
          : isObject$1(param) ? assign(exprs, param)
          : error(`Invalid ${name} value: ${param+''}`);
      };

      toArray(params).forEach(marshal);

      if (options.preparse) {
        options.preparse(exprs);
      }

      return parse$2(exprs, { table, ...options });
    }

    function __fold(table, values, options) {
      return _fold(table, parse$1('fold', table, values), options);
    }

    function _impute(table, values, keys, arrays) {
      const write = keys && keys.length;
      return impute(
        write ? expand(table, keys, arrays) : table,
        values,
        write
      );
    }

    function impute(table, { names, exprs, ops }, write) {
      const gets = aggregateGet(table, ops, exprs);
      const cols = write ? null : columnSet(table);
      const rows = table.totalRows();

      names.forEach((name, i) => {
        const col = table.column(name);
        const out = write ? col.data : cols.add(name, Array(rows));
        const get = gets[i];

        table.scan(idx => {
          const v = col.get(idx);
          out[idx] = !isValid(v) ? get(idx) : v;
        });
      });

      return write ? table : table.create(cols);
    }

    function expand(table, keys, values) {
      const groups = table.groups();
      const data = table.data();

      // expansion keys and accessors
      const keyNames = (groups ? groups.names : []).concat(keys);
      const keyGet = (groups ? groups.get : [])
        .concat(keys.map(key => table.getter(key)));

      // build hash of existing rows
      const hash = new Set();
      const keyTable = keyFunction(keyGet);
      table.scan((idx, data) => hash.add(keyTable(idx, data)));

      // initialize output table data
      const names = table.columnNames();
      const cols = columnSet();
      const out = names.map(name => cols.add(name, []));
      names.forEach((name, i) => {
        const old = data[name];
        const col = out[i];
        table.scan(row => col.push(old.get(row)));
      });

      // enumerate expanded value sets and augment output table
      const keyEnum = keyFunction(keyGet.map((k, i) => a => a[i]));
      const set = unroll(
        'v',
        '{' + out.map((_, i) => `_${i}.push(v[$${i}]);`).join('') + '}',
        out, names.map(name => keyNames.indexOf(name))
      );

      if (groups) {
        let row = groups.keys.length;
        const prod = values.reduce((p, a) => p * a.length, groups.size);
        const keys = new Uint32Array(prod + (row - hash.size));
        keys.set(groups.keys);
        enumerate(groups, values, (vec, idx) => {
          if (!hash.has(keyEnum(vec))) {
            set(vec);
            keys[row++] = idx[0];
          }
        });
        cols.groupby({ ...groups, keys });
      } else {
        enumerate(groups, values, vec => {
          if (!hash.has(keyEnum(vec))) set(vec);
        });
      }

      return table.create(cols.new());
    }

    function enumerate(groups, values, callback) {
      const offset = groups ? groups.get.length : 0;
      const pad = groups ? 1 : 0;
      const len = pad + values.length;
      const lens = new Int32Array(len);
      const idxs = new Int32Array(len);
      const set = [];

      if (groups) {
        const { get, rows, size } = groups;
        lens[0] = size;
        set.push((vec, idx) => {
          const row = rows[idx];
          for (let i = 0; i < offset; ++i) {
            vec[i] = get[i](row);
          }
        });
      }

      values.forEach((a, i) => {
        const j = i + offset;
        lens[i + pad] = a.length;
        set.push((vec, idx) => vec[j] = a[idx]);
      });

      const vec = Array(offset + values.length);

      // initialize value vector
      for (let i = 0; i < len; ++i) {
        set[i](vec, 0);
      }
      callback(vec, idxs);

      // enumerate all combinations of values
      for (let i = len - 1; i >= 0;) {
        const idx = ++idxs[i];
        if (idx < lens[i]) {
          set[i](vec, idx);
          callback(vec, idxs);
          i = len - 1;
        } else {
          idxs[i] = 0;
          set[i](vec, 0);
          --i;
        }
      }
    }

    function _rollup(table, { names, exprs, ops }) {
      // output data
      const cols = columnSet();
      const groups = table.groups();

      // write groupby fields to output
      if (groups) groupOutput(cols, groups);

      // compute and write aggregate output
      output$1(names, exprs, groups, aggregate(table, ops), cols);

      // return output table
      return table.create(cols.new());
    }

    function output$1(names, exprs, groups, result = [], cols) {
      if (!exprs.length) return;
      const size = groups ? groups.size : 1;
      const op = (id, row) => result[id][row];
      const n = names.length;

      for (let i = 0; i < n; ++i) {
        const get = exprs[i];
        if (get.field != null) {
          // if expression is op only, use aggregates directly
          cols.add(names[i], result[get.field]);
        } else if (size > 1) {
          // if multiple groups, evaluate expression for each
          const col = cols.add(names[i], Array(size));
          for (let j = 0; j < size; ++j) {
            col[j] = get(j, null, op);
          }
        } else {
          // if only one group, no need to loop
          cols.add(names[i], [ get(0, null, op) ]);
        }
      }
    }

    function __impute(table, values, options = {}) {
      values = parse$2(values, { table });

      values.names.forEach(name =>
        table.column(name) ? 0 : error(`Invalid impute column ${toString$1(name)}`)
      );

      if (options.expand) {
        const opt = { preparse: preparse$1, aggronly: true };
        const params = parse$1('impute', table, options.expand, opt);
        const result = _rollup(table.ungroup(), params);
        return _impute(
          table, values, params.names,
          params.names.map(name => result.get(name, 0))
        );
      } else {
        return _impute(table, values);
      }
    }

    // map direct field reference to "unique" aggregate
    function preparse$1(map) {
      map.forEach((value, key) =>
        value.field ? map.set(key, array_agg_distinct(value + '')) : 0
      );
    }

    function __intersect(table, others) {
      const names = table.columnNames();
      return others.length
        ? others.reduce((a, b) => a.semijoin(b.select(names)), table).dedupe()
        : table.reify([]);
    }

    function rowLookup(table, hash) {
      const lut = new Map();
      table.scan((row, data) => {
        const key = hash(row, data);
        if (key != null && key === key) {
          lut.set(key, row);
        }
      });
      return lut;
    }

    function indexLookup(idx, data, hash) {
      const lut = new Map();
      const n = idx.length;
      for (let i = 0; i < n; ++i) {
        const row = idx[i];
        const key = hash(row, data);
        if (key != null && key === key) {
          lut.has(key)
            ? lut.get(key).push(i)
            : lut.set(key, [i]);
        }
      }
      return lut;
    }

    function emitter(columns, getters) {
      const args = ['i', 'a', 'j', 'b'];
      return unroll(
        args,
        '{' + concat(columns, (_, i) => `_${i}.push($${i}(${args}));`) + '}',
        columns, getters
      );
    }

    function _join(tableL, tableR, predicate, { names, exprs }, options = {}) {
      // initialize data for left table
      const dataL = tableL.data();
      const idxL = tableL.indices(false);
      const nL = idxL.length;
      const hitL = new Int32Array(nL);

      // initialize data for right table
      const dataR = tableR.data();
      const idxR = tableR.indices(false);
      const nR = idxR.length;
      const hitR = new Int32Array(nR);

      // initialize output data
      const ncols = names.length;
      const cols = columnSet();
      const columns = Array(ncols);
      const getters = Array(ncols);
      for (let i = 0; i < names.length; ++i) {
        columns[i] = cols.add(names[i], []);
        getters[i] = exprs[i];
      }
      const emit = emitter(columns, getters);

      // perform join
      const join = isArray$2(predicate) ? hashJoin : loopJoin;
      join(emit, predicate, dataL, dataR, idxL, idxR, hitL, hitR, nL, nR);

      if (options.left) {
        for (let i = 0; i < nL; ++i) {
          if (!hitL[i]) {
            emit(idxL[i], dataL, -1, dataR);
          }
        }
      }

      if (options.right) {
        for (let j = 0; j < nR; ++j) {
          if (!hitR[j]) {
            emit(-1, dataL, idxR[j], dataR);
          }
        }
      }

      return tableL.create(cols.new());
    }

    function loopJoin(emit, predicate, dataL, dataR, idxL, idxR, hitL, hitR, nL, nR) {
      // perform nested-loops join
      for (let i = 0; i < nL; ++i) {
        const rowL = idxL[i];
        for (let j = 0; j < nR; ++j) {
          const rowR = idxR[j];
          if (predicate(rowL, dataL, rowR, dataR)) {
            emit(rowL, dataL, rowR, dataR);
            hitL[i] = 1;
            hitR[j] = 1;
          }
        }
      }
    }

    function hashJoin(emit, [keyL, keyR], dataL, dataR, idxL, idxR, hitL, hitR, nL, nR) {
      // determine which table to hash
      let dataScan, keyScan, hitScan, idxScan;
      let dataHash, keyHash, hitHash, idxHash;
      let emitScan = emit;
      if (nL >= nR) {
        dataScan = dataL; keyScan = keyL; hitScan = hitL; idxScan = idxL;
        dataHash = dataR; keyHash = keyR; hitHash = hitR; idxHash = idxR;
      } else {
        dataScan = dataR; keyScan = keyR; hitScan = hitR; idxScan = idxR;
        dataHash = dataL; keyHash = keyL; hitHash = hitL; idxHash = idxL;
        emitScan = (i, a, j, b) => emit(j, b, i, a);
      }

      // build lookup table
      const lut = indexLookup(idxHash, dataHash, keyHash);

      // scan other table
      const m = idxScan.length;
      for (let j = 0; j < m; ++j) {
        const rowScan = idxScan[j];
        const list = lut.get(keyScan(rowScan, dataScan));
        if (list) {
          const n = list.length;
          for (let k = 0; k < n; ++k) {
            const i = list[k];
            emitScan(rowScan, dataScan, idxHash[i], dataHash);
            hitHash[i] = 1;
          }
          hitScan[j] = 1;
        }
      }
    }

    function parseKey(name, table, params) {
      const exprs = new Map();

      toArray(params).forEach((param, i) => {
        param = isNumber$1(param) ? table.columnName(param) : param;
        isString(param) ? exprs.set(i, field(param))
          : isFunction$1(param) || isObject$1(param) && param.expr ? exprs.set(i, param)
          : error(`Invalid ${name} key value: ${param+''}`);
      });

      const fn = parse$2(exprs, { table, aggregate: false, window: false });
      return keyFunction(fn.exprs, true);
    }

    function intersect(a, b) {
      const set = new Set(b);
      return a.filter(x => set.has(x));
    }

    function inferKeys(tableL, tableR, on) {
      if (!on) {
        // perform natural join if join condition not provided
        const isect = intersect(tableL.columnNames(), tableR.columnNames());
        if (!isect.length) error('Natural join requires shared column names.');
        on = [isect, isect];
      } else if (isString(on)) {
        on = [on, on];
      } else if (isArray$2(on) && on.length === 1) {
        on = [on[0], on[0]];
      }

      return on;
    }

    function keyPredicate(tableL, tableR, onL, onR) {
      if (onL.length !== onR.length) {
        error('Mismatched number of join keys');
      }
      return [
        parseKey('join', tableL, onL),
        parseKey('join', tableR, onR)
      ];
    }

    const OPT_L = { aggregate: false, window: false };
    const OPT_R = { ...OPT_L, index: 1 };

    function __join(tableL, tableR, on, values, options = {}) {
      on = inferKeys(tableL, tableR, on);
      const optParse = { join: [tableL, tableR] };
      let predicate;

      if (isArray$2(on)) {
        const [onL, onR] = on.map(toArray);
        predicate = keyPredicate(tableL, tableR, onL, onR);

        if (!values) {
          // infer output columns, suppress duplicated key columns
          values = inferValues(tableL, onL, onR, options);
        }
      } else {
        predicate = parse$2({ on }, optParse).exprs[0];

        if (!values) {
          // include all table columns if values not provided
          values = [all(), all()];
        }
      }

      return _join(
        tableL, tableR, predicate,
        parseValues$1(tableL, tableR, values, optParse, options && options.suffix),
        options
      );
    }

    function inferValues(tableL, onL, onR, options) {
      const isect = [];
      onL.forEach((s, i) => isString(s) && s === onR[i] ? isect.push(s) : 0);
      const vR = not(isect);

      if (options.left && options.right) {
        // for full join, merge shared key columns together
        const shared = new Set(isect);
        return [
          tableL.columnNames().map(s => {
            const c = `[${toString$1(s)}]`;
            return shared.has(s)
              ? { [s]: `(a, b) => a${c} == null ? b${c} : a${c}` }
              : s;
          }),
          vR
        ];
      }

      return options.right ? [vR, all()] : [all(), vR];
    }

    function parseValues$1(tableL, tableR, values, optParse, suffix = []) {
      if (isArray$2(values)) {
        let vL, vR, vJ, n = values.length;
        vL = vR = vJ = { names: [], exprs: [] };

        if (n--) {
          vL = parse$1('join', tableL, values[0], optParse);
        }
        if (n--) {
          vR = parse$1('join', tableR, values[1], OPT_R);
        }
        if (n--) {
          vJ = parse$2(values[2], optParse);
        }

        // handle name collisions
        const rename = new Set();
        const namesL = new Set(vL.names);
        vR.names.forEach(name => {
          if (namesL.has(name)) {
            rename.add(name);
          }
        });
        if (rename.size) {
          rekey(vL.names, rename, suffix[0] || '_1');
          rekey(vR.names, rename, suffix[1] || '_2');
        }

        return {
          names: vL.names.concat(vR.names, vJ.names),
          exprs: vL.exprs.concat(vR.exprs, vJ.exprs)
        };
      } else {
        return parse$2(values, optParse);
      }
    }

    function rekey(names, rename, suffix) {
      names.forEach((name, i) => rename.has(name)
        ? (names[i] = name + suffix)
        : 0);
    }

    function _join_filter(tableL, tableR, predicate, options = {}) {
      // calculate semi-join filter mask
      const filter = new BitSet(tableL.totalRows());
      const join = isArray$2(predicate) ? hashSemiJoin : loopSemiJoin;
      join(filter, tableL, tableR, predicate);

      // if anti-join, negate the filter
      if (options.anti) {
        filter.not().and(tableL.mask());
      }

      return tableL.create({ filter });
    }

    function hashSemiJoin(filter, tableL, tableR, [keyL, keyR]) {
      // build lookup table
      const lut = rowLookup(tableR, keyR);

      // scan table, update filter with matches
      tableL.scan((rowL, data) => {
        const rowR = lut.get(keyL(rowL, data));
        if (rowR >= 0) filter.set(rowL);
      });
    }

    function loopSemiJoin(filter, tableL, tableR, predicate) {
      const nL = tableL.numRows();
      const nR = tableR.numRows();
      const dataL = tableL.data();
      const dataR = tableR.data();

      if (tableL.isFiltered() || tableR.isFiltered()) {
        // use indices as at least one table is filtered
        const idxL = tableL.indices(false);
        const idxR = tableR.indices(false);
        for (let i = 0; i < nL; ++i) {
          const rowL = idxL[i];
          for (let j = 0; j < nR; ++j) {
            if (predicate(rowL, dataL, idxR[j], dataR)) {
              filter.set(rowL);
              break;
            }
          }
        }
      } else {
        // no filters, enumerate row indices directly
        for (let i = 0; i < nL; ++i) {
          for (let j = 0; j < nR; ++j) {
            if (predicate(i, dataL, j, dataR)) {
              filter.set(i);
              break;
            }
          }
        }
      }
    }

    // export default function(tableL, tableR, predicate, options = {}) {
    //   const filter = new BitSet(tableL.totalRows());
    //   const nL = tableL.numRows();
    //   const nR = tableR.numRows();
    //   const dataL = tableL.data();
    //   const dataR = tableR.data();

    //   if (tableL.isFiltered() || tableR.isFiltered()) {
    //     // use indices as at least one table is filtered
    //     const idxL = tableL.indices(false);
    //     const idxR = tableR.indices(false);
    //     for (let i = 0; i < nL; ++i) {
    //       const rowL = idxL[i];
    //       for (let j = 0; j < nR; ++j) {
    //         if (predicate(rowL, dataL, idxR[j], dataR)) {
    //           filter.set(rowL);
    //           break;
    //         }
    //       }
    //     }
    //   } else {
    //     // no filters, enumerate row indices directly
    //     for (let i = 0; i < nL; ++i) {
    //       for (let j = 0; j < nR; ++j) {
    //         if (predicate(i, dataL, j, dataR)) {
    //           filter.set(i);
    //           break;
    //         }
    //       }
    //     }
    //   }

    //   // if anti-join, negate the filter
    //   if (options.anti) {
    //     filter.not().and(tableL.mask());
    //   }

    //   return tableL.create({ filter });
    // }

    function __semijoin(tableL, tableR, on, options) {
      on = inferKeys(tableL, tableR, on);

      const predicate = isArray$2(on)
        ? keyPredicate(tableL, tableR, ...on.map(toArray))
        : parse$2({ on }, { join: [tableL, tableR] }).exprs[0];

      return _join_filter(tableL, tableR, predicate, options);
    }

    function _lookup(tableL, tableR, [keyL, keyR], { names, exprs, ops }) {
      // instantiate output data
      const cols = columnSet(tableL);
      const total = tableL.totalRows();
      names.forEach(name => cols.add(name, Array(total).fill(NULL)));

      // build lookup table
      const lut = rowLookup(tableR, keyR);

      // generate setter function for lookup match
      const set = unroll(
        ['lr', 'rr', 'data'],
        '{' + concat(names, (_, i) => `_[${i}][lr] = $[${i}](rr, data);`) + '}',
        names.map(name => cols.data[name]),
        aggregateGet(tableR, ops, exprs)
      );

      // find matching rows, set values on match
      const dataR = tableR.data();
      tableL.scan((lrow, data) => {
        const rrow = lut.get(keyL(lrow, data));
        if (rrow >= 0) set(lrow, rrow, dataR);
      });

      return tableL.create(cols);
    }

    function __lookup(tableL, tableR, on, values) {
      on = inferKeys(tableL, tableR, on);
      return _lookup(
        tableL,
        tableR,
        [ parseKey('lookup', tableL, on[0]), parseKey('lookup', tableR, on[1]) ],
        parse$1('lookup', tableR, values)
      );
    }

    const opt = (value, defaultValue) => value != null ? value : defaultValue;

    function _pivot(table, on, values, options = {}) {
      const { keys, keyColumn } = pivotKeys(table, on, options);
      const vsep = opt(options.valueSeparator, '_');
      const namefn = values.names.length > 1
        ? (i, name) => name + vsep + keys[i]
        : i => keys[i];

      // perform separate aggregate operations for each key
      // if keys do not match, emit NaN so aggregate skips it
      // use custom toString method for proper field resolution
      const results = keys.map(
        k => aggregate(table, values.ops.map(op => {
          const fields = op.fields.map(f => {
            const fn = (r, d) => k === keyColumn[r] ? f(r, d) : NaN;
            fn.toString = () => k + ':' + f + '';
            return fn;
          });
          return { ...op, fields };
        }))
      );

      return table.create(output(values, namefn, table.groups(), results));
    }

    function pivotKeys(table, on, options) {
      const limit = options.limit > 0 ? +options.limit : Infinity;
      const sort = opt(options.sort, true);
      const ksep = opt(options.keySeparator, '_');

      // construct key accessor function
      const get = aggregateGet(table, on.ops, on.exprs);
      const key = get.length === 1
        ? get[0]
        : (row, data) => get.map(fn => fn(row, data)).join(ksep);

      // generate vector of per-row key values
      const kcol = Array(table.totalRows());
      table.scan((row, data) => kcol[row] = key(row, data));

      // collect unique key values
      const uniq = aggregate(
        table.ungroup(),
        [ {
          id: 0,
          name: 'array_agg_distinct',
          fields: [(row => kcol[row])], params: []
        } ]
      )[0][0];

      // get ordered set of unique key values
      const keys = sort ? uniq.sort() : uniq;

      // return key values
      return {
        keys: Number.isFinite(limit) ? keys.slice(0, limit) : keys,
        keyColumn: kcol
      };
    }

    function output({ names, exprs }, namefn, groups, results) {
      const size = groups ? groups.size : 1;
      const cols = columnSet();
      const m = results.length;
      const n = names.length;

      let result;
      const op = (id, row) => result[id][row];

      // write groupby fields to output
      if (groups) groupOutput(cols, groups);

      // write pivot values to output
      for (let i = 0; i < n; ++i) {
        const get = exprs[i];
        if (get.field != null) {
          // if expression is op only, use aggregates directly
          for (let j = 0; j < m; ++j) {
            cols.add(namefn(j, names[i]), results[j][get.field]);
          }
        } else if (size > 1) {
          // if multiple groups, evaluate expression for each
          for (let j = 0; j < m; ++j) {
            result = results[j];
            const col = cols.add(namefn(j, names[i]), Array(size));
            for (let k = 0; k < size; ++k) {
              col[k] = get(k, null, op);
            }
          }
        } else {
          // if only one group, no need to loop
          for (let j = 0; j < m; ++j) {
            result = results[j];
            cols.add(namefn(j, names[i]), [ get(0, null, op) ]);
          }
        }
      }

      return cols.new();
    }

    // TODO: enforce aggregates only (no output changes) for values
    function __pivot(table, on, values, options) {
      return _pivot(
        table,
        parse$1('fold', table, on),
        parse$1('fold', table, values, { preparse, aggronly: true }),
        options
      );
    }

    // map direct field reference to "any" aggregate
    function preparse(map) {
      map.forEach((value, key) =>
        value.field ? map.set(key, any(value + '')) : 0
      );
    }

    function __rename(table, columns) {
      const map = new Map();
      table.columnNames(x => (map.set(x, x), 0));
      return _select(table, resolve(table, columns, map));
    }

    function __rollup(table, values) {
      return _rollup(table, parse$2(values, { table, aggronly: true }));
    }

    function sample(buffer, replace, index, weight) {
      return (
        replace
          ? (weight ? sampleRW : sampleRU)
          : (weight ? sampleNW : sampleNU)
      )(buffer.length, buffer, index, weight);
    }

    // uniform sampling with replacement
    // uses straightforward uniform sampling
    function sampleRU(size, buffer, index) {
      const n = index.length;
      for (let i = 0; i < size; ++i) {
        buffer[i] = index[(n * random()) | 0];
      }
      return buffer;
    }

    // weighted sampling with replacement
    // uses binary search lookup against cumulative weight
    function sampleRW(size, buffer, index, weight) {
      const n = index.length;
      const w = new Float64Array(n);

      let sum = 0;
      for (let i = 0; i < n; ++i) {
        w[i] = (sum += weight(index[i]));
      }

      const bisect = bisector(ascending).right;
      for (let i = 0; i < size; ++i) {
        buffer[i] = index[bisect(w, sum * random())];
      }
      return buffer;
    }

    // uniform sampling without replacement
    // uses reservoir sampling to build out the sample
    // https://en.wikipedia.org/wiki/Reservoir_sampling
    function sampleNU(size, buffer, index) {
      const n = index.length;
      if (size >= n) return index;

      for (let i = 0; i < size; ++i) {
        buffer[i] = index[i];
      }

      for (let i = size; i < n; ++i) {
        const j = i * random();
        if (j < size) {
          buffer[j | 0] = index[i];
        }
      }

      return buffer;
    }

    // weighted sample without replacement
    // uses method of Efraimidis and Spirakis
    // TODO: could use min-heap to improve efficiency
    function sampleNW(size, buffer, index, weight) {
      const n = index.length;
      if (size >= n) return index;

      const w = new Float32Array(n);
      const k = new Uint32Array(n);
      for (let i = 0; i < n; ++i) {
        k[i] = i;
        w[i] = -Math.log(random()) / weight(index[i]);
      }

      k.sort((a, b) => w[a] - w[b]);
      for (let i = 0; i < size; ++i) {
        buffer[i] = index[k[i]];
      }
      return buffer;
    }

    function _shuffle(array, lo = 0, hi = array.length) {
      let n = hi - (lo = +lo);

      while (n) {
        const i = random() * n-- | 0;
        const v = array[n + lo];
        array[n + lo] = array[i + lo];
        array[i + lo] = v;
      }

      return array;
    }

    function _sample(table, size, weight, options = {}) {
      const { replace, shuffle } = options;
      const parts = table.partitions(false);

      let total = 0;
      size = parts.map((idx, group) => {
        let s = size(group);
        total += (s = (replace ? s : Math.min(idx.length, s)));
        return s;
      });

      const samples = new Uint32Array(total);
      let curr = 0;

      parts.forEach((idx, group) => {
        const sz = size[group];
        const buf = samples.subarray(curr, curr += sz);

        if (!replace && sz === idx.length) {
          // sample size === data size, no replacement
          // no need to sample, just copy indices
          buf.set(idx);
        } else {
          sample(buf, replace, idx, weight);
        }
      });

      if (shuffle !== false && (parts.length > 1 || !replace)) {
        // sampling with replacement methods shuffle, so in
        // that case a single partition is already good to go
        _shuffle(samples);
      }

      return table.reify(samples);
    }

    function __sample(table, size, options = {}) {
      return _sample(
        table,
        parseSize(table, size),
        parseWeight(table, options.weight),
        options
      );
    }

    const get = col => row => col.get(row) || 0;

    function parseSize(table, size) {
      return isNumber$1(size)
        ? () => size
        : get(_rollup(table, parse$2({ size }, { table })).column('size'));
    }

    function parseWeight(table, w) {
      if (w == null) return null;
      w = isNumber$1(w) ? table.columnName(w) : w;
      return get(
        isString(w)
          ? table.column(w)
          : _derive(table, parse$2({ w }, { table }), { drop: true }).column('w')
      );
    }

    function __select(table, columns) {
      return _select(table, resolve(table, columns));
    }

    function _spread(table, { names, exprs, ops = [] }, options = {}) {
      if (names.length === 0) return table;

      // ignore 'as' if there are multiple field names
      const as = (names.length === 1 && options.as) || [];
      const drop = options.drop == null ? true : !!options.drop;
      const limit = options.limit == null
        ? as.length || Infinity
        : Math.max(1, +options.limit || 1);

      const get = aggregateGet(table, ops, exprs);
      const cols = columnSet();
      const map = names.reduce((map, name, i) => map.set(name, i), new Map());

      const add = (index, name) => {
        const columns = spread(table, get[index], limit);
        const n = columns.length;
        for (let i = 0; i < n; ++i) {
          cols.add(as[i] || `${name}_${i + 1}`, columns[i]);
        }
      };

      table.columnNames().forEach(name => {
        if (map.has(name)) {
          if (!drop) cols.add(name, table.column(name));
          add(map.get(name), name);
          map.delete(name);
        } else {
          cols.add(name, table.column(name));
        }
      });

      map.forEach(add);

      return table.create(cols);
    }

    function spread(table, get, limit) {
      const nrows = table.totalRows();
      const columns = [];

      table.scan((row, data) => {
        const values = toArray(get(row, data));
        const n = Math.min(values.length, limit);
        while (columns.length < n) {
          columns.push(Array(nrows).fill(NULL));
        }
        for (let i = 0; i < n; ++i) {
          columns[i][row] = values[i];
        }
      });

      return columns;
    }

    function __spread(table, values, options) {
      return _spread(table, parse$1('spread', table, values), options);
    }

    function __union(table, others) {
      return table.concat(others).dedupe();
    }

    function __unroll(table, values, options) {
      return _unroll(
        table,
        parse$1('unroll', table, values),
        options && options.drop
          ? { ...options, drop: parse$1('unroll', table, options.drop).names }
          : options
      );
    }

    function _groupby(table, exprs) {
      return table.create({
        groups: createGroups(table, exprs)
      });
    }

    function createGroups(table, { names = [], exprs = [], ops = [] }) {
      const n = names.length;
      if (n === 0) return null;

      // check for optimized path when grouping by a single field
      // use pre-calculated groups if available
      if (n === 1 && !table.isFiltered() && exprs[0].field) {
        const col = table.column(exprs[0].field);
        if (col.groups) return col.groups(names);
      }

      let get = aggregateGet(table, ops, exprs);
      const getKey = keyFunction(get);
      const nrows = table.totalRows();
      const keys = new Uint32Array(nrows);
      const index = {};
      const rows = [];

      // inline table scan for performance
      const data = table.data();
      const bits = table.mask();
      if (bits) {
        for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
          const key = getKey(i, data) + '';
          const val = index[key];
          keys[i] = val != null ? val : (index[key] = rows.push(i) - 1);
        }
      } else {
        for (let i = 0; i < nrows; ++i) {
          const key = getKey(i, data) + '';
          const val = index[key];
          keys[i] = val != null ? val : (index[key] = rows.push(i) - 1);
        }
      }

      if (!ops.length) {
        // capture data in closure, so no interaction with select
        get = get.map(f => row => f(row, data));
      }

      return { keys, get, names, rows, size: rows.length };
    }

    function __groupby(table, values) {
      return _groupby(table, parse$1('groupby', table, values));
    }

    function _orderby(table, comparator) {
      return table.create({ order: comparator });
    }

    // generate code to compare a single field
    const _compare = (u, v, lt, gt) =>
      `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}
    : (u > v || v == null) && u != null ? ${gt}
    : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}
    : v !== v && u === u ? ${gt} : `;

    function parse(table, fields) {
      // parse expressions, generate code for both a and b values
      const names = [];
      const exprs = [];
      const fn = [];
      let keys = null, opA = '0', opB = '0';
      if (table.isGrouped()) {
        keys = table.groups().keys;
        opA = 'ka';
        opB = 'kb';
      }
      const { ops } = parse$2(fields, {
        table,
        value: (name, node) => {
          names.push(name);
          if (node.escape) {
            // if an escaped function, invoke it directly
            const f = i => `fn[${fn.length}](${i}, data)`;
            exprs.push([f('a'), f('b')]);
            fn.push(node.escape);
          } else {
            // generate code to extract values to compare
            exprs.push([
              codegen(node, { index: 'a', op: opA }),
              codegen(node, { index: 'b', op: opB })
            ]);
          }
        },
        window: false
      });

      // calculate aggregate values if needed
      const result = aggregate(table, ops);
      const op = (id, row) => result[id][row];

      // generate comparison code for each field
      const n = names.length;
      let code = 'return (a, b) => {'
        + (op && table.isGrouped() ? 'const ka = keys[a], kb = keys[b];' : '')
        + 'let u, v; return ';
      for (let i = 0; i < n; ++i) {
        const o = fields.get(names[i]).desc ? -1 : 1;
        const [u, v] = exprs[i];
        code += _compare(u, v, -o, o);
      }
      code += '0;};';

      // instantiate and return comparator function
      return Function('op', 'keys', 'fn', 'data', code)(op, keys, fn, table.data());
    }

    function __orderby(table, values) {
      return _orderby(table, parseValues(table, values));
    }

    function parseValues(table, params) {
      let index = -1;
      const exprs = new Map();
      const add = val => exprs.set(++index + '', val);

      params.forEach(param => {
        const expr = param.expr != null ? param.expr : param;

        if (isObject$1(expr) && !isFunction$1(expr)) {
          for (const key in expr) add(expr[key]);
        } else {
          add(
            isNumber$1(expr) ? field(param, table.columnName(expr))
              : isString(expr) ? field(param)
              : isFunction$1(expr) ? param
              : error(`Invalid orderby field: ${param+''}`)
          );
        }
      });

      return parse(table, exprs);
    }

    function __concat(table, others) {
      const trows = table.numRows();
      const nrows = trows + others.reduce((n, t) => n + t.numRows(), 0);
      if (trows === nrows) return table;

      const tables = [table, ...others];
      const cols = columnSet();

      table.columnNames().forEach(name => {
        const arr = Array(nrows);
        let row = 0;
        tables.forEach(table => {
          const col = table.column(name) || { get: () => NULL };
          table.scan(trow => arr[row++] = col.get(trow));
        });
        cols.add(name, arr);
      });

      return table.create(cols.new());
    }

    function __reduce(table, reducer) {
      const cols = columnSet();
      const groups = table.groups();

      // initialize groups
      const { get, names = [], rows, size = 1 } = groups || {};
      const counts = new Uint32Array(size + 1);
      names.forEach(name => cols.add(name, null));

      // compute reduced values
      const cells = groups
        ? reduceGroups(table, reducer, groups)
        : [ reduceFlat(table, reducer) ];

      // initialize output columns
      reducer.outputs().map(name => cols.add(name, []));

      // write reduced values to output columns
      const n = counts.length - 1;
      let len = 0;
      for (let i = 0; i < n; ++i) {
        len += counts[i + 1] = reducer.write(cells[i], cols.data, counts[i]);
      }

      // write group values to output columns
      if (groups) {
        const data = table.data();
        names.forEach((name, index) => {
          const column = cols.data[name] = Array(len);
          const getter = get[index];
          for (let i = 0, j = 0; i < size; ++i) {
            column.fill(getter(rows[i], data), j, j += counts[i + 1]);
          }
        });
      }

      return table.create(cols.new());
    }

    function __ungroup(table) {
      return table.isGrouped()
        ? table.create({ groups: null })
        : table;
    }

    function __unorder(table) {
      return table.isOrdered()
        ? table.create({ order: null })
        : table;
    }

    var verbs = {
      __antijoin: (table, other, on) =>
        __semijoin(table, other, on, { anti: true }),
      __count: (table, options = {}) =>
        __rollup(table, { [options.as || 'count']: count() }),
      __cross: (table, other, values, options) =>
        __join(table, other, () => true, values, {
          ...options, left: true, right: true
        }),
      __concat,
      __dedupe,
      __derive,
      __except,
      __filter,
      __fold,
      __impute,
      __intersect,
      __join,
      __lookup,
      __pivot,
      __relocate,
      __rename,
      __rollup,
      __sample,
      __select,
      __semijoin,
      __spread,
      __union,
      __unroll,
      __groupby,
      __orderby,
      __ungroup,
      __unorder,
      __reduce
    };

    // Add verb implementations to ColumnTable prototype
    Object.assign(ColumnTable.prototype, verbs);

    /**
     * Create a new table for a set of named columns.
     * @param {object|Map} columns
     *  The set of named column arrays. Keys are column names.
     *  The enumeration order of the keys determines the column indices,
     *  unless the names parameter is specified.
     *  Values must be arrays (or array-like values) of identical length.
     * @param {string[]} [names] Ordered list of column names. If specified,
     *  this array determines the column indices. If not specified, the
     *  key enumeration order of the columns object is used.
     * @return {ColumnTable} the instantiated table
     * @example table({ colA: ['a', 'b', 'c'], colB: [3, 4, 5] })
     */
    function table(columns, names) {
      return ColumnTable.new(columns, names);
    }

    /**
     * Create a new table from an existing object, such as an array of
     * objects or a set of key-value pairs.
     * @param {object|Array|Map} values Data values to populate the table.
     *  If array-valued or iterable, imports rows for each non-null value,
     *  using the provided column names as keys for each row object. If no
     *  names are provided, the first non-null object's own keys are used.
     *  If object- or Map-valued, create columns for the keys and values.
     * @param {string[]} [names] Column names to include.
     *  For object or Map values, specifies the key and value column names.
     *  Otherwise, specifies the keys to look up on each row object.
     * @return {ColumnTable} the instantiated table.
     * @example from([ { colA: 1, colB: 2 }, { colA: 3, colB: 4 } ])
     */
    function from(values, names) {
      return ColumnTable.from(values, names);
    }

    /**
     * Options for file loading.
     * @typedef {object} LoadOptions
     * @property {'arrayBuffer'|'text'|'json'} [as='text'] A string indicating
     *  the data type of the file. One of 'arrayBuffer', 'json', or 'text'.
     * @property {(data: *, options?: object) => ColumnTable} [using] A function
     *  that accepts a data payload (e.g., string or buffer) and an options object
     *  as input and returns an Arquero table (such as fromCSV or fromJSON).
     * @property {object} [fetch] Options to pass to the HTTP fetch method
     *  when loading a URL.
     */

    /**
     * Load data from a file and return a Promise for an Arquero table.
     * A specific format parser can be provided with the *using* option,
     * otherwise CSV format is assumed. The options to this method are
     * passed as the second argument to the format parser.
     * @param {string} url The URL to load.
     * @param {LoadOptions & object} options The loading and formatting options.
     * @return {Promise<ColumnTable>} A Promise for an Arquero table.
     * @example aq.load('data/table.csv')
     * @example aq.load('data/table.json', { using: aq.fromJSON })
     * @example aq.load('data/table.json', { using: aq.from })
     */
    function load(url, options = {}) {
      const parse = options.using || fromCSV;
      return fetch(url, options.fetch)
        .then(res => res[options.as || 'text']())
        .then(data => parse(data, options));
    }

    /**
     * Load an Arrow file from a URL and return a Promise for an Arquero table.
     * @param {string} url The URL to load.
     * @param {LoadOptions & import('./from-arrow').ArrowOptions} options Arrow format options.
     * @return {Promise<ColumnTable>} A Promise for an Arquero table.
     * @example aq.loadArrow('data/table.arrow')
     */
    function loadArrow(url, options) {
      return load(url, { ...options, as: 'arrayBuffer', using: fromArrow });
    }

    /**
     * Load a CSV file from a URL and return a Promise for an Arquero table.
     * @param {string} url The URL to load.
     * @param {LoadOptions & import('./from-csv').CSVParseOptions} options CSV format options.
     * @return {Promise<ColumnTable>} A Promise for an Arquero table.
     * @example aq.loadCSV('data/table.csv')
     * @example aq.loadTSV('data/table.tsv', { delimiter: '\t' })
     */
    function loadCSV(url, options) {
      return load(url, { ...options, as: 'text', using: fromCSV });
    }

    /**
     * Load a fixed width file from a URL and return a Promise for an Arquero table.
     * @param {string} url The URL to load.
     * @param {LoadOptions & import('./from-fixed').FixedParseOptions} options Fixed width format options.
     * @return {Promise<ColumnTable>} A Promise for an Arquero table.
     * @example aq.loadFixedWidth('data/table.txt', { names: ['name', 'city', state'], widths: [10, 20, 2] })
     */
     function loadFixed(url, options) {
      return load(url, { ...options, as: 'text', using: fromFixed });
    }

    /**
     * Load a JSON file from a URL and return a Promise for an Arquero table.
     * If the loaded JSON is array-valued, an array-of-objects format is assumed
     * and the aq.from method is used to construct the table. Otherwise, a
     * column object format is assumed and aq.fromJSON is applied.
     * @param {string} url The URL to load.
     * @param {LoadOptions & import('./from-json').JSONParseOptions} options JSON format options.
     * @return {Promise<ColumnTable>} A Promise for an Arquero table.
     * @example aq.loadJSON('data/table.json')
     */
    function loadJSON(url, options) {
      return load(url, { ...options, as: 'json', using: parseJSON });
    }

    function parseJSON(data, options) {
      return isArray$2(data) ? from(data) : fromJSON(data, options);
    }

    /**
     * Options for binning number values.
     * @typedef {object} BinOptions
     * @property {number} [maxbins] The maximum number of bins.
     * @property {number} [minstep] The minimum step size between bins.
     * @property {number} [step] The exact step size to use between bins.
     *  If specified, the maxbins and minstep options are ignored.
     * @property {boolean} [nice=true] Flag indicating if bins should
     *  snap to "nice" human-friendly values such as multiples of ten.
     * @property {number} [offset=0] Step offset for bin boundaries.
     *  The default floors to the lower bin boundary. A value of 1 snaps
     *  one step higher to the upper bin boundary, and so on.
     */

    /**
     * Generate a table expression that performs uniform binning of
     * number values. The resulting string can be used as part of the
     * input to table transformation verbs.
     * @param {string} name The name of the column to bin.
     * @param {BinOptions} [options] Binning scheme options.
     * @return {string} A table expression string for binned values.
     * @example bin('colA', { maxbins: 20 })
     */
    function bin(name, options = {}) {
      const field = `d[${JSON.stringify(name)}]`;
      const { maxbins, nice, minstep, step, offset } = options;
      const args = [maxbins, nice, minstep, step];

      let n = args.length;
      while (n && args[--n] == null) args.pop();
      const a = args.length ? ', ' + args.map(a => a + '').join(', ') : '';

      return `d => op.bin(${field}, ...op.bins(${field}${a}), ${offset || 0})`;
    }

    /**
     * Escape a function or value to prevent it from being parsed and recompiled.
     * This helper can be used in lieu of single-table table expressions (which
     * are internally parsed and rewritten) to apply a JavaScript function as-is,
     * including support for closures. It can also be used to pass a constant,
     * literal value as a table expression, bypassing the parser.
     * @param {*} value A function or value to escape.
     * @return {object} A wrapper object representing the escaped value.
     * @example escape(d => d.a.toFixed(2))
     * @example escape(d => d.a * -d.b)
     */
    function escape(value) {
      return wrap(value, {
        escape: true,
        toString() { error('Escaped values can not be serialized.'); }
      });
    }

    /**
     * Generate a table expression that computes the number of rows
     * corresponding to a given fraction for each group. The resulting
     * string can be used as part of the input to the sample verb.
     * @param {number} fraction The fractional value.
     * @return {string} A table expression string for computing row counts.
     * @example frac(0.5)
     */
    function frac(fraction) {
      return `() => op.round(${+fraction} * op.count())`;
    }

    /**
     * Select columns by index and rename them to the provided names. Returns a
     * selection helper function that takes a table as input and produces a
     * rename map as output. If the number of provided names is less than the
     * number of table columns, the rename map will only include entries for the
     * provided names. If the number of table columns is less than then number of
     * provided names, only the rename map will only include entries that cover
     * the existing columns.
     * @param {...(string|string[])} names An ordered list of column names.
     * @return {Function} Selection function compatible with {@link Table#select}.
     * @example table.rename(aq.names('a', 'b', 'c'))
     * @example table.select(aq.names(['a', 'b', 'c']))
     */
    function names(...names) {
      names = names.flat();
      return table => {
        const m = new Map();
        const n = Math.min(names.length, table.numCols());
        for (let i = 0; i < n; ++i) {
          m.set(table.columnName(i), names[i]);
        }
        return m;
      };
    }

    /**
     * Convenience function for computing a single aggregate value for
     * a table. Equivalent to ungrouping a table, applying a rollup verb
     * for a single aggregate, and extracting the resulting value.
     * @param {Table} table A table instance.
     * @param {import('../../table/transformable').TableExpr} expr An
     *   aggregate table expression to evaluate.
     * @return {import('../../table/table').DataValue} The aggregate value.
     * @example agg(table, op.max('colA'))
     * @example agg(table, d => [op.min('colA'), op.max('colA')])
     */
    function agg(table, expr) {
      return table.ungroup().rollup({ _: expr }).get('_');
    }

    const onIllegal = (name, type) =>
      error(`Illegal ${type} name: ${toString$1(name)}`);

    const onDefined = (name, type) =>
      error(`The ${type} ${toString$1(name)} is already defined. Use override option?`);

    const onReserve = (name, type) =>
      error(`The ${type} name ${toString$1(name)} is reserved and can not be overridden.`);

    function check(name, options, obj = ops, type = 'function') {
      if (!name) onIllegal(name, type);
      if (!options.override && has(obj, name)) onDefined(name, type);
    }

    // -- Op Functions --------------------------------------------------

    function verifyFunction(name, def, object, options) {
      return object[name] === def || check(name, options);
    }

    /**
     * Register an aggregate or window operation.
     * @param {string} name The name of the operation
     * @param {AggregateDef|WindowDef} def The operation definition.
     * @param {object} object The registry object to add the definition to.
     * @param {RegisterOptions} [options] Registration options.
     */
    function addOp(name, def, object, options = {}) {
      if (verifyFunction(name, def, object, options)) return;
      const [nf = 0, np = 0] = def.param;
      object[name] = def;
      ops[name] = (...params) => op(
        name,
        params.slice(0, nf),
        params.slice(nf, nf + np)
      );
    }

    /**
     * Register a custom aggregate function.
     * @param {string} name The name to use for the aggregate function.
     * @param {AggregateDef} def The aggregate operator definition.
     * @param {RegisterOptions} [options] Function registration options.
     * @throws If a function with the same name is already registered and
     *  the override option is not specified.
     */
    function addAggregateFunction(name, def, options) {
      addOp(name, def, aggregateFunctions, options);
    }

    /**
     * Register a custom window function.
     * @param {string} name The name to use for the window function.
     * @param {WindowDef} def The window operator definition.
     * @param {RegisterOptions} [options] Function registration options.
     * @throws If a function with the same name is already registered and
     *  the override option is not specified.
     */
    function addWindowFunction(name, def, options) {
      addOp(name, def, windowFunctions, options);
    }

    /**
     * Register a function for use within table expressions.
     * If only a single argument is provided, it will be assumed to be a
     * function and the system will try to extract its name.
     * @param {string} name The name to use for the function.
     * @param {Function} fn A standard JavaScript function.
     * @param {RegisterOptions} [options] Function registration options.
     * @throws If a function with the same name is already registered and
     *  the override option is not specified, or if no name is provided
     *  and the input function is anonymous.
     */
    function addFunction(name, fn, options = {}) {
      if (arguments.length === 1) {
        fn = name;
        name = fn.name;
        if (name === '' || name === 'anonymous') {
          error('Anonymous function provided, please include a name argument.');
        } else if (name === ROW_OBJECT) {
          onReserve(ROW_OBJECT, 'function');
        }
      }
      if (verifyFunction(name, fn, functions, options)) return;
      functions[name] = fn;
      ops[name] = fn;
    }

    // -- Table Methods and Verbs ---------------------------------------

    const proto = ColumnTable.prototype;

    /**
     * Reserved table/query methods that must not be overwritten.
     */
    let RESERVED;

    function addReserved(obj) {
      for (; obj; obj = Object.getPrototypeOf(obj)) {
        Object.getOwnPropertyNames(obj).forEach(name => RESERVED[name] = 1);
      }
    }

    function verifyTableMethod(name, fn, options) {
      const type = 'method';

      // exit early if duplicate re-assignment
      if (proto[name] && proto[name].fn === fn) return true;

      // initialize reserved properties to avoid overriding internals
      if (!RESERVED) {
        RESERVED = {};
        addReserved(proto);
        addReserved(Query.prototype);
      }

      // perform name checks
      if (RESERVED[name]) onReserve(name, type);
      if ((name + '')[0] === '_') onIllegal(name, type);
      check(name, options, proto, type);
    }

    /**
     * Register a new table method. A new method will be added to the column
     * table prototype. When invoked from a table, the registered method will
     * be invoked with the table as the first argument, followed by all the
     * provided arguments.
     * @param {string} name The name of the table method.
     * @param {Function} method The table method.
     * @param {RegisterOptions} options
     */
    function addTableMethod(name, method, options = {}) {
      if (verifyTableMethod(name, method, options)) return;
      proto[name] = function(...args) { return method(this, ...args); };
      proto[name].fn = method;
    }

    /**
     * Register a new transformation verb.
     * @param {string} name The name of the verb.
     * @param {Function} method The verb implementation.
     * @param {ParamDef[]} params The verb parameter schema.
     * @param {RegisterOptions} options Function registration options.
     */
    function addVerb(name, method, params, options = {}) {
      // register table method first
      // if that doesn't throw, add serializable verb entry
      addTableMethod(name, method, options);
      addQueryVerb(name, Verbs[name] = createVerb(name, params));
    }

    // -- Package Bundles -----------------------------------------------

    const PACKAGE = 'arquero_package';

    /**
     * Add an extension package of functions, table methods, and/or verbs.
     * @param {Package|PackageBundle} bundle The package of extensions.
     * @throws If package validation fails.
     */
    function addPackage(bundle, options = {}) {
      const pkg = bundle && bundle[PACKAGE] || bundle;
      const parts = {
        functions: [
          (name, def, opt) => verifyFunction(name, def, functions, opt),
          addFunction
        ],
        aggregateFunctions: [
          (name, def, opt) => verifyFunction(name, def, aggregateFunctions, opt),
          addAggregateFunction
        ],
        windowFunctions: [
          (name, def, opt) => verifyFunction(name, def, windowFunctions, opt),
          addWindowFunction
        ],
        tableMethods: [
          verifyTableMethod,
          addTableMethod
        ],
        verbs: [
          (name, obj, opt) => verifyTableMethod(name, obj.method, opt),
          (name, obj, opt) => addVerb(name, obj.method, obj.params, opt)
        ]
      };

      function scan(index) {
        for (const key in parts) {
          const part = parts[key];
          const p = pkg[key];
          for (const name in p) part[index](name, p[name], options);
        }
      }
      scan(0); // first validate package, throw if validation fails
      scan(1); // then add package content
    }

    /**
     * Aggregate function definition.
     * @typedef {import('./op/aggregate-functions').AggregateDef} AggregateDef
     */

    /**
     * Window function definition.
     * @typedef {import('./op/window-functions').WindowDef} WindowDef
     */

    /**
     * Verb parameter definition.
     * @typedef {import('./query/verb').ParamDef} ParamDef
     */

    /**
     * Verb definition.
     * @typedef {object} VerbDef
     * @property {Function} method A function implementing the verb.
     * @property {ParamDef[]} params The verb parameter schema.
     */

    /**
     * Verb parameter definition.
     * @typedef {object} ParamDef
     * @property {string} name The verb parameter name.
     * @property {ParamType} type The verb parameter type.
     */

    /**
     * A package of op function and table method definitions.
     * @typedef {object} Package
     * @property {{[name: string]: Function}} [functions] Standard function entries.
     * @property {{[name: string]: AggregateDef}} [aggregateFunctions] Aggregate function entries.
     * @property {{[name: string]: WindowDef}} [windowFunctions] Window function entries.
     * @property {{[name: string]: Function}} [tableMethods] Table method entries.
     * @property {{[name: string]: VerbDef}} [verbs] Verb entries.
     */

    /**
     * An object containing an extension package.
     * @typedef {object} PackageBundle
     * @property {Package} arquero.package The package bundle.
     */

    /**
     * Options for registering new functions.
     * @typedef {object} RegisterOptions
     * @property {boolean} [override=false] Flag indicating if the added
     *  function can override an existing function with the same name.
     */

    // export internal class definitions

    const internal = {
      Table: Table$1,
      ColumnTable,
      Transformable,
      Query,
      Reducer,
      Verb,
      Verbs,
      columnFactory,
      parse: parse$2,
      walk_ast: walk
    };
    const version = pkg.version;

    var aq = /*#__PURE__*/Object.freeze({
        __proto__: null,
        internal: internal,
        version: version,
        seed: seed,
        Type: Type,
        fromArrow: fromArrow,
        fromCSV: fromCSV,
        fromFixed: fromFixed,
        fromJSON: fromJSON,
        load: load,
        loadArrow: loadArrow,
        loadCSV: loadCSV,
        loadFixed: loadFixed,
        loadJSON: loadJSON,
        toArrow: toArrow,
        bin: bin,
        escape: escape,
        desc: desc,
        field: field,
        frac: frac,
        names: names,
        rolling: rolling,
        all: all,
        endswith: endswith,
        matches: matches,
        not: not,
        range: range,
        startswith: startswith,
        agg: agg,
        op: ops,
        query: query,
        queryFrom: queryFrom,
        addAggregateFunction: addAggregateFunction,
        addWindowFunction: addWindowFunction,
        addFunction: addFunction,
        addTableMethod: addTableMethod,
        addVerb: addVerb,
        addPackage: addPackage,
        table: table,
        from: from
    });

    /* src/ResultView.svelte generated by Svelte v3.46.4 */

    const { Object: Object_1, console: console_1$3 } = globals;
    const file$5 = "src/ResultView.svelte";

    // (81:0) {#if res}
    function create_if_block_3(ctx) {
    	let div0;
    	let p;
    	let b0;
    	let t1;
    	let t2_value = /*res*/ ctx[2].slice + "";
    	let t2;
    	let t3;
    	let html_tag;

    	let raw_value = (/*res*/ ctx[2].transform
    	? `<b style="padding-left:20px">transform: </b> ${/*res*/ ctx[2].transform}`
    	: "") + "";

    	let t4;
    	let b1;
    	let t6;
    	let t7_value = /*res*/ ctx[2].metric + "";
    	let t7;
    	let t8;
    	let div1;
    	let layercake;
    	let current;

    	layercake = new LayerCake({
    			props: {
    				data: Object.keys(/*res*/ ctx[2].modelResults).map(/*func_1*/ ctx[11]),
    				x: "value",
    				z: "model_hash",
    				xDomain: [0, 100],
    				$$slots: { default: [create_default_slot$4] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			div0 = element("div");
    			p = element("p");
    			b0 = element("b");
    			b0.textContent = "slice:";
    			t1 = space();
    			t2 = text(t2_value);
    			t3 = space();
    			html_tag = new HtmlTag();
    			t4 = space();
    			b1 = element("b");
    			b1.textContent = "metric:";
    			t6 = space();
    			t7 = text(t7_value);
    			t8 = space();
    			div1 = element("div");
    			create_component(layercake.$$.fragment);
    			add_location(b0, file$5, 83, 6, 2869);
    			html_tag.a = t4;
    			set_style(b1, "padding-left", "20px");
    			add_location(b1, file$5, 88, 6, 3022);
    			add_location(p, file$5, 82, 4, 2859);
    			attr_dev(div0, "id", "header");
    			add_location(div0, file$5, 81, 2, 2837);
    			attr_dev(div1, "id", "bee");
    			attr_dev(div1, "class", "svelte-1v5kw6w");
    			add_location(div1, file$5, 92, 2, 3104);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div0, anchor);
    			append_dev(div0, p);
    			append_dev(p, b0);
    			append_dev(p, t1);
    			append_dev(p, t2);
    			append_dev(p, t3);
    			html_tag.m(raw_value, p);
    			append_dev(p, t4);
    			append_dev(p, b1);
    			append_dev(p, t6);
    			append_dev(p, t7);
    			insert_dev(target, t8, anchor);
    			insert_dev(target, div1, anchor);
    			mount_component(layercake, div1, null);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty & /*res*/ 4) && t2_value !== (t2_value = /*res*/ ctx[2].slice + "")) set_data_dev(t2, t2_value);

    			if ((!current || dirty & /*res*/ 4) && raw_value !== (raw_value = (/*res*/ ctx[2].transform
    			? `<b style="padding-left:20px">transform: </b> ${/*res*/ ctx[2].transform}`
    			: "") + "")) html_tag.p(raw_value);

    			if ((!current || dirty & /*res*/ 4) && t7_value !== (t7_value = /*res*/ ctx[2].metric + "")) set_data_dev(t7, t7_value);
    			const layercake_changes = {};
    			if (dirty & /*res*/ 4) layercake_changes.data = Object.keys(/*res*/ ctx[2].modelResults).map(/*func_1*/ ctx[11]);

    			if (dirty & /*$$scope, clicked, evt*/ 16408) {
    				layercake_changes.$$scope = { dirty, ctx };
    			}

    			layercake.$set(layercake_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(layercake.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(layercake.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div0);
    			if (detaching) detach_dev(t8);
    			if (detaching) detach_dev(div1);
    			destroy_component(layercake);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_3.name,
    		type: "if",
    		source: "(81:0) {#if res}",
    		ctx
    	});

    	return block;
    }

    // (105:8) {#if evt}
    function create_if_block_4(ctx) {
    	let tooltip;
    	let current;

    	tooltip = new Tooltip({
    			props: {
    				evt: /*evt*/ ctx[4],
    				$$slots: {
    					default: [
    						create_default_slot_3$2,
    						({ detail }) => ({ 13: detail }),
    						({ detail }) => detail ? 8192 : 0
    					]
    				},
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(tooltip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const tooltip_changes = {};
    			if (dirty & /*evt*/ 16) tooltip_changes.evt = /*evt*/ ctx[4];

    			if (dirty & /*$$scope, detail*/ 24576) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_4.name,
    		type: "if",
    		source: "(105:8) {#if evt}",
    		ctx
    	});

    	return block;
    }

    // (106:10) <Tooltip {evt} let:detail>
    function create_default_slot_3$2(ctx) {
    	let p0;
    	let t0;
    	let t1_value = /*detail*/ ctx[13].props.model.split(/[\\/]/).pop() + "";
    	let t1;
    	let t2;
    	let p1;
    	let t3;
    	let t4_value = /*detail*/ ctx[13].props.value.toFixed(2) + "";
    	let t4;
    	let t5;

    	const block = {
    		c: function create() {
    			p0 = element("p");
    			t0 = text("model: ");
    			t1 = text(t1_value);
    			t2 = space();
    			p1 = element("p");
    			t3 = text("metric: ");
    			t4 = text(t4_value);
    			t5 = text("%");
    			add_location(p0, file$5, 106, 12, 3472);
    			add_location(p1, file$5, 107, 12, 3540);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p0, anchor);
    			append_dev(p0, t0);
    			append_dev(p0, t1);
    			insert_dev(target, t2, anchor);
    			insert_dev(target, p1, anchor);
    			append_dev(p1, t3);
    			append_dev(p1, t4);
    			append_dev(p1, t5);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*detail*/ 8192 && t1_value !== (t1_value = /*detail*/ ctx[13].props.model.split(/[\\/]/).pop() + "")) set_data_dev(t1, t1_value);
    			if (dirty & /*detail*/ 8192 && t4_value !== (t4_value = /*detail*/ ctx[13].props.value.toFixed(2) + "")) set_data_dev(t4, t4_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p0);
    			if (detaching) detach_dev(t2);
    			if (detaching) detach_dev(p1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_3$2.name,
    		type: "slot",
    		source: "(106:10) <Tooltip {evt} let:detail>",
    		ctx
    	});

    	return block;
    }

    // (104:6) <Html>
    function create_default_slot_2$2(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*evt*/ ctx[4] && create_if_block_4(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*evt*/ ctx[4]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*evt*/ 16) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block_4(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2$2.name,
    		type: "slot",
    		source: "(104:6) <Html>",
    		ctx
    	});

    	return block;
    }

    // (112:6) <Svg>
    function create_default_slot_1$2(ctx) {
    	let strip;
    	let updating_clicked;
    	let t;
    	let axisx;
    	let current;

    	function strip_clicked_binding(value) {
    		/*strip_clicked_binding*/ ctx[8](value);
    	}

    	let strip_props = {};

    	if (/*clicked*/ ctx[3] !== void 0) {
    		strip_props.clicked = /*clicked*/ ctx[3];
    	}

    	strip = new Strip({ props: strip_props, $$inline: true });
    	binding_callbacks.push(() => bind(strip, 'clicked', strip_clicked_binding));
    	strip.$on("mouseout", /*mouseout_handler*/ ctx[9]);
    	strip.$on("mousemove", /*mousemove_handler*/ ctx[10]);

    	axisx = new AxisX({
    			props: {
    				baseline: true,
    				tickMarks: true,
    				formatTick: func$1
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(strip.$$.fragment);
    			t = space();
    			create_component(axisx.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(strip, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(axisx, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const strip_changes = {};

    			if (!updating_clicked && dirty & /*clicked*/ 8) {
    				updating_clicked = true;
    				strip_changes.clicked = /*clicked*/ ctx[3];
    				add_flush_callback(() => updating_clicked = false);
    			}

    			strip.$set(strip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(strip.$$.fragment, local);
    			transition_in(axisx.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(strip.$$.fragment, local);
    			transition_out(axisx.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(strip, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(axisx, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$2.name,
    		type: "slot",
    		source: "(112:6) <Svg>",
    		ctx
    	});

    	return block;
    }

    // (94:4) <LayerCake       data={Object.keys(res.modelResults).map((model_hash, i) => ({         model: res.modelNames[i],         value: res.modelResults[model_hash],         model_hash: model_hash,       }))}       x="value"       z="model_hash"       xDomain={[0, 100]}     >
    function create_default_slot$4(ctx) {
    	let html;
    	let t;
    	let svg;
    	let current;

    	html = new Html({
    			props: {
    				$$slots: { default: [create_default_slot_2$2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	svg = new Svg({
    			props: {
    				$$slots: { default: [create_default_slot_1$2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(html.$$.fragment);
    			t = space();
    			create_component(svg.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(html, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(svg, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const html_changes = {};

    			if (dirty & /*$$scope, evt*/ 16400) {
    				html_changes.$$scope = { dirty, ctx };
    			}

    			html.$set(html_changes);
    			const svg_changes = {};

    			if (dirty & /*$$scope, clicked, evt*/ 16408) {
    				svg_changes.$$scope = { dirty, ctx };
    			}

    			svg.$set(svg_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(html.$$.fragment, local);
    			transition_in(svg.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(html.$$.fragment, local);
    			transition_out(svg.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(html, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(svg, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$4.name,
    		type: "slot",
    		source: "(94:4) <LayerCake       data={Object.keys(res.modelResults).map((model_hash, i) => ({         model: res.modelNames[i],         value: res.modelResults[model_hash],         model_hash: model_hash,       }))}       x=\\\"value\\\"       z=\\\"model_hash\\\"       xDomain={[0, 100]}     >",
    		ctx
    	});

    	return block;
    }

    // (211:16) 
    function create_if_block_2$1(ctx) {
    	let samples;
    	let current;

    	samples = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				label_col: /*slice*/ ctx[5].label_column,
    				table: /*table*/ ctx[0]
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(samples.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(samples, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const samples_changes = {};
    			if (dirty & /*slice*/ 32) samples_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*slice*/ 32) samples_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*table*/ 1) samples_changes.table = /*table*/ ctx[0];
    			samples.$set(samples_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(samples.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(samples.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(samples, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_2$1.name,
    		type: "if",
    		source: "(211:16) ",
    		ctx
    	});

    	return block;
    }

    // (150:50) 
    function create_if_block_1$1(ctx) {
    	let div8;
    	let div0;
    	let p0;
    	let b0;
    	let t1;
    	let p1;
    	let t2_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][1]))].split(/[\\/]/).pop() + "";
    	let t2;
    	let t3;
    	let p2;
    	let b1;
    	let t5;
    	let div7;
    	let p3;
    	let t6_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][0]))].split(/[\\/]/).pop() + "";
    	let t6;
    	let t7;
    	let div3;
    	let div1;
    	let p4;
    	let b2;
    	let t9;
    	let samples0;
    	let t10;
    	let div2;
    	let p5;
    	let b3;
    	let t12;
    	let samples1;
    	let t13;
    	let div6;
    	let div4;
    	let samples2;
    	let t14;
    	let div5;
    	let samples3;
    	let current;

    	samples0 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				label_col: /*slice*/ ctx[5].label_column,
    				table: /*splitTables*/ ctx[1][0],
    				output_col: "model" + /*clicked*/ ctx[3][0],
    				second_output_col: "model" + /*clicked*/ ctx[3][1]
    			},
    			$$inline: true
    		});

    	samples1 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				label_col: /*slice*/ ctx[5].label_column,
    				table: /*splitTables*/ ctx[1][1],
    				output_col: "model" + /*clicked*/ ctx[3][0],
    				second_output_col: "model" + /*clicked*/ ctx[3][1]
    			},
    			$$inline: true
    		});

    	samples2 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				label_col: /*slice*/ ctx[5].label_column,
    				table: /*splitTables*/ ctx[1][2],
    				output_col: "model" + /*clicked*/ ctx[3][0],
    				second_output_col: "model" + /*clicked*/ ctx[3][1]
    			},
    			$$inline: true
    		});

    	samples3 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				label_col: /*slice*/ ctx[5].label_column,
    				table: /*splitTables*/ ctx[1][3],
    				output_col: "model" + /*clicked*/ ctx[3][0],
    				second_output_col: "model" + /*clicked*/ ctx[3][1]
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			div8 = element("div");
    			div0 = element("div");
    			p0 = element("p");
    			b0 = element("b");
    			b0.textContent = "Positive";
    			t1 = space();
    			p1 = element("p");
    			t2 = text(t2_value);
    			t3 = space();
    			p2 = element("p");
    			b1 = element("b");
    			b1.textContent = "Negative";
    			t5 = space();
    			div7 = element("div");
    			p3 = element("p");
    			t6 = text(t6_value);
    			t7 = space();
    			div3 = element("div");
    			div1 = element("div");
    			p4 = element("p");
    			b2 = element("b");
    			b2.textContent = "Positive";
    			t9 = space();
    			create_component(samples0.$$.fragment);
    			t10 = space();
    			div2 = element("div");
    			p5 = element("p");
    			b3 = element("b");
    			b3.textContent = "Negative";
    			t12 = space();
    			create_component(samples1.$$.fragment);
    			t13 = space();
    			div6 = element("div");
    			div4 = element("div");
    			create_component(samples2.$$.fragment);
    			t14 = space();
    			div5 = element("div");
    			create_component(samples3.$$.fragment);
    			add_location(b0, file$5, 152, 9, 4746);
    			add_location(p0, file$5, 152, 6, 4743);
    			set_style(p1, "margin-right", "20px");
    			add_location(p1, file$5, 153, 6, 4772);
    			add_location(b1, file$5, 158, 9, 4936);
    			add_location(p2, file$5, 158, 6, 4933);
    			add_location(div0, file$5, 151, 4, 4731);
    			add_location(p3, file$5, 161, 6, 4983);
    			add_location(b2, file$5, 168, 13, 5197);
    			add_location(p4, file$5, 168, 10, 5194);
    			set_style(div1, "width", "50%");
    			add_location(div1, file$5, 167, 8, 5159);
    			add_location(b3, file$5, 178, 13, 5524);
    			add_location(p5, file$5, 178, 10, 5521);
    			set_style(div2, "width", "50%");
    			add_location(div2, file$5, 177, 8, 5486);
    			set_style(div3, "display", "inline-flex");
    			add_location(div3, file$5, 166, 6, 5116);
    			set_style(div4, "width", "50%");
    			add_location(div4, file$5, 189, 8, 5867);
    			set_style(div5, "width", "50%");
    			add_location(div5, file$5, 198, 8, 6161);
    			set_style(div6, "display", "inline-flex");
    			add_location(div6, file$5, 188, 6, 5824);
    			add_location(div7, file$5, 160, 4, 4971);
    			set_style(div8, "display", "inline-flex");
    			set_style(div8, "align-items", "center");
    			add_location(div8, file$5, 150, 2, 4671);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div8, anchor);
    			append_dev(div8, div0);
    			append_dev(div0, p0);
    			append_dev(p0, b0);
    			append_dev(div0, t1);
    			append_dev(div0, p1);
    			append_dev(p1, t2);
    			append_dev(div0, t3);
    			append_dev(div0, p2);
    			append_dev(p2, b1);
    			append_dev(div8, t5);
    			append_dev(div8, div7);
    			append_dev(div7, p3);
    			append_dev(p3, t6);
    			append_dev(div7, t7);
    			append_dev(div7, div3);
    			append_dev(div3, div1);
    			append_dev(div1, p4);
    			append_dev(p4, b2);
    			append_dev(div1, t9);
    			mount_component(samples0, div1, null);
    			append_dev(div3, t10);
    			append_dev(div3, div2);
    			append_dev(div2, p5);
    			append_dev(p5, b3);
    			append_dev(div2, t12);
    			mount_component(samples1, div2, null);
    			append_dev(div7, t13);
    			append_dev(div7, div6);
    			append_dev(div6, div4);
    			mount_component(samples2, div4, null);
    			append_dev(div6, t14);
    			append_dev(div6, div5);
    			mount_component(samples3, div5, null);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty & /*res, clicked*/ 12) && t2_value !== (t2_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][1]))].split(/[\\/]/).pop() + "")) set_data_dev(t2, t2_value);
    			if ((!current || dirty & /*res, clicked*/ 12) && t6_value !== (t6_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][0]))].split(/[\\/]/).pop() + "")) set_data_dev(t6, t6_value);
    			const samples0_changes = {};
    			if (dirty & /*slice*/ 32) samples0_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*slice*/ 32) samples0_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*splitTables*/ 2) samples0_changes.table = /*splitTables*/ ctx[1][0];
    			if (dirty & /*clicked*/ 8) samples0_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			if (dirty & /*clicked*/ 8) samples0_changes.second_output_col = "model" + /*clicked*/ ctx[3][1];
    			samples0.$set(samples0_changes);
    			const samples1_changes = {};
    			if (dirty & /*slice*/ 32) samples1_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*slice*/ 32) samples1_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*splitTables*/ 2) samples1_changes.table = /*splitTables*/ ctx[1][1];
    			if (dirty & /*clicked*/ 8) samples1_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			if (dirty & /*clicked*/ 8) samples1_changes.second_output_col = "model" + /*clicked*/ ctx[3][1];
    			samples1.$set(samples1_changes);
    			const samples2_changes = {};
    			if (dirty & /*slice*/ 32) samples2_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*slice*/ 32) samples2_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*splitTables*/ 2) samples2_changes.table = /*splitTables*/ ctx[1][2];
    			if (dirty & /*clicked*/ 8) samples2_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			if (dirty & /*clicked*/ 8) samples2_changes.second_output_col = "model" + /*clicked*/ ctx[3][1];
    			samples2.$set(samples2_changes);
    			const samples3_changes = {};
    			if (dirty & /*slice*/ 32) samples3_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*slice*/ 32) samples3_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*splitTables*/ 2) samples3_changes.table = /*splitTables*/ ctx[1][3];
    			if (dirty & /*clicked*/ 8) samples3_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			if (dirty & /*clicked*/ 8) samples3_changes.second_output_col = "model" + /*clicked*/ ctx[3][1];
    			samples3.$set(samples3_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(samples0.$$.fragment, local);
    			transition_in(samples1.$$.fragment, local);
    			transition_in(samples2.$$.fragment, local);
    			transition_in(samples3.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(samples0.$$.fragment, local);
    			transition_out(samples1.$$.fragment, local);
    			transition_out(samples2.$$.fragment, local);
    			transition_out(samples3.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div8);
    			destroy_component(samples0);
    			destroy_component(samples1);
    			destroy_component(samples2);
    			destroy_component(samples3);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1$1.name,
    		type: "if",
    		source: "(150:50) ",
    		ctx
    	});

    	return block;
    }

    // (124:0) {#if splitTables && splitTables.length === 2}
    function create_if_block$3(ctx) {
    	let p0;
    	let t0_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][0]))].split(/[\\/]/).pop() + "";
    	let t0;
    	let t1;
    	let div2;
    	let div0;
    	let p1;
    	let b0;
    	let t3;
    	let samples0;
    	let t4;
    	let div1;
    	let p2;
    	let b1;
    	let t6;
    	let samples1;
    	let current;

    	samples0 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				table: /*splitTables*/ ctx[1][0],
    				label_col: /*slice*/ ctx[5].label_column,
    				output_col: "model" + /*clicked*/ ctx[3][0]
    			},
    			$$inline: true
    		});

    	samples1 = new Samples({
    			props: {
    				id_col: /*slice*/ ctx[5].id_column,
    				table: /*splitTables*/ ctx[1][1],
    				label_col: /*slice*/ ctx[5].label_column,
    				output_col: "model" + /*clicked*/ ctx[3][0]
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			p0 = element("p");
    			t0 = text(t0_value);
    			t1 = space();
    			div2 = element("div");
    			div0 = element("div");
    			p1 = element("p");
    			b0 = element("b");
    			b0.textContent = "Positive";
    			t3 = space();
    			create_component(samples0.$$.fragment);
    			t4 = space();
    			div1 = element("div");
    			p2 = element("p");
    			b1 = element("b");
    			b1.textContent = "Negative";
    			t6 = space();
    			create_component(samples1.$$.fragment);
    			add_location(p0, file$5, 124, 2, 3985);
    			add_location(b0, file$5, 131, 9, 4171);
    			add_location(p1, file$5, 131, 6, 4168);
    			set_style(div0, "width", "50%");
    			add_location(div0, file$5, 130, 4, 4137);
    			add_location(b1, file$5, 140, 9, 4409);
    			add_location(p2, file$5, 140, 6, 4406);
    			set_style(div1, "width", "50%");
    			add_location(div1, file$5, 139, 4, 4375);
    			set_style(div2, "display", "inline-flex");
    			add_location(div2, file$5, 129, 2, 4098);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p0, anchor);
    			append_dev(p0, t0);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, div2, anchor);
    			append_dev(div2, div0);
    			append_dev(div0, p1);
    			append_dev(p1, b0);
    			append_dev(div0, t3);
    			mount_component(samples0, div0, null);
    			append_dev(div2, t4);
    			append_dev(div2, div1);
    			append_dev(div1, p2);
    			append_dev(p2, b1);
    			append_dev(div1, t6);
    			mount_component(samples1, div1, null);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty & /*res, clicked*/ 12) && t0_value !== (t0_value = /*res*/ ctx[2].modelNames[/*res*/ ctx[2].modelIds.indexOf(parseInt(/*clicked*/ ctx[3][0]))].split(/[\\/]/).pop() + "")) set_data_dev(t0, t0_value);
    			const samples0_changes = {};
    			if (dirty & /*slice*/ 32) samples0_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*splitTables*/ 2) samples0_changes.table = /*splitTables*/ ctx[1][0];
    			if (dirty & /*slice*/ 32) samples0_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*clicked*/ 8) samples0_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			samples0.$set(samples0_changes);
    			const samples1_changes = {};
    			if (dirty & /*slice*/ 32) samples1_changes.id_col = /*slice*/ ctx[5].id_column;
    			if (dirty & /*splitTables*/ 2) samples1_changes.table = /*splitTables*/ ctx[1][1];
    			if (dirty & /*slice*/ 32) samples1_changes.label_col = /*slice*/ ctx[5].label_column;
    			if (dirty & /*clicked*/ 8) samples1_changes.output_col = "model" + /*clicked*/ ctx[3][0];
    			samples1.$set(samples1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(samples0.$$.fragment, local);
    			transition_in(samples1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(samples0.$$.fragment, local);
    			transition_out(samples1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p0);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(div2);
    			destroy_component(samples0);
    			destroy_component(samples1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$3.name,
    		type: "if",
    		source: "(124:0) {#if splitTables && splitTables.length === 2}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$6(ctx) {
    	let t0;
    	let hr;
    	let t1;
    	let current_block_type_index;
    	let if_block1;
    	let if_block1_anchor;
    	let current;
    	let if_block0 = /*res*/ ctx[2] && create_if_block_3(ctx);
    	const if_block_creators = [create_if_block$3, create_if_block_1$1, create_if_block_2$1];
    	const if_blocks = [];

    	function select_block_type(ctx, dirty) {
    		if (/*splitTables*/ ctx[1] && /*splitTables*/ ctx[1].length === 2) return 0;
    		if (/*splitTables*/ ctx[1] && /*splitTables*/ ctx[1].length === 4) return 1;
    		if (/*table*/ ctx[0]) return 2;
    		return -1;
    	}

    	if (~(current_block_type_index = select_block_type(ctx))) {
    		if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    	}

    	const block = {
    		c: function create() {
    			if (if_block0) if_block0.c();
    			t0 = space();
    			hr = element("hr");
    			t1 = space();
    			if (if_block1) if_block1.c();
    			if_block1_anchor = empty$2();
    			set_style(hr, "margin-top", "50px");
    			add_location(hr, file$5, 122, 0, 3905);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			if (if_block0) if_block0.m(target, anchor);
    			insert_dev(target, t0, anchor);
    			insert_dev(target, hr, anchor);
    			insert_dev(target, t1, anchor);

    			if (~current_block_type_index) {
    				if_blocks[current_block_type_index].m(target, anchor);
    			}

    			insert_dev(target, if_block1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (/*res*/ ctx[2]) {
    				if (if_block0) {
    					if_block0.p(ctx, dirty);

    					if (dirty & /*res*/ 4) {
    						transition_in(if_block0, 1);
    					}
    				} else {
    					if_block0 = create_if_block_3(ctx);
    					if_block0.c();
    					transition_in(if_block0, 1);
    					if_block0.m(t0.parentNode, t0);
    				}
    			} else if (if_block0) {
    				group_outros();

    				transition_out(if_block0, 1, 1, () => {
    					if_block0 = null;
    				});

    				check_outros();
    			}

    			let previous_block_index = current_block_type_index;
    			current_block_type_index = select_block_type(ctx);

    			if (current_block_type_index === previous_block_index) {
    				if (~current_block_type_index) {
    					if_blocks[current_block_type_index].p(ctx, dirty);
    				}
    			} else {
    				if (if_block1) {
    					group_outros();

    					transition_out(if_blocks[previous_block_index], 1, 1, () => {
    						if_blocks[previous_block_index] = null;
    					});

    					check_outros();
    				}

    				if (~current_block_type_index) {
    					if_block1 = if_blocks[current_block_type_index];

    					if (!if_block1) {
    						if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    						if_block1.c();
    					} else {
    						if_block1.p(ctx, dirty);
    					}

    					transition_in(if_block1, 1);
    					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
    				} else {
    					if_block1 = null;
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block0);
    			transition_in(if_block1);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block0);
    			transition_out(if_block1);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block0) if_block0.d(detaching);
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(hr);
    			if (detaching) detach_dev(t1);

    			if (~current_block_type_index) {
    				if_blocks[current_block_type_index].d(detaching);
    			}

    			if (detaching) detach_dev(if_block1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$6.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func$1 = d => d + "%";

    function instance$6($$self, $$props, $$invalidate) {
    	let slice;
    	let $slices;
    	validate_store(slices, 'slices');
    	component_subscribe($$self, slices, $$value => $$invalidate(7, $slices = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('ResultView', slots, []);
    	let { params } = $$props;
    	let table$1;
    	let splitTables = [];
    	let evt;
    	let res;

    	results.subscribe(r => {
    		$$invalidate(2, res = r.filter(d => d.id === parseInt(params.id))[0]);
    	});

    	let clicked = [];

    	function updateSplitTables() {
    		if (clicked.length === 1) {
    			$$invalidate(1, splitTables = [
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 1)),
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 0))
    			]);
    		} else if (clicked.length === 2) {
    			$$invalidate(1, splitTables = [
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 1 && d["metric" + clicked[1]] === 1)),
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 1 && d["metric" + clicked[1]] === 0)),
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 0 && d["metric" + clicked[1]] === 1)),
    				table$1.filter(escape(d => d["metric" + clicked[0]] === 0 && d["metric" + clicked[1]] === 0))
    			]);
    		}
    	}

    	slices.subscribe(s => {
    		if (s.size > 0) {
    			console.log(s, res.slice);
    			let slice = s.get(res.slice.join(""));
    			console.log(slice);

    			if (!slice.table) {
    				fetch("/api/table/" + slice.name.join("")).then(d => d.arrayBuffer()).then(d => {
    					$$invalidate(0, table$1 = fromArrow(d));
    					slice.table = table$1;
    					s.set(res.slice.join(""), slice);
    					slices.set(s);
    				}).catch(e => console.log(e));
    			}
    		}
    	});

    	const writable_props = ['params'];

    	Object_1.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$3.warn(`<ResultView> was created with unknown prop '${key}'`);
    	});

    	function strip_clicked_binding(value) {
    		clicked = value;
    		$$invalidate(3, clicked);
    	}

    	const mouseout_handler = () => $$invalidate(4, evt = "");
    	const mousemove_handler = e => $$invalidate(4, evt = e);

    	const func_1 = (model_hash, i) => ({
    		model: res.modelNames[i],
    		value: res.modelResults[model_hash],
    		model_hash
    	});

    	$$self.$$set = $$props => {
    		if ('params' in $$props) $$invalidate(6, params = $$props.params);
    	};

    	$$self.$capture_state = () => ({
    		results,
    		LayerCake,
    		Svg,
    		Html,
    		Samples,
    		AxisX,
    		Strip,
    		Tooltip,
    		slices,
    		aq,
    		params,
    		table: table$1,
    		splitTables,
    		evt,
    		res,
    		clicked,
    		updateSplitTables,
    		slice,
    		$slices
    	});

    	$$self.$inject_state = $$props => {
    		if ('params' in $$props) $$invalidate(6, params = $$props.params);
    		if ('table' in $$props) $$invalidate(0, table$1 = $$props.table);
    		if ('splitTables' in $$props) $$invalidate(1, splitTables = $$props.splitTables);
    		if ('evt' in $$props) $$invalidate(4, evt = $$props.evt);
    		if ('res' in $$props) $$invalidate(2, res = $$props.res);
    		if ('clicked' in $$props) $$invalidate(3, clicked = $$props.clicked);
    		if ('slice' in $$props) $$invalidate(5, slice = $$props.slice);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*res, $slices*/ 132) {
    			$$invalidate(5, slice = res
    			? $$invalidate(5, slice = $slices.get(res.slice.join("")))
    			: "");
    		}

    		if ($$self.$$.dirty & /*clicked*/ 8) {
    			if (clicked.length > 2) {
    				clicked.splice(1, 1);
    				$$invalidate(3, clicked = [...clicked]);
    			}
    		}

    		if ($$self.$$.dirty & /*clicked, splitTables, table, res*/ 15) {
    			if (clicked.length > 0 && clicked.length < 3 && splitTables.length !== clicked.length * clicked.length) {
    				clicked.forEach(model_hash => {
    					if (!table$1.columnNames().includes("model" + model_hash)) {
    						fetch("/api/model_outputs/" + res.id + "/" + model_hash).then(d => d.json()).then(d => {
    							let model_outs = JSON.parse(d);

    							$$invalidate(0, table$1 = table$1.assign(table({
    								["metric" + model_hash]: model_outs.metric,
    								["model" + model_hash]: model_outs.output
    							})));

    							updateSplitTables();
    						});
    					}
    				});

    				updateSplitTables();
    			} else if (clicked.length === 0) {
    				$$invalidate(1, splitTables = []);
    			}
    		}
    	};

    	return [
    		table$1,
    		splitTables,
    		res,
    		clicked,
    		evt,
    		slice,
    		params,
    		$slices,
    		strip_clicked_binding,
    		mouseout_handler,
    		mousemove_handler,
    		func_1
    	];
    }

    class ResultView extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$6, create_fragment$6, safe_not_equal, { params: 6 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "ResultView",
    			options,
    			id: create_fragment$6.name
    		});

    		const { ctx } = this.$$;
    		const props = options.props || {};

    		if (/*params*/ ctx[6] === undefined && !('params' in props)) {
    			console_1$3.warn("<ResultView> was created without expected prop 'params'");
    		}
    	}

    	get params() {
    		throw new Error("<ResultView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set params(value) {
    		throw new Error("<ResultView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/Slicers.svelte generated by Svelte v3.46.4 */

    const { console: console_1$2 } = globals;
    const file$4 = "src/Slicers.svelte";

    function get_each_context$1(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[1] = list[i];
    	return child_ctx;
    }

    // (17:2) <Paper>
    function create_default_slot$3(ctx) {
    	let p;
    	let b;
    	let t0_value = /*sli*/ ctx[1].name + "";
    	let t0;
    	let t1;
    	let a;
    	let t2_value = /*sli*/ ctx[1].slices.length + "";
    	let t2;
    	let t3;
    	let a_href_value;
    	let t4;
    	let highlight;
    	let current;

    	highlight = new Highlight$1({
    			props: {
    				language: python$1,
    				code: /*sli*/ ctx[1].source
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			p = element("p");
    			b = element("b");
    			t0 = text(t0_value);
    			t1 = text(",\n      ");
    			a = element("a");
    			t2 = text(t2_value);
    			t3 = text(" slices");
    			t4 = space();
    			create_component(highlight.$$.fragment);
    			add_location(b, file$4, 18, 6, 516);
    			attr_dev(a, "href", a_href_value = "/#/slices/" + /*sli*/ ctx[1].name.join(""));
    			add_location(a, file$4, 19, 6, 541);
    			add_location(p, file$4, 17, 4, 506);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, p, anchor);
    			append_dev(p, b);
    			append_dev(b, t0);
    			append_dev(p, t1);
    			append_dev(p, a);
    			append_dev(a, t2);
    			append_dev(a, t3);
    			insert_dev(target, t4, anchor);
    			mount_component(highlight, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if ((!current || dirty & /*$slicers*/ 1) && t0_value !== (t0_value = /*sli*/ ctx[1].name + "")) set_data_dev(t0, t0_value);
    			if ((!current || dirty & /*$slicers*/ 1) && t2_value !== (t2_value = /*sli*/ ctx[1].slices.length + "")) set_data_dev(t2, t2_value);

    			if (!current || dirty & /*$slicers*/ 1 && a_href_value !== (a_href_value = "/#/slices/" + /*sli*/ ctx[1].name.join(""))) {
    				attr_dev(a, "href", a_href_value);
    			}

    			const highlight_changes = {};
    			if (dirty & /*$slicers*/ 1) highlight_changes.code = /*sli*/ ctx[1].source;
    			highlight.$set(highlight_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(highlight.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(highlight.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(p);
    			if (detaching) detach_dev(t4);
    			destroy_component(highlight, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$3.name,
    		type: "slot",
    		source: "(17:2) <Paper>",
    		ctx
    	});

    	return block;
    }

    // (16:0) {#each $slicers as sli}
    function create_each_block$1(ctx) {
    	let paper;
    	let t;
    	let br;
    	let current;

    	paper = new Paper({
    			props: {
    				$$slots: { default: [create_default_slot$3] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(paper.$$.fragment);
    			t = space();
    			br = element("br");
    			add_location(br, file$4, 23, 2, 691);
    		},
    		m: function mount(target, anchor) {
    			mount_component(paper, target, anchor);
    			insert_dev(target, t, anchor);
    			insert_dev(target, br, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const paper_changes = {};

    			if (dirty & /*$$scope, $slicers*/ 17) {
    				paper_changes.$$scope = { dirty, ctx };
    			}

    			paper.$set(paper_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(paper.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(paper.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(paper, detaching);
    			if (detaching) detach_dev(t);
    			if (detaching) detach_dev(br);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block$1.name,
    		type: "each",
    		source: "(16:0) {#each $slicers as sli}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$5(ctx) {
    	let h2;
    	let t1;
    	let h5;
    	let t3;
    	let each_1_anchor;
    	let current;
    	let each_value = /*$slicers*/ ctx[0];
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			h2 = element("h2");
    			h2.textContent = "Slicers";
    			t1 = space();
    			h5 = element("h5");
    			h5.textContent = "Slicing functions and sample instances";
    			t3 = space();

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    			add_location(h2, file$4, 13, 0, 403);
    			add_location(h5, file$4, 14, 0, 420);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h2, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, h5, anchor);
    			insert_dev(target, t3, anchor);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			if (dirty & /*python, $slicers*/ 1) {
    				each_value = /*$slicers*/ ctx[0];
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context$1(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block$1(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h2);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(h5);
    			if (detaching) detach_dev(t3);
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$5.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$5($$self, $$props, $$invalidate) {
    	let $slicers;
    	validate_store(slicers, 'slicers');
    	component_subscribe($$self, slicers, $$value => $$invalidate(0, $slicers = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Slicers', slots, []);
    	slicers.subscribe(d => console.log(d));

    	onMount(() => {
    		fetch("/api/slicers").then(d => d.json()).then(d => slicers.set(JSON.parse(d)));
    	});

    	const writable_props = [];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$2.warn(`<Slicers> was created with unknown prop '${key}'`);
    	});

    	$$self.$capture_state = () => ({
    		Paper,
    		onMount,
    		Highlight: Highlight$1,
    		python: python$1,
    		slicers,
    		$slicers
    	});

    	return [$slicers];
    }

    class Slicers extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$5, create_fragment$5, safe_not_equal, {});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Slicers",
    			options,
    			id: create_fragment$5.name
    		});
    	}
    }

    /* node_modules/@smui-extra/accordion/dist/Accordion.svelte generated by Svelte v3.46.4 */
    const file$3 = "node_modules/@smui-extra/accordion/dist/Accordion.svelte";

    function create_fragment$4(ctx) {
    	let div;
    	let div_class_value;
    	let useActions_action;
    	let current;
    	let mounted;
    	let dispose;
    	const default_slot_template = /*#slots*/ ctx[13].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[12], null);

    	let div_levels = [
    		{
    			class: div_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'smui-accordion': true,
    				'smui-accordion--multiple': /*multiple*/ ctx[2],
    				'smui-accordion--with-open-dialog': /*withOpenDialog*/ ctx[4]
    			})
    		},
    		/*$$restProps*/ ctx[10]
    	];

    	let div_data = {};

    	for (let i = 0; i < div_levels.length; i += 1) {
    		div_data = assign$1(div_data, div_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (default_slot) default_slot.c();
    			set_attributes(div, div_data);
    			add_location(div, file$3, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (default_slot) {
    				default_slot.m(div, null);
    			}

    			/*div_binding*/ ctx[14](div);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[5].call(null, div)),
    					listen_dev(div, "SMUIAccordionPanel:mount", /*handlePanelMount*/ ctx[6], false, false, false),
    					listen_dev(div, "SMUIAccordionPanel:unmount", /*handlePanelUnmount*/ ctx[7], false, false, false),
    					listen_dev(div, "SMUIAccordionPanel:activate", /*handlePanelActivate*/ ctx[8], false, false, false),
    					listen_dev(div, "SMUIAccordionPanel:opening", /*handlePanelOpening*/ ctx[9], false, false, false),
    					listen_dev(div, "SMUIDialog:opening", /*SMUIDialog_opening_handler*/ ctx[15], true, false, false),
    					listen_dev(div, "SMUIDialog:closed", /*SMUIDialog_closed_handler*/ ctx[16], true, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 4096)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[12],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[12])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[12], dirty, null),
    						null
    					);
    				}
    			}

    			set_attributes(div, div_data = get_spread_update(div_levels, [
    				(!current || dirty & /*className, multiple, withOpenDialog*/ 22 && div_class_value !== (div_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'smui-accordion': true,
    					'smui-accordion--multiple': /*multiple*/ ctx[2],
    					'smui-accordion--with-open-dialog': /*withOpenDialog*/ ctx[4]
    				}))) && { class: div_class_value },
    				dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (default_slot) default_slot.d(detaching);
    			/*div_binding*/ ctx[14](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$4.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$4($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","multiple","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Accordion', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { multiple = false } = $$props;
    	let element;
    	let panelAccessorSet = new Set();
    	let withOpenDialog = false;

    	function handlePanelMount(event) {
    		const accessor = event.detail;
    		event.stopPropagation();

    		if (!multiple && accessor.open) {
    			const currentOpen = Array.from(panelAccessorSet).find(accessor => accessor.open);

    			if (currentOpen) {
    				currentOpen.setOpen(false);
    			}
    		}

    		panelAccessorSet.add(accessor);
    	}

    	function handlePanelUnmount(event) {
    		const accessor = event.detail;
    		event.stopPropagation();
    		panelAccessorSet.delete(accessor);
    	}

    	function handlePanelActivate(event) {
    		const { accessor } = event.detail;

    		if (!multiple && !accessor.open) {
    			const currentOpen = Array.from(panelAccessorSet).find(accessor => accessor.open);

    			if (currentOpen) {
    				currentOpen.setOpen(false);
    			}
    		}

    		accessor.setOpen(!accessor.open);
    	}

    	function handlePanelOpening(event) {
    		const { accessor } = event.detail;

    		if (!multiple) {
    			const otherOpen = Array.from(panelAccessorSet).filter(checkAccessor => checkAccessor !== accessor && checkAccessor.open);
    			otherOpen.forEach(accessor => accessor.setOpen(false));
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function div_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(3, element);
    		});
    	}

    	const SMUIDialog_opening_handler = () => $$invalidate(4, withOpenDialog = true);
    	const SMUIDialog_closed_handler = () => $$invalidate(4, withOpenDialog = false);

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('multiple' in $$new_props) $$invalidate(2, multiple = $$new_props.multiple);
    		if ('$$scope' in $$new_props) $$invalidate(12, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		forwardEvents,
    		use,
    		className,
    		multiple,
    		element,
    		panelAccessorSet,
    		withOpenDialog,
    		handlePanelMount,
    		handlePanelUnmount,
    		handlePanelActivate,
    		handlePanelOpening,
    		getElement
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('multiple' in $$props) $$invalidate(2, multiple = $$new_props.multiple);
    		if ('element' in $$props) $$invalidate(3, element = $$new_props.element);
    		if ('panelAccessorSet' in $$props) panelAccessorSet = $$new_props.panelAccessorSet;
    		if ('withOpenDialog' in $$props) $$invalidate(4, withOpenDialog = $$new_props.withOpenDialog);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		multiple,
    		element,
    		withOpenDialog,
    		forwardEvents,
    		handlePanelMount,
    		handlePanelUnmount,
    		handlePanelActivate,
    		handlePanelOpening,
    		$$restProps,
    		getElement,
    		$$scope,
    		slots,
    		div_binding,
    		SMUIDialog_opening_handler,
    		SMUIDialog_closed_handler
    	];
    }

    class Accordion extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$4, create_fragment$4, safe_not_equal, {
    			use: 0,
    			class: 1,
    			multiple: 2,
    			getElement: 11
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Accordion",
    			options,
    			id: create_fragment$4.name
    		});
    	}

    	get use() {
    		throw new Error("<Accordion>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Accordion>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Accordion>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Accordion>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get multiple() {
    		throw new Error("<Accordion>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set multiple(value) {
    		throw new Error("<Accordion>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[11];
    	}

    	set getElement(value) {
    		throw new Error("<Accordion>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui-extra/accordion/dist/Panel.svelte generated by Svelte v3.46.4 */

    // (1:0) <Paper   bind:this={element}   use={usePass}   class={classMap({     [className]: true,     'smui-accordion__panel': true,     'smui-accordion__panel--open': open,     'smui-accordion__panel--opened': opened,     'smui-accordion__panel--disabled': disabled,     'smui-accordion__panel--non-interactive': nonInteractive,     'smui-accordion__panel--raised': variant === 'raised',     'smui-accordion__panel--extend': extend,     ['smui-accordion__panel--elevation-z' +     (extend && open ? extendedElevation : elevation)]:       (elevation !== 0 && variant === 'raised') ||       (extendedElevation !== 0 && variant === 'raised' && extend && open),   })}   {color}   variant={variant === 'raised' ? 'unelevated' : variant}   on:SMUIAccordionHeader:activate={handleHeaderActivate}   {...$$restProps}>
    function create_default_slot$2(ctx) {
    	let current;
    	const default_slot_template = /*#slots*/ ctx[23].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[25], null);

    	const block = {
    		c: function create() {
    			if (default_slot) default_slot.c();
    		},
    		m: function mount(target, anchor) {
    			if (default_slot) {
    				default_slot.m(target, anchor);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 33554432)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[25],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[25], dirty, null),
    						null
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (default_slot) default_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$2.name,
    		type: "slot",
    		source: "(1:0) <Paper   bind:this={element}   use={usePass}   class={classMap({     [className]: true,     'smui-accordion__panel': true,     'smui-accordion__panel--open': open,     'smui-accordion__panel--opened': opened,     'smui-accordion__panel--disabled': disabled,     'smui-accordion__panel--non-interactive': nonInteractive,     'smui-accordion__panel--raised': variant === 'raised',     'smui-accordion__panel--extend': extend,     ['smui-accordion__panel--elevation-z' +     (extend && open ? extendedElevation : elevation)]:       (elevation !== 0 && variant === 'raised') ||       (extendedElevation !== 0 && variant === 'raised' && extend && open),   })}   {color}   variant={variant === 'raised' ? 'unelevated' : variant}   on:SMUIAccordionHeader:activate={handleHeaderActivate}   {...$$restProps}>",
    		ctx
    	});

    	return block;
    }

    function create_fragment$3(ctx) {
    	let paper;
    	let current;

    	const paper_spread_levels = [
    		{ use: /*usePass*/ ctx[11] },
    		{
    			class: classMap({
    				[/*className*/ ctx[1]]: true,
    				'smui-accordion__panel': true,
    				'smui-accordion__panel--open': /*open*/ ctx[0],
    				'smui-accordion__panel--opened': /*opened*/ ctx[10],
    				'smui-accordion__panel--disabled': /*disabled*/ ctx[5],
    				'smui-accordion__panel--non-interactive': /*nonInteractive*/ ctx[6],
    				'smui-accordion__panel--raised': /*variant*/ ctx[2] === 'raised',
    				'smui-accordion__panel--extend': /*extend*/ ctx[7],
    				['smui-accordion__panel--elevation-z' + (/*extend*/ ctx[7] && /*open*/ ctx[0]
    				? /*extendedElevation*/ ctx[8]
    				: /*elevation*/ ctx[4])]: /*elevation*/ ctx[4] !== 0 && /*variant*/ ctx[2] === 'raised' || /*extendedElevation*/ ctx[8] !== 0 && /*variant*/ ctx[2] === 'raised' && /*extend*/ ctx[7] && /*open*/ ctx[0]
    			})
    		},
    		{ color: /*color*/ ctx[3] },
    		{
    			variant: /*variant*/ ctx[2] === 'raised'
    			? 'unelevated'
    			: /*variant*/ ctx[2]
    		},
    		/*$$restProps*/ ctx[16]
    	];

    	let paper_props = {
    		$$slots: { default: [create_default_slot$2] },
    		$$scope: { ctx }
    	};

    	for (let i = 0; i < paper_spread_levels.length; i += 1) {
    		paper_props = assign$1(paper_props, paper_spread_levels[i]);
    	}

    	paper = new Paper({ props: paper_props, $$inline: true });
    	/*paper_binding*/ ctx[24](paper);
    	paper.$on("SMUIAccordionHeader:activate", /*handleHeaderActivate*/ ctx[15]);

    	const block = {
    		c: function create() {
    			create_component(paper.$$.fragment);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			mount_component(paper, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const paper_changes = (dirty & /*usePass, classMap, className, open, opened, disabled, nonInteractive, variant, extend, extendedElevation, elevation, color, $$restProps*/ 69119)
    			? get_spread_update(paper_spread_levels, [
    					dirty & /*usePass*/ 2048 && { use: /*usePass*/ ctx[11] },
    					dirty & /*classMap, className, open, opened, disabled, nonInteractive, variant, extend, extendedElevation, elevation*/ 1527 && {
    						class: classMap({
    							[/*className*/ ctx[1]]: true,
    							'smui-accordion__panel': true,
    							'smui-accordion__panel--open': /*open*/ ctx[0],
    							'smui-accordion__panel--opened': /*opened*/ ctx[10],
    							'smui-accordion__panel--disabled': /*disabled*/ ctx[5],
    							'smui-accordion__panel--non-interactive': /*nonInteractive*/ ctx[6],
    							'smui-accordion__panel--raised': /*variant*/ ctx[2] === 'raised',
    							'smui-accordion__panel--extend': /*extend*/ ctx[7],
    							['smui-accordion__panel--elevation-z' + (/*extend*/ ctx[7] && /*open*/ ctx[0]
    							? /*extendedElevation*/ ctx[8]
    							: /*elevation*/ ctx[4])]: /*elevation*/ ctx[4] !== 0 && /*variant*/ ctx[2] === 'raised' || /*extendedElevation*/ ctx[8] !== 0 && /*variant*/ ctx[2] === 'raised' && /*extend*/ ctx[7] && /*open*/ ctx[0]
    						})
    					},
    					dirty & /*color*/ 8 && { color: /*color*/ ctx[3] },
    					dirty & /*variant*/ 4 && {
    						variant: /*variant*/ ctx[2] === 'raised'
    						? 'unelevated'
    						: /*variant*/ ctx[2]
    					},
    					dirty & /*$$restProps*/ 65536 && get_spread_object(/*$$restProps*/ ctx[16])
    				])
    			: {};

    			if (dirty & /*$$scope*/ 33554432) {
    				paper_changes.$$scope = { dirty, ctx };
    			}

    			paper.$set(paper_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(paper.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(paper.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			/*paper_binding*/ ctx[24](null);
    			destroy_component(paper, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$3.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance$3($$self, $$props, $$invalidate) {
    	let usePass;

    	const omit_props_names = [
    		"use","class","variant","color","elevation","open","disabled","nonInteractive","extend","extendedElevation","isOpen","setOpen","getElement"
    	];

    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $openStore;
    	let $nonInteractiveStore;
    	let $disabledStore;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Panel', slots, ['default']);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { variant = 'raised' } = $$props;
    	let { color = 'default' } = $$props;
    	let { elevation = 1 } = $$props;
    	let { open = false } = $$props;
    	let { disabled = false } = $$props;
    	let { nonInteractive = false } = $$props;
    	let { extend = false } = $$props;
    	let { extendedElevation = 3 } = $$props;
    	let element;
    	let accessor;
    	let opened = open;
    	const disabledStore = writable(disabled);
    	validate_store(disabledStore, 'disabledStore');
    	component_subscribe($$self, disabledStore, value => $$invalidate(28, $disabledStore = value));
    	setContext('SMUI:accordion:panel:disabled', disabledStore);
    	const nonInteractiveStore = writable(nonInteractive);
    	validate_store(nonInteractiveStore, 'nonInteractiveStore');
    	component_subscribe($$self, nonInteractiveStore, value => $$invalidate(27, $nonInteractiveStore = value));
    	setContext('SMUI:accordion:panel:nonInteractive', nonInteractiveStore);
    	const openStore = writable(open);
    	validate_store(openStore, 'openStore');
    	component_subscribe($$self, openStore, value => $$invalidate(26, $openStore = value));
    	setContext('SMUI:accordion:panel:open', openStore);
    	let previousOpen = open;

    	onMount(() => {
    		$$invalidate(21, accessor = {
    			get open() {
    				return open;
    			},
    			setOpen
    		});

    		// Set the ari-hidden property on content children.
    		Array.from(getElement().children).forEach(child => {
    			if (child.classList.contains('smui-paper__content')) {
    				const content = child;
    				content.setAttribute('aria-hidden', open ? 'false' : 'true');
    			}
    		});

    		dispatch$1(getElement(), 'SMUIAccordionPanel:mount', accessor);

    		return () => {
    			dispatch$1(getElement(), 'SMUIAccordionPanel:unmount', accessor);
    		};
    	});

    	function handleHeaderActivate(event) {
    		event.stopPropagation();

    		if (disabled || nonInteractive) {
    			return;
    		}

    		dispatch$1(getElement(), 'SMUIAccordionPanel:activate', { accessor, event });
    	}

    	function isOpen() {
    		return open;
    	}

    	function setOpen(value) {
    		$$invalidate(0, open = value);
    	}

    	function getElement() {
    		return element.getElement();
    	}

    	function paper_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(9, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(16, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(17, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('variant' in $$new_props) $$invalidate(2, variant = $$new_props.variant);
    		if ('color' in $$new_props) $$invalidate(3, color = $$new_props.color);
    		if ('elevation' in $$new_props) $$invalidate(4, elevation = $$new_props.elevation);
    		if ('open' in $$new_props) $$invalidate(0, open = $$new_props.open);
    		if ('disabled' in $$new_props) $$invalidate(5, disabled = $$new_props.disabled);
    		if ('nonInteractive' in $$new_props) $$invalidate(6, nonInteractive = $$new_props.nonInteractive);
    		if ('extend' in $$new_props) $$invalidate(7, extend = $$new_props.extend);
    		if ('extendedElevation' in $$new_props) $$invalidate(8, extendedElevation = $$new_props.extendedElevation);
    		if ('$$scope' in $$new_props) $$invalidate(25, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		onMount,
    		setContext,
    		writable,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		dispatch: dispatch$1,
    		Paper,
    		forwardEvents,
    		use,
    		className,
    		variant,
    		color,
    		elevation,
    		open,
    		disabled,
    		nonInteractive,
    		extend,
    		extendedElevation,
    		element,
    		accessor,
    		opened,
    		disabledStore,
    		nonInteractiveStore,
    		openStore,
    		previousOpen,
    		handleHeaderActivate,
    		isOpen,
    		setOpen,
    		getElement,
    		usePass,
    		$openStore,
    		$nonInteractiveStore,
    		$disabledStore
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(17, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('variant' in $$props) $$invalidate(2, variant = $$new_props.variant);
    		if ('color' in $$props) $$invalidate(3, color = $$new_props.color);
    		if ('elevation' in $$props) $$invalidate(4, elevation = $$new_props.elevation);
    		if ('open' in $$props) $$invalidate(0, open = $$new_props.open);
    		if ('disabled' in $$props) $$invalidate(5, disabled = $$new_props.disabled);
    		if ('nonInteractive' in $$props) $$invalidate(6, nonInteractive = $$new_props.nonInteractive);
    		if ('extend' in $$props) $$invalidate(7, extend = $$new_props.extend);
    		if ('extendedElevation' in $$props) $$invalidate(8, extendedElevation = $$new_props.extendedElevation);
    		if ('element' in $$props) $$invalidate(9, element = $$new_props.element);
    		if ('accessor' in $$props) $$invalidate(21, accessor = $$new_props.accessor);
    		if ('opened' in $$props) $$invalidate(10, opened = $$new_props.opened);
    		if ('previousOpen' in $$props) $$invalidate(22, previousOpen = $$new_props.previousOpen);
    		if ('usePass' in $$props) $$invalidate(11, usePass = $$new_props.usePass);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*use*/ 131072) {
    			$$invalidate(11, usePass = [forwardEvents, ...use]);
    		}

    		if ($$self.$$.dirty & /*disabled*/ 32) {
    			set_store_value(disabledStore, $disabledStore = disabled, $disabledStore);
    		}

    		if ($$self.$$.dirty & /*nonInteractive*/ 64) {
    			set_store_value(nonInteractiveStore, $nonInteractiveStore = nonInteractive, $nonInteractiveStore);
    		}

    		if ($$self.$$.dirty & /*open*/ 1) {
    			set_store_value(openStore, $openStore = open, $openStore);
    		}

    		if ($$self.$$.dirty & /*previousOpen, open, accessor*/ 6291457) {
    			if (previousOpen !== open) {
    				$$invalidate(22, previousOpen = open);

    				Array.from(getElement().children).forEach(child => {
    					if (child.classList.contains('smui-paper__content')) {
    						const content = child;

    						// Calculate the height of the content and apply it. This lets the CSS
    						// animation run properly.
    						if (open) {
    							content.classList.add('smui-accordion__content--no-transition');
    							content.classList.add('smui-accordion__content--force-open');

    							// Force a reflow to get the height.
    							const { height } = content.getBoundingClientRect();

    							content.classList.remove('smui-accordion__content--force-open');

    							// Force another reflow to reset the height.
    							content.getBoundingClientRect();

    							content.classList.remove('smui-accordion__content--no-transition');
    							content.style.height = height + 'px';

    							content.addEventListener(
    								'transitionend',
    								() => {
    									if (content) {
    										content.style.height = '';
    									}

    									// Assign only when the panel is fully opened.
    									$$invalidate(10, opened = true);

    									dispatch$1(getElement(), 'SMUIAccordionPanel:opened', { accessor });
    								},
    								{ once: true }
    							);
    						} else {
    							content.style.height = content.getBoundingClientRect().height + 'px';

    							// Force a reflow.
    							content.getBoundingClientRect();

    							requestAnimationFrame(() => {
    								if (content) {
    									content.style.height = '';
    								}

    								dispatch$1(getElement(), 'SMUIAccordionPanel:closed', { accessor });
    							});

    							// Assign as soon as the panel is closing.
    							$$invalidate(10, opened = false);
    						}

    						// Set the aria-hidden property.
    						content.setAttribute('aria-hidden', open ? 'false' : 'true');
    					}
    				});

    				dispatch$1(
    					getElement(),
    					open
    					? 'SMUIAccordionPanel:opening'
    					: 'SMUIAccordionPanel:closing',
    					{ accessor }
    				);
    			}
    		}
    	};

    	return [
    		open,
    		className,
    		variant,
    		color,
    		elevation,
    		disabled,
    		nonInteractive,
    		extend,
    		extendedElevation,
    		element,
    		opened,
    		usePass,
    		disabledStore,
    		nonInteractiveStore,
    		openStore,
    		handleHeaderActivate,
    		$$restProps,
    		use,
    		isOpen,
    		setOpen,
    		getElement,
    		accessor,
    		previousOpen,
    		slots,
    		paper_binding,
    		$$scope
    	];
    }

    class Panel$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$3, create_fragment$3, safe_not_equal, {
    			use: 17,
    			class: 1,
    			variant: 2,
    			color: 3,
    			elevation: 4,
    			open: 0,
    			disabled: 5,
    			nonInteractive: 6,
    			extend: 7,
    			extendedElevation: 8,
    			isOpen: 18,
    			setOpen: 19,
    			getElement: 20
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Panel",
    			options,
    			id: create_fragment$3.name
    		});
    	}

    	get use() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get variant() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set variant(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get color() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set color(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get elevation() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set elevation(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get open() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set open(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get disabled() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set disabled(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get nonInteractive() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set nonInteractive(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get extend() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set extend(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get extendedElevation() {
    		throw new Error("<Panel>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set extendedElevation(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get isOpen() {
    		return this.$$.ctx[18];
    	}

    	set isOpen(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get setOpen() {
    		return this.$$.ctx[19];
    	}

    	set setOpen(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[20];
    	}

    	set getElement(value) {
    		throw new Error("<Panel>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* node_modules/@smui-extra/accordion/dist/Header.svelte generated by Svelte v3.46.4 */
    const file$2 = "node_modules/@smui-extra/accordion/dist/Header.svelte";
    const get_icon_slot_changes = dirty => ({});
    const get_icon_slot_context = ctx => ({});
    const get_description_slot_changes = dirty => ({});
    const get_description_slot_context = ctx => ({});

    // (30:2) {#if ripple}
    function create_if_block_2(ctx) {
    	let div;

    	const block = {
    		c: function create() {
    			div = element("div");
    			attr_dev(div, "class", "smui-accordion__header__ripple");
    			add_location(div, file$2, 30, 4, 672);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_2.name,
    		type: "if",
    		source: "(30:2) {#if ripple}",
    		ctx
    	});

    	return block;
    }

    // (41:2) {#if $$slots.description}
    function create_if_block_1(ctx) {
    	let div;
    	let current;
    	const description_slot_template = /*#slots*/ ctx[23].description;
    	const description_slot = create_slot(description_slot_template, ctx, /*$$scope*/ ctx[22], get_description_slot_context);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (description_slot) description_slot.c();
    			attr_dev(div, "class", "smui-accordion__header__description");
    			add_location(div, file$2, 41, 4, 945);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (description_slot) {
    				description_slot.m(div, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (description_slot) {
    				if (description_slot.p && (!current || dirty & /*$$scope*/ 4194304)) {
    					update_slot_base(
    						description_slot,
    						description_slot_template,
    						ctx,
    						/*$$scope*/ ctx[22],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[22])
    						: get_slot_changes(description_slot_template, /*$$scope*/ ctx[22], dirty, get_description_slot_changes),
    						get_description_slot_context
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(description_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(description_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (description_slot) description_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block_1.name,
    		type: "if",
    		source: "(41:2) {#if $$slots.description}",
    		ctx
    	});

    	return block;
    }

    // (46:2) {#if $$slots.icon}
    function create_if_block$2(ctx) {
    	let div;
    	let current;
    	const icon_slot_template = /*#slots*/ ctx[23].icon;
    	const icon_slot = create_slot(icon_slot_template, ctx, /*$$scope*/ ctx[22], get_icon_slot_context);

    	const block = {
    		c: function create() {
    			div = element("div");
    			if (icon_slot) icon_slot.c();
    			attr_dev(div, "class", "smui-accordion__header__icon");
    			add_location(div, file$2, 46, 4, 1073);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div, anchor);

    			if (icon_slot) {
    				icon_slot.m(div, null);
    			}

    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (icon_slot) {
    				if (icon_slot.p && (!current || dirty & /*$$scope*/ 4194304)) {
    					update_slot_base(
    						icon_slot,
    						icon_slot_template,
    						ctx,
    						/*$$scope*/ ctx[22],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[22])
    						: get_slot_changes(icon_slot_template, /*$$scope*/ ctx[22], dirty, get_icon_slot_changes),
    						get_icon_slot_context
    					);
    				}
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(icon_slot, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(icon_slot, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div);
    			if (icon_slot) icon_slot.d(detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$2.name,
    		type: "if",
    		source: "(46:2) {#if $$slots.icon}",
    		ctx
    	});

    	return block;
    }

    function create_fragment$2(ctx) {
    	let div1;
    	let t0;
    	let div0;
    	let div0_class_value;
    	let t1;
    	let t2;
    	let div1_class_value;
    	let div1_style_value;
    	let div1_tabindex_value;
    	let div1_aria_expanded_value;
    	let useActions_action;
    	let Ripple_action;
    	let current;
    	let mounted;
    	let dispose;
    	let if_block0 = /*ripple*/ ctx[3] && create_if_block_2(ctx);
    	const default_slot_template = /*#slots*/ ctx[23].default;
    	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[22], null);
    	let if_block1 = /*$$slots*/ ctx[20].description && create_if_block_1(ctx);
    	let if_block2 = /*$$slots*/ ctx[20].icon && create_if_block$2(ctx);

    	let div1_levels = [
    		{
    			class: div1_class_value = classMap({
    				[/*className*/ ctx[1]]: true,
    				'smui-accordion__header': true,
    				.../*internalClasses*/ ctx[5]
    			})
    		},
    		{
    			style: div1_style_value = Object.entries(/*internalStyles*/ ctx[6]).map(func).concat([/*style*/ ctx[2]]).join(' ')
    		},
    		{ role: "button" },
    		{
    			tabindex: div1_tabindex_value = /*$nonInteractive*/ ctx[7] ? -1 : 0
    		},
    		{
    			"aria-expanded": div1_aria_expanded_value = /*$open*/ ctx[9] ? 'true' : 'false'
    		},
    		/*$$restProps*/ ctx[19]
    	];

    	let div1_data = {};

    	for (let i = 0; i < div1_levels.length; i += 1) {
    		div1_data = assign$1(div1_data, div1_levels[i]);
    	}

    	const block = {
    		c: function create() {
    			div1 = element("div");
    			if (if_block0) if_block0.c();
    			t0 = space();
    			div0 = element("div");
    			if (default_slot) default_slot.c();
    			t1 = space();
    			if (if_block1) if_block1.c();
    			t2 = space();
    			if (if_block2) if_block2.c();

    			attr_dev(div0, "class", div0_class_value = classMap({
    				'smui-accordion__header__title': true,
    				'smui-accordion__header__title--with-description': /*$$slots*/ ctx[20].description
    			}));

    			add_location(div0, file$2, 32, 2, 729);
    			set_attributes(div1, div1_data);
    			add_location(div1, file$2, 0, 0, 0);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, div1, anchor);
    			if (if_block0) if_block0.m(div1, null);
    			append_dev(div1, t0);
    			append_dev(div1, div0);

    			if (default_slot) {
    				default_slot.m(div0, null);
    			}

    			append_dev(div1, t1);
    			if (if_block1) if_block1.m(div1, null);
    			append_dev(div1, t2);
    			if (if_block2) if_block2.m(div1, null);
    			/*div1_binding*/ ctx[24](div1);
    			current = true;

    			if (!mounted) {
    				dispose = [
    					action_destroyer(useActions_action = useActions.call(null, div1, /*use*/ ctx[0])),
    					action_destroyer(/*forwardEvents*/ ctx[10].call(null, div1)),
    					action_destroyer(Ripple_action = Ripple.call(null, div1, {
    						ripple: /*ripple*/ ctx[3],
    						unbounded: false,
    						surface: !/*$nonInteractive*/ ctx[7],
    						disabled: /*$disabled*/ ctx[8] || /*$nonInteractive*/ ctx[7],
    						addClass: /*addClass*/ ctx[16],
    						removeClass: /*removeClass*/ ctx[17],
    						addStyle: /*addStyle*/ ctx[18]
    					})),
    					listen_dev(div1, "click", /*handleClick*/ ctx[14], false, false, false),
    					listen_dev(div1, "keydown", /*handleKeyDown*/ ctx[15], false, false, false)
    				];

    				mounted = true;
    			}
    		},
    		p: function update(ctx, [dirty]) {
    			if (/*ripple*/ ctx[3]) {
    				if (if_block0) ; else {
    					if_block0 = create_if_block_2(ctx);
    					if_block0.c();
    					if_block0.m(div1, t0);
    				}
    			} else if (if_block0) {
    				if_block0.d(1);
    				if_block0 = null;
    			}

    			if (default_slot) {
    				if (default_slot.p && (!current || dirty & /*$$scope*/ 4194304)) {
    					update_slot_base(
    						default_slot,
    						default_slot_template,
    						ctx,
    						/*$$scope*/ ctx[22],
    						!current
    						? get_all_dirty_from_scope(/*$$scope*/ ctx[22])
    						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[22], dirty, null),
    						null
    					);
    				}
    			}

    			if (!current || dirty & /*$$slots*/ 1048576 && div0_class_value !== (div0_class_value = classMap({
    				'smui-accordion__header__title': true,
    				'smui-accordion__header__title--with-description': /*$$slots*/ ctx[20].description
    			}))) {
    				attr_dev(div0, "class", div0_class_value);
    			}

    			if (/*$$slots*/ ctx[20].description) {
    				if (if_block1) {
    					if_block1.p(ctx, dirty);

    					if (dirty & /*$$slots*/ 1048576) {
    						transition_in(if_block1, 1);
    					}
    				} else {
    					if_block1 = create_if_block_1(ctx);
    					if_block1.c();
    					transition_in(if_block1, 1);
    					if_block1.m(div1, t2);
    				}
    			} else if (if_block1) {
    				group_outros();

    				transition_out(if_block1, 1, 1, () => {
    					if_block1 = null;
    				});

    				check_outros();
    			}

    			if (/*$$slots*/ ctx[20].icon) {
    				if (if_block2) {
    					if_block2.p(ctx, dirty);

    					if (dirty & /*$$slots*/ 1048576) {
    						transition_in(if_block2, 1);
    					}
    				} else {
    					if_block2 = create_if_block$2(ctx);
    					if_block2.c();
    					transition_in(if_block2, 1);
    					if_block2.m(div1, null);
    				}
    			} else if (if_block2) {
    				group_outros();

    				transition_out(if_block2, 1, 1, () => {
    					if_block2 = null;
    				});

    				check_outros();
    			}

    			set_attributes(div1, div1_data = get_spread_update(div1_levels, [
    				(!current || dirty & /*className, internalClasses*/ 34 && div1_class_value !== (div1_class_value = classMap({
    					[/*className*/ ctx[1]]: true,
    					'smui-accordion__header': true,
    					.../*internalClasses*/ ctx[5]
    				}))) && { class: div1_class_value },
    				(!current || dirty & /*internalStyles, style*/ 68 && div1_style_value !== (div1_style_value = Object.entries(/*internalStyles*/ ctx[6]).map(func).concat([/*style*/ ctx[2]]).join(' '))) && { style: div1_style_value },
    				{ role: "button" },
    				(!current || dirty & /*$nonInteractive*/ 128 && div1_tabindex_value !== (div1_tabindex_value = /*$nonInteractive*/ ctx[7] ? -1 : 0)) && { tabindex: div1_tabindex_value },
    				(!current || dirty & /*$open*/ 512 && div1_aria_expanded_value !== (div1_aria_expanded_value = /*$open*/ ctx[9] ? 'true' : 'false')) && {
    					"aria-expanded": div1_aria_expanded_value
    				},
    				dirty & /*$$restProps*/ 524288 && /*$$restProps*/ ctx[19]
    			]));

    			if (useActions_action && is_function(useActions_action.update) && dirty & /*use*/ 1) useActions_action.update.call(null, /*use*/ ctx[0]);

    			if (Ripple_action && is_function(Ripple_action.update) && dirty & /*ripple, $nonInteractive, $disabled*/ 392) Ripple_action.update.call(null, {
    				ripple: /*ripple*/ ctx[3],
    				unbounded: false,
    				surface: !/*$nonInteractive*/ ctx[7],
    				disabled: /*$disabled*/ ctx[8] || /*$nonInteractive*/ ctx[7],
    				addClass: /*addClass*/ ctx[16],
    				removeClass: /*removeClass*/ ctx[17],
    				addStyle: /*addStyle*/ ctx[18]
    			});
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(default_slot, local);
    			transition_in(if_block1);
    			transition_in(if_block2);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(default_slot, local);
    			transition_out(if_block1);
    			transition_out(if_block2);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(div1);
    			if (if_block0) if_block0.d();
    			if (default_slot) default_slot.d(detaching);
    			if (if_block1) if_block1.d();
    			if (if_block2) if_block2.d();
    			/*div1_binding*/ ctx[24](null);
    			mounted = false;
    			run_all(dispose);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$2.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const func = ([name, value]) => `${name}: ${value};`;

    function instance$2($$self, $$props, $$invalidate) {
    	const omit_props_names = ["use","class","style","ripple","getElement"];
    	let $$restProps = compute_rest_props($$props, omit_props_names);
    	let $nonInteractive;
    	let $disabled;
    	let $open;
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Header', slots, ['default','description','icon']);
    	const $$slots = compute_slots(slots);
    	const forwardEvents = forwardEventsBuilder(get_current_component());
    	let { use = [] } = $$props;
    	let { class: className = '' } = $$props;
    	let { style = '' } = $$props;
    	let { ripple = true } = $$props;
    	let element;
    	let internalClasses = {};
    	let internalStyles = {};
    	const disabled = getContext('SMUI:accordion:panel:disabled');
    	validate_store(disabled, 'disabled');
    	component_subscribe($$self, disabled, value => $$invalidate(8, $disabled = value));
    	const nonInteractive = getContext('SMUI:accordion:panel:nonInteractive');
    	validate_store(nonInteractive, 'nonInteractive');
    	component_subscribe($$self, nonInteractive, value => $$invalidate(7, $nonInteractive = value));
    	const open = getContext('SMUI:accordion:panel:open');
    	validate_store(open, 'open');
    	component_subscribe($$self, open, value => $$invalidate(9, $open = value));

    	function handleClick(event) {
    		event = event;

    		if (event.button === 0) {
    			dispatch$1(getElement(), 'SMUIAccordionHeader:activate', { event });
    		}
    	}

    	function handleKeyDown(event) {
    		event = event;

    		if (event.key === 'Enter') {
    			dispatch$1(getElement(), 'SMUIAccordionHeader:activate', { event });
    		}
    	}

    	function addClass(className) {
    		if (!internalClasses[className]) {
    			$$invalidate(5, internalClasses[className] = true, internalClasses);
    		}
    	}

    	function removeClass(className) {
    		if (!(className in internalClasses) || internalClasses[className]) {
    			$$invalidate(5, internalClasses[className] = false, internalClasses);
    		}
    	}

    	function addStyle(name, value) {
    		if (internalStyles[name] != value) {
    			if (value === '' || value == null) {
    				delete internalStyles[name];
    				$$invalidate(6, internalStyles);
    			} else {
    				$$invalidate(6, internalStyles[name] = value, internalStyles);
    			}
    		}
    	}

    	function getElement() {
    		return element;
    	}

    	function div1_binding($$value) {
    		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
    			element = $$value;
    			$$invalidate(4, element);
    		});
    	}

    	$$self.$$set = $$new_props => {
    		$$props = assign$1(assign$1({}, $$props), exclude_internal_props($$new_props));
    		$$invalidate(19, $$restProps = compute_rest_props($$props, omit_props_names));
    		if ('use' in $$new_props) $$invalidate(0, use = $$new_props.use);
    		if ('class' in $$new_props) $$invalidate(1, className = $$new_props.class);
    		if ('style' in $$new_props) $$invalidate(2, style = $$new_props.style);
    		if ('ripple' in $$new_props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('$$scope' in $$new_props) $$invalidate(22, $$scope = $$new_props.$$scope);
    	};

    	$$self.$capture_state = () => ({
    		getContext,
    		get_current_component,
    		forwardEventsBuilder,
    		classMap,
    		useActions,
    		dispatch: dispatch$1,
    		Ripple,
    		forwardEvents,
    		use,
    		className,
    		style,
    		ripple,
    		element,
    		internalClasses,
    		internalStyles,
    		disabled,
    		nonInteractive,
    		open,
    		handleClick,
    		handleKeyDown,
    		addClass,
    		removeClass,
    		addStyle,
    		getElement,
    		$nonInteractive,
    		$disabled,
    		$open
    	});

    	$$self.$inject_state = $$new_props => {
    		if ('use' in $$props) $$invalidate(0, use = $$new_props.use);
    		if ('className' in $$props) $$invalidate(1, className = $$new_props.className);
    		if ('style' in $$props) $$invalidate(2, style = $$new_props.style);
    		if ('ripple' in $$props) $$invalidate(3, ripple = $$new_props.ripple);
    		if ('element' in $$props) $$invalidate(4, element = $$new_props.element);
    		if ('internalClasses' in $$props) $$invalidate(5, internalClasses = $$new_props.internalClasses);
    		if ('internalStyles' in $$props) $$invalidate(6, internalStyles = $$new_props.internalStyles);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		use,
    		className,
    		style,
    		ripple,
    		element,
    		internalClasses,
    		internalStyles,
    		$nonInteractive,
    		$disabled,
    		$open,
    		forwardEvents,
    		disabled,
    		nonInteractive,
    		open,
    		handleClick,
    		handleKeyDown,
    		addClass,
    		removeClass,
    		addStyle,
    		$$restProps,
    		$$slots,
    		getElement,
    		$$scope,
    		slots,
    		div1_binding
    	];
    }

    class Header$1 extends SvelteComponentDev {
    	constructor(options) {
    		super(options);

    		init$1(this, options, instance$2, create_fragment$2, safe_not_equal, {
    			use: 0,
    			class: 1,
    			style: 2,
    			ripple: 3,
    			getElement: 21
    		});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Header",
    			options,
    			id: create_fragment$2.name
    		});
    	}

    	get use() {
    		throw new Error("<Header>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set use(value) {
    		throw new Error("<Header>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get class() {
    		throw new Error("<Header>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set class(value) {
    		throw new Error("<Header>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get style() {
    		throw new Error("<Header>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set style(value) {
    		throw new Error("<Header>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get ripple() {
    		throw new Error("<Header>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set ripple(value) {
    		throw new Error("<Header>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	get getElement() {
    		return this.$$.ctx[21];
    	}

    	set getElement(value) {
    		throw new Error("<Header>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    const Panel = Panel$1;
    const Header = Header$1;

    /* src/Slices.svelte generated by Svelte v3.46.4 */

    const { console: console_1$1 } = globals;
    const file$1 = "src/Slices.svelte";

    function get_each_context(ctx, list, i) {
    	const child_ctx = ctx.slice();
    	child_ctx[9] = list[i];
    	child_ctx[11] = i;
    	return child_ctx;
    }

    // (68:14) <Text>
    function create_default_slot_6$1(ctx) {
    	let t_value = /*chip*/ ctx[12] + "";
    	let t;

    	const block = {
    		c: function create() {
    			t = text(t_value);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*chip*/ 4096 && t_value !== (t_value = /*chip*/ ctx[12] + "")) set_data_dev(t, t_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_6$1.name,
    		type: "slot",
    		source: "(68:14) <Text>",
    		ctx
    	});

    	return block;
    }

    // (67:12) <Chip {chip} on:click={(e) => e.stopPropagation()}>
    function create_default_slot_5$1(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text({
    			props: {
    				$$slots: { default: [create_default_slot_6$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope, chip*/ 12288) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_5$1.name,
    		type: "slot",
    		source: "(67:12) <Chip {chip} on:click={(e) => e.stopPropagation()}>",
    		ctx
    	});

    	return block;
    }

    // (66:10) <ChipSet chips={sli.name} filter let:chip bind:selected>
    function create_default_slot_4$1(ctx) {
    	let chip;
    	let current;

    	chip = new Chip({
    			props: {
    				chip: /*chip*/ ctx[12],
    				$$slots: { default: [create_default_slot_5$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	chip.$on("click", click_handler);

    	const block = {
    		c: function create() {
    			create_component(chip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(chip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const chip_changes = {};
    			if (dirty & /*chip*/ 4096) chip_changes.chip = /*chip*/ ctx[12];

    			if (dirty & /*$$scope, chip*/ 12288) {
    				chip_changes.$$scope = { dirty, ctx };
    			}

    			chip.$set(chip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(chip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(chip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(chip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_4$1.name,
    		type: "slot",
    		source: "(66:10) <ChipSet chips={sli.name} filter let:chip bind:selected>",
    		ctx
    	});

    	return block;
    }

    // (65:8) <Header>
    function create_default_slot_3$1(ctx) {
    	let chipset;
    	let updating_selected;
    	let current;

    	function chipset_selected_binding(value) {
    		/*chipset_selected_binding*/ ctx[6](value);
    	}

    	let chipset_props = {
    		chips: /*sli*/ ctx[9].name,
    		filter: true,
    		$$slots: {
    			default: [
    				create_default_slot_4$1,
    				({ chip }) => ({ 12: chip }),
    				({ chip }) => chip ? 4096 : 0
    			]
    		},
    		$$scope: { ctx }
    	};

    	if (/*selected*/ ctx[1] !== void 0) {
    		chipset_props.selected = /*selected*/ ctx[1];
    	}

    	chipset = new Set$1({ props: chipset_props, $$inline: true });
    	binding_callbacks.push(() => bind(chipset, 'selected', chipset_selected_binding));

    	const block = {
    		c: function create() {
    			create_component(chipset.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(chipset, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const chipset_changes = {};
    			if (dirty & /*shownSlices*/ 8) chipset_changes.chips = /*sli*/ ctx[9].name;

    			if (dirty & /*$$scope, chip*/ 12288) {
    				chipset_changes.$$scope = { dirty, ctx };
    			}

    			if (!updating_selected && dirty & /*selected*/ 2) {
    				updating_selected = true;
    				chipset_changes.selected = /*selected*/ ctx[1];
    				add_flush_callback(() => updating_selected = false);
    			}

    			chipset.$set(chipset_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(chipset.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(chipset.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(chipset, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_3$1.name,
    		type: "slot",
    		source: "(65:8) <Header>",
    		ctx
    	});

    	return block;
    }

    // (73:10) 
    function create_description_slot(ctx) {
    	let span;
    	let t0_value = /*sli*/ ctx[9].size + "";
    	let t0;
    	let t1;

    	const block = {
    		c: function create() {
    			span = element("span");
    			t0 = text(t0_value);
    			t1 = text(" instances");
    			attr_dev(span, "slot", "description");
    			add_location(span, file$1, 72, 10, 2016);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, span, anchor);
    			append_dev(span, t0);
    			append_dev(span, t1);
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*shownSlices*/ 8 && t0_value !== (t0_value = /*sli*/ ctx[9].size + "")) set_data_dev(t0, t0_value);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(span);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_description_slot.name,
    		type: "slot",
    		source: "(73:10) ",
    		ctx
    	});

    	return block;
    }

    // (78:10) {#if open === i && sli.table}
    function create_if_block$1(ctx) {
    	let samples;
    	let current;

    	samples = new Samples({
    			props: {
    				id_col: /*sli*/ ctx[9].id_column,
    				label_col: /*sli*/ ctx[9].label_column,
    				table: /*sli*/ ctx[9].table
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(samples.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(samples, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const samples_changes = {};
    			if (dirty & /*shownSlices*/ 8) samples_changes.id_col = /*sli*/ ctx[9].id_column;
    			if (dirty & /*shownSlices*/ 8) samples_changes.label_col = /*sli*/ ctx[9].label_column;
    			if (dirty & /*shownSlices*/ 8) samples_changes.table = /*sli*/ ctx[9].table;
    			samples.$set(samples_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(samples.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(samples.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(samples, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block$1.name,
    		type: "if",
    		source: "(78:10) {#if open === i && sli.table}",
    		ctx
    	});

    	return block;
    }

    // (77:8) <Content>
    function create_default_slot_2$1(ctx) {
    	let if_block_anchor;
    	let current;
    	let if_block = /*open*/ ctx[2] === /*i*/ ctx[11] && /*sli*/ ctx[9].table && create_if_block$1(ctx);

    	const block = {
    		c: function create() {
    			if (if_block) if_block.c();
    			if_block_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			if (if_block) if_block.m(target, anchor);
    			insert_dev(target, if_block_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (/*open*/ ctx[2] === /*i*/ ctx[11] && /*sli*/ ctx[9].table) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*open, shownSlices*/ 12) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block$1(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(if_block_anchor.parentNode, if_block_anchor);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(if_block);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(if_block);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (if_block) if_block.d(detaching);
    			if (detaching) detach_dev(if_block_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2$1.name,
    		type: "slot",
    		source: "(77:8) <Content>",
    		ctx
    	});

    	return block;
    }

    // (59:6) <Panel         on:SMUIAccordionHeader:activate={() => {           currSlice = sli;           open = i;         }}       >
    function create_default_slot_1$1(ctx) {
    	let header;
    	let t0;
    	let content;
    	let t1;
    	let current;

    	header = new Header({
    			props: {
    				$$slots: {
    					description: [create_description_slot],
    					default: [create_default_slot_3$1]
    				},
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	content = new Content({
    			props: {
    				$$slots: { default: [create_default_slot_2$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(header.$$.fragment);
    			t0 = space();
    			create_component(content.$$.fragment);
    			t1 = space();
    		},
    		m: function mount(target, anchor) {
    			mount_component(header, target, anchor);
    			insert_dev(target, t0, anchor);
    			mount_component(content, target, anchor);
    			insert_dev(target, t1, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const header_changes = {};

    			if (dirty & /*$$scope, shownSlices, selected*/ 8202) {
    				header_changes.$$scope = { dirty, ctx };
    			}

    			header.$set(header_changes);
    			const content_changes = {};

    			if (dirty & /*$$scope, shownSlices, open*/ 8204) {
    				content_changes.$$scope = { dirty, ctx };
    			}

    			content.$set(content_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(header.$$.fragment, local);
    			transition_in(content.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(header.$$.fragment, local);
    			transition_out(content.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(header, detaching);
    			if (detaching) detach_dev(t0);
    			destroy_component(content, detaching);
    			if (detaching) detach_dev(t1);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1$1.name,
    		type: "slot",
    		source: "(59:6) <Panel         on:SMUIAccordionHeader:activate={() => {           currSlice = sli;           open = i;         }}       >",
    		ctx
    	});

    	return block;
    }

    // (58:4) {#each shownSlices as sli, i}
    function create_each_block(ctx) {
    	let panel;
    	let current;

    	function SMUIAccordionHeader_activate_handler() {
    		return /*SMUIAccordionHeader_activate_handler*/ ctx[7](/*sli*/ ctx[9], /*i*/ ctx[11]);
    	}

    	panel = new Panel({
    			props: {
    				$$slots: { default: [create_default_slot_1$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	panel.$on("SMUIAccordionHeader:activate", SMUIAccordionHeader_activate_handler);

    	const block = {
    		c: function create() {
    			create_component(panel.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(panel, target, anchor);
    			current = true;
    		},
    		p: function update(new_ctx, dirty) {
    			ctx = new_ctx;
    			const panel_changes = {};

    			if (dirty & /*$$scope, shownSlices, open, selected*/ 8206) {
    				panel_changes.$$scope = { dirty, ctx };
    			}

    			panel.$set(panel_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(panel.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(panel.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(panel, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_each_block.name,
    		type: "each",
    		source: "(58:4) {#each shownSlices as sli, i}",
    		ctx
    	});

    	return block;
    }

    // (57:2) <Accordion style="width:100%">
    function create_default_slot$1(ctx) {
    	let each_1_anchor;
    	let current;
    	let each_value = /*shownSlices*/ ctx[3];
    	validate_each_argument(each_value);
    	let each_blocks = [];

    	for (let i = 0; i < each_value.length; i += 1) {
    		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
    	}

    	const out = i => transition_out(each_blocks[i], 1, 1, () => {
    		each_blocks[i] = null;
    	});

    	const block = {
    		c: function create() {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].c();
    			}

    			each_1_anchor = empty$2();
    		},
    		m: function mount(target, anchor) {
    			for (let i = 0; i < each_blocks.length; i += 1) {
    				each_blocks[i].m(target, anchor);
    			}

    			insert_dev(target, each_1_anchor, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (dirty & /*currSlice, shownSlices, open, selected, chip*/ 4111) {
    				each_value = /*shownSlices*/ ctx[3];
    				validate_each_argument(each_value);
    				let i;

    				for (i = 0; i < each_value.length; i += 1) {
    					const child_ctx = get_each_context(ctx, each_value, i);

    					if (each_blocks[i]) {
    						each_blocks[i].p(child_ctx, dirty);
    						transition_in(each_blocks[i], 1);
    					} else {
    						each_blocks[i] = create_each_block(child_ctx);
    						each_blocks[i].c();
    						transition_in(each_blocks[i], 1);
    						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
    					}
    				}

    				group_outros();

    				for (i = each_value.length; i < each_blocks.length; i += 1) {
    					out(i);
    				}

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;

    			for (let i = 0; i < each_value.length; i += 1) {
    				transition_in(each_blocks[i]);
    			}

    			current = true;
    		},
    		o: function outro(local) {
    			each_blocks = each_blocks.filter(Boolean);

    			for (let i = 0; i < each_blocks.length; i += 1) {
    				transition_out(each_blocks[i]);
    			}

    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_each(each_blocks, detaching);
    			if (detaching) detach_dev(each_1_anchor);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot$1.name,
    		type: "slot",
    		source: "(57:2) <Accordion style=\\\"width:100%\\\">",
    		ctx
    	});

    	return block;
    }

    function create_fragment$1(ctx) {
    	let h2;
    	let t1;
    	let div;
    	let accordion;
    	let current;

    	accordion = new Accordion({
    			props: {
    				style: "width:100%",
    				$$slots: { default: [create_default_slot$1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			h2 = element("h2");
    			h2.textContent = "Slices";
    			t1 = space();
    			div = element("div");
    			create_component(accordion.$$.fragment);
    			add_location(h2, file$1, 53, 0, 1505);
    			attr_dev(div, "class", "accordion-container svelte-1s03elz");
    			add_location(div, file$1, 55, 0, 1522);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, h2, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, div, anchor);
    			mount_component(accordion, div, null);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const accordion_changes = {};

    			if (dirty & /*$$scope, shownSlices, currSlice, open, selected*/ 8207) {
    				accordion_changes.$$scope = { dirty, ctx };
    			}

    			accordion.$set(accordion_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(accordion.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(accordion.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(h2);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(div);
    			destroy_component(accordion);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment$1.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    const click_handler = e => e.stopPropagation();

    function instance$1($$self, $$props, $$invalidate) {
    	let $slices;
    	validate_store(slices, 'slices');
    	component_subscribe($$self, slices, $$value => $$invalidate(5, $slices = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('Slices', slots, []);
    	let { params = { slicer: "" } } = $$props;
    	let currSlice;
    	let selected = [];
    	let open = -1;
    	let shownSlices = [];
    	slices.subscribe(sls => updateShownSlices(sls));

    	function updateShownSlices(sls) {
    		if (sls.size === 0) {
    			$$invalidate(3, shownSlices = []);
    			return;
    		}

    		if (params.slicer) {
    			console.log(params.slicer);
    			$$invalidate(3, shownSlices = [sls.get(params.slicer)]);
    			return;
    		}

    		if (selected.length === 0) {
    			$$invalidate(3, shownSlices = [...sls.values()]);
    			return;
    		}

    		let slicesToInclude = new Set(sls.values());

    		selected.forEach(sel => {
    			[...sls.values()].forEach(slice => {
    				if (!slice.name.includes(sel)) {
    					slicesToInclude.delete(slice);
    				}
    			});
    		});

    		$$invalidate(3, shownSlices = [...slicesToInclude.values()]);
    	}

    	const writable_props = ['params'];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1$1.warn(`<Slices> was created with unknown prop '${key}'`);
    	});

    	function chipset_selected_binding(value) {
    		selected = value;
    		$$invalidate(1, selected);
    	}

    	const SMUIAccordionHeader_activate_handler = (sli, i) => {
    		$$invalidate(0, currSlice = sli);
    		$$invalidate(2, open = i);
    	};

    	$$self.$$set = $$props => {
    		if ('params' in $$props) $$invalidate(4, params = $$props.params);
    	};

    	$$self.$capture_state = () => ({
    		Accordion,
    		Panel,
    		Header,
    		Content,
    		Chip,
    		Text,
    		ChipSet: Set$1,
    		fromArrow,
    		Samples,
    		slices,
    		params,
    		currSlice,
    		selected,
    		open,
    		shownSlices,
    		updateShownSlices,
    		$slices
    	});

    	$$self.$inject_state = $$props => {
    		if ('params' in $$props) $$invalidate(4, params = $$props.params);
    		if ('currSlice' in $$props) $$invalidate(0, currSlice = $$props.currSlice);
    		if ('selected' in $$props) $$invalidate(1, selected = $$props.selected);
    		if ('open' in $$props) $$invalidate(2, open = $$props.open);
    		if ('shownSlices' in $$props) $$invalidate(3, shownSlices = $$props.shownSlices);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	$$self.$$.update = () => {
    		if ($$self.$$.dirty & /*currSlice, $slices*/ 33) {
    			if (currSlice) {
    				if (!currSlice.table) {
    					fetch("/api/table/" + currSlice.name.join("")).then(d => d.arrayBuffer()).then(d => {
    						$$invalidate(0, currSlice.table = fromArrow(d), currSlice);
    						$slices.set(currSlice.name.join(""), currSlice);
    						slices.set($slices);
    					}).catch(e => console.log(e));
    				}
    			}
    		}

    		if ($$self.$$.dirty & /*selected, $slices*/ 34) {
    			{
    				updateShownSlices($slices);
    			}
    		}
    	};

    	return [
    		currSlice,
    		selected,
    		open,
    		shownSlices,
    		params,
    		$slices,
    		chipset_selected_binding,
    		SMUIAccordionHeader_activate_handler
    	];
    }

    class Slices extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance$1, create_fragment$1, safe_not_equal, { params: 4 });

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "Slices",
    			options,
    			id: create_fragment$1.name
    		});
    	}

    	get params() {
    		throw new Error("<Slices>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}

    	set params(value) {
    		throw new Error("<Slices>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
    	}
    }

    /* src/App.svelte generated by Svelte v3.46.4 */

    const { console: console_1 } = globals;
    const file = "src/App.svelte";

    // (96:8) <Icon component={Svg} viewBox="0 0 24 24">
    function create_default_slot_28(ctx) {
    	let path;

    	const block = {
    		c: function create() {
    			path = svg_element("path");
    			attr_dev(path, "fill", "currentColor");
    			attr_dev(path, "d", mdiApi);
    			add_location(path, file, 96, 10, 2571);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, path, anchor);
    		},
    		p: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(path);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_28.name,
    		type: "slot",
    		source: "(96:8) <Icon component={Svg} viewBox=\\\"0 0 24 24\\\">",
    		ctx
    	});

    	return block;
    }

    // (95:6) <IconButton href="https://cabreraalex.github.io/zeno/intro.html">
    function create_default_slot_27(ctx) {
    	let icon;
    	let current;

    	icon = new Icon({
    			props: {
    				component: Svg$1,
    				viewBox: "0 0 24 24",
    				$$slots: { default: [create_default_slot_28] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(icon.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(icon, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const icon_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				icon_changes.$$scope = { dirty, ctx };
    			}

    			icon.$set(icon_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(icon.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(icon.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(icon, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_27.name,
    		type: "slot",
    		source: "(95:6) <IconButton href=\\\"https://cabreraalex.github.io/zeno/intro.html\\\">",
    		ctx
    	});

    	return block;
    }

    // (100:6) <Tooltip>
    function create_default_slot_26(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("read the documentation");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_26.name,
    		type: "slot",
    		source: "(100:6) <Tooltip>",
    		ctx
    	});

    	return block;
    }

    // (94:4) <Wrapper>
    function create_default_slot_25(ctx) {
    	let iconbutton;
    	let t;
    	let tooltip;
    	let current;

    	iconbutton = new IconButton({
    			props: {
    				href: "https://cabreraalex.github.io/zeno/intro.html",
    				$$slots: { default: [create_default_slot_27] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	tooltip = new Tooltip$1({
    			props: {
    				$$slots: { default: [create_default_slot_26] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(iconbutton.$$.fragment);
    			t = space();
    			create_component(tooltip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(iconbutton, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const iconbutton_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				iconbutton_changes.$$scope = { dirty, ctx };
    			}

    			iconbutton.$set(iconbutton_changes);
    			const tooltip_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(iconbutton.$$.fragment, local);
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(iconbutton.$$.fragment, local);
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(iconbutton, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_25.name,
    		type: "slot",
    		source: "(94:4) <Wrapper>",
    		ctx
    	});

    	return block;
    }

    // (104:8) <Icon component={Svg} viewBox="0 0 24 24">
    function create_default_slot_24(ctx) {
    	let path;

    	const block = {
    		c: function create() {
    			path = svg_element("path");
    			attr_dev(path, "fill", "currentColor");
    			attr_dev(path, "d", mdiGithub);
    			add_location(path, file, 104, 10, 2847);
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, path, anchor);
    		},
    		p: noop$2,
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(path);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_24.name,
    		type: "slot",
    		source: "(104:8) <Icon component={Svg} viewBox=\\\"0 0 24 24\\\">",
    		ctx
    	});

    	return block;
    }

    // (103:6) <IconButton href="https://github.com/cabreraalex/zeno">
    function create_default_slot_23(ctx) {
    	let icon;
    	let current;

    	icon = new Icon({
    			props: {
    				component: Svg$1,
    				viewBox: "0 0 24 24",
    				$$slots: { default: [create_default_slot_24] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(icon.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(icon, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const icon_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				icon_changes.$$scope = { dirty, ctx };
    			}

    			icon.$set(icon_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(icon.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(icon.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(icon, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_23.name,
    		type: "slot",
    		source: "(103:6) <IconButton href=\\\"https://github.com/cabreraalex/zeno\\\">",
    		ctx
    	});

    	return block;
    }

    // (108:6) <Tooltip>
    function create_default_slot_22(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("see the code on GitHub");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_22.name,
    		type: "slot",
    		source: "(108:6) <Tooltip>",
    		ctx
    	});

    	return block;
    }

    // (102:4) <Wrapper>
    function create_default_slot_21(ctx) {
    	let iconbutton;
    	let t;
    	let tooltip;
    	let current;

    	iconbutton = new IconButton({
    			props: {
    				href: "https://github.com/cabreraalex/zeno",
    				$$slots: { default: [create_default_slot_23] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	tooltip = new Tooltip$1({
    			props: {
    				$$slots: { default: [create_default_slot_22] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(iconbutton.$$.fragment);
    			t = space();
    			create_component(tooltip.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(iconbutton, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(tooltip, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const iconbutton_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				iconbutton_changes.$$scope = { dirty, ctx };
    			}

    			iconbutton.$set(iconbutton_changes);
    			const tooltip_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				tooltip_changes.$$scope = { dirty, ctx };
    			}

    			tooltip.$set(tooltip_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(iconbutton.$$.fragment, local);
    			transition_in(tooltip.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(iconbutton.$$.fragment, local);
    			transition_out(tooltip.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(iconbutton, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(tooltip, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_21.name,
    		type: "slot",
    		source: "(102:4) <Wrapper>",
    		ctx
    	});

    	return block;
    }

    // (117:10) <PrimaryText>
    function create_default_slot_20(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Home");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_20.name,
    		type: "slot",
    		source: "(117:10) <PrimaryText>",
    		ctx
    	});

    	return block;
    }

    // (118:10) <SecondaryText>
    function create_default_slot_19(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Overview of tests");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_19.name,
    		type: "slot",
    		source: "(118:10) <SecondaryText>",
    		ctx
    	});

    	return block;
    }

    // (116:8) <Text>
    function create_default_slot_18(ctx) {
    	let primarytext;
    	let t;
    	let secondarytext;
    	let current;

    	primarytext = new PrimaryText({
    			props: {
    				$$slots: { default: [create_default_slot_20] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	secondarytext = new SecondaryText({
    			props: {
    				$$slots: { default: [create_default_slot_19] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(primarytext.$$.fragment);
    			t = space();
    			create_component(secondarytext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(primarytext, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(secondarytext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const primarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				primarytext_changes.$$scope = { dirty, ctx };
    			}

    			primarytext.$set(primarytext_changes);
    			const secondarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				secondarytext_changes.$$scope = { dirty, ctx };
    			}

    			secondarytext.$set(secondarytext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(primarytext.$$.fragment, local);
    			transition_in(secondarytext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(primarytext.$$.fragment, local);
    			transition_out(secondarytext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(primarytext, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(secondarytext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_18.name,
    		type: "slot",
    		source: "(116:8) <Text>",
    		ctx
    	});

    	return block;
    }

    // (115:6) <Item activated={tab === "home"} on:SMUI:action={() => updateTab("home")}>
    function create_default_slot_17(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text$2({
    			props: {
    				$$slots: { default: [create_default_slot_18] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_17.name,
    		type: "slot",
    		source: "(115:6) <Item activated={tab === \\\"home\\\"} on:SMUI:action={() => updateTab(\\\"home\\\")}>",
    		ctx
    	});

    	return block;
    }

    // (129:10) <PrimaryText>
    function create_default_slot_16(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Slicers");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_16.name,
    		type: "slot",
    		source: "(129:10) <PrimaryText>",
    		ctx
    	});

    	return block;
    }

    // (130:10) <SecondaryText>
    function create_default_slot_15(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Data slicing functions");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_15.name,
    		type: "slot",
    		source: "(130:10) <SecondaryText>",
    		ctx
    	});

    	return block;
    }

    // (128:8) <Text>
    function create_default_slot_14(ctx) {
    	let primarytext;
    	let t;
    	let secondarytext;
    	let current;

    	primarytext = new PrimaryText({
    			props: {
    				$$slots: { default: [create_default_slot_16] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	secondarytext = new SecondaryText({
    			props: {
    				$$slots: { default: [create_default_slot_15] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(primarytext.$$.fragment);
    			t = space();
    			create_component(secondarytext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(primarytext, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(secondarytext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const primarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				primarytext_changes.$$scope = { dirty, ctx };
    			}

    			primarytext.$set(primarytext_changes);
    			const secondarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				secondarytext_changes.$$scope = { dirty, ctx };
    			}

    			secondarytext.$set(secondarytext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(primarytext.$$.fragment, local);
    			transition_in(secondarytext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(primarytext.$$.fragment, local);
    			transition_out(secondarytext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(primarytext, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(secondarytext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_14.name,
    		type: "slot",
    		source: "(128:8) <Text>",
    		ctx
    	});

    	return block;
    }

    // (124:6) <Item         activated={tab === "slicers"}         on:SMUI:action={() => updateTab("slicers")}       >
    function create_default_slot_13(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text$2({
    			props: {
    				$$slots: { default: [create_default_slot_14] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_13.name,
    		type: "slot",
    		source: "(124:6) <Item         activated={tab === \\\"slicers\\\"}         on:SMUI:action={() => updateTab(\\\"slicers\\\")}       >",
    		ctx
    	});

    	return block;
    }

    // (139:10) <PrimaryText>
    function create_default_slot_12(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Metrics");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_12.name,
    		type: "slot",
    		source: "(139:10) <PrimaryText>",
    		ctx
    	});

    	return block;
    }

    // (140:10) <SecondaryText>
    function create_default_slot_11(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Metric functions");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_11.name,
    		type: "slot",
    		source: "(140:10) <SecondaryText>",
    		ctx
    	});

    	return block;
    }

    // (138:8) <Text>
    function create_default_slot_10(ctx) {
    	let primarytext;
    	let t;
    	let secondarytext;
    	let current;

    	primarytext = new PrimaryText({
    			props: {
    				$$slots: { default: [create_default_slot_12] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	secondarytext = new SecondaryText({
    			props: {
    				$$slots: { default: [create_default_slot_11] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(primarytext.$$.fragment);
    			t = space();
    			create_component(secondarytext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(primarytext, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(secondarytext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const primarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				primarytext_changes.$$scope = { dirty, ctx };
    			}

    			primarytext.$set(primarytext_changes);
    			const secondarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				secondarytext_changes.$$scope = { dirty, ctx };
    			}

    			secondarytext.$set(secondarytext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(primarytext.$$.fragment, local);
    			transition_in(secondarytext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(primarytext.$$.fragment, local);
    			transition_out(secondarytext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(primarytext, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(secondarytext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_10.name,
    		type: "slot",
    		source: "(138:8) <Text>",
    		ctx
    	});

    	return block;
    }

    // (134:6) <Item         activated={tab === "tests"}         on:SMUI:action={() => updateTab("tests")}       >
    function create_default_slot_9(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text$2({
    			props: {
    				$$slots: { default: [create_default_slot_10] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_9.name,
    		type: "slot",
    		source: "(134:6) <Item         activated={tab === \\\"tests\\\"}         on:SMUI:action={() => updateTab(\\\"tests\\\")}       >",
    		ctx
    	});

    	return block;
    }

    // (151:10) <PrimaryText>
    function create_default_slot_8(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Slices");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_8.name,
    		type: "slot",
    		source: "(151:10) <PrimaryText>",
    		ctx
    	});

    	return block;
    }

    // (152:10) <SecondaryText>
    function create_default_slot_7(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Generated slices");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_7.name,
    		type: "slot",
    		source: "(152:10) <SecondaryText>",
    		ctx
    	});

    	return block;
    }

    // (150:8) <Text>
    function create_default_slot_6(ctx) {
    	let primarytext;
    	let t;
    	let secondarytext;
    	let current;

    	primarytext = new PrimaryText({
    			props: {
    				$$slots: { default: [create_default_slot_8] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	secondarytext = new SecondaryText({
    			props: {
    				$$slots: { default: [create_default_slot_7] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(primarytext.$$.fragment);
    			t = space();
    			create_component(secondarytext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(primarytext, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(secondarytext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const primarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				primarytext_changes.$$scope = { dirty, ctx };
    			}

    			primarytext.$set(primarytext_changes);
    			const secondarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				secondarytext_changes.$$scope = { dirty, ctx };
    			}

    			secondarytext.$set(secondarytext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(primarytext.$$.fragment, local);
    			transition_in(secondarytext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(primarytext.$$.fragment, local);
    			transition_out(secondarytext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(primarytext, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(secondarytext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_6.name,
    		type: "slot",
    		source: "(150:8) <Text>",
    		ctx
    	});

    	return block;
    }

    // (146:6) <Item         activated={tab === "slices"}         on:SMUI:action={() => updateTab("slices")}       >
    function create_default_slot_5(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text$2({
    			props: {
    				$$slots: { default: [create_default_slot_6] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_5.name,
    		type: "slot",
    		source: "(146:6) <Item         activated={tab === \\\"slices\\\"}         on:SMUI:action={() => updateTab(\\\"slices\\\")}       >",
    		ctx
    	});

    	return block;
    }

    // (161:10) <PrimaryText>
    function create_default_slot_4(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Results");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_4.name,
    		type: "slot",
    		source: "(161:10) <PrimaryText>",
    		ctx
    	});

    	return block;
    }

    // (162:10) <SecondaryText>
    function create_default_slot_3(ctx) {
    	let t;

    	const block = {
    		c: function create() {
    			t = text("Test results on slices");
    		},
    		m: function mount(target, anchor) {
    			insert_dev(target, t, anchor);
    		},
    		d: function destroy(detaching) {
    			if (detaching) detach_dev(t);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_3.name,
    		type: "slot",
    		source: "(162:10) <SecondaryText>",
    		ctx
    	});

    	return block;
    }

    // (160:8) <Text>
    function create_default_slot_2(ctx) {
    	let primarytext;
    	let t;
    	let secondarytext;
    	let current;

    	primarytext = new PrimaryText({
    			props: {
    				$$slots: { default: [create_default_slot_4] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	secondarytext = new SecondaryText({
    			props: {
    				$$slots: { default: [create_default_slot_3] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(primarytext.$$.fragment);
    			t = space();
    			create_component(secondarytext.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(primarytext, target, anchor);
    			insert_dev(target, t, anchor);
    			mount_component(secondarytext, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const primarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				primarytext_changes.$$scope = { dirty, ctx };
    			}

    			primarytext.$set(primarytext_changes);
    			const secondarytext_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				secondarytext_changes.$$scope = { dirty, ctx };
    			}

    			secondarytext.$set(secondarytext_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(primarytext.$$.fragment, local);
    			transition_in(secondarytext.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(primarytext.$$.fragment, local);
    			transition_out(secondarytext.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(primarytext, detaching);
    			if (detaching) detach_dev(t);
    			destroy_component(secondarytext, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_2.name,
    		type: "slot",
    		source: "(160:8) <Text>",
    		ctx
    	});

    	return block;
    }

    // (156:6) <Item         activated={tab === "results"}         on:SMUI:action={() => updateTab("results")}       >
    function create_default_slot_1(ctx) {
    	let text_1;
    	let current;

    	text_1 = new Text$2({
    			props: {
    				$$slots: { default: [create_default_slot_2] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(text_1.$$.fragment);
    		},
    		m: function mount(target, anchor) {
    			mount_component(text_1, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const text_1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				text_1_changes.$$scope = { dirty, ctx };
    			}

    			text_1.$set(text_1_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(text_1.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(text_1.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(text_1, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot_1.name,
    		type: "slot",
    		source: "(156:6) <Item         activated={tab === \\\"results\\\"}         on:SMUI:action={() => updateTab(\\\"results\\\")}       >",
    		ctx
    	});

    	return block;
    }

    // (114:4) <List class="demo-list">
    function create_default_slot(ctx) {
    	let item0;
    	let t0;
    	let separator0;
    	let t1;
    	let br0;
    	let t2;
    	let separator1;
    	let t3;
    	let item1;
    	let t4;
    	let separator2;
    	let t5;
    	let item2;
    	let t6;
    	let separator3;
    	let t7;
    	let br1;
    	let t8;
    	let separator4;
    	let t9;
    	let item3;
    	let t10;
    	let separator5;
    	let t11;
    	let item4;
    	let t12;
    	let separator6;
    	let current;

    	item0 = new Item({
    			props: {
    				activated: /*tab*/ ctx[1] === "home",
    				$$slots: { default: [create_default_slot_17] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	item0.$on("SMUI:action", /*SMUI_action_handler*/ ctx[5]);
    	separator0 = new Separator({ $$inline: true });
    	separator1 = new Separator({ $$inline: true });

    	item1 = new Item({
    			props: {
    				activated: /*tab*/ ctx[1] === "slicers",
    				$$slots: { default: [create_default_slot_13] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	item1.$on("SMUI:action", /*SMUI_action_handler_1*/ ctx[6]);
    	separator2 = new Separator({ $$inline: true });

    	item2 = new Item({
    			props: {
    				activated: /*tab*/ ctx[1] === "tests",
    				$$slots: { default: [create_default_slot_9] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	item2.$on("SMUI:action", /*SMUI_action_handler_2*/ ctx[7]);
    	separator3 = new Separator({ $$inline: true });
    	separator4 = new Separator({ $$inline: true });

    	item3 = new Item({
    			props: {
    				activated: /*tab*/ ctx[1] === "slices",
    				$$slots: { default: [create_default_slot_5] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	item3.$on("SMUI:action", /*SMUI_action_handler_3*/ ctx[8]);
    	separator5 = new Separator({ $$inline: true });

    	item4 = new Item({
    			props: {
    				activated: /*tab*/ ctx[1] === "results",
    				$$slots: { default: [create_default_slot_1] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	item4.$on("SMUI:action", /*SMUI_action_handler_4*/ ctx[9]);
    	separator6 = new Separator({ $$inline: true });

    	const block = {
    		c: function create() {
    			create_component(item0.$$.fragment);
    			t0 = space();
    			create_component(separator0.$$.fragment);
    			t1 = space();
    			br0 = element("br");
    			t2 = space();
    			create_component(separator1.$$.fragment);
    			t3 = space();
    			create_component(item1.$$.fragment);
    			t4 = space();
    			create_component(separator2.$$.fragment);
    			t5 = space();
    			create_component(item2.$$.fragment);
    			t6 = space();
    			create_component(separator3.$$.fragment);
    			t7 = space();
    			br1 = element("br");
    			t8 = space();
    			create_component(separator4.$$.fragment);
    			t9 = space();
    			create_component(item3.$$.fragment);
    			t10 = space();
    			create_component(separator5.$$.fragment);
    			t11 = space();
    			create_component(item4.$$.fragment);
    			t12 = space();
    			create_component(separator6.$$.fragment);
    			add_location(br0, file, 121, 6, 3320);
    			add_location(br1, file, 143, 6, 3911);
    		},
    		m: function mount(target, anchor) {
    			mount_component(item0, target, anchor);
    			insert_dev(target, t0, anchor);
    			mount_component(separator0, target, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, br0, anchor);
    			insert_dev(target, t2, anchor);
    			mount_component(separator1, target, anchor);
    			insert_dev(target, t3, anchor);
    			mount_component(item1, target, anchor);
    			insert_dev(target, t4, anchor);
    			mount_component(separator2, target, anchor);
    			insert_dev(target, t5, anchor);
    			mount_component(item2, target, anchor);
    			insert_dev(target, t6, anchor);
    			mount_component(separator3, target, anchor);
    			insert_dev(target, t7, anchor);
    			insert_dev(target, br1, anchor);
    			insert_dev(target, t8, anchor);
    			mount_component(separator4, target, anchor);
    			insert_dev(target, t9, anchor);
    			mount_component(item3, target, anchor);
    			insert_dev(target, t10, anchor);
    			mount_component(separator5, target, anchor);
    			insert_dev(target, t11, anchor);
    			mount_component(item4, target, anchor);
    			insert_dev(target, t12, anchor);
    			mount_component(separator6, target, anchor);
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			const item0_changes = {};
    			if (dirty & /*tab*/ 2) item0_changes.activated = /*tab*/ ctx[1] === "home";

    			if (dirty & /*$$scope*/ 4096) {
    				item0_changes.$$scope = { dirty, ctx };
    			}

    			item0.$set(item0_changes);
    			const item1_changes = {};
    			if (dirty & /*tab*/ 2) item1_changes.activated = /*tab*/ ctx[1] === "slicers";

    			if (dirty & /*$$scope*/ 4096) {
    				item1_changes.$$scope = { dirty, ctx };
    			}

    			item1.$set(item1_changes);
    			const item2_changes = {};
    			if (dirty & /*tab*/ 2) item2_changes.activated = /*tab*/ ctx[1] === "tests";

    			if (dirty & /*$$scope*/ 4096) {
    				item2_changes.$$scope = { dirty, ctx };
    			}

    			item2.$set(item2_changes);
    			const item3_changes = {};
    			if (dirty & /*tab*/ 2) item3_changes.activated = /*tab*/ ctx[1] === "slices";

    			if (dirty & /*$$scope*/ 4096) {
    				item3_changes.$$scope = { dirty, ctx };
    			}

    			item3.$set(item3_changes);
    			const item4_changes = {};
    			if (dirty & /*tab*/ 2) item4_changes.activated = /*tab*/ ctx[1] === "results";

    			if (dirty & /*$$scope*/ 4096) {
    				item4_changes.$$scope = { dirty, ctx };
    			}

    			item4.$set(item4_changes);
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(item0.$$.fragment, local);
    			transition_in(separator0.$$.fragment, local);
    			transition_in(separator1.$$.fragment, local);
    			transition_in(item1.$$.fragment, local);
    			transition_in(separator2.$$.fragment, local);
    			transition_in(item2.$$.fragment, local);
    			transition_in(separator3.$$.fragment, local);
    			transition_in(separator4.$$.fragment, local);
    			transition_in(item3.$$.fragment, local);
    			transition_in(separator5.$$.fragment, local);
    			transition_in(item4.$$.fragment, local);
    			transition_in(separator6.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(item0.$$.fragment, local);
    			transition_out(separator0.$$.fragment, local);
    			transition_out(separator1.$$.fragment, local);
    			transition_out(item1.$$.fragment, local);
    			transition_out(separator2.$$.fragment, local);
    			transition_out(item2.$$.fragment, local);
    			transition_out(separator3.$$.fragment, local);
    			transition_out(separator4.$$.fragment, local);
    			transition_out(item3.$$.fragment, local);
    			transition_out(separator5.$$.fragment, local);
    			transition_out(item4.$$.fragment, local);
    			transition_out(separator6.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(item0, detaching);
    			if (detaching) detach_dev(t0);
    			destroy_component(separator0, detaching);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(br0);
    			if (detaching) detach_dev(t2);
    			destroy_component(separator1, detaching);
    			if (detaching) detach_dev(t3);
    			destroy_component(item1, detaching);
    			if (detaching) detach_dev(t4);
    			destroy_component(separator2, detaching);
    			if (detaching) detach_dev(t5);
    			destroy_component(item2, detaching);
    			if (detaching) detach_dev(t6);
    			destroy_component(separator3, detaching);
    			if (detaching) detach_dev(t7);
    			if (detaching) detach_dev(br1);
    			if (detaching) detach_dev(t8);
    			destroy_component(separator4, detaching);
    			if (detaching) detach_dev(t9);
    			destroy_component(item3, detaching);
    			if (detaching) detach_dev(t10);
    			destroy_component(separator5, detaching);
    			if (detaching) detach_dev(t11);
    			destroy_component(item4, detaching);
    			if (detaching) detach_dev(t12);
    			destroy_component(separator6, detaching);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_default_slot.name,
    		type: "slot",
    		source: "(114:4) <List class=\\\"demo-list\\\">",
    		ctx
    	});

    	return block;
    }

    // (168:6) {#if runningAnalysis}
    function create_if_block(ctx) {
    	let circularprogress;
    	let t0;
    	let br;
    	let t1;
    	let p;
    	let current;

    	circularprogress = new CircularProgress({
    			props: {
    				style: "height: 32px; width: 32px;",
    				indeterminate: true
    			},
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			create_component(circularprogress.$$.fragment);
    			t0 = space();
    			br = element("br");
    			t1 = space();
    			p = element("p");
    			add_location(br, file, 169, 8, 4648);
    			add_location(p, file, 170, 8, 4663);
    		},
    		m: function mount(target, anchor) {
    			mount_component(circularprogress, target, anchor);
    			insert_dev(target, t0, anchor);
    			insert_dev(target, br, anchor);
    			insert_dev(target, t1, anchor);
    			insert_dev(target, p, anchor);
    			p.innerHTML = /*$status*/ ctx[2];
    			current = true;
    		},
    		p: function update(ctx, dirty) {
    			if (!current || dirty & /*$status*/ 4) p.innerHTML = /*$status*/ ctx[2];		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(circularprogress.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(circularprogress.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			destroy_component(circularprogress, detaching);
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(br);
    			if (detaching) detach_dev(t1);
    			if (detaching) detach_dev(p);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_if_block.name,
    		type: "if",
    		source: "(168:6) {#if runningAnalysis}",
    		ctx
    	});

    	return block;
    }

    function create_fragment(ctx) {
    	let html_tag;
    	let html_anchor;
    	let t0;
    	let header;
    	let img;
    	let img_src_value;
    	let t1;
    	let div0;
    	let wrapper0;
    	let t2;
    	let wrapper1;
    	let t3;
    	let main;
    	let div2;
    	let list;
    	let t4;
    	let div1;
    	let t5;
    	let div3;
    	let router;
    	let current;

    	wrapper0 = new Wrapper$1({
    			props: {
    				$$slots: { default: [create_default_slot_25] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	wrapper1 = new Wrapper$1({
    			props: {
    				$$slots: { default: [create_default_slot_21] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	list = new List$2({
    			props: {
    				class: "demo-list",
    				$$slots: { default: [create_default_slot] },
    				$$scope: { ctx }
    			},
    			$$inline: true
    		});

    	let if_block = /*runningAnalysis*/ ctx[0] && create_if_block(ctx);

    	router = new Router({
    			props: { routes: /*routes*/ ctx[3] },
    			$$inline: true
    		});

    	const block = {
    		c: function create() {
    			html_tag = new HtmlTag();
    			html_anchor = empty$2();
    			t0 = space();
    			header = element("header");
    			img = element("img");
    			t1 = space();
    			div0 = element("div");
    			create_component(wrapper0.$$.fragment);
    			t2 = space();
    			create_component(wrapper1.$$.fragment);
    			t3 = space();
    			main = element("main");
    			div2 = element("div");
    			create_component(list.$$.fragment);
    			t4 = space();
    			div1 = element("div");
    			if (if_block) if_block.c();
    			t5 = space();
    			div3 = element("div");
    			create_component(router.$$.fragment);
    			html_tag.a = html_anchor;
    			set_style(img, "width", "150px");
    			if (!src_url_equal(img.src, img_src_value = "zeno.png")) attr_dev(img, "src", img_src_value);
    			attr_dev(img, "alt", "Square spiral logo next to 'Zeno'");
    			attr_dev(img, "class", "svelte-1oi270k");
    			add_location(img, file, 86, 2, 2318);
    			add_location(div0, file, 92, 2, 2418);
    			attr_dev(header, "class", "svelte-1oi270k");
    			add_location(header, file, 85, 0, 2307);
    			attr_dev(div1, "class", "status svelte-1oi270k");
    			add_location(div1, file, 166, 4, 4513);
    			attr_dev(div2, "id", "side-menu");
    			attr_dev(div2, "class", "svelte-1oi270k");
    			add_location(div2, file, 112, 2, 3017);
    			attr_dev(div3, "id", "main");
    			attr_dev(div3, "class", "svelte-1oi270k");
    			add_location(div3, file, 174, 2, 4720);
    			attr_dev(main, "class", "svelte-1oi270k");
    			add_location(main, file, 111, 0, 3008);
    		},
    		l: function claim(nodes) {
    			throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
    		},
    		m: function mount(target, anchor) {
    			html_tag.m(github$1, document.head);
    			append_dev(document.head, html_anchor);
    			insert_dev(target, t0, anchor);
    			insert_dev(target, header, anchor);
    			append_dev(header, img);
    			append_dev(header, t1);
    			append_dev(header, div0);
    			mount_component(wrapper0, div0, null);
    			append_dev(div0, t2);
    			mount_component(wrapper1, div0, null);
    			insert_dev(target, t3, anchor);
    			insert_dev(target, main, anchor);
    			append_dev(main, div2);
    			mount_component(list, div2, null);
    			append_dev(div2, t4);
    			append_dev(div2, div1);
    			if (if_block) if_block.m(div1, null);
    			append_dev(main, t5);
    			append_dev(main, div3);
    			mount_component(router, div3, null);
    			current = true;
    		},
    		p: function update(ctx, [dirty]) {
    			const wrapper0_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				wrapper0_changes.$$scope = { dirty, ctx };
    			}

    			wrapper0.$set(wrapper0_changes);
    			const wrapper1_changes = {};

    			if (dirty & /*$$scope*/ 4096) {
    				wrapper1_changes.$$scope = { dirty, ctx };
    			}

    			wrapper1.$set(wrapper1_changes);
    			const list_changes = {};

    			if (dirty & /*$$scope, tab*/ 4098) {
    				list_changes.$$scope = { dirty, ctx };
    			}

    			list.$set(list_changes);

    			if (/*runningAnalysis*/ ctx[0]) {
    				if (if_block) {
    					if_block.p(ctx, dirty);

    					if (dirty & /*runningAnalysis*/ 1) {
    						transition_in(if_block, 1);
    					}
    				} else {
    					if_block = create_if_block(ctx);
    					if_block.c();
    					transition_in(if_block, 1);
    					if_block.m(div1, null);
    				}
    			} else if (if_block) {
    				group_outros();

    				transition_out(if_block, 1, 1, () => {
    					if_block = null;
    				});

    				check_outros();
    			}
    		},
    		i: function intro(local) {
    			if (current) return;
    			transition_in(wrapper0.$$.fragment, local);
    			transition_in(wrapper1.$$.fragment, local);
    			transition_in(list.$$.fragment, local);
    			transition_in(if_block);
    			transition_in(router.$$.fragment, local);
    			current = true;
    		},
    		o: function outro(local) {
    			transition_out(wrapper0.$$.fragment, local);
    			transition_out(wrapper1.$$.fragment, local);
    			transition_out(list.$$.fragment, local);
    			transition_out(if_block);
    			transition_out(router.$$.fragment, local);
    			current = false;
    		},
    		d: function destroy(detaching) {
    			detach_dev(html_anchor);
    			if (detaching) html_tag.d();
    			if (detaching) detach_dev(t0);
    			if (detaching) detach_dev(header);
    			destroy_component(wrapper0);
    			destroy_component(wrapper1);
    			if (detaching) detach_dev(t3);
    			if (detaching) detach_dev(main);
    			destroy_component(list);
    			if (if_block) if_block.d();
    			destroy_component(router);
    		}
    	};

    	dispatch_dev("SvelteRegisterBlock", {
    		block,
    		id: create_fragment.name,
    		type: "component",
    		source: "",
    		ctx
    	});

    	return block;
    }

    function instance($$self, $$props, $$invalidate) {
    	let $location;
    	let $status;
    	validate_store(location, 'location');
    	component_subscribe($$self, location, $$value => $$invalidate(11, $location = $$value));
    	validate_store(status, 'status');
    	component_subscribe($$self, status, $$value => $$invalidate(2, $status = $$value));
    	let { $$slots: slots = {}, $$scope } = $$props;
    	validate_slots('App', slots, []);

    	const routes = {
    		"/": Home,
    		"/slicers/": Slicers,
    		"/tests/": Metrics,
    		"/tests/:test?": Metrics,
    		"/slices/": Slices,
    		"/slices/:slicer?": Slices,
    		"/results/": Results,
    		"/result/:id?": ResultView,
    		"*": Home
    	};

    	let runningAnalysis = true;
    	let fetchedSlices = false;
    	let tab = $location.split("/")[1];

    	if (!tab) {
    		tab = "home";
    	}

    	location.subscribe(d => {
    		$$invalidate(1, tab = d.split("/")[1]);

    		if (!tab) {
    			$$invalidate(1, tab = "home");
    		}
    	});

    	function updateTab(t) {
    		$$invalidate(1, tab = t);

    		if (t === "home") {
    			window.location.hash = "";
    		} else {
    			window.location.hash = "#/" + t + "/";
    		}
    	}

    	onMount(() => {
    		wsResponse.set({ status: "connecting", results: [] });
    	});

    	status.subscribe(s => {
    		if (!fetchedSlices && (s === "Done" || s.startsWith("Model"))) {
    			fetchedSlices = true;
    			console.log("get stuff?");

    			fetch("/api/slices").then(d => d.json()).then(d => {
    				const out = JSON.parse(d);
    				const retMap = new Map();

    				out.forEach(s => {
    					retMap.set(s.name.join(""), s);
    				});

    				slices.set(retMap);
    			});

    			fetch("/api/metrics").then(d => d.json()).then(d => metrics.set(JSON.parse(d)));
    		}

    		if (s === "Done") {
    			$$invalidate(0, runningAnalysis = false);
    		} else {
    			$$invalidate(0, runningAnalysis = true);
    		}
    	});

    	const writable_props = [];

    	Object.keys($$props).forEach(key => {
    		if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<App> was created with unknown prop '${key}'`);
    	});

    	const SMUI_action_handler = () => updateTab("home");
    	const SMUI_action_handler_1 = () => updateTab("slicers");
    	const SMUI_action_handler_2 = () => updateTab("tests");
    	const SMUI_action_handler_3 = () => updateTab("slices");
    	const SMUI_action_handler_4 = () => updateTab("results");

    	$$self.$capture_state = () => ({
    		mdiApi,
    		mdiGithub,
    		CircularProgress,
    		Svg: Svg$1,
    		IconButton,
    		Icon,
    		List: List$2,
    		Item,
    		PrimaryText,
    		SecondaryText,
    		Separator,
    		Text: Text$2,
    		Tooltip: Tooltip$1,
    		Wrapper: Wrapper$1,
    		onMount,
    		github: github$1,
    		Router,
    		location,
    		Home,
    		Metrics,
    		Results,
    		ResultView,
    		Slicers,
    		Slices,
    		metrics,
    		slices,
    		status,
    		wsResponse,
    		routes,
    		runningAnalysis,
    		fetchedSlices,
    		tab,
    		updateTab,
    		$location,
    		$status
    	});

    	$$self.$inject_state = $$props => {
    		if ('runningAnalysis' in $$props) $$invalidate(0, runningAnalysis = $$props.runningAnalysis);
    		if ('fetchedSlices' in $$props) fetchedSlices = $$props.fetchedSlices;
    		if ('tab' in $$props) $$invalidate(1, tab = $$props.tab);
    	};

    	if ($$props && "$$inject" in $$props) {
    		$$self.$inject_state($$props.$$inject);
    	}

    	return [
    		runningAnalysis,
    		tab,
    		$status,
    		routes,
    		updateTab,
    		SMUI_action_handler,
    		SMUI_action_handler_1,
    		SMUI_action_handler_2,
    		SMUI_action_handler_3,
    		SMUI_action_handler_4
    	];
    }

    class App extends SvelteComponentDev {
    	constructor(options) {
    		super(options);
    		init$1(this, options, instance, create_fragment, safe_not_equal, {});

    		dispatch_dev("SvelteRegisterComponent", {
    			component: this,
    			tagName: "App",
    			options,
    			id: create_fragment.name
    		});
    	}
    }

    const app = new App({
        target: document.body,
        props: {
            name: 'world'
        }
    });

    return app;

})();
//# sourceMappingURL=bundle.js.map
