Files
ui-development-kit/out/renderer/client/_app/immutable/chunks/scheduler.fBTsnP2i.js

837 lines
22 KiB
JavaScript

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
function noop() {
}
const identity = (x) => x;
function assign(tar, src) {
for (const k in src)
tar[k] = src[k];
return (
/** @type {T & S} */
tar
);
}
function is_promise(value) {
return !!value && (typeof value === "object" || typeof value === "function") && typeof /** @type {any} */
value.then === "function";
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
}
let src_url_equal_anchor;
function src_url_equal(element_src, url) {
if (element_src === url)
return true;
if (!src_url_equal_anchor) {
src_url_equal_anchor = document.createElement("a");
}
src_url_equal_anchor.href = url;
return element_src === src_url_equal_anchor.href;
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function subscribe(store, ...callbacks) {
if (store == null) {
for (const callback of callbacks) {
callback(void 0);
}
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function get_store_value(store) {
let value;
subscribe(store, (_) => value = _)();
return value;
}
function component_subscribe(component, store, callback) {
component.$$.on_destroy.push(subscribe(store, callback));
}
function create_slot(definition, ctx, $$scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, $$scope, fn) {
return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;
}
function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($$scope.dirty === void 0) {
return lets;
}
if (typeof lets === "object") {
const merged = [];
const len = Math.max($$scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $$scope.dirty[i] | lets[i];
}
return merged;
}
return $$scope.dirty | lets;
}
return $$scope.dirty;
}
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
function get_all_dirty_from_scope($$scope) {
if ($$scope.ctx.length > 32) {
const dirty = [];
const length = $$scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
function exclude_internal_props(props) {
const result = {};
for (const k in props)
if (k[0] !== "$")
result[k] = props[k];
return result;
}
function compute_rest_props(props, keys) {
const rest = {};
keys = new Set(keys);
for (const k in props)
if (!keys.has(k) && k[0] !== "$")
rest[k] = props[k];
return rest;
}
function compute_slots(slots) {
const result = {};
for (const key in slots) {
result[key] = true;
}
return result;
}
function set_store_value(store, ret, value) {
store.set(value);
return ret;
}
function action_destroyer(action_result) {
return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
}
function split_css_unit(value) {
const split = typeof value === "string" && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
return split ? [parseFloat(split[1]), split[2] || "px"] : [
/** @type {number} */
value,
"px"
];
}
let is_hydrating = false;
function start_hydrating() {
is_hydrating = true;
}
function end_hydrating() {
is_hydrating = false;
}
function upper_bound(low, high, key, value) {
while (low < high) {
const mid = low + (high - low >> 1);
if (key(mid) <= value) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
}
function init_hydrate(target) {
if (target.hydrate_init)
return;
target.hydrate_init = true;
let children2 = (
/** @type {ArrayLike<NodeEx2>} */
target.childNodes
);
if (target.nodeName === "HEAD") {
const my_children = [];
for (let i = 0; i < children2.length; i++) {
const node = children2[i];
if (node.claim_order !== void 0) {
my_children.push(node);
}
}
children2 = my_children;
}
const m = new Int32Array(children2.length + 1);
const p = new Int32Array(children2.length);
m[0] = -1;
let longest = 0;
for (let i = 0; i < children2.length; i++) {
const current = children2[i].claim_order;
const seq_len = (longest > 0 && children2[m[longest]].claim_order <= current ? longest + 1 : upper_bound(1, longest, (idx) => children2[m[idx]].claim_order, current)) - 1;
p[i] = m[seq_len] + 1;
const new_len = seq_len + 1;
m[new_len] = i;
longest = Math.max(new_len, longest);
}
const lis = [];
const to_move = [];
let last = children2.length - 1;
for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {
lis.push(children2[cur - 1]);
for (; last >= cur; last--) {
to_move.push(children2[last]);
}
last--;
}
for (; last >= 0; last--) {
to_move.push(children2[last]);
}
lis.reverse();
to_move.sort((a, b) => a.claim_order - b.claim_order);
for (let i = 0, j = 0; i < to_move.length; i++) {
while (j < lis.length && to_move[i].claim_order >= lis[j].claim_order) {
j++;
}
const anchor = j < lis.length ? lis[j] : null;
target.insertBefore(to_move[i], anchor);
}
}
function append(target, node) {
target.appendChild(node);
}
function get_root_for_style(node) {
if (!node)
return document;
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
if (root && /** @type {ShadowRoot} */
root.host) {
return (
/** @type {ShadowRoot} */
root
);
}
return node.ownerDocument;
}
function append_empty_stylesheet(node) {
const style_element = element("style");
style_element.textContent = "/* empty */";
append_stylesheet(get_root_for_style(node), style_element);
return style_element.sheet;
}
function append_stylesheet(node, style) {
append(
/** @type {Document} */
node.head || node,
style
);
return style.sheet;
}
function append_hydration(target, node) {
if (is_hydrating) {
init_hydrate(target);
if (target.actual_end_child === void 0 || target.actual_end_child !== null && target.actual_end_child.parentNode !== target) {
target.actual_end_child = target.firstChild;
}
while (target.actual_end_child !== null && target.actual_end_child.claim_order === void 0) {
target.actual_end_child = target.actual_end_child.nextSibling;
}
if (node !== target.actual_end_child) {
if (node.claim_order !== void 0 || node.parentNode !== target) {
target.insertBefore(node, target.actual_end_child);
}
} else {
target.actual_end_child = node.nextSibling;
}
} else if (node.parentNode !== target || node.nextSibling !== null) {
target.appendChild(node);
}
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function insert_hydration(target, node, anchor) {
if (is_hydrating && !anchor) {
append_hydration(target, node);
} else if (node.parentNode !== target || node.nextSibling != anchor) {
target.insertBefore(node, anchor || null);
}
}
function detach(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i])
iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function svg_element(name) {
return document.createElementNS("http://www.w3.org/2000/svg", name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(" ");
}
function empty() {
return text("");
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
if (value == null)
node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value)
node.setAttribute(attribute, value);
}
const always_set_through_set_attribute = ["width", "height"];
function set_attributes(node, attributes) {
const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
for (const key in attributes) {
if (attributes[key] == null) {
node.removeAttribute(key);
} else if (key === "style") {
node.style.cssText = attributes[key];
} else if (key === "__value") {
node.value = node[key] = attributes[key];
} else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
node[key] = attributes[key];
} else {
attr(node, key, attributes[key]);
}
}
}
function get_svelte_dataset(node) {
return node.dataset.svelteH;
}
function children(element2) {
return Array.from(element2.childNodes);
}
function init_claim_info(nodes) {
if (nodes.claim_info === void 0) {
nodes.claim_info = { last_index: 0, total_claimed: 0 };
}
}
function claim_node(nodes, predicate, process_node, create_node, dont_update_last_index = false) {
init_claim_info(nodes);
const result_node = (() => {
for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
const node = nodes[i];
if (predicate(node)) {
const replacement = process_node(node);
if (replacement === void 0) {
nodes.splice(i, 1);
} else {
nodes[i] = replacement;
}
if (!dont_update_last_index) {
nodes.claim_info.last_index = i;
}
return node;
}
}
for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
const node = nodes[i];
if (predicate(node)) {
const replacement = process_node(node);
if (replacement === void 0) {
nodes.splice(i, 1);
} else {
nodes[i] = replacement;
}
if (!dont_update_last_index) {
nodes.claim_info.last_index = i;
} else if (replacement === void 0) {
nodes.claim_info.last_index--;
}
return node;
}
}
return create_node();
})();
result_node.claim_order = nodes.claim_info.total_claimed;
nodes.claim_info.total_claimed += 1;
return result_node;
}
function claim_element_base(nodes, name, attributes, create_element) {
return claim_node(
nodes,
/** @returns {node is Element | SVGElement} */
(node) => node.nodeName === name,
/** @param {Element} node */
(node) => {
const remove = [];
for (let j = 0; j < node.attributes.length; j++) {
const attribute = node.attributes[j];
if (!attributes[attribute.name]) {
remove.push(attribute.name);
}
}
remove.forEach((v) => node.removeAttribute(v));
return void 0;
},
() => create_element(name)
);
}
function claim_element(nodes, name, attributes) {
return claim_element_base(nodes, name, attributes, element);
}
function claim_svg_element(nodes, name, attributes) {
return claim_element_base(nodes, name, attributes, svg_element);
}
function claim_text(nodes, data) {
return claim_node(
nodes,
/** @returns {node is Text} */
(node) => node.nodeType === 3,
/** @param {Text} node */
(node) => {
const data_str = "" + data;
if (node.data.startsWith(data_str)) {
if (node.data.length !== data_str.length) {
return node.splitText(data_str.length);
}
} else {
node.data = data_str;
}
},
() => text(data),
true
// Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements
);
}
function claim_space(nodes) {
return claim_text(nodes, " ");
}
function get_comment_idx(nodes, text2, start) {
for (let i = start; i < nodes.length; i += 1) {
const node = nodes[i];
if (node.nodeType === 8 && node.textContent.trim() === text2) {
return i;
}
}
return -1;
}
function claim_html_tag(nodes, is_svg) {
const start_index = get_comment_idx(nodes, "HTML_TAG_START", 0);
const end_index = get_comment_idx(nodes, "HTML_TAG_END", start_index + 1);
if (start_index === -1 || end_index === -1) {
return new HtmlTagHydration(is_svg);
}
init_claim_info(nodes);
const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);
detach(html_tag_nodes[0]);
detach(html_tag_nodes[html_tag_nodes.length - 1]);
const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);
if (claimed_nodes.length === 0) {
return new HtmlTagHydration(is_svg);
}
for (const n of claimed_nodes) {
n.claim_order = nodes.claim_info.total_claimed;
nodes.claim_info.total_claimed += 1;
}
return new HtmlTagHydration(is_svg, claimed_nodes);
}
function set_data(text2, data) {
data = "" + data;
if (text2.data === data)
return;
text2.data = /** @type {string} */
data;
}
function set_input_value(input, value) {
input.value = value == null ? "" : value;
}
function set_style(node, key, value, important) {
if (value == null) {
node.style.removeProperty(key);
} else {
node.style.setProperty(key, value, important ? "important" : "");
}
}
function select_option(select, value, mounting) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
if (option.__value === value) {
option.selected = true;
return;
}
}
if (!mounting || value !== void 0) {
select.selectedIndex = -1;
}
}
function select_value(select) {
const selected_option = select.querySelector(":checked");
return selected_option && selected_option.__value;
}
function toggle_class(element2, name, toggle) {
element2.classList.toggle(name, !!toggle);
}
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
return new CustomEvent(type, { detail, bubbles, cancelable });
}
function head_selector(nodeId, head) {
const result = [];
let started = 0;
for (const node of head.childNodes) {
if (node.nodeType === 8) {
const comment = node.textContent.trim();
if (comment === `HEAD_${nodeId}_END`) {
started -= 1;
result.push(node);
} else if (comment === `HEAD_${nodeId}_START`) {
started += 1;
result.push(node);
}
} else if (started > 0) {
result.push(node);
}
}
return result;
}
class HtmlTag {
constructor(is_svg = false) {
/**
* @private
* @default false
*/
__publicField(this, "is_svg", false);
/** parent for creating node */
__publicField(this, "e");
/** html tag nodes */
__publicField(this, "n");
/** target */
__publicField(this, "t");
/** anchor */
__publicField(this, "a");
this.is_svg = is_svg;
this.e = this.n = null;
}
/**
* @param {string} html
* @returns {void}
*/
c(html) {
this.h(html);
}
/**
* @param {string} html
* @param {HTMLElement | SVGElement} target
* @param {HTMLElement | SVGElement} anchor
* @returns {void}
*/
m(html, target, anchor = null) {
if (!this.e) {
if (this.is_svg)
this.e = svg_element(
/** @type {keyof SVGElementTagNameMap} */
target.nodeName
);
else
this.e = element(
/** @type {keyof HTMLElementTagNameMap} */
target.nodeType === 11 ? "TEMPLATE" : target.nodeName
);
this.t = target.tagName !== "TEMPLATE" ? target : (
/** @type {HTMLTemplateElement} */
target.content
);
this.c(html);
}
this.i(anchor);
}
/**
* @param {string} html
* @returns {void}
*/
h(html) {
this.e.innerHTML = html;
this.n = Array.from(
this.e.nodeName === "TEMPLATE" ? this.e.content.childNodes : this.e.childNodes
);
}
/**
* @returns {void} */
i(anchor) {
for (let i = 0; i < this.n.length; i += 1) {
insert(this.t, this.n[i], anchor);
}
}
/**
* @param {string} html
* @returns {void}
*/
p(html) {
this.d();
this.h(html);
this.i(this.a);
}
/**
* @returns {void} */
d() {
this.n.forEach(detach);
}
}
class HtmlTagHydration extends HtmlTag {
constructor(is_svg = false, claimed_nodes) {
super(is_svg);
/** @type {Element[]} hydration claimed nodes */
__publicField(this, "l");
this.e = this.n = null;
this.l = claimed_nodes;
}
/**
* @param {string} html
* @returns {void}
*/
c(html) {
if (this.l) {
this.n = this.l;
} else {
super.c(html);
}
}
/**
* @returns {void} */
i(anchor) {
for (let i = 0; i < this.n.length; i += 1) {
insert_hydration(this.t, this.n[i], anchor);
}
}
}
function construct_svelte_component(component, props) {
return new component(props);
}
let current_component;
function set_current_component(component) {
current_component = component;
}
function get_current_component() {
if (!current_component)
throw new Error("Function called outside component initialization");
return current_component;
}
function onMount(fn) {
get_current_component().$$.on_mount.push(fn);
}
function afterUpdate(fn) {
get_current_component().$$.after_update.push(fn);
}
function createEventDispatcher() {
const component = get_current_component();
return (type, detail, { cancelable = false } = {}) => {
const callbacks = component.$$.callbacks[type];
if (callbacks) {
const event = custom_event(
/** @type {string} */
type,
detail,
{ cancelable }
);
callbacks.slice().forEach((fn) => {
fn.call(component, event);
});
return !event.defaultPrevented;
}
return true;
};
}
function setContext(key, context) {
get_current_component().$$.context.set(key, context);
return context;
}
function getContext(key) {
return get_current_component().$$.context.get(key);
}
function bubble(component, event) {
const callbacks = component.$$.callbacks[event.type];
if (callbacks) {
callbacks.slice().forEach((fn) => fn.call(this, event));
}
}
const dirty_components = [];
const binding_callbacks = [];
let render_callbacks = [];
const flush_callbacks = [];
const resolved_promise = /* @__PURE__ */ Promise.resolve();
let update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function tick() {
schedule_update();
return resolved_promise;
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
function add_flush_callback(fn) {
flush_callbacks.push(fn);
}
const seen_callbacks = /* @__PURE__ */ new Set();
let flushidx = 0;
function flush() {
if (flushidx !== 0) {
return;
}
const saved_component = current_component;
do {
try {
while (flushidx < dirty_components.length) {
const component = dirty_components[flushidx];
flushidx++;
set_current_component(component);
update(component.$$);
}
} catch (e) {
dirty_components.length = 0;
flushidx = 0;
throw e;
}
set_current_component(null);
dirty_components.length = 0;
flushidx = 0;
while (binding_callbacks.length)
binding_callbacks.pop()();
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
seen_callbacks.clear();
set_current_component(saved_component);
}
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
function flush_render_callbacks(fns) {
const filtered = [];
const targets = [];
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
targets.forEach((c) => c());
render_callbacks = filtered;
}
export {
get_store_value as $,
toggle_class as A,
binding_callbacks as B,
getContext as C,
setContext as D,
is_promise as E,
get_current_component as F,
set_current_component as G,
flush as H,
svg_element as I,
claim_svg_element as J,
set_style as K,
compute_slots as L,
afterUpdate as M,
assign as N,
exclude_internal_props as O,
create_slot as P,
update_slot_base as Q,
get_all_dirty_from_scope as R,
get_slot_changes as S,
construct_svelte_component as T,
tick as U,
createEventDispatcher as V,
action_destroyer as W,
is_function as X,
HtmlTagHydration as Y,
claim_html_tag as Z,
add_flush_callback as _,
space as a,
get_root_for_style as a0,
append_empty_stylesheet as a1,
custom_event as a2,
identity as a3,
blank_object as a4,
is_empty as a5,
flush_render_callbacks as a6,
current_component as a7,
run as a8,
dirty_components as a9,
schedule_update as aa,
start_hydrating as ab,
end_hydrating as ac,
split_css_unit as ad,
bubble as ae,
compute_rest_props as af,
set_attributes as ag,
src_url_equal as ah,
head_selector as ai,
children as b,
claim_element as c,
claim_text as d,
element as e,
claim_space as f,
detach as g,
get_svelte_dataset as h,
attr as i,
insert_hydration as j,
append_hydration as k,
set_data as l,
component_subscribe as m,
destroy_each as n,
noop as o,
onMount as p,
set_store_value as q,
select_value as r,
safe_not_equal as s,
text as t,
set_input_value as u,
add_render_callback as v,
select_option as w,
listen as x,
run_all as y,
empty as z
};