budibase/packages/server/builder/bundle.js

68202 lines
2.4 MiB

(function(l, i, v, e) { v = l.createElement(i); v.async = 1; v.src = '//' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; e = l.getElementsByTagName(i)[0]; e.parentNode.insertBefore(v, e)})(document, 'script');
(function () {
'use strict';
function noop() { }
const identity = x => x;
function assign(tar, src) {
// @ts-ignore
for (const k in src)
tar[k] = src[k];
return tar;
}
function is_promise(value) {
return value && typeof value === 'object' && typeof value.then === 'function';
}
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');
}
function validate_store(store, name) {
if (!store || typeof store.subscribe !== 'function') {
throw new Error(`'${name}' is not a store with a 'subscribe' method`);
}
}
function subscribe(store, callback) {
const unsub = store.subscribe(callback);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function component_subscribe(component, store, callback) {
component.$$.on_destroy.push(subscribe(store, callback));
}
function create_slot(definition, ctx, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, fn) {
return definition[1]
? assign({}, assign(ctx.$$scope.ctx, definition[1](fn ? fn(ctx) : {})))
: ctx.$$scope.ctx;
}
function get_slot_changes(definition, ctx, changed, fn) {
return definition[1]
? assign({}, assign(ctx.$$scope.changed || {}, definition[1](fn ? fn(changed) : {})))
: ctx.$$scope.changed || {};
}
const is_client = typeof window !== 'undefined';
let now = is_client
? () => window.performance.now()
: () => Date.now();
let raf = is_client ? cb => requestAnimationFrame(cb) : noop;
const tasks = new Set();
let running = false;
function run_tasks() {
tasks.forEach(task => {
if (!task[0](now())) {
tasks.delete(task);
task[1]();
}
});
running = tasks.size > 0;
if (running)
raf(run_tasks);
}
function loop(fn) {
let task;
if (!running) {
running = true;
raf(run_tasks);
}
return {
promise: new Promise(fulfil => {
tasks.add(task = [fn, fulfil]);
}),
abort() {
tasks.delete(task);
}
};
}
function append(target, node) {
target.appendChild(node);
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
node.parentNode.removeChild(node);
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i])
iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(' ');
}
function empty() {
return text('');
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function 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
node.setAttribute(attribute, value);
}
function children(element) {
return Array.from(element.childNodes);
}
function set_input_value(input, value) {
if (value != null || input.value) {
input.value = value;
}
}
function set_style(node, key, value, important) {
node.style.setProperty(key, value, important ? 'important' : '');
}
function select_option(select, value) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
if (option.__value === value) {
option.selected = true;
return;
}
}
}
function select_options(select, value) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
option.selected = ~value.indexOf(option.__value);
}
}
function select_value(select) {
const selected_option = select.querySelector(':checked') || select.options[0];
return selected_option && selected_option.__value;
}
function select_multiple_value(select) {
return [].map.call(select.querySelectorAll(':checked'), option => option.__value);
}
function toggle_class(element, name, toggle) {
element.classList[toggle ? 'add' : 'remove'](name);
}
function custom_event(type, detail) {
const e = document.createEvent('CustomEvent');
e.initCustomEvent(type, false, false, detail);
return e;
}
class HtmlTag {
constructor(html, anchor = null) {
this.e = element('div');
this.a = anchor;
this.u(html);
}
m(target, anchor = null) {
for (let i = 0; i < this.n.length; i += 1) {
insert(target, this.n[i], anchor);
}
this.t = target;
}
u(html) {
this.e.innerHTML = html;
this.n = Array.from(this.e.childNodes);
}
p(html) {
this.d();
this.u(html);
this.m(this.t, this.a);
}
d() {
this.n.forEach(detach);
}
}
let stylesheet;
let active = 0;
let current_rules = {};
// https://github.com/darkskyapp/string-hash/blob/master/index.js
function hash(str) {
let hash = 5381;
let i = str.length;
while (i--)
hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
return hash >>> 0;
}
function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {
const step = 16.666 / duration;
let keyframes = '{\n';
for (let p = 0; p <= 1; p += step) {
const t = a + (b - a) * ease(p);
keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`;
}
const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`;
const name = `__svelte_${hash(rule)}_${uid}`;
if (!current_rules[name]) {
if (!stylesheet) {
const style = element('style');
document.head.appendChild(style);
stylesheet = style.sheet;
}
current_rules[name] = true;
stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);
}
const animation = node.style.animation || '';
node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`;
active += 1;
return name;
}
function delete_rule(node, name) {
node.style.animation = (node.style.animation || '')
.split(', ')
.filter(name
? anim => anim.indexOf(name) < 0 // remove specific animation
: anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations
)
.join(', ');
if (name && !--active)
clear_rules();
}
function clear_rules() {
raf(() => {
if (active)
return;
let i = stylesheet.cssRules.length;
while (i--)
stylesheet.deleteRule(i);
current_rules = {};
});
}
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);
}
// 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) {
callbacks.slice().forEach(fn => fn(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 add_render_callback(fn) {
render_callbacks.push(fn);
}
function add_flush_callback(fn) {
flush_callbacks.push(fn);
}
function flush() {
const seen_callbacks = new Set();
do {
// first, call beforeUpdate functions
// and update components
while (dirty_components.length) {
const component = dirty_components.shift();
set_current_component(component);
update(component.$$);
}
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)) {
callback();
// ...so guard against infinite loops
seen_callbacks.add(callback);
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
}
function update($$) {
if ($$.fragment) {
$$.update($$.dirty);
run_all($$.before_update);
$$.fragment.p($$.dirty, $$.ctx);
$$.dirty = null;
$$.after_update.forEach(add_render_callback);
}
}
let promise;
function wait() {
if (!promise) {
promise = Promise.resolve();
promise.then(() => {
promise = null;
});
}
return promise;
}
function dispatch(node, direction, kind) {
node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));
}
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 null_transition = { duration: 0 };
function create_in_transition(node, fn, params) {
let config = fn(node, params);
let running = false;
let animation_name;
let task;
let uid = 0;
function cleanup() {
if (animation_name)
delete_rule(node, animation_name);
}
function go() {
const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;
if (css)
animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);
tick(0, 1);
const start_time = now() + delay;
const end_time = start_time + duration;
if (task)
task.abort();
running = true;
add_render_callback(() => dispatch(node, true, 'start'));
task = loop(now => {
if (running) {
if (now >= end_time) {
tick(1, 0);
dispatch(node, true, 'end');
cleanup();
return running = false;
}
if (now >= start_time) {
const t = easing((now - start_time) / duration);
tick(t, 1 - t);
}
}
return running;
});
}
let started = false;
return {
start() {
if (started)
return;
delete_rule(node);
if (is_function(config)) {
config = config();
wait().then(go);
}
else {
go();
}
},
invalidate() {
started = false;
},
end() {
if (running) {
cleanup();
running = false;
}
}
};
}
function create_out_transition(node, fn, params) {
let config = fn(node, params);
let running = true;
let animation_name;
const group = outros;
group.r += 1;
function go() {
const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;
if (css)
animation_name = create_rule(node, 1, 0, duration, delay, easing, css);
const start_time = now() + delay;
const end_time = start_time + duration;
add_render_callback(() => dispatch(node, false, 'start'));
loop(now => {
if (running) {
if (now >= end_time) {
tick(0, 1);
dispatch(node, false, 'end');
if (!--group.r) {
// this will result in `end()` being called,
// so we don't need to clean up here
run_all(group.c);
}
return false;
}
if (now >= start_time) {
const t = easing((now - start_time) / duration);
tick(1 - t, t);
}
}
return running;
});
}
if (is_function(config)) {
wait().then(() => {
// @ts-ignore
config = config();
go();
});
}
else {
go();
}
return {
end(reset) {
if (reset && config.tick) {
config.tick(1, 0);
}
if (running) {
if (animation_name)
delete_rule(node, animation_name);
running = false;
}
}
};
}
function handle_promise(promise, info) {
const token = info.token = {};
function update(type, index, key, value) {
if (info.token !== token)
return;
info.resolved = key && { [key]: value };
const child_ctx = assign(assign({}, info.ctx), info.resolved);
const block = type && (info.current = type)(child_ctx);
if (info.block) {
if (info.blocks) {
info.blocks.forEach((block, i) => {
if (i !== index && block) {
group_outros();
transition_out(block, 1, 1, () => {
info.blocks[i] = null;
});
check_outros();
}
});
}
else {
info.block.d(1);
}
block.c();
transition_in(block, 1);
block.m(info.mount(), info.anchor);
flush();
}
info.block = block;
if (info.blocks)
info.blocks[index] = block;
}
if (is_promise(promise)) {
const current_component = get_current_component();
promise.then(value => {
set_current_component(current_component);
update(info.then, 1, info.value, value);
set_current_component(null);
}, error => {
set_current_component(current_component);
update(info.catch, 2, info.error, error);
set_current_component(null);
});
// if we previously had a then/catch block, destroy it
if (info.current !== info.pending) {
update(info.pending, 0);
return true;
}
}
else {
if (info.current !== info.then) {
update(info.then, 1, info.value, promise);
return true;
}
info.resolved = { [info.value]: promise };
}
}
function bind(component, name, callback) {
if (component.$$.props.indexOf(name) === -1)
return;
component.$$.bound[name] = callback;
callback(component.$$.ctx[name]);
}
function mount_component(component, target, anchor) {
const { fragment, on_mount, on_destroy, after_update } = component.$$;
fragment.m(target, anchor);
// 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) {
if (component.$$.fragment) {
run_all(component.$$.on_destroy);
component.$$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
component.$$.on_destroy = component.$$.fragment = null;
component.$$.ctx = {};
}
}
function make_dirty(component, key) {
if (!component.$$.dirty) {
dirty_components.push(component);
schedule_update();
component.$$.dirty = blank_object();
}
component.$$.dirty[key] = true;
}
function init(component, options, instance, create_fragment, not_equal, prop_names) {
const parent_component = current_component;
set_current_component(component);
const props = options.props || {};
const $$ = component.$$ = {
fragment: null,
ctx: null,
// state
props: prop_names,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
before_update: [],
after_update: [],
context: new Map(parent_component ? parent_component.$$.context : []),
// everything else
callbacks: blank_object(),
dirty: null
};
let ready = false;
$$.ctx = instance
? instance(component, props, (key, ret, value = ret) => {
if ($$.ctx && not_equal($$.ctx[key], $$.ctx[key] = value)) {
if ($$.bound[key])
$$.bound[key](value);
if (ready)
make_dirty(component, key);
}
return ret;
})
: props;
$$.update();
ready = true;
run_all($$.before_update);
$$.fragment = create_fragment($$.ctx);
if (options.target) {
if (options.hydrate) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment.l(children(options.target));
}
else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment.c();
}
if (options.intro)
transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor);
flush();
}
set_current_component(parent_component);
}
let SvelteElement;
if (typeof HTMLElement !== 'undefined') {
SvelteElement = class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
// @ts-ignore todo: improve typings
for (const key in this.$$.slotted) {
// @ts-ignore todo: improve typings
this.appendChild(this.$$.slotted[key]);
}
}
attributeChangedCallback(attr, _oldValue, newValue) {
this[attr] = newValue;
}
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
// TODO should this delegate to addEventListener?
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() {
// overridden by instance, if it has props
}
};
}
class SvelteComponent {
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$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() {
// overridden by instance, if it has props
}
}
function dispatch_dev(type, detail) {
document.dispatchEvent(custom_event(type, detail));
}
function append_dev(target, node) {
dispatch_dev("SvelteDOMInsert", { target, node });
append(target, node);
}
function insert_dev(target, node, anchor) {
dispatch_dev("SvelteDOMInsert", { target, node, anchor });
insert(target, node, anchor);
}
function detach_dev(node) {
dispatch_dev("SvelteDOMRemove", { node });
detach(node);
}
function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {
const modifiers = options === true ? ["capture"] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default)
modifiers.push('preventDefault');
if (has_stop_propagation)
modifiers.push('stopPropagation');
dispatch_dev("SvelteDOMAddEventListener", { node, event, handler, modifiers });
const dispose = listen(node, event, handler, options);
return () => {
dispatch_dev("SvelteDOMRemoveEventListener", { node, event, handler, modifiers });
dispose();
};
}
function attr_dev(node, attribute, value) {
attr(node, attribute, value);
if (value == null)
dispatch_dev("SvelteDOMRemoveAttribute", { node, attribute });
else
dispatch_dev("SvelteDOMSetAttribute", { node, attribute, value });
}
function prop_dev(node, property, value) {
node[property] = value;
dispatch_dev("SvelteDOMSetProperty", { node, property, value });
}
function set_data_dev(text, data) {
data = '' + data;
if (text.data === data)
return;
dispatch_dev("SvelteDOMSetData", { node: text, data });
text.data = data;
}
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
};
}
}
/* src\common\Button.svelte generated by Svelte v3.12.1 */
const file = "src\\common\\Button.svelte";
function create_fragment(ctx) {
var button, button_class_value, current, dispose;
const default_slot_template = ctx.$$slots.default;
const default_slot = create_slot(default_slot_template, ctx, null);
const block = {
c: function create() {
button = element("button");
if (default_slot) default_slot.c();
attr_dev(button, "class", button_class_value = "" + ctx.color + " " + ctx.className + " " + ctx.borderClass + " " + (ctx.grouped ? "grouped" : "") + " svelte-vnon4v");
attr_dev(button, "style", ctx.style);
add_location(button, file, 14, 0, 246);
dispose = listen_dev(button, "click", ctx.click_handler);
},
l: function claim(nodes) {
if (default_slot) default_slot.l(button_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);
}
current = true;
},
p: function update(changed, ctx) {
if (default_slot && default_slot.p && changed.$$scope) {
default_slot.p(
get_slot_changes(default_slot_template, ctx, changed, null),
get_slot_context(default_slot_template, ctx, null)
);
}
if ((!current || changed.color || changed.className || changed.borderClass || changed.grouped) && button_class_value !== (button_class_value = "" + ctx.color + " " + ctx.className + " " + ctx.borderClass + " " + (ctx.grouped ? "grouped" : "") + " svelte-vnon4v")) {
attr_dev(button, "class", button_class_value);
}
if (!current || changed.style) {
attr_dev(button, "style", ctx.style);
}
},
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);
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment.name, type: "component", source: "", ctx });
return block;
}
function instance($$self, $$props, $$invalidate) {
let { color = "primary", className = "", style = "", groupPosition = "", grouped = false } = $$props;
const writable_props = ['color', 'className', 'style', 'groupPosition', 'grouped'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Button> was created with unknown prop '${key}'`);
});
let { $$slots = {}, $$scope } = $$props;
function click_handler(event) {
bubble($$self, event);
}
$$self.$set = $$props => {
if ('color' in $$props) $$invalidate('color', color = $$props.color);
if ('className' in $$props) $$invalidate('className', className = $$props.className);
if ('style' in $$props) $$invalidate('style', style = $$props.style);
if ('groupPosition' in $$props) $$invalidate('groupPosition', groupPosition = $$props.groupPosition);
if ('grouped' in $$props) $$invalidate('grouped', grouped = $$props.grouped);
if ('$$scope' in $$props) $$invalidate('$$scope', $$scope = $$props.$$scope);
};
$$self.$capture_state = () => {
return { color, className, style, groupPosition, grouped, borderClass };
};
$$self.$inject_state = $$props => {
if ('color' in $$props) $$invalidate('color', color = $$props.color);
if ('className' in $$props) $$invalidate('className', className = $$props.className);
if ('style' in $$props) $$invalidate('style', style = $$props.style);
if ('groupPosition' in $$props) $$invalidate('groupPosition', groupPosition = $$props.groupPosition);
if ('grouped' in $$props) $$invalidate('grouped', grouped = $$props.grouped);
if ('borderClass' in $$props) $$invalidate('borderClass', borderClass = $$props.borderClass);
};
let borderClass;
$$self.$$.update = ($$dirty = { grouped: 1 }) => {
if ($$dirty.grouped) { $$invalidate('borderClass', borderClass = grouped
? ""
: "border-normal"); }
};
return {
color,
className,
style,
groupPosition,
grouped,
borderClass,
click_handler,
$$slots,
$$scope
};
}
class Button extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, ["color", "className", "style", "groupPosition", "grouped"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Button", options, id: create_fragment.name });
}
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 className() {
throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set className(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 groupPosition() {
throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set groupPosition(value) {
throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get grouped() {
throw new Error("<Button>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set grouped(value) {
throw new Error("<Button>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lodash_min = createCommonjsModule(function (module, exports) {
(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n);}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&false!==t(n[r],r,n););return n}function e(n,t){for(var r=null==n?0:n.length;r--&&false!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return false;
return true}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o);}return i}function o(n,t){return !(null==n||!n.length)&&-1<v(n,t,0)}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return true;return false}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return true;return false}function p(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,false}),e}function _(n,t,r,e){var u=n.length;for(r+=e?1:-1;e?r--:++r<u;)if(t(n[r],r,n))return r;return -1}function v(n,t,r){if(t===t)n:{--r;for(var e=n.length;++r<e;)if(n[r]===t){n=r;break n}n=-1;}else n=_(n,d,r);return n}function g(n,t,r,e){
--r;for(var u=n.length;++r<u;)if(e(n[r],t))return r;return -1}function d(n){return n!==n}function y(n,t){var r=null==n?0:n.length;return r?m(n,t)/r:F}function b(n){return function(t){return null==t?T:t[n]}}function x(n){return function(t){return null==n?T:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=false,n):t(r,n,u,i);}),r}function w(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function m(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==T&&(r=r===T?i:r+i);}return r;
}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function E(n,t){return c(t,function(t){return [t,n[t]]})}function k(n){return function(t){return n(t)}}function S(n,t){return c(t,function(t){return n[t]})}function O(n,t){return n.has(t)}function I(n,t){for(var r=-1,e=n.length;++r<e&&-1<v(t,n[r],0););return r}function R(n,t){for(var r=n.length;r--&&-1<v(t,n[r],0););return r}function z(n){return "\\"+Un[n]}function W(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n];
}),r}function B(n,t){return function(r){return n(t(r))}}function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r);}return i}function U(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n;}),r}function C(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n];}),r}function D(n){if(Rn.test(n)){for(var t=On.lastIndex=0;On.test(n);)++t;n=t;}else n=Qn(n);return n}function M(n){return Rn.test(n)?n.match(On)||[]:n.split("");
}var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={};
Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false;
var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true,
Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=exports&&!exports.nodeType&&exports,Nn=Fn&&'object'=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){
try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I",
"\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C",
"\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i",
"\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r",
"\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij",
"\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),tt=x({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T;}function Un(n){this.__wrapped__=n,
this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[];}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1]);}}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1]);}}function Fn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1]);}}function Nn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new Fn;++t<r;)this.add(n[t]);
}function Zn(n){this.size=(this.__data__=new Tn(n)).size;}function qn(n,t){var r,e=ff(n),u=!e&&of(n),i=!e&&!u&&af(n),o=!e&&!u&&!i&&_f(n),u=(e=e||u||i||o)?A(n.length,ni):[],f=u.length;for(r in n)!t&&!oi.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return De(Ur(n),pt(t,0,n.length))}function ut(n){return De(Ur(n))}function it(n,t,r){(r===T||lu(n[t],r))&&(r!==T||t in n)||st(n,t,r);
}function ot(n,t,r){var e=n[t];oi.call(n,t)&&lu(e,r)&&(r!==T||t in n)||st(n,t,r);}function ft(n,t){for(var r=n.length;r--;)if(lu(n[r][0],t))return r;return -1}function ct(n,t,r,e){return uo(n,function(n,u,i){t(e,n,r(n),i);}),e}function at(n,t){return n&&Cr(t,Wu(t),n)}function lt(n,t){return n&&Cr(t,Bu(t),n)}function st(n,t,r){"__proto__"==t&&Ai?Ai(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r;}function ht(n,t){for(var r=-1,e=t.length,u=Ku(e),i=null==n;++r<e;)u[r]=i?T:Ru(n,t[r]);return u;
}function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c);}}if(o||(o=new Zn),
i=o.get(n))return i;o.set(n,f),pf(n)?n.forEach(function(r){f.add(_t(r,t,e,r,n,o));}):sf(n)&&n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o));});var a=l?a?ve:_e:a?Bu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o));}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return !e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function");
return bo(function(){n.apply(T,r);},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p),p=e||0!==p?p:0;if(a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p);}else i(t,_,e)||s.push(p);}return s}function bt(n,t){var r=true;return uo(n,function(n,e,u){return r=!!t(n,e,u)}),r}function xt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===T?o===o&&!wu(o):r(o,f)))var f=o,c=i;
}return c}function jt(n,t){var r=[];return uo(n,function(n,e,u){t(n,e,u)&&r.push(n);}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=ke),u||(u=[]);++i<o;){var f=n[i];0<t&&r(f)?1<t?wt(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f);}return u}function mt(n,t){return n&&oo(n,t,Wu)}function At(n,t){return n&&fo(n,t,Wu)}function Et(n,t){return i(t,function(t){return _u(n[t])})}function kt(n,t){t=Sr(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[Me(t[r++])];return r&&r==e?n:T}function St(n,t,r){return t=t(n),
ff(n)?t:a(t,r(n))}function Ot(n){if(null==n)n=n===T?"[object Undefined]":"[object Null]";else if(mi&&mi in Qu(n)){var t=oi.call(n,mi),r=n[mi];try{n[mi]=T;var e=true;}catch(n){}var u=ai.call(n);e&&(t?n[mi]=r:delete n[mi]),n=u;}else n=ai.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ci(p.length,s),
l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T;}var p=n[0],_=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],d=t?t(g):g,g=r||0!==g?g:0;if(v?!O(v,d):!e(h,d,r)){for(a=i;--a;){var y=l[a];if(y?!O(y,d):!e(n[a],d,r))continue n}v&&v.push(d),h.push(g);}}return h}function Bt(n,t,r){var e={};return mt(n,function(n,u,i){t(e,r(n),u,i);}),e}function Lt(t,r,e){return r=Sr(r,t),t=2>r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Ut(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){
return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!yu(n)&&!yu(t))t=n!==n&&t!==t;else n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false;}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{
if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a<o;){var l=f[a],h=n[l],p=t[l];if(e)var _=i?e(p,h,l,t,n,u):e(h,p,l,n,t,u);if(_===T?h!==p&&!Mt(h,p,r,e,u):!_){c=false;break}s||(s="constructor"==l);
}c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c;}}else t=false;else t=false;}}return t}function Tt(n){return yu(n)&&"[object Map]"==vo(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return !i;for(n=Qu(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<i;){var f=r[u],c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===T&&!(c in n))return false;
}else{if(f=new Zn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return !(!du(n)||ci&&ci in n)&&(_u(n)?hi:dn).test(Te(n))}function Nt(n){return yu(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return yu(n)&&"[object Set]"==vo(n)}function Zt(n){return yu(n)&&gu(n.length)&&!!Bn[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?$u:typeof n=="object"?ff(n)?Jt(n[0],n[1]):Ht(n):Zu(n)}function Vt(n){if(!ze(n))return Li(n);var t,r=[];for(t in Qu(n))oi.call(n,t)&&"constructor"!=t&&r.push(t);
return r}function Kt(n,t){return n<t}function Gt(n,t){var r=-1,e=su(n)?Ku(n.length):[];return uo(n,function(n,u,i){e[++r]=t(n,u,i);}),e}function Ht(n){var t=xe(n);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===n||$t(r,n,t)}}function Jt(n,t){return Ie(n)&&t===t&&!du(t)?We(Me(n),t):function(r){var e=Ru(r,n);return e===T&&e===t?zu(r,n):Mt(t,e,3)}}function Yt(n,t,r,e,u){n!==t&&oo(t,function(i,o){if(u||(u=new Zn),du(i)){var f=u,c=Le(n,o),a=Le(t,o),l=f.get(a);if(l)it(n,o,l);else{
var l=e?e(c,a,o+"",n,t,f):T,s=l===T;if(s){var h=ff(a),p=!h&&af(a),_=!h&&!p&&_f(a),l=a;h||p||_?ff(c)?l=c:hu(c)?l=Ur(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:xu(a)||of(a)?(l=c,of(c)?l=Ou(c):du(c)&&!_u(c)||(l=Ae(a))):s=false;}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a)),it(n,o,l);}}else f=e?e(Le(n,o),i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f);},Bu);}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],k(ye())),n=Gt(n,function(n){return {
a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e<o;){var c=Wr(u[e],i[e]);if(c){e=e>=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b;}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=kt(n,o);r(f,o)&&lr(i,Sr(o,n),f);}return i}function rr(n){return function(t){return kt(t,n)}}function er(n,t,r,e){var u=e?g:v,i=-1,o=t.length,f=n;for(n===t&&(t=Ur(t)),
r&&(f=c(n,k(r)));++i<o;)for(var a=0,l=t[i],l=r?r(l):l;-1<(a=u(f,l,a,e));)f!==n&&xi.call(f,a,1),xi.call(n,a,1);return n}function ur(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Se(u)?xi.call(n,u,1):xr(n,u);}}}function ir(n,t){return n+Ii(Ti()*(t-n+1))}function or(n,t){var r="";if(!n||1>t||9007199254740991<t)return r;do t%2&&(r+=n),(t=Ii(t/2))&&(n+=n);while(t);return r}function fr(n,t){return xo(Be(n,t,$u),n+"")}function cr(n){return Qn(Uu(n))}function ar(n,t){var r=Uu(n);
return De(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!du(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=Me(t[u]),a=r;if(u!=o){var l=f[c],a=e?e(l,c,f):T;a===T&&(a=du(l)?l:Se(t[u+1])?[]:{});}ot(f,c,a),f=f[c];}return n}function sr(n){return De(Uu(n))}function hr(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e<u;)r[e]=n[e+t];return r}function pr(n,t){var r;return uo(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}
function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:o<t)?e=i+1:u=i;}return u}return vr(n,t,$u,r)}function vr(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!==t,f=null===t,c=wu(t),a=t===T;u<i;){var l=Ii((u+i)/2),s=r(n[l]),h=s!==T,p=null===s,_=s===s,v=wu(s);(o?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?s<=t:s<t)?u=l+1:i=l;}return Ci(i,4294967294)}function gr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
var o=n[r],f=t?t(o):o;if(!r||!lu(f,c)){var c=f;i[u++]=0===o?0:o;}}return i}function dr(n){return typeof n=="number"?n:wu(n)?F:+n}function yr(n){if(typeof n=="string")return n;if(ff(n))return c(n,yr)+"";if(wu(n))return ro?ro.call(n):"";var t=n+"";return "0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:so(n))return U(u);c=false,u=O,l=new Nn;}else l=t?[]:a;n:for(;++e<i;){var s=n[e],h=t?t(s):s,s=r||0!==s?s:0;if(c&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n;
t&&l.push(h),a.push(s);}else u(l,h,r)||(l!==a&&l.push(h),a.push(s));}return a}function xr(n,t){return t=Sr(t,n),n=2>t.length?n:kt(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?hr(n,e?0:i,e?i+1:u):hr(n,e?i+1:0,e?u:i)}function wr(n,t){var r=n;return r instanceof Un&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mr(n,t,r){var e=n.length;if(2>e)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=yt(i[u]||o,n[f],t,r));
return br(wt(i,1),t,r)}function Ar(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:T);return o}function Er(n){return hu(n)?n:[]}function kr(n){return typeof n=="function"?n:$u}function Sr(n,t){return ff(n)?n:Ie(n,t)?[n]:jo(Iu(n))}function Or(n,t,r){var e=n.length;return r=r===T?e:r,!t&&r>=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),
t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return -1}return 0}function Br(n,t,r,e){var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Ui(i-o,0),l=Ku(c+a);for(e=!e;++f<c;)l[f]=t[f];for(;++u<o;)(e||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];
return l}function Lr(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Ui(i-f,0),s=Ku(l+a);for(e=!e;++u<l;)s[u]=n[u];for(l=u;++c<a;)s[l+c]=t[c];for(;++o<f;)(e||u<i)&&(s[l+r[o]]=n[u++]);return s}function Ur(n,t){var r=-1,e=n.length;for(t||(t=Ku(e));++r<e;)t[r]=n[r];return t}function Cr(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):T;c===T&&(c=n[f]),u?st(r,f,c):ot(r,f,c);}return r}function Dr(n,t){return Cr(n,po(n),t)}function Mr(n,t){return Cr(n,_o(n),t);
}function Tr(n,r){return function(e,u){var i=ff(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o)}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1<u?r[u-1]:T,o=2<u?r[2]:T,i=3<n.length&&typeof i=="function"?(u--,i):T;for(o&&Oe(r[0],r[1],o)&&(i=3>u?T:i,u=1),t=Qu(t);++e<u;)(o=r[e])&&n(t,o,e,i);return t})}function Fr(n,t){return function(r,e){if(null==r)return r;if(!su(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=Qu(r);(t?i--:++i<u)&&false!==e(o[i],i,o););return r}}function Nr(n){return function(t,r,e){
var u=-1,i=Qu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break}return t}}function Pr(n,t,r){function e(){return (this&&this!==$n&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Iu(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Mu(Du(t).replace(kn,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){
case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=eo(n.prototype),t=n.apply(r,t);return du(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Ku(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:L(f,a),
o-=c.length,o<e?ue(t,r,Jr,u.placeholder,T,f,c,T,T,e-o):n(this&&this!==$n&&this instanceof u?i:t,this,f)}var i=Vr(t);return u}function Gr(n){return function(t,r,e){var u=Qu(t);if(!su(t)){var i=ye(r,3);t=Wu(t),r=function(n){return i(u[n],n,u)};}return r=n(t,r,e),-1<r?u[i?t[r]:r]:T}}function Hr(n){return pe(function(t){var r=t.length,e=r,u=On.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if(typeof i!="function")throw new ti("Expected a function");if(u&&!o&&"wrapper"==ge(i))var o=new On([],true);}for(e=o?e:r;++e<r;)var i=t[e],u=ge(i),f="wrapper"==u?ho(i):T,o=f&&Re(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ge(f[0])].apply(o,f[3]):1==i.length&&Re(i)?o[u]():o.thru(i);
return function(){var n=arguments,e=n[0];if(o&&1==n.length&&ff(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function Jr(n,t,r,e,u,i,o,f,c,a){function l(){for(var d=arguments.length,y=Ku(d),b=d;b--;)y[b]=arguments[b];if(_){var x,j=de(l),b=y.length;for(x=0;b--;)y[b]===j&&++x;}if(e&&(y=Br(y,e,u,_)),i&&(y=Lr(y,i,o,_)),d-=x,_&&d<a)return j=L(y,j),ue(n,t,Jr,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[n]:n,d=y.length,f){x=y.length;for(var w=Ci(f.length,x),m=Ur(y);w--;){
var A=f[w];y[w]=Se(A,x)?m[A]:T;}}else v&&1<d&&y.reverse();return s&&c<d&&(y.length=c),this&&this!==$n&&this instanceof l&&(b=g||Vr(b)),b.apply(j,y)}var s=128&t,h=1&t,p=2&t,_=24&t,v=512&t,g=p?T:Vr(n);return l}function Yr(n,t){return function(r,e){return Bt(r,n,t(e))}}function Qr(n,t){return function(r,e){var u;if(r===T&&e===T)return t;if(r!==T&&(u=r),e!==T){if(u===T)return e;typeof r=="string"||typeof e=="string"?(r=yr(r),e=yr(e)):(r=dr(r),e=dr(e)),u=n(r,e);}return u}}function Xr(t){return pe(function(r){
return r=c(r,k(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];return n(h,o?e:this,s)}var o=1&r,f=Vr(t);return i}function re(n){return function(t,r,e){
e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=Au(t),r===T?(r=t,t=0):r=Au(r),e=e===T?t<r?1:-1:Au(e);var u=-1;r=Ui(Oi((r-t)/(e||1)),0);for(var i=Ku(r);r--;)i[n?r:++u]=t,t+=e;return i}}function ee(n){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=Su(t),r=Su(r)),n(t,r)}}function ue(n,t,r,e,u,i,o,f,c,a){var l=8&t,s=l?o:T;o=l?T:o;var h=l?i:T;return i=l?T:i,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),u=[n,t,u,h,s,i,o,f,c,a],r=r.apply(T,u),Re(n)&&yo(r,u),r.placeholder=e,Ue(r,n,t)}function ie(n){
var t=Yu[n];return function(n,r){if(n=Su(n),(r=null==r?0:Ci(Eu(r),292))&&Wi(n)){var e=(Iu(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Iu(e)+"e").split("e");return +(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=vo(t);return "[object Map]"==r?W(t):"[object Set]"==r?C(t):E(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ti("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Ui(Eu(o),0),f=f===T?f:Eu(f),a-=u?u.length:0,
64&t){var l=e,s=u;e=u=T;}var h=c?T:ho(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],
t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Ui(i[9]-a,0),!f&&24&t&&(t&=-25),Ue((h?co:yo)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;
var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++c<f;){var s=n[c],p=t[c];if(e)var _=o?e(p,s,c,t,n,i):e(s,p,c,n,t,i);if(_!==T){if(_)continue;a=false;break}if(l){if(!h(t,function(n,t){if(!O(l,t)&&(s===n||u(s,n,r,e,i)))return l.push(t)})){a=false;break}}else if(s!==p&&!u(s,p,r,e,i)){a=false;break}}return i.delete(n),i.delete(t),a}function he(n,t,r,e,u,i,o){switch(r){case"[object DataView]":if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)break;n=n.buffer,t=t.buffer;case"[object ArrayBuffer]":
if(n.byteLength!=t.byteLength||!i(new vi(n),new vi(t)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return lu(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=U),n.size!=t.size&&!(1&e))break;return (r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(to)return to.call(n)==to.call(t)}
return false}function pe(n){return xo(Be(n,T,Ze),n+"")}function _e(n){return St(n,Wu,po)}function ve(n){return St(n,Bu,_o)}function ge(n){for(var t=n.name+"",r=Gi[t],e=oi.call(Gi,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return (oi.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||Fu,n=n===Fu?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return ("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map;
}function xe(n){for(var t=Wu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!du(u)];}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e<u;){var o=Me(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o];}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&gu(u)&&Se(o,u)&&(ff(n)||of(n)))}function me(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&oi.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ae(n){
return typeof n.constructor!="function"||ze(n)?{}:eo(di(n))}function Ee(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":
case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return to?Qu(to.call(n)):{}}}function ke(n){return ff(n)||of(n)||!!(ji&&n&&n[ji])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1<n&&0==n%1&&n<t;
}function Oe(n,t,r){if(!du(r))return false;var e=typeof t;return !!("number"==e?su(r)&&Se(t,r.length):"string"==e&&t in r)&&lu(r[t],n)}function Ie(n,t){if(ff(n))return false;var r=typeof n;return !("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!wu(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Qu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Un.prototype&&(n===r||(t=ho(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ei)}function We(n,t){
return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Qu(r)))}}function Be(t,r,e){return r=Ui(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Ui(u.length-r,0),f=Ku(o);++i<o;)f[i]=u[r+i];for(i=-1,o=Ku(r+1);++i<r;)o[i]=u[i];return o[r]=e(f),n(t,this,o)}}function Le(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Ue(n,t,r){var e=t+"";t=xo;var u,i=$e;return u=(u=e.match(an))?u[1].split(ln):[],r=i(u,r),(i=r.length)&&(u=i-1,r[u]=(1<i?"& ":"")+r[u],
r=r.join(2<i?", ":" "),e=e.replace(cn,"{\n/* [wrapped with "+r+"] */\n")),t(n,e)}function Ce(n){var t=0,r=0;return function(){var e=Di(),u=16-(e-r);if(r=e,0<u){if(800<=++t)return arguments[0]}else t=0;return n.apply(T,arguments)}}function De(n,t){var r=-1,e=n.length,u=e-1;for(t=t===T?e:t;++r<t;){var e=ir(r,u),i=n[e];n[e]=n[r],n[r]=i;}return n.length=t,n}function Me(n){if(typeof n=="string"||wu(n))return n;var t=n+"";return "0"==t&&1/n==-$?"-0":t}function Te(n){if(null!=n){try{return ii.call(n)}catch(n){}
return n+""}return ""}function $e(n,t){return r(N,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e);}),n.sort()}function Fe(n){if(n instanceof Un)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ne(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return -1;var u=e-1;return r!==T&&(u=Eu(r),u=0>r?Ui(e+u,0):Ci(u,e-1)),
_(n,ye(t,3),u,true)}function Ze(n){return (null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return [];var t=0;return n=i(n,function(n){if(hu(n))return t=Ui(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return [];var e=He(t);return null==r?e:c(e,function(t){
return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return (ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return (ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return (ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),
r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r);}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,
a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return lo(h),h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ui(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T;},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;
return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return !n.call(this);case 1:return !n.call(this,t[0]);case 2:return !n.call(this,t[0],t[1]);case 3:return !n.call(this,t[0],t[1],t[2])}return !n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t;
}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return "[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return !!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==Eu(n)}function gu(n){return typeof n=="number"&&-1<n&&0==n%1&&9007199254740991>=n;
}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return !(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n);
}function mu(n){if(!n)return [];if(su(n))return ju(n)?M(n):Ur(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?U:Uu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Eu(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Eu(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,
n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Bu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Bu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e;}else{if(t=[],
null!=n)for(r in Qu(n))t.push(r);n=t;}return n}function Lu(n,t){if(null==n)return {};var r=c(ve(n),function(n){return [n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Uu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return (n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n;
}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=Et(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return (r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))});}),n}function Pu(){}
function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return []}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.g:T,di=B(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){
try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),Ei=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,ki=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Bi=ri.join,Li=B(Qu.keys,Qu),Ui=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){
function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=eo(En.prototype),On.prototype.constructor=On,Un.prototype=eo(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0;},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],
this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0;},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1),
--this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return -1<ft(this.__data__,n)},Tn.prototype.set=function(n,t){var r=this.__data__,e=ft(r,n);return 0>e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn};},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n);
},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0;},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){
return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e);}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=Ei||function(n){
return $n.clearTimeout(n)},so=Zi&&1/U(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){
var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return "[object DataView]";case Ji:return "[object Map]";case Yi:return "[object Promise]";case Qi:return "[object Set]";case Xi:return "[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){
t.push(e?u.replace(hn,"$1"):r||n);}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),Eo=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=Ve(n),r=c(n,Er);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,Er);return (t=typeof t=="function"?t:T)&&r.pop(),
r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Bo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Lo=fr(function(n){return mr(i(n,hu))}),Uo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),
mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1<t?n[t-1]:T,t=typeof t=="function"?(n.pop(),t):T;return Je(n,t)}),To=pe(function(n){function t(t){return ht(t,n)}var r=n.length,e=r?n[0]:0,u=this.__wrapped__;return !(1<r||this.__actions__.length)&&u instanceof Un&&Se(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(u,this.__chain__).thru(function(n){return r&&!n.length&&n.push(T),
n})):this.thru(t)}),$o=Tr(function(n,t,r){oi.call(n,r)?++n[r]:st(n,r,1);}),Fo=Gr(Ne),No=Gr(Pe),Po=Tr(function(n,t,r){oi.call(n,r)?n[r].push(t):st(n,r,[t]);}),Zo=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=su(t)?Ku(t.length):[];return uo(t,function(t){o[++u]=i?n(r,t,e):Lt(t,r,e);}),o}),qo=Tr(function(n,t,r){st(n,r,t);}),Vo=Tr(function(n,t,r){n[r?0:1].push(t);},function(){return [[],[]]}),Ko=fr(function(n,t){if(null==n)return [];var r=t.length;return 1<r&&Oe(n,t[0],t[1])?t=[]:2<r&&Oe(t[0],t[1],t[2])&&(t=[t[0]]),
Xt(n,wt(t,1),[])}),Go=ki||function(){return $n.Date.now()},Ho=fr(function(n,t,r){var e=1;if(r.length)var u=L(r,de(Ho)),e=32|e;return fe(n,e,t,r,u)}),Jo=fr(function(n,t,r){var e=3;if(r.length)var u=L(r,de(Jo)),e=32|e;return fe(t,e,n,r,u)}),Yo=fr(function(n,t){return dt(n,1,t)}),Qo=fr(function(n,t,r){return dt(n,Su(t)||0,r)});cu.Cache=Fn;var Xo=fr(function(t,r){r=1==r.length&&ff(r[0])?c(r[0],k(ye())):c(wt(r,1),k(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ci(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);
return n(t,this,u)})}),nf=fr(function(n,t){return fe(n,32,T,t,L(t,de(nf)))}),tf=fr(function(n,t){return fe(n,64,T,t,L(t,de(tf)))}),rf=pe(function(n,t){return fe(n,256,T,T,T,t)}),ef=ee(It),uf=ee(function(n,t){return n>=t}),of=Ut(function(){return arguments}())?Ut:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?k(Vn):Ct,af=zi||Vu,lf=Kn?k(Kn):Dt,sf=Gn?k(Gn):Tt,hf=Hn?k(Hn):Nt,pf=Jn?k(Jn):Pt,_f=Yn?k(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){
if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r]);}),yf=$r(function(n,t){Cr(t,Bu(t),n);}),bf=$r(function(n,t,r,e){Cr(t,Bu(t),n,e);}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e);}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2<e?t[2]:T;for(u&&Oe(t[0],t[1],u)&&(e=1);++r<e;)for(var u=t[r],i=Bu(u),o=-1,f=i.length;++o<f;){var c=i[o],a=n[c];(a===T||lu(a,ei[c])&&!oi.call(n,c))&&(n[c]=u[c]);}return n}),mf=fr(function(t){return t.push(T,ae),n(Of,T,t)}),Af=Yr(function(n,t,r){
null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),n[t]=r;},Tu($u)),Ef=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),oi.call(n,t)?n[t].push(r):n[t]=[r];},ye),kf=fr(Lt),Sf=$r(function(n,t,r){Yt(n,t,r);}),Of=$r(function(n,t,r,e){Yt(n,t,r,e);}),If=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1<t.length),t}),Cr(n,ve(n),r),e&&(r=_t(r,7,le));for(var u=t.length;u--;)xr(r,t[u]);return r}),Rf=pe(function(n,t){return null==n?{}:nr(n,t);
}),zf=oe(Wu),Wf=oe(Bu),Bf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Cu(t):t)}),Lf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Uf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Cf=Zr("toLowerCase"),Df=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Mf=qr(function(n,t,r){return n+(r?" ":"")+$f(t)}),Tf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),$f=Zr("toUpperCase"),Ff=fr(function(t,r){try{return n(t,T,r)}catch(n){return pu(n)?n:new Hu(n)}}),Nf=pe(function(n,t){
return r(t,function(t){t=Me(t),st(n,t,Ho(n[t],n));}),n}),Pf=Hr(),Zf=Hr(true),qf=fr(function(n,t){return function(r){return Lt(r,n,t)}}),Vf=fr(function(n,t){return function(r){return Lt(n,r,t)}}),Kf=Xr(c),Gf=Xr(u),Hf=Xr(h),Jf=re(),Yf=re(true),Qf=Qr(function(n,t){return n+t},0),Xf=ie("ceil"),nc=Qr(function(n,t){return n/t},1),tc=ie("floor"),rc=Qr(function(n,t){return n*t},1),ec=ie("round"),uc=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ti("Expected a function");
return n=Eu(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return [];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Ui(Eu(t),0),r=null==n?0:n.length,!r||1>t)return [];for(var e=0,u=0,i=Ku(Oi(r/t));e<r;)i[u++]=hr(n,e,e+=t);return i},An.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){
var i=n[t];i&&(u[e++]=i);}return u},An.concat=function(){var n=arguments.length;if(!n)return [];for(var t=Ku(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(ff(r)?Ur(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ti("Expected a function");return [e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})},An.conforms=function(n){return vt(_t(n,1))},An.constant=Tu,
An.countBy=$o,An.create=function(n,t){var r=eo(n);return null==t?r:at(r,t)},An.curry=iu,An.curryRight=ou,An.debounce=fu,An.defaults=wf,An.defaultsDeep=mf,An.defer=Yo,An.delay=Qo,An.difference=wo,An.differenceBy=mo,An.differenceWith=Ao,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[];
},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return [];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Eu(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Eu(e),0>e&&(e+=u),e=r>e?0:ku(e);r<e;)n[r++]=t;return n},An.filter=function(n,t){return (ff(n)?i:jt)(n,ye(t,3))},An.flatMap=function(n,t){return wt(ru(n,t),1)},An.flatMapDeep=function(n,t){return wt(ru(n,t),$)},An.flatMapDepth=function(n,t,r){return r=r===T?1:Eu(r),
wt(ru(n,t),r)},An.flatten=Ze,An.flattenDeep=function(n){return (null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:Eu(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Pf,An.flowRight=Zf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1];}return e},An.functions=function(n){return null==n?[]:Et(n,Wu(n))},An.functionsIn=function(n){return null==n?[]:Et(n,Bu(n))},An.groupBy=Po,An.initial=function(n){
return (null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=Eo,An.intersectionBy=ko,An.intersectionWith=So,An.invert=Af,An.invertBy=Ef,An.invokeMap=Zo,An.iteratee=Fu,An.keyBy=qo,An.keys=Wu,An.keysIn=Bu,An.map=ru,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n);}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u));}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=cu,
An.merge=Sf,An.mergeWith=Of,An.method=qf,An.methodOf=Vf,An.mixin=Nu,An.negate=au,An.nthArg=function(n){return n=Eu(n),fr(function(t){return Qt(t,n)})},An.omit=If,An.omitBy=function(n,t){return Lu(n,au(ye(t)))},An.once=function(n){return uu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(ff(t)||(t=null==t?[]:[t]),r=e?T:r,ff(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Kf,An.overArgs=Xo,An.overEvery=Gf,An.overSome=Hf,An.partial=nf,An.partialRight=tf,An.partition=Vo,An.pick=Rf,An.pickBy=Lu,An.property=Zu,
An.propertyOf=function(n){return function(t){return null==n?T:kt(n,t)}},An.pull=Oo,An.pullAll=Ke,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Io,An.range=Jf,An.rangeRight=Yf,An.rearg=rf,An.reject=function(n,t){return (ff(n)?i:jt)(n,au(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),
u.push(e));}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ti("Expected a function");return t=t===T?t:Eu(t),fr(n,t)},An.reverse=Ge,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),(ff(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return (ff(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0,
r=e):(t=null==t?0:Eu(t),r=r===T?e:Eu(r)),hr(n,t,r)):[]},An.sortBy=Ko,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Ui(Eu(r),0),
fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Eu(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),
n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Ur(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{};
}return (i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){
return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Uu,An.valuesIn=function(n){return null==n?[]:S(n,Bu(n))},An.without=Bo,An.words=Mu,An.wrap=function(n,t){return nf(kr(t),n)},An.xor=Lo,An.xorBy=Uo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Bf,An.capitalize=Cu,
An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){
n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Eu(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return (n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return (n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At);
},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Bu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Bu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Uu(n),r=r&&!e?Eu(r):0,e=n.length,0>r&&(r=Ui(e+r,0)),ju(n)?r<=e&&-1<n.indexOf(t,r):!!e&&-1<v(n,t,r);
},An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n<Ui(t,r)},An.invoke=kf,An.isArguments=of,An.isArray=ff,An.isArrayBuffer=cf,An.isArrayLike=su,An.isArrayLikeObject=hu,An.isBoolean=function(n){return true===n||false===n||yu(n)&&"[object Boolean]"==Ot(n)},An.isBuffer=af,An.isDate=lf,An.isElement=function(n){return yu(n)&&1===n.nodeType&&!xu(n)},An.isEmpty=function(n){
if(null==n)return true;if(su(n)&&(ff(n)||typeof n=="string"||typeof n.splice=="function"||af(n)||_f(n)||of(n)))return !n.length;var t=vo(n);if("[object Map]"==t||"[object Set]"==t)return !n.size;if(ze(n))return !Vt(n).length;for(var r in n)if(oi.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=pu,An.isFinite=function(n){return typeof n=="number"&&Wi(n)},An.isFunction=_u,
An.isInteger=vu,An.isLength=gu,An.isMap=sf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return bu(n)&&n!=+n},An.isNative=function(n){if(go(n))throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=bu,An.isObject=du,An.isObjectLike=yu,An.isPlainObject=xu,An.isRegExp=hf,
An.isSafeInteger=function(n){return vu(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Bi.call(n,t)},An.kebabCase=Lf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return -1;var u=e;if(r!==T&&(u=Eu(r),u=0>u?Ui(e+u,0):Ci(u,e-1)),
t===t){for(r=u+1;r--&&n[r]!==t;);n=r;}else n=_(n,d,u,true);return n},An.lowerCase=Uf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return {}},An.stubString=function(){
return ""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,Eu(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return !t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?n+ne(t-e,r):n},An.padStart=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e<t?ne(t-e,r)+n:n},An.parseInt=function(n,t,r){
return r||null==t?t=0:t&&(t=+t),Mi(Iu(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=Au(n),t===T?(t=n,n=0):t=Au(t)),n>t){var e=n;n=t,t=e;}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length;
return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e<u;){var i=null==n?T:n[Me(t[e])];i===T&&(e=u,i=r),n=_u(i)?i.call(n):i;}return n},An.round=ec,An.runInContext=x,An.sample=function(n){return (ff(n)?Qn:cr)(n)},An.size=function(n){if(null==n)return 0;if(su(n))return ju(n)?D(n):n.length;
var t=vo(n);return "[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Df,An.some=function(n,t,r){var e=ff(n)?h:pr;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e<r&&lu(n[e],t))return e}return -1},An.sortedLastIndex=function(n,t){return _r(n,t,true)},An.sortedLastIndexBy=function(n,t,r){return vr(n,t,ye(r,2),true);
},An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(lu(n[r],t))return r}return -1},An.startCase=Mf,An.startsWith=function(n,t,r){return n=Iu(n),r=null==r?0:pt(Eu(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=uc,An.sum=function(n){return n&&n.length?m(n,$u):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Iu(n),t=bf({},t,e,ce),r=bf({},t.imports,e.imports,ce);var u,i,o=Wu(r),f=S(r,o),c=0;
r=t.interpolate||jn;var a="__p+='";r=Xu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l=oi.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=oi.call(t,"variable")&&t.variable)||(a="with(obj){"+a+"}"),
a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=Ff(function(){return Ju(o,l+"return "+a).apply(T,f)}),t.source=a,pu(t))throw t;return t},An.times=function(n,t){if(n=Eu(n),1>n||9007199254740991<n)return [];var r=4294967295,e=Ci(n,4294967295);for(t=ye(t),n-=4294967295,e=A(e,t);++r<n;)t(r);return e},An.toFinite=Au,
An.toInteger=Eu,An.toLength=ku,An.toLower=function(n){return Iu(n).toLowerCase()},An.toNumber=Su,An.toSafeInteger=function(n){return n?pt(Eu(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Iu,An.toUpper=function(n){return Iu(n).toUpperCase()},An.trim=function(n,t,r){return (n=Iu(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return (n=Iu(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1,
Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){return (n=Iu(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(du(t))var u="separator"in t?t.separator:u,r="length"in t?Eu(t.length):r,e="omission"in t?yr(t.omission):e;n=Iu(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){
var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c);}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1<u&&(r=r.slice(0,u)));return r+e},An.unescape=function(n){return (n=Iu(n))&&G.test(n)?n.replace(V,tt):n},An.uniqueId=function(n){var t=++fi;return Iu(n)+t},An.upperCase=Tf,An.upperFirst=$f,An.each=nu,An.eachRight=tu,An.first=qe,Nu(An,function(){var n={};return mt(An,function(t,r){oi.call(An.prototype,r)||(n[r]=t);}),n}(),{chain:false
}),An.VERSION="4.17.15",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){An[n].placeholder=An;}),r(["drop","take"],function(n,t){Un.prototype[n]=function(r){r=r===T?1:Ui(Eu(r),0);var e=this.__filtered__&&!t?new Un(this):this.clone();return e.__filtered__?e.__takeCount__=Ci(r,e.__takeCount__):e.__views__.push({size:Ci(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()};}),r(["filter","map","takeWhile"],function(n,t){
var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t};}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]};}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)};}),Un.prototype.compact=function(){return this.filter($u)},Un.prototype.find=function(n){
return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n)},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(au(ye(n)))},Un.prototype.slice=function(n,t){n=Eu(n);var r=this;return r.__filtered__&&(0<n||0>t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Eu(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){
return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295)},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||ff(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;
return !i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)});}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)});
};}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";oi.call(Gi,e)||(Gi[e]=[]),Gi[e].push({name:t,func:r});}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);
n.__dir__=-1,n.__filtered__=true;}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s);}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__);
e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0, h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i;}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return {done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){
for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__;}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,
wi&&(An.prototype[wi]=Xe),An}();Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt;}).call(commonjsGlobal);
});
var _mapping = createCommonjsModule(function (module, exports) {
/** Used to map aliases to their real names. */
exports.aliasToReal = {
// Lodash aliases.
'each': 'forEach',
'eachRight': 'forEachRight',
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
'extendAll': 'assignInAll',
'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
// Methods that are curried variants of others.
'conforms': 'conformsTo',
'matches': 'isMatch',
'property': 'get',
// Ramda aliases.
'__': 'placeholder',
'F': 'stubFalse',
'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
'any': 'some',
'anyPass': 'overSome',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'complement': 'negate',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'dropLast': 'dropRight',
'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'paths': 'at',
'pickAll': 'pick',
'pipe': 'flow',
'pluck': 'map',
'prop': 'get',
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
'symmetricDifference': 'xor',
'symmetricDifferenceBy': 'xorBy',
'symmetricDifferenceWith': 'xorWith',
'takeLast': 'takeRight',
'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'where': 'conformsTo',
'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
'uniqueId', 'words', 'zipAll'
],
'2': [
'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight',
'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars',
'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith',
'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
'zipObjectDeep'
],
'3': [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
'xorWith', 'zipWith'
],
'4': [
'fill', 'setWith', 'updateWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
'2': [1, 0],
'3': [2, 0, 1],
'4': [3, 2, 0, 1]
};
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findFrom': 1,
'findIndex': 1,
'findIndexFrom': 1,
'findKey': 1,
'findLast': 1,
'findLastFrom': 1,
'findLastIndex': 1,
'findLastIndexFrom': 1,
'findLastKey': 1,
'flatMap': 1,
'flatMapDeep': 1,
'flatMapDepth': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'map': 1,
'mapKeys': 1,
'mapValues': 1,
'partition': 1,
'reduce': 2,
'reduceRight': 2,
'reject': 1,
'remove': 1,
'some': 1,
'takeRightWhile': 1,
'takeWhile': 1,
'times': 1,
'transform': 2
};
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'mapKeys': [1],
'reduceRight': [1, 0]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInAllWith': [1, 0],
'assignInWith': [1, 2, 0],
'assignAllWith': [1, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
'getOr': [2, 1, 0],
'intersectionBy': [1, 2, 0],
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
'mergeAllWith': [1, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
'padCharsStart': [2, 1, 0],
'pullAllBy': [2, 1, 0],
'pullAllWith': [2, 1, 0],
'rangeStep': [1, 2, 0],
'rangeStepRight': [1, 2, 0],
'setWith': [3, 1, 2, 0],
'sortedIndexBy': [2, 1, 0],
'sortedLastIndexBy': [2, 1, 0],
'unionBy': [1, 2, 0],
'unionWith': [1, 2, 0],
'updateWith': [3, 1, 2, 0],
'xorBy': [1, 2, 0],
'xorWith': [1, 2, 0],
'zipWith': [1, 2, 0]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'assignAll': { 'start': 0 },
'assignAllWith': { 'start': 0 },
'assignInAll': { 'start': 0 },
'assignInAllWith': { 'start': 0 },
'defaultsAll': { 'start': 0 },
'defaultsDeepAll': { 'start': 0 },
'invokeArgs': { 'start': 2 },
'invokeArgsMap': { 'start': 2 },
'mergeAll': { 'start': 0 },
'mergeAllWith': { 'start': 0 },
'partial': { 'start': 1 },
'partialRight': { 'start': 1 },
'without': { 'start': 1 },
'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAllWith': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignAll': true,
'assignAllWith': true,
'assignIn': true,
'assignInAll': true,
'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsAll': true,
'defaultsDeep': true,
'defaultsDeepAll': true,
'merge': true,
'mergeAll': true,
'mergeAllWith': true,
'mergeWith': true,
},
'set': {
'set': true,
'setWith': true,
'unset': true,
'update': true,
'updateWith': true
}
};
/** Used to map real names to their aliases. */
exports.realToAlias = (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
object = exports.aliasToReal,
result = {};
for (var key in object) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
return result;
}());
/** Used to map method names to other names. */
exports.remap = {
'assignAll': 'assign',
'assignAllWith': 'assignWith',
'assignInAll': 'assignIn',
'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
'defaultsAll': 'defaults',
'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
'findLastIndexFrom': 'findLastIndex',
'getOr': 'get',
'includesFrom': 'includes',
'indexOfFrom': 'indexOf',
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
'mergeAll': 'merge',
'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
'propertyOf': 'get',
'rangeStep': 'range',
'rangeStepRight': 'rangeRight',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart',
'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
exports.skipFixed = {
'castArray': true,
'flow': true,
'flowRight': true,
'iteratee': true,
'mixin': true,
'rearg': true,
'runInContext': true
};
/** Used to track methods that skip rearranging arguments. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'bind': true,
'bindKey': true,
'concat': true,
'difference': true,
'divide': true,
'eq': true,
'gt': true,
'gte': true,
'isEqual': true,
'lt': true,
'lte': true,
'matchesProperty': true,
'merge': true,
'multiply': true,
'overArgs': true,
'partial': true,
'partialRight': true,
'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true,
'zipObjectDeep': true
};
});
var _mapping_1 = _mapping.aliasToReal;
var _mapping_2 = _mapping.aryMethod;
var _mapping_3 = _mapping.aryRearg;
var _mapping_4 = _mapping.iterateeAry;
var _mapping_5 = _mapping.iterateeRearg;
var _mapping_6 = _mapping.methodRearg;
var _mapping_7 = _mapping.methodSpread;
var _mapping_8 = _mapping.mutate;
var _mapping_9 = _mapping.realToAlias;
var _mapping_10 = _mapping.remap;
var _mapping_11 = _mapping.skipFixed;
var _mapping_12 = _mapping.skipRearg;
/**
* The default argument placeholder value for methods.
*
* @type {Object}
*/
var placeholder = {};
/** Built-in value reference. */
var push = Array.prototype.push;
/**
* Creates a function, with an arity of `n`, that invokes `func` with the
* arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} n The arity of the new function.
* @returns {Function} Returns the new function.
*/
function baseArity(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
}
/**
* Creates a function that invokes `func`, with up to `n` arguments, ignoring
* any additional arguments.
*
* @private
* @param {Function} func The function to cap arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function baseAry(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
}
/**
* Creates a clone of `array`.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the cloned array.
*/
function cloneArray(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
}
/**
* Creates a function that clones a given object using the assignment `func`.
*
* @private
* @param {Function} func The assignment function.
* @returns {Function} Returns the new cloner function.
*/
function createCloner(func) {
return function(object) {
return func({}, object);
};
}
/**
* A specialized version of `_.spread` which flattens the spread array into
* the arguments of the invoked `func`.
*
* @private
* @param {Function} func The function to spread arguments over.
* @param {number} start The start position of the spread.
* @returns {Function} Returns the new function.
*/
function flatSpread(func, start) {
return function() {
var length = arguments.length,
lastIndex = length - 1,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var array = args[start],
otherArgs = args.slice(0, start);
if (array) {
push.apply(otherArgs, array);
}
if (start != lastIndex) {
push.apply(otherArgs, args.slice(start + 1));
}
return func.apply(this, otherArgs);
};
}
/**
* Creates a function that wraps `func` and uses `cloner` to clone the first
* argument it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} cloner The function to clone arguments.
* @returns {Function} Returns the new immutable function.
*/
function wrapImmutable(func, cloner) {
return function() {
var length = arguments.length;
if (!length) {
return;
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var result = args[0] = cloner.apply(undefined, args);
func.apply(undefined, args);
return result;
};
}
/**
* The base implementation of `convert` which accepts a `util` object of methods
* required to perform conversions.
*
* @param {Object} util The util object.
* @param {string} name The name of the function to convert.
* @param {Function} func The function to convert.
* @param {Object} [options] The options object.
* @param {boolean} [options.cap=true] Specify capping iteratee arguments.
* @param {boolean} [options.curry=true] Specify currying.
* @param {boolean} [options.fixed=true] Specify fixed arity.
* @param {boolean} [options.immutable=true] Specify immutable operations.
* @param {boolean} [options.rearg=true] Specify rearranging arguments.
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func, options) {
var isLib = typeof name == 'function',
isObj = name === Object(name);
if (isObj) {
options = func;
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
options || (options = {});
var config = {
'cap': 'cap' in options ? options.cap : true,
'curry': 'curry' in options ? options.curry : true,
'fixed': 'fixed' in options ? options.fixed : true,
'immutable': 'immutable' in options ? options.immutable : true,
'rearg': 'rearg' in options ? options.rearg : true
};
var defaultHolder = isLib ? func : placeholder,
forceCurry = ('curry' in options) && options.curry,
forceFixed = ('fixed' in options) && options.fixed,
forceRearg = ('rearg' in options) && options.rearg,
pristine = isLib ? func.runInContext() : undefined;
var helpers = isLib ? func : {
'ary': util.ary,
'assign': util.assign,
'clone': util.clone,
'curry': util.curry,
'forEach': util.forEach,
'isArray': util.isArray,
'isError': util.isError,
'isFunction': util.isFunction,
'isWeakMap': util.isWeakMap,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
'toInteger': util.toInteger,
'toPath': util.toPath
};
var ary = helpers.ary,
assign = helpers.assign,
clone = helpers.clone,
curry = helpers.curry,
each = helpers.forEach,
isArray = helpers.isArray,
isError = helpers.isError,
isFunction = helpers.isFunction,
isWeakMap = helpers.isWeakMap,
keys = helpers.keys,
rearg = helpers.rearg,
toInteger = helpers.toInteger,
toPath = helpers.toPath;
var aryMethodKeys = keys(_mapping.aryMethod);
var wrappers = {
'castArray': function(castArray) {
return function() {
var value = arguments[0];
return isArray(value)
? castArray(cloneArray(value))
: castArray.apply(undefined, arguments);
};
},
'iteratee': function(iteratee) {
return function() {
var func = arguments[0],
arity = arguments[1],
result = iteratee(func, arity),
length = result.length;
if (config.cap && typeof arity == 'number') {
arity = arity > 2 ? (arity - 2) : 1;
return (length && length <= arity) ? result : baseAry(result, arity);
}
return result;
};
},
'mixin': function(mixin) {
return function(source) {
var func = this;
if (!isFunction(func)) {
return mixin(func, Object(source));
}
var pairs = [];
each(keys(source), function(key) {
if (isFunction(source[key])) {
pairs.push([key, func.prototype[key]]);
}
});
mixin(func, Object(source));
each(pairs, function(pair) {
var value = pair[1];
if (isFunction(value)) {
func.prototype[pair[0]] = value;
} else {
delete func.prototype[pair[0]];
}
});
return func;
};
},
'nthArg': function(nthArg) {
return function(n) {
var arity = n < 0 ? 1 : (toInteger(n) + 1);
return curry(nthArg(n), arity);
};
},
'rearg': function(rearg) {
return function(func, indexes) {
var arity = indexes ? indexes.length : 0;
return curry(rearg(func, indexes), arity);
};
},
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context), options);
};
}
};
/*--------------------------------------------------------------------------*/
/**
* Casts `func` to a function with an arity capped iteratee if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @returns {Function} Returns the cast function.
*/
function castCap(name, func) {
if (config.cap) {
var indexes = _mapping.iterateeRearg[name];
if (indexes) {
return iterateeRearg(func, indexes);
}
var n = !isLib && _mapping.iterateeAry[name];
if (n) {
return iterateeAry(func, n);
}
}
return func;
}
/**
* Casts `func` to a curried function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castCurry(name, func, n) {
return (forceCurry || (config.curry && n > 1))
? curry(func, n)
: func;
}
/**
* Casts `func` to a fixed arity function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity cap.
* @returns {Function} Returns the cast function.
*/
function castFixed(name, func, n) {
if (config.fixed && (forceFixed || !_mapping.skipFixed[name])) {
var data = _mapping.methodSpread[name],
start = data && data.start;
return start === undefined ? ary(func, n) : flatSpread(func, start);
}
return func;
}
/**
* Casts `func` to an rearged function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castRearg(name, func, n) {
return (config.rearg && n > 1 && (forceRearg || !_mapping.skipRearg[name]))
? rearg(func, _mapping.methodRearg[name] || _mapping.aryRearg[n])
: func;
}
/**
* Creates a clone of `object` by `path`.
*
* @private
* @param {Object} object The object to clone.
* @param {Array|string} path The path to clone by.
* @returns {Object} Returns the cloned object.
*/
function cloneByPath(object, path) {
path = toPath(path);
var index = -1,
length = path.length,
lastIndex = length - 1,
result = clone(Object(object)),
nested = result;
while (nested != null && ++index < length) {
var key = path[index],
value = nested[key];
if (value != null &&
!(isFunction(value) || isError(value) || isWeakMap(value))) {
nested[key] = clone(index == lastIndex ? value : Object(value));
}
nested = nested[key];
}
return result;
}
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last
* version with conversion `options` applied.
*
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function} Returns the converted `lodash`.
*/
function convertLib(options) {
return _.runInContext.convert(options)(undefined);
}
/**
* Create a converter function for `func` of `name`.
*
* @param {string} name The name of the function to convert.
* @param {Function} func The function to convert.
* @returns {Function} Returns the new converter function.
*/
function createConverter(name, func) {
var realName = _mapping.aliasToReal[name] || name,
methodName = _mapping.remap[realName] || realName,
oldOptions = options;
return function(options) {
var newUtil = isLib ? pristine : helpers,
newFunc = isLib ? pristine[methodName] : func,
newOptions = assign(assign({}, oldOptions), options);
return baseConvert(newUtil, realName, newFunc, newOptions);
};
}
/**
* Creates a function that wraps `func` to invoke its iteratee, with up to `n`
* arguments, ignoring any additional arguments.
*
* @private
* @param {Function} func The function to cap iteratee arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function iterateeAry(func, n) {
return overArg(func, function(func) {
return typeof func == 'function' ? baseAry(func, n) : func;
});
}
/**
* Creates a function that wraps `func` to invoke its iteratee with arguments
* arranged according to the specified `indexes` where the argument value at
* the first index is provided as the first argument, the argument value at
* the second index is provided as the second argument, and so on.
*
* @private
* @param {Function} func The function to rearrange iteratee arguments for.
* @param {number[]} indexes The arranged argument indexes.
* @returns {Function} Returns the new function.
*/
function iterateeRearg(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
}
/**
* Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function() {
var length = arguments.length;
if (!length) {
return func();
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var index = config.rearg ? 0 : (length - 1);
args[index] = transform(args[index]);
return func.apply(undefined, args);
};
}
/**
* Creates a function that wraps `func` and applys the conversions
* rules by `name`.
*
* @private
* @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap.
* @returns {Function} Returns the converted function.
*/
function wrap(name, func, placeholder) {
var result,
realName = _mapping.aliasToReal[name] || name,
wrapped = func,
wrapper = wrappers[realName];
if (wrapper) {
wrapped = wrapper(func);
}
else if (config.immutable) {
if (_mapping.mutate.array[realName]) {
wrapped = wrapImmutable(func, cloneArray);
}
else if (_mapping.mutate.object[realName]) {
wrapped = wrapImmutable(func, createCloner(func));
}
else if (_mapping.mutate.set[realName]) {
wrapped = wrapImmutable(func, cloneByPath);
}
}
each(aryMethodKeys, function(aryKey) {
each(_mapping.aryMethod[aryKey], function(otherName) {
if (realName == otherName) {
var data = _mapping.methodSpread[realName],
afterRearg = data && data.afterRearg;
result = afterRearg
? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
: castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
result = castCap(realName, result);
result = castCurry(realName, result, aryKey);
return false;
}
});
return !result;
});
result || (result = wrapped);
if (result == func) {
result = forceCurry ? curry(result, 1) : function() {
return func.apply(this, arguments);
};
}
result.convert = createConverter(realName, func);
result.placeholder = func.placeholder = placeholder;
return result;
}
/*--------------------------------------------------------------------------*/
if (!isObj) {
return wrap(name, func, defaultHolder);
}
var _ = func;
// Convert methods by ary cap.
var pairs = [];
each(aryMethodKeys, function(aryKey) {
each(_mapping.aryMethod[aryKey], function(key) {
var func = _[_mapping.remap[key] || key];
if (func) {
pairs.push([key, wrap(key, func, _)]);
}
});
});
// Convert remaining methods.
each(keys(_), function(key) {
var func = _[key];
if (typeof func == 'function') {
var length = pairs.length;
while (length--) {
if (pairs[length][0] == key) {
return;
}
}
func.convert = createConverter(key, func);
pairs.push([key, func]);
}
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
_.convert = convertLib;
_.placeholder = _;
// Assign aliases.
each(keys(_), function(key) {
each(_mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
var _baseConvert = baseConvert;
var _ = lodash_min.runInContext();
var fp = _baseConvert(_, _);
var fp_1 = fp.union;
var fp_2 = fp.reduce;
var fp_3 = fp.isUndefined;
var fp_4 = fp.cloneDeep;
var fp_5 = fp.split;
var fp_6 = fp.some;
var fp_7 = fp.map;
var fp_8 = fp.filter;
var fp_9 = fp.isEmpty;
var fp_10 = fp.countBy;
var fp_11 = fp.includes;
var fp_12 = fp.last;
var fp_13 = fp.find;
var fp_14 = fp.constant;
var fp_15 = fp.take;
var fp_16 = fp.first;
var fp_17 = fp.intersection;
var fp_18 = fp.mapValues;
var fp_19 = fp.isNull;
var fp_20 = fp.has;
var fp_21 = fp.isInteger;
var fp_22 = fp.isNumber;
var fp_23 = fp.isString;
var fp_24 = fp.isBoolean;
var fp_25 = fp.isDate;
var fp_26 = fp.isArray;
var fp_27 = fp.isObject;
var fp_28 = fp.clone;
var fp_29 = fp.values;
var fp_30 = fp.keyBy;
var fp_31 = fp.isNaN;
var fp_32 = fp.keys;
var fp_33 = fp.orderBy;
var fp_34 = fp.concat;
var fp_35 = fp.reverse;
var fp_36 = fp.difference;
var fp_37 = fp.merge;
var fp_38 = fp.flatten;
var fp_39 = fp.each;
var fp_40 = fp.pull;
var fp_41 = fp.join;
var fp_42 = fp.defaultCase;
var fp_43 = fp.uniqBy;
var fp_44 = fp.every;
var fp_45 = fp.uniqWith;
var fp_46 = fp.isFunction;
var fp_47 = fp.groupBy;
var fp_48 = fp.differenceBy;
var fp_49 = fp.intersectionBy;
var fp_50 = fp.isEqual;
var fp_51 = fp.max;
var fp_52 = fp.sortBy;
var fp_53 = fp.assign;
var fp_54 = fp.uniq;
var fp_55 = fp.trimChars;
var fp_56 = fp.trimCharsStart;
var fp_57 = fp.isObjectLike;
var fp_58 = fp.flattenDeep;
var fp_59 = fp.indexOf;
var fp_60 = fp.isPlainObject;
var fp_61 = fp.toNumber;
// Found this seed-based random generator somewhere
// Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
var seed = 1;
/**
* return a random number based on a seed
* @param seed
* @returns {number}
*/
function getNextValue() {
seed = (seed * 9301 + 49297) % 233280;
return seed/(233280.0);
}
function setSeed(_seed_) {
seed = _seed_;
}
var randomFromSeed = {
nextValue: getNextValue,
seed: setSeed
};
var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
var alphabet;
var previousSeed;
var shuffled;
function reset() {
shuffled = false;
}
function setCharacters(_alphabet_) {
if (!_alphabet_) {
if (alphabet !== ORIGINAL) {
alphabet = ORIGINAL;
reset();
}
return;
}
if (_alphabet_ === alphabet) {
return;
}
if (_alphabet_.length !== ORIGINAL.length) {
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. You submitted ' + _alphabet_.length + ' characters: ' + _alphabet_);
}
var unique = _alphabet_.split('').filter(function(item, ind, arr){
return ind !== arr.lastIndexOf(item);
});
if (unique.length) {
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. These characters were not unique: ' + unique.join(', '));
}
alphabet = _alphabet_;
reset();
}
function characters(_alphabet_) {
setCharacters(_alphabet_);
return alphabet;
}
function setSeed$1(seed) {
randomFromSeed.seed(seed);
if (previousSeed !== seed) {
reset();
previousSeed = seed;
}
}
function shuffle() {
if (!alphabet) {
setCharacters(ORIGINAL);
}
var sourceArray = alphabet.split('');
var targetArray = [];
var r = randomFromSeed.nextValue();
var characterIndex;
while (sourceArray.length > 0) {
r = randomFromSeed.nextValue();
characterIndex = Math.floor(r * sourceArray.length);
targetArray.push(sourceArray.splice(characterIndex, 1)[0]);
}
return targetArray.join('');
}
function getShuffled() {
if (shuffled) {
return shuffled;
}
shuffled = shuffle();
return shuffled;
}
/**
* lookup shuffled letter
* @param index
* @returns {string}
*/
function lookup(index) {
var alphabetShuffled = getShuffled();
return alphabetShuffled[index];
}
function get () {
return alphabet || ORIGINAL;
}
var alphabet_1 = {
get: get,
characters: characters,
seed: setSeed$1,
lookup: lookup,
shuffled: getShuffled
};
var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
var randomByte;
if (!crypto || !crypto.getRandomValues) {
randomByte = function(size) {
var bytes = [];
for (var i = 0; i < size; i++) {
bytes.push(Math.floor(Math.random() * 256));
}
return bytes;
};
} else {
randomByte = function(size) {
return crypto.getRandomValues(new Uint8Array(size));
};
}
var randomByteBrowser = randomByte;
/**
* Secure random string generator with custom alphabet.
*
* Alphabet must contain 256 symbols or less. Otherwise, the generator
* will not be secure.
*
* @param {generator} random The random bytes generator.
* @param {string} alphabet Symbols to be used in new random string.
* @param {size} size The number of symbols in new random string.
*
* @return {string} Random string.
*
* @example
* const format = require('nanoid/format')
*
* function random (size) {
* const result = []
* for (let i = 0; i < size; i++) {
* result.push(randomByte())
* }
* return result
* }
*
* format(random, "abcdef", 5) //=> "fbaef"
*
* @name format
* @function
*/
var format = function (random, alphabet, size) {
var mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1;
var step = Math.ceil(1.6 * mask * size / alphabet.length);
size = +size;
var id = '';
while (true) {
var bytes = random(step);
for (var i = 0; i < step; i++) {
var byte = bytes[i] & mask;
if (alphabet[byte]) {
id += alphabet[byte];
if (id.length === size) return id
}
}
}
};
function generate(number) {
var loopCounter = 0;
var done;
var str = '';
while (!done) {
str = str + format(randomByteBrowser, alphabet_1.get(), 1);
done = number < (Math.pow(16, loopCounter + 1 ) );
loopCounter++;
}
return str;
}
var generate_1 = generate;
// Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
// This number should be updated every year or so to keep the generated id short.
// To regenerate `new Date() - 0` and bump the version. Always bump the version!
var REDUCE_TIME = 1567752802062;
// don't change unless we change the algos or REDUCE_TIME
// must be an integer and less than 16
var version = 7;
// Counter is used when shortid is called multiple times in one second.
var counter;
// Remember the last time shortid was called in case counter is needed.
var previousSeconds;
/**
* Generate unique id
* Returns string id
*/
function build(clusterWorkerId) {
var str = '';
var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);
if (seconds === previousSeconds) {
counter++;
} else {
counter = 0;
previousSeconds = seconds;
}
str = str + generate_1(version);
str = str + generate_1(clusterWorkerId);
if (counter > 0) {
str = str + generate_1(counter);
}
str = str + generate_1(seconds);
return str;
}
var build_1 = build;
function isShortId(id) {
if (!id || typeof id !== 'string' || id.length < 6 ) {
return false;
}
var nonAlphabetic = new RegExp('[^' +
alphabet_1.get().replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +
']');
return !nonAlphabetic.test(id);
}
var isValid = isShortId;
var lib = createCommonjsModule(function (module) {
// if you are using cluster or multiple servers use this to make each instance
// has a unique value for worker
// Note: I don't know if this is automatically set when using third
// party cluster solutions such as pm2.
var clusterWorkerId = 0;
/**
* Set the seed.
* Highly recommended if you don't want people to try to figure out your id schema.
* exposed as shortid.seed(int)
* @param seed Integer value to seed the random alphabet. ALWAYS USE THE SAME SEED or you might get overlaps.
*/
function seed(seedValue) {
alphabet_1.seed(seedValue);
return module.exports;
}
/**
* Set the cluster worker or machine id
* exposed as shortid.worker(int)
* @param workerId worker must be positive integer. Number less than 16 is recommended.
* returns shortid module so it can be chained.
*/
function worker(workerId) {
clusterWorkerId = workerId;
return module.exports;
}
/**
*
* sets new characters to use in the alphabet
* returns the shuffled alphabet
*/
function characters(newCharacters) {
if (newCharacters !== undefined) {
alphabet_1.characters(newCharacters);
}
return alphabet_1.shuffled();
}
/**
* Generate unique id
* Returns string id
*/
function generate() {
return build_1(clusterWorkerId);
}
// Export all other functions as properties of the generate function
module.exports = generate;
module.exports.generate = generate;
module.exports.seed = seed;
module.exports.worker = worker;
module.exports.characters = characters;
module.exports.isValid = isValid;
});
var lib_1 = lib.generate;
var lib_2 = lib.seed;
var lib_3 = lib.worker;
var lib_4 = lib.characters;
var lib_5 = lib.isValid;
var shortid = lib;
var shortid_1 = shortid.generate;
var lodash = createCommonjsModule(function (module, exports) {
(function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined$1;
/** Used as the semantic version number. */
var VERSION = '4.17.15';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Error message constants. */
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256,
WRAP_FLIP_FLAG = 512;
/** Used as default options for `_.truncate`. */
var DEFAULT_TRUNC_LENGTH = 30,
DEFAULT_TRUNC_OMISSION = '...';
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/** Used to indicate the type of lazy iteratees. */
var LAZY_FILTER_FLAG = 1,
LAZY_MAP_FLAG = 2,
LAZY_WHILE_FLAG = 3;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991,
MAX_INTEGER = 1.7976931348623157e+308,
NAN = 0 / 0;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
/** Used to associate wrap methods with their bit flags. */
var wrapFlags = [
['ary', WRAP_ARY_FLAG],
['bind', WRAP_BIND_FLAG],
['bindKey', WRAP_BIND_KEY_FLAG],
['curry', WRAP_CURRY_FLAG],
['curryRight', WRAP_CURRY_RIGHT_FLAG],
['flip', WRAP_FLIP_FLAG],
['partial', WRAP_PARTIAL_FLAG],
['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
['rearg', WRAP_REARG_FLAG]
];
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
asyncTag = '[object AsyncFunction]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
domExcTag = '[object DOMException]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
nullTag = '[object Null]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
proxyTag = '[object Proxy]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
undefinedTag = '[object Undefined]',
weakMapTag = '[object WeakMap]',
weakSetTag = '[object WeakSet]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to match empty string literals in compiled template source. */
var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
/** Used to match HTML entities and HTML characters. */
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
reUnescapedHtml = /[&<>"']/g,
reHasEscapedHtml = RegExp(reEscapedHtml.source),
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
/** Used to match template delimiters. */
var reEscape = /<%-([\s\S]+?)%>/g,
reEvaluate = /<%([\s\S]+?)%>/g,
reInterpolate = /<%=([\s\S]+?)%>/g;
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g,
reTrimStart = /^\s+/,
reTrimEnd = /\s+$/;
/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
/** Used to match words composed of alphanumeric characters. */
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Used to match
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
*/
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** Used to match Latin Unicode letters (excluding mathematical operators). */
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
/** Used to ensure capturing order of template delimiters. */
var reNoMatch = /($^)/;
/** Used to match unescaped characters in compiled string literals. */
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]",
rsAstral = '[' + rsAstralRange + ']',
rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboRange + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match apostrophes. */
var reApos = RegExp(rsApos, 'g');
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo, 'g');
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
rsUpper + '+' + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join('|'), 'g');
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
/** Used to detect strings that need a more robust regexp to match words. */
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/** Used to assign default `context` object properties. */
var contextProps = [
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
];
/** Used to make template sourceURLs easier to identify. */
var templateCounter = -1;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
cloneableTags[int32Tag] = cloneableTags[mapTag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[setTag] =
cloneableTags[stringTag] = cloneableTags[symbolTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
/** Used to map Latin Unicode letters to basic Latin letters. */
var deburredLetters = {
// Latin-1 Supplement block.
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss',
// Latin Extended-A block.
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
'\u0134': 'J', '\u0135': 'j',
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
'\u0163': 't', '\u0165': 't', '\u0167': 't',
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
'\u0174': 'W', '\u0175': 'w',
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
'\u0132': 'IJ', '\u0133': 'ij',
'\u0152': 'Oe', '\u0153': 'oe',
'\u0149': "'n", '\u017f': 's'
};
/** Used to map characters to HTML entities. */
var htmlEscapes = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'"
};
/** Used to escape characters for inclusion in compiled string literals. */
var stringEscapes = {
'\\': '\\',
"'": "'",
'\n': 'n',
'\r': 'r',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
/** Built-in method references without a dependency on `root`. */
var freeParseFloat = parseFloat,
freeParseInt = parseInt;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
nodeIsDate = nodeUtil && nodeUtil.isDate,
nodeIsMap = nodeUtil && nodeUtil.isMap,
nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
nodeIsSet = nodeUtil && nodeUtil.isSet,
nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/*--------------------------------------------------------------------------*/
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
/**
* A specialized version of `_.forEachRight` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
/**
* A specialized version of `_.every` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
*/
function arrayEvery(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
/**
* A specialized version of `_.reduceRight` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the last element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
}
return accumulator;
}
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* Gets the size of an ASCII `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
var asciiSize = baseProperty('length');
/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}
/**
* Splits an ASCII `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
/**
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
* without support for iteratee shorthands, which iterates over `collection`
* using `eachFunc`.
*
* @private
* @param {Array|Object} collection The collection to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = key;
return false;
}
});
return result;
}
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
}
/**
* This function is like `baseIndexOf` except that it accepts a comparator.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @param {Function} comparator The comparator invoked per element.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
/**
* The base implementation of `_.mean` and `_.meanBy` without support for
* iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the mean.
*/
function baseMean(array, iteratee) {
var length = array == null ? 0 : array.length;
return length ? (baseSum(array, iteratee) / length) : NAN;
}
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined$1 : object[key];
};
}
/**
* The base implementation of `_.propertyOf` without support for deep paths.
*
* @private
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined$1 : object[key];
};
}
/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
* @param {boolean} initAccum Specify using the first or last element of
* `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection) {
accumulator = initAccum
? (initAccum = false, value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
}
/**
* The base implementation of `_.sortBy` which uses `comparer` to define the
* sort order of `array` and replaces criteria objects with their corresponding
* values.
*
* @private
* @param {Array} array The array to sort.
* @param {Function} comparer The function to define sort order.
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
/**
* The base implementation of `_.sum` and `_.sumBy` without support for
* iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the sum.
*/
function baseSum(array, iteratee) {
var result,
index = -1,
length = array.length;
while (++index < length) {
var current = iteratee(array[index]);
if (current !== undefined$1) {
result = result === undefined$1 ? current : (result + current);
}
}
return result;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
* of key-value pairs for `object` corresponding to the property names of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the key-value pairs.
*/
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* The base implementation of `_.values` and `_.valuesIn` which creates an
* array of `object` property values corresponding to the property names
* of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the array of property values.
*/
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
/**
* Gets the number of `placeholder` occurrences in `array`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} placeholder The placeholder to search for.
* @returns {number} Returns the placeholder count.
*/
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}
/**
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
* letters to basic Latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
var deburrLetter = basePropertyOf(deburredLetters);
/**
* Used by `_.escape` to convert characters to HTML entities.
*
* @private
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
var escapeHtmlChar = basePropertyOf(htmlEscapes);
/**
* Used by `_.template` to escape characters for inclusion in compiled string literals.
*
* @private
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
function escapeStringChar(chr) {
return '\\' + stringEscapes[chr];
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined$1 : object[key];
}
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
/**
* Checks if `string` contains a word composed of Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a word is found, else `false`.
*/
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
/**
* Converts `iterator` to an array.
*
* @private
* @param {Object} iterator The iterator to convert.
* @returns {Array} Returns the converted array.
*/
function iteratorToArray(iterator) {
var data,
result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);
}
return result;
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
*
* @private
* @param {Array} array The array to modify.
* @param {*} placeholder The placeholder to replace.
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/**
* Converts `set` to its value-value pairs.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the value-value pairs.
*/
function setToPairs(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
}
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
/**
* A specialized version of `_.lastIndexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;
}
}
return index;
}
/**
* Gets the number of symbols in `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the string size.
*/
function stringSize(string) {
return hasUnicode(string)
? unicodeSize(string)
: asciiSize(string);
}
/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}
/**
* Used by `_.unescape` to convert HTML entities to characters.
*
* @private
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
/**
* Gets the size of a Unicode `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
/**
* Splits a Unicode `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
/*--------------------------------------------------------------------------*/
/**
* Create a new pristine `lodash` function using the `context` object.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Util
* @param {Object} [context=root] The context object.
* @returns {Function} Returns a new `lodash` function.
* @example
*
* _.mixin({ 'foo': _.constant('foo') });
*
* var lodash = _.runInContext();
* lodash.mixin({ 'bar': lodash.constant('bar') });
*
* _.isFunction(_.foo);
* // => true
* _.isFunction(_.bar);
* // => false
*
* lodash.isFunction(lodash.foo);
* // => false
* lodash.isFunction(lodash.bar);
* // => true
*
* // Create a suped-up `defer` in Node.js.
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
*/
var runInContext = (function runInContext(context) {
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
/** Built-in constructor references. */
var Array = context.Array,
Date = context.Date,
Error = context.Error,
Function = context.Function,
Math = context.Math,
Object = context.Object,
RegExp = context.RegExp,
String = context.String,
TypeError = context.TypeError;
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = context['__core-js_shared__'];
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to generate unique IDs. */
var idCounter = 0;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Buffer = moduleExports ? context.Buffer : undefined$1,
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1,
getPrototype = overArg(Object.getPrototypeOf, Object),
objectCreate = Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice,
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1,
symIterator = Symbol ? Symbol.iterator : undefined$1,
symToStringTag = Symbol ? Symbol.toStringTag : undefined$1;
var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
/** Mocked built-ins. */
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
ctxNow = Date && Date.now !== root.Date.now && Date.now,
ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1,
nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join,
nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max,
nativeMin = Math.min,
nativeNow = Date.now,
nativeParseInt = context.parseInt,
nativeRandom = Math.random,
nativeReverse = arrayProto.reverse;
/* Built-in method references that are verified to be native. */
var DataView = getNative(context, 'DataView'),
Map = getNative(context, 'Map'),
Promise = getNative(context, 'Promise'),
Set = getNative(context, 'Set'),
WeakMap = getNative(context, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
/** Used to lookup unminified function names. */
var realNames = {};
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined$1,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1,
symbolToString = symbolProto ? symbolProto.toString : undefined$1;
/*------------------------------------------------------------------------*/
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
* chain sequences. Methods that operate on and return arrays, collections,
* and functions can be chained together. Methods that retrieve a single value
* or may return a primitive value will automatically end the chain sequence
* and return the unwrapped value. Otherwise, the value must be unwrapped
* with `_#value`.
*
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
* enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
* Lazy evaluation allows several methods to support shortcut fusion.
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array and iteratees accept only
* one argument. The heuristic for whether a section qualifies for shortcut
* fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
*
* In addition to lodash methods, wrappers have `Array` and `String` methods.
*
* The wrapper `Array` methods are:
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
*
* The wrapper `String` methods are:
* `replace` and `split`
*
* The wrapper methods that support shortcut fusion are:
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
*
* The chainable wrapper methods are:
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
* `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
* `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
* @category Seq
* @param {*} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var wrapped = _([1, 2, 3]);
*
* // Returns an unwrapped value.
* wrapped.reduce(_.add);
* // => 6
*
* // Returns a wrapped value.
* var squares = wrapped.map(square);
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, '__wrapped__')) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined$1;
return result;
};
}());
/**
* The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
function baseLodash() {
// No operation performed.
}
/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined$1;
}
/**
* By default, the template delimiters used by lodash are like those in
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
* following template settings to use alternative delimiters.
*
* @static
* @memberOf _
* @type {Object}
*/
lodash.templateSettings = {
/**
* Used to detect `data` property values to be HTML-escaped.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
'escape': reEscape,
/**
* Used to detect code to be evaluated.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
'evaluate': reEvaluate,
/**
* Used to detect `data` property values to inject.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
'interpolate': reInterpolate,
/**
* Used to reference the data object in the template text.
*
* @memberOf _.templateSettings
* @type {string}
*/
'variable': '',
/**
* Used to import variables into the compiled template.
*
* @memberOf _.templateSettings
* @type {Object}
*/
'imports': {
/**
* A reference to the `lodash` function.
*
* @memberOf _.templateSettings.imports
* @type {Function}
*/
'_': lodash
}
};
// Ensure wrappers are instances of `baseLodash`.
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
/*------------------------------------------------------------------------*/
/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
/**
* Creates a clone of the lazy wrapper object.
*
* @private
* @name clone
* @memberOf LazyWrapper
* @returns {Object} Returns the cloned `LazyWrapper` object.
*/
function lazyClone() {
var result = new LazyWrapper(this.__wrapped__);
result.__actions__ = copyArray(this.__actions__);
result.__dir__ = this.__dir__;
result.__filtered__ = this.__filtered__;
result.__iteratees__ = copyArray(this.__iteratees__);
result.__takeCount__ = this.__takeCount__;
result.__views__ = copyArray(this.__views__);
return result;
}
/**
* Reverses the direction of lazy iteration.
*
* @private
* @name reverse
* @memberOf LazyWrapper
* @returns {Object} Returns the new reversed `LazyWrapper` object.
*/
function lazyReverse() {
if (this.__filtered__) {
var result = new LazyWrapper(this);
result.__dir__ = -1;
result.__filtered__ = true;
} else {
result = this.clone();
result.__dir__ *= -1;
}
return result;
}
/**
* Extracts the unwrapped value from its lazy wrapper.
*
* @private
* @name value
* @memberOf LazyWrapper
* @returns {*} Returns the unwrapped value.
*/
function lazyValue() {
var array = this.__wrapped__.value(),
dir = this.__dir__,
isArr = isArray(array),
isRight = dir < 0,
arrLength = isArr ? array.length : 0,
view = getView(0, arrLength, this.__views__),
start = view.start,
end = view.end,
length = end - start,
index = isRight ? end : (start - 1),
iteratees = this.__iteratees__,
iterLength = iteratees.length,
resIndex = 0,
takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
return baseWrapperValue(array, this.__actions__);
}
var result = [];
outer:
while (length-- && resIndex < takeCount) {
index += dir;
var iterIndex = -1,
value = array[index];
while (++iterIndex < iterLength) {
var data = iteratees[iterIndex],
iteratee = data.iteratee,
type = data.type,
computed = iteratee(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
if (type == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
result[resIndex++] = value;
}
return result;
}
// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
/*------------------------------------------------------------------------*/
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined$1 : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined$1;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? (data[key] !== undefined$1) : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (nativeCreate && value === undefined$1) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/*------------------------------------------------------------------------*/
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined$1 : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/*------------------------------------------------------------------------*/
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/*------------------------------------------------------------------------*/
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/*------------------------------------------------------------------------*/
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/*------------------------------------------------------------------------*/
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
/**
* A specialized version of `_.sample` for arrays.
*
* @private
* @param {Array} array The array to sample.
* @returns {*} Returns the random element.
*/
function arraySample(array) {
var length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined$1;
}
/**
* A specialized version of `_.sampleSize` for arrays.
*
* @private
* @param {Array} array The array to sample.
* @param {number} n The number of elements to sample.
* @returns {Array} Returns the random elements.
*/
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
}
/**
* A specialized version of `_.shuffle` for arrays.
*
* @private
* @param {Array} array The array to shuffle.
* @returns {Array} Returns the new shuffled array.
*/
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined$1 && !eq(object[key], value)) ||
(value === undefined$1 && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined$1 && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty) {
defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
/**
* The base implementation of `_.at` without support for individual paths.
*
* @private
* @param {Object} object The object to iterate over.
* @param {string[]} paths The property paths to pick.
* @returns {Array} Returns the picked elements.
*/
function baseAt(object, paths) {
var index = -1,
length = paths.length,
result = Array(length),
skip = object == null;
while (++index < length) {
result[index] = skip ? undefined$1 : get(object, paths[index]);
}
return result;
}
/**
* The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the clamped number.
*/
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined$1) {
number = number <= upper ? number : upper;
}
if (lower !== undefined$1) {
number = number >= lower ? number : lower;
}
}
return number;
}
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined$1) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat
? copySymbolsIn(value, baseAssignIn(result, value))
: copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet(value)) {
value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap(value)) {
value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
}
var keysFunc = isFull
? (isFlat ? getAllKeysIn : getAllKeys)
: (isFlat ? keysIn : keys);
var props = isArr ? undefined$1 : keysFunc(value);
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
/**
* The base implementation of `_.conforms` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
}
/**
* The base implementation of `_.conformsTo` which accepts `props` to check.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property predicates to conform to.
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
*/
function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object(object);
while (length--) {
var key = props[length],
predicate = source[key],
value = object[key];
if ((value === undefined$1 && !(key in object)) || !predicate(value)) {
return false;
}
}
return true;
}
/**
* The base implementation of `_.delay` and `_.defer` which accepts `args`
* to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {Array} args The arguments to provide to `func`.
* @returns {number|Object} Returns the timer id or timeout object.
*/
function baseDelay(func, wait, args) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return setTimeout(function() { func.apply(undefined$1, args); }, wait);
}
/**
* The base implementation of methods like `_.difference` without support
* for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
}
else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
}
else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
/**
* The base implementation of `_.forEachRight` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEachRight = createBaseEach(baseForOwnRight, true);
/**
* The base implementation of `_.every` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`
*/
function baseEvery(collection, predicate) {
var result = true;
baseEach(collection, function(value, index, collection) {
result = !!predicate(value, index, collection);
return result;
});
return result;
}
/**
* The base implementation of methods like `_.max` and `_.min` which accepts a
* `comparator` to determine the extremum value.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The iteratee invoked per iteration.
* @param {Function} comparator The comparator used to compare values.
* @returns {*} Returns the extremum value.
*/
function baseExtremum(array, iteratee, comparator) {
var index = -1,
length = array.length;
while (++index < length) {
var value = array[index],
current = iteratee(value);
if (current != null && (computed === undefined$1
? (current === current && !isSymbol(current))
: comparator(current, computed)
)) {
var computed = current,
result = value;
}
}
return result;
}
/**
* The base implementation of `_.fill` without an iteratee call guard.
*
* @private
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns `array`.
*/
function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined$1 || end > length) ? length : toInteger(end);
if (end < 0) {
end += length;
}
end = start > end ? 0 : toLength(end);
while (start < end) {
array[start++] = value;
}
return array;
}
/**
* The base implementation of `_.filter` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
/**
* This function is like `baseFor` except that it iterates over properties
* in the opposite order.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseForRight = createBaseFor(true);
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
}
/**
* The base implementation of `_.forOwnRight` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwnRight(object, iteratee) {
return object && baseForRight(object, iteratee, keys);
}
/**
* The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from `props`.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} props The property names to filter.
* @returns {Array} Returns the function names.
*/
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction(object[key]);
});
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined$1;
}
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined$1 ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
/**
* The base implementation of `_.gt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than `other`,
* else `false`.
*/
function baseGt(value, other) {
return value > other;
}
/**
* The base implementation of `_.has` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
}
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
/**
* The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
*/
function baseInRange(number, start, end) {
return number >= nativeMin(start, end) && number < nativeMax(start, end);
}
/**
* The base implementation of methods like `_.intersection`, without support
* for iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = arrayMap(array, baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined$1;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
/**
* The base implementation of `_.invert` and `_.invertBy` which inverts
* `object` with values transformed by `iteratee` and set by `setter`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform values.
* @param {Object} accumulator The initial inverted object.
* @returns {Function} Returns `accumulator`.
*/
function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}
/**
* The base implementation of `_.invoke` without support for individual
* method arguments.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
* @param {Array} args The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
*/
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined$1 : apply(func, object, args);
}
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
/**
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
*/
function baseIsArrayBuffer(value) {
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
}
/**
* The base implementation of `_.isDate` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
*/
function baseIsDate(value) {
return isObjectLike(value) && baseGetTag(value) == dateTag;
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined$1 && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined$1
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
: result
)) {
return false;
}
}
}
return true;
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isRegExp` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.lt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is less than `other`,
* else `false`.
*/
function baseLt(value, other) {
return value < other;
}
/**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return (objValue === undefined$1 && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined$1;
if (newValue === undefined$1) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined$1;
var isCommon = newValue === undefined$1;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/**
* The base implementation of `_.nth` which doesn't coerce arguments.
*
* @private
* @param {Array} array The array to query.
* @param {number} n The index of the element to return.
* @returns {*} Returns the nth element of `array`.
*/
function baseNth(array, n) {
var length = array.length;
if (!length) {
return;
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined$1;
}
/**
* The base implementation of `_.orderBy` without param guards.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
* @param {string[]} orders The sort orders of `iteratees`.
* @returns {Array} Returns the new sorted array.
*/
function baseOrderBy(collection, iteratees, orders) {
var index = -1;
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) {
return iteratee(value);
});
return { 'criteria': criteria, 'index': ++index, 'value': value };
});
return baseSortBy(result, function(object, other) {
return compareMultiple(object, other, orders);
});
}
/**
* The base implementation of `_.pick` without support for individual
* property identifiers.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
}
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
/**
* The base implementation of `_.pullAllBy` without support for iteratee
* shorthands.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns `array`.
*/
function basePullAll(array, values, iteratee, comparator) {
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
index = -1,
length = values.length,
seen = array;
if (array === values) {
values = copyArray(values);
}
if (iteratee) {
seen = arrayMap(array, baseUnary(iteratee));
}
while (++index < length) {
var fromIndex = 0,
value = values[index],
computed = iteratee ? iteratee(value) : value;
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
splice.call(array, fromIndex, 1);
}
}
return array;
}
/**
* The base implementation of `_.pullAt` without support for individual
* indexes or capturing the removed elements.
*
* @private
* @param {Array} array The array to modify.
* @param {number[]} indexes The indexes of elements to remove.
* @returns {Array} Returns `array`.
*/
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0,
lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
} else {
baseUnset(array, index);
}
}
}
return array;
}
/**
* The base implementation of `_.random` without support for returning
* floating-point numbers.
*
* @private
* @param {number} lower The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the random number.
*/
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/**
* The base implementation of `_.repeat` which doesn't coerce arguments.
*
* @private
* @param {string} string The string to repeat.
* @param {number} n The number of times to repeat the string.
* @returns {string} Returns the repeated string.
*/
function baseRepeat(string, n) {
var result = '';
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
if (n % 2) {
result += string;
}
n = nativeFloor(n / 2);
if (n) {
string += string;
}
} while (n);
return result;
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return setToString(overRest(func, start, identity), func + '');
}
/**
* The base implementation of `_.sample`.
*
* @private
* @param {Array|Object} collection The collection to sample.
* @returns {*} Returns the random element.
*/
function baseSample(collection) {
return arraySample(values(collection));
}
/**
* The base implementation of `_.sampleSize` without param guards.
*
* @private
* @param {Array|Object} collection The collection to sample.
* @param {number} n The number of elements to sample.
* @returns {Array} Returns the random elements.
*/
function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
}
/**
* The base implementation of `_.set`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]),
newValue = value;
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined$1;
if (newValue === undefined$1) {
newValue = isObject(objValue)
? objValue
: (isIndex(path[index + 1]) ? [] : {});
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
/**
* The base implementation of `setData` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var baseSetData = !metaMap ? identity : function(func, data) {
metaMap.set(func, data);
return func;
};
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !defineProperty ? identity : function(func, string) {
return defineProperty(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(string),
'writable': true
});
};
/**
* The base implementation of `_.shuffle`.
*
* @private
* @param {Array|Object} collection The collection to shuffle.
* @returns {Array} Returns the new shuffled array.
*/
function baseShuffle(collection) {
return shuffleSelf(values(collection));
}
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**
* The base implementation of `_.some` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
var result;
baseEach(collection, function(value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}
/**
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
* performs a binary search of `array` to determine the index at which `value`
* should be inserted into `array` in order to maintain its sort order.
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array == null ? low : array.length;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid];
if (computed !== null && !isSymbol(computed) &&
(retHighest ? (computed <= value) : (computed < value))) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return baseSortedIndexBy(array, value, identity, retHighest);
}
/**
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
* which invokes `iteratee` for `value` and each element of `array` to compute
* their sort ranking. The iteratee is invoked with one argument; (value).
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} iteratee The iteratee invoked per element.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
high = array == null ? 0 : array.length,
valIsNaN = value !== value,
valIsNull = value === null,
valIsSymbol = isSymbol(value),
valIsUndefined = value === undefined$1;
while (low < high) {
var mid = nativeFloor((low + high) / 2),
computed = iteratee(array[mid]),
othIsDefined = computed !== undefined$1,
othIsNull = computed === null,
othIsReflexive = computed === computed,
othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? (computed <= value) : (computed < value);
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
/**
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseSortedUniq(array, iteratee) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
}
}
return result;
}
/**
* The base implementation of `_.toNumber` which doesn't ensure correct
* conversions of binary, hexadecimal, or octal string values.
*
* @private
* @param {*} value The value to process.
* @returns {number} Returns the number.
*/
function baseToNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
return +value;
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/**
* The base implementation of `_.update`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to update.
* @param {Function} updater The function to produce the updated value.
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
/**
* The base implementation of methods like `_.dropWhile` and `_.takeWhile`
* without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to query.
* @param {Function} predicate The function invoked per iteration.
* @param {boolean} [isDrop] Specify dropping elements instead of taking them.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the slice of `array`.
*/
function baseWhile(array, predicate, isDrop, fromRight) {
var length = array.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length) &&
predicate(array[index], index, array)) {}
return isDrop
? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
: baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
}
/**
* The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each
* successive action is supplied the return value of the previous.
*
* @private
* @param {*} value The unwrapped value.
* @param {Array} actions Actions to perform to resolve the unwrapped value.
* @returns {*} Returns the resolved value.
*/
function baseWrapperValue(value, actions) {
var result = value;
if (result instanceof LazyWrapper) {
result = result.value();
}
return arrayReduce(actions, function(result, action) {
return action.func.apply(action.thisArg, arrayPush([result], action.args));
}, result);
}
/**
* The base implementation of methods like `_.xor`, without support for
* iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of values.
*/
function baseXor(arrays, iteratee, comparator) {
var length = arrays.length;
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
var index = -1,
result = Array(length);
while (++index < length) {
var array = arrays[index],
othIndex = -1;
while (++othIndex < length) {
if (othIndex != index) {
result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
}
}
}
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
}
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined$1;
assignFunc(result, props[index], value);
}
return result;
}
/**
* Casts `value` to an empty array if it's not an array like object.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array|Object} Returns the cast array-like object.
*/
function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Function} Returns cast function.
*/
function castFunction(value) {
return typeof value == 'function' ? value : identity;
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
/**
* A `baseRest` alias which can be replaced with `identity` by module
* replacement plugins.
*
* @private
* @type {Function}
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
var castRest = baseRest;
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined$1 ? length : end;
return (!start && end >= length) ? array : baseSlice(array, start, end);
}
/**
* A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
*
* @private
* @param {number|Object} id The timer id or timeout object of the timer to clear.
*/
var clearTimeout = ctxClearTimeout || function(id) {
return root.clearTimeout(id);
};
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
/**
* Compares values to sort them in ascending order.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {number} Returns the sort order indicator for `value`.
*/
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined$1,
valIsNull = value === null,
valIsReflexive = value === value,
valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined$1,
othIsNull = other === null,
othIsReflexive = other === other,
othIsSymbol = isSymbol(other);
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
(valIsNull && othIsDefined && othIsReflexive) ||
(!valIsDefined && othIsReflexive) ||
!valIsReflexive) {
return 1;
}
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
(othIsNull && valIsDefined && valIsReflexive) ||
(!othIsDefined && valIsReflexive) ||
!othIsReflexive) {
return -1;
}
}
return 0;
}
/**
* Used by `_.orderBy` to compare multiple properties of a value to another
* and stable sort them.
*
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
* specify an order of "desc" for descending or "asc" for ascending sort order
* of corresponding values.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {boolean[]|string[]} orders The order to sort by for each property.
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
while (++index < length) {
var result = compareAscending(objCriteria[index], othCriteria[index]);
if (result) {
if (index >= ordersLength) {
return result;
}
var order = orders[index];
return result * (order == 'desc' ? -1 : 1);
}
}
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circumstances, to provide the same value for
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
// for more details.
//
// This also ensures a stable sort in V8 and other engines.
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
}
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to prepend to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result[leftIndex++] = args[argsIndex++];
}
return result;
}
/**
* This function is like `composeArgs` except that the arguments composition
* is tailored for `_.partialRight`.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to append to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
rightIndex = -1,
rightLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result;
}
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined$1;
if (newValue === undefined$1) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
/**
* Copies own symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
/**
* Copies own and inherited symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, getIteratee(iteratee, 2), accumulator);
};
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined$1,
guard = length > 2 ? sources[2] : undefined$1;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined$1;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined$1 : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
/**
* Creates a function that wraps `func` to invoke it with the optional `this`
* binding of `thisArg`.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
/**
* Creates a function like `_.lowerFirst`.
*
* @private
* @param {string} methodName The name of the `String` case method to use.
* @returns {Function} Returns the new case function.
*/
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string)
? stringToArray(string)
: undefined$1;
var chr = strSymbols
? strSymbols[0]
: string.charAt(0);
var trailing = strSymbols
? castSlice(strSymbols, 1).join('')
: string.slice(1);
return chr[methodName]() + trailing;
};
}
/**
* Creates a function like `_.camelCase`.
*
* @private
* @param {Function} callback The function to combine each word.
* @returns {Function} Returns the new compounder function.
*/
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
};
}
/**
* Creates a function that produces an instance of `Ctor` regardless of
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
*
* @private
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.
return isObject(result) ? result : thisBinding;
};
}
/**
* Creates a function that wraps `func` to enable currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length,
placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
? []
: replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, undefined$1,
args, holders, undefined$1, undefined$1, arity - length);
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return apply(fn, this, args);
}
return wrapper;
}
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike(collection)) {
var iteratee = getIteratee(predicate, 3);
collection = keys(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1;
};
}
/**
* Creates a `_.flow` or `_.flowRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
return flatRest(function(funcs) {
var length = funcs.length,
index = length,
prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index--) {
var func = funcs[index];
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
var wrapper = new LodashWrapper([], true);
}
}
index = wrapper ? index : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func),
data = funcName == 'wrapper' ? getData(func) : undefined$1;
if (data && isLaziable(data[0]) &&
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
!data[4].length && data[9] == 1
) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = (func.length == 1 && isLaziable(func))
? wrapper[funcName]()
: wrapper.thru(func);
}
}
return function() {
var args = arguments,
value = args[0];
if (wrapper && args.length == 1 && isArray(value)) {
return wrapper.plant(value).value();
}
var index = 0,
result = length ? funcs[index].apply(this, args) : value;
while (++index < length) {
result = funcs[index].call(this, result);
}
return result;
};
});
}
/**
* Creates a function that wraps `func` to invoke it with optional `this`
* binding of `thisArg`, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided
* to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG,
isBind = bitmask & WRAP_BIND_FLAG,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined$1 : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
/**
* Creates a function like `_.invertBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} toIteratee The function to resolve iteratees.
* @returns {Function} Returns the new inverter function.
*/
function createInverter(setter, toIteratee) {
return function(object, iteratee) {
return baseInverter(object, setter, toIteratee(iteratee), {});
};
}
/**
* Creates a function that performs a mathematical operation on two values.
*
* @private
* @param {Function} operator The function to perform the operation.
* @param {number} [defaultValue] The value used for `undefined` arguments.
* @returns {Function} Returns the new mathematical operation function.
*/
function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result;
if (value === undefined$1 && other === undefined$1) {
return defaultValue;
}
if (value !== undefined$1) {
result = value;
}
if (other !== undefined$1) {
if (result === undefined$1) {
return other;
}
if (typeof value == 'string' || typeof other == 'string') {
value = baseToString(value);
other = baseToString(other);
} else {
value = baseToNumber(value);
other = baseToNumber(other);
}
result = operator(value, other);
}
return result;
};
}
/**
* Creates a function like `_.over`.
*
* @private
* @param {Function} arrayFunc The function to iterate over iteratees.
* @returns {Function} Returns the new over function.
*/
function createOver(arrayFunc) {
return flatRest(function(iteratees) {
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
return apply(iteratee, thisArg, args);
});
});
});
}
/**
* Creates the padding for `string` based on `length`. The `chars` string
* is truncated if the number of characters exceeds `length`.
*
* @private
* @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
function createPadding(length, chars) {
chars = chars === undefined$1 ? ' ' : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return hasUnicode(chars)
? castSlice(stringToArray(result), 0, length).join('')
: result.slice(0, length);
}
/**
* Creates a function that wraps `func` to invoke it with the `this` binding
* of `thisArg` and `partials` prepended to the arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to
* the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined$1;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined$1) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined$1 ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/**
* Creates a function that performs a relational operation on two values.
*
* @private
* @param {Function} operator The function to perform the operation.
* @returns {Function} Returns the new relational operation function.
*/
function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == 'string' && typeof other == 'string')) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
}
/**
* Creates a function that wraps `func` to continue currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG,
newHolders = isCurry ? holders : undefined$1,
newHoldersRight = isCurry ? undefined$1 : holders,
newPartials = isCurry ? partials : undefined$1,
newPartialsRight = isCurry ? undefined$1 : partials;
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
newHoldersRight, argPos, ary, arity
];
var result = wrapFunc.apply(undefined$1, newData);
if (isLaziable(func)) {
setData(result, newData);
}
result.placeholder = placeholder;
return setWrapToString(result, func, bitmask);
}
/**
* Creates a function like `_.round`.
*
* @private
* @param {string} methodName The name of the `Math` method to use when rounding.
* @returns {Function} Returns the new round function.
*/
function createRound(methodName) {
var func = Math[methodName];
return function(number, precision) {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision && nativeIsFinite(number)) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'),
value = func(pair[0] + 'e' + (+pair[1] + precision));
pair = (toString(value) + 'e').split('e');
return +(pair[0] + 'e' + (+pair[1] - precision));
}
return func(number);
};
}
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
return new Set(values);
};
/**
* Creates a `_.toPairs` or `_.toPairsIn` function.
*
* @private
* @param {Function} keysFunc The function to get the keys of a given object.
* @returns {Function} Returns the new pairs function.
*/
function createToPairs(keysFunc) {
return function(object) {
var tag = getTag(object);
if (tag == mapTag) {
return mapToArray(object);
}
if (tag == setTag) {
return setToPairs(object);
}
return baseToPairs(object, keysFunc(object));
};
}
/**
* Creates a function that either curries or invokes `func` with optional
* `this` binding and partially applied arguments.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags.
* 1 - `_.bind`
* 2 - `_.bindKey`
* 4 - `_.curry` or `_.curryRight` of a bound function
* 8 - `_.curry`
* 16 - `_.curryRight`
* 32 - `_.partial`
* 64 - `_.partialRight`
* 128 - `_.rearg`
* 256 - `_.ary`
* 512 - `_.flip`
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to be partially applied.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined$1;
}
ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0);
arity = arity === undefined$1 ? arity : toInteger(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
var partialsRight = partials,
holdersRight = holders;
partials = holders = undefined$1;
}
var data = isBindKey ? undefined$1 : getData(func);
var newData = [
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
argPos, ary, arity
];
if (data) {
mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined$1
? (isBindKey ? 0 : func.length)
: nativeMax(newData[9] - length, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result = createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
result = createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result = createPartial(func, bitmask, thisArg, partials);
} else {
result = createHybrid.apply(undefined$1, newData);
}
var setter = data ? baseSetData : setData;
return setWrapToString(setter(result, newData), func, bitmask);
}
/**
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
* of source objects to the destination object for all destination properties
* that resolve to `undefined`.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to assign.
* @param {Object} object The parent object of `objValue`.
* @returns {*} Returns the value to assign.
*/
function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined$1 ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue;
}
return objValue;
}
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack);
stack['delete'](srcValue);
}
return objValue;
}
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined$1 : value;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined$1;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined$1) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined$1
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseRest` which flattens the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
function flatRest(func) {
return setToString(overRest(func, undefined$1, flatten), func + '');
}
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
var getData = !metaMap ? noop : function(func) {
return metaMap.get(func);
};
/**
* Gets the name of `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = (func.name + ''),
array = realNames[result],
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}
/**
* Gets the argument placeholder value for `func`.
*
* @private
* @param {Function} func The function to inspect.
* @returns {*} Returns the placeholder value.
*/
function getHolder(func) {
var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
return object.placeholder;
}
/**
* Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
* this function returns the custom method, otherwise it returns `baseIteratee`.
* If arguments are provided, the chosen function is invoked with them and
* its result is returned.
*
* @private
* @param {*} [value] The value to convert to an iteratee.
* @param {number} [arity] The arity of the created iteratee.
* @returns {Function} Returns the chosen function or its result.
*/
function getIteratee() {
var result = lodash.iteratee || iteratee;
result = result === iteratee ? baseIteratee : result;
return arguments.length ? result(arguments[0], arguments[1]) : result;
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined$1;
}
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined$1;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
/**
* Creates an array of the own and inherited enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));
object = getPrototype(object);
}
return result;
};
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined$1,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Gets the view, applying any `transforms` to the `start` and `end` positions.
*
* @private
* @param {number} start The start of the view.
* @param {number} end The end of the view.
* @param {Array} transforms The transformations to apply to the view.
* @returns {Object} Returns an object containing the `start` and `end`
* positions of the view.
*/
function getView(start, end, transforms) {
var index = -1,
length = transforms.length;
while (++index < length) {
var data = transforms[index],
size = data.size;
switch (data.type) {
case 'drop': start += size; break;
case 'dropRight': end -= size; break;
case 'take': end = nativeMin(end, start + size); break;
case 'takeRight': start = nativeMax(start, end - size); break;
}
}
return { 'start': start, 'end': end };
}
/**
* Extracts wrapper details from the `source` body comment.
*
* @private
* @param {string} source The source to inspect.
* @returns {Array} Returns the wrapper details.
*/
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(object));
}
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(getPrototype(object))
: {};
}
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor;
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor;
case symbolTag:
return cloneSymbol(object);
}
}
/**
* Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
* @param {string} source The source to modify.
* @returns {Array} details The details to insert.
* @returns {string} Returns the modified source.
*/
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
details = details.join(length > 2 ? ', ' : ' ');
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has a lazy counterpart.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
* else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func),
other = lodash[funcName];
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `func` is capable of being masked.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
*/
var isMaskable = coreJsData ? isFunction : stubFalse;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined$1 || (key in Object(object)));
};
}
/**
* A specialized version of `_.memoize` which clears the memoized function's
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
*
* @private
* @param {Function} func The function to have its output memoized.
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
/**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
* may be applied regardless of execution order. Methods like `_.ary` and
* `_.rearg` modify function arguments, making the order in which they are
* executed important, preventing the merging of metadata. However, we make
* an exception for a safe combined case where curried functions have `_.ary`
* and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
* @param {Array} source The source metadata.
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo =
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
// Exit early if metadata can't be merged.
if (!(isCommon || isCombo)) {
return data;
}
// Use source `thisArg` if available.
if (srcBitmask & WRAP_BIND_FLAG) {
data[2] = source[2];
// Set when currying a bound function.
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
// Compose partial arguments.
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
// Use source `argPos` if available.
value = source[7];
if (value) {
data[7] = value;
}
// Use source `ary` if it's smaller.
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
// Use source `arity` if one is not provided.
if (data[9] == null) {
data[9] = source[9];
}
// Use source `func` and merge bitmasks.
data[0] = source[0];
data[1] = newBitmask;
return data;
}
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax(start === undefined$1 ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return apply(func, this, otherArgs);
};
}
/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**
* Reorder `array` according to the specified indexes where the element at
* the first index is assigned as the first element, the element at
* the second index is assigned as the second element, and so on.
*
* @private
* @param {Array} array The array to reorder.
* @param {Array} indexes The arranged array indexes.
* @returns {Array} Returns `array`.
*/
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin(indexes.length, arrLength),
oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1;
}
return array;
}
/**
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
if (key === 'constructor' && typeof object[key] === 'function') {
return;
}
if (key == '__proto__') {
return;
}
return object[key];
}
/**
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
* period of time, it will trip its breaker and transition to an identity
* function to avoid garbage collection pauses in V8. See
* [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var setData = shortOut(baseSetData);
/**
* A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @returns {number|Object} Returns the timer id or timeout object.
*/
var setTimeout = ctxSetTimeout || function(func, wait) {
return root.setTimeout(func, wait);
};
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString);
/**
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
* with wrapper details in a comment at the top of the source body.
*
* @private
* @param {Function} wrapper The function to modify.
* @param {Function} reference The reference function.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Function} Returns `wrapper`.
*/
function setWrapToString(wrapper, reference, bitmask) {
var source = (reference + '');
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
}
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined$1, arguments);
};
}
/**
* A specialized version of `_.shuffle` which mutates and sets the size of `array`.
*
* @private
* @param {Array} array The array to shuffle.
* @param {number} [size=array.length] The size of `array`.
* @returns {Array} Returns `array`.
*/
function shuffleSelf(array, size) {
var index = -1,
length = array.length,
lastIndex = length - 1;
size = size === undefined$1 ? length : size;
while (++index < size) {
var rand = baseRandom(index, lastIndex),
value = array[rand];
array[rand] = array[index];
array[index] = value;
}
array.length = size;
return array;
}
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Updates wrapper `details` based on `bitmask` flags.
*
* @private
* @returns {Array} details The details to modify.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Array} Returns `details`.
*/
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = '_.' + pair[0];
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
/**
* Creates a clone of `wrapper`.
*
* @private
* @param {Object} wrapper The wrapper to clone.
* @returns {Object} Returns the cloned wrapper.
*/
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;
return result;
}
/*------------------------------------------------------------------------*/
/**
* Creates an array of elements split into groups the length of `size`.
* If `array` can't be split evenly, the final chunk will be the remaining
* elements.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the new array of chunks.
* @example
*
* _.chunk(['a', 'b', 'c', 'd'], 2);
* // => [['a', 'b'], ['c', 'd']]
*
* _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
if ((guard ? isIterateeCall(array, size, guard) : size === undefined$1)) {
size = 1;
} else {
size = nativeMax(toInteger(size), 0);
}
var length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
var index = 0,
resIndex = 0,
result = Array(nativeCeil(length / size));
while (index < length) {
result[resIndex++] = baseSlice(array, index, (index += size));
}
return result;
}
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}
/**
* Creates a new array concatenating `array` with any additional arrays
* and/or values.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to concatenate.
* @param {...*} [values] The values to concatenate.
* @returns {Array} Returns the new concatenated array.
* @example
*
* var array = [1];
* var other = _.concat(array, 2, [3], [[4]]);
*
* console.log(other);
* // => [1, 2, 3, [4]]
*
* console.log(array);
* // => [1]
*/
function concat() {
var length = arguments.length;
if (!length) {
return [];
}
var args = Array(length - 1),
array = arguments[0],
index = length;
while (index--) {
args[index - 1] = arguments[index];
}
return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
}
/**
* Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* **Note:** Unlike `_.pullAll`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.without, _.xor
* @example
*
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
});
/**
* This method is like `_.difference` except that it accepts `iteratee` which
* is invoked for each element of `array` and `values` to generate the criterion
* by which they're compared. The order and references of result values are
* determined by the first array. The iteratee is invoked with one argument:
* (value).
*
* **Note:** Unlike `_.pullAllBy`, this method returns a new array.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
* // => [1.2]
*
* // The `_.property` iteratee shorthand.
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
var differenceBy = baseRest(function(array, values) {
var iteratee = last(values);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined$1;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
: [];
});
/**
* This method is like `_.difference` except that it accepts `comparator`
* which is invoked to compare elements of `array` to `values`. The order and
* references of result values are determined by the first array. The comparator
* is invoked with two arguments: (arrVal, othVal).
*
* **Note:** Unlike `_.pullAllWith`, this method returns a new array.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
*
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
* // => [{ 'x': 2, 'y': 1 }]
*/
var differenceWith = baseRest(function(array, values) {
var comparator = last(values);
if (isArrayLikeObject(comparator)) {
comparator = undefined$1;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined$1, comparator)
: [];
});
/**
* Creates a slice of `array` with `n` elements dropped from the beginning.
*
* @static
* @memberOf _
* @since 0.5.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.drop([1, 2, 3]);
* // => [2, 3]
*
* _.drop([1, 2, 3], 2);
* // => [3]
*
* _.drop([1, 2, 3], 5);
* // => []
*
* _.drop([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function drop(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined$1) ? 1 : toInteger(n);
return baseSlice(array, n < 0 ? 0 : n, length);
}
/**
* Creates a slice of `array` with `n` elements dropped from the end.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropRight([1, 2, 3]);
* // => [1, 2]
*
* _.dropRight([1, 2, 3], 2);
* // => [1]
*
* _.dropRight([1, 2, 3], 5);
* // => []
*
* _.dropRight([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined$1) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` excluding elements dropped from the end.
* Elements are dropped until `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* _.dropRightWhile(users, function(o) { return !o.active; });
* // => objects for ['barney']
*
* // The `_.matches` iteratee shorthand.
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
* // => objects for ['barney', 'fred']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.dropRightWhile(users, ['active', false]);
* // => objects for ['barney']
*
* // The `_.property` iteratee shorthand.
* _.dropRightWhile(users, 'active');
* // => objects for ['barney', 'fred', 'pebbles']
*/
function dropRightWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, getIteratee(predicate, 3), true, true)
: [];
}
/**
* Creates a slice of `array` excluding elements dropped from the beginning.
* Elements are dropped until `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.dropWhile(users, function(o) { return !o.active; });
* // => objects for ['pebbles']
*
* // The `_.matches` iteratee shorthand.
* _.dropWhile(users, { 'user': 'barney', 'active': false });
* // => objects for ['fred', 'pebbles']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.dropWhile(users, ['active', false]);
* // => objects for ['pebbles']
*
* // The `_.property` iteratee shorthand.
* _.dropWhile(users, 'active');
* // => objects for ['barney', 'fred', 'pebbles']
*/
function dropWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, getIteratee(predicate, 3), true)
: [];
}
/**
* Fills elements of `array` with `value` from `start` up to, but not
* including, `end`.
*
* **Note:** This method mutates `array`.
*
* @static
* @memberOf _
* @since 3.2.0
* @category Array
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns `array`.
* @example
*
* var array = [1, 2, 3];
*
* _.fill(array, 'a');
* console.log(array);
* // => ['a', 'a', 'a']
*
* _.fill(Array(3), 2);
* // => [2, 2, 2]
*
* _.fill([4, 6, 8, 10], '*', 1, 3);
* // => [4, '*', '*', 10]
*/
function fill(array, value, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, getIteratee(predicate, 3), index);
}
/**
* This method is like `_.findIndex` except that it iterates over elements
* of `collection` from right to left.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=array.length-1] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
* // => 2
*
* // The `_.matches` iteratee shorthand.
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
* // => 0
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findLastIndex(users, ['active', false]);
* // => 2
*
* // The `_.property` iteratee shorthand.
* _.findLastIndex(users, 'active');
* // => 0
*/
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length - 1;
if (fromIndex !== undefined$1) {
index = toInteger(fromIndex);
index = fromIndex < 0
? nativeMax(length + index, 0)
: nativeMin(index, length - 1);
}
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
}
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
/**
* Recursively flattens `array`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flattenDeep([1, [2, [3, [4]], 5]]);
* // => [1, 2, 3, 4, 5]
*/
function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}
/**
* Recursively flatten `array` up to `depth` times.
*
* @static
* @memberOf _
* @since 4.4.0
* @category Array
* @param {Array} array The array to flatten.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
* @example
*
* var array = [1, [2, [3, [4]], 5]];
*
* _.flattenDepth(array, 1);
* // => [1, 2, [3, [4]], 5]
*
* _.flattenDepth(array, 2);
* // => [1, 2, 3, [4], 5]
*/
function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
depth = depth === undefined$1 ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
/**
* The inverse of `_.toPairs`; this method returns an object composed
* from key-value `pairs`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} pairs The key-value pairs.
* @returns {Object} Returns the new object.
* @example
*
* _.fromPairs([['a', 1], ['b', 2]]);
* // => { 'a': 1, 'b': 2 }
*/
function fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
var pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;
}
/**
* Gets the first element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias first
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the first element of `array`.
* @example
*
* _.head([1, 2, 3]);
* // => 1
*
* _.head([]);
* // => undefined
*/
function head(array) {
return (array && array.length) ? array[0] : undefined$1;
}
/**
* Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it's used as the
* offset from the end of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.indexOf([1, 2, 1, 2], 2);
* // => 1
*
* // Search from the `fromIndex`.
* _.indexOf([1, 2, 1, 2], 2, 2);
* // => 3
*/
function indexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseIndexOf(array, value, index);
}
/**
* Gets all but the last element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.initial([1, 2, 3]);
* // => [1, 2]
*/
function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
}
/**
* Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersection([2, 1], [2, 3]);
* // => [2]
*/
var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped)
: [];
});
/**
* This method is like `_.intersection` except that it accepts `iteratee`
* which is invoked for each element of each `arrays` to generate the criterion
* by which they're compared. The order and references of result values are
* determined by the first array. The iteratee is invoked with one argument:
* (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
* // => [2.1]
*
* // The `_.property` iteratee shorthand.
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }]
*/
var intersectionBy = baseRest(function(arrays) {
var iteratee = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee === last(mapped)) {
iteratee = undefined$1;
} else {
mapped.pop();
}
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped, getIteratee(iteratee, 2))
: [];
});
/**
* This method is like `_.intersection` except that it accepts `comparator`
* which is invoked to compare elements of `arrays`. The order and references
* of result values are determined by the first array. The comparator is
* invoked with two arguments: (arrVal, othVal).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
*
* _.intersectionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }]
*/
var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
comparator = typeof comparator == 'function' ? comparator : undefined$1;
if (comparator) {
mapped.pop();
}
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped, undefined$1, comparator)
: [];
});
/**
* Converts all elements in `array` into a string separated by `separator`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to convert.
* @param {string} [separator=','] The element separator.
* @returns {string} Returns the joined string.
* @example
*
* _.join(['a', 'b', 'c'], '~');
* // => 'a~b~c'
*/
function join(array, separator) {
return array == null ? '' : nativeJoin.call(array, separator);
}
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined$1;
}
/**
* This method is like `_.indexOf` except that it iterates over elements of
* `array` from right to left.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=array.length-1] The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.lastIndexOf([1, 2, 1, 2], 2);
* // => 3
*
* // Search from the `fromIndex`.
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
* // => 1
*/
function lastIndexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length;
if (fromIndex !== undefined$1) {
index = toInteger(fromIndex);
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
}
return value === value
? strictLastIndexOf(array, value, index)
: baseFindIndex(array, baseIsNaN, index, true);
}
/**
* Gets the element at index `n` of `array`. If `n` is negative, the nth
* element from the end is returned.
*
* @static
* @memberOf _
* @since 4.11.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=0] The index of the element to return.
* @returns {*} Returns the nth element of `array`.
* @example
*
* var array = ['a', 'b', 'c', 'd'];
*
* _.nth(array, 1);
* // => 'b'
*
* _.nth(array, -2);
* // => 'c';
*/
function nth(array, n) {
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined$1;
}
/**
* Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
* to remove elements from an array by predicate.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...*} [values] The values to remove.
* @returns {Array} Returns `array`.
* @example
*
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
*
* _.pull(array, 'a', 'c');
* console.log(array);
* // => ['b', 'b']
*/
var pull = baseRest(pullAll);
/**
* This method is like `_.pull` except that it accepts an array of values to remove.
*
* **Note:** Unlike `_.difference`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @returns {Array} Returns `array`.
* @example
*
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
*
* _.pullAll(array, ['a', 'c']);
* console.log(array);
* // => ['b', 'b']
*/
function pullAll(array, values) {
return (array && array.length && values && values.length)
? basePullAll(array, values)
: array;
}
/**
* This method is like `_.pullAll` except that it accepts `iteratee` which is
* invoked for each element of `array` and `values` to generate the criterion
* by which they're compared. The iteratee is invoked with one argument: (value).
*
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
*
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
*
* _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
* console.log(array);
* // => [{ 'x': 2 }]
*/
function pullAllBy(array, values, iteratee) {
return (array && array.length && values && values.length)
? basePullAll(array, values, getIteratee(iteratee, 2))
: array;
}
/**
* This method is like `_.pullAll` except that it accepts `comparator` which
* is invoked to compare elements of `array` to `values`. The comparator is
* invoked with two arguments: (arrVal, othVal).
*
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns `array`.
* @example
*
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
*
* _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
* console.log(array);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
*/
function pullAllWith(array, values, comparator) {
return (array && array.length && values && values.length)
? basePullAll(array, values, undefined$1, comparator)
: array;
}
/**
* Removes elements from `array` corresponding to `indexes` and returns an
* array of removed elements.
*
* **Note:** Unlike `_.at`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...(number|number[])} [indexes] The indexes of elements to remove.
* @returns {Array} Returns the new array of removed elements.
* @example
*
* var array = ['a', 'b', 'c', 'd'];
* var pulled = _.pullAt(array, [1, 3]);
*
* console.log(array);
* // => ['a', 'c']
*
* console.log(pulled);
* // => ['b', 'd']
*/
var pullAt = flatRest(function(array, indexes) {
var length = array == null ? 0 : array.length,
result = baseAt(array, indexes);
basePullAt(array, arrayMap(indexes, function(index) {
return isIndex(index, length) ? +index : index;
}).sort(compareAscending));
return result;
});
/**
* Removes all elements from `array` that `predicate` returns truthy for
* and returns an array of the removed elements. The predicate is invoked
* with three arguments: (value, index, array).
*
* **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
* to pull elements from an array by value.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
*
* var array = [1, 2, 3, 4];
* var evens = _.remove(array, function(n) {
* return n % 2 == 0;
* });
*
* console.log(array);
* // => [1, 3]
*
* console.log(evens);
* // => [2, 4]
*/
function remove(array, predicate) {
var result = [];
if (!(array && array.length)) {
return result;
}
var index = -1,
indexes = [],
length = array.length;
predicate = getIteratee(predicate, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result;
}
/**
* Reverses `array` so that the first element becomes the last, the second
* element becomes the second to last, and so on.
*
* **Note:** This method mutates `array` and is based on
* [`Array#reverse`](https://mdn.io/Array/reverse).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @returns {Array} Returns `array`.
* @example
*
* var array = [1, 2, 3];
*
* _.reverse(array);
* // => [3, 2, 1]
*
* console.log(array);
* // => [3, 2, 1]
*/
function reverse(array) {
return array == null ? array : nativeReverse.call(array);
}
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
* **Note:** This method is used instead of
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
* returned.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
start = 0;
end = length;
}
else {
start = start == null ? 0 : toInteger(start);
end = end === undefined$1 ? length : toInteger(end);
}
return baseSlice(array, start, end);
}
/**
* Uses a binary search to determine the lowest index at which `value`
* should be inserted into `array` in order to maintain its sort order.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* _.sortedIndex([30, 50], 40);
* // => 1
*/
function sortedIndex(array, value) {
return baseSortedIndex(array, value);
}
/**
* This method is like `_.sortedIndex` except that it accepts `iteratee`
* which is invoked for `value` and each element of `array` to compute their
* sort ranking. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* var objects = [{ 'x': 4 }, { 'x': 5 }];
*
* _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.sortedIndexBy(objects, { 'x': 4 }, 'x');
* // => 0
*/
function sortedIndexBy(array, value, iteratee) {
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
}
/**
* This method is like `_.indexOf` except that it performs a binary
* search on a sorted `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.sortedIndexOf([4, 5, 5, 5, 6], 5);
* // => 1
*/
function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
}
/**
* This method is like `_.sortedIndex` except that it returns the highest
* index at which `value` should be inserted into `array` in order to
* maintain its sort order.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
* // => 4
*/
function sortedLastIndex(array, value) {
return baseSortedIndex(array, value, true);
}
/**
* This method is like `_.sortedLastIndex` except that it accepts `iteratee`
* which is invoked for `value` and each element of `array` to compute their
* sort ranking. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* var objects = [{ 'x': 4 }, { 'x': 5 }];
*
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
* // => 1
*
* // The `_.property` iteratee shorthand.
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
* // => 1
*/
function sortedLastIndexBy(array, value, iteratee) {
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
}
/**
* This method is like `_.lastIndexOf` except that it performs a binary
* search on a sorted `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
* // => 3
*/
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}
}
return -1;
}
/**
* This method is like `_.uniq` except that it's designed and optimized
* for sorted arrays.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.sortedUniq([1, 1, 2]);
* // => [1, 2]
*/
function sortedUniq(array) {
return (array && array.length)
? baseSortedUniq(array)
: [];
}
/**
* This method is like `_.uniqBy` except that it's designed and optimized
* for sorted arrays.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
* // => [1.1, 2.3]
*/
function sortedUniqBy(array, iteratee) {
return (array && array.length)
? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
}
/**
* Gets all but the first element of `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.tail([1, 2, 3]);
* // => [2, 3]
*/
function tail(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}
/**
* Creates a slice of `array` with `n` elements taken from the beginning.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.take([1, 2, 3]);
* // => [1]
*
* _.take([1, 2, 3], 2);
* // => [1, 2]
*
* _.take([1, 2, 3], 5);
* // => [1, 2, 3]
*
* _.take([1, 2, 3], 0);
* // => []
*/
function take(array, n, guard) {
if (!(array && array.length)) {
return [];
}
n = (guard || n === undefined$1) ? 1 : toInteger(n);
return baseSlice(array, 0, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` with `n` elements taken from the end.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.takeRight([1, 2, 3]);
* // => [3]
*
* _.takeRight([1, 2, 3], 2);
* // => [2, 3]
*
* _.takeRight([1, 2, 3], 5);
* // => [1, 2, 3]
*
* _.takeRight([1, 2, 3], 0);
* // => []
*/
function takeRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined$1) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, n < 0 ? 0 : n, length);
}
/**
* Creates a slice of `array` with elements taken from the end. Elements are
* taken until `predicate` returns falsey. The predicate is invoked with
* three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* _.takeRightWhile(users, function(o) { return !o.active; });
* // => objects for ['fred', 'pebbles']
*
* // The `_.matches` iteratee shorthand.
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
* // => objects for ['pebbles']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.takeRightWhile(users, ['active', false]);
* // => objects for ['fred', 'pebbles']
*
* // The `_.property` iteratee shorthand.
* _.takeRightWhile(users, 'active');
* // => []
*/
function takeRightWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, getIteratee(predicate, 3), false, true)
: [];
}
/**
* Creates a slice of `array` with elements taken from the beginning. Elements
* are taken until `predicate` returns falsey. The predicate is invoked with
* three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.takeWhile(users, function(o) { return !o.active; });
* // => objects for ['barney', 'fred']
*
* // The `_.matches` iteratee shorthand.
* _.takeWhile(users, { 'user': 'barney', 'active': false });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.takeWhile(users, ['active', false]);
* // => objects for ['barney', 'fred']
*
* // The `_.property` iteratee shorthand.
* _.takeWhile(users, 'active');
* // => []
*/
function takeWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, getIteratee(predicate, 3))
: [];
}
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/**
* This method is like `_.union` except that it accepts `iteratee` which is
* invoked for each element of each `arrays` to generate the criterion by
* which uniqueness is computed. Result values are chosen from the first
* array in which the value occurs. The iteratee is invoked with one argument:
* (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
* // => [2.1, 1.2]
*
* // The `_.property` iteratee shorthand.
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
var unionBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined$1;
}
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
});
/**
* This method is like `_.union` except that it accepts `comparator` which
* is invoked to compare elements of `arrays`. Result values are chosen from
* the first array in which the value occurs. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
*
* _.unionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == 'function' ? comparator : undefined$1;
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator);
});
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? baseUniq(array) : [];
}
/**
* This method is like `_.uniq` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the criterion by which
* uniqueness is computed. The order of result values is determined by the
* order they occur in the array. The iteratee is invoked with one argument:
* (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniqBy([2.1, 1.2, 2.3], Math.floor);
* // => [2.1, 1.2]
*
* // The `_.property` iteratee shorthand.
* _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
function uniqBy(array, iteratee) {
return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
}
/**
* This method is like `_.uniq` except that it accepts `comparator` which
* is invoked to compare elements of `array`. The order of result values is
* determined by the order they occur in the array.The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
*
* _.uniqWith(objects, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
*/
function uniqWith(array, comparator) {
comparator = typeof comparator == 'function' ? comparator : undefined$1;
return (array && array.length) ? baseUniq(array, undefined$1, comparator) : [];
}
/**
* This method is like `_.zip` except that it accepts an array of grouped
* elements and creates an array regrouping the elements to their pre-zip
* configuration.
*
* @static
* @memberOf _
* @since 1.2.0
* @category Array
* @param {Array} array The array of grouped elements to process.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
* var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
* // => [['a', 1, true], ['b', 2, false]]
*
* _.unzip(zipped);
* // => [['a', 'b'], [1, 2], [true, false]]
*/
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(length, function(index) {
return arrayMap(array, baseProperty(index));
});
}
/**
* This method is like `_.unzip` except that it accepts `iteratee` to specify
* how regrouped values should be combined. The iteratee is invoked with the
* elements of each group: (...group).
*
* @static
* @memberOf _
* @since 3.8.0
* @category Array
* @param {Array} array The array of grouped elements to process.
* @param {Function} [iteratee=_.identity] The function to combine
* regrouped values.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
* // => [[1, 10, 100], [2, 20, 200]]
*
* _.unzipWith(zipped, _.add);
* // => [3, 30, 300]
*/
function unzipWith(array, iteratee) {
if (!(array && array.length)) {
return [];
}
var result = unzip(array);
if (iteratee == null) {
return result;
}
return arrayMap(result, function(group) {
return apply(iteratee, undefined$1, group);
});
}
/**
* Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.pull`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.xor
* @example
*
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
});
/**
* Creates an array of unique values that is the
* [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
* of the given arrays. The order of result values is determined by the order
* they occur in the arrays.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.without
* @example
*
* _.xor([2, 1], [2, 3]);
* // => [1, 3]
*/
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
/**
* This method is like `_.xor` except that it accepts `iteratee` which is
* invoked for each element of each `arrays` to generate the criterion by
* which by which they're compared. The order of result values is determined
* by the order they occur in the arrays. The iteratee is invoked with one
* argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
* // => [1.2, 3.4]
*
* // The `_.property` iteratee shorthand.
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
var xorBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined$1;
}
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
});
/**
* This method is like `_.xor` except that it accepts `comparator` which is
* invoked to compare elements of `arrays`. The order of result values is
* determined by the order they occur in the arrays. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
*
* _.xorWith(objects, others, _.isEqual);
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == 'function' ? comparator : undefined$1;
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator);
});
/**
* Creates an array of grouped elements, the first of which contains the
* first elements of the given arrays, the second of which contains the
* second elements of the given arrays, and so on.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @returns {Array} Returns the new array of grouped elements.
* @example
*
* _.zip(['a', 'b'], [1, 2], [true, false]);
* // => [['a', 1, true], ['b', 2, false]]
*/
var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/**
* This method is like `_.zipObject` except that it supports property paths.
*
* @static
* @memberOf _
* @since 4.1.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
*/
function zipObjectDeep(props, values) {
return baseZipObject(props || [], values || [], baseSet);
}
/**
* This method is like `_.zip` except that it accepts `iteratee` to specify
* how grouped values should be combined. The iteratee is invoked with the
* elements of each group: (...group).
*
* @static
* @memberOf _
* @since 3.8.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @param {Function} [iteratee=_.identity] The function to combine
* grouped values.
* @returns {Array} Returns the new array of grouped elements.
* @example
*
* _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
* return a + b + c;
* });
* // => [111, 222]
*/
var zipWith = baseRest(function(arrays) {
var length = arrays.length,
iteratee = length > 1 ? arrays[length - 1] : undefined$1;
iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined$1;
return unzipWith(arrays, iteratee);
});
/*------------------------------------------------------------------------*/
/**
* Creates a `lodash` wrapper instance that wraps `value` with explicit method
* chain sequences enabled. The result of such sequences must be unwrapped
* with `_#value`.
*
* @static
* @memberOf _
* @since 1.3.0
* @category Seq
* @param {*} value The value to wrap.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'pebbles', 'age': 1 }
* ];
*
* var youngest = _
* .chain(users)
* .sortBy('age')
* .map(function(o) {
* return o.user + ' is ' + o.age;
* })
* .head()
* .value();
* // => 'pebbles is 1'
*/
function chain(value) {
var result = lodash(value);
result.__chain__ = true;
return result;
}
/**
* This method invokes `interceptor` and returns `value`. The interceptor
* is invoked with one argument; (value). The purpose of this method is to
* "tap into" a method chain sequence in order to modify intermediate results.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
* @returns {*} Returns `value`.
* @example
*
* _([1, 2, 3])
* .tap(function(array) {
* // Mutate input array.
* array.pop();
* })
* .reverse()
* .value();
* // => [2, 1]
*/
function tap(value, interceptor) {
interceptor(value);
return value;
}
/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
* The purpose of this method is to "pass thru" values replacing intermediate
* results in a method chain sequence.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
* @returns {*} Returns the result of `interceptor`.
* @example
*
* _(' abc ')
* .chain()
* .trim()
* .thru(function(value) {
* return [value];
* })
* .value();
* // => ['abc']
*/
function thru(value, interceptor) {
return interceptor(value);
}
/**
* This method is the wrapper version of `_.at`.
*
* @name at
* @memberOf _
* @since 1.0.0
* @category Seq
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _(object).at(['a[0].b.c', 'a[1]']).value();
* // => [3, 4]
*/
var wrapperAt = flatRest(function(paths) {
var length = paths.length,
start = length ? paths[0] : 0,
value = this.__wrapped__,
interceptor = function(object) { return baseAt(object, paths); };
if (length > 1 || this.__actions__.length ||
!(value instanceof LazyWrapper) || !isIndex(start)) {
return this.thru(interceptor);
}
value = value.slice(start, +start + (length ? 1 : 0));
value.__actions__.push({
'func': thru,
'args': [interceptor],
'thisArg': undefined$1
});
return new LodashWrapper(value, this.__chain__).thru(function(array) {
if (length && !array.length) {
array.push(undefined$1);
}
return array;
});
});
/**
* Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
*
* @name chain
* @memberOf _
* @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* // A sequence without explicit chaining.
* _(users).head();
* // => { 'user': 'barney', 'age': 36 }
*
* // A sequence with explicit chaining.
* _(users)
* .chain()
* .head()
* .pick('user')
* .value();
* // => { 'user': 'barney' }
*/
function wrapperChain() {
return chain(this);
}
/**
* Executes the chain sequence and returns the wrapped result.
*
* @name commit
* @memberOf _
* @since 3.2.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var array = [1, 2];
* var wrapped = _(array).push(3);
*
* console.log(array);
* // => [1, 2]
*
* wrapped = wrapped.commit();
* console.log(array);
* // => [1, 2, 3]
*
* wrapped.last();
* // => 3
*
* console.log(array);
* // => [1, 2, 3]
*/
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
/**
* Gets the next value on a wrapped object following the
* [iterator protocol](https://mdn.io/iteration_protocols#iterator).
*
* @name next
* @memberOf _
* @since 4.0.0
* @category Seq
* @returns {Object} Returns the next iterator value.
* @example
*
* var wrapped = _([1, 2]);
*
* wrapped.next();
* // => { 'done': false, 'value': 1 }
*
* wrapped.next();
* // => { 'done': false, 'value': 2 }
*
* wrapped.next();
* // => { 'done': true, 'value': undefined }
*/
function wrapperNext() {
if (this.__values__ === undefined$1) {
this.__values__ = toArray(this.value());
}
var done = this.__index__ >= this.__values__.length,
value = done ? undefined$1 : this.__values__[this.__index__++];
return { 'done': done, 'value': value };
}
/**
* Enables the wrapper to be iterable.
*
* @name Symbol.iterator
* @memberOf _
* @since 4.0.0
* @category Seq
* @returns {Object} Returns the wrapper object.
* @example
*
* var wrapped = _([1, 2]);
*
* wrapped[Symbol.iterator]() === wrapped;
* // => true
*
* Array.from(wrapped);
* // => [1, 2]
*/
function wrapperToIterator() {
return this;
}
/**
* Creates a clone of the chain sequence planting `value` as the wrapped value.
*
* @name plant
* @memberOf _
* @since 3.2.0
* @category Seq
* @param {*} value The value to plant.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var wrapped = _([1, 2]).map(square);
* var other = wrapped.plant([3, 4]);
*
* other.value();
* // => [9, 16]
*
* wrapped.value();
* // => [1, 4]
*/
function wrapperPlant(value) {
var result,
parent = this;
while (parent instanceof baseLodash) {
var clone = wrapperClone(parent);
clone.__index__ = 0;
clone.__values__ = undefined$1;
if (result) {
previous.__wrapped__ = clone;
} else {
result = clone;
}
var previous = clone;
parent = parent.__wrapped__;
}
previous.__wrapped__ = value;
return result;
}
/**
* This method is the wrapper version of `_.reverse`.
*
* **Note:** This method mutates the wrapped array.
*
* @name reverse
* @memberOf _
* @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var array = [1, 2, 3];
*
* _(array).reverse().value()
* // => [3, 2, 1]
*
* console.log(array);
* // => [3, 2, 1]
*/
function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
'func': thru,
'args': [reverse],
'thisArg': undefined$1
});
return new LodashWrapper(wrapped, this.__chain__);
}
return this.thru(reverse);
}
/**
* Executes the chain sequence to resolve the unwrapped value.
*
* @name value
* @memberOf _
* @since 0.1.0
* @alias toJSON, valueOf
* @category Seq
* @returns {*} Returns the resolved unwrapped value.
* @example
*
* _([1, 2, 3]).value();
* // => [1, 2, 3]
*/
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
/*------------------------------------------------------------------------*/
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the number of times the key was returned by `iteratee`. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.countBy([6.1, 4.2, 6.3], Math.floor);
* // => { '4': 1, '6': 2 }
*
* // The `_.property` iteratee shorthand.
* _.countBy(['one', 'two', 'three'], 'length');
* // => { '3': 2, '5': 1 }
*/
var countBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
++result[key];
} else {
baseAssignValue(result, key, 1);
}
});
/**
* Checks if `predicate` returns truthy for **all** elements of `collection`.
* Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* **Note:** This method returns `true` for
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
* elements of empty collections.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
* @example
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.every(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.every(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.every(users, 'active');
* // => false
*/
function every(collection, predicate, guard) {
var func = isArray(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined$1;
}
return func(collection, getIteratee(predicate, 3));
}
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*/
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = createFind(findIndex);
/**
* This method is like `_.find` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=collection.length-1] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* _.findLast([1, 2, 3, 4], function(n) {
* return n % 2 == 1;
* });
* // => 3
*/
var findLast = createFind(findLastIndex);
/**
* Creates a flattened array of values by running each element in `collection`
* thru `iteratee` and flattening the mapped results. The iteratee is invoked
* with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
* function duplicate(n) {
* return [n, n];
* }
*
* _.flatMap([1, 2], duplicate);
* // => [1, 1, 2, 2]
*/
function flatMap(collection, iteratee) {
return baseFlatten(map(collection, iteratee), 1);
}
/**
* This method is like `_.flatMap` except that it recursively flattens the
* mapped results.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
* function duplicate(n) {
* return [[[n, n]]];
* }
*
* _.flatMapDeep([1, 2], duplicate);
* // => [1, 1, 2, 2]
*/
function flatMapDeep(collection, iteratee) {
return baseFlatten(map(collection, iteratee), INFINITY);
}
/**
* This method is like `_.flatMap` except that it recursively flattens the
* mapped results up to `depth` times.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
* @example
*
* function duplicate(n) {
* return [[[n, n]]];
* }
*
* _.flatMapDepth([1, 2], duplicate, 2);
* // => [[1, 1], [2, 2]]
*/
function flatMapDepth(collection, iteratee, depth) {
depth = depth === undefined$1 ? 1 : toInteger(depth);
return baseFlatten(map(collection, iteratee), depth);
}
/**
* Iterates over elements of `collection` and invokes `iteratee` for each element.
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* **Note:** As with other "Collections" methods, objects with a "length"
* property are iterated like arrays. To avoid this behavior use `_.forIn`
* or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
* @see _.forEachRight
* @example
*
* _.forEach([1, 2], function(value) {
* console.log(value);
* });
* // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
var func = isArray(collection) ? arrayEach : baseEach;
return func(collection, getIteratee(iteratee, 3));
}
/**
* This method is like `_.forEach` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @since 2.0.0
* @alias eachRight
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
* @see _.forEach
* @example
*
* _.forEachRight([1, 2], function(value) {
* console.log(value);
* });
* // => Logs `2` then `1`.
*/
function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee, 3));
}
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The order of grouped values
* is determined by the order they occur in `collection`. The corresponding
* value of each key is an array of elements responsible for generating the
* key. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
* // => { '4': [4.2], '6': [6.1, 6.3] }
*
* // The `_.property` iteratee shorthand.
* _.groupBy(['one', 'two', 'three'], 'length');
* // => { '3': ['one', 'two'], '5': ['three'] }
*/
var groupBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
result[key].push(value);
} else {
baseAssignValue(result, key, [value]);
}
});
/**
* Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
* @example
*
* _.includes([1, 2, 3], 1);
* // => true
*
* _.includes([1, 2, 3], 1, 2);
* // => false
*
* _.includes({ 'a': 1, 'b': 2 }, 1);
* // => true
*
* _.includes('abcd', 'bc');
* // => true
*/
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike(collection) ? collection : values(collection);
fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax(length + fromIndex, 0);
}
return isString(collection)
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
: (!!length && baseIndexOf(collection, value, fromIndex) > -1);
}
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
* are provided to each invoked method. If `path` is a function, it's invoked
* for, and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array|Function|string} path The path of the method to invoke or
* the function invoked per iteration.
* @param {...*} [args] The arguments to invoke each method with.
* @returns {Array} Returns the array of results.
* @example
*
* _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
* // => [[1, 5, 7], [1, 2, 3]]
*
* _.invokeMap([123, 456], String.prototype.split, '');
* // => [['1', '2', '3'], ['4', '5', '6']]
*/
var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path == 'function',
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) {
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
});
return result;
});
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* var array = [
* { 'dir': 'left', 'code': 97 },
* { 'dir': 'right', 'code': 100 }
* ];
*
* _.keyBy(array, function(o) {
* return String.fromCharCode(o.code);
* });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(array, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*/
var keyBy = createAggregator(function(result, value, key) {
baseAssignValue(result, key, value);
});
/**
* Creates an array of values by running each element in `collection` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
* function square(n) {
* return n * n;
* }
*
* _.map([4, 8], square);
* // => [16, 64]
*
* _.map({ 'a': 4, 'b': 8 }, square);
* // => [16, 64] (iteration order is not guaranteed)
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
function map(collection, iteratee) {
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee, 3));
}
/**
* This method is like `_.sortBy` except that it allows specifying the sort
* orders of the iteratees to sort by. If `orders` is unspecified, all values
* are sorted in ascending order. Otherwise, specify an order of "desc" for
* descending or "asc" for ascending sort order of corresponding values.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
* The iteratees to sort by.
* @param {string[]} [orders] The sort orders of `iteratees`.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 34 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 36 }
* ];
*
* // Sort by `user` in ascending order and by `age` in descending order.
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined$1 : orders;
if (!isArray(orders)) {
orders = orders == null ? [] : [orders];
}
return baseOrderBy(collection, iteratees, orders);
}
/**
* Creates an array of elements split into two groups, the first of which
* contains elements `predicate` returns truthy for, the second of which
* contains elements `predicate` returns falsey for. The predicate is
* invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of grouped elements.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': true },
* { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
* _.partition(users, function(o) { return o.active; });
* // => objects for [['fred'], ['barney', 'pebbles']]
*
* // The `_.matches` iteratee shorthand.
* _.partition(users, { 'age': 1, 'active': false });
* // => objects for [['pebbles'], ['barney', 'fred']]
*
* // The `_.matchesProperty` iteratee shorthand.
* _.partition(users, ['active', false]);
* // => objects for [['barney', 'pebbles'], ['fred']]
*
* // The `_.property` iteratee shorthand.
* _.partition(users, 'active');
* // => objects for [['fred'], ['barney', 'pebbles']]
*/
var partition = createAggregator(function(result, value, key) {
result[key ? 0 : 1].push(value);
}, function() { return [[], []]; });
/**
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` thru `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator`
* is not given, the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.reduce`, `_.reduceRight`, and `_.transform`.
*
* The guarded methods are:
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
* and `sortBy`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
* @see _.reduceRight
* @example
*
* _.reduce([1, 2], function(sum, n) {
* return sum + n;
* }, 0);
* // => 3
*
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
* (result[value] || (result[value] = [])).push(key);
* return result;
* }, {});
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
*/
function reduce(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduce : baseReduce,
initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
}
/**
* This method is like `_.reduce` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
* @see _.reduce
* @example
*
* var array = [[0, 1], [2, 3], [4, 5]];
*
* _.reduceRight(array, function(flattened, other) {
* return flattened.concat(other);
* }, []);
* // => [4, 5, 2, 3, 0, 1]
*/
function reduceRight(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce,
initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
}
/**
* The opposite of `_.filter`; this method returns the elements of `collection`
* that `predicate` does **not** return truthy for.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.filter
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* _.reject(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.reject(users, { 'age': 40, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.reject(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.reject(users, 'active');
* // => objects for ['barney']
*/
function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, negate(getIteratee(predicate, 3)));
}
/**
* Gets a random element from `collection`.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
* @returns {*} Returns the random element.
* @example
*
* _.sample([1, 2, 3, 4]);
* // => 2
*/
function sample(collection) {
var func = isArray(collection) ? arraySample : baseSample;
return func(collection);
}
/**
* Gets `n` random elements at unique keys from `collection` up to the
* size of `collection`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
* @param {number} [n=1] The number of elements to sample.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the random elements.
* @example
*
* _.sampleSize([1, 2, 3], 2);
* // => [3, 1]
*
* _.sampleSize([1, 2, 3], 4);
* // => [2, 3, 1]
*/
function sampleSize(collection, n, guard) {
if ((guard ? isIterateeCall(collection, n, guard) : n === undefined$1)) {
n = 1;
} else {
n = toInteger(n);
}
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n);
}
/**
* Creates an array of shuffled values, using a version of the
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to shuffle.
* @returns {Array} Returns the new shuffled array.
* @example
*
* _.shuffle([1, 2, 3, 4]);
* // => [4, 1, 3, 2]
*/
function shuffle(collection) {
var func = isArray(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
/**
* Gets the size of `collection` by returning its length for array-like
* values or the number of own enumerable string keyed properties for objects.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @returns {number} Returns the collection size.
* @example
*
* _.size([1, 2, 3]);
* // => 3
*
* _.size({ 'a': 1, 'b': 2 });
* // => 2
*
* _.size('pebbles');
* // => 7
*/
function size(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike(collection)) {
return isString(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}
return baseKeys(collection).length;
}
/**
* Checks if `predicate` returns truthy for **any** element of `collection`.
* Iteration is stopped once `predicate` returns truthy. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
* // => true
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.some(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.some(users, 'active');
* // => true
*/
function some(collection, predicate, guard) {
var func = isArray(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined$1;
}
return func(collection, getIteratee(predicate, 3));
}
/**
* Creates an array of elements, sorted in ascending order by the results of
* running each element in a collection thru each iteratee. This method
* performs a stable sort, that is, it preserves the original sort order of
* equal elements. The iteratees are invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {...(Function|Function[])} [iteratees=[_.identity]]
* The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.sortBy(users, [function(o) { return o.user; }]);
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*
* _.sortBy(users, ['user', 'age']);
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
*/
var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length = iteratees.length;
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
/*------------------------------------------------------------------------*/
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = ctxNow || function() {
return root.Date.now();
};
/*------------------------------------------------------------------------*/
/**
* The opposite of `_.before`; this method creates a function that invokes
* `func` once it's called `n` or more times.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {number} n The number of calls before `func` is invoked.
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* var saves = ['profile', 'settings'];
*
* var done = _.after(saves.length, function() {
* console.log('done saving!');
* });
*
* _.forEach(saves, function(type) {
* asyncSave({ 'type': type, 'complete': done });
* });
* // => Logs 'done saving!' after the two async saves have completed.
*/
function after(n, func) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
/**
* Creates a function that invokes `func`, with up to `n` arguments,
* ignoring any additional arguments.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new capped function.
* @example
*
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
* // => [6, 8, 10]
*/
function ary(func, n, guard) {
n = guard ? undefined$1 : n;
n = (func && n == null) ? func.length : n;
return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n);
}
/**
* Creates a function that invokes `func`, with the `this` binding and arguments
* of the created function, while it's called less than `n` times. Subsequent
* calls to the created function return the result of the last `func` invocation.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Function
* @param {number} n The number of calls at which `func` is no longer invoked.
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* jQuery(element).on('click', _.before(5, addContactToList));
* // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined$1;
}
return result;
};
}
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
* and `partials` prepended to the arguments it receives.
*
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for partially applied arguments.
*
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
* property of bound functions.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* }
*
* var object = { 'user': 'fred' };
*
* var bound = _.bind(greet, object, 'hi');
* bound('!');
* // => 'hi fred!'
*
* // Bound with placeholders.
* var bound = _.bind(greet, object, _, '!');
* bound('hi');
* // => 'hi fred!'
*/
var bind = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
/**
* Creates a function that invokes the method at `object[key]` with `partials`
* prepended to the arguments it receives.
*
* This method differs from `_.bind` by allowing bound functions to reference
* methods that may be redefined or don't yet exist. See
* [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
* for more details.
*
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* @static
* @memberOf _
* @since 0.10.0
* @category Function
* @param {Object} object The object to invoke the method on.
* @param {string} key The key of the method.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* var object = {
* 'user': 'fred',
* 'greet': function(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* }
* };
*
* var bound = _.bindKey(object, 'greet', 'hi');
* bound('!');
* // => 'hi fred!'
*
* object.greet = function(greeting, punctuation) {
* return greeting + 'ya ' + this.user + punctuation;
* };
*
* bound('!');
* // => 'hiya fred!'
*
* // Bound with placeholders.
* var bound = _.bindKey(object, 'greet', _, '!');
* bound('hi');
* // => 'hiya fred!'
*/
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
/**
* Creates a function that accepts arguments of `func` and either invokes
* `func` returning its result, if at least `arity` number of arguments have
* been provided, or returns a function that accepts the remaining `func`
* arguments, and so on. The arity of `func` may be specified if `func.length`
* is not sufficient.
*
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for provided arguments.
*
* **Note:** This method doesn't set the "length" property of curried functions.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
* var abc = function(a, b, c) {
* return [a, b, c];
* };
*
* var curried = _.curry(abc);
*
* curried(1)(2)(3);
* // => [1, 2, 3]
*
* curried(1, 2)(3);
* // => [1, 2, 3]
*
* curried(1, 2, 3);
* // => [1, 2, 3]
*
* // Curried with placeholders.
* curried(1)(_, 3)(2);
* // => [1, 2, 3]
*/
function curry(func, arity, guard) {
arity = guard ? undefined$1 : arity;
var result = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
result.placeholder = curry.placeholder;
return result;
}
/**
* This method is like `_.curry` except that arguments are applied to `func`
* in the manner of `_.partialRight` instead of `_.partial`.
*
* The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for provided arguments.
*
* **Note:** This method doesn't set the "length" property of curried functions.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
* var abc = function(a, b, c) {
* return [a, b, c];
* };
*
* var curried = _.curryRight(abc);
*
* curried(3)(2)(1);
* // => [1, 2, 3]
*
* curried(2, 3)(1);
* // => [1, 2, 3]
*
* curried(1, 2, 3);
* // => [1, 2, 3]
*
* // Curried with placeholders.
* curried(3)(1, _)(2);
* // => [1, 2, 3]
*/
function curryRight(func, arity, guard) {
arity = guard ? undefined$1 : arity;
var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
result.placeholder = curryRight.placeholder;
return result;
}
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=false]
* Specify invoking on the leading edge of the timeout.
* @param {number} [options.maxWait]
* The maximum time `func` is allowed to be delayed before it's invoked.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
* var source = new EventSource('/stream');
* jQuery(source).on('message', debounced);
*
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined$1;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time;
// Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait);
// Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
timeWaiting = wait - timeSinceLastCall;
return maxing
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
: timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return (lastCallTime === undefined$1 || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
// Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined$1;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined$1;
return result;
}
function cancel() {
if (timerId !== undefined$1) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined$1;
}
function flush() {
return timerId === undefined$1 ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined$1) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined$1) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
/**
* Defers invoking the `func` until the current call stack has cleared. Any
* additional arguments are provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to defer.
* @param {...*} [args] The arguments to invoke `func` with.
* @returns {number} Returns the timer id.
* @example
*
* _.defer(function(text) {
* console.log(text);
* }, 'deferred');
* // => Logs 'deferred' after one millisecond.
*/
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
/**
* Invokes `func` after `wait` milliseconds. Any additional arguments are
* provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {...*} [args] The arguments to invoke `func` with.
* @returns {number} Returns the timer id.
* @example
*
* _.delay(function(text) {
* console.log(text);
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
/**
* Creates a function that invokes `func` with arguments reversed.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Function
* @param {Function} func The function to flip arguments for.
* @returns {Function} Returns the new flipped function.
* @example
*
* var flipped = _.flip(function() {
* return _.toArray(arguments);
* });
*
* flipped('a', 'b', 'c', 'd');
* // => ['d', 'c', 'b', 'a']
*/
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Expose `MapCache`.
memoize.Cache = MapCache;
/**
* Creates a function that negates the result of the predicate `func`. The
* `func` predicate is invoked with the `this` binding and arguments of the
* created function.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Function
* @param {Function} predicate The predicate to negate.
* @returns {Function} Returns the new negated function.
* @example
*
* function isEven(n) {
* return n % 2 == 0;
* }
*
* _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
* // => [1, 3, 5]
*/
function negate(predicate) {
if (typeof predicate != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0: return !predicate.call(this);
case 1: return !predicate.call(this, args[0]);
case 2: return !predicate.call(this, args[0], args[1]);
case 3: return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
}
/**
* Creates a function that is restricted to invoking `func` once. Repeat calls
* to the function return the value of the first invocation. The `func` is
* invoked with the `this` binding and arguments of the created function.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* var initialize = _.once(createApplication);
* initialize();
* initialize();
* // => `createApplication` is invoked once
*/
function once(func) {
return before(2, func);
}
/**
* Creates a function that invokes `func` with its arguments transformed.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
* @param {...(Function|Function[])} [transforms=[_.identity]]
* The argument transforms.
* @returns {Function} Returns the new function.
* @example
*
* function doubled(n) {
* return n * 2;
* }
*
* function square(n) {
* return n * n;
* }
*
* var func = _.overArgs(function(x, y) {
* return [x, y];
* }, [square, doubled]);
*
* func(9, 3);
* // => [81, 6]
*
* func(10, 5);
* // => [100, 10]
*/
var overArgs = castRest(function(func, transforms) {
transforms = (transforms.length == 1 && isArray(transforms[0]))
? arrayMap(transforms[0], baseUnary(getIteratee()))
: arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return baseRest(function(args) {
var index = -1,
length = nativeMin(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}
return apply(func, this, args);
});
});
/**
* Creates a function that invokes `func` with `partials` prepended to the
* arguments it receives. This method is like `_.bind` except it does **not**
* alter the `this` binding.
*
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method doesn't set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @since 0.2.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* function greet(greeting, name) {
* return greeting + ' ' + name;
* }
*
* var sayHelloTo = _.partial(greet, 'hello');
* sayHelloTo('fred');
* // => 'hello fred'
*
* // Partially applied with placeholders.
* var greetFred = _.partial(greet, _, 'fred');
* greetFred('hi');
* // => 'hi fred'
*/
var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders);
});
/**
* This method is like `_.partial` except that partially applied arguments
* are appended to the arguments it receives.
*
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method doesn't set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* function greet(greeting, name) {
* return greeting + ' ' + name;
* }
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
* // => 'hi fred'
*
* // Partially applied with placeholders.
* var sayHelloTo = _.partialRight(greet, 'hello', _);
* sayHelloTo('fred');
* // => 'hello fred'
*/
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders);
});
/**
* Creates a function that invokes `func` with arguments arranged according
* to the specified `indexes` where the argument value at the first index is
* provided as the first argument, the argument value at the second index is
* provided as the second argument, and so on.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Function
* @param {Function} func The function to rearrange arguments for.
* @param {...(number|number[])} indexes The arranged argument indexes.
* @returns {Function} Returns the new function.
* @example
*
* var rearged = _.rearg(function(a, b, c) {
* return [a, b, c];
* }, [2, 0, 1]);
*
* rearged('b', 'c', 'a')
* // => ['a', 'b', 'c']
*/
var rearg = flatRest(function(func, indexes) {
return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes);
});
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as
* an array.
*
* **Note:** This method is based on the
* [rest parameter](https://mdn.io/rest_parameters).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.rest(function(what, names) {
* return what + ' ' + _.initial(names).join(', ') +
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
* });
*
* say('hello', 'fred', 'barney', 'pebbles');
* // => 'hello fred, barney, & pebbles'
*/
function rest(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start === undefined$1 ? start : toInteger(start);
return baseRest(func, start);
}
/**
* Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
*
* **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator).
*
* @static
* @memberOf _
* @since 3.2.0
* @category Function
* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.spread(function(who, what) {
* return who + ' says ' + what;
* });
*
* say(['fred', 'hello']);
* // => 'fred says hello'
*
* var numbers = Promise.all([
* Promise.resolve(40),
* Promise.resolve(36)
* ]);
*
* numbers.then(_.spread(function(x, y) {
* return x + y;
* }));
* // => a Promise of 76
*/
function spread(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide `options` to indicate whether `func`
* should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=true]
* Specify invoking on the leading edge of the timeout.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // Avoid excessively updating the position while scrolling.
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
* jQuery(element).on('click', throttled);
*
* // Cancel the trailing throttled invocation.
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
}
/**
* Creates a function that accepts up to one argument, ignoring any
* additional arguments.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
* @example
*
* _.map(['6', '8', '10'], _.unary(parseInt));
* // => [6, 8, 10]
*/
function unary(func) {
return ary(func, 1);
}
/**
* Creates a function that provides `value` to `wrapper` as its first
* argument. Any additional arguments provided to the function are appended
* to those provided to the `wrapper`. The wrapper is invoked with the `this`
* binding of the created function.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {*} value The value to wrap.
* @param {Function} [wrapper=identity] The wrapper function.
* @returns {Function} Returns the new function.
* @example
*
* var p = _.wrap(_.escape, function(func, text) {
* return '<p>' + func(text) + '</p>';
* });
*
* p('fred, barney, & pebbles');
* // => '<p>fred, barney, &amp; pebbles</p>'
*/
function wrap(value, wrapper) {
return partial(castFunction(wrapper), value);
}
/*------------------------------------------------------------------------*/
/**
* Casts `value` as an array if it's not one.
*
* @static
* @memberOf _
* @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
* @example
*
* _.castArray(1);
* // => [1]
*
* _.castArray({ 'a': 1 });
* // => [{ 'a': 1 }]
*
* _.castArray('abc');
* // => ['abc']
*
* _.castArray(null);
* // => [null]
*
* _.castArray(undefined);
* // => [undefined]
*
* _.castArray();
* // => []
*
* var array = [1, 2, 3];
* console.log(_.castArray(array) === array);
* // => true
*/
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
/**
* Creates a shallow clone of `value`.
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
* and supports cloning arrays, array buffers, booleans, date objects, maps,
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
* arrays. The own enumerable properties of `arguments` objects are cloned
* as plain objects. An empty object is returned for uncloneable values such
* as error objects, functions, DOM nodes, and WeakMaps.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
* @see _.cloneDeep
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var shallow = _.clone(objects);
* console.log(shallow[0] === objects[0]);
* // => true
*/
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
/**
* This method is like `_.clone` except that it accepts `customizer` which
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
* cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the cloned value.
* @see _.cloneDeepWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* }
*
* var el = _.cloneWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 0
*/
function cloneWith(value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}
/**
* This method is like `_.clone` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
* @see _.clone
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var deep = _.cloneDeep(objects);
* console.log(deep[0] === objects[0]);
* // => false
*/
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
/**
* This method is like `_.cloneWith` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the deep cloned value.
* @see _.cloneWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(true);
* }
* }
*
* var el = _.cloneDeepWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 20
*/
function cloneDeepWith(value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
}
/**
* Checks if `object` conforms to `source` by invoking the predicate
* properties of `source` with the corresponding property values of `object`.
*
* **Note:** This method is equivalent to `_.conforms` when `source` is
* partially applied.
*
* @static
* @memberOf _
* @since 4.14.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property predicates to conform to.
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
* @example
*
* var object = { 'a': 1, 'b': 2 };
*
* _.conformsTo(object, { 'b': function(n) { return n > 1; } });
* // => true
*
* _.conformsTo(object, { 'b': function(n) { return n > 2; } });
* // => false
*/
function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is greater than `other`.
*
* @static
* @memberOf _
* @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than `other`,
* else `false`.
* @see _.lt
* @example
*
* _.gt(3, 1);
* // => true
*
* _.gt(3, 3);
* // => false
*
* _.gt(1, 3);
* // => false
*/
var gt = createRelationalOperation(baseGt);
/**
* Checks if `value` is greater than or equal to `other`.
*
* @static
* @memberOf _
* @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than or equal to
* `other`, else `false`.
* @see _.lte
* @example
*
* _.gte(3, 1);
* // => true
*
* _.gte(3, 3);
* // => true
*
* _.gte(1, 3);
* // => false
*/
var gte = createRelationalOperation(function(value, other) {
return value >= other;
});
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
* // => true
*
* _.isArrayBuffer(new Array(2));
* // => false
*/
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
* @example
*
* _.isBoolean(false);
* // => true
*
* _.isBoolean(null);
* // => false
*/
function isBoolean(value) {
return value === true || value === false ||
(isObjectLike(value) && baseGetTag(value) == boolTag);
}
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
/**
* Checks if `value` is classified as a `Date` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
* @example
*
* _.isDate(new Date);
* // => true
*
* _.isDate('Mon April 23 2012');
* // => false
*/
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
/**
* Checks if `value` is likely a DOM element.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
* @example
*
* _.isElement(document.body);
* // => true
*
* _.isElement('<body>');
* // => false
*/
function isElement(value) {
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
}
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) &&
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag = getTag(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
/**
* This method is like `_.isEqual` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* function isGreeting(value) {
* return /^h(?:i|ello)$/.test(value);
* }
*
* function customizer(objValue, othValue) {
* if (isGreeting(objValue) && isGreeting(othValue)) {
* return true;
* }
* }
*
* var array = ['hello', 'goodbye'];
* var other = ['hi', 'goodbye'];
*
* _.isEqualWith(array, other, customizer);
* // => true
*/
function isEqualWith(value, other, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
var result = customizer ? customizer(value, other) : undefined$1;
return result === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result;
}
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* @example
*
* _.isError(new Error);
* // => true
*
* _.isError(Error);
* // => false
*/
function isError(value) {
if (!isObjectLike(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == errorTag || tag == domExcTag ||
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
}
/**
* Checks if `value` is a finite primitive number.
*
* **Note:** This method is based on
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(3);
* // => true
*
* _.isFinite(Number.MIN_VALUE);
* // => true
*
* _.isFinite(Infinity);
* // => false
*
* _.isFinite('3');
* // => false
*/
function isFinite(value) {
return typeof value == 'number' && nativeIsFinite(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
/**
* Checks if `value` is an integer.
*
* **Note:** This method is based on
* [`Number.isInteger`](https://mdn.io/Number/isInteger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
* @example
*
* _.isInteger(3);
* // => true
*
* _.isInteger(Number.MIN_VALUE);
* // => false
*
* _.isInteger(Infinity);
* // => false
*
* _.isInteger('3');
* // => false
*/
function isInteger(value) {
return typeof value == 'number' && value == toInteger(value);
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
/**
* Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values.
*
* **Note:** This method is equivalent to `_.matches` when `source` is
* partially applied.
*
* Partial comparisons will match empty array and empty object `source`
* values against any array or object value, respectively. See `_.isEqual`
* for a list of supported value comparisons.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
* @example
*
* var object = { 'a': 1, 'b': 2 };
*
* _.isMatch(object, { 'b': 2 });
* // => true
*
* _.isMatch(object, { 'b': 1 });
* // => false
*/
function isMatch(object, source) {
return object === source || baseIsMatch(object, source, getMatchData(source));
}
/**
* This method is like `_.isMatch` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with five
* arguments: (objValue, srcValue, index|key, object, source).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
* @example
*
* function isGreeting(value) {
* return /^h(?:i|ello)$/.test(value);
* }
*
* function customizer(objValue, srcValue) {
* if (isGreeting(objValue) && isGreeting(srcValue)) {
* return true;
* }
* }
*
* var object = { 'greeting': 'hello' };
* var source = { 'greeting': 'hi' };
*
* _.isMatchWith(object, source, customizer);
* // => true
*/
function isMatchWith(object, source, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
return baseIsMatch(object, source, getMatchData(source), customizer);
}
/**
* Checks if `value` is `NaN`.
*
* **Note:** This method is based on
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
* `undefined` and other non-number values.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
* @example
*
* _.isNaN(NaN);
* // => true
*
* _.isNaN(new Number(NaN));
* // => true
*
* isNaN(undefined);
* // => true
*
* _.isNaN(undefined);
* // => false
*/
function isNaN(value) {
// An `NaN` primitive is the only value that is not equal to itself.
// Perform the `toStringTag` check first to avoid errors with some
// ActiveX objects in IE.
return isNumber(value) && value != +value;
}
/**
* Checks if `value` is a pristine native function.
*
* **Note:** This method can't reliably detect native functions in the presence
* of the core-js package because core-js circumvents this kind of detection.
* Despite multiple requests, the core-js maintainer has made it clear: any
* attempt to fix the detection will be obstructed. As a result, we're left
* with little choice but to throw an error. Unfortunately, this also affects
* packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
* which rely on core-js.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (isMaskable(value)) {
throw new Error(CORE_ERROR_TEXT);
}
return baseIsNative(value);
}
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
/**
* Checks if `value` is `null` or `undefined`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
* @example
*
* _.isNil(null);
* // => true
*
* _.isNil(void 0);
* // => true
*
* _.isNil(NaN);
* // => false
*/
function isNil(value) {
return value == null;
}
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
* classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
* @example
*
* _.isNumber(3);
* // => true
*
* _.isNumber(Number.MIN_VALUE);
* // => true
*
* _.isNumber(Infinity);
* // => true
*
* _.isNumber('3');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' ||
(isObjectLike(value) && baseGetTag(value) == numberTag);
}
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/**
* Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
* @example
*
* _.isRegExp(/abc/);
* // => true
*
* _.isRegExp('/abc/');
* // => false
*/
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
/**
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
* double precision number which isn't the result of a rounded unsafe integer.
*
* **Note:** This method is based on
* [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
* @example
*
* _.isSafeInteger(3);
* // => true
*
* _.isSafeInteger(Number.MIN_VALUE);
* // => false
*
* _.isSafeInteger(Infinity);
* // => false
*
* _.isSafeInteger('3');
* // => false
*/
function isSafeInteger(value) {
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' ||
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Checks if `value` is `undefined`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
* @example
*
* _.isUndefined(void 0);
* // => true
*
* _.isUndefined(null);
* // => false
*/
function isUndefined(value) {
return value === undefined$1;
}
/**
* Checks if `value` is classified as a `WeakMap` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
* // => true
*
* _.isWeakMap(new Map);
* // => false
*/
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
/**
* Checks if `value` is classified as a `WeakSet` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
* // => true
*
* _.isWeakSet(new Set);
* // => false
*/
function isWeakSet(value) {
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
/**
* Checks if `value` is less than `other`.
*
* @static
* @memberOf _
* @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is less than `other`,
* else `false`.
* @see _.gt
* @example
*
* _.lt(1, 3);
* // => true
*
* _.lt(3, 3);
* // => false
*
* _.lt(3, 1);
* // => false
*/
var lt = createRelationalOperation(baseLt);
/**
* Checks if `value` is less than or equal to `other`.
*
* @static
* @memberOf _
* @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is less than or equal to
* `other`, else `false`.
* @see _.gte
* @example
*
* _.lte(1, 3);
* // => true
*
* _.lte(3, 3);
* // => true
*
* _.lte(3, 1);
* // => false
*/
var lte = createRelationalOperation(function(value, other) {
return value <= other;
});
/**
* Converts `value` to an array.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
* @returns {Array} Returns the converted array.
* @example
*
* _.toArray({ 'a': 1, 'b': 2 });
* // => [1, 2]
*
* _.toArray('abc');
* // => ['a', 'b', 'c']
*
* _.toArray(1);
* // => []
*
* _.toArray(null);
* // => []
*/
function toArray(value) {
if (!value) {
return [];
}
if (isArrayLike(value)) {
return isString(value) ? stringToArray(value) : copyArray(value);
}
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(value),
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
return func(value);
}
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
/**
* Converts `value` to an integer suitable for use as the length of an
* array-like object.
*
* **Note:** This method is based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toLength(3.2);
* // => 3
*
* _.toLength(Number.MIN_VALUE);
* // => 0
*
* _.toLength(Infinity);
* // => 4294967295
*
* _.toLength('3.2');
* // => 3
*/
function toLength(value) {
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
}
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/**
* Converts `value` to a safe integer. A safe integer can be compared and
* represented correctly.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toSafeInteger(3.2);
* // => 3
*
* _.toSafeInteger(Number.MIN_VALUE);
* // => 0
*
* _.toSafeInteger(Infinity);
* // => 9007199254740991
*
* _.toSafeInteger('3.2');
* // => 3
*/
function toSafeInteger(value) {
return value
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
: (value === 0 ? value : 0);
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/*------------------------------------------------------------------------*/
/**
* Assigns own enumerable string keyed properties of source objects to the
* destination object. Source objects are applied from left to right.
* Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
* @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.assignIn
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* function Bar() {
* this.c = 3;
* }
*
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assign({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
/**
* This method is like `_.assign` except that it iterates over own and
* inherited source properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias extend
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.assign
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* function Bar() {
* this.c = 3;
* }
*
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
});
/**
* This method is like `_.assignIn` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns
* `undefined`, assignment is handled by the method instead. The `customizer`
* is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias extendWith
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @see _.assignWith
* @example
*
* function customizer(objValue, srcValue) {
* return _.isUndefined(objValue) ? srcValue : objValue;
* }
*
* var defaults = _.partialRight(_.assignInWith, customizer);
*
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
/**
* This method is like `_.assign` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns
* `undefined`, assignment is handled by the method instead. The `customizer`
* is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @see _.assignInWith
* @example
*
* function customizer(objValue, srcValue) {
* return _.isUndefined(objValue) ? srcValue : objValue;
* }
*
* var defaults = _.partialRight(_.assignWith, customizer);
*
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keys(source), object, customizer);
});
/**
* Creates an array of values corresponding to `paths` of `object`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Array} Returns the picked values.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = flatRest(baseAt);
/**
* Creates an object that inherits from the `prototype` object. If a
* `properties` object is given, its own enumerable string keyed properties
* are assigned to the created object.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
* @returns {Object} Returns the new object.
* @example
*
* function Shape() {
* this.x = 0;
* this.y = 0;
* }
*
* function Circle() {
* Shape.call(this);
* }
*
* Circle.prototype = _.create(Shape.prototype, {
* 'constructor': Circle
* });
*
* var circle = new Circle;
* circle instanceof Circle;
* // => true
*
* circle instanceof Shape;
* // => true
*/
function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
}
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
* resolve to `undefined`. Source objects are applied from left to right.
* Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(function(object, sources) {
object = Object(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined$1;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined$1 ||
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
object[key] = source[key];
}
}
}
return object;
});
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined$1, customDefaultsMerge);
return apply(mergeWith, undefined$1, args);
});
/**
* This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Object
* @param {Object} object The object to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
*
* var users = {
* 'barney': { 'age': 36, 'active': true },
* 'fred': { 'age': 40, 'active': false },
* 'pebbles': { 'age': 1, 'active': true }
* };
*
* _.findKey(users, function(o) { return o.age < 40; });
* // => 'barney' (iteration order is not guaranteed)
*
* // The `_.matches` iteratee shorthand.
* _.findKey(users, { 'age': 1, 'active': true });
* // => 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findKey(users, ['active', false]);
* // => 'fred'
*
* // The `_.property` iteratee shorthand.
* _.findKey(users, 'active');
* // => 'barney'
*/
function findKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
}
/**
* This method is like `_.findKey` except that it iterates over elements of
* a collection in the opposite order.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Object
* @param {Object} object The object to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
*
* var users = {
* 'barney': { 'age': 36, 'active': true },
* 'fred': { 'age': 40, 'active': false },
* 'pebbles': { 'age': 1, 'active': true }
* };
*
* _.findLastKey(users, function(o) { return o.age < 40; });
* // => returns 'pebbles' assuming `_.findKey` returns 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.findLastKey(users, { 'age': 36, 'active': true });
* // => 'barney'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findLastKey(users, ['active', false]);
* // => 'fred'
*
* // The `_.property` iteratee shorthand.
* _.findLastKey(users, 'active');
* // => 'pebbles'
*/
function findLastKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
}
/**
* Iterates over own and inherited enumerable string keyed properties of an
* object and invokes `iteratee` for each property. The iteratee is invoked
* with three arguments: (value, key, object). Iteratee functions may exit
* iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
* @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forInRight
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forIn(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
*/
function forIn(object, iteratee) {
return object == null
? object
: baseFor(object, getIteratee(iteratee, 3), keysIn);
}
/**
* This method is like `_.forIn` except that it iterates over properties of
* `object` in the opposite order.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forIn
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forInRight(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
*/
function forInRight(object, iteratee) {
return object == null
? object
: baseForRight(object, getIteratee(iteratee, 3), keysIn);
}
/**
* Iterates over own enumerable string keyed properties of an object and
* invokes `iteratee` for each property. The iteratee is invoked with three
* arguments: (value, key, object). Iteratee functions may exit iteration
* early by explicitly returning `false`.
*
* @static
* @memberOf _
* @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forOwnRight
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forOwn(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
return object && baseForOwn(object, getIteratee(iteratee, 3));
}
/**
* This method is like `_.forOwn` except that it iterates over properties of
* `object` in the opposite order.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forOwn
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forOwnRight(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
*/
function forOwnRight(object, iteratee) {
return object && baseForOwnRight(object, getIteratee(iteratee, 3));
}
/**
* Creates an array of function property names from own enumerable properties
* of `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the function names.
* @see _.functionsIn
* @example
*
* function Foo() {
* this.a = _.constant('a');
* this.b = _.constant('b');
* }
*
* Foo.prototype.c = _.constant('c');
*
* _.functions(new Foo);
* // => ['a', 'b']
*/
function functions(object) {
return object == null ? [] : baseFunctions(object, keys(object));
}
/**
* Creates an array of function property names from own and inherited
* enumerable properties of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the function names.
* @see _.functions
* @example
*
* function Foo() {
* this.a = _.constant('a');
* this.b = _.constant('b');
* }
*
* Foo.prototype.c = _.constant('c');
*
* _.functionsIn(new Foo);
* // => ['a', 'b', 'c']
*/
function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined$1 : baseGet(object, path);
return result === undefined$1 ? defaultValue : result;
}
/**
* Checks if `path` is a direct property of `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = { 'a': { 'b': 2 } };
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.has(object, 'a');
* // => true
*
* _.has(object, 'a.b');
* // => true
*
* _.has(object, ['a', 'b']);
* // => true
*
* _.has(other, 'a');
* // => false
*/
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
/**
* Creates an object composed of the inverted keys and values of `object`.
* If `object` contains duplicate values, subsequent values overwrite
* property assignments of previous values.
*
* @static
* @memberOf _
* @since 0.7.0
* @category Object
* @param {Object} object The object to invert.
* @returns {Object} Returns the new inverted object.
* @example
*
* var object = { 'a': 1, 'b': 2, 'c': 1 };
*
* _.invert(object);
* // => { '1': 'c', '2': 'b' }
*/
var invert = createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString.call(value);
}
result[value] = key;
}, constant(identity));
/**
* This method is like `_.invert` except that the inverted object is generated
* from the results of running each element of `object` thru `iteratee`. The
* corresponding inverted value of each inverted key is an array of keys
* responsible for generating the inverted value. The iteratee is invoked
* with one argument: (value).
*
* @static
* @memberOf _
* @since 4.1.0
* @category Object
* @param {Object} object The object to invert.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Object} Returns the new inverted object.
* @example
*
* var object = { 'a': 1, 'b': 2, 'c': 1 };
*
* _.invertBy(object);
* // => { '1': ['a', 'c'], '2': ['b'] }
*
* _.invertBy(object, function(value) {
* return 'group' + value;
* });
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
*/
var invertBy = createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString.call(value);
}
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}, getIteratee);
/**
* Invokes the method at `path` of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
* @example
*
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
*
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
* // => [2, 3]
*/
var invoke = baseRest(baseInvoke);
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
/**
* The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable
* string keyed property of `object` thru `iteratee`. The iteratee is invoked
* with three arguments: (value, key, object).
*
* @static
* @memberOf _
* @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapValues
* @example
*
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
* return key + value;
* });
* // => { 'a1': 1, 'b2': 2 }
*/
function mapKeys(object, iteratee) {
var result = {};
iteratee = getIteratee(iteratee, 3);
baseForOwn(object, function(value, key, object) {
baseAssignValue(result, iteratee(value, key, object), value);
});
return result;
}
/**
* Creates an object with the same keys as `object` and values generated
* by running each own enumerable string keyed property of `object` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, key, object).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapKeys
* @example
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* _.mapValues(users, function(o) { return o.age; });
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*
* // The `_.property` iteratee shorthand.
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
function mapValues(object, iteratee) {
var result = {};
iteratee = getIteratee(iteratee, 3);
baseForOwn(object, function(value, key, object) {
baseAssignValue(result, key, iteratee(value, key, object));
});
return result;
}
/**
* This method is like `_.assign` except that it recursively merges own and
* inherited enumerable string keyed properties of source objects into the
* destination object. Source properties that resolve to `undefined` are
* skipped if a destination value exists. Array and plain object properties
* are merged recursively. Other objects and value types are overridden by
* assignment. Source objects are applied from left to right. Subsequent
* sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 0.5.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @example
*
* var object = {
* 'a': [{ 'b': 2 }, { 'd': 4 }]
* };
*
* var other = {
* 'a': [{ 'c': 3 }, { 'e': 5 }]
* };
*
* _.merge(object, other);
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
*/
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(getIteratee(predicate)));
}
/**
* Creates an object composed of the picked `object` properties.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/**
* This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and
* its result is returned.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to resolve.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
*
* _.result(object, 'a[0].b.c1');
* // => 3
*
* _.result(object, 'a[0].b.c2');
* // => 4
*
* _.result(object, 'a[0].b.c3', 'default');
* // => 'default'
*
* _.result(object, 'a[0].b.c3', _.constant('default'));
* // => 'default'
*/
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1,
length = path.length;
// Ensure the loop is entered when path is empty.
if (!length) {
length = 1;
object = undefined$1;
}
while (++index < length) {
var value = object == null ? undefined$1 : object[toKey(path[index])];
if (value === undefined$1) {
index = length;
value = defaultValue;
}
object = isFunction(value) ? value.call(object) : value;
}
return object;
}
/**
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
* it's created. Arrays are created for missing index properties while objects
* are created for all other missing properties. Use `_.setWith` to customize
* `path` creation.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @returns {Object} Returns `object`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.set(object, 'a[0].b.c', 4);
* console.log(object.a[0].b.c);
* // => 4
*
* _.set(object, ['x', '0', 'y', 'z'], 5);
* console.log(object.x[0].y.z);
* // => 5
*/
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
/**
* This method is like `_.set` except that it accepts `customizer` which is
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
* path creation is handled by the method instead. The `customizer` is invoked
* with three arguments: (nsValue, key, nsObject).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* var object = {};
*
* _.setWith(object, '[0][1]', 'a', Object);
* // => { '0': { '1': 'a' } }
*/
function setWith(object, path, value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
return object == null ? object : baseSet(object, path, value, customizer);
}
/**
* Creates an array of own enumerable string keyed-value pairs for `object`
* which can be consumed by `_.fromPairs`. If `object` is a map or set, its
* entries are returned.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias entries
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the key-value pairs.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.toPairs(new Foo);
* // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
*/
var toPairs = createToPairs(keys);
/**
* Creates an array of own and inherited enumerable string keyed-value pairs
* for `object` which can be consumed by `_.fromPairs`. If `object` is a map
* or set, its entries are returned.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias entriesIn
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the key-value pairs.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.toPairsIn(new Foo);
* // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
*/
var toPairsIn = createToPairs(keysIn);
/**
* An alternative to `_.reduce`; this method transforms `object` to a new
* `accumulator` object which is the result of running each of its own
* enumerable string keyed properties thru `iteratee`, with each invocation
* potentially mutating the `accumulator` object. If `accumulator` is not
* provided, a new object with the same `[[Prototype]]` will be used. The
* iteratee is invoked with four arguments: (accumulator, value, key, object).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
* @since 1.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The custom accumulator value.
* @returns {*} Returns the accumulated value.
* @example
*
* _.transform([2, 3, 4], function(result, n) {
* result.push(n *= n);
* return n % 2 == 0;
* }, []);
* // => [4, 9]
*
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
* (result[value] || (result[value] = [])).push(key);
* }, {});
* // => { '1': ['a', 'c'], '2': ['b'] }
*/
function transform(object, iteratee, accumulator) {
var isArr = isArray(object),
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee = getIteratee(iteratee, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
accumulator = isArr ? new Ctor : [];
}
else if (isObject(object)) {
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
}
else {
accumulator = {};
}
}
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
return iteratee(accumulator, value, index, object);
});
return accumulator;
}
/**
* Removes the property at `path` of `object`.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 7 } }] };
* _.unset(object, 'a[0].b.c');
* // => true
*
* console.log(object);
* // => { 'a': [{ 'b': {} }] };
*
* _.unset(object, ['a', '0', 'b', 'c']);
* // => true
*
* console.log(object);
* // => { 'a': [{ 'b': {} }] };
*/
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
/**
* This method is like `_.set` except that accepts `updater` to produce the
* value to set. Use `_.updateWith` to customize `path` creation. The `updater`
* is invoked with one argument: (value).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {Function} updater The function to produce the updated value.
* @returns {Object} Returns `object`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.update(object, 'a[0].b.c', function(n) { return n * n; });
* console.log(object.a[0].b.c);
* // => 9
*
* _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
* console.log(object.x[0].y.z);
* // => 0
*/
function update(object, path, updater) {
return object == null ? object : baseUpdate(object, path, castFunction(updater));
}
/**
* This method is like `_.update` except that it accepts `customizer` which is
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
* path creation is handled by the method instead. The `customizer` is invoked
* with three arguments: (nsValue, key, nsObject).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {Function} updater The function to produce the updated value.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* var object = {};
*
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
* // => { '0': { '1': 'a' } }
*/
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined$1;
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
}
/**
* Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.values(new Foo);
* // => [1, 2] (iteration order is not guaranteed)
*
* _.values('hi');
* // => ['h', 'i']
*/
function values(object) {
return object == null ? [] : baseValues(object, keys(object));
}
/**
* Creates an array of the own and inherited enumerable string keyed property
* values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.valuesIn(new Foo);
* // => [1, 2, 3] (iteration order is not guaranteed)
*/
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
/*------------------------------------------------------------------------*/
/**
* Clamps `number` within the inclusive `lower` and `upper` bounds.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Number
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the clamped number.
* @example
*
* _.clamp(-10, -5, 5);
* // => -5
*
* _.clamp(10, -5, 5);
* // => 5
*/
function clamp(number, lower, upper) {
if (upper === undefined$1) {
upper = lower;
lower = undefined$1;
}
if (upper !== undefined$1) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined$1) {
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber(number), lower, upper);
}
/**
* Checks if `n` is between `start` and up to, but not including, `end`. If
* `end` is not specified, it's set to `start` with `start` then set to `0`.
* If `start` is greater than `end` the params are swapped to support
* negative ranges.
*
* @static
* @memberOf _
* @since 3.3.0
* @category Number
* @param {number} number The number to check.
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
* @see _.range, _.rangeRight
* @example
*
* _.inRange(3, 2, 4);
* // => true
*
* _.inRange(4, 8);
* // => true
*
* _.inRange(4, 2);
* // => false
*
* _.inRange(2, 2);
* // => false
*
* _.inRange(1.2, 2);
* // => true
*
* _.inRange(5.2, 4);
* // => false
*
* _.inRange(-3, -2, -6);
* // => true
*/
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined$1) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber(number);
return baseInRange(number, start, end);
}
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
* If only one argument is provided a number between `0` and the given number
* is returned. If `floating` is `true`, or either `lower` or `upper` are
* floats, a floating-point number is returned instead of an integer.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @memberOf _
* @since 0.7.0
* @category Number
* @param {number} [lower=0] The lower bound.
* @param {number} [upper=1] The upper bound.
* @param {boolean} [floating] Specify returning a floating-point number.
* @returns {number} Returns the random number.
* @example
*
* _.random(0, 5);
* // => an integer between 0 and 5
*
* _.random(5);
* // => also an integer between 0 and 5
*
* _.random(5, true);
* // => a floating-point number between 0 and 5
*
* _.random(1.2, 5.2);
* // => a floating-point number between 1.2 and 5.2
*/
function random(lower, upper, floating) {
if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
upper = floating = undefined$1;
}
if (floating === undefined$1) {
if (typeof upper == 'boolean') {
floating = upper;
upper = undefined$1;
}
else if (typeof lower == 'boolean') {
floating = lower;
lower = undefined$1;
}
}
if (lower === undefined$1 && upper === undefined$1) {
lower = 0;
upper = 1;
}
else {
lower = toFinite(lower);
if (upper === undefined$1) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
}
return baseRandom(lower, upper);
}
/*------------------------------------------------------------------------*/
/**
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
* @example
*
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
* _.camelCase('--foo-bar--');
* // => 'fooBar'
*
* _.camelCase('__FOO_BAR__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? capitalize(word) : word);
});
/**
* Converts the first character of `string` to upper case and the remaining
* to lower case.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
* @example
*
* _.capitalize('FRED');
* // => 'Fred'
*/
function capitalize(string) {
return upperFirst(toString(string).toLowerCase());
}
/**
* Deburrs `string` by converting
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
* letters to basic Latin letters and removing
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
}
/**
* Checks if `string` ends with the given target string.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {string} [target] The string to search for.
* @param {number} [position=string.length] The position to search up to.
* @returns {boolean} Returns `true` if `string` ends with `target`,
* else `false`.
* @example
*
* _.endsWith('abc', 'c');
* // => true
*
* _.endsWith('abc', 'b');
* // => false
*
* _.endsWith('abc', 'b', 2);
* // => true
*/
function endsWith(string, target, position) {
string = toString(string);
target = baseToString(target);
var length = string.length;
position = position === undefined$1
? length
: baseClamp(toInteger(position), 0, length);
var end = position;
position -= target.length;
return position >= 0 && string.slice(position, end) == target;
}
/**
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
* corresponding HTML entities.
*
* **Note:** No other characters are escaped. To escape additional
* characters use a third-party library like [_he_](https://mths.be/he).
*
* Though the ">" character is escaped for symmetry, characters like
* ">" and "/" don't need escaping in HTML and have no special meaning
* unless they're part of a tag or unquoted attribute value. See
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
* (under "semi-related fun fact") for more details.
*
* When working with HTML you should always
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
* XSS vectors.
*
* @static
* @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escape('fred, barney, & pebbles');
* // => 'fred, barney, &amp; pebbles'
*/
function escape(string) {
string = toString(string);
return (string && reHasUnescapedHtml.test(string))
? string.replace(reUnescapedHtml, escapeHtmlChar)
: string;
}
/**
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escapeRegExp('[lodash](https://lodash.com/)');
* // => '\[lodash\]\(https://lodash\.com/\)'
*/
function escapeRegExp(string) {
string = toString(string);
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar, '\\$&')
: string;
}
/**
* Converts `string` to
* [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the kebab cased string.
* @example
*
* _.kebabCase('Foo Bar');
* // => 'foo-bar'
*
* _.kebabCase('fooBar');
* // => 'foo-bar'
*
* _.kebabCase('__FOO_BAR__');
* // => 'foo-bar'
*/
var kebabCase = createCompounder(function(result, word, index) {
return result + (index ? '-' : '') + word.toLowerCase();
});
/**
* Converts `string`, as space separated words, to lower case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
* _.lowerCase('--Foo-Bar--');
* // => 'foo bar'
*
* _.lowerCase('fooBar');
* // => 'foo bar'
*
* _.lowerCase('__FOO_BAR__');
* // => 'foo bar'
*/
var lowerCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + word.toLowerCase();
});
/**
* Converts the first character of `string` to lower case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.lowerFirst('Fred');
* // => 'fred'
*
* _.lowerFirst('FRED');
* // => 'fRED'
*/
var lowerFirst = createCaseFirst('toLowerCase');
/**
* Pads `string` on the left and right sides if it's shorter than `length`.
* Padding characters are truncated if they can't be evenly divided by `length`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.pad('abc', 8);
* // => ' abc '
*
* _.pad('abc', 8, '_-');
* // => '_-abc_-_'
*
* _.pad('abc', 3);
* // => 'abc'
*/
function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
var mid = (length - strLength) / 2;
return (
createPadding(nativeFloor(mid), chars) +
string +
createPadding(nativeCeil(mid), chars)
);
}
/**
* Pads `string` on the right side if it's shorter than `length`. Padding
* characters are truncated if they exceed `length`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.padEnd('abc', 6);
* // => 'abc '
*
* _.padEnd('abc', 6, '_-');
* // => 'abc_-_'
*
* _.padEnd('abc', 3);
* // => 'abc'
*/
function padEnd(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return (length && strLength < length)
? (string + createPadding(length - strLength, chars))
: string;
}
/**
* Pads `string` on the left side if it's shorter than `length`. Padding
* characters are truncated if they exceed `length`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.padStart('abc', 6);
* // => ' abc'
*
* _.padStart('abc', 6, '_-');
* // => '_-_abc'
*
* _.padStart('abc', 3);
* // => 'abc'
*/
function padStart(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return (length && strLength < length)
? (createPadding(length - strLength, chars) + string)
: string;
}
/**
* Converts `string` to an integer of the specified radix. If `radix` is
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a
* hexadecimal, in which case a `radix` of `16` is used.
*
* **Note:** This method aligns with the
* [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
*
* @static
* @memberOf _
* @since 1.1.0
* @category String
* @param {string} string The string to convert.
* @param {number} [radix=10] The radix to interpret `value` by.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {number} Returns the converted integer.
* @example
*
* _.parseInt('08');
* // => 8
*
* _.map(['6', '08', '10'], _.parseInt);
* // => [6, 8, 10]
*/
function parseInt(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
}
/**
* Repeats the given string `n` times.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to repeat.
* @param {number} [n=1] The number of times to repeat the string.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the repeated string.
* @example
*
* _.repeat('*', 3);
* // => '***'
*
* _.repeat('abc', 2);
* // => 'abcabc'
*
* _.repeat('abc', 0);
* // => ''
*/
function repeat(string, n, guard) {
if ((guard ? isIterateeCall(string, n, guard) : n === undefined$1)) {
n = 1;
} else {
n = toInteger(n);
}
return baseRepeat(toString(string), n);
}
/**
* Replaces matches for `pattern` in `string` with `replacement`.
*
* **Note:** This method is based on
* [`String#replace`](https://mdn.io/String/replace).
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to modify.
* @param {RegExp|string} pattern The pattern to replace.
* @param {Function|string} replacement The match replacement.
* @returns {string} Returns the modified string.
* @example
*
* _.replace('Hi Fred', 'Fred', 'Barney');
* // => 'Hi Barney'
*/
function replace() {
var args = arguments,
string = toString(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
}
/**
* Converts `string` to
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
* @example
*
* _.snakeCase('Foo Bar');
* // => 'foo_bar'
*
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
* _.snakeCase('--FOO-BAR--');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
return result + (index ? '_' : '') + word.toLowerCase();
});
/**
* Splits `string` by `separator`.
*
* **Note:** This method is based on
* [`String#split`](https://mdn.io/String/split).
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to split.
* @param {RegExp|string} separator The separator pattern to split by.
* @param {number} [limit] The length to truncate results to.
* @returns {Array} Returns the string segments.
* @example
*
* _.split('a-b-c', '-', 2);
* // => ['a', 'b']
*/
function split(string, separator, limit) {
if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
separator = limit = undefined$1;
}
limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString(string);
if (string && (
typeof separator == 'string' ||
(separator != null && !isRegExp(separator))
)) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
/**
* Converts `string` to
* [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
*
* @static
* @memberOf _
* @since 3.1.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
* _.startCase('--foo-bar--');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
* _.startCase('__FOO_BAR__');
* // => 'FOO BAR'
*/
var startCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + upperFirst(word);
});
/**
* Checks if `string` starts with the given target string.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {string} [target] The string to search for.
* @param {number} [position=0] The position to search from.
* @returns {boolean} Returns `true` if `string` starts with `target`,
* else `false`.
* @example
*
* _.startsWith('abc', 'a');
* // => true
*
* _.startsWith('abc', 'b');
* // => false
*
* _.startsWith('abc', 'b', 1);
* // => true
*/
function startsWith(string, target, position) {
string = toString(string);
position = position == null
? 0
: baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return string.slice(position, position + target.length) == target;
}
/**
* Creates a compiled template function that can interpolate data properties
* in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting
* object is given, it takes precedence over `_.templateSettings` values.
*
* **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
* for easier debugging.
*
* For more information on precompiling templates see
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
*
* For more information on Chrome extension sandboxes see
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
*
* @static
* @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The template string.
* @param {Object} [options={}] The options object.
* @param {RegExp} [options.escape=_.templateSettings.escape]
* The HTML "escape" delimiter.
* @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
* The "evaluate" delimiter.
* @param {Object} [options.imports=_.templateSettings.imports]
* An object to import into the template as free variables.
* @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
* The "interpolate" delimiter.
* @param {string} [options.sourceURL='lodash.templateSources[n]']
* The sourceURL of the compiled template.
* @param {string} [options.variable='obj']
* The data object variable name.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the compiled template function.
* @example
*
* // Use the "interpolate" delimiter to create a compiled template.
* var compiled = _.template('hello <%= user %>!');
* compiled({ 'user': 'fred' });
* // => 'hello fred!'
*
* // Use the HTML "escape" delimiter to escape data property values.
* var compiled = _.template('<b><%- value %></b>');
* compiled({ 'value': '<script>' });
* // => '<b>&lt;script&gt;</b>'
*
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
* compiled({ 'users': ['fred', 'barney'] });
* // => '<li>fred</li><li>barney</li>'
*
* // Use the internal `print` function in "evaluate" delimiters.
* var compiled = _.template('<% print("hello " + user); %>!');
* compiled({ 'user': 'barney' });
* // => 'hello barney!'
*
* // Use the ES template literal delimiter as an "interpolate" delimiter.
* // Disable support by replacing the "interpolate" delimiter.
* var compiled = _.template('hello ${ user }!');
* compiled({ 'user': 'pebbles' });
* // => 'hello pebbles!'
*
* // Use backslashes to treat delimiters as plain text.
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
* compiled({ 'value': 'ignored' });
* // => '<%- value %>'
*
* // Use the `imports` option to import `jQuery` as `jq`.
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
* compiled({ 'users': ['fred', 'barney'] });
* // => '<li>fred</li><li>barney</li>'
*
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
* compiled(data);
* // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
*
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
* compiled.source;
* // => function(data) {
* // var __t, __p = '';
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
* // return __p;
* // }
*
* // Use custom template delimiters.
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ user }}!');
* compiled({ 'user': 'mustache' });
* // => 'hello mustache!'
*
* // Use the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and stack traces.
* fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
* var JST = {\
* "main": ' + _.template(mainText).source + '\
* };\
* ');
*/
function template(string, options, guard) {
// Based on John Resig's `tmpl` implementation
// (http://ejohn.org/blog/javascript-micro-templating/)
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
var settings = lodash.templateSettings;
if (guard && isIterateeCall(string, options, guard)) {
options = undefined$1;
}
string = toString(string);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys);
var isEscaping,
isEvaluating,
index = 0,
interpolate = options.interpolate || reNoMatch,
source = "__p += '";
// Compile the regexp to match each delimiter.
var reDelimiters = RegExp(
(options.escape || reNoMatch).source + '|' +
interpolate.source + '|' +
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
(options.evaluate || reNoMatch).source + '|$'
, 'g');
// Use a sourceURL for easier debugging.
// The sourceURL gets injected into the source that's eval-ed, so be careful
// with lookup (in case of e.g. prototype pollution), and strip newlines if any.
// A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
var sourceURL = '//# sourceURL=' +
(hasOwnProperty.call(options, 'sourceURL')
? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
: ('lodash.templateSources[' + (++templateCounter) + ']')
) + '\n';
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue);
// Escape characters that can't be included in string literals.
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
// Replace delimiters with snippets.
if (escapeValue) {
isEscaping = true;
source += "' +\n__e(" + escapeValue + ") +\n'";
}
if (evaluateValue) {
isEvaluating = true;
source += "';\n" + evaluateValue + ";\n__p += '";
}
if (interpolateValue) {
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
}
index = offset + match.length;
// The JS engine embedded in Adobe products needs `match` returned in
// order to produce the correct `offset` value.
return match;
});
source += "';\n";
// If `variable` is not specified wrap a with-statement around the generated
// code to add the data object to the top of the scope chain.
// Like with sourceURL, we take care to not check the option's prototype,
// as this configuration is a code injection vector.
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n';
}
// Cleanup code by stripping empty strings.
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
.replace(reEmptyStringMiddle, '$1')
.replace(reEmptyStringTrailing, '$1;');
// Frame code as the function body.
source = 'function(' + (variable || 'obj') + ') {\n' +
(variable
? ''
: 'obj || (obj = {});\n'
) +
"var __t, __p = ''" +
(isEscaping
? ', __e = _.escape'
: ''
) +
(isEvaluating
? ', __j = Array.prototype.join;\n' +
"function print() { __p += __j.call(arguments, '') }\n"
: ';\n'
) +
source +
'return __p\n}';
var result = attempt(function() {
return Function(importsKeys, sourceURL + 'return ' + source)
.apply(undefined$1, importsValues);
});
// Provide the compiled function's source by its `toString` method or
// the `source` property as a convenience for inlining compiled templates.
result.source = source;
if (isError(result)) {
throw result;
}
return result;
}
/**
* Converts `string`, as a whole, to lower case just like
* [String#toLowerCase](https://mdn.io/toLowerCase).
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
* _.toLower('--Foo-Bar--');
* // => '--foo-bar--'
*
* _.toLower('fooBar');
* // => 'foobar'
*
* _.toLower('__FOO_BAR__');
* // => '__foo_bar__'
*/
function toLower(value) {
return toString(value).toLowerCase();
}
/**
* Converts `string`, as a whole, to upper case just like
* [String#toUpperCase](https://mdn.io/toUpperCase).
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
* @example
*
* _.toUpper('--foo-bar--');
* // => '--FOO-BAR--'
*
* _.toUpper('fooBar');
* // => 'FOOBAR'
*
* _.toUpper('__foo_bar__');
* // => '__FOO_BAR__'
*/
function toUpper(value) {
return toString(value).toUpperCase();
}
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined$1)) {
return string.replace(reTrim, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join('');
}
/**
* Removes trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trimEnd(' abc ');
* // => ' abc'
*
* _.trimEnd('-_-abc-_-', '_-');
* // => '-_-abc'
*/
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined$1)) {
return string.replace(reTrimEnd, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end).join('');
}
/**
* Removes leading whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trimStart(' abc ');
* // => 'abc '
*
* _.trimStart('-_-abc-_-', '_-');
* // => 'abc-_-'
*/
function trimStart(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined$1)) {
return string.replace(reTrimStart, '');
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join('');
}
/**
* Truncates `string` if it's longer than the given maximum string length.
* The last characters of the truncated string are replaced with the omission
* string which defaults to "...".
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to truncate.
* @param {Object} [options={}] The options object.
* @param {number} [options.length=30] The maximum string length.
* @param {string} [options.omission='...'] The string to indicate text is omitted.
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
* @returns {string} Returns the truncated string.
* @example
*
* _.truncate('hi-diddly-ho there, neighborino');
* // => 'hi-diddly-ho there, neighbo...'
*
* _.truncate('hi-diddly-ho there, neighborino', {
* 'length': 24,
* 'separator': ' '
* });
* // => 'hi-diddly-ho there,...'
*
* _.truncate('hi-diddly-ho there, neighborino', {
* 'length': 24,
* 'separator': /,? +/
* });
* // => 'hi-diddly-ho there...'
*
* _.truncate('hi-diddly-ho there, neighborino', {
* 'omission': ' [...]'
* });
* // => 'hi-diddly-ho there, neig [...]'
*/
function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;
if (isObject(options)) {
var separator = 'separator' in options ? options.separator : separator;
length = 'length' in options ? toInteger(options.length) : length;
omission = 'omission' in options ? baseToString(options.omission) : omission;
}
string = toString(string);
var strLength = string.length;
if (hasUnicode(string)) {
var strSymbols = stringToArray(string);
strLength = strSymbols.length;
}
if (length >= strLength) {
return string;
}
var end = length - stringSize(omission);
if (end < 1) {
return omission;
}
var result = strSymbols
? castSlice(strSymbols, 0, end).join('')
: string.slice(0, end);
if (separator === undefined$1) {
return result + omission;
}
if (strSymbols) {
end += (result.length - end);
}
if (isRegExp(separator)) {
if (string.slice(end).search(separator)) {
var match,
substring = result;
if (!separator.global) {
separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
}
separator.lastIndex = 0;
while ((match = separator.exec(substring))) {
var newEnd = match.index;
}
result = result.slice(0, newEnd === undefined$1 ? end : newEnd);
}
} else if (string.indexOf(baseToString(separator), end) != end) {
var index = result.lastIndexOf(separator);
if (index > -1) {
result = result.slice(0, index);
}
}
return result + omission;
}
/**
* The inverse of `_.escape`; this method converts the HTML entities
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
* their corresponding characters.
*
* **Note:** No other HTML entities are unescaped. To unescape additional
* HTML entities use a third-party library like [_he_](https://mths.be/he).
*
* @static
* @memberOf _
* @since 0.6.0
* @category String
* @param {string} [string=''] The string to unescape.
* @returns {string} Returns the unescaped string.
* @example
*
* _.unescape('fred, barney, &amp; pebbles');
* // => 'fred, barney, & pebbles'
*/
function unescape(string) {
string = toString(string);
return (string && reHasEscapedHtml.test(string))
? string.replace(reEscapedHtml, unescapeHtmlChar)
: string;
}
/**
* Converts `string`, as space separated words, to upper case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
* @example
*
* _.upperCase('--foo-bar');
* // => 'FOO BAR'
*
* _.upperCase('fooBar');
* // => 'FOO BAR'
*
* _.upperCase('__foo_bar__');
* // => 'FOO BAR'
*/
var upperCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + word.toUpperCase();
});
/**
* Converts the first character of `string` to upper case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.upperFirst('fred');
* // => 'Fred'
*
* _.upperFirst('FRED');
* // => 'FRED'
*/
var upperFirst = createCaseFirst('toUpperCase');
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined$1 : pattern;
if (pattern === undefined$1) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
/*------------------------------------------------------------------------*/
/**
* Attempts to invoke `func`, returning either the result or the caught error
* object. Any additional arguments are provided to `func` when it's invoked.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Util
* @param {Function} func The function to attempt.
* @param {...*} [args] The arguments to invoke `func` with.
* @returns {*} Returns the `func` result or error object.
* @example
*
* // Avoid throwing errors for invalid selectors.
* var elements = _.attempt(function(selector) {
* return document.querySelectorAll(selector);
* }, '>_>');
*
* if (_.isError(elements)) {
* elements = [];
* }
*/
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined$1, args);
} catch (e) {
return isError(e) ? e : new Error(e);
}
});
/**
* Binds methods of an object to the object itself, overwriting the existing
* method.
*
* **Note:** This method doesn't set the "length" property of bound functions.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {Object} object The object to bind and assign the bound methods to.
* @param {...(string|string[])} methodNames The object method names to bind.
* @returns {Object} Returns `object`.
* @example
*
* var view = {
* 'label': 'docs',
* 'click': function() {
* console.log('clicked ' + this.label);
* }
* };
*
* _.bindAll(view, ['click']);
* jQuery(element).on('click', view.click);
* // => Logs 'clicked docs' when clicked.
*/
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
baseAssignValue(object, key, bind(object[key], object));
});
return object;
});
/**
* Creates a function that iterates over `pairs` and invokes the corresponding
* function of the first predicate to return truthy. The predicate-function
* pairs are invoked with the `this` binding and arguments of the created
* function.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
* @returns {Function} Returns the new composite function.
* @example
*
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
* [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
* // => 'matches A'
*
* func({ 'a': 0, 'b': 1 });
* // => 'matches B'
*
* func({ 'a': '1', 'b': '2' });
* // => 'no match'
*/
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
/**
* Creates a function that invokes the predicate properties of `source` with
* the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`.
*
* **Note:** The created function is equivalent to `_.conformsTo` with
* `source` partially applied.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new spec function.
* @example
*
* var objects = [
* { 'a': 2, 'b': 1 },
* { 'a': 1, 'b': 2 }
* ];
*
* _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
* // => [{ 'a': 1, 'b': 2 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
/**
* Checks `value` to determine whether a default value should be returned in
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
* or `undefined`.
*
* @static
* @memberOf _
* @since 4.14.0
* @category Util
* @param {*} value The value to check.
* @param {*} defaultValue The default value.
* @returns {*} Returns the resolved value.
* @example
*
* _.defaultTo(1, 10);
* // => 1
*
* _.defaultTo(undefined, 10);
* // => 10
*/
function defaultTo(value, defaultValue) {
return (value == null || value !== value) ? defaultValue : value;
}
/**
* Creates a function that returns the result of invoking the given functions
* with the `this` binding of the created function, where each successive
* invocation is supplied the return value of the previous.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Util
* @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flowRight
* @example
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flow([_.add, square]);
* addSquare(1, 2);
* // => 9
*/
var flow = createFlow();
/**
* This method is like `_.flow` except that it creates a function that
* invokes the given functions from right to left.
*
* @static
* @since 3.0.0
* @memberOf _
* @category Util
* @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flow
* @example
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flowRight([square, _.add]);
* addSquare(1, 2);
* // => 9
*/
var flowRight = createFlow(true);
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
/**
* Creates a function that invokes `func` with the arguments of the created
* function. If `func` is a property name, the created function returns the
* property value for a given element. If `func` is an array or object, the
* created function returns `true` for elements that contain the equivalent
* source properties, otherwise it returns `false`.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Util
* @param {*} [func=_.identity] The value to convert to a callback.
* @returns {Function} Returns the callback.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
* // => [{ 'user': 'barney', 'age': 36, 'active': true }]
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, _.iteratee(['user', 'fred']));
* // => [{ 'user': 'fred', 'age': 40 }]
*
* // The `_.property` iteratee shorthand.
* _.map(users, _.iteratee('user'));
* // => ['barney', 'fred']
*
* // Create custom iteratee shorthands.
* _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
* return !_.isRegExp(func) ? iteratee(func) : function(string) {
* return func.test(string);
* };
* });
*
* _.filter(['abc', 'def'], /ef/);
* // => ['def']
*/
function iteratee(func) {
return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
}
/**
* Creates a function that performs a partial deep comparison between a given
* object and `source`, returning `true` if the given object has equivalent
* property values, else `false`.
*
* **Note:** The created function is equivalent to `_.isMatch` with `source`
* partially applied.
*
* Partial comparisons will match empty array and empty object `source`
* values against any array or object value, respectively. See `_.isEqual`
* for a list of supported value comparisons.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Util
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
* @example
*
* var objects = [
* { 'a': 1, 'b': 2, 'c': 3 },
* { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
*/
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
/**
* Creates a function that performs a partial deep comparison between the
* value at `path` of a given object to `srcValue`, returning `true` if the
* object value is equivalent, else `false`.
*
* **Note:** Partial comparisons will match empty array and empty object
* `srcValue` values against any array or object value, respectively. See
* `_.isEqual` for a list of supported value comparisons.
*
* @static
* @memberOf _
* @since 3.2.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
* @example
*
* var objects = [
* { 'a': 1, 'b': 2, 'c': 3 },
* { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
* _.find(objects, _.matchesProperty('a', 4));
* // => { 'a': 4, 'b': 5, 'c': 6 }
*/
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}
/**
* Creates a function that invokes the method at `path` of a given object.
* Any additional arguments are provided to the invoked method.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Util
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Function} Returns the new invoker function.
* @example
*
* var objects = [
* { 'a': { 'b': _.constant(2) } },
* { 'a': { 'b': _.constant(1) } }
* ];
*
* _.map(objects, _.method('a.b'));
* // => [2, 1]
*
* _.map(objects, _.method(['a', 'b']));
* // => [2, 1]
*/
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
/**
* The opposite of `_.method`; this method creates a function that invokes
* the method at a given path of `object`. Any additional arguments are
* provided to the invoked method.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Util
* @param {Object} object The object to query.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Function} Returns the new invoker function.
* @example
*
* var array = _.times(3, _.constant),
* object = { 'a': array, 'b': array, 'c': array };
*
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
* // => [2, 0]
*
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
* // => [2, 0]
*/
var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
});
/**
* Adds all own enumerable string keyed function properties of a source
* object to the destination object. If `object` is a function, then methods
* are added to its prototype as well.
*
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
* avoid conflicts caused by modifying the original.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {Function|Object} [object=lodash] The destination object.
* @param {Object} source The object of functions to add.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.chain=true] Specify whether mixins are chainable.
* @returns {Function|Object} Returns `object`.
* @example
*
* function vowels(string) {
* return _.filter(string, function(v) {
* return /[aeiou]/i.test(v);
* });
* }
*
* _.mixin({ 'vowels': vowels });
* _.vowels('fred');
* // => ['e']
*
* _('fred').vowels().value();
* // => ['e']
*
* _.mixin({ 'vowels': vowels }, { 'chain': false });
* _('fred').vowels();
* // => ['e']
*/
function mixin(object, source, options) {
var props = keys(source),
methodNames = baseFunctions(source, props);
if (options == null &&
!(isObject(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
methodNames = baseFunctions(source, keys(source));
}
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain || chainAll) {
var result = object(this.__wrapped__),
actions = result.__actions__ = copyArray(this.__actions__);
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
result.__chain__ = chainAll;
return result;
}
return func.apply(object, arrayPush([this.value()], arguments));
};
}
});
return object;
}
/**
* Reverts the `_` variable to its previous value and returns a reference to
* the `lodash` function.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @returns {Function} Returns the `lodash` function.
* @example
*
* var lodash = _.noConflict();
*/
function noConflict() {
if (root._ === this) {
root._ = oldDash;
}
return this;
}
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
/**
* Creates a function that gets the argument at index `n`. If `n` is negative,
* the nth argument from the end is returned.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {number} [n=0] The index of the argument to return.
* @returns {Function} Returns the new pass-thru function.
* @example
*
* var func = _.nthArg(1);
* func('a', 'b', 'c', 'd');
* // => 'b'
*
* var func = _.nthArg(-2);
* func('a', 'b', 'c', 'd');
* // => 'c'
*/
function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
}
/**
* Creates a function that invokes `iteratees` with the arguments it receives
* and returns their results.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {...(Function|Function[])} [iteratees=[_.identity]]
* The iteratees to invoke.
* @returns {Function} Returns the new function.
* @example
*
* var func = _.over([Math.max, Math.min]);
*
* func(1, 2, 3, 4);
* // => [4, 1]
*/
var over = createOver(arrayMap);
/**
* Creates a function that checks if **all** of the `predicates` return
* truthy when invoked with the arguments it receives.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {...(Function|Function[])} [predicates=[_.identity]]
* The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
* var func = _.overEvery([Boolean, isFinite]);
*
* func('1');
* // => true
*
* func(null);
* // => false
*
* func(NaN);
* // => false
*/
var overEvery = createOver(arrayEvery);
/**
* Creates a function that checks if **any** of the `predicates` return
* truthy when invoked with the arguments it receives.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {...(Function|Function[])} [predicates=[_.identity]]
* The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
* var func = _.overSome([Boolean, isFinite]);
*
* func('1');
* // => true
*
* func(null);
* // => true
*
* func(NaN);
* // => false
*/
var overSome = createOver(arraySome);
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
/**
* The opposite of `_.property`; this method creates a function that returns
* the value at a given path of `object`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Util
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
* @example
*
* var array = [0, 1, 2],
* object = { 'a': array, 'b': array, 'c': array };
*
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
* // => [2, 0]
*
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
* // => [2, 0]
*/
function propertyOf(object) {
return function(path) {
return object == null ? undefined$1 : baseGet(object, path);
};
}
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/**
* This method is like `_.range` except that it populates values in
* descending order.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.range
* @example
*
* _.rangeRight(4);
* // => [3, 2, 1, 0]
*
* _.rangeRight(-4);
* // => [-3, -2, -1, 0]
*
* _.rangeRight(1, 5);
* // => [4, 3, 2, 1]
*
* _.rangeRight(0, 20, 5);
* // => [15, 10, 5, 0]
*
* _.rangeRight(0, -4, -1);
* // => [-3, -2, -1, 0]
*
* _.rangeRight(1, 4, 0);
* // => [1, 1, 1]
*
* _.rangeRight(0);
* // => []
*/
var rangeRight = createRange(true);
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
/**
* This method returns a new empty object.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Object} Returns the new empty object.
* @example
*
* var objects = _.times(2, _.stubObject);
*
* console.log(objects);
* // => [{}, {}]
*
* console.log(objects[0] === objects[1]);
* // => false
*/
function stubObject() {
return {};
}
/**
* This method returns an empty string.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {string} Returns the empty string.
* @example
*
* _.times(2, _.stubString);
* // => ['', '']
*/
function stubString() {
return '';
}
/**
* This method returns `true`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `true`.
* @example
*
* _.times(2, _.stubTrue);
* // => [true, true]
*/
function stubTrue() {
return true;
}
/**
* Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The iteratee is invoked with one argument; (index).
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of results.
* @example
*
* _.times(3, String);
* // => ['0', '1', '2']
*
* _.times(4, _.constant(0));
* // => [0, 0, 0, 0]
*/
function times(n, iteratee) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee = getIteratee(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
while (++index < n) {
iteratee(index);
}
return result;
}
/**
* Converts `value` to a property path array.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {*} value The value to convert.
* @returns {Array} Returns the new property path array.
* @example
*
* _.toPath('a.b.c');
* // => ['a', 'b', 'c']
*
* _.toPath('a[0].b.c');
* // => ['a', '0', 'b', 'c']
*/
function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
}
/**
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {string} [prefix=''] The value to prefix the ID with.
* @returns {string} Returns the unique ID.
* @example
*
* _.uniqueId('contact_');
* // => 'contact_104'
*
* _.uniqueId();
* // => '105'
*/
function uniqueId(prefix) {
var id = ++idCounter;
return toString(prefix) + id;
}
/*------------------------------------------------------------------------*/
/**
* Adds two numbers.
*
* @static
* @memberOf _
* @since 3.4.0
* @category Math
* @param {number} augend The first number in an addition.
* @param {number} addend The second number in an addition.
* @returns {number} Returns the total.
* @example
*
* _.add(6, 4);
* // => 10
*/
var add = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
/**
* Computes `number` rounded up to `precision`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Math
* @param {number} number The number to round up.
* @param {number} [precision=0] The precision to round up to.
* @returns {number} Returns the rounded up number.
* @example
*
* _.ceil(4.006);
* // => 5
*
* _.ceil(6.004, 2);
* // => 6.01
*
* _.ceil(6040, -2);
* // => 6100
*/
var ceil = createRound('ceil');
/**
* Divide two numbers.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Math
* @param {number} dividend The first number in a division.
* @param {number} divisor The second number in a division.
* @returns {number} Returns the quotient.
* @example
*
* _.divide(6, 4);
* // => 1.5
*/
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
}, 1);
/**
* Computes `number` rounded down to `precision`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Math
* @param {number} number The number to round down.
* @param {number} [precision=0] The precision to round down to.
* @returns {number} Returns the rounded down number.
* @example
*
* _.floor(4.006);
* // => 4
*
* _.floor(0.046, 2);
* // => 0.04
*
* _.floor(4060, -2);
* // => 4000
*/
var floor = createRound('floor');
/**
* Computes the maximum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
* @returns {*} Returns the maximum value.
* @example
*
* _.max([4, 2, 8, 6]);
* // => 8
*
* _.max([]);
* // => undefined
*/
function max(array) {
return (array && array.length)
? baseExtremum(array, identity, baseGt)
: undefined$1;
}
/**
* This method is like `_.max` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the criterion by which
* the value is ranked. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the maximum value.
* @example
*
* var objects = [{ 'n': 1 }, { 'n': 2 }];
*
* _.maxBy(objects, function(o) { return o.n; });
* // => { 'n': 2 }
*
* // The `_.property` iteratee shorthand.
* _.maxBy(objects, 'n');
* // => { 'n': 2 }
*/
function maxBy(array, iteratee) {
return (array && array.length)
? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
: undefined$1;
}
/**
* Computes the mean of the values in `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the mean.
* @example
*
* _.mean([4, 2, 8, 6]);
* // => 5
*/
function mean(array) {
return baseMean(array, identity);
}
/**
* This method is like `_.mean` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the value to be averaged.
* The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.7.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the mean.
* @example
*
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
*
* _.meanBy(objects, function(o) { return o.n; });
* // => 5
*
* // The `_.property` iteratee shorthand.
* _.meanBy(objects, 'n');
* // => 5
*/
function meanBy(array, iteratee) {
return baseMean(array, getIteratee(iteratee, 2));
}
/**
* Computes the minimum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
* @returns {*} Returns the minimum value.
* @example
*
* _.min([4, 2, 8, 6]);
* // => 2
*
* _.min([]);
* // => undefined
*/
function min(array) {
return (array && array.length)
? baseExtremum(array, identity, baseLt)
: undefined$1;
}
/**
* This method is like `_.min` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the criterion by which
* the value is ranked. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
* var objects = [{ 'n': 1 }, { 'n': 2 }];
*
* _.minBy(objects, function(o) { return o.n; });
* // => { 'n': 1 }
*
* // The `_.property` iteratee shorthand.
* _.minBy(objects, 'n');
* // => { 'n': 1 }
*/
function minBy(array, iteratee) {
return (array && array.length)
? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
: undefined$1;
}
/**
* Multiply two numbers.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Math
* @param {number} multiplier The first number in a multiplication.
* @param {number} multiplicand The second number in a multiplication.
* @returns {number} Returns the product.
* @example
*
* _.multiply(6, 4);
* // => 24
*/
var multiply = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
}, 1);
/**
* Computes `number` rounded to `precision`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Math
* @param {number} number The number to round.
* @param {number} [precision=0] The precision to round to.
* @returns {number} Returns the rounded number.
* @example
*
* _.round(4.006);
* // => 4
*
* _.round(4.006, 2);
* // => 4.01
*
* _.round(4060, -2);
* // => 4100
*/
var round = createRound('round');
/**
* Subtract two numbers.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {number} minuend The first number in a subtraction.
* @param {number} subtrahend The second number in a subtraction.
* @returns {number} Returns the difference.
* @example
*
* _.subtract(6, 4);
* // => 2
*/
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
/**
* Computes the sum of the values in `array`.
*
* @static
* @memberOf _
* @since 3.4.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
* @example
*
* _.sum([4, 2, 8, 6]);
* // => 20
*/
function sum(array) {
return (array && array.length)
? baseSum(array, identity)
: 0;
}
/**
* This method is like `_.sum` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the value to be summed.
* The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
*
* _.sumBy(objects, function(o) { return o.n; });
* // => 20
*
* // The `_.property` iteratee shorthand.
* _.sumBy(objects, 'n');
* // => 20
*/
function sumBy(array, iteratee) {
return (array && array.length)
? baseSum(array, getIteratee(iteratee, 2))
: 0;
}
/*------------------------------------------------------------------------*/
// Add methods that return wrapped values in chain sequences.
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at;
lodash.before = before;
lodash.bind = bind;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.concat = concat;
lodash.cond = cond;
lodash.conforms = conforms;
lodash.constant = constant;
lodash.countBy = countBy;
lodash.create = create;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce;
lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference;
lodash.differenceBy = differenceBy;
lodash.differenceWith = differenceWith;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter;
lodash.flatMap = flatMap;
lodash.flatMapDeep = flatMapDeep;
lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
lodash.flow = flow;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
lodash.functionsIn = functionsIn;
lodash.groupBy = groupBy;
lodash.initial = initial;
lodash.intersection = intersection;
lodash.intersectionBy = intersectionBy;
lodash.intersectionWith = intersectionWith;
lodash.invert = invert;
lodash.invertBy = invertBy;
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
lodash.keys = keys;
lodash.keysIn = keysIn;
lodash.map = map;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate;
lodash.nthArg = nthArg;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once;
lodash.orderBy = orderBy;
lodash.over = over;
lodash.overArgs = overArgs;
lodash.overEvery = overEvery;
lodash.overSome = overSome;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition;
lodash.pick = pick;
lodash.pickBy = pickBy;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rangeRight = rangeRight;
lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
lodash.reverse = reverse;
lodash.sampleSize = sampleSize;
lodash.set = set;
lodash.setWith = setWith;
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy;
lodash.sortedUniq = sortedUniq;
lodash.sortedUniqBy = sortedUniqBy;
lodash.split = split;
lodash.spread = spread;
lodash.tail = tail;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.toArray = toArray;
lodash.toPairs = toPairs;
lodash.toPairsIn = toPairsIn;
lodash.toPath = toPath;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.unary = unary;
lodash.union = union;
lodash.unionBy = unionBy;
lodash.unionWith = unionWith;
lodash.uniq = uniq;
lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.update = update;
lodash.updateWith = updateWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
lodash.wrap = wrap;
lodash.xor = xor;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
lodash.zip = zip;
lodash.zipObject = zipObject;
lodash.zipObjectDeep = zipObjectDeep;
lodash.zipWith = zipWith;
// Add aliases.
lodash.entries = toPairs;
lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
// Add methods to `lodash.prototype`.
mixin(lodash, lodash);
/*------------------------------------------------------------------------*/
// Add methods that return unwrapped values in chain sequences.
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.ceil = ceil;
lodash.clamp = clamp;
lodash.clone = clone;
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every;
lodash.find = find;
lodash.findIndex = findIndex;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.floor = floor;
lodash.forEach = forEach;
lodash.forEachRight = forEachRight;
lodash.forIn = forIn;
lodash.forInRight = forInRight;
lodash.forOwn = forOwn;
lodash.forOwnRight = forOwnRight;
lodash.get = get;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
lodash.head = head;
lodash.identity = identity;
lodash.includes = includes;
lodash.indexOf = indexOf;
lodash.inRange = inRange;
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
lodash.isEqual = isEqual;
lodash.isEqualWith = isEqualWith;
lodash.isError = isError;
lodash.isFinite = isFinite;
lodash.isFunction = isFunction;
lodash.isInteger = isInteger;
lodash.isLength = isLength;
lodash.isMap = isMap;
lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN;
lodash.isNative = isNative;
lodash.isNil = isNil;
lodash.isNull = isNull;
lodash.isNumber = isNumber;
lodash.isObject = isObject;
lodash.isObjectLike = isObjectLike;
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
lodash.lowerCase = lowerCase;
lodash.lowerFirst = lowerFirst;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max;
lodash.maxBy = maxBy;
lodash.mean = mean;
lodash.meanBy = meanBy;
lodash.min = min;
lodash.minBy = minBy;
lodash.stubArray = stubArray;
lodash.stubFalse = stubFalse;
lodash.stubObject = stubObject;
lodash.stubString = stubString;
lodash.stubTrue = stubTrue;
lodash.multiply = multiply;
lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop;
lodash.now = now;
lodash.pad = pad;
lodash.padEnd = padEnd;
lodash.padStart = padStart;
lodash.parseInt = parseInt;
lodash.random = random;
lodash.reduce = reduce;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat;
lodash.replace = replace;
lodash.result = result;
lodash.round = round;
lodash.runInContext = runInContext;
lodash.sample = sample;
lodash.size = size;
lodash.snakeCase = snakeCase;
lodash.some = some;
lodash.sortedIndex = sortedIndex;
lodash.sortedIndexBy = sortedIndexBy;
lodash.sortedIndexOf = sortedIndexOf;
lodash.sortedLastIndex = sortedLastIndex;
lodash.sortedLastIndexBy = sortedLastIndexBy;
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract;
lodash.sum = sum;
lodash.sumBy = sumBy;
lodash.template = template;
lodash.times = times;
lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
lodash.toString = toString;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
lodash.trimStart = trimStart;
lodash.truncate = truncate;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId;
lodash.upperCase = upperCase;
lodash.upperFirst = upperFirst;
// Add aliases.
lodash.each = forEach;
lodash.eachRight = forEachRight;
lodash.first = head;
mixin(lodash, (function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
return source;
}()), { 'chain': false });
/*------------------------------------------------------------------------*/
/**
* The semantic version number.
*
* @static
* @memberOf _
* @type {string}
*/
lodash.VERSION = VERSION;
// Assign default placeholders.
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
lodash[methodName].placeholder = lodash;
});
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
arrayEach(['drop', 'take'], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(n) {
n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0);
var result = (this.__filtered__ && !index)
? new LazyWrapper(this)
: this.clone();
if (result.__filtered__) {
result.__takeCount__ = nativeMin(n, result.__takeCount__);
} else {
result.__views__.push({
'size': nativeMin(n, MAX_ARRAY_LENGTH),
'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
});
}
return result;
};
LazyWrapper.prototype[methodName + 'Right'] = function(n) {
return this.reverse()[methodName](n).reverse();
};
});
// Add `LazyWrapper` methods that accept an `iteratee` value.
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
var type = index + 1,
isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee) {
var result = this.clone();
result.__iteratees__.push({
'iteratee': getIteratee(iteratee, 3),
'type': type
});
result.__filtered__ = result.__filtered__ || isFilter;
return result;
};
});
// Add `LazyWrapper` methods for `_.head` and `_.last`.
arrayEach(['head', 'last'], function(methodName, index) {
var takeName = 'take' + (index ? 'Right' : '');
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
arrayEach(['initial', 'tail'], function(methodName, index) {
var dropName = 'drop' + (index ? '' : 'Right');
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};
LazyWrapper.prototype.find = function(predicate) {
return this.filter(predicate).head();
};
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == 'function') {
return new LazyWrapper(this);
}
return this.map(function(value) {
return baseInvoke(value, path, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
start = toInteger(start);
var result = this;
if (result.__filtered__ && (start > 0 || end < 0)) {
return new LazyWrapper(result);
}
if (start < 0) {
result = result.takeRight(-start);
} else if (start) {
result = result.drop(start);
}
if (end !== undefined$1) {
end = toInteger(end);
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
}
return result;
};
LazyWrapper.prototype.takeRightWhile = function(predicate) {
return this.reverse().takeWhile(predicate).reverse();
};
LazyWrapper.prototype.toArray = function() {
return this.take(MAX_ARRAY_LENGTH);
};
// Add `LazyWrapper` methods to `lodash.prototype`.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
isTaker = /^(?:head|last)$/.test(methodName),
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
retUnwrapped = isTaker || /^find/.test(methodName);
if (!lodashFunc) {
return;
}
lodash.prototype[methodName] = function() {
var value = this.__wrapped__,
args = isTaker ? [1] : arguments,
isLazy = value instanceof LazyWrapper,
iteratee = args[0],
useLazy = isLazy || isArray(value);
var interceptor = function(value) {
var result = lodashFunc.apply(lodash, arrayPush([value], args));
return (isTaker && chainAll) ? result[0] : result;
};
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
// Avoid lazy use if the iteratee has a "length" value other than `1`.
isLazy = useLazy = false;
}
var chainAll = this.__chain__,
isHybrid = !!this.__actions__.length,
isUnwrapped = retUnwrapped && !chainAll,
onlyLazy = isLazy && !isHybrid;
if (!retUnwrapped && useLazy) {
value = onlyLazy ? value : new LazyWrapper(this);
var result = func.apply(value, args);
result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 });
return new LodashWrapper(result, chainAll);
}
if (isUnwrapped && onlyLazy) {
return func.apply(this, args);
}
result = this.thru(interceptor);
return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
};
});
// Add `Array` methods to `lodash.prototype`.
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value = this.value();
return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value) {
return func.apply(isArray(value) ? value : [], args);
});
};
});
// Map minified method names to their real names.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name + '';
if (!hasOwnProperty.call(realNames, key)) {
realNames[key] = [];
}
realNames[key].push({ 'name': methodName, 'func': lodashFunc });
}
});
realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
'name': 'wrapper',
'func': undefined$1
}];
// Add methods to `LazyWrapper`.
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
// Add chain sequence methods to the `lodash` wrapper.
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
// Add lazy aliases.
lodash.prototype.first = lodash.prototype.head;
if (symIterator) {
lodash.prototype[symIterator] = wrapperToIterator;
}
return lodash;
});
/*--------------------------------------------------------------------------*/
// Export lodash.
var _ = runInContext();
// Some AMD build optimizers, like r.js, check for condition patterns like:
if (freeModule) {
// Export for Node.js.
(freeModule.exports = _)._ = _;
// Export for CommonJS support.
freeExports._ = _;
}
else {
// Export to the global object.
root._ = _;
}
}.call(commonjsGlobal));
});
var lodash_1 = lodash.flow;
var lodash_2 = lodash.join;
var lodash_3 = lodash.replace;
var lodash_4 = lodash.trim;
var lodash_5 = lodash.dropRight;
var lodash_6 = lodash.takeRight;
var lodash_7 = lodash.head;
var lodash_8 = lodash.reduce;
var lodash_9 = lodash.tail;
var lodash_10 = lodash.startsWith;
var lodash_11 = lodash.findIndex;
var lodash_12 = lodash.merge;
var lodash_13 = lodash.assign;
var lodash_14 = lodash.each;
var lodash_15 = lodash.find;
var lodash_16 = lodash.orderBy;
var lodash_17 = lodash.union;
const commonPlus = extra => fp_1(['onBegin', 'onComplete', 'onError'])(extra);
const common = () => commonPlus([]);
const _events = {
recordApi: {
save: commonPlus([
'onInvalid',
'onRecordUpdated',
'onRecordCreated']),
delete: common(),
getContext: common(),
getNew: common(),
load: common(),
validate: common(),
uploadFile: common(),
downloadFile: common(),
},
indexApi: {
buildIndex: common(),
listItems: common(),
delete: common(),
aggregates: common(),
},
collectionApi: {
getAllowedRecordTypes: common(),
initialise: common(),
delete: common(),
},
authApi: {
authenticate: common(),
authenticateTemporaryAccess: common(),
createTemporaryAccess: common(),
createUser: common(),
enableUser: common(),
disableUser: common(),
loadAccessLevels: common(),
getNewAccessLevel: common(),
getNewUser: common(),
getNewUserAuth: common(),
getUsers: common(),
saveAccessLevels: common(),
isAuthorized: common(),
changeMyPassword: common(),
setPasswordFromTemporaryCode: common(),
scorePassword: common(),
isValidPassword: common(),
validateUser: common(),
validateAccessLevels: common(),
setUserAccessLevels: common(),
},
templateApi: {
saveApplicationHierarchy: common(),
saveActionsAndTriggers: common(),
},
actionsApi: {
execute: common(),
},
};
const _eventsList = [];
const makeEvent = (area, method, name) => `${area}:${method}:${name}`;
for (const areaKey in _events) {
for (const methodKey in _events[areaKey]) {
_events[areaKey][methodKey] = fp_2((obj, s) => {
obj[s] = makeEvent(areaKey, methodKey, s);
return obj;
},
{})(_events[areaKey][methodKey]);
}
}
for (const areaKey in _events) {
for (const methodKey in _events[areaKey]) {
for (const name in _events[areaKey][methodKey]) {
_eventsList.push(
_events[areaKey][methodKey][name],
);
}
}
}
const events = _events;
const eventsList = _eventsList;
class BadRequestError extends Error {
constructor(message) {
super(message);
this.httpStatusCode = 400;
}
}
class UnauthorisedError extends Error {
constructor(message) {
super(message);
this.httpStatusCode = 401;
}
}
class NotFoundError extends Error {
constructor(message) {
super(message);
this.httpStatusCode = 404;
}
}
const apiWrapper = async (app, eventNamespace, isAuthorized, eventContext, func, ...params) => {
pushCallStack(app, eventNamespace);
if (!isAuthorized(app)) {
handleNotAuthorized(app, eventContext, eventNamespace);
return;
}
const startDate = Date.now();
const elapsed = () => (Date.now() - startDate);
try {
await app.publish(
eventNamespace.onBegin,
eventContext,
);
const result = await func(...params);
await publishComplete(app, eventContext, eventNamespace, elapsed, result);
return result;
} catch (error) {
await publishError(app, eventContext, eventNamespace, elapsed, error);
throw error;
}
};
const apiWrapperSync = (app, eventNamespace, isAuthorized, eventContext, func, ...params) => {
pushCallStack(app, eventNamespace);
if (!isAuthorized(app)) {
handleNotAuthorized(app, eventContext, eventNamespace);
return;
}
const startDate = Date.now();
const elapsed = () => (Date.now() - startDate);
try {
app.publish(
eventNamespace.onBegin,
eventContext,
);
const result = func(...params);
publishComplete(app, eventContext, eventNamespace, elapsed, result);
return result;
} catch (error) {
publishError(app, eventContext, eventNamespace, elapsed, error);
throw error;
}
};
const handleNotAuthorized = (app, eventContext, eventNamespace) => {
const err = new UnauthorisedError(`Unauthorized: ${eventNamespace}`);
publishError(app, eventContext, eventNamespace, () => 0, err);
throw err;
};
const pushCallStack = (app, eventNamespace, seedCallId) => {
const callId = shortid_1();
const createCallStack = () => ({
seedCallId: !fp_3(seedCallId)
? seedCallId
: callId,
threadCallId: callId,
stack: [],
});
if (fp_3(app.calls)) {
app.calls = createCallStack();
}
app.calls.stack.push({
namespace: eventNamespace,
callId,
});
};
const popCallStack = (app) => {
app.calls.stack.pop();
if (app.calls.stack.length === 0) {
delete app.calls;
}
};
const publishError = async (app, eventContext, eventNamespace, elapsed, err) => {
const ctx = fp_4(eventContext);
ctx.error = err;
ctx.elapsed = elapsed();
await app.publish(
eventNamespace.onError,
ctx,
);
popCallStack(app);
};
const publishComplete = async (app, eventContext, eventNamespace, elapsed, result) => {
const endcontext = fp_4(eventContext);
endcontext.result = result;
endcontext.elapsed = elapsed();
await app.publish(
eventNamespace.onComplete,
endcontext,
);
popCallStack(app);
return result;
};
const lockOverlapMilliseconds = 10;
const getLock = async (app, lockFile, timeoutMilliseconds, maxLockRetries, retryCount = 0) => {
try {
const timeout = (await app.getEpochTime())
+ timeoutMilliseconds;
const lock = {
timeout,
key: lockFile,
totalTimeout: timeoutMilliseconds,
};
await app.datastore.createFile(
lockFile,
getLockFileContent(
lock.totalTimeout,
lock.timeout,
),
);
return lock;
} catch (e) {
if (retryCount == maxLockRetries) { return NO_LOCK; }
const lock = parseLockFileContent(
lockFile,
await app.datastore.loadFile(lockFile),
);
const currentEpochTime = await app.getEpochTime();
if (currentEpochTime < lock.timeout) {
return NO_LOCK;
}
try {
await app.datastore.deleteFile(lockFile);
} catch (_) {
//empty
}
await sleepForRetry();
return await getLock(
app, lockFile, timeoutMilliseconds,
maxLockRetries, retryCount + 1,
);
}
};
const getLockFileContent = (totalTimeout, epochTime) => `${totalTimeout}:${epochTime.toString()}`;
const parseLockFileContent = (key, content) => $(content, [
fp_5(':'),
parts => ({
totalTimeout: new Number(parts[0]),
timeout: new Number(parts[1]),
key,
}),
]);
const releaseLock = async (app, lock) => {
const currentEpochTime = await app.getEpochTime();
// only release if not timedout
if (currentEpochTime < (lock.timeout - lockOverlapMilliseconds)) {
try {
await app.datastore.deleteFile(lock.key);
} catch (_) {
//empty
}
}
};
const NO_LOCK = 'no lock';
const isNolock = id => id === NO_LOCK;
const sleepForRetry = () => new Promise(resolve => setTimeout(resolve, lockOverlapMilliseconds));
// this is the combinator function
const $$ = (...funcs) => arg => lodash_1(funcs)(arg);
// this is the pipe function
const $ = (arg, funcs) => $$(...funcs)(arg);
const keySep = '/';
const trimKeySep = str => lodash_4(str, keySep);
const splitByKeySep = str => fp_5(keySep)(str);
const safeKey = key => lodash_3(`${keySep}${trimKeySep(key)}`, `${keySep}${keySep}`, keySep);
const joinKey = (...strs) => {
const paramsOrArray = strs.length === 1 & fp_26(strs[0])
? strs[0] : strs;
return safeKey(fp_41(keySep)(paramsOrArray));
};
const splitKey = $$(trimKeySep, splitByKeySep);
const getDirFomKey = $$(splitKey, lodash_5, p => joinKey(...p));
const getFileFromKey = $$(splitKey, lodash_6, lodash_7);
const configFolder = `${keySep}.config`;
const fieldDefinitions = joinKey(configFolder, 'fields.json');
const templateDefinitions = joinKey(configFolder, 'templates.json');
const appDefinitionFile = joinKey(configFolder, 'appDefinition.json');
const dirIndex = folderPath => joinKey(configFolder, 'dir', ...splitKey(folderPath), 'dir.idx');
const getIndexKeyFromFileKey = $$(getDirFomKey, dirIndex);
const ifExists = (val, exists, notExists) => (fp_3(val)
? fp_3(notExists) ? (() => { })() : notExists()
: exists());
const getOrDefault = (val, defaultVal) => ifExists(val, () => val, () => defaultVal);
const not = func => val => !func(val);
const isDefined = not(fp_3);
const isNonNull = not(fp_19);
const isNotNaN = not(fp_31);
const allTrue = (...funcArgs) => val => fp_2(
(result, conditionFunc) => (fp_19(result) || result == true) && conditionFunc(val),
null)(funcArgs);
const anyTrue = (...funcArgs) => val => fp_2(
(result, conditionFunc) => result == true || conditionFunc(val),
null)(funcArgs);
const insensitiveEquals = (str1, str2) => str1.trim().toLowerCase() === str2.trim().toLowerCase();
const isSomething = allTrue(isDefined, isNonNull, isNotNaN);
const isNothing = not(isSomething);
const isNothingOrEmpty = v => isNothing(v) || fp_9(v);
const somethingOrGetDefault = getDefaultFunc => val => (isSomething(val) ? val : getDefaultFunc());
const somethingOrDefault = (val, defaultVal) => somethingOrGetDefault(fp_14(defaultVal))(val);
const mapIfSomethingOrDefault = (mapFunc, defaultVal) => val => (isSomething(val) ? mapFunc(val) : defaultVal);
const mapIfSomethingOrBlank = mapFunc => mapIfSomethingOrDefault(mapFunc, '');
const none = predicate => collection => !fp_6(predicate)(collection);
const all = predicate => collection => none(v => !predicate(v))(collection);
const isNotEmpty = ob => !fp_9(ob);
const isNonEmptyArray = allTrue(fp_26, isNotEmpty);
const isNonEmptyString = allTrue(fp_23, isNotEmpty);
const tryOr = failFunc => (func, ...args) => {
try {
return func.apply(null, ...args);
} catch (_) {
return failFunc();
}
};
const tryAwaitOr = failFunc => async (func, ...args) => {
try {
return await func.apply(null, ...args);
} catch (_) {
return await failFunc();
}
};
const defineError = (func, errorPrefix) => {
try {
return func();
} catch (err) {
err.message = `${errorPrefix} : ${err.message}`;
throw err;
}
};
const tryOrIgnore = tryOr(() => { });
const tryAwaitOrIgnore = tryAwaitOr(async () => { });
const causesException = (func) => {
try {
func();
return false;
} catch (e) {
return true;
}
};
const executesWithoutException = func => !causesException(func);
const handleErrorWith = returnValInError => tryOr(fp_14(returnValInError));
const handleErrorWithUndefined = handleErrorWith(undefined);
const switchCase = (...cases) => (value) => {
const nextCase = () => lodash_7(cases)[0](value);
const nextResult = () => lodash_7(cases)[1](value);
if (fp_9(cases)) return; // undefined
if (nextCase() === true) return nextResult();
return switchCase(...lodash_9(cases))(value);
};
const isValue = val1 => val2 => (val1 === val2);
const isOneOf = (...vals) => val => fp_11(val)(vals);
const defaultCase = fp_14(true);
const memberMatches = (member, match) => obj => match(obj[member]);
const StartsWith = searchFor => searchIn => lodash_10(searchIn, searchFor);
const contains = val => array => (lodash_11(array, v => v === val) > -1);
const getHashCode = (s) => {
let hash = 0; let i; let char; let
l;
if (s.length == 0) return hash;
for (i = 0, l = s.length; i < l; i++) {
char = s.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash |= 0; // Convert to 32bit integer
}
// converting to string, but dont want a "-" prefixed
if (hash < 0) { return `n${(hash * -1).toString()}`; }
return hash.toString();
};
// thanks to https://blog.grossman.io/how-to-write-async-await-without-try-catch-blocks-in-javascript/
const awEx = async (promise) => {
try {
const result = await promise;
return [undefined, result];
} catch (error) {
return [error, undefined];
}
};
const isSafeInteger = n => fp_21(n)
&& n <= Number.MAX_SAFE_INTEGER
&& n >= 0 - Number.MAX_SAFE_INTEGER;
const toDateOrNull = s => (fp_19(s) ? null
: fp_25(s) ? s : new Date(s));
const toBoolOrNull = s => (fp_19(s) ? null
: s === 'true' || s === true);
const toNumberOrNull = s => (fp_19(s) ? null
: fp_61(s));
const isArrayOfString = opts => fp_26(opts) && all(fp_23)(opts);
const pause = async duration => new Promise(res => setTimeout(res, duration));
const retry = async (fn, retries, delay, ...args) => {
try {
return await fn(...args);
} catch (err) {
if (retries > 1) {
return await pause(delay).then(async () => await retry(fn, (retries - 1), delay, ...args));
}
throw err;
}
};
var common$1 = {
ifExists,
getOrDefault,
isDefined,
isNonNull,
isNotNaN,
allTrue,
isSomething,
mapIfSomethingOrDefault,
mapIfSomethingOrBlank,
configFolder,
fieldDefinitions,
isNothing,
not,
switchCase,
defaultCase,
StartsWith,
contains,
templateDefinitions,
handleErrorWith,
handleErrorWithUndefined,
tryOr,
tryOrIgnore,
tryAwaitOr,
tryAwaitOrIgnore,
dirIndex,
keySep,
$,
$$,
getDirFomKey,
getFileFromKey,
splitKey,
somethingOrDefault,
getIndexKeyFromFileKey,
joinKey,
somethingOrGetDefault,
appDefinitionFile,
isValue,
all,
isOneOf,
memberMatches,
defineError,
anyTrue,
isNonEmptyArray,
causesException,
executesWithoutException,
none,
getHashCode,
awEx,
apiWrapper,
events,
eventsList,
isNothingOrEmpty,
isSafeInteger,
toNumber: fp_61,
toDate: toDateOrNull,
toBool: toBoolOrNull,
isArrayOfString,
getLock,
NO_LOCK,
isNolock,
insensitiveEquals,
pause,
retry,
};
const stringNotEmpty = s => isSomething(s) && s.trim().length > 0;
const makerule = (field, error, isValid) => ({ field, error, isValid });
const validationError = (rule, item) => ({ ...rule, item });
const applyRuleSet = ruleSet => itemToValidate => $(ruleSet, [
fp_7(applyRule(itemToValidate)),
fp_8(isSomething),
]);
const applyRule = itemTovalidate => rule => (rule.isValid(itemTovalidate)
? null
: validationError(rule, itemTovalidate));
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
var filters = new Map();
var limiters = new Map();
function compileRawExpression(src) {
return new Function('context', 'tempVars', // eslint-disable-line
("const sandbox = $nxCompileToSandbox(context, tempVars)\n try { with (sandbox) { return " + src + " } } catch (err) {\n if (!(err instanceof TypeError)) throw err\n }\n $nxClearSandbox()"));
}
function compileRawCode(src) {
return new Function('context', 'tempVars', // eslint-disable-line
("const sandbox = $nxCompileToSandbox(context, tempVars)\n with (sandbox) { " + src + " }\n $nxClearSandbox()"));
}
var filterRegex = /(?:[^\|]|\|\|)+/g;
var limiterRegex = /(?:[^&]|&&)+/g;
var argsRegex = /\S+/g;
function parseExpression(src) {
var tokens = src.match(filterRegex);
if (tokens.length === 1) {
return compileRawExpression(tokens[0]);
}
var expression = {
exec: compileRawExpression(tokens[0]),
filters: []
};
for (var i = 1; i < tokens.length; i++) {
var filterTokens = tokens[i].match(argsRegex);
var filterName = filterTokens.shift();
var effect = filters.get(filterName);
if (!effect) {
throw new Error(("There is no filter named: " + filterName + "."));
}
expression.filters.push({ effect: effect, argExpressions: filterTokens.map(compileRawExpression) });
}
return expression;
}
function parseCode(src) {
var tokens = src.match(limiterRegex);
if (tokens.length === 1) {
return compileRawCode(tokens[0]);
}
var code = {
exec: compileRawCode(tokens[0]),
limiters: []
};
for (var i = 1; i < tokens.length; i++) {
var limiterTokens = tokens[i].match(argsRegex);
var limiterName = limiterTokens.shift();
var effect = limiters.get(limiterName);
if (!effect) {
throw new Error(("There is no limiter named: " + limiterName + "."));
}
code.limiters.push({ effect: effect, argExpressions: limiterTokens.map(compileRawExpression) });
}
return code;
}
var expressionCache = new Map();
var codeCache = new Map();
function compileExpression(src) {
if (typeof src !== 'string') {
throw new TypeError('First argument must be a string.');
}
var expression = expressionCache.get(src);
if (!expression) {
expression = parseExpression(src);
expressionCache.set(src, expression);
}
if (typeof expression === 'function') {
return expression;
}
return function evaluateExpression(context, tempVars) {
var value = expression.exec(context, tempVars);
for (var i = 0, list = expression.filters; i < list.length; i += 1) {
var filter = list[i];
var args = filter.argExpressions.map(evaluateArgExpression, context);
value = filter.effect.apply(filter, [ value ].concat( args ));
}
return value;
};
}
function compileCode(src) {
if (typeof src !== 'string') {
throw new TypeError('First argument must be a string.');
}
var code = codeCache.get(src);
if (!code) {
code = parseCode(src);
codeCache.set(src, code);
}
if (typeof code === 'function') {
return code;
}
var context = {};
return function evaluateCode(state, tempVars) {
var i = 0;
function next() {
Object.assign(context, tempVars);
if (i < code.limiters.length) {
var limiter = code.limiters[i++];
var args = limiter.argExpressions.map(evaluateArgExpression, state);
limiter.effect.apply(limiter, [ next, context ].concat( args ));
} else {
code.exec(state, tempVars);
}
}
next();
};
}
function evaluateArgExpression(argExpression) {
return argExpression(this);
}
var hasHandler = { has: has };
var allHandlers = { has: has, get: get$1 };
var globals = new Set();
var temp;
var globalObj;
if (typeof window !== 'undefined') { globalObj = window; } // eslint-disable-line
else if (typeof global$1 !== 'undefined') { globalObj = global$1; } // eslint-disable-line
else if (typeof self !== 'undefined') { globalObj = self; } // eslint-disable-line
globalObj.$nxCompileToSandbox = toSandbox;
globalObj.$nxClearSandbox = clearSandbox;
function has(target, key) {
return globals.has(key) ? key in target : true;
}
function get$1(target, key) {
return key in temp ? temp[key] : target[key];
}
function toSandbox(obj, tempVars) {
if (tempVars) {
temp = tempVars;
return new Proxy(obj, allHandlers);
}
return new Proxy(obj, hasHandler);
}
function clearSandbox() {
temp = undefined;
}
const mapEval = 'MAP_EVALUATE';
const mapCompile = 'MAP_COMPILE';
const compileFilter = index => compileExpression(index.filter);
const compileMap = index => compileCode(index.map);
const mapRecord = (record, index) => {
const recordClone = fp_4(record);
const context = { record: recordClone };
const map = index.map ? index.map : 'return {...record};';
const compiledMap = defineError(
() => compileCode(map),
mapCompile,
);
const mapped = defineError(
() => compiledMap(context),
mapEval,
);
const mappedKeys = fp_32(mapped);
for (let i = 0; i < mappedKeys.length; i++) {
const key = mappedKeys[i];
mapped[key] = fp_3(mapped[key]) ? null : mapped[key];
if (fp_46(mapped[key])) {
delete mapped[key];
}
}
mapped.key = record.key;
mapped.sortKey = index.getSortKey
? compileCode(index.getSortKey)(context)
: record.id;
return mapped;
};
const indexTypes = { reference: 'reference', ancestor: 'ancestor' };
const indexRuleSet = [
makerule('map', 'index has no map function',
index => isNonEmptyString(index.map)),
makerule('map', "index's map function does not compile",
index => !isNonEmptyString(index.map)
|| executesWithoutException(() => compileMap(index))),
makerule('filter', "index's filter function does not compile",
index => !isNonEmptyString(index.filter)
|| executesWithoutException(() => compileFilter(index))),
makerule('name', 'must declare a name for index',
index => isNonEmptyString(index.name)),
makerule('name', 'there is a duplicate named index on this node',
index => fp_9(index.name)
|| fp_10('name')(index.parent().indexes)[index.name] === 1),
makerule('indexType', 'reference index may only exist on a record node',
index => isRecord(index.parent())
|| index.indexType !== indexTypes.reference),
makerule('indexType', `index type must be one of: ${fp_41(', ')(fp_32(indexTypes))}`,
index => fp_11(index.indexType)(fp_32(indexTypes))),
];
const getFlattenedHierarchy = (appHierarchy, useCached = true) => {
if (isSomething(appHierarchy.getFlattenedHierarchy) && useCached) { return appHierarchy.getFlattenedHierarchy(); }
const flattenHierarchy = (currentNode, flattened) => {
flattened.push(currentNode);
if ((!currentNode.children
|| currentNode.children.length === 0)
&& (!currentNode.indexes
|| currentNode.indexes.length === 0)
&& (!currentNode.aggregateGroups
|| currentNode.aggregateGroups.length === 0)) {
return flattened;
}
const unionIfAny = l2 => l1 => fp_1(l1)(!l2 ? [] : l2);
const children = $([], [
unionIfAny(currentNode.children),
unionIfAny(currentNode.indexes),
unionIfAny(currentNode.aggregateGroups),
]);
for (const child of children) {
flattenHierarchy(child, flattened);
}
return flattened;
};
appHierarchy.getFlattenedHierarchy = () => flattenHierarchy(appHierarchy, []);
return appHierarchy.getFlattenedHierarchy();
};
const getLastPartInKey = key => fp_12(splitKey(key));
const getNodesInPath = appHierarchy => key => $(appHierarchy, [
getFlattenedHierarchy,
fp_8(n => new RegExp(`${n.pathRegx()}`).test(key)),
]);
const getExactNodeForPath = appHierarchy => key => $(appHierarchy, [
getFlattenedHierarchy,
fp_13(n => new RegExp(`${n.pathRegx()}$`).test(key)),
]);
const getNodeForCollectionPath = appHierarchy => collectionKey => $(appHierarchy, [
getFlattenedHierarchy,
fp_13(n => (isCollectionRecord(n)
&& new RegExp(`${n.collectionPathRegx()}$`).test(collectionKey))),
]);
const hasMatchingAncestor = ancestorPredicate => decendantNode => switchCase(
[node => isNothing(node.parent()),
fp_14(false)],
[node => ancestorPredicate(node.parent()),
fp_14(true)],
[defaultCase,
node => hasMatchingAncestor(ancestorPredicate)(node.parent())],
)(decendantNode);
const getNode = (appHierarchy, nodeKey) => $(appHierarchy, [
getFlattenedHierarchy,
fp_13(n => n.nodeKey() === nodeKey
|| (isCollectionRecord(n)
&& n.collectionNodeKey() === nodeKey)),
]);
const getNodeByKeyOrNodeKey = (appHierarchy, keyOrNodeKey) => {
const nodeByKey = getExactNodeForPath(appHierarchy)(keyOrNodeKey);
return isNothing(nodeByKey)
? getNode(appHierarchy, keyOrNodeKey)
: nodeByKey;
};
const isNode = (appHierarchy, key) => isSomething(getExactNodeForPath(appHierarchy)(key));
const getActualKeyOfParent = (parentNodeKey, actualChildKey) => $(actualChildKey, [
splitKey,
fp_15(splitKey(parentNodeKey).length),
ks => joinKey(...ks),
]);
const getParentKey = (key) => {
return $(key, [
splitKey,
fp_15(splitKey(key).length - 1),
joinKey,
]);
};
const isKeyAncestorOf = ancestorKey => decendantNode => hasMatchingAncestor(p => p.nodeKey() === ancestorKey)(decendantNode);
const hasNoMatchingAncestors = parentPredicate => node => !hasMatchingAncestor(parentPredicate)(node);
const findField = (recordNode, fieldName) => fp_13(f => f.name == fieldName)(recordNode.fields);
const isAncestor = decendant => ancestor => isKeyAncestorOf(ancestor.nodeKey())(decendant);
const isDecendant = ancestor => decendant => isAncestor(decendant)(ancestor);
const getRecordNodeId = recordKey => $(recordKey, [
splitKey,
fp_12,
getRecordNodeIdFromId,
]);
const getRecordNodeIdFromId = recordId => $(recordId, [fp_5('-'), fp_16, parseInt]);
const getRecordNodeById = (hierarchy, recordId) => $(hierarchy, [
getFlattenedHierarchy,
fp_13(n => isRecord(n)
&& n.nodeId === getRecordNodeIdFromId(recordId)),
]);
const recordNodeIdIsAllowed = indexNode => nodeId => indexNode.allowedRecordNodeIds.length === 0
|| fp_11(nodeId)(indexNode.allowedRecordNodeIds);
const recordNodeIsAllowed = indexNode => recordNode => recordNodeIdIsAllowed(indexNode)(recordNode.nodeId);
const getAllowedRecordNodesForIndex = (appHierarchy, indexNode) => {
const recordNodes = $(appHierarchy, [
getFlattenedHierarchy,
fp_8(isRecord),
]);
if (isGlobalIndex(indexNode)) {
return $(recordNodes, [
fp_8(recordNodeIsAllowed(indexNode)),
]);
}
if (isAncestorIndex(indexNode)) {
return $(recordNodes, [
fp_8(isDecendant(indexNode.parent())),
fp_8(recordNodeIsAllowed(indexNode)),
]);
}
if (isReferenceIndex(indexNode)) {
return $(recordNodes, [
fp_8(n => fp_6(fieldReversesReferenceToIndex(indexNode))(n.fields)),
]);
}
};
const getNodeFromNodeKeyHash = hierarchy => hash => $(hierarchy, [
getFlattenedHierarchy,
fp_13(n => getHashCode(n.nodeKey()) === hash),
]);
const isRecord = node => isSomething(node) && node.type === 'record';
const isSingleRecord = node => isRecord(node) && node.isSingle;
const isCollectionRecord = node => isRecord(node) && !node.isSingle;
const isIndex = node => isSomething(node) && node.type === 'index';
const isaggregateGroup = node => isSomething(node) && node.type === 'aggregateGroup';
const isShardedIndex = node => isIndex(node) && isNonEmptyString(node.getShardName);
const isRoot = node => isSomething(node) && node.isRoot();
const isDecendantOfARecord = hasMatchingAncestor(isRecord);
const isGlobalIndex = node => isIndex(node) && isRoot(node.parent());
const isReferenceIndex = node => isIndex(node) && node.indexType === indexTypes.reference;
const isAncestorIndex = node => isIndex(node) && node.indexType === indexTypes.ancestor;
const fieldReversesReferenceToNode = node => field => field.type === 'reference'
&& fp_17(field.typeOptions.reverseIndexNodeKeys)(fp_7(i => i.nodeKey())(node.indexes))
.length > 0;
const fieldReversesReferenceToIndex = indexNode => field => field.type === 'reference'
&& fp_17(field.typeOptions.reverseIndexNodeKeys)([indexNode.nodeKey()])
.length > 0;
var hierarchyFunctions = {
getLastPartInKey,
getNodesInPath,
getExactNodeForPath,
hasMatchingAncestor,
getNode,
getNodeByKeyOrNodeKey,
isNode,
getActualKeyOfParent,
getParentKey,
isKeyAncestorOf,
hasNoMatchingAncestors,
findField,
isAncestor,
isDecendant,
getRecordNodeId,
getRecordNodeIdFromId,
getRecordNodeById,
recordNodeIdIsAllowed,
recordNodeIsAllowed,
getAllowedRecordNodesForIndex,
getNodeFromNodeKeyHash,
isRecord,
isCollectionRecord,
isIndex,
isaggregateGroup,
isShardedIndex,
isRoot,
isDecendantOfARecord,
isGlobalIndex,
isReferenceIndex,
isAncestorIndex,
fieldReversesReferenceToNode,
fieldReversesReferenceToIndex,
getFlattenedHierarchy,
};
const getSafeFieldParser = (tryParse, defaultValueFunctions) => (field, record) => {
if (fp_20(field.name)(record)) {
return getSafeValueParser(tryParse, defaultValueFunctions)(record[field.name]);
}
return defaultValueFunctions[field.getUndefinedValue]();
};
const getSafeValueParser = (tryParse, defaultValueFunctions) => (value) => {
const parsed = tryParse(value);
if (parsed.success) {
return parsed.value;
}
return defaultValueFunctions.default();
};
const getNewValue = (tryParse, defaultValueFunctions) => (field) => {
const getInitialValue = fp_3(field) || fp_3(field.getInitialValue)
? 'default'
: field.getInitialValue;
return fp_20(getInitialValue)(defaultValueFunctions)
? defaultValueFunctions[getInitialValue]()
: getSafeValueParser(tryParse, defaultValueFunctions)(getInitialValue);
};
const typeFunctions = specificFunctions => lodash_12({
value: fp_14,
null: fp_14(null),
}, specificFunctions);
const validateTypeConstraints = validationRules => async (field, record, context) => {
const fieldValue = record[field.name];
const validateRule = async r => (!await r.isValid(fieldValue, field.typeOptions, context)
? r.getMessage(fieldValue, field.typeOptions)
: '');
const errors = [];
for (const r of validationRules) {
const err = await validateRule(r);
if (isNotEmpty(err)) errors.push(err);
}
return errors;
};
const getDefaultOptions = fp_18(v => v.defaultValue);
const makerule$1 = (isValid, getMessage) => ({ isValid, getMessage });
const parsedFailed = val => ({ success: false, value: val });
const parsedSuccess = val => ({ success: true, value: val });
const getDefaultExport = (name, tryParse, functions, options, validationRules, sampleValue, stringify) => ({
getNew: getNewValue(tryParse, functions),
safeParseField: getSafeFieldParser(tryParse, functions),
safeParseValue: getSafeValueParser(tryParse, functions),
tryParse,
name,
getDefaultOptions: () => getDefaultOptions(fp_4(options)),
optionDefinitions: options,
validateTypeConstraints: validateTypeConstraints(validationRules),
sampleValue,
stringify: val => (val === null || val === undefined
? '' : stringify(val)),
getDefaultValue: functions.default,
});
const stringFunctions = typeFunctions({
default: fp_14(null),
});
const stringTryParse = switchCase(
[fp_23, parsedSuccess],
[fp_19, parsedSuccess],
[defaultCase, v => parsedSuccess(v.toString())],
);
const options = {
maxLength: {
defaultValue: null,
isValid: n => n === null || isSafeInteger(n) && n > 0,
requirementDescription: 'max length must be null (no limit) or a greater than zero integer',
parse: toNumberOrNull,
},
values: {
defaultValue: null,
isValid: v => v === null || (isArrayOfString(v) && v.length > 0 && v.length < 10000),
requirementDescription: "'values' must be null (no values) or an arry of at least one string",
parse: s => s,
},
allowDeclaredValuesOnly: {
defaultValue: false,
isValid: fp_24,
requirementDescription: 'allowDeclaredValuesOnly must be true or false',
parse: toBoolOrNull,
},
};
const typeConstraints = [
makerule$1(async (val, opts) => val === null || opts.maxLength === null || val.length <= opts.maxLength,
(val, opts) => `value exceeds maximum length of ${opts.maxLength}`),
makerule$1(async (val, opts) => val === null
|| opts.allowDeclaredValuesOnly === false
|| fp_11(val)(opts.values),
(val) => `"${val}" does not exist in the list of allowed values`),
];
var string = getDefaultExport(
'string',
stringTryParse,
stringFunctions,
options,
typeConstraints,
'abcde',
str => str,
);
const boolFunctions = typeFunctions({
default: fp_14(null),
});
const boolTryParse = switchCase(
[fp_24, parsedSuccess],
[fp_19, parsedSuccess],
[isOneOf('true', '1', 'yes', 'on'), () => parsedSuccess(true)],
[isOneOf('false', '0', 'no', 'off'), () => parsedSuccess(false)],
[defaultCase, parsedFailed],
);
const options$1 = {
allowNulls: {
defaultValue: true,
isValid: fp_24,
requirementDescription: 'must be a true or false',
parse: toBoolOrNull,
},
};
const typeConstraints$1 = [
makerule$1(async (val, opts) => opts.allowNulls === true || val !== null,
() => 'field cannot be null'),
];
var bool = getDefaultExport(
'bool', boolTryParse, boolFunctions,
options$1, typeConstraints$1, true, JSON.stringify,
);
const numberFunctions = typeFunctions({
default: fp_14(null),
});
const parseStringtoNumberOrNull = (s) => {
const num = Number(s);
return isNaN(num) ? parsedFailed(s) : parsedSuccess(num);
};
const numberTryParse = switchCase(
[fp_22, parsedSuccess],
[fp_23, parseStringtoNumberOrNull],
[fp_19, parsedSuccess],
[defaultCase, parsedFailed],
);
const options$2 = {
maxValue: {
defaultValue: Number.MAX_SAFE_INTEGER,
isValid: isSafeInteger,
requirementDescription: 'must be a valid integer',
parse: toNumberOrNull,
},
minValue: {
defaultValue: 0 - Number.MAX_SAFE_INTEGER,
isValid: isSafeInteger,
requirementDescription: 'must be a valid integer',
parse: toNumberOrNull,
},
decimalPlaces: {
defaultValue: 0,
isValid: n => isSafeInteger(n) && n >= 0,
requirementDescription: 'must be a positive integer',
parse: toNumberOrNull,
},
};
const getDecimalPlaces = (val) => {
const splitDecimal = val.toString().split('.');
if (splitDecimal.length === 1) return 0;
return splitDecimal[1].length;
};
const typeConstraints$2 = [
makerule$1(async (val, opts) => val === null || opts.minValue === null || val >= opts.minValue,
(val, opts) => `value (${val.toString()}) must be greater than or equal to ${opts.minValue}`),
makerule$1(async (val, opts) => val === null || opts.maxValue === null || val <= opts.maxValue,
(val, opts) => `value (${val.toString()}) must be less than or equal to ${opts.minValue} options`),
makerule$1(async (val, opts) => val === null || opts.decimalPlaces >= getDecimalPlaces(val),
(val, opts) => `value (${val.toString()}) must have ${opts.decimalPlaces} decimal places or less`),
];
var number = getDefaultExport(
'number',
numberTryParse,
numberFunctions,
options$2,
typeConstraints$2,
1,
num => num.toString(),
);
const dateFunctions = typeFunctions({
default: fp_14(null),
now: () => new Date(),
});
const isValidDate = d => d instanceof Date && !isNaN(d);
const parseStringToDate = s => switchCase(
[isValidDate, parsedSuccess],
[defaultCase, parsedFailed],
)(new Date(s));
const dateTryParse = switchCase(
[fp_25, parsedSuccess],
[fp_23, parseStringToDate],
[fp_19, parsedSuccess],
[defaultCase, parsedFailed],
);
const options$3 = {
maxValue: {
defaultValue: new Date(32503680000000),
isValid: fp_25,
requirementDescription: 'must be a valid date',
parse: toDateOrNull,
},
minValue: {
defaultValue: new Date(-8520336000000),
isValid: fp_25,
requirementDescription: 'must be a valid date',
parse: toDateOrNull,
},
};
const typeConstraints$3 = [
makerule$1(async (val, opts) => val === null || opts.minValue === null || val >= opts.minValue,
(val, opts) => `value (${val.toString()}) must be greater than or equal to ${opts.minValue}`),
makerule$1(async (val, opts) => val === null || opts.maxValue === null || val <= opts.maxValue,
(val, opts) => `value (${val.toString()}) must be less than or equal to ${opts.minValue} options`),
];
var datetime = getDefaultExport(
'datetime',
dateTryParse,
dateFunctions,
options$3,
typeConstraints$3,
new Date(1984, 4, 1),
date => JSON.stringify(date).replace(new RegExp('"', 'g'), ''),
);
const arrayFunctions = () => typeFunctions({
default: fp_14([]),
});
const mapToParsedArrary = type => $$(
fp_7(i => type.safeParseValue(i)),
parsedSuccess,
);
const arrayTryParse = type => switchCase(
[fp_26, mapToParsedArrary(type)],
[defaultCase, parsedFailed],
);
const typeName = type => `array<${type}>`;
const options$4 = {
maxLength: {
defaultValue: 10000,
isValid: isSafeInteger,
requirementDescription: 'must be a positive integer',
parse: toNumberOrNull,
},
minLength: {
defaultValue: 0,
isValid: n => isSafeInteger(n) && n >= 0,
requirementDescription: 'must be a positive integer',
parse: toNumberOrNull,
},
};
const typeConstraints$4 = [
makerule$1(async (val, opts) => val === null || val.length >= opts.minLength,
(val, opts) => `must choose ${opts.minLength} or more options`),
makerule$1(async (val, opts) => val === null || val.length <= opts.maxLength,
(val, opts) => `cannot choose more than ${opts.maxLength} options`),
];
var array = type => getDefaultExport(
typeName(type.name),
arrayTryParse(type),
arrayFunctions(),
options$4,
typeConstraints$4,
[type.sampleValue],
JSON.stringify,
);
const referenceNothing = () => ({ key: '' });
const referenceFunctions = typeFunctions({
default: referenceNothing,
});
const hasStringValue = (ob, path) => fp_20(path)(ob)
&& fp_23(ob[path]);
const isObjectWithKey = v => fp_57(v)
&& hasStringValue(v, 'key');
const tryParseFromString = s => {
try {
const asObj = JSON.parse(s);
if(isObjectWithKey) {
return parsedSuccess(asObj);
}
}
catch(_) {
// EMPTY
}
return parsedFailed(s);
};
const referenceTryParse = v => switchCase(
[isObjectWithKey, parsedSuccess],
[fp_23, tryParseFromString],
[fp_19, () => parsedSuccess(referenceNothing())],
[defaultCase, parsedFailed],
)(v);
const options$5 = {
indexNodeKey: {
defaultValue: null,
isValid: isNonEmptyString,
requirementDescription: 'must be a non-empty string',
parse: s => s,
},
displayValue: {
defaultValue: '',
isValid: isNonEmptyString,
requirementDescription: 'must be a non-empty string',
parse: s => s,
},
reverseIndexNodeKeys: {
defaultValue: null,
isValid: v => isArrayOfString(v) && v.length > 0,
requirementDescription: 'must be a non-empty array of strings',
parse: s => s,
},
};
const isEmptyString = s => fp_23(s) && fp_9(s);
const ensureReferenceExists = async (val, opts, context) => isEmptyString(val.key)
|| await context.referenceExists(opts, val.key);
const typeConstraints$5 = [
makerule$1(
ensureReferenceExists,
(val, opts) => `"${val[opts.displayValue]}" does not exist in options list (key: ${val.key})`,
),
];
var reference = getDefaultExport(
'reference',
referenceTryParse,
referenceFunctions,
options$5,
typeConstraints$5,
{ key: 'key', value: 'value' },
JSON.stringify,
);
const illegalCharacters = '*?\\/:<>|\0\b\f\v';
const isLegalFilename = (filePath) => {
const fn = fileName(filePath);
return fn.length <= 255
&& fp_17(fn.split(''))(illegalCharacters.split('')).length === 0
&& none(f => f === '..')(splitKey(filePath));
};
const fileNothing = () => ({ relativePath: '', size: 0 });
const fileFunctions = typeFunctions({
default: fileNothing,
});
const fileTryParse = v => switchCase(
[isValidFile, parsedSuccess],
[fp_19, () => parsedSuccess(fileNothing())],
[defaultCase, parsedFailed],
)(v);
const fileName = filePath => $(filePath, [
splitKey,
fp_12,
]);
const isValidFile = f => !fp_19(f)
&& fp_20('relativePath')(f) && fp_20('size')(f)
&& fp_22(f.size)
&& fp_23(f.relativePath)
&& isLegalFilename(f.relativePath);
const options$6 = {};
const typeConstraints$6 = [];
var file$1 = getDefaultExport(
'file',
fileTryParse,
fileFunctions,
options$6,
typeConstraints$6,
{ relativePath: 'some_file.jpg', size: 1000 },
JSON.stringify,
);
const allTypes = () => {
const basicTypes = {
string, number, datetime, bool, reference, file: file$1,
};
const arrays = $(basicTypes, [
fp_32,
fp_7((k) => {
const kvType = {};
const concreteArray = array(basicTypes[k]);
kvType[concreteArray.name] = concreteArray;
return kvType;
}),
types => lodash_13({}, ...types),
]);
return lodash_12({}, basicTypes, arrays);
};
const all$1 = allTypes();
const getType = (typeName) => {
if (!fp_20(typeName)(all$1)) throw new BadRequestError(`Do not recognise type ${typeName}`);
return all$1[typeName];
};
const getSampleFieldValue = field => getType(field.type).sampleValue;
const getNewFieldValue = field => getType(field.type).getNew(field);
const getDefaultOptions$1 = type => getType(type).getDefaultOptions();
const detectType = (value) => {
if (fp_23(value)) return string;
if (fp_24(value)) return bool;
if (fp_22(value)) return number;
if (fp_25(value)) return datetime;
if (fp_26(value)) return array(detectType(value[0]));
if (fp_27(value)
&& fp_20('key')(value)
&& fp_20('value')(value)) return reference;
if (fp_27(value)
&& fp_20('relativePath')(value)
&& fp_20('size')(value)) return file$1;
throw new BadRequestError(`cannot determine type: ${JSON.stringify(value)}`);
};
// 5 minutes
const tempCodeExpiryLength = 5 * 60 * 1000;
const AUTH_FOLDER = '/.auth';
const USERS_LIST_FILE = joinKey(AUTH_FOLDER, 'users.json');
const userAuthFile = username => joinKey(AUTH_FOLDER, `auth_${username}.json`);
const USERS_LOCK_FILE = joinKey(AUTH_FOLDER, 'users_lock');
const ACCESS_LEVELS_FILE = joinKey(AUTH_FOLDER, 'access_levels.json');
const ACCESS_LEVELS_LOCK_FILE = joinKey(AUTH_FOLDER, 'access_levels_lock');
const permissionTypes = {
CREATE_RECORD: 'create record',
UPDATE_RECORD: 'update record',
READ_RECORD: 'read record',
DELETE_RECORD: 'delete record',
READ_INDEX: 'read index',
MANAGE_INDEX: 'manage index',
MANAGE_COLLECTION: 'manage collection',
WRITE_TEMPLATES: 'write templates',
CREATE_USER: 'create user',
SET_PASSWORD: 'set password',
CREATE_TEMPORARY_ACCESS: 'create temporary access',
ENABLE_DISABLE_USER: 'enable or disable user',
WRITE_ACCESS_LEVELS: 'write access levels',
LIST_USERS: 'list users',
LIST_ACCESS_LEVELS: 'list access levels',
EXECUTE_ACTION: 'execute action',
SET_USER_ACCESS_LEVELS: 'set user access levels',
};
const getUserByName = (users, name) => $(users, [
fp_13(u => u.name.toLowerCase() === name.toLowerCase()),
]);
const stripUserOfSensitiveStuff = (user) => {
const stripped = fp_28(user);
delete stripped.tempCode;
return stripped;
};
const parseTemporaryCode = fullCode => $(fullCode, [
fp_5(':'),
parts => ({
id: parts[1],
code: parts[2],
}),
]);
const isAuthorized = app => (permissionType, resourceKey) => apiWrapperSync(
app,
events.authApi.isAuthorized,
alwaysAuthorized,
{ resourceKey, permissionType },
_isAuthorized, app, permissionType, resourceKey,
);
const _isAuthorized = (app, permissionType, resourceKey) => {
if (!app.user) {
return false;
}
const validType = $(permissionTypes, [
fp_29,
fp_11(permissionType),
]);
if (!validType) {
return false;
}
const permMatchesResource = (userperm) => {
const nodeKey = isNothing(resourceKey)
? null
: isNode(app.hierarchy, resourceKey)
? getNodeByKeyOrNodeKey(
app.hierarchy, resourceKey,
).nodeKey()
: resourceKey;
return (userperm.type === permissionType)
&& (
isNothing(resourceKey)
|| nodeKey === userperm.nodeKey
);
};
return $(app.user.permissions, [
fp_6(permMatchesResource),
]);
};
const nodePermission = type => ({
add: (nodeKey, accessLevel) => accessLevel.permissions.push({ type, nodeKey }),
isAuthorized: resourceKey => app => isAuthorized(app)(type, resourceKey),
isNode: true,
get: nodeKey => ({ type, nodeKey }),
});
const staticPermission = type => ({
add: accessLevel => accessLevel.permissions.push({ type }),
isAuthorized: app => isAuthorized(app)(type),
isNode: false,
get: () => ({ type }),
});
const createRecord = nodePermission(permissionTypes.CREATE_RECORD);
const updateRecord = nodePermission(permissionTypes.UPDATE_RECORD);
const deleteRecord = nodePermission(permissionTypes.DELETE_RECORD);
const readRecord = nodePermission(permissionTypes.READ_RECORD);
const writeTemplates = staticPermission(permissionTypes.WRITE_TEMPLATES);
const createUser = staticPermission(permissionTypes.CREATE_USER);
const setPassword = staticPermission(permissionTypes.SET_PASSWORD);
const readIndex = nodePermission(permissionTypes.READ_INDEX);
const manageIndex = staticPermission(permissionTypes.MANAGE_INDEX);
const manageCollection = staticPermission(permissionTypes.MANAGE_COLLECTION);
const createTemporaryAccess = staticPermission(permissionTypes.CREATE_TEMPORARY_ACCESS);
const enableDisableUser = staticPermission(permissionTypes.ENABLE_DISABLE_USER);
const writeAccessLevels = staticPermission(permissionTypes.WRITE_ACCESS_LEVELS);
const listUsers = staticPermission(permissionTypes.LIST_USERS);
const listAccessLevels = staticPermission(permissionTypes.LIST_ACCESS_LEVELS);
const setUserAccessLevels = staticPermission(permissionTypes.SET_USER_ACCESS_LEVELS);
const executeAction = nodePermission(permissionTypes.EXECUTE_ACTION);
const alwaysAuthorized = () => true;
const permission = {
createRecord,
updateRecord,
deleteRecord,
readRecord,
writeTemplates,
createUser,
setPassword,
readIndex,
createTemporaryAccess,
enableDisableUser,
writeAccessLevels,
listUsers,
listAccessLevels,
manageIndex,
manageCollection,
executeAction,
setUserAccessLevels,
};
const getNew = app => (collectionKey, recordTypeName) => {
const recordNode = getRecordNode(app, collectionKey);
collectionKey=safeKey(collectionKey);
return apiWrapperSync(
app,
events.recordApi.getNew,
permission.createRecord.isAuthorized(recordNode.nodeKey()),
{ collectionKey, recordTypeName },
_getNew, recordNode, collectionKey,
);
};
const _getNew = (recordNode, collectionKey) => constructRecord(recordNode, getNewFieldValue, collectionKey);
const getRecordNode = (app, collectionKey) => {
collectionKey = safeKey(collectionKey);
return getNodeForCollectionPath(app.hierarchy)(collectionKey);
};
const getNewChild = app => (recordKey, collectionName, recordTypeName) =>
getNew(app)(joinKey(recordKey, collectionName), recordTypeName);
const constructRecord = (recordNode, getFieldValue, collectionKey) => {
const record = $(recordNode.fields, [
fp_30('name'),
fp_18(getFieldValue),
]);
record.id = `${recordNode.nodeId}-${shortid_1()}`;
record.key = joinKey(collectionKey, record.id);
record.isNew = true;
record.type = recordNode.name;
return record;
};
var lunr = createCommonjsModule(function (module, exports) {
(function(){
/**
* A convenience function for configuring and constructing
* a new lunr Index.
*
* A lunr.Builder instance is created and the pipeline setup
* with a trimmer, stop word filter and stemmer.
*
* This builder object is yielded to the configuration function
* that is passed as a parameter, allowing the list of fields
* and other builder parameters to be customised.
*
* All documents _must_ be added within the passed config function.
*
* @example
* var idx = lunr(function () {
* this.field('title')
* this.field('body')
* this.ref('id')
*
* documents.forEach(function (doc) {
* this.add(doc)
* }, this)
* })
*
* @see {@link lunr.Builder}
* @see {@link lunr.Pipeline}
* @see {@link lunr.trimmer}
* @see {@link lunr.stopWordFilter}
* @see {@link lunr.stemmer}
* @namespace {function} lunr
*/
var lunr = function (config) {
var builder = new lunr.Builder;
builder.pipeline.add(
lunr.trimmer,
lunr.stopWordFilter,
lunr.stemmer
);
builder.searchPipeline.add(
lunr.stemmer
);
config.call(builder, builder);
return builder.build()
};
lunr.version = "2.3.6";
/*!
* lunr.utils
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* A namespace containing utils for the rest of the lunr library
* @namespace lunr.utils
*/
lunr.utils = {};
/**
* Print a warning message to the console.
*
* @param {String} message The message to be printed.
* @memberOf lunr.utils
* @function
*/
lunr.utils.warn = (function (global) {
/* eslint-disable no-console */
return function (message) {
if (global.console && console.warn) {
console.warn(message);
}
}
/* eslint-enable no-console */
})(this);
/**
* Convert an object to a string.
*
* In the case of `null` and `undefined` the function returns
* the empty string, in all other cases the result of calling
* `toString` on the passed object is returned.
*
* @param {Any} obj The object to convert to a string.
* @return {String} string representation of the passed object.
* @memberOf lunr.utils
*/
lunr.utils.asString = function (obj) {
if (obj === void 0 || obj === null) {
return ""
} else {
return obj.toString()
}
};
/**
* Clones an object.
*
* Will create a copy of an existing object such that any mutations
* on the copy cannot affect the original.
*
* Only shallow objects are supported, passing a nested object to this
* function will cause a TypeError.
*
* Objects with primitives, and arrays of primitives are supported.
*
* @param {Object} obj The object to clone.
* @return {Object} a clone of the passed object.
* @throws {TypeError} when a nested object is passed.
* @memberOf Utils
*/
lunr.utils.clone = function (obj) {
if (obj === null || obj === undefined) {
return obj
}
var clone = Object.create(null),
keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
var key = keys[i],
val = obj[key];
if (Array.isArray(val)) {
clone[key] = val.slice();
continue
}
if (typeof val === 'string' ||
typeof val === 'number' ||
typeof val === 'boolean') {
clone[key] = val;
continue
}
throw new TypeError("clone is not deep and does not support nested objects")
}
return clone
};
lunr.FieldRef = function (docRef, fieldName, stringValue) {
this.docRef = docRef;
this.fieldName = fieldName;
this._stringValue = stringValue;
};
lunr.FieldRef.joiner = "/";
lunr.FieldRef.fromString = function (s) {
var n = s.indexOf(lunr.FieldRef.joiner);
if (n === -1) {
throw "malformed field ref string"
}
var fieldRef = s.slice(0, n),
docRef = s.slice(n + 1);
return new lunr.FieldRef (docRef, fieldRef, s)
};
lunr.FieldRef.prototype.toString = function () {
if (this._stringValue == undefined) {
this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef;
}
return this._stringValue
};
/*!
* lunr.Set
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* A lunr set.
*
* @constructor
*/
lunr.Set = function (elements) {
this.elements = Object.create(null);
if (elements) {
this.length = elements.length;
for (var i = 0; i < this.length; i++) {
this.elements[elements[i]] = true;
}
} else {
this.length = 0;
}
};
/**
* A complete set that contains all elements.
*
* @static
* @readonly
* @type {lunr.Set}
*/
lunr.Set.complete = {
intersect: function (other) {
return other
},
union: function (other) {
return other
},
contains: function () {
return true
}
};
/**
* An empty set that contains no elements.
*
* @static
* @readonly
* @type {lunr.Set}
*/
lunr.Set.empty = {
intersect: function () {
return this
},
union: function (other) {
return other
},
contains: function () {
return false
}
};
/**
* Returns true if this set contains the specified object.
*
* @param {object} object - Object whose presence in this set is to be tested.
* @returns {boolean} - True if this set contains the specified object.
*/
lunr.Set.prototype.contains = function (object) {
return !!this.elements[object]
};
/**
* Returns a new set containing only the elements that are present in both
* this set and the specified set.
*
* @param {lunr.Set} other - set to intersect with this set.
* @returns {lunr.Set} a new set that is the intersection of this and the specified set.
*/
lunr.Set.prototype.intersect = function (other) {
var a, b, elements, intersection = [];
if (other === lunr.Set.complete) {
return this
}
if (other === lunr.Set.empty) {
return other
}
if (this.length < other.length) {
a = this;
b = other;
} else {
a = other;
b = this;
}
elements = Object.keys(a.elements);
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (element in b.elements) {
intersection.push(element);
}
}
return new lunr.Set (intersection)
};
/**
* Returns a new set combining the elements of this and the specified set.
*
* @param {lunr.Set} other - set to union with this set.
* @return {lunr.Set} a new set that is the union of this and the specified set.
*/
lunr.Set.prototype.union = function (other) {
if (other === lunr.Set.complete) {
return lunr.Set.complete
}
if (other === lunr.Set.empty) {
return this
}
return new lunr.Set(Object.keys(this.elements).concat(Object.keys(other.elements)))
};
/**
* A function to calculate the inverse document frequency for
* a posting. This is shared between the builder and the index
*
* @private
* @param {object} posting - The posting for a given term
* @param {number} documentCount - The total number of documents.
*/
lunr.idf = function (posting, documentCount) {
var documentsWithTerm = 0;
for (var fieldName in posting) {
if (fieldName == '_index') continue // Ignore the term index, its not a field
documentsWithTerm += Object.keys(posting[fieldName]).length;
}
var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5);
return Math.log(1 + Math.abs(x))
};
/**
* A token wraps a string representation of a token
* as it is passed through the text processing pipeline.
*
* @constructor
* @param {string} [str=''] - The string token being wrapped.
* @param {object} [metadata={}] - Metadata associated with this token.
*/
lunr.Token = function (str, metadata) {
this.str = str || "";
this.metadata = metadata || {};
};
/**
* Returns the token string that is being wrapped by this object.
*
* @returns {string}
*/
lunr.Token.prototype.toString = function () {
return this.str
};
/**
* A token update function is used when updating or optionally
* when cloning a token.
*
* @callback lunr.Token~updateFunction
* @param {string} str - The string representation of the token.
* @param {Object} metadata - All metadata associated with this token.
*/
/**
* Applies the given function to the wrapped string token.
*
* @example
* token.update(function (str, metadata) {
* return str.toUpperCase()
* })
*
* @param {lunr.Token~updateFunction} fn - A function to apply to the token string.
* @returns {lunr.Token}
*/
lunr.Token.prototype.update = function (fn) {
this.str = fn(this.str, this.metadata);
return this
};
/**
* Creates a clone of this token. Optionally a function can be
* applied to the cloned token.
*
* @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token.
* @returns {lunr.Token}
*/
lunr.Token.prototype.clone = function (fn) {
fn = fn || function (s) { return s };
return new lunr.Token (fn(this.str, this.metadata), this.metadata)
};
/*!
* lunr.tokenizer
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* A function for splitting a string into tokens ready to be inserted into
* the search index. Uses `lunr.tokenizer.separator` to split strings, change
* the value of this property to change how strings are split into tokens.
*
* This tokenizer will convert its parameter to a string by calling `toString` and
* then will split this string on the character in `lunr.tokenizer.separator`.
* Arrays will have their elements converted to strings and wrapped in a lunr.Token.
*
* Optional metadata can be passed to the tokenizer, this metadata will be cloned and
* added as metadata to every token that is created from the object to be tokenized.
*
* @static
* @param {?(string|object|object[])} obj - The object to convert into tokens
* @param {?object} metadata - Optional metadata to associate with every token
* @returns {lunr.Token[]}
* @see {@link lunr.Pipeline}
*/
lunr.tokenizer = function (obj, metadata) {
if (obj == null || obj == undefined) {
return []
}
if (Array.isArray(obj)) {
return obj.map(function (t) {
return new lunr.Token(
lunr.utils.asString(t).toLowerCase(),
lunr.utils.clone(metadata)
)
})
}
var str = obj.toString().trim().toLowerCase(),
len = str.length,
tokens = [];
for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
var char = str.charAt(sliceEnd),
sliceLength = sliceEnd - sliceStart;
if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) {
if (sliceLength > 0) {
var tokenMetadata = lunr.utils.clone(metadata) || {};
tokenMetadata["position"] = [sliceStart, sliceLength];
tokenMetadata["index"] = tokens.length;
tokens.push(
new lunr.Token (
str.slice(sliceStart, sliceEnd),
tokenMetadata
)
);
}
sliceStart = sliceEnd + 1;
}
}
return tokens
};
/**
* The separator used to split a string into tokens. Override this property to change the behaviour of
* `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.
*
* @static
* @see lunr.tokenizer
*/
lunr.tokenizer.separator = /[\s\-]+/;
/*!
* lunr.Pipeline
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* lunr.Pipelines maintain an ordered list of functions to be applied to all
* tokens in documents entering the search index and queries being ran against
* the index.
*
* An instance of lunr.Index created with the lunr shortcut will contain a
* pipeline with a stop word filter and an English language stemmer. Extra
* functions can be added before or after either of these functions or these
* default functions can be removed.
*
* When run the pipeline will call each function in turn, passing a token, the
* index of that token in the original list of all tokens and finally a list of
* all the original tokens.
*
* The output of functions in the pipeline will be passed to the next function
* in the pipeline. To exclude a token from entering the index the function
* should return undefined, the rest of the pipeline will not be called with
* this token.
*
* For serialisation of pipelines to work, all functions used in an instance of
* a pipeline should be registered with lunr.Pipeline. Registered functions can
* then be loaded. If trying to load a serialised pipeline that uses functions
* that are not registered an error will be thrown.
*
* If not planning on serialising the pipeline then registering pipeline functions
* is not necessary.
*
* @constructor
*/
lunr.Pipeline = function () {
this._stack = [];
};
lunr.Pipeline.registeredFunctions = Object.create(null);
/**
* A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token
* string as well as all known metadata. A pipeline function can mutate the token string
* or mutate (or add) metadata for a given token.
*
* A pipeline function can indicate that the passed token should be discarded by returning
* null. This token will not be passed to any downstream pipeline functions and will not be
* added to the index.
*
* Multiple tokens can be returned by returning an array of tokens. Each token will be passed
* to any downstream pipeline functions and all will returned tokens will be added to the index.
*
* Any number of pipeline functions may be chained together using a lunr.Pipeline.
*
* @interface lunr.PipelineFunction
* @param {lunr.Token} token - A token from the document being processed.
* @param {number} i - The index of this token in the complete list of tokens for this document/field.
* @param {lunr.Token[]} tokens - All tokens for this document/field.
* @returns {(?lunr.Token|lunr.Token[])}
*/
/**
* Register a function with the pipeline.
*
* Functions that are used in the pipeline should be registered if the pipeline
* needs to be serialised, or a serialised pipeline needs to be loaded.
*
* Registering a function does not add it to a pipeline, functions must still be
* added to instances of the pipeline for them to be used when running a pipeline.
*
* @param {lunr.PipelineFunction} fn - The function to check for.
* @param {String} label - The label to register this function with
*/
lunr.Pipeline.registerFunction = function (fn, label) {
if (label in this.registeredFunctions) {
lunr.utils.warn('Overwriting existing registered function: ' + label);
}
fn.label = label;
lunr.Pipeline.registeredFunctions[fn.label] = fn;
};
/**
* Warns if the function is not registered as a Pipeline function.
*
* @param {lunr.PipelineFunction} fn - The function to check for.
* @private
*/
lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
var isRegistered = fn.label && (fn.label in this.registeredFunctions);
if (!isRegistered) {
lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn);
}
};
/**
* Loads a previously serialised pipeline.
*
* All functions to be loaded must already be registered with lunr.Pipeline.
* If any function from the serialised data has not been registered then an
* error will be thrown.
*
* @param {Object} serialised - The serialised pipeline to load.
* @returns {lunr.Pipeline}
*/
lunr.Pipeline.load = function (serialised) {
var pipeline = new lunr.Pipeline;
serialised.forEach(function (fnName) {
var fn = lunr.Pipeline.registeredFunctions[fnName];
if (fn) {
pipeline.add(fn);
} else {
throw new Error('Cannot load unregistered function: ' + fnName)
}
});
return pipeline
};
/**
* Adds new functions to the end of the pipeline.
*
* Logs a warning if the function has not been registered.
*
* @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline.
*/
lunr.Pipeline.prototype.add = function () {
var fns = Array.prototype.slice.call(arguments);
fns.forEach(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn);
this._stack.push(fn);
}, this);
};
/**
* Adds a single function after a function that already exists in the
* pipeline.
*
* Logs a warning if the function has not been registered.
*
* @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
* @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
*/
lunr.Pipeline.prototype.after = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn);
var pos = this._stack.indexOf(existingFn);
if (pos == -1) {
throw new Error('Cannot find existingFn')
}
pos = pos + 1;
this._stack.splice(pos, 0, newFn);
};
/**
* Adds a single function before a function that already exists in the
* pipeline.
*
* Logs a warning if the function has not been registered.
*
* @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
* @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
*/
lunr.Pipeline.prototype.before = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn);
var pos = this._stack.indexOf(existingFn);
if (pos == -1) {
throw new Error('Cannot find existingFn')
}
this._stack.splice(pos, 0, newFn);
};
/**
* Removes a function from the pipeline.
*
* @param {lunr.PipelineFunction} fn The function to remove from the pipeline.
*/
lunr.Pipeline.prototype.remove = function (fn) {
var pos = this._stack.indexOf(fn);
if (pos == -1) {
return
}
this._stack.splice(pos, 1);
};
/**
* Runs the current list of functions that make up the pipeline against the
* passed tokens.
*
* @param {Array} tokens The tokens to run through the pipeline.
* @returns {Array}
*/
lunr.Pipeline.prototype.run = function (tokens) {
var stackLength = this._stack.length;
for (var i = 0; i < stackLength; i++) {
var fn = this._stack[i];
var memo = [];
for (var j = 0; j < tokens.length; j++) {
var result = fn(tokens[j], j, tokens);
if (result === void 0 || result === '') continue
if (Array.isArray(result)) {
for (var k = 0; k < result.length; k++) {
memo.push(result[k]);
}
} else {
memo.push(result);
}
}
tokens = memo;
}
return tokens
};
/**
* Convenience method for passing a string through a pipeline and getting
* strings out. This method takes care of wrapping the passed string in a
* token and mapping the resulting tokens back to strings.
*
* @param {string} str - The string to pass through the pipeline.
* @param {?object} metadata - Optional metadata to associate with the token
* passed to the pipeline.
* @returns {string[]}
*/
lunr.Pipeline.prototype.runString = function (str, metadata) {
var token = new lunr.Token (str, metadata);
return this.run([token]).map(function (t) {
return t.toString()
})
};
/**
* Resets the pipeline by removing any existing processors.
*
*/
lunr.Pipeline.prototype.reset = function () {
this._stack = [];
};
/**
* Returns a representation of the pipeline ready for serialisation.
*
* Logs a warning if the function has not been registered.
*
* @returns {Array}
*/
lunr.Pipeline.prototype.toJSON = function () {
return this._stack.map(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn);
return fn.label
})
};
/*!
* lunr.Vector
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* A vector is used to construct the vector space of documents and queries. These
* vectors support operations to determine the similarity between two documents or
* a document and a query.
*
* Normally no parameters are required for initializing a vector, but in the case of
* loading a previously dumped vector the raw elements can be provided to the constructor.
*
* For performance reasons vectors are implemented with a flat array, where an elements
* index is immediately followed by its value. E.g. [index, value, index, value]. This
* allows the underlying array to be as sparse as possible and still offer decent
* performance when being used for vector calculations.
*
* @constructor
* @param {Number[]} [elements] - The flat list of element index and element value pairs.
*/
lunr.Vector = function (elements) {
this._magnitude = 0;
this.elements = elements || [];
};
/**
* Calculates the position within the vector to insert a given index.
*
* This is used internally by insert and upsert. If there are duplicate indexes then
* the position is returned as if the value for that index were to be updated, but it
* is the callers responsibility to check whether there is a duplicate at that index
*
* @param {Number} insertIdx - The index at which the element should be inserted.
* @returns {Number}
*/
lunr.Vector.prototype.positionForIndex = function (index) {
// For an empty vector the tuple can be inserted at the beginning
if (this.elements.length == 0) {
return 0
}
var start = 0,
end = this.elements.length / 2,
sliceLength = end - start,
pivotPoint = Math.floor(sliceLength / 2),
pivotIndex = this.elements[pivotPoint * 2];
while (sliceLength > 1) {
if (pivotIndex < index) {
start = pivotPoint;
}
if (pivotIndex > index) {
end = pivotPoint;
}
if (pivotIndex == index) {
break
}
sliceLength = end - start;
pivotPoint = start + Math.floor(sliceLength / 2);
pivotIndex = this.elements[pivotPoint * 2];
}
if (pivotIndex == index) {
return pivotPoint * 2
}
if (pivotIndex > index) {
return pivotPoint * 2
}
if (pivotIndex < index) {
return (pivotPoint + 1) * 2
}
};
/**
* Inserts an element at an index within the vector.
*
* Does not allow duplicates, will throw an error if there is already an entry
* for this index.
*
* @param {Number} insertIdx - The index at which the element should be inserted.
* @param {Number} val - The value to be inserted into the vector.
*/
lunr.Vector.prototype.insert = function (insertIdx, val) {
this.upsert(insertIdx, val, function () {
throw "duplicate index"
});
};
/**
* Inserts or updates an existing index within the vector.
*
* @param {Number} insertIdx - The index at which the element should be inserted.
* @param {Number} val - The value to be inserted into the vector.
* @param {function} fn - A function that is called for updates, the existing value and the
* requested value are passed as arguments
*/
lunr.Vector.prototype.upsert = function (insertIdx, val, fn) {
this._magnitude = 0;
var position = this.positionForIndex(insertIdx);
if (this.elements[position] == insertIdx) {
this.elements[position + 1] = fn(this.elements[position + 1], val);
} else {
this.elements.splice(position, 0, insertIdx, val);
}
};
/**
* Calculates the magnitude of this vector.
*
* @returns {Number}
*/
lunr.Vector.prototype.magnitude = function () {
if (this._magnitude) return this._magnitude
var sumOfSquares = 0,
elementsLength = this.elements.length;
for (var i = 1; i < elementsLength; i += 2) {
var val = this.elements[i];
sumOfSquares += val * val;
}
return this._magnitude = Math.sqrt(sumOfSquares)
};
/**
* Calculates the dot product of this vector and another vector.
*
* @param {lunr.Vector} otherVector - The vector to compute the dot product with.
* @returns {Number}
*/
lunr.Vector.prototype.dot = function (otherVector) {
var dotProduct = 0,
a = this.elements, b = otherVector.elements,
aLen = a.length, bLen = b.length,
aVal = 0, bVal = 0,
i = 0, j = 0;
while (i < aLen && j < bLen) {
aVal = a[i], bVal = b[j];
if (aVal < bVal) {
i += 2;
} else if (aVal > bVal) {
j += 2;
} else if (aVal == bVal) {
dotProduct += a[i + 1] * b[j + 1];
i += 2;
j += 2;
}
}
return dotProduct
};
/**
* Calculates the similarity between this vector and another vector.
*
* @param {lunr.Vector} otherVector - The other vector to calculate the
* similarity with.
* @returns {Number}
*/
lunr.Vector.prototype.similarity = function (otherVector) {
return this.dot(otherVector) / this.magnitude() || 0
};
/**
* Converts the vector to an array of the elements within the vector.
*
* @returns {Number[]}
*/
lunr.Vector.prototype.toArray = function () {
var output = new Array (this.elements.length / 2);
for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {
output[j] = this.elements[i];
}
return output
};
/**
* A JSON serializable representation of the vector.
*
* @returns {Number[]}
*/
lunr.Vector.prototype.toJSON = function () {
return this.elements
};
/* eslint-disable */
/*!
* lunr.stemmer
* Copyright (C) 2019 Oliver Nightingale
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
*/
/**
* lunr.stemmer is an english language stemmer, this is a JavaScript
* implementation of the PorterStemmer taken from http://tartarus.org/~martin
*
* @static
* @implements {lunr.PipelineFunction}
* @param {lunr.Token} token - The string to stem
* @returns {lunr.Token}
* @see {@link lunr.Pipeline}
* @function
*/
lunr.stemmer = (function(){
var step2list = {
"ational" : "ate",
"tional" : "tion",
"enci" : "ence",
"anci" : "ance",
"izer" : "ize",
"bli" : "ble",
"alli" : "al",
"entli" : "ent",
"eli" : "e",
"ousli" : "ous",
"ization" : "ize",
"ation" : "ate",
"ator" : "ate",
"alism" : "al",
"iveness" : "ive",
"fulness" : "ful",
"ousness" : "ous",
"aliti" : "al",
"iviti" : "ive",
"biliti" : "ble",
"logi" : "log"
},
step3list = {
"icate" : "ic",
"ative" : "",
"alize" : "al",
"iciti" : "ic",
"ical" : "ic",
"ful" : "",
"ness" : ""
},
c = "[^aeiou]", // consonant
v = "[aeiouy]", // vowel
C = c + "[^aeiouy]*", // consonant sequence
V = v + "[aeiou]*", // vowel sequence
mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0
meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1
mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1
s_v = "^(" + C + ")?" + v; // vowel in stem
var re_mgr0 = new RegExp(mgr0);
var re_mgr1 = new RegExp(mgr1);
var re_meq1 = new RegExp(meq1);
var re_s_v = new RegExp(s_v);
var re_1a = /^(.+?)(ss|i)es$/;
var re2_1a = /^(.+?)([^s])s$/;
var re_1b = /^(.+?)eed$/;
var re2_1b = /^(.+?)(ed|ing)$/;
var re_1b_2 = /.$/;
var re2_1b_2 = /(at|bl|iz)$/;
var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
var re_1c = /^(.+?[^aeiou])y$/;
var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
var re2_4 = /^(.+?)(s|t)(ion)$/;
var re_5 = /^(.+?)e$/;
var re_5_1 = /ll$/;
var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
var porterStemmer = function porterStemmer(w) {
var stem,
suffix,
firstch,
re,
re2,
re3,
re4;
if (w.length < 3) { return w; }
firstch = w.substr(0,1);
if (firstch == "y") {
w = firstch.toUpperCase() + w.substr(1);
}
// Step 1a
re = re_1a;
re2 = re2_1a;
if (re.test(w)) { w = w.replace(re,"$1$2"); }
else if (re2.test(w)) { w = w.replace(re2,"$1$2"); }
// Step 1b
re = re_1b;
re2 = re2_1b;
if (re.test(w)) {
var fp = re.exec(w);
re = re_mgr0;
if (re.test(fp[1])) {
re = re_1b_2;
w = w.replace(re,"");
}
} else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = re_s_v;
if (re2.test(stem)) {
w = stem;
re2 = re2_1b_2;
re3 = re3_1b_2;
re4 = re4_1b_2;
if (re2.test(w)) { w = w + "e"; }
else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); }
else if (re4.test(w)) { w = w + "e"; }
}
}
// Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)
re = re_1c;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
w = stem + "i";
}
// Step 2
re = re_2;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = re_mgr0;
if (re.test(stem)) {
w = stem + step2list[suffix];
}
}
// Step 3
re = re_3;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = re_mgr0;
if (re.test(stem)) {
w = stem + step3list[suffix];
}
}
// Step 4
re = re_4;
re2 = re2_4;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = re_mgr1;
if (re.test(stem)) {
w = stem;
}
} else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = re_mgr1;
if (re2.test(stem)) {
w = stem;
}
}
// Step 5
re = re_5;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = re_mgr1;
re2 = re_meq1;
re3 = re3_5;
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {
w = stem;
}
}
re = re_5_1;
re2 = re_mgr1;
if (re.test(w) && re2.test(w)) {
re = re_1b_2;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y") {
w = firstch.toLowerCase() + w.substr(1);
}
return w;
};
return function (token) {
return token.update(porterStemmer);
}
})();
lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer');
/*!
* lunr.stopWordFilter
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* lunr.generateStopWordFilter builds a stopWordFilter function from the provided
* list of stop words.
*
* The built in lunr.stopWordFilter is built using this generator and can be used
* to generate custom stopWordFilters for applications or non English languages.
*
* @function
* @param {Array} token The token to pass through the filter
* @returns {lunr.PipelineFunction}
* @see lunr.Pipeline
* @see lunr.stopWordFilter
*/
lunr.generateStopWordFilter = function (stopWords) {
var words = stopWords.reduce(function (memo, stopWord) {
memo[stopWord] = stopWord;
return memo
}, {});
return function (token) {
if (token && words[token.toString()] !== token.toString()) return token
}
};
/**
* lunr.stopWordFilter is an English language stop word list filter, any words
* contained in the list will not be passed through the filter.
*
* This is intended to be used in the Pipeline. If the token does not pass the
* filter then undefined will be returned.
*
* @function
* @implements {lunr.PipelineFunction}
* @params {lunr.Token} token - A token to check for being a stop word.
* @returns {lunr.Token}
* @see {@link lunr.Pipeline}
*/
lunr.stopWordFilter = lunr.generateStopWordFilter([
'a',
'able',
'about',
'across',
'after',
'all',
'almost',
'also',
'am',
'among',
'an',
'and',
'any',
'are',
'as',
'at',
'be',
'because',
'been',
'but',
'by',
'can',
'cannot',
'could',
'dear',
'did',
'do',
'does',
'either',
'else',
'ever',
'every',
'for',
'from',
'get',
'got',
'had',
'has',
'have',
'he',
'her',
'hers',
'him',
'his',
'how',
'however',
'i',
'if',
'in',
'into',
'is',
'it',
'its',
'just',
'least',
'let',
'like',
'likely',
'may',
'me',
'might',
'most',
'must',
'my',
'neither',
'no',
'nor',
'not',
'of',
'off',
'often',
'on',
'only',
'or',
'other',
'our',
'own',
'rather',
'said',
'say',
'says',
'she',
'should',
'since',
'so',
'some',
'than',
'that',
'the',
'their',
'them',
'then',
'there',
'these',
'they',
'this',
'tis',
'to',
'too',
'twas',
'us',
'wants',
'was',
'we',
'were',
'what',
'when',
'where',
'which',
'while',
'who',
'whom',
'why',
'will',
'with',
'would',
'yet',
'you',
'your'
]);
lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter');
/*!
* lunr.trimmer
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* lunr.trimmer is a pipeline function for trimming non word
* characters from the beginning and end of tokens before they
* enter the index.
*
* This implementation may not work correctly for non latin
* characters and should either be removed or adapted for use
* with languages with non-latin characters.
*
* @static
* @implements {lunr.PipelineFunction}
* @param {lunr.Token} token The token to pass through the filter
* @returns {lunr.Token}
* @see lunr.Pipeline
*/
lunr.trimmer = function (token) {
return token.update(function (s) {
return s.replace(/^\W+/, '').replace(/\W+$/, '')
})
};
lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer');
/*!
* lunr.TokenSet
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* A token set is used to store the unique list of all tokens
* within an index. Token sets are also used to represent an
* incoming query to the index, this query token set and index
* token set are then intersected to find which tokens to look
* up in the inverted index.
*
* A token set can hold multiple tokens, as in the case of the
* index token set, or it can hold a single token as in the
* case of a simple query token set.
*
* Additionally token sets are used to perform wildcard matching.
* Leading, contained and trailing wildcards are supported, and
* from this edit distance matching can also be provided.
*
* Token sets are implemented as a minimal finite state automata,
* where both common prefixes and suffixes are shared between tokens.
* This helps to reduce the space used for storing the token set.
*
* @constructor
*/
lunr.TokenSet = function () {
this.final = false;
this.edges = {};
this.id = lunr.TokenSet._nextId;
lunr.TokenSet._nextId += 1;
};
/**
* Keeps track of the next, auto increment, identifier to assign
* to a new tokenSet.
*
* TokenSets require a unique identifier to be correctly minimised.
*
* @private
*/
lunr.TokenSet._nextId = 1;
/**
* Creates a TokenSet instance from the given sorted array of words.
*
* @param {String[]} arr - A sorted array of strings to create the set from.
* @returns {lunr.TokenSet}
* @throws Will throw an error if the input array is not sorted.
*/
lunr.TokenSet.fromArray = function (arr) {
var builder = new lunr.TokenSet.Builder;
for (var i = 0, len = arr.length; i < len; i++) {
builder.insert(arr[i]);
}
builder.finish();
return builder.root
};
/**
* Creates a token set from a query clause.
*
* @private
* @param {Object} clause - A single clause from lunr.Query.
* @param {string} clause.term - The query clause term.
* @param {number} [clause.editDistance] - The optional edit distance for the term.
* @returns {lunr.TokenSet}
*/
lunr.TokenSet.fromClause = function (clause) {
if ('editDistance' in clause) {
return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)
} else {
return lunr.TokenSet.fromString(clause.term)
}
};
/**
* Creates a token set representing a single string with a specified
* edit distance.
*
* Insertions, deletions, substitutions and transpositions are each
* treated as an edit distance of 1.
*
* Increasing the allowed edit distance will have a dramatic impact
* on the performance of both creating and intersecting these TokenSets.
* It is advised to keep the edit distance less than 3.
*
* @param {string} str - The string to create the token set from.
* @param {number} editDistance - The allowed edit distance to match.
* @returns {lunr.Vector}
*/
lunr.TokenSet.fromFuzzyString = function (str, editDistance) {
var root = new lunr.TokenSet;
var stack = [{
node: root,
editsRemaining: editDistance,
str: str
}];
while (stack.length) {
var frame = stack.pop();
// no edit
if (frame.str.length > 0) {
var char = frame.str.charAt(0),
noEditNode;
if (char in frame.node.edges) {
noEditNode = frame.node.edges[char];
} else {
noEditNode = new lunr.TokenSet;
frame.node.edges[char] = noEditNode;
}
if (frame.str.length == 1) {
noEditNode.final = true;
}
stack.push({
node: noEditNode,
editsRemaining: frame.editsRemaining,
str: frame.str.slice(1)
});
}
if (frame.editsRemaining == 0) {
continue
}
// insertion
if ("*" in frame.node.edges) {
var insertionNode = frame.node.edges["*"];
} else {
var insertionNode = new lunr.TokenSet;
frame.node.edges["*"] = insertionNode;
}
if (frame.str.length == 0) {
insertionNode.final = true;
}
stack.push({
node: insertionNode,
editsRemaining: frame.editsRemaining - 1,
str: frame.str
});
// deletion
// can only do a deletion if we have enough edits remaining
// and if there are characters left to delete in the string
if (frame.str.length > 1) {
stack.push({
node: frame.node,
editsRemaining: frame.editsRemaining - 1,
str: frame.str.slice(1)
});
}
// deletion
// just removing the last character from the str
if (frame.str.length == 1) {
frame.node.final = true;
}
// substitution
// can only do a substitution if we have enough edits remaining
// and if there are characters left to substitute
if (frame.str.length >= 1) {
if ("*" in frame.node.edges) {
var substitutionNode = frame.node.edges["*"];
} else {
var substitutionNode = new lunr.TokenSet;
frame.node.edges["*"] = substitutionNode;
}
if (frame.str.length == 1) {
substitutionNode.final = true;
}
stack.push({
node: substitutionNode,
editsRemaining: frame.editsRemaining - 1,
str: frame.str.slice(1)
});
}
// transposition
// can only do a transposition if there are edits remaining
// and there are enough characters to transpose
if (frame.str.length > 1) {
var charA = frame.str.charAt(0),
charB = frame.str.charAt(1),
transposeNode;
if (charB in frame.node.edges) {
transposeNode = frame.node.edges[charB];
} else {
transposeNode = new lunr.TokenSet;
frame.node.edges[charB] = transposeNode;
}
if (frame.str.length == 1) {
transposeNode.final = true;
}
stack.push({
node: transposeNode,
editsRemaining: frame.editsRemaining - 1,
str: charA + frame.str.slice(2)
});
}
}
return root
};
/**
* Creates a TokenSet from a string.
*
* The string may contain one or more wildcard characters (*)
* that will allow wildcard matching when intersecting with
* another TokenSet.
*
* @param {string} str - The string to create a TokenSet from.
* @returns {lunr.TokenSet}
*/
lunr.TokenSet.fromString = function (str) {
var node = new lunr.TokenSet,
root = node;
/*
* Iterates through all characters within the passed string
* appending a node for each character.
*
* When a wildcard character is found then a self
* referencing edge is introduced to continually match
* any number of any characters.
*/
for (var i = 0, len = str.length; i < len; i++) {
var char = str[i],
final = (i == len - 1);
if (char == "*") {
node.edges[char] = node;
node.final = final;
} else {
var next = new lunr.TokenSet;
next.final = final;
node.edges[char] = next;
node = next;
}
}
return root
};
/**
* Converts this TokenSet into an array of strings
* contained within the TokenSet.
*
* @returns {string[]}
*/
lunr.TokenSet.prototype.toArray = function () {
var words = [];
var stack = [{
prefix: "",
node: this
}];
while (stack.length) {
var frame = stack.pop(),
edges = Object.keys(frame.node.edges),
len = edges.length;
if (frame.node.final) {
/* In Safari, at this point the prefix is sometimes corrupted, see:
* https://github.com/olivernn/lunr.js/issues/279 Calling any
* String.prototype method forces Safari to "cast" this string to what
* it's supposed to be, fixing the bug. */
frame.prefix.charAt(0);
words.push(frame.prefix);
}
for (var i = 0; i < len; i++) {
var edge = edges[i];
stack.push({
prefix: frame.prefix.concat(edge),
node: frame.node.edges[edge]
});
}
}
return words
};
/**
* Generates a string representation of a TokenSet.
*
* This is intended to allow TokenSets to be used as keys
* in objects, largely to aid the construction and minimisation
* of a TokenSet. As such it is not designed to be a human
* friendly representation of the TokenSet.
*
* @returns {string}
*/
lunr.TokenSet.prototype.toString = function () {
// NOTE: Using Object.keys here as this.edges is very likely
// to enter 'hash-mode' with many keys being added
//
// avoiding a for-in loop here as it leads to the function
// being de-optimised (at least in V8). From some simple
// benchmarks the performance is comparable, but allowing
// V8 to optimize may mean easy performance wins in the future.
if (this._str) {
return this._str
}
var str = this.final ? '1' : '0',
labels = Object.keys(this.edges).sort(),
len = labels.length;
for (var i = 0; i < len; i++) {
var label = labels[i],
node = this.edges[label];
str = str + label + node.id;
}
return str
};
/**
* Returns a new TokenSet that is the intersection of
* this TokenSet and the passed TokenSet.
*
* This intersection will take into account any wildcards
* contained within the TokenSet.
*
* @param {lunr.TokenSet} b - An other TokenSet to intersect with.
* @returns {lunr.TokenSet}
*/
lunr.TokenSet.prototype.intersect = function (b) {
var output = new lunr.TokenSet,
frame = undefined;
var stack = [{
qNode: b,
output: output,
node: this
}];
while (stack.length) {
frame = stack.pop();
// NOTE: As with the #toString method, we are using
// Object.keys and a for loop instead of a for-in loop
// as both of these objects enter 'hash' mode, causing
// the function to be de-optimised in V8
var qEdges = Object.keys(frame.qNode.edges),
qLen = qEdges.length,
nEdges = Object.keys(frame.node.edges),
nLen = nEdges.length;
for (var q = 0; q < qLen; q++) {
var qEdge = qEdges[q];
for (var n = 0; n < nLen; n++) {
var nEdge = nEdges[n];
if (nEdge == qEdge || qEdge == '*') {
var node = frame.node.edges[nEdge],
qNode = frame.qNode.edges[qEdge],
final = node.final && qNode.final,
next = undefined;
if (nEdge in frame.output.edges) {
// an edge already exists for this character
// no need to create a new node, just set the finality
// bit unless this node is already final
next = frame.output.edges[nEdge];
next.final = next.final || final;
} else {
// no edge exists yet, must create one
// set the finality bit and insert it
// into the output
next = new lunr.TokenSet;
next.final = final;
frame.output.edges[nEdge] = next;
}
stack.push({
qNode: qNode,
output: next,
node: node
});
}
}
}
}
return output
};
lunr.TokenSet.Builder = function () {
this.previousWord = "";
this.root = new lunr.TokenSet;
this.uncheckedNodes = [];
this.minimizedNodes = {};
};
lunr.TokenSet.Builder.prototype.insert = function (word) {
var node,
commonPrefix = 0;
if (word < this.previousWord) {
throw new Error ("Out of order word insertion")
}
for (var i = 0; i < word.length && i < this.previousWord.length; i++) {
if (word[i] != this.previousWord[i]) break
commonPrefix++;
}
this.minimize(commonPrefix);
if (this.uncheckedNodes.length == 0) {
node = this.root;
} else {
node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child;
}
for (var i = commonPrefix; i < word.length; i++) {
var nextNode = new lunr.TokenSet,
char = word[i];
node.edges[char] = nextNode;
this.uncheckedNodes.push({
parent: node,
char: char,
child: nextNode
});
node = nextNode;
}
node.final = true;
this.previousWord = word;
};
lunr.TokenSet.Builder.prototype.finish = function () {
this.minimize(0);
};
lunr.TokenSet.Builder.prototype.minimize = function (downTo) {
for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {
var node = this.uncheckedNodes[i],
childKey = node.child.toString();
if (childKey in this.minimizedNodes) {
node.parent.edges[node.char] = this.minimizedNodes[childKey];
} else {
// Cache the key for this node since
// we know it can't change anymore
node.child._str = childKey;
this.minimizedNodes[childKey] = node.child;
}
this.uncheckedNodes.pop();
}
};
/*!
* lunr.Index
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* An index contains the built index of all documents and provides a query interface
* to the index.
*
* Usually instances of lunr.Index will not be created using this constructor, instead
* lunr.Builder should be used to construct new indexes, or lunr.Index.load should be
* used to load previously built and serialized indexes.
*
* @constructor
* @param {Object} attrs - The attributes of the built search index.
* @param {Object} attrs.invertedIndex - An index of term/field to document reference.
* @param {Object<string, lunr.Vector>} attrs.fieldVectors - Field vectors
* @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens.
* @param {string[]} attrs.fields - The names of indexed document fields.
* @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms.
*/
lunr.Index = function (attrs) {
this.invertedIndex = attrs.invertedIndex;
this.fieldVectors = attrs.fieldVectors;
this.tokenSet = attrs.tokenSet;
this.fields = attrs.fields;
this.pipeline = attrs.pipeline;
};
/**
* A result contains details of a document matching a search query.
* @typedef {Object} lunr.Index~Result
* @property {string} ref - The reference of the document this result represents.
* @property {number} score - A number between 0 and 1 representing how similar this document is to the query.
* @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.
*/
/**
* Although lunr provides the ability to create queries using lunr.Query, it also provides a simple
* query language which itself is parsed into an instance of lunr.Query.
*
* For programmatically building queries it is advised to directly use lunr.Query, the query language
* is best used for human entered text rather than program generated text.
*
* At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported
* and will be combined with OR, e.g `hello world` will match documents that contain either 'hello'
* or 'world', though those that contain both will rank higher in the results.
*
* Wildcards can be included in terms to match one or more unspecified characters, these wildcards can
* be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding
* wildcards will increase the number of documents that will be found but can also have a negative
* impact on query performance, especially with wildcards at the beginning of a term.
*
* Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term
* hello in the title field will match this query. Using a field not present in the index will lead
* to an error being thrown.
*
* Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term
* boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported
* to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2.
* Avoid large values for edit distance to improve query performance.
*
* Each term also supports a presence modifier. By default a term's presence in document is optional, however
* this can be changed to either required or prohibited. For a term's presence to be required in a document the
* term should be prefixed with a '+', e.g. `+foo bar` is a search for documents that must contain 'foo' and
* optionally contain 'bar'. Conversely a leading '-' sets the terms presence to prohibited, i.e. it must not
* appear in a document, e.g. `-foo bar` is a search for documents that do not contain 'foo' but may contain 'bar'.
*
* To escape special characters the backslash character '\' can be used, this allows searches to include
* characters that would normally be considered modifiers, e.g. `foo\~2` will search for a term "foo~2" instead
* of attempting to apply a boost of 2 to the search term "foo".
*
* @typedef {string} lunr.Index~QueryString
* @example <caption>Simple single term query</caption>
* hello
* @example <caption>Multiple term query</caption>
* hello world
* @example <caption>term scoped to a field</caption>
* title:hello
* @example <caption>term with a boost of 10</caption>
* hello^10
* @example <caption>term with an edit distance of 2</caption>
* hello~2
* @example <caption>terms with presence modifiers</caption>
* -foo +bar baz
*/
/**
* Performs a search against the index using lunr query syntax.
*
* Results will be returned sorted by their score, the most relevant results
* will be returned first. For details on how the score is calculated, please see
* the {@link https://lunrjs.com/guides/searching.html#scoring|guide}.
*
* For more programmatic querying use lunr.Index#query.
*
* @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
* @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
* @returns {lunr.Index~Result[]}
*/
lunr.Index.prototype.search = function (queryString) {
return this.query(function (query) {
var parser = new lunr.QueryParser(queryString, query);
parser.parse();
})
};
/**
* A query builder callback provides a query object to be used to express
* the query to perform on the index.
*
* @callback lunr.Index~queryBuilder
* @param {lunr.Query} query - The query object to build up.
* @this lunr.Query
*/
/**
* Performs a query against the index using the yielded lunr.Query object.
*
* If performing programmatic queries against the index, this method is preferred
* over lunr.Index#search so as to avoid the additional query parsing overhead.
*
* A query object is yielded to the supplied function which should be used to
* express the query to be run against the index.
*
* Note that although this function takes a callback parameter it is _not_ an
* asynchronous operation, the callback is just yielded a query object to be
* customized.
*
* @param {lunr.Index~queryBuilder} fn - A function that is used to build the query.
* @returns {lunr.Index~Result[]}
*/
lunr.Index.prototype.query = function (fn) {
// for each query clause
// * process terms
// * expand terms from token set
// * find matching documents and metadata
// * get document vectors
// * score documents
var query = new lunr.Query(this.fields),
matchingFields = Object.create(null),
queryVectors = Object.create(null),
termFieldCache = Object.create(null),
requiredMatches = Object.create(null),
prohibitedMatches = Object.create(null);
/*
* To support field level boosts a query vector is created per
* field. An empty vector is eagerly created to support negated
* queries.
*/
for (var i = 0; i < this.fields.length; i++) {
queryVectors[this.fields[i]] = new lunr.Vector;
}
fn.call(query, query);
for (var i = 0; i < query.clauses.length; i++) {
/*
* Unless the pipeline has been disabled for this term, which is
* the case for terms with wildcards, we need to pass the clause
* term through the search pipeline. A pipeline returns an array
* of processed terms. Pipeline functions may expand the passed
* term, which means we may end up performing multiple index lookups
* for a single query term.
*/
var clause = query.clauses[i],
terms = null,
clauseMatches = lunr.Set.complete;
if (clause.usePipeline) {
terms = this.pipeline.runString(clause.term, {
fields: clause.fields
});
} else {
terms = [clause.term];
}
for (var m = 0; m < terms.length; m++) {
var term = terms[m];
/*
* Each term returned from the pipeline needs to use the same query
* clause object, e.g. the same boost and or edit distance. The
* simplest way to do this is to re-use the clause object but mutate
* its term property.
*/
clause.term = term;
/*
* From the term in the clause we create a token set which will then
* be used to intersect the indexes token set to get a list of terms
* to lookup in the inverted index
*/
var termTokenSet = lunr.TokenSet.fromClause(clause),
expandedTerms = this.tokenSet.intersect(termTokenSet).toArray();
/*
* If a term marked as required does not exist in the tokenSet it is
* impossible for the search to return any matches. We set all the field
* scoped required matches set to empty and stop examining any further
* clauses.
*/
if (expandedTerms.length === 0 && clause.presence === lunr.Query.presence.REQUIRED) {
for (var k = 0; k < clause.fields.length; k++) {
var field = clause.fields[k];
requiredMatches[field] = lunr.Set.empty;
}
break
}
for (var j = 0; j < expandedTerms.length; j++) {
/*
* For each term get the posting and termIndex, this is required for
* building the query vector.
*/
var expandedTerm = expandedTerms[j],
posting = this.invertedIndex[expandedTerm],
termIndex = posting._index;
for (var k = 0; k < clause.fields.length; k++) {
/*
* For each field that this query term is scoped by (by default
* all fields are in scope) we need to get all the document refs
* that have this term in that field.
*
* The posting is the entry in the invertedIndex for the matching
* term from above.
*/
var field = clause.fields[k],
fieldPosting = posting[field],
matchingDocumentRefs = Object.keys(fieldPosting),
termField = expandedTerm + "/" + field,
matchingDocumentsSet = new lunr.Set(matchingDocumentRefs);
/*
* if the presence of this term is required ensure that the matching
* documents are added to the set of required matches for this clause.
*
*/
if (clause.presence == lunr.Query.presence.REQUIRED) {
clauseMatches = clauseMatches.union(matchingDocumentsSet);
if (requiredMatches[field] === undefined) {
requiredMatches[field] = lunr.Set.complete;
}
}
/*
* if the presence of this term is prohibited ensure that the matching
* documents are added to the set of prohibited matches for this field,
* creating that set if it does not yet exist.
*/
if (clause.presence == lunr.Query.presence.PROHIBITED) {
if (prohibitedMatches[field] === undefined) {
prohibitedMatches[field] = lunr.Set.empty;
}
prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet);
/*
* Prohibited matches should not be part of the query vector used for
* similarity scoring and no metadata should be extracted so we continue
* to the next field
*/
continue
}
/*
* The query field vector is populated using the termIndex found for
* the term and a unit value with the appropriate boost applied.
* Using upsert because there could already be an entry in the vector
* for the term we are working with. In that case we just add the scores
* together.
*/
queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b });
/**
* If we've already seen this term, field combo then we've already collected
* the matching documents and metadata, no need to go through all that again
*/
if (termFieldCache[termField]) {
continue
}
for (var l = 0; l < matchingDocumentRefs.length; l++) {
/*
* All metadata for this term/field/document triple
* are then extracted and collected into an instance
* of lunr.MatchData ready to be returned in the query
* results
*/
var matchingDocumentRef = matchingDocumentRefs[l],
matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),
metadata = fieldPosting[matchingDocumentRef],
fieldMatch;
if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) {
matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata);
} else {
fieldMatch.add(expandedTerm, field, metadata);
}
}
termFieldCache[termField] = true;
}
}
}
/**
* If the presence was required we need to update the requiredMatches field sets.
* We do this after all fields for the term have collected their matches because
* the clause terms presence is required in _any_ of the fields not _all_ of the
* fields.
*/
if (clause.presence === lunr.Query.presence.REQUIRED) {
for (var k = 0; k < clause.fields.length; k++) {
var field = clause.fields[k];
requiredMatches[field] = requiredMatches[field].intersect(clauseMatches);
}
}
}
/**
* Need to combine the field scoped required and prohibited
* matching documents into a global set of required and prohibited
* matches
*/
var allRequiredMatches = lunr.Set.complete,
allProhibitedMatches = lunr.Set.empty;
for (var i = 0; i < this.fields.length; i++) {
var field = this.fields[i];
if (requiredMatches[field]) {
allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field]);
}
if (prohibitedMatches[field]) {
allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field]);
}
}
var matchingFieldRefs = Object.keys(matchingFields),
results = [],
matches = Object.create(null);
/*
* If the query is negated (contains only prohibited terms)
* we need to get _all_ fieldRefs currently existing in the
* index. This is only done when we know that the query is
* entirely prohibited terms to avoid any cost of getting all
* fieldRefs unnecessarily.
*
* Additionally, blank MatchData must be created to correctly
* populate the results.
*/
if (query.isNegated()) {
matchingFieldRefs = Object.keys(this.fieldVectors);
for (var i = 0; i < matchingFieldRefs.length; i++) {
var matchingFieldRef = matchingFieldRefs[i];
var fieldRef = lunr.FieldRef.fromString(matchingFieldRef);
matchingFields[matchingFieldRef] = new lunr.MatchData;
}
}
for (var i = 0; i < matchingFieldRefs.length; i++) {
/*
* Currently we have document fields that match the query, but we
* need to return documents. The matchData and scores are combined
* from multiple fields belonging to the same document.
*
* Scores are calculated by field, using the query vectors created
* above, and combined into a final document score using addition.
*/
var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]),
docRef = fieldRef.docRef;
if (!allRequiredMatches.contains(docRef)) {
continue
}
if (allProhibitedMatches.contains(docRef)) {
continue
}
var fieldVector = this.fieldVectors[fieldRef],
score = queryVectors[fieldRef.fieldName].similarity(fieldVector),
docMatch;
if ((docMatch = matches[docRef]) !== undefined) {
docMatch.score += score;
docMatch.matchData.combine(matchingFields[fieldRef]);
} else {
var match = {
ref: docRef,
score: score,
matchData: matchingFields[fieldRef]
};
matches[docRef] = match;
results.push(match);
}
}
/*
* Sort the results objects by score, highest first.
*/
return results.sort(function (a, b) {
return b.score - a.score
})
};
/**
* Prepares the index for JSON serialization.
*
* The schema for this JSON blob will be described in a
* separate JSON schema file.
*
* @returns {Object}
*/
lunr.Index.prototype.toJSON = function () {
var invertedIndex = Object.keys(this.invertedIndex)
.sort()
.map(function (term) {
return [term, this.invertedIndex[term]]
}, this);
var fieldVectors = Object.keys(this.fieldVectors)
.map(function (ref) {
return [ref, this.fieldVectors[ref].toJSON()]
}, this);
return {
version: lunr.version,
fields: this.fields,
fieldVectors: fieldVectors,
invertedIndex: invertedIndex,
pipeline: this.pipeline.toJSON()
}
};
/**
* Loads a previously serialized lunr.Index
*
* @param {Object} serializedIndex - A previously serialized lunr.Index
* @returns {lunr.Index}
*/
lunr.Index.load = function (serializedIndex) {
var attrs = {},
fieldVectors = {},
serializedVectors = serializedIndex.fieldVectors,
invertedIndex = Object.create(null),
serializedInvertedIndex = serializedIndex.invertedIndex,
tokenSetBuilder = new lunr.TokenSet.Builder,
pipeline = lunr.Pipeline.load(serializedIndex.pipeline);
if (serializedIndex.version != lunr.version) {
lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'");
}
for (var i = 0; i < serializedVectors.length; i++) {
var tuple = serializedVectors[i],
ref = tuple[0],
elements = tuple[1];
fieldVectors[ref] = new lunr.Vector(elements);
}
for (var i = 0; i < serializedInvertedIndex.length; i++) {
var tuple = serializedInvertedIndex[i],
term = tuple[0],
posting = tuple[1];
tokenSetBuilder.insert(term);
invertedIndex[term] = posting;
}
tokenSetBuilder.finish();
attrs.fields = serializedIndex.fields;
attrs.fieldVectors = fieldVectors;
attrs.invertedIndex = invertedIndex;
attrs.tokenSet = tokenSetBuilder.root;
attrs.pipeline = pipeline;
return new lunr.Index(attrs)
};
/*!
* lunr.Builder
* Copyright (C) 2019 Oliver Nightingale
*/
/**
* lunr.Builder performs indexing on a set of documents and
* returns instances of lunr.Index ready for querying.
*
* All configuration of the index is done via the builder, the
* fields to index, the document reference, the text processing
* pipeline and document scoring parameters are all set on the
* builder before indexing.
*
* @constructor
* @property {string} _ref - Internal reference to the document reference field.
* @property {string[]} _fields - Internal reference to the document fields to index.
* @property {object} invertedIndex - The inverted index maps terms to document fields.
* @property {object} documentTermFrequencies - Keeps track of document term frequencies.
* @property {object} documentLengths - Keeps track of the length of documents added to the index.
* @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing.
* @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing.
* @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index.
* @property {number} documentCount - Keeps track of the total number of documents indexed.
* @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.
* @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2.
* @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space.
* @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.
*/
lunr.Builder = function () {
this._ref = "id";
this._fields = Object.create(null);
this._documents = Object.create(null);
this.invertedIndex = Object.create(null);
this.fieldTermFrequencies = {};
this.fieldLengths = {};
this.tokenizer = lunr.tokenizer;
this.pipeline = new lunr.Pipeline;
this.searchPipeline = new lunr.Pipeline;
this.documentCount = 0;
this._b = 0.75;
this._k1 = 1.2;
this.termIndex = 0;
this.metadataWhitelist = [];
};
/**
* Sets the document field used as the document reference. Every document must have this field.
* The type of this field in the document should be a string, if it is not a string it will be
* coerced into a string by calling toString.
*
* The default ref is 'id'.
*
* The ref should _not_ be changed during indexing, it should be set before any documents are
* added to the index. Changing it during indexing can lead to inconsistent results.
*
* @param {string} ref - The name of the reference field in the document.
*/
lunr.Builder.prototype.ref = function (ref) {
this._ref = ref;
};
/**
* A function that is used to extract a field from a document.
*
* Lunr expects a field to be at the top level of a document, if however the field
* is deeply nested within a document an extractor function can be used to extract
* the right field for indexing.
*
* @callback fieldExtractor
* @param {object} doc - The document being added to the index.
* @returns {?(string|object|object[])} obj - The object that will be indexed for this field.
* @example <caption>Extracting a nested field</caption>
* function (doc) { return doc.nested.field }
*/
/**
* Adds a field to the list of document fields that will be indexed. Every document being
* indexed should have this field. Null values for this field in indexed documents will
* not cause errors but will limit the chance of that document being retrieved by searches.
*
* All fields should be added before adding documents to the index. Adding fields after
* a document has been indexed will have no effect on already indexed documents.
*
* Fields can be boosted at build time. This allows terms within that field to have more
* importance when ranking search results. Use a field boost to specify that matches within
* one field are more important than other fields.
*
* @param {string} fieldName - The name of a field to index in all documents.
* @param {object} attributes - Optional attributes associated with this field.
* @param {number} [attributes.boost=1] - Boost applied to all terms within this field.
* @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.
* @throws {RangeError} fieldName cannot contain unsupported characters '/'
*/
lunr.Builder.prototype.field = function (fieldName, attributes) {
if (/\//.test(fieldName)) {
throw new RangeError ("Field '" + fieldName + "' contains illegal character '/'")
}
this._fields[fieldName] = attributes || {};
};
/**
* A parameter to tune the amount of field length normalisation that is applied when
* calculating relevance scores. A value of 0 will completely disable any normalisation
* and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b
* will be clamped to the range 0 - 1.
*
* @param {number} number - The value to set for this tuning parameter.
*/
lunr.Builder.prototype.b = function (number) {
if (number < 0) {
this._b = 0;
} else if (number > 1) {
this._b = 1;
} else {
this._b = number;
}
};
/**
* A parameter that controls the speed at which a rise in term frequency results in term
* frequency saturation. The default value is 1.2. Setting this to a higher value will give
* slower saturation levels, a lower value will result in quicker saturation.
*
* @param {number} number - The value to set for this tuning parameter.
*/
lunr.Builder.prototype.k1 = function (number) {
this._k1 = number;
};
/**
* Adds a document to the index.
*
* Before adding fields to the index the index should have been fully setup, with the document
* ref and all fields to index already having been specified.
*
* The document must have a field name as specified by the ref (by default this is 'id') and
* it should have all fields defined for indexing, though null or undefined values will not
* cause errors.
*
* Entire documents can be boosted at build time. Applying a boost to a document indicates that
* this document should rank higher in search results than other documents.
*
* @param {object} doc - The document to add to the index.
* @param {object} attributes - Optional attributes associated with this document.
* @param {number} [attributes.boost=1] - Boost applied to all terms within this document.
*/
lunr.Builder.prototype.add = function (doc, attributes) {
var docRef = doc[this._ref],
fields = Object.keys(this._fields);
this._documents[docRef] = attributes || {};
this.documentCount += 1;
for (var i = 0; i < fields.length; i++) {
var fieldName = fields[i],
extractor = this._fields[fieldName].extractor,
field = extractor ? extractor(doc) : doc[fieldName],
tokens = this.tokenizer(field, {
fields: [fieldName]
}),
terms = this.pipeline.run(tokens),
fieldRef = new lunr.FieldRef (docRef, fieldName),
fieldTerms = Object.create(null);
this.fieldTermFrequencies[fieldRef] = fieldTerms;
this.fieldLengths[fieldRef] = 0;
// store the length of this field for this document
this.fieldLengths[fieldRef] += terms.length;
// calculate term frequencies for this field
for (var j = 0; j < terms.length; j++) {
var term = terms[j];
if (fieldTerms[term] == undefined) {
fieldTerms[term] = 0;
}
fieldTerms[term] += 1;
// add to inverted index
// create an initial posting if one doesn't exist
if (this.invertedIndex[term] == undefined) {
var posting = Object.create(null);
posting["_index"] = this.termIndex;
this.termIndex += 1;
for (var k = 0; k < fields.length; k++) {
posting[fields[k]] = Object.create(null);
}
this.invertedIndex[term] = posting;
}
// add an entry for this term/fieldName/docRef to the invertedIndex
if (this.invertedIndex[term][fieldName][docRef] == undefined) {
this.invertedIndex[term][fieldName][docRef] = Object.create(null);
}
// store all whitelisted metadata about this token in the
// inverted index
for (var l = 0; l < this.metadataWhitelist.length; l++) {
var metadataKey = this.metadataWhitelist[l],
metadata = term.metadata[metadataKey];
if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) {
this.invertedIndex[term][fieldName][docRef][metadataKey] = [];
}
this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata);
}
}
}
};
/**
* Calculates the average document length for this index
*
* @private
*/
lunr.Builder.prototype.calculateAverageFieldLengths = function () {
var fieldRefs = Object.keys(this.fieldLengths),
numberOfFields = fieldRefs.length,
accumulator = {},
documentsWithField = {};
for (var i = 0; i < numberOfFields; i++) {
var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
field = fieldRef.fieldName;
documentsWithField[field] || (documentsWithField[field] = 0);
documentsWithField[field] += 1;
accumulator[field] || (accumulator[field] = 0);
accumulator[field] += this.fieldLengths[fieldRef];
}
var fields = Object.keys(this._fields);
for (var i = 0; i < fields.length; i++) {
var fieldName = fields[i];
accumulator[fieldName] = accumulator[fieldName] / documentsWithField[fieldName];
}
this.averageFieldLength = accumulator;
};
/**
* Builds a vector space model of every document using lunr.Vector
*
* @private
*/
lunr.Builder.prototype.createFieldVectors = function () {
var fieldVectors = {},
fieldRefs = Object.keys(this.fieldTermFrequencies),
fieldRefsLength = fieldRefs.length,
termIdfCache = Object.create(null);
for (var i = 0; i < fieldRefsLength; i++) {
var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
fieldName = fieldRef.fieldName,
fieldLength = this.fieldLengths[fieldRef],
fieldVector = new lunr.Vector,
termFrequencies = this.fieldTermFrequencies[fieldRef],
terms = Object.keys(termFrequencies),
termsLength = terms.length;
var fieldBoost = this._fields[fieldName].boost || 1,
docBoost = this._documents[fieldRef.docRef].boost || 1;
for (var j = 0; j < termsLength; j++) {
var term = terms[j],
tf = termFrequencies[term],
termIndex = this.invertedIndex[term]._index,
idf, score, scoreWithPrecision;
if (termIdfCache[term] === undefined) {
idf = lunr.idf(this.invertedIndex[term], this.documentCount);
termIdfCache[term] = idf;
} else {
idf = termIdfCache[term];
}
score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[fieldName])) + tf);
score *= fieldBoost;
score *= docBoost;
scoreWithPrecision = Math.round(score * 1000) / 1000;
// Converts 1.23456789 to 1.234.
// Reducing the precision so that the vectors take up less
// space when serialised. Doing it now so that they behave
// the same before and after serialisation. Also, this is
// the fastest approach to reducing a number's precision in
// JavaScript.
fieldVector.insert(termIndex, scoreWithPrecision);
}
fieldVectors[fieldRef] = fieldVector;
}
this.fieldVectors = fieldVectors;
};
/**
* Creates a token set of all tokens in the index using lunr.TokenSet
*
* @private
*/
lunr.Builder.prototype.createTokenSet = function () {
this.tokenSet = lunr.TokenSet.fromArray(
Object.keys(this.invertedIndex).sort()
);
};
/**
* Builds the index, creating an instance of lunr.Index.
*
* This completes the indexing process and should only be called
* once all documents have been added to the index.
*
* @returns {lunr.Index}
*/
lunr.Builder.prototype.build = function () {
this.calculateAverageFieldLengths();
this.createFieldVectors();
this.createTokenSet();
return new lunr.Index({
invertedIndex: this.invertedIndex,
fieldVectors: this.fieldVectors,
tokenSet: this.tokenSet,
fields: Object.keys(this._fields),
pipeline: this.searchPipeline
})
};
/**
* Applies a plugin to the index builder.
*
* A plugin is a function that is called with the index builder as its context.
* Plugins can be used to customise or extend the behaviour of the index
* in some way. A plugin is just a function, that encapsulated the custom
* behaviour that should be applied when building the index.
*
* The plugin function will be called with the index builder as its argument, additional
* arguments can also be passed when calling use. The function will be called
* with the index builder as its context.
*
* @param {Function} plugin The plugin to apply.
*/
lunr.Builder.prototype.use = function (fn) {
var args = Array.prototype.slice.call(arguments, 1);
args.unshift(this);
fn.apply(this, args);
};
/**
* Contains and collects metadata about a matching document.
* A single instance of lunr.MatchData is returned as part of every
* lunr.Index~Result.
*
* @constructor
* @param {string} term - The term this match data is associated with
* @param {string} field - The field in which the term was found
* @param {object} metadata - The metadata recorded about this term in this field
* @property {object} metadata - A cloned collection of metadata associated with this document.
* @see {@link lunr.Index~Result}
*/
lunr.MatchData = function (term, field, metadata) {
var clonedMetadata = Object.create(null),
metadataKeys = Object.keys(metadata || {});
// Cloning the metadata to prevent the original
// being mutated during match data combination.
// Metadata is kept in an array within the inverted
// index so cloning the data can be done with
// Array#slice
for (var i = 0; i < metadataKeys.length; i++) {
var key = metadataKeys[i];
clonedMetadata[key] = metadata[key].slice();
}
this.metadata = Object.create(null);
if (term !== undefined) {
this.metadata[term] = Object.create(null);
this.metadata[term][field] = clonedMetadata;
}
};
/**
* An instance of lunr.MatchData will be created for every term that matches a
* document. However only one instance is required in a lunr.Index~Result. This
* method combines metadata from another instance of lunr.MatchData with this
* objects metadata.
*
* @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one.
* @see {@link lunr.Index~Result}
*/
lunr.MatchData.prototype.combine = function (otherMatchData) {
var terms = Object.keys(otherMatchData.metadata);
for (var i = 0; i < terms.length; i++) {
var term = terms[i],
fields = Object.keys(otherMatchData.metadata[term]);
if (this.metadata[term] == undefined) {
this.metadata[term] = Object.create(null);
}
for (var j = 0; j < fields.length; j++) {
var field = fields[j],
keys = Object.keys(otherMatchData.metadata[term][field]);
if (this.metadata[term][field] == undefined) {
this.metadata[term][field] = Object.create(null);
}
for (var k = 0; k < keys.length; k++) {
var key = keys[k];
if (this.metadata[term][field][key] == undefined) {
this.metadata[term][field][key] = otherMatchData.metadata[term][field][key];
} else {
this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key]);
}
}
}
}
};
/**
* Add metadata for a term/field pair to this instance of match data.
*
* @param {string} term - The term this match data is associated with
* @param {string} field - The field in which the term was found
* @param {object} metadata - The metadata recorded about this term in this field
*/
lunr.MatchData.prototype.add = function (term, field, metadata) {
if (!(term in this.metadata)) {
this.metadata[term] = Object.create(null);
this.metadata[term][field] = metadata;
return
}
if (!(field in this.metadata[term])) {
this.metadata[term][field] = metadata;
return
}
var metadataKeys = Object.keys(metadata);
for (var i = 0; i < metadataKeys.length; i++) {
var key = metadataKeys[i];
if (key in this.metadata[term][field]) {
this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key]);
} else {
this.metadata[term][field][key] = metadata[key];
}
}
};
/**
* A lunr.Query provides a programmatic way of defining queries to be performed
* against a {@link lunr.Index}.
*
* Prefer constructing a lunr.Query using the {@link lunr.Index#query} method
* so the query object is pre-initialized with the right index fields.
*
* @constructor
* @property {lunr.Query~Clause[]} clauses - An array of query clauses.
* @property {string[]} allFields - An array of all available fields in a lunr.Index.
*/
lunr.Query = function (allFields) {
this.clauses = [];
this.allFields = allFields;
};
/**
* Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.
*
* This allows wildcards to be added to the beginning and end of a term without having to manually do any string
* concatenation.
*
* The wildcard constants can be bitwise combined to select both leading and trailing wildcards.
*
* @constant
* @default
* @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour
* @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists
* @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists
* @see lunr.Query~Clause
* @see lunr.Query#clause
* @see lunr.Query#term
* @example <caption>query term with trailing wildcard</caption>
* query.term('foo', { wildcard: lunr.Query.wildcard.TRAILING })
* @example <caption>query term with leading and trailing wildcard</caption>
* query.term('foo', {
* wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING
* })
*/
lunr.Query.wildcard = new String ("*");
lunr.Query.wildcard.NONE = 0;
lunr.Query.wildcard.LEADING = 1;
lunr.Query.wildcard.TRAILING = 2;
/**
* Constants for indicating what kind of presence a term must have in matching documents.
*
* @constant
* @enum {number}
* @see lunr.Query~Clause
* @see lunr.Query#clause
* @see lunr.Query#term
* @example <caption>query term with required presence</caption>
* query.term('foo', { presence: lunr.Query.presence.REQUIRED })
*/
lunr.Query.presence = {
/**
* Term's presence in a document is optional, this is the default value.
*/
OPTIONAL: 1,
/**
* Term's presence in a document is required, documents that do not contain
* this term will not be returned.
*/
REQUIRED: 2,
/**
* Term's presence in a document is prohibited, documents that do contain
* this term will not be returned.
*/
PROHIBITED: 3
};
/**
* A single clause in a {@link lunr.Query} contains a term and details on how to
* match that term against a {@link lunr.Index}.
*
* @typedef {Object} lunr.Query~Clause
* @property {string[]} fields - The fields in an index this clause should be matched against.
* @property {number} [boost=1] - Any boost that should be applied when matching this clause.
* @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be.
* @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline.
* @property {number} [wildcard=lunr.Query.wildcard.NONE] - Whether the term should have wildcards appended or prepended.
* @property {number} [presence=lunr.Query.presence.OPTIONAL] - The terms presence in any matching documents.
*/
/**
* Adds a {@link lunr.Query~Clause} to this query.
*
* Unless the clause contains the fields to be matched all fields will be matched. In addition
* a default boost of 1 is applied to the clause.
*
* @param {lunr.Query~Clause} clause - The clause to add to this query.
* @see lunr.Query~Clause
* @returns {lunr.Query}
*/
lunr.Query.prototype.clause = function (clause) {
if (!('fields' in clause)) {
clause.fields = this.allFields;
}
if (!('boost' in clause)) {
clause.boost = 1;
}
if (!('usePipeline' in clause)) {
clause.usePipeline = true;
}
if (!('wildcard' in clause)) {
clause.wildcard = lunr.Query.wildcard.NONE;
}
if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {
clause.term = "*" + clause.term;
}
if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {
clause.term = "" + clause.term + "*";
}
if (!('presence' in clause)) {
clause.presence = lunr.Query.presence.OPTIONAL;
}
this.clauses.push(clause);
return this
};
/**
* A negated query is one in which every clause has a presence of
* prohibited. These queries require some special processing to return
* the expected results.
*
* @returns boolean
*/
lunr.Query.prototype.isNegated = function () {
for (var i = 0; i < this.clauses.length; i++) {
if (this.clauses[i].presence != lunr.Query.presence.PROHIBITED) {
return false
}
}
return true
};
/**
* Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause}
* to the list of clauses that make up this query.
*
* The term is used as is, i.e. no tokenization will be performed by this method. Instead conversion
* to a token or token-like string should be done before calling this method.
*
* The term will be converted to a string by calling `toString`. Multiple terms can be passed as an
* array, each term in the array will share the same options.
*
* @param {object|object[]} term - The term(s) to add to the query.
* @param {object} [options] - Any additional properties to add to the query clause.
* @returns {lunr.Query}
* @see lunr.Query#clause
* @see lunr.Query~Clause
* @example <caption>adding a single term to a query</caption>
* query.term("foo")
* @example <caption>adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard</caption>
* query.term("foo", {
* fields: ["title"],
* boost: 10,
* wildcard: lunr.Query.wildcard.TRAILING
* })
* @example <caption>using lunr.tokenizer to convert a string to tokens before using them as terms</caption>
* query.term(lunr.tokenizer("foo bar"))
*/
lunr.Query.prototype.term = function (term, options) {
if (Array.isArray(term)) {
term.forEach(function (t) { this.term(t, lunr.utils.clone(options)); }, this);
return this
}
var clause = options || {};
clause.term = term.toString();
this.clause(clause);
return this
};
lunr.QueryParseError = function (message, start, end) {
this.name = "QueryParseError";
this.message = message;
this.start = start;
this.end = end;
};
lunr.QueryParseError.prototype = new Error;
lunr.QueryLexer = function (str) {
this.lexemes = [];
this.str = str;
this.length = str.length;
this.pos = 0;
this.start = 0;
this.escapeCharPositions = [];
};
lunr.QueryLexer.prototype.run = function () {
var state = lunr.QueryLexer.lexText;
while (state) {
state = state(this);
}
};
lunr.QueryLexer.prototype.sliceString = function () {
var subSlices = [],
sliceStart = this.start,
sliceEnd = this.pos;
for (var i = 0; i < this.escapeCharPositions.length; i++) {
sliceEnd = this.escapeCharPositions[i];
subSlices.push(this.str.slice(sliceStart, sliceEnd));
sliceStart = sliceEnd + 1;
}
subSlices.push(this.str.slice(sliceStart, this.pos));
this.escapeCharPositions.length = 0;
return subSlices.join('')
};
lunr.QueryLexer.prototype.emit = function (type) {
this.lexemes.push({
type: type,
str: this.sliceString(),
start: this.start,
end: this.pos
});
this.start = this.pos;
};
lunr.QueryLexer.prototype.escapeCharacter = function () {
this.escapeCharPositions.push(this.pos - 1);
this.pos += 1;
};
lunr.QueryLexer.prototype.next = function () {
if (this.pos >= this.length) {
return lunr.QueryLexer.EOS
}
var char = this.str.charAt(this.pos);
this.pos += 1;
return char
};
lunr.QueryLexer.prototype.width = function () {
return this.pos - this.start
};
lunr.QueryLexer.prototype.ignore = function () {
if (this.start == this.pos) {
this.pos += 1;
}
this.start = this.pos;
};
lunr.QueryLexer.prototype.backup = function () {
this.pos -= 1;
};
lunr.QueryLexer.prototype.acceptDigitRun = function () {
var char, charCode;
do {
char = this.next();
charCode = char.charCodeAt(0);
} while (charCode > 47 && charCode < 58)
if (char != lunr.QueryLexer.EOS) {
this.backup();
}
};
lunr.QueryLexer.prototype.more = function () {
return this.pos < this.length
};
lunr.QueryLexer.EOS = 'EOS';
lunr.QueryLexer.FIELD = 'FIELD';
lunr.QueryLexer.TERM = 'TERM';
lunr.QueryLexer.EDIT_DISTANCE = 'EDIT_DISTANCE';
lunr.QueryLexer.BOOST = 'BOOST';
lunr.QueryLexer.PRESENCE = 'PRESENCE';
lunr.QueryLexer.lexField = function (lexer) {
lexer.backup();
lexer.emit(lunr.QueryLexer.FIELD);
lexer.ignore();
return lunr.QueryLexer.lexText
};
lunr.QueryLexer.lexTerm = function (lexer) {
if (lexer.width() > 1) {
lexer.backup();
lexer.emit(lunr.QueryLexer.TERM);
}
lexer.ignore();
if (lexer.more()) {
return lunr.QueryLexer.lexText
}
};
lunr.QueryLexer.lexEditDistance = function (lexer) {
lexer.ignore();
lexer.acceptDigitRun();
lexer.emit(lunr.QueryLexer.EDIT_DISTANCE);
return lunr.QueryLexer.lexText
};
lunr.QueryLexer.lexBoost = function (lexer) {
lexer.ignore();
lexer.acceptDigitRun();
lexer.emit(lunr.QueryLexer.BOOST);
return lunr.QueryLexer.lexText
};
lunr.QueryLexer.lexEOS = function (lexer) {
if (lexer.width() > 0) {
lexer.emit(lunr.QueryLexer.TERM);
}
};
// This matches the separator used when tokenising fields
// within a document. These should match otherwise it is
// not possible to search for some tokens within a document.
//
// It is possible for the user to change the separator on the
// tokenizer so it _might_ clash with any other of the special
// characters already used within the search string, e.g. :.
//
// This means that it is possible to change the separator in
// such a way that makes some words unsearchable using a search
// string.
lunr.QueryLexer.termSeparator = lunr.tokenizer.separator;
lunr.QueryLexer.lexText = function (lexer) {
while (true) {
var char = lexer.next();
if (char == lunr.QueryLexer.EOS) {
return lunr.QueryLexer.lexEOS
}
// Escape character is '\'
if (char.charCodeAt(0) == 92) {
lexer.escapeCharacter();
continue
}
if (char == ":") {
return lunr.QueryLexer.lexField
}
if (char == "~") {
lexer.backup();
if (lexer.width() > 0) {
lexer.emit(lunr.QueryLexer.TERM);
}
return lunr.QueryLexer.lexEditDistance
}
if (char == "^") {
lexer.backup();
if (lexer.width() > 0) {
lexer.emit(lunr.QueryLexer.TERM);
}
return lunr.QueryLexer.lexBoost
}
// "+" indicates term presence is required
// checking for length to ensure that only
// leading "+" are considered
if (char == "+" && lexer.width() === 1) {
lexer.emit(lunr.QueryLexer.PRESENCE);
return lunr.QueryLexer.lexText
}
// "-" indicates term presence is prohibited
// checking for length to ensure that only
// leading "-" are considered
if (char == "-" && lexer.width() === 1) {
lexer.emit(lunr.QueryLexer.PRESENCE);
return lunr.QueryLexer.lexText
}
if (char.match(lunr.QueryLexer.termSeparator)) {
return lunr.QueryLexer.lexTerm
}
}
};
lunr.QueryParser = function (str, query) {
this.lexer = new lunr.QueryLexer (str);
this.query = query;
this.currentClause = {};
this.lexemeIdx = 0;
};
lunr.QueryParser.prototype.parse = function () {
this.lexer.run();
this.lexemes = this.lexer.lexemes;
var state = lunr.QueryParser.parseClause;
while (state) {
state = state(this);
}
return this.query
};
lunr.QueryParser.prototype.peekLexeme = function () {
return this.lexemes[this.lexemeIdx]
};
lunr.QueryParser.prototype.consumeLexeme = function () {
var lexeme = this.peekLexeme();
this.lexemeIdx += 1;
return lexeme
};
lunr.QueryParser.prototype.nextClause = function () {
var completedClause = this.currentClause;
this.query.clause(completedClause);
this.currentClause = {};
};
lunr.QueryParser.parseClause = function (parser) {
var lexeme = parser.peekLexeme();
if (lexeme == undefined) {
return
}
switch (lexeme.type) {
case lunr.QueryLexer.PRESENCE:
return lunr.QueryParser.parsePresence
case lunr.QueryLexer.FIELD:
return lunr.QueryParser.parseField
case lunr.QueryLexer.TERM:
return lunr.QueryParser.parseTerm
default:
var errorMessage = "expected either a field or a term, found " + lexeme.type;
if (lexeme.str.length >= 1) {
errorMessage += " with value '" + lexeme.str + "'";
}
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
};
lunr.QueryParser.parsePresence = function (parser) {
var lexeme = parser.consumeLexeme();
if (lexeme == undefined) {
return
}
switch (lexeme.str) {
case "-":
parser.currentClause.presence = lunr.Query.presence.PROHIBITED;
break
case "+":
parser.currentClause.presence = lunr.Query.presence.REQUIRED;
break
default:
var errorMessage = "unrecognised presence operator'" + lexeme.str + "'";
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
var nextLexeme = parser.peekLexeme();
if (nextLexeme == undefined) {
var errorMessage = "expecting term or field, found nothing";
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
switch (nextLexeme.type) {
case lunr.QueryLexer.FIELD:
return lunr.QueryParser.parseField
case lunr.QueryLexer.TERM:
return lunr.QueryParser.parseTerm
default:
var errorMessage = "expecting term or field, found '" + nextLexeme.type + "'";
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
}
};
lunr.QueryParser.parseField = function (parser) {
var lexeme = parser.consumeLexeme();
if (lexeme == undefined) {
return
}
if (parser.query.allFields.indexOf(lexeme.str) == -1) {
var possibleFields = parser.query.allFields.map(function (f) { return "'" + f + "'" }).join(', '),
errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields;
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
parser.currentClause.fields = [lexeme.str];
var nextLexeme = parser.peekLexeme();
if (nextLexeme == undefined) {
var errorMessage = "expecting term, found nothing";
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
switch (nextLexeme.type) {
case lunr.QueryLexer.TERM:
return lunr.QueryParser.parseTerm
default:
var errorMessage = "expecting term, found '" + nextLexeme.type + "'";
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
}
};
lunr.QueryParser.parseTerm = function (parser) {
var lexeme = parser.consumeLexeme();
if (lexeme == undefined) {
return
}
parser.currentClause.term = lexeme.str.toLowerCase();
if (lexeme.str.indexOf("*") != -1) {
parser.currentClause.usePipeline = false;
}
var nextLexeme = parser.peekLexeme();
if (nextLexeme == undefined) {
parser.nextClause();
return
}
switch (nextLexeme.type) {
case lunr.QueryLexer.TERM:
parser.nextClause();
return lunr.QueryParser.parseTerm
case lunr.QueryLexer.FIELD:
parser.nextClause();
return lunr.QueryParser.parseField
case lunr.QueryLexer.EDIT_DISTANCE:
return lunr.QueryParser.parseEditDistance
case lunr.QueryLexer.BOOST:
return lunr.QueryParser.parseBoost
case lunr.QueryLexer.PRESENCE:
parser.nextClause();
return lunr.QueryParser.parsePresence
default:
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
}
};
lunr.QueryParser.parseEditDistance = function (parser) {
var lexeme = parser.consumeLexeme();
if (lexeme == undefined) {
return
}
var editDistance = parseInt(lexeme.str, 10);
if (isNaN(editDistance)) {
var errorMessage = "edit distance must be numeric";
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
parser.currentClause.editDistance = editDistance;
var nextLexeme = parser.peekLexeme();
if (nextLexeme == undefined) {
parser.nextClause();
return
}
switch (nextLexeme.type) {
case lunr.QueryLexer.TERM:
parser.nextClause();
return lunr.QueryParser.parseTerm
case lunr.QueryLexer.FIELD:
parser.nextClause();
return lunr.QueryParser.parseField
case lunr.QueryLexer.EDIT_DISTANCE:
return lunr.QueryParser.parseEditDistance
case lunr.QueryLexer.BOOST:
return lunr.QueryParser.parseBoost
case lunr.QueryLexer.PRESENCE:
parser.nextClause();
return lunr.QueryParser.parsePresence
default:
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
}
};
lunr.QueryParser.parseBoost = function (parser) {
var lexeme = parser.consumeLexeme();
if (lexeme == undefined) {
return
}
var boost = parseInt(lexeme.str, 10);
if (isNaN(boost)) {
var errorMessage = "boost must be numeric";
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
}
parser.currentClause.boost = boost;
var nextLexeme = parser.peekLexeme();
if (nextLexeme == undefined) {
parser.nextClause();
return
}
switch (nextLexeme.type) {
case lunr.QueryLexer.TERM:
parser.nextClause();
return lunr.QueryParser.parseTerm
case lunr.QueryLexer.FIELD:
parser.nextClause();
return lunr.QueryParser.parseField
case lunr.QueryLexer.EDIT_DISTANCE:
return lunr.QueryParser.parseEditDistance
case lunr.QueryLexer.BOOST:
return lunr.QueryParser.parseBoost
case lunr.QueryLexer.PRESENCE:
parser.nextClause();
return lunr.QueryParser.parsePresence
default:
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
}
}
/**
* export the module via AMD, CommonJS or as a browser global
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
*/
;(function (root, factory) {
{
/**
* Node. Does not work with strict CommonJS, but
* only CommonJS-like enviroments that support module.exports,
* like Node.
*/
module.exports = factory();
}
}(this, function () {
/**
* Just return a value to define the module export.
* This example returns an object, but the module
* can return a function as the exported value.
*/
return lunr
}));
})();
});
const generateSchema = (hierarchy, indexNode) => {
const recordNodes = getAllowedRecordNodesForIndex(hierarchy, indexNode);
const mappedRecords = $(recordNodes, [
fp_7(n => mapRecord(createSampleRecord(n), indexNode)),
]);
// always has record key and sort key
const schema = {
sortKey: all$1.string,
key: all$1.string,
};
const fieldsHas = fp_20(schema);
const setField = (fieldName, value) => {
if (value === null || value === undefined) { return; }
const thisType = detectType(value);
if (fieldsHas(fieldName)) {
if (schema[fieldName] !== thisType) {
schema[fieldName] = all$1.string;
}
} else {
schema[fieldName] = thisType;
}
};
for (const mappedRec of mappedRecords) {
for (const f in mappedRec) {
setField(f, mappedRec[f]);
}
}
// returing an array of {name, type}
return $(schema, [
fp_32,
fp_7(k => ({ name: k, type: schema[k].name })),
fp_8(s => s.name !== 'sortKey'),
fp_33('name', ['desc']), // reverse aplha
fp_34([{ name: 'sortKey', type: all$1.string.name }]), // sortKey on end
fp_35, // sortKey first, then rest are alphabetical
]);
};
const createSampleRecord = recordNode => constructRecord(
recordNode,
getSampleFieldValue,
recordNode.parent().nodeKey(),
);
var lookup$1 = [];
var revLookup = [];
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
var inited = false;
function init$1 () {
inited = true;
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (var i = 0, len = code.length; i < len; ++i) {
lookup$1[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
}
function toByteArray (b64) {
if (!inited) {
init$1();
}
var i, j, l, tmp, placeHolders, arr;
var len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
// base64 is 4/3 + up to two characters of the original data
arr = new Arr(len * 3 / 4 - placeHolders);
// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len;
var L = 0;
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
arr[L++] = (tmp >> 16) & 0xFF;
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
if (placeHolders === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[L++] = tmp & 0xFF;
} else if (placeHolders === 1) {
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
return arr
}
function tripletToBase64 (num) {
return lookup$1[num >> 18 & 0x3F] + lookup$1[num >> 12 & 0x3F] + lookup$1[num >> 6 & 0x3F] + lookup$1[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp;
var output = [];
for (var i = start; i < end; i += 3) {
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
output.push(tripletToBase64(tmp));
}
return output.join('')
}
function fromByteArray (uint8) {
if (!inited) {
init$1();
}
var tmp;
var len = uint8.length;
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
var output = '';
var parts = [];
var maxChunkLength = 16383; // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
output += lookup$1[tmp >> 2];
output += lookup$1[(tmp << 4) & 0x3F];
output += '==';
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
output += lookup$1[tmp >> 10];
output += lookup$1[(tmp >> 4) & 0x3F];
output += lookup$1[(tmp << 2) & 0x3F];
output += '=';
}
parts.push(output);
return parts.join('')
}
function read (buffer, offset, isLE, mLen, nBytes) {
var e, m;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var nBits = -7;
var i = isLE ? (nBytes - 1) : 0;
var d = isLE ? -1 : 1;
var s = buffer[offset + i];
i += d;
e = s & ((1 << (-nBits)) - 1);
s >>= (-nBits);
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1);
e >>= (-nBits);
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
function write (buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
var i = isLE ? 0 : (nBytes - 1);
var d = isLE ? 1 : -1;
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128;
}
var toString = {}.toString;
var isArray = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
var INSPECT_MAX_BYTES = 50;
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Due to various browser bugs, sometimes the Object implementation will be used even
* when the browser supports typed arrays.
*
* Note:
*
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
* get the Object implementation, which is slower but behaves correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
? global$1.TYPED_ARRAY_SUPPORT
: true;
/*
* Export kMaxLength after typed array support is determined.
*/
var _kMaxLength = kMaxLength();
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
}
function createBuffer (that, length) {
if (kMaxLength() < length) {
throw new RangeError('Invalid typed array length')
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array(length);
that.__proto__ = Buffer.prototype;
} else {
// Fallback: Return an object instance of the Buffer class
if (that === null) {
that = new Buffer(length);
}
that.length = length;
}
return that
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
function Buffer (arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length)
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error(
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe(this, arg)
}
return from(this, arg, encodingOrOffset, length)
}
Buffer.poolSize = 8192; // not used by this implementation
// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
arr.__proto__ = Buffer.prototype;
return arr
};
function from (that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number')
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length)
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset)
}
return fromObject(that, value)
}
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(null, value, encodingOrOffset, length)
};
if (Buffer.TYPED_ARRAY_SUPPORT) {
Buffer.prototype.__proto__ = Uint8Array.prototype;
Buffer.__proto__ = Uint8Array;
}
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative')
}
}
function alloc (that, size, fill, encoding) {
assertSize(size);
if (size <= 0) {
return createBuffer(that, size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(that, size).fill(fill, encoding)
: createBuffer(that, size).fill(fill)
}
return createBuffer(that, size)
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(null, size, fill, encoding)
};
function allocUnsafe (that, size) {
assertSize(size);
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0;
}
}
return that
}
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(null, size)
};
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(null, size)
};
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8';
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
var length = byteLength(string, encoding) | 0;
that = createBuffer(that, length);
var actual = that.write(string, encoding);
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual);
}
return that
}
function fromArrayLike (that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0;
that = createBuffer(that, length);
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255;
}
return that
}
function fromArrayBuffer (that, array, byteOffset, length) {
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds')
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array);
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset);
} else {
array = new Uint8Array(array, byteOffset, length);
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array;
that.__proto__ = Buffer.prototype;
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array);
}
return that
}
function fromObject (that, obj) {
if (internalIsBuffer(obj)) {
var len = checked(obj.length) | 0;
that = createBuffer(that, len);
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len);
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data)
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}
function checked (length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0;
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = isBuffer;
function internalIsBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i];
y = b[i];
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
};
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'latin1':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
};
Buffer.concat = function concat (list, length) {
if (!isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
if (list.length === 0) {
return Buffer.alloc(0)
}
var i;
if (length === undefined) {
length = 0;
for (i = 0; i < list.length; ++i) {
length += list[i].length;
}
}
var buffer = Buffer.allocUnsafe(length);
var pos = 0;
for (i = 0; i < list.length; ++i) {
var buf = list[i];
if (!internalIsBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
buf.copy(buffer, pos);
pos += buf.length;
}
return buffer
};
function byteLength (string, encoding) {
if (internalIsBuffer(string)) {
return string.length
}
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
string = '' + string;
}
var len = string.length;
if (len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false;
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
case undefined:
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) return utf8ToBytes(string).length // assume utf8
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
}
Buffer.byteLength = byteLength;
function slowToString (encoding, start, end) {
var loweredCase = false;
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0;
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length;
}
if (end <= 0) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0;
start >>>= 0;
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8';
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase();
loweredCase = true;
}
}
}
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true;
function swap (b, n, m) {
var i = b[n];
b[n] = b[m];
b[m] = i;
}
Buffer.prototype.swap16 = function swap16 () {
var len = this.length;
if (len % 2 !== 0) {
throw new RangeError('Buffer size must be a multiple of 16-bits')
}
for (var i = 0; i < len; i += 2) {
swap(this, i, i + 1);
}
return this
};
Buffer.prototype.swap32 = function swap32 () {
var len = this.length;
if (len % 4 !== 0) {
throw new RangeError('Buffer size must be a multiple of 32-bits')
}
for (var i = 0; i < len; i += 4) {
swap(this, i, i + 3);
swap(this, i + 1, i + 2);
}
return this
};
Buffer.prototype.swap64 = function swap64 () {
var len = this.length;
if (len % 8 !== 0) {
throw new RangeError('Buffer size must be a multiple of 64-bits')
}
for (var i = 0; i < len; i += 8) {
swap(this, i, i + 7);
swap(this, i + 1, i + 6);
swap(this, i + 2, i + 5);
swap(this, i + 3, i + 4);
}
return this
};
Buffer.prototype.toString = function toString () {
var length = this.length | 0;
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
};
Buffer.prototype.equals = function equals (b) {
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
};
Buffer.prototype.inspect = function inspect () {
var str = '';
var max = INSPECT_MAX_BYTES;
if (this.length > 0) {
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
if (this.length > max) str += ' ... ';
}
return '<Buffer ' + str + '>'
};
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
if (!internalIsBuffer(target)) {
throw new TypeError('Argument must be a Buffer')
}
if (start === undefined) {
start = 0;
}
if (end === undefined) {
end = target ? target.length : 0;
}
if (thisStart === undefined) {
thisStart = 0;
}
if (thisEnd === undefined) {
thisEnd = this.length;
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError('out of range index')
}
if (thisStart >= thisEnd && start >= end) {
return 0
}
if (thisStart >= thisEnd) {
return -1
}
if (start >= end) {
return 1
}
start >>>= 0;
end >>>= 0;
thisStart >>>= 0;
thisEnd >>>= 0;
if (this === target) return 0
var x = thisEnd - thisStart;
var y = end - start;
var len = Math.min(x, y);
var thisCopy = this.slice(thisStart, thisEnd);
var targetCopy = target.slice(start, end);
for (var i = 0; i < len; ++i) {
if (thisCopy[i] !== targetCopy[i]) {
x = thisCopy[i];
y = targetCopy[i];
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
};
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset;
byteOffset = 0;
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff;
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000;
}
byteOffset = +byteOffset; // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1);
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1;
} else if (byteOffset < 0) {
if (dir) byteOffset = 0;
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding);
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (internalIsBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF; // Search for a byte value [0-255]
if (Buffer.TYPED_ARRAY_SUPPORT &&
typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1;
var arrLength = arr.length;
var valLength = val.length;
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase();
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2;
arrLength /= 2;
valLength /= 2;
byteOffset /= 2;
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i;
if (dir) {
var foundIndex = -1;
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i;
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex;
foundIndex = -1;
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
for (i = byteOffset; i >= 0; i--) {
var found = true;
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false;
break
}
}
if (found) return i
}
}
return -1
}
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1
};
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
};
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
};
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0;
var remaining = buf.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
}
// must be an even number of digits
var strLen = string.length;
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2;
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16);
if (isNaN(parsed)) return i
buf[offset + i] = parsed;
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8';
length = this.length;
offset = 0;
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset;
length = this.length;
offset = 0;
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset | 0;
if (isFinite(length)) {
length = length | 0;
if (encoding === undefined) encoding = 'utf8';
} else {
encoding = length;
length = undefined;
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
throw new Error(
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
var remaining = this.length - offset;
if (length === undefined || length > remaining) length = remaining;
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8';
var loweredCase = false;
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'latin1':
case 'binary':
return latin1Write(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
};
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
};
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return fromByteArray(buf)
} else {
return fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end);
var res = [];
var i = start;
while (i < end) {
var firstByte = buf[i];
var codePoint = null;
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1;
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint;
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte;
}
break
case 2:
secondByte = buf[i + 1];
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint;
}
}
break
case 3:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint;
}
}
break
case 4:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
fourthByte = buf[i + 3];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint;
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD;
bytesPerSequence = 1;
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000;
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
codePoint = 0xDC00 | codePoint & 0x3FF;
}
res.push(codePoint);
i += bytesPerSequence;
}
return decodeCodePointsArray(res)
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000;
function decodeCodePointsArray (codePoints) {
var len = codePoints.length;
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = '';
var i = 0;
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
);
}
return res
}
function asciiSlice (buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F);
}
return ret
}
function latin1Slice (buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i]);
}
return ret
}
function hexSlice (buf, start, end) {
var len = buf.length;
if (!start || start < 0) start = 0;
if (!end || end < 0 || end > len) end = len;
var out = '';
for (var i = start; i < end; ++i) {
out += toHex(buf[i]);
}
return out
}
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end);
var res = '';
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
var len = this.length;
start = ~~start;
end = end === undefined ? len : ~~end;
if (start < 0) {
start += len;
if (start < 0) start = 0;
} else if (start > len) {
start = len;
}
if (end < 0) {
end += len;
if (end < 0) end = 0;
} else if (end > len) {
end = len;
}
if (end < start) end = start;
var newBuf;
if (Buffer.TYPED_ARRAY_SUPPORT) {
newBuf = this.subarray(start, end);
newBuf.__proto__ = Buffer.prototype;
} else {
var sliceLen = end - start;
newBuf = new Buffer(sliceLen, undefined);
for (var i = 0; i < sliceLen; ++i) {
newBuf[i] = this[i + start];
}
}
return newBuf
};
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var val = this[offset];
var mul = 1;
var i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul;
}
return val
};
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) {
checkOffset(offset, byteLength, this.length);
}
var val = this[offset + --byteLength];
var mul = 1;
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul;
}
return val
};
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length);
return this[offset]
};
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length);
return this[offset] | (this[offset + 1] << 8)
};
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length);
return (this[offset] << 8) | this[offset + 1]
};
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
};
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
};
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var val = this[offset];
var mul = 1;
var i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul;
}
mul *= 0x80;
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
return val
};
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var i = byteLength;
var mul = 1;
var val = this[offset + --i];
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul;
}
mul *= 0x80;
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
return val
};
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length);
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
};
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length);
var val = this[offset] | (this[offset + 1] << 8);
return (val & 0x8000) ? val | 0xFFFF0000 : val
};
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length);
var val = this[offset + 1] | (this[offset] << 8);
return (val & 0x8000) ? val | 0xFFFF0000 : val
};
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
};
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
};
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return read(this, offset, true, 23, 4)
};
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length);
return read(this, offset, false, 23, 4)
};
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length);
return read(this, offset, true, 52, 8)
};
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length);
return read(this, offset, false, 52, 8)
};
function checkInt (buf, value, offset, ext, max, min) {
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
checkInt(this, value, offset, byteLength, maxBytes, 0);
}
var mul = 1;
var i = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset | 0;
byteLength = byteLength | 0;
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
checkInt(this, value, offset, byteLength, maxBytes, 0);
}
var i = byteLength - 1;
var mul = 1;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
this[offset] = (value & 0xff);
return offset + 1
};
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1;
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8;
}
}
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
} else {
objectWriteUInt16(this, value, offset, true);
}
return offset + 2
};
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8);
this[offset + 1] = (value & 0xff);
} else {
objectWriteUInt16(this, value, offset, false);
}
return offset + 2
};
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1;
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
}
}
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset + 3] = (value >>> 24);
this[offset + 2] = (value >>> 16);
this[offset + 1] = (value >>> 8);
this[offset] = (value & 0xff);
} else {
objectWriteUInt32(this, value, offset, true);
}
return offset + 4
};
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24);
this[offset + 1] = (value >>> 16);
this[offset + 2] = (value >>> 8);
this[offset + 3] = (value & 0xff);
} else {
objectWriteUInt32(this, value, offset, false);
}
return offset + 4
};
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1);
checkInt(this, value, offset, byteLength, limit - 1, -limit);
}
var i = 0;
var mul = 1;
var sub = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) {
var limit = Math.pow(2, 8 * byteLength - 1);
checkInt(this, value, offset, byteLength, limit - 1, -limit);
}
var i = byteLength - 1;
var mul = 1;
var sub = 0;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
if (value < 0) value = 0xff + value + 1;
this[offset] = (value & 0xff);
return offset + 1
};
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
} else {
objectWriteUInt16(this, value, offset, true);
}
return offset + 2
};
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8);
this[offset + 1] = (value & 0xff);
} else {
objectWriteUInt16(this, value, offset, false);
}
return offset + 2
};
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
this[offset + 2] = (value >>> 16);
this[offset + 3] = (value >>> 24);
} else {
objectWriteUInt32(this, value, offset, true);
}
return offset + 4
};
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value;
offset = offset | 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
if (value < 0) value = 0xffffffff + value + 1;
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24);
this[offset + 1] = (value >>> 16);
this[offset + 2] = (value >>> 8);
this[offset + 3] = (value & 0xff);
} else {
objectWriteUInt32(this, value, offset, false);
}
return offset + 4
};
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4);
}
write(buf, value, offset, littleEndian, 23, 4);
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
};
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
};
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8);
}
write(buf, value, offset, littleEndian, 52, 8);
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
};
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
};
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (!start) start = 0;
if (!end && end !== 0) end = this.length;
if (targetStart >= target.length) targetStart = target.length;
if (!targetStart) targetStart = 0;
if (end > 0 && end < start) end = start;
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
// Fatal error conditions
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
// Are we oob?
if (end > this.length) end = this.length;
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start;
}
var len = end - start;
var i;
if (this === target && start < targetStart && targetStart < end) {
// descending copy from end
for (i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start];
}
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
// ascending copy from start
for (i = 0; i < len; ++i) {
target[i + targetStart] = this[i + start];
}
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, start + len),
targetStart
);
}
return len
};
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
// Handle string cases:
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start;
start = 0;
end = this.length;
} else if (typeof end === 'string') {
encoding = end;
end = this.length;
}
if (val.length === 1) {
var code = val.charCodeAt(0);
if (code < 256) {
val = code;
}
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
} else if (typeof val === 'number') {
val = val & 255;
}
// Invalid ranges are not set to a default, so can range check early.
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (end <= start) {
return this
}
start = start >>> 0;
end = end === undefined ? this.length : end >>> 0;
if (!val) val = 0;
var i;
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val;
}
} else {
var bytes = internalIsBuffer(val)
? val
: utf8ToBytes(new Buffer(val, encoding).toString());
var len = bytes.length;
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len];
}
}
return this
};
// HELPER FUNCTIONS
// ================
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '=';
}
return str
}
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
function utf8ToBytes (string, units) {
units = units || Infinity;
var codePoint;
var length = string.length;
var leadSurrogate = null;
var bytes = [];
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i);
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
}
// valid lead
leadSurrogate = codePoint;
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
leadSurrogate = codePoint;
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
}
leadSurrogate = null;
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint);
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF);
}
return byteArray
}
function utf16leToBytes (str, units) {
var c, hi, lo;
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray
}
function base64ToBytes (str) {
return toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i];
}
return i
}
function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
function isBuffer(obj) {
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
}
function isFastBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
// For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
}
var bufferEs6 = /*#__PURE__*/Object.freeze({
INSPECT_MAX_BYTES: INSPECT_MAX_BYTES,
kMaxLength: _kMaxLength,
Buffer: Buffer,
SlowBuffer: SlowBuffer,
isBuffer: isBuffer
});
var safeBuffer = createCommonjsModule(function (module, exports) {
/* eslint-disable node/no-deprecated-api */
var Buffer = bufferEs6.Buffer;
// alternative to using Object.keys for old browsers
function copyProps (src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = bufferEs6;
} else {
// Copy properties from require('buffer')
copyProps(bufferEs6, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer (arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length)
}
SafeBuffer.prototype = Object.create(Buffer.prototype);
// Copy static methods from Buffer
copyProps(Buffer, SafeBuffer);
SafeBuffer.from = function (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
throw new TypeError('Argument must not be a number')
}
return Buffer(arg, encodingOrOffset, length)
};
SafeBuffer.alloc = function (size, fill, encoding) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
var buf = Buffer(size);
if (fill !== undefined) {
if (typeof encoding === 'string') {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf
};
SafeBuffer.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return Buffer(size)
};
SafeBuffer.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return bufferEs6.SlowBuffer(size)
};
});
var safeBuffer_1 = safeBuffer.Buffer;
const TRANSACTIONS_FOLDER = `${keySep}.transactions`;
const LOCK_FILENAME = 'lock';
const LOCK_FILE_KEY = joinKey(
TRANSACTIONS_FOLDER, LOCK_FILENAME,
);
const createNodeErrors = {
indexCannotBeParent: 'Index template cannot be a parent',
allNonRootNodesMustHaveParent: 'Only the root node may have no parent',
indexParentMustBeRecordOrRoot: 'An index may only have a record or root as a parent',
aggregateParentMustBeAnIndex: 'aggregateGroup parent must be an index',
};
const pathRegxMaker = node => () => node.nodeKey().replace(/{id}/g, '[a-zA-Z0-9_-]+');
const nodeKeyMaker = node => () => switchCase(
[n => isRecord(n) && !isSingleRecord(n),
n => joinKey(
node.parent().nodeKey(),
node.collectionName,
`${n.nodeId}-{id}`,
)],
[isRoot,
fp_14('/')],
[defaultCase,
n => joinKey(node.parent().nodeKey(), n.name)],
)(node);
const validate = parent => (node) => {
if (isIndex(node)
&& isSomething(parent)
&& !isRoot(parent)
&& !isRecord(parent)) {
throw new BadRequestError(createNodeErrors.indexParentMustBeRecordOrRoot);
}
if (isaggregateGroup(node)
&& isSomething(parent)
&& !isIndex(parent)) {
throw new BadRequestError(createNodeErrors.aggregateParentMustBeAnIndex);
}
if (isNothing(parent) && !isRoot(node)) { throw new BadRequestError(createNodeErrors.allNonRootNodesMustHaveParent); }
return node;
};
const construct = parent => (node) => {
node.nodeKey = nodeKeyMaker(node);
node.pathRegx = pathRegxMaker(node);
node.parent = fp_14(parent);
node.isRoot = () => isNothing(parent)
&& node.name === 'root'
&& node.type === 'root';
if (isCollectionRecord(node)) {
node.collectionNodeKey = () => joinKey(
parent.nodeKey(), node.collectionName,
);
node.collectionPathRegx = () => joinKey(
parent.pathRegx(), node.collectionName,
);
}
return node;
};
const addToParent = (obj) => {
const parent = obj.parent();
if (isSomething(parent)) {
if (isIndex(obj))
// Q: why are indexes not children ?
// A: because they cannot have children of their own.
{ parent.indexes.push(obj); } else if (isaggregateGroup(obj)) { parent.aggregateGroups.push(obj); } else { parent.children.push(obj); }
if (isRecord(obj)) {
const defaultIndex = lodash_15(
parent.indexes,
i => i.name === `${parent.name}_index`,
);
if (defaultIndex) {
defaultIndex.allowedRecordNodeIds.push(obj.nodeId);
}
}
}
return obj;
};
const constructNode = (parent, obj) => $(obj, [
construct(parent),
validate(parent),
addToParent,
]);
const getNodeId = (parentNode) => {
// this case is handled better elsewhere
if (!parentNode) return null;
const findRoot = n => (isRoot(n) ? n : findRoot(n.parent()));
const root = findRoot(parentNode);
return ($(root, [
getFlattenedHierarchy,
fp_7(n => n.nodeId),
fp_51]) + 1);
};
const constructHierarchy = (node, parent) => {
construct(parent)(node);
if (node.indexes) {
lodash_14(node.indexes,
child => constructHierarchy(child, node));
}
if (node.aggregateGroups) {
lodash_14(node.aggregateGroups,
child => constructHierarchy(child, node));
}
if (node.children && node.children.length > 0) {
lodash_14(node.children,
child => constructHierarchy(child, node));
}
if (node.fields) {
lodash_14(node.fields,
f => lodash_14(f.typeOptions, (val, key) => {
const def = all$1[f.type].optionDefinitions[key];
if (!def) {
// unknown typeOption
delete f.typeOptions[key];
} else {
f.typeOptions[key] = def.parse(val);
}
}));
}
return node;
};
const getNewRootLevel = () => construct()({
name: 'root',
type: 'root',
children: [],
pathMaps: [],
indexes: [],
nodeId: 0,
});
const _getNewRecordTemplate = (parent, name, createDefaultIndex, isSingle) => {
const node = constructNode(parent, {
name,
type: 'record',
fields: [],
children: [],
validationRules: [],
nodeId: getNodeId(parent),
indexes: [],
allidsShardFactor: isRecord(parent) ? 1 : 64,
collectionName: '',
isSingle,
});
if (createDefaultIndex) {
const defaultIndex = getNewIndexTemplate(parent);
defaultIndex.name = `${name}_index`;
defaultIndex.allowedRecordNodeIds.push(node.nodeId);
}
return node;
};
const getNewRecordTemplate = (parent, name = '', createDefaultIndex = true) => _getNewRecordTemplate(parent, name, createDefaultIndex, false);
const getNewSingleRecordTemplate = parent => _getNewRecordTemplate(parent, '', false, true);
const getNewIndexTemplate = (parent, type = 'ancestor') => constructNode(parent, {
name: '',
type: 'index',
map: 'return {...record};',
filter: '',
indexType: type,
getShardName: '',
getSortKey: 'record.id',
aggregateGroups: [],
allowedRecordNodeIds: [],
nodeId: getNodeId(parent),
});
const getNewAggregateGroupTemplate = index => constructNode(index, {
name: '',
type: 'aggregateGroup',
groupBy: '',
aggregates: [],
condition: '',
nodeId: getNodeId(index),
});
const getNewAggregateTemplate = (set) => {
const aggregatedValue = {
name: '',
aggregatedValue: '',
};
set.aggregates.push(aggregatedValue);
return aggregatedValue;
};
const fieldErrors = {
AddFieldValidationFailed: 'Add field validation: ',
};
const allowedTypes = () => fp_32(all$1);
const getNewField = type => ({
name: '', // how field is referenced internally
type,
typeOptions: getDefaultOptions$1(type),
label: '', // how field is displayed
getInitialValue: 'default', // function that gets value when initially created
getUndefinedValue: 'default', // function that gets value when field undefined on record
});
const fieldRules = allFields => [
makerule('name', 'field name is not set',
f => isNonEmptyString(f.name)),
makerule('type', 'field type is not set',
f => isNonEmptyString(f.type)),
makerule('label', 'field label is not set',
f => isNonEmptyString(f.label)),
makerule('getInitialValue', 'getInitialValue function is not set',
f => isNonEmptyString(f.getInitialValue)),
makerule('getUndefinedValue', 'getUndefinedValue function is not set',
f => isNonEmptyString(f.getUndefinedValue)),
makerule('name', 'field name is duplicated',
f => isNothingOrEmpty(f.name)
|| fp_10('name')(allFields)[f.name] === 1),
makerule('type', 'type is unknown',
f => isNothingOrEmpty(f.type)
|| fp_6(t => f.type === t)(allowedTypes())),
];
const typeOptionsRules = (field) => {
const type = all$1[field.type];
if (isNothing(type)) return [];
const def = optName => type.optionDefinitions[optName];
return $(field.typeOptions, [
fp_32,
fp_8(o => isSomething(def(o))
&& isSomething(def(o).isValid)),
fp_7(o => makerule(
`typeOptions.${o}`,
`${def(o).requirementDescription}`,
field => def(o).isValid(field.typeOptions[o]),
)),
]);
};
const validateField = allFields => (field) => {
const everySingleField = fp_11(field)(allFields) ? allFields : [...allFields, field];
return applyRuleSet([...fieldRules(everySingleField), ...typeOptionsRules(field)])(field);
};
const validateAllFields = recordNode => $(recordNode.fields, [
fp_7(validateField(recordNode.fields)),
fp_38,
]);
const addField = (recordTemplate, field) => {
if (isNothingOrEmpty(field.label)) {
field.label = field.name;
}
const validationMessages = validateField([...recordTemplate.fields, field])(field);
if (validationMessages.length > 0) {
const errors = fp_7(m => m.error)(validationMessages);
throw new BadRequestError(`${fieldErrors.AddFieldValidationFailed} ${errors.join(', ')}`);
}
recordTemplate.fields.push(field);
};
const getNewRecordValidationRule = (invalidFields,
messageWhenInvalid,
expressionWhenValid) => ({
invalidFields, messageWhenInvalid, expressionWhenValid,
});
const getStaticValue = switchCase(
[fp_22, v => v.toString()],
[fp_24, v => v.toString()],
[fp_42, v => `'${v}'`],
);
const commonRecordValidationRules = ({
fieldNotEmpty: fieldName => getNewRecordValidationRule(
[fieldName],
`${fieldName} is empty`,
`!_.isEmpty(record['${fieldName}'])`,
),
fieldBetween: (fieldName, min, max) => getNewRecordValidationRule(
[fieldName],
`${fieldName} must be between ${min.toString()} and ${max.toString()}`,
`record['${fieldName}'] >= ${getStaticValue(min)} && record['${fieldName}'] <= ${getStaticValue(max)} `,
),
fieldGreaterThan: (fieldName, min, max) => getNewRecordValidationRule(
[fieldName],
`${fieldName} must be greater than ${min.toString()} and ${max.toString()}`,
`record['${fieldName}'] >= ${getStaticValue(min)} `,
),
});
const addRecordValidationRule = recordNode => rule => recordNode.validationRules.push(rule);
const createTrigger = () => ({
actionName: '',
eventName: '',
// function, has access to event context,
// returns object that is used as parameter to action
// only used if triggered by event
optionsCreator: '',
// action runs if true,
// has access to event context
condition: '',
});
const createAction = () => ({
name: '',
behaviourSource: '',
// name of function in actionSource
behaviourName: '',
// parameter passed into behaviour.
// any other parms passed at runtime e.g.
// by trigger, or manually, will be merged into this
initialOptions: {},
});
const aggregateRules = [
makerule('name', 'choose a name for the aggregate',
a => isNonEmptyString(a.name)),
makerule('aggregatedValue', 'aggregatedValue does not compile',
a => fp_9(a.aggregatedValue)
|| executesWithoutException(
() => compileCode(a.aggregatedValue),
)),
];
const validateAggregate = aggregate => applyRuleSet(aggregateRules)(aggregate);
const validateAllAggregates = all => $(all, [
fp_7(validateAggregate),
fp_38,
]);
const ruleSet = (...sets) => fp_14(fp_38([...sets]));
const commonRules = [
makerule('name', 'node name is not set',
node => stringNotEmpty(node.name)),
makerule('type', 'node type not recognised',
anyTrue(isRecord, isRoot, isIndex, isaggregateGroup)),
];
const recordRules = [
makerule('fields', 'no fields have been added to the record',
node => isNonEmptyArray(node.fields)),
makerule('validationRules', "validation rule is missing a 'messageWhenValid' member",
node => fp_44(r => fp_20('messageWhenInvalid')(r))(node.validationRules)),
makerule('validationRules', "validation rule is missing a 'expressionWhenValid' member",
node => fp_44(r => fp_20('expressionWhenValid')(r))(node.validationRules)),
];
const aggregateGroupRules = [
makerule('condition', 'condition does not compile',
a => fp_9(a.condition)
|| executesWithoutException(
() => compileExpression(a.condition),
)),
];
const getRuleSet = node => switchCase(
[isRecord, ruleSet(
commonRules,
recordRules,
)],
[isIndex, ruleSet(
commonRules,
indexRuleSet,
)],
[isaggregateGroup, ruleSet(
commonRules,
aggregateGroupRules,
)],
[defaultCase, ruleSet(commonRules, [])],
)(node);
const validateNode = node => applyRuleSet(getRuleSet(node))(node);
const validateAll = (appHierarchy) => {
const flattened = getFlattenedHierarchy(
appHierarchy,
);
const duplicateNameRule = makerule(
'name', 'node names must be unique under shared parent',
n => fp_8(f => f.parent() === n.parent()
&& f.name === n.name)(flattened).length === 1,
);
const duplicateNodeKeyErrors = $(flattened, [
fp_7(n => applyRuleSet([duplicateNameRule])(n)),
fp_8(isSomething),
fp_38,
]);
const fieldErrors = $(flattened, [
fp_8(isRecord),
fp_7(validateAllFields),
fp_38,
]);
const aggregateErrors = $(flattened, [
fp_8(isaggregateGroup),
fp_7(s => validateAllAggregates(
s.aggregates,
)),
fp_38,
]);
return $(flattened, [
fp_7(validateNode),
fp_38,
fp_1(duplicateNodeKeyErrors),
fp_1(fieldErrors),
fp_1(aggregateErrors),
]);
};
const actionRules = [
makerule('name', 'action must have a name',
a => isNonEmptyString(a.name)),
makerule('behaviourName', 'must supply a behaviour name to the action',
a => isNonEmptyString(a.behaviourName)),
makerule('behaviourSource', 'must supply a behaviour source for the action',
a => isNonEmptyString(a.behaviourSource)),
];
const duplicateActionRule = makerule('', 'action name must be unique', () => {});
const validateAction = action => applyRuleSet(actionRules)(action);
const validateActions = (allActions) => {
const duplicateActions = $(allActions, [
fp_8(a => fp_8(a2 => a2.name === a.name)(allActions).length > 1),
fp_7(a => validationError(duplicateActionRule, a)),
]);
const errors = $(allActions, [
fp_7(validateAction),
fp_38,
fp_1(duplicateActions),
fp_43('name'),
]);
return errors;
};
const triggerRules = actions => ([
makerule('actionName', 'must specify an action',
t => isNonEmptyString(t.actionName)),
makerule('eventName', 'must specify and event',
t => isNonEmptyString(t.eventName)),
makerule('actionName', 'specified action not supplied',
t => !t.actionName
|| fp_6(a => a.name === t.actionName)(actions)),
makerule('eventName', 'invalid Event Name',
t => !t.eventName
|| fp_11(t.eventName)(eventsList)),
makerule('optionsCreator', 'Options Creator does not compile - check your expression',
(t) => {
if (!t.optionsCreator) return true;
try {
compileCode(t.optionsCreator);
return true;
} catch (_) { return false; }
}),
makerule('condition', 'Trigger condition does not compile - check your expression',
(t) => {
if (!t.condition) return true;
try {
compileExpression(t.condition);
return true;
} catch (_) { return false; }
}),
]);
const validateTrigger = (trigger, allActions) => {
const errors = applyRuleSet(triggerRules(allActions))(trigger);
return errors;
};
const validateTriggers = (triggers, allActions) => $(triggers, [
fp_7(t => validateTrigger(t, allActions)),
fp_38,
]);
const getApplicationDefinition = datastore => async () => {
const exists = await datastore.exists(appDefinitionFile);
if (!exists) throw new Error('Application definition does not exist');
const appDefinition = await datastore.loadJson(appDefinitionFile);
appDefinition.hierarchy = constructHierarchy(
appDefinition.hierarchy,
);
return appDefinition;
};
const saveApplicationHierarchy = app => async hierarchy => apiWrapper(
app,
events.templateApi.saveApplicationHierarchy,
permission.writeTemplates.isAuthorized,
{ hierarchy },
_saveApplicationHierarchy, app.datastore, hierarchy,
);
const _saveApplicationHierarchy = async (datastore, hierarchy) => {
const validationErrors = await validateAll(hierarchy);
if (validationErrors.length > 0) {
throw new Error(`Hierarchy is invalid: ${lodash_2(
validationErrors.map(e => `${e.item.nodeKey ? e.item.nodeKey() : ''} : ${e.error}`),
',',
)}`);
}
if (await datastore.exists(appDefinitionFile)) {
const appDefinition = await datastore.loadJson(appDefinitionFile);
appDefinition.hierarchy = hierarchy;
await datastore.updateJson(appDefinitionFile, appDefinition);
} else {
await datastore.createFolder('/.config');
const appDefinition = { actions: [], triggers: [], hierarchy };
await datastore.createJson(appDefinitionFile, appDefinition);
}
};
const saveActionsAndTriggers = app => async (actions, triggers) => apiWrapper(
app,
events.templateApi.saveActionsAndTriggers,
permission.writeTemplates.isAuthorized,
{ actions, triggers },
_saveActionsAndTriggers, app.datastore, actions, triggers,
);
const _saveActionsAndTriggers = async (datastore, actions, triggers) => {
if (await datastore.exists(appDefinitionFile)) {
const appDefinition = await datastore.loadJson(appDefinitionFile);
appDefinition.actions = actions;
appDefinition.triggers = triggers;
const actionValidErrs = fp_7(e => e.error)(validateActions(actions));
if (actionValidErrs.length > 0) {
throw new BadRequestError(`Actions are invalid: ${lodash_2(actionValidErrs, ', ')}`);
}
const triggerValidErrs = fp_7(e => e.error)(validateTriggers(triggers, actions));
if (triggerValidErrs.length > 0) {
throw new BadRequestError(`Triggers are invalid: ${lodash_2(triggerValidErrs, ', ')}`);
}
await datastore.updateJson(appDefinitionFile, appDefinition);
} else {
throw new BadRequestError('Cannot save actions: Application definition does not exist');
}
};
const getBehaviourSources = async (datastore) => {
await datastore.loadFile('/.config/behaviourSources.js');
};
const api = app => ({
getApplicationDefinition: getApplicationDefinition(app.datastore),
saveApplicationHierarchy: saveApplicationHierarchy(app),
saveActionsAndTriggers: saveActionsAndTriggers(app),
getBehaviourSources: () => getBehaviourSources(app.datastore),
getNewRootLevel,
constructNode,
getNewIndexTemplate,
getNewRecordTemplate,
getNewField,
validateField,
addField,
fieldErrors,
getNewRecordValidationRule,
commonRecordValidationRules,
addRecordValidationRule,
createAction,
createTrigger,
validateActions,
validateTrigger,
getNewAggregateGroupTemplate,
getNewAggregateTemplate,
constructHierarchy,
getNewSingleRecordTemplate,
allTypes: all$1,
validateNode,
validateAll,
validateTriggers,
});
const getTemplateApi = app => api(app);
const getUsers = app => async () => apiWrapper(
app,
events.authApi.getUsers,
permission.listUsers.isAuthorized,
{},
_getUsers, app,
);
const _getUsers = async app => $(await app.datastore.loadJson(USERS_LIST_FILE), [
fp_7(stripUserOfSensitiveStuff),
]);
const loadAccessLevels = app => async () => apiWrapper(
app,
events.authApi.loadAccessLevels,
permission.listAccessLevels.isAuthorized,
{},
_loadAccessLevels, app,
);
const _loadAccessLevels = async app => await app.datastore.loadJson(ACCESS_LEVELS_FILE);
const dummyHash = '$argon2i$v=19$m=4096,t=3,p=1$UZRo409UYBGjHJS3CV6Uxw$rU84qUqPeORFzKYmYY0ceBLDaPO+JWSH4PfNiKXfIKk';
const authenticate = app => async (username, password) => apiWrapper(
app,
events.authApi.authenticate,
alwaysAuthorized,
{ username, password },
_authenticate, app, username, password,
);
const _authenticate = async (app, username, password) => {
if (isNothingOrEmpty(username) || isNothingOrEmpty(password)) { return null; }
const allUsers = await _getUsers(app);
let user = getUserByName(
allUsers,
username,
);
const notAUser = 'not-a-user';
// continue with non-user - so time to verify remains consistent
// with verification of a valid user
if (!user || !user.enabled) { user = notAUser; }
let userAuth;
try {
userAuth = await app.datastore.loadJson(
userAuthFile(username),
);
} catch (_) {
userAuth = { accessLevels: [], passwordHash: dummyHash };
}
const permissions = await buildUserPermissions(app, user.accessLevels);
const verified = await app.crypto.verify(
userAuth.passwordHash,
password,
);
if (user === notAUser) { return null; }
return verified
? {
...user, permissions, temp: false, isUser: true,
}
: null;
};
const authenticateTemporaryAccess = app => async (tempAccessCode) => {
if (isNothingOrEmpty(tempAccessCode)) { return null; }
const temp = parseTemporaryCode(tempAccessCode);
let user = $(await _getUsers(app), [
fp_13(u => u.temporaryAccessId === temp.id),
]);
const notAUser = 'not-a-user';
if (!user || !user.enabled) { user = notAUser; }
let userAuth;
try {
userAuth = await app.datastore.loadJson(
userAuthFile(user.name),
);
} catch (e) {
userAuth = {
temporaryAccessHash: dummyHash,
temporaryAccessExpiryEpoch: (await app.getEpochTime() + 10000),
};
}
if (userAuth.temporaryAccessExpiryEpoch < await app.getEpochTime()) { user = notAUser; }
const tempCode = !temp.code ? shortid_1() : temp.code;
const verified = await app.crypto.verify(
userAuth.temporaryAccessHash,
tempCode,
);
if (user === notAUser) { return null; }
return verified
? {
...user,
permissions: [],
temp: true,
isUser: true,
}
: null;
};
const buildUserPermissions = async (app, userAccessLevels) => {
const allAccessLevels = await _loadAccessLevels(app);
return $(allAccessLevels.levels, [
fp_8(l => fp_6(ua => l.name === ua)(userAccessLevels)),
fp_7(l => l.permissions),
fp_38,
]);
};
const createTemporaryAccess$1 = app => async userName => apiWrapper(
app,
events.authApi.createTemporaryAccess,
alwaysAuthorized,
{ userName },
_createTemporaryAccess, app, userName,
);
const _createTemporaryAccess = async (app, userName) => {
const tempCode = await getTemporaryCode(app);
const lock = await getLock(
app, USERS_LOCK_FILE, 1000, 2,
);
if (isNolock(lock)) { throw new Error('Unable to create temporary access, could not get lock - try again'); }
try {
const users = await app.datastore.loadJson(USERS_LIST_FILE);
const user = getUserByName(users, userName);
user.temporaryAccessId = tempCode.temporaryAccessId;
await app.datastore.updateJson(
USERS_LIST_FILE,
users,
);
} finally {
await releaseLock(app, lock);
}
const userAuth = await app.datastore.loadJson(
userAuthFile(userName),
);
userAuth.temporaryAccessHash = tempCode.temporaryAccessHash;
userAuth.temporaryAccessExpiryEpoch = tempCode.temporaryAccessExpiryEpoch;
await app.datastore.updateJson(
userAuthFile(userName),
userAuth,
);
return tempCode.tempCode;
};
const getTemporaryCode = async (app) => {
const tempCode = shortid_1()
+ shortid_1()
+ shortid_1()
+ shortid_1();
const tempId = shortid_1();
return {
temporaryAccessHash: await app.crypto.hash(
tempCode,
),
temporaryAccessExpiryEpoch:
(await app.getEpochTime()) + tempCodeExpiryLength,
tempCode: `tmp:${tempId}:${tempCode}`,
temporaryAccessId: tempId,
};
};
const userRules = allUsers => [
makerule('name', 'username must be set',
u => isNonEmptyString(u.name)),
makerule('accessLevels', 'user must have at least one access level',
u => u.accessLevels.length > 0),
makerule('name', 'username must be unique',
u => fp_8(u2 => insensitiveEquals(u2.name, u.name))(allUsers).length === 1),
makerule('accessLevels', 'access levels must only contain stings',
u => all(isNonEmptyString)(u.accessLevels)),
];
const validateUser = () => (allusers, user) => applyRuleSet(userRules(allusers))(user);
const getNewUser = app => () => apiWrapperSync(
app,
events.authApi.getNewUser,
permission.createUser.isAuthorized,
{},
_getNewUser, app,
);
const _getNewUser = () => ({
name: '',
accessLevels: [],
enabled: true,
temporaryAccessId: '',
});
const getNewUserAuth = app => () => apiWrapperSync(
app,
events.authApi.getNewUserAuth,
permission.createUser.isAuthorized,
{},
_getNewUserAuth, app,
);
const _getNewUserAuth = () => ({
passwordHash: '',
temporaryAccessHash: '',
temporaryAccessExpiryEpoch: 0,
});
const isValidPassword = app => password => apiWrapperSync(
app,
events.authApi.isValidPassword,
alwaysAuthorized,
{ password },
_isValidPassword, app, password,
);
const _isValidPassword = (app, password) => scorePassword(password).score > 30;
const changeMyPassword = app => async (currentPw, newpassword) => apiWrapper(
app,
events.authApi.changeMyPassword,
alwaysAuthorized,
{ currentPw, newpassword },
_changeMyPassword, app, currentPw, newpassword,
);
const _changeMyPassword = async (app, currentPw, newpassword) => {
const existingAuth = await app.datastore.loadJson(
userAuthFile(app.user.name),
);
if (isSomething(existingAuth.passwordHash)) {
const verified = await app.crypto.verify(
existingAuth.passwordHash,
currentPw,
);
if (verified) {
await await doSet(
app, existingAuth,
app.user.name, newpassword,
);
return true;
}
}
return false;
};
const setPasswordFromTemporaryCode = app => async (tempCode, newpassword) => apiWrapper(
app,
events.authApi.setPasswordFromTemporaryCode,
alwaysAuthorized,
{ tempCode, newpassword },
_setPasswordFromTemporaryCode, app, tempCode, newpassword,
);
const _setPasswordFromTemporaryCode = async (app, tempCode, newpassword) => {
const currentTime = await app.getEpochTime();
const temp = parseTemporaryCode(tempCode);
const user = $(await _getUsers(app), [
fp_13(u => u.temporaryAccessId === temp.id),
]);
if (!user) { return false; }
const existingAuth = await app.datastore.loadJson(
userAuthFile(user.name),
);
if (isSomething(existingAuth.temporaryAccessHash)
&& existingAuth.temporaryAccessExpiryEpoch > currentTime) {
const verified = await app.crypto.verify(
existingAuth.temporaryAccessHash,
temp.code,
);
if (verified) {
await doSet(
app, existingAuth,
user.name, newpassword,
);
return true;
}
}
return false;
};
const doSet = async (app, auth, username, newpassword) => {
auth.temporaryAccessHash = '';
auth.temporaryAccessExpiryEpoch = 0;
auth.passwordHash = await app.crypto.hash(
newpassword,
);
await app.datastore.updateJson(
userAuthFile(username),
auth,
);
};
const scorePassword = app => password => apiWrapperSync(
app,
events.authApi.scorePassword,
alwaysAuthorized,
{ password },
_scorePassword, password,
);
const _scorePassword = (password) => {
// from https://stackoverflow.com/questions/948172/password-strength-meter
// thank you https://stackoverflow.com/users/46617/tm-lv
let score = 0;
if (!password) { return score; }
// award every unique letter until 5 repetitions
const letters = new Object();
for (let i = 0; i < password.length; i++) {
letters[password[i]] = (letters[password[i]] || 0) + 1;
score += 5.0 / letters[password[i]];
}
// bonus points for mixing it up
const variations = {
digits: /\d/.test(password),
lower: /[a-z]/.test(password),
upper: /[A-Z]/.test(password),
nonWords: /\W/.test(password),
};
let variationCount = 0;
for (const check in variations) {
variationCount += (variations[check] == true) ? 1 : 0;
}
score += (variationCount - 1) * 10;
const strengthText = score > 80
? 'strong'
: score > 60
? 'good'
: score >= 30
? 'weak'
: 'very weak';
return {
score: parseInt(score),
strengthText,
};
};
const createUser$1 = app => async (user, password = null) => apiWrapper(
app,
events.authApi.createUser,
permission.createUser.isAuthorized,
{ user, password },
_createUser, app, user, password,
);
const _createUser = async (app, user, password = null) => {
const lock = await getLock(
app, USERS_LOCK_FILE, 1000, 2,
);
if (isNolock(lock)) { throw new Error('Unable to create user, could not get lock - try again'); }
const users = await app.datastore.loadJson(USERS_LIST_FILE);
const userErrors = validateUser()([...users, user], user);
if (userErrors.length > 0) { throw new BadRequestError(`User is invalid. ${fp_41('; ')(userErrors)}`); }
const { auth, tempCode, temporaryAccessId } = await getAccess(
app, password,
);
user.tempCode = tempCode;
user.temporaryAccessId = temporaryAccessId;
if (fp_6(u => insensitiveEquals(u.name, user.name))(users)) {
throw new BadRequestError('User already exists');
}
users.push(
stripUserOfSensitiveStuff(user),
);
await app.datastore.updateJson(
USERS_LIST_FILE,
users,
);
try {
await app.datastore.createJson(
userAuthFile(user.name),
auth,
);
} catch (_) {
await app.datastore.updateJson(
userAuthFile(user.name),
auth,
);
}
await releaseLock(app, lock);
return user;
};
const getAccess = async (app, password) => {
const auth = getNewUserAuth(app)();
if (isNonEmptyString(password)) {
if (isValidPassword(password)) {
auth.passwordHash = await app.crypto.hash(password);
auth.temporaryAccessHash = '';
auth.temporaryAccessId = '';
auth.temporaryAccessExpiryEpoch = 0;
return { auth };
}
throw new BadRequestError('Password does not meet requirements');
} else {
const tempAccess = await getTemporaryCode(app);
auth.temporaryAccessHash = tempAccess.temporaryAccessHash;
auth.temporaryAccessExpiryEpoch = tempAccess.temporaryAccessExpiryEpoch;
auth.passwordHash = '';
return ({
auth,
tempCode: tempAccess.tempCode,
temporaryAccessId: tempAccess.temporaryAccessId,
});
}
};
const enableUser = app => async username => apiWrapper(
app,
events.authApi.enableUser,
permission.enableDisableUser.isAuthorized,
{ username },
_enableUser, app, username,
);
const disableUser = app => async username => apiWrapper(
app,
events.authApi.disableUser,
permission.enableDisableUser.isAuthorized,
{ username },
_disableUser, app, username,
);
const _enableUser = async (app, username) => await toggleUser(app, username, true);
const _disableUser = async (app, username) => await toggleUser(app, username, false);
const toggleUser = async (app, username, enabled) => {
const lock = await getLock(app, USERS_LOCK_FILE, 1000, 1, 0);
const actionName = enabled ? 'enable' : 'disable';
if (isNolock(lock)) { throw new Error(`Could not ${actionName} user - cannot get lock`); }
try {
const users = await app.datastore.loadJson(USERS_LIST_FILE);
const user = getUserByName(users, username);
if (!user) { throw new NotFoundError(`Could not find user to ${actionName}`); }
if (user.enabled === !enabled) {
user.enabled = enabled;
await app.datastore.updateJson(USERS_LIST_FILE, users);
}
} finally {
releaseLock(app, lock);
}
};
const getNewAccessLevel = () => () => ({
name: '',
permissions: [],
default:false
});
const isAllowedType = t => $(permissionTypes, [
fp_29,
fp_11(t),
]);
const isRecordOrIndexType = t => fp_6(p => p === t)([
permissionTypes.CREATE_RECORD,
permissionTypes.UPDATE_RECORD,
permissionTypes.DELETE_RECORD,
permissionTypes.READ_RECORD,
permissionTypes.READ_INDEX,
permissionTypes.EXECUTE_ACTION,
]);
const permissionRules = app => ([
makerule('type', 'type must be one of allowed types',
p => isAllowedType(p.type)),
makerule('nodeKey', 'record and index permissions must include a valid nodeKey',
p => (!isRecordOrIndexType(p.type))
|| isSomething(getNode(app.hierarchy, p.nodeKey))),
]);
const applyPermissionRules = app => applyRuleSet(permissionRules(app));
const accessLevelRules = allLevels => ([
makerule('name', 'name must be set',
l => isNonEmptyString(l.name)),
makerule('name', 'access level names must be unique',
l => fp_9(l.name)
|| fp_8(a => insensitiveEquals(l.name, a.name))(allLevels).length === 1),
]);
const applyLevelRules = allLevels => applyRuleSet(accessLevelRules(allLevels));
const validateAccessLevel = app => (allLevels, level) => {
const errs = $(level.permissions, [
fp_7(applyPermissionRules(app)),
fp_38,
fp_34(
applyLevelRules(allLevels)(level),
),
]);
return errs;
};
const validateAccessLevels = app => allLevels => apiWrapperSync(
app,
events.authApi.validateAccessLevels,
alwaysAuthorized,
{ allLevels },
_validateAccessLevels, app, allLevels,
);
const _validateAccessLevels = (app, allLevels) => $(allLevels, [
fp_7(l => validateAccessLevel(app)(allLevels, l)),
fp_38,
fp_45((x, y) => x.field === y.field
&& x.item === y.item
&& x.error === y.error),
]);
const saveAccessLevels = app => async accessLevels => apiWrapper(
app,
events.authApi.saveAccessLevels,
permission.writeAccessLevels.isAuthorized,
{ accessLevels },
_saveAccessLevels, app, accessLevels,
);
const _saveAccessLevels = async (app, accessLevels) => {
const validationErrors = validateAccessLevels(app)(accessLevels.levels);
if (validationErrors.length > 0) {
const errs = $(validationErrors, [
fp_7(e => e.error),
fp_41(', '),
]);
throw new Error(
`Access Levels Invalid: ${errs}`,
);
}
const lock = await getLock(
app, ACCESS_LEVELS_LOCK_FILE, 2000, 2,
);
if (isNolock(lock)) { throw new Error('Could not get lock to save access levels'); }
try {
const existing = await app.datastore.loadJson(ACCESS_LEVELS_FILE);
if (existing.version !== accessLevels.version) { throw new Error('Access levels have already been updated, since you loaded'); }
accessLevels.version++;
app.datastore.updateJson(ACCESS_LEVELS_FILE, accessLevels);
} finally {
await releaseLock(app, lock);
}
};
const generateFullPermissions = (app) => {
const allNodes = getFlattenedHierarchy(app.hierarchy);
const accessLevel = { permissions: [] };
const recordNodes = $(allNodes, [
fp_8(isRecord),
]);
for (const n of recordNodes) {
permission.createRecord.add(n.nodeKey(), accessLevel);
permission.updateRecord.add(n.nodeKey(), accessLevel);
permission.deleteRecord.add(n.nodeKey(), accessLevel);
permission.readRecord.add(n.nodeKey(), accessLevel);
}
const indexNodes = $(allNodes, [
fp_8(isIndex),
]);
for (const n of indexNodes) {
permission.readIndex.add(n.nodeKey(), accessLevel);
}
for (const a of fp_32(app.actions)) {
permission.executeAction.add(a, accessLevel);
}
$(permission, [
fp_29,
fp_8(p => !p.isNode),
fp_39(p => p.add(accessLevel)),
]);
return accessLevel.permissions;
};
const setUserAccessLevels$1 = app => async (userName, accessLevels) => apiWrapper(
app,
events.authApi.setUserAccessLevels,
permission.setUserAccessLevels.isAuthorized,
{ userName, accessLevels },
_setUserAccessLevels, app, userName, accessLevels,
);
const _setUserAccessLevels = async (app, username, accessLevels) => {
const lock = await getLock(app, USERS_LOCK_FILE, 1000, 1, 0);
const actualAccessLevels = $(
await app.datastore.loadJson(ACCESS_LEVELS_FILE),
[
l => l.levels,
fp_7(l => l.name),
],
);
const missing = fp_36(accessLevels)(actualAccessLevels);
if (missing.length > 0) {
throw new Error(`Invalid access levels supplied: ${fp_41(', ', missing)}`);
}
if (isNolock(lock)) { throw new Error('Could set user access levels cannot get lock'); }
try {
const users = await app.datastore.loadJson(USERS_LIST_FILE);
const user = getUserByName(users, username);
if (!user) { throw new NotFoundError(`Could not find user with ${username}`); }
user.accessLevels = accessLevels;
await app.datastore.updateJson(USERS_LIST_FILE, users);
} finally {
releaseLock(app, lock);
}
};
const getAuthApi = app => ({
authenticate: authenticate(app),
authenticateTemporaryAccess: authenticateTemporaryAccess(app),
createTemporaryAccess: createTemporaryAccess$1(app),
createUser: createUser$1(app),
loadAccessLevels: loadAccessLevels(app),
enableUser: enableUser(app),
disableUser: disableUser(app),
getNewAccessLevel: getNewAccessLevel(),
getNewUser: getNewUser(app),
getNewUserAuth: getNewUserAuth(app),
getUsers: getUsers(app),
saveAccessLevels: saveAccessLevels(app),
isAuthorized: isAuthorized(app),
changeMyPassword: changeMyPassword(app),
setPasswordFromTemporaryCode: setPasswordFromTemporaryCode(app),
scorePassword,
isValidPassword: isValidPassword(app),
validateUser: validateUser(),
validateAccessLevels: validateAccessLevels(app),
generateFullPermissions: () => generateFullPermissions(app),
setUserAccessLevels: setUserAccessLevels$1(app),
});
const userWithFullAccess = (app) => {
app.user = {
name: "app",
permissions : generateFullPermissions(app),
isUser:false,
temp:false
};
return app.user;
};
const pipe$1 = common$1.$;
const events$1 = common$1.eventsList;
const getNode$1 = (hierarchy, nodeId) =>
pipe$1(hierarchy, [
hierarchyFunctions.getFlattenedHierarchy,
fp_13(n => n.nodeId === nodeId || n.nodeKey() === nodeId)
]);
const constructHierarchy$1 = node => {
if(!node) return node;
return templateApi(node).constructHierarchy(node);
};
const templateApi = hierarchy => getTemplateApi({hierarchy});
const authApi = (hierarchy, actions) => getAuthApi({
hierarchy, actions: fp_30("name")(actions), publish:()=>{}});
const allTypes$1 = templateApi({}).allTypes;
const validate$1 = {
all: templateApi({}).validateAll,
node: templateApi({}).validateNode,
field: templateApi({}).validateField
};
const getPotentialReverseReferenceIndexes = (hierarchy, refIndex) => {
const res = pipe$1(hierarchy, [
hierarchyFunctions.getFlattenedHierarchy,
fp_8(n => hierarchyFunctions.isAncestor(refIndex)(n)
|| hierarchyFunctions.isAncestor(refIndex)(n.parent())),
fp_7(n => n.indexes),
fp_38,
fp_8(hierarchyFunctions.isReferenceIndex)
]);
return res;
};
const getPotentialReferenceIndexes = (hierarchy, record) =>
pipe$1(hierarchy, [
hierarchyFunctions.getFlattenedHierarchy,
fp_8(hierarchyFunctions.isAncestorIndex),
fp_8(i => hierarchyFunctions.isAncestor(record)(i.parent())
|| i.parent().nodeId === record.parent().nodeId
|| hierarchyFunctions.isRoot(i.parent()))
]);
const getDefaultTypeOptions = type =>
!type ? {} : allTypes$1[type].getDefaultOptions();
const getNewAction = () => templateApi({}).createAction();
const getNewTrigger = () => templateApi({}).createTrigger();
const validateActions$1 = actions => templateApi({}).validateActions(actions);
const validateTriggers$1 = (triggers, actions) => templateApi({}).validateTriggers(triggers, actions);
const generateFullPermissions$1 = (hierarchy, actions) =>
authApi(hierarchy,actions).generateFullPermissions();
const getNewAccessLevel$1 = () =>
authApi().getNewAccessLevel();
const validateAccessLevels$1 = (hierarchy, actions, accessLevels) =>
authApi(hierarchy, actions).validateAccessLevels(accessLevels);
const getIndexNodes = (hierarchy) =>
pipe$1(hierarchy, [
hierarchyFunctions.getFlattenedHierarchy,
fp_8(hierarchyFunctions.isIndex)
]);
const getRecordNodes = (hierarchy) =>
pipe$1(hierarchy, [
hierarchyFunctions.getFlattenedHierarchy,
fp_8(hierarchyFunctions.isRecord)
]);
const getIndexSchema = hierarchy => index =>
generateSchema(hierarchy, index);
const subscriber_queue = [];
/**
* 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) {
let stop;
const subscribers = [];
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 (let i = 0; i < subscribers.length; i += 1) {
const s = subscribers[i];
s[1]();
subscriber_queue.push(s, 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) {
const subscriber = [run, invalidate];
subscribers.push(subscriber);
if (subscribers.length === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
const index = subscribers.indexOf(subscriber);
if (index !== -1) {
subscribers.splice(index, 1);
}
if (subscribers.length === 0) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
const defaultPagesObject = () => ({
main: {
index: {
_component : "./components/indexHtml"
},
appBody: "bbapp.main.json"
},
unauthenticated: {
index: {
_component : "./components/indexHtml"
},
appBody: "bbapp.unauthenticated.json"
},
componentLibraries: [],
stylesheets: []
});
const BB_STATE_BINDINGPATH = "##bbstate";
const BB_STATE_BINDINGSOURCE = "##bbsource";
const BB_STATE_FALLBACK = "##bbstatefallback";
const isBound = (prop) =>
prop !== undefined
&& prop[BB_STATE_BINDINGPATH] !== undefined;
const setState = (store, path, value) => {
if(!path || path.length === 0) return;
const pathParts = path.split(".");
const safeSetPath = (obj, currentPartIndex=0) => {
const currentKey = pathParts[currentPartIndex];
if(pathParts.length - 1 == currentPartIndex) {
obj[currentKey] = value;
return;
}
if(obj[currentKey] === null
|| obj[currentKey] === undefined
|| !fp_27(obj[currentKey])) {
obj[currentKey] = {};
}
safeSetPath(obj[currentKey], currentPartIndex + 1);
};
store.update(s => {
safeSetPath(s);
return s;
});
};
const getState = (s, path, fallback) => {
if(!s) return fallback;
if(!path || path.length === 0) return fallback;
if(path === "$") return s;
const pathParts = path.split(".");
const safeGetPath = (obj, currentPartIndex=0) => {
const currentKey = pathParts[currentPartIndex];
if(pathParts.length - 1 == currentPartIndex) {
const value = obj[currentKey];
if(fp_3(value))
return fallback;
else
return value;
}
if(obj[currentKey] === null
|| obj[currentKey] === undefined
|| !fp_27(obj[currentKey])) {
return fallback;
}
return safeGetPath(obj[currentKey], currentPartIndex + 1);
};
return safeGetPath(s);
};
const ERROR = "##error_message";
const trimSlash = (str) => str.replace(/^\/+|\/+$/g, '');
const loadRecord = (api) => async ({recordKey, statePath}) => {
if(!recordKey) {
api.error("Load Record: record key not set");
return;
}
if(!statePath) {
api.error("Load Record: state path not set");
return;
}
const record = await api.get({
url:`/api/record/${trimSlash(recordKey)}`
});
if(api.isSuccess(record))
api.setState(statePath, record);
};
const listRecords = api => async ({indexKey, statePath}) => {
if(!indexKey) {
api.error("Load Record: record key not set");
return;
}
if(!statePath) {
api.error("Load Record: state path not set");
return;
}
const records = await api.get({
url:`/api/listRecords/${trimSlash(indexKey)}`
});
if(api.isSuccess(records))
api.setState(statePath, records);
};
const USER_STATE_PATH = "_bbuser";
const authenticate$1 = (api) => async ({username, password}) => {
if(!username) {
api.error("Authenticate: username not set");
return;
}
if(!password) {
api.error("Authenticate: password not set");
return;
}
const user = await api.post({
url:"/api/authenticate",
body : {username, password}
});
// set user even if error - so it is defined at least
api.setState(USER_STATE_PATH, user);
localStorage.setItem("budibase:user", JSON.stringify(user));
};
const saveRecord = (api) => async ({statePath}) => {
if(!statePath) {
api.error("Load Record: state path not set");
return;
}
const recordtoSave = api.getState(statePath);
if(!recordtoSave) {
api.error(`there is no record in state: ${statePath}`);
return;
}
if(!recordtoSave.key) {
api.error(`item in state does not appear to be a record - it has no key (${statePath})`);
return;
}
const savedRecord = await api.post({
url:`/api/record/${trimSlash(recordtoSave.key)}`,
body: recordtoSave
});
if(api.isSuccess(savedRecord))
api.setState(statePath, savedRecord);
};
const createApi = ({rootPath, setState, getState}) => {
const apiCall = (method) => ({url, body, notFound, badRequest, forbidden}) => {
return fetch(`${rootPath}${url}`, {
method: method,
headers: {
'Content-Type': 'application/json',
},
body: body && JSON.stringify(body),
credentials: "same-origin"
}).then(r => {
switch (r.status) {
case 200:
return r.json();
case 404:
return error(notFound || `${url} Not found`);
case 400:
return error(badRequest || `${url} Bad Request`);
case 403:
return error(forbidden || `${url} Forbidden`);
default:
if(r.status.toString().startsWith("2")
|| r.status.toString().startsWith("3"))
return r.json()
else
return error(`${url} - ${r.statusText}`);
}
});
};
const post = apiCall("POST");
const get = apiCall("GET");
const patch = apiCall("PATCH");
const del = apiCall("DELETE");
const ERROR_MEMBER = "##error";
const error = message => {
const e = {};
e[ERROR_MEMBER] = message;
setState(ERROR, message);
return e;
};
const isSuccess = obj => !obj || !obj[ERROR_MEMBER];
const apiOpts = {
rootPath, setState, getState, isSuccess, error,
post, get, patch, delete:del
};
return {
loadRecord:loadRecord(apiOpts),
listRecords: listRecords(apiOpts),
authenticate: authenticate$1(apiOpts),
saveRecord: saveRecord(apiOpts)
}
};
const getNewChildRecordToState = (coreApi, setState) =>
({recordKey, collectionName,childRecordType,statePath}) => {
const error = errorHandler(setState);
try {
if(!recordKey) {
error("getNewChild > recordKey not set");
return;
}
if(!collectionName) {
error("getNewChild > collectionName not set");
return;
}
if(!childRecordType) {
error("getNewChild > childRecordType not set");
return;
}
if(!statePath) {
error("getNewChild > statePath not set");
return;
}
const rec = coreApi.recordApi.getNewChild(recordKey, collectionName, childRecordType);
setState(statePath, rec);
}
catch(e) {
error(e.message);
}
};
const getNewRecordToState = (coreApi, setState) =>
({collectionKey,childRecordType,statePath}) => {
const error = errorHandler(setState);
try {
if(!collectionKey) {
error("getNewChild > collectionKey not set");
return;
}
if(!childRecordType) {
error("getNewChild > childRecordType not set");
return;
}
if(!statePath) {
error("getNewChild > statePath not set");
return;
}
const rec = coreApi.recordApi.getNew(collectionKey, childRecordType);
setState(statePath, rec);
}
catch(e) {
error(e.message);
}
};
const errorHandler = setState => message => setState(ERROR, message);
const EVENT_TYPE_MEMBER_NAME = "##eventHandlerType";
const eventHandlers = (store,coreApi,rootPath) => {
const handler = (parameters, execute) => ({
execute, parameters
});
const setStateWithStore = (path, value) => setState(store, path, value);
let currentState;
store.subscribe(s => {
currentState = s;
});
const api = createApi({
rootPath:rootPath,
setState: setStateWithStore,
getState: (path, fallback) => getState(currentState, path, fallback)
});
const setStateHandler = ({path, value}) => setState(store, path, value);
return {
"Set State": handler(["path", "value"], setStateHandler),
"Load Record": handler(["recordKey", "statePath"], api.loadRecord),
"List Records": handler(["indexKey", "statePath"], api.listRecords),
"Save Record": handler(["statePath"], api.saveRecord),
"Get New Child Record": handler(
["recordKey", "collectionName", "childRecordType", "statePath"],
getNewChildRecordToState(coreApi, setStateWithStore)),
"Get New Record": handler(
["collectionKey", "childRecordType", "statePath"],
getNewRecordToState(coreApi, setStateWithStore)),
"Authenticate": handler(["username", "password"], api.authenticate)
};
};
const createCoreApp = (appDefinition, user) => {
const app = {
datastore: null,
crypto:null,
publish: () => {},
hierarchy: appDefinition.hierarchy,
actions: appDefinition.actions,
user
};
return app;
};
const createCoreApi = (appDefinition, user) => {
const app = createCoreApp(appDefinition, user);
return {
recordApi: {
getNew: getNew(app),
getNewChild: getNewChild(app)
},
templateApi: {
constructHierarchy
}
}
};
const allHandlers$1 = (appDefinition, user) => {
const coreApi = createCoreApi(appDefinition, user);
appDefinition.hierarchy = coreApi.templateApi.constructHierarchy(appDefinition.hierarchy);
const store = writable({
_bbuser: user
});
const handlersObj = eventHandlers(store, coreApi);
const handlersArray = [];
for(let key in handlersObj) {
handlersArray.push({name:key, ...handlersObj[key]});
}
return handlersArray;
};
const defaultDef = typeName => () => ({
type: typeName,
required:false,
default:types[typeName].default(),
options: typeName === "options" ? [] : undefined,
elementDefinition: typeName === "array" ? {} : undefined
});
const propType = (defaultValue, isOfType, defaultDefinition) => ({
isOfType, default:defaultValue, defaultDefinition
});
const expandSingleProp = propDef => {
const p = fp_23(propDef)
? types[propDef].defaultDefinition()
: propDef;
if(!fp_23(propDef)) {
const def = types[propDef.type].defaultDefinition();
for(let p in def) {
if(propDef[p] === undefined) {
propDef[p] = def[p];
}
}
}
if(p.type === "array") {
p.elementDefinition = expandPropsDefinition(p.elementDefinition);
}
return p;
};
const expandPropsDefinition = propsDefinition => {
const expandedProps = {};
for(let p in propsDefinition) {
expandedProps[p] = expandSingleProp(propsDefinition[p]);
}
return expandedProps;
};
const isComponent = fp_57;
const isEvent = e =>
fp_60(e)
&& fp_23(e[EVENT_TYPE_MEMBER_NAME])
&& fp_60(e.parameters);
const isEventList = e =>
fp_26(e) && fp_44(isEvent)(e);
const emptyState = () => {
const s = {};
s[BB_STATE_BINDINGPATH] = "";
return s;
};
const types = {
string: propType(() => "", fp_23, defaultDef("string")),
bool: propType(() => false, fp_24, defaultDef("bool")),
number: propType(() => 0, fp_22, defaultDef("number")),
array: propType(() => [], fp_26, defaultDef("array")),
options: propType(() => "", fp_23, defaultDef("options")),
component: propType(() => ({_component:""}), isComponent, defaultDef("component")),
asset: propType(() => "", fp_23, defaultDef("asset")),
event: propType(() => [], isEventList, defaultDef("event")),
state: propType(() => emptyState(), isBound, defaultDef("state"))
};
const normalString = s => (s||"").trim().toLowerCase();
const isRootComponent = c => isComponent$1(c) && fp_3(c.inherits);
const isComponent$1 = c => {
const hasProp = (n) => !fp_3(c[n]);
return hasProp("name") && hasProp("props");
};
const getExactComponent = (allComponents, name) => {
const stringEquals = (s1, s2) =>
normalString(s1) === normalString(s2);
return pipe$1(allComponents,[
fp_13(c => stringEquals(c.name, name))
]);
};
const getInstanceProps = (componentInfo, props) => {
const finalProps = fp_4(componentInfo.fullProps);
for(let p in props) {
finalProps[p] = props[p];
}
return finalProps;
};
const getNewComponentInfo = (allComponents, inherits) => {
const parentcomponent = fp_13(c => c.name === inherits)(allComponents);
const component = {
name:"",
description:"",
inherits,
props:{},
tags:parentcomponent.tags
};
return getComponentInfo(
allComponents,
inherits,
[component],
{});
};
const getComponentInfo = (allComponents, comp, stack=[], subComponentProps=null) => {
const component = fp_23(comp)
? fp_13(c => c.name === comp)(allComponents)
: comp;
const cname = fp_23(comp) ? comp : comp.name;
if(isRootComponent(component)) {
subComponentProps = subComponentProps||{};
const p = createProps(cname, component.props, subComponentProps);
const rootProps = createProps(cname, component.props);
const inheritedProps = [];
const targetComponent = stack.length > 0
? fp_12(stack)
: component;
if(stack.length > 0) {
for(let prop in subComponentProps) {
const hasProp = pipe$1(targetComponent.props, [
fp_32,
fp_11(prop)]);
if(!hasProp)
inheritedProps.push(prop);
}
}
const unsetProps = pipe$1(p.props, [
fp_32,
fp_8(k => !fp_11(k)(fp_32(subComponentProps)) && k !== "_component")
]);
const fullProps = fp_4(p.props);
fullProps._component = targetComponent.name;
return ({
propsDefinition:expandPropsDefinition(component.props),
inheritedProps,
rootDefaultProps: rootProps.props,
unsetProps,
fullProps: fullProps,
errors: p.errors,
component: targetComponent,
rootComponent: component
});
}
return getComponentInfo(
allComponents,
component.inherits,
[component, ...stack],
{...component.props, ...subComponentProps});
};
const createProps = (componentName, propsDefinition, derivedFromProps) => {
const error = (propName, error) =>
errors.push({propName, error});
const props = {
_component: componentName
};
const errors = [];
if(!componentName)
error("_component", "Component name not supplied");
for(let propDef in propsDefinition) {
const parsedPropDef = parsePropDef(propsDefinition[propDef]);
if(parsedPropDef.error)
error(propDef, parsedPropDef.error);
else
props[propDef] = parsedPropDef;
}
if(derivedFromProps) {
lodash_13(props, derivedFromProps);
}
return ({
props, errors
});
};
const createArrayElementProps = (arrayPropName, elementDefinition) =>
createProps(
`#${arrayPropName}#array_element`,
elementDefinition);
const parsePropDef = propDef => {
const error = message => ({error:message, propDef});
if(fp_23(propDef)) {
if(!types[propDef])
return error(`Do not recognise type ${propDef}`);
return types[propDef].default();
}
if(!propDef.type)
return error("Property Definition must declare a type");
const type = types[propDef.type];
if(!type)
return error(`Do not recognise type ${propDef.type}`);
if(fp_3(propDef.default))
return type.default(propDef);
if(!type.isOfType(propDef.default))
return error(`${propDef.default} is not of type ${type}`);
return propDef.default;
};
/*
Allowed propDefOptions
- type: string, bool, number, array
- default: default value, when undefined
- required: field is required
*/
const buildPropsHierarchy = (allComponents, baseComponent) => {
const buildProps = (componentName, propsDefinition, derivedFromProps) => {
const {props} = createProps(componentName, propsDefinition, derivedFromProps);
props._component = componentName;
for(let propName in props) {
if(propName === "_component") continue;
const propDef = propsDefinition[propName];
if(!propDef) continue;
if(propDef.type === "component") {
const subComponentProps = props[propName];
if(!subComponentProps._component) continue;
const propComponentInfo = getComponentInfo(
allComponents, subComponentProps._component);
const subComponentInstanceProps = getInstanceProps(
propComponentInfo,
subComponentProps
);
props[propName] = buildProps(
propComponentInfo.rootComponent.name,
propComponentInfo.propsDefinition,
subComponentInstanceProps);
} else if(propDef.type === "array") {
const propsArray = props[propName];
const newPropsArray = [];
for(let element of propsArray) {
newPropsArray.push(
buildProps(
`${propName}#array_element#`,
propDef.elementDefinition,
element));
}
props[propName] = newPropsArray;
}
}
return props;
};
if(!baseComponent) return {};
const baseComponentInfo = getComponentInfo(allComponents, baseComponent);
return buildProps(
baseComponentInfo.rootComponent.name,
baseComponentInfo.propsDefinition,
baseComponentInfo.fullProps);
};
const apiCall = (method) => (url, body) =>
fetch(url, {
method: method,
headers: {
'Content-Type': 'application/json',
},
body: body && JSON.stringify(body),
});
const post = apiCall("POST");
const get$2 = apiCall("GET");
const patch = apiCall("PATCH");
const del = apiCall("DELETE");
var api$1 = {
post, get: get$2, patch, delete:del
};
const rename = (pages, allComponents, oldname, newname) => {
pages = fp_4(pages);
allComponents = fp_4(allComponents);
const changedComponents = [];
const existingWithNewName = getExactComponent(allComponents, newname);
if(existingWithNewName) return {
allComponents, pages, error: "Component by that name already exists"
};
const traverseProps = (props) => {
let hasEdited = false;
if(props._component && props._component === oldname) {
props._component = newname;
hasEdited = true;
}
for(let propName in props) {
const prop = props[propName];
if(fp_60(prop) && prop._component) {
hasEdited = traverseProps(prop) || hasEdited;
}
if(fp_26(prop)) {
for(let element of prop) {
hasEdited = traverseProps(element) || hasEdited;
}
}
}
return hasEdited;
};
for(let component of allComponents) {
if(isRootComponent(component)) {
continue;
}
let hasEdited = false;
if(component.name === oldname) {
component.name = newname;
hasEdited = true;
}
if(component.inherits === oldname) {
component.inherits = newname;
hasEdited = true;
}
hasEdited = traverseProps(component.props) || hasEdited;
if(hasEdited && component.name !== newname)
changedComponents.push(component.name);
}
for(let pageName in pages) {
const page = pages[pageName];
if(page.appBody === oldname) {
page.appBody = newname;
}
}
return {allComponents, pages, changedComponents};
};
const loadLibs = async (appName, appPackage) => {
const allLibraries = {};
for(let lib of appPackage.pages.componentLibraries) {
const libModule = await import(makeLibraryUrl(appName, lib));
allLibraries[lib] = libModule;
}
return allLibraries;
};
const loadGeneratorLibs = async (appName, appPackage) => {
const allGeneratorLibs = {};
for(let lib of appPackage.pages.componentLibraries) {
const generatorModule = await import(makeGeneratorLibraryUrl(appName, lib));
allGeneratorLibs[lib] = generatorModule;
}
return allGeneratorLibs;
};
const loadLibUrls = (appName, appPackage) => {
const allLibraries = [];
for(let lib of appPackage.pages.componentLibraries) {
const libUrl = makeLibraryUrl(appName, lib);
allLibraries.push({libName:lib, importPath:libUrl});
}
return allLibraries;
};
const makeLibraryUrl = (appName, lib) =>
`/_builder/${appName}/componentlibrary?lib=${encodeURI(lib)}`;
const makeGeneratorLibraryUrl = (appName, lib) =>
`/_builder/${appName}/componentlibraryGenerators?lib=${encodeURI(lib)}`;
let appname = "";
const getStore = () => {
const initial = {
apps:[],
appname:"",
hierarchy: {},
actions: [],
triggers: [],
pages:defaultPagesObject(),
mainUi:{},
unauthenticatedUi:{},
allComponents:[],
currentFrontEndItem:null,
currentComponentInfo:null,
currentComponentIsNew:false,
currentFrontEndType:"none",
currentPageName: "",
currentNodeIsNew: false,
errors: [],
activeNav: "database",
isBackend:true,
hasAppPackage: false,
accessLevels: {version:0, levels:[]},
currentNode: null,
libraries:null,
showSettings:false,
useAnalytics:true,
};
const store = writable(initial);
store.initialise = initialise(store, initial);
store.newChildRecord = newRecord(store, false);
store.newRootRecord = newRecord(store, true);
store.selectExistingNode = selectExistingNode(store);
store.newChildIndex = newIndex(store, false);
store.newRootIndex = newIndex(store, true);
store.saveCurrentNode = saveCurrentNode(store);
store.importAppDefinition = importAppDefinition(store);
store.deleteCurrentNode = deleteCurrentNode(store);
store.saveField = saveField(store);
store.deleteField = deleteField(store);
store.saveAction = saveAction(store);
store.deleteAction = deleteAction(store);
store.saveTrigger = saveTrigger(store);
store.deleteTrigger = deleteTrigger(store);
store.saveLevel = saveLevel(store);
store.deleteLevel = deleteLevel(store);
store.setActiveNav = setActiveNav(store);
store.saveDerivedComponent = saveDerivedComponent(store);
store.refreshComponents = refreshComponents(store);
store.addComponentLibrary = addComponentLibrary(store);
store.renameDerivedComponent = renameDerivedComponent(store);
store.deleteDerivedComponent = deleteDerivedComponent(store);
store.setCurrentComponent = setCurrentComponent(store);
store.setCurrentPage = setCurrentPage(store);
store.createDerivedComponent = createDerivedComponent(store);
store.removeComponentLibrary =removeComponentLibrary(store);
store.addStylesheet = addStylesheet(store);
store.removeStylesheet = removeStylesheet(store);
store.savePage = savePage(store);
store.showFrontend = showFrontend(store);
store.showBackend = showBackend(store);
store.showSettings = showSettings(store);
store.useAnalytics = useAnalytics(store);
store.createGeneratedComponents = createGeneratedComponents(store);
return store;
};
const initialise = (store, initial) => async () => {
appname = window.location.hash
? fp_12(window.location.hash.substr(1).split("/"))
: "";
if(!appname) {
initial.apps = await api$1.get(`/_builder/api/apps`).then(r => r.json());
initial.hasAppPackage = false;
store.set(initial);
return initial;
}
const pkg = await api$1.get(`/_builder/api/${appname}/appPackage`)
.then(r => r.json());
initial.libraries = await loadLibs(appname, pkg);
initial.generatorLibraries = await loadGeneratorLibs(appname, pkg);
initial.loadLibraryUrls = () => loadLibUrls(appname, pkg);
initial.appname = appname;
initial.pages = pkg.pages;
initial.hasAppPackage = true;
initial.hierarchy = pkg.appDefinition.hierarchy;
initial.accessLevels = pkg.accessLevels;
initial.derivedComponents = fp_29(pkg.derivedComponents);
initial.generators = generatorsArray(pkg.rootComponents.generators);
initial.allComponents = combineComponents(
pkg.derivedComponents, pkg.rootComponents.components);
initial.actions = fp_29(pkg.appDefinition.actions);
initial.triggers = pkg.appDefinition.triggers;
if(!!initial.hierarchy && !fp_9(initial.hierarchy)) {
initial.hierarchy = constructHierarchy$1(initial.hierarchy);
const shadowHierarchy = createShadowHierarchy(initial.hierarchy);
if(initial.currentNode !== null)
initial.currentNode = getNode$1(
shadowHierarchy, initial.currentNode.nodeId
);
}
store.set(initial);
return initial;
};
const generatorsArray = generators =>
pipe$1(generators, [
fp_32,
fp_8(k => k !== "_lib"),
fp_7(k => generators[k])
]);
const showSettings = store => show => {
store.update(s => {
s.showSettings = !s.showSettings;
return s;
});
};
const useAnalytics = store => useAnalytics => {
store.update(s => {
s.useAnalytics = !s.useAnalytics;
return s;
});
};
const showBackend = store => () => {
store.update(s => {
s.isBackend = true;
return s;
});
};
const showFrontend = store => () => {
store.update(s => {
s.isBackend = false;
return s;
});
};
const combineComponents = (root, derived) => {
const all = [];
for(let r in root) {
all.push(root[r]);
}
for(let d in derived) {
all.push(derived[d]);
}
return all;
};
const newRecord = (store, useRoot) => () => {
store.update(s => {
s.currentNodeIsNew = true;
const shadowHierarchy = createShadowHierarchy(s.hierarchy);
parent = useRoot ? shadowHierarchy
: getNode$1(
shadowHierarchy,
s.currentNode.nodeId);
s.errors = [];
s.currentNode = templateApi(shadowHierarchy)
.getNewRecordTemplate(parent, "", true);
return s;
});
};
const selectExistingNode = (store) => (nodeId) => {
store.update(s => {
const shadowHierarchy = createShadowHierarchy(s.hierarchy);
s.currentNode = getNode$1(
shadowHierarchy, nodeId
);
s.currentNodeIsNew = false;
s.errors = [];
s.activeNav = "database";
return s;
});
};
const newIndex = (store, useRoot) => () => {
store.update(s => {
s.currentNodeIsNew = true;
s.errors = [];
const shadowHierarchy = createShadowHierarchy(s.hierarchy);
parent = useRoot ? shadowHierarchy
: getNode$1(
shadowHierarchy,
s.currentNode.nodeId);
s.currentNode = templateApi(shadowHierarchy)
.getNewIndexTemplate(parent);
return s;
});
};
const saveCurrentNode = (store) => () => {
store.update(s => {
const errors = validate$1.node(s.currentNode);
s.errors = errors;
if(errors.length > 0) {
return s;
}
const parentNode = getNode$1(
s.hierarchy, s.currentNode.parent().nodeId);
const existingNode = getNode$1(
s.hierarchy, s.currentNode.nodeId);
let index = parentNode.children.length;
if(!!existingNode) {
// remove existing
index = existingNode.parent().children.indexOf(existingNode);
existingNode.parent().children = pipe$1(existingNode.parent().children, [
fp_8(c => c.nodeId !== existingNode.nodeId)
]);
}
// should add node into existing hierarchy
const cloned = fp_4(s.currentNode);
templateApi(s.hierarchy).constructNode(
parentNode,
cloned
);
const newIndexOfchild = child => {
if(child === cloned) return index;
const currentIndex = parentNode.children.indexOf(child);
return currentIndex >= index ? currentIndex + 1 : currentIndex;
};
parentNode.children = pipe$1(parentNode.children, [
fp_52(newIndexOfchild)
]);
s.currentNodeIsNew = false;
savePackage(store, s);
return s;
});
};
const importAppDefinition = store => appDefinition => {
store.update(s => {
s.hierarchy = appDefinition.hierarchy;
s.currentNode = appDefinition.hierarchy.children.length > 0
? appDefinition.hierarchy.children[0]
: null;
s.actions = appDefinition.actions;
s.triggers = appDefinition.triggers;
s.currentNodeIsNew = false;
return s;
});
};
const deleteCurrentNode = store => () => {
store.update(s => {
const nodeToDelete = getNode$1(s.hierarchy, s.currentNode.nodeId);
s.currentNode = hierarchyFunctions.isRoot(nodeToDelete.parent())
? fp_13(n => n != s.currentNode)
(s.hierarchy.children)
: nodeToDelete.parent();
if(hierarchyFunctions.isRecord(nodeToDelete)) {
nodeToDelete.parent().children = fp_8(c => c.nodeId !== nodeToDelete.nodeId)
(nodeToDelete.parent().children);
} else {
nodeToDelete.parent().indexes = fp_8(c => c.nodeId !== nodeToDelete.nodeId)
(nodeToDelete.parent().indexes);
}
s.errors = [];
savePackage(store, s);
return s;
});
};
const saveField = databaseStore => (field) => {
databaseStore.update(db => {
db.currentNode.fields = fp_8(f => f.name !== field.name)
(db.currentNode.fields);
templateApi(db.hierarchy).addField(db.currentNode, field);
return db;
});
};
const deleteField = databaseStore => field => {
databaseStore.update(db => {
db.currentNode.fields = fp_8(f => f.name !== field.name)
(db.currentNode.fields);
return db;
});
};
const saveAction = store => (newAction, isNew, oldAction=null) => {
store.update(s => {
const existingAction = isNew
? null
: fp_13(a => a.name === oldAction.name)(s.actions);
if(existingAction) {
s.actions = pipe$1(s.actions, [
fp_7(a => a === existingAction ? newAction : a)
]);
} else {
s.actions.push(newAction);
}
savePackage(store, s);
return s;
});
};
const deleteAction = store => action => {
store.update(s => {
s.actions = fp_8(a => a.name !== action.name)(s.actions);
savePackage(store, s);
return s;
});
};
const saveTrigger = store => (newTrigger, isNew, oldTrigger=null) => {
store.update(s => {
const existingTrigger = isNew
? null
: fp_13(a => a.name === oldTrigger.name)(s.triggers);
if(existingTrigger) {
s.triggers = pipe$1(s.triggers, [
fp_7(a => a === existingTrigger ? newTrigger : a)
]);
} else {
s.triggers.push(newTrigger);
}
savePackage(store, s);
return s;
});
};
const deleteTrigger = store => trigger => {
store.update(s => {
s.triggers = fp_8(t => t.name !== trigger.name)(s.triggers);
return s;
});
};
const incrementAccessLevelsVersion = (s) =>
s.accessLevels.version = (s.accessLevels.version || 0) + 1;
const saveLevel = store => (newLevel, isNew, oldLevel=null) => {
store.update(s => {
const levels = s.accessLevels.levels;
const existingLevel = isNew
? null
: fp_13(a => a.name === oldLevel.name)(levels);
if(existingLevel) {
s.accessLevels.levels = pipe$1(levels, [
fp_7(a => a === existingLevel ? newLevel : a)
]);
} else {
s.accessLevels.levels.push(newLevel);
}
incrementAccessLevelsVersion(s);
savePackage(store, s);
return s;
});
};
const deleteLevel = store => level => {
store.update(s => {
s.accessLevels.levels = fp_8(t => t.name !== level.name)(s.accessLevels.levels);
incrementAccessLevelsVersion(s);
savePackage(store, s);
return s;
});
};
const setActiveNav = store => navName => {
store.update(s => {
s.activeNav = navName;
return s;
});
};
const createShadowHierarchy = hierarchy =>
constructHierarchy$1(JSON.parse(JSON.stringify(hierarchy)));
const saveDerivedComponent = store => (derivedComponent) => {
store.update(s => {
const components = pipe$1(s.allComponents, [
fp_8(c => c.name !== derivedComponent.name),
fp_34([derivedComponent])
]);
const derivedComponents = pipe$1(s.derivedComponents, [
fp_8(c => c.name !== derivedComponent.name),
fp_34([derivedComponent])
]);
s.allComponents = components;
s.derivedComponents = derivedComponents;
s.currentFrontEndItem = derivedComponent;
s.currentComponentInfo = getComponentInfo(
s.allComponents, derivedComponent.name);
s.currentComponentIsNew = false;
api$1.post(`/_builder/api/${s.appname}/derivedcomponent`, derivedComponent)
.then(() => savePackage(store, s));
return s;
});
};
const createDerivedComponent = store => componentName => {
store.update(s => {
const newComponentInfo = getNewComponentInfo(
s.allComponents, componentName);
s.currentFrontEndItem = newComponentInfo.component;
s.currentComponentInfo = newComponentInfo;
s.currentFrontEndType = "component";
s.currentComponentIsNew = true;
return s;
});
};
const createGeneratedComponents = store => components => {
store.update(s => {
s.allComponents = [...s.allComponents, ...components];
s.derivedComponents = [...s.derivedComponents, ...components];
const doCreate = async () => {
for(let c of components) {
await api$1.post(`/_builder/api/${s.appname}/derivedcomponent`, c);
}
await savePackage(store, s);
};
doCreate();
return s;
});
};
const deleteDerivedComponent = store => name => {
store.update(s => {
const allComponents = pipe$1(s.allComponents, [
fp_8(c => c.name !== name)
]);
const derivedComponents = pipe$1(s.derivedComponents, [
fp_8(c => c.name !== name)
]);
s.allComponents = allComponents;
s.derivedComponents = derivedComponents;
if(s.currentFrontEndItem.name === name) {
s.currentFrontEndItem = null;
s.currentFrontEndType = "";
}
api$1.delete(`/_builder/api/${s.appname}/derivedcomponent/${name}`);
return s;
});
};
const renameDerivedComponent = store => (oldname, newname) => {
store.update(s => {
const {
allComponents, pages, error, changedComponents
} = rename(s.pages, s.allComponents, oldname, newname);
if(error) {
// should really do something with this
return s;
}
s.allComponents = allComponents;
s.pages = pages;
if(s.currentFrontEndItem.name === oldname)
s.currentFrontEndItem.name = newname;
const saveAllChanged = async () => {
for(let cname of changedComponents) {
const changedComponent = getExactComponent(allComponents, cname);
await api$1.post(`/_builder/api/${s.appname}/derivedcomponent`, changedComponent);
}
};
api$1.patch(`/_builder/api/${s.appname}/derivedcomponent`, {
oldname, newname
})
.then(() => saveAllChanged())
.then(() => {
savePackage(store, s);
});
return s;
});
};
const savePage = store => async page => {
store.update(s => {
if(s.currentFrontEndType !== "page" || !s.currentPageName) {
return s;
}
s.pages[s.currentPageName] = page;
savePackage(store, s);
return s;
});
};
const addComponentLibrary = store => async lib => {
const response =
await api$1.get(`/_builder/api/${appname}/componentlibrary?lib=${encodeURI(lib)}`,undefined, false);
const success = response.status === 200;
const error = response.status === 404
? `Could not find library ${lib}`
: success
? ""
: response.statusText;
const components = success
? await response.json()
: [];
store.update(s => {
if(success) {
const componentsArray = [];
for(let c in components) {
componentsArray.push(components[c]);
}
s.allComponents = pipe$1(s.allComponents, [
fp_8(c => !c.name.startsWith(`${lib}/`)),
fp_34(componentsArray)
]);
s.pages.componentLibraries.push(lib);
savePackage(store, s);
}
return s;
});
};
const removeComponentLibrary = store => lib => {
store.update(s => {
s.pages.componentLibraries = fp_8(l => l !== lib)(
s.pages.componentLibraries);
savePackage(store, s);
return s;
});
};
const addStylesheet = store => stylesheet => {
store.update(s => {
s.pages.stylesheets.push(stylesheet);
savePackage(store, s);
return s;
});
};
const removeStylesheet = store => stylesheet => {
store.update(s => {
s.pages.stylesheets = fp_8(s => s !== stylesheet)(s.pages.stylesheets);
savePackage(store, s);
return s;
});
};
const refreshComponents = store => async () => {
const components =
await api$1.get(`/_builder/api/${db.appname}/rootcomponents`).then(r => r.json());
const rootComponents = pipe$1(components.components, [
fp_32,
fp_7(k => ({...components[k], name:k}))
]);
store.update(s => {
s.allComponents = pipe$1(s.allComponents, [
fp_8(c => !isRootComponent(c)),
fp_34(rootComponents)
]);
s.generators = components.generators;
return s;
});
};
const savePackage = (store, s) => {
const appDefinition = {
hierarchy:s.hierarchy,
triggers:s.triggers,
actions: fp_30("name")(s.actions),
props: {
main: buildPropsHierarchy(s.allComponents, s.pages.main.appBody),
unauthenticated: buildPropsHierarchy(s.allComponents, s.pages.unauthenticated.appBody)
}
};
const data = {
appDefinition,
accessLevels:s.accessLevels,
pages:s.pages,
};
return api$1.post(`/_builder/api/${s.appname}/appPackage`, data);
};
const setCurrentComponent = store => componentName => {
store.update(s => {
const component = getExactComponent(s.allComponents, componentName);
s.currentFrontEndItem = component;
s.currentFrontEndType = "component";
s.currentComponentIsNew = false;
s.currentComponentInfo = getComponentInfo(s.allComponents, component.name);
return s;
});
};
const setCurrentPage = store => pageName => {
store.update(s => {
s.currentFrontEndType = "page";
s.currentPageName = pageName;
return s;
});
};
const store = getStore();
const initialise$1 = async () => {
try {
setupRouter(store);
await store.initialise();
} catch(err) {
console.log(err);
}
};
const setupRouter = (writable) => {
const pushState = history.pushState;
history.pushState = () => {
pushState.apply(history, arguments);
//fireEvents('pushState', arguments);
writable.initialise();
};
window.addEventListener('hashchange',()=>{
writable.initialise();
});
};
/* src\NoPackage.svelte generated by Svelte v3.12.1 */
const file$2 = "src\\NoPackage.svelte";
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.app = list[i];
return child_ctx;
}
// (17:16) {#each $store.apps as app}
function create_each_block(ctx) {
var a, t_value = ctx.app + "", t, a_href_value;
const block = {
c: function create() {
a = element("a");
t = text(t_value);
attr_dev(a, "href", a_href_value = `#/${ctx.app}`);
attr_dev(a, "class", "app-link svelte-e4n7zy");
add_location(a, file$2, 17, 16, 435);
},
m: function mount(target, anchor) {
insert_dev(target, a, anchor);
append_dev(a, t);
},
p: function update(changed, ctx) {
if ((changed.$store) && t_value !== (t_value = ctx.app + "")) {
set_data_dev(t, t_value);
}
if ((changed.$store) && a_href_value !== (a_href_value = `#/${ctx.app}`)) {
attr_dev(a, "href", a_href_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(a);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block.name, type: "each", source: "(17:16) {#each $store.apps as app}", ctx });
return block;
}
function create_fragment$1(ctx) {
var div3, div2, img, t0, div1, div0, h4, t2;
let each_value = ctx.$store.apps;
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 block = {
c: function create() {
div3 = element("div");
div2 = element("div");
img = element("img");
t0 = space();
div1 = element("div");
div0 = element("div");
h4 = element("h4");
h4.textContent = "Choose an Application";
t2 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(img, "src", "/_builder/assets/budibase-logo.png");
attr_dev(img, "class", "logo svelte-e4n7zy");
attr_dev(img, "alt", "budibase logo");
add_location(img, file$2, 11, 8, 175);
set_style(h4, "margin-bottom", "20px");
add_location(h4, file$2, 15, 16, 317);
add_location(div0, file$2, 14, 12, 295);
add_location(div1, file$2, 12, 8, 264);
attr_dev(div2, "class", "inner svelte-e4n7zy");
add_location(div2, file$2, 10, 4, 147);
attr_dev(div3, "class", "root svelte-e4n7zy");
add_location(div3, file$2, 9, 0, 124);
},
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, div3, anchor);
append_dev(div3, div2);
append_dev(div2, img);
append_dev(div2, t0);
append_dev(div2, div1);
append_dev(div1, div0);
append_dev(div0, h4);
append_dev(div0, t2);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div0, null);
}
},
p: function update(changed, ctx) {
if (changed.$store) {
each_value = ctx.$store.apps;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div0, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$1.name, type: "component", source: "", ctx });
return block;
}
function instance$1($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let errors = [];
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('errors' in $$props) errors = $$props.errors;
if ('$store' in $$props) store.set($store);
};
return { $store };
}
class NoPackage extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$1, create_fragment$1, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "NoPackage", options, id: create_fragment$1.name });
}
}
var feather = createCommonjsModule(function (module, exports) {
(function webpackUniversalModuleDefinition(root, factory) {
module.exports = factory();
})(typeof self !== 'undefined' ? self : commonjsGlobal, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./dist/icons.json":
/*!*************************!*\
!*** ./dist/icons.json ***!
\*************************/
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, aperture, archive, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, award, bar-chart-2, bar-chart, battery-charging, battery, bell-off, bell, bluetooth, bold, book-open, book, bookmark, box, briefcase, calendar, camera-off, camera, cast, check-circle, check-square, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, chrome, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-off, cloud-rain, cloud-snow, cloud, code, codepen, codesandbox, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, dollar-sign, download-cloud, download, droplet, edit-2, edit-3, edit, external-link, eye-off, eye, facebook, fast-forward, feather, figma, file-minus, file-plus, file-text, file, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, grid, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, info, instagram, italic, key, layers, layout, life-buoy, link-2, link, linkedin, list, loader, lock, log-in, log-out, mail, map-pin, map, maximize-2, maximize, meh, menu, message-circle, message-square, mic-off, mic, minimize-2, minimize, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation-2, navigation, octagon, package, paperclip, pause-circle, pause, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, pie-chart, play-circle, play, plus-circle, plus-square, plus, pocket, power, printer, radio, refresh-ccw, refresh-cw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, server, settings, share-2, share, shield-off, shield, shopping-bag, shopping-cart, shuffle, sidebar, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, square, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash-2, trash, trello, trending-down, trending-up, triangle, truck, tv, twitch, twitter, type, umbrella, underline, unlock, upload-cloud, upload, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume-1, volume-2, volume-x, volume, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */
/***/ (function(module) {
module.exports = {"activity":"<polyline points=\"22 12 18 12 15 21 9 3 6 12 2 12\"></polyline>","airplay":"<path d=\"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1\"></path><polygon points=\"12 15 17 21 7 21 12 15\"></polygon>","alert-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-octagon":"<polygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"></polygon><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-triangle":"<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"></path><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"></line><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"></line>","align-center":"<line x1=\"18\" y1=\"10\" x2=\"6\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"18\" y1=\"18\" x2=\"6\" y2=\"18\"></line>","align-justify":"<line x1=\"21\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-left":"<line x1=\"17\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"17\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-right":"<line x1=\"21\" y1=\"10\" x2=\"7\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"7\" y2=\"18\"></line>","anchor":"<circle cx=\"12\" cy=\"5\" r=\"3\"></circle><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"8\"></line><path d=\"M5 12H2a10 10 0 0 0 20 0h-3\"></path>","aperture":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"14.31\" y1=\"8\" x2=\"20.05\" y2=\"17.94\"></line><line x1=\"9.69\" y1=\"8\" x2=\"21.17\" y2=\"8\"></line><line x1=\"7.38\" y1=\"12\" x2=\"13.12\" y2=\"2.06\"></line><line x1=\"9.69\" y1=\"16\" x2=\"3.95\" y2=\"6.06\"></line><line x1=\"14.31\" y1=\"16\" x2=\"2.83\" y2=\"16\"></line><line x1=\"16.62\" y1=\"12\" x2=\"10.88\" y2=\"21.94\"></line>","archive":"<polyline points=\"21 8 21 21 3 21 3 8\"></polyline><rect x=\"1\" y=\"3\" width=\"22\" height=\"5\"></rect><line x1=\"10\" y1=\"12\" x2=\"14\" y2=\"12\"></line>","arrow-down-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"8 12 12 16 16 12\"></polyline><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line>","arrow-down-left":"<line x1=\"17\" y1=\"7\" x2=\"7\" y2=\"17\"></line><polyline points=\"17 17 7 17 7 7\"></polyline>","arrow-down-right":"<line x1=\"7\" y1=\"7\" x2=\"17\" y2=\"17\"></line><polyline points=\"17 7 17 17 7 17\"></polyline>","arrow-down":"<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><polyline points=\"19 12 12 19 5 12\"></polyline>","arrow-left-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 8 8 12 12 16\"></polyline><line x1=\"16\" y1=\"12\" x2=\"8\" y2=\"12\"></line>","arrow-left":"<line x1=\"19\" y1=\"12\" x2=\"5\" y2=\"12\"></line><polyline points=\"12 19 5 12 12 5\"></polyline>","arrow-right-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 16 16 12 12 8\"></polyline><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","arrow-right":"<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line><polyline points=\"12 5 19 12 12 19\"></polyline>","arrow-up-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"16 12 12 8 8 12\"></polyline><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"8\"></line>","arrow-up-left":"<line x1=\"17\" y1=\"17\" x2=\"7\" y2=\"7\"></line><polyline points=\"7 17 7 7 17 7\"></polyline>","arrow-up-right":"<line x1=\"7\" y1=\"17\" x2=\"17\" y2=\"7\"></line><polyline points=\"7 7 17 7 17 17\"></polyline>","arrow-up":"<line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"5\"></line><polyline points=\"5 12 12 5 19 12\"></polyline>","at-sign":"<circle cx=\"12\" cy=\"12\" r=\"4\"></circle><path d=\"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94\"></path>","award":"<circle cx=\"12\" cy=\"8\" r=\"7\"></circle><polyline points=\"8.21 13.89 7 23 12 20 17 23 15.79 13.88\"></polyline>","bar-chart-2":"<line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"10\"></line><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"4\"></line><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"14\"></line>","bar-chart":"<line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"10\"></line><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"4\"></line><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"16\"></line>","battery-charging":"<path d=\"M5 18H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3.19M15 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-3.19\"></path><line x1=\"23\" y1=\"13\" x2=\"23\" y2=\"11\"></line><polyline points=\"11 6 7 12 13 12 9 18\"></polyline>","battery":"<rect x=\"1\" y=\"6\" width=\"18\" height=\"12\" rx=\"2\" ry=\"2\"></rect><line x1=\"23\" y1=\"13\" x2=\"23\" y2=\"11\"></line>","bell-off":"<path d=\"M13.73 21a2 2 0 0 1-3.46 0\"></path><path d=\"M18.63 13A17.89 17.89 0 0 1 18 8\"></path><path d=\"M6.26 6.26A5.86 5.86 0 0 0 6 8c0 7-3 9-3 9h14\"></path><path d=\"M18 8a6 6 0 0 0-9.33-5\"></path><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","bell":"<path d=\"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9\"></path><path d=\"M13.73 21a2 2 0 0 1-3.46 0\"></path>","bluetooth":"<polyline points=\"6.5 6.5 17.5 17.5 12 23 12 1 17.5 6.5 6.5 17.5\"></polyline>","bold":"<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"></path><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"></path>","book-open":"<path d=\"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z\"></path><path d=\"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z\"></path>","book":"<path d=\"M4 19.5A2.5 2.5 0 0 1 6.5 17H20\"></path><path d=\"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z\"></path>","bookmark":"<path d=\"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z\"></path>","box":"<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"></path><polyline points=\"3.27 6.96 12 12.01 20.73 6.96\"></polyline><line x1=\"12\" y1=\"22.08\" x2=\"12\" y2=\"12\"></line>","briefcase":"<rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\" ry=\"2\"></rect><path d=\"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16\"></path>","calendar":"<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"></line><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"></line><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"></line>","camera-off":"<line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line><path d=\"M21 21H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3m3-3h6l2 3h4a2 2 0 0 1 2 2v9.34m-7.72-2.06a4 4 0 1 1-5.56-5.56\"></path>","camera":"<path d=\"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z\"></path><circle cx=\"12\" cy=\"13\" r=\"4\"></circle>","cast":"<path d=\"M2 16.1A5 5 0 0 1 5.9 20M2 12.05A9 9 0 0 1 9.95 20M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6\"></path><line x1=\"2\" y1=\"20\" x2=\"2.01\" y2=\"20\"></line>","check-circle":"<path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"></path><polyline points=\"22 4 12 14.01 9 11.01\"></polyline>","check-square":"<polyline points=\"9 11 12 14 22 4\"></polyline><path d=\"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11\"></path>","check":"<polyline points=\"20 6 9 17 4 12\"></polyline>","chevron-down":"<polyline points=\"6 9 12 15 18 9\"></polyline>","chevron-left":"<polyline points=\"15 18 9 12 15 6\"></polyline>","chevron-right":"<polyline points=\"9 18 15 12 9 6\"></polyline>","chevron-up":"<polyline points=\"18 15 12 9 6 15\"></polyline>","chevrons-down":"<polyline points=\"7 13 12 18 17 13\"></polyline><polyline points=\"7 6 12 11 17 6\"></polyline>","chevrons-left":"<polyline points=\"11 17 6 12 11 7\"></polyline><polyline points=\"18 17 13 12 18 7\"></polyline>","chevrons-right":"<polyline points=\"13 17 18 12 13 7\"></polyline><polyline points=\"6 17 11 12 6 7\"></polyline>","chevrons-up":"<polyline points=\"17 11 12 6 7 11\"></polyline><polyline points=\"17 18 12 13 7 18\"></polyline>","chrome":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><circle cx=\"12\" cy=\"12\" r=\"4\"></circle><line x1=\"21.17\" y1=\"8\" x2=\"12\" y2=\"8\"></line><line x1=\"3.95\" y1=\"6.06\" x2=\"8.54\" y2=\"14\"></line><line x1=\"10.88\" y1=\"21.94\" x2=\"15.46\" y2=\"14\"></line>","circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle>","clipboard":"<path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\"></path><rect x=\"8\" y=\"2\" width=\"8\" height=\"4\" rx=\"1\" ry=\"1\"></rect>","clock":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 6 12 12 16 14\"></polyline>","cloud-drizzle":"<line x1=\"8\" y1=\"19\" x2=\"8\" y2=\"21\"></line><line x1=\"8\" y1=\"13\" x2=\"8\" y2=\"15\"></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"21\"></line><line x1=\"16\" y1=\"13\" x2=\"16\" y2=\"15\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"></line><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"17\"></line><path d=\"M20 16.58A5 5 0 0 0 18 7h-1.26A8 8 0 1 0 4 15.25\"></path>","cloud-lightning":"<path d=\"M19 16.9A5 5 0 0 0 18 7h-1.26a8 8 0 1 0-11.62 9\"></path><polyline points=\"13 11 9 17 15 17 11 23\"></polyline>","cloud-off":"<path d=\"M22.61 16.95A5 5 0 0 0 18 10h-1.26a8 8 0 0 0-7.05-6M5 5a8 8 0 0 0 4 15h9a5 5 0 0 0 1.7-.3\"></path><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","cloud-rain":"<line x1=\"16\" y1=\"13\" x2=\"16\" y2=\"21\"></line><line x1=\"8\" y1=\"13\" x2=\"8\" y2=\"21\"></line><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"23\"></line><path d=\"M20 16.58A5 5 0 0 0 18 7h-1.26A8 8 0 1 0 4 15.25\"></path>","cloud-snow":"<path d=\"M20 17.58A5 5 0 0 0 18 8h-1.26A8 8 0 1 0 4 16.25\"></path><line x1=\"8\" y1=\"16\" x2=\"8.01\" y2=\"16\"></line><line x1=\"8\" y1=\"20\" x2=\"8.01\" y2=\"20\"></line><line x1=\"12\" y1=\"18\" x2=\"12.01\" y2=\"18\"></line><line x1=\"12\" y1=\"22\" x2=\"12.01\" y2=\"22\"></line><line x1=\"16\" y1=\"16\" x2=\"16.01\" y2=\"16\"></line><line x1=\"16\" y1=\"20\" x2=\"16.01\" y2=\"20\"></line>","cloud":"<path d=\"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z\"></path>","code":"<polyline points=\"16 18 22 12 16 6\"></polyline><polyline points=\"8 6 2 12 8 18\"></polyline>","codepen":"<polygon points=\"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2\"></polygon><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"15.5\"></line><polyline points=\"22 8.5 12 15.5 2 8.5\"></polyline><polyline points=\"2 15.5 12 8.5 22 15.5\"></polyline><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"8.5\"></line>","codesandbox":"<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"></path><polyline points=\"7.5 4.21 12 6.81 16.5 4.21\"></polyline><polyline points=\"7.5 19.79 7.5 14.6 3 12\"></polyline><polyline points=\"21 12 16.5 14.6 16.5 19.79\"></polyline><polyline points=\"3.27 6.96 12 12.01 20.73 6.96\"></polyline><line x1=\"12\" y1=\"22.08\" x2=\"12\" y2=\"12\"></line>","coffee":"<path d=\"M18 8h1a4 4 0 0 1 0 8h-1\"></path><path d=\"M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V8z\"></path><line x1=\"6\" y1=\"1\" x2=\"6\" y2=\"4\"></line><line x1=\"10\" y1=\"1\" x2=\"10\" y2=\"4\"></line><line x1=\"14\" y1=\"1\" x2=\"14\" y2=\"4\"></line>","columns":"<path d=\"M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18\"></path>","command":"<path d=\"M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z\"></path>","compass":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polygon points=\"16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76\"></polygon>","copy":"<rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path>","corner-down-left":"<polyline points=\"9 10 4 15 9 20\"></polyline><path d=\"M20 4v7a4 4 0 0 1-4 4H4\"></path>","corner-down-right":"<polyline points=\"15 10 20 15 15 20\"></polyline><path d=\"M4 4v7a4 4 0 0 0 4 4h12\"></path>","corner-left-down":"<polyline points=\"14 15 9 20 4 15\"></polyline><path d=\"M20 4h-7a4 4 0 0 0-4 4v12\"></path>","corner-left-up":"<polyline points=\"14 9 9 4 4 9\"></polyline><path d=\"M20 20h-7a4 4 0 0 1-4-4V4\"></path>","corner-right-down":"<polyline points=\"10 15 15 20 20 15\"></polyline><path d=\"M4 4h7a4 4 0 0 1 4 4v12\"></path>","corner-right-up":"<polyline points=\"10 9 15 4 20 9\"></polyline><path d=\"M4 20h7a4 4 0 0 0 4-4V4\"></path>","corner-up-left":"<polyline points=\"9 14 4 9 9 4\"></polyline><path d=\"M20 20v-7a4 4 0 0 0-4-4H4\"></path>","corner-up-right":"<polyline points=\"15 14 20 9 15 4\"></polyline><path d=\"M4 20v-7a4 4 0 0 1 4-4h12\"></path>","cpu":"<rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\" ry=\"2\"></rect><rect x=\"9\" y=\"9\" width=\"6\" height=\"6\"></rect><line x1=\"9\" y1=\"1\" x2=\"9\" y2=\"4\"></line><line x1=\"15\" y1=\"1\" x2=\"15\" y2=\"4\"></line><line x1=\"9\" y1=\"20\" x2=\"9\" y2=\"23\"></line><line x1=\"15\" y1=\"20\" x2=\"15\" y2=\"23\"></line><line x1=\"20\" y1=\"9\" x2=\"23\" y2=\"9\"></line><line x1=\"20\" y1=\"14\" x2=\"23\" y2=\"14\"></line><line x1=\"1\" y1=\"9\" x2=\"4\" y2=\"9\"></line><line x1=\"1\" y1=\"14\" x2=\"4\" y2=\"14\"></line>","credit-card":"<rect x=\"1\" y=\"4\" width=\"22\" height=\"16\" rx=\"2\" ry=\"2\"></rect><line x1=\"1\" y1=\"10\" x2=\"23\" y2=\"10\"></line>","crop":"<path d=\"M6.13 1L6 16a2 2 0 0 0 2 2h15\"></path><path d=\"M1 6.13L16 6a2 2 0 0 1 2 2v15\"></path>","crosshair":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"22\" y1=\"12\" x2=\"18\" y2=\"12\"></line><line x1=\"6\" y1=\"12\" x2=\"2\" y2=\"12\"></line><line x1=\"12\" y1=\"6\" x2=\"12\" y2=\"2\"></line><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"18\"></line>","database":"<ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"></ellipse><path d=\"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3\"></path><path d=\"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5\"></path>","delete":"<path d=\"M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z\"></path><line x1=\"18\" y1=\"9\" x2=\"12\" y2=\"15\"></line><line x1=\"12\" y1=\"9\" x2=\"18\" y2=\"15\"></line>","disc":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><circle cx=\"12\" cy=\"12\" r=\"3\"></circle>","dollar-sign":"<line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"23\"></line><path d=\"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6\"></path>","download-cloud":"<polyline points=\"8 17 12 21 16 17\"></polyline><line x1=\"12\" y1=\"12\" x2=\"12\" y2=\"21\"></line><path d=\"M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29\"></path>","download":"<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path><polyline points=\"7 10 12 15 17 10\"></polyline><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"></line>","droplet":"<path d=\"M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z\"></path>","edit-2":"<path d=\"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\"></path>","edit-3":"<path d=\"M12 20h9\"></path><path d=\"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z\"></path>","edit":"<path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"></path>","external-link":"<path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path><polyline points=\"15 3 21 3 21 9\"></polyline><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"></line>","eye-off":"<path d=\"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24\"></path><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","eye":"<path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\"></path><circle cx=\"12\" cy=\"12\" r=\"3\"></circle>","facebook":"<path d=\"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z\"></path>","fast-forward":"<polygon points=\"13 19 22 12 13 5 13 19\"></polygon><polygon points=\"2 19 11 12 2 5 2 19\"></polygon>","feather":"<path d=\"M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5z\"></path><line x1=\"16\" y1=\"8\" x2=\"2\" y2=\"22\"></line><line x1=\"17.5\" y1=\"15\" x2=\"9\" y2=\"15\"></line>","figma":"<path d=\"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z\"></path><path d=\"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z\"></path><path d=\"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z\"></path><path d=\"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z\"></path><path d=\"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z\"></path>","file-minus":"<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"></path><polyline points=\"14 2 14 8 20 8\"></polyline><line x1=\"9\" y1=\"15\" x2=\"15\" y2=\"15\"></line>","file-plus":"<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"></path><polyline points=\"14 2 14 8 20 8\"></polyline><line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"12\"></line><line x1=\"9\" y1=\"15\" x2=\"15\" y2=\"15\"></line>","file-text":"<path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"></path><polyline points=\"14 2 14 8 20 8\"></polyline><line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\"></line><line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\"></line><polyline points=\"10 9 9 9 8 9\"></polyline>","file":"<path d=\"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z\"></path><polyline points=\"13 2 13 9 20 9\"></polyline>","film":"<rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"2.18\" ry=\"2.18\"></rect><line x1=\"7\" y1=\"2\" x2=\"7\" y2=\"22\"></line><line x1=\"17\" y1=\"2\" x2=\"17\" y2=\"22\"></line><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"2\" y1=\"7\" x2=\"7\" y2=\"7\"></line><line x1=\"2\" y1=\"17\" x2=\"7\" y2=\"17\"></line><line x1=\"17\" y1=\"17\" x2=\"22\" y2=\"17\"></line><line x1=\"17\" y1=\"7\" x2=\"22\" y2=\"7\"></line>","filter":"<polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\"></polygon>","flag":"<path d=\"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z\"></path><line x1=\"4\" y1=\"22\" x2=\"4\" y2=\"15\"></line>","folder-minus":"<path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"></path><line x1=\"9\" y1=\"14\" x2=\"15\" y2=\"14\"></line>","folder-plus":"<path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"></path><line x1=\"12\" y1=\"11\" x2=\"12\" y2=\"17\"></line><line x1=\"9\" y1=\"14\" x2=\"15\" y2=\"14\"></line>","folder":"<path d=\"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\"></path>","framer":"<path d=\"M5 16V9h14V2H5l14 14h-7m-7 0l7 7v-7m-7 0h7\"></path>","frown":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M16 16s-1.5-2-4-2-4 2-4 2\"></path><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"></line><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"></line>","gift":"<polyline points=\"20 12 20 22 4 22 4 12\"></polyline><rect x=\"2\" y=\"7\" width=\"20\" height=\"5\"></rect><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"7\"></line><path d=\"M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z\"></path><path d=\"M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z\"></path>","git-branch":"<line x1=\"6\" y1=\"3\" x2=\"6\" y2=\"15\"></line><circle cx=\"18\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle><path d=\"M18 9a9 9 0 0 1-9 9\"></path>","git-commit":"<circle cx=\"12\" cy=\"12\" r=\"4\"></circle><line x1=\"1.05\" y1=\"12\" x2=\"7\" y2=\"12\"></line><line x1=\"17.01\" y1=\"12\" x2=\"22.96\" y2=\"12\"></line>","git-merge":"<circle cx=\"18\" cy=\"18\" r=\"3\"></circle><circle cx=\"6\" cy=\"6\" r=\"3\"></circle><path d=\"M6 21V9a9 9 0 0 0 9 9\"></path>","git-pull-request":"<circle cx=\"18\" cy=\"18\" r=\"3\"></circle><circle cx=\"6\" cy=\"6\" r=\"3\"></circle><path d=\"M13 6h3a2 2 0 0 1 2 2v7\"></path><line x1=\"6\" y1=\"9\" x2=\"6\" y2=\"21\"></line>","github":"<path d=\"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22\"></path>","gitlab":"<path d=\"M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z\"></path>","globe":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"></line><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"></path>","grid":"<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\"></rect><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\"></rect><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\"></rect><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\"></rect>","hard-drive":"<line x1=\"22\" y1=\"12\" x2=\"2\" y2=\"12\"></line><path d=\"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\"></path><line x1=\"6\" y1=\"16\" x2=\"6.01\" y2=\"16\"></line><line x1=\"10\" y1=\"16\" x2=\"10.01\" y2=\"16\"></line>","hash":"<line x1=\"4\" y1=\"9\" x2=\"20\" y2=\"9\"></line><line x1=\"4\" y1=\"15\" x2=\"20\" y2=\"15\"></line><line x1=\"10\" y1=\"3\" x2=\"8\" y2=\"21\"></line><line x1=\"16\" y1=\"3\" x2=\"14\" y2=\"21\"></line>","headphones":"<path d=\"M3 18v-6a9 9 0 0 1 18 0v6\"></path><path d=\"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z\"></path>","heart":"<path d=\"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z\"></path>","help-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\"></path><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"></line>","hexagon":"<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"></path>","home":"<path d=\"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path><polyline points=\"9 22 9 12 15 12 15 22\"></polyline>","image":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"></circle><polyline points=\"21 15 16 10 5 21\"></polyline>","inbox":"<polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\"></polyline><path d=\"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\"></path>","info":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"></line>","instagram":"<rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"5\" ry=\"5\"></rect><path d=\"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z\"></path><line x1=\"17.5\" y1=\"6.5\" x2=\"17.51\" y2=\"6.5\"></line>","italic":"<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"></line><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"></line><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"></line>","key":"<path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\"></path>","layers":"<polygon points=\"12 2 2 7 12 12 22 7 12 2\"></polygon><polyline points=\"2 17 12 22 22 17\"></polyline><polyline points=\"2 12 12 17 22 12\"></polyline>","layout":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"></line><line x1=\"9\" y1=\"21\" x2=\"9\" y2=\"9\"></line>","life-buoy":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><circle cx=\"12\" cy=\"12\" r=\"4\"></circle><line x1=\"4.93\" y1=\"4.93\" x2=\"9.17\" y2=\"9.17\"></line><line x1=\"14.83\" y1=\"14.83\" x2=\"19.07\" y2=\"19.07\"></line><line x1=\"14.83\" y1=\"9.17\" x2=\"19.07\" y2=\"4.93\"></line><line x1=\"14.83\" y1=\"9.17\" x2=\"18.36\" y2=\"5.64\"></line><line x1=\"4.93\" y1=\"19.07\" x2=\"9.17\" y2=\"14.83\"></line>","link-2":"<path d=\"M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3\"></path><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","link":"<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"></path><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"></path>","linkedin":"<path d=\"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z\"></path><rect x=\"2\" y=\"9\" width=\"4\" height=\"12\"></rect><circle cx=\"4\" cy=\"4\" r=\"2\"></circle>","list":"<line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\"></line><line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\"></line><line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\"></line><line x1=\"3\" y1=\"6\" x2=\"3.01\" y2=\"6\"></line><line x1=\"3\" y1=\"12\" x2=\"3.01\" y2=\"12\"></line><line x1=\"3\" y1=\"18\" x2=\"3.01\" y2=\"18\"></line>","loader":"<line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"6\"></line><line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"22\"></line><line x1=\"4.93\" y1=\"4.93\" x2=\"7.76\" y2=\"7.76\"></line><line x1=\"16.24\" y1=\"16.24\" x2=\"19.07\" y2=\"19.07\"></line><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\"></line><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"4.93\" y1=\"19.07\" x2=\"7.76\" y2=\"16.24\"></line><line x1=\"16.24\" y1=\"7.76\" x2=\"19.07\" y2=\"4.93\"></line>","lock":"<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"></path>","log-in":"<path d=\"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4\"></path><polyline points=\"10 17 15 12 10 7\"></polyline><line x1=\"15\" y1=\"12\" x2=\"3\" y2=\"12\"></line>","log-out":"<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\"></path><polyline points=\"16 17 21 12 16 7\"></polyline><line x1=\"21\" y1=\"12\" x2=\"9\" y2=\"12\"></line>","mail":"<path d=\"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z\"></path><polyline points=\"22,6 12,13 2,6\"></polyline>","map-pin":"<path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\"></path><circle cx=\"12\" cy=\"10\" r=\"3\"></circle>","map":"<polygon points=\"1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6\"></polygon><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"18\"></line><line x1=\"16\" y1=\"6\" x2=\"16\" y2=\"22\"></line>","maximize-2":"<polyline points=\"15 3 21 3 21 9\"></polyline><polyline points=\"9 21 3 21 3 15\"></polyline><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"></line><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"></line>","maximize":"<path d=\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3\"></path>","meh":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"8\" y1=\"15\" x2=\"16\" y2=\"15\"></line><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"></line><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"></line>","menu":"<line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"></line><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line><line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"></line>","message-circle":"<path d=\"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z\"></path>","message-square":"<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"></path>","mic-off":"<line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line><path d=\"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6\"></path><path d=\"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23\"></path><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"></line><line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"></line>","mic":"<path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"></path><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"></path><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"></line><line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"></line>","minimize-2":"<polyline points=\"4 14 10 14 10 20\"></polyline><polyline points=\"20 10 14 10 14 4\"></polyline><line x1=\"14\" y1=\"10\" x2=\"21\" y2=\"3\"></line><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"></line>","minimize":"<path d=\"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3\"></path>","minus-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","minus-square":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","minus":"<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>","monitor":"<rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" ry=\"2\"></rect><line x1=\"8\" y1=\"21\" x2=\"16\" y2=\"21\"></line><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"21\"></line>","moon":"<path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"></path>","more-horizontal":"<circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"19\" cy=\"12\" r=\"1\"></circle><circle cx=\"5\" cy=\"12\" r=\"1\"></circle>","more-vertical":"<circle cx=\"12\" cy=\"12\" r=\"1\"></circle><circle cx=\"12\" cy=\"5\" r=\"1\"></circle><circle cx=\"12\" cy=\"19\" r=\"1\"></circle>","mouse-pointer":"<path d=\"M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z\"></path><path d=\"M13 13l6 6\"></path>","move":"<polyline points=\"5 9 2 12 5 15\"></polyline><polyline points=\"9 5 12 2 15 5\"></polyline><polyline points=\"15 19 12 22 9 19\"></polyline><polyline points=\"19 9 22 12 19 15\"></polyline><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"></line>","music":"<path d=\"M9 18V5l12-2v13\"></path><circle cx=\"6\" cy=\"18\" r=\"3\"></circle><circle cx=\"18\" cy=\"16\" r=\"3\"></circle>","navigation-2":"<polygon points=\"12 2 19 21 12 17 5 21 12 2\"></polygon>","navigation":"<polygon points=\"3 11 22 2 13 21 11 13 3 11\"></polygon>","octagon":"<polygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"></polygon>","package":"<line x1=\"16.5\" y1=\"9.4\" x2=\"7.5\" y2=\"4.21\"></line><path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"></path><polyline points=\"3.27 6.96 12 12.01 20.73 6.96\"></polyline><line x1=\"12\" y1=\"22.08\" x2=\"12\" y2=\"12\"></line>","paperclip":"<path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"></path>","pause-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"10\" y1=\"15\" x2=\"10\" y2=\"9\"></line><line x1=\"14\" y1=\"15\" x2=\"14\" y2=\"9\"></line>","pause":"<rect x=\"6\" y=\"4\" width=\"4\" height=\"16\"></rect><rect x=\"14\" y=\"4\" width=\"4\" height=\"16\"></rect>","pen-tool":"<path d=\"M12 19l7-7 3 3-7 7-3-3z\"></path><path d=\"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z\"></path><path d=\"M2 2l7.586 7.586\"></path><circle cx=\"11\" cy=\"11\" r=\"2\"></circle>","percent":"<line x1=\"19\" y1=\"5\" x2=\"5\" y2=\"19\"></line><circle cx=\"6.5\" cy=\"6.5\" r=\"2.5\"></circle><circle cx=\"17.5\" cy=\"17.5\" r=\"2.5\"></circle>","phone-call":"<path d=\"M15.05 5A5 5 0 0 1 19 8.95M15.05 1A9 9 0 0 1 23 8.94m-1 7.98v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","phone-forwarded":"<polyline points=\"19 1 23 5 19 9\"></polyline><line x1=\"15\" y1=\"5\" x2=\"23\" y2=\"5\"></line><path d=\"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","phone-incoming":"<polyline points=\"16 2 16 8 22 8\"></polyline><line x1=\"23\" y1=\"1\" x2=\"16\" y2=\"8\"></line><path d=\"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","phone-missed":"<line x1=\"23\" y1=\"1\" x2=\"17\" y2=\"7\"></line><line x1=\"17\" y1=\"1\" x2=\"23\" y2=\"7\"></line><path d=\"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","phone-off":"<path d=\"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91\"></path><line x1=\"23\" y1=\"1\" x2=\"1\" y2=\"23\"></line>","phone-outgoing":"<polyline points=\"23 7 23 1 17 1\"></polyline><line x1=\"16\" y1=\"8\" x2=\"23\" y2=\"1\"></line><path d=\"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","phone":"<path d=\"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z\"></path>","pie-chart":"<path d=\"M21.21 15.89A10 10 0 1 1 8 2.83\"></path><path d=\"M22 12A10 10 0 0 0 12 2v10z\"></path>","play-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polygon points=\"10 8 16 12 10 16 10 8\"></polygon>","play":"<polygon points=\"5 3 19 12 5 21 5 3\"></polygon>","plus-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","plus-square":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","plus":"<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>","pocket":"<path d=\"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z\"></path><polyline points=\"8 10 12 14 16 10\"></polyline>","power":"<path d=\"M18.36 6.64a9 9 0 1 1-12.73 0\"></path><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"12\"></line>","printer":"<polyline points=\"6 9 6 2 18 2 18 9\"></polyline><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"></path><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\"></rect>","radio":"<circle cx=\"12\" cy=\"12\" r=\"2\"></circle><path d=\"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14\"></path>","refresh-ccw":"<polyline points=\"1 4 1 10 7 10\"></polyline><polyline points=\"23 20 23 14 17 14\"></polyline><path d=\"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15\"></path>","refresh-cw":"<polyline points=\"23 4 23 10 17 10\"></polyline><polyline points=\"1 20 1 14 7 14\"></polyline><path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"></path>","repeat":"<polyline points=\"17 1 21 5 17 9\"></polyline><path d=\"M3 11V9a4 4 0 0 1 4-4h14\"></path><polyline points=\"7 23 3 19 7 15\"></polyline><path d=\"M21 13v2a4 4 0 0 1-4 4H3\"></path>","rewind":"<polygon points=\"11 19 2 12 11 5 11 19\"></polygon><polygon points=\"22 19 13 12 22 5 22 19\"></polygon>","rotate-ccw":"<polyline points=\"1 4 1 10 7 10\"></polyline><path d=\"M3.51 15a9 9 0 1 0 2.13-9.36L1 10\"></path>","rotate-cw":"<polyline points=\"23 4 23 10 17 10\"></polyline><path d=\"M20.49 15a9 9 0 1 1-2.12-9.36L23 10\"></path>","rss":"<path d=\"M4 11a9 9 0 0 1 9 9\"></path><path d=\"M4 4a16 16 0 0 1 16 16\"></path><circle cx=\"5\" cy=\"19\" r=\"1\"></circle>","save":"<path d=\"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z\"></path><polyline points=\"17 21 17 13 7 13 7 21\"></polyline><polyline points=\"7 3 7 8 15 8\"></polyline>","scissors":"<circle cx=\"6\" cy=\"6\" r=\"3\"></circle><circle cx=\"6\" cy=\"18\" r=\"3\"></circle><line x1=\"20\" y1=\"4\" x2=\"8.12\" y2=\"15.88\"></line><line x1=\"14.47\" y1=\"14.48\" x2=\"20\" y2=\"20\"></line><line x1=\"8.12\" y1=\"8.12\" x2=\"12\" y2=\"12\"></line>","search":"<circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>","send":"<line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\"></line><polygon points=\"22 2 15 22 11 13 2 9 22 2\"></polygon>","server":"<rect x=\"2\" y=\"2\" width=\"20\" height=\"8\" rx=\"2\" ry=\"2\"></rect><rect x=\"2\" y=\"14\" width=\"20\" height=\"8\" rx=\"2\" ry=\"2\"></rect><line x1=\"6\" y1=\"6\" x2=\"6.01\" y2=\"6\"></line><line x1=\"6\" y1=\"18\" x2=\"6.01\" y2=\"18\"></line>","settings":"<circle cx=\"12\" cy=\"12\" r=\"3\"></circle><path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z\"></path>","share-2":"<circle cx=\"18\" cy=\"5\" r=\"3\"></circle><circle cx=\"6\" cy=\"12\" r=\"3\"></circle><circle cx=\"18\" cy=\"19\" r=\"3\"></circle><line x1=\"8.59\" y1=\"13.51\" x2=\"15.42\" y2=\"17.49\"></line><line x1=\"15.41\" y1=\"6.51\" x2=\"8.59\" y2=\"10.49\"></line>","share":"<path d=\"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8\"></path><polyline points=\"16 6 12 2 8 6\"></polyline><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"15\"></line>","shield-off":"<path d=\"M19.69 14a6.9 6.9 0 0 0 .31-2V5l-8-3-3.16 1.18\"></path><path d=\"M4.73 4.73L4 5v7c0 6 8 10 8 10a20.29 20.29 0 0 0 5.62-4.38\"></path><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","shield":"<path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"></path>","shopping-bag":"<path d=\"M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z\"></path><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line><path d=\"M16 10a4 4 0 0 1-8 0\"></path>","shopping-cart":"<circle cx=\"9\" cy=\"21\" r=\"1\"></circle><circle cx=\"20\" cy=\"21\" r=\"1\"></circle><path d=\"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6\"></path>","shuffle":"<polyline points=\"16 3 21 3 21 8\"></polyline><line x1=\"4\" y1=\"20\" x2=\"21\" y2=\"3\"></line><polyline points=\"21 16 21 21 16 21\"></polyline><line x1=\"15\" y1=\"15\" x2=\"21\" y2=\"21\"></line><line x1=\"4\" y1=\"4\" x2=\"9\" y2=\"9\"></line>","sidebar":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"></line>","skip-back":"<polygon points=\"19 20 9 12 19 4 19 20\"></polygon><line x1=\"5\" y1=\"19\" x2=\"5\" y2=\"5\"></line>","skip-forward":"<polygon points=\"5 4 15 12 5 20 5 4\"></polygon><line x1=\"19\" y1=\"5\" x2=\"19\" y2=\"19\"></line>","slack":"<path d=\"M14.5 10c-.83 0-1.5-.67-1.5-1.5v-5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v5c0 .83-.67 1.5-1.5 1.5z\"></path><path d=\"M20.5 10H19V8.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z\"></path><path d=\"M9.5 14c.83 0 1.5.67 1.5 1.5v5c0 .83-.67 1.5-1.5 1.5S8 21.33 8 20.5v-5c0-.83.67-1.5 1.5-1.5z\"></path><path d=\"M3.5 14H5v1.5c0 .83-.67 1.5-1.5 1.5S2 16.33 2 15.5 2.67 14 3.5 14z\"></path><path d=\"M14 14.5c0-.83.67-1.5 1.5-1.5h5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-5c-.83 0-1.5-.67-1.5-1.5z\"></path><path d=\"M15.5 19H14v1.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z\"></path><path d=\"M10 9.5C10 8.67 9.33 8 8.5 8h-5C2.67 8 2 8.67 2 9.5S2.67 11 3.5 11h5c.83 0 1.5-.67 1.5-1.5z\"></path><path d=\"M8.5 5H10V3.5C10 2.67 9.33 2 8.5 2S7 2.67 7 3.5 7.67 5 8.5 5z\"></path>","slash":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"4.93\" y1=\"4.93\" x2=\"19.07\" y2=\"19.07\"></line>","sliders":"<line x1=\"4\" y1=\"21\" x2=\"4\" y2=\"14\"></line><line x1=\"4\" y1=\"10\" x2=\"4\" y2=\"3\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"3\"></line><line x1=\"20\" y1=\"21\" x2=\"20\" y2=\"16\"></line><line x1=\"20\" y1=\"12\" x2=\"20\" y2=\"3\"></line><line x1=\"1\" y1=\"14\" x2=\"7\" y2=\"14\"></line><line x1=\"9\" y1=\"8\" x2=\"15\" y2=\"8\"></line><line x1=\"17\" y1=\"16\" x2=\"23\" y2=\"16\"></line>","smartphone":"<rect x=\"5\" y=\"2\" width=\"14\" height=\"20\" rx=\"2\" ry=\"2\"></rect><line x1=\"12\" y1=\"18\" x2=\"12.01\" y2=\"18\"></line>","smile":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M8 14s1.5 2 4 2 4-2 4-2\"></path><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"></line><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"></line>","speaker":"<rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\" ry=\"2\"></rect><circle cx=\"12\" cy=\"14\" r=\"4\"></circle><line x1=\"12\" y1=\"6\" x2=\"12.01\" y2=\"6\"></line>","square":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect>","star":"<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"></polygon>","stop-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><rect x=\"9\" y=\"9\" width=\"6\" height=\"6\"></rect>","sun":"<circle cx=\"12\" cy=\"12\" r=\"5\"></circle><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"></line><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"></line><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"></line><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"></line><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"></line><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"></line><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"></line>","sunrise":"<path d=\"M17 18a5 5 0 0 0-10 0\"></path><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"9\"></line><line x1=\"4.22\" y1=\"10.22\" x2=\"5.64\" y2=\"11.64\"></line><line x1=\"1\" y1=\"18\" x2=\"3\" y2=\"18\"></line><line x1=\"21\" y1=\"18\" x2=\"23\" y2=\"18\"></line><line x1=\"18.36\" y1=\"11.64\" x2=\"19.78\" y2=\"10.22\"></line><line x1=\"23\" y1=\"22\" x2=\"1\" y2=\"22\"></line><polyline points=\"8 6 12 2 16 6\"></polyline>","sunset":"<path d=\"M17 18a5 5 0 0 0-10 0\"></path><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"2\"></line><line x1=\"4.22\" y1=\"10.22\" x2=\"5.64\" y2=\"11.64\"></line><line x1=\"1\" y1=\"18\" x2=\"3\" y2=\"18\"></line><line x1=\"21\" y1=\"18\" x2=\"23\" y2=\"18\"></line><line x1=\"18.36\" y1=\"11.64\" x2=\"19.78\" y2=\"10.22\"></line><line x1=\"23\" y1=\"22\" x2=\"1\" y2=\"22\"></line><polyline points=\"16 5 12 9 8 5\"></polyline>","tablet":"<rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\" ry=\"2\"></rect><line x1=\"12\" y1=\"18\" x2=\"12.01\" y2=\"18\"></line>","tag":"<path d=\"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z\"></path><line x1=\"7\" y1=\"7\" x2=\"7.01\" y2=\"7\"></line>","target":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><circle cx=\"12\" cy=\"12\" r=\"6\"></circle><circle cx=\"12\" cy=\"12\" r=\"2\"></circle>","terminal":"<polyline points=\"4 17 10 11 4 5\"></polyline><line x1=\"12\" y1=\"19\" x2=\"20\" y2=\"19\"></line>","thermometer":"<path d=\"M14 14.76V3.5a2.5 2.5 0 0 0-5 0v11.26a4.5 4.5 0 1 0 5 0z\"></path>","thumbs-down":"<path d=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"></path>","thumbs-up":"<path d=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"></path>","toggle-left":"<rect x=\"1\" y=\"5\" width=\"22\" height=\"14\" rx=\"7\" ry=\"7\"></rect><circle cx=\"8\" cy=\"12\" r=\"3\"></circle>","toggle-right":"<rect x=\"1\" y=\"5\" width=\"22\" height=\"14\" rx=\"7\" ry=\"7\"></rect><circle cx=\"16\" cy=\"12\" r=\"3\"></circle>","tool":"<path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z\"></path>","trash-2":"<polyline points=\"3 6 5 6 21 6\"></polyline><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"></path><line x1=\"10\" y1=\"11\" x2=\"10\" y2=\"17\"></line><line x1=\"14\" y1=\"11\" x2=\"14\" y2=\"17\"></line>","trash":"<polyline points=\"3 6 5 6 21 6\"></polyline><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"></path>","trello":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><rect x=\"7\" y=\"7\" width=\"3\" height=\"9\"></rect><rect x=\"14\" y=\"7\" width=\"3\" height=\"5\"></rect>","trending-down":"<polyline points=\"23 18 13.5 8.5 8.5 13.5 1 6\"></polyline><polyline points=\"17 18 23 18 23 12\"></polyline>","trending-up":"<polyline points=\"23 6 13.5 15.5 8.5 10.5 1 18\"></polyline><polyline points=\"17 6 23 6 23 12\"></polyline>","triangle":"<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"></path>","truck":"<rect x=\"1\" y=\"3\" width=\"15\" height=\"13\"></rect><polygon points=\"16 8 20 8 23 11 23 16 16 16 16 8\"></polygon><circle cx=\"5.5\" cy=\"18.5\" r=\"2.5\"></circle><circle cx=\"18.5\" cy=\"18.5\" r=\"2.5\"></circle>","tv":"<rect x=\"2\" y=\"7\" width=\"20\" height=\"15\" rx=\"2\" ry=\"2\"></rect><polyline points=\"17 2 12 7 7 2\"></polyline>","twitch":"<path d=\"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7\"></path>","twitter":"<path d=\"M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z\"></path>","type":"<polyline points=\"4 7 4 4 20 4 20 7\"></polyline><line x1=\"9\" y1=\"20\" x2=\"15\" y2=\"20\"></line><line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\"></line>","umbrella":"<path d=\"M23 12a11.05 11.05 0 0 0-22 0zm-5 7a3 3 0 0 1-6 0v-7\"></path>","underline":"<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"></path><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"></line>","unlock":"<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"M7 11V7a5 5 0 0 1 9.9-1\"></path>","upload-cloud":"<polyline points=\"16 16 12 12 8 16\"></polyline><line x1=\"12\" y1=\"12\" x2=\"12\" y2=\"21\"></line><path d=\"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3\"></path><polyline points=\"16 16 12 12 8 16\"></polyline>","upload":"<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path><polyline points=\"17 8 12 3 7 8\"></polyline><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\"></line>","user-check":"<path d=\"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"></path><circle cx=\"8.5\" cy=\"7\" r=\"4\"></circle><polyline points=\"17 11 19 13 23 9\"></polyline>","user-minus":"<path d=\"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"></path><circle cx=\"8.5\" cy=\"7\" r=\"4\"></circle><line x1=\"23\" y1=\"11\" x2=\"17\" y2=\"11\"></line>","user-plus":"<path d=\"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"></path><circle cx=\"8.5\" cy=\"7\" r=\"4\"></circle><line x1=\"20\" y1=\"8\" x2=\"20\" y2=\"14\"></line><line x1=\"23\" y1=\"11\" x2=\"17\" y2=\"11\"></line>","user-x":"<path d=\"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"></path><circle cx=\"8.5\" cy=\"7\" r=\"4\"></circle><line x1=\"18\" y1=\"8\" x2=\"23\" y2=\"13\"></line><line x1=\"23\" y1=\"8\" x2=\"18\" y2=\"13\"></line>","user":"<path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\"></path><circle cx=\"12\" cy=\"7\" r=\"4\"></circle>","users":"<path d=\"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"></path><circle cx=\"9\" cy=\"7\" r=\"4\"></circle><path d=\"M23 21v-2a4 4 0 0 0-3-3.87\"></path><path d=\"M16 3.13a4 4 0 0 1 0 7.75\"></path>","video-off":"<path d=\"M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10\"></path><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","video":"<polygon points=\"23 7 16 12 23 17 23 7\"></polygon><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" ry=\"2\"></rect>","voicemail":"<circle cx=\"5.5\" cy=\"11.5\" r=\"4.5\"></circle><circle cx=\"18.5\" cy=\"11.5\" r=\"4.5\"></circle><line x1=\"5.5\" y1=\"16\" x2=\"18.5\" y2=\"16\"></line>","volume-1":"<polygon points=\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"></polygon><path d=\"M15.54 8.46a5 5 0 0 1 0 7.07\"></path>","volume-2":"<polygon points=\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"></polygon><path d=\"M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07\"></path>","volume-x":"<polygon points=\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"></polygon><line x1=\"23\" y1=\"9\" x2=\"17\" y2=\"15\"></line><line x1=\"17\" y1=\"9\" x2=\"23\" y2=\"15\"></line>","volume":"<polygon points=\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"></polygon>","watch":"<circle cx=\"12\" cy=\"12\" r=\"7\"></circle><polyline points=\"12 9 12 12 13.5 13.5\"></polyline><path d=\"M16.51 17.35l-.35 3.83a2 2 0 0 1-2 1.82H9.83a2 2 0 0 1-2-1.82l-.35-3.83m.01-10.7l.35-3.83A2 2 0 0 1 9.83 1h4.35a2 2 0 0 1 2 1.82l.35 3.83\"></path>","wifi-off":"<line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line><path d=\"M16.72 11.06A10.94 10.94 0 0 1 19 12.55\"></path><path d=\"M5 12.55a10.94 10.94 0 0 1 5.17-2.39\"></path><path d=\"M10.71 5.05A16 16 0 0 1 22.58 9\"></path><path d=\"M1.42 9a15.91 15.91 0 0 1 4.7-2.88\"></path><path d=\"M8.53 16.11a6 6 0 0 1 6.95 0\"></path><line x1=\"12\" y1=\"20\" x2=\"12.01\" y2=\"20\"></line>","wifi":"<path d=\"M5 12.55a11 11 0 0 1 14.08 0\"></path><path d=\"M1.42 9a16 16 0 0 1 21.16 0\"></path><path d=\"M8.53 16.11a6 6 0 0 1 6.95 0\"></path><line x1=\"12\" y1=\"20\" x2=\"12.01\" y2=\"20\"></line>","wind":"<path d=\"M9.59 4.59A2 2 0 1 1 11 8H2m10.59 11.41A2 2 0 1 0 14 16H2m15.73-8.27A2.5 2.5 0 1 1 19.5 12H2\"></path>","x-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"></line><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"></line>","x-octagon":"<polygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"></polygon><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"></line><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"></line>","x-square":"<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"></line><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"></line>","x":"<line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>","youtube":"<path d=\"M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z\"></path><polygon points=\"9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02\"></polygon>","zap-off":"<polyline points=\"12.41 6.75 13 2 10.57 4.92\"></polyline><polyline points=\"18.57 12.91 21 10 15.66 10\"></polyline><polyline points=\"8 8 3 14 12 14 11 22 16 16\"></polyline><line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\"></line>","zap":"<polygon points=\"13 2 3 14 12 14 11 22 21 10 12 10 13 2\"></polygon>","zoom-in":"<circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>","zoom-out":"<circle cx=\"11\" cy=\"11\" r=\"8\"></circle><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line><line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>"};
/***/ }),
/***/ "./node_modules/classnames/dedupe.js":
/*!*******************************************!*\
!*** ./node_modules/classnames/dedupe.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
var classNames = (function () {
// don't inherit from Object so we can skip hasOwnProperty check later
// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232
function StorageObject() {}
StorageObject.prototype = Object.create(null);
function _parseArray (resultSet, array) {
var length = array.length;
for (var i = 0; i < length; ++i) {
_parse(resultSet, array[i]);
}
}
var hasOwn = {}.hasOwnProperty;
function _parseNumber (resultSet, num) {
resultSet[num] = true;
}
function _parseObject (resultSet, object) {
for (var k in object) {
if (hasOwn.call(object, k)) {
// set value to false instead of deleting it to avoid changing object structure
// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions
resultSet[k] = !!object[k];
}
}
}
var SPACE = /\s+/;
function _parseString (resultSet, str) {
var array = str.split(SPACE);
var length = array.length;
for (var i = 0; i < length; ++i) {
resultSet[array[i]] = true;
}
}
function _parse (resultSet, arg) {
if (!arg) return;
var argType = typeof arg;
// 'foo bar'
if (argType === 'string') {
_parseString(resultSet, arg);
// ['foo', 'bar', ...]
} else if (Array.isArray(arg)) {
_parseArray(resultSet, arg);
// { 'foo': true, ... }
} else if (argType === 'object') {
_parseObject(resultSet, arg);
// '130'
} else if (argType === 'number') {
_parseNumber(resultSet, arg);
}
}
function _classNames () {
// don't leak arguments
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var len = arguments.length;
var args = Array(len);
for (var i = 0; i < len; i++) {
args[i] = arguments[i];
}
var classSet = new StorageObject();
_parseArray(classSet, args);
var list = [];
for (var k in classSet) {
if (classSet[k]) {
list.push(k);
}
}
return list.join(' ');
}
return _classNames;
})();
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
}());
/***/ }),
/***/ "./node_modules/core-js/es/array/from.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/es/array/from.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! ../../modules/es.string.iterator */ "./node_modules/core-js/modules/es.string.iterator.js");
__webpack_require__(/*! ../../modules/es.array.from */ "./node_modules/core-js/modules/es.array.from.js");
var path = __webpack_require__(/*! ../../internals/path */ "./node_modules/core-js/internals/path.js");
module.exports = path.Array.from;
/***/ }),
/***/ "./node_modules/core-js/internals/a-function.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/a-function.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
/***/ }),
/***/ "./node_modules/core-js/internals/an-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/an-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
module.exports = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
/***/ }),
/***/ "./node_modules/core-js/internals/array-from.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/array-from.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var bind = __webpack_require__(/*! ../internals/bind-context */ "./node_modules/core-js/internals/bind-context.js");
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
var callWithSafeIterationClosing = __webpack_require__(/*! ../internals/call-with-safe-iteration-closing */ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js");
var isArrayIteratorMethod = __webpack_require__(/*! ../internals/is-array-iterator-method */ "./node_modules/core-js/internals/is-array-iterator-method.js");
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
var createProperty = __webpack_require__(/*! ../internals/create-property */ "./node_modules/core-js/internals/create-property.js");
var getIteratorMethod = __webpack_require__(/*! ../internals/get-iterator-method */ "./node_modules/core-js/internals/get-iterator-method.js");
// `Array.from` method
// https://tc39.github.io/ecma262/#sec-array.from
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var argumentsLength = arguments.length;
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var index = 0;
var iteratorMethod = getIteratorMethod(O);
var length, result, step, iterator;
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
// if the target is not iterable or it's an array with the default iterator - use a simple case
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
iterator = iteratorMethod.call(O);
result = new C();
for (;!(step = iterator.next()).done; index++) {
createProperty(result, index, mapping
? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
: step.value
);
}
} else {
length = toLength(O.length);
result = new C(length);
for (;length > index; index++) {
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/array-includes.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/array-includes.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
var toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ "./node_modules/core-js/internals/to-absolute-index.js");
// `Array.prototype.{ indexOf, includes }` methods implementation
// false -> Array#indexOf
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
// true -> Array#includes
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
module.exports = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/bind-context.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/internals/bind-context.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__(/*! ../internals/a-function */ "./node_modules/core-js/internals/a-function.js");
// optional / simple context binding
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js":
/*!****************************************************************************!*\
!*** ./node_modules/core-js/internals/call-with-safe-iteration-closing.js ***!
\****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
// call something on iterator step with safe closing on error
module.exports = function (iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
var returnMethod = iterator['return'];
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
throw error;
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/check-correctness-of-iteration.js":
/*!**************************************************************************!*\
!*** ./node_modules/core-js/internals/check-correctness-of-iteration.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
module.exports = function (exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
/***/ }),
/***/ "./node_modules/core-js/internals/classof-raw.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/classof-raw.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/***/ "./node_modules/core-js/internals/classof.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/internals/classof.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var classofRaw = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
module.exports = function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw(O)
// ES3 arguments fallback
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/copy-constructor-properties.js":
/*!***********************************************************************!*\
!*** ./node_modules/core-js/internals/copy-constructor-properties.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var ownKeys = __webpack_require__(/*! ../internals/own-keys */ "./node_modules/core-js/internals/own-keys.js");
var getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
module.exports = function (target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/correct-prototype-getter.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/correct-prototype-getter.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
module.exports = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
/***/ }),
/***/ "./node_modules/core-js/internals/create-iterator-constructor.js":
/*!***********************************************************************!*\
!*** ./node_modules/core-js/internals/create-iterator-constructor.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var IteratorPrototype = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js").IteratorPrototype;
var create = __webpack_require__(/*! ../internals/object-create */ "./node_modules/core-js/internals/object-create.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var returnThis = function () { return this; };
module.exports = function (IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
Iterators[TO_STRING_TAG] = returnThis;
return IteratorConstructor;
};
/***/ }),
/***/ "./node_modules/core-js/internals/create-property-descriptor.js":
/*!**********************************************************************!*\
!*** ./node_modules/core-js/internals/create-property-descriptor.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/create-property.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/create-property.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
module.exports = function (object, key, value) {
var propertyKey = toPrimitive(key);
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
else object[propertyKey] = value;
};
/***/ }),
/***/ "./node_modules/core-js/internals/define-iterator.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/define-iterator.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
var createIteratorConstructor = __webpack_require__(/*! ../internals/create-iterator-constructor */ "./node_modules/core-js/internals/create-iterator-constructor.js");
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
var setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ "./node_modules/core-js/internals/object-set-prototype-of.js");
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var IteratorsCore = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js");
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis = function () { return this; };
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function (KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
switch (KIND) {
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
} return function () { return new IteratorConstructor(this); };
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator = IterablePrototype[ITERATOR]
|| IterablePrototype['@@iterator']
|| DEFAULT && IterablePrototype[DEFAULT];
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
// fix native
if (anyNativeIterator) {
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
if (setPrototypeOf) {
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
hide(CurrentIteratorPrototype, ITERATOR, returnThis);
}
}
// Set @@toStringTag to native iterators
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return nativeIterator.call(this); };
}
// define iterator
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
hide(IterablePrototype, ITERATOR, defaultIterator);
}
Iterators[NAME] = defaultIterator;
// export additional methods
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED) for (KEY in methods) {
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
redefine(IterablePrototype, KEY, methods[KEY]);
}
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
}
return methods;
};
/***/ }),
/***/ "./node_modules/core-js/internals/descriptors.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/descriptors.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/internals/document-create-element.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/document-create-element.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var document = global.document;
// typeof document.createElement is 'object' in old IE
var exist = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return exist ? document.createElement(it) : {};
};
/***/ }),
/***/ "./node_modules/core-js/internals/enum-bug-keys.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/enum-bug-keys.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// IE8- don't enum bug keys
module.exports = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
/***/ }),
/***/ "./node_modules/core-js/internals/export.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/export.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js").f;
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ "./node_modules/core-js/internals/copy-constructor-properties.js");
var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js/internals/is-forced.js");
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
module.exports = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global;
} else if (STATIC) {
target = global[TARGET] || setGlobal(TARGET, {});
} else {
target = (global[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
hide(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/fails.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/internals/fails.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/function-to-string.js":
/*!**************************************************************!*\
!*** ./node_modules/core-js/internals/function-to-string.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
module.exports = shared('native-function-to-string', Function.toString);
/***/ }),
/***/ "./node_modules/core-js/internals/get-iterator-method.js":
/*!***************************************************************!*\
!*** ./node_modules/core-js/internals/get-iterator-method.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(/*! ../internals/classof */ "./node_modules/core-js/internals/classof.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/***/ "./node_modules/core-js/internals/global.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/global.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var O = 'object';
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
// eslint-disable-next-line no-undef
check(typeof globalThis == O && globalThis) ||
check(typeof window == O && window) ||
check(typeof self == O && self) ||
check(typeof global == O && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));
/***/ }),
/***/ "./node_modules/core-js/internals/has.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/internals/has.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/***/ "./node_modules/core-js/internals/hidden-keys.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/hidden-keys.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "./node_modules/core-js/internals/hide.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/hide.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
module.exports = DESCRIPTORS ? function (object, key, value) {
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/***/ "./node_modules/core-js/internals/html.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/html.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var document = global.document;
module.exports = document && document.documentElement;
/***/ }),
/***/ "./node_modules/core-js/internals/ie8-dom-define.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/ie8-dom-define.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/internals/indexed-object.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/indexed-object.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var classof = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
var split = ''.split;
module.exports = fails(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
/***/ }),
/***/ "./node_modules/core-js/internals/internal-state.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/internal-state.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/native-weak-map */ "./node_modules/core-js/internals/native-weak-map.js");
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var objectHas = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var WeakMap = global.WeakMap;
var set, get, has;
var enforce = function (it) {
return has(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP) {
var store = new WeakMap();
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function (it, metadata) {
wmset.call(store, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store, it) || {};
};
has = function (it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function (it, metadata) {
hide(it, STATE, metadata);
return metadata;
};
get = function (it) {
return objectHas(it, STATE) ? it[STATE] : {};
};
has = function (it) {
return objectHas(it, STATE);
};
}
module.exports = {
set: set,
get: get,
has: has,
enforce: enforce,
getterFor: getterFor
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-array-iterator-method.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/is-array-iterator-method.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;
// check on default Array iterator
module.exports = function (it) {
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-forced.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/is-forced.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var replacement = /#|\.prototype\./;
var isForced = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails(detection)
: !!detection;
};
var normalize = isForced.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';
module.exports = isForced;
/***/ }),
/***/ "./node_modules/core-js/internals/is-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/is-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-pure.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/internals/is-pure.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = false;
/***/ }),
/***/ "./node_modules/core-js/internals/iterators-core.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/iterators-core.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var ITERATOR = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;
var returnThis = function () { return this; };
// `%IteratorPrototype%` object
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
}
}
if (IteratorPrototype == undefined) IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
/***/ }),
/***/ "./node_modules/core-js/internals/iterators.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/iterators.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "./node_modules/core-js/internals/native-symbol.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/native-symbol.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
/***/ }),
/***/ "./node_modules/core-js/internals/native-weak-map.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/native-weak-map.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
var WeakMap = global.WeakMap;
module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap));
/***/ }),
/***/ "./node_modules/core-js/internals/object-create.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/object-create.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var defineProperties = __webpack_require__(/*! ../internals/object-define-properties */ "./node_modules/core-js/internals/object-define-properties.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var html = __webpack_require__(/*! ../internals/html */ "./node_modules/core-js/internals/html.js");
var documentCreateElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var IE_PROTO = sharedKey('IE_PROTO');
var PROTOTYPE = 'prototype';
var Empty = function () { /* empty */ };
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var length = enumBugKeys.length;
var lt = '<';
var script = 'script';
var gt = '>';
var js = 'java' + script + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = String(js);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
return createDict();
};
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
};
hiddenKeys[IE_PROTO] = true;
/***/ }),
/***/ "./node_modules/core-js/internals/object-define-properties.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/object-define-properties.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var objectKeys = __webpack_require__(/*! ../internals/object-keys */ "./node_modules/core-js/internals/object-keys.js");
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var i = 0;
var key;
while (length > i) definePropertyModule.f(O, key = keys[i++], Properties[key]);
return O;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-define-property.js":
/*!******************************************************************!*\
!*** ./node_modules/core-js/internals/object-define-property.js ***!
\******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var nativeDefineProperty = Object.defineProperty;
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-descriptor.js":
/*!******************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-descriptor.js ***!
\******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ "./node_modules/core-js/internals/object-property-is-enumerable.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-names.js":
/*!*************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-names.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-symbols.js":
/*!***************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-symbols.js ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-prototype-of.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-prototype-of.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(/*! ../internals/correct-prototype-getter */ "./node_modules/core-js/internals/correct-prototype-getter.js");
var IE_PROTO = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
O = toObject(O);
if (has(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectPrototype : null;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-keys-internal.js":
/*!****************************************************************!*\
!*** ./node_modules/core-js/internals/object-keys-internal.js ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var arrayIncludes = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var arrayIndexOf = arrayIncludes(false);
module.exports = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-keys.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/object-keys.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
module.exports = Object.keys || function keys(O) {
return internalObjectKeys(O, enumBugKeys);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-property-is-enumerable.js":
/*!*************************************************************************!*\
!*** ./node_modules/core-js/internals/object-property-is-enumerable.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
} : nativePropertyIsEnumerable;
/***/ }),
/***/ "./node_modules/core-js/internals/object-set-prototype-of.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/object-set-prototype-of.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var validateSetPrototypeOfArguments = __webpack_require__(/*! ../internals/validate-set-prototype-of-arguments */ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var correctSetter = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
correctSetter = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
validateSetPrototypeOfArguments(O, proto);
if (correctSetter) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
/***/ }),
/***/ "./node_modules/core-js/internals/own-keys.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/internals/own-keys.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ "./node_modules/core-js/internals/object-get-own-property-names.js");
var getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ "./node_modules/core-js/internals/object-get-own-property-symbols.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var Reflect = global.Reflect;
// all object keys, includes non-enumerable and symbols
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
/***/ }),
/***/ "./node_modules/core-js/internals/path.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/path.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
/***/ }),
/***/ "./node_modules/core-js/internals/redefine.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/internals/redefine.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(nativeFunctionToString).split('toString');
shared('inspectSource', function (it) {
return nativeFunctionToString.call(it);
});
(module.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
if (typeof value == 'function') {
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
if (O === global) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else hide(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
});
/***/ }),
/***/ "./node_modules/core-js/internals/require-object-coercible.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/require-object-coercible.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/***/ "./node_modules/core-js/internals/set-global.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/set-global.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
module.exports = function (key, value) {
try {
hide(global, key, value);
} catch (error) {
global[key] = value;
} return value;
};
/***/ }),
/***/ "./node_modules/core-js/internals/set-to-string-tag.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/set-to-string-tag.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f;
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
module.exports = function (it, TAG, STATIC) {
if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/shared-key.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/shared-key.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
var keys = shared('keys');
module.exports = function (key) {
return keys[key] || (keys[key] = uid(key));
};
/***/ }),
/***/ "./node_modules/core-js/internals/shared.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/shared.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.1.3',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/***/ "./node_modules/core-js/internals/string-at.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/string-at.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
// CONVERT_TO_STRING: true -> String#at
// CONVERT_TO_STRING: false -> String#codePointAt
module.exports = function (that, pos, CONVERT_TO_STRING) {
var S = String(requireObjectCoercible(that));
var position = toInteger(pos);
var size = S.length;
var first, second;
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
first = S.charCodeAt(position);
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
? CONVERT_TO_STRING ? S.charAt(position) : first
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-absolute-index.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/to-absolute-index.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
var max = Math.max;
var min = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
module.exports = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min(integer, length);
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-indexed-object.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/to-indexed-object.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "./node_modules/core-js/internals/indexed-object.js");
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
module.exports = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-integer.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/to-integer.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var ceil = Math.ceil;
var floor = Math.floor;
// `ToInteger` abstract operation
// https://tc39.github.io/ecma262/#sec-tointeger
module.exports = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-length.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/to-length.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.github.io/ecma262/#sec-tolength
module.exports = function (argument) {
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/to-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function (argument) {
return Object(requireObjectCoercible(argument));
};
/***/ }),
/***/ "./node_modules/core-js/internals/to-primitive.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/internals/to-primitive.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
// 7.1.1 ToPrimitive(input [, PreferredType])
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ }),
/***/ "./node_modules/core-js/internals/uid.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/internals/uid.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var id = 0;
var postfix = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
};
/***/ }),
/***/ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":
/*!*******************************************************************************!*\
!*** ./node_modules/core-js/internals/validate-set-prototype-of-arguments.js ***!
\*******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
module.exports = function (O, proto) {
anObject(O);
if (!isObject(proto) && proto !== null) {
throw TypeError("Can't set " + String(proto) + ' as a prototype');
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/well-known-symbol.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/well-known-symbol.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ "./node_modules/core-js/internals/native-symbol.js");
var Symbol = global.Symbol;
var store = shared('wks');
module.exports = function (name) {
return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name]
|| (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
/***/ }),
/***/ "./node_modules/core-js/modules/es.array.from.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/modules/es.array.from.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
var from = __webpack_require__(/*! ../internals/array-from */ "./node_modules/core-js/internals/array-from.js");
var checkCorrectnessOfIteration = __webpack_require__(/*! ../internals/check-correctness-of-iteration */ "./node_modules/core-js/internals/check-correctness-of-iteration.js");
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
});
// `Array.from` method
// https://tc39.github.io/ecma262/#sec-array.from
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
from: from
});
/***/ }),
/***/ "./node_modules/core-js/modules/es.string.iterator.js":
/*!************************************************************!*\
!*** ./node_modules/core-js/modules/es.string.iterator.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var codePointAt = __webpack_require__(/*! ../internals/string-at */ "./node_modules/core-js/internals/string-at.js");
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
var defineIterator = __webpack_require__(/*! ../internals/define-iterator */ "./node_modules/core-js/internals/define-iterator.js");
var STRING_ITERATOR = 'String Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
// `String.prototype[@@iterator]` method
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
setInternalState(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
// `%StringIteratorPrototype%.next` method
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
var state = getInternalState(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = codePointAt(string, index, true);
state.index += point.length;
return { value: point, done: false };
});
/***/ }),
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/***/ "./src/default-attrs.json":
/*!********************************!*\
!*** ./src/default-attrs.json ***!
\********************************/
/*! exports provided: xmlns, width, height, viewBox, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, default */
/***/ (function(module) {
module.exports = {"xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};
/***/ }),
/***/ "./src/icon.js":
/*!*********************!*\
!*** ./src/icon.js ***!
\*********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
var _dedupe2 = _interopRequireDefault(_dedupe);
var _defaultAttrs = __webpack_require__(/*! ./default-attrs.json */ "./src/default-attrs.json");
var _defaultAttrs2 = _interopRequireDefault(_defaultAttrs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Icon = function () {
function Icon(name, contents) {
var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
_classCallCheck(this, Icon);
this.name = name;
this.contents = contents;
this.tags = tags;
this.attrs = _extends({}, _defaultAttrs2.default, { class: 'feather feather-' + name });
}
/**
* Create an SVG string.
* @param {Object} attrs
* @returns {string}
*/
_createClass(Icon, [{
key: 'toSvg',
value: function toSvg() {
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var combinedAttrs = _extends({}, this.attrs, attrs, { class: (0, _dedupe2.default)(this.attrs.class, attrs.class) });
return '<svg ' + attrsToString(combinedAttrs) + '>' + this.contents + '</svg>';
}
/**
* Return string representation of an `Icon`.
*
* Added for backward compatibility. If old code expects `feather.icons.<name>`
* to be a string, `toString()` will get implicitly called.
*
* @returns {string}
*/
}, {
key: 'toString',
value: function toString() {
return this.contents;
}
}]);
return Icon;
}();
/**
* Convert attributes object to string of HTML attributes.
* @param {Object} attrs
* @returns {string}
*/
function attrsToString(attrs) {
return Object.keys(attrs).map(function (key) {
return key + '="' + attrs[key] + '"';
}).join(' ');
}
exports.default = Icon;
/***/ }),
/***/ "./src/icons.js":
/*!**********************!*\
!*** ./src/icons.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _icon = __webpack_require__(/*! ./icon */ "./src/icon.js");
var _icon2 = _interopRequireDefault(_icon);
var _icons = __webpack_require__(/*! ../dist/icons.json */ "./dist/icons.json");
var _icons2 = _interopRequireDefault(_icons);
var _tags = __webpack_require__(/*! ./tags.json */ "./src/tags.json");
var _tags2 = _interopRequireDefault(_tags);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = Object.keys(_icons2.default).map(function (key) {
return new _icon2.default(key, _icons2.default[key], _tags2.default[key]);
}).reduce(function (object, icon) {
object[icon.name] = icon;
return object;
}, {});
/***/ }),
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
var _icons2 = _interopRequireDefault(_icons);
var _toSvg = __webpack_require__(/*! ./to-svg */ "./src/to-svg.js");
var _toSvg2 = _interopRequireDefault(_toSvg);
var _replace = __webpack_require__(/*! ./replace */ "./src/replace.js");
var _replace2 = _interopRequireDefault(_replace);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = { icons: _icons2.default, toSvg: _toSvg2.default, replace: _replace2.default };
/***/ }),
/***/ "./src/replace.js":
/*!************************!*\
!*** ./src/replace.js ***!
\************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint-env browser */
var _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
var _dedupe2 = _interopRequireDefault(_dedupe);
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
var _icons2 = _interopRequireDefault(_icons);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Replace all HTML elements that have a `data-feather` attribute with SVG markup
* corresponding to the element's `data-feather` attribute value.
* @param {Object} attrs
*/
function replace() {
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (typeof document === 'undefined') {
throw new Error('`feather.replace()` only works in a browser environment.');
}
var elementsToReplace = document.querySelectorAll('[data-feather]');
Array.from(elementsToReplace).forEach(function (element) {
return replaceElement(element, attrs);
});
}
/**
* Replace a single HTML element with SVG markup
* corresponding to the element's `data-feather` attribute value.
* @param {HTMLElement} element
* @param {Object} attrs
*/
function replaceElement(element) {
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var elementAttrs = getAttrs(element);
var name = elementAttrs['data-feather'];
delete elementAttrs['data-feather'];
var svgString = _icons2.default[name].toSvg(_extends({}, attrs, elementAttrs, { class: (0, _dedupe2.default)(attrs.class, elementAttrs.class) }));
var svgDocument = new DOMParser().parseFromString(svgString, 'image/svg+xml');
var svgElement = svgDocument.querySelector('svg');
element.parentNode.replaceChild(svgElement, element);
}
/**
* Get the attributes of an HTML element.
* @param {HTMLElement} element
* @returns {Object}
*/
function getAttrs(element) {
return Array.from(element.attributes).reduce(function (attrs, attr) {
attrs[attr.name] = attr.value;
return attrs;
}, {});
}
exports.default = replace;
/***/ }),
/***/ "./src/tags.json":
/*!***********************!*\
!*** ./src/tags.json ***!
\***********************/
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, at-sign, award, aperture, bell, bell-off, bluetooth, book-open, book, bookmark, briefcase, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-rain, cloud-snow, cloud, codepen, codesandbox, coffee, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, credit-card, crop, crosshair, database, delete, disc, dollar-sign, droplet, edit, edit-2, edit-3, eye, eye-off, external-link, facebook, fast-forward, figma, film, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, global, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, instagram, key, life-bouy, linkedin, lock, log-in, log-out, mail, map-pin, map, maximize, maximize-2, meh, menu, message-circle, message-square, mic-off, mic, minimize, minimize-2, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, navigation, navigation-2, octagon, package, paperclip, pause, pause-circle, pen-tool, play, play-circle, plus, plus-circle, plus-square, pocket, power, radio, rewind, rss, save, search, send, settings, shield, shield-off, shopping-bag, shopping-cart, shuffle, skip-back, skip-forward, slash, sliders, smile, speaker, star, sun, sunrise, sunset, tag, target, terminal, thumbs-down, thumbs-up, toggle-left, toggle-right, trash, trash-2, triangle, truck, twitter, umbrella, video-off, video, voicemail, volume, volume-1, volume-2, volume-x, watch, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, default */
/***/ (function(module) {
module.exports = {"activity":["pulse","health","action","motion"],"airplay":["stream","cast","mirroring"],"alert-circle":["warning"],"alert-octagon":["warning"],"alert-triangle":["warning"],"at-sign":["mention"],"award":["achievement","badge"],"aperture":["camera","photo"],"bell":["alarm","notification"],"bell-off":["alarm","notification","silent"],"bluetooth":["wireless"],"book-open":["read"],"book":["read","dictionary","booklet","magazine"],"bookmark":["read","clip","marker","tag"],"briefcase":["work","bag","baggage","folder"],"clipboard":["copy"],"clock":["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],"cloud":["weather"],"codepen":["logo"],"codesandbox":["logo"],"coffee":["drink","cup","mug","tea","cafe","hot","beverage"],"command":["keyboard","cmd"],"compass":["navigation","safari","travel"],"copy":["clone","duplicate"],"corner-down-left":["arrow"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],"credit-card":["purchase","payment","cc"],"crop":["photo","image"],"crosshair":["aim","target"],"database":["storage"],"delete":["remove"],"disc":["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],"droplet":["water"],"edit":["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],"eye":["view","watch"],"eye-off":["view","watch"],"external-link":["outbound"],"facebook":["logo"],"fast-forward":["music"],"figma":["logo","design","tool"],"film":["movie","video"],"folder-minus":["directory"],"folder-plus":["directory"],"folder":["directory"],"framer":["logo","design","tool"],"frown":["emoji","face","bad","sad","emotion"],"gift":["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],"github":["logo","version control"],"gitlab":["logo","version control"],"global":["world","browser","language","translate"],"hard-drive":["computer","server"],"hash":["hashtag","number","pound"],"headphones":["music","audio"],"heart":["like","love"],"help-circle":["question mark"],"hexagon":["shape","node.js","logo"],"home":["house"],"image":["picture"],"inbox":["email"],"instagram":["logo","camera"],"key":["password","login","authentication"],"life-bouy":["help","life ring","support"],"linkedin":["logo"],"lock":["security","password"],"log-in":["sign in","arrow"],"log-out":["sign out","arrow"],"mail":["email"],"map-pin":["location","navigation","travel","marker"],"map":["location","navigation","travel"],"maximize":["fullscreen"],"maximize-2":["fullscreen","arrows"],"meh":["emoji","face","neutral","emotion"],"menu":["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record"],"mic":["record"],"minimize":["exit fullscreen"],"minimize-2":["exit fullscreen","arrows"],"monitor":["tv"],"moon":["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],"move":["arrows"],"navigation":["location","travel"],"navigation-2":["location","travel"],"octagon":["stop"],"package":["box"],"paperclip":["attachment"],"pause":["music","stop"],"pause-circle":["music","stop"],"pen-tool":["vector","drawing"],"play":["music","start"],"play-circle":["music","start"],"plus":["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],"pocket":["logo","save"],"power":["on","off"],"radio":["signal"],"rewind":["music"],"rss":["feed","subscribe"],"save":["floppy disk"],"search":["find","magnifier","magnifying glass"],"send":["message","mail","paper airplane"],"settings":["cog","edit","gear","preferences"],"shield":["security"],"shield-off":["security"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],"shuffle":["music"],"skip-back":["music"],"skip-forward":["music"],"slash":["ban","no"],"sliders":["settings","controls"],"smile":["emoji","face","happy","good","emotion"],"speaker":["music"],"star":["bookmark","favorite","like"],"sun":["brightness","weather","light"],"sunrise":["weather"],"sunset":["weather"],"tag":["label"],"target":["bullseye"],"terminal":["code","command line"],"thumbs-down":["dislike","bad"],"thumbs-up":["like","good"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],"trash":["garbage","delete","remove"],"trash-2":["garbage","delete","remove"],"triangle":["delta"],"truck":["delivery","van","shipping"],"twitter":["logo"],"umbrella":["rain","weather"],"video-off":["camera","movie","film"],"video":["camera","movie","film"],"voicemail":["phone"],"volume":["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],"watch":["clock","time"],"wind":["weather","air"],"x-circle":["cancel","close","delete","remove","times"],"x-octagon":["delete","stop","alert","warning","times"],"x-square":["cancel","close","delete","remove","times"],"x":["cancel","close","delete","remove","times"],"youtube":["logo","video","play"],"zap-off":["flash","camera","lightning"],"zap":["flash","camera","lightning"]};
/***/ }),
/***/ "./src/to-svg.js":
/*!***********************!*\
!*** ./src/to-svg.js ***!
\***********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
var _icons2 = _interopRequireDefault(_icons);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Create an SVG string.
* @deprecated
* @param {string} name
* @param {Object} attrs
* @returns {string}
*/
function toSvg(name) {
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
console.warn('feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead.');
if (!name) {
throw new Error('The required `key` (icon name) parameter is missing.');
}
if (!_icons2.default[name]) {
throw new Error('No icon matching \'' + name + '\'. See the complete list of icons at https://feathericons.com');
}
return _icons2.default[name].toSvg(attrs);
}
exports.default = toSvg;
/***/ }),
/***/ 0:
/*!**************************************************!*\
!*** multi core-js/es/array/from ./src/index.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! core-js/es/array/from */"./node_modules/core-js/es/array/from.js");
module.exports = __webpack_require__(/*! /home/travis/build/feathericons/feather/src/index.js */"./src/index.js");
/***/ })
/******/ });
});
//# sourceMappingURL=feather.js.map
});
var feather$1 = unwrapExports(feather);
const getIcon = (icon, size) => feather$1.icons[icon].toSvg({height:size||"16", width:size||"16"});
/* src\common\IconButton.svelte generated by Svelte v3.12.1 */
const file$3 = "src\\common\\IconButton.svelte";
function create_fragment$2(ctx) {
var button, raw_value = getIcon(ctx.icon, ctx.size) + "", button_style_value, addAttributes_action, dispose;
const block = {
c: function create() {
button = element("button");
attr_dev(button, "style", button_style_value = "" + ctx.style + (ctx.style ? ";" : "") + " color:" + ctx.color + "; --hovercolor:" + ctx.hoverColor);
attr_dev(button, "class", "svelte-bxuckr");
add_location(button, file$3, 38, 0, 836);
dispose = listen_dev(button, "click", ctx.click_handler);
},
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);
button.innerHTML = raw_value;
addAttributes_action = ctx.addAttributes.call(null, button, ctx.attributes) || {};
},
p: function update(changed, ctx) {
if ((changed.icon || changed.size) && raw_value !== (raw_value = getIcon(ctx.icon, ctx.size) + "")) {
button.innerHTML = raw_value;
}
if ((changed.style || changed.color || changed.hoverColor) && button_style_value !== (button_style_value = "" + ctx.style + (ctx.style ? ";" : "") + " color:" + ctx.color + "; --hovercolor:" + ctx.hoverColor)) {
attr_dev(button, "style", button_style_value);
}
if (typeof addAttributes_action.update === 'function' && changed.attributes) {
addAttributes_action.update.call(null, ctx.attributes);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(button);
}
if (addAttributes_action && typeof addAttributes_action.destroy === 'function') addAttributes_action.destroy();
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$2.name, type: "component", source: "", ctx });
return block;
}
function instance$2($$self, $$props, $$invalidate) {
let { size = 18, icon = "", style = "", color = "var(--secondary100)", hoverColor = "var(--secondary75)", attributes = {} } = $$props;
let currentAttributes = [];
const addAttributes = (node, attributes) => {
const add = (_attributes) => {
const attrs = [];
for(let attr in _attributes) {
node.setAttribute(attr, _attributes[attr]);
attrs.push("uk-toggle");
}
currentAttributes = attrs;
};
add(attributes);
return {
// should implement update method
update(attributes) {
for(let attr of currentAttributes) {
node.removeAttribute(attr);
}
add(attributes);
},
destroy() {}
}
};
const writable_props = ['size', 'icon', 'style', 'color', 'hoverColor', 'attributes'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<IconButton> was created with unknown prop '${key}'`);
});
function click_handler(event) {
bubble($$self, event);
}
$$self.$set = $$props => {
if ('size' in $$props) $$invalidate('size', size = $$props.size);
if ('icon' in $$props) $$invalidate('icon', icon = $$props.icon);
if ('style' in $$props) $$invalidate('style', style = $$props.style);
if ('color' in $$props) $$invalidate('color', color = $$props.color);
if ('hoverColor' in $$props) $$invalidate('hoverColor', hoverColor = $$props.hoverColor);
if ('attributes' in $$props) $$invalidate('attributes', attributes = $$props.attributes);
};
$$self.$capture_state = () => {
return { size, icon, style, color, hoverColor, attributes, currentAttributes };
};
$$self.$inject_state = $$props => {
if ('size' in $$props) $$invalidate('size', size = $$props.size);
if ('icon' in $$props) $$invalidate('icon', icon = $$props.icon);
if ('style' in $$props) $$invalidate('style', style = $$props.style);
if ('color' in $$props) $$invalidate('color', color = $$props.color);
if ('hoverColor' in $$props) $$invalidate('hoverColor', hoverColor = $$props.hoverColor);
if ('attributes' in $$props) $$invalidate('attributes', attributes = $$props.attributes);
if ('currentAttributes' in $$props) currentAttributes = $$props.currentAttributes;
};
return {
size,
icon,
style,
color,
hoverColor,
attributes,
addAttributes,
click_handler
};
}
class IconButton extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$2, create_fragment$2, safe_not_equal, ["size", "icon", "style", "color", "hoverColor", "attributes"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "IconButton", options, id: create_fragment$2.name });
}
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 icon() {
throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set icon(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 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 hoverColor() {
throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set hoverColor(value) {
throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get attributes() {
throw new Error("<IconButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set attributes(value) {
throw new Error("<IconButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\ComponentsHierarchy.svelte generated by Svelte v3.12.1 */
const file$4 = "src\\userInterface\\ComponentsHierarchy.svelte";
function get_each_context$1(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.component = list[i];
return child_ctx;
}
function get_each_context_1(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.folder = list[i];
return child_ctx;
}
// (130:8) {#if folder.isExpanded}
function create_if_block(ctx) {
var current;
var componentshierarchy = new ComponentsHierarchy({
props: {
components: ctx.subComponents(ctx.folder.name),
thisLevel: ctx.folder.path
},
$$inline: true
});
const block = {
c: function create() {
componentshierarchy.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(componentshierarchy, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var componentshierarchy_changes = {};
if (changed.subfolders) componentshierarchy_changes.components = ctx.subComponents(ctx.folder.name);
if (changed.subfolders) componentshierarchy_changes.thisLevel = ctx.folder.path;
componentshierarchy.$set(componentshierarchy_changes);
},
i: function intro(local) {
if (current) return;
transition_in(componentshierarchy.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(componentshierarchy.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(componentshierarchy, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block.name, type: "if", source: "(130:8) {#if folder.isExpanded}", ctx });
return block;
}
// (125:4) {#each subfolders as folder}
function create_each_block_1(ctx) {
var div, span0, raw_value = getIcon(ctx.folder.isExpanded ? "chevron-down" : "chevron-right", "16") + "", t0, span1, t1_value = ctx.folder.name + "", t1, t2, current, dispose;
var if_block = (ctx.folder.isExpanded) && create_if_block(ctx);
function click_handler() {
return ctx.click_handler(ctx);
}
const block = {
c: function create() {
div = element("div");
span0 = element("span");
t0 = space();
span1 = element("span");
t1 = text(t1_value);
t2 = space();
if (if_block) if_block.c();
add_location(span0, file$4, 127, 8, 3120);
attr_dev(span1, "class", "title svelte-1r2dipt");
toggle_class(span1, "currentfolder", ctx.$store.currentFrontEndItem && ctx.isInSubfolder(ctx.folder.name, ctx.$store.currentFrontEndItem));
add_location(span1, file$4, 128, 8, 3217);
attr_dev(div, "class", "hierarchy-item folder svelte-1r2dipt");
add_location(div, file$4, 125, 4, 3013);
dispose = listen_dev(div, "click", stop_propagation(click_handler), false, false, true);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, span0);
span0.innerHTML = raw_value;
append_dev(div, t0);
append_dev(div, span1);
append_dev(span1, t1);
append_dev(div, t2);
if (if_block) if_block.m(div, null);
current = true;
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((!current || changed.subfolders) && raw_value !== (raw_value = getIcon(ctx.folder.isExpanded ? "chevron-down" : "chevron-right", "16") + "")) {
span0.innerHTML = raw_value;
}
if ((!current || changed.subfolders) && t1_value !== (t1_value = ctx.folder.name + "")) {
set_data_dev(t1, t1_value);
}
if ((changed.$store || changed.isInSubfolder || changed.subfolders)) {
toggle_class(span1, "currentfolder", ctx.$store.currentFrontEndItem && ctx.isInSubfolder(ctx.folder.name, ctx.$store.currentFrontEndItem));
}
if (ctx.folder.isExpanded) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(div, 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(if_block);
current = true;
},
o: function outro(local) {
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
if (if_block) if_block.d();
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1.name, type: "each", source: "(125:4) {#each subfolders as folder}", ctx });
return block;
}
// (137:4) {#each componentsThisLevel as component}
function create_each_block$1(ctx) {
var div, span0, raw_value = getIcon("circle", "7") + "", t0, span1, t1_value = ctx.component.title + "", t1, t2, dispose;
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
div = element("div");
span0 = element("span");
t0 = space();
span1 = element("span");
t1 = text(t1_value);
t2 = space();
add_location(span0, file$4, 139, 8, 3849);
attr_dev(span1, "class", "title svelte-1r2dipt");
add_location(span1, file$4, 140, 8, 3901);
attr_dev(div, "class", "hierarchy-item component svelte-1r2dipt");
toggle_class(div, "selected", ctx.isComponentSelected(ctx.$store.currentFrontEndType, ctx.$store.currentFrontEndItem, ctx.component.component));
add_location(div, file$4, 137, 4, 3594);
dispose = listen_dev(div, "click", stop_propagation(click_handler_1), false, false, true);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, span0);
span0.innerHTML = raw_value;
append_dev(div, t0);
append_dev(div, span1);
append_dev(span1, t1);
append_dev(div, t2);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.componentsThisLevel) && t1_value !== (t1_value = ctx.component.title + "")) {
set_data_dev(t1, t1_value);
}
if ((changed.isComponentSelected || changed.$store || changed.componentsThisLevel)) {
toggle_class(div, "selected", ctx.isComponentSelected(ctx.$store.currentFrontEndType, ctx.$store.currentFrontEndItem, ctx.component.component));
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$1.name, type: "each", source: "(137:4) {#each componentsThisLevel as component}", ctx });
return block;
}
function create_fragment$3(ctx) {
var div, t, div_style_value, current;
let each_value_1 = ctx.subfolders;
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
const out = i => transition_out(each_blocks_1[i], 1, 1, () => {
each_blocks_1[i] = null;
});
let each_value = ctx.componentsThisLevel;
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 block = {
c: function create() {
div = element("div");
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div, "class", "root svelte-1r2dipt");
attr_dev(div, "style", div_style_value = `padding-left: calc(10px * ${ctx.pathPartsThisLevel})`);
add_location(div, file$4, 122, 0, 2896);
},
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_1.length; i += 1) {
each_blocks_1[i].m(div, null);
}
append_dev(div, t);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div, null);
}
current = true;
},
p: function update(changed, ctx) {
if (changed.subfolders || changed.subComponents || changed.$store || changed.isInSubfolder || changed.getIcon) {
each_value_1 = ctx.subfolders;
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_1[i]) {
each_blocks_1[i].p(changed, child_ctx);
transition_in(each_blocks_1[i], 1);
} else {
each_blocks_1[i] = create_each_block_1(child_ctx);
each_blocks_1[i].c();
transition_in(each_blocks_1[i], 1);
each_blocks_1[i].m(div, t);
}
}
group_outros();
for (i = each_value_1.length; i < each_blocks_1.length; i += 1) {
out(i);
}
check_outros();
}
if (changed.isComponentSelected || changed.$store || changed.componentsThisLevel || changed.getIcon) {
each_value = ctx.componentsThisLevel;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$1(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
if ((!current || changed.pathPartsThisLevel) && div_style_value !== (div_style_value = `padding-left: calc(10px * ${ctx.pathPartsThisLevel})`)) {
attr_dev(div, "style", div_style_value);
}
},
i: function intro(local) {
if (current) return;
for (let i = 0; i < each_value_1.length; i += 1) {
transition_in(each_blocks_1[i]);
}
current = true;
},
o: function outro(local) {
each_blocks_1 = each_blocks_1.filter(Boolean);
for (let i = 0; i < each_blocks_1.length; i += 1) {
transition_out(each_blocks_1[i]);
}
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_each(each_blocks_1, detaching);
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$3.name, type: "component", source: "", ctx });
return block;
}
function instance$3($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let { components = [], thisLevel = "" } = $$props;
let pathPartsThisLevel;
let componentsThisLevel;
let subfolders;
let expandedFolders = [];
const joinPath = fp_41("/");
const normalizedName = name => pipe$1(name, [
fp_56("./"),
fp_56("~/"),
fp_56("../"),
fp_55(" ")
]);
const isOnThisLevel = (c) =>
normalizedName(c.name).split("/").length === pathPartsThisLevel
&&
(!thisLevel || normalizedName(c.name).startsWith(normalizedName(thisLevel)));
const notOnThisLevel = (c) => !isOnThisLevel(c);
const isInSubfolder = (subfolder, c) =>
normalizedName(c.name).startsWith(
fp_56("/")(
joinPath([thisLevel, subfolder])));
const lastPartOfName = (c) =>
fp_12(c.name.split("/"));
const subFolder = (c) => {
const cname = normalizedName(c.name);
const folderName = cname.substring(thisLevel.length, cname.length).split("/")[0];
return ({
name: folderName,
isExpanded: fp_11(folderName)(expandedFolders),
path: thisLevel + "/" + folderName
});
};
const subComponents = (subfolder) => pipe$1(components, [
fp_8(c => isInSubfolder(subfolder, c))
]);
const expandFolder = folder => {
const expandedFolder = {...folder};
if(expandedFolder.isExpanded) {
expandedFolder.isExpanded = false;
expandedFolders = fp_8(f => f.name !== folder.name)(expandedFolders);
} else {
expandedFolder.isExpanded = true;
expandedFolders.push(folder.name);
}
const newFolders = [...subfolders];
newFolders.splice(
newFolders.indexOf(folder),
1,
expandedFolder);
$$invalidate('subfolders', subfolders = newFolders);
};
const isComponentSelected = (type, current,c) =>
type==="component"
&& current
&& current.name === c.name;
const writable_props = ['components', 'thisLevel'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ComponentsHierarchy> was created with unknown prop '${key}'`);
});
const click_handler = ({ folder }) => expandFolder(folder);
const click_handler_1 = ({ component }) => store.setCurrentComponent(component.component.name);
$$self.$set = $$props => {
if ('components' in $$props) $$invalidate('components', components = $$props.components);
if ('thisLevel' in $$props) $$invalidate('thisLevel', thisLevel = $$props.thisLevel);
};
$$self.$capture_state = () => {
return { components, thisLevel, pathPartsThisLevel, componentsThisLevel, subfolders, expandedFolders, $store };
};
$$self.$inject_state = $$props => {
if ('components' in $$props) $$invalidate('components', components = $$props.components);
if ('thisLevel' in $$props) $$invalidate('thisLevel', thisLevel = $$props.thisLevel);
if ('pathPartsThisLevel' in $$props) $$invalidate('pathPartsThisLevel', pathPartsThisLevel = $$props.pathPartsThisLevel);
if ('componentsThisLevel' in $$props) $$invalidate('componentsThisLevel', componentsThisLevel = $$props.componentsThisLevel);
if ('subfolders' in $$props) $$invalidate('subfolders', subfolders = $$props.subfolders);
if ('expandedFolders' in $$props) expandedFolders = $$props.expandedFolders;
if ('$store' in $$props) store.set($store);
};
$$self.$$.update = ($$dirty = { thisLevel: 1, components: 1 }) => {
if ($$dirty.thisLevel || $$dirty.components) { {
$$invalidate('pathPartsThisLevel', pathPartsThisLevel = !thisLevel
? 1
: normalizedName(thisLevel).split("/").length + 1);
$$invalidate('componentsThisLevel', componentsThisLevel =
pipe$1(components, [
fp_8(isOnThisLevel),
fp_7(c => ({component:c, title:lastPartOfName(c)})),
fp_52("title")
]));
$$invalidate('subfolders', subfolders =
pipe$1(components, [
fp_8(notOnThisLevel),
fp_52("name"),
fp_7(subFolder),
fp_45((f1,f2) => f1.path === f2.path)
]));
} }
};
return {
components,
thisLevel,
pathPartsThisLevel,
componentsThisLevel,
subfolders,
isInSubfolder,
subComponents,
expandFolder,
isComponentSelected,
$store,
click_handler,
click_handler_1
};
}
class ComponentsHierarchy extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$3, create_fragment$3, safe_not_equal, ["components", "thisLevel"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ComponentsHierarchy", options, id: create_fragment$3.name });
}
get components() {
throw new Error("<ComponentsHierarchy>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set components(value) {
throw new Error("<ComponentsHierarchy>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get thisLevel() {
throw new Error("<ComponentsHierarchy>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set thisLevel(value) {
throw new Error("<ComponentsHierarchy>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\PagesList.svelte generated by Svelte v3.12.1 */
const file$5 = "src\\userInterface\\PagesList.svelte";
function create_fragment$4(ctx) {
var div2, div0, span0, raw0_value = getIcon("circle", "7") + "", t0, span1, t2, div1, span2, raw1_value = getIcon("circle", "7") + "", t3, span3, dispose;
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
span0 = element("span");
t0 = space();
span1 = element("span");
span1.textContent = "Main";
t2 = space();
div1 = element("div");
span2 = element("span");
t3 = space();
span3 = element("span");
span3.textContent = "Login";
add_location(span0, file$5, 14, 8, 431);
attr_dev(span1, "class", "title svelte-117bbrk");
add_location(span1, file$5, 15, 8, 483);
attr_dev(div0, "class", "hierarchy-item component svelte-117bbrk");
toggle_class(div0, "selected", ctx.$store.currentFrontEndType === "page" && ctx.$store.currentPageName === "main");
add_location(div0, file$5, 12, 4, 218);
add_location(span2, file$5, 20, 8, 766);
attr_dev(span3, "class", "title svelte-117bbrk");
add_location(span3, file$5, 21, 8, 818);
attr_dev(div1, "class", "hierarchy-item component svelte-117bbrk");
toggle_class(div1, "selected", ctx.$store.currentFrontEndType === "page" && ctx.$store.currentPageName === "unauthenticated");
add_location(div1, file$5, 18, 4, 531);
attr_dev(div2, "class", "root svelte-117bbrk");
add_location(div2, file$5, 11, 0, 195);
dispose = [
listen_dev(div0, "click", stop_propagation(ctx.click_handler), false, false, true),
listen_dev(div1, "click", stop_propagation(ctx.click_handler_1), false, false, true)
];
},
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, span0);
span0.innerHTML = raw0_value;
append_dev(div0, t0);
append_dev(div0, span1);
append_dev(div2, t2);
append_dev(div2, div1);
append_dev(div1, span2);
span2.innerHTML = raw1_value;
append_dev(div1, t3);
append_dev(div1, span3);
},
p: function update(changed, ctx) {
if (changed.$store) {
toggle_class(div0, "selected", ctx.$store.currentFrontEndType === "page" && ctx.$store.currentPageName === "main");
toggle_class(div1, "selected", ctx.$store.currentFrontEndType === "page" && ctx.$store.currentPageName === "unauthenticated");
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$4.name, type: "component", source: "", ctx });
return block;
}
function instance$4($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
const click_handler = () => store.setCurrentPage("main");
const click_handler_1 = () => store.setCurrentPage("unauthenticated");
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('$store' in $$props) store.set($store);
};
return { $store, click_handler, click_handler_1 };
}
class PagesList extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$4, create_fragment$4, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PagesList", options, id: create_fragment$4.name });
}
}
/* src\common\Checkbox.svelte generated by Svelte v3.12.1 */
const file$6 = "src\\common\\Checkbox.svelte";
function create_fragment$5(ctx) {
var input, t, dispose;
const block = {
c: function create() {
input = element("input");
t = text(ctx.label);
attr_dev(input, "class", "uk-checkbox svelte-9fre0g");
attr_dev(input, "type", "checkbox");
add_location(input, file$6, 7, 0, 69);
dispose = [
listen_dev(input, "change", ctx.input_change_handler),
listen_dev(input, "change", ctx.change_handler)
];
},
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, input, anchor);
input.checked = ctx.checked;
insert_dev(target, t, anchor);
},
p: function update(changed, ctx) {
if (changed.checked) input.checked = ctx.checked;
if (changed.label) {
set_data_dev(t, ctx.label);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(input);
detach_dev(t);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$5.name, type: "component", source: "", ctx });
return block;
}
function instance$5($$self, $$props, $$invalidate) {
let { checked=false, label="" } = $$props;
const writable_props = ['checked', 'label'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Checkbox> was created with unknown prop '${key}'`);
});
function change_handler(event) {
bubble($$self, event);
}
function input_change_handler() {
checked = this.checked;
$$invalidate('checked', checked);
}
$$self.$set = $$props => {
if ('checked' in $$props) $$invalidate('checked', checked = $$props.checked);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
$$self.$capture_state = () => {
return { checked, label };
};
$$self.$inject_state = $$props => {
if ('checked' in $$props) $$invalidate('checked', checked = $$props.checked);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
return {
checked,
label,
change_handler,
input_change_handler
};
}
class Checkbox extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$5, create_fragment$5, safe_not_equal, ["checked", "label"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Checkbox", options, id: create_fragment$5.name });
}
get checked() {
throw new Error("<Checkbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set checked(value) {
throw new Error("<Checkbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<Checkbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<Checkbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\Textbox.svelte generated by Svelte v3.12.1 */
const file$7 = "src\\common\\Textbox.svelte";
// (21:4) {#if infoText}
function create_if_block$1(ctx) {
var div, t;
const block = {
c: function create() {
div = element("div");
t = text(ctx.infoText);
attr_dev(div, "class", "info-text svelte-1gx0gkl");
add_location(div, file$7, 21, 4, 582);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t);
},
p: function update(changed, ctx) {
if (changed.infoText) {
set_data_dev(t, ctx.infoText);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$1.name, type: "if", source: "(21:4) {#if infoText}", ctx });
return block;
}
function create_fragment$6(ctx) {
var div1, label_1, t0, t1, div0, input, input_class_value, t2, dispose;
var if_block = (ctx.infoText) && create_if_block$1(ctx);
const block = {
c: function create() {
div1 = element("div");
label_1 = element("label");
t0 = text(ctx.label);
t1 = space();
div0 = element("div");
input = element("input");
t2 = space();
if (if_block) if_block.c();
attr_dev(label_1, "class", "uk-form-label");
add_location(label_1, file$7, 12, 4, 266);
attr_dev(input, "class", input_class_value = "uk-input uk-form-width-" + ctx.width + " uk-form-" + ctx.size + " svelte-1gx0gkl");
input.disabled = ctx.disabled;
toggle_class(input, "uk-form-danger", ctx.hasError);
add_location(input, file$7, 14, 8, 354);
attr_dev(div0, "class", "uk-form-controls");
add_location(div0, file$7, 13, 4, 315);
toggle_class(div1, "uk-margin", ctx.margin);
add_location(div1, file$7, 11, 0, 231);
dispose = [
listen_dev(input, "input", ctx.input_input_handler),
listen_dev(input, "change", ctx.change_handler)
];
},
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, label_1);
append_dev(label_1, t0);
append_dev(div1, t1);
append_dev(div1, div0);
append_dev(div0, input);
set_input_value(input, ctx.text);
append_dev(div1, t2);
if (if_block) if_block.m(div1, null);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if (changed.text && (input.value !== ctx.text)) set_input_value(input, ctx.text);
if ((changed.width || changed.size) && input_class_value !== (input_class_value = "uk-input uk-form-width-" + ctx.width + " uk-form-" + ctx.size + " svelte-1gx0gkl")) {
attr_dev(input, "class", input_class_value);
}
if (changed.disabled) {
prop_dev(input, "disabled", ctx.disabled);
}
if ((changed.width || changed.size || changed.hasError)) {
toggle_class(input, "uk-form-danger", ctx.hasError);
}
if (ctx.infoText) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$1(ctx);
if_block.c();
if_block.m(div1, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (changed.margin) {
toggle_class(div1, "uk-margin", ctx.margin);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
if (if_block) if_block.d();
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$6.name, type: "component", source: "", ctx });
return block;
}
function instance$6($$self, $$props, $$invalidate) {
let { text = "", label = "", width = "medium", size = "small", margin = true, infoText = "", hasError = false, disabled = false } = $$props;
const writable_props = ['text', 'label', 'width', 'size', 'margin', 'infoText', 'hasError', 'disabled'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Textbox> was created with unknown prop '${key}'`);
});
function change_handler(event) {
bubble($$self, event);
}
function input_input_handler() {
text = this.value;
$$invalidate('text', text);
}
$$self.$set = $$props => {
if ('text' in $$props) $$invalidate('text', text = $$props.text);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
if ('margin' in $$props) $$invalidate('margin', margin = $$props.margin);
if ('infoText' in $$props) $$invalidate('infoText', infoText = $$props.infoText);
if ('hasError' in $$props) $$invalidate('hasError', hasError = $$props.hasError);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
};
$$self.$capture_state = () => {
return { text, label, width, size, margin, infoText, hasError, disabled };
};
$$self.$inject_state = $$props => {
if ('text' in $$props) $$invalidate('text', text = $$props.text);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
if ('margin' in $$props) $$invalidate('margin', margin = $$props.margin);
if ('infoText' in $$props) $$invalidate('infoText', infoText = $$props.infoText);
if ('hasError' in $$props) $$invalidate('hasError', hasError = $$props.hasError);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
};
return {
text,
label,
width,
size,
margin,
infoText,
hasError,
disabled,
change_handler,
input_input_handler
};
}
class Textbox extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$6, create_fragment$6, safe_not_equal, ["text", "label", "width", "size", "margin", "infoText", "hasError", "disabled"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Textbox", options, id: create_fragment$6.name });
}
get text() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set text(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get width() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set width(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get size() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set size(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get margin() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set margin(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get infoText() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set infoText(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get hasError() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set hasError(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get disabled() {
throw new Error("<Textbox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set disabled(value) {
throw new Error("<Textbox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\Dropdown.svelte generated by Svelte v3.12.1 */
const file$8 = "src\\common\\Dropdown.svelte";
function get_each_context_1$1(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.option = list[i];
return child_ctx;
}
function get_each_context$2(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.option = list[i];
return child_ctx;
}
// (30:8) {:else}
function create_else_block(ctx) {
var select, select_class_value, dispose;
let each_value_1 = ctx.options;
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 block = {
c: function create() {
select = element("select");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
if (ctx.selected === void 0) add_render_callback(() => ctx.select_change_handler_1.call(select));
attr_dev(select, "class", select_class_value = "uk-select uk-form-width-" + ctx.width + " uk-form-" + ctx.size);
add_location(select, file$8, 31, 8, 781);
dispose = [
listen_dev(select, "change", ctx.select_change_handler_1),
listen_dev(select, "change", ctx.change_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, select, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(select, null);
}
select_option(select, ctx.selected);
},
p: function update(changed, ctx) {
if (changed.valueMember || changed.options || changed.textMember) {
each_value_1 = ctx.options;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block_1$1(child_ctx);
each_blocks[i].c();
each_blocks[i].m(select, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
if (changed.selected) select_option(select, ctx.selected);
if ((changed.width || changed.size) && select_class_value !== (select_class_value = "uk-select uk-form-width-" + ctx.width + " uk-form-" + ctx.size)) {
attr_dev(select, "class", select_class_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(select);
}
destroy_each(each_blocks, detaching);
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block.name, type: "else", source: "(30:8) {:else}", ctx });
return block;
}
// (22:8) {#if multiple}
function create_if_block$2(ctx) {
var select, select_class_value, dispose;
let each_value = ctx.options;
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 block = {
c: function create() {
select = element("select");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
if (ctx.selected === void 0) add_render_callback(() => ctx.select_change_handler.call(select));
attr_dev(select, "class", select_class_value = "uk-select uk-form-width-" + ctx.width + " uk-form-" + ctx.size);
select.multiple = true;
add_location(select, file$8, 23, 8, 449);
dispose = [
listen_dev(select, "change", ctx.select_change_handler),
listen_dev(select, "change", ctx.change_handler)
];
},
m: function mount(target, anchor) {
insert_dev(target, select, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(select, null);
}
select_options(select, ctx.selected);
},
p: function update(changed, ctx) {
if (changed.valueMember || changed.options || changed.textMember) {
each_value = ctx.options;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(select, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
if (changed.selected) select_options(select, ctx.selected);
if ((changed.width || changed.size) && select_class_value !== (select_class_value = "uk-select uk-form-width-" + ctx.width + " uk-form-" + ctx.size)) {
attr_dev(select, "class", select_class_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(select);
}
destroy_each(each_blocks, detaching);
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$2.name, type: "if", source: "(22:8) {#if multiple}", ctx });
return block;
}
// (33:12) {#each options as option}
function create_each_block_1$1(ctx) {
var option, t_value = !ctx.textMember ? ctx.option : ctx.textMember(ctx.option) + "", t, option_value_value;
const block = {
c: function create() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = !ctx.valueMember ? ctx.option : ctx.valueMember(ctx.option);
option.value = option.__value;
add_location(option, file$8, 33, 12, 927);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t);
},
p: function update(changed, ctx) {
if ((changed.textMember || changed.options) && t_value !== (t_value = !ctx.textMember ? ctx.option : ctx.textMember(ctx.option) + "")) {
set_data_dev(t, t_value);
}
if ((changed.valueMember || changed.options) && option_value_value !== (option_value_value = !ctx.valueMember ? ctx.option : ctx.valueMember(ctx.option))) {
prop_dev(option, "__value", option_value_value);
}
option.value = option.__value;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(option);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$1.name, type: "each", source: "(33:12) {#each options as option}", ctx });
return block;
}
// (25:12) {#each options as option}
function create_each_block$2(ctx) {
var option, t_value = !ctx.textMember ? ctx.option : ctx.textMember(ctx.option) + "", t, option_value_value;
const block = {
c: function create() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = !ctx.valueMember ? ctx.option : ctx.valueMember(ctx.option);
option.value = option.__value;
add_location(option, file$8, 25, 12, 604);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t);
},
p: function update(changed, ctx) {
if ((changed.textMember || changed.options) && t_value !== (t_value = !ctx.textMember ? ctx.option : ctx.textMember(ctx.option) + "")) {
set_data_dev(t, t_value);
}
if ((changed.valueMember || changed.options) && option_value_value !== (option_value_value = !ctx.valueMember ? ctx.option : ctx.valueMember(ctx.option))) {
prop_dev(option, "__value", option_value_value);
}
option.value = option.__value;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(option);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$2.name, type: "each", source: "(25:12) {#each options as option}", ctx });
return block;
}
function create_fragment$7(ctx) {
var div1, label_1, t0, t1, div0;
function select_block_type(changed, ctx) {
if (ctx.multiple) return create_if_block$2;
return create_else_block;
}
var current_block_type = select_block_type(null, ctx);
var if_block = current_block_type(ctx);
const block = {
c: function create() {
div1 = element("div");
label_1 = element("label");
t0 = text(ctx.label);
t1 = space();
div0 = element("div");
if_block.c();
attr_dev(label_1, "class", "uk-form-label");
add_location(label_1, file$8, 19, 4, 329);
attr_dev(div0, "class", "uk-form-controls");
add_location(div0, file$8, 20, 4, 378);
attr_dev(div1, "class", "uk-margin");
add_location(div1, file$8, 18, 0, 301);
},
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, label_1);
append_dev(label_1, t0);
append_dev(div1, t1);
append_dev(div1, div0);
if_block.m(div0, null);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if (current_block_type === (current_block_type = select_block_type(changed, ctx)) && if_block) {
if_block.p(changed, ctx);
} else {
if_block.d(1);
if_block = current_block_type(ctx);
if (if_block) {
if_block.c();
if_block.m(div0, null);
}
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
if_block.d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$7.name, type: "component", source: "", ctx });
return block;
}
function instance$7($$self, $$props, $$invalidate) {
let { selected, label, options, valueMember, textMember, multiple=false, width = "medium", size = "small" } = $$props;
const writable_props = ['selected', 'label', 'options', 'valueMember', 'textMember', 'multiple', 'width', 'size'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Dropdown> was created with unknown prop '${key}'`);
});
function change_handler(event) {
bubble($$self, event);
}
function change_handler_1(event) {
bubble($$self, event);
}
function select_change_handler() {
selected = select_multiple_value(this);
$$invalidate('selected', selected);
$$invalidate('valueMember', valueMember);
$$invalidate('options', options);
}
function select_change_handler_1() {
selected = select_value(this);
$$invalidate('selected', selected);
$$invalidate('valueMember', valueMember);
$$invalidate('options', options);
}
$$self.$set = $$props => {
if ('selected' in $$props) $$invalidate('selected', selected = $$props.selected);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('options' in $$props) $$invalidate('options', options = $$props.options);
if ('valueMember' in $$props) $$invalidate('valueMember', valueMember = $$props.valueMember);
if ('textMember' in $$props) $$invalidate('textMember', textMember = $$props.textMember);
if ('multiple' in $$props) $$invalidate('multiple', multiple = $$props.multiple);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
};
$$self.$capture_state = () => {
return { selected, label, options, valueMember, textMember, multiple, width, size };
};
$$self.$inject_state = $$props => {
if ('selected' in $$props) $$invalidate('selected', selected = $$props.selected);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('options' in $$props) $$invalidate('options', options = $$props.options);
if ('valueMember' in $$props) $$invalidate('valueMember', valueMember = $$props.valueMember);
if ('textMember' in $$props) $$invalidate('textMember', textMember = $$props.textMember);
if ('multiple' in $$props) $$invalidate('multiple', multiple = $$props.multiple);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
};
return {
selected,
label,
options,
valueMember,
textMember,
multiple,
width,
size,
change_handler,
change_handler_1,
select_change_handler,
select_change_handler_1
};
}
class Dropdown extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$7, create_fragment$7, safe_not_equal, ["selected", "label", "options", "valueMember", "textMember", "multiple", "width", "size"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Dropdown", options, id: create_fragment$7.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.selected === undefined && !('selected' in props)) {
console.warn("<Dropdown> was created without expected prop 'selected'");
}
if (ctx.label === undefined && !('label' in props)) {
console.warn("<Dropdown> was created without expected prop 'label'");
}
if (ctx.options === undefined && !('options' in props)) {
console.warn("<Dropdown> was created without expected prop 'options'");
}
if (ctx.valueMember === undefined && !('valueMember' in props)) {
console.warn("<Dropdown> was created without expected prop 'valueMember'");
}
if (ctx.textMember === undefined && !('textMember' in props)) {
console.warn("<Dropdown> was created without expected prop 'textMember'");
}
}
get selected() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set selected(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get options() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set options(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get valueMember() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set valueMember(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get textMember() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set textMember(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get multiple() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set multiple(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get width() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set width(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get size() {
throw new Error("<Dropdown>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set size(value) {
throw new Error("<Dropdown>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
var performance$1 = global$1.performance || {};
var performanceNow =
performance$1.now ||
performance$1.mozNow ||
performance$1.msNow ||
performance$1.oNow ||
performance$1.webkitNow ||
function(){ return (new Date()).getTime() };
function isString(arg) {
return typeof arg === 'string';
}
const isBinding = value =>
!fp_23(value)
&& value
&& fp_23(value[BB_STATE_BINDINGPATH])
&& value[BB_STATE_BINDINGPATH].length > 0;
const setBinding = ({path, fallback, source}, binding={} ) => {
if(isNonEmptyString$1(path)) binding[BB_STATE_BINDINGPATH] = path;
if(isNonEmptyString$1(fallback)) binding[BB_STATE_FALLBACK] = fallback;
binding[BB_STATE_BINDINGSOURCE] = source || "store";
return binding
};
const getBinding = binding => ({
path: binding[BB_STATE_BINDINGPATH] || "",
fallback: binding[BB_STATE_FALLBACK] || "",
source: binding[BB_STATE_BINDINGSOURCE] || "store"
});
const isNonEmptyString$1 = s => fp_23(s) && s.length > 0;
const makeError = (errors, propName, stack) => (message) =>
errors.push({
stack,
propName,
error:message});
const expandPropDef = propDef => {
const p = isString(propDef)
? types[propDef].defaultDefinition()
: propDef;
if(p.type === "array" && isString(p.elementDefinition)) {
p.elementDefinition = types[p.elementDefinition].defaultDefinition();
}
return p;
};
const validateProps = (propsDefinition, props, stack=[], isFinal=true, isArrayElement=false) => {
const errors = [];
if(isFinal && !props._component && !isArrayElement) {
makeError(errors, "_component", stack)("Component is not set");
return errors;
// this would break everything else anyway
}
for(let propDefName in propsDefinition) {
if(propDefName === "_component") continue;
const propDef = expandPropDef(propsDefinition[propDefName]);
const type = types[propDef.type];
const error = makeError(errors, propDefName, stack);
const propValue = props[propDefName];
// component declarations dont need to define al props.
if(!isFinal && fp_3(propValue)) continue;
if(isFinal && propDef.required && propValue) {
error(`Property ${propDefName} is required`);
continue;
}
if(isBinding(propValue)) {
if(propDef.type === "array"
|| propDef.type === "component"
|| propDef.type === "event") {
error(`Cannot apply binding to type ${propDef.type}`);
continue;
}
}
else if(!type.isOfType(propValue)) {
error(`Property ${propDefName} is not of type ${propDef.type}. Actual value ${propValue}`);
continue;
}
if(propDef.type === "array") {
let index = 0;
for(let arrayItem of propValue) {
const arrayErrs = validateProps(
propDef.elementDefinition,
arrayItem,
[...stack, `${propDefName}[${index}]`],
isFinal,
true
);
for(let arrErr of arrayErrs) {
errors.push(arrErr);
}
index++;
}
}
if(propDef.type === "options"
&& propValue
&& !isBinding(propValue)
&& !fp_11(propValue)(propDef.options)) {
error(`Property ${propDefName} is not one of allowed options. Acutal value is ${propValue}`);
}
}
return errors;
};
const splitName = fullname => {
const componentName = pipe$1(fullname, [
fp_5("/"),
fp_12
]);
const libName =fullname.substring(
0, fullname.length - componentName.length - 1);
return {libName, componentName};
};
/* src\userInterface\ComponentSelector.svelte generated by Svelte v3.12.1 */
const file$9 = "src\\userInterface\\ComponentSelector.svelte";
function get_each_context$3(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.component = list[i];
return child_ctx;
}
function get_each_context_2(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.component = list[i];
return child_ctx;
}
function get_each_context_3(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.generator = list[i];
return child_ctx;
}
function get_each_context_1$2(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.lib = list[i];
return child_ctx;
}
// (81:4) {#if allowGenerators}
function create_if_block$3(ctx) {
var div, t_1, each_1_anchor;
let each_value_3 = ctx.lib.generators;
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 block = {
c: function create() {
div = element("div");
div.textContent = "Generators";
t_1 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
each_1_anchor = empty();
attr_dev(div, "class", "inner-header svelte-chhyel");
add_location(div, file$9, 81, 4, 1767);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
insert_dev(target, t_1, 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(changed, ctx) {
if (changed.componentLibraries || changed.splitName) {
each_value_3 = ctx.lib.generators;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block_3(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_3.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t_1);
}
destroy_each(each_blocks, detaching);
if (detaching) {
detach_dev(each_1_anchor);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$3.name, type: "if", source: "(81:4) {#if allowGenerators}", ctx });
return block;
}
// (86:4) {#each lib.generators as generator}
function create_each_block_3(ctx) {
var div2, div0, t0_value = splitName(ctx.generator.name).componentName + "", t0, t1, div1, t2_value = ctx.generator.description + "", t2, t3, dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
t2 = text(t2_value);
t3 = space();
attr_dev(div0, "class", "name svelte-chhyel");
add_location(div0, file$9, 89, 8, 1965);
attr_dev(div1, "class", "description svelte-chhyel");
add_location(div1, file$9, 92, 8, 2064);
attr_dev(div2, "class", "component svelte-chhyel");
add_location(div2, file$9, 87, 4, 1876);
dispose = listen_dev(div2, "click", click_handler);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div0, t0);
append_dev(div2, t1);
append_dev(div2, div1);
append_dev(div1, t2);
append_dev(div2, t3);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.componentLibraries) && t0_value !== (t0_value = splitName(ctx.generator.name).componentName + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.componentLibraries) && t2_value !== (t2_value = ctx.generator.description + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_3.name, type: "each", source: "(86:4) {#each lib.generators as generator}", ctx });
return block;
}
// (105:4) {#each lib.components as component}
function create_each_block_2(ctx) {
var div2, div0, t0_value = splitName(ctx.component.name).componentName + "", t0, t1, div1, t2_value = ctx.component.description + "", t2, dispose;
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
t2 = text(t2_value);
attr_dev(div0, "class", "name svelte-chhyel");
add_location(div0, file$9, 108, 8, 2386);
attr_dev(div1, "class", "description svelte-chhyel");
add_location(div1, file$9, 111, 8, 2485);
attr_dev(div2, "class", "component svelte-chhyel");
add_location(div2, file$9, 106, 4, 2297);
dispose = listen_dev(div2, "click", click_handler_1);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div0, t0);
append_dev(div2, t1);
append_dev(div2, div1);
append_dev(div1, t2);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.componentLibraries) && t0_value !== (t0_value = splitName(ctx.component.name).componentName + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.componentLibraries) && t2_value !== (t2_value = ctx.component.description + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_2.name, type: "each", source: "(105:4) {#each lib.components as component}", ctx });
return block;
}
// (74:0) {#each componentLibraries as lib}
function create_each_block_1$2(ctx) {
var div0, t0_value = ctx.lib.libName + "", t0, t1, div2, t2, div1, t4;
var if_block = (ctx.allowGenerators) && create_if_block$3(ctx);
let each_value_2 = ctx.lib.components;
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 block = {
c: function create() {
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div2 = element("div");
if (if_block) if_block.c();
t2 = space();
div1 = element("div");
div1.textContent = "Components";
t4 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div0, "class", "library-header svelte-chhyel");
add_location(div0, file$9, 74, 0, 1642);
attr_dev(div1, "class", "inner-header svelte-chhyel");
add_location(div1, file$9, 100, 4, 2188);
attr_dev(div2, "class", "library-container svelte-chhyel");
add_location(div2, file$9, 78, 0, 1701);
},
m: function mount(target, anchor) {
insert_dev(target, div0, anchor);
append_dev(div0, t0);
insert_dev(target, t1, anchor);
insert_dev(target, div2, anchor);
if (if_block) if_block.m(div2, null);
append_dev(div2, t2);
append_dev(div2, div1);
append_dev(div2, t4);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div2, null);
}
},
p: function update(changed, ctx) {
if ((changed.componentLibraries) && t0_value !== (t0_value = ctx.lib.libName + "")) {
set_data_dev(t0, t0_value);
}
if (ctx.allowGenerators) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$3(ctx);
if_block.c();
if_block.m(div2, t2);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (changed.componentLibraries || changed.splitName) {
each_value_2 = ctx.lib.components;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block_2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div2, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_2.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div0);
detach_dev(t1);
detach_dev(div2);
}
if (if_block) if_block.d();
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$2.name, type: "each", source: "(74:0) {#each componentLibraries as lib}", ctx });
return block;
}
// (130:4) {#each derivedComponents as component}
function create_each_block$3(ctx) {
var div2, div0, t0_value = ctx.component.name + "", t0, t1, div1, t2_value = ctx.component.description + "", t2, t3, dispose;
function click_handler_2() {
return ctx.click_handler_2(ctx);
}
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
t2 = text(t2_value);
t3 = space();
attr_dev(div0, "class", "name svelte-chhyel");
add_location(div0, file$9, 133, 8, 2850);
attr_dev(div1, "class", "description svelte-chhyel");
add_location(div1, file$9, 136, 8, 2924);
attr_dev(div2, "class", "component svelte-chhyel");
add_location(div2, file$9, 131, 4, 2761);
dispose = listen_dev(div2, "click", click_handler_2);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div0, t0);
append_dev(div2, t1);
append_dev(div2, div1);
append_dev(div1, t2);
append_dev(div2, t3);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.derivedComponents) && t0_value !== (t0_value = ctx.component.name + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.derivedComponents) && t2_value !== (t2_value = ctx.component.description + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$3.name, type: "each", source: "(130:4) {#each derivedComponents as component}", ctx });
return block;
}
function create_fragment$8(ctx) {
var t0, div0, t2, div1;
let each_value_1 = ctx.componentLibraries;
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_1$2(get_each_context_1$2(ctx, each_value_1, i));
}
let each_value = ctx.derivedComponents;
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 block = {
c: function create() {
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t0 = space();
div0 = element("div");
div0.textContent = "My Components";
t2 = space();
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div0, "class", "library-header svelte-chhyel");
add_location(div0, file$9, 123, 0, 2617);
attr_dev(div1, "class", "library-container svelte-chhyel");
add_location(div1, file$9, 127, 0, 2676);
},
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) {
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].m(target, anchor);
}
insert_dev(target, t0, anchor);
insert_dev(target, div0, anchor);
insert_dev(target, t2, anchor);
insert_dev(target, div1, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
},
p: function update(changed, ctx) {
if (changed.componentLibraries || changed.splitName || changed.allowGenerators) {
each_value_1 = ctx.componentLibraries;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$2(ctx, each_value_1, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(changed, child_ctx);
} else {
each_blocks_1[i] = create_each_block_1$2(child_ctx);
each_blocks_1[i].c();
each_blocks_1[i].m(t0.parentNode, t0);
}
}
for (; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].d(1);
}
each_blocks_1.length = each_value_1.length;
}
if (changed.derivedComponents) {
each_value = ctx.derivedComponents;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$3(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;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
destroy_each(each_blocks_1, detaching);
if (detaching) {
detach_dev(t0);
detach_dev(div0);
detach_dev(t2);
detach_dev(div1);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$8.name, type: "component", source: "", ctx });
return block;
}
function instance$8($$self, $$props, $$invalidate) {
let { onComponentChosen, onGeneratorChosen, allowGenerators } = $$props;
let derivedComponents=[];
let componentLibraries=[];
const addRootComponent = (c, all, isGenerator) => {
const { libName } = splitName(c.name);
let group = fp_13(r => r.libName === libName)(all);
if(!group) {
group = {
libName,
components: [],
generators: []
};
all.push(group);
}
if(isGenerator) {
group.generators.push(c);
} else {
group.components.push(c);
}
};
store.subscribe(s => {
const newComponentLibraries = [];
const newDerivedComponents = [];
for(let comp of fp_52(["name"])(s.allComponents)) {
if(isRootComponent(comp)) {
addRootComponent(
comp,
newComponentLibraries,
false);
} else {
newDerivedComponents.push(comp);
}
}
for(let generator of s.generators) {
addRootComponent(
generator,
newComponentLibraries,
true);
}
$$invalidate('derivedComponents', derivedComponents = fp_52(["name"])(newDerivedComponents));
$$invalidate('componentLibraries', componentLibraries = newComponentLibraries);
});
const writable_props = ['onComponentChosen', 'onGeneratorChosen', 'allowGenerators'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ComponentSelector> was created with unknown prop '${key}'`);
});
const click_handler = ({ generator }) => onGeneratorChosen(generator);
const click_handler_1 = ({ component }) => onComponentChosen(component);
const click_handler_2 = ({ component }) => onComponentChosen(component);
$$self.$set = $$props => {
if ('onComponentChosen' in $$props) $$invalidate('onComponentChosen', onComponentChosen = $$props.onComponentChosen);
if ('onGeneratorChosen' in $$props) $$invalidate('onGeneratorChosen', onGeneratorChosen = $$props.onGeneratorChosen);
if ('allowGenerators' in $$props) $$invalidate('allowGenerators', allowGenerators = $$props.allowGenerators);
};
$$self.$capture_state = () => {
return { onComponentChosen, onGeneratorChosen, allowGenerators, derivedComponents, componentLibraries };
};
$$self.$inject_state = $$props => {
if ('onComponentChosen' in $$props) $$invalidate('onComponentChosen', onComponentChosen = $$props.onComponentChosen);
if ('onGeneratorChosen' in $$props) $$invalidate('onGeneratorChosen', onGeneratorChosen = $$props.onGeneratorChosen);
if ('allowGenerators' in $$props) $$invalidate('allowGenerators', allowGenerators = $$props.allowGenerators);
if ('derivedComponents' in $$props) $$invalidate('derivedComponents', derivedComponents = $$props.derivedComponents);
if ('componentLibraries' in $$props) $$invalidate('componentLibraries', componentLibraries = $$props.componentLibraries);
};
return {
onComponentChosen,
onGeneratorChosen,
allowGenerators,
derivedComponents,
componentLibraries,
click_handler,
click_handler_1,
click_handler_2
};
}
class ComponentSelector extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$8, create_fragment$8, safe_not_equal, ["onComponentChosen", "onGeneratorChosen", "allowGenerators"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ComponentSelector", options, id: create_fragment$8.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.onComponentChosen === undefined && !('onComponentChosen' in props)) {
console.warn("<ComponentSelector> was created without expected prop 'onComponentChosen'");
}
if (ctx.onGeneratorChosen === undefined && !('onGeneratorChosen' in props)) {
console.warn("<ComponentSelector> was created without expected prop 'onGeneratorChosen'");
}
if (ctx.allowGenerators === undefined && !('allowGenerators' in props)) {
console.warn("<ComponentSelector> was created without expected prop 'allowGenerators'");
}
}
get onComponentChosen() {
throw new Error("<ComponentSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onComponentChosen(value) {
throw new Error("<ComponentSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onGeneratorChosen() {
throw new Error("<ComponentSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onGeneratorChosen(value) {
throw new Error("<ComponentSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allowGenerators() {
throw new Error("<ComponentSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allowGenerators(value) {
throw new Error("<ComponentSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\ButtonGroup.svelte generated by Svelte v3.12.1 */
const file$a = "src\\common\\ButtonGroup.svelte";
function create_fragment$9(ctx) {
var div, current;
const default_slot_template = ctx.$$slots.default;
const default_slot = create_slot(default_slot_template, ctx, null);
const block = {
c: function create() {
div = element("div");
if (default_slot) default_slot.c();
attr_dev(div, "class", "root svelte-x3bf9z");
attr_dev(div, "style", ctx.style);
add_location(div, file$a, 4, 0, 41);
},
l: function claim(nodes) {
if (default_slot) default_slot.l(div_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);
}
current = true;
},
p: function update(changed, ctx) {
if (default_slot && default_slot.p && changed.$$scope) {
default_slot.p(
get_slot_changes(default_slot_template, ctx, changed, null),
get_slot_context(default_slot_template, ctx, null)
);
}
if (!current || changed.style) {
attr_dev(div, "style", ctx.style);
}
},
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_fragment$9.name, type: "component", source: "", ctx });
return block;
}
function instance$9($$self, $$props, $$invalidate) {
let { style="" } = $$props;
const writable_props = ['style'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ButtonGroup> was created with unknown prop '${key}'`);
});
let { $$slots = {}, $$scope } = $$props;
$$self.$set = $$props => {
if ('style' in $$props) $$invalidate('style', style = $$props.style);
if ('$$scope' in $$props) $$invalidate('$$scope', $$scope = $$props.$$scope);
};
$$self.$capture_state = () => {
return { style };
};
$$self.$inject_state = $$props => {
if ('style' in $$props) $$invalidate('style', style = $$props.style);
};
return { style, $$slots, $$scope };
}
class ButtonGroup extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$9, create_fragment$9, safe_not_equal, ["style"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ButtonGroup", options, id: create_fragment$9.name });
}
get style() {
throw new Error("<ButtonGroup>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set style(value) {
throw new Error("<ButtonGroup>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
var uikit = createCommonjsModule(function (module, exports) {
/*! UIkit 3.2.0 | http://www.getuikit.com | (c) 2014 - 2019 YOOtheme | MIT License */
(function (global, factory) {
module.exports = factory() ;
}(commonjsGlobal, function () {
var objPrototype = Object.prototype;
var hasOwnProperty = objPrototype.hasOwnProperty;
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
}
var hyphenateCache = {};
var hyphenateRe = /([a-z\d])([A-Z])/g;
function hyphenate(str) {
if (!(str in hyphenateCache)) {
hyphenateCache[str] = str
.replace(hyphenateRe, '$1-$2')
.toLowerCase();
}
return hyphenateCache[str];
}
var camelizeRe = /-(\w)/g;
function camelize(str) {
return str.replace(camelizeRe, toUpper);
}
function toUpper(_, c) {
return c ? c.toUpperCase() : '';
}
function ucfirst(str) {
return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : '';
}
var strPrototype = String.prototype;
var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; };
function startsWith(str, search) {
return startsWithFn.call(str, search);
}
var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-search.length) === search; };
function endsWith(str, search) {
return endsWithFn.call(str, search);
}
var arrPrototype = Array.prototype;
var includesFn = function (search, i) { return ~this.indexOf(search, i); };
var includesStr = strPrototype.includes || includesFn;
var includesArray = arrPrototype.includes || includesFn;
function includes(obj, search) {
return obj && (isString(obj) ? includesStr : includesArray).call(obj, search);
}
var findIndexFn = arrPrototype.findIndex || function (predicate) {
var arguments$1 = arguments;
for (var i = 0; i < this.length; i++) {
if (predicate.call(arguments$1[1], this[i], i, this)) {
return i;
}
}
return -1;
};
function findIndex(array, predicate) {
return findIndexFn.call(array, predicate);
}
var isArray = Array.isArray;
function isFunction(obj) {
return typeof obj === 'function';
}
function isObject(obj) {
return obj !== null && typeof obj === 'object';
}
function isPlainObject(obj) {
return isObject(obj) && Object.getPrototypeOf(obj) === objPrototype;
}
function isWindow(obj) {
return isObject(obj) && obj === obj.window;
}
function isDocument(obj) {
return isObject(obj) && obj.nodeType === 9;
}
function isJQuery(obj) {
return isObject(obj) && !!obj.jquery;
}
function isNode(obj) {
return obj instanceof Node || isObject(obj) && obj.nodeType >= 1;
}
var toString = objPrototype.toString;
function isNodeCollection(obj) {
return toString.call(obj).match(/^\[object (NodeList|HTMLCollection)\]$/);
}
function isBoolean(value) {
return typeof value === 'boolean';
}
function isString(value) {
return typeof value === 'string';
}
function isNumber(value) {
return typeof value === 'number';
}
function isNumeric(value) {
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
}
function isEmpty(obj) {
return !(isArray(obj)
? obj.length
: isObject(obj)
? Object.keys(obj).length
: false
);
}
function isUndefined(value) {
return value === void 0;
}
function toBoolean(value) {
return isBoolean(value)
? value
: value === 'true' || value === '1' || value === ''
? true
: value === 'false' || value === '0'
? false
: value;
}
function toNumber(value) {
var number = Number(value);
return !isNaN(number) ? number : false;
}
function toFloat(value) {
return parseFloat(value) || 0;
}
function toNode(element) {
return isNode(element) || isWindow(element) || isDocument(element)
? element
: isNodeCollection(element) || isJQuery(element)
? element[0]
: isArray(element)
? toNode(element[0])
: null;
}
function toNodes(element) {
return isNode(element)
? [element]
: isNodeCollection(element)
? arrPrototype.slice.call(element)
: isArray(element)
? element.map(toNode).filter(Boolean)
: isJQuery(element)
? element.toArray()
: [];
}
function toList(value) {
return isArray(value)
? value
: isString(value)
? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value)
? toNumber(value)
: toBoolean(value.trim()); })
: [value];
}
function toMs(time) {
return !time
? 0
: endsWith(time, 'ms')
? toFloat(time)
: toFloat(time) * 1000;
}
function isEqual(value, other) {
return value === other
|| isObject(value)
&& isObject(other)
&& Object.keys(value).length === Object.keys(other).length
&& each(value, function (val, key) { return val === other[key]; });
}
function swap(value, a, b) {
return value.replace(new RegExp((a + "|" + b), 'mg'), function (match) {
return match === a ? b : a;
});
}
var assign = Object.assign || function (target) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
target = Object(target);
for (var i = 0; i < args.length; i++) {
var source = args[i];
if (source !== null) {
for (var key in source) {
if (hasOwn(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
function last(array) {
return array[array.length - 1];
}
function each(obj, cb) {
for (var key in obj) {
if (false === cb(obj[key], key)) {
return false;
}
}
return true;
}
function sortBy(array, prop) {
return array.sort(function (ref, ref$1) {
var propA = ref[prop]; if ( propA === void 0 ) propA = 0;
var propB = ref$1[prop]; if ( propB === void 0 ) propB = 0;
return propA > propB
? 1
: propB > propA
? -1
: 0;
}
);
}
function uniqueBy(array, prop) {
var seen = new Set();
return array.filter(function (ref) {
var check = ref[prop];
return seen.has(check)
? false
: seen.add(check) || true;
} // IE 11 does not return the Set object
);
}
function clamp(number, min, max) {
if ( min === void 0 ) min = 0;
if ( max === void 0 ) max = 1;
return Math.min(Math.max(toNumber(number) || 0, min), max);
}
function noop() {}
function intersectRect(r1, r2) {
return r1.left < r2.right &&
r1.right > r2.left &&
r1.top < r2.bottom &&
r1.bottom > r2.top;
}
function pointInRect(point, rect) {
return point.x <= rect.right &&
point.x >= rect.left &&
point.y <= rect.bottom &&
point.y >= rect.top;
}
var Dimensions = {
ratio: function(dimensions, prop, value) {
var obj;
var aProp = prop === 'width' ? 'height' : 'width';
return ( obj = {}, obj[aProp] = dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp], obj[prop] = value, obj );
},
contain: function(dimensions, maxDimensions) {
var this$1 = this;
dimensions = assign({}, dimensions);
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop]
? this$1.ratio(dimensions, prop, maxDimensions[prop])
: dimensions; }
);
return dimensions;
},
cover: function(dimensions, maxDimensions) {
var this$1 = this;
dimensions = this.contain(dimensions, maxDimensions);
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop]
? this$1.ratio(dimensions, prop, maxDimensions[prop])
: dimensions; }
);
return dimensions;
}
};
function attr(element, name, value) {
if (isObject(name)) {
for (var key in name) {
attr(element, key, name[key]);
}
return;
}
if (isUndefined(value)) {
element = toNode(element);
return element && element.getAttribute(name);
} else {
toNodes(element).forEach(function (element) {
if (isFunction(value)) {
value = value.call(element, attr(element, name));
}
if (value === null) {
removeAttr(element, name);
} else {
element.setAttribute(name, value);
}
});
}
}
function hasAttr(element, name) {
return toNodes(element).some(function (element) { return element.hasAttribute(name); });
}
function removeAttr(element, name) {
element = toNodes(element);
name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.hasAttribute(name) && element.removeAttribute(name); }
); }
);
}
function data(element, attribute) {
for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) {
if (hasAttr(element, attrs[i])) {
return attr(element, attrs[i]);
}
}
}
/* global DocumentTouch */
var isIE = /msie|trident/i.test(window.navigator.userAgent);
var isRtl = attr(document.documentElement, 'dir') === 'rtl';
var hasTouchEvents = 'ontouchstart' in window;
var hasPointerEvents = window.PointerEvent;
var hasTouch = hasTouchEvents
|| window.DocumentTouch && document instanceof DocumentTouch
|| navigator.maxTouchPoints; // IE >=11
var pointerDown = hasPointerEvents ? 'pointerdown' : hasTouchEvents ? 'touchstart' : 'mousedown';
var pointerMove = hasPointerEvents ? 'pointermove' : hasTouchEvents ? 'touchmove' : 'mousemove';
var pointerUp = hasPointerEvents ? 'pointerup' : hasTouchEvents ? 'touchend' : 'mouseup';
var pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouchEvents ? '' : 'mouseenter';
var pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouchEvents ? '' : 'mouseleave';
var pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
function query(selector, context) {
return toNode(selector) || find(selector, getContext(selector, context));
}
function queryAll(selector, context) {
var nodes = toNodes(selector);
return nodes.length && nodes || findAll(selector, getContext(selector, context));
}
function getContext(selector, context) {
if ( context === void 0 ) context = document;
return isContextSelector(selector) || isDocument(context)
? context
: context.ownerDocument;
}
function find(selector, context) {
return toNode(_query(selector, context, 'querySelector'));
}
function findAll(selector, context) {
return toNodes(_query(selector, context, 'querySelectorAll'));
}
function _query(selector, context, queryFn) {
if ( context === void 0 ) context = document;
if (!selector || !isString(selector)) {
return null;
}
selector = selector.replace(contextSanitizeRe, '$1 *');
var removes;
if (isContextSelector(selector)) {
removes = [];
selector = splitSelector(selector).map(function (selector, i) {
var ctx = context;
if (selector[0] === '!') {
var selectors = selector.substr(1).trim().split(' ');
ctx = closest(context.parentNode, selectors[0]);
selector = selectors.slice(1).join(' ').trim();
}
if (selector[0] === '-') {
var selectors$1 = selector.substr(1).trim().split(' ');
var prev = (ctx || context).previousElementSibling;
ctx = matches(prev, selector.substr(1)) ? prev : null;
selector = selectors$1.slice(1).join(' ');
}
if (!ctx) {
return null;
}
if (!ctx.id) {
ctx.id = "uk-" + (Date.now()) + i;
removes.push(function () { return removeAttr(ctx, 'id'); });
}
return ("#" + (escape(ctx.id)) + " " + selector);
}).filter(Boolean).join(',');
context = document;
}
try {
return context[queryFn](selector);
} catch (e) {
return null;
} finally {
removes && removes.forEach(function (remove) { return remove(); });
}
}
var contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
var contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
function isContextSelector(selector) {
return isString(selector) && selector.match(contextSelectorRe);
}
var selectorRe = /.*?[^\\](?:,|$)/g;
function splitSelector(selector) {
return selector.match(selectorRe).map(function (selector) { return selector.replace(/,$/, '').trim(); });
}
var elProto = Element.prototype;
var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector;
function matches(element, selector) {
return toNodes(element).some(function (element) { return matchesFn.call(element, selector); });
}
var closestFn = elProto.closest || function (selector) {
var ancestor = this;
do {
if (matches(ancestor, selector)) {
return ancestor;
}
ancestor = ancestor.parentNode;
} while (ancestor && ancestor.nodeType === 1);
};
function closest(element, selector) {
if (startsWith(selector, '>')) {
selector = selector.slice(1);
}
return isNode(element)
? closestFn.call(element, selector)
: toNodes(element).map(function (element) { return closest(element, selector); }).filter(Boolean);
}
function parents(element, selector) {
var elements = [];
element = toNode(element);
while ((element = element.parentNode) && element.nodeType === 1) {
if (matches(element, selector)) {
elements.push(element);
}
}
return elements;
}
var escapeFn = window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); };
function escape(css) {
return isString(css) ? escapeFn.call(null, css) : '';
}
var voidElements = {
area: true,
base: true,
br: true,
col: true,
embed: true,
hr: true,
img: true,
input: true,
keygen: true,
link: true,
menuitem: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
function isVoidElement(element) {
return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; });
}
function isVisible(element) {
return toNodes(element).some(function (element) { return element.offsetWidth || element.offsetHeight || element.getClientRects().length; });
}
var selInput = 'input,select,textarea,button';
function isInput(element) {
return toNodes(element).some(function (element) { return matches(element, selInput); });
}
function filter(element, selector) {
return toNodes(element).filter(function (element) { return matches(element, selector); });
}
function within(element, selector) {
return !isString(selector)
? element === selector || (isDocument(selector)
? selector.documentElement
: toNode(selector)).contains(toNode(element)) // IE 11 document does not implement contains
: matches(element, selector) || closest(element, selector);
}
function on() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var ref = getArgs(args);
var targets = ref[0];
var type = ref[1];
var selector = ref[2];
var listener = ref[3];
var useCapture = ref[4];
targets = toEventTargets(targets);
if (listener.length > 1) {
listener = detail(listener);
}
if (selector) {
listener = delegate(targets, selector, listener);
}
if (useCapture && useCapture.self) {
listener = selfFilter(listener);
}
useCapture = useCaptureFilter(useCapture);
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.addEventListener(type, listener, useCapture); }
); }
);
return function () { return off(targets, type, listener, useCapture); };
}
function off(targets, type, listener, useCapture) {
if ( useCapture === void 0 ) useCapture = false;
useCapture = useCaptureFilter(useCapture);
targets = toEventTargets(targets);
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.removeEventListener(type, listener, useCapture); }
); }
);
}
function once() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var ref = getArgs(args);
var element = ref[0];
var type = ref[1];
var selector = ref[2];
var listener = ref[3];
var useCapture = ref[4];
var condition = ref[5];
var off = on(element, type, selector, function (e) {
var result = !condition || condition(e);
if (result) {
off();
listener(e, result);
}
}, useCapture);
return off;
}
function trigger(targets, event, detail) {
return toEventTargets(targets).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); }
, true);
}
function createEvent(e, bubbles, cancelable, detail) {
if ( bubbles === void 0 ) bubbles = true;
if ( cancelable === void 0 ) cancelable = false;
if (isString(e)) {
var event = document.createEvent('CustomEvent'); // IE 11
event.initCustomEvent(e, bubbles, cancelable, detail);
e = event;
}
return e;
}
function getArgs(args) {
if (isFunction(args[2])) {
args.splice(2, 0, false);
}
return args;
}
function delegate(delegates, selector, listener) {
var this$1 = this;
return function (e) {
delegates.forEach(function (delegate) {
var current = selector[0] === '>'
? findAll(selector, delegate).reverse().filter(function (element) { return within(e.target, element); })[0]
: closest(e.target, selector);
if (current) {
e.delegate = delegate;
e.current = current;
listener.call(this$1, e);
}
});
};
}
function detail(listener) {
return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); };
}
function selfFilter(listener) {
return function (e) {
if (e.target === e.currentTarget || e.target === e.current) {
return listener.call(null, e);
}
};
}
function useCaptureFilter(options) {
return options && isIE && !isBoolean(options)
? !!options.capture
: options;
}
function isEventTarget(target) {
return target && 'addEventListener' in target;
}
function toEventTarget(target) {
return isEventTarget(target) ? target : toNode(target);
}
function toEventTargets(target) {
return isArray(target)
? target.map(toEventTarget).filter(Boolean)
: isString(target)
? findAll(target)
: isEventTarget(target)
? [target]
: toNodes(target);
}
function isTouch(e) {
return e.pointerType === 'touch' || !!e.touches;
}
function getEventPos(e, prop) {
if ( prop === void 0 ) prop = 'client';
var touches = e.touches;
var changedTouches = e.changedTouches;
var ref = touches && touches[0] || changedTouches && changedTouches[0] || e;
var x = ref[(prop + "X")];
var y = ref[(prop + "Y")];
return {x: x, y: y};
}
/* global setImmediate */
var Promise = 'Promise' in window ? window.Promise : PromiseFn;
var Deferred = function() {
var this$1 = this;
this.promise = new Promise(function (resolve, reject) {
this$1.reject = reject;
this$1.resolve = resolve;
});
};
/**
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
*/
var RESOLVED = 0;
var REJECTED = 1;
var PENDING = 2;
var async = 'setImmediate' in window ? setImmediate : setTimeout;
function PromiseFn(executor) {
this.state = PENDING;
this.value = undefined;
this.deferred = [];
var promise = this;
try {
executor(
function (x) {
promise.resolve(x);
},
function (r) {
promise.reject(r);
}
);
} catch (e) {
promise.reject(e);
}
}
PromiseFn.reject = function (r) {
return new PromiseFn(function (resolve, reject) {
reject(r);
});
};
PromiseFn.resolve = function (x) {
return new PromiseFn(function (resolve, reject) {
resolve(x);
});
};
PromiseFn.all = function all(iterable) {
return new PromiseFn(function (resolve, reject) {
var result = [];
var count = 0;
if (iterable.length === 0) {
resolve(result);
}
function resolver(i) {
return function (x) {
result[i] = x;
count += 1;
if (count === iterable.length) {
resolve(result);
}
};
}
for (var i = 0; i < iterable.length; i += 1) {
PromiseFn.resolve(iterable[i]).then(resolver(i), reject);
}
});
};
PromiseFn.race = function race(iterable) {
return new PromiseFn(function (resolve, reject) {
for (var i = 0; i < iterable.length; i += 1) {
PromiseFn.resolve(iterable[i]).then(resolve, reject);
}
});
};
var p = PromiseFn.prototype;
p.resolve = function resolve(x) {
var promise = this;
if (promise.state === PENDING) {
if (x === promise) {
throw new TypeError('Promise settled with itself.');
}
var called = false;
try {
var then = x && x.then;
if (x !== null && isObject(x) && isFunction(then)) {
then.call(
x,
function (x) {
if (!called) {
promise.resolve(x);
}
called = true;
},
function (r) {
if (!called) {
promise.reject(r);
}
called = true;
}
);
return;
}
} catch (e) {
if (!called) {
promise.reject(e);
}
return;
}
promise.state = RESOLVED;
promise.value = x;
promise.notify();
}
};
p.reject = function reject(reason) {
var promise = this;
if (promise.state === PENDING) {
if (reason === promise) {
throw new TypeError('Promise settled with itself.');
}
promise.state = REJECTED;
promise.value = reason;
promise.notify();
}
};
p.notify = function notify() {
var this$1 = this;
async(function () {
if (this$1.state !== PENDING) {
while (this$1.deferred.length) {
var ref = this$1.deferred.shift();
var onResolved = ref[0];
var onRejected = ref[1];
var resolve = ref[2];
var reject = ref[3];
try {
if (this$1.state === RESOLVED) {
if (isFunction(onResolved)) {
resolve(onResolved.call(undefined, this$1.value));
} else {
resolve(this$1.value);
}
} else if (this$1.state === REJECTED) {
if (isFunction(onRejected)) {
resolve(onRejected.call(undefined, this$1.value));
} else {
reject(this$1.value);
}
}
} catch (e) {
reject(e);
}
}
}
});
};
p.then = function then(onResolved, onRejected) {
var this$1 = this;
return new PromiseFn(function (resolve, reject) {
this$1.deferred.push([onResolved, onRejected, resolve, reject]);
this$1.notify();
});
};
p.catch = function (onRejected) {
return this.then(undefined, onRejected);
};
function ajax(url, options) {
return new Promise(function (resolve, reject) {
var env = assign({
data: null,
method: 'GET',
headers: {},
xhr: new XMLHttpRequest(),
beforeSend: noop,
responseType: ''
}, options);
env.beforeSend(env);
var xhr = env.xhr;
for (var prop in env) {
if (prop in xhr) {
try {
xhr[prop] = env[prop];
} catch (e) {}
}
}
xhr.open(env.method.toUpperCase(), url);
for (var header in env.headers) {
xhr.setRequestHeader(header, env.headers[header]);
}
on(xhr, 'load', function () {
if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
resolve(xhr);
} else {
reject(assign(Error(xhr.statusText), {
xhr: xhr,
status: xhr.status
}));
}
});
on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); });
on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); });
xhr.send(env.data);
});
}
function getImage(src, srcset, sizes) {
return new Promise(function (resolve, reject) {
var img = new Image();
img.onerror = reject;
img.onload = function () { return resolve(img); };
sizes && (img.sizes = sizes);
srcset && (img.srcset = srcset);
img.src = src;
});
}
function ready(fn) {
if (document.readyState !== 'loading') {
fn();
return;
}
var unbind = on(document, 'DOMContentLoaded', function () {
unbind();
fn();
});
}
function index(element, ref) {
return ref
? toNodes(element).indexOf(toNode(ref))
: toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element);
}
function getIndex(i, elements, current, finite) {
if ( current === void 0 ) current = 0;
if ( finite === void 0 ) finite = false;
elements = toNodes(elements);
var length = elements.length;
i = isNumeric(i)
? toNumber(i)
: i === 'next'
? current + 1
: i === 'previous'
? current - 1
: index(elements, i);
if (finite) {
return clamp(i, 0, length - 1);
}
i %= length;
return i < 0 ? i + length : i;
}
function empty(element) {
element = $(element);
element.innerHTML = '';
return element;
}
function html(parent, html) {
parent = $(parent);
return isUndefined(html)
? parent.innerHTML
: append(parent.hasChildNodes() ? empty(parent) : parent, html);
}
function prepend(parent, element) {
parent = $(parent);
if (!parent.hasChildNodes()) {
return append(parent, element);
} else {
return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); });
}
}
function append(parent, element) {
parent = $(parent);
return insertNodes(element, function (element) { return parent.appendChild(element); });
}
function before(ref, element) {
ref = $(ref);
return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); });
}
function after(ref, element) {
ref = $(ref);
return insertNodes(element, function (element) { return ref.nextSibling
? before(ref.nextSibling, element)
: append(ref.parentNode, element); }
);
}
function insertNodes(element, fn) {
element = isString(element) ? fragment(element) : element;
return element
? 'length' in element
? toNodes(element).map(fn)
: fn(element)
: null;
}
function remove(element) {
toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); });
}
function wrapAll(element, structure) {
structure = toNode(before(element, structure));
while (structure.firstChild) {
structure = structure.firstChild;
}
append(structure, element);
return structure;
}
function wrapInner(element, structure) {
return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); }
));
}
function unwrap(element) {
toNodes(element)
.map(function (element) { return element.parentNode; })
.filter(function (value, index, self) { return self.indexOf(value) === index; })
.forEach(function (parent) {
before(parent, parent.childNodes);
remove(parent);
});
}
var fragmentRe = /^\s*<(\w+|!)[^>]*>/;
var singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
function fragment(html) {
var matches = singleTagRe.exec(html);
if (matches) {
return document.createElement(matches[1]);
}
var container = document.createElement('div');
if (fragmentRe.test(html)) {
container.insertAdjacentHTML('beforeend', html.trim());
} else {
container.textContent = html;
}
return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
}
function apply(node, fn) {
if (!node || node.nodeType !== 1) {
return;
}
fn(node);
node = node.firstElementChild;
while (node) {
apply(node, fn);
node = node.nextElementSibling;
}
}
function $(selector, context) {
return !isString(selector)
? toNode(selector)
: isHtml(selector)
? toNode(fragment(selector))
: find(selector, context);
}
function $$(selector, context) {
return !isString(selector)
? toNodes(selector)
: isHtml(selector)
? toNodes(fragment(selector))
: findAll(selector, context);
}
function isHtml(str) {
return str[0] === '<' || str.match(/^\s*</);
}
function addClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
apply$1(element, args, 'add');
}
function removeClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
apply$1(element, args, 'remove');
}
function removeClasses(element, cls) {
attr(element, 'class', function (value) { return (value || '').replace(new RegExp(("\\b" + cls + "\\b"), 'g'), ''); });
}
function replaceClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
args[0] && removeClass(element, args[0]);
args[1] && addClass(element, args[1]);
}
function hasClass(element, cls) {
return cls && toNodes(element).some(function (element) { return element.classList.contains(cls.split(' ')[0]); });
}
function toggleClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
if (!args.length) {
return;
}
args = getArgs$1(args);
var force = !isString(last(args)) ? args.pop() : []; // in iOS 9.3 force === undefined evaluates to false
args = args.filter(Boolean);
toNodes(element).forEach(function (ref) {
var classList = ref.classList;
for (var i = 0; i < args.length; i++) {
supports.Force
? classList.toggle.apply(classList, [args[i]].concat(force))
: (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i]));
}
});
}
function apply$1(element, args, fn) {
args = getArgs$1(args).filter(Boolean);
args.length && toNodes(element).forEach(function (ref) {
var classList = ref.classList;
supports.Multiple
? classList[fn].apply(classList, args)
: args.forEach(function (cls) { return classList[fn](cls); });
});
}
function getArgs$1(args) {
return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); }
, []);
}
// IE 11
var supports = {
get Multiple() {
return this.get('_multiple');
},
get Force() {
return this.get('_force');
},
get: function(key) {
if (!hasOwn(this, key)) {
var ref = document.createElement('_');
var classList = ref.classList;
classList.add('a', 'b');
classList.toggle('c', false);
this._multiple = classList.contains('b');
this._force = !classList.contains('c');
}
return this[key];
}
};
var cssNumber = {
'animation-iteration-count': true,
'column-count': true,
'fill-opacity': true,
'flex-grow': true,
'flex-shrink': true,
'font-weight': true,
'line-height': true,
'opacity': true,
'order': true,
'orphans': true,
'stroke-dasharray': true,
'stroke-dashoffset': true,
'widows': true,
'z-index': true,
'zoom': true
};
function css(element, property, value) {
return toNodes(element).map(function (element) {
if (isString(property)) {
property = propName(property);
if (isUndefined(value)) {
return getStyle(element, property);
} else if (!value && !isNumber(value)) {
element.style.removeProperty(property);
} else {
element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value;
}
} else if (isArray(property)) {
var styles = getStyles(element);
return property.reduce(function (props, property) {
props[property] = styles[propName(property)];
return props;
}, {});
} else if (isObject(property)) {
each(property, function (value, property) { return css(element, property, value); });
}
return element;
})[0];
}
function getStyles(element, pseudoElt) {
element = toNode(element);
return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt);
}
function getStyle(element, property, pseudoElt) {
return getStyles(element, pseudoElt)[property];
}
var vars = {};
function getCssVar(name) {
var docEl = document.documentElement;
if (!isIE) {
return getStyles(docEl).getPropertyValue(("--uk-" + name));
}
if (!(name in vars)) {
/* usage in css: .uk-name:before { content:"xyz" } */
var element = append(docEl, document.createElement('div'));
addClass(element, ("uk-" + name));
vars[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1');
remove(element);
}
return vars[name];
}
var cssProps = {};
function propName(name) {
var ret = cssProps[name];
if (!ret) {
ret = cssProps[name] = vendorPropName(name) || name;
}
return ret;
}
var cssPrefixes = ['webkit', 'moz', 'ms'];
function vendorPropName(name) {
name = hyphenate(name);
var ref = document.documentElement;
var style = ref.style;
if (name in style) {
return name;
}
var i = cssPrefixes.length, prefixedName;
while (i--) {
prefixedName = "-" + (cssPrefixes[i]) + "-" + name;
if (prefixedName in style) {
return prefixedName;
}
}
}
function transition(element, props, duration, timing) {
if ( duration === void 0 ) duration = 400;
if ( timing === void 0 ) timing = 'linear';
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
for (var name in props) {
var value = css(element, name);
if (value === '') {
css(element, name, value);
}
}
var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration);
once(element, 'transitionend transitioncanceled', function (ref) {
var type = ref.type;
clearTimeout(timer);
removeClass(element, 'uk-transition');
css(element, {
'transition-property': '',
'transition-duration': '',
'transition-timing-function': ''
});
type === 'transitioncanceled' ? reject() : resolve();
}, {self: true});
addClass(element, 'uk-transition');
css(element, assign({
'transition-property': Object.keys(props).map(propName).join(','),
'transition-duration': (duration + "ms"),
'transition-timing-function': timing
}, props));
}); }
));
}
var Transition = {
start: transition,
stop: function(element) {
trigger(element, 'transitionend');
return Promise.resolve();
},
cancel: function(element) {
trigger(element, 'transitioncanceled');
},
inProgress: function(element) {
return hasClass(element, 'uk-transition');
}
};
var animationPrefix = 'uk-animation-';
var clsCancelAnimation = 'uk-cancel-animation';
function animate(element, animation, duration, origin, out) {
var arguments$1 = arguments;
if ( duration === void 0 ) duration = 200;
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
if (hasClass(element, clsCancelAnimation)) {
requestAnimationFrame(function () { return Promise.resolve().then(function () { return animate.apply(void 0, arguments$1).then(resolve, reject); }
); }
);
return;
}
var cls = animation + " " + animationPrefix + (out ? 'leave' : 'enter');
if (startsWith(animation, animationPrefix)) {
if (origin) {
cls += " uk-transform-origin-" + origin;
}
if (out) {
cls += " " + animationPrefix + "reverse";
}
}
reset();
once(element, 'animationend animationcancel', function (ref) {
var type = ref.type;
var hasReset = false;
if (type === 'animationcancel') {
reject();
reset();
} else {
resolve();
Promise.resolve().then(function () {
hasReset = true;
reset();
});
}
requestAnimationFrame(function () {
if (!hasReset) {
addClass(element, clsCancelAnimation);
requestAnimationFrame(function () { return removeClass(element, clsCancelAnimation); });
}
});
}, {self: true});
css(element, 'animationDuration', (duration + "ms"));
addClass(element, cls);
function reset() {
css(element, 'animationDuration', '');
removeClasses(element, (animationPrefix + "\\S*"));
}
}); }
));
}
var inProgress = new RegExp((animationPrefix + "(enter|leave)"));
var Animation = {
in: function(element, animation, duration, origin) {
return animate(element, animation, duration, origin, false);
},
out: function(element, animation, duration, origin) {
return animate(element, animation, duration, origin, true);
},
inProgress: function(element) {
return inProgress.test(attr(element, 'class'));
},
cancel: function(element) {
trigger(element, 'animationcancel');
}
};
var dirs = {
width: ['x', 'left', 'right'],
height: ['y', 'top', 'bottom']
};
function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) {
elAttach = getPos(elAttach);
targetAttach = getPos(targetAttach);
var flipped = {element: elAttach, target: targetAttach};
if (!element || !target) {
return flipped;
}
var dim = getDimensions(element);
var targetDim = getDimensions(target);
var position = targetDim;
moveTo(position, elAttach, dim, -1);
moveTo(position, targetAttach, targetDim, 1);
elOffset = getOffsets(elOffset, dim.width, dim.height);
targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
elOffset['x'] += targetOffset['x'];
elOffset['y'] += targetOffset['y'];
position.left += elOffset['x'];
position.top += elOffset['y'];
if (flip) {
var boundaries = [getDimensions(getWindow(element))];
if (boundary) {
boundaries.unshift(getDimensions(boundary));
}
each(dirs, function (ref, prop) {
var dir = ref[0];
var align = ref[1];
var alignFlip = ref[2];
if (!(flip === true || includes(flip, dir))) {
return;
}
boundaries.some(function (boundary) {
var elemOffset = elAttach[dir] === align
? -dim[prop]
: elAttach[dir] === alignFlip
? dim[prop]
: 0;
var targetOffset = targetAttach[dir] === align
? targetDim[prop]
: targetAttach[dir] === alignFlip
? -targetDim[prop]
: 0;
if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) {
var centerOffset = dim[prop] / 2;
var centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
return elAttach[dir] === 'center' && (
apply(centerOffset, centerTargetOffset)
|| apply(-centerOffset, -centerTargetOffset)
) || apply(elemOffset, targetOffset);
}
function apply(elemOffset, targetOffset) {
var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2;
if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
position[align] = newVal;
['element', 'target'].forEach(function (el) {
flipped[el][dir] = !elemOffset
? flipped[el][dir]
: flipped[el][dir] === dirs[prop][1]
? dirs[prop][2]
: dirs[prop][1];
});
return true;
}
}
});
});
}
offset(element, position);
return flipped;
}
function offset(element, coordinates) {
element = toNode(element);
if (coordinates) {
var currentOffset = offset(element);
var pos = css(element, 'position');
['left', 'top'].forEach(function (prop) {
if (prop in coordinates) {
var value = css(element, prop);
css(element, prop, coordinates[prop] - currentOffset[prop]
+ toFloat(pos === 'absolute' && value === 'auto'
? position(element)[prop]
: value)
);
}
});
return;
}
return getDimensions(element);
}
function getDimensions(element) {
element = toNode(element);
if (!element) {
return {};
}
var ref = getWindow(element);
var top = ref.pageYOffset;
var left = ref.pageXOffset;
if (isWindow(element)) {
var height = element.innerHeight;
var width = element.innerWidth;
return {
top: top,
left: left,
height: height,
width: width,
bottom: top + height,
right: left + width
};
}
var style, hidden;
if (!isVisible(element) && css(element, 'display') === 'none') {
style = attr(element, 'style');
hidden = attr(element, 'hidden');
attr(element, {
style: ((style || '') + ";display:block !important;"),
hidden: null
});
}
var rect = element.getBoundingClientRect();
if (!isUndefined(style)) {
attr(element, {style: style, hidden: hidden});
}
return {
height: rect.height,
width: rect.width,
top: rect.top + top,
left: rect.left + left,
bottom: rect.bottom + top,
right: rect.right + left
};
}
function position(element) {
element = toNode(element);
var parent = element.offsetParent || getDocEl(element);
var parentOffset = offset(parent);
var ref = ['top', 'left'].reduce(function (props, prop) {
var propName = ucfirst(prop);
props[prop] -= parentOffset[prop]
+ toFloat(css(element, ("margin" + propName)))
+ toFloat(css(parent, ("border" + propName + "Width")));
return props;
}, offset(element));
var top = ref.top;
var left = ref.left;
return {top: top, left: left};
}
var height = dimension('height');
var width = dimension('width');
function dimension(prop) {
var propName = ucfirst(prop);
return function (element, value) {
element = toNode(element);
if (isUndefined(value)) {
if (isWindow(element)) {
return element[("inner" + propName)];
}
if (isDocument(element)) {
var doc = element.documentElement;
return Math.max(doc[("offset" + propName)], doc[("scroll" + propName)]);
}
value = css(element, prop);
value = value === 'auto' ? element[("offset" + propName)] : toFloat(value) || 0;
return value - boxModelAdjust(prop, element);
} else {
css(element, prop, !value && value !== 0
? ''
: +value + boxModelAdjust(prop, element) + 'px'
);
}
};
}
function boxModelAdjust(prop, element, sizing) {
if ( sizing === void 0 ) sizing = 'border-box';
return css(element, 'boxSizing') === sizing
? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value
+ toFloat(css(element, ("padding" + prop)))
+ toFloat(css(element, ("border" + prop + "Width"))); }
, 0)
: 0;
}
function moveTo(position, attach, dim, factor) {
each(dirs, function (ref, prop) {
var dir = ref[0];
var align = ref[1];
var alignFlip = ref[2];
if (attach[dir] === alignFlip) {
position[align] += dim[prop] * factor;
} else if (attach[dir] === 'center') {
position[align] += dim[prop] * factor / 2;
}
});
}
function getPos(pos) {
var x = /left|center|right/;
var y = /top|center|bottom/;
pos = (pos || '').split(' ');
if (pos.length === 1) {
pos = x.test(pos[0])
? pos.concat(['center'])
: y.test(pos[0])
? ['center'].concat(pos)
: ['center', 'center'];
}
return {
x: x.test(pos[0]) ? pos[0] : 'center',
y: y.test(pos[1]) ? pos[1] : 'center'
};
}
function getOffsets(offsets, width, height) {
var ref = (offsets || '').split(' ');
var x = ref[0];
var y = ref[1];
return {
x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0
};
}
function flipPosition(pos) {
switch (pos) {
case 'left':
return 'right';
case 'right':
return 'left';
case 'top':
return 'bottom';
case 'bottom':
return 'top';
default:
return pos;
}
}
function isInView(element, topOffset, leftOffset) {
if ( topOffset === void 0 ) topOffset = 0;
if ( leftOffset === void 0 ) leftOffset = 0;
if (!isVisible(element)) {
return false;
}
element = toNode(element);
var win = getWindow(element);
var client = element.getBoundingClientRect();
var bounding = {
top: -topOffset,
left: -leftOffset,
bottom: topOffset + height(win),
right: leftOffset + width(win)
};
return intersectRect(client, bounding) || pointInRect({x: client.left, y: client.top}, bounding);
}
function scrolledOver(element, heightOffset) {
if ( heightOffset === void 0 ) heightOffset = 0;
if (!isVisible(element)) {
return 0;
}
element = toNode(element);
var win = getWindow(element);
var doc = getDocument(element);
var elHeight = element.offsetHeight + heightOffset;
var ref = offsetPosition(element);
var top = ref[0];
var vp = height(win);
var vh = vp + Math.min(0, top - vp);
var diff = Math.max(0, vp - (height(doc) + heightOffset - (top + elHeight)));
return clamp(((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100)) / 100);
}
function scrollTop(element, top) {
element = toNode(element);
if (isWindow(element) || isDocument(element)) {
var ref = getWindow(element);
var scrollTo = ref.scrollTo;
var pageXOffset = ref.pageXOffset;
scrollTo(pageXOffset, top);
} else {
element.scrollTop = top;
}
}
function offsetPosition(element) {
var offset = [0, 0];
do {
offset[0] += element.offsetTop;
offset[1] += element.offsetLeft;
if (css(element, 'position') === 'fixed') {
var win = getWindow(element);
offset[0] += win.pageYOffset;
offset[1] += win.pageXOffset;
return offset;
}
} while ((element = element.offsetParent));
return offset;
}
function toPx(value, property, element) {
if ( property === void 0 ) property = 'width';
if ( element === void 0 ) element = window;
return isNumeric(value)
? +value
: endsWith(value, 'vh')
? percent(height(getWindow(element)), value)
: endsWith(value, 'vw')
? percent(width(getWindow(element)), value)
: endsWith(value, '%')
? percent(getDimensions(element)[property], value)
: toFloat(value);
}
function percent(base, value) {
return base * toFloat(value) / 100;
}
function getWindow(element) {
return isWindow(element) ? element : getDocument(element).defaultView;
}
function getDocument(element) {
return toNode(element).ownerDocument;
}
function getDocEl(element) {
return getDocument(element).documentElement;
}
/*
Based on:
Copyright (c) 2016 Wilson Page wilsonpage@me.com
https://github.com/wilsonpage/fastdom
*/
var fastdom = {
reads: [],
writes: [],
read: function(task) {
this.reads.push(task);
scheduleFlush();
return task;
},
write: function(task) {
this.writes.push(task);
scheduleFlush();
return task;
},
clear: function(task) {
return remove$1(this.reads, task) || remove$1(this.writes, task);
},
flush: flush
};
function flush() {
runTasks(fastdom.reads);
runTasks(fastdom.writes.splice(0, fastdom.writes.length));
fastdom.scheduled = false;
if (fastdom.reads.length || fastdom.writes.length) {
scheduleFlush(true);
}
}
function scheduleFlush(microtask) {
if ( microtask === void 0 ) microtask = false;
if (!fastdom.scheduled) {
fastdom.scheduled = true;
if (microtask) {
Promise.resolve().then(flush);
} else {
requestAnimationFrame(flush);
}
}
}
function runTasks(tasks) {
var task;
while ((task = tasks.shift())) {
task();
}
}
function remove$1(array, item) {
var index = array.indexOf(item);
return !!~index && !!array.splice(index, 1);
}
function MouseTracker() {}
MouseTracker.prototype = {
positions: [],
position: null,
init: function() {
var this$1 = this;
this.positions = [];
this.position = null;
var ticking = false;
this.unbind = on(document, 'mousemove', function (e) {
if (ticking) {
return;
}
setTimeout(function () {
var time = Date.now();
var ref = this$1.positions;
var length = ref.length;
if (length && (time - this$1.positions[length - 1].time > 100)) {
this$1.positions.splice(0, length);
}
this$1.positions.push({time: time, x: e.pageX, y: e.pageY});
if (this$1.positions.length > 5) {
this$1.positions.shift();
}
ticking = false;
}, 5);
ticking = true;
});
},
cancel: function() {
if (this.unbind) {
this.unbind();
}
},
movesTo: function(target) {
if (this.positions.length < 2) {
return false;
}
var p = offset(target);
var position = last(this.positions);
var ref = this.positions;
var prevPos = ref[0];
if (p.left <= position.x && position.x <= p.right && p.top <= position.y && position.y <= p.bottom) {
return false;
}
var points = [
[{x: p.left, y: p.top}, {x: p.right, y: p.bottom}],
[{x: p.right, y: p.top}, {x: p.left, y: p.bottom}]
];
if (p.right <= position.x) ; else if (p.left >= position.x) {
points[0].reverse();
points[1].reverse();
} else if (p.bottom <= position.y) {
points[0].reverse();
} else if (p.top >= position.y) {
points[1].reverse();
}
return !!points.reduce(function (result, point) {
return result + (slope(prevPos, point[0]) < slope(position, point[0]) && slope(prevPos, point[1]) > slope(position, point[1]));
}, 0);
}
};
function slope(a, b) {
return (b.y - a.y) / (b.x - a.x);
}
var strats = {};
strats.events =
strats.created =
strats.beforeConnect =
strats.connected =
strats.beforeDisconnect =
strats.disconnected =
strats.destroy = concatStrat;
// args strategy
strats.args = function (parentVal, childVal) {
return childVal !== false && concatStrat(childVal || parentVal);
};
// update strategy
strats.update = function (parentVal, childVal) {
return sortBy(concatStrat(parentVal, isFunction(childVal) ? {read: childVal} : childVal), 'order');
};
// property strategy
strats.props = function (parentVal, childVal) {
if (isArray(childVal)) {
childVal = childVal.reduce(function (value, key) {
value[key] = String;
return value;
}, {});
}
return strats.methods(parentVal, childVal);
};
// extend strategy
strats.computed =
strats.methods = function (parentVal, childVal) {
return childVal
? parentVal
? assign({}, parentVal, childVal)
: childVal
: parentVal;
};
// data strategy
strats.data = function (parentVal, childVal, vm) {
if (!vm) {
if (!childVal) {
return parentVal;
}
if (!parentVal) {
return childVal;
}
return function (vm) {
return mergeFnData(parentVal, childVal, vm);
};
}
return mergeFnData(parentVal, childVal, vm);
};
function mergeFnData(parentVal, childVal, vm) {
return strats.computed(
isFunction(parentVal)
? parentVal.call(vm, vm)
: parentVal,
isFunction(childVal)
? childVal.call(vm, vm)
: childVal
);
}
// concat strategy
function concatStrat(parentVal, childVal) {
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
return childVal
? parentVal
? parentVal.concat(childVal)
: isArray(childVal)
? childVal
: [childVal]
: parentVal;
}
// default strategy
function defaultStrat(parentVal, childVal) {
return isUndefined(childVal) ? parentVal : childVal;
}
function mergeOptions(parent, child, vm) {
var options = {};
if (isFunction(child)) {
child = child.options;
}
if (child.extends) {
parent = mergeOptions(parent, child.extends, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm);
}
}
for (var key in parent) {
mergeKey(key);
}
for (var key$1 in child) {
if (!hasOwn(parent, key$1)) {
mergeKey(key$1);
}
}
function mergeKey(key) {
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
}
return options;
}
function parseOptions(options, args) {
var obj;
if ( args === void 0 ) args = [];
try {
return !options
? {}
: startsWith(options, '{')
? JSON.parse(options)
: args.length && !includes(options, ':')
? (( obj = {}, obj[args[0]] = options, obj ))
: options.split(';').reduce(function (options, option) {
var ref = option.split(/:(.*)/);
var key = ref[0];
var value = ref[1];
if (key && !isUndefined(value)) {
options[key.trim()] = value.trim();
}
return options;
}, {});
} catch (e) {
return {};
}
}
var id = 0;
var Player = function(el) {
this.id = ++id;
this.el = toNode(el);
};
Player.prototype.isVideo = function () {
return this.isYoutube() || this.isVimeo() || this.isHTML5();
};
Player.prototype.isHTML5 = function () {
return this.el.tagName === 'VIDEO';
};
Player.prototype.isIFrame = function () {
return this.el.tagName === 'IFRAME';
};
Player.prototype.isYoutube = function () {
return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/);
};
Player.prototype.isVimeo = function () {
return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/);
};
Player.prototype.enableApi = function () {
var this$1 = this;
if (this.ready) {
return this.ready;
}
var youtube = this.isYoutube();
var vimeo = this.isVimeo();
var poller;
if (youtube || vimeo) {
return this.ready = new Promise(function (resolve) {
once(this$1.el, 'load', function () {
if (youtube) {
var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); };
poller = setInterval(listener, 100);
listener();
}
});
listen(function (data) { return youtube && data.id === this$1.id && data.event === 'onReady' || vimeo && Number(data.player_id) === this$1.id; })
.then(function () {
resolve();
poller && clearInterval(poller);
});
attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + (this$1.id)))));
});
}
return Promise.resolve();
};
Player.prototype.play = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); });
} else if (this.isHTML5()) {
try {
var promise = this.el.play();
if (promise) {
promise.catch(noop);
}
} catch (e) {}
}
};
Player.prototype.pause = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); });
} else if (this.isHTML5()) {
this.el.pause();
}
};
Player.prototype.mute = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); });
} else if (this.isHTML5()) {
this.el.muted = true;
attr(this.el, 'muted', '');
}
};
function post(el, cmd) {
try {
el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*');
} catch (e) {}
}
function listen(cb) {
return new Promise(function (resolve) {
once(window, 'message', function (_, data) { return resolve(data); }, false, function (ref) {
var data = ref.data;
if (!data || !isString(data)) {
return;
}
try {
data = JSON.parse(data);
} catch (e) {
return;
}
return data && cb(data);
});
});
}
var IntersectionObserver = 'IntersectionObserver' in window
? window.IntersectionObserver
: /*@__PURE__*/(function () {
function IntersectionObserverClass(callback, ref) {
var this$1 = this;
if ( ref === void 0 ) ref = {};
var rootMargin = ref.rootMargin; if ( rootMargin === void 0 ) rootMargin = '0 0';
this.targets = [];
var ref$1 = (rootMargin || '0 0').split(' ').map(toFloat);
var offsetTop = ref$1[0];
var offsetLeft = ref$1[1];
this.offsetTop = offsetTop;
this.offsetLeft = offsetLeft;
var pending;
this.apply = function () {
if (pending) {
return;
}
pending = requestAnimationFrame(function () { return setTimeout(function () {
var records = this$1.takeRecords();
if (records.length) {
callback(records, this$1);
}
pending = false;
}); });
};
this.off = on(window, 'scroll resize load', this.apply, {passive: true, capture: true});
}
IntersectionObserverClass.prototype.takeRecords = function () {
var this$1 = this;
return this.targets.filter(function (entry) {
var inView = isInView(entry.target, this$1.offsetTop, this$1.offsetLeft);
if (entry.isIntersecting === null || inView ^ entry.isIntersecting) {
entry.isIntersecting = inView;
return true;
}
});
};
IntersectionObserverClass.prototype.observe = function (target) {
this.targets.push({
target: target,
isIntersecting: null
});
this.apply();
};
IntersectionObserverClass.prototype.disconnect = function () {
this.targets = [];
this.off();
};
return IntersectionObserverClass;
}());
var util = /*#__PURE__*/Object.freeze({
ajax: ajax,
getImage: getImage,
transition: transition,
Transition: Transition,
animate: animate,
Animation: Animation,
attr: attr,
hasAttr: hasAttr,
removeAttr: removeAttr,
data: data,
addClass: addClass,
removeClass: removeClass,
removeClasses: removeClasses,
replaceClass: replaceClass,
hasClass: hasClass,
toggleClass: toggleClass,
positionAt: positionAt,
offset: offset,
position: position,
height: height,
width: width,
boxModelAdjust: boxModelAdjust,
flipPosition: flipPosition,
isInView: isInView,
scrolledOver: scrolledOver,
scrollTop: scrollTop,
offsetPosition: offsetPosition,
toPx: toPx,
ready: ready,
index: index,
getIndex: getIndex,
empty: empty,
html: html,
prepend: prepend,
append: append,
before: before,
after: after,
remove: remove,
wrapAll: wrapAll,
wrapInner: wrapInner,
unwrap: unwrap,
fragment: fragment,
apply: apply,
$: $,
$$: $$,
isIE: isIE,
isRtl: isRtl,
hasTouch: hasTouch,
pointerDown: pointerDown,
pointerMove: pointerMove,
pointerUp: pointerUp,
pointerEnter: pointerEnter,
pointerLeave: pointerLeave,
pointerCancel: pointerCancel,
on: on,
off: off,
once: once,
trigger: trigger,
createEvent: createEvent,
toEventTargets: toEventTargets,
isTouch: isTouch,
getEventPos: getEventPos,
fastdom: fastdom,
isVoidElement: isVoidElement,
isVisible: isVisible,
selInput: selInput,
isInput: isInput,
filter: filter,
within: within,
hasOwn: hasOwn,
hyphenate: hyphenate,
camelize: camelize,
ucfirst: ucfirst,
startsWith: startsWith,
endsWith: endsWith,
includes: includes,
findIndex: findIndex,
isArray: isArray,
isFunction: isFunction,
isObject: isObject,
isPlainObject: isPlainObject,
isWindow: isWindow,
isDocument: isDocument,
isJQuery: isJQuery,
isNode: isNode,
isNodeCollection: isNodeCollection,
isBoolean: isBoolean,
isString: isString,
isNumber: isNumber,
isNumeric: isNumeric,
isEmpty: isEmpty,
isUndefined: isUndefined,
toBoolean: toBoolean,
toNumber: toNumber,
toFloat: toFloat,
toNode: toNode,
toNodes: toNodes,
toList: toList,
toMs: toMs,
isEqual: isEqual,
swap: swap,
assign: assign,
last: last,
each: each,
sortBy: sortBy,
uniqueBy: uniqueBy,
clamp: clamp,
noop: noop,
intersectRect: intersectRect,
pointInRect: pointInRect,
Dimensions: Dimensions,
MouseTracker: MouseTracker,
mergeOptions: mergeOptions,
parseOptions: parseOptions,
Player: Player,
Promise: Promise,
Deferred: Deferred,
IntersectionObserver: IntersectionObserver,
query: query,
queryAll: queryAll,
find: find,
findAll: findAll,
matches: matches,
closest: closest,
parents: parents,
escape: escape,
css: css,
getStyles: getStyles,
getStyle: getStyle,
getCssVar: getCssVar,
propName: propName
});
function componentAPI (UIkit) {
var DATA = UIkit.data;
var components = {};
UIkit.component = function (name, options) {
if (!options) {
if (isPlainObject(components[name])) {
components[name] = UIkit.extend(components[name]);
}
return components[name];
}
UIkit[name] = function (element, data) {
var i = arguments.length, argsArray = Array(i);
while ( i-- ) argsArray[i] = arguments[i];
var component = UIkit.component(name);
if (isPlainObject(element)) {
return new component({data: element});
}
if (component.options.functional) {
return new component({data: [].concat( argsArray )});
}
return element && element.nodeType ? init(element) : $$(element).map(init)[0];
function init(element) {
var instance = UIkit.getComponent(element, name);
if (instance) {
if (!data) {
return instance;
} else {
instance.$destroy();
}
}
return new component({el: element, data: data});
}
};
var opt = isPlainObject(options) ? assign({}, options) : options.options;
opt.name = name;
if (opt.install) {
opt.install(UIkit, opt, name);
}
if (UIkit._initialized && !opt.functional) {
var id = hyphenate(name);
fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); });
}
return components[name] = isPlainObject(options) ? opt : options;
};
UIkit.getComponents = function (element) { return element && element[DATA] || {}; };
UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; };
UIkit.connect = function (node) {
if (node[DATA]) {
for (var name in node[DATA]) {
node[DATA][name]._callConnected();
}
}
for (var i = 0; i < node.attributes.length; i++) {
var name$1 = getComponentName(node.attributes[i].name);
if (name$1 && name$1 in components) {
UIkit[name$1](node);
}
}
};
UIkit.disconnect = function (node) {
for (var name in node[DATA]) {
node[DATA][name]._callDisconnected();
}
};
}
function getComponentName(attribute) {
return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-')
? camelize(attribute.replace('data-uk-', '').replace('uk-', ''))
: false;
}
function boot (UIkit) {
var connect = UIkit.connect;
var disconnect = UIkit.disconnect;
if (!('MutationObserver' in window)) {
return;
}
if (document.body) {
fastdom.read(init);
} else {
(new MutationObserver(function () {
if (document.body) {
this.disconnect();
init();
}
})).observe(document, {childList: true, subtree: true});
}
function init() {
apply(document.body, connect);
// Safari renders prior to first animation frame
fastdom.flush();
(new MutationObserver(function (mutations) { return mutations.forEach(applyMutation); })).observe(document, {
childList: true,
subtree: true,
characterData: true,
attributes: true
});
UIkit._initialized = true;
}
function applyMutation(mutation) {
var target = mutation.target;
var type = mutation.type;
var update = type !== 'attributes'
? applyChildList(mutation)
: applyAttribute(mutation);
update && UIkit.update(target);
}
function applyAttribute(ref) {
var target = ref.target;
var attributeName = ref.attributeName;
if (attributeName === 'href') {
return true;
}
var name = getComponentName(attributeName);
if (!name || !(name in UIkit)) {
return;
}
if (hasAttr(target, attributeName)) {
UIkit[name](target);
return true;
}
var component = UIkit.getComponent(target, name);
if (component) {
component.$destroy();
return true;
}
}
function applyChildList(ref) {
var addedNodes = ref.addedNodes;
var removedNodes = ref.removedNodes;
for (var i = 0; i < addedNodes.length; i++) {
apply(addedNodes[i], connect);
}
for (var i$1 = 0; i$1 < removedNodes.length; i$1++) {
apply(removedNodes[i$1], disconnect);
}
return true;
}
function apply(node, fn) {
if (node.nodeType !== 1 || hasAttr(node, 'uk-no-boot')) {
return;
}
fn(node);
node = node.firstElementChild;
while (node) {
var next = node.nextElementSibling;
apply(node, fn);
node = next;
}
}
}
function globalAPI (UIkit) {
var DATA = UIkit.data;
UIkit.use = function (plugin) {
if (plugin.installed) {
return;
}
plugin.call(null, this);
plugin.installed = true;
return this;
};
UIkit.mixin = function (mixin, component) {
component = (isString(component) ? UIkit.component(component) : component) || this;
component.options = mergeOptions(component.options, mixin);
};
UIkit.extend = function (options) {
options = options || {};
var Super = this;
var Sub = function UIkitComponent(options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.options = mergeOptions(Super.options, options);
Sub.super = Super;
Sub.extend = Super.extend;
return Sub;
};
UIkit.update = function (element, e) {
element = element ? toNode(element) : document.body;
path(element, function (element) { return update(element[DATA], e); });
apply(element, function (element) { return update(element[DATA], e); });
};
var container;
Object.defineProperty(UIkit, 'container', {
get: function() {
return container || document.body;
},
set: function(element) {
container = $(element);
}
});
function update(data, e) {
if (!data) {
return;
}
for (var name in data) {
if (data[name]._connected) {
data[name]._callUpdate(e);
}
}
}
function path(node, fn) {
if (node && node !== document.body && node.parentNode) {
path(node.parentNode, fn);
fn(node.parentNode);
}
}
}
function hooksAPI (UIkit) {
UIkit.prototype._callHook = function (hook) {
var this$1 = this;
var handlers = this.$options[hook];
if (handlers) {
handlers.forEach(function (handler) { return handler.call(this$1); });
}
};
UIkit.prototype._callConnected = function () {
if (this._connected) {
return;
}
this._data = {};
this._computeds = {};
this._initProps();
this._callHook('beforeConnect');
this._connected = true;
this._initEvents();
this._initObserver();
this._callHook('connected');
this._callUpdate();
};
UIkit.prototype._callDisconnected = function () {
if (!this._connected) {
return;
}
this._callHook('beforeDisconnect');
if (this._observer) {
this._observer.disconnect();
this._observer = null;
}
this._unbindEvents();
this._callHook('disconnected');
this._connected = false;
};
UIkit.prototype._callUpdate = function (e) {
var this$1 = this;
if ( e === void 0 ) e = 'update';
var type = e.type || e;
if (includes(['update', 'resize'], type)) {
this._callWatches();
}
var updates = this.$options.update;
var ref = this._frames;
var reads = ref.reads;
var writes = ref.writes;
if (!updates) {
return;
}
updates.forEach(function (ref, i) {
var read = ref.read;
var write = ref.write;
var events = ref.events;
if (type !== 'update' && !includes(events, type)) {
return;
}
if (read && !includes(fastdom.reads, reads[i])) {
reads[i] = fastdom.read(function () {
var result = this$1._connected && read.call(this$1, this$1._data, type);
if (result === false && write) {
fastdom.clear(writes[i]);
} else if (isPlainObject(result)) {
assign(this$1._data, result);
}
});
}
if (write && !includes(fastdom.writes, writes[i])) {
writes[i] = fastdom.write(function () { return this$1._connected && write.call(this$1, this$1._data, type); });
}
});
};
}
function stateAPI (UIkit) {
var uid = 0;
UIkit.prototype._init = function (options) {
options = options || {};
options.data = normalizeData(options, this.constructor.options);
this.$options = mergeOptions(this.constructor.options, options, this);
this.$el = null;
this.$props = {};
this._frames = {reads: {}, writes: {}};
this._events = [];
this._uid = uid++;
this._initData();
this._initMethods();
this._initComputeds();
this._callHook('created');
if (options.el) {
this.$mount(options.el);
}
};
UIkit.prototype._initData = function () {
var ref = this.$options;
var data = ref.data; if ( data === void 0 ) data = {};
for (var key in data) {
this.$props[key] = this[key] = data[key];
}
};
UIkit.prototype._initMethods = function () {
var ref = this.$options;
var methods = ref.methods;
if (methods) {
for (var key in methods) {
this[key] = methods[key].bind(this);
}
}
};
UIkit.prototype._initComputeds = function () {
var ref = this.$options;
var computed = ref.computed;
this._computeds = {};
if (computed) {
for (var key in computed) {
registerComputed(this, key, computed[key]);
}
}
};
UIkit.prototype._callWatches = function () {
var ref = this;
var computed = ref.$options.computed;
var _computeds = ref._computeds;
for (var key in _computeds) {
var value = _computeds[key];
delete _computeds[key];
if (computed[key].watch && !isEqual(value, this[key])) {
computed[key].watch.call(this, this[key], value);
}
}
};
UIkit.prototype._initProps = function (props) {
var key;
props = props || getProps(this.$options, this.$name);
for (key in props) {
if (!isUndefined(props[key])) {
this.$props[key] = props[key];
}
}
var exclude = [this.$options.computed, this.$options.methods];
for (key in this.$props) {
if (key in props && notIn(exclude, key)) {
this[key] = this.$props[key];
}
}
};
UIkit.prototype._initEvents = function () {
var this$1 = this;
var ref = this.$options;
var events = ref.events;
if (events) {
events.forEach(function (event) {
if (!hasOwn(event, 'handler')) {
for (var key in event) {
registerEvent(this$1, event[key], key);
}
} else {
registerEvent(this$1, event);
}
});
}
};
UIkit.prototype._unbindEvents = function () {
this._events.forEach(function (unbind) { return unbind(); });
this._events = [];
};
UIkit.prototype._initObserver = function () {
var this$1 = this;
var ref = this.$options;
var attrs = ref.attrs;
var props = ref.props;
var el = ref.el;
if (this._observer || !props || attrs === false) {
return;
}
attrs = isArray(attrs) ? attrs : Object.keys(props);
this._observer = new MutationObserver(function () {
var data = getProps(this$1.$options, this$1.$name);
if (attrs.some(function (key) { return !isUndefined(data[key]) && data[key] !== this$1.$props[key]; })) {
this$1.$reset();
}
});
var filter = attrs.map(function (key) { return hyphenate(key); }).concat(this.$name);
this._observer.observe(el, {
attributes: true,
attributeFilter: filter.concat(filter.map(function (key) { return ("data-" + key); }))
});
};
function getProps(opts, name) {
var data$1 = {};
var args = opts.args; if ( args === void 0 ) args = [];
var props = opts.props; if ( props === void 0 ) props = {};
var el = opts.el;
if (!props) {
return data$1;
}
for (var key in props) {
var prop = hyphenate(key);
var value = data(el, prop);
if (!isUndefined(value)) {
value = props[key] === Boolean && value === ''
? true
: coerce(props[key], value);
if (prop === 'target' && (!value || startsWith(value, '_'))) {
continue;
}
data$1[key] = value;
}
}
var options = parseOptions(data(el, name), args);
for (var key$1 in options) {
var prop$1 = camelize(key$1);
if (props[prop$1] !== undefined) {
data$1[prop$1] = coerce(props[prop$1], options[key$1]);
}
}
return data$1;
}
function registerComputed(component, key, cb) {
Object.defineProperty(component, key, {
enumerable: true,
get: function() {
var _computeds = component._computeds;
var $props = component.$props;
var $el = component.$el;
if (!hasOwn(_computeds, key)) {
_computeds[key] = (cb.get || cb).call(component, $props, $el);
}
return _computeds[key];
},
set: function(value) {
var _computeds = component._computeds;
_computeds[key] = cb.set ? cb.set.call(component, value) : value;
if (isUndefined(_computeds[key])) {
delete _computeds[key];
}
}
});
}
function registerEvent(component, event, key) {
if (!isPlainObject(event)) {
event = ({name: key, handler: event});
}
var name = event.name;
var el = event.el;
var handler = event.handler;
var capture = event.capture;
var passive = event.passive;
var delegate = event.delegate;
var filter = event.filter;
var self = event.self;
el = isFunction(el)
? el.call(component)
: el || component.$el;
if (isArray(el)) {
el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); });
return;
}
if (!el || filter && !filter.call(component)) {
return;
}
component._events.push(
on(
el,
name,
!delegate
? null
: isString(delegate)
? delegate
: delegate.call(component),
isString(handler) ? component[handler] : handler.bind(component),
{passive: passive, capture: capture, self: self}
)
);
}
function notIn(options, key) {
return options.every(function (arr) { return !arr || !hasOwn(arr, key); });
}
function coerce(type, value) {
if (type === Boolean) {
return toBoolean(value);
} else if (type === Number) {
return toNumber(value);
} else if (type === 'list') {
return toList(value);
}
return type ? type(value) : value;
}
function normalizeData(ref, ref$1) {
var data = ref.data;
var el = ref.el;
var args = ref$1.args;
var props = ref$1.props; if ( props === void 0 ) props = {};
data = isArray(data)
? !isEmpty(args)
? data.slice(0, args.length).reduce(function (data, value, index) {
if (isPlainObject(value)) {
assign(data, value);
} else {
data[args[index]] = value;
}
return data;
}, {})
: undefined
: data;
if (data) {
for (var key in data) {
if (isUndefined(data[key])) {
delete data[key];
} else {
data[key] = props[key] ? coerce(props[key], data[key]) : data[key];
}
}
}
return data;
}
}
function instanceAPI (UIkit) {
var DATA = UIkit.data;
UIkit.prototype.$mount = function (el) {
var ref = this.$options;
var name = ref.name;
if (!el[DATA]) {
el[DATA] = {};
}
if (el[DATA][name]) {
return;
}
el[DATA][name] = this;
this.$el = this.$options.el = this.$options.el || el;
if (within(el, document)) {
this._callConnected();
}
};
UIkit.prototype.$emit = function (e) {
this._callUpdate(e);
};
UIkit.prototype.$reset = function () {
this._callDisconnected();
this._callConnected();
};
UIkit.prototype.$destroy = function (removeEl) {
if ( removeEl === void 0 ) removeEl = false;
var ref = this.$options;
var el = ref.el;
var name = ref.name;
if (el) {
this._callDisconnected();
}
this._callHook('destroy');
if (!el || !el[DATA]) {
return;
}
delete el[DATA][name];
if (!isEmpty(el[DATA])) {
delete el[DATA];
}
if (removeEl) {
remove(this.$el);
}
};
UIkit.prototype.$create = function (component, element, data) {
return UIkit[component](element, data);
};
UIkit.prototype.$update = UIkit.update;
UIkit.prototype.$getComponent = UIkit.getComponent;
var names = {};
Object.defineProperties(UIkit.prototype, {
$container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
$name: {
get: function() {
var ref = this.$options;
var name = ref.name;
if (!names[name]) {
names[name] = UIkit.prefix + hyphenate(name);
}
return names[name];
}
}
});
}
var UIkit = function (options) {
this._init(options);
};
UIkit.util = util;
UIkit.data = '__uikit__';
UIkit.prefix = 'uk-';
UIkit.options = {};
globalAPI(UIkit);
hooksAPI(UIkit);
stateAPI(UIkit);
componentAPI(UIkit);
instanceAPI(UIkit);
var Class = {
connected: function() {
!hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
}
};
var Togglable = {
props: {
cls: Boolean,
animation: 'list',
duration: Number,
origin: String,
transition: String,
queued: Boolean
},
data: {
cls: false,
animation: [false],
duration: 200,
origin: false,
transition: 'linear',
queued: false,
initProps: {
overflow: '',
height: '',
paddingTop: '',
paddingBottom: '',
marginTop: '',
marginBottom: ''
},
hideProps: {
overflow: 'hidden',
height: 0,
paddingTop: 0,
paddingBottom: 0,
marginTop: 0,
marginBottom: 0
}
},
computed: {
hasAnimation: function(ref) {
var animation = ref.animation;
return !!animation[0];
},
hasTransition: function(ref) {
var animation = ref.animation;
return this.hasAnimation && animation[0] === true;
}
},
methods: {
toggleElement: function(targets, show, animate) {
var this$1 = this;
return new Promise(function (resolve) {
targets = toNodes(targets);
var all = function (targets) { return Promise.all(targets.map(function (el) { return this$1._toggleElement(el, show, animate); })); };
var toggled = targets.filter(function (el) { return this$1.isToggled(el); });
var untoggled = targets.filter(function (el) { return !includes(toggled, el); });
var p;
if (!this$1.queued || !isUndefined(animate) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) {
p = all(untoggled.concat(toggled));
} else {
var body = document.body;
var scroll = body.scrollTop;
var el = toggled[0];
var inProgress = Animation.inProgress(el) && hasClass(el, 'uk-animation-leave')
|| Transition.inProgress(el) && el.style.height === '0px';
p = all(toggled);
if (!inProgress) {
p = p.then(function () {
var p = all(untoggled);
body.scrollTop = scroll;
return p;
});
}
}
p.then(resolve, noop);
});
},
toggleNow: function(targets, show) {
var this$1 = this;
return new Promise(function (resolve) { return Promise.all(toNodes(targets).map(function (el) { return this$1._toggleElement(el, show, false); })).then(resolve, noop); });
},
isToggled: function(el) {
var nodes = toNodes(el || this.$el);
return this.cls
? hasClass(nodes, this.cls.split(' ')[0])
: !hasAttr(nodes, 'hidden');
},
updateAria: function(el) {
if (this.cls === false) {
attr(el, 'aria-hidden', !this.isToggled(el));
}
},
_toggleElement: function(el, show, animate) {
var this$1 = this;
show = isBoolean(show)
? show
: Animation.inProgress(el)
? hasClass(el, 'uk-animation-leave')
: Transition.inProgress(el)
? el.style.height === '0px'
: !this.isToggled(el);
if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) {
return Promise.reject();
}
var promise = (
isFunction(animate)
? animate
: animate === false || !this.hasAnimation
? this._toggle
: this.hasTransition
? toggleHeight(this)
: toggleAnimation(this)
)(el, show);
trigger(el, show ? 'show' : 'hide', [this]);
var final = function () {
trigger(el, show ? 'shown' : 'hidden', [this$1]);
this$1.$update(el);
};
return promise ? promise.then(final) : Promise.resolve(final());
},
_toggle: function(el, toggled) {
if (!el) {
return;
}
toggled = Boolean(toggled);
var changed;
if (this.cls) {
changed = includes(this.cls, ' ') || toggled !== hasClass(el, this.cls);
changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled);
} else {
changed = toggled === hasAttr(el, 'hidden');
changed && attr(el, 'hidden', !toggled ? '' : null);
}
$$('[autofocus]', el).some(function (el) { return isVisible(el) ? el.focus() || true : el.blur(); });
this.updateAria(el);
changed && this.$update(el);
}
}
};
function toggleHeight(ref) {
var isToggled = ref.isToggled;
var duration = ref.duration;
var initProps = ref.initProps;
var hideProps = ref.hideProps;
var transition = ref.transition;
var _toggle = ref._toggle;
return function (el, show) {
var inProgress = Transition.inProgress(el);
var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0;
var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
Transition.cancel(el);
if (!isToggled(el)) {
_toggle(el, true);
}
height(el, '');
// Update child components first
fastdom.flush();
var endHeight = height(el) + (inProgress ? 0 : inner);
height(el, currentHeight);
return (show
? Transition.start(el, assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition)
: Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); })
).then(function () { return css(el, initProps); });
};
}
function toggleAnimation(ref) {
var animation = ref.animation;
var duration = ref.duration;
var origin = ref.origin;
var _toggle = ref._toggle;
return function (el, show) {
Animation.cancel(el);
if (show) {
_toggle(el, true);
return Animation.in(el, animation[0], duration, origin);
}
return Animation.out(el, animation[1] || animation[0], duration, origin).then(function () { return _toggle(el, false); });
};
}
var Accordion = {
mixins: [Class, Togglable],
props: {
targets: String,
active: null,
collapsible: Boolean,
multiple: Boolean,
toggle: String,
content: String,
transition: String
},
data: {
targets: '> *',
active: false,
animation: [true],
collapsible: true,
multiple: false,
clsOpen: 'uk-open',
toggle: '> .uk-accordion-title',
content: '> .uk-accordion-content',
transition: 'ease'
},
computed: {
items: function(ref, $el) {
var targets = ref.targets;
return $$(targets, $el);
}
},
events: [
{
name: 'click',
delegate: function() {
return ((this.targets) + " " + (this.$props.toggle));
},
handler: function(e) {
e.preventDefault();
this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current));
}
}
],
connected: function() {
if (this.active === false) {
return;
}
var active = this.items[Number(this.active)];
if (active && !hasClass(active, this.clsOpen)) {
this.toggle(active, false);
}
},
update: function() {
var this$1 = this;
this.items.forEach(function (el) { return this$1._toggle($(this$1.content, el), hasClass(el, this$1.clsOpen)); });
var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0];
if (active) {
this.toggle(active, false);
}
},
methods: {
toggle: function(item, animate) {
var this$1 = this;
var index = getIndex(item, this.items);
var active = filter(this.items, ("." + (this.clsOpen)));
item = this.items[index];
item && [item]
.concat(!this.multiple && !includes(active, item) && active || [])
.forEach(function (el) {
var isItem = el === item;
var state = isItem && !hasClass(el, this$1.clsOpen);
if (!state && isItem && !this$1.collapsible && active.length < 2) {
return;
}
toggleClass(el, this$1.clsOpen, state);
var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el);
if (!el._wrapper) {
el._wrapper = wrapAll(content, '<div>');
attr(el._wrapper, 'hidden', state ? '' : null);
}
this$1._toggle(content, true);
this$1.toggleElement(el._wrapper, state, animate).then(function () {
if (hasClass(el, this$1.clsOpen) !== state) {
return;
}
if (!state) {
this$1._toggle(content, false);
}
el._wrapper = null;
unwrap(content);
});
});
}
}
};
var Alert = {
mixins: [Class, Togglable],
args: 'animation',
props: {
close: String
},
data: {
animation: [true],
selClose: '.uk-alert-close',
duration: 150,
hideProps: assign({opacity: 0}, Togglable.data.hideProps)
},
events: [
{
name: 'click',
delegate: function() {
return this.selClose;
},
handler: function(e) {
e.preventDefault();
this.close();
}
}
],
methods: {
close: function() {
var this$1 = this;
this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); });
}
}
};
function Core (UIkit) {
ready(function () {
UIkit.update();
on(window, 'load resize', function () { return UIkit.update(null, 'resize'); });
on(document, 'loadedmetadata load', function (ref) {
var target = ref.target;
return UIkit.update(target, 'resize');
}, true);
// throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
var pending;
on(window, 'scroll', function (e) {
if (pending) {
return;
}
pending = true;
fastdom.write(function () { return pending = false; });
var target = e.target;
UIkit.update(target.nodeType !== 1 ? document.body : target, e.type);
}, {passive: true, capture: true});
var started = 0;
on(document, 'animationstart', function (ref) {
var target = ref.target;
if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
started++;
css(document.body, 'overflowX', 'hidden');
setTimeout(function () {
if (!--started) {
css(document.body, 'overflowX', '');
}
}, toMs(css(target, 'animationDuration')) + 100);
}
}, true);
var off;
on(document, pointerDown, function (e) {
off && off();
if (!isTouch(e)) {
return;
}
// Handle Swipe Gesture
var pos = getEventPos(e);
var target = 'tagName' in e.target ? e.target : e.target.parentNode;
off = once(document, (pointerUp + " " + pointerCancel), function (e) {
var ref = getEventPos(e);
var x = ref.x;
var y = ref.y;
// swipe
if (target && x && Math.abs(pos.x - x) > 100 || y && Math.abs(pos.y - y) > 100) {
setTimeout(function () {
trigger(target, 'swipe');
trigger(target, ("swipe" + (swipeDirection(pos.x, pos.y, x, y))));
});
}
});
// Force click event anywhere on iOS < 13
if (pointerDown === 'touchstart') {
css(document.body, 'cursor', 'pointer');
once(document, (pointerUp + " " + pointerCancel), function () { return setTimeout(function () { return css(document.body, 'cursor', ''); }
, 50); }
);
}
}, {passive: true});
});
}
function swipeDirection(x1, y1, x2, y2) {
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
? x1 - x2 > 0
? 'Left'
: 'Right'
: y1 - y2 > 0
? 'Up'
: 'Down';
}
var Video = {
args: 'autoplay',
props: {
automute: Boolean,
autoplay: Boolean
},
data: {
automute: false,
autoplay: true
},
computed: {
inView: function(ref) {
var autoplay = ref.autoplay;
return autoplay === 'inview';
}
},
connected: function() {
if (this.inView && !hasAttr(this.$el, 'preload')) {
this.$el.preload = 'none';
}
this.player = new Player(this.$el);
if (this.automute) {
this.player.mute();
}
},
update: {
read: function() {
return !this.player
? false
: {
visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
inView: this.inView && isInView(this.$el)
};
},
write: function(ref) {
var visible = ref.visible;
var inView = ref.inView;
if (!visible || this.inView && !inView) {
this.player.pause();
} else if (this.autoplay === true || this.inView && inView) {
this.player.play();
}
},
events: ['resize', 'scroll']
}
};
var Cover = {
mixins: [Class, Video],
props: {
width: Number,
height: Number
},
data: {
automute: true
},
update: {
read: function() {
var el = this.$el;
var ref = el.parentNode;
var height = ref.offsetHeight;
var width = ref.offsetWidth;
var dim = Dimensions.cover(
{
width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight
},
{
width: width + (width % 2 ? 1 : 0),
height: height + (height % 2 ? 1 : 0)
}
);
if (!dim.width || !dim.height) {
return false;
}
return dim;
},
write: function(ref) {
var height = ref.height;
var width = ref.width;
css(this.$el, {height: height, width: width});
},
events: ['resize']
}
};
var Position = {
props: {
pos: String,
offset: null,
flip: Boolean,
clsPos: String
},
data: {
pos: ("bottom-" + (!isRtl ? 'left' : 'right')),
flip: true,
offset: false,
clsPos: ''
},
computed: {
pos: function(ref) {
var pos = ref.pos;
return (pos + (!includes(pos, '-') ? '-center' : '')).split('-');
},
dir: function() {
return this.pos[0];
},
align: function() {
return this.pos[1];
}
},
methods: {
positionAt: function(element, target, boundary) {
removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?"));
css(element, {top: '', left: ''});
var node;
var ref = this;
var offset$1 = ref.offset;
var axis = this.getAxis();
if (!isNumeric(offset$1)) {
node = $(offset$1);
offset$1 = node
? offset(node)[axis === 'x' ? 'left' : 'top'] - offset(target)[axis === 'x' ? 'right' : 'bottom']
: 0;
}
var ref$1 = positionAt(
element,
target,
axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))),
axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)),
axis === 'x' ? ("" + (this.dir === 'left' ? -offset$1 : offset$1)) : (" " + (this.dir === 'top' ? -offset$1 : offset$1)),
null,
this.flip,
boundary
).target;
var x = ref$1.x;
var y = ref$1.y;
this.dir = axis === 'x' ? x : y;
this.align = axis === 'x' ? y : x;
toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false);
},
getAxis: function() {
return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
}
}
};
var active;
var Drop = {
mixins: [Position, Togglable],
args: 'pos',
props: {
mode: 'list',
toggle: Boolean,
boundary: Boolean,
boundaryAlign: Boolean,
delayShow: Number,
delayHide: Number,
clsDrop: String
},
data: {
mode: ['click', 'hover'],
toggle: '- *',
boundary: window,
boundaryAlign: false,
delayShow: 0,
delayHide: 800,
clsDrop: false,
hoverIdle: 200,
animation: ['uk-animation-fade'],
cls: 'uk-open'
},
computed: {
boundary: function(ref, $el) {
var boundary = ref.boundary;
return query(boundary, $el);
},
clsDrop: function(ref) {
var clsDrop = ref.clsDrop;
return clsDrop || ("uk-" + (this.$options.name));
},
clsPos: function() {
return this.clsDrop;
}
},
created: function() {
this.tracker = new MouseTracker();
},
connected: function() {
addClass(this.$el, this.clsDrop);
var ref = this.$props;
var toggle = ref.toggle;
this.toggle = toggle && this.$create('toggle', query(toggle, this.$el), {
target: this.$el,
mode: this.mode
});
!this.toggle && trigger(this.$el, 'updatearia');
},
events: [
{
name: 'click',
delegate: function() {
return ("." + (this.clsDrop) + "-close");
},
handler: function(e) {
e.preventDefault();
this.hide(false);
}
},
{
name: 'click',
delegate: function() {
return 'a[href^="#"]';
},
handler: function(ref) {
var defaultPrevented = ref.defaultPrevented;
var hash = ref.current.hash;
if (!defaultPrevented && hash && !within(hash, this.$el)) {
this.hide(false);
}
}
},
{
name: 'beforescroll',
handler: function() {
this.hide(false);
}
},
{
name: 'toggle',
self: true,
handler: function(e, toggle) {
e.preventDefault();
if (this.isToggled()) {
this.hide(false);
} else {
this.show(toggle, false);
}
}
},
{
name: pointerEnter,
filter: function() {
return includes(this.mode, 'hover');
},
handler: function(e) {
if (isTouch(e)) {
return;
}
if (active
&& active !== this
&& active.toggle
&& includes(active.toggle.mode, 'hover')
&& !within(e.target, active.toggle.$el)
&& !pointInRect({x: e.pageX, y: e.pageY}, offset(active.$el))
) {
active.hide(false);
}
e.preventDefault();
this.show(this.toggle);
}
},
{
name: 'toggleshow',
handler: function(e, toggle) {
if (toggle && !includes(toggle.target, this.$el)) {
return;
}
e.preventDefault();
this.show(toggle || this.toggle);
}
},
{
name: ("togglehide " + pointerLeave),
handler: function(e, toggle) {
if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) {
return;
}
e.preventDefault();
if (this.toggle && includes(this.toggle.mode, 'hover')) {
this.hide();
}
}
},
{
name: 'beforeshow',
self: true,
handler: function() {
this.clearTimers();
Animation.cancel(this.$el);
this.position();
}
},
{
name: 'show',
self: true,
handler: function() {
var this$1 = this;
this.tracker.init();
trigger(this.$el, 'updatearia');
// If triggered from an click event handler, delay adding the click handler
var off = delayOn(document, 'click', function (ref) {
var defaultPrevented = ref.defaultPrevented;
var target = ref.target;
if (!defaultPrevented && !within(target, this$1.$el) && !(this$1.toggle && within(target, this$1.toggle.$el))) {
this$1.hide(false);
}
});
once(this.$el, 'hide', off, {self: true});
}
},
{
name: 'beforehide',
self: true,
handler: function() {
this.clearTimers();
}
},
{
name: 'hide',
handler: function(ref) {
var target = ref.target;
if (this.$el !== target) {
active = active === null && within(target, this.$el) && this.isToggled() ? this : active;
return;
}
active = this.isActive() ? null : active;
trigger(this.$el, 'updatearia');
this.tracker.cancel();
}
},
{
name: 'updatearia',
self: true,
handler: function(e, toggle) {
e.preventDefault();
this.updateAria(this.$el);
if (toggle || this.toggle) {
attr((toggle || this.toggle).$el, 'aria-expanded', this.isToggled());
toggleClass(this.toggle.$el, this.cls, this.isToggled());
}
}
}
],
update: {
write: function() {
if (this.isToggled() && !Animation.inProgress(this.$el)) {
this.position();
}
},
events: ['resize']
},
methods: {
show: function(toggle, delay) {
var this$1 = this;
if ( delay === void 0 ) delay = true;
var show = function () { return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); };
var tryShow = function () {
this$1.toggle = toggle || this$1.toggle;
this$1.clearTimers();
if (this$1.isActive()) {
return;
} else if (delay && active && active !== this$1 && active.isDelaying) {
this$1.showTimer = setTimeout(this$1.show, 10);
return;
} else if (this$1.isParentOf(active)) {
if (active.hideTimer) {
active.hide(false);
} else {
return;
}
} else if (this$1.isChildOf(active)) {
active.clearTimers();
} else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) {
var prev;
while (active && active !== prev && !this$1.isChildOf(active)) {
prev = active;
active.hide(false);
}
}
if (delay && this$1.delayShow) {
this$1.showTimer = setTimeout(show, this$1.delayShow);
} else {
show();
}
active = this$1;
};
if (toggle && this.toggle && toggle.$el !== this.toggle.$el) {
once(this.$el, 'hide', tryShow);
this.hide(false);
} else {
tryShow();
}
},
hide: function(delay) {
var this$1 = this;
if ( delay === void 0 ) delay = true;
var hide = function () { return this$1.toggleNow(this$1.$el, false); };
this.clearTimers();
this.isDelaying = this.tracker.movesTo(this.$el);
if (delay && this.isDelaying) {
this.hideTimer = setTimeout(this.hide, this.hoverIdle);
} else if (delay && this.delayHide) {
this.hideTimer = setTimeout(hide, this.delayHide);
} else {
hide();
}
},
clearTimers: function() {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
this.showTimer = null;
this.hideTimer = null;
this.isDelaying = false;
},
isActive: function() {
return active === this;
},
isChildOf: function(drop) {
return drop && drop !== this && within(this.$el, drop.$el);
},
isParentOf: function(drop) {
return drop && drop !== this && within(drop.$el, this.$el);
},
position: function() {
removeClasses(this.$el, ((this.clsDrop) + "-(stack|boundary)"));
css(this.$el, {top: '', left: '', display: 'block'});
toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign);
var boundary = offset(this.boundary);
var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el);
if (this.align === 'justify') {
var prop = this.getAxis() === 'y' ? 'width' : 'height';
css(this.$el, prop, alignTo[prop]);
} else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) {
addClass(this.$el, ((this.clsDrop) + "-stack"));
}
this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary);
css(this.$el, 'display', '');
}
}
};
function delayOn(el, type, fn) {
var off = once(el, type, function () { return off = on(el, type, fn); }
, true);
return function () { return off(); };
}
var Dropdown = {
extends: Drop
};
var FormCustom = {
mixins: [Class],
args: 'target',
props: {
target: Boolean
},
data: {
target: false
},
computed: {
input: function(_, $el) {
return $(selInput, $el);
},
state: function() {
return this.input.nextElementSibling;
},
target: function(ref, $el) {
var target = ref.target;
return target && (target === true
&& this.input.parentNode === $el
&& this.input.nextElementSibling
|| query(target, $el));
}
},
update: function() {
var ref = this;
var target = ref.target;
var input = ref.input;
if (!target) {
return;
}
var option;
var prop = isInput(target) ? 'value' : 'textContent';
var prev = target[prop];
var value = input.files && input.files[0]
? input.files[0].name
: matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0]) // eslint-disable-line prefer-destructuring
? option.textContent
: input.value;
if (prev !== value) {
target[prop] = value;
}
},
events: [
{
name: 'change',
handler: function() {
this.$emit();
}
},
{
name: 'reset',
el: function() {
return closest(this.$el, 'form');
},
handler: function() {
this.$emit();
}
}
]
};
// Deprecated
var Gif = {
update: {
read: function(data) {
var inview = isInView(this.$el);
if (!inview || data.isInView === inview) {
return false;
}
data.isInView = inview;
},
write: function() {
this.$el.src = this.$el.src;
},
events: ['scroll', 'resize']
}
};
var Margin = {
props: {
margin: String,
firstColumn: Boolean
},
data: {
margin: 'uk-margin-small-top',
firstColumn: 'uk-first-column'
},
update: {
read: function(data) {
var items = this.$el.children;
var rows = [[]];
if (!items.length || !isVisible(this.$el)) {
return data.rows = rows;
}
data.rows = getRows(items);
data.stacks = !data.rows.some(function (row) { return row.length > 1; });
},
write: function(ref) {
var this$1 = this;
var rows = ref.rows;
rows.forEach(function (row, i) { return row.forEach(function (el, j) {
toggleClass(el, this$1.margin, i !== 0);
toggleClass(el, this$1.firstColumn, j === 0);
}); }
);
},
events: ['resize']
}
};
function getRows(items) {
var rows = [[]];
for (var i = 0; i < items.length; i++) {
var el = items[i];
var dim = getOffset(el);
if (!dim.height) {
continue;
}
for (var j = rows.length - 1; j >= 0; j--) {
var row = rows[j];
if (!row[0]) {
row.push(el);
break;
}
var leftDim = (void 0);
if (row[0].offsetParent === el.offsetParent) {
leftDim = getOffset(row[0]);
} else {
dim = getOffset(el, true);
leftDim = getOffset(row[0], true);
}
if (dim.top >= leftDim.bottom - 1 && dim.top !== leftDim.top) {
rows.push([el]);
break;
}
if (dim.bottom > leftDim.top) {
if (dim.left < leftDim.left && !isRtl) {
row.unshift(el);
break;
}
row.push(el);
break;
}
if (j === 0) {
rows.unshift([el]);
break;
}
}
}
return rows;
}
function getOffset(element, offset) {
var assign;
if ( offset === void 0 ) offset = false;
var offsetTop = element.offsetTop;
var offsetLeft = element.offsetLeft;
var offsetHeight = element.offsetHeight;
if (offset) {
(assign = offsetPosition(element), offsetTop = assign[0], offsetLeft = assign[1]);
}
return {
top: offsetTop,
left: offsetLeft,
height: offsetHeight,
bottom: offsetTop + offsetHeight
};
}
var Grid = {
extends: Margin,
mixins: [Class],
name: 'grid',
props: {
masonry: Boolean,
parallax: Number
},
data: {
margin: 'uk-grid-margin',
clsStack: 'uk-grid-stack',
masonry: false,
parallax: 0
},
computed: {
length: function(_, $el) {
return $el.children.length;
},
parallax: function(ref) {
var parallax = ref.parallax;
return parallax && this.length ? Math.abs(parallax) : '';
}
},
connected: function() {
this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top');
},
update: [
{
read: function(ref) {
var rows = ref.rows;
if (this.masonry || this.parallax) {
rows = rows.map(function (elements) { return sortBy(elements, 'offsetLeft'); });
if (isRtl) {
rows.map(function (row) { return row.reverse(); });
}
}
var transitionInProgress = rows.some(function (elements) { return elements.some(Transition.inProgress); });
var translates = false;
var elHeight = '';
if (this.masonry && this.length) {
var height = 0;
translates = rows.reduce(function (translates, row, i) {
translates[i] = row.map(function (_, j) { return i === 0 ? 0 : toFloat(translates[i - 1][j]) + (height - toFloat(rows[i - 1][j] && rows[i - 1][j].offsetHeight)); });
height = row.reduce(function (height, el) { return Math.max(height, el.offsetHeight); }, 0);
return translates;
}, []);
elHeight = maxColumnHeight(rows) + getMarginTop(this.$el, this.margin) * (rows.length - 1);
}
var padding = this.parallax && getPaddingBottom(this.parallax, rows, translates);
return {padding: padding, rows: rows, translates: translates, height: !transitionInProgress ? elHeight : false};
},
write: function(ref) {
var stacks = ref.stacks;
var height = ref.height;
var padding = ref.padding;
toggleClass(this.$el, this.clsStack, stacks);
css(this.$el, 'paddingBottom', padding);
height !== false && css(this.$el, 'height', height);
},
events: ['resize']
},
{
read: function(ref) {
var height$1 = ref.height;
return {
scrolled: this.parallax
? scrolledOver(this.$el, height$1 ? height$1 - height(this.$el) : 0) * this.parallax
: false
};
},
write: function(ref) {
var rows = ref.rows;
var scrolled = ref.scrolled;
var translates = ref.translates;
if (scrolled === false && !translates) {
return;
}
rows.forEach(function (row, i) { return row.forEach(function (el, j) { return css(el, 'transform', !scrolled && !translates ? '' : ("translateY(" + ((translates && -translates[i][j]) + (scrolled ? j % 2 ? scrolled : scrolled / 8 : 0)) + "px)")); }
); }
);
},
events: ['scroll', 'resize']
}
]
};
function getPaddingBottom(distance, rows, translates) {
var column = 0;
var max = 0;
var maxScrolled = 0;
for (var i = rows.length - 1; i >= 0; i--) {
for (var j = column; j < rows[i].length; j++) {
var el = rows[i][j];
var bottom = el.offsetTop + height(el) + (translates && -translates[i][j]);
max = Math.max(max, bottom);
maxScrolled = Math.max(maxScrolled, bottom + (j % 2 ? distance : distance / 8));
column++;
}
}
return maxScrolled - max;
}
function getMarginTop(root, cls) {
var nodes = toNodes(root.children);
var ref = nodes.filter(function (el) { return hasClass(el, cls); });
var node = ref[0];
return toFloat(node
? css(node, 'marginTop')
: css(nodes[0], 'paddingLeft'));
}
function maxColumnHeight(rows) {
return Math.max.apply(Math, rows.reduce(function (sum, row) {
row.forEach(function (el, i) { return sum[i] = (sum[i] || 0) + el.offsetHeight; });
return sum;
}, []));
}
// IE 11 fix (min-height on a flex container won't apply to its flex items)
var FlexBug = isIE ? {
props: {
selMinHeight: String
},
data: {
selMinHeight: false,
forceHeight: false
},
computed: {
elements: function(ref, $el) {
var selMinHeight = ref.selMinHeight;
return selMinHeight ? $$(selMinHeight, $el) : [$el];
}
},
update: [
{
read: function() {
css(this.elements, 'height', '');
},
order: -5,
events: ['resize']
},
{
write: function() {
var this$1 = this;
this.elements.forEach(function (el) {
var height = toFloat(css(el, 'minHeight'));
if (height && (this$1.forceHeight || Math.round(height + boxModelAdjust('height', el, 'content-box')) >= el.offsetHeight)) {
css(el, 'height', height);
}
});
},
order: 5,
events: ['resize']
}
]
} : {};
var HeightMatch = {
mixins: [FlexBug],
args: 'target',
props: {
target: String,
row: Boolean
},
data: {
target: '> *',
row: true,
forceHeight: true
},
computed: {
elements: function(ref, $el) {
var target = ref.target;
return $$(target, $el);
}
},
update: {
read: function() {
return {
rows: (this.row ? getRows(this.elements) : [this.elements]).map(match)
};
},
write: function(ref) {
var rows = ref.rows;
rows.forEach(function (ref) {
var heights = ref.heights;
var elements = ref.elements;
return elements.forEach(function (el, i) { return css(el, 'minHeight', heights[i]); }
);
}
);
},
events: ['resize']
}
};
function match(elements) {
var assign;
if (elements.length < 2) {
return {heights: [''], elements: elements};
}
var ref = getHeights(elements);
var heights = ref.heights;
var max = ref.max;
var hasMinHeight = elements.some(function (el) { return el.style.minHeight; });
var hasShrunk = elements.some(function (el, i) { return !el.style.minHeight && heights[i] < max; });
if (hasMinHeight && hasShrunk) {
css(elements, 'minHeight', '');
((assign = getHeights(elements), heights = assign.heights, max = assign.max));
}
heights = elements.map(function (el, i) { return heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max; }
);
return {heights: heights, elements: elements};
}
function getHeights(elements) {
var heights = elements.map(function (el) { return offset(el).height - boxModelAdjust('height', el, 'content-box'); });
var max = Math.max.apply(null, heights);
return {heights: heights, max: max};
}
var HeightViewport = {
mixins: [FlexBug],
props: {
expand: Boolean,
offsetTop: Boolean,
offsetBottom: Boolean,
minHeight: Number
},
data: {
expand: false,
offsetTop: false,
offsetBottom: false,
minHeight: 0
},
update: {
read: function(ref) {
var prev = ref.minHeight;
if (!isVisible(this.$el)) {
return false;
}
var minHeight = '';
var box = boxModelAdjust('height', this.$el, 'content-box');
if (this.expand) {
this.$el.dataset.heightExpand = '';
if ($('[data-height-expand]') !== this.$el) {
return false;
}
minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) - box || '';
} else {
// on mobile devices (iOS and Android) window.innerHeight !== 100vh
minHeight = 'calc(100vh';
if (this.offsetTop) {
var ref$1 = offset(this.$el);
var top = ref$1.top;
minHeight += top > 0 && top < height(window) / 2 ? (" - " + top + "px") : '';
}
if (this.offsetBottom === true) {
minHeight += " - " + (offsetHeight(this.$el.nextElementSibling)) + "px";
} else if (isNumeric(this.offsetBottom)) {
minHeight += " - " + (this.offsetBottom) + "vh";
} else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
minHeight += " - " + (toFloat(this.offsetBottom)) + "px";
} else if (isString(this.offsetBottom)) {
minHeight += " - " + (offsetHeight(query(this.offsetBottom, this.$el))) + "px";
}
minHeight += (box ? (" - " + box + "px") : '') + ")";
}
return {minHeight: minHeight, prev: prev};
},
write: function(ref) {
var minHeight = ref.minHeight;
var prev = ref.prev;
css(this.$el, {minHeight: minHeight});
if (minHeight !== prev) {
this.$update(this.$el, 'resize');
}
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
css(this.$el, 'minHeight', this.minHeight);
}
},
events: ['resize']
}
};
function offsetHeight(el) {
return el && offset(el).height || 0;
}
var Svg = {
args: 'src',
props: {
id: Boolean,
icon: String,
src: String,
style: String,
width: Number,
height: Number,
ratio: Number,
class: String,
strokeAnimation: Boolean,
focusable: Boolean, // IE 11
attributes: 'list'
},
data: {
ratio: 1,
include: ['style', 'class', 'focusable'],
class: '',
strokeAnimation: false
},
beforeConnect: function() {
var this$1 = this;
var assign;
this.class += ' uk-svg';
if (!this.icon && includes(this.src, '#')) {
var parts = this.src.split('#');
if (parts.length > 1) {
(assign = parts, this.src = assign[0], this.icon = assign[1]);
}
}
this.svg = this.getSvg().then(function (el) {
this$1.applyAttributes(el);
return this$1.svgEl = insertSVG(el, this$1.$el);
}, noop);
},
disconnected: function() {
var this$1 = this;
if (isVoidElement(this.$el)) {
attr(this.$el, 'hidden', null);
}
if (this.svg) {
this.svg.then(function (svg) { return (!this$1._connected || svg !== this$1.svgEl) && remove(svg); }, noop);
}
this.svg = this.svgEl = null;
},
update: {
read: function() {
return !!(this.strokeAnimation && this.svgEl && isVisible(this.svgEl));
},
write: function() {
applyAnimation(this.svgEl);
},
type: ['resize']
},
methods: {
getSvg: function() {
var this$1 = this;
return loadSVG(this.src).then(function (svg) { return parseSVG(svg, this$1.icon) || Promise.reject('SVG not found.'); }
);
},
applyAttributes: function(el) {
var this$1 = this;
for (var prop in this.$options.props) {
if (this[prop] && includes(this.include, prop)) {
attr(el, prop, this[prop]);
}
}
for (var attribute in this.attributes) {
var ref = this.attributes[attribute].split(':', 2);
var prop$1 = ref[0];
var value = ref[1];
attr(el, prop$1, value);
}
if (!this.id) {
removeAttr(el, 'id');
}
var props = ['width', 'height'];
var dimensions = [this.width, this.height];
if (!dimensions.some(function (val) { return val; })) {
dimensions = props.map(function (prop) { return attr(el, prop); });
}
var viewBox = attr(el, 'viewBox');
if (viewBox && !dimensions.some(function (val) { return val; })) {
dimensions = viewBox.split(' ').slice(2);
}
dimensions.forEach(function (val, i) {
val = (val | 0) * this$1.ratio;
val && attr(el, props[i], val);
if (val && !dimensions[i ^ 1]) {
removeAttr(el, props[i ^ 1]);
}
});
attr(el, 'data-svg', this.icon || this.src);
}
}
};
var svgs = {};
function loadSVG(src) {
if (svgs[src]) {
return svgs[src];
}
return svgs[src] = new Promise(function (resolve, reject) {
if (!src) {
reject();
return;
}
if (startsWith(src, 'data:')) {
resolve(decodeURIComponent(src.split(',')[1]));
} else {
ajax(src).then(
function (xhr) { return resolve(xhr.response); },
function () { return reject('SVG not found.'); }
);
}
});
}
function parseSVG(svg, icon) {
if (icon && includes(svg, '<symbol')) {
svg = parseSymbols(svg, icon) || svg;
}
svg = $(svg.substr(svg.indexOf('<svg')));
return svg && svg.hasChildNodes() && svg;
}
var symbolRe = /<symbol(.*?id=(['"])(.*?)\2[^]*?<\/)symbol>/g;
var symbols = {};
function parseSymbols(svg, icon) {
if (!symbols[svg]) {
symbols[svg] = {};
var match;
while ((match = symbolRe.exec(svg))) {
symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + (match[1]) + "svg>";
}
symbolRe.lastIndex = 0;
}
return symbols[svg][icon];
}
function applyAnimation(el) {
var length = getMaxPathLength(el);
if (length) {
el.style.setProperty('--uk-animation-stroke', length);
}
}
function getMaxPathLength(el) {
return Math.ceil(Math.max.apply(Math, $$('[stroke]', el).map(function (stroke) { return stroke.getTotalLength && stroke.getTotalLength() || 0; }
).concat([0])));
}
function insertSVG(el, root) {
if (isVoidElement(root) || root.tagName === 'CANVAS') {
attr(root, 'hidden', true);
var next = root.nextElementSibling;
return equals(el, next)
? next
: after(root, el);
} else {
var last = root.lastElementChild;
return equals(el, last)
? last
: append(root, el);
}
}
function equals(el, other) {
return attr(el, 'data-svg') === attr(other, 'data-svg');
}
var closeIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"1\" y1=\"1\" x2=\"13\" y2=\"13\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"13\" y1=\"1\" x2=\"1\" y2=\"13\"/></svg>";
var closeLarge = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"1\" y1=\"1\" x2=\"19\" y2=\"19\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"19\" y1=\"1\" x2=\"1\" y2=\"19\"/></svg>";
var marker = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"9\" y=\"4\" width=\"1\" height=\"11\"/><rect x=\"4\" y=\"9\" width=\"11\" height=\"1\"/></svg>";
var navbarToggleIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect y=\"9\" width=\"20\" height=\"2\"/><rect y=\"3\" width=\"20\" height=\"2\"/><rect y=\"15\" width=\"20\" height=\"2\"/></svg>";
var overlayIcon = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"19\" y=\"0\" width=\"1\" height=\"40\"/><rect x=\"0\" y=\"19\" width=\"40\" height=\"1\"/></svg>";
var paginationNext = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 1 6 6 1 11\"/></svg>";
var paginationPrevious = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"6 1 1 6 6 11\"/></svg>";
var searchIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"9\" cy=\"9\" r=\"7\"/><path fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M14,14 L18,18 L14,14 Z\"/></svg>";
var searchLarge = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" cx=\"17.5\" cy=\"17.5\" r=\"16.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" x1=\"38\" y1=\"39\" x2=\"29\" y2=\"30\"/></svg>";
var searchNavbar = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"10.5\" cy=\"10.5\" r=\"9.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"23\" y1=\"23\" x2=\"17\" y2=\"17\"/></svg>";
var slidenavNext = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"1.225,23 12.775,12 1.225,1 \"/></svg>";
var slidenavNextLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"4.002,38.547 22.527,20.024 4,1.5 \"/></svg>";
var slidenavPrevious = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"12.775,1 1.225,12 12.775,23 \"/></svg>";
var slidenavPreviousLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"20.527,1.5 2,20.024 20.525,38.547 \"/></svg>";
var spinner = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" cx=\"15\" cy=\"15\" r=\"14\"/></svg>";
var totop = "<svg width=\"18\" height=\"10\" viewBox=\"0 0 18 10\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 9 9 1 17 9 \"/></svg>";
var parsed = {};
var icons = {
spinner: spinner,
totop: totop,
marker: marker,
'close-icon': closeIcon,
'close-large': closeLarge,
'navbar-toggle-icon': navbarToggleIcon,
'overlay-icon': overlayIcon,
'pagination-next': paginationNext,
'pagination-previous': paginationPrevious,
'search-icon': searchIcon,
'search-large': searchLarge,
'search-navbar': searchNavbar,
'slidenav-next': slidenavNext,
'slidenav-next-large': slidenavNextLarge,
'slidenav-previous': slidenavPrevious,
'slidenav-previous-large': slidenavPreviousLarge
};
var Icon = {
install: install,
extends: Svg,
args: 'icon',
props: ['icon'],
data: {
include: ['focusable']
},
isIcon: true,
beforeConnect: function() {
addClass(this.$el, 'uk-icon');
},
methods: {
getSvg: function() {
var icon = getIcon(applyRtl(this.icon));
if (!icon) {
return Promise.reject('Icon not found.');
}
return Promise.resolve(icon);
}
}
};
var IconComponent = {
args: false,
extends: Icon,
data: function (vm) { return ({
icon: hyphenate(vm.constructor.options.name)
}); },
beforeConnect: function() {
addClass(this.$el, this.$name);
}
};
var Slidenav = {
extends: IconComponent,
beforeConnect: function() {
addClass(this.$el, 'uk-slidenav');
},
computed: {
icon: function(ref, $el) {
var icon = ref.icon;
return hasClass($el, 'uk-slidenav-large')
? (icon + "-large")
: icon;
}
}
};
var Search = {
extends: IconComponent,
computed: {
icon: function(ref, $el) {
var icon = ref.icon;
return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
? 'search-large'
: parents($el, '.uk-search-navbar').length
? 'search-navbar'
: icon;
}
}
};
var Close = {
extends: IconComponent,
computed: {
icon: function() {
return ("close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'));
}
}
};
var Spinner = {
extends: IconComponent,
connected: function() {
var this$1 = this;
this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this$1.ratio); }, noop);
}
};
function install(UIkit) {
UIkit.icon.add = function (name, svg) {
var obj;
var added = isString(name) ? (( obj = {}, obj[name] = svg, obj )) : name;
each(added, function (svg, name) {
icons[name] = svg;
delete parsed[name];
});
if (UIkit._initialized) {
apply(document.body, function (el) { return each(UIkit.getComponents(el), function (cmp) {
cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
}); }
);
}
};
}
function getIcon(icon) {
if (!icons[icon]) {
return null;
}
if (!parsed[icon]) {
parsed[icon] = $(icons[icon].trim());
}
return parsed[icon].cloneNode(true);
}
function applyRtl(icon) {
return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
}
var Img = {
args: 'dataSrc',
props: {
dataSrc: String,
dataSrcset: Boolean,
sizes: String,
width: Number,
height: Number,
offsetTop: String,
offsetLeft: String,
target: String
},
data: {
dataSrc: '',
dataSrcset: false,
sizes: false,
width: false,
height: false,
offsetTop: '50vh',
offsetLeft: 0,
target: false
},
computed: {
cacheKey: function(ref) {
var dataSrc = ref.dataSrc;
return ((this.$name) + "." + dataSrc);
},
width: function(ref) {
var width = ref.width;
var dataWidth = ref.dataWidth;
return width || dataWidth;
},
height: function(ref) {
var height = ref.height;
var dataHeight = ref.dataHeight;
return height || dataHeight;
},
sizes: function(ref) {
var sizes = ref.sizes;
var dataSizes = ref.dataSizes;
return sizes || dataSizes;
},
isImg: function(_, $el) {
return isImg($el);
},
target: {
get: function(ref) {
var target = ref.target;
return [this.$el].concat(queryAll(target, this.$el));
},
watch: function() {
this.observe();
}
},
offsetTop: function(ref) {
var offsetTop = ref.offsetTop;
return toPx(offsetTop, 'height');
},
offsetLeft: function(ref) {
var offsetLeft = ref.offsetLeft;
return toPx(offsetLeft, 'width');
}
},
connected: function() {
if (storage[this.cacheKey]) {
setSrcAttrs(this.$el, storage[this.cacheKey] || this.dataSrc, this.dataSrcset, this.sizes);
} else if (this.isImg && this.width && this.height) {
setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
}
this.observer = new IntersectionObserver(this.load, {
rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
});
requestAnimationFrame(this.observe);
},
disconnected: function() {
this.observer.disconnect();
},
update: {
read: function(ref) {
var this$1 = this;
var image = ref.image;
if (!image && document.readyState === 'complete') {
this.load(this.observer.takeRecords());
}
if (this.isImg) {
return false;
}
image && image.then(function (img) { return img && img.currentSrc !== '' && setSrcAttrs(this$1.$el, currentSrc(img)); });
},
write: function(data) {
if (this.dataSrcset && window.devicePixelRatio !== 1) {
var bgSize = css(this.$el, 'backgroundSize');
if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
css(this.$el, 'backgroundSize', ((data.bgSize) + "px"));
}
}
},
events: ['resize']
},
methods: {
load: function(entries) {
var this$1 = this;
// Old chromium based browsers (UC Browser) did not implement `isIntersecting`
if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
return;
}
this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
setSrcAttrs(this$1.$el, currentSrc(img), img.srcset, img.sizes);
storage[this$1.cacheKey] = currentSrc(img);
return img;
}, noop);
this.observer.disconnect();
},
observe: function() {
var this$1 = this;
if (!this._data.image && this._connected) {
this.target.forEach(function (el) { return this$1.observer.observe(el); });
}
}
}
};
function setSrcAttrs(el, src, srcset, sizes) {
if (isImg(el)) {
sizes && (el.sizes = sizes);
srcset && (el.srcset = srcset);
src && (el.src = src);
} else if (src) {
var change = !includes(el.style.backgroundImage, src);
if (change) {
css(el, 'backgroundImage', ("url(" + (escape(src)) + ")"));
trigger(el, createEvent('load', false));
}
}
}
function getPlaceholderImage(width, height, sizes) {
var assign;
if (sizes) {
((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
}
return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
}
var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
function sizesToPixel(sizes) {
var matches;
sizesRe.lastIndex = 0;
while ((matches = sizesRe.exec(sizes))) {
if (!matches[1] || window.matchMedia(matches[1]).matches) {
matches = evaluateSize(matches[2]);
break;
}
}
return matches || '100vw';
}
var sizeRe = /\d+(?:\w+|%)/g;
var additionRe = /[+-]?(\d+)/g;
function evaluateSize(size) {
return startsWith(size, 'calc')
? size
.substring(5, size.length - 1)
.replace(sizeRe, function (size) { return toPx(size); })
.replace(/ /g, '')
.match(additionRe)
.reduce(function (a, b) { return a + +b; }, 0)
: size;
}
var srcSetRe = /\s+\d+w\s*(?:,|$)/g;
function getSourceSize(srcset, sizes) {
var srcSize = toPx(sizesToPixel(sizes));
var descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort(function (a, b) { return a - b; });
return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
}
function isImg(el) {
return el.tagName === 'IMG';
}
function currentSrc(el) {
return el.currentSrc || el.src;
}
var key = '__test__';
var storage;
// workaround for Safari's private browsing mode and accessing sessionStorage in Blink
try {
storage = window.sessionStorage || {};
storage[key] = 1;
delete storage[key];
} catch (e) {
storage = {};
}
var Media = {
props: {
media: Boolean
},
data: {
media: false
},
computed: {
matchMedia: function() {
var media = toMedia(this.media);
return !media || window.matchMedia(media).matches;
}
}
};
function toMedia(value) {
if (isString(value)) {
if (value[0] === '@') {
var name = "breakpoint-" + (value.substr(1));
value = toFloat(getCssVar(name));
} else if (isNaN(value)) {
return value;
}
}
return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false;
}
var Leader = {
mixins: [Class, Media],
props: {
fill: String
},
data: {
fill: '',
clsWrapper: 'uk-leader-fill',
clsHide: 'uk-leader-hide',
attrFill: 'data-fill'
},
computed: {
fill: function(ref) {
var fill = ref.fill;
return fill || getCssVar('leader-fill-content');
}
},
connected: function() {
var assign;
(assign = wrapInner(this.$el, ("<span class=\"" + (this.clsWrapper) + "\">")), this.wrapper = assign[0]);
},
disconnected: function() {
unwrap(this.wrapper.childNodes);
},
update: {
read: function(ref) {
var changed = ref.changed;
var width = ref.width;
var prev = width;
width = Math.floor(this.$el.offsetWidth / 2);
return {
width: width,
fill: this.fill,
changed: changed || prev !== width,
hide: !this.matchMedia
};
},
write: function(data) {
toggleClass(this.wrapper, this.clsHide, data.hide);
if (data.changed) {
data.changed = false;
attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
}
},
events: ['resize']
}
};
var Container = {
props: {
container: Boolean
},
data: {
container: true
},
computed: {
container: function(ref) {
var container = ref.container;
return container === true && this.$container || container && $(container);
}
}
};
var active$1 = [];
var Modal = {
mixins: [Class, Container, Togglable],
props: {
selPanel: String,
selClose: String,
escClose: Boolean,
bgClose: Boolean,
stack: Boolean
},
data: {
cls: 'uk-open',
escClose: true,
bgClose: true,
overlay: true,
stack: false
},
computed: {
panel: function(ref, $el) {
var selPanel = ref.selPanel;
return $(selPanel, $el);
},
transitionElement: function() {
return this.panel;
},
bgClose: function(ref) {
var bgClose = ref.bgClose;
return bgClose && this.panel;
}
},
beforeDisconnect: function() {
if (this.isToggled()) {
this.toggleNow(this.$el, false);
}
},
events: [
{
name: 'click',
delegate: function() {
return this.selClose;
},
handler: function(e) {
e.preventDefault();
this.hide();
}
},
{
name: 'toggle',
self: true,
handler: function(e) {
if (e.defaultPrevented) {
return;
}
e.preventDefault();
this.toggle();
}
},
{
name: 'beforeshow',
self: true,
handler: function(e) {
if (includes(active$1, this)) {
return false;
}
if (!this.stack && active$1.length) {
Promise.all(active$1.map(function (modal) { return modal.hide(); })).then(this.show);
e.preventDefault();
} else {
active$1.push(this);
}
}
},
{
name: 'show',
self: true,
handler: function() {
var this$1 = this;
if (width(window) - width(document) && this.overlay) {
css(document.body, 'overflowY', 'scroll');
}
addClass(document.documentElement, this.clsPage);
if (this.bgClose) {
once(this.$el, 'hide', delayOn(document, 'click', function (ref) {
var defaultPrevented = ref.defaultPrevented;
var target = ref.target;
var current = last(active$1);
if (!defaultPrevented
&& current === this$1
&& (!current.overlay || within(target, current.$el))
&& !within(target, current.panel)
) {
current.hide();
}
}), {self: true});
}
if (this.escClose) {
once(this.$el, 'hide', on(document, 'keydown', function (e) {
var current = last(active$1);
if (e.keyCode === 27 && current === this$1) {
e.preventDefault();
current.hide();
}
}), {self: true});
}
}
},
{
name: 'hidden',
self: true,
handler: function() {
var this$1 = this;
active$1.splice(active$1.indexOf(this), 1);
if (!active$1.length) {
css(document.body, 'overflowY', '');
}
if (!active$1.some(function (modal) { return modal.clsPage === this$1.clsPage; })) {
removeClass(document.documentElement, this.clsPage);
}
}
}
],
methods: {
toggle: function() {
return this.isToggled() ? this.hide() : this.show();
},
show: function() {
var this$1 = this;
if (this.container && this.$el.parentNode !== this.container) {
append(this.container, this.$el);
return new Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); }
); }
);
}
return this.toggleElement(this.$el, true, animate$1(this));
},
hide: function() {
return this.toggleElement(this.$el, false, animate$1(this));
}
}
};
function animate$1(ref) {
var transitionElement = ref.transitionElement;
var _toggle = ref._toggle;
return function (el, show) { return new Promise(function (resolve, reject) { return once(el, 'show hide', function () {
el._reject && el._reject();
el._reject = reject;
_toggle(el, show);
var off = once(transitionElement, 'transitionstart', function () {
once(transitionElement, 'transitionend transitioncancel', resolve, {self: true});
clearTimeout(timer);
}, {self: true});
var timer = setTimeout(function () {
off();
resolve();
}, toMs(css(transitionElement, 'transitionDuration')));
}); }
); };
}
var Modal$1 = {
install: install$1,
mixins: [Modal],
data: {
clsPage: 'uk-modal-page',
selPanel: '.uk-modal-dialog',
selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full'
},
events: [
{
name: 'show',
self: true,
handler: function() {
if (hasClass(this.panel, 'uk-margin-auto-vertical')) {
addClass(this.$el, 'uk-flex');
} else {
css(this.$el, 'display', 'block');
}
height(this.$el); // force reflow
}
},
{
name: 'hidden',
self: true,
handler: function() {
css(this.$el, 'display', '');
removeClass(this.$el, 'uk-flex');
}
}
]
};
function install$1(UIkit) {
UIkit.modal.dialog = function (content, options) {
var dialog = UIkit.modal((" <div class=\"uk-modal\"> <div class=\"uk-modal-dialog\">" + content + "</div> </div> "), options);
dialog.show();
on(dialog.$el, 'hidden', function () { return Promise.resolve(function () { return dialog.$destroy(true); }); }, {self: true});
return dialog;
};
UIkit.modal.alert = function (message, options) {
options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options);
return new Promise(
function (resolve) { return on(UIkit.modal.dialog((" <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (options.labels.ok) + "</button> </div> "), options).$el, 'hide', resolve); }
);
};
UIkit.modal.confirm = function (message, options) {
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
return new Promise(function (resolve, reject) {
var confirm = UIkit.modal.dialog((" <form> <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\" autofocus>" + (options.labels.ok) + "</button> </div> </form> "), options);
var resolved = false;
on(confirm.$el, 'submit', 'form', function (e) {
e.preventDefault();
resolve();
resolved = true;
confirm.hide();
});
on(confirm.$el, 'hide', function () {
if (!resolved) {
reject();
}
});
});
};
UIkit.modal.prompt = function (message, value, options) {
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
return new Promise(function (resolve) {
var prompt = UIkit.modal.dialog((" <form class=\"uk-form-stacked\"> <div class=\"uk-modal-body\"> <label>" + (isString(message) ? message : html(message)) + "</label> <input class=\"uk-input\" autofocus> </div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\">" + (options.labels.ok) + "</button> </div> </form> "), options),
input = $('input', prompt.$el);
input.value = value;
var resolved = false;
on(prompt.$el, 'submit', 'form', function (e) {
e.preventDefault();
resolve(input.value);
resolved = true;
prompt.hide();
});
on(prompt.$el, 'hide', function () {
if (!resolved) {
resolve(null);
}
});
});
};
UIkit.modal.labels = {
ok: 'Ok',
cancel: 'Cancel'
};
}
var Nav = {
extends: Accordion,
data: {
targets: '> .uk-parent',
toggle: '> a',
content: '> ul'
}
};
var Navbar = {
mixins: [Class, FlexBug],
props: {
dropdown: String,
mode: 'list',
align: String,
offset: Number,
boundary: Boolean,
boundaryAlign: Boolean,
clsDrop: String,
delayShow: Number,
delayHide: Number,
dropbar: Boolean,
dropbarMode: String,
dropbarAnchor: Boolean,
duration: Number
},
data: {
dropdown: '.uk-navbar-nav > li',
align: !isRtl ? 'left' : 'right',
clsDrop: 'uk-navbar-dropdown',
mode: undefined,
offset: undefined,
delayShow: undefined,
delayHide: undefined,
boundaryAlign: undefined,
flip: 'x',
boundary: true,
dropbar: false,
dropbarMode: 'slide',
dropbarAnchor: false,
duration: 200,
forceHeight: true,
selMinHeight: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle'
},
computed: {
boundary: function(ref, $el) {
var boundary = ref.boundary;
var boundaryAlign = ref.boundaryAlign;
return (boundary === true || boundaryAlign) ? $el : boundary;
},
dropbarAnchor: function(ref, $el) {
var dropbarAnchor = ref.dropbarAnchor;
return query(dropbarAnchor, $el);
},
pos: function(ref) {
var align = ref.align;
return ("bottom-" + align);
},
dropdowns: function(ref, $el) {
var dropdown = ref.dropdown;
var clsDrop = ref.clsDrop;
return $$((dropdown + " ." + clsDrop), $el);
}
},
beforeConnect: function() {
var ref = this.$props;
var dropbar = ref.dropbar;
this.dropbar = dropbar && (query(dropbar, this.$el) || $('+ .uk-navbar-dropbar', this.$el) || $('<div></div>'));
if (this.dropbar) {
addClass(this.dropbar, 'uk-navbar-dropbar');
if (this.dropbarMode === 'slide') {
addClass(this.dropbar, 'uk-navbar-dropbar-slide');
}
}
},
disconnected: function() {
this.dropbar && remove(this.dropbar);
},
update: function() {
var this$1 = this;
this.$create(
'drop',
this.dropdowns.filter(function (el) { return !this$1.getDropdown(el); }),
assign({}, this.$props, {boundary: this.boundary, pos: this.pos, offset: this.dropbar || this.offset})
);
},
events: [
{
name: 'mouseover',
delegate: function() {
return this.dropdown;
},
handler: function(ref) {
var current = ref.current;
var active = this.getActive();
if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) {
active.hide(false);
}
}
},
{
name: 'mouseleave',
el: function() {
return this.dropbar;
},
handler: function() {
var active = this.getActive();
if (active && !this.dropdowns.some(function (el) { return matches(el, ':hover'); })) {
active.hide();
}
}
},
{
name: 'beforeshow',
capture: true,
filter: function() {
return this.dropbar;
},
handler: function() {
if (!this.dropbar.parentNode) {
after(this.dropbarAnchor || this.$el, this.dropbar);
}
}
},
{
name: 'show',
capture: true,
filter: function() {
return this.dropbar;
},
handler: function(_, drop) {
var $el = drop.$el;
var dir = drop.dir;
this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar"));
if (dir === 'bottom') {
this.transitionTo($el.offsetHeight + toFloat(css($el, 'marginTop')) + toFloat(css($el, 'marginBottom')), $el);
}
}
},
{
name: 'beforehide',
filter: function() {
return this.dropbar;
},
handler: function(e, ref) {
var $el = ref.$el;
var active = this.getActive();
if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
e.preventDefault();
}
}
},
{
name: 'hide',
filter: function() {
return this.dropbar;
},
handler: function(_, ref) {
var $el = ref.$el;
var active = this.getActive();
if (!active || active && active.$el === $el) {
this.transitionTo(0);
}
}
}
],
methods: {
getActive: function() {
var ref = this.dropdowns.map(this.getDropdown).filter(function (drop) { return drop && drop.isActive(); });
var active = ref[0];
return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active;
},
transitionTo: function(newHeight, el) {
var this$1 = this;
var ref = this;
var dropbar = ref.dropbar;
var oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
el = oldHeight < newHeight && el;
css(el, 'clip', ("rect(0," + (el.offsetWidth) + "px," + oldHeight + "px,0)"));
height(dropbar, oldHeight);
Transition.cancel([el, dropbar]);
return Promise.all([
Transition.start(dropbar, {height: newHeight}, this.duration),
Transition.start(el, {clip: ("rect(0," + (el.offsetWidth) + "px," + newHeight + "px,0)")}, this.duration)
])
.catch(noop)
.then(function () {
css(el, {clip: ''});
this$1.$update(dropbar);
});
},
getDropdown: function(el) {
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
}
}
};
var Offcanvas = {
mixins: [Modal],
args: 'mode',
props: {
mode: String,
flip: Boolean,
overlay: Boolean
},
data: {
mode: 'slide',
flip: false,
overlay: false,
clsPage: 'uk-offcanvas-page',
clsContainer: 'uk-offcanvas-container',
selPanel: '.uk-offcanvas-bar',
clsFlip: 'uk-offcanvas-flip',
clsContainerAnimation: 'uk-offcanvas-container-animation',
clsSidebarAnimation: 'uk-offcanvas-bar-animation',
clsMode: 'uk-offcanvas',
clsOverlay: 'uk-offcanvas-overlay',
selClose: '.uk-offcanvas-close',
container: false
},
computed: {
clsFlip: function(ref) {
var flip = ref.flip;
var clsFlip = ref.clsFlip;
return flip ? clsFlip : '';
},
clsOverlay: function(ref) {
var overlay = ref.overlay;
var clsOverlay = ref.clsOverlay;
return overlay ? clsOverlay : '';
},
clsMode: function(ref) {
var mode = ref.mode;
var clsMode = ref.clsMode;
return (clsMode + "-" + mode);
},
clsSidebarAnimation: function(ref) {
var mode = ref.mode;
var clsSidebarAnimation = ref.clsSidebarAnimation;
return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
},
clsContainerAnimation: function(ref) {
var mode = ref.mode;
var clsContainerAnimation = ref.clsContainerAnimation;
return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
},
transitionElement: function(ref) {
var mode = ref.mode;
return mode === 'reveal' ? this.panel.parentNode : this.panel;
}
},
events: [
{
name: 'click',
delegate: function() {
return 'a[href^="#"]';
},
handler: function(ref) {
var hash = ref.current.hash;
var defaultPrevented = ref.defaultPrevented;
if (!defaultPrevented && hash && $(hash, document.body)) {
this.hide();
}
}
},
{
name: 'touchstart',
passive: true,
el: function() {
return this.panel;
},
handler: function(ref) {
var targetTouches = ref.targetTouches;
if (targetTouches.length === 1) {
this.clientY = targetTouches[0].clientY;
}
}
},
{
name: 'touchmove',
self: true,
passive: false,
filter: function() {
return this.overlay;
},
handler: function(e) {
e.cancelable && e.preventDefault();
}
},
{
name: 'touchmove',
passive: false,
el: function() {
return this.panel;
},
handler: function(e) {
if (e.targetTouches.length !== 1) {
return;
}
var clientY = event.targetTouches[0].clientY - this.clientY;
var ref = this.panel;
var scrollTop = ref.scrollTop;
var scrollHeight = ref.scrollHeight;
var clientHeight = ref.clientHeight;
if (clientHeight >= scrollHeight
|| scrollTop === 0 && clientY > 0
|| scrollHeight - scrollTop <= clientHeight && clientY < 0
) {
e.cancelable && e.preventDefault();
}
}
},
{
name: 'show',
self: true,
handler: function() {
if (this.mode === 'reveal' && !hasClass(this.panel.parentNode, this.clsMode)) {
wrapAll(this.panel, '<div>');
addClass(this.panel.parentNode, this.clsMode);
}
css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
addClass(document.body, this.clsContainer, this.clsFlip);
css(document.body, 'touch-action', 'pan-y pinch-zoom');
css(this.$el, 'display', 'block');
addClass(this.$el, this.clsOverlay);
addClass(this.panel, this.clsSidebarAnimation, this.mode !== 'reveal' ? this.clsMode : '');
height(document.body); // force reflow
addClass(document.body, this.clsContainerAnimation);
this.clsContainerAnimation && suppressUserScale();
}
},
{
name: 'hide',
self: true,
handler: function() {
removeClass(document.body, this.clsContainerAnimation);
css(document.body, 'touch-action', '');
}
},
{
name: 'hidden',
self: true,
handler: function() {
this.clsContainerAnimation && resumeUserScale();
if (this.mode === 'reveal') {
unwrap(this.panel);
}
removeClass(this.panel, this.clsSidebarAnimation, this.clsMode);
removeClass(this.$el, this.clsOverlay);
css(this.$el, 'display', '');
removeClass(document.body, this.clsContainer, this.clsFlip);
css(document.documentElement, 'overflowY', '');
}
},
{
name: 'swipeLeft swipeRight',
handler: function(e) {
if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
this.hide();
}
}
}
]
};
// Chrome in responsive mode zooms page upon opening offcanvas
function suppressUserScale() {
getViewport().content += ',user-scalable=0';
}
function resumeUserScale() {
var viewport = getViewport();
viewport.content = viewport.content.replace(/,user-scalable=0$/, '');
}
function getViewport() {
return $('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">');
}
var OverflowAuto = {
mixins: [Class],
props: {
selContainer: String,
selContent: String
},
data: {
selContainer: '.uk-modal',
selContent: '.uk-modal-dialog'
},
computed: {
container: function(ref, $el) {
var selContainer = ref.selContainer;
return closest($el, selContainer);
},
content: function(ref, $el) {
var selContent = ref.selContent;
return closest($el, selContent);
}
},
connected: function() {
css(this.$el, 'minHeight', 150);
},
update: {
read: function() {
if (!this.content || !this.container) {
return false;
}
return {
current: toFloat(css(this.$el, 'maxHeight')),
max: Math.max(150, height(this.container) - (offset(this.content).height - height(this.$el)))
};
},
write: function(ref) {
var current = ref.current;
var max = ref.max;
css(this.$el, 'maxHeight', max);
if (Math.round(current) !== Math.round(max)) {
trigger(this.$el, 'resize');
}
},
events: ['resize']
}
};
var Responsive = {
props: ['width', 'height'],
connected: function() {
addClass(this.$el, 'uk-responsive-width');
},
update: {
read: function() {
return isVisible(this.$el) && this.width && this.height
? {width: width(this.$el.parentNode), height: this.height}
: false;
},
write: function(dim) {
height(this.$el, Dimensions.contain({
height: this.height,
width: this.width
}, dim).height);
},
events: ['resize']
}
};
var Scroll = {
props: {
duration: Number,
offset: Number
},
data: {
duration: 1000,
offset: 0
},
methods: {
scrollTo: function(el) {
var this$1 = this;
el = el && $(el) || document.body;
var docHeight = height(document);
var winHeight = height(window);
var target = offset(el).top - this.offset;
if (target + winHeight > docHeight) {
target = docHeight - winHeight;
}
if (!trigger(this.$el, 'beforescroll', [this, el])) {
return;
}
var start = Date.now();
var startY = window.pageYOffset;
var step = function () {
var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration));
scrollTop(window, currentY);
// scroll more if we have not reached our destination
if (currentY !== target) {
requestAnimationFrame(step);
} else {
trigger(this$1.$el, 'scrolled', [this$1, el]);
}
};
step();
}
},
events: {
click: function(e) {
if (e.defaultPrevented) {
return;
}
e.preventDefault();
this.scrollTo(escape(decodeURIComponent(this.$el.hash)).substr(1));
}
}
};
function ease(k) {
return 0.5 * (1 - Math.cos(Math.PI * k));
}
var Scrollspy = {
args: 'cls',
props: {
cls: String,
target: String,
hidden: Boolean,
offsetTop: Number,
offsetLeft: Number,
repeat: Boolean,
delay: Number
},
data: function () { return ({
cls: false,
target: false,
hidden: true,
offsetTop: 0,
offsetLeft: 0,
repeat: false,
delay: 0,
inViewClass: 'uk-scrollspy-inview'
}); },
computed: {
elements: function(ref, $el) {
var target = ref.target;
return target ? $$(target, $el) : [$el];
}
},
update: [
{
write: function() {
if (this.hidden) {
css(filter(this.elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden');
}
}
},
{
read: function(ref) {
var this$1 = this;
var update = ref.update;
if (!update) {
return;
}
this.elements.forEach(function (el) {
var state = el._ukScrollspyState;
if (!state) {
state = {cls: data(el, 'uk-scrollspy-class') || this$1.cls};
}
state.show = isInView(el, this$1.offsetTop, this$1.offsetLeft);
el._ukScrollspyState = state;
});
},
write: function(data) {
var this$1 = this;
// Let child components be applied at least once first
if (!data.update) {
this.$emit();
return data.update = true;
}
this.elements.forEach(function (el) {
var state = el._ukScrollspyState;
var cls = state.cls;
if (state.show && !state.inview && !state.queued) {
var show = function () {
css(el, 'visibility', '');
addClass(el, this$1.inViewClass);
toggleClass(el, cls);
trigger(el, 'inview');
this$1.$update(el);
state.inview = true;
state.abort && state.abort();
};
if (this$1.delay) {
state.queued = true;
data.promise = (data.promise || Promise.resolve()).then(function () {
return !state.inview && new Promise(function (resolve) {
var timer = setTimeout(function () {
show();
resolve();
}, data.promise || this$1.elements.length === 1 ? this$1.delay : 0);
state.abort = function () {
clearTimeout(timer);
resolve();
state.queued = false;
};
});
});
} else {
show();
}
} else if (!state.show && (state.inview || state.queued) && this$1.repeat) {
state.abort && state.abort();
if (!state.inview) {
return;
}
css(el, 'visibility', this$1.hidden ? 'hidden' : '');
removeClass(el, this$1.inViewClass);
toggleClass(el, cls);
trigger(el, 'outview');
this$1.$update(el);
state.inview = false;
}
});
},
events: ['scroll', 'resize']
}
]
};
var ScrollspyNav = {
props: {
cls: String,
closest: String,
scroll: Boolean,
overflow: Boolean,
offset: Number
},
data: {
cls: 'uk-active',
closest: false,
scroll: false,
overflow: true,
offset: 0
},
computed: {
links: function(_, $el) {
return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; });
},
elements: function(ref) {
var selector = ref.closest;
return closest(this.links, selector || '*');
},
targets: function() {
return $$(this.links.map(function (el) { return escape(el.hash).substr(1); }).join(','));
}
},
update: [
{
read: function() {
if (this.scroll) {
this.$create('scroll', this.links, {offset: this.offset || 0});
}
}
},
{
read: function(data) {
var this$1 = this;
var scroll = window.pageYOffset + this.offset + 1;
var max = height(document) - height(window) + this.offset;
data.active = false;
this.targets.every(function (el, i) {
var ref = offset(el);
var top = ref.top;
var last = i + 1 === this$1.targets.length;
if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) {
return false;
}
if (!last && offset(this$1.targets[i + 1]).top <= scroll) {
return true;
}
if (scroll >= max) {
for (var j = this$1.targets.length - 1; j > i; j--) {
if (isInView(this$1.targets[j])) {
el = this$1.targets[j];
break;
}
}
}
return !(data.active = $(filter(this$1.links, ("[href=\"#" + (el.id) + "\"]"))));
});
},
write: function(ref) {
var active = ref.active;
this.links.forEach(function (el) { return el.blur(); });
removeClass(this.elements, this.cls);
if (active) {
trigger(this.$el, 'active', [active, addClass(this.closest ? closest(active, this.closest) : active, this.cls)]);
}
},
events: ['scroll', 'resize']
}
]
};
var Sticky = {
mixins: [Class, Media],
props: {
top: null,
bottom: Boolean,
offset: String,
animation: String,
clsActive: String,
clsInactive: String,
clsFixed: String,
clsBelow: String,
selTarget: String,
widthElement: Boolean,
showOnUp: Boolean,
targetOffset: Number
},
data: {
top: 0,
bottom: false,
offset: 0,
animation: '',
clsActive: 'uk-active',
clsInactive: '',
clsFixed: 'uk-sticky-fixed',
clsBelow: 'uk-sticky-below',
selTarget: '',
widthElement: false,
showOnUp: false,
targetOffset: false
},
computed: {
offset: function(ref) {
var offset = ref.offset;
return toPx(offset);
},
selTarget: function(ref, $el) {
var selTarget = ref.selTarget;
return selTarget && $(selTarget, $el) || $el;
},
widthElement: function(ref, $el) {
var widthElement = ref.widthElement;
return query(widthElement, $el) || this.placeholder;
},
isActive: {
get: function() {
return hasClass(this.selTarget, this.clsActive);
},
set: function(value) {
if (value && !this.isActive) {
replaceClass(this.selTarget, this.clsInactive, this.clsActive);
trigger(this.$el, 'active');
} else if (!value && !hasClass(this.selTarget, this.clsInactive)) {
replaceClass(this.selTarget, this.clsActive, this.clsInactive);
trigger(this.$el, 'inactive');
}
}
}
},
connected: function() {
this.placeholder = $('+ .uk-sticky-placeholder', this.$el) || $('<div class="uk-sticky-placeholder"></div>');
this.isFixed = false;
this.isActive = false;
},
disconnected: function() {
if (this.isFixed) {
this.hide();
removeClass(this.selTarget, this.clsInactive);
}
remove(this.placeholder);
this.placeholder = null;
this.widthElement = null;
},
events: [
{
name: 'load hashchange popstate',
el: window,
handler: function() {
var this$1 = this;
if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) {
return;
}
var target = $(location.hash);
if (target) {
fastdom.read(function () {
var ref = offset(target);
var top = ref.top;
var elTop = offset(this$1.$el).top;
var elHeight = this$1.$el.offsetHeight;
if (this$1.isFixed && elTop + elHeight >= top && elTop <= top + target.offsetHeight) {
scrollTop(window, top - elHeight - (isNumeric(this$1.targetOffset) ? this$1.targetOffset : 0) - this$1.offset);
}
});
}
}
}
],
update: [
{
read: function(ref, type) {
var height = ref.height;
if (this.isActive && type !== 'update') {
this.hide();
height = this.$el.offsetHeight;
this.show();
}
height = !this.isActive ? this.$el.offsetHeight : height;
this.topOffset = offset(this.isFixed ? this.placeholder : this.$el).top;
this.bottomOffset = this.topOffset + height;
var bottom = parseProp('bottom', this);
this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset;
this.bottom = bottom && bottom - height;
this.inactive = !this.matchMedia;
return {
lastScroll: false,
height: height,
margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
};
},
write: function(ref) {
var height = ref.height;
var margins = ref.margins;
var ref$1 = this;
var placeholder = ref$1.placeholder;
css(placeholder, assign({height: height}, margins));
if (!within(placeholder, document)) {
after(this.$el, placeholder);
attr(placeholder, 'hidden', '');
}
// ensure active/inactive classes are applied
this.isActive = this.isActive;
},
events: ['resize']
},
{
read: function(ref) {
var scroll = ref.scroll; if ( scroll === void 0 ) scroll = 0;
this.width = (isVisible(this.widthElement) ? this.widthElement : this.$el).offsetWidth;
this.scroll = window.pageYOffset;
return {
dir: scroll <= this.scroll ? 'down' : 'up',
scroll: this.scroll,
visible: isVisible(this.$el),
top: offsetPosition(this.placeholder)[0]
};
},
write: function(data, type) {
var this$1 = this;
var initTimestamp = data.initTimestamp; if ( initTimestamp === void 0 ) initTimestamp = 0;
var dir = data.dir;
var lastDir = data.lastDir;
var lastScroll = data.lastScroll;
var scroll = data.scroll;
var top = data.top;
var visible = data.visible;
var now = performance.now();
data.lastScroll = scroll;
if (scroll < 0 || scroll === lastScroll || !visible || this.disabled || this.showOnUp && type !== 'scroll') {
return;
}
if (now - initTimestamp > 300 || dir !== lastDir) {
data.initScroll = scroll;
data.initTimestamp = now;
}
data.lastDir = dir;
if (this.showOnUp && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) {
return;
}
if (this.inactive
|| scroll < this.top
|| this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isFixed && scroll <= this.bottomOffset)
) {
if (!this.isFixed) {
if (Animation.inProgress(this.$el) && top > scroll) {
Animation.cancel(this.$el);
this.hide();
}
return;
}
this.isFixed = false;
if (this.animation && scroll > this.topOffset) {
Animation.cancel(this.$el);
Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop);
} else {
this.hide();
}
} else if (this.isFixed) {
this.update();
} else if (this.animation) {
Animation.cancel(this.$el);
this.show();
Animation.in(this.$el, this.animation).catch(noop);
} else {
this.show();
}
},
events: ['resize', 'scroll']
}
],
methods: {
show: function() {
this.isFixed = true;
this.update();
attr(this.placeholder, 'hidden', null);
},
hide: function() {
this.isActive = false;
removeClass(this.$el, this.clsFixed, this.clsBelow);
css(this.$el, {position: '', top: '', width: ''});
attr(this.placeholder, 'hidden', '');
},
update: function() {
var active = this.top !== 0 || this.scroll > this.top;
var top = Math.max(0, this.offset);
if (this.bottom && this.scroll > this.bottom - this.offset) {
top = this.bottom - this.scroll;
}
css(this.$el, {
position: 'fixed',
top: (top + "px"),
width: this.width
});
this.isActive = active;
toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset);
addClass(this.$el, this.clsFixed);
}
}
};
function parseProp(prop, ref) {
var $props = ref.$props;
var $el = ref.$el;
var propOffset = ref[(prop + "Offset")];
var value = $props[prop];
if (!value) {
return;
}
if (isNumeric(value) && isString(value) && value.match(/^-?\d/)) {
return propOffset + toPx(value);
} else {
return offset(value === true ? $el.parentNode : query(value, $el)).bottom;
}
}
var Switcher = {
mixins: [Togglable],
args: 'connect',
props: {
connect: String,
toggle: String,
active: Number,
swiping: Boolean
},
data: {
connect: '~.uk-switcher',
toggle: '> * > :first-child',
active: 0,
swiping: true,
cls: 'uk-active',
clsContainer: 'uk-switcher',
attrItem: 'uk-switcher-item',
queued: true
},
computed: {
connects: function(ref, $el) {
var connect = ref.connect;
return queryAll(connect, $el);
},
toggles: function(ref, $el) {
var toggle = ref.toggle;
return $$(toggle, $el);
}
},
events: [
{
name: 'click',
delegate: function() {
return ((this.toggle) + ":not(.uk-disabled)");
},
handler: function(e) {
e.preventDefault();
this.show(toNodes(this.$el.children).filter(function (el) { return within(e.current, el); })[0]);
}
},
{
name: 'click',
el: function() {
return this.connects;
},
delegate: function() {
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
},
handler: function(e) {
e.preventDefault();
this.show(data(e.current, this.attrItem));
}
},
{
name: 'swipeRight swipeLeft',
filter: function() {
return this.swiping;
},
el: function() {
return this.connects;
},
handler: function(ref) {
var type = ref.type;
this.show(endsWith(type, 'Left') ? 'next' : 'previous');
}
}
],
update: function() {
var this$1 = this;
this.connects.forEach(function (list) { return this$1.updateAria(list.children); });
var ref = this.$el;
var children = ref.children;
this.show(filter(children, ("." + (this.cls)))[0] || children[this.active] || children[0]);
this.swiping && css(this.connects, 'touch-action', 'pan-y pinch-zoom');
},
methods: {
index: function() {
return !isEmpty(this.connects) && index(filter(this.connects[0].children, ("." + (this.cls)))[0]);
},
show: function(item) {
var this$1 = this;
var ref = this.$el;
var children = ref.children;
var length = children.length;
var prev = this.index();
var hasPrev = prev >= 0;
var dir = item === 'previous' ? -1 : 1;
var toggle, active, next = getIndex(item, children, prev);
for (var i = 0; i < length; i++, next = (next + dir + length) % length) {
if (!matches(this.toggles[next], '.uk-disabled *, .uk-disabled, [disabled]')) {
toggle = this.toggles[next];
active = children[next];
break;
}
}
if (!active || prev >= 0 && hasClass(active, this.cls) || prev === next) {
return;
}
removeClass(children, this.cls);
addClass(active, this.cls);
attr(this.toggles, 'aria-expanded', false);
attr(toggle, 'aria-expanded', true);
this.connects.forEach(function (list) {
if (!hasPrev) {
this$1.toggleNow(list.children[next]);
} else {
this$1.toggleElement([list.children[prev], list.children[next]]);
}
});
}
}
};
var Tab = {
mixins: [Class],
extends: Switcher,
props: {
media: Boolean
},
data: {
media: 960,
attrItem: 'uk-tab-item'
},
connected: function() {
var cls = hasClass(this.$el, 'uk-tab-left')
? 'uk-tab-left'
: hasClass(this.$el, 'uk-tab-right')
? 'uk-tab-right'
: false;
if (cls) {
this.$create('toggle', this.$el, {cls: cls, mode: 'media', media: this.media});
}
}
};
var Toggle = {
mixins: [Media, Togglable],
args: 'target',
props: {
href: String,
target: null,
mode: 'list'
},
data: {
href: false,
target: false,
mode: 'click',
queued: true
},
computed: {
target: function(ref, $el) {
var href = ref.href;
var target = ref.target;
target = queryAll(target || href, $el);
return target.length && target || [$el];
}
},
connected: function() {
trigger(this.target, 'updatearia', [this]);
},
events: [
{
name: (pointerEnter + " " + pointerLeave),
filter: function() {
return includes(this.mode, 'hover');
},
handler: function(e) {
if (!isTouch(e)) {
this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide')));
}
}
},
{
name: 'click',
filter: function() {
return includes(this.mode, 'click') || hasTouch && includes(this.mode, 'hover');
},
handler: function(e) {
// TODO better isToggled handling
var link;
if (closest(e.target, 'a[href="#"], a[href=""]')
|| (link = closest(e.target, 'a[href]')) && (
this.cls
|| !isVisible(this.target)
|| link.hash && matches(this.target, link.hash)
)
) {
e.preventDefault();
}
this.toggle();
}
}
],
update: {
read: function() {
return includes(this.mode, 'media') && this.media
? {match: this.matchMedia}
: false;
},
write: function(ref) {
var match = ref.match;
var toggled = this.isToggled(this.target);
if (match ? !toggled : toggled) {
this.toggle();
}
},
events: ['resize']
},
methods: {
toggle: function(type) {
if (trigger(this.target, type || 'toggle', [this])) {
this.toggleElement(this.target);
}
}
}
};
function core (UIkit) {
// core components
UIkit.component('accordion', Accordion);
UIkit.component('alert', Alert);
UIkit.component('cover', Cover);
UIkit.component('drop', Drop);
UIkit.component('dropdown', Dropdown);
UIkit.component('formCustom', FormCustom);
UIkit.component('gif', Gif);
UIkit.component('grid', Grid);
UIkit.component('heightMatch', HeightMatch);
UIkit.component('heightViewport', HeightViewport);
UIkit.component('icon', Icon);
UIkit.component('img', Img);
UIkit.component('leader', Leader);
UIkit.component('margin', Margin);
UIkit.component('modal', Modal$1);
UIkit.component('nav', Nav);
UIkit.component('navbar', Navbar);
UIkit.component('offcanvas', Offcanvas);
UIkit.component('overflowAuto', OverflowAuto);
UIkit.component('responsive', Responsive);
UIkit.component('scroll', Scroll);
UIkit.component('scrollspy', Scrollspy);
UIkit.component('scrollspyNav', ScrollspyNav);
UIkit.component('sticky', Sticky);
UIkit.component('svg', Svg);
UIkit.component('switcher', Switcher);
UIkit.component('tab', Tab);
UIkit.component('toggle', Toggle);
UIkit.component('video', Video);
// Icon components
UIkit.component('close', Close);
UIkit.component('marker', IconComponent);
UIkit.component('navbarToggleIcon', IconComponent);
UIkit.component('overlayIcon', IconComponent);
UIkit.component('paginationNext', IconComponent);
UIkit.component('paginationPrevious', IconComponent);
UIkit.component('searchIcon', Search);
UIkit.component('slidenavNext', Slidenav);
UIkit.component('slidenavPrevious', Slidenav);
UIkit.component('spinner', Spinner);
UIkit.component('totop', IconComponent);
// core functionality
UIkit.use(Core);
}
UIkit.version = '3.2.0';
core(UIkit);
var Countdown = {
mixins: [Class],
props: {
date: String,
clsWrapper: String
},
data: {
date: '',
clsWrapper: '.uk-countdown-%unit%'
},
computed: {
date: function(ref) {
var date = ref.date;
return Date.parse(date);
},
days: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'days'), $el);
},
hours: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'hours'), $el);
},
minutes: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'minutes'), $el);
},
seconds: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'seconds'), $el);
},
units: function() {
var this$1 = this;
return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; });
}
},
connected: function() {
this.start();
},
disconnected: function() {
var this$1 = this;
this.stop();
this.units.forEach(function (unit) { return empty(this$1[unit]); });
},
events: [
{
name: 'visibilitychange',
el: document,
handler: function() {
if (document.hidden) {
this.stop();
} else {
this.start();
}
}
}
],
update: {
write: function() {
var this$1 = this;
var timespan = getTimeSpan(this.date);
if (timespan.total <= 0) {
this.stop();
timespan.days
= timespan.hours
= timespan.minutes
= timespan.seconds
= 0;
}
this.units.forEach(function (unit) {
var digits = String(Math.floor(timespan[unit]));
digits = digits.length < 2 ? ("0" + digits) : digits;
var el = this$1[unit];
if (el.textContent !== digits) {
digits = digits.split('');
if (digits.length !== el.children.length) {
html(el, digits.map(function () { return '<span></span>'; }).join(''));
}
digits.forEach(function (digit, i) { return el.children[i].textContent = digit; });
}
});
}
},
methods: {
start: function() {
var this$1 = this;
this.stop();
if (this.date && this.units.length) {
this.$emit();
this.timer = setInterval(function () { return this$1.$emit(); }, 1000);
}
},
stop: function() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
}
}
};
function getTimeSpan(date) {
var total = date - Date.now();
return {
total: total,
seconds: total / 1000 % 60,
minutes: total / 1000 / 60 % 60,
hours: total / 1000 / 60 / 60 % 24,
days: total / 1000 / 60 / 60 / 24
};
}
var targetClass = 'uk-animation-target';
var Animate = {
props: {
animation: Number
},
data: {
animation: 150
},
computed: {
target: function() {
return this.$el;
}
},
methods: {
animate: function(action) {
var this$1 = this;
addStyle();
var children = toNodes(this.target.children);
var propsFrom = children.map(function (el) { return getProps(el, true); });
var oldHeight = height(this.target);
var oldScrollY = window.pageYOffset;
action();
Transition.cancel(this.target);
children.forEach(Transition.cancel);
reset(this.target);
this.$update(this.target);
fastdom.flush();
var newHeight = height(this.target);
children = children.concat(toNodes(this.target.children).filter(function (el) { return !includes(children, el); }));
var propsTo = children.map(function (el, i) { return el.parentNode && i in propsFrom
? propsFrom[i]
? isVisible(el)
? getPositionWithMargin(el)
: {opacity: 0}
: {opacity: isVisible(el) ? 1 : 0}
: false; }
);
propsFrom = propsTo.map(function (props, i) {
var from = children[i].parentNode === this$1.target
? propsFrom[i] || getProps(children[i])
: false;
if (from) {
if (!props) {
delete from.opacity;
} else if (!('opacity' in props)) {
var opacity = from.opacity;
if (opacity % 1) {
props.opacity = 1;
} else {
delete from.opacity;
}
}
}
return from;
});
addClass(this.target, targetClass);
children.forEach(function (el, i) { return propsFrom[i] && css(el, propsFrom[i]); });
css(this.target, 'height', oldHeight);
scrollTop(window, oldScrollY);
return Promise.all(children.map(function (el, i) { return propsFrom[i] && propsTo[i]
? Transition.start(el, propsTo[i], this$1.animation, 'ease')
: Promise.resolve(); }
).concat(Transition.start(this.target, {height: newHeight}, this.animation, 'ease'))).then(function () {
children.forEach(function (el, i) { return css(el, {display: propsTo[i].opacity === 0 ? 'none' : '', zIndex: ''}); });
reset(this$1.target);
this$1.$update(this$1.target);
fastdom.flush(); // needed for IE11
}, noop);
}
}
};
function getProps(el, opacity) {
var zIndex = css(el, 'zIndex');
return isVisible(el)
? assign({
display: '',
opacity: opacity ? css(el, 'opacity') : '0',
pointerEvents: 'none',
position: 'absolute',
zIndex: zIndex === 'auto' ? index(el) : zIndex
}, getPositionWithMargin(el))
: false;
}
function reset(el) {
css(el.children, {
height: '',
left: '',
opacity: '',
pointerEvents: '',
position: '',
top: '',
width: ''
});
removeClass(el, targetClass);
css(el, 'height', '');
}
function getPositionWithMargin(el) {
var ref = el.getBoundingClientRect();
var height = ref.height;
var width = ref.width;
var ref$1 = position(el);
var top = ref$1.top;
var left = ref$1.left;
top += toFloat(css(el, 'marginTop'));
return {top: top, left: left, height: height, width: width};
}
var style;
function addStyle() {
if (style) {
return;
}
style = append(document.head, '<style>').sheet;
style.insertRule(
("." + targetClass + " > * {\n margin-top: 0 !important;\n transform: none !important;\n }"), 0
);
}
var Filter = {
mixins: [Animate],
args: 'target',
props: {
target: Boolean,
selActive: Boolean
},
data: {
target: null,
selActive: false,
attrItem: 'uk-filter-control',
cls: 'uk-active',
animation: 250
},
computed: {
toggles: {
get: function(ref, $el) {
var attrItem = ref.attrItem;
return $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), $el);
},
watch: function() {
this.updateState();
}
},
target: function(ref, $el) {
var target = ref.target;
return $(target, $el);
},
children: {
get: function() {
return toNodes(this.target && this.target.children);
},
watch: function(list, old) {
if (!isEqualList(list, old)) {
this.updateState();
}
}
}
},
events: [
{
name: 'click',
delegate: function() {
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
},
handler: function(e) {
e.preventDefault();
this.apply(e.current);
}
}
],
connected: function() {
var this$1 = this;
this.updateState();
if (this.selActive !== false) {
var actives = $$(this.selActive, this.$el);
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, includes(actives, el)); });
}
},
methods: {
apply: function(el) {
this.setState(mergeState(el, this.attrItem, this.getState()));
},
getState: function() {
var this$1 = this;
return this.toggles
.filter(function (item) { return hasClass(item, this$1.cls); })
.reduce(function (state, el) { return mergeState(el, this$1.attrItem, state); }, {filter: {'': ''}, sort: []});
},
setState: function(state, animate) {
var this$1 = this;
if ( animate === void 0 ) animate = true;
state = assign({filter: {'': ''}, sort: []}, state);
trigger(this.$el, 'beforeFilter', [this, state]);
var ref = this;
var children = ref.children;
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, !!matchFilter(el, this$1.attrItem, state)); });
var apply = function () {
var selector = getSelector(state);
children.forEach(function (el) { return css(el, 'display', selector && !matches(el, selector) ? 'none' : ''); });
var ref = state.sort;
var sort = ref[0];
var order = ref[1];
if (sort) {
var sorted = sortItems(children, sort, order);
if (!isEqual(sorted, children)) {
sorted.forEach(function (el) { return append(this$1.target, el); });
}
}
};
if (animate) {
this.animate(apply).then(function () { return trigger(this$1.$el, 'afterFilter', [this$1]); });
} else {
apply();
trigger(this.$el, 'afterFilter', [this]);
}
},
updateState: function() {
var this$1 = this;
fastdom.write(function () { return this$1.setState(this$1.getState(), false); });
}
}
};
function getFilter(el, attr) {
return parseOptions(data(el, attr), ['filter']);
}
function mergeState(el, attr, state) {
var filterBy = getFilter(el, attr);
var filter = filterBy.filter;
var group = filterBy.group;
var sort = filterBy.sort;
var order = filterBy.order; if ( order === void 0 ) order = 'asc';
if (filter || isUndefined(sort)) {
if (group) {
if (filter) {
delete state.filter[''];
state.filter[group] = filter;
} else {
delete state.filter[group];
if (isEmpty(state.filter) || '' in state.filter) {
state.filter = {'': filter || ''};
}
}
} else {
state.filter = {'': filter || ''};
}
}
if (!isUndefined(sort)) {
state.sort = [sort, order];
}
return state;
}
function matchFilter(el, attr, ref) {
var stateFilter = ref.filter; if ( stateFilter === void 0 ) stateFilter = {'': ''};
var ref_sort = ref.sort;
var stateSort = ref_sort[0];
var stateOrder = ref_sort[1];
var ref$1 = getFilter(el, attr);
var filter = ref$1.filter; if ( filter === void 0 ) filter = '';
var group = ref$1.group; if ( group === void 0 ) group = '';
var sort = ref$1.sort;
var order = ref$1.order; if ( order === void 0 ) order = 'asc';
return isUndefined(sort)
? group in stateFilter && filter === stateFilter[group]
|| !filter && group && !(group in stateFilter) && !stateFilter['']
: stateSort === sort && stateOrder === order;
}
function isEqualList(listA, listB) {
return listA.length === listB.length
&& listA.every(function (el) { return ~listB.indexOf(el); });
}
function getSelector(ref) {
var filter = ref.filter;
var selector = '';
each(filter, function (value) { return selector += value || ''; });
return selector;
}
function sortItems(nodes, sort, order) {
return assign([], nodes).sort(function (a, b) { return data(a, sort).localeCompare(data(b, sort), undefined, {numeric: true}) * (order === 'asc' || -1); });
}
var Animations = {
slide: {
show: function(dir) {
return [
{transform: translate(dir * -100)},
{transform: translate()}
];
},
percent: function(current) {
return translated(current);
},
translate: function(percent, dir) {
return [
{transform: translate(dir * -100 * percent)},
{transform: translate(dir * 100 * (1 - percent))}
];
}
}
};
function translated(el) {
return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
}
function translate(value, unit) {
if ( value === void 0 ) value = 0;
if ( unit === void 0 ) unit = '%';
value += value ? unit : '';
return isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning
}
function scale3d(value) {
return ("scale3d(" + value + ", " + value + ", 1)");
}
var Animations$1 = assign({}, Animations, {
fade: {
show: function() {
return [
{opacity: 0},
{opacity: 1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent},
{opacity: percent}
];
}
},
scale: {
show: function() {
return [
{opacity: 0, transform: scale3d(1 - .2)},
{opacity: 1, transform: scale3d(1)}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, transform: scale3d(1 - .2 * percent)},
{opacity: percent, transform: scale3d(1 - .2 + .2 * percent)}
];
}
}
});
function Transitioner(prev, next, dir, ref) {
var animation = ref.animation;
var easing = ref.easing;
var percent = animation.percent;
var translate = animation.translate;
var show = animation.show; if ( show === void 0 ) show = noop;
var props = show(dir);
var deferred = new Deferred();
return {
dir: dir,
show: function(duration, percent, linear) {
var this$1 = this;
if ( percent === void 0 ) percent = 0;
var timing = linear ? 'linear' : easing;
duration -= Math.round(duration * clamp(percent, -1, 1));
this.translate(percent);
triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
Promise.all([
Transition.start(next, props[1], duration, timing),
Transition.start(prev, props[0], duration, timing)
]).then(function () {
this$1.reset();
deferred.resolve();
}, noop);
return deferred.promise;
},
stop: function() {
return Transition.stop([next, prev]);
},
cancel: function() {
Transition.cancel([next, prev]);
},
reset: function() {
for (var prop in props[0]) {
css([next, prev], prop, '');
}
},
forward: function(duration, percent) {
if ( percent === void 0 ) percent = this.percent();
Transition.cancel([next, prev]);
return this.show(duration, percent, true);
},
translate: function(percent) {
this.reset();
var props = translate(percent, dir);
css(next, props[1]);
css(prev, props[0]);
triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir});
triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir});
},
percent: function() {
return percent(prev || next, next, dir);
},
getDistance: function() {
return prev && prev.offsetWidth;
}
};
}
function triggerUpdate(el, type, data) {
trigger(el, createEvent(type, false, false, data));
}
var SliderAutoplay = {
props: {
autoplay: Boolean,
autoplayInterval: Number,
pauseOnHover: Boolean
},
data: {
autoplay: false,
autoplayInterval: 7000,
pauseOnHover: true
},
connected: function() {
this.autoplay && this.startAutoplay();
},
disconnected: function() {
this.stopAutoplay();
},
update: function() {
attr(this.slides, 'tabindex', '-1');
},
events: [
{
name: 'visibilitychange',
el: document,
filter: function() {
return this.autoplay;
},
handler: function() {
if (document.hidden) {
this.stopAutoplay();
} else {
this.startAutoplay();
}
}
}
],
methods: {
startAutoplay: function() {
var this$1 = this;
this.stopAutoplay();
this.interval = setInterval(
function () { return (!this$1.draggable || !$(':focus', this$1.$el))
&& (!this$1.pauseOnHover || !matches(this$1.$el, ':hover'))
&& !this$1.stack.length
&& this$1.show('next'); },
this.autoplayInterval
);
},
stopAutoplay: function() {
this.interval && clearInterval(this.interval);
}
}
};
var SliderDrag = {
props: {
draggable: Boolean
},
data: {
draggable: true,
threshold: 10
},
created: function() {
var this$1 = this;
['start', 'move', 'end'].forEach(function (key) {
var fn = this$1[key];
this$1[key] = function (e) {
var pos = getEventPos(e).x * (isRtl ? -1 : 1);
this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos;
this$1.pos = pos;
fn(e);
};
});
},
events: [
{
name: pointerDown,
delegate: function() {
return this.selSlides;
},
handler: function(e) {
if (!this.draggable
|| !isTouch(e) && hasTextNodesOnly(e.target)
|| e.button > 0
|| this.length < 2
) {
return;
}
this.start(e);
}
},
{
// Workaround for iOS 11 bug: https://bugs.webkit.org/show_bug.cgi?id=184250
name: 'touchmove',
passive: false,
handler: 'move',
delegate: function() {
return this.selSlides;
}
},
{
name: 'dragstart',
handler: function(e) {
e.preventDefault();
}
}
],
methods: {
start: function() {
var this$1 = this;
this.drag = this.pos;
if (this._transitioner) {
this.percent = this._transitioner.percent();
this.drag += this._transitioner.getDistance() * this.percent * this.dir;
this._transitioner.cancel();
this._transitioner.translate(this.percent);
this.dragging = true;
this.stack = [];
} else {
this.prevIndex = this.index;
}
// See above workaround notice
var off = pointerMove !== 'touchmove'
? on(document, pointerMove, this.move, {passive: false})
: noop;
this.unbindMove = function () {
off();
this$1.unbindMove = null;
};
on(window, 'scroll', this.unbindMove);
on(document, pointerUp, this.end, true);
css(this.list, 'userSelect', 'none');
},
move: function(e) {
var this$1 = this;
// See above workaround notice
if (!this.unbindMove) {
return;
}
var distance = this.pos - this.drag;
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
return;
}
css(this.list, 'pointerEvents', 'none');
e.cancelable && e.preventDefault();
this.dragging = true;
this.dir = (distance < 0 ? 1 : -1);
var ref = this;
var slides = ref.slides;
var ref$1 = this;
var prevIndex = ref$1.prevIndex;
var dis = Math.abs(distance);
var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
while (nextIndex !== prevIndex && dis > width) {
this.drag -= width * this.dir;
prevIndex = nextIndex;
dis -= width;
nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
}
this.percent = dis / width;
var prev = slides[prevIndex];
var next = slides[nextIndex];
var changed = this.index !== nextIndex;
var edge = prevIndex === nextIndex;
var itemShown;
[this.index, this.prevIndex].filter(function (i) { return !includes([nextIndex, prevIndex], i); }).forEach(function (i) {
trigger(slides[i], 'itemhidden', [this$1]);
if (edge) {
itemShown = true;
this$1.prevIndex = prevIndex;
}
});
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
trigger(slides[this.index], 'itemshown', [this]);
}
if (changed) {
this.prevIndex = prevIndex;
this.index = nextIndex;
!edge && trigger(prev, 'beforeitemhide', [this]);
trigger(next, 'beforeitemshow', [this]);
}
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
if (changed) {
!edge && trigger(prev, 'itemhide', [this]);
trigger(next, 'itemshow', [this]);
}
},
end: function() {
off(window, 'scroll', this.unbindMove);
this.unbindMove && this.unbindMove();
off(document, pointerUp, this.end, true);
if (this.dragging) {
this.dragging = null;
if (this.index === this.prevIndex) {
this.percent = 1 - this.percent;
this.dir *= -1;
this._show(false, this.index, true);
this._transitioner = null;
} else {
var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
this.index = dirChange ? this.index : this.prevIndex;
if (dirChange) {
this.percent = 1 - this.percent;
}
this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
}
}
css(this.list, {userSelect: '', pointerEvents: ''});
this.drag
= this.percent
= null;
}
}
};
function hasTextNodesOnly(el) {
return !el.children.length && el.childNodes.length;
}
var SliderNav = {
data: {
selNav: false
},
computed: {
nav: function(ref, $el) {
var selNav = ref.selNav;
return $(selNav, $el);
},
selNavItem: function(ref) {
var attrItem = ref.attrItem;
return ("[" + attrItem + "],[data-" + attrItem + "]");
},
navItems: function(_, $el) {
return $$(this.selNavItem, $el);
}
},
update: {
write: function() {
var this$1 = this;
if (this.nav && this.length !== this.nav.children.length) {
html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href=\"#\"></a></li>"); }).join(''));
}
toggleClass($$(this.selNavItem, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex);
this.updateNav();
},
events: ['resize']
},
events: [
{
name: 'click',
delegate: function() {
return this.selNavItem;
},
handler: function(e) {
e.preventDefault();
this.show(data(e.current, this.attrItem));
}
},
{
name: 'itemshow',
handler: 'updateNav'
}
],
methods: {
updateNav: function() {
var this$1 = this;
var i = this.getValidIndex();
this.navItems.forEach(function (el) {
var cmd = data(el, this$1.attrItem);
toggleClass(el, this$1.clsActive, toNumber(cmd) === i);
toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex));
});
}
}
};
var Slider = {
mixins: [SliderAutoplay, SliderDrag, SliderNav],
props: {
clsActivated: Boolean,
easing: String,
index: Number,
finite: Boolean,
velocity: Number
},
data: function () { return ({
easing: 'ease',
finite: false,
velocity: 1,
index: 0,
prevIndex: -1,
stack: [],
percent: 0,
clsActive: 'uk-active',
clsActivated: false,
Transitioner: false,
transitionOptions: {}
}); },
connected: function() {
this.prevIndex = -1;
this.index = this.getValidIndex(this.index);
this.stack = [];
},
disconnected: function() {
removeClass(this.slides, this.clsActive);
},
computed: {
duration: function(ref, $el) {
var velocity = ref.velocity;
return speedUp($el.offsetWidth / velocity);
},
list: function(ref, $el) {
var selList = ref.selList;
return $(selList, $el);
},
maxIndex: function() {
return this.length - 1;
},
selSlides: function(ref) {
var selList = ref.selList;
return (selList + " > *");
},
slides: {
get: function() {
return toNodes(this.list.children);
},
watch: function() {
this.$reset();
}
},
length: function() {
return this.slides.length;
}
},
events: {
itemshown: function() {
this.$update(this.list);
}
},
methods: {
show: function(index, force) {
var this$1 = this;
if ( force === void 0 ) force = false;
if (this.dragging || !this.length) {
return;
}
var ref = this;
var stack = ref.stack;
var queueIndex = force ? 0 : stack.length;
var reset = function () {
stack.splice(queueIndex, 1);
if (stack.length) {
this$1.show(stack.shift(), true);
}
};
stack[force ? 'unshift' : 'push'](index);
if (!force && stack.length > 1) {
if (stack.length === 2) {
this._transitioner.forward(Math.min(this.duration, 200));
}
return;
}
var prevIndex = this.index;
var prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
var nextIndex = this.getIndex(index, this.index);
var next = this.slides[nextIndex];
if (prev === next) {
reset();
return;
}
this.dir = getDirection(index, prevIndex);
this.prevIndex = prevIndex;
this.index = nextIndex;
prev && trigger(prev, 'beforeitemhide', [this]);
if (!trigger(next, 'beforeitemshow', [this, prev])) {
this.index = this.prevIndex;
reset();
return;
}
var promise = this._show(prev, next, force).then(function () {
prev && trigger(prev, 'itemhidden', [this$1]);
trigger(next, 'itemshown', [this$1]);
return new Promise(function (resolve) {
fastdom.write(function () {
stack.shift();
if (stack.length) {
this$1.show(stack.shift(), true);
} else {
this$1._transitioner = null;
}
resolve();
});
});
});
prev && trigger(prev, 'itemhide', [this]);
trigger(next, 'itemshow', [this]);
return promise;
},
getIndex: function(index, prev) {
if ( index === void 0 ) index = this.index;
if ( prev === void 0 ) prev = this.index;
return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
},
getValidIndex: function(index, prevIndex) {
if ( index === void 0 ) index = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
return this.getIndex(index, prevIndex);
},
_show: function(prev, next, force) {
this._transitioner = this._getTransitioner(
prev,
next,
this.dir,
assign({
easing: force
? next.offsetWidth < 600
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
: 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
: this.easing
}, this.transitionOptions)
);
if (!force && !prev) {
this._transitioner.translate(1);
return Promise.resolve();
}
var ref = this.stack;
var length = ref.length;
return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
},
_getDistance: function(prev, next) {
return this._getTransitioner(prev, prev !== next && next).getDistance();
},
_translate: function(percent, prev, next) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
transitioner.translate(percent);
return transitioner;
},
_getTransitioner: function(prev, next, dir, options) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
if ( dir === void 0 ) dir = this.dir || 1;
if ( options === void 0 ) options = this.transitionOptions;
return new this.Transitioner(
isNumber(prev) ? this.slides[prev] : prev,
isNumber(next) ? this.slides[next] : next,
dir * (isRtl ? -1 : 1),
options
);
}
}
};
function getDirection(index, prevIndex) {
return index === 'next'
? 1
: index === 'previous'
? -1
: index < prevIndex
? -1
: 1;
}
function speedUp(x) {
return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
}
var Slideshow = {
mixins: [Slider],
props: {
animation: String
},
data: {
animation: 'slide',
clsActivated: 'uk-transition-active',
Animations: Animations,
Transitioner: Transitioner
},
computed: {
animation: function(ref) {
var animation = ref.animation;
var Animations = ref.Animations;
return assign(animation in Animations ? Animations[animation] : Animations.slide, {name: animation});
},
transitionOptions: function() {
return {animation: this.animation};
}
},
events: {
'itemshow itemhide itemshown itemhidden': function(ref) {
var target = ref.target;
this.$update(target);
},
beforeitemshow: function(ref) {
var target = ref.target;
addClass(target, this.clsActive);
},
itemshown: function(ref) {
var target = ref.target;
addClass(target, this.clsActivated);
},
itemhidden: function(ref) {
var target = ref.target;
removeClass(target, this.clsActive, this.clsActivated);
}
}
};
var lightboxPanel = {
mixins: [Container, Modal, Togglable, Slideshow],
functional: true,
props: {
delayControls: Number,
preload: Number,
videoAutoplay: Boolean,
template: String
},
data: function () { return ({
preload: 1,
videoAutoplay: false,
delayControls: 3000,
items: [],
cls: 'uk-open',
clsPage: 'uk-lightbox-page',
selList: '.uk-lightbox-items',
attrItem: 'uk-lightbox-item',
selClose: '.uk-close-large',
selCaption: '.uk-lightbox-caption',
pauseOnHover: false,
velocity: 2,
Animations: Animations$1,
template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>"
}); },
created: function() {
var $el = $(this.template);
var list = $(this.selList, $el);
this.items.forEach(function () { return append(list, '<li></li>'); });
this.$mount(append(this.container, $el));
},
computed: {
caption: function(ref, $el) {
var selCaption = ref.selCaption;
return $('.uk-lightbox-caption', $el);
}
},
events: [
{
name: (pointerMove + " " + pointerDown + " keydown"),
handler: 'showControls'
},
{
name: 'click',
self: true,
delegate: function() {
return this.selSlides;
},
handler: function(e) {
if (e.defaultPrevented) {
return;
}
this.hide();
}
},
{
name: 'shown',
self: true,
handler: function() {
this.showControls();
}
},
{
name: 'hide',
self: true,
handler: function() {
this.hideControls();
removeClass(this.slides, this.clsActive);
Transition.stop(this.slides);
}
},
{
name: 'hidden',
self: true,
handler: function() {
this.$destroy(true);
}
},
{
name: 'keyup',
el: document,
handler: function(e) {
if (!this.isToggled(this.$el)) {
return;
}
switch (e.keyCode) {
case 37:
this.show('previous');
break;
case 39:
this.show('next');
break;
}
}
},
{
name: 'beforeitemshow',
handler: function(e) {
if (this.isToggled()) {
return;
}
this.draggable = false;
e.preventDefault();
this.toggleNow(this.$el, true);
this.animation = Animations$1['scale'];
removeClass(e.target, this.clsActive);
this.stack.splice(1, 0, this.index);
}
},
{
name: 'itemshow',
handler: function(ref) {
var target = ref.target;
var i = index(target);
var ref$1 = this.getItem(i);
var caption = ref$1.caption;
css(this.caption, 'display', caption ? '' : 'none');
html(this.caption, caption);
for (var j = 0; j <= this.preload; j++) {
this.loadItem(this.getIndex(i + j));
this.loadItem(this.getIndex(i - j));
}
}
},
{
name: 'itemshown',
handler: function() {
this.draggable = this.$props.draggable;
}
},
{
name: 'itemload',
handler: function(_, item) {
var this$1 = this;
var source = item.source;
var type = item.type;
var alt = item.alt;
this.setItem(item, '<span uk-spinner></span>');
if (!source) {
return;
}
var matches;
// Image
if (type === 'image' || source.match(/\.(jp(e)?g|png|gif|svg|webp)($|\?)/i)) {
getImage(source).then(
function (img) { return this$1.setItem(item, ("<img width=\"" + (img.width) + "\" height=\"" + (img.height) + "\" src=\"" + source + "\" alt=\"" + (alt ? alt : '') + "\">")); },
function () { return this$1.setError(item); }
);
// Video
} else if (type === 'video' || source.match(/\.(mp4|webm|ogv)($|\?)/i)) {
var video = $(("<video controls playsinline" + (item.poster ? (" poster=\"" + (item.poster) + "\"") : '') + " uk-video=\"" + (this.videoAutoplay) + "\"></video>"));
attr(video, 'src', source);
once(video, 'error loadedmetadata', function (type) {
if (type === 'error') {
this$1.setError(item);
} else {
attr(video, {width: video.videoWidth, height: video.videoHeight});
this$1.setItem(item, video);
}
});
// Iframe
} else if (type === 'iframe' || source.match(/\.(html|php)($|\?)/i)) {
this.setItem(item, ("<iframe class=\"uk-lightbox-iframe\" src=\"" + source + "\" frameborder=\"0\" allowfullscreen></iframe>"));
// YouTube
} else if ((matches = source.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/watch\?v=([^&\s]+)/) || source.match(/()youtu\.be\/(.*)/))) {
var id = matches[2];
var setIframe = function (width, height) {
if ( width === void 0 ) width = 640;
if ( height === void 0 ) height = 450;
return this$1.setItem(item, getIframe(("https://www.youtube" + (matches[1] || '') + ".com/embed/" + id), width, height, this$1.videoAutoplay));
};
getImage(("https://img.youtube.com/vi/" + id + "/maxresdefault.jpg")).then(
function (ref) {
var width = ref.width;
var height = ref.height;
// YouTube default 404 thumb, fall back to low resolution
if (width === 120 && height === 90) {
getImage(("https://img.youtube.com/vi/" + id + "/0.jpg")).then(
function (ref) {
var width = ref.width;
var height = ref.height;
return setIframe(width, height);
},
setIframe
);
} else {
setIframe(width, height);
}
},
setIframe
);
// Vimeo
} else if ((matches = source.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/))) {
ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(source))), {responseType: 'json', withCredentials: false})
.then(
function (ref) {
var ref_response = ref.response;
var height = ref_response.height;
var width = ref_response.width;
return this$1.setItem(item, getIframe(("https://player.vimeo.com/video/" + (matches[2])), width, height, this$1.videoAutoplay));
},
function () { return this$1.setError(item); }
);
}
}
}
],
methods: {
loadItem: function(index) {
if ( index === void 0 ) index = this.index;
var item = this.getItem(index);
if (item.content) {
return;
}
trigger(this.$el, 'itemload', [item]);
},
getItem: function(index) {
if ( index === void 0 ) index = this.index;
return this.items[index] || {};
},
setItem: function(item, content) {
assign(item, {content: content});
var el = html(this.slides[this.items.indexOf(item)], content);
trigger(this.$el, 'itemloaded', [this, el]);
this.$update(el);
},
setError: function(item) {
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
},
showControls: function() {
clearTimeout(this.controlsTimer);
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
addClass(this.$el, 'uk-active', 'uk-transition-active');
},
hideControls: function() {
removeClass(this.$el, 'uk-active', 'uk-transition-active');
}
}
};
function getIframe(src, width, height, autoplay) {
return ("<iframe src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\" style=\"max-width: 100%; box-sizing: border-box;\" frameborder=\"0\" allowfullscreen uk-video=\"autoplay: " + autoplay + "\" uk-responsive></iframe>");
}
var Lightbox = {
install: install$2,
props: {toggle: String},
data: {toggle: 'a'},
computed: {
toggles: {
get: function(ref, $el) {
var toggle = ref.toggle;
return $$(toggle, $el);
},
watch: function() {
this.hide();
}
},
items: function() {
return uniqueBy(this.toggles.map(toItem), 'source');
}
},
disconnected: function() {
this.hide();
},
events: [
{
name: 'click',
delegate: function() {
return ((this.toggle) + ":not(.uk-disabled)");
},
handler: function(e) {
e.preventDefault();
var src = data(e.current, 'href');
this.show(findIndex(this.items, function (ref) {
var source = ref.source;
return source === src;
}));
}
}
],
methods: {
show: function(index) {
var this$1 = this;
this.panel = this.panel || this.$create('lightboxPanel', assign({}, this.$props, {items: this.items}));
on(this.panel.$el, 'hidden', function () { return this$1.panel = false; });
return this.panel.show(index);
},
hide: function() {
return this.panel && this.panel.hide();
}
}
};
function install$2(UIkit, Lightbox) {
if (!UIkit.lightboxPanel) {
UIkit.component('lightboxPanel', lightboxPanel);
}
assign(
Lightbox.props,
UIkit.component('lightboxPanel').options.props
);
}
function toItem(el) {
return ['href', 'caption', 'type', 'poster', 'alt'].reduce(function (obj, attr) {
obj[attr === 'href' ? 'source' : attr] = data(el, attr);
return obj;
}, {});
}
var obj;
var containers = {};
var Notification = {
functional: true,
args: ['message', 'status'],
data: {
message: '',
status: '',
timeout: 5000,
group: null,
pos: 'top-center',
clsClose: 'uk-notification-close',
clsMsg: 'uk-notification-message'
},
install: install$3,
computed: {
marginProp: function(ref) {
var pos = ref.pos;
return ("margin" + (startsWith(pos, 'top') ? 'Top' : 'Bottom'));
},
startProps: function() {
var obj;
return ( obj = {opacity: 0}, obj[this.marginProp] = -this.$el.offsetHeight, obj );
}
},
created: function() {
if (!containers[this.pos]) {
containers[this.pos] = append(this.$container, ("<div class=\"uk-notification uk-notification-" + (this.pos) + "\"></div>"));
}
var container = css(containers[this.pos], 'display', 'block');
this.$mount(append(container,
("<div class=\"" + (this.clsMsg) + (this.status ? (" " + (this.clsMsg) + "-" + (this.status)) : '') + "\"> <a href=\"#\" class=\"" + (this.clsClose) + "\" data-uk-close></a> <div>" + (this.message) + "</div> </div>")
));
},
connected: function() {
var this$1 = this;
var obj;
var margin = toFloat(css(this.$el, this.marginProp));
Transition.start(
css(this.$el, this.startProps),
( obj = {opacity: 1}, obj[this.marginProp] = margin, obj )
).then(function () {
if (this$1.timeout) {
this$1.timer = setTimeout(this$1.close, this$1.timeout);
}
});
},
events: ( obj = {
click: function(e) {
if (closest(e.target, 'a[href="#"],a[href=""]')) {
e.preventDefault();
}
this.close();
}
}, obj[pointerEnter] = function () {
if (this.timer) {
clearTimeout(this.timer);
}
}, obj[pointerLeave] = function () {
if (this.timeout) {
this.timer = setTimeout(this.close, this.timeout);
}
}, obj ),
methods: {
close: function(immediate) {
var this$1 = this;
var removeFn = function () {
trigger(this$1.$el, 'close', [this$1]);
remove(this$1.$el);
if (!containers[this$1.pos].children.length) {
css(containers[this$1.pos], 'display', 'none');
}
};
if (this.timer) {
clearTimeout(this.timer);
}
if (immediate) {
removeFn();
} else {
Transition.start(this.$el, this.startProps).then(removeFn);
}
}
}
};
function install$3(UIkit) {
UIkit.notification.closeAll = function (group, immediate) {
apply(document.body, function (el) {
var notification = UIkit.getComponent(el, 'notification');
if (notification && (!group || group === notification.group)) {
notification.close(immediate);
}
});
};
}
var props = ['x', 'y', 'bgx', 'bgy', 'rotate', 'scale', 'color', 'backgroundColor', 'borderColor', 'opacity', 'blur', 'hue', 'grayscale', 'invert', 'saturate', 'sepia', 'fopacity', 'stroke'];
var Parallax = {
mixins: [Media],
props: props.reduce(function (props, prop) {
props[prop] = 'list';
return props;
}, {}),
data: props.reduce(function (data, prop) {
data[prop] = undefined;
return data;
}, {}),
computed: {
props: function(properties, $el) {
var this$1 = this;
return props.reduce(function (props, prop) {
if (isUndefined(properties[prop])) {
return props;
}
var isColor = prop.match(/color/i);
var isCssProp = isColor || prop === 'opacity';
var pos, bgPos, diff;
var steps = properties[prop].slice(0);
if (isCssProp) {
css($el, prop, '');
}
if (steps.length < 2) {
steps.unshift((prop === 'scale'
? 1
: isCssProp
? css($el, prop)
: 0) || 0);
}
var unit = getUnit(steps);
if (isColor) {
var ref = $el.style;
var color = ref.color;
steps = steps.map(function (step) { return parseColor($el, step); });
$el.style.color = color;
} else if (startsWith(prop, 'bg')) {
var attr = prop === 'bgy' ? 'height' : 'width';
steps = steps.map(function (step) { return toPx(step, attr, this$1.$el); });
css($el, ("background-position-" + (prop[2])), '');
bgPos = css($el, 'backgroundPosition').split(' ')[prop[2] === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
if (this$1.covers) {
var min = Math.min.apply(Math, steps);
var max = Math.max.apply(Math, steps);
var down = steps.indexOf(min) < steps.indexOf(max);
diff = max - min;
steps = steps.map(function (step) { return step - (down ? min : max); });
pos = (down ? -diff : 0) + "px";
} else {
pos = bgPos;
}
} else {
steps = steps.map(toFloat);
}
if (prop === 'stroke') {
if (!steps.some(function (step) { return step; })) {
return props;
}
var length = getMaxPathLength(this$1.$el);
css($el, 'strokeDasharray', length);
if (unit === '%') {
steps = steps.map(function (step) { return step * length / 100; });
}
steps = steps.reverse();
prop = 'strokeDashoffset';
}
props[prop] = {steps: steps, unit: unit, pos: pos, bgPos: bgPos, diff: diff};
return props;
}, {});
},
bgProps: function() {
var this$1 = this;
return ['bgx', 'bgy'].filter(function (bg) { return bg in this$1.props; });
},
covers: function(_, $el) {
return covers($el);
}
},
disconnected: function() {
delete this._image;
},
update: {
read: function(data) {
var this$1 = this;
data.active = this.matchMedia;
if (!data.active) {
return;
}
if (!data.image && this.covers && this.bgProps.length) {
var src = css(this.$el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
if (src) {
var img = new Image();
img.src = src;
data.image = img;
if (!img.naturalWidth) {
img.onload = function () { return this$1.$emit(); };
}
}
}
var image = data.image;
if (!image || !image.naturalWidth) {
return;
}
var dimEl = {
width: this.$el.offsetWidth,
height: this.$el.offsetHeight
};
var dimImage = {
width: image.naturalWidth,
height: image.naturalHeight
};
var dim = Dimensions.cover(dimImage, dimEl);
this.bgProps.forEach(function (prop) {
var ref = this$1.props[prop];
var diff = ref.diff;
var bgPos = ref.bgPos;
var steps = ref.steps;
var attr = prop === 'bgy' ? 'height' : 'width';
var span = dim[attr] - dimEl[attr];
if (span < diff) {
dimEl[attr] = dim[attr] + diff - span;
} else if (span > diff) {
var posPercentage = dimEl[attr] / toPx(bgPos, attr, this$1.$el);
if (posPercentage) {
this$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / posPercentage; });
}
}
dim = Dimensions.cover(dimImage, dimEl);
});
data.dim = dim;
},
write: function(ref) {
var dim = ref.dim;
var active = ref.active;
if (!active) {
css(this.$el, {backgroundSize: '', backgroundRepeat: ''});
return;
}
dim && css(this.$el, {
backgroundSize: ((dim.width) + "px " + (dim.height) + "px"),
backgroundRepeat: 'no-repeat'
});
},
events: ['resize']
},
methods: {
reset: function() {
var this$1 = this;
each(this.getCss(0), function (_, prop) { return css(this$1.$el, prop, ''); });
},
getCss: function(percent) {
var ref = this;
var props = ref.props;
return Object.keys(props).reduce(function (css, prop) {
var ref = props[prop];
var steps = ref.steps;
var unit = ref.unit;
var pos = ref.pos;
var value = getValue(steps, percent);
switch (prop) {
// transforms
case 'x':
case 'y': {
unit = unit || 'px';
css.transform += " translate" + (ucfirst(prop)) + "(" + (toFloat(value).toFixed(unit === 'px' ? 0 : 2)) + unit + ")";
break;
}
case 'rotate':
unit = unit || 'deg';
css.transform += " rotate(" + (value + unit) + ")";
break;
case 'scale':
css.transform += " scale(" + value + ")";
break;
// bg image
case 'bgy':
case 'bgx':
css[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + value + "px)";
break;
// color
case 'color':
case 'backgroundColor':
case 'borderColor': {
var ref$1 = getStep(steps, percent);
var start = ref$1[0];
var end = ref$1[1];
var p = ref$1[2];
css[prop] = "rgba(" + (start.map(function (value, i) {
value = value + p * (end[i] - value);
return i === 3 ? toFloat(value) : parseInt(value, 10);
}).join(',')) + ")";
break;
}
// CSS Filter
case 'blur':
unit = unit || 'px';
css.filter += " blur(" + (value + unit) + ")";
break;
case 'hue':
unit = unit || 'deg';
css.filter += " hue-rotate(" + (value + unit) + ")";
break;
case 'fopacity':
unit = unit || '%';
css.filter += " opacity(" + (value + unit) + ")";
break;
case 'grayscale':
case 'invert':
case 'saturate':
case 'sepia':
unit = unit || '%';
css.filter += " " + prop + "(" + (value + unit) + ")";
break;
default:
css[prop] = value;
}
return css;
}, {transform: '', filter: ''});
}
}
};
function parseColor(el, color) {
return css(css(el, 'color', color), 'color')
.split(/[(),]/g)
.slice(1, -1)
.concat(1)
.slice(0, 4)
.map(toFloat);
}
function getStep(steps, percent) {
var count = steps.length - 1;
var index = Math.min(Math.floor(count * percent), count - 1);
var step = steps.slice(index, index + 2);
step.push(percent === 1 ? 1 : percent % (1 / count) * count);
return step;
}
function getValue(steps, percent, digits) {
if ( digits === void 0 ) digits = 2;
var ref = getStep(steps, percent);
var start = ref[0];
var end = ref[1];
var p = ref[2];
return (isNumber(start)
? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
: +end
).toFixed(digits);
}
function getUnit(steps) {
return steps.reduce(function (unit, step) { return isString(step) && step.replace(/-|\d/g, '').trim() || unit; }, '');
}
function covers(el) {
var ref = el.style;
var backgroundSize = ref.backgroundSize;
var covers = css(css(el, 'backgroundSize', ''), 'backgroundSize') === 'cover';
el.style.backgroundSize = backgroundSize;
return covers;
}
var Parallax$1 = {
mixins: [Parallax],
props: {
target: String,
viewport: Number,
easing: Number
},
data: {
target: false,
viewport: 1,
easing: 1
},
computed: {
target: function(ref, $el) {
var target = ref.target;
return getOffsetElement(target && query(target, $el) || $el);
}
},
update: {
read: function(ref, type) {
var percent = ref.percent;
var active = ref.active;
if (type !== 'scroll') {
percent = false;
}
if (!active) {
return;
}
var prev = percent;
percent = ease$1(scrolledOver(this.target) / (this.viewport || 1), this.easing);
return {
percent: percent,
style: prev !== percent ? this.getCss(percent) : false
};
},
write: function(ref) {
var style = ref.style;
var active = ref.active;
if (!active) {
this.reset();
return;
}
style && css(this.$el, style);
},
events: ['scroll', 'resize']
}
};
function ease$1(percent, easing) {
return clamp(percent * (1 - (easing - easing * percent)));
}
// SVG elements do not inherit from HTMLElement
function getOffsetElement(el) {
return el
? 'offsetTop' in el
? el
: getOffsetElement(el.parentNode)
: document.body;
}
var SliderReactive = {
update: {
write: function() {
if (this.stack.length || this.dragging) {
return;
}
var index = this.getValidIndex(this.index);
if (!~this.prevIndex || this.index !== index) {
this.show(index);
}
},
events: ['resize']
}
};
function Transitioner$1 (prev, next, dir, ref) {
var center = ref.center;
var easing = ref.easing;
var list = ref.list;
var deferred = new Deferred();
var from = prev
? getLeft(prev, list, center)
: getLeft(next, list, center) + bounds(next).width * dir;
var to = next
? getLeft(next, list, center)
: from + bounds(prev).width * dir * (isRtl ? -1 : 1);
return {
dir: dir,
show: function(duration, percent, linear) {
if ( percent === void 0 ) percent = 0;
var timing = linear ? 'linear' : easing;
duration -= Math.round(duration * clamp(percent, -1, 1));
this.translate(percent);
prev && this.updateTranslates();
percent = prev ? percent : clamp(percent, 0, 1);
triggerUpdate$1(this.getItemIn(), 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
prev && triggerUpdate$1(this.getItemIn(true), 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
Transition
.start(list, {transform: translate(-to * (isRtl ? -1 : 1), 'px')}, duration, timing)
.then(deferred.resolve, noop);
return deferred.promise;
},
stop: function() {
return Transition.stop(list);
},
cancel: function() {
Transition.cancel(list);
},
reset: function() {
css(list, 'transform', '');
},
forward: function(duration, percent) {
if ( percent === void 0 ) percent = this.percent();
Transition.cancel(list);
return this.show(duration, percent, true);
},
translate: function(percent) {
var distance = this.getDistance() * dir * (isRtl ? -1 : 1);
css(list, 'transform', translate(clamp(
-to + (distance - distance * percent),
-getWidth(list),
bounds(list).width
) * (isRtl ? -1 : 1), 'px'));
this.updateTranslates();
if (prev) {
percent = clamp(percent, -1, 1);
triggerUpdate$1(this.getItemIn(), 'itemtranslatein', {percent: percent, dir: dir});
triggerUpdate$1(this.getItemIn(true), 'itemtranslateout', {percent: 1 - percent, dir: dir});
}
},
percent: function() {
return Math.abs((css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from));
},
getDistance: function() {
return Math.abs(to - from);
},
getItemIn: function(out) {
if ( out === void 0 ) out = false;
var actives = this.getActives();
var all = sortBy(slides(list), 'offsetLeft');
var i = index(all, actives[dir * (out ? -1 : 1) > 0 ? actives.length - 1 : 0]);
return ~i && all[i + (prev && !out ? dir : 0)];
},
getActives: function() {
var left = getLeft(prev || next, list, center);
return sortBy(slides(list).filter(function (slide) {
var slideLeft = getElLeft(slide, list);
return slideLeft >= left && slideLeft + bounds(slide).width <= bounds(list).width + left;
}), 'offsetLeft');
},
updateTranslates: function() {
var actives = this.getActives();
slides(list).forEach(function (slide) {
var isActive = includes(actives, slide);
triggerUpdate$1(slide, ("itemtranslate" + (isActive ? 'in' : 'out')), {
percent: isActive ? 1 : 0,
dir: slide.offsetLeft <= next.offsetLeft ? 1 : -1
});
});
}
};
}
function getLeft(el, list, center) {
var left = getElLeft(el, list);
return center
? left - centerEl(el, list)
: Math.min(left, getMax(list));
}
function getMax(list) {
return Math.max(0, getWidth(list) - bounds(list).width);
}
function getWidth(list) {
return slides(list).reduce(function (right, el) { return bounds(el).width + right; }, 0);
}
function getMaxWidth(list) {
return slides(list).reduce(function (right, el) { return Math.max(right, bounds(el).width); }, 0);
}
function centerEl(el, list) {
return bounds(list).width / 2 - bounds(el).width / 2;
}
function getElLeft(el, list) {
return (position(el).left + (isRtl ? bounds(el).width - bounds(list).width : 0)) * (isRtl ? -1 : 1);
}
function bounds(el) {
return el.getBoundingClientRect();
}
function triggerUpdate$1(el, type, data) {
trigger(el, createEvent(type, false, false, data));
}
function slides(list) {
return toNodes(list.children);
}
var Slider$1 = {
mixins: [Class, Slider, SliderReactive],
props: {
center: Boolean,
sets: Boolean
},
data: {
center: false,
sets: false,
attrItem: 'uk-slider-item',
selList: '.uk-slider-items',
selNav: '.uk-slider-nav',
clsContainer: 'uk-slider-container',
Transitioner: Transitioner$1
},
computed: {
avgWidth: function() {
return getWidth(this.list) / this.length;
},
finite: function(ref) {
var finite = ref.finite;
return finite || getWidth(this.list) < bounds(this.list).width + getMaxWidth(this.list) + this.center;
},
maxIndex: function() {
if (!this.finite || this.center && !this.sets) {
return this.length - 1;
}
if (this.center) {
return last(this.sets);
}
css(this.slides, 'order', '');
var max = getMax(this.list);
var i = this.length;
while (i--) {
if (getElLeft(this.list.children[i], this.list) < max) {
return Math.min(i + 1, this.length - 1);
}
}
return 0;
},
sets: function(ref) {
var this$1 = this;
var sets = ref.sets;
var width = bounds(this.list).width / (this.center ? 2 : 1);
var left = 0;
var leftCenter = width;
var slideLeft = 0;
sets = sets && this.slides.reduce(function (sets, slide, i) {
var ref = bounds(slide);
var slideWidth = ref.width;
var slideRight = slideLeft + slideWidth;
if (slideRight > left) {
if (!this$1.center && i > this$1.maxIndex) {
i = this$1.maxIndex;
}
if (!includes(sets, i)) {
var cmp = this$1.slides[i + 1];
if (this$1.center && cmp && slideWidth < leftCenter - bounds(cmp).width / 2) {
leftCenter -= slideWidth;
} else {
leftCenter = width;
sets.push(i);
left = slideLeft + width + (this$1.center ? slideWidth / 2 : 0);
}
}
}
slideLeft += slideWidth;
return sets;
}, []);
return !isEmpty(sets) && sets;
},
transitionOptions: function() {
return {
center: this.center,
list: this.list
};
}
},
connected: function() {
toggleClass(this.$el, this.clsContainer, !$(("." + (this.clsContainer)), this.$el));
},
update: {
write: function() {
var this$1 = this;
$$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), this.$el).forEach(function (el) {
var index = data(el, this$1.attrItem);
this$1.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index) && (this$1.sets && !includes(this$1.sets, toFloat(index)) || index > this$1.maxIndex));
});
if (!this.dragging && !this.stack.length) {
this._getTransitioner().translate(1);
}
},
events: ['resize']
},
events: {
beforeitemshow: function(e) {
if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) {
this.index = this.getValidIndex();
}
var diff = Math.abs(
this.index
- this.prevIndex
+ (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)
);
if (!this.dragging && diff > 1) {
for (var i = 0; i < diff; i++) {
this.stack.splice(1, 0, this.dir > 0 ? 'next' : 'previous');
}
e.preventDefault();
return;
}
this.duration = speedUp(this.avgWidth / this.velocity)
* (bounds(
this.dir < 0 || !this.slides[this.prevIndex]
? this.slides[this.index]
: this.slides[this.prevIndex]
).width / this.avgWidth);
this.reorder();
},
itemshow: function() {
!isUndefined(this.prevIndex) && addClass(this._getTransitioner().getItemIn(), this.clsActive);
},
itemshown: function() {
var this$1 = this;
var actives = this._getTransitioner(this.index).getActives();
this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActive, includes(actives, slide)); });
(!this.sets || includes(this.sets, toFloat(this.index))) && this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActivated, includes(actives, slide)); });
}
},
methods: {
reorder: function() {
var this$1 = this;
css(this.slides, 'order', '');
if (this.finite) {
return;
}
var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
this.slides.forEach(function (slide, i) { return css(slide, 'order', this$1.dir > 0 && i < index
? 1
: this$1.dir < 0 && i >= this$1.index
? -1
: ''
); }
);
if (!this.center) {
return;
}
var next = this.slides[index];
var width = bounds(this.list).width / 2 - bounds(next).width / 2;
var j = 0;
while (width > 0) {
var slideIndex = this.getIndex(--j + index, index);
var slide = this.slides[slideIndex];
css(slide, 'order', slideIndex > index ? -2 : -1);
width -= bounds(slide).width;
}
},
getValidIndex: function(index, prevIndex) {
if ( index === void 0 ) index = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
index = this.getIndex(index, prevIndex);
if (!this.sets) {
return index;
}
var prev;
do {
if (includes(this.sets, index)) {
return index;
}
prev = index;
index = this.getIndex(index + this.dir, prevIndex);
} while (index !== prev);
return index;
}
}
};
var SlideshowParallax = {
mixins: [Parallax],
data: {
selItem: '!li'
},
computed: {
item: function(ref, $el) {
var selItem = ref.selItem;
return query(selItem, $el);
}
},
events: [
{
name: 'itemshown',
self: true,
el: function() {
return this.item;
},
handler: function() {
css(this.$el, this.getCss(.5));
}
},
{
name: 'itemin itemout',
self: true,
el: function() {
return this.item;
},
handler: function(ref) {
var type = ref.type;
var ref_detail = ref.detail;
var percent = ref_detail.percent;
var duration = ref_detail.duration;
var timing = ref_detail.timing;
var dir = ref_detail.dir;
Transition.cancel(this.$el);
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
Transition.start(this.$el, this.getCss(isIn(type)
? .5
: dir > 0
? 1
: 0
), duration, timing).catch(noop);
}
},
{
name: 'transitioncanceled transitionend',
self: true,
el: function() {
return this.item;
},
handler: function() {
Transition.cancel(this.$el);
}
},
{
name: 'itemtranslatein itemtranslateout',
self: true,
el: function() {
return this.item;
},
handler: function(ref) {
var type = ref.type;
var ref_detail = ref.detail;
var percent = ref_detail.percent;
var dir = ref_detail.dir;
Transition.cancel(this.$el);
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
}
}
]
};
function isIn(type) {
return endsWith(type, 'in');
}
function getCurrent(type, dir, percent) {
percent /= 2;
return !isIn(type)
? dir < 0
? percent
: 1 - percent
: dir < 0
? 1 - percent
: percent;
}
var Animations$2 = assign({}, Animations, {
fade: {
show: function() {
return [
{opacity: 0, zIndex: 0},
{zIndex: -1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, zIndex: 0},
{zIndex: -1}
];
}
},
scale: {
show: function() {
return [
{opacity: 0, transform: scale3d(1 + .5), zIndex: 0},
{zIndex: -1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0},
{zIndex: -1}
];
}
},
pull: {
show: function(dir) {
return dir < 0
? [
{transform: translate(30), zIndex: -1},
{transform: translate(), zIndex: 0}
]
: [
{transform: translate(-100), zIndex: 0},
{transform: translate(), zIndex: -1}
];
},
percent: function(current, next, dir) {
return dir < 0
? 1 - translated(next)
: translated(current);
},
translate: function(percent, dir) {
return dir < 0
? [
{transform: translate(30 * percent), zIndex: -1},
{transform: translate(-100 * (1 - percent)), zIndex: 0}
]
: [
{transform: translate(-percent * 100), zIndex: 0},
{transform: translate(30 * (1 - percent)), zIndex: -1}
];
}
},
push: {
show: function(dir) {
return dir < 0
? [
{transform: translate(100), zIndex: 0},
{transform: translate(), zIndex: -1}
]
: [
{transform: translate(-30), zIndex: -1},
{transform: translate(), zIndex: 0}
];
},
percent: function(current, next, dir) {
return dir > 0
? 1 - translated(next)
: translated(current);
},
translate: function(percent, dir) {
return dir < 0
? [
{transform: translate(percent * 100), zIndex: 0},
{transform: translate(-30 * (1 - percent)), zIndex: -1}
]
: [
{transform: translate(-30 * percent), zIndex: -1},
{transform: translate(100 * (1 - percent)), zIndex: 0}
];
}
}
});
var Slideshow$1 = {
mixins: [Class, Slideshow, SliderReactive],
props: {
ratio: String,
minHeight: Number,
maxHeight: Number
},
data: {
ratio: '16:9',
minHeight: false,
maxHeight: false,
selList: '.uk-slideshow-items',
attrItem: 'uk-slideshow-item',
selNav: '.uk-slideshow-nav',
Animations: Animations$2
},
update: {
read: function() {
var ref = this.ratio.split(':').map(Number);
var width = ref[0];
var height = ref[1];
height = height * this.list.offsetWidth / width || 0;
if (this.minHeight) {
height = Math.max(this.minHeight, height);
}
if (this.maxHeight) {
height = Math.min(this.maxHeight, height);
}
return {height: height - boxModelAdjust(this.list, 'content-box')};
},
write: function(ref) {
var height = ref.height;
height > 0 && css(this.list, 'minHeight', height);
},
events: ['resize']
}
};
var Sortable = {
mixins: [Class, Animate],
props: {
group: String,
threshold: Number,
clsItem: String,
clsPlaceholder: String,
clsDrag: String,
clsDragState: String,
clsBase: String,
clsNoDrag: String,
clsEmpty: String,
clsCustom: String,
handle: String
},
data: {
group: false,
threshold: 5,
clsItem: 'uk-sortable-item',
clsPlaceholder: 'uk-sortable-placeholder',
clsDrag: 'uk-sortable-drag',
clsDragState: 'uk-drag',
clsBase: 'uk-sortable',
clsNoDrag: 'uk-sortable-nodrag',
clsEmpty: 'uk-sortable-empty',
clsCustom: '',
handle: false
},
created: function() {
var this$1 = this;
['init', 'start', 'move', 'end'].forEach(function (key) {
var fn = this$1[key];
this$1[key] = function (e) {
this$1.scrollY = window.pageYOffset;
var ref = getEventPos(e, 'page');
var x = ref.x;
var y = ref.y;
this$1.pos = {x: x, y: y};
fn(e);
};
});
},
events: {
name: pointerDown,
passive: false,
handler: 'init'
},
update: {
write: function() {
if (this.clsEmpty) {
toggleClass(this.$el, this.clsEmpty, isEmpty(this.$el.children));
}
css(this.handle ? $$(this.handle, this.$el) : this.$el.children, {touchAction: 'none', userSelect: 'none'});
if (this.drag) {
// clamp to viewport
var ref = offset(window);
var right = ref.right;
var bottom = ref.bottom;
offset(this.drag, {
top: clamp(this.pos.y + this.origin.top, 0, bottom - this.drag.offsetHeight),
left: clamp(this.pos.x + this.origin.left, 0, right - this.drag.offsetWidth)
});
trackScroll(this.pos);
}
}
},
methods: {
init: function(e) {
var target = e.target;
var button = e.button;
var defaultPrevented = e.defaultPrevented;
var ref = toNodes(this.$el.children).filter(function (el) { return within(target, el); });
var placeholder = ref[0];
if (!placeholder
|| defaultPrevented
|| button > 0
|| isInput(target)
|| within(target, ("." + (this.clsNoDrag)))
|| this.handle && !within(target, this.handle)
) {
return;
}
e.preventDefault();
this.touched = [this];
this.placeholder = placeholder;
this.origin = assign({target: target, index: index(placeholder)}, this.pos);
on(document, pointerMove, this.move);
on(document, pointerUp, this.end);
on(window, 'scroll', this.scroll);
if (!this.threshold) {
this.start(e);
}
},
start: function(e) {
this.drag = append(this.$container, this.placeholder.outerHTML.replace(/^<li/i, '<div').replace(/li>$/i, 'div>'));
css(this.drag, assign({
boxSizing: 'border-box',
width: this.placeholder.offsetWidth,
height: this.placeholder.offsetHeight,
overflow: 'hidden'
}, css(this.placeholder, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'])));
attr(this.drag, 'uk-no-boot', '');
addClass(this.drag, this.clsDrag, this.clsCustom);
height(this.drag.firstElementChild, height(this.placeholder.firstElementChild));
var ref = offset(this.placeholder);
var left = ref.left;
var top = ref.top;
assign(this.origin, {left: left - this.pos.x, top: top - this.pos.y});
addClass(this.placeholder, this.clsPlaceholder);
addClass(this.$el.children, this.clsItem);
addClass(document.documentElement, this.clsDragState);
trigger(this.$el, 'start', [this, this.placeholder]);
this.move(e);
},
move: function(e) {
if (!this.drag) {
if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) {
this.start(e);
}
return;
}
this.$emit();
var target = e.type === 'mousemove' ? e.target : document.elementFromPoint(this.pos.x - window.pageXOffset, this.pos.y - window.pageYOffset);
var sortable = this.getSortable(target);
var previous = this.getSortable(this.placeholder);
var move = sortable !== previous;
if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) {
return;
}
target = sortable.$el === target.parentNode && target || toNodes(sortable.$el.children).filter(function (element) { return within(target, element); })[0];
if (move) {
previous.remove(this.placeholder);
} else if (!target) {
return;
}
sortable.insert(this.placeholder, target);
if (!includes(this.touched, sortable)) {
this.touched.push(sortable);
}
},
end: function(e) {
off(document, pointerMove, this.move);
off(document, pointerUp, this.end);
off(window, 'scroll', this.scroll);
if (!this.drag) {
if (e.type === 'touchend') {
e.target.click();
}
return;
}
untrackScroll();
var sortable = this.getSortable(this.placeholder);
if (this === sortable) {
if (this.origin.index !== index(this.placeholder)) {
trigger(this.$el, 'moved', [this, this.placeholder]);
}
} else {
trigger(sortable.$el, 'added', [sortable, this.placeholder]);
trigger(this.$el, 'removed', [this, this.placeholder]);
}
trigger(this.$el, 'stop', [this, this.placeholder]);
remove(this.drag);
this.drag = null;
var classes = this.touched.map(function (sortable) { return ((sortable.clsPlaceholder) + " " + (sortable.clsItem)); }).join(' ');
this.touched.forEach(function (sortable) { return removeClass(sortable.$el.children, classes); });
removeClass(document.documentElement, this.clsDragState);
},
scroll: function() {
var scroll = window.pageYOffset;
if (scroll !== this.scrollY) {
this.pos.y += scroll - this.scrollY;
this.scrollY = scroll;
this.$emit();
}
},
insert: function(element, target) {
var this$1 = this;
addClass(this.$el.children, this.clsItem);
var insert = function () {
if (target) {
if (!within(element, this$1.$el) || isPredecessor(element, target)) {
before(target, element);
} else {
after(target, element);
}
} else {
append(this$1.$el, element);
}
};
if (this.animation) {
this.animate(insert);
} else {
insert();
}
},
remove: function(element) {
if (!within(element, this.$el)) {
return;
}
css(this.handle ? $$(this.handle, element) : element, {touchAction: '', userSelect: ''});
if (this.animation) {
this.animate(function () { return remove(element); });
} else {
remove(element);
}
},
getSortable: function(element) {
return element && (this.$getComponent(element, 'sortable') || this.getSortable(element.parentNode));
}
}
};
function isPredecessor(element, target) {
return element.parentNode === target.parentNode && index(element) > index(target);
}
var trackTimer;
function trackScroll(ref) {
var x = ref.x;
var y = ref.y;
clearTimeout(trackTimer);
scrollParents(document.elementFromPoint(x - window.pageXOffset, y - window.pageYOffset)).some(function (scrollEl) {
var scroll = scrollEl.scrollTop;
var scrollHeight = scrollEl.scrollHeight;
if (getScrollingElement() === scrollEl) {
scrollEl = window;
scrollHeight -= window.innerHeight;
}
var ref = offset(scrollEl);
var top = ref.top;
var bottom = ref.bottom;
if (top < y && top + 30 > y) {
scroll -= 5;
} else if (bottom > y && bottom - 20 < y) {
scroll += 5;
}
if (scroll > 0 && scroll < scrollHeight) {
return trackTimer = setTimeout(function () {
scrollTop(scrollEl, scroll);
trackScroll({x: x, y: y});
}, 10);
}
});
}
function untrackScroll() {
clearTimeout(trackTimer);
}
var overflowRe = /auto|scroll/;
function scrollParents(element) {
var scrollEl = getScrollingElement();
return parents$1(element, function (parent) { return parent === scrollEl || overflowRe.test(css(parent, 'overflow')); });
}
function parents$1(element, fn) {
var parents = [];
do {
if (fn(element)) {
parents.unshift(element);
}
} while (element && (element = element.parentElement));
return parents;
}
function getScrollingElement() {
return document.scrollingElement || document.documentElement;
}
var obj$1;
var actives = [];
var Tooltip = {
mixins: [Container, Togglable, Position],
args: 'title',
props: {
delay: Number,
title: String
},
data: {
pos: 'top',
title: '',
delay: 0,
animation: ['uk-animation-scale-up'],
duration: 100,
cls: 'uk-active',
clsPos: 'uk-tooltip'
},
beforeConnect: function() {
this._hasTitle = hasAttr(this.$el, 'title');
attr(this.$el, {title: '', 'aria-expanded': false});
},
disconnected: function() {
this.hide();
attr(this.$el, {title: this._hasTitle ? this.title : null, 'aria-expanded': null});
},
methods: {
show: function() {
var this$1 = this;
if (this.isActive() || !this.title) {
return;
}
actives.forEach(function (active) { return active.hide(); });
actives.push(this);
this._unbind = on(document, pointerUp, function (e) { return !within(e.target, this$1.$el) && this$1.hide(); });
clearTimeout(this.showTimer);
this.showTimer = setTimeout(function () {
this$1._show();
this$1.hideTimer = setInterval(function () {
if (!isVisible(this$1.$el)) {
this$1.hide();
}
}, 150);
}, this.delay);
},
hide: function() {
if (!this.isActive() || matches(this.$el, 'input:focus')) {
return;
}
actives.splice(actives.indexOf(this), 1);
clearTimeout(this.showTimer);
clearInterval(this.hideTimer);
attr(this.$el, 'aria-expanded', false);
this.toggleElement(this.tooltip, false);
this.tooltip && remove(this.tooltip);
this.tooltip = false;
this._unbind();
},
_show: function() {
this.tooltip = append(this.container,
("<div class=\"" + (this.clsPos) + "\" aria-expanded=\"true\" aria-hidden> <div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div> </div>")
);
this.positionAt(this.tooltip, this.$el);
this.origin = this.getAxis() === 'y'
? ((flipPosition(this.dir)) + "-" + (this.align))
: ((this.align) + "-" + (flipPosition(this.dir)));
this.toggleElement(this.tooltip, true);
},
isActive: function() {
return includes(actives, this);
}
},
events: ( obj$1 = {
focus: 'show',
blur: 'hide'
}, obj$1[(pointerEnter + " " + pointerLeave)] = function (e) {
if (isTouch(e)) {
return;
}
e.type === pointerEnter
? this.show()
: this.hide();
}, obj$1[pointerDown] = function (e) {
if (!isTouch(e)) {
return;
}
this.isActive()
? this.hide()
: this.show();
}, obj$1 )
};
var Upload = {
props: {
allow: String,
clsDragover: String,
concurrent: Number,
maxSize: Number,
method: String,
mime: String,
msgInvalidMime: String,
msgInvalidName: String,
msgInvalidSize: String,
multiple: Boolean,
name: String,
params: Object,
type: String,
url: String
},
data: {
allow: false,
clsDragover: 'uk-dragover',
concurrent: 1,
maxSize: 0,
method: 'POST',
mime: false,
msgInvalidMime: 'Invalid File Type: %s',
msgInvalidName: 'Invalid File Name: %s',
msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
multiple: false,
name: 'files[]',
params: {},
type: '',
url: '',
abort: noop,
beforeAll: noop,
beforeSend: noop,
complete: noop,
completeAll: noop,
error: noop,
fail: noop,
load: noop,
loadEnd: noop,
loadStart: noop,
progress: noop
},
events: {
change: function(e) {
if (!matches(e.target, 'input[type="file"]')) {
return;
}
e.preventDefault();
if (e.target.files) {
this.upload(e.target.files);
}
e.target.value = '';
},
drop: function(e) {
stop(e);
var transfer = e.dataTransfer;
if (!transfer || !transfer.files) {
return;
}
removeClass(this.$el, this.clsDragover);
this.upload(transfer.files);
},
dragenter: function(e) {
stop(e);
},
dragover: function(e) {
stop(e);
addClass(this.$el, this.clsDragover);
},
dragleave: function(e) {
stop(e);
removeClass(this.$el, this.clsDragover);
}
},
methods: {
upload: function(files) {
var this$1 = this;
if (!files.length) {
return;
}
trigger(this.$el, 'upload', [files]);
for (var i = 0; i < files.length; i++) {
if (this.maxSize && this.maxSize * 1000 < files[i].size) {
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
return;
}
if (this.allow && !match$1(this.allow, files[i].name)) {
this.fail(this.msgInvalidName.replace('%s', this.allow));
return;
}
if (this.mime && !match$1(this.mime, files[i].type)) {
this.fail(this.msgInvalidMime.replace('%s', this.mime));
return;
}
}
if (!this.multiple) {
files = [files[0]];
}
this.beforeAll(this, files);
var chunks = chunk(files, this.concurrent);
var upload = function (files) {
var data = new FormData();
files.forEach(function (file) { return data.append(this$1.name, file); });
for (var key in this$1.params) {
data.append(key, this$1.params[key]);
}
ajax(this$1.url, {
data: data,
method: this$1.method,
responseType: this$1.type,
beforeSend: function (env) {
var xhr = env.xhr;
xhr.upload && on(xhr.upload, 'progress', this$1.progress);
['loadStart', 'load', 'loadEnd', 'abort'].forEach(function (type) { return on(xhr, type.toLowerCase(), this$1[type]); }
);
this$1.beforeSend(env);
}
}).then(
function (xhr) {
this$1.complete(xhr);
if (chunks.length) {
upload(chunks.shift());
} else {
this$1.completeAll(xhr);
}
},
function (e) { return this$1.error(e); }
);
};
upload(chunks.shift());
}
}
};
function match$1(pattern, path) {
return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i'));
}
function chunk(files, size) {
var chunks = [];
for (var i = 0; i < files.length; i += size) {
var chunk = [];
for (var j = 0; j < size; j++) {
chunk.push(files[i + j]);
}
chunks.push(chunk);
}
return chunks;
}
function stop(e) {
e.preventDefault();
e.stopPropagation();
}
UIkit.component('countdown', Countdown);
UIkit.component('filter', Filter);
UIkit.component('lightbox', Lightbox);
UIkit.component('lightboxPanel', lightboxPanel);
UIkit.component('notification', Notification);
UIkit.component('parallax', Parallax$1);
UIkit.component('slider', Slider$1);
UIkit.component('sliderParallax', SlideshowParallax);
UIkit.component('slideshow', Slideshow$1);
UIkit.component('slideshowParallax', SlideshowParallax);
UIkit.component('sortable', Sortable);
UIkit.component('tooltip', Tooltip);
UIkit.component('upload', Upload);
{
boot(UIkit);
}
return UIkit;
}));
});
/* src\userInterface\ComponentPropSelector.svelte generated by Svelte v3.12.1 */
const file$b = "src\\userInterface\\ComponentPropSelector.svelte";
// (83:50)
function create_if_block_3(ctx) {
var current;
var iconbutton = new IconButton({ props: { icon: "plus" }, $$inline: true });
iconbutton.$on("click", ctx.click_handler_2);
const block = {
c: function create() {
iconbutton.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(iconbutton, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(iconbutton, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_3.name, type: "if", source: "(83:50) ", ctx });
return block;
}
// (77:8) {#if !disabled && componentSelected}
function create_if_block_2(ctx) {
var t, current;
var iconbutton0 = new IconButton({ props: { icon: "edit" }, $$inline: true });
iconbutton0.$on("click", ctx.click_handler);
var iconbutton1 = new IconButton({ props: { icon: "trash" }, $$inline: true });
iconbutton1.$on("click", ctx.click_handler_1);
const block = {
c: function create() {
iconbutton0.$$.fragment.c();
t = space();
iconbutton1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(iconbutton0, target, anchor);
insert_dev(target, t, anchor);
mount_component(iconbutton1, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton0.$$.fragment, local);
transition_in(iconbutton1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton0.$$.fragment, local);
transition_out(iconbutton1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(iconbutton0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(iconbutton1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2.name, type: "if", source: "(77:8) {#if !disabled && componentSelected}", ctx });
return block;
}
// (99:50)
function create_if_block_1(ctx) {
var div0, t_1, div1, current;
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div0 = element("div");
div0.textContent = "Clear this component ?";
t_1 = space();
div1 = element("div");
buttongroup.$$.fragment.c();
attr_dev(div0, "class", "uk-modal-body");
add_location(div0, file$b, 99, 8, 2530);
attr_dev(div1, "class", "uk-modal-footer");
add_location(div1, file$b, 102, 8, 2616);
},
m: function mount(target, anchor) {
insert_dev(target, div0, anchor);
insert_dev(target, t_1, anchor);
insert_dev(target, div1, anchor);
mount_component(buttongroup, div1, null);
current = true;
},
p: function update(changed, ctx) {
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div0);
detach_dev(t_1);
detach_dev(div1);
}
destroy_component(buttongroup);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1.name, type: "if", source: "(99:50) ", ctx });
return block;
}
// (94:8) {#if modalAction === CHOOSE_COMPONENT}
function create_if_block$4(ctx) {
var div, current;
var componentselector = new ComponentSelector({
props: {
onComponentChosen: ctx.componentChosen,
allowGenerators: false
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
componentselector.$$.fragment.c();
attr_dev(div, "class", "uk-modal-body");
add_location(div, file$b, 94, 8, 2303);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(componentselector, div, null);
current = true;
},
p: noop,
i: function intro(local) {
if (current) return;
transition_in(componentselector.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(componentselector.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(componentselector);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$4.name, type: "if", source: "(94:8) {#if modalAction === CHOOSE_COMPONENT}", ctx });
return block;
}
// (105:16) <Button grouped on:click={hideDialog} color="secondary" >
function create_default_slot_2(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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.name, type: "slot", source: "(105:16) <Button grouped on:click={hideDialog} color=\"secondary\" >", ctx });
return block;
}
// (108:16) <Button grouped on:click={confirmClearComponent}>
function create_default_slot_1(ctx) {
var t;
const block = {
c: function create() {
t = text("OK");
},
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_1.name, type: "slot", source: "(108:16) <Button grouped on:click={confirmClearComponent}>", ctx });
return block;
}
// (104:12) <ButtonGroup>
function create_default_slot(ctx) {
var t, current;
var button0 = new Button({
props: {
grouped: true,
color: "secondary",
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.hideDialog);
var button1 = new Button({
props: {
grouped: true,
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.confirmClearComponent);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot.name, type: "slot", source: "(104:12) <ButtonGroup>", ctx });
return block;
}
function create_fragment$a(ctx) {
var div2, div0, t0_value = ctx.componentSelected ? ctx.shortName : "(none)" + "", t0, t1, div1, current_block_type_index, if_block0, t2, div4, div3, current_block_type_index_1, if_block1, current;
var if_block_creators = [
create_if_block_2,
create_if_block_3
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (!ctx.disabled && ctx.componentSelected) return 0;
if (!ctx.disabled && !ctx.componentSelected) return 1;
return -1;
}
if (~(current_block_type_index = select_block_type(null, ctx))) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
}
var if_block_creators_1 = [
create_if_block$4,
create_if_block_1
];
var if_blocks_1 = [];
function select_block_type_1(changed, ctx) {
if (ctx.modalAction === CHOOSE_COMPONENT) return 0;
if (ctx.modalAction === CLEAR_COMPONENT) return 1;
return -1;
}
if (~(current_block_type_index_1 = select_block_type_1(null, ctx))) {
if_block1 = if_blocks_1[current_block_type_index_1] = if_block_creators_1[current_block_type_index_1](ctx);
}
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
if (if_block0) if_block0.c();
t2 = space();
div4 = element("div");
div3 = element("div");
if (if_block1) if_block1.c();
attr_dev(div0, "class", "svelte-ogh8o0");
toggle_class(div0, "selectedname", ctx.componentSelected);
add_location(div0, file$b, 72, 4, 1636);
attr_dev(div1, "class", "svelte-ogh8o0");
add_location(div1, file$b, 75, 4, 1748);
attr_dev(div2, "class", "root uk-form-controls svelte-ogh8o0");
add_location(div2, file$b, 71, 0, 1596);
attr_dev(div3, "class", "uk-modal-dialog");
attr_dev(div3, "uk-overflow-auto", "");
add_location(div3, file$b, 91, 4, 2200);
attr_dev(div4, "uk-modal", "");
attr_dev(div4, "class", "svelte-ogh8o0");
add_location(div4, file$b, 90, 0, 2156);
},
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, t0);
append_dev(div2, t1);
append_dev(div2, div1);
if (~current_block_type_index) if_blocks[current_block_type_index].m(div1, null);
insert_dev(target, t2, anchor);
insert_dev(target, div4, anchor);
append_dev(div4, div3);
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].m(div3, null);
ctx.div4_binding(div4);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.componentSelected || changed.shortName) && t0_value !== (t0_value = ctx.componentSelected ? ctx.shortName : "(none)" + "")) {
set_data_dev(t0, t0_value);
}
if (changed.componentSelected) {
toggle_class(div0, "selectedname", ctx.componentSelected);
}
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
if (if_block0) {
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_block0 = if_blocks[current_block_type_index];
if (!if_block0) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
if_block0.c();
}
transition_in(if_block0, 1);
if_block0.m(div1, null);
} else {
if_block0 = null;
}
}
var previous_block_index_1 = current_block_type_index_1;
current_block_type_index_1 = select_block_type_1(changed, ctx);
if (current_block_type_index_1 === previous_block_index_1) {
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].p(changed, ctx);
} else {
if (if_block1) {
group_outros();
transition_out(if_blocks_1[previous_block_index_1], 1, 1, () => {
if_blocks_1[previous_block_index_1] = null;
});
check_outros();
}
if (~current_block_type_index_1) {
if_block1 = if_blocks_1[current_block_type_index_1];
if (!if_block1) {
if_block1 = if_blocks_1[current_block_type_index_1] = if_block_creators_1[current_block_type_index_1](ctx);
if_block1.c();
}
transition_in(if_block1, 1);
if_block1.m(div3, null);
} 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 (detaching) {
detach_dev(div2);
}
if (~current_block_type_index) if_blocks[current_block_type_index].d();
if (detaching) {
detach_dev(t2);
detach_dev(div4);
}
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].d();
ctx.div4_binding(null);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$a.name, type: "component", source: "", ctx });
return block;
}
const CHOOSE_COMPONENT = "choose_component";
const CLEAR_COMPONENT = "clear_component";
function instance$a($$self, $$props, $$invalidate) {
const emptyProps = () => ({_component:""});
let { props = emptyProps(), onValueChanged = () => {} } = $$props;
let { onComponentChosen = () => {} } = $$props;
let { onEdit = () => {} } = $$props;
let { disabled = false } = $$props;
let allComponents;
let modalElement;
let modalAction;
store.subscribe(s => {
allComponents = s.allComponents;
});
const chooseComponent = () => {
$$invalidate('modalAction', modalAction = CHOOSE_COMPONENT);
showDialog();
};
const clearComponent = () => {
$$invalidate('modalAction', modalAction = CLEAR_COMPONENT);
showDialog();
};
const componentChosen = (component) => {
const componentInfo = getComponentInfo(allComponents, component.name);
$$invalidate('props', props = componentInfo.fullProps);
onValueChanged(props);
onComponentChosen();
hideDialog();
};
const hideDialog = () => {
uikit.modal(modalElement).hide();
};
const showDialog = () => {
uikit.modal(modalElement).show();
};
const confirmClearComponent = () => {
$$invalidate('props', props = emptyProps());
onValueChanged(emptyProps());
hideDialog();
};
const writable_props = ['props', 'onValueChanged', 'onComponentChosen', 'onEdit', 'disabled'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ComponentPropSelector> was created with unknown prop '${key}'`);
});
const click_handler = () => onEdit();
const click_handler_1 = () => clearComponent();
const click_handler_2 = () => chooseComponent();
function div4_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('modalElement', modalElement = $$value);
});
}
$$self.$set = $$props => {
if ('props' in $$props) $$invalidate('props', props = $$props.props);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onComponentChosen' in $$props) $$invalidate('onComponentChosen', onComponentChosen = $$props.onComponentChosen);
if ('onEdit' in $$props) $$invalidate('onEdit', onEdit = $$props.onEdit);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
};
$$self.$capture_state = () => {
return { props, onValueChanged, onComponentChosen, onEdit, disabled, allComponents, modalElement, modalAction, componentSelected, shortName };
};
$$self.$inject_state = $$props => {
if ('props' in $$props) $$invalidate('props', props = $$props.props);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onComponentChosen' in $$props) $$invalidate('onComponentChosen', onComponentChosen = $$props.onComponentChosen);
if ('onEdit' in $$props) $$invalidate('onEdit', onEdit = $$props.onEdit);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
if ('allComponents' in $$props) allComponents = $$props.allComponents;
if ('modalElement' in $$props) $$invalidate('modalElement', modalElement = $$props.modalElement);
if ('modalAction' in $$props) $$invalidate('modalAction', modalAction = $$props.modalAction);
if ('componentSelected' in $$props) $$invalidate('componentSelected', componentSelected = $$props.componentSelected);
if ('shortName' in $$props) $$invalidate('shortName', shortName = $$props.shortName);
};
let componentSelected, shortName;
$$self.$$.update = ($$dirty = { props: 1 }) => {
if ($$dirty.props) { $$invalidate('componentSelected', componentSelected = props._component.length > 0); }
if ($$dirty.props) { $$invalidate('shortName', shortName = fp_12(props._component.split("/"))); }
};
return {
props,
onValueChanged,
onComponentChosen,
onEdit,
disabled,
modalElement,
modalAction,
chooseComponent,
clearComponent,
componentChosen,
hideDialog,
confirmClearComponent,
componentSelected,
shortName,
click_handler,
click_handler_1,
click_handler_2,
div4_binding
};
}
class ComponentPropSelector extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$a, create_fragment$a, safe_not_equal, ["props", "onValueChanged", "onComponentChosen", "onEdit", "disabled"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ComponentPropSelector", options, id: create_fragment$a.name });
}
get props() {
throw new Error("<ComponentPropSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set props(value) {
throw new Error("<ComponentPropSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValueChanged() {
throw new Error("<ComponentPropSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValueChanged(value) {
throw new Error("<ComponentPropSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onComponentChosen() {
throw new Error("<ComponentPropSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onComponentChosen(value) {
throw new Error("<ComponentPropSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onEdit() {
throw new Error("<ComponentPropSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onEdit(value) {
throw new Error("<ComponentPropSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get disabled() {
throw new Error("<ComponentPropSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set disabled(value) {
throw new Error("<ComponentPropSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\PropArraySelector.svelte generated by Svelte v3.12.1 */
const file$c = "src\\userInterface\\PropArraySelector.svelte";
function get_each_context_1$3(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.propDef = list[i];
return child_ctx;
}
function get_each_context$4(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.item = list[i];
child_ctx.index = i;
return child_ctx;
}
// (80:12) {#each elementDefinitionArray as propDef}
function create_each_block_1$3(ctx) {
var current;
var propcontrol = new PropControl({
props: {
setProp: ctx.setProp(ctx.index),
fieldHasError: ctx.fieldHasError(ctx.index),
propDef: ctx.propDef,
props: ctx.item,
index: ctx.index,
onEditComponent: ctx.onEditComponent(ctx.index, ctx.propDef.____name),
disabled: false
},
$$inline: true
});
const block = {
c: function create() {
propcontrol.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(propcontrol, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var propcontrol_changes = {};
if (changed.elementDefinitionArray) propcontrol_changes.propDef = ctx.propDef;
if (changed.value) propcontrol_changes.props = ctx.item;
if (changed.elementDefinitionArray) propcontrol_changes.onEditComponent = ctx.onEditComponent(ctx.index, ctx.propDef.____name);
propcontrol.$set(propcontrol_changes);
},
i: function intro(local) {
if (current) return;
transition_in(propcontrol.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(propcontrol.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(propcontrol, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$3.name, type: "each", source: "(80:12) {#each elementDefinitionArray as propDef}", ctx });
return block;
}
// (77:8) {#each value as item, index}
function create_each_block$4(ctx) {
var div, current;
let each_value_1 = ctx.elementDefinitionArray;
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1$3(get_each_context_1$3(ctx, each_value_1, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
const block = {
c: function create() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div, "class", "item-inner-container");
add_location(div, file$c, 78, 8, 1913);
},
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);
}
current = true;
},
p: function update(changed, ctx) {
if (changed.setProp || changed.fieldHasError || changed.elementDefinitionArray || changed.value || changed.onEditComponent) {
each_value_1 = ctx.elementDefinitionArray;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$3(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_1$3(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div, null);
}
}
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;
for (let i = 0; i < each_value_1.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(div);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$4.name, type: "each", source: "(77:8) {#each value as item, index}", ctx });
return block;
}
function create_fragment$b(ctx) {
var div2, div1, t, div0, current, dispose;
let each_value = ctx.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 out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
var iconbutton = new IconButton({
props: { icon: "plus", size: "12" },
$$inline: true
});
const block = {
c: function create() {
div2 = element("div");
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
div0 = element("div");
iconbutton.$$.fragment.c();
attr_dev(div0, "class", "addelement-container svelte-199q8jr");
add_location(div0, file$c, 92, 8, 2408);
attr_dev(div1, "class", "item-container svelte-199q8jr");
add_location(div1, file$c, 75, 4, 1834);
attr_dev(div2, "class", "root");
add_location(div2, file$c, 72, 0, 1809);
dispose = listen_dev(div0, "click", ctx.addElement);
},
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, div1);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
append_dev(div1, t);
append_dev(div1, div0);
mount_component(iconbutton, div0, null);
current = true;
},
p: function update(changed, ctx) {
if (changed.elementDefinitionArray || changed.setProp || changed.fieldHasError || changed.value || changed.onEditComponent) {
each_value = ctx.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(changed, child_ctx);
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(div1, t);
}
}
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]);
}
transition_in(iconbutton.$$.fragment, local);
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]);
}
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_each(each_blocks, detaching);
destroy_component(iconbutton);
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$b.name, type: "component", source: "", ctx });
return block;
}
function instance$b($$self, $$props, $$invalidate) {
let { parentProps, propDef, onValueChanged, onValidate = () => {} } = $$props;
let { onEditComponentProp = () => {} } = $$props;
let value = [];
let elementDefinitionArray;
let elementErrors = {};
const addElement = () => {
const newElement = createArrayElementProps(
propDef.____name,
propDef.elementDefinition).props;
$$invalidate('value', value = [...value, newElement]);
onValueChanged(value);
};
const validate = (index, elementProps) => {
elementErrors[index] = validateProps(
propDef.elementDefinition, elementProps, [], true);
onValidate(elementErrors[index]);
return elementErrors[index].length === 0;
};
const setProp = (index) => (name, propValue) => {
const newValue = fp_4(value);
const newProps = fp_4(newValue[index]);
newProps[name] = propValue;
newValue[index] = newProps;
$$invalidate('value', value = newValue);
if(validate(index, newProps))
onValueChanged(newValue);
};
let fieldHasError = index => propName =>
fp_6(e => e.propName === propName)(elementErrors[index]);
const onEditComponent = (index, propName) => () => {
onEditComponentProp(index, propName);
};
const writable_props = ['parentProps', 'propDef', 'onValueChanged', 'onValidate', 'onEditComponentProp'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<PropArraySelector> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('parentProps' in $$props) $$invalidate('parentProps', parentProps = $$props.parentProps);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
if ('onEditComponentProp' in $$props) $$invalidate('onEditComponentProp', onEditComponentProp = $$props.onEditComponentProp);
};
$$self.$capture_state = () => {
return { parentProps, propDef, onValueChanged, onValidate, onEditComponentProp, value, elementDefinitionArray, elementErrors, fieldHasError };
};
$$self.$inject_state = $$props => {
if ('parentProps' in $$props) $$invalidate('parentProps', parentProps = $$props.parentProps);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
if ('onEditComponentProp' in $$props) $$invalidate('onEditComponentProp', onEditComponentProp = $$props.onEditComponentProp);
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('elementDefinitionArray' in $$props) $$invalidate('elementDefinitionArray', elementDefinitionArray = $$props.elementDefinitionArray);
if ('elementErrors' in $$props) elementErrors = $$props.elementErrors;
if ('fieldHasError' in $$props) $$invalidate('fieldHasError', fieldHasError = $$props.fieldHasError);
};
$$self.$$.update = ($$dirty = { propDef: 1, parentProps: 1 }) => {
if ($$dirty.propDef || $$dirty.parentProps) { {
const elArray = [];
for(let elProp in propDef.elementDefinition) {
if(elProp === "_component") continue;
elArray.push({
...propDef.elementDefinition[elProp],
____name: elProp
});
}
$$invalidate('elementDefinitionArray', elementDefinitionArray = elArray);
$$invalidate('value', value = parentProps[propDef.____name]);
} }
};
return {
parentProps,
propDef,
onValueChanged,
onValidate,
onEditComponentProp,
value,
elementDefinitionArray,
addElement,
setProp,
fieldHasError,
onEditComponent
};
}
class PropArraySelector extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$b, create_fragment$b, safe_not_equal, ["parentProps", "propDef", "onValueChanged", "onValidate", "onEditComponentProp"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PropArraySelector", options, id: create_fragment$b.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.parentProps === undefined && !('parentProps' in props)) {
console.warn("<PropArraySelector> was created without expected prop 'parentProps'");
}
if (ctx.propDef === undefined && !('propDef' in props)) {
console.warn("<PropArraySelector> was created without expected prop 'propDef'");
}
if (ctx.onValueChanged === undefined && !('onValueChanged' in props)) {
console.warn("<PropArraySelector> was created without expected prop 'onValueChanged'");
}
}
get parentProps() {
throw new Error("<PropArraySelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set parentProps(value) {
throw new Error("<PropArraySelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get propDef() {
throw new Error("<PropArraySelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set propDef(value) {
throw new Error("<PropArraySelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValueChanged() {
throw new Error("<PropArraySelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValueChanged(value) {
throw new Error("<PropArraySelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValidate() {
throw new Error("<PropArraySelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValidate(value) {
throw new Error("<PropArraySelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onEditComponentProp() {
throw new Error("<PropArraySelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onEditComponentProp(value) {
throw new Error("<PropArraySelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\StateBindingControl.svelte generated by Svelte v3.12.1 */
const file$d = "src\\userInterface\\StateBindingControl.svelte";
function get_each_context$5(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.option = list[i];
return child_ctx;
}
// (112:0) {:else}
function create_else_block$1(ctx) {
var div, current_block_type_index, if_block, t, current;
var if_block_creators = [
create_if_block_3$1,
create_if_block_4,
create_else_block_1
];
var if_blocks = [];
function select_block_type_1(changed, ctx) {
if (ctx.type === "bool") return 0;
if (ctx.type === "options") return 1;
return 2;
}
current_block_type_index = select_block_type_1(null, ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
var iconbutton = new IconButton({
props: { icon: "link", size: "12" },
$$inline: true
});
iconbutton.$on("click", ctx.makeBinding);
const block = {
c: function create() {
div = element("div");
if_block.c();
t = space();
iconbutton.$$.fragment.c();
attr_dev(div, "class", "unbound-container svelte-jubmd5");
add_location(div, file$d, 112, 0, 2742);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
if_blocks[current_block_type_index].m(div, null);
append_dev(div, t);
mount_component(iconbutton, div, null);
current = true;
},
p: function update(changed, ctx) {
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type_1(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} 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();
}
transition_in(if_block, 1);
if_block.m(div, t);
}
},
i: function intro(local) {
if (current) return;
transition_in(if_block);
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(if_block);
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
if_blocks[current_block_type_index].d();
destroy_component(iconbutton);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$1.name, type: "else", source: "(112:0) {:else}", ctx });
return block;
}
// (76:0) {#if isBound}
function create_if_block$5(ctx) {
var div2, div1, div0, t0_value = ctx.isExpanded ? "" : ctx.bindingPath + "", t0, t1, t2, t3, current;
var iconbutton = new IconButton({
props: { icon: ctx.isExpanded ? "chevron-up" : "chevron-down", size: "12" },
$$inline: true
});
iconbutton.$on("click", ctx.click_handler);
var if_block0 = (!ctx.canOnlyBind) && create_if_block_2$1(ctx);
var if_block1 = (ctx.isExpanded) && create_if_block_1$1(ctx);
const block = {
c: function create() {
div2 = element("div");
div1 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
iconbutton.$$.fragment.c();
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
if (if_block1) if_block1.c();
attr_dev(div0, "class", "svelte-jubmd5");
add_location(div0, file$d, 78, 8, 1644);
attr_dev(div1, "class", "bound-header svelte-jubmd5");
add_location(div1, file$d, 77, 4, 1609);
attr_dev(div2, "class", "svelte-jubmd5");
add_location(div2, file$d, 76, 0, 1599);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div1);
append_dev(div1, div0);
append_dev(div0, t0);
append_dev(div1, t1);
mount_component(iconbutton, div1, null);
append_dev(div1, t2);
if (if_block0) if_block0.m(div1, null);
append_dev(div2, t3);
if (if_block1) if_block1.m(div2, null);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.isExpanded || changed.bindingPath) && t0_value !== (t0_value = ctx.isExpanded ? "" : ctx.bindingPath + "")) {
set_data_dev(t0, t0_value);
}
var iconbutton_changes = {};
if (changed.isExpanded) iconbutton_changes.icon = ctx.isExpanded ? "chevron-up" : "chevron-down";
iconbutton.$set(iconbutton_changes);
if (!ctx.canOnlyBind) {
if (!if_block0) {
if_block0 = create_if_block_2$1(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(div1, null);
} else transition_in(if_block0, 1);
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if (ctx.isExpanded) {
if (if_block1) {
if_block1.p(changed, ctx);
} else {
if_block1 = create_if_block_1$1(ctx);
if_block1.c();
if_block1.m(div2, null);
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
transition_in(if_block0);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
transition_out(if_block0);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(iconbutton);
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$5.name, type: "if", source: "(76:0) {#if isBound}", ctx });
return block;
}
// (133:4) {:else}
function create_else_block_1(ctx) {
var input, dispose;
const block = {
c: function create() {
input = element("input");
attr_dev(input, "class", "uk-input uk-form-small svelte-jubmd5");
set_style(input, "flex", "1 0 auto");
add_location(input, file$d, 134, 4, 3276);
dispose = [
listen_dev(input, "input", ctx.input_input_handler),
listen_dev(input, "change", ctx.change_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
set_input_value(input, ctx.value);
},
p: function update(changed, ctx) {
if (changed.value && (input.value !== ctx.value)) set_input_value(input, ctx.value);
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(input);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block_1.name, type: "else", source: "(133:4) {:else}", ctx });
return block;
}
// (123:33)
function create_if_block_4(ctx) {
var select, select_value_value, dispose;
let each_value = ctx.options;
let each_blocks = [];
for (let i_1 = 0; i_1 < each_value.length; i_1 += 1) {
each_blocks[i_1] = create_each_block$5(get_each_context$5(ctx, each_value, i_1));
}
const block = {
c: function create() {
select = element("select");
for (let i_1 = 0; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].c();
}
attr_dev(select, "class", "uk-select uk-form-small svelte-jubmd5");
add_location(select, file$d, 124, 4, 3019);
dispose = listen_dev(select, "change", ctx.change_handler);
},
m: function mount(target, anchor) {
insert_dev(target, select, anchor);
for (let i_1 = 0; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].m(select, null);
}
select_value_value = ctx.value;
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
},
p: function update(changed, ctx) {
if (changed.options) {
each_value = ctx.options;
let i_1;
for (i_1 = 0; i_1 < each_value.length; i_1 += 1) {
const child_ctx = get_each_context$5(ctx, each_value, i_1);
if (each_blocks[i_1]) {
each_blocks[i_1].p(changed, child_ctx);
} else {
each_blocks[i_1] = create_each_block$5(child_ctx);
each_blocks[i_1].c();
each_blocks[i_1].m(select, null);
}
}
for (; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].d(1);
}
each_blocks.length = each_value.length;
}
if ((changed.value) && select_value_value !== (select_value_value = ctx.value)) {
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(select);
}
destroy_each(each_blocks, detaching);
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_4.name, type: "if", source: "(123:33) ", ctx });
return block;
}
// (115:4) {#if type === "bool"}
function create_if_block_3$1(ctx) {
var div, current;
var iconbutton = new IconButton({
props: { icon: ctx.value == true ? "check-square" : "square", size: "19" },
$$inline: true
});
iconbutton.$on("click", ctx.click_handler_1);
const block = {
c: function create() {
div = element("div");
iconbutton.$$.fragment.c();
attr_dev(div, "class", "svelte-jubmd5");
add_location(div, file$d, 116, 4, 2806);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(iconbutton, div, null);
current = true;
},
p: function update(changed, ctx) {
var iconbutton_changes = {};
if (changed.value) iconbutton_changes.icon = ctx.value == true ? "check-square" : "square";
iconbutton.$set(iconbutton_changes);
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(iconbutton);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_3$1.name, type: "if", source: "(115:4) {#if type === \"bool\"}", ctx });
return block;
}
// (128:8) {#each options as option}
function create_each_block$5(ctx) {
var option, t_value = ctx.option + "", t, option_value_value;
const block = {
c: function create() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = ctx.option;
option.value = option.__value;
add_location(option, file$d, 128, 8, 3187);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t);
},
p: function update(changed, ctx) {
if ((changed.options) && t_value !== (t_value = ctx.option + "")) {
set_data_dev(t, t_value);
}
if ((changed.options) && option_value_value !== (option_value_value = ctx.option)) {
prop_dev(option, "__value", option_value_value);
}
option.value = option.__value;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(option);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$5.name, type: "each", source: "(128:8) {#each options as option}", ctx });
return block;
}
// (83:8) {#if !canOnlyBind}
function create_if_block_2$1(ctx) {
var current;
var iconbutton = new IconButton({
props: { icon: "trash", size: "12" },
$$inline: true
});
iconbutton.$on("click", ctx.clearBinding);
const block = {
c: function create() {
iconbutton.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(iconbutton, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(iconbutton, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$1.name, type: "if", source: "(83:8) {#if !canOnlyBind}", ctx });
return block;
}
// (89:4) {#if isExpanded}
function create_if_block_1$1(ctx) {
var div3, div0, t1, input0, t2, div1, t4, input1, t5, div2, t7, select, option0, option1, select_value_value, dispose;
const block = {
c: function create() {
div3 = element("div");
div0 = element("div");
div0.textContent = "Binding Path";
t1 = space();
input0 = element("input");
t2 = space();
div1 = element("div");
div1.textContent = "Fallback Value";
t4 = space();
input1 = element("input");
t5 = space();
div2 = element("div");
div2.textContent = "Binding Source";
t7 = space();
select = element("select");
option0 = element("option");
option0.textContent = "store";
option1 = element("option");
option1.textContent = "context";
attr_dev(div0, "class", "binding-prop-label svelte-jubmd5");
add_location(div0, file$d, 90, 8, 2051);
attr_dev(input0, "class", "uk-input uk-form-small");
input0.value = ctx.bindingPath;
add_location(input0, file$d, 91, 8, 2110);
attr_dev(div1, "class", "binding-prop-label svelte-jubmd5");
add_location(div1, file$d, 94, 8, 2235);
attr_dev(input1, "class", "uk-input uk-form-small");
input1.value = ctx.bindingFallbackValue;
add_location(input1, file$d, 95, 8, 2296);
attr_dev(div2, "class", "binding-prop-label svelte-jubmd5");
add_location(div2, file$d, 98, 8, 2434);
option0.__value = "store";
option0.value = option0.__value;
add_location(option0, file$d, 103, 12, 2626);
option1.__value = "context";
option1.value = option1.__value;
add_location(option1, file$d, 104, 12, 2661);
attr_dev(select, "class", "uk-select uk-form-small");
add_location(select, file$d, 99, 8, 2495);
add_location(div3, file$d, 89, 4, 2037);
dispose = [
listen_dev(input0, "change", ctx.setBindingPath),
listen_dev(input1, "change", ctx.setBindingFallback),
listen_dev(select, "change", ctx.setBindingSource)
];
},
m: function mount(target, anchor) {
insert_dev(target, div3, anchor);
append_dev(div3, div0);
append_dev(div3, t1);
append_dev(div3, input0);
append_dev(div3, t2);
append_dev(div3, div1);
append_dev(div3, t4);
append_dev(div3, input1);
append_dev(div3, t5);
append_dev(div3, div2);
append_dev(div3, t7);
append_dev(div3, select);
append_dev(select, option0);
append_dev(select, option1);
select_value_value = ctx.bindingSource;
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
},
p: function update(changed, ctx) {
if (changed.bindingPath) {
prop_dev(input0, "value", ctx.bindingPath);
}
if (changed.bindingFallbackValue) {
prop_dev(input1, "value", ctx.bindingFallbackValue);
}
if ((changed.bindingSource) && select_value_value !== (select_value_value = ctx.bindingSource)) {
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$1.name, type: "if", source: "(89:4) {#if isExpanded}", ctx });
return block;
}
function create_fragment$c(ctx) {
var current_block_type_index, if_block, if_block_anchor, current;
var if_block_creators = [
create_if_block$5,
create_else_block$1
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.isBound) return 0;
return 1;
}
current_block_type_index = select_block_type(null, 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();
},
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(changed, ctx) {
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} 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();
}
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$c.name, type: "component", source: "", ctx });
return block;
}
function instance$c($$self, $$props, $$invalidate) {
let { value="", onChanged= () => {} } = $$props;
let { type="", options=[] } = $$props;
let isBound=false;
let bindingPath="";
let bindingFallbackValue="";
let bindingSource="store";
let isExpanded = false;
let forceIsBound = false;
let canOnlyBind = false;
const clearBinding = () => {
$$invalidate('forceIsBound', forceIsBound = false);
onChanged("");
};
const bind = (path, fallback, source) => {
if(!path) {
clearBinding();
return;
}
const binding = setBinding({path, fallback, source});
onChanged(binding);
};
const setBindingPath = ev => {
$$invalidate('forceIsBound', forceIsBound = canOnlyBind);
bind(ev.target.value, bindingFallbackValue, bindingSource);
};
const setBindingFallback = ev => {
bind(bindingPath, ev.target.value, bindingSource);
};
const setBindingSource = ev => {
bind(bindingPath, bindingFallbackValue, ev.target.value);
};
const makeBinding = () => {
$$invalidate('forceIsBound', forceIsBound=true);
$$invalidate('isExpanded', isExpanded=true);
};
const writable_props = ['value', 'onChanged', 'type', 'options'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<StateBindingControl> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate('isExpanded', isExpanded=!isExpanded);
const click_handler_1 = () => onChanged(!value);
const change_handler = (ev) => onChanged(ev.target.value);
function input_input_handler() {
value = this.value;
$$invalidate('value', value);
}
const change_handler_1 = (ev) => onChanged(ev.target.value);
$$self.$set = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('onChanged' in $$props) $$invalidate('onChanged', onChanged = $$props.onChanged);
if ('type' in $$props) $$invalidate('type', type = $$props.type);
if ('options' in $$props) $$invalidate('options', options = $$props.options);
};
$$self.$capture_state = () => {
return { value, onChanged, type, options, isBound, bindingPath, bindingFallbackValue, bindingSource, isExpanded, forceIsBound, canOnlyBind };
};
$$self.$inject_state = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('onChanged' in $$props) $$invalidate('onChanged', onChanged = $$props.onChanged);
if ('type' in $$props) $$invalidate('type', type = $$props.type);
if ('options' in $$props) $$invalidate('options', options = $$props.options);
if ('isBound' in $$props) $$invalidate('isBound', isBound = $$props.isBound);
if ('bindingPath' in $$props) $$invalidate('bindingPath', bindingPath = $$props.bindingPath);
if ('bindingFallbackValue' in $$props) $$invalidate('bindingFallbackValue', bindingFallbackValue = $$props.bindingFallbackValue);
if ('bindingSource' in $$props) $$invalidate('bindingSource', bindingSource = $$props.bindingSource);
if ('isExpanded' in $$props) $$invalidate('isExpanded', isExpanded = $$props.isExpanded);
if ('forceIsBound' in $$props) $$invalidate('forceIsBound', forceIsBound = $$props.forceIsBound);
if ('canOnlyBind' in $$props) $$invalidate('canOnlyBind', canOnlyBind = $$props.canOnlyBind);
};
$$self.$$.update = ($$dirty = { type: 1, forceIsBound: 1, canOnlyBind: 1, value: 1, isBound: 1 }) => {
if ($$dirty.type || $$dirty.forceIsBound || $$dirty.canOnlyBind || $$dirty.value || $$dirty.isBound) { {
$$invalidate('canOnlyBind', canOnlyBind = type === "state");
if(!forceIsBound && canOnlyBind)
$$invalidate('forceIsBound', forceIsBound = true);
$$invalidate('isBound', isBound= forceIsBound || isBinding(value));
if(isBound) {
const binding = getBinding(value);
$$invalidate('bindingPath', bindingPath= binding.path);
$$invalidate('bindingFallbackValue', bindingFallbackValue= binding.fallback);
$$invalidate('bindingSource', bindingSource = binding.source || "store");
} else {
$$invalidate('bindingPath', bindingPath="");
$$invalidate('bindingFallbackValue', bindingFallbackValue="");
$$invalidate('bindingSource', bindingSource="store");
}
} }
};
return {
value,
onChanged,
type,
options,
isBound,
bindingPath,
bindingFallbackValue,
bindingSource,
isExpanded,
canOnlyBind,
clearBinding,
setBindingPath,
setBindingFallback,
setBindingSource,
makeBinding,
click_handler,
click_handler_1,
change_handler,
input_input_handler,
change_handler_1
};
}
class StateBindingControl extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$c, create_fragment$c, safe_not_equal, ["value", "onChanged", "type", "options"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "StateBindingControl", options, id: create_fragment$c.name });
}
get value() {
throw new Error("<StateBindingControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<StateBindingControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onChanged() {
throw new Error("<StateBindingControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onChanged(value) {
throw new Error("<StateBindingControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get type() {
throw new Error("<StateBindingControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set type(value) {
throw new Error("<StateBindingControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get options() {
throw new Error("<StateBindingControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set options(value) {
throw new Error("<StateBindingControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\EventSelector.svelte generated by Svelte v3.12.1 */
const file$e = "src\\userInterface\\EventSelector.svelte";
function get_each_context$6(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.p = list[i];
child_ctx.index = i;
return child_ctx;
}
function get_each_context_1$4(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.ev = list[i];
return child_ctx;
}
// (74:8) {#each events as ev}
function create_each_block_1$4(ctx) {
var option, t_value = ctx.ev.name + "", t, option_value_value;
const block = {
c: function create() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = ctx.ev.name;
option.value = option.__value;
add_location(option, file$e, 74, 8, 1965);
},
m: function mount(target, anchor) {
insert_dev(target, option, anchor);
append_dev(option, t);
},
p: function update(changed, ctx) {
if ((changed.events) && t_value !== (t_value = ctx.ev.name + "")) {
set_data_dev(t, t_value);
}
if ((changed.events) && option_value_value !== (option_value_value = ctx.ev.name)) {
prop_dev(option, "__value", option_value_value);
}
option.value = option.__value;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(option);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$4.name, type: "each", source: "(74:8) {#each events as ev}", ctx });
return block;
}
// (85:0) {#if parameters}
function create_if_block$6(ctx) {
var each_1_anchor, current;
let each_value = ctx.parameters;
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 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();
},
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(changed, ctx) {
if (changed.onParameterChanged || changed.parameters) {
each_value = ctx.parameters;
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(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$6(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$6.name, type: "if", source: "(85:0) {#if parameters}", ctx });
return block;
}
// (86:0) {#each parameters as p, index}
function create_each_block$6(ctx) {
var div, t0_value = ctx.p.name + "", t0, t1, current;
var statebindingcontrol = new StateBindingControl({
props: {
onChanged: ctx.onParameterChanged(ctx.index),
value: ctx.p.value
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
statebindingcontrol.$$.fragment.c();
add_location(div, file$e, 87, 0, 2206);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
insert_dev(target, t1, anchor);
mount_component(statebindingcontrol, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.parameters) && t0_value !== (t0_value = ctx.p.name + "")) {
set_data_dev(t0, t0_value);
}
var statebindingcontrol_changes = {};
if (changed.parameters) statebindingcontrol_changes.value = ctx.p.value;
statebindingcontrol.$set(statebindingcontrol_changes);
},
i: function intro(local) {
if (current) return;
transition_in(statebindingcontrol.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(statebindingcontrol.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
}
destroy_component(statebindingcontrol, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$6.name, type: "each", source: "(86:0) {#each parameters as p, index}", ctx });
return block;
}
function create_fragment$d(ctx) {
var div, select, select_value_value, t0, t1, if_block_anchor, current, dispose;
let each_value_1 = ctx.events;
let each_blocks = [];
for (let i_1 = 0; i_1 < each_value_1.length; i_1 += 1) {
each_blocks[i_1] = create_each_block_1$4(get_each_context_1$4(ctx, each_value_1, i_1));
}
var iconbutton = new IconButton({
props: { icon: "trash", size: "12" },
$$inline: true
});
iconbutton.$on("click", ctx.onRemoved);
var if_block = (ctx.parameters) && create_if_block$6(ctx);
const block = {
c: function create() {
div = element("div");
select = element("select");
for (let i_1 = 0; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].c();
}
t0 = space();
iconbutton.$$.fragment.c();
t1 = space();
if (if_block) if_block.c();
if_block_anchor = empty();
attr_dev(select, "class", "type-selector uk-select uk-form-small svelte-1b6pj9u");
add_location(select, file$e, 72, 4, 1823);
attr_dev(div, "class", "type-selector-container svelte-1b6pj9u");
add_location(div, file$e, 71, 0, 1780);
dispose = listen_dev(select, "change", ctx.eventTypeChanged);
},
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);
append_dev(div, select);
for (let i_1 = 0; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].m(select, null);
}
select_value_value = ctx.eventType;
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
append_dev(div, t0);
mount_component(iconbutton, div, null);
insert_dev(target, t1, anchor);
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
current = true;
},
p: function update(changed, ctx) {
if (changed.events) {
each_value_1 = ctx.events;
let i_1;
for (i_1 = 0; i_1 < each_value_1.length; i_1 += 1) {
const child_ctx = get_each_context_1$4(ctx, each_value_1, i_1);
if (each_blocks[i_1]) {
each_blocks[i_1].p(changed, child_ctx);
} else {
each_blocks[i_1] = create_each_block_1$4(child_ctx);
each_blocks[i_1].c();
each_blocks[i_1].m(select, null);
}
}
for (; i_1 < each_blocks.length; i_1 += 1) {
each_blocks[i_1].d(1);
}
each_blocks.length = each_value_1.length;
}
if ((!current || changed.eventType) && select_value_value !== (select_value_value = ctx.eventType)) {
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
}
if (ctx.parameters) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$6(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(iconbutton.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_each(each_blocks, detaching);
destroy_component(iconbutton);
if (detaching) {
detach_dev(t1);
}
if (if_block) if_block.d(detaching);
if (detaching) {
detach_dev(if_block_anchor);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$d.name, type: "component", source: "", ctx });
return block;
}
function instance$d($$self, $$props, $$invalidate) {
let { event, onChanged, onRemoved } = $$props;
let events;
let eventType;
let parameters = [];
store.subscribe(s => {
$$invalidate('events', events = allHandlers$1(
{hierarchy: s.hierarchy},
userWithFullAccess({
hierarchy: s.hierarchy,
actions: fp_30("name")(s.actions)
})
));
});
const eventChanged = (type, parameters) => {
const paramsAsObject = fp_2(
(obj, p) => {
obj[p.name] = p.value;
return obj;
}
, {}
)(parameters);
const ev = {};
ev[EVENT_TYPE_MEMBER_NAME]=type;
ev.parameters = paramsAsObject;
onChanged(ev);
};
const eventTypeChanged = (ev) => {
const eType = fp_13(e => e.name === ev.target.value)(events);
const emptyParameters = fp_7(p => ({name:p, value:""}))(eType.parameters);
eventChanged(eType.name, emptyParameters);
};
const onParameterChanged = index => val => {
const newparameters = [...parameters];
newparameters[index].value = val;
eventChanged(eventType, newparameters);
};
const writable_props = ['event', 'onChanged', 'onRemoved'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<EventSelector> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('event' in $$props) $$invalidate('event', event = $$props.event);
if ('onChanged' in $$props) $$invalidate('onChanged', onChanged = $$props.onChanged);
if ('onRemoved' in $$props) $$invalidate('onRemoved', onRemoved = $$props.onRemoved);
};
$$self.$capture_state = () => {
return { event, onChanged, onRemoved, events, eventType, parameters };
};
$$self.$inject_state = $$props => {
if ('event' in $$props) $$invalidate('event', event = $$props.event);
if ('onChanged' in $$props) $$invalidate('onChanged', onChanged = $$props.onChanged);
if ('onRemoved' in $$props) $$invalidate('onRemoved', onRemoved = $$props.onRemoved);
if ('events' in $$props) $$invalidate('events', events = $$props.events);
if ('eventType' in $$props) $$invalidate('eventType', eventType = $$props.eventType);
if ('parameters' in $$props) $$invalidate('parameters', parameters = $$props.parameters);
};
$$self.$$.update = ($$dirty = { event: 1 }) => {
if ($$dirty.event) { {
if(event) {
$$invalidate('eventType', eventType = event[EVENT_TYPE_MEMBER_NAME]);
$$invalidate('parameters', parameters = pipe$1(event.parameters, [
fp_32,
fp_7(k => ({name:k, value:event.parameters[k]}))
]));
} else {
$$invalidate('eventType', eventType = "");
$$invalidate('parameters', parameters = []);
}
} }
};
return {
event,
onChanged,
onRemoved,
events,
eventType,
parameters,
eventTypeChanged,
onParameterChanged
};
}
class EventSelector extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$d, create_fragment$d, safe_not_equal, ["event", "onChanged", "onRemoved"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "EventSelector", options, id: create_fragment$d.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.event === undefined && !('event' in props)) {
console.warn("<EventSelector> was created without expected prop 'event'");
}
if (ctx.onChanged === undefined && !('onChanged' in props)) {
console.warn("<EventSelector> was created without expected prop 'onChanged'");
}
if (ctx.onRemoved === undefined && !('onRemoved' in props)) {
console.warn("<EventSelector> was created without expected prop 'onRemoved'");
}
}
get event() {
throw new Error("<EventSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set event(value) {
throw new Error("<EventSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onChanged() {
throw new Error("<EventSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onChanged(value) {
throw new Error("<EventSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onRemoved() {
throw new Error("<EventSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onRemoved(value) {
throw new Error("<EventSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\EventListSelector.svelte generated by Svelte v3.12.1 */
const file$f = "src\\userInterface\\EventListSelector.svelte";
function get_each_context$7(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.ev = list[i];
child_ctx.index = i;
return child_ctx;
}
// (47:8) {#each events as ev, index}
function create_each_block$7(ctx) {
var div0, t, div1, current;
var eventselector = new EventSelector({
props: {
onChanged: ctx.onEventHandlerChanged(ctx.ev),
onRemoved: ctx.removeHandler(ctx.index),
event: ctx.ev
},
$$inline: true
});
const block = {
c: function create() {
div0 = element("div");
eventselector.$$.fragment.c();
t = space();
div1 = element("div");
attr_dev(div0, "class", "handler-container");
add_location(div0, file$f, 48, 8, 1176);
attr_dev(div1, "class", "separator svelte-r1ft9p");
add_location(div1, file$f, 55, 8, 1400);
},
m: function mount(target, anchor) {
insert_dev(target, div0, anchor);
mount_component(eventselector, div0, null);
insert_dev(target, t, anchor);
insert_dev(target, div1, anchor);
current = true;
},
p: function update(changed, ctx) {
var eventselector_changes = {};
if (changed.events) eventselector_changes.onChanged = ctx.onEventHandlerChanged(ctx.ev);
if (changed.events) eventselector_changes.event = ctx.ev;
eventselector.$set(eventselector_changes);
},
i: function intro(local) {
if (current) return;
transition_in(eventselector.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(eventselector.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div0);
}
destroy_component(eventselector);
if (detaching) {
detach_dev(t);
detach_dev(div1);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$7.name, type: "each", source: "(47:8) {#each events as ev, index}", ctx });
return block;
}
function create_fragment$e(ctx) {
var div2, div1, t, div0, current, dispose;
let each_value = ctx.events;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$7(get_each_context$7(ctx, each_value, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
var iconbutton = new IconButton({
props: { icon: "plus", size: "12" },
$$inline: true
});
const block = {
c: function create() {
div2 = element("div");
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
div0 = element("div");
iconbutton.$$.fragment.c();
attr_dev(div0, "class", "addelement-container svelte-r1ft9p");
add_location(div0, file$f, 58, 8, 1458);
attr_dev(div1, "class", "control-container svelte-r1ft9p");
add_location(div1, file$f, 45, 4, 1096);
attr_dev(div2, "class", "root");
add_location(div2, file$f, 44, 0, 1072);
dispose = listen_dev(div0, "click", ctx.addHandler);
},
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, div1);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
append_dev(div1, t);
append_dev(div1, div0);
mount_component(iconbutton, div0, null);
current = true;
},
p: function update(changed, ctx) {
if (changed.onEventHandlerChanged || changed.events || changed.removeHandler) {
each_value = ctx.events;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$7(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$7(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div1, t);
}
}
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]);
}
transition_in(iconbutton.$$.fragment, local);
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]);
}
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_each(each_blocks, detaching);
destroy_component(iconbutton);
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$e.name, type: "component", source: "", ctx });
return block;
}
function instance$e($$self, $$props, $$invalidate) {
let { parentProps, propDef, onValueChanged, onValidate = () => {} } = $$props;
let events = [];
let elementErrors = {};
const addHandler = () => {
const newHandler = {parameters:{}};
newHandler[EVENT_TYPE_MEMBER_NAME] = "";
$$invalidate('events', events = [...events, newHandler]);
onValueChanged(events);
};
const onEventHandlerChanged = (oldEvent) => (newEvent) => {
const indexOfOldEvent = events.indexOf(oldEvent);
const newEvents = [...events];
newEvents.splice(
events.indexOf(oldEvent),
1,
newEvent);
$$invalidate('events', events = newEvents);
onValueChanged(events);
};
const removeHandler = (index) => () => {
$$invalidate('events', events = fp_8(e => e !== events[index])(events));
onValueChanged(events);
};
const writable_props = ['parentProps', 'propDef', 'onValueChanged', 'onValidate'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<EventListSelector> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('parentProps' in $$props) $$invalidate('parentProps', parentProps = $$props.parentProps);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
};
$$self.$capture_state = () => {
return { parentProps, propDef, onValueChanged, onValidate, events, elementErrors };
};
$$self.$inject_state = $$props => {
if ('parentProps' in $$props) $$invalidate('parentProps', parentProps = $$props.parentProps);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('onValueChanged' in $$props) $$invalidate('onValueChanged', onValueChanged = $$props.onValueChanged);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
if ('events' in $$props) $$invalidate('events', events = $$props.events);
if ('elementErrors' in $$props) elementErrors = $$props.elementErrors;
};
$$self.$$.update = ($$dirty = { parentProps: 1, propDef: 1 }) => {
if ($$dirty.parentProps || $$dirty.propDef) { {
$$invalidate('events', events = parentProps[propDef.____name]);
} }
};
return {
parentProps,
propDef,
onValueChanged,
onValidate,
events,
addHandler,
onEventHandlerChanged,
removeHandler
};
}
class EventListSelector extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$e, create_fragment$e, safe_not_equal, ["parentProps", "propDef", "onValueChanged", "onValidate"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "EventListSelector", options, id: create_fragment$e.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.parentProps === undefined && !('parentProps' in props)) {
console.warn("<EventListSelector> was created without expected prop 'parentProps'");
}
if (ctx.propDef === undefined && !('propDef' in props)) {
console.warn("<EventListSelector> was created without expected prop 'propDef'");
}
if (ctx.onValueChanged === undefined && !('onValueChanged' in props)) {
console.warn("<EventListSelector> was created without expected prop 'onValueChanged'");
}
}
get parentProps() {
throw new Error("<EventListSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set parentProps(value) {
throw new Error("<EventListSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get propDef() {
throw new Error("<EventListSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set propDef(value) {
throw new Error("<EventListSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValueChanged() {
throw new Error("<EventListSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValueChanged(value) {
throw new Error("<EventListSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValidate() {
throw new Error("<EventListSelector>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValidate(value) {
throw new Error("<EventListSelector>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\PropControl.svelte generated by Svelte v3.12.1 */
const file$g = "src\\userInterface\\PropControl.svelte";
// (56:4) {:else}
function create_else_block$2(ctx) {
var div, t0_value = ctx.propDef.____name + "", t0, t1, current;
var statebindingcontrol = new StateBindingControl({
props: {
value: ctx.props[ctx.propDef.____name],
type: ctx.propDef.type,
options: ctx.propDef.options,
onChanged: ctx.func
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
statebindingcontrol.$$.fragment.c();
attr_dev(div, "class", "prop-label svelte-1v0yya9");
add_location(div, file$g, 57, 4, 1738);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
insert_dev(target, t1, anchor);
mount_component(statebindingcontrol, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.propDef) && t0_value !== (t0_value = ctx.propDef.____name + "")) {
set_data_dev(t0, t0_value);
}
var statebindingcontrol_changes = {};
if (changed.props || changed.propDef) statebindingcontrol_changes.value = ctx.props[ctx.propDef.____name];
if (changed.propDef) statebindingcontrol_changes.type = ctx.propDef.type;
if (changed.propDef) statebindingcontrol_changes.options = ctx.propDef.options;
if (changed.setProp || changed.propDef) statebindingcontrol_changes.onChanged = ctx.func;
statebindingcontrol.$set(statebindingcontrol_changes);
},
i: function intro(local) {
if (current) return;
transition_in(statebindingcontrol.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(statebindingcontrol.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
}
destroy_component(statebindingcontrol, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$2.name, type: "else", source: "(56:4) {:else}", ctx });
return block;
}
// (49:39)
function create_if_block_2$2(ctx) {
var div, t0_value = ctx.propDef.____name + "", t0, t1, current;
var eventlistselector = new EventListSelector({
props: {
parentProps: ctx.props,
propDef: ctx.propDef,
onValueChanged: ctx.setComponentProp
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
eventlistselector.$$.fragment.c();
attr_dev(div, "class", "prop-label svelte-1v0yya9");
add_location(div, file$g, 50, 4, 1535);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
insert_dev(target, t1, anchor);
mount_component(eventlistselector, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.propDef) && t0_value !== (t0_value = ctx.propDef.____name + "")) {
set_data_dev(t0, t0_value);
}
var eventlistselector_changes = {};
if (changed.props) eventlistselector_changes.parentProps = ctx.props;
if (changed.propDef) eventlistselector_changes.propDef = ctx.propDef;
eventlistselector.$set(eventlistselector_changes);
},
i: function intro(local) {
if (current) return;
transition_in(eventlistselector.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(eventlistselector.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
}
destroy_component(eventlistselector, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$2.name, type: "if", source: "(49:39) ", ctx });
return block;
}
// (41:39)
function create_if_block_1$2(ctx) {
var div, t0_value = ctx.propDef.____name + "", t0, t1, current;
var proparrayselector = new PropArraySelector({
props: {
parentProps: ctx.props,
propDef: ctx.propDef,
onValueChanged: ctx.setComponentProp,
onEditComponentProp: ctx.onEditComponent
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
proparrayselector.$$.fragment.c();
attr_dev(div, "class", "prop-label svelte-1v0yya9");
add_location(div, file$g, 42, 4, 1243);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
insert_dev(target, t1, anchor);
mount_component(proparrayselector, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.propDef) && t0_value !== (t0_value = ctx.propDef.____name + "")) {
set_data_dev(t0, t0_value);
}
var proparrayselector_changes = {};
if (changed.props) proparrayselector_changes.parentProps = ctx.props;
if (changed.propDef) proparrayselector_changes.propDef = ctx.propDef;
if (changed.onEditComponent) proparrayselector_changes.onEditComponentProp = ctx.onEditComponent;
proparrayselector.$set(proparrayselector_changes);
},
i: function intro(local) {
if (current) return;
transition_in(proparrayselector.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(proparrayselector.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
}
destroy_component(proparrayselector, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$2.name, type: "if", source: "(41:39) ", ctx });
return block;
}
// (31:4) {#if propDef.type === "component"}
function create_if_block$7(ctx) {
var div, t0_value = ctx.propDef.____name + "", t0, t1, current;
var componentpropselector = new ComponentPropSelector({
props: {
label: ctx.propDef.____name,
props: ctx.props[ctx.propDef.____name],
disabled: ctx.disabled,
onEdit: ctx.onEditComponent,
onComponentChosen: ctx.onEditComponent,
onValueChanged: ctx.setComponentProp
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
componentpropselector.$$.fragment.c();
attr_dev(div, "class", "prop-label svelte-1v0yya9");
add_location(div, file$g, 32, 4, 816);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
insert_dev(target, t1, anchor);
mount_component(componentpropselector, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.propDef) && t0_value !== (t0_value = ctx.propDef.____name + "")) {
set_data_dev(t0, t0_value);
}
var componentpropselector_changes = {};
if (changed.propDef) componentpropselector_changes.label = ctx.propDef.____name;
if (changed.props || changed.propDef) componentpropselector_changes.props = ctx.props[ctx.propDef.____name];
if (changed.disabled) componentpropselector_changes.disabled = ctx.disabled;
if (changed.onEditComponent) componentpropselector_changes.onEdit = ctx.onEditComponent;
if (changed.onEditComponent) componentpropselector_changes.onComponentChosen = ctx.onEditComponent;
componentpropselector.$set(componentpropselector_changes);
},
i: function intro(local) {
if (current) return;
transition_in(componentpropselector.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(componentpropselector.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
}
destroy_component(componentpropselector, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$7.name, type: "if", source: "(31:4) {#if propDef.type === \"component\"}", ctx });
return block;
}
function create_fragment$f(ctx) {
var div, current_block_type_index, if_block, current;
var if_block_creators = [
create_if_block$7,
create_if_block_1$2,
create_if_block_2$2,
create_else_block$2
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.propDef.type === "component") return 0;
if (ctx.propDef.type === "array") return 1;
if (ctx.propDef.type === "event") return 2;
return 3;
}
current_block_type_index = select_block_type(null, ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
const block = {
c: function create() {
div = element("div");
if_block.c();
attr_dev(div, "class", "root svelte-1v0yya9");
add_location(div, file$g, 28, 0, 751);
},
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);
current = true;
},
p: function update(changed, ctx) {
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} 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();
}
transition_in(if_block, 1);
if_block.m(div, null);
}
},
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();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$f.name, type: "component", source: "", ctx });
return block;
}
function instance$f($$self, $$props, $$invalidate) {
let { errors = [], setProp = () => {} } = $$props;
let { fieldHasError =() => {} } = $$props;
let { propDef = {}, props = {}, disabled, index, onEditComponent = () => {} } = $$props;
const setComponentProp = (props) => {
setProp(propDef.____name, props);
};
const writable_props = ['errors', 'setProp', 'fieldHasError', 'propDef', 'props', 'disabled', 'index', 'onEditComponent'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<PropControl> was created with unknown prop '${key}'`);
});
const func = (v) => setProp(propDef.____name, v);
$$self.$set = $$props => {
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('setProp' in $$props) $$invalidate('setProp', setProp = $$props.setProp);
if ('fieldHasError' in $$props) $$invalidate('fieldHasError', fieldHasError = $$props.fieldHasError);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('props' in $$props) $$invalidate('props', props = $$props.props);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
if ('index' in $$props) $$invalidate('index', index = $$props.index);
if ('onEditComponent' in $$props) $$invalidate('onEditComponent', onEditComponent = $$props.onEditComponent);
};
$$self.$capture_state = () => {
return { errors, setProp, fieldHasError, propDef, props, disabled, index, onEditComponent, isOdd };
};
$$self.$inject_state = $$props => {
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('setProp' in $$props) $$invalidate('setProp', setProp = $$props.setProp);
if ('fieldHasError' in $$props) $$invalidate('fieldHasError', fieldHasError = $$props.fieldHasError);
if ('propDef' in $$props) $$invalidate('propDef', propDef = $$props.propDef);
if ('props' in $$props) $$invalidate('props', props = $$props.props);
if ('disabled' in $$props) $$invalidate('disabled', disabled = $$props.disabled);
if ('index' in $$props) $$invalidate('index', index = $$props.index);
if ('onEditComponent' in $$props) $$invalidate('onEditComponent', onEditComponent = $$props.onEditComponent);
if ('isOdd' in $$props) isOdd = $$props.isOdd;
};
let isOdd;
$$self.$$.update = ($$dirty = { index: 1 }) => {
if ($$dirty.index) { isOdd = (index % 2 !== 0); }
};
return {
errors,
setProp,
fieldHasError,
propDef,
props,
disabled,
index,
onEditComponent,
setComponentProp,
func
};
}
class PropControl extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$f, create_fragment$f, safe_not_equal, ["errors", "setProp", "fieldHasError", "propDef", "props", "disabled", "index", "onEditComponent"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PropControl", options, id: create_fragment$f.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.disabled === undefined && !('disabled' in props)) {
console.warn("<PropControl> was created without expected prop 'disabled'");
}
if (ctx.index === undefined && !('index' in props)) {
console.warn("<PropControl> was created without expected prop 'index'");
}
}
get errors() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set errors(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get setProp() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set setProp(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get fieldHasError() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set fieldHasError(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get propDef() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set propDef(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get props() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set props(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get disabled() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set disabled(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get index() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set index(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onEditComponent() {
throw new Error("<PropControl>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onEditComponent(value) {
throw new Error("<PropControl>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\PropsView.svelte generated by Svelte v3.12.1 */
const file$h = "src\\userInterface\\PropsView.svelte";
function get_each_context$8(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.propDef = list[i];
child_ctx.index = i;
return child_ctx;
}
function get_each_context_1$5(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.propDef = list[i];
child_ctx.index = i;
return child_ctx;
}
// (112:8) {#each propsDefinitions as propDef, index}
function create_each_block_1$5(ctx) {
var current;
var propcontrol = new PropControl({
props: {
setProp: ctx.setProp,
fieldHasError: ctx.fieldHasError,
propDef: ctx.propDef,
props: ctx.props,
index: ctx.index,
onEditComponent: ctx.onEditComponent(ctx.propDef.____name),
disabled: false
},
$$inline: true
});
const block = {
c: function create() {
propcontrol.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(propcontrol, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var propcontrol_changes = {};
if (changed.propsDefinitions) propcontrol_changes.propDef = ctx.propDef;
if (changed.props) propcontrol_changes.props = ctx.props;
if (changed.propsDefinitions) propcontrol_changes.onEditComponent = ctx.onEditComponent(ctx.propDef.____name);
propcontrol.$set(propcontrol_changes);
},
i: function intro(local) {
if (current) return;
transition_in(propcontrol.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(propcontrol.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(propcontrol, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$5.name, type: "each", source: "(112:8) {#each propsDefinitions as propDef, index}", ctx });
return block;
}
// (124:8) {#if inheritedPropsDefinitions.length > 0}
function create_if_block_1$3(ctx) {
var div2, div0, t_1, div1, current;
var iconbutton = new IconButton({
props: { icon: ctx.inheritedExpanded ? "chevron-down" : "chevron-right" },
$$inline: true
});
iconbutton.$on("click", ctx.click_handler);
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
div0.textContent = "Inherited";
t_1 = space();
div1 = element("div");
iconbutton.$$.fragment.c();
attr_dev(div0, "class", "svelte-47ohpz");
add_location(div0, file$h, 125, 12, 3574);
attr_dev(div1, "class", "svelte-47ohpz");
add_location(div1, file$h, 126, 12, 3607);
attr_dev(div2, "class", "inherited-title padding svelte-47ohpz");
add_location(div2, file$h, 124, 8, 3524);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div2, t_1);
append_dev(div2, div1);
mount_component(iconbutton, div1, null);
current = true;
},
p: function update(changed, ctx) {
var iconbutton_changes = {};
if (changed.inheritedExpanded) iconbutton_changes.icon = ctx.inheritedExpanded ? "chevron-down" : "chevron-right";
iconbutton.$set(iconbutton_changes);
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(iconbutton);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$3.name, type: "if", source: "(124:8) {#if inheritedPropsDefinitions.length > 0}", ctx });
return block;
}
// (134:8) {#if inheritedExpanded}
function create_if_block$8(ctx) {
var each_1_anchor, current;
let each_value = ctx.inheritedPropsDefinitions;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$8(get_each_context$8(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();
},
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(changed, ctx) {
if (changed.setProp || changed.fieldHasError || changed.inheritedPropsDefinitions || changed.props) {
each_value = ctx.inheritedPropsDefinitions;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$8(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$8(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$8.name, type: "if", source: "(134:8) {#if inheritedExpanded}", ctx });
return block;
}
// (135:12) {#each inheritedPropsDefinitions as propDef, index}
function create_each_block$8(ctx) {
var current;
var propcontrol = new PropControl({
props: {
setProp: ctx.setProp,
fieldHasError: ctx.fieldHasError,
propDef: ctx.propDef,
props: ctx.props,
index: ctx.index,
disabled: true
},
$$inline: true
});
const block = {
c: function create() {
propcontrol.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(propcontrol, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var propcontrol_changes = {};
if (changed.inheritedPropsDefinitions) propcontrol_changes.propDef = ctx.propDef;
if (changed.props) propcontrol_changes.props = ctx.props;
propcontrol.$set(propcontrol_changes);
},
i: function intro(local) {
if (current) return;
transition_in(propcontrol.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(propcontrol.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(propcontrol, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$8.name, type: "each", source: "(135:12) {#each inheritedPropsDefinitions as propDef, index}", ctx });
return block;
}
function create_fragment$g(ctx) {
var div, form, t0, t1, current;
let each_value_1 = ctx.propsDefinitions;
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1$5(get_each_context_1$5(ctx, each_value_1, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
var if_block0 = (ctx.inheritedPropsDefinitions.length > 0) && create_if_block_1$3(ctx);
var if_block1 = (ctx.inheritedExpanded) && create_if_block$8(ctx);
const block = {
c: function create() {
div = element("div");
form = element("form");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t0 = space();
if (if_block0) if_block0.c();
t1 = space();
if (if_block1) if_block1.c();
attr_dev(form, "class", "uk-form-stacked");
add_location(form, file$h, 110, 4, 3073);
attr_dev(div, "class", "root svelte-47ohpz");
add_location(div, file$h, 108, 0, 3049);
},
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);
append_dev(div, form);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(form, null);
}
append_dev(form, t0);
if (if_block0) if_block0.m(form, null);
append_dev(form, t1);
if (if_block1) if_block1.m(form, null);
current = true;
},
p: function update(changed, ctx) {
if (changed.setProp || changed.fieldHasError || changed.propsDefinitions || changed.props || changed.onEditComponent) {
each_value_1 = ctx.propsDefinitions;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$5(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_1$5(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(form, t0);
}
}
group_outros();
for (i = each_value_1.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
if (ctx.inheritedPropsDefinitions.length > 0) {
if (if_block0) {
if_block0.p(changed, ctx);
transition_in(if_block0, 1);
} else {
if_block0 = create_if_block_1$3(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(form, t1);
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if (ctx.inheritedExpanded) {
if (if_block1) {
if_block1.p(changed, ctx);
transition_in(if_block1, 1);
} else {
if_block1 = create_if_block$8(ctx);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(form, null);
}
} else if (if_block1) {
group_outros();
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
check_outros();
}
},
i: function intro(local) {
if (current) return;
for (let i = 0; i < each_value_1.length; i += 1) {
transition_in(each_blocks[i]);
}
transition_in(if_block0);
transition_in(if_block1);
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]);
}
transition_out(if_block0);
transition_out(if_block1);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_each(each_blocks, detaching);
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$g.name, type: "component", source: "", ctx });
return block;
}
function instance$g($$self, $$props, $$invalidate) {
let { shouldValidate = true, onValidate = () => {} } = $$props;
let { componentInfo, instanceProps = null, onPropsChanged = () => {} } = $$props;
let { onEditComponentProp = () => {} } = $$props;
let errors = [];
let props = {};
let propsDefinitions = [];
let inheritedPropsDefinitions = [];
let inheritedExpanded = false;
let isInstance = false;
const isPropInherited = name =>
fp_11(name)(componentInfo.inheritedProps);
let setProp = (name, value) => {
const newProps = fp_4(props);
let finalProps = isInstance ? newProps : fp_4(componentInfo.component.props);
if(!isInstance) {
const nowSet = [];
for(let p of componentInfo.unsetProps) {
if(!fp_50(newProps[p])(componentInfo.rootDefaultProps[p])) {
finalProps[p] = newProps[p];
nowSet.push(p);
}
}
$$invalidate('componentInfo', componentInfo.unsetProps = fp_36(nowSet)(componentInfo.unsetProps), componentInfo);
}
newProps[name] = value;
finalProps[name] = value;
$$invalidate('props', props = newProps);
if(validate(finalProps))
onPropsChanged(finalProps);
};
const validate = (finalProps) => {
errors = validateProps(componentInfo.propsDefinition, finalProps, [], false);
onValidate(errors);
return errors.length === 0;
};
const fieldHasError = (propName) =>
fp_6(e => e.propName === propName)(errors);
const onEditComponent = (propName) => (arrayIndex, arrayPropName) => {
onEditComponentProp(propName, arrayIndex, arrayPropName);
};
const writable_props = ['shouldValidate', 'onValidate', 'componentInfo', 'instanceProps', 'onPropsChanged', 'onEditComponentProp'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<PropsView> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate('inheritedExpanded', inheritedExpanded = !inheritedExpanded);
$$self.$set = $$props => {
if ('shouldValidate' in $$props) $$invalidate('shouldValidate', shouldValidate = $$props.shouldValidate);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
if ('componentInfo' in $$props) $$invalidate('componentInfo', componentInfo = $$props.componentInfo);
if ('instanceProps' in $$props) $$invalidate('instanceProps', instanceProps = $$props.instanceProps);
if ('onPropsChanged' in $$props) $$invalidate('onPropsChanged', onPropsChanged = $$props.onPropsChanged);
if ('onEditComponentProp' in $$props) $$invalidate('onEditComponentProp', onEditComponentProp = $$props.onEditComponentProp);
};
$$self.$capture_state = () => {
return { shouldValidate, onValidate, componentInfo, instanceProps, onPropsChanged, onEditComponentProp, errors, props, propsDefinitions, inheritedPropsDefinitions, inheritedExpanded, isInstance, setProp };
};
$$self.$inject_state = $$props => {
if ('shouldValidate' in $$props) $$invalidate('shouldValidate', shouldValidate = $$props.shouldValidate);
if ('onValidate' in $$props) $$invalidate('onValidate', onValidate = $$props.onValidate);
if ('componentInfo' in $$props) $$invalidate('componentInfo', componentInfo = $$props.componentInfo);
if ('instanceProps' in $$props) $$invalidate('instanceProps', instanceProps = $$props.instanceProps);
if ('onPropsChanged' in $$props) $$invalidate('onPropsChanged', onPropsChanged = $$props.onPropsChanged);
if ('onEditComponentProp' in $$props) $$invalidate('onEditComponentProp', onEditComponentProp = $$props.onEditComponentProp);
if ('errors' in $$props) errors = $$props.errors;
if ('props' in $$props) $$invalidate('props', props = $$props.props);
if ('propsDefinitions' in $$props) $$invalidate('propsDefinitions', propsDefinitions = $$props.propsDefinitions);
if ('inheritedPropsDefinitions' in $$props) $$invalidate('inheritedPropsDefinitions', inheritedPropsDefinitions = $$props.inheritedPropsDefinitions);
if ('inheritedExpanded' in $$props) $$invalidate('inheritedExpanded', inheritedExpanded = $$props.inheritedExpanded);
if ('isInstance' in $$props) $$invalidate('isInstance', isInstance = $$props.isInstance);
if ('setProp' in $$props) $$invalidate('setProp', setProp = $$props.setProp);
};
$$self.$$.update = ($$dirty = { componentInfo: 1, instanceProps: 1, isInstance: 1 }) => {
if ($$dirty.componentInfo || $$dirty.instanceProps || $$dirty.isInstance) { {
if(componentInfo)
{
$$invalidate('isInstance', isInstance = !!instanceProps);
$$invalidate('props', props = isInstance
? getInstanceProps(componentInfo, instanceProps)
: fp_4(componentInfo.fullProps));
$$invalidate('propsDefinitions', propsDefinitions = pipe$1(componentInfo.propsDefinition, [
fp_32,
fp_8(k => !isPropInherited(k)),
fp_7(k => ({...componentInfo.propsDefinition[k], ____name:k})),
fp_52("____name")
]));
$$invalidate('inheritedPropsDefinitions', inheritedPropsDefinitions = pipe$1(componentInfo.propsDefinition, [
fp_32,
fp_8(k => isPropInherited(k)),
fp_7(k => ({...componentInfo.propsDefinition[k], ____name:k})),
fp_52("____name")
]));
}
} }
};
return {
shouldValidate,
onValidate,
componentInfo,
instanceProps,
onPropsChanged,
onEditComponentProp,
props,
propsDefinitions,
inheritedPropsDefinitions,
inheritedExpanded,
setProp,
fieldHasError,
onEditComponent,
click_handler
};
}
class PropsView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$g, create_fragment$g, safe_not_equal, ["shouldValidate", "onValidate", "componentInfo", "instanceProps", "onPropsChanged", "onEditComponentProp"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PropsView", options, id: create_fragment$g.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.componentInfo === undefined && !('componentInfo' in props)) {
console.warn("<PropsView> was created without expected prop 'componentInfo'");
}
}
get shouldValidate() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set shouldValidate(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onValidate() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onValidate(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get componentInfo() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set componentInfo(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get instanceProps() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set instanceProps(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onPropsChanged() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onPropsChanged(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onEditComponentProp() {
throw new Error("<PropsView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onEditComponentProp(value) {
throw new Error("<PropsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
function cubicOut(t) {
const f = t - 1.0;
return f * f * f + 1.0;
}
function fade(node, { delay = 0, duration = 400 }) {
const o = +getComputedStyle(node).opacity;
return {
delay,
duration,
css: t => `opacity: ${t * o}`
};
}
function slide(node, { delay = 0, duration = 400, easing = cubicOut }) {
const style = getComputedStyle(node);
const opacity = +style.opacity;
const height = parseFloat(style.height);
const padding_top = parseFloat(style.paddingTop);
const padding_bottom = parseFloat(style.paddingBottom);
const margin_top = parseFloat(style.marginTop);
const margin_bottom = parseFloat(style.marginBottom);
const border_top_width = parseFloat(style.borderTopWidth);
const border_bottom_width = parseFloat(style.borderBottomWidth);
return {
delay,
duration,
easing,
css: t => `overflow: hidden;` +
`opacity: ${Math.min(t * 20, 1) * opacity};` +
`height: ${t * height}px;` +
`padding-top: ${t * padding_top}px;` +
`padding-bottom: ${t * padding_bottom}px;` +
`margin-top: ${t * margin_top}px;` +
`margin-bottom: ${t * margin_bottom}px;` +
`border-top-width: ${t * border_top_width}px;` +
`border-bottom-width: ${t * border_bottom_width}px;`
};
}
/* src\userInterface\ComponentInstanceEditor.svelte generated by Svelte v3.12.1 */
const file$i = "src\\userInterface\\ComponentInstanceEditor.svelte";
// (89:4) {:else}
function create_else_block$3(ctx) {
var current;
var propsview = new PropsView({
props: {
instanceProps: ctx.instanceProps,
componentInfo: ctx.componentInfo,
onPropsChanged: ctx.propsChanged,
onEditComponentProp: ctx.onEditComponentProp
},
$$inline: true
});
const block = {
c: function create() {
propsview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(propsview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var propsview_changes = {};
if (changed.instanceProps) propsview_changes.instanceProps = ctx.instanceProps;
if (changed.componentInfo) propsview_changes.componentInfo = ctx.componentInfo;
propsview.$set(propsview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(propsview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(propsview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(propsview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$3.name, type: "else", source: "(89:4) {:else}", ctx });
return block;
}
// (81:4) {#if editingSubComponentName}
function create_if_block$9(ctx) {
var div, div_intro, div_outro, current;
var componentinstanceeditor = new ComponentInstanceEditor({
props: {
onPropsChanged: ctx.onSubComponentPropsChanged,
onGoBack: ctx.onSubComponentGoBack,
instanceProps: ctx.editingSubComponentProps,
title: ctx.editingSubComponentTitle
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
componentinstanceeditor.$$.fragment.c();
add_location(div, file$i, 81, 4, 2229);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(componentinstanceeditor, div, null);
current = true;
},
p: function update(changed, ctx) {
var componentinstanceeditor_changes = {};
if (changed.editingSubComponentProps) componentinstanceeditor_changes.instanceProps = ctx.editingSubComponentProps;
if (changed.editingSubComponentTitle) componentinstanceeditor_changes.title = ctx.editingSubComponentTitle;
componentinstanceeditor.$set(componentinstanceeditor_changes);
},
i: function intro(local) {
if (current) return;
transition_in(componentinstanceeditor.$$.fragment, local);
add_render_callback(() => {
if (div_outro) div_outro.end(1);
if (!div_intro) div_intro = create_in_transition(div, slide, {delay: 250, duration: 300});
div_intro.start();
});
current = true;
},
o: function outro(local) {
transition_out(componentinstanceeditor.$$.fragment, local);
if (div_intro) div_intro.invalidate();
div_outro = create_out_transition(div, fade, {});
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(componentinstanceeditor);
if (detaching) {
if (div_outro) div_outro.end();
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$9.name, type: "if", source: "(81:4) {#if editingSubComponentName}", ctx });
return block;
}
function create_fragment$h(ctx) {
var div1, div0, t0, span, t1, t2, current_block_type_index, if_block, current;
var iconbutton = new IconButton({
props: { icon: "chevron-left" },
$$inline: true
});
iconbutton.$on("click", ctx.onGoBack);
var if_block_creators = [
create_if_block$9,
create_else_block$3
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.editingSubComponentName) return 0;
return 1;
}
current_block_type_index = select_block_type(null, 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");
div0 = element("div");
iconbutton.$$.fragment.c();
t0 = space();
span = element("span");
t1 = text(ctx.title);
t2 = space();
if_block.c();
attr_dev(span, "class", "svelte-dhe1ge");
add_location(span, file$i, 77, 8, 2158);
attr_dev(div0, "class", "title svelte-dhe1ge");
add_location(div0, file$i, 74, 4, 2048);
add_location(div1, file$i, 72, 0, 2037);
},
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);
mount_component(iconbutton, div0, null);
append_dev(div0, t0);
append_dev(div0, span);
append_dev(span, t1);
append_dev(div1, t2);
if_blocks[current_block_type_index].m(div1, null);
current = true;
},
p: function update(changed, ctx) {
if (!current || changed.title) {
set_data_dev(t1, ctx.title);
}
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} 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();
}
transition_in(if_block, 1);
if_block.m(div1, null);
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
destroy_component(iconbutton);
if_blocks[current_block_type_index].d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$h.name, type: "component", source: "", ctx });
return block;
}
function instance$h($$self, $$props, $$invalidate) {
let { title = "", onGoBack = () => {} } = $$props;
let { instanceProps = {}, onPropsChanged = () => {} } = $$props;
let editingSubComponentName;
let editingSubComponentProps;
let editingSubComponentArrayIndex;
let editingSubComponentArrayPropName;
let editingSubComponentTitle;
let allComponents;
store.subscribe(s => {
$$invalidate('allComponents', allComponents = s.allComponents);
});
const onSubComponentGoBack = () => {
$$invalidate('editingSubComponentName', editingSubComponentName = null);
$$invalidate('editingSubComponentProps', editingSubComponentProps = null);
};
const onEditComponentProp = (propName, arrayIndex, arrayPropName) => {
$$invalidate('editingSubComponentName', editingSubComponentName = propName);
$$invalidate('editingSubComponentTitle', editingSubComponentTitle = fp_3(arrayIndex)
? propName
: `${propName}[${arrayIndex}].${arrayPropName}`);
$$invalidate('editingSubComponentProps', editingSubComponentProps = fp_3(arrayIndex)
? instanceProps[propName]
: instanceProps[propName][arrayIndex][arrayPropName]);
editingSubComponentArrayIndex = arrayIndex;
editingSubComponentArrayPropName = arrayPropName;
};
const onSubComponentPropsChanged = (subProps) => {
const newProps = fp_4(instanceProps);
if(fp_3(editingSubComponentArrayIndex)) {
newProps[editingSubComponentName] = subProps;
} else {
newProps[editingSubComponentName]
[editingSubComponentArrayIndex]
[editingSubComponentArrayPropName] = subProps;
}
$$invalidate('instanceProps', instanceProps = newProps);
onPropsChanged(newProps);
};
const propsChanged = newProps => {
$$invalidate('instanceProps', instanceProps = newProps);
onPropsChanged(newProps);
};
const writable_props = ['title', 'onGoBack', 'instanceProps', 'onPropsChanged'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ComponentInstanceEditor> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('title' in $$props) $$invalidate('title', title = $$props.title);
if ('onGoBack' in $$props) $$invalidate('onGoBack', onGoBack = $$props.onGoBack);
if ('instanceProps' in $$props) $$invalidate('instanceProps', instanceProps = $$props.instanceProps);
if ('onPropsChanged' in $$props) $$invalidate('onPropsChanged', onPropsChanged = $$props.onPropsChanged);
};
$$self.$capture_state = () => {
return { title, onGoBack, instanceProps, onPropsChanged, editingSubComponentName, editingSubComponentProps, editingSubComponentArrayIndex, editingSubComponentArrayPropName, editingSubComponentTitle, allComponents, componentInfo };
};
$$self.$inject_state = $$props => {
if ('title' in $$props) $$invalidate('title', title = $$props.title);
if ('onGoBack' in $$props) $$invalidate('onGoBack', onGoBack = $$props.onGoBack);
if ('instanceProps' in $$props) $$invalidate('instanceProps', instanceProps = $$props.instanceProps);
if ('onPropsChanged' in $$props) $$invalidate('onPropsChanged', onPropsChanged = $$props.onPropsChanged);
if ('editingSubComponentName' in $$props) $$invalidate('editingSubComponentName', editingSubComponentName = $$props.editingSubComponentName);
if ('editingSubComponentProps' in $$props) $$invalidate('editingSubComponentProps', editingSubComponentProps = $$props.editingSubComponentProps);
if ('editingSubComponentArrayIndex' in $$props) editingSubComponentArrayIndex = $$props.editingSubComponentArrayIndex;
if ('editingSubComponentArrayPropName' in $$props) editingSubComponentArrayPropName = $$props.editingSubComponentArrayPropName;
if ('editingSubComponentTitle' in $$props) $$invalidate('editingSubComponentTitle', editingSubComponentTitle = $$props.editingSubComponentTitle);
if ('allComponents' in $$props) $$invalidate('allComponents', allComponents = $$props.allComponents);
if ('componentInfo' in $$props) $$invalidate('componentInfo', componentInfo = $$props.componentInfo);
};
let componentInfo;
$$self.$$.update = ($$dirty = { allComponents: 1, instanceProps: 1 }) => {
if ($$dirty.allComponents || $$dirty.instanceProps) { $$invalidate('componentInfo', componentInfo = getComponentInfo(
allComponents, instanceProps._component)); }
};
return {
title,
onGoBack,
instanceProps,
onPropsChanged,
editingSubComponentName,
editingSubComponentProps,
editingSubComponentTitle,
onSubComponentGoBack,
onEditComponentProp,
onSubComponentPropsChanged,
propsChanged,
componentInfo
};
}
class ComponentInstanceEditor extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$h, create_fragment$h, safe_not_equal, ["title", "onGoBack", "instanceProps", "onPropsChanged"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ComponentInstanceEditor", options, id: create_fragment$h.name });
}
get title() {
throw new Error("<ComponentInstanceEditor>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set title(value) {
throw new Error("<ComponentInstanceEditor>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onGoBack() {
throw new Error("<ComponentInstanceEditor>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onGoBack(value) {
throw new Error("<ComponentInstanceEditor>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get instanceProps() {
throw new Error("<ComponentInstanceEditor>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set instanceProps(value) {
throw new Error("<ComponentInstanceEditor>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onPropsChanged() {
throw new Error("<ComponentInstanceEditor>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onPropsChanged(value) {
throw new Error("<ComponentInstanceEditor>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\EditComponent.svelte generated by Svelte v3.12.1 */
const file$j = "src\\userInterface\\EditComponent.svelte";
// (187:4) {:else}
function create_else_block$4(ctx) {
var div2, div0, span0, t1, t2, t3, div1, span1, t5, current, dispose;
var iconbutton = new IconButton({
props: { icon: ctx.componentDetailsExpanded ? "chevron-down" : "chevron-right" },
$$inline: true
});
var if_block = (ctx.componentDetailsExpanded) && create_if_block_1$4(ctx);
var propsview = new PropsView({
props: {
onValidate: ctx.onPropsValidate,
componentInfo: ctx.componentInfo,
onPropsChanged: ctx.onPropsChanged,
onEditComponentProp: ctx.onEditComponentProp
},
$$inline: true
});
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
span0 = element("span");
span0.textContent = "Component Details";
t1 = space();
iconbutton.$$.fragment.c();
t2 = space();
if (if_block) if_block.c();
t3 = space();
div1 = element("div");
span1 = element("span");
span1.textContent = "Properties";
t5 = space();
propsview.$$.fragment.c();
set_style(span0, "margin-right", "7px");
add_location(span0, file$j, 190, 12, 5484);
attr_dev(div0, "class", "section-header padding svelte-1abif7s");
add_location(div0, file$j, 189, 8, 5365);
add_location(span1, file$j, 214, 12, 6504);
attr_dev(div1, "class", "section-header padding svelte-1abif7s");
add_location(div1, file$j, 213, 8, 6455);
attr_dev(div2, "class", "component-props-container svelte-1abif7s");
add_location(div2, file$j, 187, 4, 5316);
dispose = listen_dev(div0, "click", ctx.click_handler);
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div0, span0);
append_dev(div0, t1);
mount_component(iconbutton, div0, null);
append_dev(div2, t2);
if (if_block) if_block.m(div2, null);
append_dev(div2, t3);
append_dev(div2, div1);
append_dev(div1, span1);
append_dev(div2, t5);
mount_component(propsview, div2, null);
current = true;
},
p: function update(changed, ctx) {
var iconbutton_changes = {};
if (changed.componentDetailsExpanded) iconbutton_changes.icon = ctx.componentDetailsExpanded ? "chevron-down" : "chevron-right";
iconbutton.$set(iconbutton_changes);
if (ctx.componentDetailsExpanded) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block_1$4(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(div2, t3);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
var propsview_changes = {};
if (changed.componentInfo) propsview_changes.componentInfo = ctx.componentInfo;
propsview.$set(propsview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
transition_in(if_block);
transition_in(propsview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
transition_out(if_block);
transition_out(propsview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(iconbutton);
if (if_block) if_block.d();
destroy_component(propsview);
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$4.name, type: "else", source: "(187:4) {:else}", ctx });
return block;
}
// (180:4) {#if editingComponentInstance}
function create_if_block$a(ctx) {
var div, current;
var componentinstanceeditor = new ComponentInstanceEditor({
props: {
onGoBack: ctx.componentInstanceCancelEdit,
title: ctx.editingComponentInstanceTitle,
instanceProps: ctx.editingComponentInstance,
onPropsChanged: ctx.componentInstancePropsChanged
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
componentinstanceeditor.$$.fragment.c();
attr_dev(div, "class", "component-props-container svelte-1abif7s");
add_location(div, file$j, 180, 4, 4953);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(componentinstanceeditor, div, null);
current = true;
},
p: function update(changed, ctx) {
var componentinstanceeditor_changes = {};
if (changed.editingComponentInstanceTitle) componentinstanceeditor_changes.title = ctx.editingComponentInstanceTitle;
if (changed.editingComponentInstance) componentinstanceeditor_changes.instanceProps = ctx.editingComponentInstance;
componentinstanceeditor.$set(componentinstanceeditor_changes);
},
i: function intro(local) {
if (current) return;
transition_in(componentinstanceeditor.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(componentinstanceeditor.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(componentinstanceeditor);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$a.name, type: "if", source: "(180:4) {#if editingComponentInstance}", ctx });
return block;
}
// (195:8) {#if componentDetailsExpanded}
function create_if_block_1$4(ctx) {
var div1, div0, t0, t1, current;
var textbox0 = new Textbox({
props: {
label: "Name",
infoText: "use forward slash to store in subfolders",
text: ctx.name,
hasError: !!ctx.nameInvalid
},
$$inline: true
});
textbox0.$on("change", ctx.change_handler);
var textbox1 = new Textbox({
props: {
label: "Description",
text: ctx.description
},
$$inline: true
});
textbox1.$on("change", ctx.change_handler_1);
var textbox2 = new Textbox({
props: {
label: "Tags",
infoText: "comma separated",
text: ctx.tagsString
},
$$inline: true
});
textbox2.$on("change", ctx.change_handler_2);
const block = {
c: function create() {
div1 = element("div");
div0 = element("div");
textbox0.$$.fragment.c();
t0 = space();
textbox1.$$.fragment.c();
t1 = space();
textbox2.$$.fragment.c();
attr_dev(div0, "class", "info-text svelte-1abif7s");
add_location(div0, file$j, 196, 12, 5731);
attr_dev(div1, "class", "padding svelte-1abif7s");
add_location(div1, file$j, 195, 8, 5697);
},
m: function mount(target, anchor) {
insert_dev(target, div1, anchor);
append_dev(div1, div0);
mount_component(textbox0, div0, null);
append_dev(div0, t0);
mount_component(textbox1, div0, null);
append_dev(div0, t1);
mount_component(textbox2, div0, null);
current = true;
},
p: function update(changed, ctx) {
var textbox0_changes = {};
if (changed.name) textbox0_changes.text = ctx.name;
if (changed.nameInvalid) textbox0_changes.hasError = !!ctx.nameInvalid;
textbox0.$set(textbox0_changes);
var textbox1_changes = {};
if (changed.description) textbox1_changes.text = ctx.description;
textbox1.$set(textbox1_changes);
var textbox2_changes = {};
if (changed.tagsString) textbox2_changes.text = ctx.tagsString;
textbox2.$set(textbox2_changes);
},
i: function intro(local) {
if (current) return;
transition_in(textbox0.$$.fragment, local);
transition_in(textbox1.$$.fragment, local);
transition_in(textbox2.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(textbox0.$$.fragment, local);
transition_out(textbox1.$$.fragment, local);
transition_out(textbox2.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
destroy_component(textbox0);
destroy_component(textbox1);
destroy_component(textbox2);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$4.name, type: "if", source: "(195:8) {#if componentDetailsExpanded}", ctx });
return block;
}
// (244:16) <Button grouped on:click={confirmDeleteComponent}>
function create_default_slot_2$1(ctx) {
var t;
const block = {
c: function create() {
t = text("OK");
},
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$1.name, type: "slot", source: "(244:16) <Button grouped on:click={confirmDeleteComponent}>", ctx });
return block;
}
// (248:16) <Button grouped on:click={hideDialog} color="secondary" >
function create_default_slot_1$1(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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_1$1.name, type: "slot", source: "(248:16) <Button grouped on:click={hideDialog} color=\"secondary\" >", ctx });
return block;
}
// (243:12) <ButtonGroup>
function create_default_slot$1(ctx) {
var t, current;
var button0 = new Button({
props: {
grouped: true,
$$slots: { default: [create_default_slot_2$1] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.confirmDeleteComponent);
var button1 = new Button({
props: {
grouped: true,
color: "secondary",
$$slots: { default: [create_default_slot_1$1] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.hideDialog);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$1.name, type: "slot", source: "(243:12) <ButtonGroup>", ctx });
return block;
}
function create_fragment$i(ctx) {
var div3, div2, div0, t0, t1, div1, t2, t3, current_block_type_index, if_block, t4, div8, div7, div4, t5, t6, t7, t8, div5, t10, div6, current;
var iconbutton0 = new IconButton({
props: {
icon: "save",
color: "var(--secondary100)",
hoverColor: "var(--primary100)"
},
$$inline: true
});
iconbutton0.$on("click", ctx.save);
var iconbutton1 = new IconButton({
props: {
icon: "trash",
color: "var(--secondary100)",
hoverColor: "var(--primary100)"
},
$$inline: true
});
iconbutton1.$on("click", ctx.deleteComponent);
var if_block_creators = [
create_if_block$a,
create_else_block$4
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.editingComponentInstance) return 0;
return 1;
}
current_block_type_index = select_block_type(null, ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot$1] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div3 = element("div");
div2 = element("div");
div0 = element("div");
t0 = text(ctx.shortName);
t1 = space();
div1 = element("div");
iconbutton0.$$.fragment.c();
t2 = space();
iconbutton1.$$.fragment.c();
t3 = space();
if_block.c();
t4 = space();
div8 = element("div");
div7 = element("div");
div4 = element("div");
t5 = text("Delete ");
t6 = text(ctx.name);
t7 = text(" ?");
t8 = space();
div5 = element("div");
div5.textContent = "Are you sure you want to delete this component ?";
t10 = space();
div6 = element("div");
buttongroup.$$.fragment.c();
attr_dev(div0, "class", "svelte-1abif7s");
add_location(div0, file$j, 166, 8, 4464);
attr_dev(div1, "class", "svelte-1abif7s");
add_location(div1, file$j, 167, 8, 4495);
attr_dev(div2, "class", "title svelte-1abif7s");
add_location(div2, file$j, 165, 4, 4436);
attr_dev(div3, "class", "root svelte-1abif7s");
add_location(div3, file$j, 163, 0, 4412);
attr_dev(div4, "class", "uk-modal-header");
add_location(div4, file$j, 233, 8, 6829);
attr_dev(div5, "class", "uk-modal-body");
add_location(div5, file$j, 237, 8, 6912);
attr_dev(div6, "class", "uk-modal-footer");
add_location(div6, file$j, 241, 8, 7025);
attr_dev(div7, "class", "uk-modal-dialog");
add_location(div7, file$j, 231, 4, 6790);
attr_dev(div8, "uk-modal", "");
attr_dev(div8, "class", "svelte-1abif7s");
add_location(div8, file$j, 230, 0, 6746);
},
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, div3, anchor);
append_dev(div3, div2);
append_dev(div2, div0);
append_dev(div0, t0);
append_dev(div2, t1);
append_dev(div2, div1);
mount_component(iconbutton0, div1, null);
append_dev(div1, t2);
mount_component(iconbutton1, div1, null);
append_dev(div3, t3);
if_blocks[current_block_type_index].m(div3, null);
insert_dev(target, t4, anchor);
insert_dev(target, div8, anchor);
append_dev(div8, div7);
append_dev(div7, div4);
append_dev(div4, t5);
append_dev(div4, t6);
append_dev(div4, t7);
append_dev(div7, t8);
append_dev(div7, div5);
append_dev(div7, t10);
append_dev(div7, div6);
mount_component(buttongroup, div6, null);
ctx.div8_binding(div8);
current = true;
},
p: function update(changed, ctx) {
if (!current || changed.shortName) {
set_data_dev(t0, ctx.shortName);
}
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} 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();
}
transition_in(if_block, 1);
if_block.m(div3, null);
}
if (!current || changed.name) {
set_data_dev(t6, ctx.name);
}
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton0.$$.fragment, local);
transition_in(iconbutton1.$$.fragment, local);
transition_in(if_block);
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton0.$$.fragment, local);
transition_out(iconbutton1.$$.fragment, local);
transition_out(if_block);
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
destroy_component(iconbutton0);
destroy_component(iconbutton1);
if_blocks[current_block_type_index].d();
if (detaching) {
detach_dev(t4);
detach_dev(div8);
}
destroy_component(buttongroup);
ctx.div8_binding(null);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$i.name, type: "component", source: "", ctx });
return block;
}
function instance$i($$self, $$props, $$invalidate) {
let component;
let name = "";
let description = "";
let tagsString = "";
let nameInvalid = "";
let componentDetailsExpanded = false;
let componentInfo;
let modalElement;
let propsValidationErrors = [];
let editingComponentInstance;
let editingComponentInstancePropName="";
let editingComponentArrayIndex;
let editingComponentArrayPropName;
let editingComponentInstanceTitle;
let originalName="";
let allComponents;
let ignoreStore = false;
store.subscribe(s => {
if(ignoreStore) return;
component = s.currentFrontEndItem;
if(!component) return;
originalName = component.name;
$$invalidate('name', name = component.name);
$$invalidate('description', description = component.description);
$$invalidate('tagsString', tagsString = fp_41(", ")(component.tags));
$$invalidate('componentInfo', componentInfo = s.currentComponentInfo);
$$invalidate('componentDetailsExpanded', componentDetailsExpanded = s.currentComponentIsNew);
allComponents = s.allComponents;
});
const save = () => {
ignoreStore = true;
if(!validate()) {
ignoreStore = false;
return;
}
component.name = originalName || name;
component.description = description;
component.tags = pipe$1(tagsString, [
fp_5(","),
fp_7(s => s.trim())
]);
store.saveDerivedComponent(component);
ignoreStore = false;
// now do the rename
if(name !== originalName) {
store.renameDerivedComponent(originalName, name);
}
};
const deleteComponent = () => {
showDialog();
};
const confirmDeleteComponent = () => {
store.deleteDerivedComponent(component.name);
hideDialog();
};
const onPropsValidate = result => {
propsValidationErrors = result;
};
const updateComponent = doChange => {
const newComponent = fp_4(component);
doChange(newComponent);
component = newComponent;
$$invalidate('componentInfo', componentInfo = getComponentInfo(allComponents, newComponent));
};
const onPropsChanged = newProps => {
updateComponent(newComponent =>
lodash_13(newComponent.props, newProps));
};
const validate = () => {
if(!name) $$invalidate('nameInvalid', nameInvalid = "component name i not supplied");
else $$invalidate('nameInvalid', nameInvalid = "");
return (!nameInvalid && propsValidationErrors.length === 0);
};
const hideDialog = () => {
uikit.modal(modalElement).hide();
};
const showDialog = () => {
uikit.modal(modalElement).show();
};
const onEditComponentProp = (propName, arrayIndex, arrayPropName) => {
$$invalidate('editingComponentInstance', editingComponentInstance = fp_3(arrayIndex)
? component.props[propName]
: component.props[propName][arrayIndex][arrayPropName]);
editingComponentInstancePropName = propName;
$$invalidate('editingComponentInstanceTitle', editingComponentInstanceTitle = fp_3(arrayIndex)
? propName
: `${propName}[${arrayIndex}].${arrayPropName}`);
editingComponentArrayIndex = arrayIndex;
editingComponentArrayPropName = arrayPropName;
};
const componentInstanceCancelEdit = () => {
$$invalidate('editingComponentInstance', editingComponentInstance = null);
editingComponentInstancePropName = "";
};
const componentInstancePropsChanged = (instanceProps) => {
updateComponent(newComponent => {
if(fp_3(editingComponentArrayIndex)) {
newComponent.props[editingComponentInstancePropName] = instanceProps;
} else {
newComponent.props[editingComponentInstancePropName]
[editingComponentArrayIndex]
[editingComponentArrayPropName] = instanceProps;
}
});
};
const click_handler = () => $$invalidate('componentDetailsExpanded', componentDetailsExpanded = !componentDetailsExpanded);
const change_handler = (ev) => $$invalidate('name', name = ev.target.value);
const change_handler_1 = (ev) => $$invalidate('description', description = ev.target.value);
const change_handler_2 = (ev) => $$invalidate('tagsString', tagsString = ev.target.value);
function div8_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('modalElement', modalElement = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('component' in $$props) component = $$props.component;
if ('name' in $$props) $$invalidate('name', name = $$props.name);
if ('description' in $$props) $$invalidate('description', description = $$props.description);
if ('tagsString' in $$props) $$invalidate('tagsString', tagsString = $$props.tagsString);
if ('nameInvalid' in $$props) $$invalidate('nameInvalid', nameInvalid = $$props.nameInvalid);
if ('componentDetailsExpanded' in $$props) $$invalidate('componentDetailsExpanded', componentDetailsExpanded = $$props.componentDetailsExpanded);
if ('componentInfo' in $$props) $$invalidate('componentInfo', componentInfo = $$props.componentInfo);
if ('modalElement' in $$props) $$invalidate('modalElement', modalElement = $$props.modalElement);
if ('propsValidationErrors' in $$props) propsValidationErrors = $$props.propsValidationErrors;
if ('editingComponentInstance' in $$props) $$invalidate('editingComponentInstance', editingComponentInstance = $$props.editingComponentInstance);
if ('editingComponentInstancePropName' in $$props) editingComponentInstancePropName = $$props.editingComponentInstancePropName;
if ('editingComponentArrayIndex' in $$props) editingComponentArrayIndex = $$props.editingComponentArrayIndex;
if ('editingComponentArrayPropName' in $$props) editingComponentArrayPropName = $$props.editingComponentArrayPropName;
if ('editingComponentInstanceTitle' in $$props) $$invalidate('editingComponentInstanceTitle', editingComponentInstanceTitle = $$props.editingComponentInstanceTitle);
if ('originalName' in $$props) originalName = $$props.originalName;
if ('allComponents' in $$props) allComponents = $$props.allComponents;
if ('ignoreStore' in $$props) ignoreStore = $$props.ignoreStore;
if ('shortName' in $$props) $$invalidate('shortName', shortName = $$props.shortName);
};
let shortName;
$$self.$$.update = ($$dirty = { name: 1 }) => {
if ($$dirty.name) { $$invalidate('shortName', shortName = fp_12(name.split("/"))); }
};
return {
name,
description,
tagsString,
nameInvalid,
componentDetailsExpanded,
componentInfo,
modalElement,
editingComponentInstance,
editingComponentInstanceTitle,
save,
deleteComponent,
confirmDeleteComponent,
onPropsValidate,
onPropsChanged,
hideDialog,
onEditComponentProp,
componentInstanceCancelEdit,
componentInstancePropsChanged,
shortName,
click_handler,
change_handler,
change_handler_1,
change_handler_2,
div8_binding
};
}
class EditComponent extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$i, create_fragment$i, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "EditComponent", options, id: create_fragment$i.name });
}
}
/* src\common\Modal.svelte generated by Svelte v3.12.1 */
const file$k = "src\\common\\Modal.svelte";
function create_fragment$j(ctx) {
var div1, div0, current;
const default_slot_template = ctx.$$slots.default;
const default_slot = create_slot(default_slot_template, ctx, null);
const block = {
c: function create() {
div1 = element("div");
div0 = element("div");
if (default_slot) default_slot.c();
attr_dev(div0, "class", "uk-modal-dialog uk-modal-body svelte-vwwrf9");
attr_dev(div0, "uk-overflow-auto", "");
add_location(div0, file$k, 28, 4, 487);
attr_dev(div1, "uk-modal", "");
attr_dev(div1, "id", ctx.id);
add_location(div1, file$k, 27, 0, 443);
},
l: function claim(nodes) {
if (default_slot) default_slot.l(div0_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);
}
ctx.div1_binding(div1);
current = true;
},
p: function update(changed, ctx) {
if (default_slot && default_slot.p && changed.$$scope) {
default_slot.p(
get_slot_changes(default_slot_template, ctx, changed, null),
get_slot_context(default_slot_template, ctx, null)
);
}
if (!current || changed.id) {
attr_dev(div1, "id", ctx.id);
}
},
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);
ctx.div1_binding(null);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$j.name, type: "component", source: "", ctx });
return block;
}
function instance$j($$self, $$props, $$invalidate) {
let { isOpen = false, onClosed = () => {} } = $$props;
let { id = "" } = $$props;
let ukModal;
let listenerAdded = false;
const writable_props = ['isOpen', 'onClosed', 'id'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Modal> was created with unknown prop '${key}'`);
});
let { $$slots = {}, $$scope } = $$props;
function div1_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('ukModal', ukModal = $$value);
});
}
$$self.$set = $$props => {
if ('isOpen' in $$props) $$invalidate('isOpen', isOpen = $$props.isOpen);
if ('onClosed' in $$props) $$invalidate('onClosed', onClosed = $$props.onClosed);
if ('id' in $$props) $$invalidate('id', id = $$props.id);
if ('$$scope' in $$props) $$invalidate('$$scope', $$scope = $$props.$$scope);
};
$$self.$capture_state = () => {
return { isOpen, onClosed, id, ukModal, listenerAdded };
};
$$self.$inject_state = $$props => {
if ('isOpen' in $$props) $$invalidate('isOpen', isOpen = $$props.isOpen);
if ('onClosed' in $$props) $$invalidate('onClosed', onClosed = $$props.onClosed);
if ('id' in $$props) $$invalidate('id', id = $$props.id);
if ('ukModal' in $$props) $$invalidate('ukModal', ukModal = $$props.ukModal);
if ('listenerAdded' in $$props) $$invalidate('listenerAdded', listenerAdded = $$props.listenerAdded);
};
$$self.$$.update = ($$dirty = { ukModal: 1, listenerAdded: 1, onClosed: 1, isOpen: 1 }) => {
if ($$dirty.ukModal || $$dirty.listenerAdded || $$dirty.onClosed) { if(ukModal && !listenerAdded) {
$$invalidate('listenerAdded', listenerAdded = true);
ukModal.addEventListener("hide", onClosed);
} }
if ($$dirty.ukModal || $$dirty.isOpen) { {
if(ukModal) {
if(isOpen) {
uikit.modal(ukModal).show();
} else {
uikit.modal(ukModal).hide();
}
}
} }
};
return {
isOpen,
onClosed,
id,
ukModal,
div1_binding,
$$slots,
$$scope
};
}
class Modal extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$j, create_fragment$j, safe_not_equal, ["isOpen", "onClosed", "id"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Modal", options, id: create_fragment$j.name });
}
get isOpen() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set isOpen(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onClosed() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onClosed(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get id() {
throw new Error("<Modal>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set id(value) {
throw new Error("<Modal>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
const libraryDependencies = (allComponents, lib) => {
const componentDependsOnLibrary = comp => {
if(isRootComponent(comp)) {
const {libName} = splitName(component.name);
return (libName === lib);
}
return componentDependsOnLibrary(
fp_13(c => c.name === comp.inherits)(allComponents)
);
};
return fp_8(c => !isRootComponent(c)
&& componentDependsOnLibrary(c))(
allComponents
);
};
const componentDependencies = (pages, allComponents, dependsOn) => {
pages = fp_4(pages);
allComponents = fp_4(allComponents);
const dependantComponents = [];
const dependantPages = [];
const traverseProps = (props) => {
if(props._component && props._component === dependsOn.name) {
return true;
}
for(let propName in props) {
const prop = props[propName];
if(fp_60(prop) && prop._component) {
if(traverseProps(prop)) return true;
}
if(fp_26(prop)) {
for(let element of prop) {
if(traverseProps(element)) return true;
}
}
}
return false;
};
for(let component of allComponents) {
if(isRootComponent(component)) {
continue;
}
if(component.name === dependsOn.name) {
continue;
}
if(component.inherits === dependsOn.name) {
dependantComponents.push(component);
continue;
}
if(traverseProps(component.props)) {
dependantComponents.push(component);
}
}
for(let pageName in pages) {
const page = pages[pageName];
if(page.appBody === dependsOn.name) {
dependantPages.push(pageName);
}
}
return {dependantComponents, dependantPages};
};
/* src\userInterface\GeneratedComponents.svelte generated by Svelte v3.12.1 */
const file$l = "src\\userInterface\\GeneratedComponents.svelte";
function get_each_context$9(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.c = list[i];
return child_ctx;
}
// (116:8) {#if isComponentSelected(c)}
function create_if_block$b(ctx) {
var span, t_value = ctx.c.error + "", t;
const block = {
c: function create() {
span = element("span");
t = text(t_value);
attr_dev(span, "class", "error svelte-3sgo90");
add_location(span, file$l, 116, 8, 3628);
},
m: function mount(target, anchor) {
insert_dev(target, span, anchor);
append_dev(span, t);
},
p: function update(changed, ctx) {
if ((changed.components) && t_value !== (t_value = ctx.c.error + "")) {
set_data_dev(t, t_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(span);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$b.name, type: "if", source: "(116:8) {#if isComponentSelected(c)}", ctx });
return block;
}
// (102:0) {#each components as c}
function create_each_block$9(ctx) {
var div2, div0, input0, input0_disabled_value, input0_checked_value, t0, input1, input1_value_value, input1_class_value, t1, show_if = ctx.isComponentSelected(ctx.c), t2, div1, t3_value = ctx.c.component.description + "", t3, dispose;
var if_block = (show_if) && create_if_block$b(ctx);
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
input0 = element("input");
t0 = space();
input1 = element("input");
t1 = space();
if (if_block) if_block.c();
t2 = space();
div1 = element("div");
t3 = text(t3_value);
attr_dev(input0, "type", "checkbox");
input0.disabled = input0_disabled_value = ctx.c.dependants.length > 0;
attr_dev(input0, "class", "uk-checkbox");
input0.checked = input0_checked_value = ctx.isComponentSelected(ctx.c);
add_location(input0, file$l, 106, 8, 3179);
attr_dev(input1, "type", "text");
input1.value = input1_value_value = ctx.c.component.name;
attr_dev(input1, "class", input1_class_value = "uk-input title " + (ctx.c.error ? 'uk-form-danger' : '') + " svelte-3sgo90");
add_location(input1, file$l, 111, 8, 3400);
attr_dev(div0, "class", "uk-inline");
add_location(div0, file$l, 105, 4, 3146);
attr_dev(div1, "class", "description svelte-3sgo90");
add_location(div1, file$l, 120, 4, 3699);
attr_dev(div2, "class", "component svelte-3sgo90");
add_location(div2, file$l, 103, 0, 3115);
dispose = [
listen_dev(input0, "change", ctx.onSelectedChanged(ctx.c)),
listen_dev(input1, "change", ctx.onNameChanged(ctx.c))
];
},
m: function mount(target, anchor) {
insert_dev(target, div2, anchor);
append_dev(div2, div0);
append_dev(div0, input0);
append_dev(div0, t0);
append_dev(div0, input1);
append_dev(div0, t1);
if (if_block) if_block.m(div0, null);
append_dev(div2, t2);
append_dev(div2, div1);
append_dev(div1, t3);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.components) && input0_disabled_value !== (input0_disabled_value = ctx.c.dependants.length > 0)) {
prop_dev(input0, "disabled", input0_disabled_value);
}
if ((changed.components) && input0_checked_value !== (input0_checked_value = ctx.isComponentSelected(ctx.c))) {
prop_dev(input0, "checked", input0_checked_value);
}
if ((changed.components) && input1_value_value !== (input1_value_value = ctx.c.component.name)) {
prop_dev(input1, "value", input1_value_value);
}
if ((changed.components) && input1_class_value !== (input1_class_value = "uk-input title " + (ctx.c.error ? 'uk-form-danger' : '') + " svelte-3sgo90")) {
attr_dev(input1, "class", input1_class_value);
}
if (changed.components) show_if = ctx.isComponentSelected(ctx.c);
if (show_if) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$b(ctx);
if_block.c();
if_block.m(div0, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if ((changed.components) && t3_value !== (t3_value = ctx.c.component.description + "")) {
set_data_dev(t3, t3_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
if (if_block) if_block.d();
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$9.name, type: "each", source: "(102:0) {#each components as c}", ctx });
return block;
}
// (130:4) <Button on:click={() => onConfirmGenerate(selectedComponents)}>
function create_default_slot$2(ctx) {
var t;
const block = {
c: function create() {
t = text("Add Components");
},
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.name, type: "slot", source: "(130:4) <Button on:click={() => onConfirmGenerate(selectedComponents)}>", ctx });
return block;
}
function create_fragment$k(ctx) {
var t, div, current;
let each_value = ctx.components;
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));
}
var button = new Button({
props: {
$$slots: { default: [create_default_slot$2] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", ctx.click_handler);
const block = {
c: function create() {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
div = element("div");
button.$$.fragment.c();
attr_dev(div, "class", "button-container svelte-3sgo90");
add_location(div, file$l, 128, 0, 3796);
},
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) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
}
insert_dev(target, t, anchor);
insert_dev(target, div, anchor);
mount_component(button, div, null);
current = true;
},
p: function update(changed, ctx) {
if (changed.components || changed.isComponentSelected) {
each_value = ctx.components;
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(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$9(child_ctx);
each_blocks[i].c();
each_blocks[i].m(t.parentNode, t);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
var button_changes = {};
if (changed.$$scope) button_changes.$$scope = { changed, ctx };
button.$set(button_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) {
detach_dev(t);
detach_dev(div);
}
destroy_component(button);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$k.name, type: "component", source: "", ctx });
return block;
}
function instance$k($$self, $$props, $$invalidate) {
let { generator, onConfirmGenerate } = $$props;
let libName;
let componentName;
let libs;
let existingComponents;
let _generator;
let components;
let generateParameter;
let allGeneratedComponents;
let selectedComponents = [];
store.subscribe(s => {
$$invalidate('libs', libs = s.generatorLibraries);
$$invalidate('generateParameter', generateParameter = {
indexes: getIndexNodes(s.hierarchy),
records: getRecordNodes(s.hierarchy),
helpers: {
indexSchema: getIndexSchema(s.hierarchy)
}
});
existingComponents = s.allComponents;
});
const componentExists = name =>
getExactComponent(existingComponents, name);
const componentsWithDependencies = () => {
const cmp = fp_7(c => {
const dependants = componentDependencies(
{}, [...selectedComponents, ...existingComponents], c);
const exists = componentExists(c.name);
return {
dependants: dependants.dependantComponents,
component:c,
error: exists ? "a component by this name already exists" : ""
};
})(allGeneratedComponents);
$$invalidate('components', components = cmp);
};
const onSelectedChanged = component => ev => {
const newselectedComponents = fp_8(c => c.name !== component.component.name)(
selectedComponents);
if(ev.target.checked) {
newselectedComponents.push(component.component);
}
$$invalidate('selectedComponents', selectedComponents = newselectedComponents);
componentsWithDependencies();
};
const onNameChanged = component => ev => {
const newname = ev.target.value;
const oldname = component.component.name;
const result = rename({}, allGeneratedComponents, oldname, newname);
component.error = result.error || "";
$$invalidate('allGeneratedComponents', allGeneratedComponents = [...result.allComponents]);
$$invalidate('selectedComponents', selectedComponents = fp_7(s => {
if(s.name === oldname) s.name = newname;
return s;
})(selectedComponents));
componentsWithDependencies();
};
const isComponentSelected = component =>
fp_6(c => c.name === component.component.name)(selectedComponents);
const writable_props = ['generator', 'onConfirmGenerate'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<GeneratedComponents> was created with unknown prop '${key}'`);
});
const click_handler = () => onConfirmGenerate(selectedComponents);
$$self.$set = $$props => {
if ('generator' in $$props) $$invalidate('generator', generator = $$props.generator);
if ('onConfirmGenerate' in $$props) $$invalidate('onConfirmGenerate', onConfirmGenerate = $$props.onConfirmGenerate);
};
$$self.$capture_state = () => {
return { generator, onConfirmGenerate, libName, componentName, libs, existingComponents, _generator, components, generateParameter, allGeneratedComponents, selectedComponents };
};
$$self.$inject_state = $$props => {
if ('generator' in $$props) $$invalidate('generator', generator = $$props.generator);
if ('onConfirmGenerate' in $$props) $$invalidate('onConfirmGenerate', onConfirmGenerate = $$props.onConfirmGenerate);
if ('libName' in $$props) $$invalidate('libName', libName = $$props.libName);
if ('componentName' in $$props) $$invalidate('componentName', componentName = $$props.componentName);
if ('libs' in $$props) $$invalidate('libs', libs = $$props.libs);
if ('existingComponents' in $$props) existingComponents = $$props.existingComponents;
if ('_generator' in $$props) $$invalidate('_generator', _generator = $$props._generator);
if ('components' in $$props) $$invalidate('components', components = $$props.components);
if ('generateParameter' in $$props) $$invalidate('generateParameter', generateParameter = $$props.generateParameter);
if ('allGeneratedComponents' in $$props) $$invalidate('allGeneratedComponents', allGeneratedComponents = $$props.allGeneratedComponents);
if ('selectedComponents' in $$props) $$invalidate('selectedComponents', selectedComponents = $$props.selectedComponents);
};
$$self.$$.update = ($$dirty = { generator: 1, _generator: 1, libs: 1, libName: 1, componentName: 1, generateParameter: 1, allGeneratedComponents: 1 }) => {
if ($$dirty.generator || $$dirty._generator || $$dirty.libs || $$dirty.libName || $$dirty.componentName || $$dirty.generateParameter || $$dirty.allGeneratedComponents) { {
if(generator && generator !== _generator) {
$$invalidate('_generator', _generator = generator);
const sp = splitName(generator.name);
$$invalidate('libName', libName = sp.libName);
$$invalidate('componentName', componentName = sp.componentName);
$$invalidate('allGeneratedComponents', allGeneratedComponents = libs[libName][componentName](generateParameter));
$$invalidate('selectedComponents', selectedComponents =
fp_8(c => !componentExists(c.name))(allGeneratedComponents));
componentsWithDependencies();
}
} }
};
return {
generator,
onConfirmGenerate,
components,
selectedComponents,
onSelectedChanged,
onNameChanged,
isComponentSelected,
click_handler
};
}
class GeneratedComponents extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$k, create_fragment$k, safe_not_equal, ["generator", "onConfirmGenerate"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "GeneratedComponents", options, id: create_fragment$k.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.generator === undefined && !('generator' in props)) {
console.warn("<GeneratedComponents> was created without expected prop 'generator'");
}
if (ctx.onConfirmGenerate === undefined && !('onConfirmGenerate' in props)) {
console.warn("<GeneratedComponents> was created without expected prop 'onConfirmGenerate'");
}
}
get generator() {
throw new Error("<GeneratedComponents>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set generator(value) {
throw new Error("<GeneratedComponents>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onConfirmGenerate() {
throw new Error("<GeneratedComponents>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onConfirmGenerate(value) {
throw new Error("<GeneratedComponents>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\NewComponent.svelte generated by Svelte v3.12.1 */
const file$m = "src\\userInterface\\NewComponent.svelte";
// (86:8) {#if generator}
function create_if_block$c(ctx) {
var div0, h1, t0, t1_value = ctx.generator ? ctx.generator.name : "" + "", t1, t2, div1, current;
var generatedcomponents = new GeneratedComponents({
props: {
generator: ctx.generator,
onConfirmGenerate: ctx.onConfirmGenerate
},
$$inline: true
});
const block = {
c: function create() {
div0 = element("div");
h1 = element("h1");
t0 = text("Generator - ");
t1 = text(t1_value);
t2 = space();
div1 = element("div");
generatedcomponents.$$.fragment.c();
attr_dev(h1, "class", "svelte-16jkjx9");
add_location(h1, file$m, 88, 12, 2206);
attr_dev(div0, "class", "uk-modal-header");
add_location(div0, file$m, 87, 8, 2164);
attr_dev(div1, "class", "uk-modal-body");
add_location(div1, file$m, 91, 8, 2285);
},
m: function mount(target, anchor) {
insert_dev(target, div0, anchor);
append_dev(div0, h1);
append_dev(h1, t0);
append_dev(h1, t1);
insert_dev(target, t2, anchor);
insert_dev(target, div1, anchor);
mount_component(generatedcomponents, div1, null);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.generator) && t1_value !== (t1_value = ctx.generator ? ctx.generator.name : "" + "")) {
set_data_dev(t1, t1_value);
}
var generatedcomponents_changes = {};
if (changed.generator) generatedcomponents_changes.generator = ctx.generator;
generatedcomponents.$set(generatedcomponents_changes);
},
i: function intro(local) {
if (current) return;
transition_in(generatedcomponents.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(generatedcomponents.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div0);
detach_dev(t2);
detach_dev(div1);
}
destroy_component(generatedcomponents);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$c.name, type: "if", source: "(86:8) {#if generator}", ctx });
return block;
}
function create_fragment$l(ctx) {
var div3, div2, div0, h1, t1, div1, t2, div5, div4, current;
var componentselector = new ComponentSelector({
props: {
onComponentChosen: ctx.onComponentChosen,
onGeneratorChosen: ctx.onGeneratorChosen,
allowGenerators: true
},
$$inline: true
});
var if_block = (ctx.generator) && create_if_block$c(ctx);
const block = {
c: function create() {
div3 = element("div");
div2 = element("div");
div0 = element("div");
h1 = element("h1");
h1.textContent = "New Component";
t1 = space();
div1 = element("div");
componentselector.$$.fragment.c();
t2 = space();
div5 = element("div");
div4 = element("div");
if (if_block) if_block.c();
attr_dev(h1, "class", "svelte-16jkjx9");
add_location(h1, file$m, 70, 12, 1717);
attr_dev(div0, "class", "uk-modal-header");
add_location(div0, file$m, 69, 8, 1675);
attr_dev(div1, "class", "uk-modal-body");
add_location(div1, file$m, 73, 8, 1764);
attr_dev(div2, "class", "uk-modal-dialog");
attr_dev(div2, "uk-overflow-auto", "");
add_location(div2, file$m, 67, 4, 1619);
attr_dev(div3, "id", "new-component-modal");
attr_dev(div3, "uk-modal", "");
add_location(div3, file$m, 66, 0, 1540);
attr_dev(div4, "class", "uk-modal-dialog");
attr_dev(div4, "uk-overflow-auto", "");
add_location(div4, file$m, 83, 4, 2075);
attr_dev(div5, "uk-modal", "");
add_location(div5, file$m, 82, 0, 2022);
},
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, div3, anchor);
append_dev(div3, div2);
append_dev(div2, div0);
append_dev(div0, h1);
append_dev(div2, t1);
append_dev(div2, div1);
mount_component(componentselector, div1, null);
ctx.div3_binding(div3);
insert_dev(target, t2, anchor);
insert_dev(target, div5, anchor);
append_dev(div5, div4);
if (if_block) if_block.m(div4, null);
ctx.div5_binding(div5);
current = true;
},
p: function update(changed, ctx) {
if (ctx.generator) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$c(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(div4, 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(componentselector.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(componentselector.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
destroy_component(componentselector);
ctx.div3_binding(null);
if (detaching) {
detach_dev(t2);
detach_dev(div5);
}
if (if_block) if_block.d();
ctx.div5_binding(null);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$l.name, type: "component", source: "", ctx });
return block;
}
function instance$l($$self, $$props, $$invalidate) {
let componentSelectorModal;
let generatorOptionsModal;
let allComponents;
let generator;
store.subscribe(s => {
allComponents = s.allComponents;
});
const close = () => {
uikit.modal(componentSelectorModal).hide();
if(generatorOptionsModal) uikit.modal(generatorOptionsModal).hide();
$$invalidate('generator', generator = null);
};
const show = () => {
uikit.modal(componentSelectorModal).show();
};
const onComponentChosen = (c) => {
store.createDerivedComponent(c.name);
close();
};
const onGeneratorChosen = (g) => {
$$invalidate('generator', generator = g);
uikit.modal(componentSelectorModal).hide();
uikit.modal(generatorOptionsModal).show();
};
const onConfirmGenerate = (components) => {
store.createGeneratedComponents(components);
uikit.modal(generatorOptionsModal).hide();
$$invalidate('generator', generator = null);
};
function div3_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('componentSelectorModal', componentSelectorModal = $$value);
});
}
function div5_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('generatorOptionsModal', generatorOptionsModal = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('componentSelectorModal' in $$props) $$invalidate('componentSelectorModal', componentSelectorModal = $$props.componentSelectorModal);
if ('generatorOptionsModal' in $$props) $$invalidate('generatorOptionsModal', generatorOptionsModal = $$props.generatorOptionsModal);
if ('allComponents' in $$props) allComponents = $$props.allComponents;
if ('generator' in $$props) $$invalidate('generator', generator = $$props.generator);
};
return {
componentSelectorModal,
generatorOptionsModal,
generator,
close,
show,
onComponentChosen,
onGeneratorChosen,
onConfirmGenerate,
div3_binding,
div5_binding
};
}
class NewComponent extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$l, create_fragment$l, safe_not_equal, ["close", "show"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "NewComponent", options, id: create_fragment$l.name });
}
get close() {
return this.$$.ctx.close;
}
set close(value) {
throw new Error("<NewComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get show() {
return this.$$.ctx.show;
}
set show(value) {
throw new Error("<NewComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\CurrentItemPreview.svelte generated by Svelte v3.12.1 */
const file$n = "src\\userInterface\\CurrentItemPreview.svelte";
// (39:4) {#if hasComponent}
function create_if_block$d(ctx) {
var iframe, iframe_srcdoc_value;
const block = {
c: function create() {
iframe = element("iframe");
set_style(iframe, "height", "100%");
set_style(iframe, "width", "100%");
attr_dev(iframe, "title", "componentPreview");
attr_dev(iframe, "srcdoc", iframe_srcdoc_value = `<html>
<head>
${ctx.stylesheetLinks}
<script>
window["##BUDIBASE_APPDEFINITION##"] = ${JSON.stringify(ctx.appDefinition)};
import('./budibase-client.esm.mjs')
.then(module => {
module.loadBudibase();
})
</script>
<style>
body {
box-sizing: border-box;
padding: 20px;
}
</style>
</head>
<body>
</body>
</html>`);
attr_dev(iframe, "class", "svelte-teqoiq");
add_location(iframe, file$n, 39, 4, 1014);
},
m: function mount(target, anchor) {
insert_dev(target, iframe, anchor);
},
p: function update(changed, ctx) {
if ((changed.stylesheetLinks || changed.appDefinition) && iframe_srcdoc_value !== (iframe_srcdoc_value = `<html>
<head>
${ctx.stylesheetLinks}
<script>
window["##BUDIBASE_APPDEFINITION##"] = ${JSON.stringify(ctx.appDefinition)};
import('./budibase-client.esm.mjs')
.then(module => {
module.loadBudibase();
})
</script>
<style>
body {
box-sizing: border-box;
padding: 20px;
}
</style>
</head>
<body>
</body>
</html>`)) {
attr_dev(iframe, "srcdoc", iframe_srcdoc_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(iframe);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$d.name, type: "if", source: "(39:4) {#if hasComponent}", ctx });
return block;
}
function create_fragment$m(ctx) {
var div;
var if_block = (ctx.hasComponent) && create_if_block$d(ctx);
const block = {
c: function create() {
div = element("div");
if (if_block) if_block.c();
attr_dev(div, "class", "component-container svelte-teqoiq");
add_location(div, file$n, 37, 0, 953);
},
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 (if_block) if_block.m(div, null);
},
p: function update(changed, ctx) {
if (ctx.hasComponent) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$d(ctx);
if_block.c();
if_block.m(div, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
if (if_block) if_block.d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$m.name, type: "component", source: "", ctx });
return block;
}
function instance$m($$self, $$props, $$invalidate) {
let hasComponent=false;
let stylesheetLinks = "";
let appDefinition = {};
store.subscribe(s => {
$$invalidate('hasComponent', hasComponent = !!s.currentFrontEndItem);
$$invalidate('stylesheetLinks', stylesheetLinks = pipe$1(s.pages.stylesheets, [
fp_7(s => `<link rel="stylesheet" href="${s}"/>`),
fp_41("\n")
]));
$$invalidate('appDefinition', appDefinition = {
componentLibraries: s.loadLibraryUrls(),
props: buildPropsHierarchy(s.allComponents, s.currentFrontEndItem),
hierarchy: s.hierarchy
});
});
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('hasComponent' in $$props) $$invalidate('hasComponent', hasComponent = $$props.hasComponent);
if ('stylesheetLinks' in $$props) $$invalidate('stylesheetLinks', stylesheetLinks = $$props.stylesheetLinks);
if ('appDefinition' in $$props) $$invalidate('appDefinition', appDefinition = $$props.appDefinition);
};
return {
hasComponent,
stylesheetLinks,
appDefinition
};
}
class CurrentItemPreview extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$m, create_fragment$m, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "CurrentItemPreview", options, id: create_fragment$m.name });
}
}
/* src\userInterface\SettingsView.svelte generated by Svelte v3.12.1 */
const file$o = "src\\userInterface\\SettingsView.svelte";
function get_each_context$a(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.stylesheet = list[i];
return child_ctx;
}
function get_each_context_1$6(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.lib = list[i];
return child_ctx;
}
// (69:24) <Button color="primary-outline" on:click={addLib}>
function create_default_slot_1$2(ctx) {
var t;
const block = {
c: function create() {
t = text("Add");
},
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_1$2.name, type: "slot", source: "(69:24) <Button color=\"primary-outline\" on:click={addLib}>", ctx });
return block;
}
// (73:16) {#each $store.pages.componentLibraries as lib}
function create_each_block_1$6(ctx) {
var div, span, t0_value = ctx.lib + "", t0, t1, t2, current;
function click_handler() {
return ctx.click_handler(ctx);
}
var iconbutton = new IconButton({ props: { icon: "x" }, $$inline: true });
iconbutton.$on("click", click_handler);
const block = {
c: function create() {
div = element("div");
span = element("span");
t0 = text(t0_value);
t1 = space();
iconbutton.$$.fragment.c();
t2 = space();
attr_dev(span, "class", "row-text svelte-yk1mmr");
add_location(span, file$o, 74, 20, 1923);
add_location(div, file$o, 73, 16, 1897);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, span);
append_dev(span, t0);
append_dev(div, t1);
mount_component(iconbutton, div, null);
append_dev(div, t2);
current = true;
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((!current || changed.$store) && t0_value !== (t0_value = ctx.lib + "")) {
set_data_dev(t0, t0_value);
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(iconbutton);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$6.name, type: "each", source: "(73:16) {#each $store.pages.componentLibraries as lib}", ctx });
return block;
}
// (87:24) <Button color="primary-outline" on:click={addStylesheet} >
function create_default_slot$3(ctx) {
var t;
const block = {
c: function create() {
t = text("Add");
},
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: "(87:24) <Button color=\"primary-outline\" on:click={addStylesheet} >", ctx });
return block;
}
// (91:16) {#each $store.pages.stylesheets as stylesheet}
function create_each_block$a(ctx) {
var div, span, t0_value = ctx.stylesheet + "", t0, t1, t2, current;
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
var iconbutton = new IconButton({ props: { icon: "x" }, $$inline: true });
iconbutton.$on("click", click_handler_1);
const block = {
c: function create() {
div = element("div");
span = element("span");
t0 = text(t0_value);
t1 = space();
iconbutton.$$.fragment.c();
t2 = space();
attr_dev(span, "class", "row-text svelte-yk1mmr");
add_location(span, file$o, 92, 20, 2603);
add_location(div, file$o, 91, 16, 2577);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, span);
append_dev(span, t0);
append_dev(div, t1);
mount_component(iconbutton, div, null);
append_dev(div, t2);
current = true;
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((!current || changed.$store) && t0_value !== (t0_value = ctx.stylesheet + "")) {
set_data_dev(t0, t0_value);
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(iconbutton);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$a.name, type: "each", source: "(91:16) {#each $store.pages.stylesheets as stylesheet}", ctx });
return block;
}
function create_fragment$n(ctx) {
var div7, div6, div2, div0, t1, div1, t2, div5, div3, p0, t3, span0, input0, t4, t5, t6, div4, p1, t7, span1, input1, t8, t9, current, dispose;
var iconbutton = new IconButton({ props: { icon: "x" }, $$inline: true });
iconbutton.$on("click", ctx.close);
var button0 = new Button({
props: {
color: "primary-outline",
$$slots: { default: [create_default_slot_1$2] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.addLib);
let each_value_1 = ctx.$store.pages.componentLibraries;
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_1$6(get_each_context_1$6(ctx, each_value_1, i));
}
const out = i => transition_out(each_blocks_1[i], 1, 1, () => {
each_blocks_1[i] = null;
});
var button1 = new Button({
props: {
color: "primary-outline",
$$slots: { default: [create_default_slot$3] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.addStylesheet);
let each_value = ctx.$store.pages.stylesheets;
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));
}
const out_1 = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
const block = {
c: function create() {
div7 = element("div");
div6 = element("div");
div2 = element("div");
div0 = element("div");
div0.textContent = "Settings";
t1 = space();
div1 = element("div");
iconbutton.$$.fragment.c();
t2 = space();
div5 = element("div");
div3 = element("div");
p0 = element("p");
t3 = text("Component Libraries\n ");
span0 = element("span");
input0 = element("input");
t4 = space();
button0.$$.fragment.c();
t5 = space();
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t6 = space();
div4 = element("div");
p1 = element("p");
t7 = text("Stylesheets\n ");
span1 = element("span");
input1 = element("input");
t8 = space();
button1.$$.fragment.c();
t9 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div0, "class", "svelte-yk1mmr");
add_location(div0, file$o, 55, 12, 1269);
attr_dev(div1, "class", "svelte-yk1mmr");
add_location(div1, file$o, 56, 12, 1301);
attr_dev(div2, "class", "uk-modal-header header svelte-yk1mmr");
add_location(div2, file$o, 54, 8, 1220);
attr_dev(input0, "class", "svelte-yk1mmr");
add_location(input0, file$o, 67, 24, 1616);
attr_dev(span0, "class", "svelte-yk1mmr");
add_location(span0, file$o, 66, 20, 1585);
attr_dev(p0, "class", "svelte-yk1mmr");
add_location(p0, file$o, 65, 16, 1542);
attr_dev(div3, "class", "section-container svelte-yk1mmr");
add_location(div3, file$o, 64, 12, 1494);
attr_dev(input1, "class", "svelte-yk1mmr");
add_location(input1, file$o, 85, 24, 2277);
attr_dev(span1, "class", "svelte-yk1mmr");
add_location(span1, file$o, 84, 20, 2246);
attr_dev(p1, "class", "svelte-yk1mmr");
add_location(p1, file$o, 83, 16, 2211);
attr_dev(div4, "class", "section-container svelte-yk1mmr");
add_location(div4, file$o, 82, 12, 2163);
attr_dev(div5, "class", "uk-modal-body uk-form-horizontal");
add_location(div5, file$o, 62, 8, 1434);
attr_dev(div6, "class", "uk-modal-dialog");
add_location(div6, file$o, 52, 4, 1181);
attr_dev(div7, "id", "new-component-modal");
attr_dev(div7, "uk-modal", "");
attr_dev(div7, "class", "svelte-yk1mmr");
add_location(div7, file$o, 51, 0, 1112);
dispose = [
listen_dev(input0, "input", ctx.input0_input_handler),
listen_dev(input1, "input", ctx.input1_input_handler)
];
},
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, div7, anchor);
append_dev(div7, div6);
append_dev(div6, div2);
append_dev(div2, div0);
append_dev(div2, t1);
append_dev(div2, div1);
mount_component(iconbutton, div1, null);
append_dev(div6, t2);
append_dev(div6, div5);
append_dev(div5, div3);
append_dev(div3, p0);
append_dev(p0, t3);
append_dev(p0, span0);
append_dev(span0, input0);
set_input_value(input0, ctx.addNewLib);
append_dev(span0, t4);
mount_component(button0, span0, null);
append_dev(div3, t5);
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].m(div3, null);
}
append_dev(div5, t6);
append_dev(div5, div4);
append_dev(div4, p1);
append_dev(p1, t7);
append_dev(p1, span1);
append_dev(span1, input1);
set_input_value(input1, ctx.addNewStylesheet);
append_dev(span1, t8);
mount_component(button1, span1, null);
append_dev(div4, t9);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div4, null);
}
ctx.div7_binding(div7);
current = true;
},
p: function update(changed, ctx) {
if (changed.addNewLib && (input0.value !== ctx.addNewLib)) set_input_value(input0, ctx.addNewLib);
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
if (changed.$store) {
each_value_1 = ctx.$store.pages.componentLibraries;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$6(ctx, each_value_1, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(changed, child_ctx);
transition_in(each_blocks_1[i], 1);
} else {
each_blocks_1[i] = create_each_block_1$6(child_ctx);
each_blocks_1[i].c();
transition_in(each_blocks_1[i], 1);
each_blocks_1[i].m(div3, null);
}
}
group_outros();
for (i = each_value_1.length; i < each_blocks_1.length; i += 1) {
out(i);
}
check_outros();
}
if (changed.addNewStylesheet && (input1.value !== ctx.addNewStylesheet)) set_input_value(input1, ctx.addNewStylesheet);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
if (changed.$store) {
each_value = ctx.$store.pages.stylesheets;
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(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$a(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div4, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out_1(i);
}
check_outros();
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
transition_in(button0.$$.fragment, local);
for (let i = 0; i < each_value_1.length; i += 1) {
transition_in(each_blocks_1[i]);
}
transition_in(button1.$$.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(iconbutton.$$.fragment, local);
transition_out(button0.$$.fragment, local);
each_blocks_1 = each_blocks_1.filter(Boolean);
for (let i = 0; i < each_blocks_1.length; i += 1) {
transition_out(each_blocks_1[i]);
}
transition_out(button1.$$.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) {
if (detaching) {
detach_dev(div7);
}
destroy_component(iconbutton);
destroy_component(button0);
destroy_each(each_blocks_1, detaching);
destroy_component(button1);
destroy_each(each_blocks, detaching);
ctx.div7_binding(null);
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$n.name, type: "component", source: "", ctx });
return block;
}
let addComponentError = "";
function instance$n($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let addNewLib = "";
let addNewStylesheet = "";
let modalElement;
let allComponents;
store.subscribe(s => {
allComponents = s.allComponents;
});
const removeLibrary = lib => {
const dependencies = libraryDependencies(allComponents, lib);
if(dependencies.length > 0) return;
store.removeComponentLibrary(lib);
};
const addLib = () => {
store.addComponentLibrary(addNewLib)
.then(() => {
$$invalidate('addNewLib', addNewLib = "");
});
};
const removeStylesheet = stylesheet => {
store.removeStylesheet(stylesheet);
};
const addStylesheet = () => {
if(addNewStylesheet)
store.addStylesheet(addNewStylesheet);
};
const close = () => {
uikit.modal(modalElement).hide();
};
const show = () => {
uikit.modal(modalElement).show();
};
function input0_input_handler() {
addNewLib = this.value;
$$invalidate('addNewLib', addNewLib);
}
const click_handler = ({ lib }) => removeLibrary(lib);
function input1_input_handler() {
addNewStylesheet = this.value;
$$invalidate('addNewStylesheet', addNewStylesheet);
}
const click_handler_1 = ({ stylesheet }) => removeStylesheet(stylesheet);
function div7_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('modalElement', modalElement = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('addNewLib' in $$props) $$invalidate('addNewLib', addNewLib = $$props.addNewLib);
if ('addNewStylesheet' in $$props) $$invalidate('addNewStylesheet', addNewStylesheet = $$props.addNewStylesheet);
if ('addComponentError' in $$props) addComponentError = $$props.addComponentError;
if ('modalElement' in $$props) $$invalidate('modalElement', modalElement = $$props.modalElement);
if ('allComponents' in $$props) allComponents = $$props.allComponents;
if ('$store' in $$props) store.set($store);
};
return {
addNewLib,
addNewStylesheet,
modalElement,
removeLibrary,
addLib,
removeStylesheet,
addStylesheet,
close,
show,
$store,
input0_input_handler,
click_handler,
input1_input_handler,
click_handler_1,
div7_binding
};
}
class SettingsView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$n, create_fragment$n, safe_not_equal, ["close", "show"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "SettingsView", options, id: create_fragment$n.name });
}
get close() {
return this.$$.ctx.close;
}
set close(value) {
throw new Error("<SettingsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get show() {
return this.$$.ctx.show;
}
set show(value) {
throw new Error("<SettingsView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\userInterface\PageView.svelte generated by Svelte v3.12.1 */
const file$p = "src\\userInterface\\PageView.svelte";
// (58:8) <Button on:click={save}>
function create_default_slot$4(ctx) {
var t;
const block = {
c: function create() {
t = text("Save");
},
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: "(58:8) <Button on:click={save}>", ctx });
return block;
}
function create_fragment$o(ctx) {
var div3, h3, t0_value = ctx.$store.currentPageName + "", t0, t1, form, updating_text, t2, div0, t4, updating_selected, t5, div1, t7, div2, t8, current;
function textbox_text_binding(value) {
ctx.textbox_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Title", hasError: !ctx.title };
if (ctx.title !== void 0) {
textbox_props.text = ctx.title;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding));
function dropdown_selected_binding(value_1) {
ctx.dropdown_selected_binding.call(null, value_1);
updating_selected = true;
add_flush_callback(() => updating_selected = false);
}
let dropdown_props = {
label: "App Entry Component",
options: ctx.components,
textMember: func
};
if (ctx.entryComponent !== void 0) {
dropdown_props.selected = ctx.entryComponent;
}
var dropdown = new Dropdown({ props: dropdown_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown, 'selected', dropdown_selected_binding));
var button = new Button({
props: {
$$slots: { default: [create_default_slot$4] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", ctx.save);
const block = {
c: function create() {
div3 = element("div");
h3 = element("h3");
t0 = text(t0_value);
t1 = space();
form = element("form");
textbox.$$.fragment.c();
t2 = space();
div0 = element("div");
div0.textContent = "The title of your page, displayed in the bowser tab";
t4 = space();
dropdown.$$.fragment.c();
t5 = space();
div1 = element("div");
div1.textContent = "The component that will be loaded into the body of the page";
t7 = space();
div2 = element("div");
t8 = space();
button.$$.fragment.c();
add_location(h3, file$p, 45, 4, 1138);
attr_dev(div0, "class", "help-text svelte-1ersoxu");
add_location(div0, file$p, 49, 8, 1288);
attr_dev(div1, "class", "help-text svelte-1ersoxu");
add_location(div1, file$p, 55, 8, 1554);
set_style(div2, "margin-top", "20px");
add_location(div2, file$p, 56, 8, 1651);
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$p, 47, 4, 1177);
attr_dev(div3, "class", "root svelte-1ersoxu");
add_location(div3, file$p, 43, 0, 1114);
},
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, div3, anchor);
append_dev(div3, h3);
append_dev(h3, t0);
append_dev(div3, t1);
append_dev(div3, form);
mount_component(textbox, form, null);
append_dev(form, t2);
append_dev(form, div0);
append_dev(form, t4);
mount_component(dropdown, form, null);
append_dev(form, t5);
append_dev(form, div1);
append_dev(form, t7);
append_dev(form, div2);
append_dev(form, t8);
mount_component(button, form, null);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.$store) && t0_value !== (t0_value = ctx.$store.currentPageName + "")) {
set_data_dev(t0, t0_value);
}
var textbox_changes = {};
if (changed.title) textbox_changes.hasError = !ctx.title;
if (!updating_text && changed.title) {
textbox_changes.text = ctx.title;
}
textbox.$set(textbox_changes);
var dropdown_changes = {};
if (changed.components) dropdown_changes.options = ctx.components;
if (!updating_selected && changed.entryComponent) {
dropdown_changes.selected = ctx.entryComponent;
}
dropdown.$set(dropdown_changes);
var button_changes = {};
if (changed.$$scope) button_changes.$$scope = { changed, ctx };
button.$set(button_changes);
},
i: function intro(local) {
if (current) return;
transition_in(textbox.$$.fragment, local);
transition_in(dropdown.$$.fragment, local);
transition_in(button.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(textbox.$$.fragment, local);
transition_out(dropdown.$$.fragment, local);
transition_out(button.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
destroy_component(textbox);
destroy_component(dropdown);
destroy_component(button);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$o.name, type: "component", source: "", ctx });
return block;
}
const func = (v) => v.name;
function instance$o($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let entryComponent;
let title = "";
let components = [];
let page={};
const notSeletedComponent = {name:"(none selected)"};
store.subscribe(s => {
page = s.pages[s.currentPageName];
if(!page) return;
$$invalidate('title', title = page.index.title);
$$invalidate('components', components = pipe$1(s.allComponents, [
fp_8(s => !isRootComponent(s)),
fp_34([notSeletedComponent])
]));
$$invalidate('entryComponent', entryComponent = fp_13(c => c.name === page.appBody)(components));
if(!entryComponent) $$invalidate('entryComponent', entryComponent = notSeletedComponent);
});
const save = () => {
if(!title || !entryComponent || entryComponent === notSeletedComponent) return;
const page = {
index: {
title
},
appBody: entryComponent.name,
};
store.savePage(page);
};
function textbox_text_binding(value) {
title = value;
$$invalidate('title', title);
}
function dropdown_selected_binding(value_1) {
entryComponent = value_1;
$$invalidate('entryComponent', entryComponent);
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('entryComponent' in $$props) $$invalidate('entryComponent', entryComponent = $$props.entryComponent);
if ('title' in $$props) $$invalidate('title', title = $$props.title);
if ('components' in $$props) $$invalidate('components', components = $$props.components);
if ('page' in $$props) page = $$props.page;
if ('$store' in $$props) store.set($store);
};
return {
entryComponent,
title,
components,
save,
$store,
textbox_text_binding,
dropdown_selected_binding
};
}
class PageView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$o, create_fragment$o, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PageView", options, id: create_fragment$o.name });
}
}
/* src\userInterface\UserInterfaceRoot.svelte generated by Svelte v3.12.1 */
const file$q = "src\\userInterface\\UserInterfaceRoot.svelte";
// (64:56)
function create_if_block_2$3(ctx) {
var current;
var pageview = new PageView({ $$inline: true });
const block = {
c: function create() {
pageview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(pageview, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(pageview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(pageview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(pageview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$3.name, type: "if", source: "(64:56) ", ctx });
return block;
}
// (62:8) {#if $store.currentFrontEndType === "component"}
function create_if_block_1$5(ctx) {
var current;
var currentitempreview = new CurrentItemPreview({ $$inline: true });
const block = {
c: function create() {
currentitempreview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(currentitempreview, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(currentitempreview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(currentitempreview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(currentitempreview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$5.name, type: "if", source: "(62:8) {#if $store.currentFrontEndType === \"component\"}", ctx });
return block;
}
// (69:4) {#if $store.currentFrontEndType === "component"}
function create_if_block$e(ctx) {
var div, current;
var editcomponent = new EditComponent({ $$inline: true });
const block = {
c: function create() {
div = element("div");
editcomponent.$$.fragment.c();
attr_dev(div, "class", "properties-pane svelte-rjo9m0");
add_location(div, file$q, 69, 4, 2106);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(editcomponent, div, null);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(editcomponent.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(editcomponent.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(editcomponent);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$e.name, type: "if", source: "(69:4) {#if $store.currentFrontEndType === \"component\"}", ctx });
return block;
}
function create_fragment$p(ctx) {
var div11, div9, div4, div2, div0, raw0_value = getIcon("sidebar","18") + "", t0, span0, t2, div1, t3, t4, div3, t5, div8, div6, div5, raw1_value = getIcon("grid","18") + "", t6, span1, t8, div7, t9, div10, current_block_type_index, if_block0, t10, t11, t12, current;
var iconbutton0 = new IconButton({
props: { icon: "settings", size: "14px" },
$$inline: true
});
iconbutton0.$on("click", ctx.settings);
var iconbutton1 = new IconButton({ props: { icon: "plus" }, $$inline: true });
iconbutton1.$on("click", ctx.newComponent);
var componentshierarchy = new ComponentsHierarchy({
props: { components: ctx.$store.derivedComponents },
$$inline: true
});
var pageslist = new PagesList({ $$inline: true });
var if_block_creators = [
create_if_block_1$5,
create_if_block_2$3
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.$store.currentFrontEndType === "component") return 0;
if (ctx.$store.currentFrontEndType === "page") return 1;
return -1;
}
if (~(current_block_type_index = select_block_type(null, ctx))) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
}
var if_block1 = (ctx.$store.currentFrontEndType === "component") && create_if_block$e(ctx);
let newcomponent_props = {};
var newcomponent = new NewComponent({
props: newcomponent_props,
$$inline: true
});
ctx.newcomponent_binding(newcomponent);
let settingsview_props = {};
var settingsview = new SettingsView({
props: settingsview_props,
$$inline: true
});
ctx.settingsview_binding(settingsview);
const block = {
c: function create() {
div11 = element("div");
div9 = element("div");
div4 = element("div");
div2 = element("div");
div0 = element("div");
t0 = space();
span0 = element("span");
span0.textContent = "Components";
t2 = space();
div1 = element("div");
iconbutton0.$$.fragment.c();
t3 = space();
iconbutton1.$$.fragment.c();
t4 = space();
div3 = element("div");
componentshierarchy.$$.fragment.c();
t5 = space();
div8 = element("div");
div6 = element("div");
div5 = element("div");
t6 = space();
span1 = element("span");
span1.textContent = "Pages";
t8 = space();
div7 = element("div");
pageslist.$$.fragment.c();
t9 = space();
div10 = element("div");
if (if_block0) if_block0.c();
t10 = space();
if (if_block1) if_block1.c();
t11 = space();
newcomponent.$$.fragment.c();
t12 = space();
settingsview.$$.fragment.c();
attr_dev(div0, "class", "svelte-rjo9m0");
add_location(div0, file$q, 33, 16, 942);
attr_dev(span0, "class", "components-nav-header svelte-rjo9m0");
add_location(span0, file$q, 34, 16, 1001);
attr_dev(div1, "class", "svelte-rjo9m0");
add_location(div1, file$q, 35, 16, 1071);
attr_dev(div2, "class", "nav-group-header svelte-rjo9m0");
add_location(div2, file$q, 32, 12, 895);
attr_dev(div3, "class", "nav-items-container svelte-rjo9m0");
add_location(div3, file$q, 43, 12, 1381);
attr_dev(div4, "class", "components-list-container");
add_location(div4, file$q, 31, 8, 843);
attr_dev(div5, "class", "svelte-rjo9m0");
add_location(div5, file$q, 50, 16, 1629);
attr_dev(span1, "class", "svelte-rjo9m0");
add_location(span1, file$q, 51, 16, 1685);
attr_dev(div6, "class", "nav-group-header svelte-rjo9m0");
add_location(div6, file$q, 49, 12, 1582);
attr_dev(div7, "class", "nav-items-container svelte-rjo9m0");
add_location(div7, file$q, 53, 12, 1735);
attr_dev(div8, "class", "pages-list-container svelte-rjo9m0");
add_location(div8, file$q, 48, 8, 1535);
attr_dev(div9, "class", "ui-nav svelte-rjo9m0");
add_location(div9, file$q, 29, 4, 813);
add_location(div10, file$q, 60, 4, 1850);
attr_dev(div11, "class", "root svelte-rjo9m0");
add_location(div11, file$q, 27, 0, 785);
},
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, div11, anchor);
append_dev(div11, div9);
append_dev(div9, div4);
append_dev(div4, div2);
append_dev(div2, div0);
div0.innerHTML = raw0_value;
append_dev(div2, t0);
append_dev(div2, span0);
append_dev(div2, t2);
append_dev(div2, div1);
mount_component(iconbutton0, div1, null);
append_dev(div1, t3);
mount_component(iconbutton1, div1, null);
append_dev(div4, t4);
append_dev(div4, div3);
mount_component(componentshierarchy, div3, null);
append_dev(div9, t5);
append_dev(div9, div8);
append_dev(div8, div6);
append_dev(div6, div5);
div5.innerHTML = raw1_value;
append_dev(div6, t6);
append_dev(div6, span1);
append_dev(div8, t8);
append_dev(div8, div7);
mount_component(pageslist, div7, null);
append_dev(div11, t9);
append_dev(div11, div10);
if (~current_block_type_index) if_blocks[current_block_type_index].m(div10, null);
append_dev(div11, t10);
if (if_block1) if_block1.m(div11, null);
insert_dev(target, t11, anchor);
mount_component(newcomponent, target, anchor);
insert_dev(target, t12, anchor);
mount_component(settingsview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var componentshierarchy_changes = {};
if (changed.$store) componentshierarchy_changes.components = ctx.$store.derivedComponents;
componentshierarchy.$set(componentshierarchy_changes);
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
if (if_block0) {
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_block0 = if_blocks[current_block_type_index];
if (!if_block0) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
if_block0.c();
}
transition_in(if_block0, 1);
if_block0.m(div10, null);
} else {
if_block0 = null;
}
}
if (ctx.$store.currentFrontEndType === "component") {
if (!if_block1) {
if_block1 = create_if_block$e(ctx);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(div11, null);
} else transition_in(if_block1, 1);
} else if (if_block1) {
group_outros();
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
check_outros();
}
var newcomponent_changes = {};
newcomponent.$set(newcomponent_changes);
var settingsview_changes = {};
settingsview.$set(settingsview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton0.$$.fragment, local);
transition_in(iconbutton1.$$.fragment, local);
transition_in(componentshierarchy.$$.fragment, local);
transition_in(pageslist.$$.fragment, local);
transition_in(if_block0);
transition_in(if_block1);
transition_in(newcomponent.$$.fragment, local);
transition_in(settingsview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(iconbutton0.$$.fragment, local);
transition_out(iconbutton1.$$.fragment, local);
transition_out(componentshierarchy.$$.fragment, local);
transition_out(pageslist.$$.fragment, local);
transition_out(if_block0);
transition_out(if_block1);
transition_out(newcomponent.$$.fragment, local);
transition_out(settingsview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div11);
}
destroy_component(iconbutton0);
destroy_component(iconbutton1);
destroy_component(componentshierarchy);
destroy_component(pageslist);
if (~current_block_type_index) if_blocks[current_block_type_index].d();
if (if_block1) if_block1.d();
if (detaching) {
detach_dev(t11);
}
ctx.newcomponent_binding(null);
destroy_component(newcomponent, detaching);
if (detaching) {
detach_dev(t12);
}
ctx.settingsview_binding(null);
destroy_component(settingsview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$p.name, type: "component", source: "", ctx });
return block;
}
function instance$p($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let newComponentPicker;
const newComponent = () => {
newComponentPicker.show();
};
let settingsView;
const settings = () => {
settingsView.show();
};
function newcomponent_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('newComponentPicker', newComponentPicker = $$value);
});
}
function settingsview_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('settingsView', settingsView = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('newComponentPicker' in $$props) $$invalidate('newComponentPicker', newComponentPicker = $$props.newComponentPicker);
if ('settingsView' in $$props) $$invalidate('settingsView', settingsView = $$props.settingsView);
if ('$store' in $$props) store.set($store);
};
return {
newComponentPicker,
newComponent,
settingsView,
settings,
$store,
newcomponent_binding,
settingsview_binding
};
}
class UserInterfaceRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$p, create_fragment$p, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "UserInterfaceRoot", options, id: create_fragment$p.name });
}
}
/* src\nav\HierarchyRow.svelte generated by Svelte v3.12.1 */
const file$r = "src\\nav\\HierarchyRow.svelte";
function get_each_context$b(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.index = list[i];
return child_ctx;
}
function get_each_context_1$7(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.child = list[i];
return child_ctx;
}
// (25:4) {#if node.children}
function create_if_block_1$6(ctx) {
var each_1_anchor, current;
let each_value_1 = ctx.node.children;
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1$7(get_each_context_1$7(ctx, each_value_1, 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();
},
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(changed, ctx) {
if (changed.node || changed.level) {
each_value_1 = ctx.node.children;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$7(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_1$7(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_1.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_1.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$6.name, type: "if", source: "(25:4) {#if node.children}", ctx });
return block;
}
// (26:8) {#each node.children as child}
function create_each_block_1$7(ctx) {
var current;
var hierarchyrow = new HierarchyRow({
props: {
node: ctx.child,
level: ctx.level+1,
type: "record"
},
$$inline: true
});
const block = {
c: function create() {
hierarchyrow.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(hierarchyrow, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var hierarchyrow_changes = {};
if (changed.node) hierarchyrow_changes.node = ctx.child;
if (changed.level) hierarchyrow_changes.level = ctx.level+1;
hierarchyrow.$set(hierarchyrow_changes);
},
i: function intro(local) {
if (current) return;
transition_in(hierarchyrow.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(hierarchyrow.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(hierarchyrow, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$7.name, type: "each", source: "(26:8) {#each node.children as child}", ctx });
return block;
}
// (32:4) {#if node.indexes}
function create_if_block$f(ctx) {
var each_1_anchor, current;
let each_value = ctx.node.indexes;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$b(get_each_context$b(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();
},
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(changed, ctx) {
if (changed.node || changed.level) {
each_value = ctx.node.indexes;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$b(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$b(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$f.name, type: "if", source: "(32:4) {#if node.indexes}", ctx });
return block;
}
// (33:8) {#each node.indexes as index}
function create_each_block$b(ctx) {
var current;
var hierarchyrow = new HierarchyRow({
props: {
node: ctx.index,
level: ctx.level+1,
type: "index"
},
$$inline: true
});
const block = {
c: function create() {
hierarchyrow.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(hierarchyrow, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var hierarchyrow_changes = {};
if (changed.node) hierarchyrow_changes.node = ctx.index;
if (changed.level) hierarchyrow_changes.level = ctx.level+1;
hierarchyrow.$set(hierarchyrow_changes);
},
i: function intro(local) {
if (current) return;
transition_in(hierarchyrow.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(hierarchyrow.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(hierarchyrow, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$b.name, type: "each", source: "(33:8) {#each node.indexes as index}", ctx });
return block;
}
function create_fragment$q(ctx) {
var div1, div0, html_tag, raw_value = getIcon(ctx.icon, 12) + "", t0, span, t1_value = ctx.node.name + "", t1, div0_class_value, t2, t3, current, dispose;
var if_block0 = (ctx.node.children) && create_if_block_1$6(ctx);
var if_block1 = (ctx.node.indexes) && create_if_block$f(ctx);
const block = {
c: function create() {
div1 = element("div");
div0 = element("div");
t0 = space();
span = element("span");
t1 = text(t1_value);
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
if (if_block1) if_block1.c();
html_tag = new HtmlTag(raw_value, t0);
set_style(span, "margin-left", "1rem");
add_location(span, file$r, 22, 34, 620);
attr_dev(div0, "class", div0_class_value = "title " + ctx.navActive + " svelte-17ju2r");
set_style(div0, "padding-left", "" + (20 + (ctx.level * 20)) + "px");
add_location(div0, file$r, 21, 4, 455);
attr_dev(div1, "class", "root svelte-17ju2r");
add_location(div1, file$r, 20, 0, 432);
dispose = listen_dev(div0, "click", ctx.click_handler);
},
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);
html_tag.m(div0);
append_dev(div0, t0);
append_dev(div0, span);
append_dev(span, t1);
append_dev(div1, t2);
if (if_block0) if_block0.m(div1, null);
append_dev(div1, t3);
if (if_block1) if_block1.m(div1, null);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.icon) && raw_value !== (raw_value = getIcon(ctx.icon, 12) + "")) {
html_tag.p(raw_value);
}
if ((!current || changed.node) && t1_value !== (t1_value = ctx.node.name + "")) {
set_data_dev(t1, t1_value);
}
if ((!current || changed.navActive) && div0_class_value !== (div0_class_value = "title " + ctx.navActive + " svelte-17ju2r")) {
attr_dev(div0, "class", div0_class_value);
}
if (!current || changed.level) {
set_style(div0, "padding-left", "" + (20 + (ctx.level * 20)) + "px");
}
if (ctx.node.children) {
if (if_block0) {
if_block0.p(changed, ctx);
transition_in(if_block0, 1);
} else {
if_block0 = create_if_block_1$6(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(div1, t3);
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if (ctx.node.indexes) {
if (if_block1) {
if_block1.p(changed, ctx);
transition_in(if_block1, 1);
} else {
if_block1 = create_if_block$f(ctx);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(div1, null);
}
} else if (if_block1) {
group_outros();
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
check_outros();
}
},
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 (detaching) {
detach_dev(div1);
}
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$q.name, type: "component", source: "", ctx });
return block;
}
function instance$q($$self, $$props, $$invalidate) {
let { level = 0, node, type } = $$props;
let navActive = "";
store.subscribe(s => {
if(s.currentNode)
$$invalidate('navActive', navActive = (s.activeNav === "database" && node.nodeId === s.currentNode.nodeId
? "active" : ""));
});
const writable_props = ['level', 'node', 'type'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<HierarchyRow> was created with unknown prop '${key}'`);
});
const click_handler = () => store.selectExistingNode(node.nodeId);
$$self.$set = $$props => {
if ('level' in $$props) $$invalidate('level', level = $$props.level);
if ('node' in $$props) $$invalidate('node', node = $$props.node);
if ('type' in $$props) $$invalidate('type', type = $$props.type);
};
$$self.$capture_state = () => {
return { level, node, type, navActive, icon };
};
$$self.$inject_state = $$props => {
if ('level' in $$props) $$invalidate('level', level = $$props.level);
if ('node' in $$props) $$invalidate('node', node = $$props.node);
if ('type' in $$props) $$invalidate('type', type = $$props.type);
if ('navActive' in $$props) $$invalidate('navActive', navActive = $$props.navActive);
if ('icon' in $$props) $$invalidate('icon', icon = $$props.icon);
};
let icon;
$$self.$$.update = ($$dirty = { type: 1 }) => {
if ($$dirty.type) { $$invalidate('icon', icon = type==="index" ? "list" : "file"); }
};
return {
level,
node,
type,
navActive,
icon,
click_handler
};
}
class HierarchyRow extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$q, create_fragment$q, safe_not_equal, ["level", "node", "type"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "HierarchyRow", options, id: create_fragment$q.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.node === undefined && !('node' in props)) {
console.warn("<HierarchyRow> was created without expected prop 'node'");
}
if (ctx.type === undefined && !('type' in props)) {
console.warn("<HierarchyRow> was created without expected prop 'type'");
}
}
get level() {
throw new Error("<HierarchyRow>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set level(value) {
throw new Error("<HierarchyRow>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get node() {
throw new Error("<HierarchyRow>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set node(value) {
throw new Error("<HierarchyRow>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get type() {
throw new Error("<HierarchyRow>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set type(value) {
throw new Error("<HierarchyRow>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\DropdownButton.svelte generated by Svelte v3.12.1 */
const file$s = "src\\common\\DropdownButton.svelte";
function get_each_context$c(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.action = list[i];
return child_ctx;
}
// (17:8) {#each actions as action}
function create_each_block$c(ctx) {
var div, t0_value = ctx.action.label + "", t0, t1, dispose;
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = space();
attr_dev(div, "class", "action-row svelte-11ifkop");
add_location(div, file$s, 17, 8, 569);
dispose = listen_dev(div, "click", ctx.action.onclick);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
append_dev(div, t1);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.actions) && t0_value !== (t0_value = ctx.action.label + "")) {
set_data_dev(t0, t0_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$c.name, type: "each", source: "(17:8) {#each actions as action}", ctx });
return block;
}
function create_fragment$r(ctx) {
var div2, html_tag, raw_value = getIcon(ctx.iconName) + "", t0, div0, t1, div1, dispose;
let each_value = ctx.actions;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$c(get_each_context$c(ctx, each_value, i));
}
const block = {
c: function create() {
div2 = element("div");
t0 = space();
div0 = element("div");
t1 = space();
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
html_tag = new HtmlTag(raw_value, t0);
attr_dev(div0, "class", "dropdown-background svelte-11ifkop");
set_style(div0, "display", (ctx.isDroppedDown ? 'block' : 'none'));
add_location(div0, file$s, 13, 4, 285);
attr_dev(div1, "class", "dropdown-content svelte-11ifkop");
set_style(div1, "display", (ctx.isDroppedDown ? 'inline-block' : 'none'));
add_location(div1, file$s, 15, 4, 437);
attr_dev(div2, "class", "root svelte-11ifkop");
add_location(div2, file$s, 10, 0, 179);
dispose = [
listen_dev(div0, "click", stop_propagation(ctx.click_handler), false, false, true),
listen_dev(div2, "click", ctx.click_handler_1)
];
},
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);
html_tag.m(div2);
append_dev(div2, t0);
append_dev(div2, div0);
append_dev(div2, t1);
append_dev(div2, div1);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
},
p: function update(changed, ctx) {
if ((changed.iconName) && raw_value !== (raw_value = getIcon(ctx.iconName) + "")) {
html_tag.p(raw_value);
}
if (changed.isDroppedDown) {
set_style(div0, "display", (ctx.isDroppedDown ? 'block' : 'none'));
}
if (changed.actions) {
each_value = ctx.actions;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$c(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$c(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;
}
if (changed.isDroppedDown) {
set_style(div1, "display", (ctx.isDroppedDown ? 'inline-block' : 'none'));
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_each(each_blocks, detaching);
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$r.name, type: "component", source: "", ctx });
return block;
}
function instance$r($$self, $$props, $$invalidate) {
let { iconName, actions = [] } = $$props; // [ {label: "Action Name", onclick: () => {...} } ]
let isDroppedDown = false;
const writable_props = ['iconName', 'actions'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<DropdownButton> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate('isDroppedDown', isDroppedDown = false);
const click_handler_1 = () => $$invalidate('isDroppedDown', isDroppedDown = !isDroppedDown);
$$self.$set = $$props => {
if ('iconName' in $$props) $$invalidate('iconName', iconName = $$props.iconName);
if ('actions' in $$props) $$invalidate('actions', actions = $$props.actions);
};
$$self.$capture_state = () => {
return { iconName, actions, isDroppedDown };
};
$$self.$inject_state = $$props => {
if ('iconName' in $$props) $$invalidate('iconName', iconName = $$props.iconName);
if ('actions' in $$props) $$invalidate('actions', actions = $$props.actions);
if ('isDroppedDown' in $$props) $$invalidate('isDroppedDown', isDroppedDown = $$props.isDroppedDown);
};
return {
iconName,
actions,
isDroppedDown,
click_handler,
click_handler_1
};
}
class DropdownButton extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$r, create_fragment$r, safe_not_equal, ["iconName", "actions"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "DropdownButton", options, id: create_fragment$r.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.iconName === undefined && !('iconName' in props)) {
console.warn("<DropdownButton> was created without expected prop 'iconName'");
}
}
get iconName() {
throw new Error("<DropdownButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set iconName(value) {
throw new Error("<DropdownButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get actions() {
throw new Error("<DropdownButton>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set actions(value) {
throw new Error("<DropdownButton>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\nav\NavItem.svelte generated by Svelte v3.12.1 */
const file$t = "src\\nav\\NavItem.svelte";
function create_fragment$s(ctx) {
var div, t, div_class_value, dispose;
const block = {
c: function create() {
div = element("div");
t = text(ctx.label);
attr_dev(div, "class", div_class_value = "nav-item " + ctx.navActive + " svelte-1i5jqm7");
add_location(div, file$t, 19, 0, 307);
dispose = listen_dev(div, "click", ctx.setActive);
},
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);
append_dev(div, t);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t, ctx.label);
}
if ((changed.navActive) && div_class_value !== (div_class_value = "nav-item " + ctx.navActive + " svelte-1i5jqm7")) {
attr_dev(div, "class", div_class_value);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$s.name, type: "component", source: "", ctx });
return block;
}
function instance$s($$self, $$props, $$invalidate) {
let { name = "", label = "" } = $$props;
let navActive = "";
store.subscribe(db => {
$$invalidate('navActive', navActive = (db.activeNav === name ? "active" : ""));
});
const setActive = () =>
store.setActiveNav(name);
const writable_props = ['name', 'label'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<NavItem> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('name' in $$props) $$invalidate('name', name = $$props.name);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
$$self.$capture_state = () => {
return { name, label, navActive };
};
$$self.$inject_state = $$props => {
if ('name' in $$props) $$invalidate('name', name = $$props.name);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('navActive' in $$props) $$invalidate('navActive', navActive = $$props.navActive);
};
return { name, label, navActive, setActive };
}
class NavItem extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$s, create_fragment$s, safe_not_equal, ["name", "label"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "NavItem", options, id: create_fragment$s.name });
}
get name() {
throw new Error("<NavItem>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set name(value) {
throw new Error("<NavItem>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<NavItem>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<NavItem>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\nav\BackendNav.svelte generated by Svelte v3.12.1 */
const file$u = "src\\nav\\BackendNav.svelte";
function get_each_context$d(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.index = list[i];
return child_ctx;
}
function get_each_context_1$8(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.record = list[i];
return child_ctx;
}
// (60:12) {#each $store.hierarchy.children as record}
function create_each_block_1$8(ctx) {
var current;
var hierarchyrow = new HierarchyRow({
props: { node: ctx.record, type: "record" },
$$inline: true
});
const block = {
c: function create() {
hierarchyrow.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(hierarchyrow, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var hierarchyrow_changes = {};
if (changed.$store) hierarchyrow_changes.node = ctx.record;
hierarchyrow.$set(hierarchyrow_changes);
},
i: function intro(local) {
if (current) return;
transition_in(hierarchyrow.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(hierarchyrow.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(hierarchyrow, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$8.name, type: "each", source: "(60:12) {#each $store.hierarchy.children as record}", ctx });
return block;
}
// (65:12) {#each $store.hierarchy.indexes as index}
function create_each_block$d(ctx) {
var current;
var hierarchyrow = new HierarchyRow({
props: { node: ctx.index, type: "index" },
$$inline: true
});
const block = {
c: function create() {
hierarchyrow.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(hierarchyrow, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var hierarchyrow_changes = {};
if (changed.$store) hierarchyrow_changes.node = ctx.index;
hierarchyrow.$set(hierarchyrow_changes);
},
i: function intro(local) {
if (current) return;
transition_in(hierarchyrow.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(hierarchyrow.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(hierarchyrow, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$d.name, type: "each", source: "(65:12) {#each $store.hierarchy.indexes as index}", ctx });
return block;
}
function create_fragment$t(ctx) {
var div6, div5, div3, div2, div0, raw_value = getIcon("database","18") + "", t0, div1, t2, t3, div4, t4, t5, t6, current;
var dropdownbutton = new DropdownButton({
props: { iconName: "plus", actions: ctx.newChildActions },
$$inline: true
});
let each_value_1 = ctx.$store.hierarchy.children;
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_1$8(get_each_context_1$8(ctx, each_value_1, i));
}
const out = i => transition_out(each_blocks_1[i], 1, 1, () => {
each_blocks_1[i] = null;
});
let each_value = ctx.$store.hierarchy.indexes;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$d(get_each_context$d(ctx, each_value, i));
}
const out_1 = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
var navitem0 = new NavItem({
props: {
name: "actions",
label: "Actions & Triggers"
},
$$inline: true
});
var navitem1 = new NavItem({
props: {
name: "access levels",
label: "User Levels"
},
$$inline: true
});
const block = {
c: function create() {
div6 = element("div");
div5 = element("div");
div3 = element("div");
div2 = element("div");
div0 = element("div");
t0 = space();
div1 = element("div");
div1.textContent = "Database";
t2 = space();
dropdownbutton.$$.fragment.c();
t3 = space();
div4 = element("div");
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t4 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t5 = space();
navitem0.$$.fragment.c();
t6 = space();
navitem1.$$.fragment.c();
attr_dev(div0, "class", "svelte-19lmivt");
add_location(div0, file$u, 52, 16, 1390);
attr_dev(div1, "class", "hierarchy-title svelte-19lmivt");
add_location(div1, file$u, 53, 16, 1450);
attr_dev(div2, "class", "nav-group-header svelte-19lmivt");
add_location(div2, file$u, 51, 12, 1343);
attr_dev(div3, "class", "components-list-container");
add_location(div3, file$u, 50, 8, 1291);
attr_dev(div4, "class", "hierarchy-items-container svelte-19lmivt");
add_location(div4, file$u, 58, 8, 1614);
attr_dev(div5, "class", "hierarchy svelte-19lmivt");
add_location(div5, file$u, 49, 4, 1259);
attr_dev(div6, "class", "items-root svelte-19lmivt");
add_location(div6, file$u, 48, 0, 1230);
},
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, div6, anchor);
append_dev(div6, div5);
append_dev(div5, div3);
append_dev(div3, div2);
append_dev(div2, div0);
div0.innerHTML = raw_value;
append_dev(div2, t0);
append_dev(div2, div1);
append_dev(div2, t2);
mount_component(dropdownbutton, div2, null);
append_dev(div5, t3);
append_dev(div5, div4);
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].m(div4, null);
}
append_dev(div4, t4);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div4, null);
}
append_dev(div6, t5);
mount_component(navitem0, div6, null);
append_dev(div6, t6);
mount_component(navitem1, div6, null);
current = true;
},
p: function update(changed, ctx) {
var dropdownbutton_changes = {};
if (changed.newChildActions) dropdownbutton_changes.actions = ctx.newChildActions;
dropdownbutton.$set(dropdownbutton_changes);
if (changed.$store) {
each_value_1 = ctx.$store.hierarchy.children;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$8(ctx, each_value_1, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(changed, child_ctx);
transition_in(each_blocks_1[i], 1);
} else {
each_blocks_1[i] = create_each_block_1$8(child_ctx);
each_blocks_1[i].c();
transition_in(each_blocks_1[i], 1);
each_blocks_1[i].m(div4, t4);
}
}
group_outros();
for (i = each_value_1.length; i < each_blocks_1.length; i += 1) {
out(i);
}
check_outros();
}
if (changed.$store) {
each_value = ctx.$store.hierarchy.indexes;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$d(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$d(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div4, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out_1(i);
}
check_outros();
}
},
i: function intro(local) {
if (current) return;
transition_in(dropdownbutton.$$.fragment, local);
for (let i = 0; i < each_value_1.length; i += 1) {
transition_in(each_blocks_1[i]);
}
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
transition_in(navitem0.$$.fragment, local);
transition_in(navitem1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(dropdownbutton.$$.fragment, local);
each_blocks_1 = each_blocks_1.filter(Boolean);
for (let i = 0; i < each_blocks_1.length; i += 1) {
transition_out(each_blocks_1[i]);
}
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
transition_out(navitem0.$$.fragment, local);
transition_out(navitem1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div6);
}
destroy_component(dropdownbutton);
destroy_each(each_blocks_1, detaching);
destroy_each(each_blocks, detaching);
destroy_component(navitem0);
destroy_component(navitem1);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$t.name, type: "component", source: "", ctx });
return block;
}
function instance$t($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
const defaultNewChildActions = [
{
label:"New Root Index",
onclick: store.newRootIndex
},
{
label:"New Root Record",
onclick: store.newRootRecord
}
];
let newChildActions = defaultNewChildActions;
store.subscribe(db => {
if(!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) {
$$invalidate('newChildActions', newChildActions = defaultNewChildActions);
} else {
$$invalidate('newChildActions', newChildActions = [
{label:"New Root Record",
onclick: store.newRootRecord},
{label: `New Child Record of ${db.currentNode.name}`,
onclick: store.newChildRecord},
{label:"New Root Index",
onclick: store.newRootIndex},
{label: `New Index on ${db.currentNode.name}`,
onclick: store.newChildIndex}
]);
}
});
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('newChildActions' in $$props) $$invalidate('newChildActions', newChildActions = $$props.newChildActions);
if ('$store' in $$props) store.set($store);
};
return { newChildActions, $store };
}
class BackendNav extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$t, create_fragment$t, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "BackendNav", options, id: create_fragment$t.name });
}
}
/* src\common\NumberBox.svelte generated by Svelte v3.12.1 */
const file$v = "src\\common\\NumberBox.svelte";
function create_fragment$u(ctx) {
var div1, label_1, t0, t1, div0, input, dispose;
const block = {
c: function create() {
div1 = element("div");
label_1 = element("label");
t0 = text(ctx.label);
t1 = space();
div0 = element("div");
input = element("input");
attr_dev(label_1, "class", "uk-form-label");
add_location(label_1, file$v, 20, 4, 313);
attr_dev(input, "class", "uk-input");
input.value = ctx.value;
add_location(input, file$v, 22, 8, 401);
attr_dev(div0, "class", "uk-form-controls");
add_location(div0, file$v, 21, 4, 362);
attr_dev(div1, "class", "uk-margin");
add_location(div1, file$v, 19, 0, 285);
dispose = listen_dev(input, "change", ctx.inputChanged);
},
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, label_1);
append_dev(label_1, t0);
append_dev(div1, t1);
append_dev(div1, div0);
append_dev(div0, input);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if (changed.value) {
prop_dev(input, "value", ctx.value);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$u.name, type: "component", source: "", ctx });
return block;
}
function instance$u($$self, $$props, $$invalidate) {
let { value, label } = $$props;
const inputChanged = ev => {
try {
$$invalidate('value', value = Number(ev.target.value));
} catch(_) {
$$invalidate('value', value = null);
}
};
let numberText = value === null || value === undefined
? "" : value.toString();
const writable_props = ['value', 'label'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<NumberBox> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
$$self.$capture_state = () => {
return { value, label, numberText };
};
$$self.$inject_state = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('numberText' in $$props) numberText = $$props.numberText;
};
return { value, label, inputChanged };
}
class NumberBox extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$u, create_fragment$u, safe_not_equal, ["value", "label"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "NumberBox", options, id: create_fragment$u.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.value === undefined && !('value' in props)) {
console.warn("<NumberBox> was created without expected prop 'value'");
}
if (ctx.label === undefined && !('label' in props)) {
console.warn("<NumberBox> was created without expected prop 'label'");
}
}
get value() {
throw new Error("<NumberBox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<NumberBox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<NumberBox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<NumberBox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\ValuesList.svelte generated by Svelte v3.12.1 */
const file$w = "src\\common\\ValuesList.svelte";
function create_fragment$v(ctx) {
var div1, label_1, t0, t1, div0, textarea, dispose;
const block = {
c: function create() {
div1 = element("div");
label_1 = element("label");
t0 = text(ctx.label);
t1 = space();
div0 = element("div");
textarea = element("textarea");
attr_dev(label_1, "class", "uk-form-label");
add_location(label_1, file$w, 21, 4, 290);
textarea.value = ctx.valuesText;
attr_dev(textarea, "class", "svelte-1kv2xk7");
add_location(textarea, file$w, 23, 8, 378);
attr_dev(div0, "class", "uk-form-controls");
add_location(div0, file$w, 22, 4, 339);
attr_dev(div1, "class", "uk-margin");
add_location(div1, file$w, 20, 0, 262);
dispose = listen_dev(textarea, "change", ctx.inputChanged);
},
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, label_1);
append_dev(label_1, t0);
append_dev(div1, t1);
append_dev(div1, div0);
append_dev(div0, textarea);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if (changed.valuesText) {
prop_dev(textarea, "value", ctx.valuesText);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$v.name, type: "component", source: "", ctx });
return block;
}
function instance$v($$self, $$props, $$invalidate) {
let { values, label } = $$props;
const inputChanged = ev => {
try {
$$invalidate('values', values = ev.target.value.split("\n"));
} catch(_) {
$$invalidate('values', values = []);
}
};
const writable_props = ['values', 'label'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ValuesList> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('values' in $$props) $$invalidate('values', values = $$props.values);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
$$self.$capture_state = () => {
return { values, label, valuesText };
};
$$self.$inject_state = $$props => {
if ('values' in $$props) $$invalidate('values', values = $$props.values);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('valuesText' in $$props) $$invalidate('valuesText', valuesText = $$props.valuesText);
};
let valuesText;
$$self.$$.update = ($$dirty = { values: 1 }) => {
if ($$dirty.values) { $$invalidate('valuesText', valuesText = fp_41("\n")(values)); }
};
return { values, label, inputChanged, valuesText };
}
class ValuesList extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$v, create_fragment$v, safe_not_equal, ["values", "label"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ValuesList", options, id: create_fragment$v.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.values === undefined && !('values' in props)) {
console.warn("<ValuesList> was created without expected prop 'values'");
}
if (ctx.label === undefined && !('label' in props)) {
console.warn("<ValuesList> was created without expected prop 'label'");
}
}
get values() {
throw new Error("<ValuesList>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set values(value) {
throw new Error("<ValuesList>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<ValuesList>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<ValuesList>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\common\ErrorsBox.svelte generated by Svelte v3.12.1 */
const file$x = "src\\common\\ErrorsBox.svelte";
function get_each_context$e(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.error = list[i];
return child_ctx;
}
// (7:0) {#if hasErrors}
function create_if_block$g(ctx) {
var div;
let each_value = ctx.errors;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$e(get_each_context$e(ctx, each_value, i));
}
const block = {
c: function create() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(div, "class", "error-container svelte-ole1mk");
add_location(div, file$x, 7, 0, 94);
},
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);
}
},
p: function update(changed, ctx) {
if (changed.errors) {
each_value = ctx.errors;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$e(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$e(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$g.name, type: "if", source: "(7:0) {#if hasErrors}", ctx });
return block;
}
// (9:4) {#each errors as error}
function create_each_block$e(ctx) {
var div, t0_value = ctx.error.field ? `${ctx.error.field}: ` : "" + "", t0, t1_value = ctx.error.error + "", t1;
const block = {
c: function create() {
div = element("div");
t0 = text(t0_value);
t1 = text(t1_value);
attr_dev(div, "class", "error-row svelte-ole1mk");
add_location(div, file$x, 9, 4, 156);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t0);
append_dev(div, t1);
},
p: function update(changed, ctx) {
if ((changed.errors) && t0_value !== (t0_value = ctx.error.field ? `${ctx.error.field}: ` : "" + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.errors) && t1_value !== (t1_value = ctx.error.error + "")) {
set_data_dev(t1, t1_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$e.name, type: "each", source: "(9:4) {#each errors as error}", ctx });
return block;
}
function create_fragment$w(ctx) {
var if_block_anchor;
var if_block = (ctx.hasErrors) && create_if_block$g(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
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);
},
p: function update(changed, ctx) {
if (ctx.hasErrors) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$g(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: noop,
o: noop,
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$w.name, type: "component", source: "", ctx });
return block;
}
function instance$w($$self, $$props, $$invalidate) {
let { errors = [] } = $$props;
const writable_props = ['errors'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ErrorsBox> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
};
$$self.$capture_state = () => {
return { errors, hasErrors };
};
$$self.$inject_state = $$props => {
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('hasErrors' in $$props) $$invalidate('hasErrors', hasErrors = $$props.hasErrors);
};
let hasErrors;
$$self.$$.update = ($$dirty = { errors: 1 }) => {
if ($$dirty.errors) { $$invalidate('hasErrors', hasErrors = errors.length > 0); }
};
return { errors, hasErrors };
}
class ErrorsBox extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$w, create_fragment$w, safe_not_equal, ["errors"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ErrorsBox", options, id: create_fragment$w.name });
}
get errors() {
throw new Error("<ErrorsBox>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set errors(value) {
throw new Error("<ErrorsBox>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
var flatpickr = createCommonjsModule(function (module, exports) {
/* flatpickr v4.6.2, @license MIT */
(function (global, factory) {
module.exports = factory() ;
}(commonjsGlobal, function () {
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
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);
};
var HOOKS = [
"onChange",
"onClose",
"onDayCreate",
"onDestroy",
"onKeyDown",
"onMonthChange",
"onOpen",
"onParseConfig",
"onReady",
"onValueUpdate",
"onYearChange",
"onPreCalendarPosition",
];
var defaults = {
_disable: [],
_enable: [],
allowInput: false,
altFormat: "F j, Y",
altInput: false,
altInputClass: "form-control input",
animate: typeof window === "object" &&
window.navigator.userAgent.indexOf("MSIE") === -1,
ariaDateFormat: "F j, Y",
clickOpens: true,
closeOnSelect: true,
conjunction: ", ",
dateFormat: "Y-m-d",
defaultHour: 12,
defaultMinute: 0,
defaultSeconds: 0,
disable: [],
disableMobile: false,
enable: [],
enableSeconds: false,
enableTime: false,
errorHandler: function (err) {
return typeof console !== "undefined" && console.warn(err);
},
getWeek: function (givenDate) {
var date = new Date(givenDate.getTime());
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
// January 4 is always in week 1.
var week1 = new Date(date.getFullYear(), 0, 4);
// Adjust to Thursday in week 1 and count number of weeks from date to week1.
return (1 +
Math.round(((date.getTime() - week1.getTime()) / 86400000 -
3 +
((week1.getDay() + 6) % 7)) /
7));
},
hourIncrement: 1,
ignoredFocusElements: [],
inline: false,
locale: "default",
minuteIncrement: 5,
mode: "single",
monthSelectorType: "dropdown",
nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
noCalendar: false,
now: new Date(),
onChange: [],
onClose: [],
onDayCreate: [],
onDestroy: [],
onKeyDown: [],
onMonthChange: [],
onOpen: [],
onParseConfig: [],
onReady: [],
onValueUpdate: [],
onYearChange: [],
onPreCalendarPosition: [],
plugins: [],
position: "auto",
positionElement: undefined,
prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
shorthandCurrentMonth: false,
showMonths: 1,
static: false,
time_24hr: false,
weekNumbers: false,
wrap: false
};
var english = {
weekdays: {
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
longhand: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
]
},
months: {
shorthand: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
longhand: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
]
},
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
firstDayOfWeek: 0,
ordinal: function (nth) {
var s = nth % 100;
if (s > 3 && s < 21)
return "th";
switch (s % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
},
rangeSeparator: " to ",
weekAbbreviation: "Wk",
scrollTitle: "Scroll to increment",
toggleTitle: "Click to toggle",
amPM: ["AM", "PM"],
yearAriaLabel: "Year",
hourAriaLabel: "Hour",
minuteAriaLabel: "Minute",
time_24hr: false
};
var pad = function (number) { return ("0" + number).slice(-2); };
var int = function (bool) { return (bool === true ? 1 : 0); };
/* istanbul ignore next */
function debounce(func, wait, immediate) {
if (immediate === void 0) { immediate = false; }
var timeout;
return function () {
var context = this, args = arguments;
timeout !== null && clearTimeout(timeout);
timeout = window.setTimeout(function () {
timeout = null;
if (!immediate)
func.apply(context, args);
}, wait);
if (immediate && !timeout)
func.apply(context, args);
};
}
var arrayify = function (obj) {
return obj instanceof Array ? obj : [obj];
};
function toggleClass(elem, className, bool) {
if (bool === true)
return elem.classList.add(className);
elem.classList.remove(className);
}
function createElement(tag, className, content) {
var e = window.document.createElement(tag);
className = className || "";
content = content || "";
e.className = className;
if (content !== undefined)
e.textContent = content;
return e;
}
function clearNode(node) {
while (node.firstChild)
node.removeChild(node.firstChild);
}
function findParent(node, condition) {
if (condition(node))
return node;
else if (node.parentNode)
return findParent(node.parentNode, condition);
return undefined; // nothing found
}
function createNumberInput(inputClassName, opts) {
var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
numInput.type = "number";
}
else {
numInput.type = "text";
numInput.pattern = "\\d*";
}
if (opts !== undefined)
for (var key in opts)
numInput.setAttribute(key, opts[key]);
wrapper.appendChild(numInput);
wrapper.appendChild(arrowUp);
wrapper.appendChild(arrowDown);
return wrapper;
}
function getEventTarget(event) {
if (typeof event.composedPath === "function") {
var path = event.composedPath();
return path[0];
}
return event.target;
}
var doNothing = function () { return undefined; };
var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
var revFormat = {
D: doNothing,
F: function (dateObj, monthName, locale) {
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
},
G: function (dateObj, hour) {
dateObj.setHours(parseFloat(hour));
},
H: function (dateObj, hour) {
dateObj.setHours(parseFloat(hour));
},
J: function (dateObj, day) {
dateObj.setDate(parseFloat(day));
},
K: function (dateObj, amPM, locale) {
dateObj.setHours((dateObj.getHours() % 12) +
12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
},
M: function (dateObj, shortMonth, locale) {
dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
},
S: function (dateObj, seconds) {
dateObj.setSeconds(parseFloat(seconds));
},
U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
W: function (dateObj, weekNum, locale) {
var weekNumber = parseInt(weekNum);
var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
return date;
},
Y: function (dateObj, year) {
dateObj.setFullYear(parseFloat(year));
},
Z: function (_, ISODate) { return new Date(ISODate); },
d: function (dateObj, day) {
dateObj.setDate(parseFloat(day));
},
h: function (dateObj, hour) {
dateObj.setHours(parseFloat(hour));
},
i: function (dateObj, minutes) {
dateObj.setMinutes(parseFloat(minutes));
},
j: function (dateObj, day) {
dateObj.setDate(parseFloat(day));
},
l: doNothing,
m: function (dateObj, month) {
dateObj.setMonth(parseFloat(month) - 1);
},
n: function (dateObj, month) {
dateObj.setMonth(parseFloat(month) - 1);
},
s: function (dateObj, seconds) {
dateObj.setSeconds(parseFloat(seconds));
},
u: function (_, unixMillSeconds) {
return new Date(parseFloat(unixMillSeconds));
},
w: doNothing,
y: function (dateObj, year) {
dateObj.setFullYear(2000 + parseFloat(year));
}
};
var tokenRegex = {
D: "(\\w+)",
F: "(\\w+)",
G: "(\\d\\d|\\d)",
H: "(\\d\\d|\\d)",
J: "(\\d\\d|\\d)\\w+",
K: "",
M: "(\\w+)",
S: "(\\d\\d|\\d)",
U: "(.+)",
W: "(\\d\\d|\\d)",
Y: "(\\d{4})",
Z: "(.+)",
d: "(\\d\\d|\\d)",
h: "(\\d\\d|\\d)",
i: "(\\d\\d|\\d)",
j: "(\\d\\d|\\d)",
l: "(\\w+)",
m: "(\\d\\d|\\d)",
n: "(\\d\\d|\\d)",
s: "(\\d\\d|\\d)",
u: "(.+)",
w: "(\\d\\d|\\d)",
y: "(\\d{2})"
};
var formats = {
// get the date in UTC
Z: function (date) { return date.toISOString(); },
// weekday name, short, e.g. Thu
D: function (date, locale, options) {
return locale.weekdays.shorthand[formats.w(date, locale, options)];
},
// full month name e.g. January
F: function (date, locale, options) {
return monthToStr(formats.n(date, locale, options) - 1, false, locale);
},
// padded hour 1-12
G: function (date, locale, options) {
return pad(formats.h(date, locale, options));
},
// hours with leading zero e.g. 03
H: function (date) { return pad(date.getHours()); },
// day (1-30) with ordinal suffix e.g. 1st, 2nd
J: function (date, locale) {
return locale.ordinal !== undefined
? date.getDate() + locale.ordinal(date.getDate())
: date.getDate();
},
// AM/PM
K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
// shorthand month e.g. Jan, Sep, Oct, etc
M: function (date, locale) {
return monthToStr(date.getMonth(), true, locale);
},
// seconds 00-59
S: function (date) { return pad(date.getSeconds()); },
// unix timestamp
U: function (date) { return date.getTime() / 1000; },
W: function (date, _, options) {
return options.getWeek(date);
},
// full year e.g. 2016
Y: function (date) { return date.getFullYear(); },
// day in month, padded (01-30)
d: function (date) { return pad(date.getDate()); },
// hour from 1-12 (am/pm)
h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
// minutes, padded with leading zero e.g. 09
i: function (date) { return pad(date.getMinutes()); },
// day in month (1-30)
j: function (date) { return date.getDate(); },
// weekday name, full, e.g. Thursday
l: function (date, locale) {
return locale.weekdays.longhand[date.getDay()];
},
// padded month number (01-12)
m: function (date) { return pad(date.getMonth() + 1); },
// the month number (1-12)
n: function (date) { return date.getMonth() + 1; },
// seconds 0-59
s: function (date) { return date.getSeconds(); },
// Unix Milliseconds
u: function (date) { return date.getTime(); },
// number of the day of the week
w: function (date) { return date.getDay(); },
// last two digits of year e.g. 16 for 2016
y: function (date) { return String(date.getFullYear()).substring(2); }
};
var createDateFormatter = function (_a) {
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
return function (dateObj, frmt, overrideLocale) {
var locale = overrideLocale || l10n;
if (config.formatDate !== undefined) {
return config.formatDate(dateObj, frmt, locale);
}
return frmt
.split("")
.map(function (c, i, arr) {
return formats[c] && arr[i - 1] !== "\\"
? formats[c](dateObj, locale, config)
: c !== "\\"
? c
: "";
})
.join("");
};
};
var createDateParser = function (_a) {
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
return function (date, givenFormat, timeless, customLocale) {
if (date !== 0 && !date)
return undefined;
var locale = customLocale || l10n;
var parsedDate;
var dateOrig = date;
if (date instanceof Date)
parsedDate = new Date(date.getTime());
else if (typeof date !== "string" &&
date.toFixed !== undefined // timestamp
)
// create a copy
parsedDate = new Date(date);
else if (typeof date === "string") {
// date string
var format = givenFormat || (config || defaults).dateFormat;
var datestr = String(date).trim();
if (datestr === "today") {
parsedDate = new Date();
timeless = true;
}
else if (/Z$/.test(datestr) ||
/GMT$/.test(datestr) // datestrings w/ timezone
)
parsedDate = new Date(date);
else if (config && config.parseDate)
parsedDate = config.parseDate(date, format);
else {
parsedDate =
!config || !config.noCalendar
? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
: new Date(new Date().setHours(0, 0, 0, 0));
var matched = void 0, ops = [];
for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
var token_1 = format[i];
var isBackSlash = token_1 === "\\";
var escaped = format[i - 1] === "\\" || isBackSlash;
if (tokenRegex[token_1] && !escaped) {
regexStr += tokenRegex[token_1];
var match = new RegExp(regexStr).exec(date);
if (match && (matched = true)) {
ops[token_1 !== "Y" ? "push" : "unshift"]({
fn: revFormat[token_1],
val: match[++matchIndex]
});
}
}
else if (!isBackSlash)
regexStr += "."; // don't really care
ops.forEach(function (_a) {
var fn = _a.fn, val = _a.val;
return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
});
}
parsedDate = matched ? parsedDate : undefined;
}
}
/* istanbul ignore next */
if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
config.errorHandler(new Error("Invalid date provided: " + dateOrig));
return undefined;
}
if (timeless === true)
parsedDate.setHours(0, 0, 0, 0);
return parsedDate;
};
};
/**
* Compute the difference in dates, measured in ms
*/
function compareDates(date1, date2, timeless) {
if (timeless === void 0) { timeless = true; }
if (timeless !== false) {
return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
new Date(date2.getTime()).setHours(0, 0, 0, 0));
}
return date1.getTime() - date2.getTime();
}
var isBetween = function (ts, ts1, ts2) {
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
};
var duration = {
DAY: 86400000
};
if (typeof Object.assign !== "function") {
Object.assign = function (target) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (!target) {
throw TypeError("Cannot convert undefined or null to object");
}
var _loop_1 = function (source) {
if (source) {
Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
}
};
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
var source = args_1[_a];
_loop_1(source);
}
return target;
};
}
var DEBOUNCED_CHANGE_MS = 300;
function FlatpickrInstance(element, instanceConfig) {
var self = {
config: __assign({}, defaults, flatpickr.defaultConfig),
l10n: english
};
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
self._handlers = [];
self.pluginElements = [];
self.loadedPlugins = [];
self._bind = bind;
self._setHoursFromDate = setHoursFromDate;
self._positionCalendar = positionCalendar;
self.changeMonth = changeMonth;
self.changeYear = changeYear;
self.clear = clear;
self.close = close;
self._createElement = createElement;
self.destroy = destroy;
self.isEnabled = isEnabled;
self.jumpToDate = jumpToDate;
self.open = open;
self.redraw = redraw;
self.set = set;
self.setDate = setDate;
self.toggle = toggle;
function setupHelperFunctions() {
self.utils = {
getDaysInMonth: function (month, yr) {
if (month === void 0) { month = self.currentMonth; }
if (yr === void 0) { yr = self.currentYear; }
if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
return 29;
return self.l10n.daysInMonth[month];
}
};
}
function init() {
self.element = self.input = element;
self.isOpen = false;
parseConfig();
setupLocale();
setupInputs();
setupDates();
setupHelperFunctions();
if (!self.isMobile)
build();
bindEvents();
if (self.selectedDates.length || self.config.noCalendar) {
if (self.config.enableTime) {
setHoursFromDate(self.config.noCalendar
? self.latestSelectedDateObj || self.config.minDate
: undefined);
}
updateValue(false);
}
setCalendarWidth();
self.showTimeInput =
self.selectedDates.length > 0 || self.config.noCalendar;
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
/* TODO: investigate this further
Currently, there is weird positioning behavior in safari causing pages
to scroll up. https://github.com/chmln/flatpickr/issues/563
However, most browsers are not Safari and positioning is expensive when used
in scale. https://github.com/chmln/flatpickr/issues/1096
*/
if (!self.isMobile && isSafari) {
positionCalendar();
}
triggerEvent("onReady");
}
function bindToInstance(fn) {
return fn.bind(self);
}
function setCalendarWidth() {
var config = self.config;
if (config.weekNumbers === false && config.showMonths === 1)
return;
else if (config.noCalendar !== true) {
window.requestAnimationFrame(function () {
if (self.calendarContainer !== undefined) {
self.calendarContainer.style.visibility = "hidden";
self.calendarContainer.style.display = "block";
}
if (self.daysContainer !== undefined) {
var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
self.daysContainer.style.width = daysWidth + "px";
self.calendarContainer.style.width =
daysWidth +
(self.weekWrapper !== undefined
? self.weekWrapper.offsetWidth
: 0) +
"px";
self.calendarContainer.style.removeProperty("visibility");
self.calendarContainer.style.removeProperty("display");
}
});
}
}
/**
* The handler for all events targeting the time inputs
*/
function updateTime(e) {
if (self.selectedDates.length === 0) {
setDefaultTime();
}
if (e !== undefined && e.type !== "blur") {
timeWrapper(e);
}
var prevValue = self._input.value;
setHoursFromInputs();
updateValue();
if (self._input.value !== prevValue) {
self._debouncedChange();
}
}
function ampm2military(hour, amPM) {
return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);
}
function military2ampm(hour) {
switch (hour % 24) {
case 0:
case 12:
return 12;
default:
return hour % 12;
}
}
/**
* Syncs the selected date object time with user's time input
*/
function setHoursFromInputs() {
if (self.hourElement === undefined || self.minuteElement === undefined)
return;
var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
? (parseInt(self.secondElement.value, 10) || 0) % 60
: 0;
if (self.amPM !== undefined) {
hours = ampm2military(hours, self.amPM.textContent);
}
var limitMinHours = self.config.minTime !== undefined ||
(self.config.minDate &&
self.minDateHasTime &&
self.latestSelectedDateObj &&
compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
0);
var limitMaxHours = self.config.maxTime !== undefined ||
(self.config.maxDate &&
self.maxDateHasTime &&
self.latestSelectedDateObj &&
compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
0);
if (limitMaxHours) {
var maxTime = self.config.maxTime !== undefined
? self.config.maxTime
: self.config.maxDate;
hours = Math.min(hours, maxTime.getHours());
if (hours === maxTime.getHours())
minutes = Math.min(minutes, maxTime.getMinutes());
if (minutes === maxTime.getMinutes())
seconds = Math.min(seconds, maxTime.getSeconds());
}
if (limitMinHours) {
var minTime = self.config.minTime !== undefined
? self.config.minTime
: self.config.minDate;
hours = Math.max(hours, minTime.getHours());
if (hours === minTime.getHours())
minutes = Math.max(minutes, minTime.getMinutes());
if (minutes === minTime.getMinutes())
seconds = Math.max(seconds, minTime.getSeconds());
}
setHours(hours, minutes, seconds);
}
/**
* Syncs time input values with a date
*/
function setHoursFromDate(dateObj) {
var date = dateObj || self.latestSelectedDateObj;
if (date)
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
}
function setDefaultHours() {
var hours = self.config.defaultHour;
var minutes = self.config.defaultMinute;
var seconds = self.config.defaultSeconds;
if (self.config.minDate !== undefined) {
var minHr = self.config.minDate.getHours();
var minMinutes = self.config.minDate.getMinutes();
hours = Math.max(hours, minHr);
if (hours === minHr)
minutes = Math.max(minMinutes, minutes);
if (hours === minHr && minutes === minMinutes)
seconds = self.config.minDate.getSeconds();
}
if (self.config.maxDate !== undefined) {
var maxHr = self.config.maxDate.getHours();
var maxMinutes = self.config.maxDate.getMinutes();
hours = Math.min(hours, maxHr);
if (hours === maxHr)
minutes = Math.min(maxMinutes, minutes);
if (hours === maxHr && minutes === maxMinutes)
seconds = self.config.maxDate.getSeconds();
}
setHours(hours, minutes, seconds);
}
/**
* Sets the hours, minutes, and optionally seconds
* of the latest selected date object and the
* corresponding time inputs
* @param {Number} hours the hour. whether its military
* or am-pm gets inferred from config
* @param {Number} minutes the minutes
* @param {Number} seconds the seconds (optional)
*/
function setHours(hours, minutes, seconds) {
if (self.latestSelectedDateObj !== undefined) {
self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
}
if (!self.hourElement || !self.minuteElement || self.isMobile)
return;
self.hourElement.value = pad(!self.config.time_24hr
? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)
: hours);
self.minuteElement.value = pad(minutes);
if (self.amPM !== undefined)
self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
if (self.secondElement !== undefined)
self.secondElement.value = pad(seconds);
}
/**
* Handles the year input and incrementing events
* @param {Event} event the keyup or increment event
*/
function onYearInput(event) {
var year = parseInt(event.target.value) + (event.delta || 0);
if (year / 1000 > 1 ||
(event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
changeYear(year);
}
}
/**
* Essentially addEventListener + tracking
* @param {Element} element the element to addEventListener to
* @param {String} event the event name
* @param {Function} handler the event handler
*/
function bind(element, event, handler, options) {
if (event instanceof Array)
return event.forEach(function (ev) { return bind(element, ev, handler, options); });
if (element instanceof Array)
return element.forEach(function (el) { return bind(el, event, handler, options); });
element.addEventListener(event, handler, options);
self._handlers.push({
element: element,
event: event,
handler: handler,
options: options
});
}
/**
* A mousedown handler which mimics click.
* Minimizes latency, since we don't need to wait for mouseup in most cases.
* Also, avoids handling right clicks.
*
* @param {Function} handler the event handler
*/
function onClick(handler) {
return function (evt) {
evt.which === 1 && handler(evt);
};
}
function triggerChange() {
triggerEvent("onChange");
}
/**
* Adds all the necessary event listeners
*/
function bindEvents() {
if (self.config.wrap) {
["open", "close", "toggle", "clear"].forEach(function (evt) {
Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) {
return bind(el, "click", self[evt]);
});
});
}
if (self.isMobile) {
setupMobile();
return;
}
var debouncedResize = debounce(onResize, 50);
self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);
if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
bind(self.daysContainer, "mouseover", function (e) {
if (self.config.mode === "range")
onMouseOver(e.target);
});
bind(window.document.body, "keydown", onKeyDown);
if (!self.config.inline && !self.config.static)
bind(window, "resize", debouncedResize);
if (window.ontouchstart !== undefined)
bind(window.document, "touchstart", documentClick);
else
bind(window.document, "mousedown", onClick(documentClick));
bind(window.document, "focus", documentClick, { capture: true });
if (self.config.clickOpens === true) {
bind(self._input, "focus", self.open);
bind(self._input, "mousedown", onClick(self.open));
}
if (self.daysContainer !== undefined) {
bind(self.monthNav, "mousedown", onClick(onMonthNavClick));
bind(self.monthNav, ["keyup", "increment"], onYearInput);
bind(self.daysContainer, "mousedown", onClick(selectDate));
}
if (self.timeContainer !== undefined &&
self.minuteElement !== undefined &&
self.hourElement !== undefined) {
var selText = function (e) {
return e.target.select();
};
bind(self.timeContainer, ["increment"], updateTime);
bind(self.timeContainer, "blur", updateTime, { capture: true });
bind(self.timeContainer, "mousedown", onClick(timeIncrement));
bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
if (self.secondElement !== undefined)
bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
if (self.amPM !== undefined) {
bind(self.amPM, "mousedown", onClick(function (e) {
updateTime(e);
triggerChange();
}));
}
}
}
/**
* Set the calendar view to a particular date.
* @param {Date} jumpDate the date to set the view to
* @param {boolean} triggerChange if change events should be triggered
*/
function jumpToDate(jumpDate, triggerChange) {
var jumpTo = jumpDate !== undefined
? self.parseDate(jumpDate)
: self.latestSelectedDateObj ||
(self.config.minDate && self.config.minDate > self.now
? self.config.minDate
: self.config.maxDate && self.config.maxDate < self.now
? self.config.maxDate
: self.now);
var oldYear = self.currentYear;
var oldMonth = self.currentMonth;
try {
if (jumpTo !== undefined) {
self.currentYear = jumpTo.getFullYear();
self.currentMonth = jumpTo.getMonth();
}
}
catch (e) {
/* istanbul ignore next */
e.message = "Invalid date supplied: " + jumpTo;
self.config.errorHandler(e);
}
if (triggerChange && self.currentYear !== oldYear) {
triggerEvent("onYearChange");
buildMonthSwitch();
}
if (triggerChange &&
(self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
triggerEvent("onMonthChange");
}
self.redraw();
}
/**
* The up/down arrow handler for time inputs
* @param {Event} e the click event
*/
function timeIncrement(e) {
if (~e.target.className.indexOf("arrow"))
incrementNumInput(e, e.target.classList.contains("arrowUp") ? 1 : -1);
}
/**
* Increments/decrements the value of input associ-
* ated with the up/down arrow by dispatching an
* "increment" event on the input.
*
* @param {Event} e the click event
* @param {Number} delta the diff (usually 1 or -1)
* @param {Element} inputElem the input element
*/
function incrementNumInput(e, delta, inputElem) {
var target = e && e.target;
var input = inputElem ||
(target && target.parentNode && target.parentNode.firstChild);
var event = createEvent("increment");
event.delta = delta;
input && input.dispatchEvent(event);
}
function build() {
var fragment = window.document.createDocumentFragment();
self.calendarContainer = createElement("div", "flatpickr-calendar");
self.calendarContainer.tabIndex = -1;
if (!self.config.noCalendar) {
fragment.appendChild(buildMonthNav());
self.innerContainer = createElement("div", "flatpickr-innerContainer");
if (self.config.weekNumbers) {
var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
self.innerContainer.appendChild(weekWrapper);
self.weekNumbers = weekNumbers;
self.weekWrapper = weekWrapper;
}
self.rContainer = createElement("div", "flatpickr-rContainer");
self.rContainer.appendChild(buildWeekdays());
if (!self.daysContainer) {
self.daysContainer = createElement("div", "flatpickr-days");
self.daysContainer.tabIndex = -1;
}
buildDays();
self.rContainer.appendChild(self.daysContainer);
self.innerContainer.appendChild(self.rContainer);
fragment.appendChild(self.innerContainer);
}
if (self.config.enableTime) {
fragment.appendChild(buildTime());
}
toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
toggleClass(self.calendarContainer, "animate", self.config.animate === true);
toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
self.calendarContainer.appendChild(fragment);
var customAppend = self.config.appendTo !== undefined &&
self.config.appendTo.nodeType !== undefined;
if (self.config.inline || self.config.static) {
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
if (self.config.inline) {
if (!customAppend && self.element.parentNode)
self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
else if (self.config.appendTo !== undefined)
self.config.appendTo.appendChild(self.calendarContainer);
}
if (self.config.static) {
var wrapper = createElement("div", "flatpickr-wrapper");
if (self.element.parentNode)
self.element.parentNode.insertBefore(wrapper, self.element);
wrapper.appendChild(self.element);
if (self.altInput)
wrapper.appendChild(self.altInput);
wrapper.appendChild(self.calendarContainer);
}
}
if (!self.config.static && !self.config.inline)
(self.config.appendTo !== undefined
? self.config.appendTo
: window.document.body).appendChild(self.calendarContainer);
}
function createDay(className, date, dayNumber, i) {
var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString());
dayElement.dateObj = date;
dayElement.$i = i;
dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
if (className.indexOf("hidden") === -1 &&
compareDates(date, self.now) === 0) {
self.todayDateElem = dayElement;
dayElement.classList.add("today");
dayElement.setAttribute("aria-current", "date");
}
if (dateIsEnabled) {
dayElement.tabIndex = -1;
if (isDateSelected(date)) {
dayElement.classList.add("selected");
self.selectedDateElem = dayElement;
if (self.config.mode === "range") {
toggleClass(dayElement, "startRange", self.selectedDates[0] &&
compareDates(date, self.selectedDates[0], true) === 0);
toggleClass(dayElement, "endRange", self.selectedDates[1] &&
compareDates(date, self.selectedDates[1], true) === 0);
if (className === "nextMonthDay")
dayElement.classList.add("inRange");
}
}
}
else {
dayElement.classList.add("flatpickr-disabled");
}
if (self.config.mode === "range") {
if (isDateInRange(date) && !isDateSelected(date))
dayElement.classList.add("inRange");
}
if (self.weekNumbers &&
self.config.showMonths === 1 &&
className !== "prevMonthDay" &&
dayNumber % 7 === 1) {
self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
}
triggerEvent("onDayCreate", dayElement);
return dayElement;
}
function focusOnDayElem(targetNode) {
targetNode.focus();
if (self.config.mode === "range")
onMouseOver(targetNode);
}
function getFirstAvailableDay(delta) {
var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
var endMonth = delta > 0 ? self.config.showMonths : -1;
for (var m = startMonth; m != endMonth; m += delta) {
var month = self.daysContainer.children[m];
var startIndex = delta > 0 ? 0 : month.children.length - 1;
var endIndex = delta > 0 ? month.children.length : -1;
for (var i = startIndex; i != endIndex; i += delta) {
var c = month.children[i];
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
return c;
}
}
return undefined;
}
function getNextAvailableDay(current, delta) {
var givenMonth = current.className.indexOf("Month") === -1
? current.dateObj.getMonth()
: self.currentMonth;
var endMonth = delta > 0 ? self.config.showMonths : -1;
var loopDelta = delta > 0 ? 1 : -1;
for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
var month = self.daysContainer.children[m];
var startIndex = givenMonth - self.currentMonth === m
? current.$i + delta
: delta < 0
? month.children.length - 1
: 0;
var numMonthDays = month.children.length;
for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
var c = month.children[i];
if (c.className.indexOf("hidden") === -1 &&
isEnabled(c.dateObj) &&
Math.abs(current.$i - i) >= Math.abs(delta))
return focusOnDayElem(c);
}
}
self.changeMonth(loopDelta);
focusOnDay(getFirstAvailableDay(loopDelta), 0);
return undefined;
}
function focusOnDay(current, offset) {
var dayFocused = isInView(document.activeElement || document.body);
var startElem = current !== undefined
? current
: dayFocused
? document.activeElement
: self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
? self.selectedDateElem
: self.todayDateElem !== undefined && isInView(self.todayDateElem)
? self.todayDateElem
: getFirstAvailableDay(offset > 0 ? 1 : -1);
if (startElem === undefined)
return self._input.focus();
if (!dayFocused)
return focusOnDayElem(startElem);
getNextAvailableDay(startElem, offset);
}
function buildMonthDays(year, month) {
var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);
var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
// prepend days from the ending of previous month
for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
}
// Start at 1 since there is no 0th day
for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
}
// append days from the next month
for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
(self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
}
//updateNavigationCurrentMonth();
var dayContainer = createElement("div", "dayContainer");
dayContainer.appendChild(days);
return dayContainer;
}
function buildDays() {
if (self.daysContainer === undefined) {
return;
}
clearNode(self.daysContainer);
// TODO: week numbers for each month
if (self.weekNumbers)
clearNode(self.weekNumbers);
var frag = document.createDocumentFragment();
for (var i = 0; i < self.config.showMonths; i++) {
var d = new Date(self.currentYear, self.currentMonth, 1);
d.setMonth(self.currentMonth + i);
frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
}
self.daysContainer.appendChild(frag);
self.days = self.daysContainer.firstChild;
if (self.config.mode === "range" && self.selectedDates.length === 1) {
onMouseOver();
}
}
function buildMonthSwitch() {
if (self.config.showMonths > 1 ||
self.config.monthSelectorType !== "dropdown")
return;
var shouldBuildMonth = function (month) {
if (self.config.minDate !== undefined &&
self.currentYear === self.config.minDate.getFullYear() &&
month < self.config.minDate.getMonth()) {
return false;
}
return !(self.config.maxDate !== undefined &&
self.currentYear === self.config.maxDate.getFullYear() &&
month > self.config.maxDate.getMonth());
};
self.monthsDropdownContainer.tabIndex = -1;
self.monthsDropdownContainer.innerHTML = "";
for (var i = 0; i < 12; i++) {
if (!shouldBuildMonth(i))
continue;
var month = createElement("option", "flatpickr-monthDropdown-month");
month.value = new Date(self.currentYear, i).getMonth().toString();
month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
month.tabIndex = -1;
if (self.currentMonth === i) {
month.selected = true;
}
self.monthsDropdownContainer.appendChild(month);
}
}
function buildMonth() {
var container = createElement("div", "flatpickr-month");
var monthNavFragment = window.document.createDocumentFragment();
var monthElement;
if (self.config.showMonths > 1 ||
self.config.monthSelectorType === "static") {
monthElement = createElement("span", "cur-month");
}
else {
self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
bind(self.monthsDropdownContainer, "change", function (e) {
var target = e.target;
var selectedMonth = parseInt(target.value, 10);
self.changeMonth(selectedMonth - self.currentMonth);
triggerEvent("onMonthChange");
});
buildMonthSwitch();
monthElement = self.monthsDropdownContainer;
}
var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
var yearElement = yearInput.getElementsByTagName("input")[0];
yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
if (self.config.minDate) {
yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
}
if (self.config.maxDate) {
yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
yearElement.disabled =
!!self.config.minDate &&
self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
}
var currentMonth = createElement("div", "flatpickr-current-month");
currentMonth.appendChild(monthElement);
currentMonth.appendChild(yearInput);
monthNavFragment.appendChild(currentMonth);
container.appendChild(monthNavFragment);
return {
container: container,
yearElement: yearElement,
monthElement: monthElement
};
}
function buildMonths() {
clearNode(self.monthNav);
self.monthNav.appendChild(self.prevMonthNav);
if (self.config.showMonths) {
self.yearElements = [];
self.monthElements = [];
}
for (var m = self.config.showMonths; m--;) {
var month = buildMonth();
self.yearElements.push(month.yearElement);
self.monthElements.push(month.monthElement);
self.monthNav.appendChild(month.container);
}
self.monthNav.appendChild(self.nextMonthNav);
}
function buildMonthNav() {
self.monthNav = createElement("div", "flatpickr-months");
self.yearElements = [];
self.monthElements = [];
self.prevMonthNav = createElement("span", "flatpickr-prev-month");
self.prevMonthNav.innerHTML = self.config.prevArrow;
self.nextMonthNav = createElement("span", "flatpickr-next-month");
self.nextMonthNav.innerHTML = self.config.nextArrow;
buildMonths();
Object.defineProperty(self, "_hidePrevMonthArrow", {
get: function () { return self.__hidePrevMonthArrow; },
set: function (bool) {
if (self.__hidePrevMonthArrow !== bool) {
toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
self.__hidePrevMonthArrow = bool;
}
}
});
Object.defineProperty(self, "_hideNextMonthArrow", {
get: function () { return self.__hideNextMonthArrow; },
set: function (bool) {
if (self.__hideNextMonthArrow !== bool) {
toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
self.__hideNextMonthArrow = bool;
}
}
});
self.currentYearElement = self.yearElements[0];
updateNavigationCurrentMonth();
return self.monthNav;
}
function buildTime() {
self.calendarContainer.classList.add("hasTime");
if (self.config.noCalendar)
self.calendarContainer.classList.add("noCalendar");
self.timeContainer = createElement("div", "flatpickr-time");
self.timeContainer.tabIndex = -1;
var separator = createElement("span", "flatpickr-time-separator", ":");
var hourInput = createNumberInput("flatpickr-hour", {
"aria-label": self.l10n.hourAriaLabel
});
self.hourElement = hourInput.getElementsByTagName("input")[0];
var minuteInput = createNumberInput("flatpickr-minute", {
"aria-label": self.l10n.minuteAriaLabel
});
self.minuteElement = minuteInput.getElementsByTagName("input")[0];
self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
self.hourElement.value = pad(self.latestSelectedDateObj
? self.latestSelectedDateObj.getHours()
: self.config.time_24hr
? self.config.defaultHour
: military2ampm(self.config.defaultHour));
self.minuteElement.value = pad(self.latestSelectedDateObj
? self.latestSelectedDateObj.getMinutes()
: self.config.defaultMinute);
self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
self.minuteElement.setAttribute("min", "0");
self.minuteElement.setAttribute("max", "59");
self.timeContainer.appendChild(hourInput);
self.timeContainer.appendChild(separator);
self.timeContainer.appendChild(minuteInput);
if (self.config.time_24hr)
self.timeContainer.classList.add("time24hr");
if (self.config.enableSeconds) {
self.timeContainer.classList.add("hasSeconds");
var secondInput = createNumberInput("flatpickr-second");
self.secondElement = secondInput.getElementsByTagName("input")[0];
self.secondElement.value = pad(self.latestSelectedDateObj
? self.latestSelectedDateObj.getSeconds()
: self.config.defaultSeconds);
self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
self.secondElement.setAttribute("min", "0");
self.secondElement.setAttribute("max", "59");
self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
self.timeContainer.appendChild(secondInput);
}
if (!self.config.time_24hr) {
// add self.amPM if appropriate
self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj
? self.hourElement.value
: self.config.defaultHour) > 11)]);
self.amPM.title = self.l10n.toggleTitle;
self.amPM.tabIndex = -1;
self.timeContainer.appendChild(self.amPM);
}
return self.timeContainer;
}
function buildWeekdays() {
if (!self.weekdayContainer)
self.weekdayContainer = createElement("div", "flatpickr-weekdays");
else
clearNode(self.weekdayContainer);
for (var i = self.config.showMonths; i--;) {
var container = createElement("div", "flatpickr-weekdaycontainer");
self.weekdayContainer.appendChild(container);
}
updateWeekdays();
return self.weekdayContainer;
}
function updateWeekdays() {
var firstDayOfWeek = self.l10n.firstDayOfWeek;
var weekdays = self.l10n.weekdays.shorthand.slice();
if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));
}
for (var i = self.config.showMonths; i--;) {
self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n ";
}
}
/* istanbul ignore next */
function buildWeeks() {
self.calendarContainer.classList.add("hasWeeks");
var weekWrapper = createElement("div", "flatpickr-weekwrapper");
weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
var weekNumbers = createElement("div", "flatpickr-weeks");
weekWrapper.appendChild(weekNumbers);
return {
weekWrapper: weekWrapper,
weekNumbers: weekNumbers
};
}
function changeMonth(value, isOffset) {
if (isOffset === void 0) { isOffset = true; }
var delta = isOffset ? value : value - self.currentMonth;
if ((delta < 0 && self._hidePrevMonthArrow === true) ||
(delta > 0 && self._hideNextMonthArrow === true))
return;
self.currentMonth += delta;
if (self.currentMonth < 0 || self.currentMonth > 11) {
self.currentYear += self.currentMonth > 11 ? 1 : -1;
self.currentMonth = (self.currentMonth + 12) % 12;
triggerEvent("onYearChange");
buildMonthSwitch();
}
buildDays();
triggerEvent("onMonthChange");
updateNavigationCurrentMonth();
}
function clear(triggerChangeEvent, toInitial) {
if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
if (toInitial === void 0) { toInitial = true; }
self.input.value = "";
if (self.altInput !== undefined)
self.altInput.value = "";
if (self.mobileInput !== undefined)
self.mobileInput.value = "";
self.selectedDates = [];
self.latestSelectedDateObj = undefined;
if (toInitial === true) {
self.currentYear = self._initialDate.getFullYear();
self.currentMonth = self._initialDate.getMonth();
}
self.showTimeInput = false;
if (self.config.enableTime === true) {
setDefaultHours();
}
self.redraw();
if (triggerChangeEvent)
// triggerChangeEvent is true (default) or an Event
triggerEvent("onChange");
}
function close() {
self.isOpen = false;
if (!self.isMobile) {
if (self.calendarContainer !== undefined) {
self.calendarContainer.classList.remove("open");
}
if (self._input !== undefined) {
self._input.classList.remove("active");
}
}
triggerEvent("onClose");
}
function destroy() {
if (self.config !== undefined)
triggerEvent("onDestroy");
for (var i = self._handlers.length; i--;) {
var h = self._handlers[i];
h.element.removeEventListener(h.event, h.handler, h.options);
}
self._handlers = [];
if (self.mobileInput) {
if (self.mobileInput.parentNode)
self.mobileInput.parentNode.removeChild(self.mobileInput);
self.mobileInput = undefined;
}
else if (self.calendarContainer && self.calendarContainer.parentNode) {
if (self.config.static && self.calendarContainer.parentNode) {
var wrapper = self.calendarContainer.parentNode;
wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
if (wrapper.parentNode) {
while (wrapper.firstChild)
wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
wrapper.parentNode.removeChild(wrapper);
}
}
else
self.calendarContainer.parentNode.removeChild(self.calendarContainer);
}
if (self.altInput) {
self.input.type = "text";
if (self.altInput.parentNode)
self.altInput.parentNode.removeChild(self.altInput);
delete self.altInput;
}
if (self.input) {
self.input.type = self.input._type;
self.input.classList.remove("flatpickr-input");
self.input.removeAttribute("readonly");
self.input.value = "";
}
[
"_showTimeInput",
"latestSelectedDateObj",
"_hideNextMonthArrow",
"_hidePrevMonthArrow",
"__hideNextMonthArrow",
"__hidePrevMonthArrow",
"isMobile",
"isOpen",
"selectedDateElem",
"minDateHasTime",
"maxDateHasTime",
"days",
"daysContainer",
"_input",
"_positionElement",
"innerContainer",
"rContainer",
"monthNav",
"todayDateElem",
"calendarContainer",
"weekdayContainer",
"prevMonthNav",
"nextMonthNav",
"monthsDropdownContainer",
"currentMonthElement",
"currentYearElement",
"navigationCurrentMonth",
"selectedDateElem",
"config",
].forEach(function (k) {
try {
delete self[k];
}
catch (_) { }
});
}
function isCalendarElem(elem) {
if (self.config.appendTo && self.config.appendTo.contains(elem))
return true;
return self.calendarContainer.contains(elem);
}
function documentClick(e) {
if (self.isOpen && !self.config.inline) {
var eventTarget_1 = getEventTarget(e);
var isCalendarElement = isCalendarElem(eventTarget_1);
var isInput = eventTarget_1 === self.input ||
eventTarget_1 === self.altInput ||
self.element.contains(eventTarget_1) ||
// web components
// e.path is not present in all browsers. circumventing typechecks
(e.path &&
e.path.indexOf &&
(~e.path.indexOf(self.input) ||
~e.path.indexOf(self.altInput)));
var lostFocus = e.type === "blur"
? isInput &&
e.relatedTarget &&
!isCalendarElem(e.relatedTarget)
: !isInput &&
!isCalendarElement &&
!isCalendarElem(e.relatedTarget);
var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {
return elem.contains(eventTarget_1);
});
if (lostFocus && isIgnored) {
self.close();
if (self.config.mode === "range" && self.selectedDates.length === 1) {
self.clear(false);
self.redraw();
}
}
}
}
function changeYear(newYear) {
if (!newYear ||
(self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
(self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
return;
var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
self.currentYear = newYearNum || self.currentYear;
if (self.config.maxDate &&
self.currentYear === self.config.maxDate.getFullYear()) {
self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
}
else if (self.config.minDate &&
self.currentYear === self.config.minDate.getFullYear()) {
self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
}
if (isNewYear) {
self.redraw();
triggerEvent("onYearChange");
buildMonthSwitch();
}
}
function isEnabled(date, timeless) {
if (timeless === void 0) { timeless = true; }
var dateToCheck = self.parseDate(date, undefined, timeless); // timeless
if ((self.config.minDate &&
dateToCheck &&
compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
(self.config.maxDate &&
dateToCheck &&
compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))
return false;
if (self.config.enable.length === 0 && self.config.disable.length === 0)
return true;
if (dateToCheck === undefined)
return false;
var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;
for (var i = 0, d = void 0; i < array.length; i++) {
d = array[i];
if (typeof d === "function" &&
d(dateToCheck) // disabled by function
)
return bool;
else if (d instanceof Date &&
dateToCheck !== undefined &&
d.getTime() === dateToCheck.getTime())
// disabled by date
return bool;
else if (typeof d === "string" && dateToCheck !== undefined) {
// disabled by date string
var parsed = self.parseDate(d, undefined, true);
return parsed && parsed.getTime() === dateToCheck.getTime()
? bool
: !bool;
}
else if (
// disabled by range
typeof d === "object" &&
dateToCheck !== undefined &&
d.from &&
d.to &&
dateToCheck.getTime() >= d.from.getTime() &&
dateToCheck.getTime() <= d.to.getTime())
return bool;
}
return !bool;
}
function isInView(elem) {
if (self.daysContainer !== undefined)
return (elem.className.indexOf("hidden") === -1 &&
self.daysContainer.contains(elem));
return false;
}
function onKeyDown(e) {
// e.key e.keyCode
// "Backspace" 8
// "Tab" 9
// "Enter" 13
// "Escape" (IE "Esc") 27
// "ArrowLeft" (IE "Left") 37
// "ArrowUp" (IE "Up") 38
// "ArrowRight" (IE "Right") 39
// "ArrowDown" (IE "Down") 40
// "Delete" (IE "Del") 46
var isInput = e.target === self._input;
var allowInput = self.config.allowInput;
var allowKeydown = self.isOpen && (!allowInput || !isInput);
var allowInlineKeydown = self.config.inline && isInput && !allowInput;
if (e.keyCode === 13 && isInput) {
if (allowInput) {
self.setDate(self._input.value, true, e.target === self.altInput
? self.config.altFormat
: self.config.dateFormat);
return e.target.blur();
}
else {
self.open();
}
}
else if (isCalendarElem(e.target) ||
allowKeydown ||
allowInlineKeydown) {
var isTimeObj = !!self.timeContainer &&
self.timeContainer.contains(e.target);
switch (e.keyCode) {
case 13:
if (isTimeObj) {
e.preventDefault();
updateTime();
focusAndClose();
}
else
selectDate(e);
break;
case 27: // escape
e.preventDefault();
focusAndClose();
break;
case 8:
case 46:
if (isInput && !self.config.allowInput) {
e.preventDefault();
self.clear();
}
break;
case 37:
case 39:
if (!isTimeObj && !isInput) {
e.preventDefault();
if (self.daysContainer !== undefined &&
(allowInput === false ||
(document.activeElement && isInView(document.activeElement)))) {
var delta_1 = e.keyCode === 39 ? 1 : -1;
if (!e.ctrlKey)
focusOnDay(undefined, delta_1);
else {
e.stopPropagation();
changeMonth(delta_1);
focusOnDay(getFirstAvailableDay(1), 0);
}
}
}
else if (self.hourElement)
self.hourElement.focus();
break;
case 38:
case 40:
e.preventDefault();
var delta = e.keyCode === 40 ? 1 : -1;
if ((self.daysContainer && e.target.$i !== undefined) ||
e.target === self.input) {
if (e.ctrlKey) {
e.stopPropagation();
changeYear(self.currentYear - delta);
focusOnDay(getFirstAvailableDay(1), 0);
}
else if (!isTimeObj)
focusOnDay(undefined, delta * 7);
}
else if (e.target === self.currentYearElement) {
changeYear(self.currentYear - delta);
}
else if (self.config.enableTime) {
if (!isTimeObj && self.hourElement)
self.hourElement.focus();
updateTime(e);
self._debouncedChange();
}
break;
case 9:
if (isTimeObj) {
var elems = [
self.hourElement,
self.minuteElement,
self.secondElement,
self.amPM,
]
.concat(self.pluginElements)
.filter(function (x) { return x; });
var i = elems.indexOf(e.target);
if (i !== -1) {
var target = elems[i + (e.shiftKey ? -1 : 1)];
e.preventDefault();
(target || self._input).focus();
}
}
else if (!self.config.noCalendar &&
self.daysContainer &&
self.daysContainer.contains(e.target) &&
e.shiftKey) {
e.preventDefault();
self._input.focus();
}
break;
default:
break;
}
}
if (self.amPM !== undefined && e.target === self.amPM) {
switch (e.key) {
case self.l10n.amPM[0].charAt(0):
case self.l10n.amPM[0].charAt(0).toLowerCase():
self.amPM.textContent = self.l10n.amPM[0];
setHoursFromInputs();
updateValue();
break;
case self.l10n.amPM[1].charAt(0):
case self.l10n.amPM[1].charAt(0).toLowerCase():
self.amPM.textContent = self.l10n.amPM[1];
setHoursFromInputs();
updateValue();
break;
}
}
if (isInput || isCalendarElem(e.target)) {
triggerEvent("onKeyDown", e);
}
}
function onMouseOver(elem) {
if (self.selectedDates.length !== 1 ||
(elem &&
(!elem.classList.contains("flatpickr-day") ||
elem.classList.contains("flatpickr-disabled"))))
return;
var hoverDate = elem
? elem.dateObj.getTime()
: self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
var containsDisabled = false;
var minRange = 0, maxRange = 0;
for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
if (!isEnabled(new Date(t), true)) {
containsDisabled =
containsDisabled || (t > rangeStartDate && t < rangeEndDate);
if (t < initialDate && (!minRange || t > minRange))
minRange = t;
else if (t > initialDate && (!maxRange || t < maxRange))
maxRange = t;
}
}
for (var m = 0; m < self.config.showMonths; m++) {
var month = self.daysContainer.children[m];
var _loop_1 = function (i, l) {
var dayElem = month.children[i], date = dayElem.dateObj;
var timestamp = date.getTime();
var outOfRange = (minRange > 0 && timestamp < minRange) ||
(maxRange > 0 && timestamp > maxRange);
if (outOfRange) {
dayElem.classList.add("notAllowed");
["inRange", "startRange", "endRange"].forEach(function (c) {
dayElem.classList.remove(c);
});
return "continue";
}
else if (containsDisabled && !outOfRange)
return "continue";
["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
dayElem.classList.remove(c);
});
if (elem !== undefined) {
elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
? "startRange"
: "endRange");
if (initialDate < hoverDate && timestamp === initialDate)
dayElem.classList.add("startRange");
else if (initialDate > hoverDate && timestamp === initialDate)
dayElem.classList.add("endRange");
if (timestamp >= minRange &&
(maxRange === 0 || timestamp <= maxRange) &&
isBetween(timestamp, initialDate, hoverDate))
dayElem.classList.add("inRange");
}
};
for (var i = 0, l = month.children.length; i < l; i++) {
_loop_1(i, l);
}
}
}
function onResize() {
if (self.isOpen && !self.config.static && !self.config.inline)
positionCalendar();
}
function setDefaultTime() {
self.setDate(self.config.minDate !== undefined
? new Date(self.config.minDate.getTime())
: new Date(), true);
setDefaultHours();
updateValue();
}
function open(e, positionElement) {
if (positionElement === void 0) { positionElement = self._positionElement; }
if (self.isMobile === true) {
if (e) {
e.preventDefault();
e.target && e.target.blur();
}
if (self.mobileInput !== undefined) {
self.mobileInput.focus();
self.mobileInput.click();
}
triggerEvent("onOpen");
return;
}
if (self._input.disabled || self.config.inline)
return;
var wasOpen = self.isOpen;
self.isOpen = true;
if (!wasOpen) {
self.calendarContainer.classList.add("open");
self._input.classList.add("active");
triggerEvent("onOpen");
positionCalendar(positionElement);
}
if (self.config.enableTime === true && self.config.noCalendar === true) {
if (self.selectedDates.length === 0) {
setDefaultTime();
}
if (self.config.allowInput === false &&
(e === undefined ||
!self.timeContainer.contains(e.relatedTarget))) {
setTimeout(function () { return self.hourElement.select(); }, 50);
}
}
}
function minMaxDateSetter(type) {
return function (date) {
var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat));
var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
if (dateObj !== undefined) {
self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
dateObj.getHours() > 0 ||
dateObj.getMinutes() > 0 ||
dateObj.getSeconds() > 0;
}
if (self.selectedDates) {
self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
if (!self.selectedDates.length && type === "min")
setHoursFromDate(dateObj);
updateValue();
}
if (self.daysContainer) {
redraw();
if (dateObj !== undefined)
self.currentYearElement[type] = dateObj.getFullYear().toString();
else
self.currentYearElement.removeAttribute(type);
self.currentYearElement.disabled =
!!inverseDateObj &&
dateObj !== undefined &&
inverseDateObj.getFullYear() === dateObj.getFullYear();
}
};
}
function parseConfig() {
var boolOpts = [
"wrap",
"weekNumbers",
"allowInput",
"clickOpens",
"time_24hr",
"enableTime",
"noCalendar",
"altInput",
"shorthandCurrentMonth",
"inline",
"static",
"enableSeconds",
"disableMobile",
];
var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
var formats = {};
self.config.parseDate = userConfig.parseDate;
self.config.formatDate = userConfig.formatDate;
Object.defineProperty(self.config, "enable", {
get: function () { return self.config._enable; },
set: function (dates) {
self.config._enable = parseDateRules(dates);
}
});
Object.defineProperty(self.config, "disable", {
get: function () { return self.config._disable; },
set: function (dates) {
self.config._disable = parseDateRules(dates);
}
});
var timeMode = userConfig.mode === "time";
if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
formats.dateFormat =
userConfig.noCalendar || timeMode
? "H:i" + (userConfig.enableSeconds ? ":S" : "")
: defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
}
if (userConfig.altInput &&
(userConfig.enableTime || timeMode) &&
!userConfig.altFormat) {
var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
formats.altFormat =
userConfig.noCalendar || timeMode
? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
: defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
}
if (!userConfig.altInputClass) {
self.config.altInputClass =
self.input.className + " " + self.config.altInputClass;
}
Object.defineProperty(self.config, "minDate", {
get: function () { return self.config._minDate; },
set: minMaxDateSetter("min")
});
Object.defineProperty(self.config, "maxDate", {
get: function () { return self.config._maxDate; },
set: minMaxDateSetter("max")
});
var minMaxTimeSetter = function (type) { return function (val) {
self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i");
}; };
Object.defineProperty(self.config, "minTime", {
get: function () { return self.config._minTime; },
set: minMaxTimeSetter("min")
});
Object.defineProperty(self.config, "maxTime", {
get: function () { return self.config._maxTime; },
set: minMaxTimeSetter("max")
});
if (userConfig.mode === "time") {
self.config.noCalendar = true;
self.config.enableTime = true;
}
Object.assign(self.config, formats, userConfig);
for (var i = 0; i < boolOpts.length; i++)
self.config[boolOpts[i]] =
self.config[boolOpts[i]] === true ||
self.config[boolOpts[i]] === "true";
HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
});
self.isMobile =
!self.config.disableMobile &&
!self.config.inline &&
self.config.mode === "single" &&
!self.config.disable.length &&
!self.config.enable.length &&
!self.config.weekNumbers &&
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
for (var i = 0; i < self.config.plugins.length; i++) {
var pluginConf = self.config.plugins[i](self) || {};
for (var key in pluginConf) {
if (HOOKS.indexOf(key) > -1) {
self.config[key] = arrayify(pluginConf[key])
.map(bindToInstance)
.concat(self.config[key]);
}
else if (typeof userConfig[key] === "undefined")
self.config[key] = pluginConf[key];
}
}
triggerEvent("onParseConfig");
}
function setupLocale() {
if (typeof self.config.locale !== "object" &&
typeof flatpickr.l10ns[self.config.locale] === "undefined")
self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
self.l10n = __assign({}, flatpickr.l10ns["default"], (typeof self.config.locale === "object"
? self.config.locale
: self.config.locale !== "default"
? flatpickr.l10ns[self.config.locale]
: undefined));
tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
if (userConfig.time_24hr === undefined &&
flatpickr.defaultConfig.time_24hr === undefined) {
self.config.time_24hr = self.l10n.time_24hr;
}
self.formatDate = createDateFormatter(self);
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
}
function positionCalendar(customPositionElement) {
if (self.calendarContainer === undefined)
return;
triggerEvent("onPreCalendarPosition");
var positionElement = customPositionElement || self._positionElement;
var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" ||
(configPosVertical !== "below" &&
distanceFromBottom < calendarHeight &&
inputBounds.top > calendarHeight);
var top = window.pageYOffset +
inputBounds.top +
(!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
if (self.config.inline)
return;
var left = window.pageXOffset +
inputBounds.left -
(configPosHorizontal != null && configPosHorizontal === "center"
? (calendarWidth - inputBounds.width) / 2
: 0);
var right = window.document.body.offsetWidth - inputBounds.right;
var rightMost = left + calendarWidth > window.document.body.offsetWidth;
var centerMost = right + calendarWidth > window.document.body.offsetWidth;
toggleClass(self.calendarContainer, "rightMost", rightMost);
if (self.config.static)
return;
self.calendarContainer.style.top = top + "px";
if (!rightMost) {
self.calendarContainer.style.left = left + "px";
self.calendarContainer.style.right = "auto";
}
else if (!centerMost) {
self.calendarContainer.style.left = "auto";
self.calendarContainer.style.right = right + "px";
}
else {
var doc = document.styleSheets[0];
// some testing environments don't have css support
if (doc === undefined)
return;
var bodyWidth = window.document.body.offsetWidth;
var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
var centerBefore = ".flatpickr-calendar.centerMost:before";
var centerAfter = ".flatpickr-calendar.centerMost:after";
var centerIndex = doc.cssRules.length;
var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
toggleClass(self.calendarContainer, "rightMost", false);
toggleClass(self.calendarContainer, "centerMost", true);
doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
self.calendarContainer.style.left = centerLeft + "px";
self.calendarContainer.style.right = "auto";
}
}
function redraw() {
if (self.config.noCalendar || self.isMobile)
return;
updateNavigationCurrentMonth();
buildDays();
}
function focusAndClose() {
self._input.focus();
if (window.navigator.userAgent.indexOf("MSIE") !== -1 ||
navigator.msMaxTouchPoints !== undefined) {
// hack - bugs in the way IE handles focus keeps the calendar open
setTimeout(self.close, 0);
}
else {
self.close();
}
}
function selectDate(e) {
e.preventDefault();
e.stopPropagation();
var isSelectable = function (day) {
return day.classList &&
day.classList.contains("flatpickr-day") &&
!day.classList.contains("flatpickr-disabled") &&
!day.classList.contains("notAllowed");
};
var t = findParent(e.target, isSelectable);
if (t === undefined)
return;
var target = t;
var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
selectedDate.getMonth() >
self.currentMonth + self.config.showMonths - 1) &&
self.config.mode !== "range";
self.selectedDateElem = target;
if (self.config.mode === "single")
self.selectedDates = [selectedDate];
else if (self.config.mode === "multiple") {
var selectedIndex = isDateSelected(selectedDate);
if (selectedIndex)
self.selectedDates.splice(parseInt(selectedIndex), 1);
else
self.selectedDates.push(selectedDate);
}
else if (self.config.mode === "range") {
if (self.selectedDates.length === 2) {
self.clear(false, false);
}
self.latestSelectedDateObj = selectedDate;
self.selectedDates.push(selectedDate);
// unless selecting same date twice, sort ascendingly
if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
}
setHoursFromInputs();
if (shouldChangeMonth) {
var isNewYear = self.currentYear !== selectedDate.getFullYear();
self.currentYear = selectedDate.getFullYear();
self.currentMonth = selectedDate.getMonth();
if (isNewYear) {
triggerEvent("onYearChange");
buildMonthSwitch();
}
triggerEvent("onMonthChange");
}
updateNavigationCurrentMonth();
buildDays();
updateValue();
if (self.config.enableTime)
setTimeout(function () { return (self.showTimeInput = true); }, 50);
// maintain focus
if (!shouldChangeMonth &&
self.config.mode !== "range" &&
self.config.showMonths === 1)
focusOnDayElem(target);
else if (self.selectedDateElem !== undefined &&
self.hourElement === undefined) {
self.selectedDateElem && self.selectedDateElem.focus();
}
if (self.hourElement !== undefined)
self.hourElement !== undefined && self.hourElement.focus();
if (self.config.closeOnSelect) {
var single = self.config.mode === "single" && !self.config.enableTime;
var range = self.config.mode === "range" &&
self.selectedDates.length === 2 &&
!self.config.enableTime;
if (single || range) {
focusAndClose();
}
}
triggerChange();
}
var CALLBACKS = {
locale: [setupLocale, updateWeekdays],
showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
minDate: [jumpToDate],
maxDate: [jumpToDate]
};
function set(option, value) {
if (option !== null && typeof option === "object") {
Object.assign(self.config, option);
for (var key in option) {
if (CALLBACKS[key] !== undefined)
CALLBACKS[key].forEach(function (x) { return x(); });
}
}
else {
self.config[option] = value;
if (CALLBACKS[option] !== undefined)
CALLBACKS[option].forEach(function (x) { return x(); });
else if (HOOKS.indexOf(option) > -1)
self.config[option] = arrayify(value);
}
self.redraw();
updateValue(false);
}
function setSelectedDate(inputDate, format) {
var dates = [];
if (inputDate instanceof Array)
dates = inputDate.map(function (d) { return self.parseDate(d, format); });
else if (inputDate instanceof Date || typeof inputDate === "number")
dates = [self.parseDate(inputDate, format)];
else if (typeof inputDate === "string") {
switch (self.config.mode) {
case "single":
case "time":
dates = [self.parseDate(inputDate, format)];
break;
case "multiple":
dates = inputDate
.split(self.config.conjunction)
.map(function (date) { return self.parseDate(date, format); });
break;
case "range":
dates = inputDate
.split(self.l10n.rangeSeparator)
.map(function (date) { return self.parseDate(date, format); });
break;
default:
break;
}
}
else
self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
self.selectedDates = dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); });
if (self.config.mode === "range")
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
}
function setDate(date, triggerChange, format) {
if (triggerChange === void 0) { triggerChange = false; }
if (format === void 0) { format = self.config.dateFormat; }
if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
return self.clear(triggerChange);
setSelectedDate(date, format);
self.showTimeInput = self.selectedDates.length > 0;
self.latestSelectedDateObj =
self.selectedDates[self.selectedDates.length - 1];
self.redraw();
jumpToDate();
setHoursFromDate();
if (self.selectedDates.length === 0) {
self.clear(false);
}
updateValue(triggerChange);
if (triggerChange)
triggerEvent("onChange");
}
function parseDateRules(arr) {
return arr
.slice()
.map(function (rule) {
if (typeof rule === "string" ||
typeof rule === "number" ||
rule instanceof Date) {
return self.parseDate(rule, undefined, true);
}
else if (rule &&
typeof rule === "object" &&
rule.from &&
rule.to)
return {
from: self.parseDate(rule.from, undefined),
to: self.parseDate(rule.to, undefined)
};
return rule;
})
.filter(function (x) { return x; }); // remove falsy values
}
function setupDates() {
self.selectedDates = [];
self.now = self.parseDate(self.config.now) || new Date();
// Workaround IE11 setting placeholder as the input's value
var preloadedDate = self.config.defaultDate ||
((self.input.nodeName === "INPUT" ||
self.input.nodeName === "TEXTAREA") &&
self.input.placeholder &&
self.input.value === self.input.placeholder
? null
: self.input.value);
if (preloadedDate)
setSelectedDate(preloadedDate, self.config.dateFormat);
self._initialDate =
self.selectedDates.length > 0
? self.selectedDates[0]
: self.config.minDate &&
self.config.minDate.getTime() > self.now.getTime()
? self.config.minDate
: self.config.maxDate &&
self.config.maxDate.getTime() < self.now.getTime()
? self.config.maxDate
: self.now;
self.currentYear = self._initialDate.getFullYear();
self.currentMonth = self._initialDate.getMonth();
if (self.selectedDates.length > 0)
self.latestSelectedDateObj = self.selectedDates[0];
if (self.config.minTime !== undefined)
self.config.minTime = self.parseDate(self.config.minTime, "H:i");
if (self.config.maxTime !== undefined)
self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
self.minDateHasTime =
!!self.config.minDate &&
(self.config.minDate.getHours() > 0 ||
self.config.minDate.getMinutes() > 0 ||
self.config.minDate.getSeconds() > 0);
self.maxDateHasTime =
!!self.config.maxDate &&
(self.config.maxDate.getHours() > 0 ||
self.config.maxDate.getMinutes() > 0 ||
self.config.maxDate.getSeconds() > 0);
Object.defineProperty(self, "showTimeInput", {
get: function () { return self._showTimeInput; },
set: function (bool) {
self._showTimeInput = bool;
if (self.calendarContainer)
toggleClass(self.calendarContainer, "showTimeInput", bool);
self.isOpen && positionCalendar();
}
});
}
function setupInputs() {
self.input = self.config.wrap
? element.querySelector("[data-input]")
: element;
/* istanbul ignore next */
if (!self.input) {
self.config.errorHandler(new Error("Invalid input element specified"));
return;
}
// hack: store previous type to restore it after destroy()
self.input._type = self.input.type;
self.input.type = "text";
self.input.classList.add("flatpickr-input");
self._input = self.input;
if (self.config.altInput) {
// replicate self.element
self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
self._input = self.altInput;
self.altInput.placeholder = self.input.placeholder;
self.altInput.disabled = self.input.disabled;
self.altInput.required = self.input.required;
self.altInput.tabIndex = self.input.tabIndex;
self.altInput.type = "text";
self.input.setAttribute("type", "hidden");
if (!self.config.static && self.input.parentNode)
self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
}
if (!self.config.allowInput)
self._input.setAttribute("readonly", "readonly");
self._positionElement = self.config.positionElement || self._input;
}
function setupMobile() {
var inputType = self.config.enableTime
? self.config.noCalendar
? "time"
: "datetime-local"
: "date";
self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
self.mobileInput.step = self.input.getAttribute("step") || "any";
self.mobileInput.tabIndex = 1;
self.mobileInput.type = inputType;
self.mobileInput.disabled = self.input.disabled;
self.mobileInput.required = self.input.required;
self.mobileInput.placeholder = self.input.placeholder;
self.mobileFormatStr =
inputType === "datetime-local"
? "Y-m-d\\TH:i:S"
: inputType === "date"
? "Y-m-d"
: "H:i:S";
if (self.selectedDates.length > 0) {
self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
}
if (self.config.minDate)
self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
if (self.config.maxDate)
self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
self.input.type = "hidden";
if (self.altInput !== undefined)
self.altInput.type = "hidden";
try {
if (self.input.parentNode)
self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
}
catch (_a) { }
bind(self.mobileInput, "change", function (e) {
self.setDate(e.target.value, false, self.mobileFormatStr);
triggerEvent("onChange");
triggerEvent("onClose");
});
}
function toggle(e) {
if (self.isOpen === true)
return self.close();
self.open(e);
}
function triggerEvent(event, data) {
// If the instance has been destroyed already, all hooks have been removed
if (self.config === undefined)
return;
var hooks = self.config[event];
if (hooks !== undefined && hooks.length > 0) {
for (var i = 0; hooks[i] && i < hooks.length; i++)
hooks[i](self.selectedDates, self.input.value, self, data);
}
if (event === "onChange") {
self.input.dispatchEvent(createEvent("change"));
// many front-end frameworks bind to the input event
self.input.dispatchEvent(createEvent("input"));
}
}
function createEvent(name) {
var e = document.createEvent("Event");
e.initEvent(name, true, true);
return e;
}
function isDateSelected(date) {
for (var i = 0; i < self.selectedDates.length; i++) {
if (compareDates(self.selectedDates[i], date) === 0)
return "" + i;
}
return false;
}
function isDateInRange(date) {
if (self.config.mode !== "range" || self.selectedDates.length < 2)
return false;
return (compareDates(date, self.selectedDates[0]) >= 0 &&
compareDates(date, self.selectedDates[1]) <= 0);
}
function updateNavigationCurrentMonth() {
if (self.config.noCalendar || self.isMobile || !self.monthNav)
return;
self.yearElements.forEach(function (yearElement, i) {
var d = new Date(self.currentYear, self.currentMonth, 1);
d.setMonth(self.currentMonth + i);
if (self.config.showMonths > 1 ||
self.config.monthSelectorType === "static") {
self.monthElements[i].textContent =
monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
}
else {
self.monthsDropdownContainer.value = d.getMonth().toString();
}
yearElement.value = d.getFullYear().toString();
});
self._hidePrevMonthArrow =
self.config.minDate !== undefined &&
(self.currentYear === self.config.minDate.getFullYear()
? self.currentMonth <= self.config.minDate.getMonth()
: self.currentYear < self.config.minDate.getFullYear());
self._hideNextMonthArrow =
self.config.maxDate !== undefined &&
(self.currentYear === self.config.maxDate.getFullYear()
? self.currentMonth + 1 > self.config.maxDate.getMonth()
: self.currentYear > self.config.maxDate.getFullYear());
}
function getDateStr(format) {
return self.selectedDates
.map(function (dObj) { return self.formatDate(dObj, format); })
.filter(function (d, i, arr) {
return self.config.mode !== "range" ||
self.config.enableTime ||
arr.indexOf(d) === i;
})
.join(self.config.mode !== "range"
? self.config.conjunction
: self.l10n.rangeSeparator);
}
/**
* Updates the values of inputs associated with the calendar
*/
function updateValue(triggerChange) {
if (triggerChange === void 0) { triggerChange = true; }
if (self.mobileInput !== undefined && self.mobileFormatStr) {
self.mobileInput.value =
self.latestSelectedDateObj !== undefined
? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)
: "";
}
self.input.value = getDateStr(self.config.dateFormat);
if (self.altInput !== undefined) {
self.altInput.value = getDateStr(self.config.altFormat);
}
if (triggerChange !== false)
triggerEvent("onValueUpdate");
}
function onMonthNavClick(e) {
var isPrevMonth = self.prevMonthNav.contains(e.target);
var isNextMonth = self.nextMonthNav.contains(e.target);
if (isPrevMonth || isNextMonth) {
changeMonth(isPrevMonth ? -1 : 1);
}
else if (self.yearElements.indexOf(e.target) >= 0) {
e.target.select();
}
else if (e.target.classList.contains("arrowUp")) {
self.changeYear(self.currentYear + 1);
}
else if (e.target.classList.contains("arrowDown")) {
self.changeYear(self.currentYear - 1);
}
}
function timeWrapper(e) {
e.preventDefault();
var isKeyDown = e.type === "keydown", input = e.target;
if (self.amPM !== undefined && e.target === self.amPM) {
self.amPM.textContent =
self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
}
var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta ||
(isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
var newValue = curValue + step * delta;
if (typeof input.value !== "undefined" && input.value.length === 2) {
var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
if (newValue < min) {
newValue =
max +
newValue +
int(!isHourElem) +
(int(isHourElem) && int(!self.amPM));
if (isMinuteElem)
incrementNumInput(undefined, -1, self.hourElement);
}
else if (newValue > max) {
newValue =
input === self.hourElement ? newValue - max - int(!self.amPM) : min;
if (isMinuteElem)
incrementNumInput(undefined, 1, self.hourElement);
}
if (self.amPM &&
isHourElem &&
(step === 1
? newValue + curValue === 23
: Math.abs(newValue - curValue) > step)) {
self.amPM.textContent =
self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
}
input.value = pad(newValue);
}
}
init();
return self;
}
/* istanbul ignore next */
function _flatpickr(nodeList, config) {
// static list
var nodes = Array.prototype.slice
.call(nodeList)
.filter(function (x) { return x instanceof HTMLElement; });
var instances = [];
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
try {
if (node.getAttribute("data-fp-omit") !== null)
continue;
if (node._flatpickr !== undefined) {
node._flatpickr.destroy();
node._flatpickr = undefined;
}
node._flatpickr = FlatpickrInstance(node, config || {});
instances.push(node._flatpickr);
}
catch (e) {
console.error(e);
}
}
return instances.length === 1 ? instances[0] : instances;
}
/* istanbul ignore next */
if (typeof HTMLElement !== "undefined" &&
typeof HTMLCollection !== "undefined" &&
typeof NodeList !== "undefined") {
// browser env
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
return _flatpickr(this, config);
};
HTMLElement.prototype.flatpickr = function (config) {
return _flatpickr([this], config);
};
}
/* istanbul ignore next */
var flatpickr = function (selector, config) {
if (typeof selector === "string") {
return _flatpickr(window.document.querySelectorAll(selector), config);
}
else if (selector instanceof Node) {
return _flatpickr([selector], config);
}
else {
return _flatpickr(selector, config);
}
};
/* istanbul ignore next */
flatpickr.defaultConfig = {};
flatpickr.l10ns = {
en: __assign({}, english),
"default": __assign({}, english)
};
flatpickr.localize = function (l10n) {
flatpickr.l10ns["default"] = __assign({}, flatpickr.l10ns["default"], l10n);
};
flatpickr.setDefaults = function (config) {
flatpickr.defaultConfig = __assign({}, flatpickr.defaultConfig, config);
};
flatpickr.parseDate = createDateParser({});
flatpickr.formatDate = createDateFormatter({});
flatpickr.compareDates = compareDates;
/* istanbul ignore next */
if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
jQuery.fn.flatpickr = function (config) {
return _flatpickr(this, config);
};
}
// eslint-disable-next-line @typescript-eslint/camelcase
Date.prototype.fp_incr = function (days) {
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
};
if (typeof window !== "undefined") {
window.flatpickr = flatpickr;
}
return flatpickr;
}));
});
/* src\common\DatePicker.svelte generated by Svelte v3.12.1 */
const file$y = "src\\common\\DatePicker.svelte";
function create_fragment$x(ctx) {
var div1, label_1, t0, t1, div0, input_1, input_1_class_value;
const block = {
c: function create() {
div1 = element("div");
label_1 = element("label");
t0 = text(ctx.label);
t1 = space();
div0 = element("div");
input_1 = element("input");
attr_dev(label_1, "class", "uk-form-label");
add_location(label_1, file$y, 30, 4, 559);
attr_dev(input_1, "class", input_1_class_value = "uk-input uk-form-width-" + ctx.width + " uk-form-" + ctx.size);
add_location(input_1, file$y, 32, 8, 647);
attr_dev(div0, "class", "uk-form-controls");
add_location(div0, file$y, 31, 4, 608);
attr_dev(div1, "class", "uk-margin");
add_location(div1, file$y, 29, 0, 531);
},
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, label_1);
append_dev(label_1, t0);
append_dev(div1, t1);
append_dev(div1, div0);
append_dev(div0, input_1);
ctx.input_1_binding(input_1);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if ((changed.width || changed.size) && input_1_class_value !== (input_1_class_value = "uk-input uk-form-width-" + ctx.width + " uk-form-" + ctx.size)) {
attr_dev(input_1, "class", input_1_class_value);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
ctx.input_1_binding(null);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$x.name, type: "component", source: "", ctx });
return block;
}
function instance$x($$self, $$props, $$invalidate) {
let { value, label, width = "medium", size = "small" } = $$props;
let input;
let fpInstance;
onMount(() => {
$$invalidate('fpInstance', fpInstance = flatpickr(input, {}));
fpInstance.config.onChange.push(selectedDates => {
if(selectedDates.length > 0)
$$invalidate('value', value = new Date(selectedDates[0]));
});
return fpInstance;
});
const writable_props = ['value', 'label', 'width', 'size'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<DatePicker> was created with unknown prop '${key}'`);
});
function input_1_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
$$invalidate('input', input = $$value);
});
}
$$self.$set = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
};
$$self.$capture_state = () => {
return { value, label, width, size, input, fpInstance };
};
$$self.$inject_state = $$props => {
if ('value' in $$props) $$invalidate('value', value = $$props.value);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
if ('width' in $$props) $$invalidate('width', width = $$props.width);
if ('size' in $$props) $$invalidate('size', size = $$props.size);
if ('input' in $$props) $$invalidate('input', input = $$props.input);
if ('fpInstance' in $$props) $$invalidate('fpInstance', fpInstance = $$props.fpInstance);
};
$$self.$$.update = ($$dirty = { fpInstance: 1, value: 1 }) => {
if ($$dirty.fpInstance || $$dirty.value) { if (fpInstance) fpInstance.setDate(value); }
};
return {
value,
label,
width,
size,
input,
input_1_binding
};
}
class DatePicker extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$x, create_fragment$x, safe_not_equal, ["value", "label", "width", "size"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "DatePicker", options, id: create_fragment$x.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.value === undefined && !('value' in props)) {
console.warn("<DatePicker> was created without expected prop 'value'");
}
if (ctx.label === undefined && !('label' in props)) {
console.warn("<DatePicker> was created without expected prop 'label'");
}
}
get value() {
throw new Error("<DatePicker>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set value(value) {
throw new Error("<DatePicker>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<DatePicker>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<DatePicker>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get width() {
throw new Error("<DatePicker>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set width(value) {
throw new Error("<DatePicker>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get size() {
throw new Error("<DatePicker>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set size(value) {
throw new Error("<DatePicker>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\database\FieldView.svelte generated by Svelte v3.12.1 */
const file$z = "src\\database\\FieldView.svelte";
// (68:8) {:else}
function create_else_block$5(ctx) {
var div, t_value = ctx.clonedField.name + "", t;
const block = {
c: function create() {
div = element("div");
t = text(t_value);
set_style(div, "font-weight", "bold");
add_location(div, file$z, 68, 8, 2004);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, t);
},
p: function update(changed, ctx) {
if ((changed.clonedField) && t_value !== (t_value = ctx.clonedField.name + "")) {
set_data_dev(t, t_value);
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$5.name, type: "else", source: "(68:8) {:else}", ctx });
return block;
}
// (66:8) {#if isNew}
function create_if_block_6(ctx) {
var updating_text, current;
function textbox_text_binding(value) {
ctx.textbox_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Field Name" };
if (ctx.clonedField.name !== void 0) {
textbox_props.text = ctx.clonedField.name;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding));
const block = {
c: function create() {
textbox.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(textbox, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var textbox_changes = {};
if (!updating_text && changed.clonedField) {
textbox_changes.text = ctx.clonedField.name;
}
textbox.$set(textbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(textbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(textbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(textbox, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_6.name, type: "if", source: "(66:8) {#if isNew}", ctx });
return block;
}
// (103:55)
function create_if_block_5(ctx) {
var updating_value, t, updating_value_1, current;
function numberbox0_value_binding_1(value) {
ctx.numberbox0_value_binding_1.call(null, value);
updating_value = true;
add_flush_callback(() => updating_value = false);
}
let numberbox0_props = { label: "Min Length" };
if (ctx.clonedField.typeOptions.minLength !== void 0) {
numberbox0_props.value = ctx.clonedField.typeOptions.minLength;
}
var numberbox0 = new NumberBox({ props: numberbox0_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox0, 'value', numberbox0_value_binding_1));
function numberbox1_value_binding_1(value_1) {
ctx.numberbox1_value_binding_1.call(null, value_1);
updating_value_1 = true;
add_flush_callback(() => updating_value_1 = false);
}
let numberbox1_props = { label: "Max Length" };
if (ctx.clonedField.typeOptions.maxLength !== void 0) {
numberbox1_props.value = ctx.clonedField.typeOptions.maxLength;
}
var numberbox1 = new NumberBox({ props: numberbox1_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox1, 'value', numberbox1_value_binding_1));
const block = {
c: function create() {
numberbox0.$$.fragment.c();
t = space();
numberbox1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(numberbox0, target, anchor);
insert_dev(target, t, anchor);
mount_component(numberbox1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var numberbox0_changes = {};
if (!updating_value && changed.clonedField) {
numberbox0_changes.value = ctx.clonedField.typeOptions.minLength;
}
numberbox0.$set(numberbox0_changes);
var numberbox1_changes = {};
if (!updating_value_1 && changed.clonedField) {
numberbox1_changes.value = ctx.clonedField.typeOptions.maxLength;
}
numberbox1.$set(numberbox1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(numberbox0.$$.fragment, local);
transition_in(numberbox1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(numberbox0.$$.fragment, local);
transition_out(numberbox1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(numberbox0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(numberbox1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_5.name, type: "if", source: "(103:55) ", ctx });
return block;
}
// (87:51)
function create_if_block_4$1(ctx) {
var updating_selected, t0, updating_selected_1, t1, updating_text, current;
function dropdown0_selected_binding(value) {
ctx.dropdown0_selected_binding.call(null, value);
updating_selected = true;
add_flush_callback(() => updating_selected = false);
}
let dropdown0_props = {
label: "Lookup Index",
options: ctx.possibleReferenceIndexes,
valueMember: func$1,
textMember: func_1
};
if (ctx.clonedField.typeOptions.indexNodeKey !== void 0) {
dropdown0_props.selected = ctx.clonedField.typeOptions.indexNodeKey;
}
var dropdown0 = new Dropdown({ props: dropdown0_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown0, 'selected', dropdown0_selected_binding));
function dropdown1_selected_binding(value_1) {
ctx.dropdown1_selected_binding.call(null, value_1);
updating_selected_1 = true;
add_flush_callback(() => updating_selected_1 = false);
}
let dropdown1_props = {
label: "Reverse Reference Index",
options: ctx.possibleReverseReferenceIndexes,
multiple: "true",
valueMember: func_2,
textMember: func_3
};
if (ctx.clonedField.typeOptions.reverseIndexNodeKeys !== void 0) {
dropdown1_props.selected = ctx.clonedField.typeOptions.reverseIndexNodeKeys;
}
var dropdown1 = new Dropdown({ props: dropdown1_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown1, 'selected', dropdown1_selected_binding));
function textbox_text_binding_2(value_2) {
ctx.textbox_text_binding_2.call(null, value_2);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Display Value" };
if (ctx.clonedField.typeOptions.displayValue !== void 0) {
textbox_props.text = ctx.clonedField.typeOptions.displayValue;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding_2));
const block = {
c: function create() {
dropdown0.$$.fragment.c();
t0 = space();
dropdown1.$$.fragment.c();
t1 = space();
textbox.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(dropdown0, target, anchor);
insert_dev(target, t0, anchor);
mount_component(dropdown1, target, anchor);
insert_dev(target, t1, anchor);
mount_component(textbox, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var dropdown0_changes = {};
if (changed.possibleReferenceIndexes) dropdown0_changes.options = ctx.possibleReferenceIndexes;
if (!updating_selected && changed.clonedField) {
dropdown0_changes.selected = ctx.clonedField.typeOptions.indexNodeKey;
}
dropdown0.$set(dropdown0_changes);
var dropdown1_changes = {};
if (changed.possibleReverseReferenceIndexes) dropdown1_changes.options = ctx.possibleReverseReferenceIndexes;
if (!updating_selected_1 && changed.clonedField) {
dropdown1_changes.selected = ctx.clonedField.typeOptions.reverseIndexNodeKeys;
}
dropdown1.$set(dropdown1_changes);
var textbox_changes = {};
if (!updating_text && changed.clonedField) {
textbox_changes.text = ctx.clonedField.typeOptions.displayValue;
}
textbox.$set(textbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(dropdown0.$$.fragment, local);
transition_in(dropdown1.$$.fragment, local);
transition_in(textbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(dropdown0.$$.fragment, local);
transition_out(dropdown1.$$.fragment, local);
transition_out(textbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(dropdown0, detaching);
if (detaching) {
detach_dev(t0);
}
destroy_component(dropdown1, detaching);
if (detaching) {
detach_dev(t1);
}
destroy_component(textbox, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_4$1.name, type: "if", source: "(87:51) ", ctx });
return block;
}
// (83:48)
function create_if_block_3$2(ctx) {
var updating_value, t0, updating_value_1, t1, updating_value_2, current;
function numberbox0_value_binding(value) {
ctx.numberbox0_value_binding.call(null, value);
updating_value = true;
add_flush_callback(() => updating_value = false);
}
let numberbox0_props = { label: "Min Value" };
if (ctx.clonedField.typeOptions.minValue !== void 0) {
numberbox0_props.value = ctx.clonedField.typeOptions.minValue;
}
var numberbox0 = new NumberBox({ props: numberbox0_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox0, 'value', numberbox0_value_binding));
function numberbox1_value_binding(value_1) {
ctx.numberbox1_value_binding.call(null, value_1);
updating_value_1 = true;
add_flush_callback(() => updating_value_1 = false);
}
let numberbox1_props = { label: "Max Value" };
if (ctx.clonedField.typeOptions.maxValue !== void 0) {
numberbox1_props.value = ctx.clonedField.typeOptions.maxValue;
}
var numberbox1 = new NumberBox({ props: numberbox1_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox1, 'value', numberbox1_value_binding));
function numberbox2_value_binding(value_2) {
ctx.numberbox2_value_binding.call(null, value_2);
updating_value_2 = true;
add_flush_callback(() => updating_value_2 = false);
}
let numberbox2_props = { label: "Decimal Places" };
if (ctx.clonedField.typeOptions.decimalPlaces !== void 0) {
numberbox2_props.value = ctx.clonedField.typeOptions.decimalPlaces;
}
var numberbox2 = new NumberBox({ props: numberbox2_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox2, 'value', numberbox2_value_binding));
const block = {
c: function create() {
numberbox0.$$.fragment.c();
t0 = space();
numberbox1.$$.fragment.c();
t1 = space();
numberbox2.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(numberbox0, target, anchor);
insert_dev(target, t0, anchor);
mount_component(numberbox1, target, anchor);
insert_dev(target, t1, anchor);
mount_component(numberbox2, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var numberbox0_changes = {};
if (!updating_value && changed.clonedField) {
numberbox0_changes.value = ctx.clonedField.typeOptions.minValue;
}
numberbox0.$set(numberbox0_changes);
var numberbox1_changes = {};
if (!updating_value_1 && changed.clonedField) {
numberbox1_changes.value = ctx.clonedField.typeOptions.maxValue;
}
numberbox1.$set(numberbox1_changes);
var numberbox2_changes = {};
if (!updating_value_2 && changed.clonedField) {
numberbox2_changes.value = ctx.clonedField.typeOptions.decimalPlaces;
}
numberbox2.$set(numberbox2_changes);
},
i: function intro(local) {
if (current) return;
transition_in(numberbox0.$$.fragment, local);
transition_in(numberbox1.$$.fragment, local);
transition_in(numberbox2.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(numberbox0.$$.fragment, local);
transition_out(numberbox1.$$.fragment, local);
transition_out(numberbox2.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(numberbox0, detaching);
if (detaching) {
detach_dev(t0);
}
destroy_component(numberbox1, detaching);
if (detaching) {
detach_dev(t1);
}
destroy_component(numberbox2, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_3$2.name, type: "if", source: "(83:48) ", ctx });
return block;
}
// (80:50)
function create_if_block_2$4(ctx) {
var updating_value, t, updating_value_1, current;
function datepicker0_value_binding(value) {
ctx.datepicker0_value_binding.call(null, value);
updating_value = true;
add_flush_callback(() => updating_value = false);
}
let datepicker0_props = { label: "Min Value" };
if (ctx.clonedField.typeOptions.minValue !== void 0) {
datepicker0_props.value = ctx.clonedField.typeOptions.minValue;
}
var datepicker0 = new DatePicker({ props: datepicker0_props, $$inline: true });
binding_callbacks.push(() => bind(datepicker0, 'value', datepicker0_value_binding));
function datepicker1_value_binding(value_1) {
ctx.datepicker1_value_binding.call(null, value_1);
updating_value_1 = true;
add_flush_callback(() => updating_value_1 = false);
}
let datepicker1_props = { label: "Max Value" };
if (ctx.clonedField.typeOptions.maxValue !== void 0) {
datepicker1_props.value = ctx.clonedField.typeOptions.maxValue;
}
var datepicker1 = new DatePicker({ props: datepicker1_props, $$inline: true });
binding_callbacks.push(() => bind(datepicker1, 'value', datepicker1_value_binding));
const block = {
c: function create() {
datepicker0.$$.fragment.c();
t = space();
datepicker1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(datepicker0, target, anchor);
insert_dev(target, t, anchor);
mount_component(datepicker1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var datepicker0_changes = {};
if (!updating_value && changed.clonedField) {
datepicker0_changes.value = ctx.clonedField.typeOptions.minValue;
}
datepicker0.$set(datepicker0_changes);
var datepicker1_changes = {};
if (!updating_value_1 && changed.clonedField) {
datepicker1_changes.value = ctx.clonedField.typeOptions.maxValue;
}
datepicker1.$set(datepicker1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(datepicker0.$$.fragment, local);
transition_in(datepicker1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(datepicker0.$$.fragment, local);
transition_out(datepicker1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(datepicker0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(datepicker1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$4.name, type: "if", source: "(80:50) ", ctx });
return block;
}
// (78:46)
function create_if_block_1$7(ctx) {
var updating_checked, current;
function checkbox_checked_binding_1(value) {
ctx.checkbox_checked_binding_1.call(null, value);
updating_checked = true;
add_flush_callback(() => updating_checked = false);
}
let checkbox_props = { label: "Allow Null" };
if (ctx.clonedField.typeOptions.allowNulls !== void 0) {
checkbox_props.checked = ctx.clonedField.typeOptions.allowNulls;
}
var checkbox = new Checkbox({ props: checkbox_props, $$inline: true });
binding_callbacks.push(() => bind(checkbox, 'checked', checkbox_checked_binding_1));
const block = {
c: function create() {
checkbox.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(checkbox, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var checkbox_changes = {};
if (!updating_checked && changed.clonedField) {
checkbox_changes.checked = ctx.clonedField.typeOptions.allowNulls;
}
checkbox.$set(checkbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(checkbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(checkbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(checkbox, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$7.name, type: "if", source: "(78:46) ", ctx });
return block;
}
// (74:8) {#if clonedField.type === "string"}
function create_if_block$h(ctx) {
var updating_value, t0, updating_values, t1, updating_checked, current;
function numberbox_value_binding(value) {
ctx.numberbox_value_binding.call(null, value);
updating_value = true;
add_flush_callback(() => updating_value = false);
}
let numberbox_props = { label: "Max Length" };
if (ctx.clonedField.typeOptions.maxLength !== void 0) {
numberbox_props.value = ctx.clonedField.typeOptions.maxLength;
}
var numberbox = new NumberBox({ props: numberbox_props, $$inline: true });
binding_callbacks.push(() => bind(numberbox, 'value', numberbox_value_binding));
function valueslist_values_binding(value_1) {
ctx.valueslist_values_binding.call(null, value_1);
updating_values = true;
add_flush_callback(() => updating_values = false);
}
let valueslist_props = { label: "Values (options)" };
if (ctx.clonedField.typeOptions.values !== void 0) {
valueslist_props.values = ctx.clonedField.typeOptions.values;
}
var valueslist = new ValuesList({ props: valueslist_props, $$inline: true });
binding_callbacks.push(() => bind(valueslist, 'values', valueslist_values_binding));
function checkbox_checked_binding(value_2) {
ctx.checkbox_checked_binding.call(null, value_2);
updating_checked = true;
add_flush_callback(() => updating_checked = false);
}
let checkbox_props = { label: "Declared Values Only" };
if (ctx.clonedField.typeOptions.allowDeclaredValuesOnly !== void 0) {
checkbox_props.checked = ctx.clonedField.typeOptions.allowDeclaredValuesOnly;
}
var checkbox = new Checkbox({ props: checkbox_props, $$inline: true });
binding_callbacks.push(() => bind(checkbox, 'checked', checkbox_checked_binding));
const block = {
c: function create() {
numberbox.$$.fragment.c();
t0 = space();
valueslist.$$.fragment.c();
t1 = space();
checkbox.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(numberbox, target, anchor);
insert_dev(target, t0, anchor);
mount_component(valueslist, target, anchor);
insert_dev(target, t1, anchor);
mount_component(checkbox, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var numberbox_changes = {};
if (!updating_value && changed.clonedField) {
numberbox_changes.value = ctx.clonedField.typeOptions.maxLength;
}
numberbox.$set(numberbox_changes);
var valueslist_changes = {};
if (!updating_values && changed.clonedField) {
valueslist_changes.values = ctx.clonedField.typeOptions.values;
}
valueslist.$set(valueslist_changes);
var checkbox_changes = {};
if (!updating_checked && changed.clonedField) {
checkbox_changes.checked = ctx.clonedField.typeOptions.allowDeclaredValuesOnly;
}
checkbox.$set(checkbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(numberbox.$$.fragment, local);
transition_in(valueslist.$$.fragment, local);
transition_in(checkbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(numberbox.$$.fragment, local);
transition_out(valueslist.$$.fragment, local);
transition_out(checkbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(numberbox, detaching);
if (detaching) {
detach_dev(t0);
}
destroy_component(valueslist, detaching);
if (detaching) {
detach_dev(t1);
}
destroy_component(checkbox, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$h.name, type: "if", source: "(74:8) {#if clonedField.type === \"string\"}", ctx });
return block;
}
// (111:8) <Button color="primary" grouped on:click={save}>
function create_default_slot_2$2(ctx) {
var t;
const block = {
c: function create() {
t = text("Save");
},
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$2.name, type: "slot", source: "(111:8) <Button color=\"primary\" grouped on:click={save}>", ctx });
return block;
}
// (112:8) <Button color="tertiary" grouped on:click={() => onFinished(false)}>
function create_default_slot_1$3(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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_1$3.name, type: "slot", source: "(112:8) <Button color=\"tertiary\" grouped on:click={() => onFinished(false)}>", ctx });
return block;
}
// (110:4) <ButtonGroup style="float: right;">
function create_default_slot$5(ctx) {
var t, current;
var button0 = new Button({
props: {
color: "primary",
grouped: true,
$$slots: { default: [create_default_slot_2$2] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.save);
var button1 = new Button({
props: {
color: "tertiary",
grouped: true,
$$slots: { default: [create_default_slot_1$3] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.click_handler);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$5.name, type: "slot", source: "(110:4) <ButtonGroup style=\"float: right;\">", ctx });
return block;
}
function create_fragment$y(ctx) {
var div, t0, form, updating_selected, t1, current_block_type_index, if_block0, t2, updating_text, t3, show_if, current_block_type_index_1, if_block1, t4, current;
var errorsbox = new ErrorsBox({
props: { errors: ctx.errors },
$$inline: true
});
function dropdown_selected_binding(value) {
ctx.dropdown_selected_binding.call(null, value);
updating_selected = true;
add_flush_callback(() => updating_selected = false);
}
let dropdown_props = { label: "Type", options: fp_32(allTypes$1) };
if (ctx.clonedField.type !== void 0) {
dropdown_props.selected = ctx.clonedField.type;
}
var dropdown = new Dropdown({ props: dropdown_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown, 'selected', dropdown_selected_binding));
dropdown.$on("change", ctx.typeChanged);
var if_block_creators = [
create_if_block_6,
create_else_block$5
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.isNew) return 0;
return 1;
}
current_block_type_index = select_block_type(null, ctx);
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
function textbox_text_binding_1(value_1) {
ctx.textbox_text_binding_1.call(null, value_1);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Label" };
if (ctx.clonedField.label !== void 0) {
textbox_props.text = ctx.clonedField.label;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding_1));
var if_block_creators_1 = [
create_if_block$h,
create_if_block_1$7,
create_if_block_2$4,
create_if_block_3$2,
create_if_block_4$1,
create_if_block_5
];
var if_blocks_1 = [];
function select_block_type_1(changed, ctx) {
if (ctx.clonedField.type === "string") return 0;
if (ctx.clonedField.type === "bool") return 1;
if (ctx.clonedField.type === "datetime") return 2;
if (ctx.clonedField.type === "number") return 3;
if (ctx.clonedField.type === "reference") return 4;
if ((show_if == null) || changed.clonedField) show_if = !!(ctx.clonedField.type.startsWith("array"));
if (show_if) return 5;
return -1;
}
if (~(current_block_type_index_1 = select_block_type_1(null, ctx))) {
if_block1 = if_blocks_1[current_block_type_index_1] = if_block_creators_1[current_block_type_index_1](ctx);
}
var buttongroup = new ButtonGroup({
props: {
style: "float: right;",
$$slots: { default: [create_default_slot$5] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
errorsbox.$$.fragment.c();
t0 = space();
form = element("form");
dropdown.$$.fragment.c();
t1 = space();
if_block0.c();
t2 = space();
textbox.$$.fragment.c();
t3 = space();
if (if_block1) if_block1.c();
t4 = space();
buttongroup.$$.fragment.c();
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$z, 61, 4, 1740);
attr_dev(div, "class", "root");
add_location(div, file$z, 57, 0, 1681);
},
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);
mount_component(errorsbox, div, null);
append_dev(div, t0);
append_dev(div, form);
mount_component(dropdown, form, null);
append_dev(form, t1);
if_blocks[current_block_type_index].m(form, null);
append_dev(form, t2);
mount_component(textbox, form, null);
append_dev(form, t3);
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].m(form, null);
append_dev(div, t4);
mount_component(buttongroup, div, null);
current = true;
},
p: function update(changed, ctx) {
var errorsbox_changes = {};
if (changed.errors) errorsbox_changes.errors = ctx.errors;
errorsbox.$set(errorsbox_changes);
var dropdown_changes = {};
if (!updating_selected && changed.clonedField) {
dropdown_changes.selected = ctx.clonedField.type;
}
dropdown.$set(dropdown_changes);
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(changed, ctx);
} else {
group_outros();
transition_out(if_blocks[previous_block_index], 1, 1, () => {
if_blocks[previous_block_index] = null;
});
check_outros();
if_block0 = if_blocks[current_block_type_index];
if (!if_block0) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
if_block0.c();
}
transition_in(if_block0, 1);
if_block0.m(form, t2);
}
var textbox_changes = {};
if (!updating_text && changed.clonedField) {
textbox_changes.text = ctx.clonedField.label;
}
textbox.$set(textbox_changes);
var previous_block_index_1 = current_block_type_index_1;
current_block_type_index_1 = select_block_type_1(changed, ctx);
if (current_block_type_index_1 === previous_block_index_1) {
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].p(changed, ctx);
} else {
if (if_block1) {
group_outros();
transition_out(if_blocks_1[previous_block_index_1], 1, 1, () => {
if_blocks_1[previous_block_index_1] = null;
});
check_outros();
}
if (~current_block_type_index_1) {
if_block1 = if_blocks_1[current_block_type_index_1];
if (!if_block1) {
if_block1 = if_blocks_1[current_block_type_index_1] = if_block_creators_1[current_block_type_index_1](ctx);
if_block1.c();
}
transition_in(if_block1, 1);
if_block1.m(form, null);
} else {
if_block1 = null;
}
}
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(errorsbox.$$.fragment, local);
transition_in(dropdown.$$.fragment, local);
transition_in(if_block0);
transition_in(textbox.$$.fragment, local);
transition_in(if_block1);
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(errorsbox.$$.fragment, local);
transition_out(dropdown.$$.fragment, local);
transition_out(if_block0);
transition_out(textbox.$$.fragment, local);
transition_out(if_block1);
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(errorsbox);
destroy_component(dropdown);
if_blocks[current_block_type_index].d();
destroy_component(textbox);
if (~current_block_type_index_1) if_blocks_1[current_block_type_index_1].d();
destroy_component(buttongroup);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$y.name, type: "component", source: "", ctx });
return block;
}
const func$1 = (n) => n.nodeKey();
const func_1 = (n) => n.name;
const func_2 = (n) => n.nodeKey();
const func_3 = (n) => n.name;
function instance$y($$self, $$props, $$invalidate) {
let { field, allFields, onFinished = () => {} } = $$props;
let { store } = $$props;
let errors = [];
let clonedField = fp_4(field);
const typeChanged = (ev) =>
$$invalidate('clonedField', clonedField.typeOptions = getDefaultTypeOptions(ev.detail), clonedField);
const save = () => {
$$invalidate('errors', errors = validate$1.field(allFields)(clonedField));
if(errors.length > 0) return;
$$invalidate('field', field.typeOptions = fp_4(clonedField.typeOptions), field);
onFinished(
fp_53(field)(clonedField)
);
};
const writable_props = ['field', 'allFields', 'onFinished', 'store'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<FieldView> was created with unknown prop '${key}'`);
});
function dropdown_selected_binding(value) {
clonedField.type = value;
$$invalidate('clonedField', clonedField);
}
function textbox_text_binding(value) {
clonedField.name = value;
$$invalidate('clonedField', clonedField);
}
function textbox_text_binding_1(value_1) {
clonedField.label = value_1;
$$invalidate('clonedField', clonedField);
}
function numberbox_value_binding(value) {
clonedField.typeOptions.maxLength = value;
$$invalidate('clonedField', clonedField);
}
function valueslist_values_binding(value_1) {
clonedField.typeOptions.values = value_1;
$$invalidate('clonedField', clonedField);
}
function checkbox_checked_binding(value_2) {
clonedField.typeOptions.allowDeclaredValuesOnly = value_2;
$$invalidate('clonedField', clonedField);
}
function checkbox_checked_binding_1(value) {
clonedField.typeOptions.allowNulls = value;
$$invalidate('clonedField', clonedField);
}
function datepicker0_value_binding(value) {
clonedField.typeOptions.minValue = value;
$$invalidate('clonedField', clonedField);
}
function datepicker1_value_binding(value_1) {
clonedField.typeOptions.maxValue = value_1;
$$invalidate('clonedField', clonedField);
}
function numberbox0_value_binding(value) {
clonedField.typeOptions.minValue = value;
$$invalidate('clonedField', clonedField);
}
function numberbox1_value_binding(value_1) {
clonedField.typeOptions.maxValue = value_1;
$$invalidate('clonedField', clonedField);
}
function numberbox2_value_binding(value_2) {
clonedField.typeOptions.decimalPlaces = value_2;
$$invalidate('clonedField', clonedField);
}
function dropdown0_selected_binding(value) {
clonedField.typeOptions.indexNodeKey = value;
$$invalidate('clonedField', clonedField);
}
function dropdown1_selected_binding(value_1) {
clonedField.typeOptions.reverseIndexNodeKeys = value_1;
$$invalidate('clonedField', clonedField);
}
function textbox_text_binding_2(value_2) {
clonedField.typeOptions.displayValue = value_2;
$$invalidate('clonedField', clonedField);
}
function numberbox0_value_binding_1(value) {
clonedField.typeOptions.minLength = value;
$$invalidate('clonedField', clonedField);
}
function numberbox1_value_binding_1(value_1) {
clonedField.typeOptions.maxLength = value_1;
$$invalidate('clonedField', clonedField);
}
const click_handler = () => onFinished(false);
$$self.$set = $$props => {
if ('field' in $$props) $$invalidate('field', field = $$props.field);
if ('allFields' in $$props) $$invalidate('allFields', allFields = $$props.allFields);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('store' in $$props) $$invalidate('store', store = $$props.store);
};
$$self.$capture_state = () => {
return { field, allFields, onFinished, store, errors, clonedField, isNew, possibleReferenceIndexes, selectedReverseRefIndex, possibleReverseReferenceIndexes };
};
$$self.$inject_state = $$props => {
if ('field' in $$props) $$invalidate('field', field = $$props.field);
if ('allFields' in $$props) $$invalidate('allFields', allFields = $$props.allFields);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('store' in $$props) $$invalidate('store', store = $$props.store);
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('clonedField' in $$props) $$invalidate('clonedField', clonedField = $$props.clonedField);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
if ('possibleReferenceIndexes' in $$props) $$invalidate('possibleReferenceIndexes', possibleReferenceIndexes = $$props.possibleReferenceIndexes);
if ('selectedReverseRefIndex' in $$props) $$invalidate('selectedReverseRefIndex', selectedReverseRefIndex = $$props.selectedReverseRefIndex);
if ('possibleReverseReferenceIndexes' in $$props) $$invalidate('possibleReverseReferenceIndexes', possibleReverseReferenceIndexes = $$props.possibleReverseReferenceIndexes);
};
let isNew, possibleReferenceIndexes, selectedReverseRefIndex, possibleReverseReferenceIndexes;
$$self.$$.update = ($$dirty = { field: 1, store: 1, clonedField: 1, selectedReverseRefIndex: 1 }) => {
if ($$dirty.field) { $$invalidate('isNew', isNew = !!field && field.name.length === 0); }
if ($$dirty.store) { $$invalidate('possibleReferenceIndexes', possibleReferenceIndexes = getPotentialReferenceIndexes(
store.hierarchy, store.currentNode
)); }
if ($$dirty.clonedField || $$dirty.store) { $$invalidate('selectedReverseRefIndex', selectedReverseRefIndex =
!clonedField.typeOptions.indexNodeKey
? ""
: getNode$1(store.hierarchy, clonedField.typeOptions.indexNodeKey)); }
if ($$dirty.selectedReverseRefIndex || $$dirty.store) { $$invalidate('possibleReverseReferenceIndexes', possibleReverseReferenceIndexes =
!selectedReverseRefIndex
? []
: getPotentialReverseReferenceIndexes(
store.hierarchy, selectedReverseRefIndex)); }
};
return {
field,
allFields,
onFinished,
store,
errors,
clonedField,
typeChanged,
save,
isNew,
possibleReferenceIndexes,
possibleReverseReferenceIndexes,
dropdown_selected_binding,
textbox_text_binding,
textbox_text_binding_1,
numberbox_value_binding,
valueslist_values_binding,
checkbox_checked_binding,
checkbox_checked_binding_1,
datepicker0_value_binding,
datepicker1_value_binding,
numberbox0_value_binding,
numberbox1_value_binding,
numberbox2_value_binding,
dropdown0_selected_binding,
dropdown1_selected_binding,
textbox_text_binding_2,
numberbox0_value_binding_1,
numberbox1_value_binding_1,
click_handler
};
}
class FieldView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$y, create_fragment$y, safe_not_equal, ["field", "allFields", "onFinished", "store"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "FieldView", options, id: create_fragment$y.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.field === undefined && !('field' in props)) {
console.warn("<FieldView> was created without expected prop 'field'");
}
if (ctx.allFields === undefined && !('allFields' in props)) {
console.warn("<FieldView> was created without expected prop 'allFields'");
}
if (ctx.store === undefined && !('store' in props)) {
console.warn("<FieldView> was created without expected prop 'store'");
}
}
get field() {
throw new Error("<FieldView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set field(value) {
throw new Error("<FieldView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allFields() {
throw new Error("<FieldView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allFields(value) {
throw new Error("<FieldView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onFinished() {
throw new Error("<FieldView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onFinished(value) {
throw new Error("<FieldView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get store() {
throw new Error("<FieldView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set store(value) {
throw new Error("<FieldView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\database\RecordView.svelte generated by Svelte v3.12.1 */
const file$A = "src\\database\\RecordView.svelte";
function get_each_context$f(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.index = list[i];
return child_ctx;
}
function get_each_context_1$9(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.field = list[i];
return child_ctx;
}
// (93:8) {#if !record.isSingle}
function create_if_block_3$3(ctx) {
var updating_text, t, updating_text_1, current;
function textbox0_text_binding(value) {
ctx.textbox0_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox0_props = { label: "Collection Name:" };
if (ctx.record.collectionName !== void 0) {
textbox0_props.text = ctx.record.collectionName;
}
var textbox0 = new Textbox({ props: textbox0_props, $$inline: true });
binding_callbacks.push(() => bind(textbox0, 'text', textbox0_text_binding));
function textbox1_text_binding(value_1) {
ctx.textbox1_text_binding.call(null, value_1);
updating_text_1 = true;
add_flush_callback(() => updating_text_1 = false);
}
let textbox1_props = { label: "Shard Factor:" };
if (ctx.record.allidsShardFactor !== void 0) {
textbox1_props.text = ctx.record.allidsShardFactor;
}
var textbox1 = new Textbox({ props: textbox1_props, $$inline: true });
binding_callbacks.push(() => bind(textbox1, 'text', textbox1_text_binding));
const block = {
c: function create() {
textbox0.$$.fragment.c();
t = space();
textbox1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(textbox0, target, anchor);
insert_dev(target, t, anchor);
mount_component(textbox1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var textbox0_changes = {};
if (!updating_text && changed.record) {
textbox0_changes.text = ctx.record.collectionName;
}
textbox0.$set(textbox0_changes);
var textbox1_changes = {};
if (!updating_text_1 && changed.record) {
textbox1_changes.text = ctx.record.allidsShardFactor;
}
textbox1.$set(textbox1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(textbox0.$$.fragment, local);
transition_in(textbox1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(textbox0.$$.fragment, local);
transition_out(textbox1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(textbox0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(textbox1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_3$3.name, type: "if", source: "(93:8) {#if !record.isSingle}", ctx });
return block;
}
// (131:4) {:else}
function create_else_block_1$1(ctx) {
var t;
const block = {
c: function create() {
t = text("(no fields added)");
},
m: function mount(target, anchor) {
insert_dev(target, t, anchor);
},
p: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(t);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block_1$1.name, type: "else", source: "(131:4) {:else}", ctx });
return block;
}
// (104:4) {#if record.fields.length > 0}
function create_if_block_2$5(ctx) {
var table, thead, tr, th0, t1, th1, t3, th2, t5, th3, t6, tbody;
let each_value_1 = ctx.record.fields;
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1$9(get_each_context_1$9(ctx, each_value_1, i));
}
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Name";
t1 = space();
th1 = element("th");
th1.textContent = "Type";
t3 = space();
th2 = element("th");
th2.textContent = "Options";
t5 = space();
th3 = element("th");
t6 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(th0, "class", "svelte-18xd5y3");
add_location(th0, file$A, 107, 16, 2954);
attr_dev(th1, "class", "svelte-18xd5y3");
add_location(th1, file$A, 108, 16, 2984);
attr_dev(th2, "class", "svelte-18xd5y3");
add_location(th2, file$A, 109, 16, 3014);
attr_dev(th3, "class", "svelte-18xd5y3");
add_location(th3, file$A, 110, 16, 3047);
attr_dev(tr, "class", "svelte-18xd5y3");
add_location(tr, file$A, 106, 12, 2933);
attr_dev(thead, "class", "svelte-18xd5y3");
add_location(thead, file$A, 105, 8, 2913);
attr_dev(tbody, "class", "svelte-18xd5y3");
add_location(tbody, file$A, 113, 8, 3100);
attr_dev(table, "class", "fields-table uk-table svelte-18xd5y3");
add_location(table, file$A, 104, 4, 2867);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(tr, t5);
append_dev(tr, th3);
append_dev(table, t6);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
},
p: function update(changed, ctx) {
if (changed.getIcon || changed.getTypeOptions || changed.record) {
each_value_1 = ctx.record.fields;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1$9(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block_1$9(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(table);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$5.name, type: "if", source: "(104:4) {#if record.fields.length > 0}", ctx });
return block;
}
// (115:12) {#each record.fields as field}
function create_each_block_1$9(ctx) {
var tr, td0, div0, t0_value = ctx.field.label + "", t0, t1, div1, t2_value = ctx.field.name + "", t2, t3, td1, t4_value = ctx.field.type + "", t4, t5, td2, raw0_value = ctx.getTypeOptions(ctx.field.typeOptions) + "", t6, td3, span0, raw1_value = getIcon("edit") + "", t7, span1, raw2_value = getIcon("trash") + "", t8, dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
div1 = element("div");
t2 = text(t2_value);
t3 = space();
td1 = element("td");
t4 = text(t4_value);
t5 = space();
td2 = element("td");
t6 = space();
td3 = element("td");
span0 = element("span");
t7 = space();
span1 = element("span");
t8 = space();
attr_dev(div0, "class", "field-label svelte-18xd5y3");
add_location(div0, file$A, 117, 20, 3210);
set_style(div1, "font-size", "0.8em");
set_style(div1, "color", "var(--slate)");
add_location(div1, file$A, 118, 20, 3275);
attr_dev(td0, "class", "svelte-18xd5y3");
add_location(td0, file$A, 116, 16, 3184);
attr_dev(td1, "class", "svelte-18xd5y3");
add_location(td1, file$A, 120, 16, 3383);
attr_dev(td2, "class", "svelte-18xd5y3");
add_location(td2, file$A, 121, 16, 3422);
attr_dev(span0, "class", "edit-button svelte-18xd5y3");
add_location(span0, file$A, 123, 20, 3515);
attr_dev(span1, "class", "edit-button svelte-18xd5y3");
add_location(span1, file$A, 124, 20, 3626);
attr_dev(td3, "class", "svelte-18xd5y3");
add_location(td3, file$A, 122, 16, 3490);
attr_dev(tr, "class", "svelte-18xd5y3");
add_location(tr, file$A, 115, 12, 3163);
dispose = [
listen_dev(span0, "click", click_handler),
listen_dev(span1, "click", click_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, div0);
append_dev(div0, t0);
append_dev(td0, t1);
append_dev(td0, div1);
append_dev(div1, t2);
append_dev(tr, t3);
append_dev(tr, td1);
append_dev(td1, t4);
append_dev(tr, t5);
append_dev(tr, td2);
td2.innerHTML = raw0_value;
append_dev(tr, t6);
append_dev(tr, td3);
append_dev(td3, span0);
span0.innerHTML = raw1_value;
append_dev(td3, t7);
append_dev(td3, span1);
span1.innerHTML = raw2_value;
append_dev(tr, t8);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.record) && t0_value !== (t0_value = ctx.field.label + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.record) && t2_value !== (t2_value = ctx.field.name + "")) {
set_data_dev(t2, t2_value);
}
if ((changed.record) && t4_value !== (t4_value = ctx.field.type + "")) {
set_data_dev(t4, t4_value);
}
if ((changed.record) && raw0_value !== (raw0_value = ctx.getTypeOptions(ctx.field.typeOptions) + "")) {
td2.innerHTML = raw0_value;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(tr);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$9.name, type: "each", source: "(115:12) {#each record.fields as field}", ctx });
return block;
}
// (135:4) {#if editingField}
function create_if_block_1$8(ctx) {
var updating_isOpen, current;
function modal_isOpen_binding(value) {
ctx.modal_isOpen_binding.call(null, value);
updating_isOpen = true;
add_flush_callback(() => updating_isOpen = false);
}
let modal_props = {
$$slots: { default: [create_default_slot$6] },
$$scope: { ctx }
};
if (ctx.editingField !== void 0) {
modal_props.isOpen = ctx.editingField;
}
var modal = new Modal({ props: modal_props, $$inline: true });
binding_callbacks.push(() => bind(modal, 'isOpen', modal_isOpen_binding));
const block = {
c: function create() {
modal.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(modal, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var modal_changes = {};
if (changed.$$scope || changed.fieldToEdit || changed.onFinishedFieldEdit || changed.record || changed.$store) modal_changes.$$scope = { changed, ctx };
if (!updating_isOpen && changed.editingField) {
modal_changes.isOpen = ctx.editingField;
}
modal.$set(modal_changes);
},
i: function intro(local) {
if (current) return;
transition_in(modal.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(modal.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(modal, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$8.name, type: "if", source: "(135:4) {#if editingField}", ctx });
return block;
}
// (136:4) <Modal bind:isOpen={editingField}>
function create_default_slot$6(ctx) {
var current;
var fieldview = new FieldView({
props: {
field: ctx.fieldToEdit,
onFinished: ctx.onFinishedFieldEdit,
allFields: ctx.record.fields,
store: ctx.$store
},
$$inline: true
});
const block = {
c: function create() {
fieldview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(fieldview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var fieldview_changes = {};
if (changed.fieldToEdit) fieldview_changes.field = ctx.fieldToEdit;
if (changed.onFinishedFieldEdit) fieldview_changes.onFinished = ctx.onFinishedFieldEdit;
if (changed.record) fieldview_changes.allFields = ctx.record.fields;
if (changed.$store) fieldview_changes.store = ctx.$store;
fieldview.$set(fieldview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(fieldview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(fieldview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(fieldview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$6.name, type: "slot", source: "(136:4) <Modal bind:isOpen={editingField}>", ctx });
return block;
}
// (171:4) {:else}
function create_else_block$6(ctx) {
var div;
const block = {
c: function create() {
div = element("div");
div.textContent = "No indexes added.\n ";
attr_dev(div, "class", "no-indexes svelte-18xd5y3");
add_location(div, file$A, 171, 4, 5114);
},
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_else_block$6.name, type: "else", source: "(171:4) {:else}", ctx });
return block;
}
// (164:8) {#if index.filter}
function create_if_block$i(ctx) {
var div, span, t1, code, t2_value = ctx.index.filter + "", t2;
const block = {
c: function create() {
div = element("div");
span = element("span");
span.textContent = "filter:";
t1 = space();
code = element("code");
t2 = text(t2_value);
attr_dev(span, "class", "index-label svelte-18xd5y3");
add_location(span, file$A, 165, 12, 4953);
attr_dev(code, "class", "index-mapfilter svelte-18xd5y3");
add_location(code, file$A, 166, 12, 5006);
attr_dev(div, "class", "index-field-row svelte-18xd5y3");
add_location(div, file$A, 164, 8, 4911);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, span);
append_dev(div, t1);
append_dev(div, code);
append_dev(code, t2);
},
p: function update(changed, ctx) {
if ((changed.record) && t2_value !== (t2_value = ctx.index.filter + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$i.name, type: "if", source: "(164:8) {#if index.filter}", ctx });
return block;
}
// (148:4) {#each record.indexes as index}
function create_each_block$f(ctx) {
var div3, div0, t0_value = ctx.index.name + "", t0, t1, span0, raw_value = getIcon("edit") + "", t2, div1, span1, t4, span2, t5_value = ctx.getIndexAllowedRecords(ctx.index) + "", t5, t6, span3, t8, span4, t9_value = ctx.index.indexType + "", t9, t10, div2, span5, t12, code, t13_value = ctx.index.map + "", t13, t14, t15, dispose;
function click_handler_2() {
return ctx.click_handler_2(ctx);
}
var if_block = (ctx.index.filter) && create_if_block$i(ctx);
const block = {
c: function create() {
div3 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
span0 = element("span");
t2 = space();
div1 = element("div");
span1 = element("span");
span1.textContent = "records indexed:";
t4 = space();
span2 = element("span");
t5 = text(t5_value);
t6 = space();
span3 = element("span");
span3.textContent = "type:";
t8 = space();
span4 = element("span");
t9 = text(t9_value);
t10 = space();
div2 = element("div");
span5 = element("span");
span5.textContent = "map:";
t12 = space();
code = element("code");
t13 = text(t13_value);
t14 = space();
if (if_block) if_block.c();
t15 = space();
set_style(span0, "margin-left", "7px");
add_location(span0, file$A, 151, 12, 4306);
attr_dev(div0, "class", "index-name svelte-18xd5y3");
add_location(div0, file$A, 149, 8, 4244);
attr_dev(span1, "class", "index-label svelte-18xd5y3");
add_location(span1, file$A, 154, 12, 4467);
add_location(span2, file$A, 155, 12, 4531);
attr_dev(span3, "class", "index-label svelte-18xd5y3");
set_style(span3, "margin-left", "15px");
add_location(span3, file$A, 156, 12, 4588);
add_location(span4, file$A, 157, 12, 4666);
attr_dev(div1, "class", "index-field-row svelte-18xd5y3");
add_location(div1, file$A, 153, 8, 4425);
attr_dev(span5, "class", "index-label svelte-18xd5y3");
add_location(span5, file$A, 160, 12, 4762);
attr_dev(code, "class", "index-mapfilter svelte-18xd5y3");
add_location(code, file$A, 161, 12, 4812);
attr_dev(div2, "class", "index-field-row svelte-18xd5y3");
add_location(div2, file$A, 159, 8, 4720);
attr_dev(div3, "class", "index-container svelte-18xd5y3");
add_location(div3, file$A, 148, 4, 4206);
dispose = listen_dev(span0, "click", click_handler_2);
},
m: function mount(target, anchor) {
insert_dev(target, div3, anchor);
append_dev(div3, div0);
append_dev(div0, t0);
append_dev(div0, t1);
append_dev(div0, span0);
span0.innerHTML = raw_value;
append_dev(div3, t2);
append_dev(div3, div1);
append_dev(div1, span1);
append_dev(div1, t4);
append_dev(div1, span2);
append_dev(span2, t5);
append_dev(div1, t6);
append_dev(div1, span3);
append_dev(div1, t8);
append_dev(div1, span4);
append_dev(span4, t9);
append_dev(div3, t10);
append_dev(div3, div2);
append_dev(div2, span5);
append_dev(div2, t12);
append_dev(div2, code);
append_dev(code, t13);
append_dev(div3, t14);
if (if_block) if_block.m(div3, null);
append_dev(div3, t15);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.record) && t0_value !== (t0_value = ctx.index.name + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.getIndexAllowedRecords || changed.record) && t5_value !== (t5_value = ctx.getIndexAllowedRecords(ctx.index) + "")) {
set_data_dev(t5, t5_value);
}
if ((changed.record) && t9_value !== (t9_value = ctx.index.indexType + "")) {
set_data_dev(t9, t9_value);
}
if ((changed.record) && t13_value !== (t13_value = ctx.index.map + "")) {
set_data_dev(t13, t13_value);
}
if (ctx.index.filter) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block$i(ctx);
if_block.c();
if_block.m(div3, t15);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
if (if_block) if_block.d();
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$f.name, type: "each", source: "(148:4) {#each record.indexes as index}", ctx });
return block;
}
function create_fragment$z(ctx) {
var div1, form, h30, t1, updating_text, t2, t3, div0, t4_value = ctx.record.nodeKey() + "", t4, t5, h31, t6, span, raw_value = getIcon("plus") + "", t7, t8, t9, h32, t11, current, dispose;
function textbox_text_binding(value) {
ctx.textbox_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Name:" };
if (ctx.record.name !== void 0) {
textbox_props.text = ctx.record.name;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding));
var if_block0 = (!ctx.record.isSingle) && create_if_block_3$3(ctx);
function select_block_type(changed, ctx) {
if (ctx.record.fields.length > 0) return create_if_block_2$5;
return create_else_block_1$1;
}
var current_block_type = select_block_type(null, ctx);
var if_block1 = current_block_type(ctx);
var if_block2 = (ctx.editingField) && create_if_block_1$8(ctx);
let each_value = ctx.record.indexes;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$f(get_each_context$f(ctx, each_value, i));
}
let each_1_else = null;
if (!each_value.length) {
each_1_else = create_else_block$6(ctx);
each_1_else.c();
}
const block = {
c: function create() {
div1 = element("div");
form = element("form");
h30 = element("h3");
h30.textContent = "Settings";
t1 = space();
textbox.$$.fragment.c();
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
div0 = element("div");
t4 = text(t4_value);
t5 = space();
h31 = element("h3");
t6 = text("Fields ");
span = element("span");
t7 = space();
if_block1.c();
t8 = space();
if (if_block2) if_block2.c();
t9 = space();
h32 = element("h3");
h32.textContent = "Indexes";
t11 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr_dev(h30, "class", "settings-title svelte-18xd5y3");
add_location(h30, file$A, 87, 8, 2306);
attr_dev(div0, "class", "recordkey svelte-18xd5y3");
add_location(div0, file$A, 96, 8, 2636);
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$A, 86, 4, 2264);
attr_dev(span, "class", "add-field-button svelte-18xd5y3");
add_location(span, file$A, 100, 15, 2735);
attr_dev(h31, "class", "title svelte-18xd5y3");
add_location(h31, file$A, 99, 4, 2701);
attr_dev(h32, "class", "title svelte-18xd5y3");
add_location(h32, file$A, 143, 4, 4119);
attr_dev(div1, "class", "root svelte-18xd5y3");
add_location(div1, file$A, 84, 0, 2240);
dispose = listen_dev(span, "click", ctx.newField);
},
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, form);
append_dev(form, h30);
append_dev(form, t1);
mount_component(textbox, form, null);
append_dev(form, t2);
if (if_block0) if_block0.m(form, null);
append_dev(form, t3);
append_dev(form, div0);
append_dev(div0, t4);
append_dev(div1, t5);
append_dev(div1, h31);
append_dev(h31, t6);
append_dev(h31, span);
span.innerHTML = raw_value;
append_dev(div1, t7);
if_block1.m(div1, null);
append_dev(div1, t8);
if (if_block2) if_block2.m(div1, null);
append_dev(div1, t9);
append_dev(div1, h32);
append_dev(div1, t11);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
if (each_1_else) {
each_1_else.m(div1, null);
}
current = true;
},
p: function update(changed, ctx) {
var textbox_changes = {};
if (!updating_text && changed.record) {
textbox_changes.text = ctx.record.name;
}
textbox.$set(textbox_changes);
if (!ctx.record.isSingle) {
if (if_block0) {
if_block0.p(changed, ctx);
transition_in(if_block0, 1);
} else {
if_block0 = create_if_block_3$3(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(form, t3);
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if ((!current || changed.record) && t4_value !== (t4_value = ctx.record.nodeKey() + "")) {
set_data_dev(t4, t4_value);
}
if (current_block_type === (current_block_type = select_block_type(changed, ctx)) && if_block1) {
if_block1.p(changed, ctx);
} else {
if_block1.d(1);
if_block1 = current_block_type(ctx);
if (if_block1) {
if_block1.c();
if_block1.m(div1, t8);
}
}
if (ctx.editingField) {
if (if_block2) {
if_block2.p(changed, ctx);
transition_in(if_block2, 1);
} else {
if_block2 = create_if_block_1$8(ctx);
if_block2.c();
transition_in(if_block2, 1);
if_block2.m(div1, t9);
}
} else if (if_block2) {
group_outros();
transition_out(if_block2, 1, 1, () => {
if_block2 = null;
});
check_outros();
}
if (changed.record || changed.getIndexAllowedRecords || changed.getIcon) {
each_value = ctx.record.indexes;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$f(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$f(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;
}
if (each_value.length) {
if (each_1_else) {
each_1_else.d(1);
each_1_else = null;
}
} else if (!each_1_else) {
each_1_else = create_else_block$6(ctx);
each_1_else.c();
each_1_else.m(div1, null);
}
},
i: function intro(local) {
if (current) return;
transition_in(textbox.$$.fragment, local);
transition_in(if_block0);
transition_in(if_block2);
current = true;
},
o: function outro(local) {
transition_out(textbox.$$.fragment, local);
transition_out(if_block0);
transition_out(if_block2);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div1);
}
destroy_component(textbox);
if (if_block0) if_block0.d();
if_block1.d();
if (if_block2) if_block2.d();
destroy_each(each_blocks, detaching);
if (each_1_else) each_1_else.d();
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$z.name, type: "component", source: "", ctx });
return block;
}
function instance$z($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let record;
let getIndexAllowedRecords;
let editingField = false;
let fieldToEdit;
let isNewField = false;
let newField;
let editField;
let deleteField;
let onFinishedFieldEdit;
let editIndex;
store.subscribe($store => {
$$invalidate('record', record = $store.currentNode);
const flattened = hierarchyFunctions.getFlattenedHierarchy($store.hierarchy);
$$invalidate('getIndexAllowedRecords', getIndexAllowedRecords = index =>
pipe$1(index.allowedRecordNodeIds, [
fp_8(id => fp_6(n => n.nodeId === id)(flattened)),
fp_7(id => fp_13(n => n.nodeId === id)
(flattened).name),
fp_41(", ")
]));
$$invalidate('newField', newField = () => {
isNewField = true;
$$invalidate('fieldToEdit', fieldToEdit = templateApi($store.hierarchy).getNewField("string"));
$$invalidate('editingField', editingField = true);
});
$$invalidate('onFinishedFieldEdit', onFinishedFieldEdit = (field) => {
if(field) {
store.saveField(field);
}
$$invalidate('editingField', editingField = false);
});
$$invalidate('editField', editField = (field) => {
isNewField = false;
$$invalidate('fieldToEdit', fieldToEdit = field);
$$invalidate('editingField', editingField = true);
});
$$invalidate('deleteField', deleteField = (field) => {
store.deleteField(field);
});
$$invalidate('editIndex', editIndex = index => {
store.selectExistingNode(index.nodeId);
});
});
let getTypeOptionsValueText = value => {
if(value === Number.MAX_SAFE_INTEGER
|| value === Number.MIN_SAFE_INTEGER
|| new Date(value).getTime() === new Date(8640000000000000).getTime()
|| new Date(value).getTime() === new Date(-8640000000000000).getTime()) return "(any)";
if(value === null) return "(not set)";
return value;
};
let getTypeOptions = typeOptions =>
pipe$1(typeOptions, [
fp_32,
fp_7(k => `<span style="color:var(--slate)">${k}: </span>${getTypeOptionsValueText(typeOptions[k])}`),
fp_41("<br>")
]);
function textbox_text_binding(value) {
record.name = value;
$$invalidate('record', record);
}
function textbox0_text_binding(value) {
record.collectionName = value;
$$invalidate('record', record);
}
function textbox1_text_binding(value_1) {
record.allidsShardFactor = value_1;
$$invalidate('record', record);
}
const click_handler = ({ field }) => editField(field);
const click_handler_1 = ({ field }) => deleteField(field);
function modal_isOpen_binding(value) {
editingField = value;
$$invalidate('editingField', editingField);
}
const click_handler_2 = ({ index }) => editIndex(index);
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('record' in $$props) $$invalidate('record', record = $$props.record);
if ('getIndexAllowedRecords' in $$props) $$invalidate('getIndexAllowedRecords', getIndexAllowedRecords = $$props.getIndexAllowedRecords);
if ('editingField' in $$props) $$invalidate('editingField', editingField = $$props.editingField);
if ('fieldToEdit' in $$props) $$invalidate('fieldToEdit', fieldToEdit = $$props.fieldToEdit);
if ('isNewField' in $$props) isNewField = $$props.isNewField;
if ('newField' in $$props) $$invalidate('newField', newField = $$props.newField);
if ('editField' in $$props) $$invalidate('editField', editField = $$props.editField);
if ('deleteField' in $$props) $$invalidate('deleteField', deleteField = $$props.deleteField);
if ('onFinishedFieldEdit' in $$props) $$invalidate('onFinishedFieldEdit', onFinishedFieldEdit = $$props.onFinishedFieldEdit);
if ('editIndex' in $$props) $$invalidate('editIndex', editIndex = $$props.editIndex);
if ('getTypeOptionsValueText' in $$props) getTypeOptionsValueText = $$props.getTypeOptionsValueText;
if ('getTypeOptions' in $$props) $$invalidate('getTypeOptions', getTypeOptions = $$props.getTypeOptions);
if ('$store' in $$props) store.set($store);
};
return {
record,
getIndexAllowedRecords,
editingField,
fieldToEdit,
newField,
editField,
deleteField,
onFinishedFieldEdit,
editIndex,
getTypeOptions,
$store,
textbox_text_binding,
textbox0_text_binding,
textbox1_text_binding,
click_handler,
click_handler_1,
modal_isOpen_binding,
click_handler_2
};
}
class RecordView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$z, create_fragment$z, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "RecordView", options, id: create_fragment$z.name });
}
}
/* src\common\CodeArea.svelte generated by Svelte v3.12.1 */
const file$B = "src\\common\\CodeArea.svelte";
function create_fragment$A(ctx) {
var div, t0, t1, textarea, dispose;
const block = {
c: function create() {
div = element("div");
t0 = text(ctx.label);
t1 = space();
textarea = element("textarea");
add_location(div, file$B, 6, 0, 96);
attr_dev(textarea, "class", "uk-textarea svelte-di7k4b");
add_location(textarea, file$B, 7, 0, 115);
dispose = listen_dev(textarea, "input", ctx.textarea_input_handler);
},
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);
append_dev(div, t0);
insert_dev(target, t1, anchor);
insert_dev(target, textarea, anchor);
set_input_value(textarea, ctx.text);
},
p: function update(changed, ctx) {
if (changed.label) {
set_data_dev(t0, ctx.label);
}
if (changed.text) set_input_value(textarea, ctx.text);
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
detach_dev(t1);
detach_dev(textarea);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$A.name, type: "component", source: "", ctx });
return block;
}
function instance$A($$self, $$props, $$invalidate) {
// todo: use https://ace.c9.io
let { text = "", label = "" } = $$props;
const writable_props = ['text', 'label'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<CodeArea> was created with unknown prop '${key}'`);
});
function textarea_input_handler() {
text = this.value;
$$invalidate('text', text);
}
$$self.$set = $$props => {
if ('text' in $$props) $$invalidate('text', text = $$props.text);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
$$self.$capture_state = () => {
return { text, label };
};
$$self.$inject_state = $$props => {
if ('text' in $$props) $$invalidate('text', text = $$props.text);
if ('label' in $$props) $$invalidate('label', label = $$props.label);
};
return { text, label, textarea_input_handler };
}
class CodeArea extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$A, create_fragment$A, safe_not_equal, ["text", "label"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "CodeArea", options, id: create_fragment$A.name });
}
get text() {
throw new Error("<CodeArea>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set text(value) {
throw new Error("<CodeArea>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get label() {
throw new Error("<CodeArea>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set label(value) {
throw new Error("<CodeArea>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\database\IndexView.svelte generated by Svelte v3.12.1 */
const file$C = "src\\database\\IndexView.svelte";
function get_each_context$g(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.rec = list[i];
return child_ctx;
}
// (45:8) {#each indexableRecords as rec}
function create_each_block$g(ctx) {
var input, input_checked_value, t0, span, t1_value = ctx.rec.node.name + "", t1, dispose;
function change_handler() {
return ctx.change_handler(ctx);
}
const block = {
c: function create() {
input = element("input");
t0 = space();
span = element("span");
t1 = text(t1_value);
attr_dev(input, "type", "checkbox");
input.checked = input_checked_value = ctx.rec.isallowed;
add_location(input, file$C, 45, 8, 1362);
attr_dev(span, "class", "svelte-pq2tmv");
add_location(span, file$C, 46, 8, 1462);
dispose = listen_dev(input, "change", change_handler);
},
m: function mount(target, anchor) {
insert_dev(target, input, anchor);
insert_dev(target, t0, anchor);
insert_dev(target, span, anchor);
append_dev(span, t1);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.indexableRecords) && input_checked_value !== (input_checked_value = ctx.rec.isallowed)) {
prop_dev(input, "checked", input_checked_value);
}
if ((changed.indexableRecords) && t1_value !== (t1_value = ctx.rec.node.name + "")) {
set_data_dev(t1, t1_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(input);
detach_dev(t0);
detach_dev(span);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$g.name, type: "each", source: "(45:8) {#each indexableRecords as rec}", ctx });
return block;
}
function create_fragment$B(ctx) {
var form, updating_text, t0, div1, div0, t2, t3, updating_selected, t4, updating_text_1, t5, updating_text_2, t6, updating_text_3, current;
function textbox_text_binding(value) {
ctx.textbox_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Name" };
if (ctx.index.name !== void 0) {
textbox_props.text = ctx.index.name;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding));
let each_value = ctx.indexableRecords;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$g(get_each_context$g(ctx, each_value, i));
}
function dropdown_selected_binding(value_1) {
ctx.dropdown_selected_binding.call(null, value_1);
updating_selected = true;
add_flush_callback(() => updating_selected = false);
}
let dropdown_props = {
label: "Index Type",
options: ["ancestor", "reference"]
};
if (ctx.index.indexType !== void 0) {
dropdown_props.selected = ctx.index.indexType;
}
var dropdown = new Dropdown({ props: dropdown_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown, 'selected', dropdown_selected_binding));
function codearea0_text_binding(value_2) {
ctx.codearea0_text_binding.call(null, value_2);
updating_text_1 = true;
add_flush_callback(() => updating_text_1 = false);
}
let codearea0_props = { label: "Map (javascript)" };
if (ctx.index.map !== void 0) {
codearea0_props.text = ctx.index.map;
}
var codearea0 = new CodeArea({ props: codearea0_props, $$inline: true });
binding_callbacks.push(() => bind(codearea0, 'text', codearea0_text_binding));
function codearea1_text_binding(value_3) {
ctx.codearea1_text_binding.call(null, value_3);
updating_text_2 = true;
add_flush_callback(() => updating_text_2 = false);
}
let codearea1_props = { label: "Filter (javascript expression)" };
if (ctx.index.filter !== void 0) {
codearea1_props.text = ctx.index.filter;
}
var codearea1 = new CodeArea({ props: codearea1_props, $$inline: true });
binding_callbacks.push(() => bind(codearea1, 'text', codearea1_text_binding));
function codearea2_text_binding(value_4) {
ctx.codearea2_text_binding.call(null, value_4);
updating_text_3 = true;
add_flush_callback(() => updating_text_3 = false);
}
let codearea2_props = {
label: "Shard Name (javascript expression)"
};
if (ctx.index.getShardName !== void 0) {
codearea2_props.text = ctx.index.getShardName;
}
var codearea2 = new CodeArea({ props: codearea2_props, $$inline: true });
binding_callbacks.push(() => bind(codearea2, 'text', codearea2_text_binding));
const block = {
c: function create() {
form = element("form");
textbox.$$.fragment.c();
t0 = space();
div1 = element("div");
div0 = element("div");
div0.textContent = "Records to Index";
t2 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t3 = space();
dropdown.$$.fragment.c();
t4 = space();
codearea0.$$.fragment.c();
t5 = space();
codearea1.$$.fragment.c();
t6 = space();
codearea2.$$.fragment.c();
add_location(div0, file$C, 43, 8, 1286);
attr_dev(div1, "class", "allowed-records svelte-pq2tmv");
add_location(div1, file$C, 42, 4, 1248);
attr_dev(form, "class", "uk-form-horizontal root svelte-pq2tmv");
add_location(form, file$C, 39, 0, 1149);
},
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, form, anchor);
mount_component(textbox, form, null);
append_dev(form, t0);
append_dev(form, div1);
append_dev(div1, div0);
append_dev(div1, t2);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
append_dev(form, t3);
mount_component(dropdown, form, null);
append_dev(form, t4);
mount_component(codearea0, form, null);
append_dev(form, t5);
mount_component(codearea1, form, null);
append_dev(form, t6);
mount_component(codearea2, form, null);
current = true;
},
p: function update(changed, ctx) {
var textbox_changes = {};
if (!updating_text && changed.index) {
textbox_changes.text = ctx.index.name;
}
textbox.$set(textbox_changes);
if (changed.indexableRecords) {
each_value = ctx.indexableRecords;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$g(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$g(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;
}
var dropdown_changes = {};
if (!updating_selected && changed.index) {
dropdown_changes.selected = ctx.index.indexType;
}
dropdown.$set(dropdown_changes);
var codearea0_changes = {};
if (!updating_text_1 && changed.index) {
codearea0_changes.text = ctx.index.map;
}
codearea0.$set(codearea0_changes);
var codearea1_changes = {};
if (!updating_text_2 && changed.index) {
codearea1_changes.text = ctx.index.filter;
}
codearea1.$set(codearea1_changes);
var codearea2_changes = {};
if (!updating_text_3 && changed.index) {
codearea2_changes.text = ctx.index.getShardName;
}
codearea2.$set(codearea2_changes);
},
i: function intro(local) {
if (current) return;
transition_in(textbox.$$.fragment, local);
transition_in(dropdown.$$.fragment, local);
transition_in(codearea0.$$.fragment, local);
transition_in(codearea1.$$.fragment, local);
transition_in(codearea2.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(textbox.$$.fragment, local);
transition_out(dropdown.$$.fragment, local);
transition_out(codearea0.$$.fragment, local);
transition_out(codearea1.$$.fragment, local);
transition_out(codearea2.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(form);
}
destroy_component(textbox);
destroy_each(each_blocks, detaching);
destroy_component(dropdown);
destroy_component(codearea0);
destroy_component(codearea1);
destroy_component(codearea2);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$B.name, type: "component", source: "", ctx });
return block;
}
function instance$B($$self, $$props, $$invalidate) {
const pipe = common$1.$;
let index;
let indexableRecords = [];
store.subscribe($store => {
$$invalidate('index', index = $store.currentNode);
$$invalidate('indexableRecords', indexableRecords = pipe($store.hierarchy,[
hierarchyFunctions.getFlattenedHierarchy,
fp_8(hierarchyFunctions.isDecendant(index.parent())),
fp_8(hierarchyFunctions.isRecord),
fp_7(n => ({
node:n,
isallowed: fp_6(id => n.nodeId === id)(index.allowedRecordNodeIds)
}))
]));
});
const toggleAllowedRecord = record => {
if(record.isallowed) {
$$invalidate('index', index.allowedRecordNodeIds = fp_8(id => id !== record.node.nodeId)
(index.allowedRecordNodeIds), index);
} else {
index.allowedRecordNodeIds.push(record.node.nodeId);
}
};
function textbox_text_binding(value) {
index.name = value;
$$invalidate('index', index);
}
const change_handler = ({ rec }) => toggleAllowedRecord(rec);
function dropdown_selected_binding(value_1) {
index.indexType = value_1;
$$invalidate('index', index);
}
function codearea0_text_binding(value_2) {
index.map = value_2;
$$invalidate('index', index);
}
function codearea1_text_binding(value_3) {
index.filter = value_3;
$$invalidate('index', index);
}
function codearea2_text_binding(value_4) {
index.getShardName = value_4;
$$invalidate('index', index);
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('index' in $$props) $$invalidate('index', index = $$props.index);
if ('indexableRecords' in $$props) $$invalidate('indexableRecords', indexableRecords = $$props.indexableRecords);
};
return {
index,
indexableRecords,
toggleAllowedRecord,
textbox_text_binding,
change_handler,
dropdown_selected_binding,
codearea0_text_binding,
codearea1_text_binding,
codearea2_text_binding
};
}
class IndexView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$B, create_fragment$B, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "IndexView", options, id: create_fragment$B.name });
}
}
/* src\database\ActionsHeader.svelte generated by Svelte v3.12.1 */
const file$D = "src\\database\\ActionsHeader.svelte";
// (27:12) {:else}
function create_else_block$7(ctx) {
var t;
const block = {
c: function create() {
t = text("Update");
},
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_else_block$7.name, type: "else", source: "(27:12) {:else}", ctx });
return block;
}
// (25:12) {#if $store.currentNodeIsNew}
function create_if_block_2$6(ctx) {
var t;
const block = {
c: function create() {
t = text("Create");
},
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_if_block_2$6.name, type: "if", source: "(25:12) {#if $store.currentNodeIsNew}", ctx });
return block;
}
// (24:8) <Button color="secondary" grouped on:click={store.saveCurrentNode}>
function create_default_slot_5(ctx) {
var if_block_anchor;
function select_block_type(changed, ctx) {
if (ctx.$store.currentNodeIsNew) return create_if_block_2$6;
return create_else_block$7;
}
var current_block_type = select_block_type(null, ctx);
var if_block = current_block_type(ctx);
const block = {
c: function create() {
if_block.c();
if_block_anchor = empty();
},
m: function mount(target, anchor) {
if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
},
p: function update(changed, ctx) {
if (current_block_type !== (current_block_type = select_block_type(changed, ctx))) {
if_block.d(1);
if_block = current_block_type(ctx);
if (if_block) {
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
}
},
d: function destroy(detaching) {
if_block.d(detaching);
if (detaching) {
detach_dev(if_block_anchor);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_5.name, type: "slot", source: "(24:8) <Button color=\"secondary\" grouped on:click={store.saveCurrentNode}>", ctx });
return block;
}
// (32:8) {#if !$store.currentNodeIsNew}
function create_if_block_1$9(ctx) {
var current;
var button = new Button({
props: {
color: "tertiary",
grouped: true,
$$slots: { default: [create_default_slot_4] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", ctx.openConfirmDelete);
const block = {
c: function create() {
button.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(button.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$9.name, type: "if", source: "(32:8) {#if !$store.currentNodeIsNew}", ctx });
return block;
}
// (33:8) <Button color="tertiary" grouped on:click={openConfirmDelete}>
function create_default_slot_4(ctx) {
var t;
const block = {
c: function create() {
t = text("Delete");
},
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: "(33:8) <Button color=\"tertiary\" grouped on:click={openConfirmDelete}>", ctx });
return block;
}
// (23:4) <ButtonGroup>
function create_default_slot_3(ctx) {
var t, if_block_anchor, current;
var button = new Button({
props: {
color: "secondary",
grouped: true,
$$slots: { default: [create_default_slot_5] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", store.saveCurrentNode);
var if_block = (!ctx.$store.currentNodeIsNew) && create_if_block_1$9(ctx);
const block = {
c: function create() {
button.$$.fragment.c();
t = space();
if (if_block) if_block.c();
if_block_anchor = empty();
},
m: function mount(target, anchor) {
mount_component(button, target, anchor);
insert_dev(target, t, anchor);
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
current = true;
},
p: function update(changed, ctx) {
var button_changes = {};
if (changed.$$scope || changed.$store) button_changes.$$scope = { changed, ctx };
button.$set(button_changes);
if (!ctx.$store.currentNodeIsNew) {
if (!if_block) {
if_block = create_if_block_1$9(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
} else transition_in(if_block, 1);
} 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(button.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(button.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
destroy_component(button, detaching);
if (detaching) {
detach_dev(t);
}
if (if_block) if_block.d(detaching);
if (detaching) {
detach_dev(if_block_anchor);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_3.name, type: "slot", source: "(23:4) <ButtonGroup>", ctx });
return block;
}
// (39:4) {#if !!$store.errors && $store.errors.length > 0}
function create_if_block$j(ctx) {
var div, current;
var errorsbox = new ErrorsBox({
props: { errors: ctx.$store.errors },
$$inline: true
});
const block = {
c: function create() {
div = element("div");
errorsbox.$$.fragment.c();
set_style(div, "width", "500px");
add_location(div, file$D, 39, 4, 971);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(errorsbox, div, null);
current = true;
},
p: function update(changed, ctx) {
var errorsbox_changes = {};
if (changed.$store) errorsbox_changes.errors = ctx.$store.errors;
errorsbox.$set(errorsbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(errorsbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(errorsbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(errorsbox);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$j.name, type: "if", source: "(39:4) {#if !!$store.errors && $store.errors.length > 0}", ctx });
return block;
}
// (48:12) <Button color="primary" on:click={deleteCurrentNode}>
function create_default_slot_2$3(ctx) {
var t;
const block = {
c: function create() {
t = text("Yes");
},
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: "(48:12) <Button color=\"primary\" on:click={deleteCurrentNode}>", ctx });
return block;
}
// (49:12) <Button color="secondary" on:click={() => confirmDelete = false}>
function create_default_slot_1$4(ctx) {
var t;
const block = {
c: function create() {
t = text("No");
},
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_1$4.name, type: "slot", source: "(49:12) <Button color=\"secondary\" on:click={() => confirmDelete = false}>", ctx });
return block;
}
// (45:4) <Modal bind:isOpen={confirmDelete}>
function create_default_slot$7(ctx) {
var div0, t0, t1_value = ctx.$store.currentNode.name + "", t1, t2, t3, div1, t4, current;
var button0 = new Button({
props: {
color: "primary",
$$slots: { default: [create_default_slot_2$3] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.deleteCurrentNode);
var button1 = new Button({
props: {
color: "secondary",
$$slots: { default: [create_default_slot_1$4] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.click_handler);
const block = {
c: function create() {
div0 = element("div");
t0 = text("Are you sure you want to delete ");
t1 = text(t1_value);
t2 = text(" ?");
t3 = space();
div1 = element("div");
button0.$$.fragment.c();
t4 = space();
button1.$$.fragment.c();
set_style(div0, "margin", "10px 0px 20px 0px");
add_location(div0, file$D, 45, 8, 1116);
set_style(div1, "float", "right");
add_location(div1, file$D, 46, 8, 1229);
},
m: function mount(target, anchor) {
insert_dev(target, div0, anchor);
append_dev(div0, t0);
append_dev(div0, t1);
append_dev(div0, t2);
insert_dev(target, t3, anchor);
insert_dev(target, div1, anchor);
mount_component(button0, div1, null);
append_dev(div1, t4);
mount_component(button1, div1, null);
current = true;
},
p: function update(changed, ctx) {
if ((!current || changed.$store) && t1_value !== (t1_value = ctx.$store.currentNode.name + "")) {
set_data_dev(t1, t1_value);
}
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div0);
detach_dev(t3);
detach_dev(div1);
}
destroy_component(button0);
destroy_component(button1);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$7.name, type: "slot", source: "(45:4) <Modal bind:isOpen={confirmDelete}>", ctx });
return block;
}
function create_fragment$C(ctx) {
var div, t0, t1, updating_isOpen, current;
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot_3] },
$$scope: { ctx }
},
$$inline: true
});
var if_block = (!!ctx.$store.errors && ctx.$store.errors.length > 0) && create_if_block$j(ctx);
function modal_isOpen_binding(value) {
ctx.modal_isOpen_binding.call(null, value);
updating_isOpen = true;
add_flush_callback(() => updating_isOpen = false);
}
let modal_props = {
$$slots: { default: [create_default_slot$7] },
$$scope: { ctx }
};
if (ctx.confirmDelete !== void 0) {
modal_props.isOpen = ctx.confirmDelete;
}
var modal = new Modal({ props: modal_props, $$inline: true });
binding_callbacks.push(() => bind(modal, 'isOpen', modal_isOpen_binding));
const block = {
c: function create() {
div = element("div");
buttongroup.$$.fragment.c();
t0 = space();
if (if_block) if_block.c();
t1 = space();
modal.$$.fragment.c();
attr_dev(div, "class", "root svelte-wgyofl");
set_style(div, "left", ctx.left);
add_location(div, file$D, 20, 0, 460);
},
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);
mount_component(buttongroup, div, null);
append_dev(div, t0);
if (if_block) if_block.m(div, null);
append_dev(div, t1);
mount_component(modal, div, null);
current = true;
},
p: function update(changed, ctx) {
var buttongroup_changes = {};
if (changed.$$scope || changed.$store) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
if (!!ctx.$store.errors && ctx.$store.errors.length > 0) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$j(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(div, t1);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
var modal_changes = {};
if (changed.$$scope || changed.$store) modal_changes.$$scope = { changed, ctx };
if (!updating_isOpen && changed.confirmDelete) {
modal_changes.isOpen = ctx.confirmDelete;
}
modal.$set(modal_changes);
if (!current || changed.left) {
set_style(div, "left", ctx.left);
}
},
i: function intro(local) {
if (current) return;
transition_in(buttongroup.$$.fragment, local);
transition_in(if_block);
transition_in(modal.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(buttongroup.$$.fragment, local);
transition_out(if_block);
transition_out(modal.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(buttongroup);
if (if_block) if_block.d();
destroy_component(modal);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$C.name, type: "component", source: "", ctx });
return block;
}
function instance$C($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let { left } = $$props;
let confirmDelete = false;
const openConfirmDelete = () => {
$$invalidate('confirmDelete', confirmDelete = true);
};
const deleteCurrentNode = () => {
$$invalidate('confirmDelete', confirmDelete = false);
store.deleteCurrentNode();
};
const writable_props = ['left'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ActionsHeader> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate('confirmDelete', confirmDelete = false);
function modal_isOpen_binding(value) {
confirmDelete = value;
$$invalidate('confirmDelete', confirmDelete);
}
$$self.$set = $$props => {
if ('left' in $$props) $$invalidate('left', left = $$props.left);
};
$$self.$capture_state = () => {
return { left, confirmDelete, $store };
};
$$self.$inject_state = $$props => {
if ('left' in $$props) $$invalidate('left', left = $$props.left);
if ('confirmDelete' in $$props) $$invalidate('confirmDelete', confirmDelete = $$props.confirmDelete);
if ('$store' in $$props) store.set($store);
};
return {
left,
confirmDelete,
openConfirmDelete,
deleteCurrentNode,
$store,
click_handler,
modal_isOpen_binding
};
}
class ActionsHeader extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$C, create_fragment$C, safe_not_equal, ["left"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ActionsHeader", options, id: create_fragment$C.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.left === undefined && !('left' in props)) {
console.warn("<ActionsHeader> was created without expected prop 'left'");
}
}
get left() {
throw new Error("<ActionsHeader>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set left(value) {
throw new Error("<ActionsHeader>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\database\DatabaseRoot.svelte generated by Svelte v3.12.1 */
const file$E = "src\\database\\DatabaseRoot.svelte";
// (51:8) {#if $store.currentNode}
function create_if_block_2$7(ctx) {
var current;
var actionsheader = new ActionsHeader({
props: { left: hierarchyWidth },
$$inline: true
});
const block = {
c: function create() {
actionsheader.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(actionsheader, target, anchor);
current = true;
},
p: noop,
i: function intro(local) {
if (current) return;
transition_in(actionsheader.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(actionsheader.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(actionsheader, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$7.name, type: "if", source: "(51:8) {#if $store.currentNode}", ctx });
return block;
}
// (60:8) {:else}
function create_else_block$8(ctx) {
var current;
var indexview = new IndexView({ $$inline: true });
const block = {
c: function create() {
indexview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(indexview, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(indexview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(indexview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(indexview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$8.name, type: "else", source: "(60:8) {:else}", ctx });
return block;
}
// (58:55)
function create_if_block_1$a(ctx) {
var current;
var recordview = new RecordView({ $$inline: true });
const block = {
c: function create() {
recordview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(recordview, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(recordview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(recordview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(recordview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$a.name, type: "if", source: "(58:55) ", ctx });
return block;
}
// (56:8) {#if !$store.currentNode}
function create_if_block$k(ctx) {
var h1;
const block = {
c: function create() {
h1 = element("h1");
h1.textContent = ":)";
set_style(h1, "margin-left", "100px");
add_location(h1, file$E, 56, 8, 1573);
},
m: function mount(target, anchor) {
insert_dev(target, h1, anchor);
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(h1);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$k.name, type: "if", source: "(56:8) {#if !$store.currentNode}", ctx });
return block;
}
function create_fragment$D(ctx) {
var div2, div0, t, div1, current_block_type_index, if_block1, current;
var if_block0 = (ctx.$store.currentNode) && create_if_block_2$7(ctx);
var if_block_creators = [
create_if_block$k,
create_if_block_1$a,
create_else_block$8
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (!ctx.$store.currentNode) return 0;
if (ctx.$store.currentNode.type === "record") return 1;
return 2;
}
current_block_type_index = select_block_type(null, ctx);
if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
if (if_block0) if_block0.c();
t = space();
div1 = element("div");
if_block1.c();
attr_dev(div0, "class", "actions-header svelte-apja7r");
add_location(div0, file$E, 49, 4, 1369);
attr_dev(div1, "class", "node-view svelte-apja7r");
add_location(div1, file$E, 54, 4, 1507);
attr_dev(div2, "class", "root svelte-apja7r");
add_location(div2, file$E, 48, 0, 1346);
},
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);
if (if_block0) if_block0.m(div0, null);
append_dev(div2, t);
append_dev(div2, div1);
if_blocks[current_block_type_index].m(div1, null);
current = true;
},
p: function update(changed, ctx) {
if (ctx.$store.currentNode) {
if (if_block0) {
if_block0.p(changed, ctx);
transition_in(if_block0, 1);
} else {
if_block0 = create_if_block_2$7(ctx);
if_block0.c();
transition_in(if_block0, 1);
if_block0.m(div0, null);
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
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();
}
transition_in(if_block1, 1);
if_block1.m(div1, 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 (detaching) {
detach_dev(div2);
}
if (if_block0) if_block0.d();
if_blocks[current_block_type_index].d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$D.name, type: "component", source: "", ctx });
return block;
}
const hierarchyWidth = "200px";
function instance$D($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
const defaultNewIndexActions = [{
label:"New Root Index",
onclick: store.newRootIndex
}];
const defaultNewRecordActions = [{
label:"New Root Record",
onclick: store.newRootRecord
}];
let newIndexActions = defaultNewIndexActions;
let newRecordActions = defaultNewRecordActions;
store.subscribe(db => {
if(!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) {
newRecordActions = defaultNewRecordActions;
newIndexActions = defaultNewIndexActions;
} else {
newRecordActions = [
...defaultNewRecordActions,
{label: `New Child Record of ${db.currentNode.name}`,
onclick: store.newChildRecord}
];
newIndexActions = [
...defaultNewIndexActions,
{label: `New Index on ${db.currentNode.name}`,
onclick: store.newChildIndex}
];
}
});
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('newIndexActions' in $$props) newIndexActions = $$props.newIndexActions;
if ('newRecordActions' in $$props) newRecordActions = $$props.newRecordActions;
if ('$store' in $$props) store.set($store);
};
return { $store };
}
class DatabaseRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$D, create_fragment$D, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "DatabaseRoot", options, id: create_fragment$D.name });
}
}
/* src\actionsAndTriggers\ActionView.svelte generated by Svelte v3.12.1 */
const file$F = "src\\actionsAndTriggers\\ActionView.svelte";
function get_each_context$h(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.option = list[i];
return child_ctx;
}
// (86:12) <Button color="primary-outline uk-width-1-4" on:click={addNewOption}>
function create_default_slot_3$1(ctx) {
var t;
const block = {
c: function create() {
t = text("Add");
},
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$1.name, type: "slot", source: "(86:12) <Button color=\"primary-outline uk-width-1-4\" on:click={addNewOption}>", ctx });
return block;
}
// (89:12) {#each initialOptions as option}
function create_each_block$h(ctx) {
var span1, t0_value = ctx.option.key + "", t0, t1, t2_value = ctx.option.value + "", t2, t3, span0, raw_value = getIcon("trash-2") + "", dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
const block = {
c: function create() {
span1 = element("span");
t0 = text(t0_value);
t1 = text(" : ");
t2 = text(t2_value);
t3 = space();
span0 = element("span");
set_style(span0, "font-size", "10pt");
set_style(span0, "cursor", "pointer");
add_location(span0, file$F, 89, 73, 2565);
attr_dev(span1, "class", "option-container svelte-16sjty9");
add_location(span1, file$F, 89, 12, 2504);
dispose = listen_dev(span0, "click", click_handler);
},
m: function mount(target, anchor) {
insert_dev(target, span1, anchor);
append_dev(span1, t0);
append_dev(span1, t1);
append_dev(span1, t2);
append_dev(span1, t3);
append_dev(span1, span0);
span0.innerHTML = raw_value;
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.initialOptions) && t0_value !== (t0_value = ctx.option.key + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.initialOptions) && t2_value !== (t2_value = ctx.option.value + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(span1);
}
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$h.name, type: "each", source: "(89:12) {#each initialOptions as option}", ctx });
return block;
}
// (96:8) <Button color="secondary" grouped on:click={save}>
function create_default_slot_2$4(ctx) {
var t;
const block = {
c: function create() {
t = text("Save");
},
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$4.name, type: "slot", source: "(96:8) <Button color=\"secondary\" grouped on:click={save}>", ctx });
return block;
}
// (97:8) <Button color="tertiary" grouped on:click={cancel}>
function create_default_slot_1$5(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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_1$5.name, type: "slot", source: "(97:8) <Button color=\"tertiary\" grouped on:click={cancel}>", ctx });
return block;
}
// (95:4) <ButtonGroup>
function create_default_slot$8(ctx) {
var t, current;
var button0 = new Button({
props: {
color: "secondary",
grouped: true,
$$slots: { default: [create_default_slot_2$4] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.save);
var button1 = new Button({
props: {
color: "tertiary",
grouped: true,
$$slots: { default: [create_default_slot_1$5] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.cancel);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$8.name, type: "slot", source: "(95:4) <ButtonGroup>", ctx });
return block;
}
function create_fragment$E(ctx) {
var div3, t0, form, updating_text, t1, updating_text_1, t2, updating_text_2, t3, div2, label, t5, div0, input0, t6, input1, t7, t8, div1, t9, current, dispose;
var errorsbox = new ErrorsBox({
props: { errors: ctx.errors },
$$inline: true
});
function textbox0_text_binding(value) {
ctx.textbox0_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox0_props = { label: "Name" };
if (ctx.clonedAction.name !== void 0) {
textbox0_props.text = ctx.clonedAction.name;
}
var textbox0 = new Textbox({ props: textbox0_props, $$inline: true });
binding_callbacks.push(() => bind(textbox0, 'text', textbox0_text_binding));
function textbox1_text_binding(value_1) {
ctx.textbox1_text_binding.call(null, value_1);
updating_text_1 = true;
add_flush_callback(() => updating_text_1 = false);
}
let textbox1_props = { label: "Behaviour Source" };
if (ctx.clonedAction.behaviourSource !== void 0) {
textbox1_props.text = ctx.clonedAction.behaviourSource;
}
var textbox1 = new Textbox({ props: textbox1_props, $$inline: true });
binding_callbacks.push(() => bind(textbox1, 'text', textbox1_text_binding));
function textbox2_text_binding(value_2) {
ctx.textbox2_text_binding.call(null, value_2);
updating_text_2 = true;
add_flush_callback(() => updating_text_2 = false);
}
let textbox2_props = { label: "Behaviour" };
if (ctx.clonedAction.behaviourName !== void 0) {
textbox2_props.text = ctx.clonedAction.behaviourName;
}
var textbox2 = new Textbox({ props: textbox2_props, $$inline: true });
binding_callbacks.push(() => bind(textbox2, 'text', textbox2_text_binding));
var button = new Button({
props: {
color: "primary-outline uk-width-1-4",
$$slots: { default: [create_default_slot_3$1] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", ctx.addNewOption);
let each_value = ctx.initialOptions;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$h(get_each_context$h(ctx, each_value, i));
}
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot$8] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div3 = element("div");
errorsbox.$$.fragment.c();
t0 = space();
form = element("form");
textbox0.$$.fragment.c();
t1 = space();
textbox1.$$.fragment.c();
t2 = space();
textbox2.$$.fragment.c();
t3 = space();
div2 = element("div");
label = element("label");
label.textContent = "Default Options";
t5 = space();
div0 = element("div");
input0 = element("input");
t6 = space();
input1 = element("input");
t7 = space();
button.$$.fragment.c();
t8 = space();
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t9 = space();
buttongroup.$$.fragment.c();
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$F, 72, 4, 1626);
attr_dev(label, "class", "uk-form-label");
add_location(label, file$F, 81, 8, 1972);
attr_dev(input0, "class", "uk-input uk-width-1-4 uk-margin-right");
attr_dev(input0, "placeholder", "key");
add_location(input0, file$F, 83, 12, 2081);
attr_dev(input1, "class", "uk-input uk-width-1-4 uk-margin-right");
attr_dev(input1, "placeholder", "value");
add_location(input1, file$F, 84, 12, 2194);
attr_dev(div0, "class", "uk-grid-small svelte-16sjty9");
attr_dev(div0, "uk-grid", "");
add_location(div0, file$F, 82, 8, 2033);
set_style(div1, "margin-top", "10px");
add_location(div1, file$F, 87, 8, 2416);
attr_dev(div2, "class", " uk-form-stacked");
set_style(div2, "margin-bottom", "20px");
add_location(div2, file$F, 80, 4, 1905);
attr_dev(div3, "class", "root svelte-16sjty9");
add_location(div3, file$F, 68, 0, 1574);
dispose = [
listen_dev(input0, "input", ctx.input0_input_handler),
listen_dev(input1, "input", ctx.input1_input_handler)
];
},
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, div3, anchor);
mount_component(errorsbox, div3, null);
append_dev(div3, t0);
append_dev(div3, form);
mount_component(textbox0, form, null);
append_dev(form, t1);
mount_component(textbox1, form, null);
append_dev(form, t2);
mount_component(textbox2, form, null);
append_dev(div3, t3);
append_dev(div3, div2);
append_dev(div2, label);
append_dev(div2, t5);
append_dev(div2, div0);
append_dev(div0, input0);
set_input_value(input0, ctx.optKey);
append_dev(div0, t6);
append_dev(div0, input1);
set_input_value(input1, ctx.optValue);
append_dev(div0, t7);
mount_component(button, div0, null);
append_dev(div2, t8);
append_dev(div2, div1);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div1, null);
}
append_dev(div3, t9);
mount_component(buttongroup, div3, null);
current = true;
},
p: function update(changed, ctx) {
var errorsbox_changes = {};
if (changed.errors) errorsbox_changes.errors = ctx.errors;
errorsbox.$set(errorsbox_changes);
var textbox0_changes = {};
if (!updating_text && changed.clonedAction) {
textbox0_changes.text = ctx.clonedAction.name;
}
textbox0.$set(textbox0_changes);
var textbox1_changes = {};
if (!updating_text_1 && changed.clonedAction) {
textbox1_changes.text = ctx.clonedAction.behaviourSource;
}
textbox1.$set(textbox1_changes);
var textbox2_changes = {};
if (!updating_text_2 && changed.clonedAction) {
textbox2_changes.text = ctx.clonedAction.behaviourName;
}
textbox2.$set(textbox2_changes);
if (changed.optKey && (input0.value !== ctx.optKey)) set_input_value(input0, ctx.optKey);
if (changed.optValue && (input1.value !== ctx.optValue)) set_input_value(input1, ctx.optValue);
var button_changes = {};
if (changed.$$scope) button_changes.$$scope = { changed, ctx };
button.$set(button_changes);
if (changed.getIcon || changed.initialOptions) {
each_value = ctx.initialOptions;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$h(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$h(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;
}
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(errorsbox.$$.fragment, local);
transition_in(textbox0.$$.fragment, local);
transition_in(textbox1.$$.fragment, local);
transition_in(textbox2.$$.fragment, local);
transition_in(button.$$.fragment, local);
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(errorsbox.$$.fragment, local);
transition_out(textbox0.$$.fragment, local);
transition_out(textbox1.$$.fragment, local);
transition_out(textbox2.$$.fragment, local);
transition_out(button.$$.fragment, local);
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div3);
}
destroy_component(errorsbox);
destroy_component(textbox0);
destroy_component(textbox1);
destroy_component(textbox2);
destroy_component(button);
destroy_each(each_blocks, detaching);
destroy_component(buttongroup);
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$E.name, type: "component", source: "", ctx });
return block;
}
function instance$E($$self, $$props, $$invalidate) {
let { action, onFinished = (action) => {} } = $$props;
let { allActions, isNew = true } = $$props;
let optKey = "";
let optValue = "";
let clonedAction = fp_4(action);
let initialOptions = pipe$1(action.initialOptions, [
fp_32,
fp_7(k => ({key:k, value:action.initialOptions[k]}))
]);
let errors = [];
const addNewOption = () => {
if(optKey && optValue && fp_3(clonedAction.initialOptions[optKey])) {
$$invalidate('clonedAction', clonedAction.initialOptions[optKey] = optValue, clonedAction);
$$invalidate('initialOptions', initialOptions = [...initialOptions, {
key:optKey, value: optValue
}]);
$$invalidate('optKey', optKey = "");
$$invalidate('optValue', optValue = "");
}
};
const removeOption = (opt) => {
if(opt) {
delete clonedAction.initialOptions[opt.key];
$$invalidate('initialOptions', initialOptions = pipe$1(initialOptions, [
fp_8(o => o.key !== opt.key)
]));
}
};
const save = () => {
const newActionsList = [
...pipe$1(allActions ,[fp_8(a => a !== action)]),
clonedAction];
$$invalidate('errors', errors = pipe$1(newActionsList ,[
validateActions$1,
fp_7(e => e.error)
]));
if(errors.length === 0)
onFinished(clonedAction);
};
const cancel = () => {
onFinished();
};
const writable_props = ['action', 'onFinished', 'allActions', 'isNew'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<ActionView> was created with unknown prop '${key}'`);
});
function textbox0_text_binding(value) {
clonedAction.name = value;
$$invalidate('clonedAction', clonedAction);
}
function textbox1_text_binding(value_1) {
clonedAction.behaviourSource = value_1;
$$invalidate('clonedAction', clonedAction);
}
function textbox2_text_binding(value_2) {
clonedAction.behaviourName = value_2;
$$invalidate('clonedAction', clonedAction);
}
function input0_input_handler() {
optKey = this.value;
$$invalidate('optKey', optKey);
}
function input1_input_handler() {
optValue = this.value;
$$invalidate('optValue', optValue);
}
const click_handler = ({ option }) => removeOption(option);
$$self.$set = $$props => {
if ('action' in $$props) $$invalidate('action', action = $$props.action);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('allActions' in $$props) $$invalidate('allActions', allActions = $$props.allActions);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
};
$$self.$capture_state = () => {
return { action, onFinished, allActions, isNew, optKey, optValue, clonedAction, initialOptions, errors };
};
$$self.$inject_state = $$props => {
if ('action' in $$props) $$invalidate('action', action = $$props.action);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('allActions' in $$props) $$invalidate('allActions', allActions = $$props.allActions);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
if ('optKey' in $$props) $$invalidate('optKey', optKey = $$props.optKey);
if ('optValue' in $$props) $$invalidate('optValue', optValue = $$props.optValue);
if ('clonedAction' in $$props) $$invalidate('clonedAction', clonedAction = $$props.clonedAction);
if ('initialOptions' in $$props) $$invalidate('initialOptions', initialOptions = $$props.initialOptions);
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
};
return {
action,
onFinished,
allActions,
isNew,
optKey,
optValue,
clonedAction,
initialOptions,
errors,
addNewOption,
removeOption,
save,
cancel,
textbox0_text_binding,
textbox1_text_binding,
textbox2_text_binding,
input0_input_handler,
input1_input_handler,
click_handler
};
}
class ActionView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$E, create_fragment$E, safe_not_equal, ["action", "onFinished", "allActions", "isNew"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ActionView", options, id: create_fragment$E.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.action === undefined && !('action' in props)) {
console.warn("<ActionView> was created without expected prop 'action'");
}
if (ctx.allActions === undefined && !('allActions' in props)) {
console.warn("<ActionView> was created without expected prop 'allActions'");
}
}
get action() {
throw new Error("<ActionView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set action(value) {
throw new Error("<ActionView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onFinished() {
throw new Error("<ActionView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onFinished(value) {
throw new Error("<ActionView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allActions() {
throw new Error("<ActionView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allActions(value) {
throw new Error("<ActionView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get isNew() {
throw new Error("<ActionView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set isNew(value) {
throw new Error("<ActionView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\actionsAndTriggers\Actions.svelte generated by Svelte v3.12.1 */
const file$G = "src\\actionsAndTriggers\\Actions.svelte";
function get_each_context$i(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.action = list[i];
return child_ctx;
}
// (76:0) {:else}
function create_else_block$9(ctx) {
var t;
const block = {
c: function create() {
t = text("(no actions added)");
},
m: function mount(target, anchor) {
insert_dev(target, t, anchor);
},
p: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(t);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$9.name, type: "else", source: "(76:0) {:else}", ctx });
return block;
}
// (50:0) {#if actionsArray}
function create_if_block_1$b(ctx) {
var table, thead, tr, th0, t1, th1, t3, th2, t5, th3, t7, th4, t8, tbody;
let each_value = ctx.actionsArray;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$i(get_each_context$i(ctx, each_value, i));
}
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Description";
t1 = space();
th1 = element("th");
th1.textContent = "Behaviour Source";
t3 = space();
th2 = element("th");
th2.textContent = "Behaviour Name";
t5 = space();
th3 = element("th");
th3.textContent = "Default Options";
t7 = space();
th4 = element("th");
t8 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
add_location(th0, file$G, 53, 12, 1316);
add_location(th1, file$G, 54, 12, 1350);
add_location(th2, file$G, 55, 12, 1388);
add_location(th3, file$G, 56, 12, 1424);
add_location(th4, file$G, 57, 12, 1461);
add_location(tr, file$G, 52, 8, 1299);
add_location(thead, file$G, 51, 4, 1283);
add_location(tbody, file$G, 60, 4, 1502);
attr_dev(table, "class", "fields-table uk-table uk-table-small uk-table-striped");
add_location(table, file$G, 50, 0, 1209);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(tr, t5);
append_dev(tr, th3);
append_dev(tr, t7);
append_dev(tr, th4);
append_dev(table, t8);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
},
p: function update(changed, ctx) {
if (changed.getIcon || changed.getDefaultOptionsHtml || changed.actionsArray) {
each_value = ctx.actionsArray;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$i(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$i(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(table);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$b.name, type: "if", source: "(50:0) {#if actionsArray}", ctx });
return block;
}
// (62:8) {#each actionsArray as action}
function create_each_block$i(ctx) {
var tr, td0, t0_value = ctx.action.name + "", t0, t1, td1, t2_value = ctx.action.behaviourSource + "", t2, t3, td2, t4_value = ctx.action.behaviourName + "", t4, t5, td3, raw0_value = ctx.getDefaultOptionsHtml(ctx.action.initialOptions) + "", t6, td4, span0, raw1_value = getIcon("edit") + "", t7, span1, raw2_value = getIcon("trash") + "", t8, dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = text(t0_value);
t1 = space();
td1 = element("td");
t2 = text(t2_value);
t3 = space();
td2 = element("td");
t4 = text(t4_value);
t5 = space();
td3 = element("td");
t6 = space();
td4 = element("td");
span0 = element("span");
t7 = space();
span1 = element("span");
t8 = space();
attr_dev(td0, "class", "table-content svelte-lhfdtn");
add_location(td0, file$G, 63, 12, 1574);
attr_dev(td1, "class", "table-content svelte-lhfdtn");
add_location(td1, file$G, 64, 12, 1631);
attr_dev(td2, "class", "table-content svelte-lhfdtn");
add_location(td2, file$G, 65, 12, 1699);
attr_dev(td3, "class", "table-content svelte-lhfdtn");
add_location(td3, file$G, 66, 12, 1765);
add_location(span0, file$G, 68, 16, 1902);
add_location(span1, file$G, 69, 16, 1993);
attr_dev(td4, "class", "edit-button svelte-lhfdtn");
add_location(td4, file$G, 67, 12, 1861);
attr_dev(tr, "class", "svelte-lhfdtn");
add_location(tr, file$G, 62, 8, 1557);
dispose = [
listen_dev(span0, "click", click_handler),
listen_dev(span1, "click", click_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, t0);
append_dev(tr, t1);
append_dev(tr, td1);
append_dev(td1, t2);
append_dev(tr, t3);
append_dev(tr, td2);
append_dev(td2, t4);
append_dev(tr, t5);
append_dev(tr, td3);
td3.innerHTML = raw0_value;
append_dev(tr, t6);
append_dev(tr, td4);
append_dev(td4, span0);
span0.innerHTML = raw1_value;
append_dev(td4, t7);
append_dev(td4, span1);
span1.innerHTML = raw2_value;
append_dev(tr, t8);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.actionsArray) && t0_value !== (t0_value = ctx.action.name + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.actionsArray) && t2_value !== (t2_value = ctx.action.behaviourSource + "")) {
set_data_dev(t2, t2_value);
}
if ((changed.actionsArray) && t4_value !== (t4_value = ctx.action.behaviourName + "")) {
set_data_dev(t4, t4_value);
}
if ((changed.actionsArray) && raw0_value !== (raw0_value = ctx.getDefaultOptionsHtml(ctx.action.initialOptions) + "")) {
td3.innerHTML = raw0_value;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(tr);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$i.name, type: "each", source: "(62:8) {#each actionsArray as action}", ctx });
return block;
}
// (82:4) {#if isEditing}
function create_if_block$l(ctx) {
var current;
var actionview = new ActionView({
props: {
action: ctx.editingAction,
allActions: ctx.$store.actions,
onFinished: ctx.actionEditingFinished,
isNew: ctx.editingActionIsNew
},
$$inline: true
});
const block = {
c: function create() {
actionview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(actionview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var actionview_changes = {};
if (changed.editingAction) actionview_changes.action = ctx.editingAction;
if (changed.$store) actionview_changes.allActions = ctx.$store.actions;
if (changed.editingActionIsNew) actionview_changes.isNew = ctx.editingActionIsNew;
actionview.$set(actionview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(actionview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(actionview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(actionview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$l.name, type: "if", source: "(82:4) {#if isEditing}", ctx });
return block;
}
// (81:0) <Modal bind:isOpen={isEditing}>
function create_default_slot$9(ctx) {
var if_block_anchor, current;
var if_block = (ctx.isEditing) && create_if_block$l(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
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(changed, ctx) {
if (ctx.isEditing) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$l(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$9.name, type: "slot", source: "(81:0) <Modal bind:isOpen={isEditing}>", ctx });
return block;
}
function create_fragment$F(ctx) {
var h3, t1, t2, updating_isOpen, current;
function select_block_type(changed, ctx) {
if (ctx.actionsArray) return create_if_block_1$b;
return create_else_block$9;
}
var current_block_type = select_block_type(null, ctx);
var if_block = current_block_type(ctx);
function modal_isOpen_binding(value) {
ctx.modal_isOpen_binding.call(null, value);
updating_isOpen = true;
add_flush_callback(() => updating_isOpen = false);
}
let modal_props = {
$$slots: { default: [create_default_slot$9] },
$$scope: { ctx }
};
if (ctx.isEditing !== void 0) {
modal_props.isOpen = ctx.isEditing;
}
var modal = new Modal({ props: modal_props, $$inline: true });
binding_callbacks.push(() => bind(modal, 'isOpen', modal_isOpen_binding));
const block = {
c: function create() {
h3 = element("h3");
h3.textContent = "Actions";
t1 = space();
if_block.c();
t2 = space();
modal.$$.fragment.c();
attr_dev(h3, "class", "title svelte-lhfdtn");
add_location(h3, file$G, 47, 0, 1158);
},
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);
insert_dev(target, t1, anchor);
if_block.m(target, anchor);
insert_dev(target, t2, anchor);
mount_component(modal, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if (current_block_type === (current_block_type = select_block_type(changed, ctx)) && if_block) {
if_block.p(changed, ctx);
} else {
if_block.d(1);
if_block = current_block_type(ctx);
if (if_block) {
if_block.c();
if_block.m(t2.parentNode, t2);
}
}
var modal_changes = {};
if (changed.$$scope || changed.isEditing || changed.editingAction || changed.$store || changed.editingActionIsNew) modal_changes.$$scope = { changed, ctx };
if (!updating_isOpen && changed.isEditing) {
modal_changes.isOpen = ctx.isEditing;
}
modal.$set(modal_changes);
},
i: function intro(local) {
if (current) return;
transition_in(modal.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(modal.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(h3);
detach_dev(t1);
}
if_block.d(detaching);
if (detaching) {
detach_dev(t2);
}
destroy_component(modal, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$F.name, type: "component", source: "", ctx });
return block;
}
function instance$F($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let { editingActionIsNew = false, editingAction = null, onActionEdit = (action) => {} } = $$props;
let { onActionDelete = (action) => {} } = $$props;
let { onActionSave = (action) => {} } = $$props;
let { onActionCancel = () => {} } = $$props;
let actionsArray = [];
store.subscribe(s => {
$$invalidate('actionsArray', actionsArray = pipe$1(s.actions, [
fp_32,
fp_7(k => s.actions[k])
]));
});
let getDefaultOptionsHtml = defaultOptions =>
pipe$1(defaultOptions, [
fp_32,
fp_7(k => `<span style="color:var(--slate)">${k}: </span>${JSON.stringify(defaultOptions[k])}`),
fp_41("<br>")
]);
let actionEditingFinished = (action) => {
if(action) {
onActionSave(action);
} else {
onActionCancel();
}
};
const writable_props = ['editingActionIsNew', 'editingAction', 'onActionEdit', 'onActionDelete', 'onActionSave', 'onActionCancel'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Actions> was created with unknown prop '${key}'`);
});
const click_handler = ({ action }) => onActionEdit(action);
const click_handler_1 = ({ action }) => onActionDelete(action);
function modal_isOpen_binding(value) {
isEditing = value;
$$invalidate('isEditing', isEditing), $$invalidate('editingAction', editingAction);
}
$$self.$set = $$props => {
if ('editingActionIsNew' in $$props) $$invalidate('editingActionIsNew', editingActionIsNew = $$props.editingActionIsNew);
if ('editingAction' in $$props) $$invalidate('editingAction', editingAction = $$props.editingAction);
if ('onActionEdit' in $$props) $$invalidate('onActionEdit', onActionEdit = $$props.onActionEdit);
if ('onActionDelete' in $$props) $$invalidate('onActionDelete', onActionDelete = $$props.onActionDelete);
if ('onActionSave' in $$props) $$invalidate('onActionSave', onActionSave = $$props.onActionSave);
if ('onActionCancel' in $$props) $$invalidate('onActionCancel', onActionCancel = $$props.onActionCancel);
};
$$self.$capture_state = () => {
return { editingActionIsNew, editingAction, onActionEdit, onActionDelete, onActionSave, onActionCancel, actionsArray, getDefaultOptionsHtml, actionEditingFinished, isEditing, $store };
};
$$self.$inject_state = $$props => {
if ('editingActionIsNew' in $$props) $$invalidate('editingActionIsNew', editingActionIsNew = $$props.editingActionIsNew);
if ('editingAction' in $$props) $$invalidate('editingAction', editingAction = $$props.editingAction);
if ('onActionEdit' in $$props) $$invalidate('onActionEdit', onActionEdit = $$props.onActionEdit);
if ('onActionDelete' in $$props) $$invalidate('onActionDelete', onActionDelete = $$props.onActionDelete);
if ('onActionSave' in $$props) $$invalidate('onActionSave', onActionSave = $$props.onActionSave);
if ('onActionCancel' in $$props) $$invalidate('onActionCancel', onActionCancel = $$props.onActionCancel);
if ('actionsArray' in $$props) $$invalidate('actionsArray', actionsArray = $$props.actionsArray);
if ('getDefaultOptionsHtml' in $$props) $$invalidate('getDefaultOptionsHtml', getDefaultOptionsHtml = $$props.getDefaultOptionsHtml);
if ('actionEditingFinished' in $$props) $$invalidate('actionEditingFinished', actionEditingFinished = $$props.actionEditingFinished);
if ('isEditing' in $$props) $$invalidate('isEditing', isEditing = $$props.isEditing);
if ('$store' in $$props) store.set($store);
};
let isEditing;
$$self.$$.update = ($$dirty = { editingAction: 1 }) => {
if ($$dirty.editingAction) { $$invalidate('isEditing', isEditing = (editingAction !== null)); }
};
return {
editingActionIsNew,
editingAction,
onActionEdit,
onActionDelete,
onActionSave,
onActionCancel,
actionsArray,
getDefaultOptionsHtml,
actionEditingFinished,
isEditing,
$store,
click_handler,
click_handler_1,
modal_isOpen_binding
};
}
class Actions extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$F, create_fragment$F, safe_not_equal, ["editingActionIsNew", "editingAction", "onActionEdit", "onActionDelete", "onActionSave", "onActionCancel"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Actions", options, id: create_fragment$F.name });
}
get editingActionIsNew() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set editingActionIsNew(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get editingAction() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set editingAction(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onActionEdit() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onActionEdit(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onActionDelete() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onActionDelete(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onActionSave() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onActionSave(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onActionCancel() {
throw new Error("<Actions>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onActionCancel(value) {
throw new Error("<Actions>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\actionsAndTriggers\TriggerView.svelte generated by Svelte v3.12.1 */
const file$H = "src\\actionsAndTriggers\\TriggerView.svelte";
// (60:8) <Button color="primary" grouped on:click={save}>
function create_default_slot_2$5(ctx) {
var t;
const block = {
c: function create() {
t = text("Save");
},
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$5.name, type: "slot", source: "(60:8) <Button color=\"primary\" grouped on:click={save}>", ctx });
return block;
}
// (61:8) <Button color="tertiary" grouped on:click={cancel}>
function create_default_slot_1$6(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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_1$6.name, type: "slot", source: "(61:8) <Button color=\"tertiary\" grouped on:click={cancel}>", ctx });
return block;
}
// (59:4) <ButtonGroup>
function create_default_slot$a(ctx) {
var t, current;
var button0 = new Button({
props: {
color: "primary",
grouped: true,
$$slots: { default: [create_default_slot_2$5] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.save);
var button1 = new Button({
props: {
color: "tertiary",
grouped: true,
$$slots: { default: [create_default_slot_1$6] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.cancel);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$a.name, type: "slot", source: "(59:4) <ButtonGroup>", ctx });
return block;
}
function create_fragment$G(ctx) {
var div, t0, form, updating_selected, t1, updating_selected_1, t2, updating_text, t3, updating_text_1, t4, current;
var errorsbox = new ErrorsBox({
props: {
errors: ctx.errors,
style: "margin-bottom:20px"
},
$$inline: true
});
function dropdown0_selected_binding(value) {
ctx.dropdown0_selected_binding.call(null, value);
updating_selected = true;
add_flush_callback(() => updating_selected = false);
}
let dropdown0_props = { label: "Event", options: ["",...events$1] };
if (ctx.clonedTrigger.eventName !== void 0) {
dropdown0_props.selected = ctx.clonedTrigger.eventName;
}
var dropdown0 = new Dropdown({ props: dropdown0_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown0, 'selected', dropdown0_selected_binding));
function dropdown1_selected_binding(value_1) {
ctx.dropdown1_selected_binding.call(null, value_1);
updating_selected_1 = true;
add_flush_callback(() => updating_selected_1 = false);
}
let dropdown1_props = { label: "Action", options: ["",...ctx.actionNames] };
if (ctx.clonedTrigger.actionName !== void 0) {
dropdown1_props.selected = ctx.clonedTrigger.actionName;
}
var dropdown1 = new Dropdown({ props: dropdown1_props, $$inline: true });
binding_callbacks.push(() => bind(dropdown1, 'selected', dropdown1_selected_binding));
function codearea0_text_binding(value_2) {
ctx.codearea0_text_binding.call(null, value_2);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let codearea0_props = { label: "Condition (javascript)" };
if (ctx.clonedTrigger.condition !== void 0) {
codearea0_props.text = ctx.clonedTrigger.condition;
}
var codearea0 = new CodeArea({ props: codearea0_props, $$inline: true });
binding_callbacks.push(() => bind(codearea0, 'text', codearea0_text_binding));
function codearea1_text_binding(value_3) {
ctx.codearea1_text_binding.call(null, value_3);
updating_text_1 = true;
add_flush_callback(() => updating_text_1 = false);
}
let codearea1_props = {
label: "Action Options Creator (javascript)"
};
if (ctx.clonedTrigger.optionsCreator !== void 0) {
codearea1_props.text = ctx.clonedTrigger.optionsCreator;
}
var codearea1 = new CodeArea({ props: codearea1_props, $$inline: true });
binding_callbacks.push(() => bind(codearea1, 'text', codearea1_text_binding));
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot$a] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
errorsbox.$$.fragment.c();
t0 = space();
form = element("form");
dropdown0.$$.fragment.c();
t1 = space();
dropdown1.$$.fragment.c();
t2 = space();
codearea0.$$.fragment.c();
t3 = space();
codearea1.$$.fragment.c();
t4 = space();
buttongroup.$$.fragment.c();
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$H, 43, 4, 1208);
add_location(div, file$H, 39, 0, 1143);
},
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);
mount_component(errorsbox, div, null);
append_dev(div, t0);
append_dev(div, form);
mount_component(dropdown0, form, null);
append_dev(form, t1);
mount_component(dropdown1, form, null);
append_dev(form, t2);
mount_component(codearea0, form, null);
append_dev(form, t3);
mount_component(codearea1, form, null);
append_dev(div, t4);
mount_component(buttongroup, div, null);
current = true;
},
p: function update(changed, ctx) {
var errorsbox_changes = {};
if (changed.errors) errorsbox_changes.errors = ctx.errors;
errorsbox.$set(errorsbox_changes);
var dropdown0_changes = {};
if (!updating_selected && changed.clonedTrigger) {
dropdown0_changes.selected = ctx.clonedTrigger.eventName;
}
dropdown0.$set(dropdown0_changes);
var dropdown1_changes = {};
if (changed.actionNames) dropdown1_changes.options = ["",...ctx.actionNames];
if (!updating_selected_1 && changed.clonedTrigger) {
dropdown1_changes.selected = ctx.clonedTrigger.actionName;
}
dropdown1.$set(dropdown1_changes);
var codearea0_changes = {};
if (!updating_text && changed.clonedTrigger) {
codearea0_changes.text = ctx.clonedTrigger.condition;
}
codearea0.$set(codearea0_changes);
var codearea1_changes = {};
if (!updating_text_1 && changed.clonedTrigger) {
codearea1_changes.text = ctx.clonedTrigger.optionsCreator;
}
codearea1.$set(codearea1_changes);
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(errorsbox.$$.fragment, local);
transition_in(dropdown0.$$.fragment, local);
transition_in(dropdown1.$$.fragment, local);
transition_in(codearea0.$$.fragment, local);
transition_in(codearea1.$$.fragment, local);
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(errorsbox.$$.fragment, local);
transition_out(dropdown0.$$.fragment, local);
transition_out(dropdown1.$$.fragment, local);
transition_out(codearea0.$$.fragment, local);
transition_out(codearea1.$$.fragment, local);
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(errorsbox);
destroy_component(dropdown0);
destroy_component(dropdown1);
destroy_component(codearea0);
destroy_component(codearea1);
destroy_component(buttongroup);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$G.name, type: "component", source: "", ctx });
return block;
}
function instance$G($$self, $$props, $$invalidate) {
let { trigger, onFinished = (action) => {} } = $$props;
let { allTriggers, allActions, isNew = true } = $$props;
let clonedTrigger = fp_4(trigger);
let errors = [];
let cancel = () => onFinished();
let save = () => {
const newTriggersList = [
...pipe$1(allTriggers ,[fp_8(t => t !== trigger)]),
clonedTrigger];
$$invalidate('errors', errors = validateTriggers$1(newTriggersList, allActions));
const test = fp_7(t =>(!t.actionName || fp_6(a => a.name === t.actionName)(allActions)))(newTriggersList);
if(errors.length === 0)
onFinished(clonedTrigger);
};
const writable_props = ['trigger', 'onFinished', 'allTriggers', 'allActions', 'isNew'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<TriggerView> was created with unknown prop '${key}'`);
});
function dropdown0_selected_binding(value) {
clonedTrigger.eventName = value;
$$invalidate('clonedTrigger', clonedTrigger);
}
function dropdown1_selected_binding(value_1) {
clonedTrigger.actionName = value_1;
$$invalidate('clonedTrigger', clonedTrigger);
}
function codearea0_text_binding(value_2) {
clonedTrigger.condition = value_2;
$$invalidate('clonedTrigger', clonedTrigger);
}
function codearea1_text_binding(value_3) {
clonedTrigger.optionsCreator = value_3;
$$invalidate('clonedTrigger', clonedTrigger);
}
$$self.$set = $$props => {
if ('trigger' in $$props) $$invalidate('trigger', trigger = $$props.trigger);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('allTriggers' in $$props) $$invalidate('allTriggers', allTriggers = $$props.allTriggers);
if ('allActions' in $$props) $$invalidate('allActions', allActions = $$props.allActions);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
};
$$self.$capture_state = () => {
return { trigger, onFinished, allTriggers, allActions, isNew, clonedTrigger, errors, cancel, save, actionNames };
};
$$self.$inject_state = $$props => {
if ('trigger' in $$props) $$invalidate('trigger', trigger = $$props.trigger);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('allTriggers' in $$props) $$invalidate('allTriggers', allTriggers = $$props.allTriggers);
if ('allActions' in $$props) $$invalidate('allActions', allActions = $$props.allActions);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
if ('clonedTrigger' in $$props) $$invalidate('clonedTrigger', clonedTrigger = $$props.clonedTrigger);
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('cancel' in $$props) $$invalidate('cancel', cancel = $$props.cancel);
if ('save' in $$props) $$invalidate('save', save = $$props.save);
if ('actionNames' in $$props) $$invalidate('actionNames', actionNames = $$props.actionNames);
};
let actionNames;
$$self.$$.update = ($$dirty = { allActions: 1 }) => {
if ($$dirty.allActions) { $$invalidate('actionNames', actionNames = fp_7(a => a.name)(allActions)); }
};
return {
trigger,
onFinished,
allTriggers,
allActions,
isNew,
clonedTrigger,
errors,
cancel,
save,
actionNames,
dropdown0_selected_binding,
dropdown1_selected_binding,
codearea0_text_binding,
codearea1_text_binding
};
}
class TriggerView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$G, create_fragment$G, safe_not_equal, ["trigger", "onFinished", "allTriggers", "allActions", "isNew"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "TriggerView", options, id: create_fragment$G.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.trigger === undefined && !('trigger' in props)) {
console.warn("<TriggerView> was created without expected prop 'trigger'");
}
if (ctx.allTriggers === undefined && !('allTriggers' in props)) {
console.warn("<TriggerView> was created without expected prop 'allTriggers'");
}
if (ctx.allActions === undefined && !('allActions' in props)) {
console.warn("<TriggerView> was created without expected prop 'allActions'");
}
}
get trigger() {
throw new Error("<TriggerView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set trigger(value) {
throw new Error("<TriggerView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onFinished() {
throw new Error("<TriggerView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onFinished(value) {
throw new Error("<TriggerView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allTriggers() {
throw new Error("<TriggerView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allTriggers(value) {
throw new Error("<TriggerView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allActions() {
throw new Error("<TriggerView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allActions(value) {
throw new Error("<TriggerView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get isNew() {
throw new Error("<TriggerView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set isNew(value) {
throw new Error("<TriggerView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\actionsAndTriggers\Triggers.svelte generated by Svelte v3.12.1 */
const file$I = "src\\actionsAndTriggers\\Triggers.svelte";
function get_each_context$j(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.trigger = list[i];
return child_ctx;
}
// (58:0) {:else}
function create_else_block$a(ctx) {
var t;
const block = {
c: function create() {
t = text("(no triggers added)");
},
m: function mount(target, anchor) {
insert_dev(target, t, anchor);
},
p: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(t);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$a.name, type: "else", source: "(58:0) {:else}", ctx });
return block;
}
// (32:0) {#if $store.triggers}
function create_if_block_1$c(ctx) {
var table, thead, tr, th0, t1, th1, t3, th2, t5, th3, t7, th4, t8, tbody;
let each_value = ctx.$store.triggers;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$j(get_each_context$j(ctx, each_value, i));
}
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Event";
t1 = space();
th1 = element("th");
th1.textContent = "Action";
t3 = space();
th2 = element("th");
th2.textContent = "Condition";
t5 = space();
th3 = element("th");
th3.textContent = "Create Options";
t7 = space();
th4 = element("th");
t8 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
add_location(th0, file$I, 35, 12, 838);
add_location(th1, file$I, 36, 12, 865);
add_location(th2, file$I, 37, 12, 893);
add_location(th3, file$I, 38, 12, 924);
add_location(th4, file$I, 39, 12, 960);
add_location(tr, file$I, 34, 8, 821);
add_location(thead, file$I, 33, 4, 805);
add_location(tbody, file$I, 42, 4, 1001);
attr_dev(table, "class", "fields-table uk-table uk-table-small uk-table-striped");
add_location(table, file$I, 32, 0, 731);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(tr, t5);
append_dev(tr, th3);
append_dev(tr, t7);
append_dev(tr, th4);
append_dev(table, t8);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
},
p: function update(changed, ctx) {
if (changed.getIcon || changed.$store) {
each_value = ctx.$store.triggers;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$j(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$j(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(table);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$c.name, type: "if", source: "(32:0) {#if $store.triggers}", ctx });
return block;
}
// (44:8) {#each $store.triggers as trigger}
function create_each_block$j(ctx) {
var tr, td0, t0_value = ctx.trigger.eventName + "", t0, t1, td1, t2_value = ctx.trigger.actionName + "", t2, t3, td2, t4_value = ctx.trigger.condition + "", t4, t5, td3, t6_value = ctx.trigger.optionsCreator + "", t6, t7, td4, span0, raw0_value = getIcon("edit") + "", t8, span1, raw1_value = getIcon("trash") + "", t9, dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = text(t0_value);
t1 = space();
td1 = element("td");
t2 = text(t2_value);
t3 = space();
td2 = element("td");
t4 = text(t4_value);
t5 = space();
td3 = element("td");
t6 = text(t6_value);
t7 = space();
td4 = element("td");
span0 = element("span");
t8 = space();
span1 = element("span");
t9 = space();
attr_dev(td0, "class", "table-content svelte-zm41av");
add_location(td0, file$I, 45, 12, 1077);
attr_dev(td1, "class", "table-content svelte-zm41av");
add_location(td1, file$I, 46, 12, 1140);
attr_dev(td2, "class", "table-content svelte-zm41av");
add_location(td2, file$I, 47, 12, 1204);
attr_dev(td3, "class", "table-content svelte-zm41av");
add_location(td3, file$I, 48, 12, 1267);
add_location(span0, file$I, 50, 16, 1376);
add_location(span1, file$I, 51, 16, 1469);
attr_dev(td4, "class", "edit-button svelte-zm41av");
add_location(td4, file$I, 49, 12, 1335);
attr_dev(tr, "class", "svelte-zm41av");
add_location(tr, file$I, 44, 8, 1060);
dispose = [
listen_dev(span0, "click", click_handler),
listen_dev(span1, "click", click_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, t0);
append_dev(tr, t1);
append_dev(tr, td1);
append_dev(td1, t2);
append_dev(tr, t3);
append_dev(tr, td2);
append_dev(td2, t4);
append_dev(tr, t5);
append_dev(tr, td3);
append_dev(td3, t6);
append_dev(tr, t7);
append_dev(tr, td4);
append_dev(td4, span0);
span0.innerHTML = raw0_value;
append_dev(td4, t8);
append_dev(td4, span1);
span1.innerHTML = raw1_value;
append_dev(tr, t9);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.$store) && t0_value !== (t0_value = ctx.trigger.eventName + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.$store) && t2_value !== (t2_value = ctx.trigger.actionName + "")) {
set_data_dev(t2, t2_value);
}
if ((changed.$store) && t4_value !== (t4_value = ctx.trigger.condition + "")) {
set_data_dev(t4, t4_value);
}
if ((changed.$store) && t6_value !== (t6_value = ctx.trigger.optionsCreator + "")) {
set_data_dev(t6, t6_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(tr);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$j.name, type: "each", source: "(44:8) {#each $store.triggers as trigger}", ctx });
return block;
}
// (64:4) {#if isEditing}
function create_if_block$m(ctx) {
var current;
var triggerview = new TriggerView({
props: {
trigger: ctx.editingTrigger,
allActions: ctx.$store.actions,
allTriggers: ctx.$store.triggers,
onFinished: ctx.triggerEditingFinished,
isNew: ctx.editingTriggerIsNew
},
$$inline: true
});
const block = {
c: function create() {
triggerview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(triggerview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var triggerview_changes = {};
if (changed.editingTrigger) triggerview_changes.trigger = ctx.editingTrigger;
if (changed.$store) triggerview_changes.allActions = ctx.$store.actions;
if (changed.$store) triggerview_changes.allTriggers = ctx.$store.triggers;
if (changed.editingTriggerIsNew) triggerview_changes.isNew = ctx.editingTriggerIsNew;
triggerview.$set(triggerview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(triggerview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(triggerview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(triggerview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$m.name, type: "if", source: "(64:4) {#if isEditing}", ctx });
return block;
}
// (63:0) <Modal bind:isOpen={isEditing}>
function create_default_slot$b(ctx) {
var if_block_anchor, current;
var if_block = (ctx.isEditing) && create_if_block$m(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
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(changed, ctx) {
if (ctx.isEditing) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$m(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$b.name, type: "slot", source: "(63:0) <Modal bind:isOpen={isEditing}>", ctx });
return block;
}
function create_fragment$H(ctx) {
var h3, t1, t2, updating_isOpen, current;
function select_block_type(changed, ctx) {
if (ctx.$store.triggers) return create_if_block_1$c;
return create_else_block$a;
}
var current_block_type = select_block_type(null, ctx);
var if_block = current_block_type(ctx);
function modal_isOpen_binding(value) {
ctx.modal_isOpen_binding.call(null, value);
updating_isOpen = true;
add_flush_callback(() => updating_isOpen = false);
}
let modal_props = {
$$slots: { default: [create_default_slot$b] },
$$scope: { ctx }
};
if (ctx.isEditing !== void 0) {
modal_props.isOpen = ctx.isEditing;
}
var modal = new Modal({ props: modal_props, $$inline: true });
binding_callbacks.push(() => bind(modal, 'isOpen', modal_isOpen_binding));
const block = {
c: function create() {
h3 = element("h3");
h3.textContent = "Triggers";
t1 = space();
if_block.c();
t2 = space();
modal.$$.fragment.c();
attr_dev(h3, "class", "title svelte-zm41av");
add_location(h3, file$I, 29, 0, 676);
},
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);
insert_dev(target, t1, anchor);
if_block.m(target, anchor);
insert_dev(target, t2, anchor);
mount_component(modal, target, anchor);
current = true;
},
p: function update(changed, ctx) {
if (current_block_type === (current_block_type = select_block_type(changed, ctx)) && if_block) {
if_block.p(changed, ctx);
} else {
if_block.d(1);
if_block = current_block_type(ctx);
if (if_block) {
if_block.c();
if_block.m(t2.parentNode, t2);
}
}
var modal_changes = {};
if (changed.$$scope || changed.isEditing || changed.editingTrigger || changed.$store || changed.editingTriggerIsNew) modal_changes.$$scope = { changed, ctx };
if (!updating_isOpen && changed.isEditing) {
modal_changes.isOpen = ctx.isEditing;
}
modal.$set(modal_changes);
},
i: function intro(local) {
if (current) return;
transition_in(modal.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(modal.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(h3);
detach_dev(t1);
}
if_block.d(detaching);
if (detaching) {
detach_dev(t2);
}
destroy_component(modal, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$H.name, type: "component", source: "", ctx });
return block;
}
function instance$H($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let { editingTrigger = null, editingTriggerIsNew = true, onTriggerEdit = (trigger) => {} } = $$props;
let { onTriggerDelete = (trigger) => {} } = $$props;
let { onTriggerSave = (trigger) => {} } = $$props;
let { onTriggerCancel = () => {} } = $$props;
let triggerEditingFinished = (trigger) => {
if(trigger) {
onTriggerSave(trigger);
} else {
onTriggerCancel();
}
};
const writable_props = ['editingTrigger', 'editingTriggerIsNew', 'onTriggerEdit', 'onTriggerDelete', 'onTriggerSave', 'onTriggerCancel'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<Triggers> was created with unknown prop '${key}'`);
});
const click_handler = ({ trigger }) => onTriggerEdit(trigger);
const click_handler_1 = ({ trigger }) => onTriggerDelete(trigger);
function modal_isOpen_binding(value) {
isEditing = value;
$$invalidate('isEditing', isEditing), $$invalidate('editingTrigger', editingTrigger);
}
$$self.$set = $$props => {
if ('editingTrigger' in $$props) $$invalidate('editingTrigger', editingTrigger = $$props.editingTrigger);
if ('editingTriggerIsNew' in $$props) $$invalidate('editingTriggerIsNew', editingTriggerIsNew = $$props.editingTriggerIsNew);
if ('onTriggerEdit' in $$props) $$invalidate('onTriggerEdit', onTriggerEdit = $$props.onTriggerEdit);
if ('onTriggerDelete' in $$props) $$invalidate('onTriggerDelete', onTriggerDelete = $$props.onTriggerDelete);
if ('onTriggerSave' in $$props) $$invalidate('onTriggerSave', onTriggerSave = $$props.onTriggerSave);
if ('onTriggerCancel' in $$props) $$invalidate('onTriggerCancel', onTriggerCancel = $$props.onTriggerCancel);
};
$$self.$capture_state = () => {
return { editingTrigger, editingTriggerIsNew, onTriggerEdit, onTriggerDelete, onTriggerSave, onTriggerCancel, triggerEditingFinished, isEditing, $store };
};
$$self.$inject_state = $$props => {
if ('editingTrigger' in $$props) $$invalidate('editingTrigger', editingTrigger = $$props.editingTrigger);
if ('editingTriggerIsNew' in $$props) $$invalidate('editingTriggerIsNew', editingTriggerIsNew = $$props.editingTriggerIsNew);
if ('onTriggerEdit' in $$props) $$invalidate('onTriggerEdit', onTriggerEdit = $$props.onTriggerEdit);
if ('onTriggerDelete' in $$props) $$invalidate('onTriggerDelete', onTriggerDelete = $$props.onTriggerDelete);
if ('onTriggerSave' in $$props) $$invalidate('onTriggerSave', onTriggerSave = $$props.onTriggerSave);
if ('onTriggerCancel' in $$props) $$invalidate('onTriggerCancel', onTriggerCancel = $$props.onTriggerCancel);
if ('triggerEditingFinished' in $$props) $$invalidate('triggerEditingFinished', triggerEditingFinished = $$props.triggerEditingFinished);
if ('isEditing' in $$props) $$invalidate('isEditing', isEditing = $$props.isEditing);
if ('$store' in $$props) store.set($store);
};
let isEditing;
$$self.$$.update = ($$dirty = { editingTrigger: 1 }) => {
if ($$dirty.editingTrigger) { $$invalidate('isEditing', isEditing = (editingTrigger !== null)); }
};
return {
editingTrigger,
editingTriggerIsNew,
onTriggerEdit,
onTriggerDelete,
onTriggerSave,
onTriggerCancel,
triggerEditingFinished,
isEditing,
$store,
click_handler,
click_handler_1,
modal_isOpen_binding
};
}
class Triggers extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$H, create_fragment$H, safe_not_equal, ["editingTrigger", "editingTriggerIsNew", "onTriggerEdit", "onTriggerDelete", "onTriggerSave", "onTriggerCancel"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Triggers", options, id: create_fragment$H.name });
}
get editingTrigger() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set editingTrigger(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get editingTriggerIsNew() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set editingTriggerIsNew(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onTriggerEdit() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onTriggerEdit(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onTriggerDelete() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onTriggerDelete(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onTriggerSave() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onTriggerSave(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onTriggerCancel() {
throw new Error("<Triggers>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onTriggerCancel(value) {
throw new Error("<Triggers>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\actionsAndTriggers\ActionsAndTriggersRoot.svelte generated by Svelte v3.12.1 */
const file$J = "src\\actionsAndTriggers\\ActionsAndTriggersRoot.svelte";
// (90:12) <Button color="secondary" grouped on:click={newAction}>
function create_default_slot_2$6(ctx) {
var t;
const block = {
c: function create() {
t = text("Create New Action");
},
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$6.name, type: "slot", source: "(90:12) <Button color=\"secondary\" grouped on:click={newAction}>", ctx });
return block;
}
// (93:12) <Button color="tertiary" grouped on:click={newTrigger}>
function create_default_slot_1$7(ctx) {
var t;
const block = {
c: function create() {
t = text("Create New Trigger");
},
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_1$7.name, type: "slot", source: "(93:12) <Button color=\"tertiary\" grouped on:click={newTrigger}>", ctx });
return block;
}
// (89:8) <ButtonGroup>
function create_default_slot$c(ctx) {
var t, current;
var button0 = new Button({
props: {
color: "secondary",
grouped: true,
$$slots: { default: [create_default_slot_2$6] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.newAction);
var button1 = new Button({
props: {
color: "tertiary",
grouped: true,
$$slots: { default: [create_default_slot_1$7] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.newTrigger);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$c.name, type: "slot", source: "(89:8) <ButtonGroup>", ctx });
return block;
}
function create_fragment$I(ctx) {
var div2, div0, t0, div1, t1, current;
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot$c] },
$$scope: { ctx }
},
$$inline: true
});
var actions = new Actions({
props: {
editingActionIsNew: ctx.editingActionIsNew,
editingAction: ctx.editingAction,
onActionEdit: ctx.onActionEdit,
onActionDelete: ctx.onActionDelete,
onActionSave: ctx.onActionSave,
onActionCancel: ctx.onActionCancel
},
$$inline: true
});
var triggers = new Triggers({
props: {
editingTriggerIsNew: ctx.editingTriggerIsNew,
editingTrigger: ctx.editingTrigger,
onTriggerEdit: ctx.onTriggerEdit,
onTriggerDelete: ctx.onTriggerDelete,
onTriggerSave: ctx.onTriggerSave,
onTriggerCancel: ctx.onTriggerCancel
},
$$inline: true
});
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
buttongroup.$$.fragment.c();
t0 = space();
div1 = element("div");
actions.$$.fragment.c();
t1 = space();
triggers.$$.fragment.c();
attr_dev(div0, "class", "actions-header svelte-wfv60d");
add_location(div0, file$J, 87, 4, 1816);
attr_dev(div1, "class", "node-view svelte-wfv60d");
add_location(div1, file$J, 98, 4, 2177);
attr_dev(div2, "class", "root svelte-wfv60d");
add_location(div2, file$J, 86, 0, 1793);
},
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);
mount_component(buttongroup, div0, null);
append_dev(div2, t0);
append_dev(div2, div1);
mount_component(actions, div1, null);
append_dev(div1, t1);
mount_component(triggers, div1, null);
current = true;
},
p: function update(changed, ctx) {
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
var actions_changes = {};
if (changed.editingActionIsNew) actions_changes.editingActionIsNew = ctx.editingActionIsNew;
if (changed.editingAction) actions_changes.editingAction = ctx.editingAction;
actions.$set(actions_changes);
var triggers_changes = {};
if (changed.editingTriggerIsNew) triggers_changes.editingTriggerIsNew = ctx.editingTriggerIsNew;
if (changed.editingTrigger) triggers_changes.editingTrigger = ctx.editingTrigger;
triggers.$set(triggers_changes);
},
i: function intro(local) {
if (current) return;
transition_in(buttongroup.$$.fragment, local);
transition_in(actions.$$.fragment, local);
transition_in(triggers.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(buttongroup.$$.fragment, local);
transition_out(actions.$$.fragment, local);
transition_out(triggers.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(buttongroup);
destroy_component(actions);
destroy_component(triggers);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$I.name, type: "component", source: "", ctx });
return block;
}
function instance$I($$self, $$props, $$invalidate) {
let editingAction = null;
let editingActionIsNew = true;
let editingTrigger = null;
let editingTriggerIsNew = true;
let getDefaultOptionsHtml = defaultOptions =>
pipe(defaultOptions, [
keys,
map(k => `<span style="color:var(--slate)">${k}: </span>${JSON.parse(typeOptions[k])}`),
join("<br>")
]);
let onActionEdit = (action) => {
$$invalidate('editingAction', editingAction = action);
$$invalidate('editingActionIsNew', editingActionIsNew = false);
};
let newAction = () => {
$$invalidate('editingAction', editingAction = getNewAction());
$$invalidate('editingActionIsNew', editingActionIsNew = true);
};
let onActionDelete = (action) => {
store.deleteAction(action);
};
let deleteTrigger = () => {};
let editTrigger = (trigger) => {
$$invalidate('editingTrigger', editingTrigger = trigger);
$$invalidate('editingTriggerIsNew', editingTriggerIsNew = false);
};
let newTrigger = () => {
$$invalidate('editingTrigger', editingTrigger = getNewTrigger());
$$invalidate('editingTriggerIsNew', editingTriggerIsNew = true);
};
let onActionSave = action => {
store.saveAction(
action,
editingActionIsNew,
editingAction);
$$invalidate('editingAction', editingAction = null);
};
let onActionCancel = () => {
$$invalidate('editingAction', editingAction = null);
};
let onTriggerSave = trigger => {
store.saveTrigger(
trigger,
editingTriggerIsNew,
editingTrigger);
$$invalidate('editingTrigger', editingTrigger = null);
};
let onTriggerCancel = () => {
$$invalidate('editingTrigger', editingTrigger = null);
};
let onTriggerEdit = (trigger) => {
$$invalidate('editingTrigger', editingTrigger = trigger);
$$invalidate('editingTriggerIsNew', editingTriggerIsNew = false);
};
let onTriggerDelete = (trigger) => {
store.deleteTrigger(trigger);
};
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('editingAction' in $$props) $$invalidate('editingAction', editingAction = $$props.editingAction);
if ('editingActionIsNew' in $$props) $$invalidate('editingActionIsNew', editingActionIsNew = $$props.editingActionIsNew);
if ('editingTrigger' in $$props) $$invalidate('editingTrigger', editingTrigger = $$props.editingTrigger);
if ('editingTriggerIsNew' in $$props) $$invalidate('editingTriggerIsNew', editingTriggerIsNew = $$props.editingTriggerIsNew);
if ('getDefaultOptionsHtml' in $$props) getDefaultOptionsHtml = $$props.getDefaultOptionsHtml;
if ('onActionEdit' in $$props) $$invalidate('onActionEdit', onActionEdit = $$props.onActionEdit);
if ('newAction' in $$props) $$invalidate('newAction', newAction = $$props.newAction);
if ('onActionDelete' in $$props) $$invalidate('onActionDelete', onActionDelete = $$props.onActionDelete);
if ('deleteTrigger' in $$props) deleteTrigger = $$props.deleteTrigger;
if ('editTrigger' in $$props) editTrigger = $$props.editTrigger;
if ('newTrigger' in $$props) $$invalidate('newTrigger', newTrigger = $$props.newTrigger);
if ('onActionSave' in $$props) $$invalidate('onActionSave', onActionSave = $$props.onActionSave);
if ('onActionCancel' in $$props) $$invalidate('onActionCancel', onActionCancel = $$props.onActionCancel);
if ('onTriggerSave' in $$props) $$invalidate('onTriggerSave', onTriggerSave = $$props.onTriggerSave);
if ('onTriggerCancel' in $$props) $$invalidate('onTriggerCancel', onTriggerCancel = $$props.onTriggerCancel);
if ('onTriggerEdit' in $$props) $$invalidate('onTriggerEdit', onTriggerEdit = $$props.onTriggerEdit);
if ('onTriggerDelete' in $$props) $$invalidate('onTriggerDelete', onTriggerDelete = $$props.onTriggerDelete);
};
return {
editingAction,
editingActionIsNew,
editingTrigger,
editingTriggerIsNew,
onActionEdit,
newAction,
onActionDelete,
newTrigger,
onActionSave,
onActionCancel,
onTriggerSave,
onTriggerCancel,
onTriggerEdit,
onTriggerDelete
};
}
class ActionsAndTriggersRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$I, create_fragment$I, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "ActionsAndTriggersRoot", options, id: create_fragment$I.name });
}
}
/* src\accessLevels\AccessLevelView.svelte generated by Svelte v3.12.1 */
const file$K = "src\\accessLevels\\AccessLevelView.svelte";
function get_each_context$k(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.permission = list[i];
return child_ctx;
}
// (79:8) {#each permissionMatrix as permission}
function create_each_block$k(ctx) {
var div, t, current;
var checkbox = new Checkbox({
props: {
label: ctx.getPermissionName(ctx.permission.permission),
checked: ctx.permission.hasPermission
},
$$inline: true
});
checkbox.$on("change", ctx.permissionChanged(ctx.permission.permission));
const block = {
c: function create() {
div = element("div");
checkbox.$$.fragment.c();
t = space();
add_location(div, file$K, 79, 8, 1869);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(checkbox, div, null);
append_dev(div, t);
current = true;
},
p: function update(changed, ctx) {
var checkbox_changes = {};
if (changed.permissionMatrix) checkbox_changes.label = ctx.getPermissionName(ctx.permission.permission);
if (changed.permissionMatrix) checkbox_changes.checked = ctx.permission.hasPermission;
checkbox.$set(checkbox_changes);
},
i: function intro(local) {
if (current) return;
transition_in(checkbox.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(checkbox.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(checkbox);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$k.name, type: "each", source: "(79:8) {#each permissionMatrix as permission}", ctx });
return block;
}
// (90:8) <Button color="primary" grouped on:click={save}>
function create_default_slot_2$7(ctx) {
var t;
const block = {
c: function create() {
t = text("Save");
},
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$7.name, type: "slot", source: "(90:8) <Button color=\"primary\" grouped on:click={save}>", ctx });
return block;
}
// (91:8) <Button color="secondary" grouped on:click={() => onFinished()}>
function create_default_slot_1$8(ctx) {
var t;
const block = {
c: function create() {
t = text("Cancel");
},
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_1$8.name, type: "slot", source: "(91:8) <Button color=\"secondary\" grouped on:click={() => onFinished()}>", ctx });
return block;
}
// (89:4) <ButtonGroup style="margin-top: 10px">
function create_default_slot$d(ctx) {
var t, current;
var button0 = new Button({
props: {
color: "primary",
grouped: true,
$$slots: { default: [create_default_slot_2$7] },
$$scope: { ctx }
},
$$inline: true
});
button0.$on("click", ctx.save);
var button1 = new Button({
props: {
color: "secondary",
grouped: true,
$$slots: { default: [create_default_slot_1$8] },
$$scope: { ctx }
},
$$inline: true
});
button1.$on("click", ctx.click_handler);
const block = {
c: function create() {
button0.$$.fragment.c();
t = space();
button1.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button0, target, anchor);
insert_dev(target, t, anchor);
mount_component(button1, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button0_changes = {};
if (changed.$$scope) button0_changes.$$scope = { changed, ctx };
button0.$set(button0_changes);
var button1_changes = {};
if (changed.$$scope) button1_changes.$$scope = { changed, ctx };
button1.$set(button1_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button0.$$.fragment, local);
transition_in(button1.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button0.$$.fragment, local);
transition_out(button1.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button0, detaching);
if (detaching) {
detach_dev(t);
}
destroy_component(button1, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$d.name, type: "slot", source: "(89:4) <ButtonGroup style=\"margin-top: 10px\">", ctx });
return block;
}
function create_fragment$J(ctx) {
var div, t0, form, updating_text, t1, t2, current;
var errorsbox = new ErrorsBox({
props: { errors: ctx.errors },
$$inline: true
});
function textbox_text_binding(value) {
ctx.textbox_text_binding.call(null, value);
updating_text = true;
add_flush_callback(() => updating_text = false);
}
let textbox_props = { label: "Name" };
if (ctx.clonedLevel.name !== void 0) {
textbox_props.text = ctx.clonedLevel.name;
}
var textbox = new Textbox({ props: textbox_props, $$inline: true });
binding_callbacks.push(() => bind(textbox, 'text', textbox_text_binding));
let each_value = ctx.permissionMatrix;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$k(get_each_context$k(ctx, each_value, i));
}
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
var buttongroup = new ButtonGroup({
props: {
style: "margin-top: 10px",
$$slots: { default: [create_default_slot$d] },
$$scope: { ctx }
},
$$inline: true
});
const block = {
c: function create() {
div = element("div");
errorsbox.$$.fragment.c();
t0 = space();
form = element("form");
textbox.$$.fragment.c();
t1 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t2 = space();
buttongroup.$$.fragment.c();
attr_dev(form, "class", "uk-form-horizontal");
add_location(form, file$K, 74, 4, 1716);
add_location(div, file$K, 70, 0, 1677);
},
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);
mount_component(errorsbox, div, null);
append_dev(div, t0);
append_dev(div, form);
mount_component(textbox, form, null);
append_dev(form, t1);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(form, null);
}
append_dev(div, t2);
mount_component(buttongroup, div, null);
current = true;
},
p: function update(changed, ctx) {
var errorsbox_changes = {};
if (changed.errors) errorsbox_changes.errors = ctx.errors;
errorsbox.$set(errorsbox_changes);
var textbox_changes = {};
if (!updating_text && changed.clonedLevel) {
textbox_changes.text = ctx.clonedLevel.name;
}
textbox.$set(textbox_changes);
if (changed.getPermissionName || changed.permissionMatrix) {
each_value = ctx.permissionMatrix;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$k(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$k(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(form, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
},
i: function intro(local) {
if (current) return;
transition_in(errorsbox.$$.fragment, local);
transition_in(textbox.$$.fragment, local);
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
transition_in(buttongroup.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(errorsbox.$$.fragment, local);
transition_out(textbox.$$.fragment, local);
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
transition_out(buttongroup.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(errorsbox);
destroy_component(textbox);
destroy_each(each_blocks, detaching);
destroy_component(buttongroup);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$J.name, type: "component", source: "", ctx });
return block;
}
function instance$J($$self, $$props, $$invalidate) {
let { level, allPermissions, onFinished, isNew, allLevels, hierarchy, actions } = $$props;
let errors = [];
let clonedLevel = fp_4(level);
const matchPermissions = (p1, p2) =>
p1.type === p2.type
&&
((!p2.nodeKey && !p1.nodeKey)
|| p2.nodeKey === p1.nodeKey);
const hasPermission = hasPerm =>
fp_6(p => matchPermissions(p, hasPerm))
(clonedLevel.permissions);
const getPermissionName = perm =>
perm.nodeKey
? `${perm.type} - ${perm.nodeKey}`
: perm.type;
const save = () => {
const newLevels =
isNew
? [...allLevels, clonedLevel]
: [...fp_8(l => l.name !== level.name)(allLevels), clonedLevel];
$$invalidate('errors', errors = validateAccessLevels$1(
hierarchy,
actions,
newLevels
));
if(errors.length > 0) return;
onFinished(clonedLevel);
};
const permissionChanged = perm => ev => {
const hasPermission = ev.target.checked;
if(hasPermission) {
clonedLevel.permissions.push(perm);
} else {
$$invalidate('clonedLevel', clonedLevel.permissions = fp_8(p => !matchPermissions(p, perm))(clonedLevel.permissions), clonedLevel);
}
};
const writable_props = ['level', 'allPermissions', 'onFinished', 'isNew', 'allLevels', 'hierarchy', 'actions'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<AccessLevelView> was created with unknown prop '${key}'`);
});
function textbox_text_binding(value) {
clonedLevel.name = value;
$$invalidate('clonedLevel', clonedLevel);
}
const click_handler = () => onFinished();
$$self.$set = $$props => {
if ('level' in $$props) $$invalidate('level', level = $$props.level);
if ('allPermissions' in $$props) $$invalidate('allPermissions', allPermissions = $$props.allPermissions);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
if ('allLevels' in $$props) $$invalidate('allLevels', allLevels = $$props.allLevels);
if ('hierarchy' in $$props) $$invalidate('hierarchy', hierarchy = $$props.hierarchy);
if ('actions' in $$props) $$invalidate('actions', actions = $$props.actions);
};
$$self.$capture_state = () => {
return { level, allPermissions, onFinished, isNew, allLevels, hierarchy, actions, errors, clonedLevel, permissionMatrix };
};
$$self.$inject_state = $$props => {
if ('level' in $$props) $$invalidate('level', level = $$props.level);
if ('allPermissions' in $$props) $$invalidate('allPermissions', allPermissions = $$props.allPermissions);
if ('onFinished' in $$props) $$invalidate('onFinished', onFinished = $$props.onFinished);
if ('isNew' in $$props) $$invalidate('isNew', isNew = $$props.isNew);
if ('allLevels' in $$props) $$invalidate('allLevels', allLevels = $$props.allLevels);
if ('hierarchy' in $$props) $$invalidate('hierarchy', hierarchy = $$props.hierarchy);
if ('actions' in $$props) $$invalidate('actions', actions = $$props.actions);
if ('errors' in $$props) $$invalidate('errors', errors = $$props.errors);
if ('clonedLevel' in $$props) $$invalidate('clonedLevel', clonedLevel = $$props.clonedLevel);
if ('permissionMatrix' in $$props) $$invalidate('permissionMatrix', permissionMatrix = $$props.permissionMatrix);
};
let permissionMatrix;
$$self.$$.update = ($$dirty = { allPermissions: 1 }) => {
if ($$dirty.allPermissions) { $$invalidate('permissionMatrix', permissionMatrix =
fp_7(p => ({permission:p, hasPermission: hasPermission(p)}))
(allPermissions)); }
};
return {
level,
allPermissions,
onFinished,
isNew,
allLevels,
hierarchy,
actions,
errors,
clonedLevel,
getPermissionName,
save,
permissionChanged,
permissionMatrix,
textbox_text_binding,
click_handler
};
}
class AccessLevelView extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$J, create_fragment$J, safe_not_equal, ["level", "allPermissions", "onFinished", "isNew", "allLevels", "hierarchy", "actions"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "AccessLevelView", options, id: create_fragment$J.name });
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.level === undefined && !('level' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'level'");
}
if (ctx.allPermissions === undefined && !('allPermissions' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'allPermissions'");
}
if (ctx.onFinished === undefined && !('onFinished' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'onFinished'");
}
if (ctx.isNew === undefined && !('isNew' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'isNew'");
}
if (ctx.allLevels === undefined && !('allLevels' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'allLevels'");
}
if (ctx.hierarchy === undefined && !('hierarchy' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'hierarchy'");
}
if (ctx.actions === undefined && !('actions' in props)) {
console.warn("<AccessLevelView> was created without expected prop 'actions'");
}
}
get level() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set level(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allPermissions() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allPermissions(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get onFinished() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set onFinished(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get isNew() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set isNew(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get allLevels() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set allLevels(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get hierarchy() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set hierarchy(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get actions() {
throw new Error("<AccessLevelView>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set actions(value) {
throw new Error("<AccessLevelView>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\accessLevels\AccessLevelsRoot.svelte generated by Svelte v3.12.1 */
const file$L = "src\\accessLevels\\AccessLevelsRoot.svelte";
function get_each_context$l(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.level = list[i];
return child_ctx;
}
// (55:4) <Button grouped color="secondary" on:click={createNewLevel}>
function create_default_slot_2$8(ctx) {
var t;
const block = {
c: function create() {
t = text("Create New Access Level");
},
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$8.name, type: "slot", source: "(55:4) <Button grouped color=\"secondary\" on:click={createNewLevel}>", ctx });
return block;
}
// (54:0) <ButtonGroup>
function create_default_slot_1$9(ctx) {
var current;
var button = new Button({
props: {
grouped: true,
color: "secondary",
$$slots: { default: [create_default_slot_2$8] },
$$scope: { ctx }
},
$$inline: true
});
button.$on("click", ctx.createNewLevel);
const block = {
c: function create() {
button.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(button, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var button_changes = {};
if (changed.$$scope) button_changes.$$scope = { changed, ctx };
button.$set(button_changes);
},
i: function intro(local) {
if (current) return;
transition_in(button.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(button.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(button, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_1$9.name, type: "slot", source: "(54:0) <ButtonGroup>", ctx });
return block;
}
// (80:0) {:else}
function create_else_block$b(ctx) {
var t;
const block = {
c: function create() {
t = text("(no actions added)");
},
m: function mount(target, anchor) {
insert_dev(target, t, anchor);
},
p: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(t);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$b.name, type: "else", source: "(80:0) {:else}", ctx });
return block;
}
// (58:0) {#if $store.accessLevels}
function create_if_block_1$d(ctx) {
var table, thead, tr, th0, t1, th1, t3, th2, t4, tbody;
let each_value = ctx.$store.accessLevels.levels;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$l(get_each_context$l(ctx, each_value, i));
}
const block = {
c: function create() {
table = element("table");
thead = element("thead");
tr = element("tr");
th0 = element("th");
th0.textContent = "Name";
t1 = space();
th1 = element("th");
th1.textContent = "Permissions";
t3 = space();
th2 = element("th");
t4 = space();
tbody = element("tbody");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
add_location(th0, file$L, 61, 12, 1434);
add_location(th1, file$L, 62, 12, 1460);
add_location(th2, file$L, 63, 12, 1493);
add_location(tr, file$L, 60, 8, 1417);
add_location(thead, file$L, 59, 4, 1401);
add_location(tbody, file$L, 66, 4, 1534);
attr_dev(table, "class", "fields-table uk-table uk-table-small");
add_location(table, file$L, 58, 0, 1344);
},
m: function mount(target, anchor) {
insert_dev(target, table, anchor);
append_dev(table, thead);
append_dev(thead, tr);
append_dev(tr, th0);
append_dev(tr, t1);
append_dev(tr, th1);
append_dev(tr, t3);
append_dev(tr, th2);
append_dev(table, t4);
append_dev(table, tbody);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(tbody, null);
}
},
p: function update(changed, ctx) {
if (changed.getIcon || changed.getPermissionsString || changed.$store) {
each_value = ctx.$store.accessLevels.levels;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$l(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(changed, child_ctx);
} else {
each_blocks[i] = create_each_block$l(child_ctx);
each_blocks[i].c();
each_blocks[i].m(tbody, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(table);
}
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$d.name, type: "if", source: "(58:0) {#if $store.accessLevels}", ctx });
return block;
}
// (68:8) {#each $store.accessLevels.levels as level}
function create_each_block$l(ctx) {
var tr, td0, t0_value = ctx.level.name + "", t0, t1, td1, t2_value = ctx.getPermissionsString(ctx.level.permissions) + "", t2, t3, td2, span0, raw0_value = getIcon("edit") + "", t4, span1, raw1_value = getIcon("trash") + "", t5, dispose;
function click_handler() {
return ctx.click_handler(ctx);
}
function click_handler_1() {
return ctx.click_handler_1(ctx);
}
const block = {
c: function create() {
tr = element("tr");
td0 = element("td");
t0 = text(t0_value);
t1 = space();
td1 = element("td");
t2 = text(t2_value);
t3 = space();
td2 = element("td");
span0 = element("span");
t4 = space();
span1 = element("span");
t5 = space();
add_location(td0, file$L, 69, 12, 1619);
add_location(td1, file$L, 70, 12, 1654);
add_location(span0, file$L, 72, 16, 1759);
add_location(span1, file$L, 73, 16, 1848);
attr_dev(td2, "class", "edit-button");
add_location(td2, file$L, 71, 12, 1718);
add_location(tr, file$L, 68, 8, 1602);
dispose = [
listen_dev(span0, "click", click_handler),
listen_dev(span1, "click", click_handler_1)
];
},
m: function mount(target, anchor) {
insert_dev(target, tr, anchor);
append_dev(tr, td0);
append_dev(td0, t0);
append_dev(tr, t1);
append_dev(tr, td1);
append_dev(td1, t2);
append_dev(tr, t3);
append_dev(tr, td2);
append_dev(td2, span0);
span0.innerHTML = raw0_value;
append_dev(td2, t4);
append_dev(td2, span1);
span1.innerHTML = raw1_value;
append_dev(tr, t5);
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
if ((changed.$store) && t0_value !== (t0_value = ctx.level.name + "")) {
set_data_dev(t0, t0_value);
}
if ((changed.$store) && t2_value !== (t2_value = ctx.getPermissionsString(ctx.level.permissions) + "")) {
set_data_dev(t2, t2_value);
}
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(tr);
}
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$l.name, type: "each", source: "(68:8) {#each $store.accessLevels.levels as level}", ctx });
return block;
}
// (86:4) {#if isEditing}
function create_if_block$n(ctx) {
var current;
var accesslevelview = new AccessLevelView({
props: {
level: ctx.editingLevel,
allPermissions: ctx.allPermissions,
onFinished: ctx.onEditingFinished,
isNew: ctx.editingLevelIsNew,
allLevels: ctx.$store.accessLevels.levels,
hierarchy: ctx.$store.hierarchy,
actions: ctx.$store.actions
},
$$inline: true
});
const block = {
c: function create() {
accesslevelview.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(accesslevelview, target, anchor);
current = true;
},
p: function update(changed, ctx) {
var accesslevelview_changes = {};
if (changed.editingLevel) accesslevelview_changes.level = ctx.editingLevel;
if (changed.allPermissions) accesslevelview_changes.allPermissions = ctx.allPermissions;
if (changed.editingLevelIsNew) accesslevelview_changes.isNew = ctx.editingLevelIsNew;
if (changed.$store) accesslevelview_changes.allLevels = ctx.$store.accessLevels.levels;
if (changed.$store) accesslevelview_changes.hierarchy = ctx.$store.hierarchy;
if (changed.$store) accesslevelview_changes.actions = ctx.$store.actions;
accesslevelview.$set(accesslevelview_changes);
},
i: function intro(local) {
if (current) return;
transition_in(accesslevelview.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(accesslevelview.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(accesslevelview, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$n.name, type: "if", source: "(86:4) {#if isEditing}", ctx });
return block;
}
// (85:0) <Modal bind:isOpen={isEditing}>
function create_default_slot$e(ctx) {
var if_block_anchor, current;
var if_block = (ctx.isEditing) && create_if_block$n(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
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(changed, ctx) {
if (ctx.isEditing) {
if (if_block) {
if_block.p(changed, ctx);
transition_in(if_block, 1);
} else {
if_block = create_if_block$n(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$e.name, type: "slot", source: "(85:0) <Modal bind:isOpen={isEditing}>", ctx });
return block;
}
function create_fragment$K(ctx) {
var div, t0, t1, updating_isOpen, current;
var buttongroup = new ButtonGroup({
props: {
$$slots: { default: [create_default_slot_1$9] },
$$scope: { ctx }
},
$$inline: true
});
function select_block_type(changed, ctx) {
if (ctx.$store.accessLevels) return create_if_block_1$d;
return create_else_block$b;
}
var current_block_type = select_block_type(null, ctx);
var if_block = current_block_type(ctx);
function modal_isOpen_binding(value) {
ctx.modal_isOpen_binding.call(null, value);
updating_isOpen = true;
add_flush_callback(() => updating_isOpen = false);
}
let modal_props = {
$$slots: { default: [create_default_slot$e] },
$$scope: { ctx }
};
if (ctx.isEditing !== void 0) {
modal_props.isOpen = ctx.isEditing;
}
var modal = new Modal({ props: modal_props, $$inline: true });
binding_callbacks.push(() => bind(modal, 'isOpen', modal_isOpen_binding));
const block = {
c: function create() {
div = element("div");
buttongroup.$$.fragment.c();
t0 = space();
if_block.c();
t1 = space();
modal.$$.fragment.c();
attr_dev(div, "class", "root svelte-nd1yft");
add_location(div, file$L, 51, 0, 1171);
},
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);
mount_component(buttongroup, div, null);
append_dev(div, t0);
if_block.m(div, null);
append_dev(div, t1);
mount_component(modal, div, null);
current = true;
},
p: function update(changed, ctx) {
var buttongroup_changes = {};
if (changed.$$scope) buttongroup_changes.$$scope = { changed, ctx };
buttongroup.$set(buttongroup_changes);
if (current_block_type === (current_block_type = select_block_type(changed, ctx)) && if_block) {
if_block.p(changed, ctx);
} else {
if_block.d(1);
if_block = current_block_type(ctx);
if (if_block) {
if_block.c();
if_block.m(div, t1);
}
}
var modal_changes = {};
if (changed.$$scope || changed.isEditing || changed.editingLevel || changed.allPermissions || changed.editingLevelIsNew || changed.$store) modal_changes.$$scope = { changed, ctx };
if (!updating_isOpen && changed.isEditing) {
modal_changes.isOpen = ctx.isEditing;
}
modal.$set(modal_changes);
},
i: function intro(local) {
if (current) return;
transition_in(buttongroup.$$.fragment, local);
transition_in(modal.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(buttongroup.$$.fragment, local);
transition_out(modal.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(buttongroup);
if_block.d();
destroy_component(modal);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$K.name, type: "component", source: "", ctx });
return block;
}
function instance$K($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let editingLevel = null;
let editingLevelIsNew = false;
let allPermissions = [];
store.subscribe(db => {
$$invalidate('allPermissions', allPermissions = generateFullPermissions$1(db.hierarchy, db.actions));
});
let onLevelEdit = (level) => {
$$invalidate('editingLevel', editingLevel = level);
$$invalidate('editingLevelIsNew', editingLevelIsNew = false);
};
let onLevelCancel = () => {
editingAction = null;
};
let onLevelDelete = (level) => {
store.deleteLevel(level);
};
let createNewLevel = () => {
$$invalidate('editingLevelIsNew', editingLevelIsNew = true);
$$invalidate('editingLevel', editingLevel = getNewAccessLevel$1());
};
let onEditingFinished = (level) => {
if(level) {
store.saveLevel(level, editingLevelIsNew, editingLevel);
}
$$invalidate('editingLevel', editingLevel = null);
};
const getPermissionsString = perms => {
return `${perms.length} / ${allPermissions.length}`;
};
const click_handler = ({ level }) => onLevelEdit(level);
const click_handler_1 = ({ level }) => onLevelDelete(level);
function modal_isOpen_binding(value) {
isEditing = value;
$$invalidate('isEditing', isEditing), $$invalidate('editingLevel', editingLevel);
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('editingLevel' in $$props) $$invalidate('editingLevel', editingLevel = $$props.editingLevel);
if ('editingLevelIsNew' in $$props) $$invalidate('editingLevelIsNew', editingLevelIsNew = $$props.editingLevelIsNew);
if ('allPermissions' in $$props) $$invalidate('allPermissions', allPermissions = $$props.allPermissions);
if ('onLevelEdit' in $$props) $$invalidate('onLevelEdit', onLevelEdit = $$props.onLevelEdit);
if ('onLevelCancel' in $$props) onLevelCancel = $$props.onLevelCancel;
if ('onLevelDelete' in $$props) $$invalidate('onLevelDelete', onLevelDelete = $$props.onLevelDelete);
if ('createNewLevel' in $$props) $$invalidate('createNewLevel', createNewLevel = $$props.createNewLevel);
if ('onEditingFinished' in $$props) $$invalidate('onEditingFinished', onEditingFinished = $$props.onEditingFinished);
if ('isEditing' in $$props) $$invalidate('isEditing', isEditing = $$props.isEditing);
if ('$store' in $$props) store.set($store);
};
let isEditing;
$$self.$$.update = ($$dirty = { editingLevel: 1 }) => {
if ($$dirty.editingLevel) { $$invalidate('isEditing', isEditing = (editingLevel !== null)); }
};
return {
editingLevel,
editingLevelIsNew,
allPermissions,
onLevelEdit,
onLevelDelete,
createNewLevel,
onEditingFinished,
getPermissionsString,
isEditing,
$store,
click_handler,
click_handler_1,
modal_isOpen_binding
};
}
class AccessLevelsRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$K, create_fragment$K, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "AccessLevelsRoot", options, id: create_fragment$K.name });
}
}
/* src\BackendRoot.svelte generated by Svelte v3.12.1 */
const file$M = "src\\BackendRoot.svelte";
// (27:51)
function create_if_block_2$8(ctx) {
var current;
var accesslevels = new AccessLevelsRoot({ $$inline: true });
const block = {
c: function create() {
accesslevels.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(accesslevels, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(accesslevels.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(accesslevels.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(accesslevels, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_2$8.name, type: "if", source: "(27:51) ", ctx });
return block;
}
// (25:45)
function create_if_block_1$e(ctx) {
var current;
var actionsandtriggers = new ActionsAndTriggersRoot({ $$inline: true });
const block = {
c: function create() {
actionsandtriggers.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(actionsandtriggers, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(actionsandtriggers.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(actionsandtriggers.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(actionsandtriggers, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$e.name, type: "if", source: "(25:45) ", ctx });
return block;
}
// (23:4) {#if $store.activeNav === "database"}
function create_if_block$o(ctx) {
var current;
var database = new DatabaseRoot({ $$inline: true });
const block = {
c: function create() {
database.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(database, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(database.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(database.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(database, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$o.name, type: "if", source: "(23:4) {#if $store.activeNav === \"database\"}", ctx });
return block;
}
function create_fragment$L(ctx) {
var div2, div0, t, div1, current_block_type_index, if_block, current;
var backendnav = new BackendNav({ $$inline: true });
var if_block_creators = [
create_if_block$o,
create_if_block_1$e,
create_if_block_2$8
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.$store.activeNav === "database") return 0;
if (ctx.$store.activeNav === "actions") return 1;
if (ctx.$store.activeNav === "access levels") return 2;
return -1;
}
if (~(current_block_type_index = select_block_type(null, ctx))) {
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
}
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
backendnav.$$.fragment.c();
t = space();
div1 = element("div");
if (if_block) if_block.c();
attr_dev(div0, "class", "nav svelte-q8uz1n");
add_location(div0, file$M, 17, 2, 498);
attr_dev(div1, "class", "content svelte-q8uz1n");
set_style(div1, "width", "calc(100% - " + ctx.navWidth + ")");
set_style(div1, "left", ctx.navWidth);
add_location(div1, file$M, 20, 2, 546);
attr_dev(div2, "class", "root svelte-q8uz1n");
add_location(div2, file$M, 16, 0, 477);
},
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);
mount_component(backendnav, div0, null);
append_dev(div2, t);
append_dev(div2, div1);
if (~current_block_type_index) if_blocks[current_block_type_index].m(div1, null);
current = true;
},
p: function update(changed, ctx) {
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
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();
}
transition_in(if_block, 1);
if_block.m(div1, null);
} else {
if_block = null;
}
}
if (!current || changed.navWidth) {
set_style(div1, "width", "calc(100% - " + ctx.navWidth + ")");
set_style(div1, "left", ctx.navWidth);
}
},
i: function intro(local) {
if (current) return;
transition_in(backendnav.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(backendnav.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(backendnav);
if (~current_block_type_index) if_blocks[current_block_type_index].d();
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$L.name, type: "component", source: "", ctx });
return block;
}
function instance$L($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let { navWidth = "50px" } = $$props;
const writable_props = ['navWidth'];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(`<BackendRoot> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {
if ('navWidth' in $$props) $$invalidate('navWidth', navWidth = $$props.navWidth);
};
$$self.$capture_state = () => {
return { navWidth, $store };
};
$$self.$inject_state = $$props => {
if ('navWidth' in $$props) $$invalidate('navWidth', navWidth = $$props.navWidth);
if ('$store' in $$props) store.set($store);
};
return { navWidth, $store };
}
class BackendRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$L, create_fragment$L, safe_not_equal, ["navWidth"]);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "BackendRoot", options, id: create_fragment$L.name });
}
get navWidth() {
throw new Error("<BackendRoot>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set navWidth(value) {
throw new Error("<BackendRoot>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
/* src\PackageRoot.svelte generated by Svelte v3.12.1 */
const file$N = "src\\PackageRoot.svelte";
// (34:8) {:else}
function create_else_block$c(ctx) {
var div, div_intro, div_outro, current;
var userinterfaceroot = new UserInterfaceRoot({ $$inline: true });
const block = {
c: function create() {
div = element("div");
userinterfaceroot.$$.fragment.c();
attr_dev(div, "class", "svelte-y7jhgd");
add_location(div, file$N, 34, 8, 945);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(userinterfaceroot, div, null);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(userinterfaceroot.$$.fragment, local);
add_render_callback(() => {
if (div_outro) div_outro.end(1);
if (!div_intro) div_intro = create_in_transition(div, fade, {});
div_intro.start();
});
current = true;
},
o: function outro(local) {
transition_out(userinterfaceroot.$$.fragment, local);
if (div_intro) div_intro.invalidate();
div_outro = create_out_transition(div, fade, {});
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(userinterfaceroot);
if (detaching) {
if (div_outro) div_outro.end();
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$c.name, type: "else", source: "(34:8) {:else}", ctx });
return block;
}
// (30:8) {#if $store.isBackend}
function create_if_block$p(ctx) {
var div, div_intro, div_outro, current;
var backendroot = new BackendRoot({ $$inline: true });
const block = {
c: function create() {
div = element("div");
backendroot.$$.fragment.c();
attr_dev(div, "class", "svelte-y7jhgd");
add_location(div, file$N, 30, 8, 855);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
mount_component(backendroot, div, null);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(backendroot.$$.fragment, local);
add_render_callback(() => {
if (div_outro) div_outro.end(1);
if (!div_intro) div_intro = create_in_transition(div, fade, {});
div_intro.start();
});
current = true;
},
o: function outro(local) {
transition_out(backendroot.$$.fragment, local);
if (div_intro) div_intro.invalidate();
div_outro = create_out_transition(div, fade, {});
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div);
}
destroy_component(backendroot);
if (detaching) {
if (div_outro) div_outro.end();
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$p.name, type: "if", source: "(30:8) {#if $store.isBackend}", ctx });
return block;
}
function create_fragment$M(ctx) {
var div2, div0, t0, span0, t2, span1, t4, div1, current_block_type_index, if_block, current, dispose;
var iconbutton = new IconButton({
props: {
icon: "home",
color: "var(--slate)",
hoverColor: "var(--secondary75)"
},
$$inline: true
});
var if_block_creators = [
create_if_block$p,
create_else_block$c
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.$store.isBackend) return 0;
return 1;
}
current_block_type_index = select_block_type(null, ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
const block = {
c: function create() {
div2 = element("div");
div0 = element("div");
iconbutton.$$.fragment.c();
t0 = space();
span0 = element("span");
span0.textContent = "Backend";
t2 = space();
span1 = element("span");
span1.textContent = "Frontend";
t4 = space();
div1 = element("div");
if_block.c();
attr_dev(span0, "class", "topnavitem svelte-y7jhgd");
toggle_class(span0, "active", ctx.$store.isBackend);
add_location(span0, file$N, 16, 8, 461);
attr_dev(span1, "class", "topnavitem svelte-y7jhgd");
toggle_class(span1, "active", !ctx.$store.isBackend);
add_location(span1, file$N, 21, 8, 622);
attr_dev(div0, "class", "top-nav svelte-y7jhgd");
add_location(div0, file$N, 12, 4, 303);
attr_dev(div1, "class", "content svelte-y7jhgd");
add_location(div1, file$N, 28, 4, 794);
attr_dev(div2, "class", "root svelte-y7jhgd");
add_location(div2, file$N, 10, 0, 279);
dispose = [
listen_dev(span0, "click", store.showBackend),
listen_dev(span1, "click", store.showFrontend)
];
},
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);
mount_component(iconbutton, div0, null);
append_dev(div0, t0);
append_dev(div0, span0);
append_dev(div0, t2);
append_dev(div0, span1);
append_dev(div2, t4);
append_dev(div2, div1);
if_blocks[current_block_type_index].m(div1, null);
current = true;
},
p: function update(changed, ctx) {
if (changed.$store) {
toggle_class(span0, "active", ctx.$store.isBackend);
toggle_class(span1, "active", !ctx.$store.isBackend);
}
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
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();
}
transition_in(if_block, 1);
if_block.m(div1, null);
}
},
i: function intro(local) {
if (current) return;
transition_in(iconbutton.$$.fragment, local);
transition_in(if_block);
current = true;
},
o: function outro(local) {
transition_out(iconbutton.$$.fragment, local);
transition_out(if_block);
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(div2);
}
destroy_component(iconbutton);
if_blocks[current_block_type_index].d();
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$M.name, type: "component", source: "", ctx });
return block;
}
function instance$M($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('$store' in $$props) store.set($store);
};
return { $store };
}
class PackageRoot extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$M, create_fragment$M, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "PackageRoot", options, id: create_fragment$M.name });
}
}
/* src\App.svelte generated by Svelte v3.12.1 */
const file$O = "src\\App.svelte";
// (31:1) {:catch err}
function create_catch_block(ctx) {
var h1, t_value = ctx.err + "", t;
const block = {
c: function create() {
h1 = element("h1");
t = text(t_value);
set_style(h1, "color", "red");
add_location(h1, file$O, 31, 2, 490);
},
m: function mount(target, anchor) {
insert_dev(target, h1, anchor);
append_dev(h1, t);
},
p: noop,
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(h1);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_catch_block.name, type: "catch", source: "(31:1) {:catch err}", ctx });
return block;
}
// (20:1) {:then result}
function create_then_block(ctx) {
var current_block_type_index, if_block, if_block_anchor, current;
var if_block_creators = [
create_if_block$q,
create_else_block$d
];
var if_blocks = [];
function select_block_type(changed, ctx) {
if (ctx.$store.hasAppPackage) return 0;
return 1;
}
current_block_type_index = select_block_type(null, 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();
},
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(changed, ctx) {
var previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(changed, ctx);
if (current_block_type_index !== previous_block_index) {
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();
}
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_then_block.name, type: "then", source: "(20:1) {:then result}", ctx });
return block;
}
// (25:2) {:else}
function create_else_block$d(ctx) {
var current;
var nopackage = new NoPackage({ $$inline: true });
const block = {
c: function create() {
nopackage.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(nopackage, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(nopackage.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(nopackage.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(nopackage, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$d.name, type: "else", source: "(25:2) {:else}", ctx });
return block;
}
// (22:2) {#if $store.hasAppPackage}
function create_if_block$q(ctx) {
var current;
var packageroot = new PackageRoot({ $$inline: true });
const block = {
c: function create() {
packageroot.$$.fragment.c();
},
m: function mount(target, anchor) {
mount_component(packageroot, target, anchor);
current = true;
},
i: function intro(local) {
if (current) return;
transition_in(packageroot.$$.fragment, local);
current = true;
},
o: function outro(local) {
transition_out(packageroot.$$.fragment, local);
current = false;
},
d: function destroy(detaching) {
destroy_component(packageroot, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$q.name, type: "if", source: "(22:2) {#if $store.hasAppPackage}", ctx });
return block;
}
// (16:14) <h1>loading</h1> {:then result}
function create_pending_block(ctx) {
var h1;
const block = {
c: function create() {
h1 = element("h1");
h1.textContent = "loading";
add_location(h1, file$O, 17, 2, 354);
},
m: function mount(target, anchor) {
insert_dev(target, h1, anchor);
},
p: noop,
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) {
detach_dev(h1);
}
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_pending_block.name, type: "pending", source: "(16:14) <h1>loading</h1> {:then result}", ctx });
return block;
}
function create_fragment$N(ctx) {
var main, promise, current;
let info = {
ctx,
current: null,
token: null,
pending: create_pending_block,
then: create_then_block,
catch: create_catch_block,
value: 'result',
error: 'err',
blocks: [,,,]
};
handle_promise(promise = ctx.init, info);
const block = {
c: function create() {
main = element("main");
info.block.c();
attr_dev(main, "class", "svelte-15fmzor");
add_location(main, file$O, 13, 0, 327);
},
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, main, anchor);
info.block.m(main, info.anchor = null);
info.mount = () => main;
info.anchor = null;
current = true;
},
p: function update(changed, new_ctx) {
ctx = new_ctx;
info.block.p(changed, assign(assign({}, ctx), info.resolved));
},
i: function intro(local) {
if (current) return;
transition_in(info.block);
current = true;
},
o: function outro(local) {
for (let i = 0; i < 3; i += 1) {
const block = info.blocks[i];
transition_out(block);
}
current = false;
},
d: function destroy(detaching) {
if (detaching) {
detach_dev(main);
}
info.block.d();
info.token = null;
info = null;
}
};
dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$N.name, type: "component", source: "", ctx });
return block;
}
function instance$N($$self, $$props, $$invalidate) {
let $store;
validate_store(store, 'store');
component_subscribe($$self, store, $$value => { $store = $$value; $$invalidate('$store', $store); });
let init = initialise$1();
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ('init' in $$props) $$invalidate('init', init = $$props.init);
if ('$store' in $$props) store.set($store);
};
return { init, $store };
}
class App extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance$N, create_fragment$N, safe_not_equal, []);
dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "App", options, id: create_fragment$N.name });
}
}
var uikit_min = createCommonjsModule(function (module, exports) {
/*! UIkit 3.2.0 | http://www.getuikit.com | (c) 2014 - 2019 YOOtheme | MIT License */
!function(t,e){module.exports=e();}(commonjsGlobal,function(){var e=Object.prototype,n=e.hasOwnProperty;function c(t,e){return n.call(t,e)}var i={},r=/([a-z\d])([A-Z])/g;function d(t){return t in i||(i[t]=t.replace(r,"$1-$2").toLowerCase()),i[t]}var o=/-(\w)/g;function f(t){return t.replace(o,s)}function s(t,e){return e?e.toUpperCase():""}function p(t){return t.length?s(0,t.charAt(0))+t.slice(1):""}var t=String.prototype,a=t.startsWith||function(t){return 0===this.lastIndexOf(t,0)};function w(t,e){return a.call(t,e)}var h=t.endsWith||function(t){return this.substr(-t.length)===t};function u(t,e){return h.call(t,e)}function l(t,e){return ~this.indexOf(t,e)}var m=Array.prototype,g=t.includes||l,v=m.includes||l;function b(t,e){return t&&(O(t)?g:v).call(t,e)}var y=m.findIndex||function(t){for(var e=arguments,n=0;n<this.length;n++)if(t.call(e[1],this[n],n,this))return n;return -1};function x(t,e){return y.call(t,e)}var k=Array.isArray;function $(t){return "function"==typeof t}function I(t){return null!==t&&"object"==typeof t}function S(t){return I(t)&&Object.getPrototypeOf(t)===e}function T(t){return I(t)&&t===t.window}function E(t){return I(t)&&9===t.nodeType}function C(t){return I(t)&&!!t.jquery}function A(t){return t instanceof Node||I(t)&&1<=t.nodeType}var _=e.toString;function N(t){return _.call(t).match(/^\[object (NodeList|HTMLCollection)\]$/)}function M(t){return "boolean"==typeof t}function O(t){return "string"==typeof t}function D(t){return "number"==typeof t}function z(t){return D(t)||O(t)&&!isNaN(t-parseFloat(t))}function B(t){return !(k(t)?t.length:I(t)&&Object.keys(t).length)}function P(t){return void 0===t}function H(t){return M(t)?t:"true"===t||"1"===t||""===t||"false"!==t&&"0"!==t&&t}function L(t){var e=Number(t);return !isNaN(e)&&e}function F(t){return parseFloat(t)||0}function j(t){return A(t)||T(t)||E(t)?t:N(t)||C(t)?t[0]:k(t)?j(t[0]):null}function W(t){return A(t)?[t]:N(t)?m.slice.call(t):k(t)?t.map(j).filter(Boolean):C(t)?t.toArray():[]}function V(t){return k(t)?t:O(t)?t.split(/,(?![^(]*\))/).map(function(t){return z(t)?L(t):H(t.trim())}):[t]}function R(t){return t?u(t,"ms")?F(t):1e3*F(t):0}function Y(t,n){return t===n||I(t)&&I(n)&&Object.keys(t).length===Object.keys(n).length&&K(t,function(t,e){return t===n[e]})}function q(t,e,n){return t.replace(new RegExp(e+"|"+n,"mg"),function(t){return t===e?n:e})}var U=Object.assign||function(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];t=Object(t);for(var i=0;i<e.length;i++){var r=e[i];if(null!==r)for(var o in r)c(r,o)&&(t[o]=r[o]);}return t};function X(t){return t[t.length-1]}function K(t,e){for(var n in t)if(!1===e(t[n],n))return !1;return !0}function G(t,r){return t.sort(function(t,e){var n=t[r];void 0===n&&(n=0);var i=e[r];return void 0===i&&(i=0),i<n?1:n<i?-1:0})}function J(t,n){var i=new Set;return t.filter(function(t){var e=t[n];return !i.has(e)&&(i.add(e)||!0)})}function Z(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),Math.min(Math.max(L(t)||0,e),n)}function Q(){}function tt(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function et(t,e){return t.x<=e.right&&t.x>=e.left&&t.y<=e.bottom&&t.y>=e.top}var nt={ratio:function(t,e,n){var i,r="width"===e?"height":"width";return (i={})[r]=t[e]?Math.round(n*t[r]/t[e]):t[r],i[e]=n,i},contain:function(n,i){var r=this;return K(n=U({},n),function(t,e){return n=n[e]>i[e]?r.ratio(n,e,i[e]):n}),n},cover:function(n,i){var r=this;return K(n=this.contain(n,i),function(t,e){return n=n[e]<i[e]?r.ratio(n,e,i[e]):n}),n}};function it(t,e,n){if(I(e))for(var i in e)it(t,i,e[i]);else{if(P(n))return (t=j(t))&&t.getAttribute(e);W(t).forEach(function(t){$(n)&&(n=n.call(t,it(t,e))),null===n?ot(t,e):t.setAttribute(e,n);});}}function rt(t,e){return W(t).some(function(t){return t.hasAttribute(e)})}function ot(t,e){t=W(t),e.split(" ").forEach(function(e){return t.forEach(function(t){return t.hasAttribute(e)&&t.removeAttribute(e)})});}function st(t,e){for(var n=0,i=[e,"data-"+e];n<i.length;n++)if(rt(t,i[n]))return it(t,i[n])}var at=/msie|trident/i.test(window.navigator.userAgent),ht="rtl"===it(document.documentElement,"dir"),ct="ontouchstart"in window,ut=window.PointerEvent,lt=ct||window.DocumentTouch&&document instanceof DocumentTouch||navigator.maxTouchPoints,dt=ut?"pointerdown":ct?"touchstart":"mousedown",ft=ut?"pointermove":ct?"touchmove":"mousemove",pt=ut?"pointerup":ct?"touchend":"mouseup",mt=ut?"pointerenter":ct?"":"mouseenter",gt=ut?"pointerleave":ct?"":"mouseleave",vt=ut?"pointercancel":"touchcancel";function wt(t,e){return j(t)||xt(t,yt(t,e))}function bt(t,e){var n=W(t);return n.length&&n||kt(t,yt(t,e))}function yt(t,e){return void 0===e&&(e=document),Tt(t)||E(e)?e:e.ownerDocument}function xt(t,e){return j($t(t,e,"querySelector"))}function kt(t,e){return W($t(t,e,"querySelectorAll"))}function $t(t,s,e){if(void 0===s&&(s=document),!t||!O(t))return null;var a;Tt(t=t.replace(St,"$1 *"))&&(a=[],t=function(t){return t.match(Et).map(function(t){return t.replace(/,$/,"").trim()})}(t).map(function(t,e){var n=s;if("!"===t[0]){var i=t.substr(1).trim().split(" ");n=Mt(s.parentNode,i[0]),t=i.slice(1).join(" ").trim();}if("-"===t[0]){var r=t.substr(1).trim().split(" "),o=(n||s).previousElementSibling;n=_t(o,t.substr(1))?o:null,t=r.slice(1).join(" ");}return n?(n.id||(n.id="uk-"+Date.now()+e,a.push(function(){return ot(n,"id")})),"#"+zt(n.id)+" "+t):null}).filter(Boolean).join(","),s=document);try{return s[e](t)}catch(t){return null}finally{a&&a.forEach(function(t){return t()});}}var It=/(^|[^\\],)\s*[!>+~-]/,St=/([!>+~-])(?=\s+[!>+~-]|\s*$)/g;function Tt(t){return O(t)&&t.match(It)}var Et=/.*?[^\\](?:,|$)/g;var Ct=Element.prototype,At=Ct.matches||Ct.webkitMatchesSelector||Ct.msMatchesSelector;function _t(t,e){return W(t).some(function(t){return At.call(t,e)})}var Nt=Ct.closest||function(t){var e=this;do{if(_t(e,t))return e;e=e.parentNode;}while(e&&1===e.nodeType)};function Mt(t,e){return w(e,">")&&(e=e.slice(1)),A(t)?Nt.call(t,e):W(t).map(function(t){return Mt(t,e)}).filter(Boolean)}function Ot(t,e){var n=[];for(t=j(t);(t=t.parentNode)&&1===t.nodeType;)_t(t,e)&&n.push(t);return n}var Dt=window.CSS&&CSS.escape||function(t){return t.replace(/([^\x7f-\uFFFF\w-])/g,function(t){return "\\"+t})};function zt(t){return O(t)?Dt.call(null,t):""}var Bt={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function Pt(t){return W(t).some(function(t){return Bt[t.tagName.toLowerCase()]})}function Ht(t){return W(t).some(function(t){return t.offsetWidth||t.offsetHeight||t.getClientRects().length})}var Lt="input,select,textarea,button";function Ft(t){return W(t).some(function(t){return _t(t,Lt)})}function jt(t,e){return W(t).filter(function(t){return _t(t,e)})}function Wt(t,e){return O(e)?_t(t,e)||Mt(t,e):t===e||(E(e)?e.documentElement:j(e)).contains(j(t))}function Vt(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Xt(t),i=n[0],r=n[1],o=n[2],s=n[3],a=n[4];return i=Zt(i),1<s.length&&(s=function(e){return function(t){return k(t.detail)?e.apply(void 0,[t].concat(t.detail)):e(t)}}(s)),o&&(s=function(t,i,r){var o=this;return function(n){t.forEach(function(t){var e=">"===i[0]?kt(i,t).reverse().filter(function(t){return Wt(n.target,t)})[0]:Mt(n.target,i);e&&(n.delegate=t,n.current=e,r.call(o,n));});}}(i,o,s)),a&&a.self&&(s=function(e){return function(t){if(t.target===t.currentTarget||t.target===t.current)return e.call(null,t)}}(s)),a=Kt(a),r.split(" ").forEach(function(e){return i.forEach(function(t){return t.addEventListener(e,s,a)})}),function(){return Rt(i,r,s,a)}}function Rt(t,e,n,i){void 0===i&&(i=!1),i=Kt(i),t=Zt(t),e.split(" ").forEach(function(e){return t.forEach(function(t){return t.removeEventListener(e,n,i)})});}function Yt(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=Xt(t),i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],h=n[5],c=Vt(i,r,o,function(t){var e=!h||h(t);e&&(c(),s(t,e));},a);return c}function qt(t,n,i){return Zt(t).reduce(function(t,e){return t&&e.dispatchEvent(Ut(n,!0,!0,i))},!0)}function Ut(t,e,n,i){if(void 0===e&&(e=!0),void 0===n&&(n=!1),O(t)){var r=document.createEvent("CustomEvent");r.initCustomEvent(t,e,n,i),t=r;}return t}function Xt(t){return $(t[2])&&t.splice(2,0,!1),t}function Kt(t){return t&&at&&!M(t)?!!t.capture:t}function Gt(t){return t&&"addEventListener"in t}function Jt(t){return Gt(t)?t:j(t)}function Zt(t){return k(t)?t.map(Jt).filter(Boolean):O(t)?kt(t):Gt(t)?[t]:W(t)}function Qt(t){return "touch"===t.pointerType||!!t.touches}function te(t,e){void 0===e&&(e="client");var n=t.touches,i=t.changedTouches,r=n&&n[0]||i&&i[0]||t;return {x:r[e+"X"],y:r[e+"Y"]}}function ee(){var n=this;this.promise=new ne(function(t,e){n.reject=e,n.resolve=t;});}var ne="Promise"in window?window.Promise:oe,ie=2,re="setImmediate"in window?setImmediate:setTimeout;function oe(t){this.state=ie,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t);},function(t){e.reject(t);});}catch(t){e.reject(t);}}oe.reject=function(n){return new oe(function(t,e){e(n);})},oe.resolve=function(n){return new oe(function(t,e){t(n);})},oe.all=function(s){return new oe(function(n,t){var i=[],r=0;function e(e){return function(t){i[e]=t,(r+=1)===s.length&&n(i);}}0===s.length&&n(i);for(var o=0;o<s.length;o+=1)oe.resolve(s[o]).then(e(o),t);})},oe.race=function(i){return new oe(function(t,e){for(var n=0;n<i.length;n+=1)oe.resolve(i[n]).then(t,e);})};var se=oe.prototype;function ae(s,a){return new ne(function(t,e){var n=U({data:null,method:"GET",headers:{},xhr:new XMLHttpRequest,beforeSend:Q,responseType:""},a);n.beforeSend(n);var i=n.xhr;for(var r in n)if(r in i)try{i[r]=n[r];}catch(t){}for(var o in i.open(n.method.toUpperCase(),s),n.headers)i.setRequestHeader(o,n.headers[o]);Vt(i,"load",function(){0===i.status||200<=i.status&&i.status<300||304===i.status?t(i):e(U(Error(i.statusText),{xhr:i,status:i.status}));}),Vt(i,"error",function(){return e(U(Error("Network Error"),{xhr:i}))}),Vt(i,"timeout",function(){return e(U(Error("Network Timeout"),{xhr:i}))}),i.send(n.data);})}function he(i,r,o){return new ne(function(t,e){var n=new Image;n.onerror=e,n.onload=function(){return t(n)},o&&(n.sizes=o),r&&(n.srcset=r),n.src=i;})}function ce(t){if("loading"===document.readyState)var e=Vt(document,"DOMContentLoaded",function(){e(),t();});else t();}function ue(t,e){return e?W(t).indexOf(j(e)):W((t=j(t))&&t.parentNode.children).indexOf(t)}function le(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var r=(e=W(e)).length;return t=z(t)?L(t):"next"===t?n+1:"previous"===t?n-1:ue(e,t),i?Z(t,0,r-1):(t%=r)<0?t+r:t}function de(t){return (t=Te(t)).innerHTML="",t}function fe(t,e){return t=Te(t),P(e)?t.innerHTML:pe(t.hasChildNodes()?de(t):t,e)}function pe(e,t){return e=Te(e),ve(t,function(t){return e.appendChild(t)})}function me(e,t){return e=Te(e),ve(t,function(t){return e.parentNode.insertBefore(t,e)})}function ge(e,t){return e=Te(e),ve(t,function(t){return e.nextSibling?me(e.nextSibling,t):pe(e.parentNode,t)})}function ve(t,e){return (t=O(t)?Ie(t):t)?"length"in t?W(t).map(e):e(t):null}function we(t){W(t).map(function(t){return t.parentNode&&t.parentNode.removeChild(t)});}function be(t,e){for(e=j(me(t,e));e.firstChild;)e=e.firstChild;return pe(e,t),e}function ye(t,e){return W(W(t).map(function(t){return t.hasChildNodes?be(W(t.childNodes),e):pe(t,e)}))}function xe(t){W(t).map(function(t){return t.parentNode}).filter(function(t,e,n){return n.indexOf(t)===e}).forEach(function(t){me(t,t.childNodes),we(t);});}se.resolve=function(t){var e=this;if(e.state===ie){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var i=t&&t.then;if(null!==t&&I(t)&&$(i))return void i.call(t,function(t){n||e.resolve(t),n=!0;},function(t){n||e.reject(t),n=!0;})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify();}},se.reject=function(t){var e=this;if(e.state===ie){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify();}},se.notify=function(){var o=this;re(function(){if(o.state!==ie)for(;o.deferred.length;){var t=o.deferred.shift(),e=t[0],n=t[1],i=t[2],r=t[3];try{0===o.state?$(e)?i(e.call(void 0,o.value)):i(o.value):1===o.state&&($(n)?i(n.call(void 0,o.value)):r(o.value));}catch(t){r(t);}}});},se.then=function(n,i){var r=this;return new oe(function(t,e){r.deferred.push([n,i,t,e]),r.notify();})},se.catch=function(t){return this.then(void 0,t)};var ke=/^\s*<(\w+|!)[^>]*>/,$e=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;function Ie(t){var e=$e.exec(t);if(e)return document.createElement(e[1]);var n=document.createElement("div");return ke.test(t)?n.insertAdjacentHTML("beforeend",t.trim()):n.textContent=t,1<n.childNodes.length?W(n.childNodes):n.firstChild}function Se(t,e){if(t&&1===t.nodeType)for(e(t),t=t.firstElementChild;t;)Se(t,e),t=t.nextElementSibling;}function Te(t,e){return O(t)?Ce(t)?j(Ie(t)):xt(t,e):j(t)}function Ee(t,e){return O(t)?Ce(t)?W(Ie(t)):kt(t,e):W(t)}function Ce(t){return "<"===t[0]||t.match(/^\s*</)}function Ae(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];ze(t,e,"add");}function _e(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];ze(t,e,"remove");}function Ne(t,e){it(t,"class",function(t){return (t||"").replace(new RegExp("\\b"+e+"\\b","g"),"")});}function Me(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];e[0]&&_e(t,e[0]),e[1]&&Ae(t,e[1]);}function Oe(t,e){return e&&W(t).some(function(t){return t.classList.contains(e.split(" ")[0])})}function De(t){for(var i=[],e=arguments.length-1;0<e--;)i[e]=arguments[e+1];if(i.length){var r=O(X(i=Be(i)))?[]:i.pop();i=i.filter(Boolean),W(t).forEach(function(t){for(var e=t.classList,n=0;n<i.length;n++)Pe.Force?e.toggle.apply(e,[i[n]].concat(r)):e[(P(r)?!e.contains(i[n]):r)?"add":"remove"](i[n]);});}}function ze(t,n,i){(n=Be(n).filter(Boolean)).length&&W(t).forEach(function(t){var e=t.classList;Pe.Multiple?e[i].apply(e,n):n.forEach(function(t){return e[i](t)});});}function Be(t){return t.reduce(function(t,e){return t.concat.call(t,O(e)&&b(e," ")?e.trim().split(" "):e)},[])}var Pe={get Multiple(){return this.get("_multiple")},get Force(){return this.get("_force")},get:function(t){if(!c(this,t)){var e=document.createElement("_").classList;e.add("a","b"),e.toggle("c",!1),this._multiple=e.contains("b"),this._force=!e.contains("c");}return this[t]}},He={"animation-iteration-count":!0,"column-count":!0,"fill-opacity":!0,"flex-grow":!0,"flex-shrink":!0,"font-weight":!0,"line-height":!0,opacity:!0,order:!0,orphans:!0,"stroke-dasharray":!0,"stroke-dashoffset":!0,widows:!0,"z-index":!0,zoom:!0};function Le(t,e,r){return W(t).map(function(n){if(O(e)){if(e=Ye(e),P(r))return je(n,e);r||D(r)?n.style[e]=z(r)&&!He[e]?r+"px":r:n.style.removeProperty(e);}else{if(k(e)){var i=Fe(n);return e.reduce(function(t,e){return t[e]=i[Ye(e)],t},{})}I(e)&&K(e,function(t,e){return Le(n,e,t)});}return n})[0]}function Fe(t,e){return (t=j(t)).ownerDocument.defaultView.getComputedStyle(t,e)}function je(t,e,n){return Fe(t,n)[e]}var We={};function Ve(t){var e=document.documentElement;if(!at)return Fe(e).getPropertyValue("--uk-"+t);if(!(t in We)){var n=pe(e,document.createElement("div"));Ae(n,"uk-"+t),We[t]=je(n,"content",":before").replace(/^["'](.*)["']$/,"$1"),we(n);}return We[t]}var Re={};function Ye(t){var e=Re[t];return e=e||(Re[t]=function(t){t=d(t);var e=document.documentElement.style;if(t in e)return t;var n,i=qe.length;for(;i--;)if((n="-"+qe[i]+"-"+t)in e)return n}(t)||t)}var qe=["webkit","moz","ms"];function Ue(t,s,a,h){return void 0===a&&(a=400),void 0===h&&(h="linear"),ne.all(W(t).map(function(o){return new ne(function(n,i){for(var t in s){var e=Le(o,t);""===e&&Le(o,t,e);}var r=setTimeout(function(){return qt(o,"transitionend")},a);Yt(o,"transitionend transitioncanceled",function(t){var e=t.type;clearTimeout(r),_e(o,"uk-transition"),Le(o,{"transition-property":"","transition-duration":"","transition-timing-function":""}),"transitioncanceled"===e?i():n();},{self:!0}),Ae(o,"uk-transition"),Le(o,U({"transition-property":Object.keys(s).map(Ye).join(","),"transition-duration":a+"ms","transition-timing-function":h},s));})}))}var Xe={start:Ue,stop:function(t){return qt(t,"transitionend"),ne.resolve()},cancel:function(t){qt(t,"transitioncanceled");},inProgress:function(t){return Oe(t,"uk-transition")}},Ke="uk-animation-",Ge="uk-cancel-animation";function Je(t,e,n,a,h){var c=arguments;return void 0===n&&(n=200),ne.all(W(t).map(function(s){return new ne(function(i,r){if(Oe(s,Ge))requestAnimationFrame(function(){return ne.resolve().then(function(){return Je.apply(void 0,c).then(i,r)})});else{var t=e+" "+Ke+(h?"leave":"enter");w(e,Ke)&&(a&&(t+=" uk-transform-origin-"+a),h&&(t+=" "+Ke+"reverse")),o(),Yt(s,"animationend animationcancel",function(t){var e=t.type,n=!1;"animationcancel"===e?(r(),o()):(i(),ne.resolve().then(function(){n=!0,o();})),requestAnimationFrame(function(){n||(Ae(s,Ge),requestAnimationFrame(function(){return _e(s,Ge)}));});},{self:!0}),Le(s,"animationDuration",n+"ms"),Ae(s,t);}function o(){Le(s,"animationDuration",""),Ne(s,Ke+"\\S*");}})}))}var Ze=new RegExp(Ke+"(enter|leave)"),Qe={in:function(t,e,n,i){return Je(t,e,n,i,!1)},out:function(t,e,n,i){return Je(t,e,n,i,!0)},inProgress:function(t){return Ze.test(it(t,"class"))},cancel:function(t){qt(t,"animationcancel");}},tn={width:["x","left","right"],height:["y","top","bottom"]};function en(t,e,u,l,d,n,i,r){u=ln(u),l=ln(l);var f={element:u,target:l};if(!t||!e)return f;var p=rn(t),m=rn(e),g=m;if(un(g,u,p,-1),un(g,l,m,1),d=dn(d,p.width,p.height),n=dn(n,m.width,m.height),d.x+=n.x,d.y+=n.y,g.left+=d.x,g.top+=d.y,i){var o=[rn(yn(t))];r&&o.unshift(rn(r)),K(tn,function(t,s){var a=t[0],h=t[1],c=t[2];!0!==i&&!b(i,a)||o.some(function(i){var t=u[a]===h?-p[s]:u[a]===c?p[s]:0,e=l[a]===h?m[s]:l[a]===c?-m[s]:0;if(g[h]<i[h]||g[h]+p[s]>i[c]){var n=p[s]/2,r="center"===l[a]?-m[s]/2:0;return "center"===u[a]&&(o(n,r)||o(-n,-r))||o(t,e)}function o(e,t){var n=g[h]+e+t-2*d[a];if(n>=i[h]&&n+p[s]<=i[c])return g[h]=n,["element","target"].forEach(function(t){f[t][a]=e?f[t][a]===tn[s][1]?tn[s][2]:tn[s][1]:f[t][a];}),!0}});});}return nn(t,g),f}function nn(n,i){if(n=j(n),!i)return rn(n);var r=nn(n),o=Le(n,"position");["left","top"].forEach(function(t){if(t in i){var e=Le(n,t);Le(n,t,i[t]-r[t]+F("absolute"===o&&"auto"===e?on(n)[t]:e));}});}function rn(t){if(!(t=j(t)))return {};var e,n,i=yn(t),r=i.pageYOffset,o=i.pageXOffset;if(T(t)){var s=t.innerHeight,a=t.innerWidth;return {top:r,left:o,height:s,width:a,bottom:r+s,right:o+a}}Ht(t)||"none"!==Le(t,"display")||(e=it(t,"style"),n=it(t,"hidden"),it(t,{style:(e||"")+";display:block !important;",hidden:null}));var h=t.getBoundingClientRect();return P(e)||it(t,{style:e,hidden:n}),{height:h.height,width:h.width,top:h.top+r,left:h.left+o,bottom:h.bottom+r,right:h.right+o}}function on(i){var r=(i=j(i)).offsetParent||function(t){return xn(t).documentElement}(i),o=nn(r),t=["top","left"].reduce(function(t,e){var n=p(e);return t[e]-=o[e]+F(Le(i,"margin"+n))+F(Le(r,"border"+n+"Width")),t},nn(i));return {top:t.top,left:t.left}}var sn=hn("height"),an=hn("width");function hn(i){var r=p(i);return function(t,e){if(t=j(t),P(e)){if(T(t))return t["inner"+r];if(E(t)){var n=t.documentElement;return Math.max(n["offset"+r],n["scroll"+r])}return (e="auto"===(e=Le(t,i))?t["offset"+r]:F(e)||0)-cn(i,t)}Le(t,i,e||0===e?+e+cn(i,t)+"px":"");}}function cn(t,n,e){return void 0===e&&(e="border-box"),Le(n,"boxSizing")===e?tn[t].slice(1).map(p).reduce(function(t,e){return t+F(Le(n,"padding"+e))+F(Le(n,"border"+e+"Width"))},0):0}function un(o,s,a,h){K(tn,function(t,e){var n=t[0],i=t[1],r=t[2];s[n]===r?o[i]+=a[e]*h:"center"===s[n]&&(o[i]+=a[e]*h/2);});}function ln(t){var e=/left|center|right/,n=/top|center|bottom/;return 1===(t=(t||"").split(" ")).length&&(t=e.test(t[0])?t.concat(["center"]):n.test(t[0])?["center"].concat(t):["center","center"]),{x:e.test(t[0])?t[0]:"center",y:n.test(t[1])?t[1]:"center"}}function dn(t,e,n){var i=(t||"").split(" "),r=i[0],o=i[1];return {x:r?F(r)*(u(r,"%")?e/100:1):0,y:o?F(o)*(u(o,"%")?n/100:1):0}}function fn(t){switch(t){case"left":return "right";case"right":return "left";case"top":return "bottom";case"bottom":return "top";default:return t}}function pn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=0),!Ht(t))return !1;var i=yn(t=j(t)),r=t.getBoundingClientRect(),o={top:-e,left:-n,bottom:e+sn(i),right:n+an(i)};return tt(r,o)||et({x:r.left,y:r.top},o)}function mn(t,e){if(void 0===e&&(e=0),!Ht(t))return 0;var n=yn(t=j(t)),i=xn(t),r=t.offsetHeight+e,o=vn(t)[0],s=sn(n),a=s+Math.min(0,o-s),h=Math.max(0,s-(sn(i)+e-(o+r)));return Z((a+n.pageYOffset-o)/((a+(r-(h<s?h:0)))/100)/100)}function gn(t,e){if(T(t=j(t))||E(t)){var n=yn(t);(0, n.scrollTo)(n.pageXOffset,e);}else t.scrollTop=e;}function vn(t){var e=[0,0];do{if(e[0]+=t.offsetTop,e[1]+=t.offsetLeft,"fixed"===Le(t,"position")){var n=yn(t);return e[0]+=n.pageYOffset,e[1]+=n.pageXOffset,e}}while(t=t.offsetParent);return e}function wn(t,e,n){return void 0===e&&(e="width"),void 0===n&&(n=window),z(t)?+t:u(t,"vh")?bn(sn(yn(n)),t):u(t,"vw")?bn(an(yn(n)),t):u(t,"%")?bn(rn(n)[e],t):F(t)}function bn(t,e){return t*F(e)/100}function yn(t){return T(t)?t:xn(t).defaultView}function xn(t){return j(t).ownerDocument}var kn={reads:[],writes:[],read:function(t){return this.reads.push(t),In(),t},write:function(t){return this.writes.push(t),In(),t},clear:function(t){return Tn(this.reads,t)||Tn(this.writes,t)},flush:$n};function $n(){Sn(kn.reads),Sn(kn.writes.splice(0,kn.writes.length)),kn.scheduled=!1,(kn.reads.length||kn.writes.length)&&In(!0);}function In(t){void 0===t&&(t=!1),kn.scheduled||(kn.scheduled=!0,t?ne.resolve().then($n):requestAnimationFrame($n));}function Sn(t){for(var e;e=t.shift();)e();}function Tn(t,e){var n=t.indexOf(e);return !!~n&&!!t.splice(n,1)}function En(){}function Cn(t,e){return (e.y-t.y)/(e.x-t.x)}En.prototype={positions:[],position:null,init:function(){var i=this;this.positions=[],this.position=null;var r=!1;this.unbind=Vt(document,"mousemove",function(n){r||(setTimeout(function(){var t=Date.now(),e=i.positions.length;e&&100<t-i.positions[e-1].time&&i.positions.splice(0,e),i.positions.push({time:t,x:n.pageX,y:n.pageY}),5<i.positions.length&&i.positions.shift(),r=!1;},5),r=!0);});},cancel:function(){this.unbind&&this.unbind();},movesTo:function(t){if(this.positions.length<2)return !1;var e=nn(t),n=X(this.positions),i=this.positions[0];if(e.left<=n.x&&n.x<=e.right&&e.top<=n.y&&n.y<=e.bottom)return !1;var r=[[{x:e.left,y:e.top},{x:e.right,y:e.bottom}],[{x:e.right,y:e.top},{x:e.left,y:e.bottom}]];return e.right<=n.x||(e.left>=n.x?(r[0].reverse(),r[1].reverse()):e.bottom<=n.y?r[0].reverse():e.top>=n.y&&r[1].reverse()),!!r.reduce(function(t,e){return t+(Cn(i,e[0])<Cn(n,e[0])&&Cn(i,e[1])>Cn(n,e[1]))},0)}};var An={};function _n(t,e,n){return An.computed($(t)?t.call(n,n):t,$(e)?e.call(n,n):e)}function Nn(t,e){return t=t&&!k(t)?[t]:t,e?t?t.concat(e):k(e)?e:[e]:t}function Mn(e,n,i){var r={};if($(n)&&(n=n.options),n.extends&&(e=Mn(e,n.extends,i)),n.mixins)for(var t=0,o=n.mixins.length;t<o;t++)e=Mn(e,n.mixins[t],i);for(var s in e)h(s);for(var a in n)c(e,a)||h(a);function h(t){r[t]=(An[t]||function(t,e){return P(e)?t:e})(e[t],n[t],i);}return r}function On(t,e){var n;void 0===e&&(e=[]);try{return t?w(t,"{")?JSON.parse(t):e.length&&!b(t,":")?((n={})[e[0]]=t,n):t.split(";").reduce(function(t,e){var n=e.split(/:(.*)/),i=n[0],r=n[1];return i&&!P(r)&&(t[i.trim()]=r.trim()),t},{}):{}}catch(t){return {}}}An.events=An.created=An.beforeConnect=An.connected=An.beforeDisconnect=An.disconnected=An.destroy=Nn,An.args=function(t,e){return !1!==e&&Nn(e||t)},An.update=function(t,e){return G(Nn(t,$(e)?{read:e}:e),"order")},An.props=function(t,e){return k(e)&&(e=e.reduce(function(t,e){return t[e]=String,t},{})),An.methods(t,e)},An.computed=An.methods=function(t,e){return e?t?U({},t,e):e:t},An.data=function(e,n,t){return t?_n(e,n,t):n?e?function(t){return _n(e,n,t)}:n:e};function Dn(t){this.id=++zn,this.el=j(t);}var zn=0;function Bn(t,e){try{t.contentWindow.postMessage(JSON.stringify(U({event:"command"},e)),"*");}catch(t){}}Dn.prototype.isVideo=function(){return this.isYoutube()||this.isVimeo()||this.isHTML5()},Dn.prototype.isHTML5=function(){return "VIDEO"===this.el.tagName},Dn.prototype.isIFrame=function(){return "IFRAME"===this.el.tagName},Dn.prototype.isYoutube=function(){return this.isIFrame()&&!!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/)},Dn.prototype.isVimeo=function(){return this.isIFrame()&&!!this.el.src.match(/vimeo\.com\/video\/.*/)},Dn.prototype.enableApi=function(){var e=this;if(this.ready)return this.ready;var n,i=this.isYoutube(),r=this.isVimeo();return i||r?this.ready=new ne(function(t){Yt(e.el,"load",function(){if(i){var t=function(){return Bn(e.el,{event:"listening",id:e.id})};n=setInterval(t,100),t();}}),function(i){return new ne(function(n){Yt(window,"message",function(t,e){return n(e)},!1,function(t){var e=t.data;if(e&&O(e)){try{e=JSON.parse(e);}catch(t){return}return e&&i(e)}});})}(function(t){return i&&t.id===e.id&&"onReady"===t.event||r&&Number(t.player_id)===e.id}).then(function(){t(),n&&clearInterval(n);}),it(e.el,"src",e.el.src+(b(e.el.src,"?")?"&":"?")+(i?"enablejsapi=1":"api=1&player_id="+e.id));}):ne.resolve()},Dn.prototype.play=function(){var t=this;if(this.isVideo())if(this.isIFrame())this.enableApi().then(function(){return Bn(t.el,{func:"playVideo",method:"play"})});else if(this.isHTML5())try{var e=this.el.play();e&&e.catch(Q);}catch(t){}},Dn.prototype.pause=function(){var t=this;this.isVideo()&&(this.isIFrame()?this.enableApi().then(function(){return Bn(t.el,{func:"pauseVideo",method:"pause"})}):this.isHTML5()&&this.el.pause());},Dn.prototype.mute=function(){var t=this;this.isVideo()&&(this.isIFrame()?this.enableApi().then(function(){return Bn(t.el,{func:"mute",method:"setVolume",value:0})}):this.isHTML5()&&(this.el.muted=!0,it(this.el,"muted","")));};var Pn="IntersectionObserver"in window?window.IntersectionObserver:function(){function t(e,t){var n=this;void 0===t&&(t={});var i=t.rootMargin;void 0===i&&(i="0 0"),this.targets=[];var r,o=(i||"0 0").split(" ").map(F),s=o[0],a=o[1];this.offsetTop=s,this.offsetLeft=a,this.apply=function(){r=r||requestAnimationFrame(function(){return setTimeout(function(){var t=n.takeRecords();t.length&&e(t,n),r=!1;})});},this.off=Vt(window,"scroll resize load",this.apply,{passive:!0,capture:!0});}return t.prototype.takeRecords=function(){var n=this;return this.targets.filter(function(t){var e=pn(t.target,n.offsetTop,n.offsetLeft);if(null===t.isIntersecting||e^t.isIntersecting)return t.isIntersecting=e,!0})},t.prototype.observe=function(t){this.targets.push({target:t,isIntersecting:null}),this.apply();},t.prototype.disconnect=function(){this.targets=[],this.off();},t}();function Hn(t){return !(!w(t,"uk-")&&!w(t,"data-uk-"))&&f(t.replace("data-uk-","").replace("uk-",""))}function Ln(t){this._init(t);}var Fn,jn,Wn,Vn,Rn,Yn,qn,Un,Xn;function Kn(t,e){if(t)for(var n in t)t[n]._connected&&t[n]._callUpdate(e);}function Gn(t,e){var n={},i=t.args;void 0===i&&(i=[]);var r=t.props;void 0===r&&(r={});var o=t.el;if(!r)return n;for(var s in r){var a=d(s),h=st(o,a);if(!P(h)){if(h=r[s]===Boolean&&""===h||ti(r[s],h),"target"===a&&(!h||w(h,"_")))continue;n[s]=h;}}var c=On(st(o,e),i);for(var u in c){var l=f(u);void 0!==r[l]&&(n[l]=ti(r[l],c[u]));}return n}function Jn(i,r,o){Object.defineProperty(i,r,{enumerable:!0,get:function(){var t=i._computeds,e=i.$props,n=i.$el;return c(t,r)||(t[r]=(o.get||o).call(i,e,n)),t[r]},set:function(t){var e=i._computeds;e[r]=o.set?o.set.call(i,t):t,P(e[r])&&delete e[r];}});}function Zn(e,n,i){S(n)||(n={name:i,handler:n});var t=n.name,r=n.el,o=n.handler,s=n.capture,a=n.passive,h=n.delegate,c=n.filter,u=n.self;r=$(r)?r.call(e):r||e.$el,k(r)?r.forEach(function(t){return Zn(e,U({},n,{el:t}),i)}):!r||c&&!c.call(e)||e._events.push(Vt(r,t,h?O(h)?h:h.call(e):null,O(o)?e[o]:o.bind(e),{passive:a,capture:s,self:u}));}function Qn(t,e){return t.every(function(t){return !t||!c(t,e)})}function ti(t,e){return t===Boolean?H(e):t===Number?L(e):"list"===t?V(e):t?t(e):e}Ln.util=Object.freeze({ajax:ae,getImage:he,transition:Ue,Transition:Xe,animate:Je,Animation:Qe,attr:it,hasAttr:rt,removeAttr:ot,data:st,addClass:Ae,removeClass:_e,removeClasses:Ne,replaceClass:Me,hasClass:Oe,toggleClass:De,positionAt:en,offset:nn,position:on,height:sn,width:an,boxModelAdjust:cn,flipPosition:fn,isInView:pn,scrolledOver:mn,scrollTop:gn,offsetPosition:vn,toPx:wn,ready:ce,index:ue,getIndex:le,empty:de,html:fe,prepend:function(e,t){return (e=Te(e)).hasChildNodes()?ve(t,function(t){return e.insertBefore(t,e.firstChild)}):pe(e,t)},append:pe,before:me,after:ge,remove:we,wrapAll:be,wrapInner:ye,unwrap:xe,fragment:Ie,apply:Se,$:Te,$$:Ee,isIE:at,isRtl:ht,hasTouch:lt,pointerDown:dt,pointerMove:ft,pointerUp:pt,pointerEnter:mt,pointerLeave:gt,pointerCancel:vt,on:Vt,off:Rt,once:Yt,trigger:qt,createEvent:Ut,toEventTargets:Zt,isTouch:Qt,getEventPos:te,fastdom:kn,isVoidElement:Pt,isVisible:Ht,selInput:Lt,isInput:Ft,filter:jt,within:Wt,hasOwn:c,hyphenate:d,camelize:f,ucfirst:p,startsWith:w,endsWith:u,includes:b,findIndex:x,isArray:k,isFunction:$,isObject:I,isPlainObject:S,isWindow:T,isDocument:E,isJQuery:C,isNode:A,isNodeCollection:N,isBoolean:M,isString:O,isNumber:D,isNumeric:z,isEmpty:B,isUndefined:P,toBoolean:H,toNumber:L,toFloat:F,toNode:j,toNodes:W,toList:V,toMs:R,isEqual:Y,swap:q,assign:U,last:X,each:K,sortBy:G,uniqueBy:J,clamp:Z,noop:Q,intersectRect:tt,pointInRect:et,Dimensions:nt,MouseTracker:En,mergeOptions:Mn,parseOptions:On,Player:Dn,Promise:ne,Deferred:ee,IntersectionObserver:Pn,query:wt,queryAll:bt,find:xt,findAll:kt,matches:_t,closest:Mt,parents:Ot,escape:zt,css:Le,getStyles:Fe,getStyle:je,getCssVar:Ve,propName:Ye}),Ln.data="__uikit__",Ln.prefix="uk-",Ln.options={},Wn=(Fn=Ln).data,Fn.use=function(t){if(!t.installed)return t.call(null,this),t.installed=!0,this},Fn.mixin=function(t,e){(e=(O(e)?Fn.component(e):e)||this).options=Mn(e.options,t);},Fn.extend=function(t){function e(t){this._init(t);}return t=t||{},((e.prototype=Object.create(this.prototype)).constructor=e).options=Mn(this.options,t),e.super=this,e.extend=this.extend,e},Fn.update=function(t,e){(function t(e,n){e&&e!==document.body&&e.parentNode&&(t(e.parentNode,n),n(e.parentNode));})(t=t?j(t):document.body,function(t){return Kn(t[Wn],e)}),Se(t,function(t){return Kn(t[Wn],e)});},Object.defineProperty(Fn,"container",{get:function(){return jn||document.body},set:function(t){jn=Te(t);}}),(Vn=Ln).prototype._callHook=function(t){var e=this,n=this.$options[t];n&&n.forEach(function(t){return t.call(e)});},Vn.prototype._callConnected=function(){this._connected||(this._data={},this._computeds={},this._initProps(),this._callHook("beforeConnect"),this._connected=!0,this._initEvents(),this._initObserver(),this._callHook("connected"),this._callUpdate());},Vn.prototype._callDisconnected=function(){this._connected&&(this._callHook("beforeDisconnect"),this._observer&&(this._observer.disconnect(),this._observer=null),this._unbindEvents(),this._callHook("disconnected"),this._connected=!1);},Vn.prototype._callUpdate=function(t){var o=this;void 0===t&&(t="update");var s=t.type||t;b(["update","resize"],s)&&this._callWatches();var e=this.$options.update,n=this._frames,a=n.reads,h=n.writes;e&&e.forEach(function(t,e){var n=t.read,i=t.write,r=t.events;"update"!==s&&!b(r,s)||(n&&!b(kn.reads,a[e])&&(a[e]=kn.read(function(){var t=o._connected&&n.call(o,o._data,s);!1===t&&i?kn.clear(h[e]):S(t)&&U(o._data,t);})),i&&!b(kn.writes,h[e])&&(h[e]=kn.write(function(){return o._connected&&i.call(o,o._data,s)})));});},Yn=0,(Rn=Ln).prototype._init=function(t){(t=t||{}).data=function(t,e){var n=t.data,i=(t.el,e.args),r=e.props;if(void 0===r&&(r={}),n=k(n)?B(i)?void 0:n.slice(0,i.length).reduce(function(t,e,n){return S(e)?U(t,e):t[i[n]]=e,t},{}):n)for(var o in n)P(n[o])?delete n[o]:n[o]=r[o]?ti(r[o],n[o]):n[o];return n}(t,this.constructor.options),this.$options=Mn(this.constructor.options,t,this),this.$el=null,this.$props={},this._frames={reads:{},writes:{}},this._events=[],this._uid=Yn++,this._initData(),this._initMethods(),this._initComputeds(),this._callHook("created"),t.el&&this.$mount(t.el);},Rn.prototype._initData=function(){var t=this.$options.data;for(var e in void 0===t&&(t={}),t)this.$props[e]=this[e]=t[e];},Rn.prototype._initMethods=function(){var t=this.$options.methods;if(t)for(var e in t)this[e]=t[e].bind(this);},Rn.prototype._initComputeds=function(){var t=this.$options.computed;if(this._computeds={},t)for(var e in t)Jn(this,e,t[e]);},Rn.prototype._callWatches=function(){var t=this.$options.computed,e=this._computeds;for(var n in e){var i=e[n];delete e[n],t[n].watch&&!Y(i,this[n])&&t[n].watch.call(this,this[n],i);}},Rn.prototype._initProps=function(t){var e;for(e in t=t||Gn(this.$options,this.$name))P(t[e])||(this.$props[e]=t[e]);var n=[this.$options.computed,this.$options.methods];for(e in this.$props)e in t&&Qn(n,e)&&(this[e]=this.$props[e]);},Rn.prototype._initEvents=function(){var n=this,t=this.$options.events;t&&t.forEach(function(t){if(c(t,"handler"))Zn(n,t);else for(var e in t)Zn(n,t[e],e);});},Rn.prototype._unbindEvents=function(){this._events.forEach(function(t){return t()}),this._events=[];},Rn.prototype._initObserver=function(){var n=this,t=this.$options,i=t.attrs,e=t.props,r=t.el;if(!this._observer&&e&&!1!==i){i=k(i)?i:Object.keys(e),this._observer=new MutationObserver(function(){var e=Gn(n.$options,n.$name);i.some(function(t){return !P(e[t])&&e[t]!==n.$props[t]})&&n.$reset();});var o=i.map(function(t){return d(t)}).concat(this.$name);this._observer.observe(r,{attributes:!0,attributeFilter:o.concat(o.map(function(t){return "data-"+t}))});}},Un=(qn=Ln).data,Xn={},qn.component=function(s,t){if(!t)return S(Xn[s])&&(Xn[s]=qn.extend(Xn[s])),Xn[s];qn[s]=function(t,n){for(var e=arguments.length,i=Array(e);e--;)i[e]=arguments[e];var r=qn.component(s);return S(t)?new r({data:t}):r.options.functional?new r({data:[].concat(i)}):t&&t.nodeType?o(t):Ee(t).map(o)[0];function o(t){var e=qn.getComponent(t,s);if(e){if(!n)return e;e.$destroy();}return new r({el:t,data:n})}};var e=S(t)?U({},t):t.options;if(e.name=s,e.install&&e.install(qn,e,s),qn._initialized&&!e.functional){var n=d(s);kn.read(function(){return qn[s]("[uk-"+n+"],[data-uk-"+n+"]")});}return Xn[s]=S(t)?e:t},qn.getComponents=function(t){return t&&t[Un]||{}},qn.getComponent=function(t,e){return qn.getComponents(t)[e]},qn.connect=function(t){if(t[Un])for(var e in t[Un])t[Un][e]._callConnected();for(var n=0;n<t.attributes.length;n++){var i=Hn(t.attributes[n].name);i&&i in Xn&&qn[i](t);}},qn.disconnect=function(t){for(var e in t[Un])t[Un][e]._callDisconnected();},function(i){var r=i.data;i.prototype.$mount=function(t){var e=this.$options.name;t[r]||(t[r]={}),t[r][e]||((t[r][e]=this).$el=this.$options.el=this.$options.el||t,Wt(t,document)&&this._callConnected());},i.prototype.$emit=function(t){this._callUpdate(t);},i.prototype.$reset=function(){this._callDisconnected(),this._callConnected();},i.prototype.$destroy=function(t){void 0===t&&(t=!1);var e=this.$options,n=e.el,i=e.name;n&&this._callDisconnected(),this._callHook("destroy"),n&&n[r]&&(delete n[r][i],B(n[r])||delete n[r],t&&we(this.$el));},i.prototype.$create=function(t,e,n){return i[t](e,n)},i.prototype.$update=i.update,i.prototype.$getComponent=i.getComponent;var e={};Object.defineProperties(i.prototype,{$container:Object.getOwnPropertyDescriptor(i,"container"),$name:{get:function(){var t=this.$options.name;return e[t]||(e[t]=i.prefix+d(t)),e[t]}}});}(Ln);var ei={connected:function(){Oe(this.$el,this.$name)||Ae(this.$el,this.$name);}},ni={props:{cls:Boolean,animation:"list",duration:Number,origin:String,transition:String,queued:Boolean},data:{cls:!1,animation:[!1],duration:200,origin:!1,transition:"linear",queued:!1,initProps:{overflow:"",height:"",paddingTop:"",paddingBottom:"",marginTop:"",marginBottom:""},hideProps:{overflow:"hidden",height:0,paddingTop:0,paddingBottom:0,marginTop:0,marginBottom:0}},computed:{hasAnimation:function(t){return !!t.animation[0]},hasTransition:function(t){var e=t.animation;return this.hasAnimation&&!0===e[0]}},methods:{toggleElement:function(c,u,l){var d=this;return new ne(function(t){c=W(c);function e(t){return ne.all(t.map(function(t){return d._toggleElement(t,u,l)}))}var n,i=c.filter(function(t){return d.isToggled(t)}),r=c.filter(function(t){return !b(i,t)});if(d.queued&&P(l)&&P(u)&&d.hasAnimation&&!(c.length<2)){var o=document.body,s=o.scrollTop,a=i[0],h=Qe.inProgress(a)&&Oe(a,"uk-animation-leave")||Xe.inProgress(a)&&"0px"===a.style.height;n=e(i),h||(n=n.then(function(){var t=e(r);return o.scrollTop=s,t}));}else n=e(r.concat(i));n.then(t,Q);})},toggleNow:function(e,n){var i=this;return new ne(function(t){return ne.all(W(e).map(function(t){return i._toggleElement(t,n,!1)})).then(t,Q)})},isToggled:function(t){var e=W(t||this.$el);return this.cls?Oe(e,this.cls.split(" ")[0]):!rt(e,"hidden")},updateAria:function(t){!1===this.cls&&it(t,"aria-hidden",!this.isToggled(t));},_toggleElement:function(t,e,n){var i=this;if(e=M(e)?e:Qe.inProgress(t)?Oe(t,"uk-animation-leave"):Xe.inProgress(t)?"0px"===t.style.height:!this.isToggled(t),!qt(t,"before"+(e?"show":"hide"),[this]))return ne.reject();var r=($(n)?n:!1!==n&&this.hasAnimation?this.hasTransition?function(t){var s=t.isToggled,a=t.duration,h=t.initProps,c=t.hideProps,u=t.transition,l=t._toggle;return function(t,e){var n=Xe.inProgress(t),i=t.hasChildNodes?F(Le(t.firstElementChild,"marginTop"))+F(Le(t.lastElementChild,"marginBottom")):0,r=Ht(t)?sn(t)+(n?0:i):0;Xe.cancel(t),s(t)||l(t,!0),sn(t,""),kn.flush();var o=sn(t)+(n?0:i);return sn(t,r),(e?Xe.start(t,U({},h,{overflow:"hidden",height:o}),Math.round(a*(1-r/o)),u):Xe.start(t,c,Math.round(a*(r/o)),u).then(function(){return l(t,!1)})).then(function(){return Le(t,h)})}}(this):function(t){var n=t.animation,i=t.duration,r=t.origin,o=t._toggle;return function(t,e){return Qe.cancel(t),e?(o(t,!0),Qe.in(t,n[0],i,r)):Qe.out(t,n[1]||n[0],i,r).then(function(){return o(t,!1)})}}(this):this._toggle)(t,e);qt(t,e?"show":"hide",[this]);function o(){qt(t,e?"shown":"hidden",[i]),i.$update(t);}return r?r.then(o):ne.resolve(o())},_toggle:function(t,e){var n;t&&(e=Boolean(e),this.cls?(n=b(this.cls," ")||e!==Oe(t,this.cls))&&De(t,this.cls,b(this.cls," ")?void 0:e):(n=e===rt(t,"hidden"))&&it(t,"hidden",e?null:""),Ee("[autofocus]",t).some(function(t){return Ht(t)?t.focus()||!0:t.blur()}),this.updateAria(t),n&&this.$update(t));}}};var ii={mixins:[ei,ni],props:{targets:String,active:null,collapsible:Boolean,multiple:Boolean,toggle:String,content:String,transition:String},data:{targets:"> *",active:!1,animation:[!0],collapsible:!0,multiple:!1,clsOpen:"uk-open",toggle:"> .uk-accordion-title",content:"> .uk-accordion-content",transition:"ease"},computed:{items:function(t,e){return Ee(t.targets,e)}},events:[{name:"click",delegate:function(){return this.targets+" "+this.$props.toggle},handler:function(t){t.preventDefault(),this.toggle(ue(Ee(this.targets+" "+this.$props.toggle,this.$el),t.current));}}],connected:function(){if(!1!==this.active){var t=this.items[Number(this.active)];t&&!Oe(t,this.clsOpen)&&this.toggle(t,!1);}},update:function(){var e=this;this.items.forEach(function(t){return e._toggle(Te(e.content,t),Oe(t,e.clsOpen))});var t=!this.collapsible&&!Oe(this.items,this.clsOpen)&&this.items[0];t&&this.toggle(t,!1);},methods:{toggle:function(r,o){var s=this,t=le(r,this.items),a=jt(this.items,"."+this.clsOpen);(r=this.items[t])&&[r].concat(!this.multiple&&!b(a,r)&&a||[]).forEach(function(t){var e=t===r,n=e&&!Oe(t,s.clsOpen);if(n||!e||s.collapsible||!(a.length<2)){De(t,s.clsOpen,n);var i=t._wrapper?t._wrapper.firstElementChild:Te(s.content,t);t._wrapper||(t._wrapper=be(i,"<div>"),it(t._wrapper,"hidden",n?"":null)),s._toggle(i,!0),s.toggleElement(t._wrapper,n,o).then(function(){Oe(t,s.clsOpen)===n&&(n||s._toggle(i,!1),t._wrapper=null,xe(i));});}});}}},ri={mixins:[ei,ni],args:"animation",props:{close:String},data:{animation:[!0],selClose:".uk-alert-close",duration:150,hideProps:U({opacity:0},ni.data.hideProps)},events:[{name:"click",delegate:function(){return this.selClose},handler:function(t){t.preventDefault(),this.close();}}],methods:{close:function(){var t=this;this.toggleElement(this.$el).then(function(){return t.$destroy(!0)});}}};function oi(r){ce(function(){var n;r.update(),Vt(window,"load resize",function(){return r.update(null,"resize")}),Vt(document,"loadedmetadata load",function(t){var e=t.target;return r.update(e,"resize")},!0),Vt(window,"scroll",function(t){if(!n){n=!0,kn.write(function(){return n=!1});var e=t.target;r.update(1!==e.nodeType?document.body:e,t.type);}},{passive:!0,capture:!0});var e,i=0;Vt(document,"animationstart",function(t){var e=t.target;(Le(e,"animationName")||"").match(/^uk-.*(left|right)/)&&(i++,Le(document.body,"overflowX","hidden"),setTimeout(function(){--i||Le(document.body,"overflowX","");},R(Le(e,"animationDuration"))+100));},!0),Vt(document,dt,function(t){if(e&&e(),Qt(t)){var r=te(t),o="tagName"in t.target?t.target:t.target.parentNode;e=Yt(document,pt+" "+vt,function(t){var e=te(t),n=e.x,i=e.y;(o&&n&&100<Math.abs(r.x-n)||i&&100<Math.abs(r.y-i))&&setTimeout(function(){qt(o,"swipe"),qt(o,"swipe"+function(t,e,n,i){return Math.abs(t-n)>=Math.abs(e-i)?0<t-n?"Left":"Right":0<e-i?"Up":"Down"}(r.x,r.y,n,i));});}),"touchstart"===dt&&(Le(document.body,"cursor","pointer"),Yt(document,pt+" "+vt,function(){return setTimeout(function(){return Le(document.body,"cursor","")},50)}));}},{passive:!0});});}var si,ai={args:"autoplay",props:{automute:Boolean,autoplay:Boolean},data:{automute:!1,autoplay:!0},computed:{inView:function(t){return "inview"===t.autoplay}},connected:function(){this.inView&&!rt(this.$el,"preload")&&(this.$el.preload="none"),this.player=new Dn(this.$el),this.automute&&this.player.mute();},update:{read:function(){return !!this.player&&{visible:Ht(this.$el)&&"hidden"!==Le(this.$el,"visibility"),inView:this.inView&&pn(this.$el)}},write:function(t){var e=t.visible,n=t.inView;!e||this.inView&&!n?this.player.pause():(!0===this.autoplay||this.inView&&n)&&this.player.play();},events:["resize","scroll"]}},hi={mixins:[ei,ai],props:{width:Number,height:Number},data:{automute:!0},update:{read:function(){var t=this.$el,e=t.parentNode,n=e.offsetHeight,i=e.offsetWidth,r=nt.cover({width:this.width||t.naturalWidth||t.videoWidth||t.clientWidth,height:this.height||t.naturalHeight||t.videoHeight||t.clientHeight},{width:i+(i%2?1:0),height:n+(n%2?1:0)});return !(!r.width||!r.height)&&r},write:function(t){var e=t.height,n=t.width;Le(this.$el,{height:e,width:n});},events:["resize"]}},ci={props:{pos:String,offset:null,flip:Boolean,clsPos:String},data:{pos:"bottom-"+(ht?"right":"left"),flip:!0,offset:!1,clsPos:""},computed:{pos:function(t){var e=t.pos;return (e+(b(e,"-")?"":"-center")).split("-")},dir:function(){return this.pos[0]},align:function(){return this.pos[1]}},methods:{positionAt:function(t,e,n){var i;Ne(t,this.clsPos+"-(top|bottom|left|right)(-[a-z]+)?"),Le(t,{top:"",left:""});var r=this.offset,o=this.getAxis();z(r)||(r=(i=Te(r))?nn(i)["x"===o?"left":"top"]-nn(e)["x"===o?"right":"bottom"]:0);var s=en(t,e,"x"===o?fn(this.dir)+" "+this.align:this.align+" "+fn(this.dir),"x"===o?this.dir+" "+this.align:this.align+" "+this.dir,"x"===o?""+("left"===this.dir?-r:r):" "+("top"===this.dir?-r:r),null,this.flip,n).target,a=s.x,h=s.y;this.dir="x"===o?a:h,this.align="x"===o?h:a,De(t,this.clsPos+"-"+this.dir+"-"+this.align,!1===this.offset);},getAxis:function(){return "top"===this.dir||"bottom"===this.dir?"y":"x"}}},ui={mixins:[ci,ni],args:"pos",props:{mode:"list",toggle:Boolean,boundary:Boolean,boundaryAlign:Boolean,delayShow:Number,delayHide:Number,clsDrop:String},data:{mode:["click","hover"],toggle:"- *",boundary:window,boundaryAlign:!1,delayShow:0,delayHide:800,clsDrop:!1,hoverIdle:200,animation:["uk-animation-fade"],cls:"uk-open"},computed:{boundary:function(t,e){return wt(t.boundary,e)},clsDrop:function(t){return t.clsDrop||"uk-"+this.$options.name},clsPos:function(){return this.clsDrop}},created:function(){this.tracker=new En;},connected:function(){Ae(this.$el,this.clsDrop);var t=this.$props.toggle;this.toggle=t&&this.$create("toggle",wt(t,this.$el),{target:this.$el,mode:this.mode}),this.toggle||qt(this.$el,"updatearia");},events:[{name:"click",delegate:function(){return "."+this.clsDrop+"-close"},handler:function(t){t.preventDefault(),this.hide(!1);}},{name:"click",delegate:function(){return 'a[href^="#"]'},handler:function(t){var e=t.defaultPrevented,n=t.current.hash;e||!n||Wt(n,this.$el)||this.hide(!1);}},{name:"beforescroll",handler:function(){this.hide(!1);}},{name:"toggle",self:!0,handler:function(t,e){t.preventDefault(),this.isToggled()?this.hide(!1):this.show(e,!1);}},{name:mt,filter:function(){return b(this.mode,"hover")},handler:function(t){Qt(t)||(si&&si!==this&&si.toggle&&b(si.toggle.mode,"hover")&&!Wt(t.target,si.toggle.$el)&&!et({x:t.pageX,y:t.pageY},nn(si.$el))&&si.hide(!1),t.preventDefault(),this.show(this.toggle));}},{name:"toggleshow",handler:function(t,e){e&&!b(e.target,this.$el)||(t.preventDefault(),this.show(e||this.toggle));}},{name:"togglehide "+gt,handler:function(t,e){Qt(t)||e&&!b(e.target,this.$el)||(t.preventDefault(),this.toggle&&b(this.toggle.mode,"hover")&&this.hide());}},{name:"beforeshow",self:!0,handler:function(){this.clearTimers(),Qe.cancel(this.$el),this.position();}},{name:"show",self:!0,handler:function(){var i=this;this.tracker.init(),qt(this.$el,"updatearia");var t=li(document,"click",function(t){var e=t.defaultPrevented,n=t.target;e||Wt(n,i.$el)||i.toggle&&Wt(n,i.toggle.$el)||i.hide(!1);});Yt(this.$el,"hide",t,{self:!0});}},{name:"beforehide",self:!0,handler:function(){this.clearTimers();}},{name:"hide",handler:function(t){var e=t.target;this.$el===e?(si=this.isActive()?null:si,qt(this.$el,"updatearia"),this.tracker.cancel()):si=null===si&&Wt(e,this.$el)&&this.isToggled()?this:si;}},{name:"updatearia",self:!0,handler:function(t,e){t.preventDefault(),this.updateAria(this.$el),(e||this.toggle)&&(it((e||this.toggle).$el,"aria-expanded",this.isToggled()),De(this.toggle.$el,this.cls,this.isToggled()));}}],update:{write:function(){this.isToggled()&&!Qe.inProgress(this.$el)&&this.position();},events:["resize"]},methods:{show:function(e,n){var i=this;void 0===n&&(n=!0);function r(){return !i.isToggled()&&i.toggleElement(i.$el,!0)}function t(){if(i.toggle=e||i.toggle,i.clearTimers(),!i.isActive())if(n&&si&&si!==i&&si.isDelaying)i.showTimer=setTimeout(i.show,10);else{if(i.isParentOf(si)){if(!si.hideTimer)return;si.hide(!1);}else if(i.isChildOf(si))si.clearTimers();else if(si&&!i.isChildOf(si)&&!i.isParentOf(si))for(var t;si&&si!==t&&!i.isChildOf(si);)(t=si).hide(!1);n&&i.delayShow?i.showTimer=setTimeout(r,i.delayShow):r(),si=i;}}e&&this.toggle&&e.$el!==this.toggle.$el?(Yt(this.$el,"hide",t),this.hide(!1)):t();},hide:function(t){var e=this;void 0===t&&(t=!0);function n(){return e.toggleNow(e.$el,!1)}this.clearTimers(),this.isDelaying=this.tracker.movesTo(this.$el),t&&this.isDelaying?this.hideTimer=setTimeout(this.hide,this.hoverIdle):t&&this.delayHide?this.hideTimer=setTimeout(n,this.delayHide):n();},clearTimers:function(){clearTimeout(this.showTimer),clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null,this.isDelaying=!1;},isActive:function(){return si===this},isChildOf:function(t){return t&&t!==this&&Wt(this.$el,t.$el)},isParentOf:function(t){return t&&t!==this&&Wt(t.$el,this.$el)},position:function(){Ne(this.$el,this.clsDrop+"-(stack|boundary)"),Le(this.$el,{top:"",left:"",display:"block"}),De(this.$el,this.clsDrop+"-boundary",this.boundaryAlign);var t=nn(this.boundary),e=this.boundaryAlign?t:nn(this.toggle.$el);if("justify"===this.align){var n="y"===this.getAxis()?"width":"height";Le(this.$el,n,e[n]);}else this.$el.offsetWidth>Math.max(t.right-e.left,e.right-t.left)&&Ae(this.$el,this.clsDrop+"-stack");this.positionAt(this.$el,this.boundaryAlign?this.boundary:this.toggle.$el,this.boundary),Le(this.$el,"display","");}}};function li(t,e,n){var i=Yt(t,e,function(){return i=Vt(t,e,n)},!0);return function(){return i()}}var di={extends:ui},fi={mixins:[ei],args:"target",props:{target:Boolean},data:{target:!1},computed:{input:function(t,e){return Te(Lt,e)},state:function(){return this.input.nextElementSibling},target:function(t,e){var n=t.target;return n&&(!0===n&&this.input.parentNode===e&&this.input.nextElementSibling||wt(n,e))}},update:function(){var t=this.target,e=this.input;if(t){var n,i=Ft(t)?"value":"textContent",r=t[i],o=e.files&&e.files[0]?e.files[0].name:_t(e,"select")&&(n=Ee("option",e).filter(function(t){return t.selected})[0])?n.textContent:e.value;r!==o&&(t[i]=o);}},events:[{name:"change",handler:function(){this.$emit();}},{name:"reset",el:function(){return Mt(this.$el,"form")},handler:function(){this.$emit();}}]},pi={update:{read:function(t){var e=pn(this.$el);if(!e||t.isInView===e)return !1;t.isInView=e;},write:function(){this.$el.src=this.$el.src;},events:["scroll","resize"]}},mi={props:{margin:String,firstColumn:Boolean},data:{margin:"uk-margin-small-top",firstColumn:"uk-first-column"},update:{read:function(t){var e=this.$el.children;if(!e.length||!Ht(this.$el))return t.rows=[[]];t.rows=gi(e),t.stacks=!t.rows.some(function(t){return 1<t.length});},write:function(t){var i=this;t.rows.forEach(function(t,n){return t.forEach(function(t,e){De(t,i.margin,0!==n),De(t,i.firstColumn,0===e);})});},events:["resize"]}};function gi(t){for(var e=[[]],n=0;n<t.length;n++){var i=t[n],r=vi(i);if(r.height)for(var o=e.length-1;0<=o;o--){var s=e[o];if(!s[0]){s.push(i);break}var a=void 0;if(a=s[0].offsetParent===i.offsetParent?vi(s[0]):(r=vi(i,!0),vi(s[0],!0)),r.top>=a.bottom-1&&r.top!==a.top){e.push([i]);break}if(r.bottom>a.top){if(r.left<a.left&&!ht){s.unshift(i);break}s.push(i);break}if(0===o){e.unshift([i]);break}}}return e}function vi(t,e){var n;void 0===e&&(e=!1);var i=t.offsetTop,r=t.offsetLeft,o=t.offsetHeight;return e&&(i=(n=vn(t))[0],r=n[1]),{top:i,left:r,height:o,bottom:i+o}}var wi={extends:mi,mixins:[ei],name:"grid",props:{masonry:Boolean,parallax:Number},data:{margin:"uk-grid-margin",clsStack:"uk-grid-stack",masonry:!1,parallax:0},computed:{length:function(t,e){return e.children.length},parallax:function(t){var e=t.parallax;return e&&this.length?Math.abs(e):""}},connected:function(){this.masonry&&Ae(this.$el,"uk-flex-top uk-flex-wrap-top");},update:[{read:function(t){var r=t.rows;(this.masonry||this.parallax)&&(r=r.map(function(t){return G(t,"offsetLeft")}),ht&&r.map(function(t){return t.reverse()}));var e=r.some(function(t){return t.some(Xe.inProgress)}),n=!1,i="";if(this.masonry&&this.length){var o=0;n=r.reduce(function(n,t,i){return n[i]=t.map(function(t,e){return 0===i?0:F(n[i-1][e])+(o-F(r[i-1][e]&&r[i-1][e].offsetHeight))}),o=t.reduce(function(t,e){return Math.max(t,e.offsetHeight)},0),n},[]),i=function(t){return Math.max.apply(Math,t.reduce(function(n,t){return t.forEach(function(t,e){return n[e]=(n[e]||0)+t.offsetHeight}),n},[]))}(r)+function(t,e){var n=W(t.children),i=n.filter(function(t){return Oe(t,e)})[0];return F(i?Le(i,"marginTop"):Le(n[0],"paddingLeft"))}(this.$el,this.margin)*(r.length-1);}return {padding:this.parallax&&function(t,e,n){for(var i=0,r=0,o=0,s=e.length-1;0<=s;s--)for(var a=i;a<e[s].length;a++){var h=e[s][a],c=h.offsetTop+sn(h)+(n&&-n[s][a]);r=Math.max(r,c),o=Math.max(o,c+(a%2?t:t/8)),i++;}return o-r}(this.parallax,r,n),rows:r,translates:n,height:!e&&i}},write:function(t){var e=t.stacks,n=t.height,i=t.padding;De(this.$el,this.clsStack,e),Le(this.$el,"paddingBottom",i),!1!==n&&Le(this.$el,"height",n);},events:["resize"]},{read:function(t){var e=t.height;return {scrolled:!!this.parallax&&mn(this.$el,e?e-sn(this.$el):0)*this.parallax}},write:function(t){var e=t.rows,i=t.scrolled,r=t.translates;!1===i&&!r||e.forEach(function(t,n){return t.forEach(function(t,e){return Le(t,"transform",i||r?"translateY("+((r&&-r[n][e])+(i?e%2?i:i/8:0))+"px)":"")})});},events:["scroll","resize"]}]};var bi=at?{props:{selMinHeight:String},data:{selMinHeight:!1,forceHeight:!1},computed:{elements:function(t,e){var n=t.selMinHeight;return n?Ee(n,e):[e]}},update:[{read:function(){Le(this.elements,"height","");},order:-5,events:["resize"]},{write:function(){var n=this;this.elements.forEach(function(t){var e=F(Le(t,"minHeight"));e&&(n.forceHeight||Math.round(e+cn("height",t,"content-box"))>=t.offsetHeight)&&Le(t,"height",e);});},order:5,events:["resize"]}]}:{},yi={mixins:[bi],args:"target",props:{target:String,row:Boolean},data:{target:"> *",row:!0,forceHeight:!0},computed:{elements:function(t,e){return Ee(t.target,e)}},update:{read:function(){return {rows:(this.row?gi(this.elements):[this.elements]).map(xi)}},write:function(t){t.rows.forEach(function(t){var n=t.heights;return t.elements.forEach(function(t,e){return Le(t,"minHeight",n[e])})});},events:["resize"]}};function xi(t){var e;if(t.length<2)return {heights:[""],elements:t};var n=ki(t),i=n.heights,r=n.max,o=t.some(function(t){return t.style.minHeight}),s=t.some(function(t,e){return !t.style.minHeight&&i[e]<r});return o&&s&&(Le(t,"minHeight",""),e=ki(t),i=e.heights,r=e.max),{heights:i=t.map(function(t,e){return i[e]===r&&F(t.style.minHeight).toFixed(2)!==r.toFixed(2)?"":r}),elements:t}}function ki(t){var e=t.map(function(t){return nn(t).height-cn("height",t,"content-box")});return {heights:e,max:Math.max.apply(null,e)}}var $i={mixins:[bi],props:{expand:Boolean,offsetTop:Boolean,offsetBottom:Boolean,minHeight:Number},data:{expand:!1,offsetTop:!1,offsetBottom:!1,minHeight:0},update:{read:function(t){var e=t.minHeight;if(!Ht(this.$el))return !1;var n="",i=cn("height",this.$el,"content-box");if(this.expand){if(this.$el.dataset.heightExpand="",Te("[data-height-expand]")!==this.$el)return !1;n=sn(window)-(Ii(document.documentElement)-Ii(this.$el))-i||"";}else{if(n="calc(100vh",this.offsetTop){var r=nn(this.$el).top;n+=0<r&&r<sn(window)/2?" - "+r+"px":"";}!0===this.offsetBottom?n+=" - "+Ii(this.$el.nextElementSibling)+"px":z(this.offsetBottom)?n+=" - "+this.offsetBottom+"vh":this.offsetBottom&&u(this.offsetBottom,"px")?n+=" - "+F(this.offsetBottom)+"px":O(this.offsetBottom)&&(n+=" - "+Ii(wt(this.offsetBottom,this.$el))+"px"),n+=(i?" - "+i+"px":"")+")";}return {minHeight:n,prev:e}},write:function(t){var e=t.minHeight,n=t.prev;Le(this.$el,{minHeight:e}),e!==n&&this.$update(this.$el,"resize"),this.minHeight&&F(Le(this.$el,"minHeight"))<this.minHeight&&Le(this.$el,"minHeight",this.minHeight);},events:["resize"]}};function Ii(t){return t&&nn(t).height||0}var Si={args:"src",props:{id:Boolean,icon:String,src:String,style:String,width:Number,height:Number,ratio:Number,class:String,strokeAnimation:Boolean,focusable:Boolean,attributes:"list"},data:{ratio:1,include:["style","class","focusable"],class:"",strokeAnimation:!1},beforeConnect:function(){var t,e=this;if(this.class+=" uk-svg",!this.icon&&b(this.src,"#")){var n=this.src.split("#");1<n.length&&(t=n,this.src=t[0],this.icon=t[1]);}this.svg=this.getSvg().then(function(t){return e.applyAttributes(t),e.svgEl=function(t,e){{if(Pt(e)||"CANVAS"===e.tagName){it(e,"hidden",!0);var n=e.nextElementSibling;return _i(t,n)?n:ge(e,t)}var i=e.lastElementChild;return _i(t,i)?i:pe(e,t)}}(t,e.$el)},Q);},disconnected:function(){var e=this;Pt(this.$el)&&it(this.$el,"hidden",null),this.svg&&this.svg.then(function(t){return (!e._connected||t!==e.svgEl)&&we(t)},Q),this.svg=this.svgEl=null;},update:{read:function(){return !!(this.strokeAnimation&&this.svgEl&&Ht(this.svgEl))},write:function(){!function(t){var e=Ai(t);e&&t.style.setProperty("--uk-animation-stroke",e);}(this.svgEl);},type:["resize"]},methods:{getSvg:function(){var e=this;return function(n){if(Ti[n])return Ti[n];return Ti[n]=new ne(function(e,t){n?w(n,"data:")?e(decodeURIComponent(n.split(",")[1])):ae(n).then(function(t){return e(t.response)},function(){return t("SVG not found.")}):t();})}(this.src).then(function(t){return function(t,e){e&&b(t,"<symbol")&&(t=function(t,e){if(!Ci[t]){var n;for(Ci[t]={};n=Ei.exec(t);)Ci[t][n[3]]='<svg xmlns="http://www.w3.org/2000/svg"'+n[1]+"svg>";Ei.lastIndex=0;}return Ci[t][e]}(t,e)||t);return (t=Te(t.substr(t.indexOf("<svg"))))&&t.hasChildNodes()&&t}(t,e.icon)||ne.reject("SVG not found.")})},applyAttributes:function(n){var i=this;for(var t in this.$options.props)this[t]&&b(this.include,t)&&it(n,t,this[t]);for(var e in this.attributes){var r=this.attributes[e].split(":",2),o=r[0],s=r[1];it(n,o,s);}this.id||ot(n,"id");var a=["width","height"],h=[this.width,this.height];h.some(function(t){return t})||(h=a.map(function(t){return it(n,t)}));var c=it(n,"viewBox");c&&!h.some(function(t){return t})&&(h=c.split(" ").slice(2)),h.forEach(function(t,e){(t=(0|t)*i.ratio)&&it(n,a[e],t),t&&!h[1^e]&&ot(n,a[1^e]);}),it(n,"data-svg",this.icon||this.src);}}},Ti={};var Ei=/<symbol(.*?id=(['"])(.*?)\2[^]*?<\/)symbol>/g,Ci={};function Ai(t){return Math.ceil(Math.max.apply(Math,Ee("[stroke]",t).map(function(t){return t.getTotalLength&&t.getTotalLength()||0}).concat([0])))}function _i(t,e){return it(t,"data-svg")===it(e,"data-svg")}var Ni={},Mi={spinner:'<svg width="30" height="30" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"><circle fill="none" stroke="#000" cx="15" cy="15" r="14"/></svg>',totop:'<svg width="18" height="10" viewBox="0 0 18 10" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="1.2" points="1 9 9 1 17 9 "/></svg>',marker:'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="4" width="1" height="11"/><rect x="4" y="9" width="11" height="1"/></svg>',"close-icon":'<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><line fill="none" stroke="#000" stroke-width="1.1" x1="1" y1="1" x2="13" y2="13"/><line fill="none" stroke="#000" stroke-width="1.1" x1="13" y1="1" x2="1" y2="13"/></svg>',"close-large":'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><line fill="none" stroke="#000" stroke-width="1.4" x1="1" y1="1" x2="19" y2="19"/><line fill="none" stroke="#000" stroke-width="1.4" x1="19" y1="1" x2="1" y2="19"/></svg>',"navbar-toggle-icon":'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><rect y="9" width="20" height="2"/><rect y="3" width="20" height="2"/><rect y="15" width="20" height="2"/></svg>',"overlay-icon":'<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><rect x="19" y="0" width="1" height="40"/><rect x="0" y="19" width="40" height="1"/></svg>',"pagination-next":'<svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="1.2" points="1 1 6 6 1 11"/></svg>',"pagination-previous":'<svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="1.2" points="6 1 1 6 6 11"/></svg>',"search-icon":'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"/><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"/></svg>',"search-large":'<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><circle fill="none" stroke="#000" stroke-width="1.8" cx="17.5" cy="17.5" r="16.5"/><line fill="none" stroke="#000" stroke-width="1.8" x1="38" y1="39" x2="29" y2="30"/></svg>',"search-navbar":'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle fill="none" stroke="#000" stroke-width="1.1" cx="10.5" cy="10.5" r="9.5"/><line fill="none" stroke="#000" stroke-width="1.1" x1="23" y1="23" x2="17" y2="17"/></svg>',"slidenav-next":'<svg width="14px" height="24px" viewBox="0 0 14 24" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="1.4" points="1.225,23 12.775,12 1.225,1 "/></svg>',"slidenav-next-large":'<svg width="25px" height="40px" viewBox="0 0 25 40" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="2" points="4.002,38.547 22.527,20.024 4,1.5 "/></svg>',"slidenav-previous":'<svg width="14px" height="24px" viewBox="0 0 14 24" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="1.4" points="12.775,1 1.225,12 12.775,23 "/></svg>',"slidenav-previous-large":'<svg width="25px" height="40px" viewBox="0 0 25 40" xmlns="http://www.w3.org/2000/svg"><polyline fill="none" stroke="#000" stroke-width="2" points="20.527,1.5 2,20.024 20.525,38.547 "/></svg>'},Oi={install:function(r){r.icon.add=function(t,e){var n,i=O(t)?((n={})[t]=e,n):t;K(i,function(t,e){Mi[e]=t,delete Ni[e];}),r._initialized&&Se(document.body,function(t){return K(r.getComponents(t),function(t){t.$options.isIcon&&t.icon in i&&t.$reset();})});};},extends:Si,args:"icon",props:["icon"],data:{include:["focusable"]},isIcon:!0,beforeConnect:function(){Ae(this.$el,"uk-icon");},methods:{getSvg:function(){var t=function(t){if(!Mi[t])return null;Ni[t]||(Ni[t]=Te(Mi[t].trim()));return Ni[t].cloneNode(!0)}(function(t){return ht?q(q(t,"left","right"),"previous","next"):t}(this.icon));return t?ne.resolve(t):ne.reject("Icon not found.")}}},Di={args:!1,extends:Oi,data:function(t){return {icon:d(t.constructor.options.name)}},beforeConnect:function(){Ae(this.$el,this.$name);}},zi={extends:Di,beforeConnect:function(){Ae(this.$el,"uk-slidenav");},computed:{icon:function(t,e){var n=t.icon;return Oe(e,"uk-slidenav-large")?n+"-large":n}}},Bi={extends:Di,computed:{icon:function(t,e){var n=t.icon;return Oe(e,"uk-search-icon")&&Ot(e,".uk-search-large").length?"search-large":Ot(e,".uk-search-navbar").length?"search-navbar":n}}},Pi={extends:Di,computed:{icon:function(){return "close-"+(Oe(this.$el,"uk-close-large")?"large":"icon")}}},Hi={extends:Di,connected:function(){var e=this;this.svg.then(function(t){return 1!==e.ratio&&Le(Te("circle",t),"strokeWidth",1/e.ratio)},Q);}};var Li={args:"dataSrc",props:{dataSrc:String,dataSrcset:Boolean,sizes:String,width:Number,height:Number,offsetTop:String,offsetLeft:String,target:String},data:{dataSrc:"",dataSrcset:!1,sizes:!1,width:!1,height:!1,offsetTop:"50vh",offsetLeft:0,target:!1},computed:{cacheKey:function(t){var e=t.dataSrc;return this.$name+"."+e},width:function(t){var e=t.width,n=t.dataWidth;return e||n},height:function(t){var e=t.height,n=t.dataHeight;return e||n},sizes:function(t){var e=t.sizes,n=t.dataSizes;return e||n},isImg:function(t,e){return qi(e)},target:{get:function(t){var e=t.target;return [this.$el].concat(bt(e,this.$el))},watch:function(){this.observe();}},offsetTop:function(t){return wn(t.offsetTop,"height")},offsetLeft:function(t){return wn(t.offsetLeft,"width")}},connected:function(){Xi[this.cacheKey]?Fi(this.$el,Xi[this.cacheKey]||this.dataSrc,this.dataSrcset,this.sizes):this.isImg&&this.width&&this.height&&Fi(this.$el,function(t,e,n){var i;n&&(i=nt.ratio({width:t,height:e},"width",wn(Wi(n))),t=i.width,e=i.height);return 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'"></svg>'}(this.width,this.height,this.sizes)),this.observer=new Pn(this.load,{rootMargin:this.offsetTop+"px "+this.offsetLeft+"px"}),requestAnimationFrame(this.observe);},disconnected:function(){this.observer.disconnect();},update:{read:function(t){var e=this,n=t.image;if(n||"complete"!==document.readyState||this.load(this.observer.takeRecords()),this.isImg)return !1;n&&n.then(function(t){return t&&""!==t.currentSrc&&Fi(e.$el,Ui(t))});},write:function(t){if(this.dataSrcset&&1!==window.devicePixelRatio){var e=Le(this.$el,"backgroundSize");!e.match(/^(auto\s?)+$/)&&F(e)!==t.bgSize||(t.bgSize=function(t,e){var n=wn(Wi(e)),i=(t.match(Yi)||[]).map(F).sort(function(t,e){return t-e});return i.filter(function(t){return n<=t})[0]||i.pop()||""}(this.dataSrcset,this.sizes),Le(this.$el,"backgroundSize",t.bgSize+"px"));}},events:["resize"]},methods:{load:function(t){var e=this;t.some(function(t){return P(t.isIntersecting)||t.isIntersecting})&&(this._data.image=he(this.dataSrc,this.dataSrcset,this.sizes).then(function(t){return Fi(e.$el,Ui(t),t.srcset,t.sizes),Xi[e.cacheKey]=Ui(t),t},Q),this.observer.disconnect());},observe:function(){var e=this;!this._data.image&&this._connected&&this.target.forEach(function(t){return e.observer.observe(t)});}}};function Fi(t,e,n,i){if(qi(t))i&&(t.sizes=i),n&&(t.srcset=n),e&&(t.src=e);else if(e){!b(t.style.backgroundImage,e)&&(Le(t,"backgroundImage","url("+zt(e)+")"),qt(t,Ut("load",!1)));}}var ji=/\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;function Wi(t){var e,n;for(ji.lastIndex=0;e=ji.exec(t);)if(!e[1]||window.matchMedia(e[1]).matches){e=w(n=e[2],"calc")?n.substring(5,n.length-1).replace(Vi,function(t){return wn(t)}).replace(/ /g,"").match(Ri).reduce(function(t,e){return t+ +e},0):n;break}return e||"100vw"}var Vi=/\d+(?:\w+|%)/g,Ri=/[+-]?(\d+)/g;var Yi=/\s+\d+w\s*(?:,|$)/g;function qi(t){return "IMG"===t.tagName}function Ui(t){return t.currentSrc||t.src}var Xi,Ki="__test__";try{(Xi=window.sessionStorage||{})[Ki]=1,delete Xi[Ki];}catch(t){Xi={};}var Gi={props:{media:Boolean},data:{media:!1},computed:{matchMedia:function(){var t=function(t){if(O(t)){if("@"===t[0])t=F(Ve("breakpoint-"+t.substr(1)));else if(isNaN(t))return t}return !(!t||isNaN(t))&&"(min-width: "+t+"px)"}(this.media);return !t||window.matchMedia(t).matches}}};var Ji={mixins:[ei,Gi],props:{fill:String},data:{fill:"",clsWrapper:"uk-leader-fill",clsHide:"uk-leader-hide",attrFill:"data-fill"},computed:{fill:function(t){return t.fill||Ve("leader-fill-content")}},connected:function(){var t;t=ye(this.$el,'<span class="'+this.clsWrapper+'">'),this.wrapper=t[0];},disconnected:function(){xe(this.wrapper.childNodes);},update:{read:function(t){var e=t.changed,n=t.width,i=n;return {width:n=Math.floor(this.$el.offsetWidth/2),fill:this.fill,changed:e||i!==n,hide:!this.matchMedia}},write:function(t){De(this.wrapper,this.clsHide,t.hide),t.changed&&(t.changed=!1,it(this.wrapper,this.attrFill,new Array(t.width).join(t.fill)));},events:["resize"]}},Zi={props:{container:Boolean},data:{container:!0},computed:{container:function(t){var e=t.container;return !0===e&&this.$container||e&&Te(e)}}},Qi=[],tr={mixins:[ei,Zi,ni],props:{selPanel:String,selClose:String,escClose:Boolean,bgClose:Boolean,stack:Boolean},data:{cls:"uk-open",escClose:!0,bgClose:!0,overlay:!0,stack:!1},computed:{panel:function(t,e){return Te(t.selPanel,e)},transitionElement:function(){return this.panel},bgClose:function(t){return t.bgClose&&this.panel}},beforeDisconnect:function(){this.isToggled()&&this.toggleNow(this.$el,!1);},events:[{name:"click",delegate:function(){return this.selClose},handler:function(t){t.preventDefault(),this.hide();}},{name:"toggle",self:!0,handler:function(t){t.defaultPrevented||(t.preventDefault(),this.toggle());}},{name:"beforeshow",self:!0,handler:function(t){if(b(Qi,this))return !1;!this.stack&&Qi.length?(ne.all(Qi.map(function(t){return t.hide()})).then(this.show),t.preventDefault()):Qi.push(this);}},{name:"show",self:!0,handler:function(){var r=this;an(window)-an(document)&&this.overlay&&Le(document.body,"overflowY","scroll"),Ae(document.documentElement,this.clsPage),this.bgClose&&Yt(this.$el,"hide",li(document,"click",function(t){var e=t.defaultPrevented,n=t.target,i=X(Qi);e||i!==r||i.overlay&&!Wt(n,i.$el)||Wt(n,i.panel)||i.hide();}),{self:!0}),this.escClose&&Yt(this.$el,"hide",Vt(document,"keydown",function(t){var e=X(Qi);27===t.keyCode&&e===r&&(t.preventDefault(),e.hide());}),{self:!0});}},{name:"hidden",self:!0,handler:function(){var e=this;Qi.splice(Qi.indexOf(this),1),Qi.length||Le(document.body,"overflowY",""),Qi.some(function(t){return t.clsPage===e.clsPage})||_e(document.documentElement,this.clsPage);}}],methods:{toggle:function(){return this.isToggled()?this.hide():this.show()},show:function(){var e=this;return this.container&&this.$el.parentNode!==this.container?(pe(this.container,this.$el),new ne(function(t){return requestAnimationFrame(function(){return e.show().then(t)})})):this.toggleElement(this.$el,!0,er(this))},hide:function(){return this.toggleElement(this.$el,!1,er(this))}}};function er(t){var s=t.transitionElement,a=t._toggle;return function(r,o){return new ne(function(n,i){return Yt(r,"show hide",function(){r._reject&&r._reject(),r._reject=i,a(r,o);var t=Yt(s,"transitionstart",function(){Yt(s,"transitionend transitioncancel",n,{self:!0}),clearTimeout(e);},{self:!0}),e=setTimeout(function(){t(),n();},R(Le(s,"transitionDuration")));})})}}var nr={install:function(a){a.modal.dialog=function(t,e){var n=a.modal(' <div class="uk-modal"> <div class="uk-modal-dialog">'+t+"</div> </div> ",e);return n.show(),Vt(n.$el,"hidden",function(){return ne.resolve(function(){return n.$destroy(!0)})},{self:!0}),n},a.modal.alert=function(e,n){return n=U({bgClose:!1,escClose:!1,labels:a.modal.labels},n),new ne(function(t){return Vt(a.modal.dialog(' <div class="uk-modal-body">'+(O(e)?e:fe(e))+'</div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-primary uk-modal-close" autofocus>'+n.labels.ok+"</button> </div> ",n).$el,"hide",t)})},a.modal.confirm=function(r,o){return o=U({bgClose:!1,escClose:!0,labels:a.modal.labels},o),new ne(function(e,t){var n=a.modal.dialog(' <form> <div class="uk-modal-body">'+(O(r)?r:fe(r))+'</div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-default uk-modal-close" type="button">'+o.labels.cancel+'</button> <button class="uk-button uk-button-primary" autofocus>'+o.labels.ok+"</button> </div> </form> ",o),i=!1;Vt(n.$el,"submit","form",function(t){t.preventDefault(),e(),i=!0,n.hide();}),Vt(n.$el,"hide",function(){i||t();});})},a.modal.prompt=function(t,o,s){return s=U({bgClose:!1,escClose:!0,labels:a.modal.labels},s),new ne(function(e){var n=a.modal.dialog(' <form class="uk-form-stacked"> <div class="uk-modal-body"> <label>'+(O(t)?t:fe(t))+'</label> <input class="uk-input" autofocus> </div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-default uk-modal-close" type="button">'+s.labels.cancel+'</button> <button class="uk-button uk-button-primary">'+s.labels.ok+"</button> </div> </form> ",s),i=Te("input",n.$el);i.value=o;var r=!1;Vt(n.$el,"submit","form",function(t){t.preventDefault(),e(i.value),r=!0,n.hide();}),Vt(n.$el,"hide",function(){r||e(null);});})},a.modal.labels={ok:"Ok",cancel:"Cancel"};},mixins:[tr],data:{clsPage:"uk-modal-page",selPanel:".uk-modal-dialog",selClose:".uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full"},events:[{name:"show",self:!0,handler:function(){Oe(this.panel,"uk-margin-auto-vertical")?Ae(this.$el,"uk-flex"):Le(this.$el,"display","block"),sn(this.$el);}},{name:"hidden",self:!0,handler:function(){Le(this.$el,"display",""),_e(this.$el,"uk-flex");}}]};var ir={extends:ii,data:{targets:"> .uk-parent",toggle:"> a",content:"> ul"}},rr={mixins:[ei,bi],props:{dropdown:String,mode:"list",align:String,offset:Number,boundary:Boolean,boundaryAlign:Boolean,clsDrop:String,delayShow:Number,delayHide:Number,dropbar:Boolean,dropbarMode:String,dropbarAnchor:Boolean,duration:Number},data:{dropdown:".uk-navbar-nav > li",align:ht?"right":"left",clsDrop:"uk-navbar-dropdown",mode:void 0,offset:void 0,delayShow:void 0,delayHide:void 0,boundaryAlign:void 0,flip:"x",boundary:!0,dropbar:!1,dropbarMode:"slide",dropbarAnchor:!1,duration:200,forceHeight:!0,selMinHeight:".uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle"},computed:{boundary:function(t,e){var n=t.boundary,i=t.boundaryAlign;return !0===n||i?e:n},dropbarAnchor:function(t,e){return wt(t.dropbarAnchor,e)},pos:function(t){return "bottom-"+t.align},dropdowns:function(t,e){return Ee(t.dropdown+" ."+t.clsDrop,e)}},beforeConnect:function(){var t=this.$props.dropbar;this.dropbar=t&&(wt(t,this.$el)||Te("+ .uk-navbar-dropbar",this.$el)||Te("<div></div>")),this.dropbar&&(Ae(this.dropbar,"uk-navbar-dropbar"),"slide"===this.dropbarMode&&Ae(this.dropbar,"uk-navbar-dropbar-slide"));},disconnected:function(){this.dropbar&&we(this.dropbar);},update:function(){var e=this;this.$create("drop",this.dropdowns.filter(function(t){return !e.getDropdown(t)}),U({},this.$props,{boundary:this.boundary,pos:this.pos,offset:this.dropbar||this.offset}));},events:[{name:"mouseover",delegate:function(){return this.dropdown},handler:function(t){var e=t.current,n=this.getActive();n&&n.toggle&&!Wt(n.toggle.$el,e)&&!n.tracker.movesTo(n.$el)&&n.hide(!1);}},{name:"mouseleave",el:function(){return this.dropbar},handler:function(){var t=this.getActive();t&&!this.dropdowns.some(function(t){return _t(t,":hover")})&&t.hide();}},{name:"beforeshow",capture:!0,filter:function(){return this.dropbar},handler:function(){this.dropbar.parentNode||ge(this.dropbarAnchor||this.$el,this.dropbar);}},{name:"show",capture:!0,filter:function(){return this.dropbar},handler:function(t,e){var n=e.$el,i=e.dir;this.clsDrop&&Ae(n,this.clsDrop+"-dropbar"),"bottom"===i&&this.transitionTo(n.offsetHeight+F(Le(n,"marginTop"))+F(Le(n,"marginBottom")),n);}},{name:"beforehide",filter:function(){return this.dropbar},handler:function(t,e){var n=e.$el,i=this.getActive();_t(this.dropbar,":hover")&&i&&i.$el===n&&t.preventDefault();}},{name:"hide",filter:function(){return this.dropbar},handler:function(t,e){var n=e.$el,i=this.getActive();(!i||i&&i.$el===n)&&this.transitionTo(0);}}],methods:{getActive:function(){var t=this.dropdowns.map(this.getDropdown).filter(function(t){return t&&t.isActive()})[0];return t&&b(t.mode,"hover")&&Wt(t.toggle.$el,this.$el)&&t},transitionTo:function(t,e){var n=this,i=this.dropbar,r=Ht(i)?sn(i):0;return Le(e=r<t&&e,"clip","rect(0,"+e.offsetWidth+"px,"+r+"px,0)"),sn(i,r),Xe.cancel([e,i]),ne.all([Xe.start(i,{height:t},this.duration),Xe.start(e,{clip:"rect(0,"+e.offsetWidth+"px,"+t+"px,0)"},this.duration)]).catch(Q).then(function(){Le(e,{clip:""}),n.$update(i);})},getDropdown:function(t){return this.$getComponent(t,"drop")||this.$getComponent(t,"dropdown")}}},or={mixins:[tr],args:"mode",props:{mode:String,flip:Boolean,overlay:Boolean},data:{mode:"slide",flip:!1,overlay:!1,clsPage:"uk-offcanvas-page",clsContainer:"uk-offcanvas-container",selPanel:".uk-offcanvas-bar",clsFlip:"uk-offcanvas-flip",clsContainerAnimation:"uk-offcanvas-container-animation",clsSidebarAnimation:"uk-offcanvas-bar-animation",clsMode:"uk-offcanvas",clsOverlay:"uk-offcanvas-overlay",selClose:".uk-offcanvas-close",container:!1},computed:{clsFlip:function(t){var e=t.flip,n=t.clsFlip;return e?n:""},clsOverlay:function(t){var e=t.overlay,n=t.clsOverlay;return e?n:""},clsMode:function(t){var e=t.mode;return t.clsMode+"-"+e},clsSidebarAnimation:function(t){var e=t.mode,n=t.clsSidebarAnimation;return "none"===e||"reveal"===e?"":n},clsContainerAnimation:function(t){var e=t.mode,n=t.clsContainerAnimation;return "push"!==e&&"reveal"!==e?"":n},transitionElement:function(t){return "reveal"===t.mode?this.panel.parentNode:this.panel}},events:[{name:"click",delegate:function(){return 'a[href^="#"]'},handler:function(t){var e=t.current.hash;!t.defaultPrevented&&e&&Te(e,document.body)&&this.hide();}},{name:"touchstart",passive:!0,el:function(){return this.panel},handler:function(t){var e=t.targetTouches;1===e.length&&(this.clientY=e[0].clientY);}},{name:"touchmove",self:!0,passive:!1,filter:function(){return this.overlay},handler:function(t){t.cancelable&&t.preventDefault();}},{name:"touchmove",passive:!1,el:function(){return this.panel},handler:function(t){if(1===t.targetTouches.length){var e=event.targetTouches[0].clientY-this.clientY,n=this.panel,i=n.scrollTop,r=n.scrollHeight,o=n.clientHeight;(r<=o||0===i&&0<e||r-i<=o&&e<0)&&t.cancelable&&t.preventDefault();}}},{name:"show",self:!0,handler:function(){"reveal"!==this.mode||Oe(this.panel.parentNode,this.clsMode)||(be(this.panel,"<div>"),Ae(this.panel.parentNode,this.clsMode)),Le(document.documentElement,"overflowY",this.overlay?"hidden":""),Ae(document.body,this.clsContainer,this.clsFlip),Le(document.body,"touch-action","pan-y pinch-zoom"),Le(this.$el,"display","block"),Ae(this.$el,this.clsOverlay),Ae(this.panel,this.clsSidebarAnimation,"reveal"!==this.mode?this.clsMode:""),sn(document.body),Ae(document.body,this.clsContainerAnimation),this.clsContainerAnimation&&(sr().content+=",user-scalable=0");}},{name:"hide",self:!0,handler:function(){_e(document.body,this.clsContainerAnimation),Le(document.body,"touch-action","");}},{name:"hidden",self:!0,handler:function(){this.clsContainerAnimation&&function(){var t=sr();t.content=t.content.replace(/,user-scalable=0$/,"");}(),"reveal"===this.mode&&xe(this.panel),_e(this.panel,this.clsSidebarAnimation,this.clsMode),_e(this.$el,this.clsOverlay),Le(this.$el,"display",""),_e(document.body,this.clsContainer,this.clsFlip),Le(document.documentElement,"overflowY","");}},{name:"swipeLeft swipeRight",handler:function(t){this.isToggled()&&u(t.type,"Left")^this.flip&&this.hide();}}]};function sr(){return Te('meta[name="viewport"]',document.head)||pe(document.head,'<meta name="viewport">')}var ar={mixins:[ei],props:{selContainer:String,selContent:String},data:{selContainer:".uk-modal",selContent:".uk-modal-dialog"},computed:{container:function(t,e){return Mt(e,t.selContainer)},content:function(t,e){return Mt(e,t.selContent)}},connected:function(){Le(this.$el,"minHeight",150);},update:{read:function(){return !(!this.content||!this.container)&&{current:F(Le(this.$el,"maxHeight")),max:Math.max(150,sn(this.container)-(nn(this.content).height-sn(this.$el)))}},write:function(t){var e=t.current,n=t.max;Le(this.$el,"maxHeight",n),Math.round(e)!==Math.round(n)&&qt(this.$el,"resize");},events:["resize"]}},hr={props:["width","height"],connected:function(){Ae(this.$el,"uk-responsive-width");},update:{read:function(){return !!(Ht(this.$el)&&this.width&&this.height)&&{width:an(this.$el.parentNode),height:this.height}},write:function(t){sn(this.$el,nt.contain({height:this.height,width:this.width},t).height);},events:["resize"]}},cr={props:{duration:Number,offset:Number},data:{duration:1e3,offset:0},methods:{scrollTo:function(e){var n=this;e=e&&Te(e)||document.body;var t=sn(document),i=sn(window),r=nn(e).top-this.offset;if(t<r+i&&(r=t-i),qt(this.$el,"beforescroll",[this,e])){var o=Date.now(),s=window.pageYOffset,a=function(){var t=s+(r-s)*function(t){return .5*(1-Math.cos(Math.PI*t))}(Z((Date.now()-o)/n.duration));gn(window,t),t!==r?requestAnimationFrame(a):qt(n.$el,"scrolled",[n,e]);};a();}}},events:{click:function(t){t.defaultPrevented||(t.preventDefault(),this.scrollTo(zt(decodeURIComponent(this.$el.hash)).substr(1)));}}};var ur={args:"cls",props:{cls:String,target:String,hidden:Boolean,offsetTop:Number,offsetLeft:Number,repeat:Boolean,delay:Number},data:function(){return {cls:!1,target:!1,hidden:!0,offsetTop:0,offsetLeft:0,repeat:!1,delay:0,inViewClass:"uk-scrollspy-inview"}},computed:{elements:function(t,e){var n=t.target;return n?Ee(n,e):[e]}},update:[{write:function(){this.hidden&&Le(jt(this.elements,":not(."+this.inViewClass+")"),"visibility","hidden");}},{read:function(t){var n=this;t.update&&this.elements.forEach(function(t){var e=t._ukScrollspyState;(e=e||{cls:st(t,"uk-scrollspy-class")||n.cls}).show=pn(t,n.offsetTop,n.offsetLeft),t._ukScrollspyState=e;});},write:function(r){var o=this;if(!r.update)return this.$emit(),r.update=!0;this.elements.forEach(function(t){var n=t._ukScrollspyState,e=n.cls;if(!n.show||n.inview||n.queued){if(!n.show&&(n.inview||n.queued)&&o.repeat){if(n.abort&&n.abort(),!n.inview)return;Le(t,"visibility",o.hidden?"hidden":""),_e(t,o.inViewClass),De(t,e),qt(t,"outview"),o.$update(t),n.inview=!1;}}else{var i=function(){Le(t,"visibility",""),Ae(t,o.inViewClass),De(t,e),qt(t,"inview"),o.$update(t),n.inview=!0,n.abort&&n.abort();};o.delay?(n.queued=!0,r.promise=(r.promise||ne.resolve()).then(function(){return !n.inview&&new ne(function(t){var e=setTimeout(function(){i(),t();},r.promise||1===o.elements.length?o.delay:0);n.abort=function(){clearTimeout(e),t(),n.queued=!1;};})})):i();}});},events:["scroll","resize"]}]},lr={props:{cls:String,closest:String,scroll:Boolean,overflow:Boolean,offset:Number},data:{cls:"uk-active",closest:!1,scroll:!1,overflow:!0,offset:0},computed:{links:function(t,e){return Ee('a[href^="#"]',e).filter(function(t){return t.hash})},elements:function(t){var e=t.closest;return Mt(this.links,e||"*")},targets:function(){return Ee(this.links.map(function(t){return zt(t.hash).substr(1)}).join(","))}},update:[{read:function(){this.scroll&&this.$create("scroll",this.links,{offset:this.offset||0});}},{read:function(o){var s=this,a=window.pageYOffset+this.offset+1,h=sn(document)-sn(window)+this.offset;o.active=!1,this.targets.every(function(t,e){var n=nn(t).top,i=e+1===s.targets.length;if(!s.overflow&&(0===e&&a<n||i&&n+t.offsetTop<a))return !1;if(!i&&nn(s.targets[e+1]).top<=a)return !0;if(h<=a)for(var r=s.targets.length-1;e<r;r--)if(pn(s.targets[r])){t=s.targets[r];break}return !(o.active=Te(jt(s.links,'[href="#'+t.id+'"]')))});},write:function(t){var e=t.active;this.links.forEach(function(t){return t.blur()}),_e(this.elements,this.cls),e&&qt(this.$el,"active",[e,Ae(this.closest?Mt(e,this.closest):e,this.cls)]);},events:["scroll","resize"]}]},dr={mixins:[ei,Gi],props:{top:null,bottom:Boolean,offset:String,animation:String,clsActive:String,clsInactive:String,clsFixed:String,clsBelow:String,selTarget:String,widthElement:Boolean,showOnUp:Boolean,targetOffset:Number},data:{top:0,bottom:!1,offset:0,animation:"",clsActive:"uk-active",clsInactive:"",clsFixed:"uk-sticky-fixed",clsBelow:"uk-sticky-below",selTarget:"",widthElement:!1,showOnUp:!1,targetOffset:!1},computed:{offset:function(t){return wn(t.offset)},selTarget:function(t,e){var n=t.selTarget;return n&&Te(n,e)||e},widthElement:function(t,e){return wt(t.widthElement,e)||this.placeholder},isActive:{get:function(){return Oe(this.selTarget,this.clsActive)},set:function(t){t&&!this.isActive?(Me(this.selTarget,this.clsInactive,this.clsActive),qt(this.$el,"active")):t||Oe(this.selTarget,this.clsInactive)||(Me(this.selTarget,this.clsActive,this.clsInactive),qt(this.$el,"inactive"));}}},connected:function(){this.placeholder=Te("+ .uk-sticky-placeholder",this.$el)||Te('<div class="uk-sticky-placeholder"></div>'),this.isFixed=!1,this.isActive=!1;},disconnected:function(){this.isFixed&&(this.hide(),_e(this.selTarget,this.clsInactive)),we(this.placeholder),this.placeholder=null,this.widthElement=null;},events:[{name:"load hashchange popstate",el:window,handler:function(){var i=this;if(!1!==this.targetOffset&&location.hash&&0<window.pageYOffset){var r=Te(location.hash);r&&kn.read(function(){var t=nn(r).top,e=nn(i.$el).top,n=i.$el.offsetHeight;i.isFixed&&t<=e+n&&e<=t+r.offsetHeight&&gn(window,t-n-(z(i.targetOffset)?i.targetOffset:0)-i.offset);});}}}],update:[{read:function(t,e){var n=t.height;this.isActive&&"update"!==e&&(this.hide(),n=this.$el.offsetHeight,this.show()),n=this.isActive?n:this.$el.offsetHeight,this.topOffset=nn(this.isFixed?this.placeholder:this.$el).top,this.bottomOffset=this.topOffset+n;var i=fr("bottom",this);return this.top=Math.max(F(fr("top",this)),this.topOffset)-this.offset,this.bottom=i&&i-n,this.inactive=!this.matchMedia,{lastScroll:!1,height:n,margins:Le(this.$el,["marginTop","marginBottom","marginLeft","marginRight"])}},write:function(t){var e=t.height,n=t.margins,i=this.placeholder;Le(i,U({height:e},n)),Wt(i,document)||(ge(this.$el,i),it(i,"hidden","")),this.isActive=this.isActive;},events:["resize"]},{read:function(t){var e=t.scroll;return void 0===e&&(e=0),this.width=(Ht(this.widthElement)?this.widthElement:this.$el).offsetWidth,this.scroll=window.pageYOffset,{dir:e<=this.scroll?"down":"up",scroll:this.scroll,visible:Ht(this.$el),top:vn(this.placeholder)[0]}},write:function(t,e){var n=this,i=t.initTimestamp;void 0===i&&(i=0);var r=t.dir,o=t.lastDir,s=t.lastScroll,a=t.scroll,h=t.top,c=t.visible,u=performance.now();if(!((t.lastScroll=a)<0||a===s||!c||this.disabled||this.showOnUp&&"scroll"!==e||((300<u-i||r!==o)&&(t.initScroll=a,t.initTimestamp=u),t.lastDir=r,this.showOnUp&&Math.abs(t.initScroll-a)<=30&&Math.abs(s-a)<=10)))if(this.inactive||a<this.top||this.showOnUp&&(a<=this.top||"down"===r||"up"===r&&!this.isFixed&&a<=this.bottomOffset)){if(!this.isFixed)return void(Qe.inProgress(this.$el)&&a<h&&(Qe.cancel(this.$el),this.hide()));this.isFixed=!1,this.animation&&a>this.topOffset?(Qe.cancel(this.$el),Qe.out(this.$el,this.animation).then(function(){return n.hide()},Q)):this.hide();}else this.isFixed?this.update():this.animation?(Qe.cancel(this.$el),this.show(),Qe.in(this.$el,this.animation).catch(Q)):this.show();},events:["resize","scroll"]}],methods:{show:function(){this.isFixed=!0,this.update(),it(this.placeholder,"hidden",null);},hide:function(){this.isActive=!1,_e(this.$el,this.clsFixed,this.clsBelow),Le(this.$el,{position:"",top:"",width:""}),it(this.placeholder,"hidden","");},update:function(){var t=0!==this.top||this.scroll>this.top,e=Math.max(0,this.offset);this.bottom&&this.scroll>this.bottom-this.offset&&(e=this.bottom-this.scroll),Le(this.$el,{position:"fixed",top:e+"px",width:this.width}),this.isActive=t,De(this.$el,this.clsBelow,this.scroll>this.bottomOffset),Ae(this.$el,this.clsFixed);}}};function fr(t,e){var n=e.$props,i=e.$el,r=e[t+"Offset"],o=n[t];if(o)return z(o)&&O(o)&&o.match(/^-?\d/)?r+wn(o):nn(!0===o?i.parentNode:wt(o,i)).bottom}var pr,mr={mixins:[ni],args:"connect",props:{connect:String,toggle:String,active:Number,swiping:Boolean},data:{connect:"~.uk-switcher",toggle:"> * > :first-child",active:0,swiping:!0,cls:"uk-active",clsContainer:"uk-switcher",attrItem:"uk-switcher-item",queued:!0},computed:{connects:function(t,e){return bt(t.connect,e)},toggles:function(t,e){return Ee(t.toggle,e)}},events:[{name:"click",delegate:function(){return this.toggle+":not(.uk-disabled)"},handler:function(e){e.preventDefault(),this.show(W(this.$el.children).filter(function(t){return Wt(e.current,t)})[0]);}},{name:"click",el:function(){return this.connects},delegate:function(){return "["+this.attrItem+"],[data-"+this.attrItem+"]"},handler:function(t){t.preventDefault(),this.show(st(t.current,this.attrItem));}},{name:"swipeRight swipeLeft",filter:function(){return this.swiping},el:function(){return this.connects},handler:function(t){var e=t.type;this.show(u(e,"Left")?"next":"previous");}}],update:function(){var e=this;this.connects.forEach(function(t){return e.updateAria(t.children)});var t=this.$el.children;this.show(jt(t,"."+this.cls)[0]||t[this.active]||t[0]),this.swiping&&Le(this.connects,"touch-action","pan-y pinch-zoom");},methods:{index:function(){return !B(this.connects)&&ue(jt(this.connects[0].children,"."+this.cls)[0])},show:function(t){for(var e,n,i=this,r=this.$el.children,o=r.length,s=this.index(),a=0<=s,h="previous"===t?-1:1,c=le(t,r,s),u=0;u<o;u++,c=(c+h+o)%o)if(!_t(this.toggles[c],".uk-disabled *, .uk-disabled, [disabled]")){e=this.toggles[c],n=r[c];break}!n||0<=s&&Oe(n,this.cls)||s===c||(_e(r,this.cls),Ae(n,this.cls),it(this.toggles,"aria-expanded",!1),it(e,"aria-expanded",!0),this.connects.forEach(function(t){a?i.toggleElement([t.children[s],t.children[c]]):i.toggleNow(t.children[c]);}));}}},gr={mixins:[ei],extends:mr,props:{media:Boolean},data:{media:960,attrItem:"uk-tab-item"},connected:function(){var t=Oe(this.$el,"uk-tab-left")?"uk-tab-left":!!Oe(this.$el,"uk-tab-right")&&"uk-tab-right";t&&this.$create("toggle",this.$el,{cls:t,mode:"media",media:this.media});}},vr={mixins:[Gi,ni],args:"target",props:{href:String,target:null,mode:"list"},data:{href:!1,target:!1,mode:"click",queued:!0},computed:{target:function(t,e){var n=t.href,i=t.target;return (i=bt(i||n,e)).length&&i||[e]}},connected:function(){qt(this.target,"updatearia",[this]);},events:[{name:mt+" "+gt,filter:function(){return b(this.mode,"hover")},handler:function(t){Qt(t)||this.toggle("toggle"+(t.type===mt?"show":"hide"));}},{name:"click",filter:function(){return b(this.mode,"click")||lt&&b(this.mode,"hover")},handler:function(t){var e;(Mt(t.target,'a[href="#"], a[href=""]')||(e=Mt(t.target,"a[href]"))&&(this.cls||!Ht(this.target)||e.hash&&_t(this.target,e.hash)))&&t.preventDefault(),this.toggle();}}],update:{read:function(){return !(!b(this.mode,"media")||!this.media)&&{match:this.matchMedia}},write:function(t){var e=t.match,n=this.isToggled(this.target);(e?!n:n)&&this.toggle();},events:["resize"]},methods:{toggle:function(t){qt(this.target,t||"toggle",[this])&&this.toggleElement(this.target);}}};Ln.version="3.2.0",(pr=Ln).component("accordion",ii),pr.component("alert",ri),pr.component("cover",hi),pr.component("drop",ui),pr.component("dropdown",di),pr.component("formCustom",fi),pr.component("gif",pi),pr.component("grid",wi),pr.component("heightMatch",yi),pr.component("heightViewport",$i),pr.component("icon",Oi),pr.component("img",Li),pr.component("leader",Ji),pr.component("margin",mi),pr.component("modal",nr),pr.component("nav",ir),pr.component("navbar",rr),pr.component("offcanvas",or),pr.component("overflowAuto",ar),pr.component("responsive",hr),pr.component("scroll",cr),pr.component("scrollspy",ur),pr.component("scrollspyNav",lr),pr.component("sticky",dr),pr.component("svg",Si),pr.component("switcher",mr),pr.component("tab",gr),pr.component("toggle",vr),pr.component("video",ai),pr.component("close",Pi),pr.component("marker",Di),pr.component("navbarToggleIcon",Di),pr.component("overlayIcon",Di),pr.component("paginationNext",Di),pr.component("paginationPrevious",Di),pr.component("searchIcon",Bi),pr.component("slidenavNext",zi),pr.component("slidenavPrevious",zi),pr.component("spinner",Hi),pr.component("totop",Di),pr.use(oi);var wr={mixins:[ei],props:{date:String,clsWrapper:String},data:{date:"",clsWrapper:".uk-countdown-%unit%"},computed:{date:function(t){var e=t.date;return Date.parse(e)},days:function(t,e){return Te(t.clsWrapper.replace("%unit%","days"),e)},hours:function(t,e){return Te(t.clsWrapper.replace("%unit%","hours"),e)},minutes:function(t,e){return Te(t.clsWrapper.replace("%unit%","minutes"),e)},seconds:function(t,e){return Te(t.clsWrapper.replace("%unit%","seconds"),e)},units:function(){var e=this;return ["days","hours","minutes","seconds"].filter(function(t){return e[t]})}},connected:function(){this.start();},disconnected:function(){var e=this;this.stop(),this.units.forEach(function(t){return de(e[t])});},events:[{name:"visibilitychange",el:document,handler:function(){document.hidden?this.stop():this.start();}}],update:{write:function(){var i=this,r=function(t){var e=t-Date.now();return {total:e,seconds:e/1e3%60,minutes:e/1e3/60%60,hours:e/1e3/60/60%24,days:e/1e3/60/60/24}}(this.date);r.total<=0&&(this.stop(),r.days=r.hours=r.minutes=r.seconds=0),this.units.forEach(function(t){var e=String(Math.floor(r[t]));e=e.length<2?"0"+e:e;var n=i[t];n.textContent!==e&&((e=e.split("")).length!==n.children.length&&fe(n,e.map(function(){return "<span></span>"}).join("")),e.forEach(function(t,e){return n.children[e].textContent=t}));});}},methods:{start:function(){var t=this;this.stop(),this.date&&this.units.length&&(this.$emit(),this.timer=setInterval(function(){return t.$emit()},1e3));},stop:function(){this.timer&&(clearInterval(this.timer),this.timer=null);}}};var br,yr="uk-animation-target",xr={props:{animation:Number},data:{animation:150},computed:{target:function(){return this.$el}},methods:{animate:function(t){var i=this;!function(){if(br)return;(br=pe(document.head,"<style>").sheet).insertRule("."+yr+" > * {\n margin-top: 0 !important;\n transform: none !important;\n }",0);}();var r=W(this.target.children),o=r.map(function(t){return kr(t,!0)}),e=sn(this.target),n=window.pageYOffset;t(),Xe.cancel(this.target),r.forEach(Xe.cancel),$r(this.target),this.$update(this.target),kn.flush();var s=sn(this.target),a=(r=r.concat(W(this.target.children).filter(function(t){return !b(r,t)}))).map(function(t,e){return !!(t.parentNode&&e in o)&&(o[e]?Ht(t)?Ir(t):{opacity:0}:{opacity:Ht(t)?1:0})});return o=a.map(function(t,e){var n=r[e].parentNode===i.target&&(o[e]||kr(r[e]));if(n)if(t){if(!("opacity"in t)){n.opacity%1?t.opacity=1:delete n.opacity;}}else delete n.opacity;return n}),Ae(this.target,yr),r.forEach(function(t,e){return o[e]&&Le(t,o[e])}),Le(this.target,"height",e),gn(window,n),ne.all(r.map(function(t,e){return o[e]&&a[e]?Xe.start(t,a[e],i.animation,"ease"):ne.resolve()}).concat(Xe.start(this.target,{height:s},this.animation,"ease"))).then(function(){r.forEach(function(t,e){return Le(t,{display:0===a[e].opacity?"none":"",zIndex:""})}),$r(i.target),i.$update(i.target),kn.flush();},Q)}}};function kr(t,e){var n=Le(t,"zIndex");return !!Ht(t)&&U({display:"",opacity:e?Le(t,"opacity"):"0",pointerEvents:"none",position:"absolute",zIndex:"auto"===n?ue(t):n},Ir(t))}function $r(t){Le(t.children,{height:"",left:"",opacity:"",pointerEvents:"",position:"",top:"",width:""}),_e(t,yr),Le(t,"height","");}function Ir(t){var e=t.getBoundingClientRect(),n=e.height,i=e.width,r=on(t),o=r.top,s=r.left;return {top:o+=F(Le(t,"marginTop")),left:s,height:n,width:i}}var Sr={mixins:[xr],args:"target",props:{target:Boolean,selActive:Boolean},data:{target:null,selActive:!1,attrItem:"uk-filter-control",cls:"uk-active",animation:250},computed:{toggles:{get:function(t,e){t.attrItem;return Ee("["+this.attrItem+"],[data-"+this.attrItem+"]",e)},watch:function(){this.updateState();}},target:function(t,e){return Te(t.target,e)},children:{get:function(){return W(this.target&&this.target.children)},watch:function(t,e){!function(t,e){return t.length===e.length&&t.every(function(t){return ~e.indexOf(t)})}(t,e)&&this.updateState();}}},events:[{name:"click",delegate:function(){return "["+this.attrItem+"],[data-"+this.attrItem+"]"},handler:function(t){t.preventDefault(),this.apply(t.current);}}],connected:function(){var e=this;if(this.updateState(),!1!==this.selActive){var n=Ee(this.selActive,this.$el);this.toggles.forEach(function(t){return De(t,e.cls,b(n,t))});}},methods:{apply:function(t){this.setState(Er(t,this.attrItem,this.getState()));},getState:function(){var n=this;return this.toggles.filter(function(t){return Oe(t,n.cls)}).reduce(function(t,e){return Er(e,n.attrItem,t)},{filter:{"":""},sort:[]})},setState:function(o,t){var s=this;void 0===t&&(t=!0),o=U({filter:{"":""},sort:[]},o),qt(this.$el,"beforeFilter",[this,o]);var a=this.children;this.toggles.forEach(function(t){return De(t,s.cls,!!function(t,e,n){var i=n.filter;void 0===i&&(i={"":""});var r=n.sort,o=r[0],s=r[1],a=Tr(t,e),h=a.filter;void 0===h&&(h="");var c=a.group;void 0===c&&(c="");var u=a.sort,l=a.order;void 0===l&&(l="asc");return P(u)?c in i&&h===i[c]||!h&&c&&!(c in i)&&!i[""]:o===u&&s===l}(t,s.attrItem,o))});function e(){var e=function(t){var e=t.filter,n="";return K(e,function(t){return n+=t||""}),n}(o);a.forEach(function(t){return Le(t,"display",e&&!_t(t,e)?"none":"")});var t=o.sort,n=t[0],i=t[1];if(n){var r=function(t,n,i){return U([],t).sort(function(t,e){return st(t,n).localeCompare(st(e,n),void 0,{numeric:!0})*("asc"===i||-1)})}(a,n,i);Y(r,a)||r.forEach(function(t){return pe(s.target,t)});}}t?this.animate(e).then(function(){return qt(s.$el,"afterFilter",[s])}):(e(),qt(this.$el,"afterFilter",[this]));},updateState:function(){var t=this;kn.write(function(){return t.setState(t.getState(),!1)});}}};function Tr(t,e){return On(st(t,e),["filter"])}function Er(t,e,n){var i=Tr(t,e),r=i.filter,o=i.group,s=i.sort,a=i.order;return void 0===a&&(a="asc"),(r||P(s))&&(o?r?(delete n.filter[""],n.filter[o]=r):(delete n.filter[o],(B(n.filter)||""in n.filter)&&(n.filter={"":r||""})):n.filter={"":r||""}),P(s)||(n.sort=[s,a]),n}var Cr={slide:{show:function(t){return [{transform:_r(-100*t)},{transform:_r()}]},percent:function(t){return Ar(t)},translate:function(t,e){return [{transform:_r(-100*e*t)},{transform:_r(100*e*(1-t))}]}}};function Ar(t){return Math.abs(Le(t,"transform").split(",")[4]/t.offsetWidth)||0}function _r(t,e){return void 0===t&&(t=0),void 0===e&&(e="%"),t+=t?e:"",at?"translateX("+t+")":"translate3d("+t+", 0, 0)"}function Nr(t){return "scale3d("+t+", "+t+", 1)"}var Mr=U({},Cr,{fade:{show:function(){return [{opacity:0},{opacity:1}]},percent:function(t){return 1-Le(t,"opacity")},translate:function(t){return [{opacity:1-t},{opacity:t}]}},scale:{show:function(){return [{opacity:0,transform:Nr(.8)},{opacity:1,transform:Nr(1)}]},percent:function(t){return 1-Le(t,"opacity")},translate:function(t){return [{opacity:1-t,transform:Nr(1-.2*t)},{opacity:t,transform:Nr(.8+.2*t)}]}}});function Or(t,e,n){qt(t,Ut(e,!1,!1,n));}var Dr={mixins:[{props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected:function(){this.autoplay&&this.startAutoplay();},disconnected:function(){this.stopAutoplay();},update:function(){it(this.slides,"tabindex","-1");},events:[{name:"visibilitychange",el:document,filter:function(){return this.autoplay},handler:function(){document.hidden?this.stopAutoplay():this.startAutoplay();}}],methods:{startAutoplay:function(){var t=this;this.stopAutoplay(),this.interval=setInterval(function(){return (!t.draggable||!Te(":focus",t.$el))&&(!t.pauseOnHover||!_t(t.$el,":hover"))&&!t.stack.length&&t.show("next")},this.autoplayInterval);},stopAutoplay:function(){this.interval&&clearInterval(this.interval);}}},{props:{draggable:Boolean},data:{draggable:!0,threshold:10},created:function(){var i=this;["start","move","end"].forEach(function(t){var n=i[t];i[t]=function(t){var e=te(t).x*(ht?-1:1);i.prevPos=e!==i.pos?i.pos:i.prevPos,i.pos=e,n(t);};});},events:[{name:dt,delegate:function(){return this.selSlides},handler:function(t){!this.draggable||!Qt(t)&&function(t){return !t.children.length&&t.childNodes.length}(t.target)||0<t.button||this.length<2||this.start(t);}},{name:"touchmove",passive:!1,handler:"move",delegate:function(){return this.selSlides}},{name:"dragstart",handler:function(t){t.preventDefault();}}],methods:{start:function(){var t=this;this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.cancel(),this._transitioner.translate(this.percent),this.dragging=!0,this.stack=[]):this.prevIndex=this.index;var e="touchmove"!=ft?Vt(document,ft,this.move,{passive:!1}):Q;this.unbindMove=function(){e(),t.unbindMove=null;},Vt(window,"scroll",this.unbindMove),Vt(document,pt,this.end,!0),Le(this.list,"userSelect","none");},move:function(t){var e=this;if(this.unbindMove){var n=this.pos-this.drag;if(!(0==n||this.prevPos===this.pos||!this.dragging&&Math.abs(n)<this.threshold)){Le(this.list,"pointerEvents","none"),t.cancelable&&t.preventDefault(),this.dragging=!0,this.dir=n<0?1:-1;for(var i=this.slides,r=this.prevIndex,o=Math.abs(n),s=this.getIndex(r+this.dir,r),a=this._getDistance(r,s)||i[r].offsetWidth;s!==r&&a<o;)this.drag-=a*this.dir,r=s,o-=a,s=this.getIndex(r+this.dir,r),a=this._getDistance(r,s)||i[r].offsetWidth;this.percent=o/a;var h,c=i[r],u=i[s],l=this.index!==s,d=r===s;[this.index,this.prevIndex].filter(function(t){return !b([s,r],t)}).forEach(function(t){qt(i[t],"itemhidden",[e]),d&&(h=!0,e.prevIndex=r);}),(this.index===r&&this.prevIndex!==r||h)&&qt(i[this.index],"itemshown",[this]),l&&(this.prevIndex=r,this.index=s,d||qt(c,"beforeitemhide",[this]),qt(u,"beforeitemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),c,!d&&u),l&&(d||qt(c,"itemhide",[this]),qt(u,"itemshow",[this]));}}},end:function(){if(Rt(window,"scroll",this.unbindMove),this.unbindMove&&this.unbindMove(),Rt(document,pt,this.end,!0),this.dragging)if(this.dragging=null,this.index===this.prevIndex)this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null;else{var t=(ht?this.dir*(ht?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(0<this.dir&&!t||this.dir<0&&t?"next":"previous",!0);}Le(this.list,{userSelect:"",pointerEvents:""}),this.drag=this.percent=null;}}},{data:{selNav:!1},computed:{nav:function(t,e){return Te(t.selNav,e)},selNavItem:function(t){var e=t.attrItem;return "["+e+"],[data-"+e+"]"},navItems:function(t,e){return Ee(this.selNavItem,e)}},update:{write:function(){var n=this;this.nav&&this.length!==this.nav.children.length&&fe(this.nav,this.slides.map(function(t,e){return "<li "+n.attrItem+'="'+e+'"><a href="#"></a></li>'}).join("")),De(Ee(this.selNavItem,this.$el).concat(this.nav),"uk-hidden",!this.maxIndex),this.updateNav();},events:["resize"]},events:[{name:"click",delegate:function(){return this.selNavItem},handler:function(t){t.preventDefault(),this.show(st(t.current,this.attrItem));}},{name:"itemshow",handler:"updateNav"}],methods:{updateNav:function(){var n=this,i=this.getValidIndex();this.navItems.forEach(function(t){var e=st(t,n.attrItem);De(t,n.clsActive,L(e)===i),De(t,"uk-invisible",n.finite&&("previous"===e&&0===i||"next"===e&&i>=n.maxIndex));});}}}],props:{clsActivated:Boolean,easing:String,index:Number,finite:Boolean,velocity:Number},data:function(){return {easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:!1,Transitioner:!1,transitionOptions:{}}},connected:function(){this.prevIndex=-1,this.index=this.getValidIndex(this.index),this.stack=[];},disconnected:function(){_e(this.slides,this.clsActive);},computed:{duration:function(t,e){var n=t.velocity;return zr(e.offsetWidth/n)},list:function(t,e){return Te(t.selList,e)},maxIndex:function(){return this.length-1},selSlides:function(t){return t.selList+" > *"},slides:{get:function(){return W(this.list.children)},watch:function(){this.$reset();}},length:function(){return this.slides.length}},events:{itemshown:function(){this.$update(this.list);}},methods:{show:function(t,e){var n=this;if(void 0===e&&(e=!1),!this.dragging&&this.length){var i=this.stack,r=e?0:i.length,o=function(){i.splice(r,1),i.length&&n.show(i.shift(),!0);};if(i[e?"unshift":"push"](t),!e&&1<i.length)2===i.length&&this._transitioner.forward(Math.min(this.duration,200));else{var s=this.index,a=Oe(this.slides,this.clsActive)&&this.slides[s],h=this.getIndex(t,this.index),c=this.slides[h];if(a!==c){if(this.dir=function(t,e){return "next"===t?1:"previous"===t?-1:t<e?-1:1}(t,s),this.prevIndex=s,this.index=h,a&&qt(a,"beforeitemhide",[this]),!qt(c,"beforeitemshow",[this,a]))return this.index=this.prevIndex,void o();var u=this._show(a,c,e).then(function(){return a&&qt(a,"itemhidden",[n]),qt(c,"itemshown",[n]),new ne(function(t){kn.write(function(){i.shift(),i.length?n.show(i.shift(),!0):n._transitioner=null,t();});})});return a&&qt(a,"itemhide",[this]),qt(c,"itemshow",[this]),u}o();}}},getIndex:function(t,e){return void 0===t&&(t=this.index),void 0===e&&(e=this.index),Z(le(t,this.slides,e,this.finite),0,this.maxIndex)},getValidIndex:function(t,e){return void 0===t&&(t=this.index),void 0===e&&(e=this.prevIndex),this.getIndex(t,e)},_show:function(t,e,n){if(this._transitioner=this._getTransitioner(t,e,this.dir,U({easing:n?e.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing},this.transitionOptions)),!n&&!t)return this._transitioner.translate(1),ne.resolve();var i=this.stack.length;return this._transitioner[1<i?"forward":"show"](1<i?Math.min(this.duration,75+75/(i-1)):this.duration,this.percent)},_getDistance:function(t,e){return this._getTransitioner(t,t!==e&&e).getDistance()},_translate:function(t,e,n){void 0===e&&(e=this.prevIndex),void 0===n&&(n=this.index);var i=this._getTransitioner(e!==n&&e,n);return i.translate(t),i},_getTransitioner:function(t,e,n,i){return void 0===t&&(t=this.prevIndex),void 0===e&&(e=this.index),void 0===n&&(n=this.dir||1),void 0===i&&(i=this.transitionOptions),new this.Transitioner(D(t)?this.slides[t]:t,D(e)?this.slides[e]:e,n*(ht?-1:1),i)}}};function zr(t){return .5*t+300}var Br={mixins:[Dr],props:{animation:String},data:{animation:"slide",clsActivated:"uk-transition-active",Animations:Cr,Transitioner:function(o,s,a,t){var e=t.animation,h=t.easing,n=e.percent,i=e.translate,r=e.show;void 0===r&&(r=Q);var c=r(a),u=new ee;return {dir:a,show:function(t,e,n){var i=this;void 0===e&&(e=0);var r=n?"linear":h;return t-=Math.round(t*Z(e,-1,1)),this.translate(e),Or(s,"itemin",{percent:e,duration:t,timing:r,dir:a}),Or(o,"itemout",{percent:1-e,duration:t,timing:r,dir:a}),ne.all([Xe.start(s,c[1],t,r),Xe.start(o,c[0],t,r)]).then(function(){i.reset(),u.resolve();},Q),u.promise},stop:function(){return Xe.stop([s,o])},cancel:function(){Xe.cancel([s,o]);},reset:function(){for(var t in c[0])Le([s,o],t,"");},forward:function(t,e){return void 0===e&&(e=this.percent()),Xe.cancel([s,o]),this.show(t,e,!0)},translate:function(t){this.reset();var e=i(t,a);Le(s,e[1]),Le(o,e[0]),Or(s,"itemtranslatein",{percent:t,dir:a}),Or(o,"itemtranslateout",{percent:1-t,dir:a});},percent:function(){return n(o||s,s,a)},getDistance:function(){return o&&o.offsetWidth}}}},computed:{animation:function(t){var e=t.animation,n=t.Animations;return U(e in n?n[e]:n.slide,{name:e})},transitionOptions:function(){return {animation:this.animation}}},events:{"itemshow itemhide itemshown itemhidden":function(t){var e=t.target;this.$update(e);},beforeitemshow:function(t){Ae(t.target,this.clsActive);},itemshown:function(t){Ae(t.target,this.clsActivated);},itemhidden:function(t){_e(t.target,this.clsActive,this.clsActivated);}}},Pr={mixins:[Zi,tr,ni,Br],functional:!0,props:{delayControls:Number,preload:Number,videoAutoplay:Boolean,template:String},data:function(){return {preload:1,videoAutoplay:!1,delayControls:3e3,items:[],cls:"uk-open",clsPage:"uk-lightbox-page",selList:".uk-lightbox-items",attrItem:"uk-lightbox-item",selClose:".uk-close-large",selCaption:".uk-lightbox-caption",pauseOnHover:!1,velocity:2,Animations:Mr,template:'<div class="uk-lightbox uk-overflow-hidden"> <ul class="uk-lightbox-items"></ul> <div class="uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque"> <button class="uk-lightbox-toolbar-icon uk-close-large" type="button" uk-close></button> </div> <a class="uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade" href="#" uk-slidenav-previous uk-lightbox-item="previous"></a> <a class="uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade" href="#" uk-slidenav-next uk-lightbox-item="next"></a> <div class="uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div> </div>'}},created:function(){var t=Te(this.template),e=Te(this.selList,t);this.items.forEach(function(){return pe(e,"<li></li>")}),this.$mount(pe(this.container,t));},computed:{caption:function(t,e){t.selCaption;return Te(".uk-lightbox-caption",e)}},events:[{name:ft+" "+dt+" keydown",handler:"showControls"},{name:"click",self:!0,delegate:function(){return this.selSlides},handler:function(t){t.defaultPrevented||this.hide();}},{name:"shown",self:!0,handler:function(){this.showControls();}},{name:"hide",self:!0,handler:function(){this.hideControls(),_e(this.slides,this.clsActive),Xe.stop(this.slides);}},{name:"hidden",self:!0,handler:function(){this.$destroy(!0);}},{name:"keyup",el:document,handler:function(t){if(this.isToggled(this.$el))switch(t.keyCode){case 37:this.show("previous");break;case 39:this.show("next");}}},{name:"beforeitemshow",handler:function(t){this.isToggled()||(this.draggable=!1,t.preventDefault(),this.toggleNow(this.$el,!0),this.animation=Mr.scale,_e(t.target,this.clsActive),this.stack.splice(1,0,this.index));}},{name:"itemshow",handler:function(t){var e=ue(t.target),n=this.getItem(e).caption;Le(this.caption,"display",n?"":"none"),fe(this.caption,n);for(var i=0;i<=this.preload;i++)this.loadItem(this.getIndex(e+i)),this.loadItem(this.getIndex(e-i));}},{name:"itemshown",handler:function(){this.draggable=this.$props.draggable;}},{name:"itemload",handler:function(t,r){var o,s=this,e=r.source,n=r.type,i=r.alt;if(this.setItem(r,"<span uk-spinner></span>"),e)if("image"===n||e.match(/\.(jp(e)?g|png|gif|svg|webp)($|\?)/i))he(e).then(function(t){return s.setItem(r,'<img width="'+t.width+'" height="'+t.height+'" src="'+e+'" alt="'+(i||"")+'">')},function(){return s.setError(r)});else if("video"===n||e.match(/\.(mp4|webm|ogv)($|\?)/i)){var a=Te("<video controls playsinline"+(r.poster?' poster="'+r.poster+'"':"")+' uk-video="'+this.videoAutoplay+'"></video>');it(a,"src",e),Yt(a,"error loadedmetadata",function(t){"error"===t?s.setError(r):(it(a,{width:a.videoWidth,height:a.videoHeight}),s.setItem(r,a));});}else if("iframe"===n||e.match(/\.(html|php)($|\?)/i))this.setItem(r,'<iframe class="uk-lightbox-iframe" src="'+e+'" frameborder="0" allowfullscreen></iframe>');else if(o=e.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/watch\?v=([^&\s]+)/)||e.match(/()youtu\.be\/(.*)/)){var h=o[2],c=function(t,e){return void 0===t&&(t=640),void 0===e&&(e=450),s.setItem(r,Hr("https://www.youtube"+(o[1]||"")+".com/embed/"+h,t,e,s.videoAutoplay))};he("https://img.youtube.com/vi/"+h+"/maxresdefault.jpg").then(function(t){var e=t.width,n=t.height;120===e&&90===n?he("https://img.youtube.com/vi/"+h+"/0.jpg").then(function(t){var e=t.width,n=t.height;return c(e,n)},c):c(e,n);},c);}else(o=e.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/))&&ae("https://vimeo.com/api/oembed.json?maxwidth=1920&url="+encodeURI(e),{responseType:"json",withCredentials:!1}).then(function(t){var e=t.response,n=e.height,i=e.width;return s.setItem(r,Hr("https://player.vimeo.com/video/"+o[2],i,n,s.videoAutoplay))},function(){return s.setError(r)});}}],methods:{loadItem:function(t){void 0===t&&(t=this.index);var e=this.getItem(t);e.content||qt(this.$el,"itemload",[e]);},getItem:function(t){return void 0===t&&(t=this.index),this.items[t]||{}},setItem:function(t,e){U(t,{content:e});var n=fe(this.slides[this.items.indexOf(t)],e);qt(this.$el,"itemloaded",[this,n]),this.$update(n);},setError:function(t){this.setItem(t,'<span uk-icon="icon: bolt; ratio: 2"></span>');},showControls:function(){clearTimeout(this.controlsTimer),this.controlsTimer=setTimeout(this.hideControls,this.delayControls),Ae(this.$el,"uk-active","uk-transition-active");},hideControls:function(){_e(this.$el,"uk-active","uk-transition-active");}}};function Hr(t,e,n,i){return '<iframe src="'+t+'" width="'+e+'" height="'+n+'" style="max-width: 100%; box-sizing: border-box;" frameborder="0" allowfullscreen uk-video="autoplay: '+i+'" uk-responsive></iframe>'}var Lr,Fr={install:function(t,e){t.lightboxPanel||t.component("lightboxPanel",Pr);U(e.props,t.component("lightboxPanel").options.props);},props:{toggle:String},data:{toggle:"a"},computed:{toggles:{get:function(t,e){return Ee(t.toggle,e)},watch:function(){this.hide();}},items:function(){return J(this.toggles.map(jr),"source")}},disconnected:function(){this.hide();},events:[{name:"click",delegate:function(){return this.toggle+":not(.uk-disabled)"},handler:function(t){t.preventDefault();var e=st(t.current,"href");this.show(x(this.items,function(t){return t.source===e}));}}],methods:{show:function(t){var e=this;return this.panel=this.panel||this.$create("lightboxPanel",U({},this.$props,{items:this.items})),Vt(this.panel.$el,"hidden",function(){return e.panel=!1}),this.panel.show(t)},hide:function(){return this.panel&&this.panel.hide()}}};function jr(n){return ["href","caption","type","poster","alt"].reduce(function(t,e){return t["href"===e?"source":e]=st(n,e),t},{})}var Wr={},Vr={functional:!0,args:["message","status"],data:{message:"",status:"",timeout:5e3,group:null,pos:"top-center",clsClose:"uk-notification-close",clsMsg:"uk-notification-message"},install:function(r){r.notification.closeAll=function(n,i){Se(document.body,function(t){var e=r.getComponent(t,"notification");!e||n&&n!==e.group||e.close(i);});};},computed:{marginProp:function(t){return "margin"+(w(t.pos,"top")?"Top":"Bottom")},startProps:function(){var t;return (t={opacity:0})[this.marginProp]=-this.$el.offsetHeight,t}},created:function(){Wr[this.pos]||(Wr[this.pos]=pe(this.$container,'<div class="uk-notification uk-notification-'+this.pos+'"></div>'));var t=Le(Wr[this.pos],"display","block");this.$mount(pe(t,'<div class="'+this.clsMsg+(this.status?" "+this.clsMsg+"-"+this.status:"")+'"> <a href="#" class="'+this.clsClose+'" data-uk-close></a> <div>'+this.message+"</div> </div>"));},connected:function(){var t,e=this,n=F(Le(this.$el,this.marginProp));Xe.start(Le(this.$el,this.startProps),((t={opacity:1})[this.marginProp]=n,t)).then(function(){e.timeout&&(e.timer=setTimeout(e.close,e.timeout));});},events:(Lr={click:function(t){Mt(t.target,'a[href="#"],a[href=""]')&&t.preventDefault(),this.close();}},Lr[mt]=function(){this.timer&&clearTimeout(this.timer);},Lr[gt]=function(){this.timeout&&(this.timer=setTimeout(this.close,this.timeout));},Lr),methods:{close:function(t){function e(){qt(n.$el,"close",[n]),we(n.$el),Wr[n.pos].children.length||Le(Wr[n.pos],"display","none");}var n=this;this.timer&&clearTimeout(this.timer),t?e():Xe.start(this.$el,this.startProps).then(e);}}};var Rr=["x","y","bgx","bgy","rotate","scale","color","backgroundColor","borderColor","opacity","blur","hue","grayscale","invert","saturate","sepia","fopacity","stroke"],Yr={mixins:[Gi],props:Rr.reduce(function(t,e){return t[e]="list",t},{}),data:Rr.reduce(function(t,e){return t[e]=void 0,t},{}),computed:{props:function(m,g){var v=this;return Rr.reduce(function(t,e){if(P(m[e]))return t;var n,i,r,o=e.match(/color/i),s=o||"opacity"===e,a=m[e].slice(0);s&&Le(g,e,""),a.length<2&&a.unshift(("scale"===e?1:s?Le(g,e):0)||0);var h=function(t){return t.reduce(function(t,e){return O(e)&&e.replace(/-|\d/g,"").trim()||t},"")}(a);if(o){var c=g.style.color;a=a.map(function(t){return function(t,e){return Le(Le(t,"color",e),"color").split(/[(),]/g).slice(1,-1).concat(1).slice(0,4).map(F)}(g,t)}),g.style.color=c;}else if(w(e,"bg")){var u="bgy"===e?"height":"width";if(a=a.map(function(t){return wn(t,u,v.$el)}),Le(g,"background-position-"+e[2],""),i=Le(g,"backgroundPosition").split(" ")["x"===e[2]?0:1],v.covers){var l=Math.min.apply(Math,a),d=Math.max.apply(Math,a),f=a.indexOf(l)<a.indexOf(d);r=d-l,a=a.map(function(t){return t-(f?l:d)}),n=(f?-r:0)+"px";}else n=i;}else a=a.map(F);if("stroke"===e){if(!a.some(function(t){return t}))return t;var p=Ai(v.$el);Le(g,"strokeDasharray",p),"%"===h&&(a=a.map(function(t){return t*p/100})),a=a.reverse(),e="strokeDashoffset";}return t[e]={steps:a,unit:h,pos:n,bgPos:i,diff:r},t},{})},bgProps:function(){var e=this;return ["bgx","bgy"].filter(function(t){return t in e.props})},covers:function(t,e){return function(t){var e=t.style.backgroundSize,n="cover"===Le(Le(t,"backgroundSize",""),"backgroundSize");return t.style.backgroundSize=e,n}(e)}},disconnected:function(){delete this._image;},update:{read:function(t){var h=this;if(t.active=this.matchMedia,t.active){if(!t.image&&this.covers&&this.bgProps.length){var e=Le(this.$el,"backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/,"$1");if(e){var n=new Image;n.src=e,(t.image=n).naturalWidth||(n.onload=function(){return h.$emit()});}}var i=t.image;if(i&&i.naturalWidth){var c={width:this.$el.offsetWidth,height:this.$el.offsetHeight},u={width:i.naturalWidth,height:i.naturalHeight},l=nt.cover(u,c);this.bgProps.forEach(function(t){var e=h.props[t],n=e.diff,i=e.bgPos,r=e.steps,o="bgy"===t?"height":"width",s=l[o]-c[o];if(s<n)c[o]=l[o]+n-s;else if(n<s){var a=c[o]/wn(i,o,h.$el);a&&(h.props[t].steps=r.map(function(t){return t-(s-n)/a}));}l=nt.cover(u,c);}),t.dim=l;}}},write:function(t){var e=t.dim;t.active?e&&Le(this.$el,{backgroundSize:e.width+"px "+e.height+"px",backgroundRepeat:"no-repeat"}):Le(this.$el,{backgroundSize:"",backgroundRepeat:""});},events:["resize"]},methods:{reset:function(){var n=this;K(this.getCss(0),function(t,e){return Le(n.$el,e,"")});},getCss:function(l){var d=this.props;return Object.keys(d).reduce(function(t,e){var n=d[e],i=n.steps,r=n.unit,o=n.pos,s=function(t,e,n){void 0===n&&(n=2);var i=qr(t,e),r=i[0],o=i[1],s=i[2];return (D(r)?r+Math.abs(r-o)*s*(r<o?1:-1):+o).toFixed(n)}(i,l);switch(e){case"x":case"y":r=r||"px",t.transform+=" translate"+p(e)+"("+F(s).toFixed("px"===r?0:2)+r+")";break;case"rotate":r=r||"deg",t.transform+=" rotate("+(s+r)+")";break;case"scale":t.transform+=" scale("+s+")";break;case"bgy":case"bgx":t["background-position-"+e[2]]="calc("+o+" + "+s+"px)";break;case"color":case"backgroundColor":case"borderColor":var a=qr(i,l),h=a[0],c=a[1],u=a[2];t[e]="rgba("+h.map(function(t,e){return t+=u*(c[e]-t),3===e?F(t):parseInt(t,10)}).join(",")+")";break;case"blur":r=r||"px",t.filter+=" blur("+(s+r)+")";break;case"hue":r=r||"deg",t.filter+=" hue-rotate("+(s+r)+")";break;case"fopacity":r=r||"%",t.filter+=" opacity("+(s+r)+")";break;case"grayscale":case"invert":case"saturate":case"sepia":r=r||"%",t.filter+=" "+e+"("+(s+r)+")";break;default:t[e]=s;}return t},{transform:"",filter:""})}}};function qr(t,e){var n=t.length-1,i=Math.min(Math.floor(n*e),n-1),r=t.slice(i,i+2);return r.push(1===e?1:e%(1/n)*n),r}var Ur={mixins:[Yr],props:{target:String,viewport:Number,easing:Number},data:{target:!1,viewport:1,easing:1},computed:{target:function(t,e){var n=t.target;return function t(e){return e?"offsetTop"in e?e:t(e.parentNode):document.body}(n&&wt(n,e)||e)}},update:{read:function(t,e){var n=t.percent;if("scroll"!==e&&(n=!1),t.active){var i=n;return {percent:n=function(t,e){return Z(t*(1-(e-e*t)))}(mn(this.target)/(this.viewport||1),this.easing),style:i!==n&&this.getCss(n)}}},write:function(t){var e=t.style;t.active?e&&Le(this.$el,e):this.reset();},events:["scroll","resize"]}};var Xr={update:{write:function(){if(!this.stack.length&&!this.dragging){var t=this.getValidIndex(this.index);~this.prevIndex&&this.index===t||this.show(t);}},events:["resize"]}};function Kr(t,e,n){var i=Zr(t,e);return n?i-function(t,e){return Qr(e).width/2-Qr(t).width/2}(t,e):Math.min(i,Gr(e))}function Gr(t){return Math.max(0,Jr(t)-Qr(t).width)}function Jr(t){return eo(t).reduce(function(t,e){return Qr(e).width+t},0)}function Zr(t,e){return (on(t).left+(ht?Qr(t).width-Qr(e).width:0))*(ht?-1:1)}function Qr(t){return t.getBoundingClientRect()}function to(t,e,n){qt(t,Ut(e,!1,!1,n));}function eo(t){return W(t.children)}var no={mixins:[ei,Dr,Xr],props:{center:Boolean,sets:Boolean},data:{center:!1,sets:!1,attrItem:"uk-slider-item",selList:".uk-slider-items",selNav:".uk-slider-nav",clsContainer:"uk-slider-container",Transitioner:function(r,i,o,t){var e=t.center,s=t.easing,a=t.list,h=new ee,n=r?Kr(r,a,e):Kr(i,a,e)+Qr(i).width*o,c=i?Kr(i,a,e):n+Qr(r).width*o*(ht?-1:1);return {dir:o,show:function(t,e,n){void 0===e&&(e=0);var i=n?"linear":s;return t-=Math.round(t*Z(e,-1,1)),this.translate(e),r&&this.updateTranslates(),e=r?e:Z(e,0,1),to(this.getItemIn(),"itemin",{percent:e,duration:t,timing:i,dir:o}),r&&to(this.getItemIn(!0),"itemout",{percent:1-e,duration:t,timing:i,dir:o}),Xe.start(a,{transform:_r(-c*(ht?-1:1),"px")},t,i).then(h.resolve,Q),h.promise},stop:function(){return Xe.stop(a)},cancel:function(){Xe.cancel(a);},reset:function(){Le(a,"transform","");},forward:function(t,e){return void 0===e&&(e=this.percent()),Xe.cancel(a),this.show(t,e,!0)},translate:function(t){var e=this.getDistance()*o*(ht?-1:1);Le(a,"transform",_r(Z(e-e*t-c,-Jr(a),Qr(a).width)*(ht?-1:1),"px")),this.updateTranslates(),r&&(t=Z(t,-1,1),to(this.getItemIn(),"itemtranslatein",{percent:t,dir:o}),to(this.getItemIn(!0),"itemtranslateout",{percent:1-t,dir:o}));},percent:function(){return Math.abs((Le(a,"transform").split(",")[4]*(ht?-1:1)+n)/(c-n))},getDistance:function(){return Math.abs(c-n)},getItemIn:function(t){void 0===t&&(t=!1);var e=this.getActives(),n=G(eo(a),"offsetLeft"),i=ue(n,e[0<o*(t?-1:1)?e.length-1:0]);return ~i&&n[i+(r&&!t?o:0)]},getActives:function(){var n=Kr(r||i,a,e);return G(eo(a).filter(function(t){var e=Zr(t,a);return n<=e&&e+Qr(t).width<=Qr(a).width+n}),"offsetLeft")},updateTranslates:function(){var n=this.getActives();eo(a).forEach(function(t){var e=b(n,t);to(t,"itemtranslate"+(e?"in":"out"),{percent:e?1:0,dir:t.offsetLeft<=i.offsetLeft?1:-1});});}}}},computed:{avgWidth:function(){return Jr(this.list)/this.length},finite:function(t){return t.finite||Jr(this.list)<Qr(this.list).width+function(t){return eo(t).reduce(function(t,e){return Math.max(t,Qr(e).width)},0)}(this.list)+this.center},maxIndex:function(){if(!this.finite||this.center&&!this.sets)return this.length-1;if(this.center)return X(this.sets);Le(this.slides,"order","");for(var t=Gr(this.list),e=this.length;e--;)if(Zr(this.list.children[e],this.list)<t)return Math.min(e+1,this.length-1);return 0},sets:function(t){var o=this,e=t.sets,s=Qr(this.list).width/(this.center?2:1),a=0,h=s,c=0;return !B(e=e&&this.slides.reduce(function(t,e,n){var i=Qr(e).width;if(a<c+i&&(!o.center&&n>o.maxIndex&&(n=o.maxIndex),!b(t,n))){var r=o.slides[n+1];o.center&&r&&i<h-Qr(r).width/2?h-=i:(h=s,t.push(n),a=c+s+(o.center?i/2:0));}return c+=i,t},[]))&&e},transitionOptions:function(){return {center:this.center,list:this.list}}},connected:function(){De(this.$el,this.clsContainer,!Te("."+this.clsContainer,this.$el));},update:{write:function(){var n=this;Ee("["+this.attrItem+"],[data-"+this.attrItem+"]",this.$el).forEach(function(t){var e=st(t,n.attrItem);n.maxIndex&&De(t,"uk-hidden",z(e)&&(n.sets&&!b(n.sets,F(e))||e>n.maxIndex));}),this.dragging||this.stack.length||this._getTransitioner().translate(1);},events:["resize"]},events:{beforeitemshow:function(t){!this.dragging&&this.sets&&this.stack.length<2&&!b(this.sets,this.index)&&(this.index=this.getValidIndex());var e=Math.abs(this.index-this.prevIndex+(0<this.dir&&this.index<this.prevIndex||this.dir<0&&this.index>this.prevIndex?(this.maxIndex+1)*this.dir:0));if(!this.dragging&&1<e){for(var n=0;n<e;n++)this.stack.splice(1,0,0<this.dir?"next":"previous");t.preventDefault();}else this.duration=zr(this.avgWidth/this.velocity)*(Qr(this.dir<0||!this.slides[this.prevIndex]?this.slides[this.index]:this.slides[this.prevIndex]).width/this.avgWidth),this.reorder();},itemshow:function(){P(this.prevIndex)||Ae(this._getTransitioner().getItemIn(),this.clsActive);},itemshown:function(){var e=this,n=this._getTransitioner(this.index).getActives();this.slides.forEach(function(t){return De(t,e.clsActive,b(n,t))}),this.sets&&!b(this.sets,F(this.index))||this.slides.forEach(function(t){return De(t,e.clsActivated,b(n,t))});}},methods:{reorder:function(){var n=this;if(Le(this.slides,"order",""),!this.finite){var i=0<this.dir&&this.slides[this.prevIndex]?this.prevIndex:this.index;if(this.slides.forEach(function(t,e){return Le(t,"order",0<n.dir&&e<i?1:n.dir<0&&e>=n.index?-1:"")}),this.center)for(var t=this.slides[i],e=Qr(this.list).width/2-Qr(t).width/2,r=0;0<e;){var o=this.getIndex(--r+i,i),s=this.slides[o];Le(s,"order",i<o?-2:-1),e-=Qr(s).width;}}},getValidIndex:function(t,e){if(void 0===t&&(t=this.index),void 0===e&&(e=this.prevIndex),t=this.getIndex(t,e),!this.sets)return t;var n;do{if(b(this.sets,t))return t;n=t,t=this.getIndex(t+this.dir,e);}while(t!==n);return t}}},io={mixins:[Yr],data:{selItem:"!li"},computed:{item:function(t,e){return wt(t.selItem,e)}},events:[{name:"itemshown",self:!0,el:function(){return this.item},handler:function(){Le(this.$el,this.getCss(.5));}},{name:"itemin itemout",self:!0,el:function(){return this.item},handler:function(t){var e=t.type,n=t.detail,i=n.percent,r=n.duration,o=n.timing,s=n.dir;Xe.cancel(this.$el),Le(this.$el,this.getCss(oo(e,s,i))),Xe.start(this.$el,this.getCss(ro(e)?.5:0<s?1:0),r,o).catch(Q);}},{name:"transitioncanceled transitionend",self:!0,el:function(){return this.item},handler:function(){Xe.cancel(this.$el);}},{name:"itemtranslatein itemtranslateout",self:!0,el:function(){return this.item},handler:function(t){var e=t.type,n=t.detail,i=n.percent,r=n.dir;Xe.cancel(this.$el),Le(this.$el,this.getCss(oo(e,r,i)));}}]};function ro(t){return u(t,"in")}function oo(t,e,n){return n/=2,ro(t)?e<0?1-n:n:e<0?n:1-n}var so,ao=U({},Cr,{fade:{show:function(){return [{opacity:0,zIndex:0},{zIndex:-1}]},percent:function(t){return 1-Le(t,"opacity")},translate:function(t){return [{opacity:1-t,zIndex:0},{zIndex:-1}]}},scale:{show:function(){return [{opacity:0,transform:Nr(1.5),zIndex:0},{zIndex:-1}]},percent:function(t){return 1-Le(t,"opacity")},translate:function(t){return [{opacity:1-t,transform:Nr(1+.5*t),zIndex:0},{zIndex:-1}]}},pull:{show:function(t){return t<0?[{transform:_r(30),zIndex:-1},{transform:_r(),zIndex:0}]:[{transform:_r(-100),zIndex:0},{transform:_r(),zIndex:-1}]},percent:function(t,e,n){return n<0?1-Ar(e):Ar(t)},translate:function(t,e){return e<0?[{transform:_r(30*t),zIndex:-1},{transform:_r(-100*(1-t)),zIndex:0}]:[{transform:_r(100*-t),zIndex:0},{transform:_r(30*(1-t)),zIndex:-1}]}},push:{show:function(t){return t<0?[{transform:_r(100),zIndex:0},{transform:_r(),zIndex:-1}]:[{transform:_r(-30),zIndex:-1},{transform:_r(),zIndex:0}]},percent:function(t,e,n){return 0<n?1-Ar(e):Ar(t)},translate:function(t,e){return e<0?[{transform:_r(100*t),zIndex:0},{transform:_r(-30*(1-t)),zIndex:-1}]:[{transform:_r(-30*t),zIndex:-1},{transform:_r(100*(1-t)),zIndex:0}]}}}),ho={mixins:[ei,Br,Xr],props:{ratio:String,minHeight:Number,maxHeight:Number},data:{ratio:"16:9",minHeight:!1,maxHeight:!1,selList:".uk-slideshow-items",attrItem:"uk-slideshow-item",selNav:".uk-slideshow-nav",Animations:ao},update:{read:function(){var t=this.ratio.split(":").map(Number),e=t[0],n=t[1];return n=n*this.list.offsetWidth/e||0,this.minHeight&&(n=Math.max(this.minHeight,n)),this.maxHeight&&(n=Math.min(this.maxHeight,n)),{height:n-cn(this.list,"content-box")}},write:function(t){var e=t.height;0<e&&Le(this.list,"minHeight",e);},events:["resize"]}},co={mixins:[ei,xr],props:{group:String,threshold:Number,clsItem:String,clsPlaceholder:String,clsDrag:String,clsDragState:String,clsBase:String,clsNoDrag:String,clsEmpty:String,clsCustom:String,handle:String},data:{group:!1,threshold:5,clsItem:"uk-sortable-item",clsPlaceholder:"uk-sortable-placeholder",clsDrag:"uk-sortable-drag",clsDragState:"uk-drag",clsBase:"uk-sortable",clsNoDrag:"uk-sortable-nodrag",clsEmpty:"uk-sortable-empty",clsCustom:"",handle:!1},created:function(){var o=this;["init","start","move","end"].forEach(function(t){var r=o[t];o[t]=function(t){o.scrollY=window.pageYOffset;var e=te(t,"page"),n=e.x,i=e.y;o.pos={x:n,y:i},r(t);};});},events:{name:dt,passive:!1,handler:"init"},update:{write:function(){if(this.clsEmpty&&De(this.$el,this.clsEmpty,B(this.$el.children)),Le(this.handle?Ee(this.handle,this.$el):this.$el.children,{touchAction:"none",userSelect:"none"}),this.drag){var t=nn(window),e=t.right,n=t.bottom;nn(this.drag,{top:Z(this.pos.y+this.origin.top,0,n-this.drag.offsetHeight),left:Z(this.pos.x+this.origin.left,0,e-this.drag.offsetWidth)}),function s(t){var a=t.x;var h=t.y;clearTimeout(so);(e=document.elementFromPoint(a-window.pageXOffset,h-window.pageYOffset),n=fo(),function(t,e){var n=[];for(;e(t)&&n.unshift(t),t=t&&t.parentElement;);return n}(e,function(t){return t===n||lo.test(Le(t,"overflow"))})).some(function(t){var e=t.scrollTop,n=t.scrollHeight;fo()===t&&(t=window,n-=window.innerHeight);var i=nn(t),r=i.top,o=i.bottom;if(r<h&&h<r+30?e-=5:h<o&&o-20<h&&(e+=5),0<e&&e<n)return so=setTimeout(function(){gn(t,e),s({x:a,y:h});},10)});var e,n;}(this.pos);}}},methods:{init:function(t){var e=t.target,n=t.button,i=t.defaultPrevented,r=W(this.$el.children).filter(function(t){return Wt(e,t)})[0];!r||i||0<n||Ft(e)||Wt(e,"."+this.clsNoDrag)||this.handle&&!Wt(e,this.handle)||(t.preventDefault(),this.touched=[this],this.placeholder=r,this.origin=U({target:e,index:ue(r)},this.pos),Vt(document,ft,this.move),Vt(document,pt,this.end),Vt(window,"scroll",this.scroll),this.threshold||this.start(t));},start:function(t){this.drag=pe(this.$container,this.placeholder.outerHTML.replace(/^<li/i,"<div").replace(/li>$/i,"div>")),Le(this.drag,U({boxSizing:"border-box",width:this.placeholder.offsetWidth,height:this.placeholder.offsetHeight,overflow:"hidden"},Le(this.placeholder,["paddingLeft","paddingRight","paddingTop","paddingBottom"]))),it(this.drag,"uk-no-boot",""),Ae(this.drag,this.clsDrag,this.clsCustom),sn(this.drag.firstElementChild,sn(this.placeholder.firstElementChild));var e=nn(this.placeholder),n=e.left,i=e.top;U(this.origin,{left:n-this.pos.x,top:i-this.pos.y}),Ae(this.placeholder,this.clsPlaceholder),Ae(this.$el.children,this.clsItem),Ae(document.documentElement,this.clsDragState),qt(this.$el,"start",[this,this.placeholder]),this.move(t);},move:function(t){if(this.drag){this.$emit();var e="mousemove"===t.type?t.target:document.elementFromPoint(this.pos.x-window.pageXOffset,this.pos.y-window.pageYOffset),n=this.getSortable(e),i=this.getSortable(this.placeholder),r=n!==i;if(n&&!Wt(e,this.placeholder)&&(!r||n.group&&n.group===i.group)){if(e=n.$el===e.parentNode&&e||W(n.$el.children).filter(function(t){return Wt(e,t)})[0],r)i.remove(this.placeholder);else if(!e)return;n.insert(this.placeholder,e),b(this.touched,n)||this.touched.push(n);}}else(Math.abs(this.pos.x-this.origin.x)>this.threshold||Math.abs(this.pos.y-this.origin.y)>this.threshold)&&this.start(t);},end:function(t){if(Rt(document,ft,this.move),Rt(document,pt,this.end),Rt(window,"scroll",this.scroll),this.drag){clearTimeout(so);var e=this.getSortable(this.placeholder);this===e?this.origin.index!==ue(this.placeholder)&&qt(this.$el,"moved",[this,this.placeholder]):(qt(e.$el,"added",[e,this.placeholder]),qt(this.$el,"removed",[this,this.placeholder])),qt(this.$el,"stop",[this,this.placeholder]),we(this.drag),this.drag=null;var n=this.touched.map(function(t){return t.clsPlaceholder+" "+t.clsItem}).join(" ");this.touched.forEach(function(t){return _e(t.$el.children,n)}),_e(document.documentElement,this.clsDragState);}else"touchend"===t.type&&t.target.click();},scroll:function(){var t=window.pageYOffset;t!==this.scrollY&&(this.pos.y+=t-this.scrollY,this.scrollY=t,this.$emit());},insert:function(t,e){var n=this;Ae(this.$el.children,this.clsItem);function i(){e?!Wt(t,n.$el)||function(t,e){return t.parentNode===e.parentNode&&ue(t)>ue(e)}(t,e)?me(e,t):ge(e,t):pe(n.$el,t);}this.animation?this.animate(i):i();},remove:function(t){Wt(t,this.$el)&&(Le(this.handle?Ee(this.handle,t):t,{touchAction:"",userSelect:""}),this.animation?this.animate(function(){return we(t)}):we(t));},getSortable:function(t){return t&&(this.$getComponent(t,"sortable")||this.getSortable(t.parentNode))}}};var uo,lo=/auto|scroll/;function fo(){return document.scrollingElement||document.documentElement}var po,mo,go,vo=[],wo={mixins:[Zi,ni,ci],args:"title",props:{delay:Number,title:String},data:{pos:"top",title:"",delay:0,animation:["uk-animation-scale-up"],duration:100,cls:"uk-active",clsPos:"uk-tooltip"},beforeConnect:function(){this._hasTitle=rt(this.$el,"title"),it(this.$el,{title:"","aria-expanded":!1});},disconnected:function(){this.hide(),it(this.$el,{title:this._hasTitle?this.title:null,"aria-expanded":null});},methods:{show:function(){var e=this;!this.isActive()&&this.title&&(vo.forEach(function(t){return t.hide()}),vo.push(this),this._unbind=Vt(document,pt,function(t){return !Wt(t.target,e.$el)&&e.hide()}),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(){e._show(),e.hideTimer=setInterval(function(){Ht(e.$el)||e.hide();},150);},this.delay));},hide:function(){this.isActive()&&!_t(this.$el,"input:focus")&&(vo.splice(vo.indexOf(this),1),clearTimeout(this.showTimer),clearInterval(this.hideTimer),it(this.$el,"aria-expanded",!1),this.toggleElement(this.tooltip,!1),this.tooltip&&we(this.tooltip),this.tooltip=!1,this._unbind());},_show:function(){this.tooltip=pe(this.container,'<div class="'+this.clsPos+'" aria-expanded="true" aria-hidden> <div class="'+this.clsPos+'-inner">'+this.title+"</div> </div>"),this.positionAt(this.tooltip,this.$el),this.origin="y"===this.getAxis()?fn(this.dir)+"-"+this.align:this.align+"-"+fn(this.dir),this.toggleElement(this.tooltip,!0);},isActive:function(){return b(vo,this)}},events:(uo={focus:"show",blur:"hide"},uo[mt+" "+gt]=function(t){Qt(t)||(t.type===mt?this.show():this.hide());},uo[dt]=function(t){Qt(t)&&(this.isActive()?this.hide():this.show());},uo)},bo={props:{allow:String,clsDragover:String,concurrent:Number,maxSize:Number,method:String,mime:String,msgInvalidMime:String,msgInvalidName:String,msgInvalidSize:String,multiple:Boolean,name:String,params:Object,type:String,url:String},data:{allow:!1,clsDragover:"uk-dragover",concurrent:1,maxSize:0,method:"POST",mime:!1,msgInvalidMime:"Invalid File Type: %s",msgInvalidName:"Invalid File Name: %s",msgInvalidSize:"Invalid File Size: %s Kilobytes Max",multiple:!1,name:"files[]",params:{},type:"",url:"",abort:Q,beforeAll:Q,beforeSend:Q,complete:Q,completeAll:Q,error:Q,fail:Q,load:Q,loadEnd:Q,loadStart:Q,progress:Q},events:{change:function(t){_t(t.target,'input[type="file"]')&&(t.preventDefault(),t.target.files&&this.upload(t.target.files),t.target.value="");},drop:function(t){xo(t);var e=t.dataTransfer;e&&e.files&&(_e(this.$el,this.clsDragover),this.upload(e.files));},dragenter:function(t){xo(t);},dragover:function(t){xo(t),Ae(this.$el,this.clsDragover);},dragleave:function(t){xo(t),_e(this.$el,this.clsDragover);}},methods:{upload:function(t){var i=this;if(t.length){qt(this.$el,"upload",[t]);for(var e=0;e<t.length;e++){if(this.maxSize&&1e3*this.maxSize<t[e].size)return void this.fail(this.msgInvalidSize.replace("%s",this.maxSize));if(this.allow&&!yo(this.allow,t[e].name))return void this.fail(this.msgInvalidName.replace("%s",this.allow));if(this.mime&&!yo(this.mime,t[e].type))return void this.fail(this.msgInvalidMime.replace("%s",this.mime))}this.multiple||(t=[t[0]]),this.beforeAll(this,t);var r=function(t,e){for(var n=[],i=0;i<t.length;i+=e){for(var r=[],o=0;o<e;o++)r.push(t[i+o]);n.push(r);}return n}(t,this.concurrent),o=function(t){var e=new FormData;for(var n in t.forEach(function(t){return e.append(i.name,t)}),i.params)e.append(n,i.params[n]);ae(i.url,{data:e,method:i.method,responseType:i.type,beforeSend:function(t){var e=t.xhr;e.upload&&Vt(e.upload,"progress",i.progress),["loadStart","load","loadEnd","abort"].forEach(function(t){return Vt(e,t.toLowerCase(),i[t])}),i.beforeSend(t);}}).then(function(t){i.complete(t),r.length?o(r.shift()):i.completeAll(t);},function(t){return i.error(t)});};o(r.shift());}}}};function yo(t,e){return e.match(new RegExp("^"+t.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$","i"))}function xo(t){t.preventDefault(),t.stopPropagation();}function ko(){Io(document.body,mo),kn.flush(),new MutationObserver(function(t){return t.forEach($o)}).observe(document,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),po._initialized=!0;}function $o(t){var e=t.target;("attributes"!==t.type?function(t){for(var e=t.addedNodes,n=t.removedNodes,i=0;i<e.length;i++)Io(e[i],mo);for(var r=0;r<n.length;r++)Io(n[r],go);return !0}(t):function(t){var e=t.target,n=t.attributeName;if("href"===n)return !0;var i=Hn(n);if(!(i&&i in po))return;if(rt(e,n))return po[i](e),!0;var r=po.getComponent(e,i);if(r)return r.$destroy(),!0}(t))&&po.update(e);}function Io(t,e){if(1===t.nodeType&&!rt(t,"uk-no-boot"))for(e(t),t=t.firstElementChild;t;){var n=t.nextElementSibling;Io(t,e),t=n;}}return Ln.component("countdown",wr),Ln.component("filter",Sr),Ln.component("lightbox",Fr),Ln.component("lightboxPanel",Pr),Ln.component("notification",Vr),Ln.component("parallax",Ur),Ln.component("slider",no),Ln.component("sliderParallax",io),Ln.component("slideshow",ho),Ln.component("slideshowParallax",io),Ln.component("sortable",co),Ln.component("tooltip",wo),Ln.component("upload",bo),mo=(po=Ln).connect,go=po.disconnect,"MutationObserver"in window&&(document.body?kn.read(ko):new MutationObserver(function(){document.body&&(this.disconnect(),ko());}).observe(document,{childList:!0,subtree:!0})),Ln});
});
const app = new App({
target: document.getElementById("app")
});
}());
//# sourceMappingURL=bundle.js.map