5451 lines
2.6 MiB
JavaScript
5451 lines
2.6 MiB
JavaScript
|
"use strict";
|
||
|
/*
|
||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
if you want to view the source, please visit the github repository of this plugin
|
||
|
*/
|
||
|
|
||
|
var __defProp = Object.defineProperty;
|
||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||
|
var __export = (target, all) => {
|
||
|
for (var name in all)
|
||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||
|
};
|
||
|
var __copyProps = (to, from, except, desc) => {
|
||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||
|
for (let key of __getOwnPropNames(from))
|
||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||
|
}
|
||
|
return to;
|
||
|
};
|
||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||
|
|
||
|
// src/main.ts
|
||
|
var main_exports = {};
|
||
|
__export(main_exports, {
|
||
|
default: () => TextExtractorPlugin
|
||
|
});
|
||
|
module.exports = __toCommonJS(main_exports);
|
||
|
var import_obsidian4 = require("obsidian");
|
||
|
|
||
|
// node_modules/.pnpm/svelte@3.59.2/node_modules/svelte/internal/index.mjs
|
||
|
function noop() {
|
||
|
}
|
||
|
var identity = (x2) => x2;
|
||
|
function assign(tar, src) {
|
||
|
for (const k2 in src)
|
||
|
tar[k2] = src[k2];
|
||
|
return tar;
|
||
|
}
|
||
|
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(a2, b2) {
|
||
|
return a2 != a2 ? b2 == b2 : a2 !== b2 || (a2 && typeof a2 === "object" || typeof a2 === "function");
|
||
|
}
|
||
|
function is_empty(obj) {
|
||
|
return Object.keys(obj).length === 0;
|
||
|
}
|
||
|
function subscribe(store, ...callbacks) {
|
||
|
if (store == null) {
|
||
|
return noop;
|
||
|
}
|
||
|
const unsub = store.subscribe(...callbacks);
|
||
|
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
|
||
|
}
|
||
|
function component_subscribe(component, store, callback) {
|
||
|
component.$$.on_destroy.push(subscribe(store, callback));
|
||
|
}
|
||
|
function create_slot(definition, ctx, $$scope, fn) {
|
||
|
if (definition) {
|
||
|
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
|
||
|
return definition[0](slot_ctx);
|
||
|
}
|
||
|
}
|
||
|
function get_slot_context(definition, ctx, $$scope, fn) {
|
||
|
return definition[1] && fn ? assign($$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 i2 = 0; i2 < len; i2 += 1) {
|
||
|
merged[i2] = $$scope.dirty[i2] | lets[i2];
|
||
|
}
|
||
|
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 i2 = 0; i2 < length; i2++) {
|
||
|
dirty[i2] = -1;
|
||
|
}
|
||
|
return dirty;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
function exclude_internal_props(props) {
|
||
|
const result = {};
|
||
|
for (const k2 in props)
|
||
|
if (k2[0] !== "$")
|
||
|
result[k2] = props[k2];
|
||
|
return result;
|
||
|
}
|
||
|
function null_to_empty(value) {
|
||
|
return value == null ? "" : value;
|
||
|
}
|
||
|
var is_client = typeof window !== "undefined";
|
||
|
var now = is_client ? () => window.performance.now() : () => Date.now();
|
||
|
var raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;
|
||
|
var tasks = /* @__PURE__ */ new Set();
|
||
|
function run_tasks(now2) {
|
||
|
tasks.forEach((task) => {
|
||
|
if (!task.c(now2)) {
|
||
|
tasks.delete(task);
|
||
|
task.f();
|
||
|
}
|
||
|
});
|
||
|
if (tasks.size !== 0)
|
||
|
raf(run_tasks);
|
||
|
}
|
||
|
function loop(callback) {
|
||
|
let task;
|
||
|
if (tasks.size === 0)
|
||
|
raf(run_tasks);
|
||
|
return {
|
||
|
promise: new Promise((fulfill) => {
|
||
|
tasks.add(task = { c: callback, f: fulfill });
|
||
|
}),
|
||
|
abort() {
|
||
|
tasks.delete(task);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : global;
|
||
|
var ResizeObserverSingleton = class {
|
||
|
constructor(options) {
|
||
|
this.options = options;
|
||
|
this._listeners = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
|
||
|
}
|
||
|
observe(element2, listener) {
|
||
|
this._listeners.set(element2, listener);
|
||
|
this._getObserver().observe(element2, this.options);
|
||
|
return () => {
|
||
|
this._listeners.delete(element2);
|
||
|
this._observer.unobserve(element2);
|
||
|
};
|
||
|
}
|
||
|
_getObserver() {
|
||
|
var _a2;
|
||
|
return (_a2 = this._observer) !== null && _a2 !== void 0 ? _a2 : this._observer = new ResizeObserver((entries) => {
|
||
|
var _a3;
|
||
|
for (const entry of entries) {
|
||
|
ResizeObserverSingleton.entries.set(entry.target, entry);
|
||
|
(_a3 = this._listeners.get(entry.target)) === null || _a3 === void 0 ? void 0 : _a3(entry);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
|
||
|
var is_hydrating = false;
|
||
|
function start_hydrating() {
|
||
|
is_hydrating = true;
|
||
|
}
|
||
|
function end_hydrating() {
|
||
|
is_hydrating = false;
|
||
|
}
|
||
|
function append(target, node) {
|
||
|
target.appendChild(node);
|
||
|
}
|
||
|
function append_styles(target, style_sheet_id, styles) {
|
||
|
const append_styles_to = get_root_for_style(target);
|
||
|
if (!append_styles_to.getElementById(style_sheet_id)) {
|
||
|
const style = element("style");
|
||
|
style.id = style_sheet_id;
|
||
|
style.textContent = styles;
|
||
|
append_stylesheet(append_styles_to, style);
|
||
|
}
|
||
|
}
|
||
|
function get_root_for_style(node) {
|
||
|
if (!node)
|
||
|
return document;
|
||
|
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
|
||
|
if (root && root.host) {
|
||
|
return root;
|
||
|
}
|
||
|
return node.ownerDocument;
|
||
|
}
|
||
|
function append_empty_stylesheet(node) {
|
||
|
const style_element = element("style");
|
||
|
append_stylesheet(get_root_for_style(node), style_element);
|
||
|
return style_element.sheet;
|
||
|
}
|
||
|
function append_stylesheet(node, style) {
|
||
|
append(node.head || node, style);
|
||
|
return style.sheet;
|
||
|
}
|
||
|
function insert(target, node, anchor) {
|
||
|
target.insertBefore(node, anchor || null);
|
||
|
}
|
||
|
function detach(node) {
|
||
|
if (node.parentNode) {
|
||
|
node.parentNode.removeChild(node);
|
||
|
}
|
||
|
}
|
||
|
function destroy_each(iterations, detaching) {
|
||
|
for (let i2 = 0; i2 < iterations.length; i2 += 1) {
|
||
|
if (iterations[i2])
|
||
|
iterations[i2].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 prevent_default(fn) {
|
||
|
return function(event) {
|
||
|
event.preventDefault();
|
||
|
return fn.call(this, event);
|
||
|
};
|
||
|
}
|
||
|
function stop_propagation(fn) {
|
||
|
return function(event) {
|
||
|
event.stopPropagation();
|
||
|
return fn.call(this, event);
|
||
|
};
|
||
|
}
|
||
|
function self2(fn) {
|
||
|
return function(event) {
|
||
|
if (event.target === this)
|
||
|
fn.call(this, event);
|
||
|
};
|
||
|
}
|
||
|
function attr(node, attribute, value) {
|
||
|
if (value == null)
|
||
|
node.removeAttribute(attribute);
|
||
|
else if (node.getAttribute(attribute) !== value)
|
||
|
node.setAttribute(attribute, value);
|
||
|
}
|
||
|
function set_svg_attributes(node, attributes) {
|
||
|
for (const key in attributes) {
|
||
|
attr(node, key, attributes[key]);
|
||
|
}
|
||
|
}
|
||
|
function children(element2) {
|
||
|
return Array.from(element2.childNodes);
|
||
|
}
|
||
|
function set_data(text2, data) {
|
||
|
data = "" + data;
|
||
|
if (text2.data === data)
|
||
|
return;
|
||
|
text2.data = 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 toggle_class(element2, name, toggle) {
|
||
|
element2.classList[toggle ? "add" : "remove"](name);
|
||
|
}
|
||
|
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
|
||
|
const e2 = document.createEvent("CustomEvent");
|
||
|
e2.initCustomEvent(type, bubbles, cancelable, detail);
|
||
|
return e2;
|
||
|
}
|
||
|
var HtmlTag = class {
|
||
|
constructor(is_svg = false) {
|
||
|
this.is_svg = false;
|
||
|
this.is_svg = is_svg;
|
||
|
this.e = this.n = null;
|
||
|
}
|
||
|
c(html) {
|
||
|
this.h(html);
|
||
|
}
|
||
|
m(html, target, anchor = null) {
|
||
|
if (!this.e) {
|
||
|
if (this.is_svg)
|
||
|
this.e = svg_element(target.nodeName);
|
||
|
else
|
||
|
this.e = element(target.nodeType === 11 ? "TEMPLATE" : target.nodeName);
|
||
|
this.t = target.tagName !== "TEMPLATE" ? target : target.content;
|
||
|
this.c(html);
|
||
|
}
|
||
|
this.i(anchor);
|
||
|
}
|
||
|
h(html) {
|
||
|
this.e.innerHTML = html;
|
||
|
this.n = Array.from(this.e.nodeName === "TEMPLATE" ? this.e.content.childNodes : this.e.childNodes);
|
||
|
}
|
||
|
i(anchor) {
|
||
|
for (let i2 = 0; i2 < this.n.length; i2 += 1) {
|
||
|
insert(this.t, this.n[i2], anchor);
|
||
|
}
|
||
|
}
|
||
|
p(html) {
|
||
|
this.d();
|
||
|
this.h(html);
|
||
|
this.i(this.a);
|
||
|
}
|
||
|
d() {
|
||
|
this.n.forEach(detach);
|
||
|
}
|
||
|
};
|
||
|
var managed_styles = /* @__PURE__ */ new Map();
|
||
|
var active = 0;
|
||
|
function hash(str) {
|
||
|
let hash2 = 5381;
|
||
|
let i2 = str.length;
|
||
|
while (i2--)
|
||
|
hash2 = (hash2 << 5) - hash2 ^ str.charCodeAt(i2);
|
||
|
return hash2 >>> 0;
|
||
|
}
|
||
|
function create_style_information(doc, node) {
|
||
|
const info = { stylesheet: append_empty_stylesheet(node), rules: {} };
|
||
|
managed_styles.set(doc, info);
|
||
|
return info;
|
||
|
}
|
||
|
function create_rule(node, a2, b2, duration, delay, ease, fn, uid = 0) {
|
||
|
const step = 16.666 / duration;
|
||
|
let keyframes = "{\n";
|
||
|
for (let p2 = 0; p2 <= 1; p2 += step) {
|
||
|
const t2 = a2 + (b2 - a2) * ease(p2);
|
||
|
keyframes += p2 * 100 + `%{${fn(t2, 1 - t2)}}
|
||
|
`;
|
||
|
}
|
||
|
const rule = keyframes + `100% {${fn(b2, 1 - b2)}}
|
||
|
}`;
|
||
|
const name = `__svelte_${hash(rule)}_${uid}`;
|
||
|
const doc = get_root_for_style(node);
|
||
|
const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);
|
||
|
if (!rules[name]) {
|
||
|
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) {
|
||
|
const previous = (node.style.animation || "").split(", ");
|
||
|
const next = previous.filter(name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1);
|
||
|
const deleted = previous.length - next.length;
|
||
|
if (deleted) {
|
||
|
node.style.animation = next.join(", ");
|
||
|
active -= deleted;
|
||
|
if (!active)
|
||
|
clear_rules();
|
||
|
}
|
||
|
}
|
||
|
function clear_rules() {
|
||
|
raf(() => {
|
||
|
if (active)
|
||
|
return;
|
||
|
managed_styles.forEach((info) => {
|
||
|
const { ownerNode } = info.stylesheet;
|
||
|
if (ownerNode)
|
||
|
detach(ownerNode);
|
||
|
});
|
||
|
managed_styles.clear();
|
||
|
});
|
||
|
}
|
||
|
function create_animation(node, from, fn, params) {
|
||
|
if (!from)
|
||
|
return noop;
|
||
|
const to = node.getBoundingClientRect();
|
||
|
if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)
|
||
|
return noop;
|
||
|
const {
|
||
|
delay = 0,
|
||
|
duration = 300,
|
||
|
easing = identity,
|
||
|
start: start_time = now() + delay,
|
||
|
end = start_time + duration,
|
||
|
tick: tick2 = noop,
|
||
|
css
|
||
|
} = fn(node, { from, to }, params);
|
||
|
let running = true;
|
||
|
let started = false;
|
||
|
let name;
|
||
|
function start() {
|
||
|
if (css) {
|
||
|
name = create_rule(node, 0, 1, duration, delay, easing, css);
|
||
|
}
|
||
|
if (!delay) {
|
||
|
started = true;
|
||
|
}
|
||
|
}
|
||
|
function stop() {
|
||
|
if (css)
|
||
|
delete_rule(node, name);
|
||
|
running = false;
|
||
|
}
|
||
|
loop((now2) => {
|
||
|
if (!started && now2 >= start_time) {
|
||
|
started = true;
|
||
|
}
|
||
|
if (started && now2 >= end) {
|
||
|
tick2(1, 0);
|
||
|
stop();
|
||
|
}
|
||
|
if (!running) {
|
||
|
return false;
|
||
|
}
|
||
|
if (started) {
|
||
|
const p2 = now2 - start_time;
|
||
|
const t2 = 0 + 1 * easing(p2 / duration);
|
||
|
tick2(t2, 1 - t2);
|
||
|
}
|
||
|
return true;
|
||
|
});
|
||
|
start();
|
||
|
tick2(0, 1);
|
||
|
return stop;
|
||
|
}
|
||
|
function fix_position(node) {
|
||
|
const style = getComputedStyle(node);
|
||
|
if (style.position !== "absolute" && style.position !== "fixed") {
|
||
|
const { width, height } = style;
|
||
|
const a2 = node.getBoundingClientRect();
|
||
|
node.style.position = "absolute";
|
||
|
node.style.width = width;
|
||
|
node.style.height = height;
|
||
|
add_transform(node, a2);
|
||
|
}
|
||
|
}
|
||
|
function add_transform(node, a2) {
|
||
|
const b2 = node.getBoundingClientRect();
|
||
|
if (a2.left !== b2.left || a2.top !== b2.top) {
|
||
|
const style = getComputedStyle(node);
|
||
|
const transform = style.transform === "none" ? "" : style.transform;
|
||
|
node.style.transform = `${transform} translate(${a2.left - b2.left}px, ${a2.top - b2.top}px)`;
|
||
|
}
|
||
|
}
|
||
|
var 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 createEventDispatcher() {
|
||
|
const component = get_current_component();
|
||
|
return (type, detail, { cancelable = false } = {}) => {
|
||
|
const callbacks = component.$$.callbacks[type];
|
||
|
if (callbacks) {
|
||
|
const event = custom_event(type, detail, { cancelable });
|
||
|
callbacks.slice().forEach((fn) => {
|
||
|
fn.call(component, event);
|
||
|
});
|
||
|
return !event.defaultPrevented;
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
}
|
||
|
function bubble(component, event) {
|
||
|
const callbacks = component.$$.callbacks[event.type];
|
||
|
if (callbacks) {
|
||
|
callbacks.slice().forEach((fn) => fn.call(this, event));
|
||
|
}
|
||
|
}
|
||
|
var dirty_components = [];
|
||
|
var binding_callbacks = [];
|
||
|
var render_callbacks = [];
|
||
|
var flush_callbacks = [];
|
||
|
var resolved_promise = /* @__PURE__ */ Promise.resolve();
|
||
|
var 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);
|
||
|
}
|
||
|
var seen_callbacks = /* @__PURE__ */ new Set();
|
||
|
var 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 (e2) {
|
||
|
dirty_components.length = 0;
|
||
|
flushidx = 0;
|
||
|
throw e2;
|
||
|
}
|
||
|
set_current_component(null);
|
||
|
dirty_components.length = 0;
|
||
|
flushidx = 0;
|
||
|
while (binding_callbacks.length)
|
||
|
binding_callbacks.pop()();
|
||
|
for (let i2 = 0; i2 < render_callbacks.length; i2 += 1) {
|
||
|
const callback = render_callbacks[i2];
|
||
|
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((c2) => fns.indexOf(c2) === -1 ? filtered.push(c2) : targets.push(c2));
|
||
|
targets.forEach((c2) => c2());
|
||
|
render_callbacks = filtered;
|
||
|
}
|
||
|
var outroing = /* @__PURE__ */ new Set();
|
||
|
var outros;
|
||
|
function group_outros() {
|
||
|
outros = {
|
||
|
r: 0,
|
||
|
c: [],
|
||
|
p: outros
|
||
|
};
|
||
|
}
|
||
|
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, detach2, callback) {
|
||
|
if (block && block.o) {
|
||
|
if (outroing.has(block))
|
||
|
return;
|
||
|
outroing.add(block);
|
||
|
outros.c.push(() => {
|
||
|
outroing.delete(block);
|
||
|
if (callback) {
|
||
|
if (detach2)
|
||
|
block.d(1);
|
||
|
callback();
|
||
|
}
|
||
|
});
|
||
|
block.o(local);
|
||
|
} else if (callback) {
|
||
|
callback();
|
||
|
}
|
||
|
}
|
||
|
function outro_and_destroy_block(block, lookup) {
|
||
|
transition_out(block, 1, 1, () => {
|
||
|
lookup.delete(block.key);
|
||
|
});
|
||
|
}
|
||
|
function fix_and_outro_and_destroy_block(block, lookup) {
|
||
|
block.f();
|
||
|
outro_and_destroy_block(block, lookup);
|
||
|
}
|
||
|
function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block2, next, get_context) {
|
||
|
let o2 = old_blocks.length;
|
||
|
let n2 = list.length;
|
||
|
let i2 = o2;
|
||
|
const old_indexes = {};
|
||
|
while (i2--)
|
||
|
old_indexes[old_blocks[i2].key] = i2;
|
||
|
const new_blocks = [];
|
||
|
const new_lookup = /* @__PURE__ */ new Map();
|
||
|
const deltas = /* @__PURE__ */ new Map();
|
||
|
const updates = [];
|
||
|
i2 = n2;
|
||
|
while (i2--) {
|
||
|
const child_ctx = get_context(ctx, list, i2);
|
||
|
const key = get_key(child_ctx);
|
||
|
let block = lookup.get(key);
|
||
|
if (!block) {
|
||
|
block = create_each_block2(key, child_ctx);
|
||
|
block.c();
|
||
|
} else if (dynamic) {
|
||
|
updates.push(() => block.p(child_ctx, dirty));
|
||
|
}
|
||
|
new_lookup.set(key, new_blocks[i2] = block);
|
||
|
if (key in old_indexes)
|
||
|
deltas.set(key, Math.abs(i2 - old_indexes[key]));
|
||
|
}
|
||
|
const will_move = /* @__PURE__ */ new Set();
|
||
|
const did_move = /* @__PURE__ */ new Set();
|
||
|
function insert2(block) {
|
||
|
transition_in(block, 1);
|
||
|
block.m(node, next);
|
||
|
lookup.set(block.key, block);
|
||
|
next = block.first;
|
||
|
n2--;
|
||
|
}
|
||
|
while (o2 && n2) {
|
||
|
const new_block = new_blocks[n2 - 1];
|
||
|
const old_block = old_blocks[o2 - 1];
|
||
|
const new_key = new_block.key;
|
||
|
const old_key = old_block.key;
|
||
|
if (new_block === old_block) {
|
||
|
next = new_block.first;
|
||
|
o2--;
|
||
|
n2--;
|
||
|
} else if (!new_lookup.has(old_key)) {
|
||
|
destroy(old_block, lookup);
|
||
|
o2--;
|
||
|
} else if (!lookup.has(new_key) || will_move.has(new_key)) {
|
||
|
insert2(new_block);
|
||
|
} else if (did_move.has(old_key)) {
|
||
|
o2--;
|
||
|
} else if (deltas.get(new_key) > deltas.get(old_key)) {
|
||
|
did_move.add(new_key);
|
||
|
insert2(new_block);
|
||
|
} else {
|
||
|
will_move.add(old_key);
|
||
|
o2--;
|
||
|
}
|
||
|
}
|
||
|
while (o2--) {
|
||
|
const old_block = old_blocks[o2];
|
||
|
if (!new_lookup.has(old_block.key))
|
||
|
destroy(old_block, lookup);
|
||
|
}
|
||
|
while (n2)
|
||
|
insert2(new_blocks[n2 - 1]);
|
||
|
run_all(updates);
|
||
|
return new_blocks;
|
||
|
}
|
||
|
function get_spread_update(levels, updates) {
|
||
|
const update2 = {};
|
||
|
const to_null_out = {};
|
||
|
const accounted_for = { $$scope: 1 };
|
||
|
let i2 = levels.length;
|
||
|
while (i2--) {
|
||
|
const o2 = levels[i2];
|
||
|
const n2 = updates[i2];
|
||
|
if (n2) {
|
||
|
for (const key in o2) {
|
||
|
if (!(key in n2))
|
||
|
to_null_out[key] = 1;
|
||
|
}
|
||
|
for (const key in n2) {
|
||
|
if (!accounted_for[key]) {
|
||
|
update2[key] = n2[key];
|
||
|
accounted_for[key] = 1;
|
||
|
}
|
||
|
}
|
||
|
levels[i2] = n2;
|
||
|
} else {
|
||
|
for (const key in o2) {
|
||
|
accounted_for[key] = 1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (const key in to_null_out) {
|
||
|
if (!(key in update2))
|
||
|
update2[key] = void 0;
|
||
|
}
|
||
|
return update2;
|
||
|
}
|
||
|
var _boolean_attributes = [
|
||
|
"allowfullscreen",
|
||
|
"allowpaymentrequest",
|
||
|
"async",
|
||
|
"autofocus",
|
||
|
"autoplay",
|
||
|
"checked",
|
||
|
"controls",
|
||
|
"default",
|
||
|
"defer",
|
||
|
"disabled",
|
||
|
"formnovalidate",
|
||
|
"hidden",
|
||
|
"inert",
|
||
|
"ismap",
|
||
|
"loop",
|
||
|
"multiple",
|
||
|
"muted",
|
||
|
"nomodule",
|
||
|
"novalidate",
|
||
|
"open",
|
||
|
"playsinline",
|
||
|
"readonly",
|
||
|
"required",
|
||
|
"reversed",
|
||
|
"selected"
|
||
|
];
|
||
|
var boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);
|
||
|
function bind(component, name, callback) {
|
||
|
const index = component.$$.props[name];
|
||
|
if (index !== void 0) {
|
||
|
component.$$.bound[index] = callback;
|
||
|
callback(component.$$.ctx[index]);
|
||
|
}
|
||
|
}
|
||
|
function create_component(block) {
|
||
|
block && block.c();
|
||
|
}
|
||
|
function mount_component(component, target, anchor, customElement) {
|
||
|
const { fragment, after_update } = component.$$;
|
||
|
fragment && fragment.m(target, anchor);
|
||
|
if (!customElement) {
|
||
|
add_render_callback(() => {
|
||
|
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
||
|
if (component.$$.on_destroy) {
|
||
|
component.$$.on_destroy.push(...new_on_destroy);
|
||
|
} else {
|
||
|
run_all(new_on_destroy);
|
||
|
}
|
||
|
component.$$.on_mount = [];
|
||
|
});
|
||
|
}
|
||
|
after_update.forEach(add_render_callback);
|
||
|
}
|
||
|
function destroy_component(component, detaching) {
|
||
|
const $$ = component.$$;
|
||
|
if ($$.fragment !== null) {
|
||
|
flush_render_callbacks($$.after_update);
|
||
|
run_all($$.on_destroy);
|
||
|
$$.fragment && $$.fragment.d(detaching);
|
||
|
$$.on_destroy = $$.fragment = null;
|
||
|
$$.ctx = [];
|
||
|
}
|
||
|
}
|
||
|
function make_dirty(component, i2) {
|
||
|
if (component.$$.dirty[0] === -1) {
|
||
|
dirty_components.push(component);
|
||
|
schedule_update();
|
||
|
component.$$.dirty.fill(0);
|
||
|
}
|
||
|
component.$$.dirty[i2 / 31 | 0] |= 1 << i2 % 31;
|
||
|
}
|
||
|
function init(component, options, instance8, create_fragment8, not_equal, props, append_styles2, dirty = [-1]) {
|
||
|
const parent_component = current_component;
|
||
|
set_current_component(component);
|
||
|
const $$ = component.$$ = {
|
||
|
fragment: null,
|
||
|
ctx: [],
|
||
|
props,
|
||
|
update: noop,
|
||
|
not_equal,
|
||
|
bound: blank_object(),
|
||
|
on_mount: [],
|
||
|
on_destroy: [],
|
||
|
on_disconnect: [],
|
||
|
before_update: [],
|
||
|
after_update: [],
|
||
|
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
||
|
callbacks: blank_object(),
|
||
|
dirty,
|
||
|
skip_bound: false,
|
||
|
root: options.target || parent_component.$$.root
|
||
|
};
|
||
|
append_styles2 && append_styles2($$.root);
|
||
|
let ready = false;
|
||
|
$$.ctx = instance8 ? instance8(component, options.props || {}, (i2, ret, ...rest) => {
|
||
|
const value = rest.length ? rest[0] : ret;
|
||
|
if ($$.ctx && not_equal($$.ctx[i2], $$.ctx[i2] = value)) {
|
||
|
if (!$$.skip_bound && $$.bound[i2])
|
||
|
$$.bound[i2](value);
|
||
|
if (ready)
|
||
|
make_dirty(component, i2);
|
||
|
}
|
||
|
return ret;
|
||
|
}) : [];
|
||
|
$$.update();
|
||
|
ready = true;
|
||
|
run_all($$.before_update);
|
||
|
$$.fragment = create_fragment8 ? create_fragment8($$.ctx) : false;
|
||
|
if (options.target) {
|
||
|
if (options.hydrate) {
|
||
|
start_hydrating();
|
||
|
const nodes = children(options.target);
|
||
|
$$.fragment && $$.fragment.l(nodes);
|
||
|
nodes.forEach(detach);
|
||
|
} else {
|
||
|
$$.fragment && $$.fragment.c();
|
||
|
}
|
||
|
if (options.intro)
|
||
|
transition_in(component.$$.fragment);
|
||
|
mount_component(component, options.target, options.anchor, options.customElement);
|
||
|
end_hydrating();
|
||
|
flush();
|
||
|
}
|
||
|
set_current_component(parent_component);
|
||
|
}
|
||
|
var SvelteElement;
|
||
|
if (typeof HTMLElement === "function") {
|
||
|
SvelteElement = class extends HTMLElement {
|
||
|
constructor() {
|
||
|
super();
|
||
|
this.attachShadow({ mode: "open" });
|
||
|
}
|
||
|
connectedCallback() {
|
||
|
const { on_mount } = this.$$;
|
||
|
this.$$.on_disconnect = on_mount.map(run).filter(is_function);
|
||
|
for (const key in this.$$.slotted) {
|
||
|
this.appendChild(this.$$.slotted[key]);
|
||
|
}
|
||
|
}
|
||
|
attributeChangedCallback(attr2, _oldValue, newValue) {
|
||
|
this[attr2] = newValue;
|
||
|
}
|
||
|
disconnectedCallback() {
|
||
|
run_all(this.$$.on_disconnect);
|
||
|
}
|
||
|
$destroy() {
|
||
|
destroy_component(this, 1);
|
||
|
this.$destroy = noop;
|
||
|
}
|
||
|
$on(type, callback) {
|
||
|
if (!is_function(callback)) {
|
||
|
return noop;
|
||
|
}
|
||
|
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
||
|
callbacks.push(callback);
|
||
|
return () => {
|
||
|
const index = callbacks.indexOf(callback);
|
||
|
if (index !== -1)
|
||
|
callbacks.splice(index, 1);
|
||
|
};
|
||
|
}
|
||
|
$set($$props) {
|
||
|
if (this.$$set && !is_empty($$props)) {
|
||
|
this.$$.skip_bound = true;
|
||
|
this.$$set($$props);
|
||
|
this.$$.skip_bound = false;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
var SvelteComponent = class {
|
||
|
$destroy() {
|
||
|
destroy_component(this, 1);
|
||
|
this.$destroy = noop;
|
||
|
}
|
||
|
$on(type, callback) {
|
||
|
if (!is_function(callback)) {
|
||
|
return noop;
|
||
|
}
|
||
|
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
||
|
callbacks.push(callback);
|
||
|
return () => {
|
||
|
const index = callbacks.indexOf(callback);
|
||
|
if (index !== -1)
|
||
|
callbacks.splice(index, 1);
|
||
|
};
|
||
|
}
|
||
|
$set($$props) {
|
||
|
if (this.$$set && !is_empty($$props)) {
|
||
|
this.$$.skip_bound = true;
|
||
|
this.$$set($$props);
|
||
|
this.$$.skip_bound = false;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// node_modules/.pnpm/svelte@3.59.2/node_modules/svelte/store/index.mjs
|
||
|
var subscriber_queue = [];
|
||
|
function writable(value, start = noop) {
|
||
|
let stop;
|
||
|
const subscribers = /* @__PURE__ */ new Set();
|
||
|
function set(new_value) {
|
||
|
if (safe_not_equal(value, new_value)) {
|
||
|
value = new_value;
|
||
|
if (stop) {
|
||
|
const run_queue = !subscriber_queue.length;
|
||
|
for (const subscriber of subscribers) {
|
||
|
subscriber[1]();
|
||
|
subscriber_queue.push(subscriber, value);
|
||
|
}
|
||
|
if (run_queue) {
|
||
|
for (let i2 = 0; i2 < subscriber_queue.length; i2 += 2) {
|
||
|
subscriber_queue[i2][0](subscriber_queue[i2 + 1]);
|
||
|
}
|
||
|
subscriber_queue.length = 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
function update2(fn) {
|
||
|
set(fn(value));
|
||
|
}
|
||
|
function subscribe2(run2, invalidate = noop) {
|
||
|
const subscriber = [run2, invalidate];
|
||
|
subscribers.add(subscriber);
|
||
|
if (subscribers.size === 1) {
|
||
|
stop = start(set) || noop;
|
||
|
}
|
||
|
run2(value);
|
||
|
return () => {
|
||
|
subscribers.delete(subscriber);
|
||
|
if (subscribers.size === 0 && stop) {
|
||
|
stop();
|
||
|
stop = null;
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
return { set, update: update2, subscribe: subscribe2 };
|
||
|
}
|
||
|
|
||
|
// src/settings.ts
|
||
|
var import_obsidian2 = require("obsidian");
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/CircleSpinner.svelte
|
||
|
function add_css(target) {
|
||
|
append_styles(target, "svelte-66wdl1", "div.svelte-66wdl1{display:inline-block;vertical-align:middle;margin:0 3pt;border-width:calc(1em / 5);border-style:solid;border-radius:50%;animation:var(--duration) infinite svelte-66wdl1-rotate}@keyframes svelte-66wdl1-rotate{100%{transform:rotate(360deg)}}");
|
||
|
}
|
||
|
function create_fragment(ctx) {
|
||
|
let div;
|
||
|
let style_border_color = `${ctx[0]} transparent ${ctx[0]}
|
||
|
${ctx[0]}`;
|
||
|
return {
|
||
|
c() {
|
||
|
div = element("div");
|
||
|
set_style(div, "--duration", ctx[1]);
|
||
|
attr(div, "class", "svelte-66wdl1");
|
||
|
set_style(div, "border-color", style_border_color);
|
||
|
set_style(div, "width", ctx[2]);
|
||
|
set_style(div, "height", ctx[2]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, div, anchor);
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
if (dirty & 2) {
|
||
|
set_style(div, "--duration", ctx2[1]);
|
||
|
}
|
||
|
const style_changed = dirty & 2;
|
||
|
if (style_changed || dirty & 3 && style_border_color !== (style_border_color = `${ctx2[0]} transparent ${ctx2[0]}
|
||
|
${ctx2[0]}`)) {
|
||
|
set_style(div, "border-color", style_border_color);
|
||
|
}
|
||
|
if (style_changed || dirty & 6) {
|
||
|
set_style(div, "width", ctx2[2]);
|
||
|
}
|
||
|
if (style_changed || dirty & 6) {
|
||
|
set_style(div, "height", ctx2[2]);
|
||
|
}
|
||
|
},
|
||
|
i: noop,
|
||
|
o: noop,
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(div);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance($$self, $$props, $$invalidate) {
|
||
|
let { color = `cornflowerblue` } = $$props;
|
||
|
let { duration = `1.5s` } = $$props;
|
||
|
let { size = `1em` } = $$props;
|
||
|
$$self.$$set = ($$props2) => {
|
||
|
if ("color" in $$props2)
|
||
|
$$invalidate(0, color = $$props2.color);
|
||
|
if ("duration" in $$props2)
|
||
|
$$invalidate(1, duration = $$props2.duration);
|
||
|
if ("size" in $$props2)
|
||
|
$$invalidate(2, size = $$props2.size);
|
||
|
};
|
||
|
return [color, duration, size];
|
||
|
}
|
||
|
var CircleSpinner = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance, create_fragment, safe_not_equal, { color: 0, duration: 1, size: 2 }, add_css);
|
||
|
}
|
||
|
};
|
||
|
var CircleSpinner_default = CircleSpinner;
|
||
|
|
||
|
// node_modules/.pnpm/svelte@3.59.2/node_modules/svelte/easing/index.mjs
|
||
|
function cubicOut(t2) {
|
||
|
const f2 = t2 - 1;
|
||
|
return f2 * f2 * f2 + 1;
|
||
|
}
|
||
|
|
||
|
// node_modules/.pnpm/svelte@3.59.2/node_modules/svelte/animate/index.mjs
|
||
|
function flip(node, { from, to }, params = {}) {
|
||
|
const style = getComputedStyle(node);
|
||
|
const transform = style.transform === "none" ? "" : style.transform;
|
||
|
const [ox, oy] = style.transformOrigin.split(" ").map(parseFloat);
|
||
|
const dx = from.left + from.width * ox / to.width - (to.left + ox);
|
||
|
const dy = from.top + from.height * oy / to.height - (to.top + oy);
|
||
|
const { delay = 0, duration = (d2) => Math.sqrt(d2) * 120, easing = cubicOut } = params;
|
||
|
return {
|
||
|
delay,
|
||
|
duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
|
||
|
easing,
|
||
|
css: (t2, u2) => {
|
||
|
const x2 = u2 * dx;
|
||
|
const y2 = u2 * dy;
|
||
|
const sx = t2 + u2 * from.width / to.width;
|
||
|
const sy = t2 + u2 * from.height / to.height;
|
||
|
return `transform: ${transform} translate(${x2}px, ${y2}px) scale(${sx}, ${sy});`;
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
// node_modules/.pnpm/svelte@3.59.2/node_modules/svelte/motion/index.mjs
|
||
|
function is_date(obj) {
|
||
|
return Object.prototype.toString.call(obj) === "[object Date]";
|
||
|
}
|
||
|
function tick_spring(ctx, last_value, current_value, target_value) {
|
||
|
if (typeof current_value === "number" || is_date(current_value)) {
|
||
|
const delta = target_value - current_value;
|
||
|
const velocity = (current_value - last_value) / (ctx.dt || 1 / 60);
|
||
|
const spring2 = ctx.opts.stiffness * delta;
|
||
|
const damper = ctx.opts.damping * velocity;
|
||
|
const acceleration = (spring2 - damper) * ctx.inv_mass;
|
||
|
const d2 = (velocity + acceleration) * ctx.dt;
|
||
|
if (Math.abs(d2) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) {
|
||
|
return target_value;
|
||
|
} else {
|
||
|
ctx.settled = false;
|
||
|
return is_date(current_value) ? new Date(current_value.getTime() + d2) : current_value + d2;
|
||
|
}
|
||
|
} else if (Array.isArray(current_value)) {
|
||
|
return current_value.map((_2, i2) => tick_spring(ctx, last_value[i2], current_value[i2], target_value[i2]));
|
||
|
} else if (typeof current_value === "object") {
|
||
|
const next_value = {};
|
||
|
for (const k2 in current_value) {
|
||
|
next_value[k2] = tick_spring(ctx, last_value[k2], current_value[k2], target_value[k2]);
|
||
|
}
|
||
|
return next_value;
|
||
|
} else {
|
||
|
throw new Error(`Cannot spring ${typeof current_value} values`);
|
||
|
}
|
||
|
}
|
||
|
function spring(value, opts = {}) {
|
||
|
const store = writable(value);
|
||
|
const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;
|
||
|
let last_time;
|
||
|
let task;
|
||
|
let current_token;
|
||
|
let last_value = value;
|
||
|
let target_value = value;
|
||
|
let inv_mass = 1;
|
||
|
let inv_mass_recovery_rate = 0;
|
||
|
let cancel_task = false;
|
||
|
function set(new_value, opts2 = {}) {
|
||
|
target_value = new_value;
|
||
|
const token = current_token = {};
|
||
|
if (value == null || opts2.hard || spring2.stiffness >= 1 && spring2.damping >= 1) {
|
||
|
cancel_task = true;
|
||
|
last_time = now();
|
||
|
last_value = new_value;
|
||
|
store.set(value = target_value);
|
||
|
return Promise.resolve();
|
||
|
} else if (opts2.soft) {
|
||
|
const rate = opts2.soft === true ? 0.5 : +opts2.soft;
|
||
|
inv_mass_recovery_rate = 1 / (rate * 60);
|
||
|
inv_mass = 0;
|
||
|
}
|
||
|
if (!task) {
|
||
|
last_time = now();
|
||
|
cancel_task = false;
|
||
|
task = loop((now2) => {
|
||
|
if (cancel_task) {
|
||
|
cancel_task = false;
|
||
|
task = null;
|
||
|
return false;
|
||
|
}
|
||
|
inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);
|
||
|
const ctx = {
|
||
|
inv_mass,
|
||
|
opts: spring2,
|
||
|
settled: true,
|
||
|
dt: (now2 - last_time) * 60 / 1e3
|
||
|
};
|
||
|
const next_value = tick_spring(ctx, last_value, value, target_value);
|
||
|
last_time = now2;
|
||
|
last_value = value;
|
||
|
store.set(value = next_value);
|
||
|
if (ctx.settled) {
|
||
|
task = null;
|
||
|
}
|
||
|
return !ctx.settled;
|
||
|
});
|
||
|
}
|
||
|
return new Promise((fulfil) => {
|
||
|
task.promise.then(() => {
|
||
|
if (token === current_token)
|
||
|
fulfil();
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
const spring2 = {
|
||
|
set,
|
||
|
update: (fn, opts2) => set(fn(target_value, value), opts2),
|
||
|
subscribe: store.subscribe,
|
||
|
stiffness,
|
||
|
damping,
|
||
|
precision
|
||
|
};
|
||
|
return spring2;
|
||
|
}
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/Wiggle.svelte
|
||
|
function create_fragment2(ctx) {
|
||
|
let span;
|
||
|
let style_transform = `rotate(${ctx[0].angle}deg) scale(${ctx[0].scale}) translate(${ctx[0].dx}px,
|
||
|
${ctx[0].dy}px)`;
|
||
|
let current;
|
||
|
const default_slot_template = ctx[11].default;
|
||
|
const default_slot = create_slot(default_slot_template, ctx, ctx[10], null);
|
||
|
return {
|
||
|
c() {
|
||
|
span = element("span");
|
||
|
if (default_slot)
|
||
|
default_slot.c();
|
||
|
set_style(span, "transform", style_transform);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, span, anchor);
|
||
|
if (default_slot) {
|
||
|
default_slot.m(span, null);
|
||
|
}
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
if (default_slot) {
|
||
|
if (default_slot.p && (!current || dirty & 1024)) {
|
||
|
update_slot_base(default_slot, default_slot_template, ctx2, ctx2[10], !current ? get_all_dirty_from_scope(ctx2[10]) : get_slot_changes(default_slot_template, ctx2[10], dirty, null), null);
|
||
|
}
|
||
|
}
|
||
|
if (dirty & 1 && style_transform !== (style_transform = `rotate(${ctx2[0].angle}deg) scale(${ctx2[0].scale}) translate(${ctx2[0].dx}px,
|
||
|
${ctx2[0].dy}px)`)) {
|
||
|
set_style(span, "transform", style_transform);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(default_slot, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(default_slot, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(span);
|
||
|
if (default_slot)
|
||
|
default_slot.d(detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance2($$self, $$props, $$invalidate) {
|
||
|
let $store;
|
||
|
let { $$slots: slots = {}, $$scope } = $$props;
|
||
|
let { wiggle = false } = $$props;
|
||
|
let { angle = 0 } = $$props;
|
||
|
let { scale = 1 } = $$props;
|
||
|
let { dx = 0 } = $$props;
|
||
|
let { dy = 0 } = $$props;
|
||
|
let { duration = 200 } = $$props;
|
||
|
let { stiffness = 0.05 } = $$props;
|
||
|
let { damping = 0.1 } = $$props;
|
||
|
let rest_state = { angle: 0, scale: 1, dx: 0, dy: 0 };
|
||
|
let store = spring(rest_state, { stiffness, damping });
|
||
|
component_subscribe($$self, store, (value) => $$invalidate(0, $store = value));
|
||
|
$$self.$$set = ($$props2) => {
|
||
|
if ("wiggle" in $$props2)
|
||
|
$$invalidate(2, wiggle = $$props2.wiggle);
|
||
|
if ("angle" in $$props2)
|
||
|
$$invalidate(3, angle = $$props2.angle);
|
||
|
if ("scale" in $$props2)
|
||
|
$$invalidate(4, scale = $$props2.scale);
|
||
|
if ("dx" in $$props2)
|
||
|
$$invalidate(5, dx = $$props2.dx);
|
||
|
if ("dy" in $$props2)
|
||
|
$$invalidate(6, dy = $$props2.dy);
|
||
|
if ("duration" in $$props2)
|
||
|
$$invalidate(7, duration = $$props2.duration);
|
||
|
if ("stiffness" in $$props2)
|
||
|
$$invalidate(8, stiffness = $$props2.stiffness);
|
||
|
if ("damping" in $$props2)
|
||
|
$$invalidate(9, damping = $$props2.damping);
|
||
|
if ("$$scope" in $$props2)
|
||
|
$$invalidate(10, $$scope = $$props2.$$scope);
|
||
|
};
|
||
|
$$self.$$.update = () => {
|
||
|
if ($$self.$$.dirty & 132) {
|
||
|
$:
|
||
|
if (wiggle)
|
||
|
setTimeout(() => $$invalidate(2, wiggle = false), duration);
|
||
|
}
|
||
|
if ($$self.$$.dirty & 124) {
|
||
|
$:
|
||
|
store.set(wiggle ? { scale, angle, dx, dy } : rest_state);
|
||
|
}
|
||
|
};
|
||
|
return [
|
||
|
$store,
|
||
|
store,
|
||
|
wiggle,
|
||
|
angle,
|
||
|
scale,
|
||
|
dx,
|
||
|
dy,
|
||
|
duration,
|
||
|
stiffness,
|
||
|
damping,
|
||
|
$$scope,
|
||
|
slots
|
||
|
];
|
||
|
}
|
||
|
var Wiggle = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance2, create_fragment2, safe_not_equal, {
|
||
|
wiggle: 2,
|
||
|
angle: 3,
|
||
|
scale: 4,
|
||
|
dx: 5,
|
||
|
dy: 6,
|
||
|
duration: 7,
|
||
|
stiffness: 8,
|
||
|
damping: 9
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
var Wiggle_default = Wiggle;
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/icons/ChevronExpand.svelte
|
||
|
function create_fragment3(ctx) {
|
||
|
let svg;
|
||
|
let path;
|
||
|
let svg_levels = [ctx[0], { fill: "currentColor" }, { viewBox: "0 0 16 16" }];
|
||
|
let svg_data = {};
|
||
|
for (let i2 = 0; i2 < svg_levels.length; i2 += 1) {
|
||
|
svg_data = assign(svg_data, svg_levels[i2]);
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
svg = svg_element("svg");
|
||
|
path = svg_element("path");
|
||
|
attr(path, "d", "M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z");
|
||
|
set_svg_attributes(svg, svg_data);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, svg, anchor);
|
||
|
append(svg, path);
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
set_svg_attributes(svg, svg_data = get_spread_update(svg_levels, [
|
||
|
dirty & 1 && ctx2[0],
|
||
|
{ fill: "currentColor" },
|
||
|
{ viewBox: "0 0 16 16" }
|
||
|
]));
|
||
|
},
|
||
|
i: noop,
|
||
|
o: noop,
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(svg);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance3($$self, $$props, $$invalidate) {
|
||
|
$$self.$$set = ($$new_props) => {
|
||
|
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
|
||
|
};
|
||
|
$$props = exclude_internal_props($$props);
|
||
|
return [$$props];
|
||
|
}
|
||
|
var ChevronExpand = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance3, create_fragment3, safe_not_equal, {});
|
||
|
}
|
||
|
};
|
||
|
var ChevronExpand_default = ChevronExpand;
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/icons/Cross.svelte
|
||
|
function create_fragment4(ctx) {
|
||
|
let svg;
|
||
|
let path;
|
||
|
let svg_levels = [ctx[0], { viewBox: "0 0 24 24" }, { fill: "currentColor" }];
|
||
|
let svg_data = {};
|
||
|
for (let i2 = 0; i2 < svg_levels.length; i2 += 1) {
|
||
|
svg_data = assign(svg_data, svg_levels[i2]);
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
svg = svg_element("svg");
|
||
|
path = svg_element("path");
|
||
|
attr(path, "d", "M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z");
|
||
|
set_svg_attributes(svg, svg_data);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, svg, anchor);
|
||
|
append(svg, path);
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
set_svg_attributes(svg, svg_data = get_spread_update(svg_levels, [
|
||
|
dirty & 1 && ctx2[0],
|
||
|
{ viewBox: "0 0 24 24" },
|
||
|
{ fill: "currentColor" }
|
||
|
]));
|
||
|
},
|
||
|
i: noop,
|
||
|
o: noop,
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(svg);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance4($$self, $$props, $$invalidate) {
|
||
|
$$self.$$set = ($$new_props) => {
|
||
|
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
|
||
|
};
|
||
|
$$props = exclude_internal_props($$props);
|
||
|
return [$$props];
|
||
|
}
|
||
|
var Cross = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance4, create_fragment4, safe_not_equal, {});
|
||
|
}
|
||
|
};
|
||
|
var Cross_default = Cross;
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/icons/Disabled.svelte
|
||
|
function create_fragment5(ctx) {
|
||
|
let svg;
|
||
|
let path;
|
||
|
let svg_levels = [ctx[0], { viewBox: "0 0 24 24" }, { fill: "currentColor" }];
|
||
|
let svg_data = {};
|
||
|
for (let i2 = 0; i2 < svg_levels.length; i2 += 1) {
|
||
|
svg_data = assign(svg_data, svg_levels[i2]);
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
svg = svg_element("svg");
|
||
|
path = svg_element("path");
|
||
|
attr(path, "d", "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm-4.906-3.68L18.32 7.094A8 8 0 0 1 7.094 18.32ZM5.68 16.906A8 8 0 0 1 16.906 5.68L5.68 16.906Z");
|
||
|
set_svg_attributes(svg, svg_data);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, svg, anchor);
|
||
|
append(svg, path);
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
set_svg_attributes(svg, svg_data = get_spread_update(svg_levels, [
|
||
|
dirty & 1 && ctx2[0],
|
||
|
{ viewBox: "0 0 24 24" },
|
||
|
{ fill: "currentColor" }
|
||
|
]));
|
||
|
},
|
||
|
i: noop,
|
||
|
o: noop,
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(svg);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance5($$self, $$props, $$invalidate) {
|
||
|
$$self.$$set = ($$new_props) => {
|
||
|
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
|
||
|
};
|
||
|
$$props = exclude_internal_props($$props);
|
||
|
return [$$props];
|
||
|
}
|
||
|
var Disabled = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance5, create_fragment5, safe_not_equal, {});
|
||
|
}
|
||
|
};
|
||
|
var Disabled_default = Disabled;
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/MultiSelect.svelte
|
||
|
var { Boolean: Boolean_1 } = globals;
|
||
|
function add_css2(target) {
|
||
|
append_styles(target, "svelte-1r2hsto", ".svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect){position:relative;align-items:center;display:flex;cursor:text;box-sizing:border-box;border:var(--sms-border, 1pt solid lightgray);border-radius:var(--sms-border-radius, 3pt);background:var(--sms-bg);width:var(--sms-width);max-width:var(--sms-max-width);padding:var(--sms-padding, 0 3pt);color:var(--sms-text-color);font-size:var(--sms-font-size, inherit);min-height:var(--sms-min-height, 22pt);margin:var(--sms-margin)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect.open){z-index:var(--sms-open-z-index, 4)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect:focus-within){border:var(--sms-focus-border, 1pt solid var(--sms-active-color, cornflowerblue))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect.disabled){background:var(--sms-disabled-bg, lightgray);cursor:not-allowed}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected){display:flex;flex:1;padding:0;margin:0;flex-wrap:wrap}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li){align-items:center;border-radius:3pt;display:flex;margin:2pt;line-height:normal;transition:0.3s;white-space:nowrap;background:var(--sms-selected-bg, rgba(0, 0, 0, 0.15));padding:var(--sms-selected-li-padding, 1pt 5pt);color:var(--sms-selected-text-color, var(--sms-text-color))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li[draggable='true']){cursor:grab}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > li.active){background:var(--sms-li-active-bg, var(--sms-active-color, rgba(0, 0, 0, 0.15)))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect button){border-radius:50%;display:flex;transition:0.2s;color:inherit;background:transparent;border:none;cursor:pointer;outline:none;padding:0;margin:0 0 0 3pt}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect button.remove-all){margin:0 3pt}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(ul.selected > li button:hover, button.remove-all:hover, button:focus){color:var(--sms-remove-btn-hover-color, lightskyblue);background:var(--sms-remove-btn-hover-bg, rgba(0, 0, 0, 0.2))}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect input){margin:auto 0;padding:0}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.selected > input){border:none;outline:none;background:none;flex:1;min-width:2em;color:var(--sms-text-color);font-size:inherit;cursor:inherit;border-radius:0}div.multiselect.svelte-1r2hsto>ul.selected.svelte-1r2hsto>input.svelte-1r2hsto::placeholder{padding-left:5pt;color:var(--sms-placeholder-color);opacity:var(--sms-placeholder-opacity)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > input.form-control){width:2em;position:absolute;background:transparent;border:none;outline:none;z-index:-1;opacity:0;pointer-events:none}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options){list-style:none;top:100%;left:0;width:100%;position:absolute;overflow:auto;transition:all 0.2s;box-sizing:border-box;background:var(--sms-options-bg, white);max-height:var(--sms-options-max-height, 50vh);overscroll-behavior:var(--sms-options-overscroll, none);box-shadow:var(--sms-options-shadow, 0 0 14pt -8pt black);border:var(--sms-options-border);border-width:var(--sms-options-border-width);border-radius:var(--sms-options-border-radius, 1ex);padding:var(--sms-options-padding);margin:var(--sms-options-margin, inherit)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options.hidden){visibility:hidden;opacity:0;transform:translateY(50px)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options > li){padding:3pt 2ex;cursor:pointer;scroll-margin:var(--sms-options-scroll-margin, 100px)}.svelte-1r2hsto.svelte-1r2hsto.svelte-1r2hsto:where(div.multiselect > ul.options .user-msg){display:block;padding:3pt 2ex}.svelte-1r2hsto.svelte-
|
||
|
}
|
||
|
function get_each_context(ctx, list, i2) {
|
||
|
const child_ctx = ctx.slice();
|
||
|
child_ctx[110] = list[i2];
|
||
|
child_ctx[117] = i2;
|
||
|
const constants_0 = child_ctx[110] instanceof Object ? child_ctx[110] : { label: child_ctx[110] };
|
||
|
child_ctx[111] = constants_0.label;
|
||
|
child_ctx[42] = constants_0.disabled !== void 0 ? constants_0.disabled : null;
|
||
|
child_ctx[112] = constants_0.title !== void 0 ? constants_0.title : null;
|
||
|
child_ctx[113] = constants_0.selectedTitle !== void 0 ? constants_0.selectedTitle : null;
|
||
|
child_ctx[114] = constants_0.disabledTitle !== void 0 ? constants_0.disabledTitle : child_ctx[13];
|
||
|
const constants_1 = child_ctx[0] === child_ctx[117];
|
||
|
child_ctx[115] = constants_1;
|
||
|
return child_ctx;
|
||
|
}
|
||
|
var get_option_slot_changes = (dirty) => ({ option: dirty[0] & 2 });
|
||
|
var get_option_slot_context = (ctx) => ({
|
||
|
option: ctx[110],
|
||
|
idx: ctx[117]
|
||
|
});
|
||
|
function get_else_ctx(ctx) {
|
||
|
const child_ctx = ctx.slice();
|
||
|
const constants_0 = child_ctx[4].some((option) => child_ctx[15](option, child_ctx[3]));
|
||
|
child_ctx[118] = constants_0;
|
||
|
const constants_1 = !child_ctx[17] && child_ctx[118] ? child_ctx[16] : child_ctx[10];
|
||
|
child_ctx[119] = constants_1;
|
||
|
return child_ctx;
|
||
|
}
|
||
|
var get_remove_icon_slot_changes_1 = (dirty) => ({});
|
||
|
var get_remove_icon_slot_context_1 = (ctx) => ({});
|
||
|
var get_disabled_icon_slot_changes = (dirty) => ({});
|
||
|
var get_disabled_icon_slot_context = (ctx) => ({});
|
||
|
var get_spinner_slot_changes = (dirty) => ({});
|
||
|
var get_spinner_slot_context = (ctx) => ({});
|
||
|
function get_each_context_1(ctx, list, i2) {
|
||
|
const child_ctx = ctx.slice();
|
||
|
child_ctx[110] = list[i2];
|
||
|
child_ctx[117] = i2;
|
||
|
return child_ctx;
|
||
|
}
|
||
|
var get_remove_icon_slot_changes = (dirty) => ({});
|
||
|
var get_remove_icon_slot_context = (ctx) => ({});
|
||
|
var get_selected_slot_changes = (dirty) => ({
|
||
|
option: dirty[0] & 16,
|
||
|
idx: dirty[0] & 16
|
||
|
});
|
||
|
var get_selected_slot_context = (ctx) => ({
|
||
|
option: ctx[110],
|
||
|
idx: ctx[117]
|
||
|
});
|
||
|
var get_expand_icon_slot_changes = (dirty) => ({ open: dirty[0] & 256 });
|
||
|
var get_expand_icon_slot_context = (ctx) => ({ open: ctx[8] });
|
||
|
function fallback_block_6(ctx) {
|
||
|
let expandicon;
|
||
|
let current;
|
||
|
expandicon = new ChevronExpand_default({
|
||
|
props: {
|
||
|
width: "15px",
|
||
|
style: "min-width: 1em; padding: 0 1pt; cursor: pointer;"
|
||
|
}
|
||
|
});
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(expandicon.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(expandicon, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p: noop,
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(expandicon.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(expandicon.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(expandicon, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_else_block_2(ctx) {
|
||
|
let t_value = ctx[41](ctx[110]) + "";
|
||
|
let t2;
|
||
|
return {
|
||
|
c() {
|
||
|
t2 = text(t_value);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, t2, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 16 && t_value !== (t_value = ctx2[41](ctx2[110]) + ""))
|
||
|
set_data(t2, t_value);
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(t2);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_10(ctx) {
|
||
|
let html_tag;
|
||
|
let raw_value = ctx[41](ctx[110]) + "";
|
||
|
let html_anchor;
|
||
|
return {
|
||
|
c() {
|
||
|
html_tag = new HtmlTag(false);
|
||
|
html_anchor = empty();
|
||
|
html_tag.a = html_anchor;
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
html_tag.m(raw_value, target, anchor);
|
||
|
insert(target, html_anchor, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 16 && raw_value !== (raw_value = ctx2[41](ctx2[110]) + ""))
|
||
|
html_tag.p(raw_value);
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(html_anchor);
|
||
|
if (detaching)
|
||
|
html_tag.d();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block_5(ctx) {
|
||
|
let if_block_anchor;
|
||
|
function select_block_type(ctx2, dirty) {
|
||
|
if (ctx2[31])
|
||
|
return create_if_block_10;
|
||
|
return create_else_block_2;
|
||
|
}
|
||
|
let current_block_type = select_block_type(ctx, [-1, -1, -1, -1]);
|
||
|
let if_block = current_block_type(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if_block.c();
|
||
|
if_block_anchor = empty();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if_block.m(target, anchor);
|
||
|
insert(target, if_block_anchor, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block) {
|
||
|
if_block.p(ctx2, dirty);
|
||
|
} else {
|
||
|
if_block.d(1);
|
||
|
if_block = current_block_type(ctx2);
|
||
|
if (if_block) {
|
||
|
if_block.c();
|
||
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if_block.d(detaching);
|
||
|
if (detaching)
|
||
|
detach(if_block_anchor);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_9(ctx) {
|
||
|
let button;
|
||
|
let button_title_value;
|
||
|
let current;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
const remove_icon_slot_template = ctx[69]["remove-icon"];
|
||
|
const remove_icon_slot = create_slot(remove_icon_slot_template, ctx, ctx[107], get_remove_icon_slot_context);
|
||
|
const remove_icon_slot_or_fallback = remove_icon_slot || fallback_block_4(ctx);
|
||
|
function mouseup_handler() {
|
||
|
return ctx[89](ctx[110]);
|
||
|
}
|
||
|
function keydown_handler_1() {
|
||
|
return ctx[90](ctx[110]);
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
button = element("button");
|
||
|
if (remove_icon_slot_or_fallback)
|
||
|
remove_icon_slot_or_fallback.c();
|
||
|
attr(button, "type", "button");
|
||
|
attr(button, "title", button_title_value = ctx[35] + " " + ctx[41](ctx[110]));
|
||
|
attr(button, "class", "remove svelte-1r2hsto");
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, button, anchor);
|
||
|
if (remove_icon_slot_or_fallback) {
|
||
|
remove_icon_slot_or_fallback.m(button, null);
|
||
|
}
|
||
|
current = true;
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(button, "mouseup", stop_propagation(mouseup_handler)),
|
||
|
listen(button, "keydown", function() {
|
||
|
if (is_function(ctx[54](keydown_handler_1)))
|
||
|
ctx[54](keydown_handler_1).apply(this, arguments);
|
||
|
})
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(new_ctx, dirty) {
|
||
|
ctx = new_ctx;
|
||
|
if (remove_icon_slot) {
|
||
|
if (remove_icon_slot.p && (!current || dirty[3] & 16384)) {
|
||
|
update_slot_base(remove_icon_slot, remove_icon_slot_template, ctx, ctx[107], !current ? get_all_dirty_from_scope(ctx[107]) : get_slot_changes(remove_icon_slot_template, ctx[107], dirty, get_remove_icon_slot_changes), get_remove_icon_slot_context);
|
||
|
}
|
||
|
}
|
||
|
if (!current || dirty[0] & 16 | dirty[1] & 16 && button_title_value !== (button_title_value = ctx[35] + " " + ctx[41](ctx[110]))) {
|
||
|
attr(button, "title", button_title_value);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(remove_icon_slot_or_fallback, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(remove_icon_slot_or_fallback, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(button);
|
||
|
if (remove_icon_slot_or_fallback)
|
||
|
remove_icon_slot_or_fallback.d(detaching);
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block_4(ctx) {
|
||
|
let crossicon;
|
||
|
let current;
|
||
|
crossicon = new Cross_default({ props: { width: "15px" } });
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(crossicon.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(crossicon, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p: noop,
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(crossicon.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(crossicon.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(crossicon, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_each_block_1(key_1, ctx) {
|
||
|
let li;
|
||
|
let t2;
|
||
|
let li_class_value;
|
||
|
let li_draggable_value;
|
||
|
let rect;
|
||
|
let stop_animation = noop;
|
||
|
let current;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
const selected_slot_template = ctx[69].selected;
|
||
|
const selected_slot = create_slot(selected_slot_template, ctx, ctx[107], get_selected_slot_context);
|
||
|
const selected_slot_or_fallback = selected_slot || fallback_block_5(ctx);
|
||
|
let if_block = !ctx[42] && (ctx[36] === null || ctx[4].length > ctx[36]) && create_if_block_9(ctx);
|
||
|
function dragenter_handler() {
|
||
|
return ctx[91](ctx[117]);
|
||
|
}
|
||
|
return {
|
||
|
key: key_1,
|
||
|
first: null,
|
||
|
c() {
|
||
|
li = element("li");
|
||
|
if (selected_slot_or_fallback)
|
||
|
selected_slot_or_fallback.c();
|
||
|
t2 = space();
|
||
|
if (if_block)
|
||
|
if_block.c();
|
||
|
attr(li, "class", li_class_value = null_to_empty(ctx[23]) + " svelte-1r2hsto");
|
||
|
attr(li, "draggable", li_draggable_value = ctx[38] && !ctx[42] && ctx[4].length > 1);
|
||
|
toggle_class(li, "active", ctx[46] === ctx[117]);
|
||
|
this.first = li;
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, li, anchor);
|
||
|
if (selected_slot_or_fallback) {
|
||
|
selected_slot_or_fallback.m(li, null);
|
||
|
}
|
||
|
append(li, t2);
|
||
|
if (if_block)
|
||
|
if_block.m(li, null);
|
||
|
current = true;
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(li, "dragstart", function() {
|
||
|
if (is_function(ctx[57](ctx[117])))
|
||
|
ctx[57](ctx[117]).apply(this, arguments);
|
||
|
}),
|
||
|
listen(li, "drop", prevent_default(function() {
|
||
|
if (is_function(ctx[56](ctx[117])))
|
||
|
ctx[56](ctx[117]).apply(this, arguments);
|
||
|
})),
|
||
|
listen(li, "dragenter", dragenter_handler),
|
||
|
listen(li, "dragover", prevent_default(ctx[85]))
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(new_ctx, dirty) {
|
||
|
ctx = new_ctx;
|
||
|
if (selected_slot) {
|
||
|
if (selected_slot.p && (!current || dirty[0] & 16 | dirty[3] & 16384)) {
|
||
|
update_slot_base(selected_slot, selected_slot_template, ctx, ctx[107], !current ? get_all_dirty_from_scope(ctx[107]) : get_slot_changes(selected_slot_template, ctx[107], dirty, get_selected_slot_changes), get_selected_slot_context);
|
||
|
}
|
||
|
} else {
|
||
|
if (selected_slot_or_fallback && selected_slot_or_fallback.p && (!current || dirty[0] & 16 | dirty[1] & 1)) {
|
||
|
selected_slot_or_fallback.p(ctx, !current ? [-1, -1, -1, -1] : dirty);
|
||
|
}
|
||
|
}
|
||
|
if (!ctx[42] && (ctx[36] === null || ctx[4].length > ctx[36])) {
|
||
|
if (if_block) {
|
||
|
if_block.p(ctx, dirty);
|
||
|
if (dirty[0] & 16 | dirty[1] & 2080) {
|
||
|
transition_in(if_block, 1);
|
||
|
}
|
||
|
} else {
|
||
|
if_block = create_if_block_9(ctx);
|
||
|
if_block.c();
|
||
|
transition_in(if_block, 1);
|
||
|
if_block.m(li, null);
|
||
|
}
|
||
|
} else if (if_block) {
|
||
|
group_outros();
|
||
|
transition_out(if_block, 1, 1, () => {
|
||
|
if_block = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
if (!current || dirty[0] & 8388608 && li_class_value !== (li_class_value = null_to_empty(ctx[23]) + " svelte-1r2hsto")) {
|
||
|
attr(li, "class", li_class_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 16 | dirty[1] & 2176 && li_draggable_value !== (li_draggable_value = ctx[38] && !ctx[42] && ctx[4].length > 1)) {
|
||
|
attr(li, "draggable", li_draggable_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 8388624 | dirty[1] & 32768) {
|
||
|
toggle_class(li, "active", ctx[46] === ctx[117]);
|
||
|
}
|
||
|
},
|
||
|
r() {
|
||
|
rect = li.getBoundingClientRect();
|
||
|
},
|
||
|
f() {
|
||
|
fix_position(li);
|
||
|
stop_animation();
|
||
|
},
|
||
|
a() {
|
||
|
stop_animation();
|
||
|
stop_animation = create_animation(li, rect, flip, { duration: 100 });
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(selected_slot_or_fallback, local);
|
||
|
transition_in(if_block);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(selected_slot_or_fallback, local);
|
||
|
transition_out(if_block);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(li);
|
||
|
if (selected_slot_or_fallback)
|
||
|
selected_slot_or_fallback.d(detaching);
|
||
|
if (if_block)
|
||
|
if_block.d();
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_8(ctx) {
|
||
|
let current;
|
||
|
const spinner_slot_template = ctx[69].spinner;
|
||
|
const spinner_slot = create_slot(spinner_slot_template, ctx, ctx[107], get_spinner_slot_context);
|
||
|
const spinner_slot_or_fallback = spinner_slot || fallback_block_3(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if (spinner_slot_or_fallback)
|
||
|
spinner_slot_or_fallback.c();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if (spinner_slot_or_fallback) {
|
||
|
spinner_slot_or_fallback.m(target, anchor);
|
||
|
}
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (spinner_slot) {
|
||
|
if (spinner_slot.p && (!current || dirty[3] & 16384)) {
|
||
|
update_slot_base(spinner_slot, spinner_slot_template, ctx2, ctx2[107], !current ? get_all_dirty_from_scope(ctx2[107]) : get_slot_changes(spinner_slot_template, ctx2[107], dirty, get_spinner_slot_changes), get_spinner_slot_context);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(spinner_slot_or_fallback, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(spinner_slot_or_fallback, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (spinner_slot_or_fallback)
|
||
|
spinner_slot_or_fallback.d(detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block_3(ctx) {
|
||
|
let circlespinner;
|
||
|
let current;
|
||
|
circlespinner = new CircleSpinner_default({});
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(circlespinner.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(circlespinner, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(circlespinner.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(circlespinner.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(circlespinner, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_5(ctx) {
|
||
|
let t2;
|
||
|
let if_block1_anchor;
|
||
|
let current;
|
||
|
let if_block0 = ctx[25] && (ctx[25] > 1 || ctx[26]) && create_if_block_7(ctx);
|
||
|
let if_block1 = ctx[25] !== 1 && ctx[4].length > 1 && create_if_block_6(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if (if_block0)
|
||
|
if_block0.c();
|
||
|
t2 = space();
|
||
|
if (if_block1)
|
||
|
if_block1.c();
|
||
|
if_block1_anchor = empty();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if (if_block0)
|
||
|
if_block0.m(target, anchor);
|
||
|
insert(target, t2, anchor);
|
||
|
if (if_block1)
|
||
|
if_block1.m(target, anchor);
|
||
|
insert(target, if_block1_anchor, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (ctx2[25] && (ctx2[25] > 1 || ctx2[26])) {
|
||
|
if (if_block0) {
|
||
|
if_block0.p(ctx2, dirty);
|
||
|
if (dirty[0] & 100663296) {
|
||
|
transition_in(if_block0, 1);
|
||
|
}
|
||
|
} else {
|
||
|
if_block0 = create_if_block_7(ctx2);
|
||
|
if_block0.c();
|
||
|
transition_in(if_block0, 1);
|
||
|
if_block0.m(t2.parentNode, t2);
|
||
|
}
|
||
|
} else if (if_block0) {
|
||
|
group_outros();
|
||
|
transition_out(if_block0, 1, 1, () => {
|
||
|
if_block0 = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
if (ctx2[25] !== 1 && ctx2[4].length > 1) {
|
||
|
if (if_block1) {
|
||
|
if_block1.p(ctx2, dirty);
|
||
|
if (dirty[0] & 33554448) {
|
||
|
transition_in(if_block1, 1);
|
||
|
}
|
||
|
} else {
|
||
|
if_block1 = create_if_block_6(ctx2);
|
||
|
if_block1.c();
|
||
|
transition_in(if_block1, 1);
|
||
|
if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
|
||
|
}
|
||
|
} else if (if_block1) {
|
||
|
group_outros();
|
||
|
transition_out(if_block1, 1, 1, () => {
|
||
|
if_block1 = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(if_block0);
|
||
|
transition_in(if_block1);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(if_block0);
|
||
|
transition_out(if_block1);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (if_block0)
|
||
|
if_block0.d(detaching);
|
||
|
if (detaching)
|
||
|
detach(t2);
|
||
|
if (if_block1)
|
||
|
if_block1.d(detaching);
|
||
|
if (detaching)
|
||
|
detach(if_block1_anchor);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_4(ctx) {
|
||
|
let current;
|
||
|
const disabled_icon_slot_template = ctx[69]["disabled-icon"];
|
||
|
const disabled_icon_slot = create_slot(disabled_icon_slot_template, ctx, ctx[107], get_disabled_icon_slot_context);
|
||
|
const disabled_icon_slot_or_fallback = disabled_icon_slot || fallback_block_1(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if (disabled_icon_slot_or_fallback)
|
||
|
disabled_icon_slot_or_fallback.c();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if (disabled_icon_slot_or_fallback) {
|
||
|
disabled_icon_slot_or_fallback.m(target, anchor);
|
||
|
}
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (disabled_icon_slot) {
|
||
|
if (disabled_icon_slot.p && (!current || dirty[3] & 16384)) {
|
||
|
update_slot_base(disabled_icon_slot, disabled_icon_slot_template, ctx2, ctx2[107], !current ? get_all_dirty_from_scope(ctx2[107]) : get_slot_changes(disabled_icon_slot_template, ctx2[107], dirty, get_disabled_icon_slot_changes), get_disabled_icon_slot_context);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(disabled_icon_slot_or_fallback, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(disabled_icon_slot_or_fallback, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (disabled_icon_slot_or_fallback)
|
||
|
disabled_icon_slot_or_fallback.d(detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_7(ctx) {
|
||
|
let wiggle_1;
|
||
|
let updating_wiggle;
|
||
|
let current;
|
||
|
function wiggle_1_wiggle_binding(value) {
|
||
|
ctx[94](value);
|
||
|
}
|
||
|
let wiggle_1_props = {
|
||
|
angle: 20,
|
||
|
$$slots: { default: [create_default_slot] },
|
||
|
$$scope: { ctx }
|
||
|
};
|
||
|
if (ctx[43] !== void 0) {
|
||
|
wiggle_1_props.wiggle = ctx[43];
|
||
|
}
|
||
|
wiggle_1 = new Wiggle_default({ props: wiggle_1_props });
|
||
|
binding_callbacks.push(() => bind(wiggle_1, "wiggle", wiggle_1_wiggle_binding));
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(wiggle_1.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(wiggle_1, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
const wiggle_1_changes = {};
|
||
|
if (dirty[0] & 234881040 | dirty[3] & 16384) {
|
||
|
wiggle_1_changes.$$scope = { dirty, ctx: ctx2 };
|
||
|
}
|
||
|
if (!updating_wiggle && dirty[1] & 4096) {
|
||
|
updating_wiggle = true;
|
||
|
wiggle_1_changes.wiggle = ctx2[43];
|
||
|
add_flush_callback(() => updating_wiggle = false);
|
||
|
}
|
||
|
wiggle_1.$set(wiggle_1_changes);
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(wiggle_1.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(wiggle_1.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(wiggle_1, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_default_slot(ctx) {
|
||
|
var _a2;
|
||
|
let span;
|
||
|
let t_value = ((_a2 = ctx[26]) == null ? void 0 : _a2.call(ctx, ctx[4].length, ctx[25])) + "";
|
||
|
let t2;
|
||
|
let span_class_value;
|
||
|
return {
|
||
|
c() {
|
||
|
span = element("span");
|
||
|
t2 = text(t_value);
|
||
|
attr(span, "class", span_class_value = "max-select-msg " + ctx[27] + " svelte-1r2hsto");
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, span, anchor);
|
||
|
append(span, t2);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
var _a3;
|
||
|
if (dirty[0] & 100663312 && t_value !== (t_value = ((_a3 = ctx2[26]) == null ? void 0 : _a3.call(ctx2, ctx2[4].length, ctx2[25])) + ""))
|
||
|
set_data(t2, t_value);
|
||
|
if (dirty[0] & 134217728 && span_class_value !== (span_class_value = "max-select-msg " + ctx2[27] + " svelte-1r2hsto")) {
|
||
|
attr(span, "class", span_class_value);
|
||
|
}
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(span);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_6(ctx) {
|
||
|
let button;
|
||
|
let current;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
const remove_icon_slot_template = ctx[69]["remove-icon"];
|
||
|
const remove_icon_slot = create_slot(remove_icon_slot_template, ctx, ctx[107], get_remove_icon_slot_context_1);
|
||
|
const remove_icon_slot_or_fallback = remove_icon_slot || fallback_block_2(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
button = element("button");
|
||
|
if (remove_icon_slot_or_fallback)
|
||
|
remove_icon_slot_or_fallback.c();
|
||
|
attr(button, "type", "button");
|
||
|
attr(button, "class", "remove remove-all svelte-1r2hsto");
|
||
|
attr(button, "title", ctx[34]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, button, anchor);
|
||
|
if (remove_icon_slot_or_fallback) {
|
||
|
remove_icon_slot_or_fallback.m(button, null);
|
||
|
}
|
||
|
current = true;
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(button, "mouseup", stop_propagation(ctx[53])),
|
||
|
listen(button, "keydown", ctx[54](ctx[53]))
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (remove_icon_slot) {
|
||
|
if (remove_icon_slot.p && (!current || dirty[3] & 16384)) {
|
||
|
update_slot_base(remove_icon_slot, remove_icon_slot_template, ctx2, ctx2[107], !current ? get_all_dirty_from_scope(ctx2[107]) : get_slot_changes(remove_icon_slot_template, ctx2[107], dirty, get_remove_icon_slot_changes_1), get_remove_icon_slot_context_1);
|
||
|
}
|
||
|
}
|
||
|
if (!current || dirty[1] & 8) {
|
||
|
attr(button, "title", ctx2[34]);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(remove_icon_slot_or_fallback, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(remove_icon_slot_or_fallback, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(button);
|
||
|
if (remove_icon_slot_or_fallback)
|
||
|
remove_icon_slot_or_fallback.d(detaching);
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block_2(ctx) {
|
||
|
let crossicon;
|
||
|
let current;
|
||
|
crossicon = new Cross_default({ props: { width: "15px" } });
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(crossicon.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(crossicon, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p: noop,
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(crossicon.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(crossicon.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(crossicon, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block_1(ctx) {
|
||
|
let disabledicon;
|
||
|
let current;
|
||
|
disabledicon = new Disabled_default({
|
||
|
props: {
|
||
|
width: "14pt",
|
||
|
style: "margin: 0 2pt;",
|
||
|
"data-name": "disabled-icon"
|
||
|
}
|
||
|
});
|
||
|
return {
|
||
|
c() {
|
||
|
create_component(disabledicon.$$.fragment);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
mount_component(disabledicon, target, anchor);
|
||
|
current = true;
|
||
|
},
|
||
|
p: noop,
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(disabledicon.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(disabledicon.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
destroy_component(disabledicon, detaching);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block(ctx) {
|
||
|
let ul;
|
||
|
let ul_class_value;
|
||
|
let current;
|
||
|
let each_value = ctx[1];
|
||
|
let each_blocks = [];
|
||
|
for (let i2 = 0; i2 < each_value.length; i2 += 1) {
|
||
|
each_blocks[i2] = create_each_block(get_each_context(ctx, each_value, i2));
|
||
|
}
|
||
|
const out = (i2) => transition_out(each_blocks[i2], 1, 1, () => {
|
||
|
each_blocks[i2] = null;
|
||
|
});
|
||
|
let each_1_else = null;
|
||
|
if (!each_value.length) {
|
||
|
each_1_else = create_else_block_1(get_else_ctx(ctx));
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
ul = element("ul");
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
each_blocks[i2].c();
|
||
|
}
|
||
|
if (each_1_else) {
|
||
|
each_1_else.c();
|
||
|
}
|
||
|
attr(ul, "class", ul_class_value = "options " + ctx[39] + " svelte-1r2hsto");
|
||
|
toggle_class(ul, "hidden", !ctx[8]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, ul, anchor);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
if (each_blocks[i2]) {
|
||
|
each_blocks[i2].m(ul, null);
|
||
|
}
|
||
|
}
|
||
|
if (each_1_else) {
|
||
|
each_1_else.m(ul, null);
|
||
|
}
|
||
|
ctx[105](ul);
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 543394843 | dirty[1] & 402433 | dirty[3] & 16384) {
|
||
|
each_value = ctx2[1];
|
||
|
let i2;
|
||
|
for (i2 = 0; i2 < each_value.length; i2 += 1) {
|
||
|
const child_ctx = get_each_context(ctx2, each_value, i2);
|
||
|
if (each_blocks[i2]) {
|
||
|
each_blocks[i2].p(child_ctx, dirty);
|
||
|
transition_in(each_blocks[i2], 1);
|
||
|
} else {
|
||
|
each_blocks[i2] = create_each_block(child_ctx);
|
||
|
each_blocks[i2].c();
|
||
|
transition_in(each_blocks[i2], 1);
|
||
|
each_blocks[i2].m(ul, null);
|
||
|
}
|
||
|
}
|
||
|
group_outros();
|
||
|
for (i2 = each_value.length; i2 < each_blocks.length; i2 += 1) {
|
||
|
out(i2);
|
||
|
}
|
||
|
check_outros();
|
||
|
if (!each_value.length && each_1_else) {
|
||
|
each_1_else.p(get_else_ctx(ctx2), dirty);
|
||
|
} else if (!each_value.length) {
|
||
|
each_1_else = create_else_block_1(get_else_ctx(ctx2));
|
||
|
each_1_else.c();
|
||
|
each_1_else.m(ul, null);
|
||
|
} else if (each_1_else) {
|
||
|
each_1_else.d(1);
|
||
|
each_1_else = null;
|
||
|
}
|
||
|
}
|
||
|
if (!current || dirty[1] & 256 && ul_class_value !== (ul_class_value = "options " + ctx2[39] + " svelte-1r2hsto")) {
|
||
|
attr(ul, "class", ul_class_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 256 | dirty[1] & 256) {
|
||
|
toggle_class(ul, "hidden", !ctx2[8]);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
for (let i2 = 0; i2 < each_value.length; i2 += 1) {
|
||
|
transition_in(each_blocks[i2]);
|
||
|
}
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
each_blocks = each_blocks.filter(Boolean_1);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
transition_out(each_blocks[i2]);
|
||
|
}
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(ul);
|
||
|
destroy_each(each_blocks, detaching);
|
||
|
if (each_1_else)
|
||
|
each_1_else.d();
|
||
|
ctx[105](null);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_else_block_1(ctx) {
|
||
|
let t2;
|
||
|
function select_block_type_3(ctx2, dirty) {
|
||
|
if (ctx2[11] && ctx2[3] && ctx2[119])
|
||
|
return create_if_block_2;
|
||
|
if (ctx2[29])
|
||
|
return create_if_block_3;
|
||
|
}
|
||
|
let current_block_type = select_block_type_3(ctx, [-1, -1, -1, -1]);
|
||
|
let if_block = current_block_type && current_block_type(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if (if_block)
|
||
|
if_block.c();
|
||
|
t2 = space();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if (if_block)
|
||
|
if_block.m(target, anchor);
|
||
|
insert(target, t2, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (current_block_type === (current_block_type = select_block_type_3(ctx2, dirty)) && if_block) {
|
||
|
if_block.p(ctx2, dirty);
|
||
|
} else {
|
||
|
if (if_block)
|
||
|
if_block.d(1);
|
||
|
if_block = current_block_type && current_block_type(ctx2);
|
||
|
if (if_block) {
|
||
|
if_block.c();
|
||
|
if_block.m(t2.parentNode, t2);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (if_block) {
|
||
|
if_block.d(detaching);
|
||
|
}
|
||
|
if (detaching)
|
||
|
detach(t2);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_3(ctx) {
|
||
|
let span;
|
||
|
let t2;
|
||
|
return {
|
||
|
c() {
|
||
|
span = element("span");
|
||
|
t2 = text(ctx[29]);
|
||
|
attr(span, "class", "user-msg svelte-1r2hsto");
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, span, anchor);
|
||
|
append(span, t2);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 536870912)
|
||
|
set_data(t2, ctx2[29]);
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(span);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_2(ctx) {
|
||
|
let li;
|
||
|
let t_value = ctx[119] + "";
|
||
|
let t2;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
return {
|
||
|
c() {
|
||
|
li = element("li");
|
||
|
t2 = text(t_value);
|
||
|
attr(li, "title", ctx[10]);
|
||
|
attr(li, "class", "user-msg svelte-1r2hsto");
|
||
|
toggle_class(li, "active", ctx[44]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, li, anchor);
|
||
|
append(li, t2);
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(li, "mousedown", stop_propagation(ctx[71])),
|
||
|
listen(li, "mouseup", stop_propagation(ctx[100])),
|
||
|
listen(li, "mouseover", ctx[101]),
|
||
|
listen(li, "focus", ctx[102]),
|
||
|
listen(li, "mouseout", ctx[103]),
|
||
|
listen(li, "blur", ctx[104])
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 230424 && t_value !== (t_value = ctx2[119] + ""))
|
||
|
set_data(t2, t_value);
|
||
|
if (dirty[0] & 1024) {
|
||
|
attr(li, "title", ctx2[10]);
|
||
|
}
|
||
|
if (dirty[1] & 8192) {
|
||
|
toggle_class(li, "active", ctx2[44]);
|
||
|
}
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(li);
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_else_block(ctx) {
|
||
|
let t_value = ctx[41](ctx[110]) + "";
|
||
|
let t2;
|
||
|
return {
|
||
|
c() {
|
||
|
t2 = text(t_value);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, t2, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 2 && t_value !== (t_value = ctx2[41](ctx2[110]) + ""))
|
||
|
set_data(t2, t_value);
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(t2);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_if_block_1(ctx) {
|
||
|
let html_tag;
|
||
|
let raw_value = ctx[41](ctx[110]) + "";
|
||
|
let html_anchor;
|
||
|
return {
|
||
|
c() {
|
||
|
html_tag = new HtmlTag(false);
|
||
|
html_anchor = empty();
|
||
|
html_tag.a = html_anchor;
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
html_tag.m(raw_value, target, anchor);
|
||
|
insert(target, html_anchor, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (dirty[0] & 2 && raw_value !== (raw_value = ctx2[41](ctx2[110]) + ""))
|
||
|
html_tag.p(raw_value);
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(html_anchor);
|
||
|
if (detaching)
|
||
|
html_tag.d();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function fallback_block(ctx) {
|
||
|
let if_block_anchor;
|
||
|
function select_block_type_2(ctx2, dirty) {
|
||
|
if (ctx2[31])
|
||
|
return create_if_block_1;
|
||
|
return create_else_block;
|
||
|
}
|
||
|
let current_block_type = select_block_type_2(ctx, [-1, -1, -1, -1]);
|
||
|
let if_block = current_block_type(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
if_block.c();
|
||
|
if_block_anchor = empty();
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
if_block.m(target, anchor);
|
||
|
insert(target, if_block_anchor, anchor);
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
if (current_block_type === (current_block_type = select_block_type_2(ctx2, dirty)) && if_block) {
|
||
|
if_block.p(ctx2, dirty);
|
||
|
} else {
|
||
|
if_block.d(1);
|
||
|
if_block = current_block_type(ctx2);
|
||
|
if (if_block) {
|
||
|
if_block.c();
|
||
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if_block.d(detaching);
|
||
|
if (detaching)
|
||
|
detach(if_block_anchor);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_each_block(ctx) {
|
||
|
let li;
|
||
|
let t2;
|
||
|
let li_title_value;
|
||
|
let li_class_value;
|
||
|
let current;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
const option_slot_template = ctx[69].option;
|
||
|
const option_slot = create_slot(option_slot_template, ctx, ctx[107], get_option_slot_context);
|
||
|
const option_slot_or_fallback = option_slot || fallback_block(ctx);
|
||
|
function mouseup_handler_1(...args) {
|
||
|
return ctx[95](ctx[42], ctx[110], ...args);
|
||
|
}
|
||
|
function mouseover_handler() {
|
||
|
return ctx[96](ctx[42], ctx[117]);
|
||
|
}
|
||
|
function focus_handler_1() {
|
||
|
return ctx[97](ctx[42], ctx[117]);
|
||
|
}
|
||
|
return {
|
||
|
c() {
|
||
|
li = element("li");
|
||
|
if (option_slot_or_fallback)
|
||
|
option_slot_or_fallback.c();
|
||
|
t2 = space();
|
||
|
attr(li, "title", li_title_value = ctx[42] ? ctx[114] : ctx[48](ctx[111]) && ctx[113] || ctx[112]);
|
||
|
attr(li, "class", li_class_value = ctx[22] + " " + (ctx[115] ? ctx[21] : ``) + " svelte-1r2hsto");
|
||
|
toggle_class(li, "selected", ctx[48](ctx[111]));
|
||
|
toggle_class(li, "active", ctx[115]);
|
||
|
toggle_class(li, "disabled", ctx[42]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, li, anchor);
|
||
|
if (option_slot_or_fallback) {
|
||
|
option_slot_or_fallback.m(li, null);
|
||
|
}
|
||
|
append(li, t2);
|
||
|
current = true;
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(li, "mousedown", stop_propagation(ctx[70])),
|
||
|
listen(li, "mouseup", stop_propagation(mouseup_handler_1)),
|
||
|
listen(li, "mouseover", mouseover_handler),
|
||
|
listen(li, "focus", focus_handler_1),
|
||
|
listen(li, "mouseout", ctx[98]),
|
||
|
listen(li, "blur", ctx[99])
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(new_ctx, dirty) {
|
||
|
ctx = new_ctx;
|
||
|
if (option_slot) {
|
||
|
if (option_slot.p && (!current || dirty[0] & 2 | dirty[3] & 16384)) {
|
||
|
update_slot_base(option_slot, option_slot_template, ctx, ctx[107], !current ? get_all_dirty_from_scope(ctx[107]) : get_slot_changes(option_slot_template, ctx[107], dirty, get_option_slot_changes), get_option_slot_context);
|
||
|
}
|
||
|
} else {
|
||
|
if (option_slot_or_fallback && option_slot_or_fallback.p && (!current || dirty[0] & 2 | dirty[1] & 1)) {
|
||
|
option_slot_or_fallback.p(ctx, !current ? [-1, -1, -1, -1] : dirty);
|
||
|
}
|
||
|
}
|
||
|
if (!current || dirty[0] & 2 | dirty[1] & 131072 && li_title_value !== (li_title_value = ctx[42] ? ctx[114] : ctx[48](ctx[111]) && ctx[113] || ctx[112])) {
|
||
|
attr(li, "title", li_title_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 6291457 && li_class_value !== (li_class_value = ctx[22] + " " + (ctx[115] ? ctx[21] : ``) + " svelte-1r2hsto")) {
|
||
|
attr(li, "class", li_class_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 6291459 | dirty[1] & 131072) {
|
||
|
toggle_class(li, "selected", ctx[48](ctx[111]));
|
||
|
}
|
||
|
if (!current || dirty[0] & 6291457) {
|
||
|
toggle_class(li, "active", ctx[115]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 6291459) {
|
||
|
toggle_class(li, "disabled", ctx[42]);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(option_slot_or_fallback, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(option_slot_or_fallback, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(li);
|
||
|
if (option_slot_or_fallback)
|
||
|
option_slot_or_fallback.d(detaching);
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function create_fragment6(ctx) {
|
||
|
var _a2;
|
||
|
let div;
|
||
|
let input0;
|
||
|
let input0_required_value;
|
||
|
let input0_value_value;
|
||
|
let t0;
|
||
|
let t1;
|
||
|
let ul;
|
||
|
let each_blocks = [];
|
||
|
let each_1_lookup = /* @__PURE__ */ new Map();
|
||
|
let t2;
|
||
|
let input1;
|
||
|
let input1_class_value;
|
||
|
let input1_placeholder_value;
|
||
|
let input1_aria_invalid_value;
|
||
|
let ul_class_value;
|
||
|
let t3;
|
||
|
let t4;
|
||
|
let current_block_type_index;
|
||
|
let if_block1;
|
||
|
let t5;
|
||
|
let div_class_value;
|
||
|
let div_title_value;
|
||
|
let current;
|
||
|
let mounted;
|
||
|
let dispose;
|
||
|
add_render_callback(ctx[86]);
|
||
|
const expand_icon_slot_template = ctx[69]["expand-icon"];
|
||
|
const expand_icon_slot = create_slot(expand_icon_slot_template, ctx, ctx[107], get_expand_icon_slot_context);
|
||
|
const expand_icon_slot_or_fallback = expand_icon_slot || fallback_block_6(ctx);
|
||
|
let each_value_1 = ctx[4];
|
||
|
const get_key = (ctx2) => ctx2[110];
|
||
|
for (let i2 = 0; i2 < each_value_1.length; i2 += 1) {
|
||
|
let child_ctx = get_each_context_1(ctx, each_value_1, i2);
|
||
|
let key = get_key(child_ctx);
|
||
|
each_1_lookup.set(key, each_blocks[i2] = create_each_block_1(key, child_ctx));
|
||
|
}
|
||
|
let if_block0 = ctx[24] && create_if_block_8(ctx);
|
||
|
const if_block_creators = [create_if_block_4, create_if_block_5];
|
||
|
const if_blocks = [];
|
||
|
function select_block_type_1(ctx2, dirty) {
|
||
|
if (ctx2[42])
|
||
|
return 0;
|
||
|
if (ctx2[4].length > 0)
|
||
|
return 1;
|
||
|
return -1;
|
||
|
}
|
||
|
if (~(current_block_type_index = select_block_type_1(ctx, [-1, -1, -1, -1]))) {
|
||
|
if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
|
||
|
}
|
||
|
let if_block2 = (ctx[3] && ctx[29] || ((_a2 = ctx[2]) == null ? void 0 : _a2.length) > 0) && create_if_block(ctx);
|
||
|
return {
|
||
|
c() {
|
||
|
div = element("div");
|
||
|
input0 = element("input");
|
||
|
t0 = space();
|
||
|
if (expand_icon_slot_or_fallback)
|
||
|
expand_icon_slot_or_fallback.c();
|
||
|
t1 = space();
|
||
|
ul = element("ul");
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
each_blocks[i2].c();
|
||
|
}
|
||
|
t2 = space();
|
||
|
input1 = element("input");
|
||
|
t3 = space();
|
||
|
if (if_block0)
|
||
|
if_block0.c();
|
||
|
t4 = space();
|
||
|
if (if_block1)
|
||
|
if_block1.c();
|
||
|
t5 = space();
|
||
|
if (if_block2)
|
||
|
if_block2.c();
|
||
|
attr(input0, "name", ctx[28]);
|
||
|
input0.required = input0_required_value = Boolean(ctx[37]);
|
||
|
input0.value = input0_value_value = ctx[4].length >= Number(ctx[37]) ? JSON.stringify(ctx[4]) : null;
|
||
|
attr(input0, "tabindex", "-1");
|
||
|
attr(input0, "aria-hidden", "true");
|
||
|
attr(input0, "aria-label", "ignore this, used only to prevent form submission if select is required but empty");
|
||
|
attr(input0, "class", "form-control svelte-1r2hsto");
|
||
|
attr(input1, "class", input1_class_value = null_to_empty(ctx[19]) + " svelte-1r2hsto");
|
||
|
attr(input1, "id", ctx[18]);
|
||
|
input1.disabled = ctx[42];
|
||
|
attr(input1, "autocomplete", ctx[12]);
|
||
|
attr(input1, "inputmode", ctx[20]);
|
||
|
attr(input1, "pattern", ctx[32]);
|
||
|
attr(input1, "placeholder", input1_placeholder_value = ctx[4].length == 0 ? ctx[33] : null);
|
||
|
attr(input1, "aria-invalid", input1_aria_invalid_value = ctx[7] ? `true` : null);
|
||
|
attr(input1, "ondrop", "return false");
|
||
|
attr(ul, "class", ul_class_value = "selected " + ctx[40] + " svelte-1r2hsto");
|
||
|
attr(ul, "aria-label", "selected options");
|
||
|
attr(div, "class", div_class_value = "multiselect " + ctx[30] + " svelte-1r2hsto");
|
||
|
attr(div, "title", div_title_value = ctx[42] ? ctx[14] : null);
|
||
|
attr(div, "data-id", ctx[18]);
|
||
|
toggle_class(div, "disabled", ctx[42]);
|
||
|
toggle_class(div, "single", ctx[25] === 1);
|
||
|
toggle_class(div, "open", ctx[8]);
|
||
|
toggle_class(div, "invalid", ctx[7]);
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, div, anchor);
|
||
|
append(div, input0);
|
||
|
ctx[87](input0);
|
||
|
append(div, t0);
|
||
|
if (expand_icon_slot_or_fallback) {
|
||
|
expand_icon_slot_or_fallback.m(div, null);
|
||
|
}
|
||
|
append(div, t1);
|
||
|
append(div, ul);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
if (each_blocks[i2]) {
|
||
|
each_blocks[i2].m(ul, null);
|
||
|
}
|
||
|
}
|
||
|
append(ul, t2);
|
||
|
append(ul, input1);
|
||
|
ctx[92](input1);
|
||
|
set_input_value(input1, ctx[3]);
|
||
|
append(div, t3);
|
||
|
if (if_block0)
|
||
|
if_block0.m(div, null);
|
||
|
append(div, t4);
|
||
|
if (~current_block_type_index) {
|
||
|
if_blocks[current_block_type_index].m(div, null);
|
||
|
}
|
||
|
append(div, t5);
|
||
|
if (if_block2)
|
||
|
if_block2.m(div, null);
|
||
|
ctx[106](div);
|
||
|
current = true;
|
||
|
if (!mounted) {
|
||
|
dispose = [
|
||
|
listen(window, "click", ctx[55]),
|
||
|
listen(window, "touchstart", ctx[55]),
|
||
|
listen(window, "resize", ctx[86]),
|
||
|
listen(input0, "invalid", ctx[88]),
|
||
|
listen(input1, "input", ctx[93]),
|
||
|
listen(input1, "mouseup", self2(stop_propagation(ctx[51]))),
|
||
|
listen(input1, "keydown", stop_propagation(ctx[52])),
|
||
|
listen(input1, "focus", ctx[72]),
|
||
|
listen(input1, "focus", ctx[51]),
|
||
|
listen(input1, "input", ctx[58]),
|
||
|
listen(input1, "blur", ctx[73]),
|
||
|
listen(input1, "change", ctx[74]),
|
||
|
listen(input1, "click", ctx[75]),
|
||
|
listen(input1, "keydown", ctx[76]),
|
||
|
listen(input1, "keyup", ctx[77]),
|
||
|
listen(input1, "mousedown", ctx[78]),
|
||
|
listen(input1, "mouseenter", ctx[79]),
|
||
|
listen(input1, "mouseleave", ctx[80]),
|
||
|
listen(input1, "touchcancel", ctx[81]),
|
||
|
listen(input1, "touchend", ctx[82]),
|
||
|
listen(input1, "touchmove", ctx[83]),
|
||
|
listen(input1, "touchstart", ctx[84]),
|
||
|
listen(div, "mouseup", stop_propagation(ctx[51]))
|
||
|
];
|
||
|
mounted = true;
|
||
|
}
|
||
|
},
|
||
|
p(ctx2, dirty) {
|
||
|
var _a3;
|
||
|
if (!current || dirty[0] & 268435456) {
|
||
|
attr(input0, "name", ctx2[28]);
|
||
|
}
|
||
|
if (!current || dirty[1] & 64 && input0_required_value !== (input0_required_value = Boolean(ctx2[37]))) {
|
||
|
input0.required = input0_required_value;
|
||
|
}
|
||
|
if (!current || dirty[0] & 16 | dirty[1] & 64 && input0_value_value !== (input0_value_value = ctx2[4].length >= Number(ctx2[37]) ? JSON.stringify(ctx2[4]) : null) && input0.value !== input0_value_value) {
|
||
|
input0.value = input0_value_value;
|
||
|
}
|
||
|
if (expand_icon_slot) {
|
||
|
if (expand_icon_slot.p && (!current || dirty[0] & 256 | dirty[3] & 16384)) {
|
||
|
update_slot_base(expand_icon_slot, expand_icon_slot_template, ctx2, ctx2[107], !current ? get_all_dirty_from_scope(ctx2[107]) : get_slot_changes(expand_icon_slot_template, ctx2[107], dirty, get_expand_icon_slot_changes), get_expand_icon_slot_context);
|
||
|
}
|
||
|
}
|
||
|
if (dirty[0] & 8388624 | dirty[1] & 109612209 | dirty[3] & 16384) {
|
||
|
each_value_1 = ctx2[4];
|
||
|
group_outros();
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1)
|
||
|
each_blocks[i2].r();
|
||
|
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value_1, each_1_lookup, ul, fix_and_outro_and_destroy_block, create_each_block_1, t2, get_each_context_1);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1)
|
||
|
each_blocks[i2].a();
|
||
|
check_outros();
|
||
|
}
|
||
|
if (!current || dirty[0] & 524288 && input1_class_value !== (input1_class_value = null_to_empty(ctx2[19]) + " svelte-1r2hsto")) {
|
||
|
attr(input1, "class", input1_class_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 262144) {
|
||
|
attr(input1, "id", ctx2[18]);
|
||
|
}
|
||
|
if (!current || dirty[1] & 2048) {
|
||
|
input1.disabled = ctx2[42];
|
||
|
}
|
||
|
if (!current || dirty[0] & 4096) {
|
||
|
attr(input1, "autocomplete", ctx2[12]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 1048576) {
|
||
|
attr(input1, "inputmode", ctx2[20]);
|
||
|
}
|
||
|
if (!current || dirty[1] & 2) {
|
||
|
attr(input1, "pattern", ctx2[32]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 16 | dirty[1] & 4 && input1_placeholder_value !== (input1_placeholder_value = ctx2[4].length == 0 ? ctx2[33] : null)) {
|
||
|
attr(input1, "placeholder", input1_placeholder_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 128 && input1_aria_invalid_value !== (input1_aria_invalid_value = ctx2[7] ? `true` : null)) {
|
||
|
attr(input1, "aria-invalid", input1_aria_invalid_value);
|
||
|
}
|
||
|
if (dirty[0] & 8 && input1.value !== ctx2[3]) {
|
||
|
set_input_value(input1, ctx2[3]);
|
||
|
}
|
||
|
if (!current || dirty[1] & 512 && ul_class_value !== (ul_class_value = "selected " + ctx2[40] + " svelte-1r2hsto")) {
|
||
|
attr(ul, "class", ul_class_value);
|
||
|
}
|
||
|
if (ctx2[24]) {
|
||
|
if (if_block0) {
|
||
|
if_block0.p(ctx2, dirty);
|
||
|
if (dirty[0] & 16777216) {
|
||
|
transition_in(if_block0, 1);
|
||
|
}
|
||
|
} else {
|
||
|
if_block0 = create_if_block_8(ctx2);
|
||
|
if_block0.c();
|
||
|
transition_in(if_block0, 1);
|
||
|
if_block0.m(div, t4);
|
||
|
}
|
||
|
} else if (if_block0) {
|
||
|
group_outros();
|
||
|
transition_out(if_block0, 1, 1, () => {
|
||
|
if_block0 = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
let previous_block_index = current_block_type_index;
|
||
|
current_block_type_index = select_block_type_1(ctx2, dirty);
|
||
|
if (current_block_type_index === previous_block_index) {
|
||
|
if (~current_block_type_index) {
|
||
|
if_blocks[current_block_type_index].p(ctx2, dirty);
|
||
|
}
|
||
|
} else {
|
||
|
if (if_block1) {
|
||
|
group_outros();
|
||
|
transition_out(if_blocks[previous_block_index], 1, 1, () => {
|
||
|
if_blocks[previous_block_index] = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
if (~current_block_type_index) {
|
||
|
if_block1 = if_blocks[current_block_type_index];
|
||
|
if (!if_block1) {
|
||
|
if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
|
||
|
if_block1.c();
|
||
|
} else {
|
||
|
if_block1.p(ctx2, dirty);
|
||
|
}
|
||
|
transition_in(if_block1, 1);
|
||
|
if_block1.m(div, t5);
|
||
|
} else {
|
||
|
if_block1 = null;
|
||
|
}
|
||
|
}
|
||
|
if (ctx2[3] && ctx2[29] || ((_a3 = ctx2[2]) == null ? void 0 : _a3.length) > 0) {
|
||
|
if (if_block2) {
|
||
|
if_block2.p(ctx2, dirty);
|
||
|
if (dirty[0] & 536870924) {
|
||
|
transition_in(if_block2, 1);
|
||
|
}
|
||
|
} else {
|
||
|
if_block2 = create_if_block(ctx2);
|
||
|
if_block2.c();
|
||
|
transition_in(if_block2, 1);
|
||
|
if_block2.m(div, null);
|
||
|
}
|
||
|
} else if (if_block2) {
|
||
|
group_outros();
|
||
|
transition_out(if_block2, 1, 1, () => {
|
||
|
if_block2 = null;
|
||
|
});
|
||
|
check_outros();
|
||
|
}
|
||
|
if (!current || dirty[0] & 1073741824 && div_class_value !== (div_class_value = "multiselect " + ctx2[30] + " svelte-1r2hsto")) {
|
||
|
attr(div, "class", div_class_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 16384 | dirty[1] & 2048 && div_title_value !== (div_title_value = ctx2[42] ? ctx2[14] : null)) {
|
||
|
attr(div, "title", div_title_value);
|
||
|
}
|
||
|
if (!current || dirty[0] & 262144) {
|
||
|
attr(div, "data-id", ctx2[18]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 1073741824 | dirty[1] & 2048) {
|
||
|
toggle_class(div, "disabled", ctx2[42]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 1107296256) {
|
||
|
toggle_class(div, "single", ctx2[25] === 1);
|
||
|
}
|
||
|
if (!current || dirty[0] & 1073742080) {
|
||
|
toggle_class(div, "open", ctx2[8]);
|
||
|
}
|
||
|
if (!current || dirty[0] & 1073741952) {
|
||
|
toggle_class(div, "invalid", ctx2[7]);
|
||
|
}
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(expand_icon_slot_or_fallback, local);
|
||
|
for (let i2 = 0; i2 < each_value_1.length; i2 += 1) {
|
||
|
transition_in(each_blocks[i2]);
|
||
|
}
|
||
|
transition_in(if_block0);
|
||
|
transition_in(if_block1);
|
||
|
transition_in(if_block2);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(expand_icon_slot_or_fallback, local);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
transition_out(each_blocks[i2]);
|
||
|
}
|
||
|
transition_out(if_block0);
|
||
|
transition_out(if_block1);
|
||
|
transition_out(if_block2);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(div);
|
||
|
ctx[87](null);
|
||
|
if (expand_icon_slot_or_fallback)
|
||
|
expand_icon_slot_or_fallback.d(detaching);
|
||
|
for (let i2 = 0; i2 < each_blocks.length; i2 += 1) {
|
||
|
each_blocks[i2].d();
|
||
|
}
|
||
|
ctx[92](null);
|
||
|
if (if_block0)
|
||
|
if_block0.d();
|
||
|
if (~current_block_type_index) {
|
||
|
if_blocks[current_block_type_index].d();
|
||
|
}
|
||
|
if (if_block2)
|
||
|
if_block2.d();
|
||
|
ctx[106](null);
|
||
|
mounted = false;
|
||
|
run_all(dispose);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance6($$self, $$props, $$invalidate) {
|
||
|
var _a2;
|
||
|
let is_selected;
|
||
|
let { $$slots: slots = {}, $$scope } = $$props;
|
||
|
let { activeIndex = null } = $$props;
|
||
|
let { activeOption = null } = $$props;
|
||
|
let { createOptionMsg = `Create this option...` } = $$props;
|
||
|
let { allowUserOptions = false } = $$props;
|
||
|
let { allowEmpty = false } = $$props;
|
||
|
let { autocomplete = `off` } = $$props;
|
||
|
let { autoScroll = true } = $$props;
|
||
|
let { breakpoint = 800 } = $$props;
|
||
|
let { defaultDisabledTitle = `This option is disabled` } = $$props;
|
||
|
let { disabled = false } = $$props;
|
||
|
let { disabledInputTitle = `This input is disabled` } = $$props;
|
||
|
let { duplicateFunc = (op1, op2) => `${get_label(op1)}`.toLowerCase() === `${get_label(op2)}`.toLowerCase() } = $$props;
|
||
|
let { duplicateOptionMsg = `This option is already selected` } = $$props;
|
||
|
let { duplicates = false } = $$props;
|
||
|
let { filterFunc = (op, searchText2) => {
|
||
|
if (!searchText2)
|
||
|
return true;
|
||
|
return `${get_label(op)}`.toLowerCase().includes(searchText2.toLowerCase());
|
||
|
} } = $$props;
|
||
|
let { focusInputOnSelect = `desktop` } = $$props;
|
||
|
let { form_input = null } = $$props;
|
||
|
let { highlightMatches = true } = $$props;
|
||
|
let { id = null } = $$props;
|
||
|
let { input = null } = $$props;
|
||
|
let { inputClass = `` } = $$props;
|
||
|
let { inputmode = null } = $$props;
|
||
|
let { invalid = false } = $$props;
|
||
|
let { liActiveOptionClass = `` } = $$props;
|
||
|
let { liOptionClass = `` } = $$props;
|
||
|
let { liSelectedClass = `` } = $$props;
|
||
|
let { loading = false } = $$props;
|
||
|
let { matchingOptions = [] } = $$props;
|
||
|
let { maxSelect = null } = $$props;
|
||
|
let { maxSelectMsg = (current, max) => max > 1 ? `${current}/${max}` : `` } = $$props;
|
||
|
let { maxSelectMsgClass = `` } = $$props;
|
||
|
let { name = null } = $$props;
|
||
|
let { noMatchingOptionsMsg = `No matching options` } = $$props;
|
||
|
let { open = false } = $$props;
|
||
|
let { options } = $$props;
|
||
|
let { outerDiv = null } = $$props;
|
||
|
let { outerDivClass = `` } = $$props;
|
||
|
let { parseLabelsAsHtml = false } = $$props;
|
||
|
let { pattern = null } = $$props;
|
||
|
let { placeholder = null } = $$props;
|
||
|
let { removeAllTitle = `Remove all` } = $$props;
|
||
|
let { removeBtnTitle = `Remove` } = $$props;
|
||
|
let { minSelect = null } = $$props;
|
||
|
let { required = false } = $$props;
|
||
|
let { resetFilterOnAdd = true } = $$props;
|
||
|
let { searchText = `` } = $$props;
|
||
|
let { selected = (_a2 = options == null ? void 0 : options.filter((op) => op instanceof Object && (op == null ? void 0 : op.preselected)).slice(0, maxSelect != null ? maxSelect : void 0)) != null ? _a2 : [] } = $$props;
|
||
|
let { sortSelected = false } = $$props;
|
||
|
let { selectedOptionsDraggable = !sortSelected } = $$props;
|
||
|
let { ulOptionsClass = `` } = $$props;
|
||
|
let { ulSelectedClass = `` } = $$props;
|
||
|
let { value = null } = $$props;
|
||
|
const get_label = (op) => {
|
||
|
if (op instanceof Object) {
|
||
|
if (op.label === void 0) {
|
||
|
console.error(`MultiSelect option ${JSON.stringify(op)} is an object but has no label key`);
|
||
|
}
|
||
|
return op.label;
|
||
|
}
|
||
|
return op;
|
||
|
};
|
||
|
let wiggle = false;
|
||
|
if (!((options == null ? void 0 : options.length) > 0)) {
|
||
|
if (allowUserOptions || loading || disabled || allowEmpty) {
|
||
|
options = [];
|
||
|
} else {
|
||
|
console.error(`MultiSelect received no options`);
|
||
|
}
|
||
|
}
|
||
|
if (maxSelect !== null && maxSelect < 1) {
|
||
|
console.error(`MultiSelect's maxSelect must be null or positive integer, got ${maxSelect}`);
|
||
|
}
|
||
|
if (!Array.isArray(selected)) {
|
||
|
console.error(`MultiSelect's selected prop should always be an array, got ${selected}`);
|
||
|
}
|
||
|
if (maxSelect && typeof required === `number` && required > maxSelect) {
|
||
|
console.error(`MultiSelect maxSelect=${maxSelect} < required=${required}, makes it impossible for users to submit a valid form`);
|
||
|
}
|
||
|
if (parseLabelsAsHtml && allowUserOptions) {
|
||
|
console.warn(`Don't combine parseLabelsAsHtml and allowUserOptions. It's susceptible to XSS attacks!`);
|
||
|
}
|
||
|
if (sortSelected && selectedOptionsDraggable) {
|
||
|
console.warn(`MultiSelect's sortSelected and selectedOptionsDraggable should not be combined as any user re-orderings of selected options will be undone by sortSelected on component re-renders.`);
|
||
|
}
|
||
|
if (allowUserOptions && !createOptionMsg && createOptionMsg !== null) {
|
||
|
console.error(`MultiSelect has allowUserOptions=${allowUserOptions} but createOptionMsg=${createOptionMsg} is falsy. This prevents the "Add option" <span> from showing up, resulting in a confusing user experience.`);
|
||
|
}
|
||
|
const dispatch = createEventDispatcher();
|
||
|
let option_msg_is_active = false;
|
||
|
let window_width;
|
||
|
if (activeIndex !== null && !matchingOptions[activeIndex]) {
|
||
|
throw `Run time error, activeIndex=${activeIndex} is out of bounds, matchingOptions.length=${matchingOptions.length}`;
|
||
|
}
|
||
|
function add(option, event) {
|
||
|
if (maxSelect && maxSelect > 1 && selected.length >= maxSelect)
|
||
|
$$invalidate(43, wiggle = true);
|
||
|
if (!isNaN(Number(option)) && typeof selected.map(get_label)[0] === `number`) {
|
||
|
option = Number(option);
|
||
|
}
|
||
|
const is_duplicate = selected.some((op) => duplicateFunc(op, option));
|
||
|
if ((maxSelect === null || maxSelect === 1 || selected.length < maxSelect) && (duplicates || !is_duplicate)) {
|
||
|
if (!options.includes(option) && [true, `append`].includes(allowUserOptions) && searchText.length > 0) {
|
||
|
if (typeof options[0] === `object`) {
|
||
|
option = { label: searchText };
|
||
|
} else {
|
||
|
if ([`number`, `undefined`].includes(typeof options[0]) && !isNaN(Number(searchText))) {
|
||
|
option = Number(searchText);
|
||
|
} else {
|
||
|
option = searchText;
|
||
|
}
|
||
|
dispatch(`create`, { option });
|
||
|
}
|
||
|
if (allowUserOptions === `append`)
|
||
|
$$invalidate(2, options = [...options, option]);
|
||
|
}
|
||
|
if (resetFilterOnAdd)
|
||
|
$$invalidate(3, searchText = ``);
|
||
|
if ([``, void 0, null].includes(option)) {
|
||
|
console.error(`MultiSelect: encountered falsy option ${option}`);
|
||
|
return;
|
||
|
}
|
||
|
if (maxSelect === 1) {
|
||
|
$$invalidate(4, selected = [option]);
|
||
|
} else {
|
||
|
$$invalidate(4, selected = [...selected, option]);
|
||
|
if (sortSelected === true) {
|
||
|
$$invalidate(4, selected = selected.sort((op1, op2) => {
|
||
|
const [label1, label2] = [get_label(op1), get_label(op2)];
|
||
|
return `${label1}`.localeCompare(`${label2}`);
|
||
|
}));
|
||
|
} else if (typeof sortSelected === `function`) {
|
||
|
$$invalidate(4, selected = selected.sort(sortSelected));
|
||
|
}
|
||
|
}
|
||
|
if (selected.length === maxSelect)
|
||
|
close_dropdown(event);
|
||
|
else if (focusInputOnSelect === true || focusInputOnSelect === `desktop` && window_width > breakpoint) {
|
||
|
input == null ? void 0 : input.focus();
|
||
|
}
|
||
|
dispatch(`add`, { option });
|
||
|
dispatch(`change`, { option, type: `add` });
|
||
|
$$invalidate(7, invalid = false);
|
||
|
form_input == null ? void 0 : form_input.setCustomValidity(``);
|
||
|
}
|
||
|
}
|
||
|
function remove(to_remove) {
|
||
|
if (selected.length === 0)
|
||
|
return;
|
||
|
const idx = selected.findIndex((op) => JSON.stringify(op) === JSON.stringify(to_remove));
|
||
|
let [option] = selected.splice(idx, 1);
|
||
|
if (option === void 0 && allowUserOptions) {
|
||
|
const other_ops_type = typeof options[0];
|
||
|
option = other_ops_type ? { label: to_remove } : to_remove;
|
||
|
}
|
||
|
if (option === void 0) {
|
||
|
return console.error(`Multiselect can't remove selected option ${JSON.stringify(to_remove)}, not found in selected list`);
|
||
|
}
|
||
|
$$invalidate(4, selected = [...selected]);
|
||
|
$$invalidate(7, invalid = false);
|
||
|
form_input == null ? void 0 : form_input.setCustomValidity(``);
|
||
|
dispatch(`remove`, { option });
|
||
|
dispatch(`change`, { option, type: `remove` });
|
||
|
}
|
||
|
function open_dropdown(event) {
|
||
|
if (disabled)
|
||
|
return;
|
||
|
$$invalidate(8, open = true);
|
||
|
if (!(event instanceof FocusEvent)) {
|
||
|
input == null ? void 0 : input.focus();
|
||
|
}
|
||
|
dispatch(`open`, { event });
|
||
|
}
|
||
|
function close_dropdown(event) {
|
||
|
$$invalidate(8, open = false);
|
||
|
input == null ? void 0 : input.blur();
|
||
|
$$invalidate(0, activeIndex = null);
|
||
|
dispatch(`close`, { event });
|
||
|
}
|
||
|
async function handle_keydown(event) {
|
||
|
var _a3;
|
||
|
if (event.key === `Escape` || event.key === `Tab`) {
|
||
|
close_dropdown(event);
|
||
|
$$invalidate(3, searchText = ``);
|
||
|
} else if (event.key === `Enter`) {
|
||
|
event.preventDefault();
|
||
|
if (activeOption) {
|
||
|
selected.includes(activeOption) ? remove(activeOption) : add(activeOption, event);
|
||
|
$$invalidate(3, searchText = ``);
|
||
|
} else if (allowUserOptions && searchText.length > 0) {
|
||
|
add(searchText, event);
|
||
|
} else
|
||
|
open_dropdown(event);
|
||
|
} else if ([`ArrowDown`, `ArrowUp`].includes(event.key)) {
|
||
|
if (activeIndex === null && matchingOptions.length > 0) {
|
||
|
$$invalidate(0, activeIndex = 0);
|
||
|
return;
|
||
|
} else if (allowUserOptions && !matchingOptions.length && searchText.length > 0) {
|
||
|
$$invalidate(44, option_msg_is_active = !option_msg_is_active);
|
||
|
return;
|
||
|
} else if (activeIndex === null) {
|
||
|
return;
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
const increment = event.key === `ArrowUp` ? -1 : 1;
|
||
|
$$invalidate(0, activeIndex = (activeIndex + increment) % matchingOptions.length);
|
||
|
if (activeIndex < 0)
|
||
|
$$invalidate(0, activeIndex = matchingOptions.length - 1);
|
||
|
if (autoScroll) {
|
||
|
await tick();
|
||
|
const li = document.querySelector(`ul.options > li.active`);
|
||
|
if (li)
|
||
|
(_a3 = li.scrollIntoViewIfNeeded) == null ? void 0 : _a3.call(li);
|
||
|
}
|
||
|
} else if (event.key === `Backspace` && selected.length > 0 && !searchText) {
|
||
|
remove(selected.at(-1));
|
||
|
} else if (matchingOptions.length > 0) {
|
||
|
$$invalidate(0, activeIndex = 0);
|
||
|
}
|
||
|
}
|
||
|
function remove_all() {
|
||
|
$$invalidate(4, selected = []);
|
||
|
$$invalidate(3, searchText = ``);
|
||
|
dispatch(`removeAll`, { options: selected });
|
||
|
dispatch(`change`, { options: selected, type: `removeAll` });
|
||
|
}
|
||
|
const if_enter_or_space = (handler) => (event) => {
|
||
|
if ([`Enter`, `Space`].includes(event.code)) {
|
||
|
event.preventDefault();
|
||
|
handler();
|
||
|
}
|
||
|
};
|
||
|
function on_click_outside(event) {
|
||
|
if (outerDiv && !outerDiv.contains(event.target)) {
|
||
|
close_dropdown(event);
|
||
|
}
|
||
|
}
|
||
|
let drag_idx = null;
|
||
|
const drop = (target_idx) => (event) => {
|
||
|
if (!event.dataTransfer)
|
||
|
return;
|
||
|
event.dataTransfer.dropEffect = `move`;
|
||
|
const start_idx = parseInt(event.dataTransfer.getData(`text/plain`));
|
||
|
const new_selected = [...selected];
|
||
|
if (start_idx < target_idx) {
|
||
|
new_selected.splice(target_idx + 1, 0, new_selected[start_idx]);
|
||
|
new_selected.splice(start_idx, 1);
|
||
|
} else {
|
||
|
new_selected.splice(target_idx, 0, new_selected[start_idx]);
|
||
|
new_selected.splice(start_idx + 1, 1);
|
||
|
}
|
||
|
$$invalidate(4, selected = new_selected);
|
||
|
$$invalidate(46, drag_idx = null);
|
||
|
};
|
||
|
const dragstart = (idx) => (event) => {
|
||
|
if (!event.dataTransfer)
|
||
|
return;
|
||
|
event.dataTransfer.effectAllowed = `move`;
|
||
|
event.dataTransfer.dropEffect = `move`;
|
||
|
event.dataTransfer.setData(`text/plain`, `${idx}`);
|
||
|
};
|
||
|
let ul_options;
|
||
|
function highlight_matching_options(event) {
|
||
|
var _a3;
|
||
|
if (!highlightMatches || typeof CSS == `undefined` || !CSS.highlights)
|
||
|
return;
|
||
|
CSS.highlights.clear();
|
||
|
const query = (_a3 = event == null ? void 0 : event.target) == null ? void 0 : _a3.value.trim().toLowerCase();
|
||
|
if (!query)
|
||
|
return;
|
||
|
const tree_walker = document.createTreeWalker(ul_options, NodeFilter.SHOW_TEXT, {
|
||
|
acceptNode: (node) => {
|
||
|
if ((node == null ? void 0 : node.textContent) === noMatchingOptionsMsg)
|
||
|
return NodeFilter.FILTER_REJECT;
|
||
|
return NodeFilter.FILTER_ACCEPT;
|
||
|
}
|
||
|
});
|
||
|
const text_nodes = [];
|
||
|
let current_node = tree_walker.nextNode();
|
||
|
while (current_node) {
|
||
|
text_nodes.push(current_node);
|
||
|
current_node = tree_walker.nextNode();
|
||
|
}
|
||
|
const ranges = text_nodes.map((el) => {
|
||
|
var _a4;
|
||
|
const text2 = (_a4 = el.textContent) == null ? void 0 : _a4.toLowerCase();
|
||
|
const indices = [];
|
||
|
let start_pos = 0;
|
||
|
while (text2 && start_pos < text2.length) {
|
||
|
const index = text2.indexOf(query, start_pos);
|
||
|
if (index === -1)
|
||
|
break;
|
||
|
indices.push(index);
|
||
|
start_pos = index + query.length;
|
||
|
}
|
||
|
return indices.map((index) => {
|
||
|
const range = new Range();
|
||
|
range.setStart(el, index);
|
||
|
range.setEnd(el, index + query.length);
|
||
|
return range;
|
||
|
});
|
||
|
});
|
||
|
CSS.highlights.set(`sms-search-matches`, new Highlight(...ranges.flat()));
|
||
|
}
|
||
|
function mousedown_handler_1(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function mousedown_handler_2(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function focus_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function blur_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function change_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function click_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function keydown_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function keyup_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function mousedown_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function mouseenter_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function mouseleave_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function touchcancel_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function touchend_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function touchmove_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function touchstart_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function dragover_handler(event) {
|
||
|
bubble.call(this, $$self, event);
|
||
|
}
|
||
|
function onwindowresize() {
|
||
|
$$invalidate(45, window_width = window.innerWidth);
|
||
|
}
|
||
|
function input0_binding($$value) {
|
||
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
||
|
form_input = $$value;
|
||
|
$$invalidate(5, form_input);
|
||
|
});
|
||
|
}
|
||
|
const invalid_handler = () => {
|
||
|
$$invalidate(7, invalid = true);
|
||
|
let msg;
|
||
|
if (maxSelect && maxSelect > 1 && Number(required) > 1) {
|
||
|
msg = `Please select between ${required} and ${maxSelect} options`;
|
||
|
} else if (Number(required) > 1) {
|
||
|
msg = `Please select at least ${required} options`;
|
||
|
} else {
|
||
|
msg = `Please select an option`;
|
||
|
}
|
||
|
form_input == null ? void 0 : form_input.setCustomValidity(msg);
|
||
|
};
|
||
|
const mouseup_handler = (option) => remove(option);
|
||
|
const keydown_handler_1 = (option) => remove(option);
|
||
|
const dragenter_handler = (idx) => $$invalidate(46, drag_idx = idx);
|
||
|
function input1_binding($$value) {
|
||
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
||
|
input = $$value;
|
||
|
$$invalidate(6, input);
|
||
|
});
|
||
|
}
|
||
|
function input1_input_handler() {
|
||
|
searchText = this.value;
|
||
|
$$invalidate(3, searchText);
|
||
|
}
|
||
|
function wiggle_1_wiggle_binding(value2) {
|
||
|
wiggle = value2;
|
||
|
$$invalidate(43, wiggle);
|
||
|
}
|
||
|
const mouseup_handler_1 = (disabled2, option, event) => {
|
||
|
if (!disabled2)
|
||
|
add(option, event);
|
||
|
};
|
||
|
const mouseover_handler = (disabled2, idx) => {
|
||
|
if (!disabled2)
|
||
|
$$invalidate(0, activeIndex = idx);
|
||
|
};
|
||
|
const focus_handler_1 = (disabled2, idx) => {
|
||
|
if (!disabled2)
|
||
|
$$invalidate(0, activeIndex = idx);
|
||
|
};
|
||
|
const mouseout_handler = () => $$invalidate(0, activeIndex = null);
|
||
|
const blur_handler_1 = () => $$invalidate(0, activeIndex = null);
|
||
|
const mouseup_handler_2 = (event) => add(searchText, event);
|
||
|
const mouseover_handler_1 = () => $$invalidate(44, option_msg_is_active = true);
|
||
|
const focus_handler_2 = () => $$invalidate(44, option_msg_is_active = true);
|
||
|
const mouseout_handler_1 = () => $$invalidate(44, option_msg_is_active = false);
|
||
|
const blur_handler_2 = () => $$invalidate(44, option_msg_is_active = false);
|
||
|
function ul_binding($$value) {
|
||
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
||
|
ul_options = $$value;
|
||
|
$$invalidate(47, ul_options);
|
||
|
});
|
||
|
}
|
||
|
function div_binding($$value) {
|
||
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
||
|
outerDiv = $$value;
|
||
|
$$invalidate(9, outerDiv);
|
||
|
});
|
||
|
}
|
||
|
$$self.$$set = ($$props2) => {
|
||
|
if ("activeIndex" in $$props2)
|
||
|
$$invalidate(0, activeIndex = $$props2.activeIndex);
|
||
|
if ("activeOption" in $$props2)
|
||
|
$$invalidate(59, activeOption = $$props2.activeOption);
|
||
|
if ("createOptionMsg" in $$props2)
|
||
|
$$invalidate(10, createOptionMsg = $$props2.createOptionMsg);
|
||
|
if ("allowUserOptions" in $$props2)
|
||
|
$$invalidate(11, allowUserOptions = $$props2.allowUserOptions);
|
||
|
if ("allowEmpty" in $$props2)
|
||
|
$$invalidate(61, allowEmpty = $$props2.allowEmpty);
|
||
|
if ("autocomplete" in $$props2)
|
||
|
$$invalidate(12, autocomplete = $$props2.autocomplete);
|
||
|
if ("autoScroll" in $$props2)
|
||
|
$$invalidate(62, autoScroll = $$props2.autoScroll);
|
||
|
if ("breakpoint" in $$props2)
|
||
|
$$invalidate(63, breakpoint = $$props2.breakpoint);
|
||
|
if ("defaultDisabledTitle" in $$props2)
|
||
|
$$invalidate(13, defaultDisabledTitle = $$props2.defaultDisabledTitle);
|
||
|
if ("disabled" in $$props2)
|
||
|
$$invalidate(42, disabled = $$props2.disabled);
|
||
|
if ("disabledInputTitle" in $$props2)
|
||
|
$$invalidate(14, disabledInputTitle = $$props2.disabledInputTitle);
|
||
|
if ("duplicateFunc" in $$props2)
|
||
|
$$invalidate(15, duplicateFunc = $$props2.duplicateFunc);
|
||
|
if ("duplicateOptionMsg" in $$props2)
|
||
|
$$invalidate(16, duplicateOptionMsg = $$props2.duplicateOptionMsg);
|
||
|
if ("duplicates" in $$props2)
|
||
|
$$invalidate(17, duplicates = $$props2.duplicates);
|
||
|
if ("filterFunc" in $$props2)
|
||
|
$$invalidate(64, filterFunc = $$props2.filterFunc);
|
||
|
if ("focusInputOnSelect" in $$props2)
|
||
|
$$invalidate(65, focusInputOnSelect = $$props2.focusInputOnSelect);
|
||
|
if ("form_input" in $$props2)
|
||
|
$$invalidate(5, form_input = $$props2.form_input);
|
||
|
if ("highlightMatches" in $$props2)
|
||
|
$$invalidate(66, highlightMatches = $$props2.highlightMatches);
|
||
|
if ("id" in $$props2)
|
||
|
$$invalidate(18, id = $$props2.id);
|
||
|
if ("input" in $$props2)
|
||
|
$$invalidate(6, input = $$props2.input);
|
||
|
if ("inputClass" in $$props2)
|
||
|
$$invalidate(19, inputClass = $$props2.inputClass);
|
||
|
if ("inputmode" in $$props2)
|
||
|
$$invalidate(20, inputmode = $$props2.inputmode);
|
||
|
if ("invalid" in $$props2)
|
||
|
$$invalidate(7, invalid = $$props2.invalid);
|
||
|
if ("liActiveOptionClass" in $$props2)
|
||
|
$$invalidate(21, liActiveOptionClass = $$props2.liActiveOptionClass);
|
||
|
if ("liOptionClass" in $$props2)
|
||
|
$$invalidate(22, liOptionClass = $$props2.liOptionClass);
|
||
|
if ("liSelectedClass" in $$props2)
|
||
|
$$invalidate(23, liSelectedClass = $$props2.liSelectedClass);
|
||
|
if ("loading" in $$props2)
|
||
|
$$invalidate(24, loading = $$props2.loading);
|
||
|
if ("matchingOptions" in $$props2)
|
||
|
$$invalidate(1, matchingOptions = $$props2.matchingOptions);
|
||
|
if ("maxSelect" in $$props2)
|
||
|
$$invalidate(25, maxSelect = $$props2.maxSelect);
|
||
|
if ("maxSelectMsg" in $$props2)
|
||
|
$$invalidate(26, maxSelectMsg = $$props2.maxSelectMsg);
|
||
|
if ("maxSelectMsgClass" in $$props2)
|
||
|
$$invalidate(27, maxSelectMsgClass = $$props2.maxSelectMsgClass);
|
||
|
if ("name" in $$props2)
|
||
|
$$invalidate(28, name = $$props2.name);
|
||
|
if ("noMatchingOptionsMsg" in $$props2)
|
||
|
$$invalidate(29, noMatchingOptionsMsg = $$props2.noMatchingOptionsMsg);
|
||
|
if ("open" in $$props2)
|
||
|
$$invalidate(8, open = $$props2.open);
|
||
|
if ("options" in $$props2)
|
||
|
$$invalidate(2, options = $$props2.options);
|
||
|
if ("outerDiv" in $$props2)
|
||
|
$$invalidate(9, outerDiv = $$props2.outerDiv);
|
||
|
if ("outerDivClass" in $$props2)
|
||
|
$$invalidate(30, outerDivClass = $$props2.outerDivClass);
|
||
|
if ("parseLabelsAsHtml" in $$props2)
|
||
|
$$invalidate(31, parseLabelsAsHtml = $$props2.parseLabelsAsHtml);
|
||
|
if ("pattern" in $$props2)
|
||
|
$$invalidate(32, pattern = $$props2.pattern);
|
||
|
if ("placeholder" in $$props2)
|
||
|
$$invalidate(33, placeholder = $$props2.placeholder);
|
||
|
if ("removeAllTitle" in $$props2)
|
||
|
$$invalidate(34, removeAllTitle = $$props2.removeAllTitle);
|
||
|
if ("removeBtnTitle" in $$props2)
|
||
|
$$invalidate(35, removeBtnTitle = $$props2.removeBtnTitle);
|
||
|
if ("minSelect" in $$props2)
|
||
|
$$invalidate(36, minSelect = $$props2.minSelect);
|
||
|
if ("required" in $$props2)
|
||
|
$$invalidate(37, required = $$props2.required);
|
||
|
if ("resetFilterOnAdd" in $$props2)
|
||
|
$$invalidate(67, resetFilterOnAdd = $$props2.resetFilterOnAdd);
|
||
|
if ("searchText" in $$props2)
|
||
|
$$invalidate(3, searchText = $$props2.searchText);
|
||
|
if ("selected" in $$props2)
|
||
|
$$invalidate(4, selected = $$props2.selected);
|
||
|
if ("sortSelected" in $$props2)
|
||
|
$$invalidate(68, sortSelected = $$props2.sortSelected);
|
||
|
if ("selectedOptionsDraggable" in $$props2)
|
||
|
$$invalidate(38, selectedOptionsDraggable = $$props2.selectedOptionsDraggable);
|
||
|
if ("ulOptionsClass" in $$props2)
|
||
|
$$invalidate(39, ulOptionsClass = $$props2.ulOptionsClass);
|
||
|
if ("ulSelectedClass" in $$props2)
|
||
|
$$invalidate(40, ulSelectedClass = $$props2.ulSelectedClass);
|
||
|
if ("value" in $$props2)
|
||
|
$$invalidate(60, value = $$props2.value);
|
||
|
if ("$$scope" in $$props2)
|
||
|
$$invalidate(107, $$scope = $$props2.$$scope);
|
||
|
};
|
||
|
$$self.$$.update = () => {
|
||
|
var _a3, _b;
|
||
|
if ($$self.$$.dirty[0] & 33554448) {
|
||
|
$:
|
||
|
$$invalidate(60, value = maxSelect === 1 ? (_a3 = selected[0]) != null ? _a3 : null : selected);
|
||
|
}
|
||
|
if ($$self.$$.dirty[0] & 28 | $$self.$$.dirty[2] & 4) {
|
||
|
$:
|
||
|
$$invalidate(1, matchingOptions = options.filter((op) => filterFunc(op, searchText) && !selected.includes(op)));
|
||
|
}
|
||
|
if ($$self.$$.dirty[0] & 3) {
|
||
|
$:
|
||
|
$$invalidate(59, activeOption = (_b = matchingOptions[activeIndex != null ? activeIndex : -1]) != null ? _b : null);
|
||
|
}
|
||
|
if ($$self.$$.dirty[0] & 16) {
|
||
|
$:
|
||
|
$$invalidate(48, is_selected = (label) => selected.map(get_label).includes(label));
|
||
|
}
|
||
|
};
|
||
|
return [
|
||
|
activeIndex,
|
||
|
matchingOptions,
|
||
|
options,
|
||
|
searchText,
|
||
|
selected,
|
||
|
form_input,
|
||
|
input,
|
||
|
invalid,
|
||
|
open,
|
||
|
outerDiv,
|
||
|
createOptionMsg,
|
||
|
allowUserOptions,
|
||
|
autocomplete,
|
||
|
defaultDisabledTitle,
|
||
|
disabledInputTitle,
|
||
|
duplicateFunc,
|
||
|
duplicateOptionMsg,
|
||
|
duplicates,
|
||
|
id,
|
||
|
inputClass,
|
||
|
inputmode,
|
||
|
liActiveOptionClass,
|
||
|
liOptionClass,
|
||
|
liSelectedClass,
|
||
|
loading,
|
||
|
maxSelect,
|
||
|
maxSelectMsg,
|
||
|
maxSelectMsgClass,
|
||
|
name,
|
||
|
noMatchingOptionsMsg,
|
||
|
outerDivClass,
|
||
|
parseLabelsAsHtml,
|
||
|
pattern,
|
||
|
placeholder,
|
||
|
removeAllTitle,
|
||
|
removeBtnTitle,
|
||
|
minSelect,
|
||
|
required,
|
||
|
selectedOptionsDraggable,
|
||
|
ulOptionsClass,
|
||
|
ulSelectedClass,
|
||
|
get_label,
|
||
|
disabled,
|
||
|
wiggle,
|
||
|
option_msg_is_active,
|
||
|
window_width,
|
||
|
drag_idx,
|
||
|
ul_options,
|
||
|
is_selected,
|
||
|
add,
|
||
|
remove,
|
||
|
open_dropdown,
|
||
|
handle_keydown,
|
||
|
remove_all,
|
||
|
if_enter_or_space,
|
||
|
on_click_outside,
|
||
|
drop,
|
||
|
dragstart,
|
||
|
highlight_matching_options,
|
||
|
activeOption,
|
||
|
value,
|
||
|
allowEmpty,
|
||
|
autoScroll,
|
||
|
breakpoint,
|
||
|
filterFunc,
|
||
|
focusInputOnSelect,
|
||
|
highlightMatches,
|
||
|
resetFilterOnAdd,
|
||
|
sortSelected,
|
||
|
slots,
|
||
|
mousedown_handler_1,
|
||
|
mousedown_handler_2,
|
||
|
focus_handler,
|
||
|
blur_handler,
|
||
|
change_handler,
|
||
|
click_handler,
|
||
|
keydown_handler,
|
||
|
keyup_handler,
|
||
|
mousedown_handler,
|
||
|
mouseenter_handler,
|
||
|
mouseleave_handler,
|
||
|
touchcancel_handler,
|
||
|
touchend_handler,
|
||
|
touchmove_handler,
|
||
|
touchstart_handler,
|
||
|
dragover_handler,
|
||
|
onwindowresize,
|
||
|
input0_binding,
|
||
|
invalid_handler,
|
||
|
mouseup_handler,
|
||
|
keydown_handler_1,
|
||
|
dragenter_handler,
|
||
|
input1_binding,
|
||
|
input1_input_handler,
|
||
|
wiggle_1_wiggle_binding,
|
||
|
mouseup_handler_1,
|
||
|
mouseover_handler,
|
||
|
focus_handler_1,
|
||
|
mouseout_handler,
|
||
|
blur_handler_1,
|
||
|
mouseup_handler_2,
|
||
|
mouseover_handler_1,
|
||
|
focus_handler_2,
|
||
|
mouseout_handler_1,
|
||
|
blur_handler_2,
|
||
|
ul_binding,
|
||
|
div_binding,
|
||
|
$$scope
|
||
|
];
|
||
|
}
|
||
|
var MultiSelect = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance6, create_fragment6, safe_not_equal, {
|
||
|
activeIndex: 0,
|
||
|
activeOption: 59,
|
||
|
createOptionMsg: 10,
|
||
|
allowUserOptions: 11,
|
||
|
allowEmpty: 61,
|
||
|
autocomplete: 12,
|
||
|
autoScroll: 62,
|
||
|
breakpoint: 63,
|
||
|
defaultDisabledTitle: 13,
|
||
|
disabled: 42,
|
||
|
disabledInputTitle: 14,
|
||
|
duplicateFunc: 15,
|
||
|
duplicateOptionMsg: 16,
|
||
|
duplicates: 17,
|
||
|
filterFunc: 64,
|
||
|
focusInputOnSelect: 65,
|
||
|
form_input: 5,
|
||
|
highlightMatches: 66,
|
||
|
id: 18,
|
||
|
input: 6,
|
||
|
inputClass: 19,
|
||
|
inputmode: 20,
|
||
|
invalid: 7,
|
||
|
liActiveOptionClass: 21,
|
||
|
liOptionClass: 22,
|
||
|
liSelectedClass: 23,
|
||
|
loading: 24,
|
||
|
matchingOptions: 1,
|
||
|
maxSelect: 25,
|
||
|
maxSelectMsg: 26,
|
||
|
maxSelectMsgClass: 27,
|
||
|
name: 28,
|
||
|
noMatchingOptionsMsg: 29,
|
||
|
open: 8,
|
||
|
options: 2,
|
||
|
outerDiv: 9,
|
||
|
outerDivClass: 30,
|
||
|
parseLabelsAsHtml: 31,
|
||
|
pattern: 32,
|
||
|
placeholder: 33,
|
||
|
removeAllTitle: 34,
|
||
|
removeBtnTitle: 35,
|
||
|
minSelect: 36,
|
||
|
required: 37,
|
||
|
resetFilterOnAdd: 67,
|
||
|
searchText: 3,
|
||
|
selected: 4,
|
||
|
sortSelected: 68,
|
||
|
selectedOptionsDraggable: 38,
|
||
|
ulOptionsClass: 39,
|
||
|
ulSelectedClass: 40,
|
||
|
value: 60,
|
||
|
get_label: 41
|
||
|
}, add_css2, [-1, -1, -1, -1]);
|
||
|
}
|
||
|
get get_label() {
|
||
|
return this.$$.ctx[41];
|
||
|
}
|
||
|
};
|
||
|
var MultiSelect_default = MultiSelect;
|
||
|
|
||
|
// node_modules/.pnpm/svelte-multiselect@8.6.2/node_modules/svelte-multiselect/dist/index.js
|
||
|
function scroll_into_view_if_needed_polyfill(centerIfNeeded = true) {
|
||
|
const elem = this;
|
||
|
const observer = new IntersectionObserver(function([entry]) {
|
||
|
const ratio = entry.intersectionRatio;
|
||
|
if (ratio < 1) {
|
||
|
const place = ratio <= 0 && centerIfNeeded ? `center` : `nearest`;
|
||
|
elem.scrollIntoView({
|
||
|
block: place,
|
||
|
inline: place
|
||
|
});
|
||
|
}
|
||
|
this.disconnect();
|
||
|
});
|
||
|
observer.observe(elem);
|
||
|
return observer;
|
||
|
}
|
||
|
var _a;
|
||
|
if (typeof Element !== `undefined` && !((_a = Element.prototype) == null ? void 0 : _a.scrollIntoViewIfNeeded) && typeof IntersectionObserver !== `undefined`) {
|
||
|
Element.prototype.scrollIntoViewIfNeeded = scroll_into_view_if_needed_polyfill;
|
||
|
}
|
||
|
|
||
|
// ../lib/dist/index.js
|
||
|
var import_obsidian = require("obsidian");
|
||
|
function F(U2, F2, Q2, B2) {
|
||
|
if (Q2 === "a" && !B2)
|
||
|
throw new TypeError("Private accessor was defined without a getter");
|
||
|
if (typeof F2 == "function" ? U2 !== F2 || !B2 : !F2.has(U2))
|
||
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||
|
return Q2 === "m" ? B2 : Q2 === "a" ? B2.call(U2) : B2 ? B2.value : F2.get(U2);
|
||
|
}
|
||
|
function Q(U2, F2, Q2, B2, R2) {
|
||
|
if (B2 === "m")
|
||
|
throw new TypeError("Private method is not writable");
|
||
|
if (B2 === "a" && !R2)
|
||
|
throw new TypeError("Private accessor was defined without a setter");
|
||
|
if (typeof F2 == "function" ? U2 !== F2 || !R2 : !F2.has(U2))
|
||
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||
|
return B2 === "a" ? R2.call(U2, Q2) : R2 ? R2.value = Q2 : F2.set(U2, Q2), Q2;
|
||
|
}
|
||
|
function B(U2, F2, Q2) {
|
||
|
var B2 = F2 === void 0 ? null : F2, R2 = function(U3, F3) {
|
||
|
var Q3 = atob(U3);
|
||
|
if (F3) {
|
||
|
for (var B3 = new Uint8Array(Q3.length), R3 = 0, V3 = Q3.length; R3 < V3; ++R3)
|
||
|
B3[R3] = Q3.charCodeAt(R3);
|
||
|
return String.fromCharCode.apply(null, new Uint16Array(B3.buffer));
|
||
|
}
|
||
|
return Q3;
|
||
|
}(U2, Q2 !== void 0 && Q2), V2 = R2.indexOf("\n", 10) + 1, l2 = R2.substring(V2) + (B2 ? "//# sourceMappingURL=" + B2 : ""), Z2 = new Blob([l2], { type: "application/javascript" });
|
||
|
return URL.createObjectURL(Z2);
|
||
|
}
|
||
|
var R;
|
||
|
var V;
|
||
|
var l;
|
||
|
var Z;
|
||
|
var d = (R = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7bGV0IEE7Y29uc3QgQj1uZXcgQXJyYXkoMTI4KS5maWxsKHZvaWQgMCk7Qi5wdXNoKHZvaWQgMCxudWxsLCEwLCExKTtsZXQgUT1CLmxlbmd0aDtmdW5jdGlvbiBnKEEpe1E9PT1CLmxlbmd0aCYmQi5wdXNoKEIubGVuZ3RoKzEpO2NvbnN0IGc9UTtyZXR1cm4gUT1CW2ddLEJbZ109QSxnfWNvbnN0IEk9InVuZGVmaW5lZCIhPXR5cGVvZiBUZXh0RGVjb2Rlcj9uZXcgVGV4dERlY29kZXIoInV0Zi04Iix7aWdub3JlQk9NOiEwLGZhdGFsOiEwfSk6e2RlY29kZTooKT0+e3Rocm93IEVycm9yKCJUZXh0RGVjb2RlciBub3QgYXZhaWxhYmxlIil9fTsidW5kZWZpbmVkIiE9dHlwZW9mIFRleHREZWNvZGVyJiZJLmRlY29kZSgpO2xldCBDPW51bGw7ZnVuY3Rpb24gRShCLFEpe3JldHVybiBCPj4+PTAsSS5kZWNvZGUoKG51bGwhPT1DJiYwIT09Qy5ieXRlTGVuZ3RofHwoQz1uZXcgVWludDhBcnJheShBLm1lbW9yeS5idWZmZXIpKSxDKS5zdWJhcnJheShCLEIrUSkpfWZ1bmN0aW9uIEQoQSl7cmV0dXJuIEJbQV19ZnVuY3Rpb24gdyhBKXtjb25zdCBnPUQoQSk7cmV0dXJuIGZ1bmN0aW9uKEEpe0E8MTMyfHwoQltBXT1RLFE9QSl9KEEpLGd9bGV0IE49bnVsbDtmdW5jdGlvbiBHKCl7cmV0dXJuIG51bGwhPT1OJiYwIT09Ti5ieXRlTGVuZ3RofHwoTj1uZXcgSW50MzJBcnJheShBLm1lbW9yeS5idWZmZXIpKSxOfWFzeW5jIGZ1bmN0aW9uIFkoQil7aWYodm9pZCAwIT09QSlyZXR1cm4gQTt2b2lkIDA9PT1CJiYoQj1uZXcgVVJMKCJvYnNpZGlhbl90ZXh0X2V4dHJhY3RfYmcud2FzbSIsZG9jdW1lbnQuY3VycmVudFNjcmlwdCYmZG9jdW1lbnQuY3VycmVudFNjcmlwdC5zcmN8fG5ldyBVUkwoInBkZi13b3JrZXIuanMiLGRvY3VtZW50LmJhc2VVUkkpLmhyZWYpKTtjb25zdCBRPWZ1bmN0aW9uKCl7Y29uc3QgQj17d2JnOnt9fTtyZXR1cm4gQi53YmcuX193YmdfbGVuZ3RoX2MyMGE0MGYxNTAyMGQ2OGE9ZnVuY3Rpb24oQSl7cmV0dXJuIEQoQSkubGVuZ3RofSxCLndiZy5fX3diaW5kZ2VuX21lbW9yeT1mdW5jdGlvbigpe3JldHVybiBnKEEubWVtb3J5KX0sQi53YmcuX193YmdfYnVmZmVyXzEyZDA3OWNjMjFlMTRiZGI9ZnVuY3Rpb24oQSl7cmV0dXJuIGcoRChBKS5idWZmZXIpfSxCLndiZy5fX3diZ19uZXdfNjNiOTJiYzg2NzFlZDQ2ND1mdW5jdGlvbihBKXtyZXR1cm4gZyhuZXcgVWludDhBcnJheShEKEEpKSl9LEIud2JnLl9fd2JnX3NldF9hNDdiYWM3MDMwNmExOWE3PWZ1bmN0aW9uKEEsQixRKXtEKEEpLnNldChEKEIpLFE+Pj4wKX0sQi53YmcuX193YmluZGdlbl9lcnJvcl9uZXc9ZnVuY3Rpb24oQSxCKXtyZXR1cm4gZyhuZXcgRXJyb3IoRShBLEIpKSl9LEIud2JnLl9fd2JpbmRnZW5fb2JqZWN0X2Ryb3BfcmVmPWZ1bmN0aW9uKEEpe3coQSl9LEIud2JnLl9fd2JpbmRnZW5fdGhyb3c9ZnVuY3Rpb24oQSxCKXt0aHJvdyBuZXcgRXJyb3IoRShBLEIpKX0sQn0oKTsoInN0cmluZyI9PXR5cGVvZiBCfHwiZnVuY3Rpb24iPT10eXBlb2YgUmVxdWVzdCYmQiBpbnN0YW5jZW9mIFJlcXVlc3R8fCJmdW5jdGlvbiI9PXR5cGVvZiBVUkwmJkIgaW5zdGFuY2VvZiBVUkwpJiYoQj1mZXRjaChCKSk7Y29uc3R7aW5zdGFuY2U6SSxtb2R1bGU6R309YXdhaXQgYXN5bmMgZnVuY3Rpb24oQSxCKXtpZigiZnVuY3Rpb24iPT10eXBlb2YgUmVzcG9uc2UmJkEgaW5zdGFuY2VvZiBSZXNwb25zZSl7aWYoImZ1bmN0aW9uIj09dHlwZW9mIFdlYkFzc2VtYmx5Lmluc3RhbnRpYXRlU3RyZWFtaW5nKXRyeXtyZXR1cm4gYXdhaXQgV2ViQXNzZW1ibHkuaW5zdGFudGlhdGVTdHJlYW1pbmcoQSxCKX1jYXRjaChCKXtpZigiYXBwbGljYXRpb24vd2FzbSI9PUEuaGVhZGVycy5nZXQoIkNvbnRlbnQtVHlwZSIpKXRocm93IEI7Y29uc29sZS53YXJuKCJgV2ViQXNzZW1ibHkuaW5zdGFudGlhdGVTdHJlYW1pbmdgIGZhaWxlZCBiZWNhdXNlIHlvdXIgc2VydmVyIGRvZXMgbm90IHNlcnZlIHdhc20gd2l0aCBgYXBwbGljYXRpb24vd2FzbWAgTUlNRSB0eXBlLiBGYWxsaW5nIGJhY2sgdG8gYFdlYkFzc2VtYmx5Lmluc3RhbnRpYXRlYCB3aGljaCBpcyBzbG93ZXIuIE9yaWdpbmFsIGVycm9yOlxuIixCKX1jb25zdCBRPWF3YWl0IEEuYXJyYXlCdWZmZXIoKTtyZXR1cm4gYXdhaXQgV2ViQXNzZW1ibHkuaW5zdGFudGlhdGUoUSxCKX17Y29uc3QgUT1hd2FpdCBXZWJBc3NlbWJseS5pbnN0YW50aWF0ZShBLEIpO3JldHVybiBRIGluc3RhbmNlb2YgV2ViQXNzZW1ibHkuSW5zdGFuY2U/e2luc3RhbmNlOlEsbW9kdWxlOkF9OlF9fShhd2FpdCBCLFEpO3JldHVybiBmdW5jdGlvbihCLFEpe3JldHVybiBBPUIuZXhwb3J0cyxZLl9fd2JpbmRnZW5fd2FzbV9tb2R1bGU9USxOPW51bGwsQz1udWxsLEF9KEksRyl9Y29uc3QgTT1hdG9iKCJBR0Z6YlFFQUFBQUIyd0l2WUFSL2YzOS9BR0FDZjM4QVlBSi9md0YvWUFOL2YzOEJmMkFCZndCZ0EzOS9md0JnQVg4QmYyQUZmMzkvZjM4QVlBQUJmMkFFZjM5L2Z3Ri9ZQVovZjM5L2YzOEFZQVYvZjM5L2Z3Ri9ZQU4vZjM4QmZtQUFBR0FDZjM4QmZHQUVmbjUvZndGK1lBUi9mMzkrQUdBQ2YzNEFZQVovZjM5L2YzOEJmMkFIZjM5L2YzOS9md0YvWUFaL2YzOStmMzhBWUFkL2YzOS9mMzkvQUdBRGYzOStBWDlnQ0g5L2YzOS9mMzkvQUdBR2YzNS9mMzkvQUdBRGYzNStBR0FKZjM5L2YzOS9mbjUrQUdBQmZ3RitZQU4rZjM4QmYyQURmMzk4QUdBRWYzOStmd0JnQ0g5L2YzOS9mMzkvQVg5Z0MzOS9mMzkvZjM5L2YzOS9BWDlnQTM1K2Z3RitZQVIvZm41K0FHQUVmMzkvZndGK1lBTi9mMzRBWUFGL0FYeGdBbjkrQVg5Z0JYOS9mWDkvQUdBRWYzMS9md0JnQlg5L2ZIOS9BR0FFZjN4L2Z3QmdCWDkvZm45L0FHQUVmMzUvZndCZ0FuOStBWDVnQW41L0FBTDJBUWdEZDJKbkhWOWZkMkpuWDJ4bGJtZDBhRjlqTWpCaE5EQm1NVFV3TWpCa05qaGhBQVlEZDJKbkVWOWZkMkpwYm1SblpXNWZiV1Z0YjNKNUFBZ0RkMkpuSFY5ZmQySm5YMkoxWm1abGNsOHhNbVF3Tnpsall6SXhaVEUwWW1SaUFBWURkMkpuR2w5Z
|
||
|
return Z = Z || B(R, V, l), new Worker(Z, U2);
|
||
|
});
|
||
|
var W = "0.3.2";
|
||
|
var J = (typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" && self, {});
|
||
|
!function(U2) {
|
||
|
var F2 = Object.prototype.hasOwnProperty, Q2 = "~";
|
||
|
function B2() {
|
||
|
}
|
||
|
function R2(U3, F3, Q3) {
|
||
|
this.fn = U3, this.context = F3, this.once = Q3 || false;
|
||
|
}
|
||
|
function V2(U3, F3, B3, V3, l3) {
|
||
|
if (typeof B3 != "function")
|
||
|
throw new TypeError("The listener must be a function");
|
||
|
var Z3 = new R2(B3, V3 || U3, l3), d2 = Q2 ? Q2 + F3 : F3;
|
||
|
return U3._events[d2] ? U3._events[d2].fn ? U3._events[d2] = [U3._events[d2], Z3] : U3._events[d2].push(Z3) : (U3._events[d2] = Z3, U3._eventsCount++), U3;
|
||
|
}
|
||
|
function l2(U3, F3) {
|
||
|
--U3._eventsCount == 0 ? U3._events = new B2() : delete U3._events[F3];
|
||
|
}
|
||
|
function Z2() {
|
||
|
this._events = new B2(), this._eventsCount = 0;
|
||
|
}
|
||
|
Object.create && (B2.prototype = /* @__PURE__ */ Object.create(null), new B2().__proto__ || (Q2 = false)), Z2.prototype.eventNames = function() {
|
||
|
var U3, B3, R3 = [];
|
||
|
if (this._eventsCount === 0)
|
||
|
return R3;
|
||
|
for (B3 in U3 = this._events)
|
||
|
F2.call(U3, B3) && R3.push(Q2 ? B3.slice(1) : B3);
|
||
|
return Object.getOwnPropertySymbols ? R3.concat(Object.getOwnPropertySymbols(U3)) : R3;
|
||
|
}, Z2.prototype.listeners = function(U3) {
|
||
|
var F3 = Q2 ? Q2 + U3 : U3, B3 = this._events[F3];
|
||
|
if (!B3)
|
||
|
return [];
|
||
|
if (B3.fn)
|
||
|
return [B3.fn];
|
||
|
for (var R3 = 0, V3 = B3.length, l3 = new Array(V3); R3 < V3; R3++)
|
||
|
l3[R3] = B3[R3].fn;
|
||
|
return l3;
|
||
|
}, Z2.prototype.listenerCount = function(U3) {
|
||
|
var F3 = Q2 ? Q2 + U3 : U3, B3 = this._events[F3];
|
||
|
return B3 ? B3.fn ? 1 : B3.length : 0;
|
||
|
}, Z2.prototype.emit = function(U3, F3, B3, R3, V3, l3) {
|
||
|
var Z3 = Q2 ? Q2 + U3 : U3;
|
||
|
if (!this._events[Z3])
|
||
|
return false;
|
||
|
var d2, W2, J2 = this._events[Z3], N2 = arguments.length;
|
||
|
if (J2.fn) {
|
||
|
switch (J2.once && this.removeListener(U3, J2.fn, void 0, true), N2) {
|
||
|
case 1:
|
||
|
return J2.fn.call(J2.context), true;
|
||
|
case 2:
|
||
|
return J2.fn.call(J2.context, F3), true;
|
||
|
case 3:
|
||
|
return J2.fn.call(J2.context, F3, B3), true;
|
||
|
case 4:
|
||
|
return J2.fn.call(J2.context, F3, B3, R3), true;
|
||
|
case 5:
|
||
|
return J2.fn.call(J2.context, F3, B3, R3, V3), true;
|
||
|
case 6:
|
||
|
return J2.fn.call(J2.context, F3, B3, R3, V3, l3), true;
|
||
|
}
|
||
|
for (W2 = 1, d2 = new Array(N2 - 1); W2 < N2; W2++)
|
||
|
d2[W2 - 1] = arguments[W2];
|
||
|
J2.fn.apply(J2.context, d2);
|
||
|
} else {
|
||
|
var S2, I2 = J2.length;
|
||
|
for (W2 = 0; W2 < I2; W2++)
|
||
|
switch (J2[W2].once && this.removeListener(U3, J2[W2].fn, void 0, true), N2) {
|
||
|
case 1:
|
||
|
J2[W2].fn.call(J2[W2].context);
|
||
|
break;
|
||
|
case 2:
|
||
|
J2[W2].fn.call(J2[W2].context, F3);
|
||
|
break;
|
||
|
case 3:
|
||
|
J2[W2].fn.call(J2[W2].context, F3, B3);
|
||
|
break;
|
||
|
case 4:
|
||
|
J2[W2].fn.call(J2[W2].context, F3, B3, R3);
|
||
|
break;
|
||
|
default:
|
||
|
if (!d2)
|
||
|
for (S2 = 1, d2 = new Array(N2 - 1); S2 < N2; S2++)
|
||
|
d2[S2 - 1] = arguments[S2];
|
||
|
J2[W2].fn.apply(J2[W2].context, d2);
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}, Z2.prototype.on = function(U3, F3, Q3) {
|
||
|
return V2(this, U3, F3, Q3, false);
|
||
|
}, Z2.prototype.once = function(U3, F3, Q3) {
|
||
|
return V2(this, U3, F3, Q3, true);
|
||
|
}, Z2.prototype.removeListener = function(U3, F3, B3, R3) {
|
||
|
var V3 = Q2 ? Q2 + U3 : U3;
|
||
|
if (!this._events[V3])
|
||
|
return this;
|
||
|
if (!F3)
|
||
|
return l2(this, V3), this;
|
||
|
var Z3 = this._events[V3];
|
||
|
if (Z3.fn)
|
||
|
Z3.fn !== F3 || R3 && !Z3.once || B3 && Z3.context !== B3 || l2(this, V3);
|
||
|
else {
|
||
|
for (var d2 = 0, W2 = [], J2 = Z3.length; d2 < J2; d2++)
|
||
|
(Z3[d2].fn !== F3 || R3 && !Z3[d2].once || B3 && Z3[d2].context !== B3) && W2.push(Z3[d2]);
|
||
|
W2.length ? this._events[V3] = W2.length === 1 ? W2[0] : W2 : l2(this, V3);
|
||
|
}
|
||
|
return this;
|
||
|
}, Z2.prototype.removeAllListeners = function(U3) {
|
||
|
var F3;
|
||
|
return U3 ? (F3 = Q2 ? Q2 + U3 : U3, this._events[F3] && l2(this, F3)) : (this._events = new B2(), this._eventsCount = 0), this;
|
||
|
}, Z2.prototype.off = Z2.prototype.removeListener, Z2.prototype.addListener = Z2.prototype.on, Z2.prefixed = Q2, Z2.EventEmitter = Z2, U2.exports = Z2;
|
||
|
}({ get exports() {
|
||
|
return J;
|
||
|
}, set exports(U2) {
|
||
|
J = U2;
|
||
|
} });
|
||
|
var N = J;
|
||
|
var S = class extends Error {
|
||
|
constructor(U2) {
|
||
|
super(U2), this.name = "TimeoutError";
|
||
|
}
|
||
|
};
|
||
|
var I = class extends Error {
|
||
|
constructor(U2) {
|
||
|
super(), this.name = "AbortError", this.message = U2;
|
||
|
}
|
||
|
};
|
||
|
var m = (U2) => globalThis.DOMException === void 0 ? new I(U2) : new DOMException(U2);
|
||
|
var i = (U2) => {
|
||
|
const F2 = U2.reason === void 0 ? m("This operation was aborted.") : U2.reason;
|
||
|
return F2 instanceof Error ? F2 : m(F2);
|
||
|
};
|
||
|
var b;
|
||
|
var E = function(U2, F2, Q2, B2) {
|
||
|
if (Q2 === "a" && !B2)
|
||
|
throw new TypeError("Private accessor was defined without a getter");
|
||
|
if (typeof F2 == "function" ? U2 !== F2 || !B2 : !F2.has(U2))
|
||
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||
|
return Q2 === "m" ? B2 : Q2 === "a" ? B2.call(U2) : B2 ? B2.value : F2.get(U2);
|
||
|
};
|
||
|
var G = class {
|
||
|
constructor() {
|
||
|
b.set(this, []);
|
||
|
}
|
||
|
enqueue(U2, F2) {
|
||
|
const Q2 = { priority: (F2 = { priority: 0, ...F2 }).priority, run: U2 };
|
||
|
if (this.size && E(this, b, "f")[this.size - 1].priority >= F2.priority)
|
||
|
return void E(this, b, "f").push(Q2);
|
||
|
const B2 = function(U3, F3, Q3) {
|
||
|
let B3 = 0, R2 = U3.length;
|
||
|
for (; R2 > 0; ) {
|
||
|
const V2 = Math.trunc(R2 / 2);
|
||
|
let l2 = B3 + V2;
|
||
|
Q3(U3[l2], F3) <= 0 ? (B3 = ++l2, R2 -= V2 + 1) : R2 = V2;
|
||
|
}
|
||
|
return B3;
|
||
|
}(E(this, b, "f"), Q2, (U3, F3) => F3.priority - U3.priority);
|
||
|
E(this, b, "f").splice(B2, 0, Q2);
|
||
|
}
|
||
|
dequeue() {
|
||
|
const U2 = E(this, b, "f").shift();
|
||
|
return U2 == null ? void 0 : U2.run;
|
||
|
}
|
||
|
filter(U2) {
|
||
|
return E(this, b, "f").filter((F2) => F2.priority === U2.priority).map((U3) => U3.run);
|
||
|
}
|
||
|
get size() {
|
||
|
return E(this, b, "f").length;
|
||
|
}
|
||
|
};
|
||
|
b = /* @__PURE__ */ new WeakMap();
|
||
|
var k;
|
||
|
var n;
|
||
|
var T;
|
||
|
var c;
|
||
|
var Y;
|
||
|
var X;
|
||
|
var h;
|
||
|
var p;
|
||
|
var C;
|
||
|
var a;
|
||
|
var M;
|
||
|
var y;
|
||
|
var L;
|
||
|
var j;
|
||
|
var x;
|
||
|
var D;
|
||
|
var u;
|
||
|
var s;
|
||
|
var t;
|
||
|
var z;
|
||
|
var H;
|
||
|
var K;
|
||
|
var o;
|
||
|
var O;
|
||
|
var w;
|
||
|
var v;
|
||
|
var e = function(U2, F2, Q2, B2, R2) {
|
||
|
if (B2 === "m")
|
||
|
throw new TypeError("Private method is not writable");
|
||
|
if (B2 === "a" && !R2)
|
||
|
throw new TypeError("Private accessor was defined without a setter");
|
||
|
if (typeof F2 == "function" ? U2 !== F2 || !R2 : !F2.has(U2))
|
||
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||
|
return B2 === "a" ? R2.call(U2, Q2) : R2 ? R2.value = Q2 : F2.set(U2, Q2), Q2;
|
||
|
};
|
||
|
var g = function(U2, F2, Q2, B2) {
|
||
|
if (Q2 === "a" && !B2)
|
||
|
throw new TypeError("Private accessor was defined without a getter");
|
||
|
if (typeof F2 == "function" ? U2 !== F2 || !B2 : !F2.has(U2))
|
||
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||
|
return Q2 === "m" ? B2 : Q2 === "a" ? B2.call(U2) : B2 ? B2.value : F2.get(U2);
|
||
|
};
|
||
|
var P = class extends Error {
|
||
|
};
|
||
|
var r = class extends N {
|
||
|
constructor(U2) {
|
||
|
var F2, Q2, B2, R2;
|
||
|
if (super(), k.add(this), n.set(this, void 0), T.set(this, void 0), c.set(this, 0), Y.set(this, void 0), X.set(this, void 0), h.set(this, 0), p.set(this, void 0), C.set(this, void 0), a.set(this, void 0), M.set(this, void 0), y.set(this, 0), L.set(this, void 0), j.set(this, void 0), x.set(this, void 0), Object.defineProperty(this, "timeout", { enumerable: true, configurable: true, writable: true, value: void 0 }), !(typeof (U2 = { carryoverConcurrencyCount: false, intervalCap: Number.POSITIVE_INFINITY, interval: 0, concurrency: Number.POSITIVE_INFINITY, autoStart: true, queueClass: G, ...U2 }).intervalCap == "number" && U2.intervalCap >= 1))
|
||
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(Q2 = (F2 = U2.intervalCap) === null || F2 === void 0 ? void 0 : F2.toString()) !== null && Q2 !== void 0 ? Q2 : ""}\` (${typeof U2.intervalCap})`);
|
||
|
if (U2.interval === void 0 || !(Number.isFinite(U2.interval) && U2.interval >= 0))
|
||
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(R2 = (B2 = U2.interval) === null || B2 === void 0 ? void 0 : B2.toString()) !== null && R2 !== void 0 ? R2 : ""}\` (${typeof U2.interval})`);
|
||
|
e(this, n, U2.carryoverConcurrencyCount, "f"), e(this, T, U2.intervalCap === Number.POSITIVE_INFINITY || U2.interval === 0, "f"), e(this, Y, U2.intervalCap, "f"), e(this, X, U2.interval, "f"), e(this, a, new U2.queueClass(), "f"), e(this, M, U2.queueClass, "f"), this.concurrency = U2.concurrency, this.timeout = U2.timeout, e(this, x, U2.throwOnTimeout === true, "f"), e(this, j, U2.autoStart === false, "f");
|
||
|
}
|
||
|
get concurrency() {
|
||
|
return g(this, L, "f");
|
||
|
}
|
||
|
set concurrency(U2) {
|
||
|
if (!(typeof U2 == "number" && U2 >= 1))
|
||
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${U2}\` (${typeof U2})`);
|
||
|
e(this, L, U2, "f"), g(this, k, "m", O).call(this);
|
||
|
}
|
||
|
async add(U2, F2 = {}) {
|
||
|
return F2 = { timeout: this.timeout, throwOnTimeout: g(this, x, "f"), ...F2 }, new Promise((Q2, B2) => {
|
||
|
g(this, a, "f").enqueue(async () => {
|
||
|
var R2, V2, l2;
|
||
|
e(this, y, (V2 = g(this, y, "f"), ++V2), "f"), e(this, c, (l2 = g(this, c, "f"), ++l2), "f");
|
||
|
try {
|
||
|
if ((R2 = F2.signal) === null || R2 === void 0 ? void 0 : R2.aborted)
|
||
|
throw new P("The task was aborted.");
|
||
|
let B3 = U2({ signal: F2.signal });
|
||
|
F2.timeout && (B3 = function(U3, F3, Q3, B4) {
|
||
|
let R3;
|
||
|
const V4 = new Promise((V5, l3) => {
|
||
|
if (typeof F3 != "number" || Math.sign(F3) !== 1)
|
||
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${F3}\``);
|
||
|
if (F3 !== Number.POSITIVE_INFINITY) {
|
||
|
if ((B4 = { customTimers: { setTimeout, clearTimeout }, ...B4 }).signal) {
|
||
|
const { signal: U4 } = B4;
|
||
|
U4.aborted && l3(i(U4)), U4.addEventListener("abort", () => {
|
||
|
l3(i(U4));
|
||
|
});
|
||
|
}
|
||
|
R3 = B4.customTimers.setTimeout.call(void 0, () => {
|
||
|
if (typeof Q3 == "function") {
|
||
|
try {
|
||
|
V5(Q3());
|
||
|
} catch (U4) {
|
||
|
l3(U4);
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
const B5 = Q3 instanceof Error ? Q3 : new S(typeof Q3 == "string" ? Q3 : `Promise timed out after ${F3} milliseconds`);
|
||
|
typeof U3.cancel == "function" && U3.cancel(), l3(B5);
|
||
|
}, F3), (async () => {
|
||
|
try {
|
||
|
V5(await U3);
|
||
|
} catch (U4) {
|
||
|
l3(U4);
|
||
|
} finally {
|
||
|
B4.customTimers.clearTimeout.call(void 0, R3);
|
||
|
}
|
||
|
})();
|
||
|
} else
|
||
|
V5(U3);
|
||
|
});
|
||
|
return V4.clear = () => {
|
||
|
clearTimeout(R3), R3 = void 0;
|
||
|
}, V4;
|
||
|
}(Promise.resolve(B3), F2.timeout)), F2.signal && (B3 = Promise.race([B3, g(this, k, "m", w).call(this, F2.signal)]));
|
||
|
const V3 = await B3;
|
||
|
Q2(V3), this.emit("completed", V3);
|
||
|
} catch (U3) {
|
||
|
if (U3 instanceof S && !F2.throwOnTimeout)
|
||
|
return void Q2();
|
||
|
B2(U3), this.emit("error", U3);
|
||
|
} finally {
|
||
|
g(this, k, "m", s).call(this);
|
||
|
}
|
||
|
}, F2), this.emit("add"), g(this, k, "m", H).call(this);
|
||
|
});
|
||
|
}
|
||
|
async addAll(U2, F2) {
|
||
|
return Promise.all(U2.map(async (U3) => this.add(U3, F2)));
|
||
|
}
|
||
|
start() {
|
||
|
return g(this, j, "f") ? (e(this, j, false, "f"), g(this, k, "m", O).call(this), this) : this;
|
||
|
}
|
||
|
pause() {
|
||
|
e(this, j, true, "f");
|
||
|
}
|
||
|
clear() {
|
||
|
e(this, a, new (g(this, M, "f"))(), "f");
|
||
|
}
|
||
|
async onEmpty() {
|
||
|
g(this, a, "f").size !== 0 && await g(this, k, "m", v).call(this, "empty");
|
||
|
}
|
||
|
async onSizeLessThan(U2) {
|
||
|
g(this, a, "f").size < U2 || await g(this, k, "m", v).call(this, "next", () => g(this, a, "f").size < U2);
|
||
|
}
|
||
|
async onIdle() {
|
||
|
g(this, y, "f") === 0 && g(this, a, "f").size === 0 || await g(this, k, "m", v).call(this, "idle");
|
||
|
}
|
||
|
get size() {
|
||
|
return g(this, a, "f").size;
|
||
|
}
|
||
|
sizeBy(U2) {
|
||
|
return g(this, a, "f").filter(U2).length;
|
||
|
}
|
||
|
get pending() {
|
||
|
return g(this, y, "f");
|
||
|
}
|
||
|
get isPaused() {
|
||
|
return g(this, j, "f");
|
||
|
}
|
||
|
};
|
||
|
n = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakSet(), D = function() {
|
||
|
return g(this, T, "f") || g(this, c, "f") < g(this, Y, "f");
|
||
|
}, u = function() {
|
||
|
return g(this, y, "f") < g(this, L, "f");
|
||
|
}, s = function() {
|
||
|
var U2;
|
||
|
e(this, y, (U2 = g(this, y, "f"), --U2), "f"), g(this, k, "m", H).call(this), this.emit("next");
|
||
|
}, t = function() {
|
||
|
g(this, k, "m", o).call(this), g(this, k, "m", K).call(this), e(this, C, void 0, "f");
|
||
|
}, z = function() {
|
||
|
const U2 = Date.now();
|
||
|
if (g(this, p, "f") === void 0) {
|
||
|
const F2 = g(this, h, "f") - U2;
|
||
|
if (!(F2 < 0))
|
||
|
return g(this, C, "f") === void 0 && e(this, C, setTimeout(() => {
|
||
|
g(this, k, "m", t).call(this);
|
||
|
}, F2), "f"), true;
|
||
|
e(this, c, g(this, n, "f") ? g(this, y, "f") : 0, "f");
|
||
|
}
|
||
|
return false;
|
||
|
}, H = function() {
|
||
|
if (g(this, a, "f").size === 0)
|
||
|
return g(this, p, "f") && clearInterval(g(this, p, "f")), e(this, p, void 0, "f"), this.emit("empty"), g(this, y, "f") === 0 && this.emit("idle"), false;
|
||
|
if (!g(this, j, "f")) {
|
||
|
const U2 = !g(this, k, "a", z);
|
||
|
if (g(this, k, "a", D) && g(this, k, "a", u)) {
|
||
|
const F2 = g(this, a, "f").dequeue();
|
||
|
return !!F2 && (this.emit("active"), F2(), U2 && g(this, k, "m", K).call(this), true);
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}, K = function() {
|
||
|
g(this, T, "f") || g(this, p, "f") !== void 0 || (e(this, p, setInterval(() => {
|
||
|
g(this, k, "m", o).call(this);
|
||
|
}, g(this, X, "f")), "f"), e(this, h, Date.now() + g(this, X, "f"), "f"));
|
||
|
}, o = function() {
|
||
|
g(this, c, "f") === 0 && g(this, y, "f") === 0 && g(this, p, "f") && (clearInterval(g(this, p, "f")), e(this, p, void 0, "f")), e(this, c, g(this, n, "f") ? g(this, y, "f") : 0, "f"), g(this, k, "m", O).call(this);
|
||
|
}, O = function() {
|
||
|
for (; g(this, k, "m", H).call(this); )
|
||
|
;
|
||
|
}, w = async function(U2) {
|
||
|
return new Promise((F2, Q2) => {
|
||
|
U2.addEventListener("abort", () => {
|
||
|
Q2(new P("The task was aborted."));
|
||
|
}, { once: true });
|
||
|
});
|
||
|
}, v = async function(U2, F2) {
|
||
|
return new Promise((Q2) => {
|
||
|
const B2 = () => {
|
||
|
F2 && !F2() || (this.off(U2, B2), Q2());
|
||
|
};
|
||
|
this.on(U2, B2);
|
||
|
});
|
||
|
};
|
||
|
var A = W;
|
||
|
var f = import_obsidian.Platform.isMobileApp ? 1 : require("os").cpus().length;
|
||
|
var q = f == 2 ? 1 : 2;
|
||
|
var _ = Math.max(1, Math.floor(0.7 * f) - q - 1);
|
||
|
_ == f && (_ = 1), console.info(`Text Extractor - Number of available workers: ${_} for PDFs, ${q} for OCR, 1 for Office`);
|
||
|
var $ = 12e4;
|
||
|
var UU = new r({ concurrency: _, timeout: 120100 });
|
||
|
var FU = new r({ concurrency: q, timeout: 120100 });
|
||
|
var QU = new r({ concurrency: 1, timeout: 120100 });
|
||
|
var BU = "[Failed to extract text]";
|
||
|
var RU = "[Cannot extract text on mobile]";
|
||
|
var VU;
|
||
|
var lU;
|
||
|
var ZU;
|
||
|
var dU;
|
||
|
var WU;
|
||
|
var JU;
|
||
|
var NU = {};
|
||
|
function SU() {
|
||
|
return `${app.vault.configDir}/plugins/text-extractor/cache`;
|
||
|
}
|
||
|
async function IU() {
|
||
|
var _a2;
|
||
|
const U2 = SU();
|
||
|
try {
|
||
|
const F2 = await app.vault.adapter.list(U2);
|
||
|
for (const Q2 of F2.folders) {
|
||
|
const F3 = await app.vault.adapter.list(Q2);
|
||
|
for (const Q3 of F3.files) {
|
||
|
const F4 = (_a2 = Q3.split("-").pop()) == null ? void 0 : _a2.split(".").shift();
|
||
|
if (F4) {
|
||
|
const B2 = `${U2}/${F4}.json`;
|
||
|
await app.vault.adapter.rename(Q3, B2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} catch (U3) {
|
||
|
}
|
||
|
}
|
||
|
function mU(U2) {
|
||
|
const F2 = function(U3) {
|
||
|
return NU.md5(U3.toString());
|
||
|
}(U2.path), Q2 = `${SU()}`, B2 = `${F2}.json`;
|
||
|
return { folder: Q2, filename: B2, fullpath: `${Q2}/${B2}` };
|
||
|
}
|
||
|
async function iU(U2) {
|
||
|
const F2 = mU(U2);
|
||
|
if (await app.vault.adapter.exists(F2.fullpath)) {
|
||
|
const U3 = await app.vault.adapter.read(F2.fullpath);
|
||
|
return JSON.parse(U3);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
async function bU(U2, F2, Q2, B2, R2) {
|
||
|
const V2 = `${U2}/${F2}`, l2 = { path: B2, text: Q2, libVersion: A, langs: R2 };
|
||
|
return await app.vault.adapter.mkdir(U2), await app.vault.adapter.write(V2, JSON.stringify(l2));
|
||
|
}
|
||
|
typeof self != "undefined" && self, { get exports() {
|
||
|
return NU;
|
||
|
}, set exports(U2) {
|
||
|
NU = U2;
|
||
|
} }.exports = function(U2) {
|
||
|
var F2 = {};
|
||
|
function Q2(B2) {
|
||
|
if (F2[B2])
|
||
|
return F2[B2].exports;
|
||
|
var R2 = F2[B2] = { i: B2, l: false, exports: {} };
|
||
|
return U2[B2].call(R2.exports, R2, R2.exports, Q2), R2.l = true, R2.exports;
|
||
|
}
|
||
|
return Q2.m = U2, Q2.c = F2, Q2.d = function(U3, F3, B2) {
|
||
|
Q2.o(U3, F3) || Object.defineProperty(U3, F3, { enumerable: true, get: B2 });
|
||
|
}, Q2.r = function(U3) {
|
||
|
typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(U3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(U3, "__esModule", { value: true });
|
||
|
}, Q2.t = function(U3, F3) {
|
||
|
if (1 & F3 && (U3 = Q2(U3)), 8 & F3)
|
||
|
return U3;
|
||
|
if (4 & F3 && typeof U3 == "object" && U3 && U3.__esModule)
|
||
|
return U3;
|
||
|
var B2 = /* @__PURE__ */ Object.create(null);
|
||
|
if (Q2.r(B2), Object.defineProperty(B2, "default", { enumerable: true, value: U3 }), 2 & F3 && typeof U3 != "string")
|
||
|
for (var R2 in U3)
|
||
|
Q2.d(B2, R2, function(F4) {
|
||
|
return U3[F4];
|
||
|
}.bind(null, R2));
|
||
|
return B2;
|
||
|
}, Q2.n = function(U3) {
|
||
|
var F3 = U3 && U3.__esModule ? function() {
|
||
|
return U3.default;
|
||
|
} : function() {
|
||
|
return U3;
|
||
|
};
|
||
|
return Q2.d(F3, "a", F3), F3;
|
||
|
}, Q2.o = function(U3, F3) {
|
||
|
return Object.prototype.hasOwnProperty.call(U3, F3);
|
||
|
}, Q2.p = "", Q2(Q2.s = 0);
|
||
|
}([function(U2, F2, Q2) {
|
||
|
Q2.r(F2), Q2.d(F2, "md5", function() {
|
||
|
return i2;
|
||
|
});
|
||
|
var B2 = "0123456789abcdef".split(""), R2 = function(U3) {
|
||
|
for (var F3 = "", Q3 = 0; Q3 < 4; Q3++)
|
||
|
F3 += B2[U3 >> 8 * Q3 + 4 & 15] + B2[U3 >> 8 * Q3 & 15];
|
||
|
return F3;
|
||
|
}, V2 = function(U3) {
|
||
|
for (var F3 = U3.length, Q3 = 0; Q3 < F3; Q3++)
|
||
|
U3[Q3] = R2(U3[Q3]);
|
||
|
return U3.join("");
|
||
|
}, l2 = function(U3, F3) {
|
||
|
return U3 + F3 & 4294967295;
|
||
|
}, Z2 = function(U3, F3, Q3, B3, R3, V3, Z3) {
|
||
|
return function(U4, F4, Q4) {
|
||
|
return l2(U4 << F4 | U4 >>> 32 - F4, Q4);
|
||
|
}(F3 = function(U4, F4, Q4, B4) {
|
||
|
return l2(l2(F4, U4), l2(Q4, B4));
|
||
|
}(U3, F3, B3, V3), R3, Q3);
|
||
|
}, d2 = function(U3, F3, Q3, B3, R3, V3, l3, d3) {
|
||
|
return Z2(Q3 & B3 | ~Q3 & R3, F3, Q3, V3, l3, d3);
|
||
|
}, W2 = function(U3, F3, Q3, B3, R3, V3, l3, d3) {
|
||
|
return Z2(Q3 & R3 | B3 & ~R3, F3, Q3, V3, l3, d3);
|
||
|
}, J2 = function(U3, F3, Q3, B3, R3, V3, l3, d3) {
|
||
|
return Z2(Q3 ^ B3 ^ R3, F3, Q3, V3, l3, d3);
|
||
|
}, N2 = function(U3, F3, Q3, B3, R3, V3, l3, d3) {
|
||
|
return Z2(B3 ^ (Q3 | ~R3), F3, Q3, V3, l3, d3);
|
||
|
}, S2 = function(U3, F3, Q3) {
|
||
|
Q3 === void 0 && (Q3 = l2);
|
||
|
var B3 = U3[0], R3 = U3[1], V3 = U3[2], Z3 = U3[3], S3 = d2.bind(null, Q3);
|
||
|
B3 = S3(B3, R3, V3, Z3, F3[0], 7, -680876936), Z3 = S3(Z3, B3, R3, V3, F3[1], 12, -389564586), V3 = S3(V3, Z3, B3, R3, F3[2], 17, 606105819), R3 = S3(R3, V3, Z3, B3, F3[3], 22, -1044525330), B3 = S3(B3, R3, V3, Z3, F3[4], 7, -176418897), Z3 = S3(Z3, B3, R3, V3, F3[5], 12, 1200080426), V3 = S3(V3, Z3, B3, R3, F3[6], 17, -1473231341), R3 = S3(R3, V3, Z3, B3, F3[7], 22, -45705983), B3 = S3(B3, R3, V3, Z3, F3[8], 7, 1770035416), Z3 = S3(Z3, B3, R3, V3, F3[9], 12, -1958414417), V3 = S3(V3, Z3, B3, R3, F3[10], 17, -42063), R3 = S3(R3, V3, Z3, B3, F3[11], 22, -1990404162), B3 = S3(B3, R3, V3, Z3, F3[12], 7, 1804603682), Z3 = S3(Z3, B3, R3, V3, F3[13], 12, -40341101), V3 = S3(V3, Z3, B3, R3, F3[14], 17, -1502002290), R3 = S3(R3, V3, Z3, B3, F3[15], 22, 1236535329);
|
||
|
var I3 = W2.bind(null, Q3);
|
||
|
B3 = I3(B3, R3, V3, Z3, F3[1], 5, -165796510), Z3 = I3(Z3, B3, R3, V3, F3[6], 9, -1069501632), V3 = I3(V3, Z3, B3, R3, F3[11], 14, 643717713), R3 = I3(R3, V3, Z3, B3, F3[0], 20, -373897302), B3 = I3(B3, R3, V3, Z3, F3[5], 5, -701558691), Z3 = I3(Z3, B3, R3, V3, F3[10], 9, 38016083), V3 = I3(V3, Z3, B3, R3, F3[15], 14, -660478335), R3 = I3(R3, V3, Z3, B3, F3[4], 20, -405537848), B3 = I3(B3, R3, V3, Z3, F3[9], 5, 568446438), Z3 = I3(Z3, B3, R3, V3, F3[14], 9, -1019803690), V3 = I3(V3, Z3, B3, R3, F3[3], 14, -187363961), R3 = I3(R3, V3, Z3, B3, F3[8], 20, 1163531501), B3 = I3(B3, R3, V3, Z3, F3[13], 5, -1444681467), Z3 = I3(Z3, B3, R3, V3, F3[2], 9, -51403784), V3 = I3(V3, Z3, B3, R3, F3[7], 14, 1735328473), R3 = I3(R3, V3, Z3, B3, F3[12], 20, -1926607734);
|
||
|
var m3 = J2.bind(null, Q3);
|
||
|
B3 = m3(B3, R3, V3, Z3, F3[5], 4, -378558), Z3 = m3(Z3, B3, R3, V3, F3[8], 11, -2022574463), V3 = m3(V3, Z3, B3, R3, F3[11], 16, 1839030562), R3 = m3(R3, V3, Z3, B3, F3[14], 23, -35309556), B3 = m3(B3, R3, V3, Z3, F3[1], 4, -1530992060), Z3 = m3(Z3, B3, R3, V3, F3[4], 11, 1272893353), V3 = m3(V3, Z3, B3, R3, F3[7], 16, -155497632), R3 = m3(R3, V3, Z3, B3, F3[10], 23, -1094730640), B3 = m3(B3, R3, V3, Z3, F3[13], 4, 681279174), Z3 = m3(Z3, B3, R3, V3, F3[0], 11, -358537222), V3 = m3(V3, Z3, B3, R3, F3[3], 16, -722521979), R3 = m3(R3, V3, Z3, B3, F3[6], 23, 76029189), B3 = m3(B3, R3, V3, Z3, F3[9], 4, -640364487), Z3 = m3(Z3, B3, R3, V3, F3[12], 11, -421815835), V3 = m3(V3, Z3, B3, R3, F3[15], 16, 530742520), R3 = m3(R3, V3, Z3, B3, F3[2], 23, -995338651);
|
||
|
var i3 = N2.bind(null, Q3);
|
||
|
B3 = i3(B3, R3, V3, Z3, F3[0], 6, -198630844), Z3 = i3(Z3, B3, R3, V3, F3[7], 10, 1126891415), V3 = i3(V3, Z3, B3, R3, F3[14], 15, -1416354905), R3 = i3(R3, V3, Z3, B3, F3[5], 21, -57434055), B3 = i3(B3, R3, V3, Z3, F3[12], 6, 1700485571), Z3 = i3(Z3, B3, R3, V3, F3[3], 10, -1894986606), V3 = i3(V3, Z3, B3, R3, F3[10], 15, -1051523), R3 = i3(R3, V3, Z3, B3, F3[1], 21, -2054922799), B3 = i3(B3, R3, V3, Z3, F3[8], 6, 1873313359), Z3 = i3(Z3, B3, R3, V3, F3[15], 10, -30611744), V3 = i3(V3, Z3, B3, R3, F3[6], 15, -1560198380), R3 = i3(R3, V3, Z3, B3, F3[13], 21, 1309151649), B3 = i3(B3, R3, V3, Z3, F3[4], 6, -145523070), Z3 = i3(Z3, B3, R3, V3, F3[11], 10, -1120210379), V3 = i3(V3, Z3, B3, R3, F3[2], 15, 718787259), R3 = i3(R3, V3, Z3, B3, F3[9], 21, -343485551), U3[0] = Q3(B3, U3[0]), U3[1] = Q3(R3, U3[1]), U3[2] = Q3(V3, U3[2]), U3[3] = Q3(Z3, U3[3]);
|
||
|
}, I2 = function(U3) {
|
||
|
for (var F3 = [], Q3 = 0; Q3 < 64; Q3 += 4)
|
||
|
F3[Q3 >> 2] = U3.charCodeAt(Q3) + (U3.charCodeAt(Q3 + 1) << 8) + (U3.charCodeAt(Q3 + 2) << 16) + (U3.charCodeAt(Q3 + 3) << 24);
|
||
|
return F3;
|
||
|
}, m2 = function(U3, F3) {
|
||
|
var Q3, B3 = U3.length, R3 = [1732584193, -271733879, -1732584194, 271733878];
|
||
|
for (Q3 = 64; Q3 <= B3; Q3 += 64)
|
||
|
S2(R3, I2(U3.substring(Q3 - 64, Q3)), F3);
|
||
|
var V3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], l3 = (U3 = U3.substring(Q3 - 64)).length;
|
||
|
for (Q3 = 0; Q3 < l3; Q3++)
|
||
|
V3[Q3 >> 2] |= U3.charCodeAt(Q3) << (Q3 % 4 << 3);
|
||
|
if (V3[Q3 >> 2] |= 128 << (Q3 % 4 << 3), Q3 > 55)
|
||
|
for (S2(R3, V3, F3), Q3 = 16; Q3--; )
|
||
|
V3[Q3] = 0;
|
||
|
return V3[14] = 8 * B3, S2(R3, V3, F3), R3;
|
||
|
};
|
||
|
function i2(U3) {
|
||
|
var F3;
|
||
|
return V2(m2("hello")) !== "5d41402abc4b2a76b9719d911017c592" && (F3 = function(U4, F4) {
|
||
|
var Q3 = (65535 & U4) + (65535 & F4);
|
||
|
return (U4 >> 16) + (F4 >> 16) + (Q3 >> 16) << 16 | 65535 & Q3;
|
||
|
}), V2(m2(U3, F3));
|
||
|
}
|
||
|
}]);
|
||
|
var EU = class {
|
||
|
constructor(U2) {
|
||
|
this.worker = U2, ZU.set(this, false);
|
||
|
}
|
||
|
static getWorker() {
|
||
|
const U2 = F(EU, VU, "f", lU).find((U3) => !F(U3, ZU, "f"));
|
||
|
if (U2)
|
||
|
return U2;
|
||
|
const Q2 = new EU(new d({ name: "PDF Text Extractor" }));
|
||
|
return F(EU, VU, "f", lU).push(Q2), Q2;
|
||
|
}
|
||
|
async run(U2) {
|
||
|
return new Promise((B2, R2) => {
|
||
|
Q(this, ZU, true, "f");
|
||
|
const V2 = setTimeout(() => {
|
||
|
console.warn("Text Extractor - PDF Worker timeout for ", U2.name), R2("timeout"), F(EU, VU, "m", dU).call(EU, this);
|
||
|
}, $);
|
||
|
this.worker.postMessage(U2), this.worker.onmessage = (U3) => {
|
||
|
clearTimeout(V2), B2(U3), Q(this, ZU, false, "f");
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
VU = EU, ZU = /* @__PURE__ */ new WeakMap(), dU = function(U2) {
|
||
|
U2.worker.terminate(), Q(EU, VU, F(EU, VU, "f", lU).filter((F2) => F2 !== U2), "f", lU);
|
||
|
}, lU = { value: [] };
|
||
|
WU = /* @__PURE__ */ new WeakSet(), JU = async function(F2) {
|
||
|
var _a2;
|
||
|
const Q2 = await iU(F2);
|
||
|
if (Q2)
|
||
|
return (_a2 = Q2.text) != null ? _a2 : BU;
|
||
|
if (import_obsidian.Platform.isMobile)
|
||
|
return RU;
|
||
|
const B2 = mU(F2), R2 = new Uint8Array(await app.vault.readBinary(F2)), V2 = EU.getWorker();
|
||
|
return new Promise(async (U2, Q3) => {
|
||
|
try {
|
||
|
const Q4 = (await V2.run({ data: R2, name: F2.basename })).data.text.replace(/\n/g, " ").replace(/ +/g, " ").trim();
|
||
|
await bU(B2.folder, B2.filename, Q4, F2.path, ""), U2(Q4);
|
||
|
} catch (Q4) {
|
||
|
await bU(B2.folder, B2.filename, "", F2.path, ""), U2("");
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
var GU = new class {
|
||
|
constructor() {
|
||
|
WU.add(this);
|
||
|
}
|
||
|
async getPdfText(U2) {
|
||
|
var _a2;
|
||
|
try {
|
||
|
return (_a2 = await UU.add(() => F(this, WU, "m", JU).call(this, U2))) != null ? _a2 : "";
|
||
|
} catch (F2) {
|
||
|
return console.warn(`Text Extractor - Error while extracting text from ${U2.basename}`), console.warn(F2), "";
|
||
|
}
|
||
|
}
|
||
|
}();
|
||
|
function kU(U2, F2, Q2) {
|
||
|
var B2 = F2 === void 0 ? null : F2, R2 = function(U3, F3) {
|
||
|
var Q3 = atob(U3);
|
||
|
if (F3) {
|
||
|
for (var B3 = new Uint8Array(Q3.length), R3 = 0, V3 = Q3.length; R3 < V3; ++R3)
|
||
|
B3[R3] = Q3.charCodeAt(R3);
|
||
|
return String.fromCharCode.apply(null, new Uint16Array(B3.buffer));
|
||
|
}
|
||
|
return Q3;
|
||
|
}(U2, Q2 !== void 0 && Q2), V2 = R2.indexOf("\n", 10) + 1, l2 = R2.substring(V2) + (B2 ? "//# sourceMappingURL=" + B2 : ""), Z2 = new Blob([l2], { type: "application/javascript" });
|
||
|
return URL.createObjectURL(Z2);
|
||
|
}
|
||
|
var nU;
|
||
|
var TU;
|
||
|
var cU;
|
||
|
var YU;
|
||
|
var XU;
|
||
|
var hU;
|
||
|
var pU = function(U2, F2, Q2) {
|
||
|
var B2;
|
||
|
return function(R2) {
|
||
|
return B2 = B2 || kU(U2, F2, Q2), new Worker(B2, R2);
|
||
|
};
|
||
|
}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7dmFyIGU9InVuZGVmaW5lZCIhPXR5cGVvZiBnbG9iYWw/Z2xvYmFsOiJ1bmRlZmluZWQiIT10eXBlb2Ygc2VsZj9zZWxmOiJ1bmRlZmluZWQiIT10eXBlb2Ygd2luZG93P3dpbmRvdzp7fSx0PVtdLG49W10scj0idW5kZWZpbmVkIiE9dHlwZW9mIFVpbnQ4QXJyYXk/VWludDhBcnJheTpBcnJheSxpPSExO2Z1bmN0aW9uIGEoKXtpPSEwO2Zvcih2YXIgZT0iQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyIscj0wO3I8NjQ7KytyKXRbcl09ZVtyXSxuW2UuY2hhckNvZGVBdChyKV09cjtuWyItIi5jaGFyQ29kZUF0KDApXT02MixuWyJfIi5jaGFyQ29kZUF0KDApXT02M31mdW5jdGlvbiBvKGUsbixyKXtmb3IodmFyIGksYSxvPVtdLGM9bjtjPHI7Yys9MylpPShlW2NdPDwxNikrKGVbYysxXTw8OCkrZVtjKzJdLG8ucHVzaCh0WyhhPWkpPj4xOCY2M10rdFthPj4xMiY2M10rdFthPj42JjYzXSt0WzYzJmFdKTtyZXR1cm4gby5qb2luKCIiKX1mdW5jdGlvbiBjKGUpe3ZhciBuO2l8fGEoKTtmb3IodmFyIHI9ZS5sZW5ndGgsYz1yJTMscz0iIixsPVtdLHU9MTYzODMsZj0wLGQ9ci1jO2Y8ZDtmKz11KWwucHVzaChvKGUsZixmK3U+ZD9kOmYrdSkpO3JldHVybiAxPT09Yz8obj1lW3ItMV0scys9dFtuPj4yXSxzKz10W248PDQmNjNdLHMrPSI9PSIpOjI9PT1jJiYobj0oZVtyLTJdPDw4KStlW3ItMV0scys9dFtuPj4xMF0scys9dFtuPj40JjYzXSxzKz10W248PDImNjNdLHMrPSI9IiksbC5wdXNoKHMpLGwuam9pbigiIil9ZnVuY3Rpb24gcyhlLHQsbixyLGkpe3ZhciBhLG8sYz04Kmktci0xLHM9KDE8PGMpLTEsbD1zPj4xLHU9LTcsZj1uP2ktMTowLGQ9bj8tMToxLGg9ZVt0K2ZdO2ZvcihmKz1kLGE9aCYoMTw8LXUpLTEsaD4+PS11LHUrPWM7dT4wO2E9MjU2KmErZVt0K2ZdLGYrPWQsdS09OCk7Zm9yKG89YSYoMTw8LXUpLTEsYT4+PS11LHUrPXI7dT4wO289MjU2Km8rZVt0K2ZdLGYrPWQsdS09OCk7aWYoMD09PWEpYT0xLWw7ZWxzZXtpZihhPT09cylyZXR1cm4gbz9OYU46MS8wKihoPy0xOjEpO28rPU1hdGgucG93KDIsciksYS09bH1yZXR1cm4oaD8tMToxKSpvKk1hdGgucG93KDIsYS1yKX1mdW5jdGlvbiBsKGUsdCxuLHIsaSxhKXt2YXIgbyxjLHMsbD04KmEtaS0xLHU9KDE8PGwpLTEsZj11Pj4xLGQ9MjM9PT1pP01hdGgucG93KDIsLTI0KS1NYXRoLnBvdygyLC03Nyk6MCxoPXI/MDphLTEscD1yPzE6LTEsZz10PDB8fDA9PT10JiYxL3Q8MD8xOjA7Zm9yKHQ9TWF0aC5hYnModCksaXNOYU4odCl8fHQ9PT0xLzA/KGM9aXNOYU4odCk/MTowLG89dSk6KG89TWF0aC5mbG9vcihNYXRoLmxvZyh0KS9NYXRoLkxOMiksdCoocz1NYXRoLnBvdygyLC1vKSk8MSYmKG8tLSxzKj0yKSwodCs9bytmPj0xP2QvczpkKk1hdGgucG93KDIsMS1mKSkqcz49MiYmKG8rKyxzLz0yKSxvK2Y+PXU/KGM9MCxvPXUpOm8rZj49MT8oYz0odCpzLTEpKk1hdGgucG93KDIsaSksbys9Zik6KGM9dCpNYXRoLnBvdygyLGYtMSkqTWF0aC5wb3coMixpKSxvPTApKTtpPj04O2VbbitoXT0yNTUmYyxoKz1wLGMvPTI1NixpLT04KTtmb3Iobz1vPDxpfGMsbCs9aTtsPjA7ZVtuK2hdPTI1NSZvLGgrPXAsby89MjU2LGwtPTgpO2VbbitoLXBdfD0xMjgqZ312YXIgdT17fS50b1N0cmluZyxmPUFycmF5LmlzQXJyYXl8fGZ1bmN0aW9uKGUpe3JldHVybiJbb2JqZWN0IEFycmF5XSI9PXUuY2FsbChlKX07ZnVuY3Rpb24gZCgpe3JldHVybiBwLlRZUEVEX0FSUkFZX1NVUFBPUlQ/MjE0NzQ4MzY0NzoxMDczNzQxODIzfWZ1bmN0aW9uIGgoZSx0KXtpZihkKCk8dCl0aHJvdyBuZXcgUmFuZ2VFcnJvcigiSW52YWxpZCB0eXBlZCBhcnJheSBsZW5ndGgiKTtyZXR1cm4gcC5UWVBFRF9BUlJBWV9TVVBQT1JUPyhlPW5ldyBVaW50OEFycmF5KHQpKS5fX3Byb3RvX189cC5wcm90b3R5cGU6KG51bGw9PT1lJiYoZT1uZXcgcCh0KSksZS5sZW5ndGg9dCksZX1mdW5jdGlvbiBwKGUsdCxuKXtpZighKHAuVFlQRURfQVJSQVlfU1VQUE9SVHx8dGhpcyBpbnN0YW5jZW9mIHApKXJldHVybiBuZXcgcChlLHQsbik7aWYoIm51bWJlciI9PXR5cGVvZiBlKXtpZigic3RyaW5nIj09dHlwZW9mIHQpdGhyb3cgbmV3IEVycm9yKCJJZiBlbmNvZGluZyBpcyBzcGVjaWZpZWQgdGhlbiB0aGUgZmlyc3QgYXJndW1lbnQgbXVzdCBiZSBhIHN0cmluZyIpO3JldHVybiBiKHRoaXMsZSl9cmV0dXJuIGcodGhpcyxlLHQsbil9ZnVuY3Rpb24gZyhlLHQsbixyKXtpZigibnVtYmVyIj09dHlwZW9mIHQpdGhyb3cgbmV3IFR5cGVFcnJvcignInZhbHVlIiBhcmd1bWVudCBtdXN0IG5vdCBiZSBhIG51bWJlcicpO3JldHVybiJ1bmRlZmluZWQiIT10eXBlb2YgQXJyYXlCdWZmZXImJnQgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcj9mdW5jdGlvbihlLHQsbixyKXtpZih0LmJ5dGVMZW5ndGgsbjwwfHx0LmJ5dGVMZW5ndGg8bil0aHJvdyBuZXcgUmFuZ2VFcnJvcigiJ29mZnNldCcgaXMgb3V0IG9mIGJvdW5kcyIpO2lmKHQuYnl0ZUxlbmd0aDxuKyhyfHwwKSl0aHJvdyBuZXcgUmFuZ2VFcnJvcigiJ2xlbmd0aCcgaXMgb3V0IG9mIGJvdW5kcyIpO3Q9dm9pZCAwPT09biYmdm9pZCAwPT09cj9uZXcgVWludDhBcnJheSh0KTp2b2lkIDA9PT1yP25ldyBVaW50OEFycmF5KHQsbik6bmV3IFVpbnQ4QXJyYXkodCxuLHIpO3AuVFlQRURfQVJSQVlfU1VQUE9SVD8oZT10KS5fX3Byb3RvX189cC5wcm90b3R5cGU6ZT15KGUsdCk7cmV0dXJuIGV9KGUsdCxuLHIpOiJzdHJpbmciPT10eXBlb2YgdD9mdW5jdGlvbihlLHQsbil7InN0cmluZyI9PXR5cGVvZiBuJiYiIiE9PW58fChuPSJ1dGY4Iik7aWYoIXAuaXNFbmNvZGluZyhuKSl0aHJvdyBuZXcgVHlwZUVycm9yKCciZW5jb2RpbmciIG11c3QgYmUgYSB2YWxpZCBzdHJpbmcgZW5jb2RpbmcnKTt2YXIgcj0wfEQodCxuKTtlPWgoZSxyKTt2YXIgaT1lLndyaXRlKHQsbik7aSE9PXImJihlPWUuc2xpY2UoMCxpKSk7cmV0dXJuIGV9KGUsdCxuKTpmdW5jdGlvbihlLHQpe2lmKHgo
|
||
|
var CU = class {
|
||
|
constructor(U2) {
|
||
|
this.worker = U2, cU.set(this, false);
|
||
|
}
|
||
|
static getWorker() {
|
||
|
const U2 = F(CU, nU, "f", TU).find((U3) => !F(U3, cU, "f"));
|
||
|
if (U2)
|
||
|
return U2;
|
||
|
const Q2 = new CU(new pU({ name: "Office Text Extractor" }));
|
||
|
return F(CU, nU, "f", TU).push(Q2), Q2;
|
||
|
}
|
||
|
async run(U2) {
|
||
|
return new Promise((B2, R2) => {
|
||
|
Q(this, cU, true, "f");
|
||
|
const V2 = setTimeout(() => {
|
||
|
console.warn("Text Extractor - Office Worker timeout for ", U2.name), R2("timeout"), F(CU, nU, "m", YU).call(CU, this);
|
||
|
}, $);
|
||
|
this.worker.postMessage(U2), this.worker.onmessage = (U3) => {
|
||
|
clearTimeout(V2), B2(U3), Q(this, cU, false, "f");
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
nU = CU, cU = /* @__PURE__ */ new WeakMap(), YU = function(U2) {
|
||
|
U2.worker.terminate(), Q(CU, nU, F(CU, nU, "f", TU).filter((F2) => F2 !== U2), "f", TU);
|
||
|
}, TU = { value: [] };
|
||
|
XU = /* @__PURE__ */ new WeakSet(), hU = async function(F2) {
|
||
|
var _a2;
|
||
|
const Q2 = await iU(F2);
|
||
|
if (Q2)
|
||
|
return (_a2 = Q2.text) != null ? _a2 : BU;
|
||
|
if (import_obsidian.Platform.isMobile)
|
||
|
return RU;
|
||
|
const B2 = mU(F2), R2 = await app.vault.readBinary(F2), V2 = CU.getWorker();
|
||
|
return new Promise(async (U2, Q3) => {
|
||
|
try {
|
||
|
const Q4 = (await V2.run({ data: R2, name: F2.basename, extension: F2.extension })).data.text.replace(/\n/g, " ").replace(/ +/g, " ").trim();
|
||
|
await bU(B2.folder, B2.filename, Q4, F2.path, ""), U2(Q4);
|
||
|
} catch (Q4) {
|
||
|
await bU(B2.folder, B2.filename, "", F2.path, ""), U2("");
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
var aU = new class {
|
||
|
constructor() {
|
||
|
XU.add(this);
|
||
|
}
|
||
|
async getOfficeText(U2) {
|
||
|
var _a2;
|
||
|
try {
|
||
|
return (_a2 = await QU.add(() => F(this, XU, "m", hU).call(this, U2))) != null ? _a2 : "";
|
||
|
} catch (F2) {
|
||
|
return console.warn(`Text Extractor - Error while extracting text from ${U2.basename}`), console.warn(F2), "";
|
||
|
}
|
||
|
}
|
||
|
}();
|
||
|
var MU = {};
|
||
|
!function(U2) {
|
||
|
var F2 = function(U3) {
|
||
|
var F3, Q2 = Object.prototype, B2 = Q2.hasOwnProperty, R2 = Object.defineProperty || function(U4, F4, Q3) {
|
||
|
U4[F4] = Q3.value;
|
||
|
}, V2 = typeof Symbol == "function" ? Symbol : {}, l2 = V2.iterator || "@@iterator", Z2 = V2.asyncIterator || "@@asyncIterator", d2 = V2.toStringTag || "@@toStringTag";
|
||
|
function W2(U4, F4, Q3) {
|
||
|
return Object.defineProperty(U4, F4, { value: Q3, enumerable: true, configurable: true, writable: true }), U4[F4];
|
||
|
}
|
||
|
try {
|
||
|
W2({}, "");
|
||
|
} catch (U4) {
|
||
|
W2 = function(U5, F4, Q3) {
|
||
|
return U5[F4] = Q3;
|
||
|
};
|
||
|
}
|
||
|
function J2(U4, F4, Q3, B3) {
|
||
|
var V3 = F4 && F4.prototype instanceof E2 ? F4 : E2, l3 = Object.create(V3.prototype), Z3 = new y2(B3 || []);
|
||
|
return R2(l3, "_invoke", { value: p2(U4, Q3, Z3) }), l3;
|
||
|
}
|
||
|
function N2(U4, F4, Q3) {
|
||
|
try {
|
||
|
return { type: "normal", arg: U4.call(F4, Q3) };
|
||
|
} catch (U5) {
|
||
|
return { type: "throw", arg: U5 };
|
||
|
}
|
||
|
}
|
||
|
U3.wrap = J2;
|
||
|
var S2 = "suspendedStart", I2 = "suspendedYield", m2 = "executing", i2 = "completed", b2 = {};
|
||
|
function E2() {
|
||
|
}
|
||
|
function G2() {
|
||
|
}
|
||
|
function k2() {
|
||
|
}
|
||
|
var n2 = {};
|
||
|
W2(n2, l2, function() {
|
||
|
return this;
|
||
|
});
|
||
|
var T2 = Object.getPrototypeOf, c2 = T2 && T2(T2(L2([])));
|
||
|
c2 && c2 !== Q2 && B2.call(c2, l2) && (n2 = c2);
|
||
|
var Y2 = k2.prototype = E2.prototype = Object.create(n2);
|
||
|
function X2(U4) {
|
||
|
["next", "throw", "return"].forEach(function(F4) {
|
||
|
W2(U4, F4, function(U5) {
|
||
|
return this._invoke(F4, U5);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
function h2(U4, F4) {
|
||
|
function Q3(R3, V4, l3, Z3) {
|
||
|
var d3 = N2(U4[R3], U4, V4);
|
||
|
if (d3.type !== "throw") {
|
||
|
var W3 = d3.arg, J3 = W3.value;
|
||
|
return J3 && typeof J3 == "object" && B2.call(J3, "__await") ? F4.resolve(J3.__await).then(function(U5) {
|
||
|
Q3("next", U5, l3, Z3);
|
||
|
}, function(U5) {
|
||
|
Q3("throw", U5, l3, Z3);
|
||
|
}) : F4.resolve(J3).then(function(U5) {
|
||
|
W3.value = U5, l3(W3);
|
||
|
}, function(U5) {
|
||
|
return Q3("throw", U5, l3, Z3);
|
||
|
});
|
||
|
}
|
||
|
Z3(d3.arg);
|
||
|
}
|
||
|
var V3;
|
||
|
R2(this, "_invoke", { value: function(U5, B3) {
|
||
|
function R3() {
|
||
|
return new F4(function(F5, R4) {
|
||
|
Q3(U5, B3, F5, R4);
|
||
|
});
|
||
|
}
|
||
|
return V3 = V3 ? V3.then(R3, R3) : R3();
|
||
|
} });
|
||
|
}
|
||
|
function p2(U4, F4, Q3) {
|
||
|
var B3 = S2;
|
||
|
return function(R3, V3) {
|
||
|
if (B3 === m2)
|
||
|
throw new Error("Generator is already running");
|
||
|
if (B3 === i2) {
|
||
|
if (R3 === "throw")
|
||
|
throw V3;
|
||
|
return j2();
|
||
|
}
|
||
|
for (Q3.method = R3, Q3.arg = V3; ; ) {
|
||
|
var l3 = Q3.delegate;
|
||
|
if (l3) {
|
||
|
var Z3 = C2(l3, Q3);
|
||
|
if (Z3) {
|
||
|
if (Z3 === b2)
|
||
|
continue;
|
||
|
return Z3;
|
||
|
}
|
||
|
}
|
||
|
if (Q3.method === "next")
|
||
|
Q3.sent = Q3._sent = Q3.arg;
|
||
|
else if (Q3.method === "throw") {
|
||
|
if (B3 === S2)
|
||
|
throw B3 = i2, Q3.arg;
|
||
|
Q3.dispatchException(Q3.arg);
|
||
|
} else
|
||
|
Q3.method === "return" && Q3.abrupt("return", Q3.arg);
|
||
|
B3 = m2;
|
||
|
var d3 = N2(U4, F4, Q3);
|
||
|
if (d3.type === "normal") {
|
||
|
if (B3 = Q3.done ? i2 : I2, d3.arg === b2)
|
||
|
continue;
|
||
|
return { value: d3.arg, done: Q3.done };
|
||
|
}
|
||
|
d3.type === "throw" && (B3 = i2, Q3.method = "throw", Q3.arg = d3.arg);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function C2(U4, Q3) {
|
||
|
var B3 = Q3.method, R3 = U4.iterator[B3];
|
||
|
if (R3 === F3)
|
||
|
return Q3.delegate = null, B3 === "throw" && U4.iterator.return && (Q3.method = "return", Q3.arg = F3, C2(U4, Q3), Q3.method === "throw") || B3 !== "return" && (Q3.method = "throw", Q3.arg = new TypeError("The iterator does not provide a '" + B3 + "' method")), b2;
|
||
|
var V3 = N2(R3, U4.iterator, Q3.arg);
|
||
|
if (V3.type === "throw")
|
||
|
return Q3.method = "throw", Q3.arg = V3.arg, Q3.delegate = null, b2;
|
||
|
var l3 = V3.arg;
|
||
|
return l3 ? l3.done ? (Q3[U4.resultName] = l3.value, Q3.next = U4.nextLoc, Q3.method !== "return" && (Q3.method = "next", Q3.arg = F3), Q3.delegate = null, b2) : l3 : (Q3.method = "throw", Q3.arg = new TypeError("iterator result is not an object"), Q3.delegate = null, b2);
|
||
|
}
|
||
|
function a2(U4) {
|
||
|
var F4 = { tryLoc: U4[0] };
|
||
|
1 in U4 && (F4.catchLoc = U4[1]), 2 in U4 && (F4.finallyLoc = U4[2], F4.afterLoc = U4[3]), this.tryEntries.push(F4);
|
||
|
}
|
||
|
function M2(U4) {
|
||
|
var F4 = U4.completion || {};
|
||
|
F4.type = "normal", delete F4.arg, U4.completion = F4;
|
||
|
}
|
||
|
function y2(U4) {
|
||
|
this.tryEntries = [{ tryLoc: "root" }], U4.forEach(a2, this), this.reset(true);
|
||
|
}
|
||
|
function L2(U4) {
|
||
|
if (U4) {
|
||
|
var Q3 = U4[l2];
|
||
|
if (Q3)
|
||
|
return Q3.call(U4);
|
||
|
if (typeof U4.next == "function")
|
||
|
return U4;
|
||
|
if (!isNaN(U4.length)) {
|
||
|
var R3 = -1, V3 = function Q4() {
|
||
|
for (; ++R3 < U4.length; )
|
||
|
if (B2.call(U4, R3))
|
||
|
return Q4.value = U4[R3], Q4.done = false, Q4;
|
||
|
return Q4.value = F3, Q4.done = true, Q4;
|
||
|
};
|
||
|
return V3.next = V3;
|
||
|
}
|
||
|
}
|
||
|
return { next: j2 };
|
||
|
}
|
||
|
function j2() {
|
||
|
return { value: F3, done: true };
|
||
|
}
|
||
|
return G2.prototype = k2, R2(Y2, "constructor", { value: k2, configurable: true }), R2(k2, "constructor", { value: G2, configurable: true }), G2.displayName = W2(k2, d2, "GeneratorFunction"), U3.isGeneratorFunction = function(U4) {
|
||
|
var F4 = typeof U4 == "function" && U4.constructor;
|
||
|
return !!F4 && (F4 === G2 || (F4.displayName || F4.name) === "GeneratorFunction");
|
||
|
}, U3.mark = function(U4) {
|
||
|
return Object.setPrototypeOf ? Object.setPrototypeOf(U4, k2) : (U4.__proto__ = k2, W2(U4, d2, "GeneratorFunction")), U4.prototype = Object.create(Y2), U4;
|
||
|
}, U3.awrap = function(U4) {
|
||
|
return { __await: U4 };
|
||
|
}, X2(h2.prototype), W2(h2.prototype, Z2, function() {
|
||
|
return this;
|
||
|
}), U3.AsyncIterator = h2, U3.async = function(F4, Q3, B3, R3, V3) {
|
||
|
V3 === void 0 && (V3 = Promise);
|
||
|
var l3 = new h2(J2(F4, Q3, B3, R3), V3);
|
||
|
return U3.isGeneratorFunction(Q3) ? l3 : l3.next().then(function(U4) {
|
||
|
return U4.done ? U4.value : l3.next();
|
||
|
});
|
||
|
}, X2(Y2), W2(Y2, d2, "Generator"), W2(Y2, l2, function() {
|
||
|
return this;
|
||
|
}), W2(Y2, "toString", function() {
|
||
|
return "[object Generator]";
|
||
|
}), U3.keys = function(U4) {
|
||
|
var F4 = Object(U4), Q3 = [];
|
||
|
for (var B3 in F4)
|
||
|
Q3.push(B3);
|
||
|
return Q3.reverse(), function U5() {
|
||
|
for (; Q3.length; ) {
|
||
|
var B4 = Q3.pop();
|
||
|
if (B4 in F4)
|
||
|
return U5.value = B4, U5.done = false, U5;
|
||
|
}
|
||
|
return U5.done = true, U5;
|
||
|
};
|
||
|
}, U3.values = L2, y2.prototype = { constructor: y2, reset: function(U4) {
|
||
|
if (this.prev = 0, this.next = 0, this.sent = this._sent = F3, this.done = false, this.delegate = null, this.method = "next", this.arg = F3, this.tryEntries.forEach(M2), !U4)
|
||
|
for (var Q3 in this)
|
||
|
Q3.charAt(0) === "t" && B2.call(this, Q3) && !isNaN(+Q3.slice(1)) && (this[Q3] = F3);
|
||
|
}, stop: function() {
|
||
|
this.done = true;
|
||
|
var U4 = this.tryEntries[0].completion;
|
||
|
if (U4.type === "throw")
|
||
|
throw U4.arg;
|
||
|
return this.rval;
|
||
|
}, dispatchException: function(U4) {
|
||
|
if (this.done)
|
||
|
throw U4;
|
||
|
var Q3 = this;
|
||
|
function R3(B3, R4) {
|
||
|
return Z3.type = "throw", Z3.arg = U4, Q3.next = B3, R4 && (Q3.method = "next", Q3.arg = F3), !!R4;
|
||
|
}
|
||
|
for (var V3 = this.tryEntries.length - 1; V3 >= 0; --V3) {
|
||
|
var l3 = this.tryEntries[V3], Z3 = l3.completion;
|
||
|
if (l3.tryLoc === "root")
|
||
|
return R3("end");
|
||
|
if (l3.tryLoc <= this.prev) {
|
||
|
var d3 = B2.call(l3, "catchLoc"), W3 = B2.call(l3, "finallyLoc");
|
||
|
if (d3 && W3) {
|
||
|
if (this.prev < l3.catchLoc)
|
||
|
return R3(l3.catchLoc, true);
|
||
|
if (this.prev < l3.finallyLoc)
|
||
|
return R3(l3.finallyLoc);
|
||
|
} else if (d3) {
|
||
|
if (this.prev < l3.catchLoc)
|
||
|
return R3(l3.catchLoc, true);
|
||
|
} else {
|
||
|
if (!W3)
|
||
|
throw new Error("try statement without catch or finally");
|
||
|
if (this.prev < l3.finallyLoc)
|
||
|
return R3(l3.finallyLoc);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}, abrupt: function(U4, F4) {
|
||
|
for (var Q3 = this.tryEntries.length - 1; Q3 >= 0; --Q3) {
|
||
|
var R3 = this.tryEntries[Q3];
|
||
|
if (R3.tryLoc <= this.prev && B2.call(R3, "finallyLoc") && this.prev < R3.finallyLoc) {
|
||
|
var V3 = R3;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
V3 && (U4 === "break" || U4 === "continue") && V3.tryLoc <= F4 && F4 <= V3.finallyLoc && (V3 = null);
|
||
|
var l3 = V3 ? V3.completion : {};
|
||
|
return l3.type = U4, l3.arg = F4, V3 ? (this.method = "next", this.next = V3.finallyLoc, b2) : this.complete(l3);
|
||
|
}, complete: function(U4, F4) {
|
||
|
if (U4.type === "throw")
|
||
|
throw U4.arg;
|
||
|
return U4.type === "break" || U4.type === "continue" ? this.next = U4.arg : U4.type === "return" ? (this.rval = this.arg = U4.arg, this.method = "return", this.next = "end") : U4.type === "normal" && F4 && (this.next = F4), b2;
|
||
|
}, finish: function(U4) {
|
||
|
for (var F4 = this.tryEntries.length - 1; F4 >= 0; --F4) {
|
||
|
var Q3 = this.tryEntries[F4];
|
||
|
if (Q3.finallyLoc === U4)
|
||
|
return this.complete(Q3.completion, Q3.afterLoc), M2(Q3), b2;
|
||
|
}
|
||
|
}, catch: function(U4) {
|
||
|
for (var F4 = this.tryEntries.length - 1; F4 >= 0; --F4) {
|
||
|
var Q3 = this.tryEntries[F4];
|
||
|
if (Q3.tryLoc === U4) {
|
||
|
var B3 = Q3.completion;
|
||
|
if (B3.type === "throw") {
|
||
|
var R3 = B3.arg;
|
||
|
M2(Q3);
|
||
|
}
|
||
|
return R3;
|
||
|
}
|
||
|
}
|
||
|
throw new Error("illegal catch attempt");
|
||
|
}, delegateYield: function(U4, Q3, B3) {
|
||
|
return this.delegate = { iterator: L2(U4), resultName: Q3, nextLoc: B3 }, this.method === "next" && (this.arg = F3), b2;
|
||
|
} }, U3;
|
||
|
}(U2.exports);
|
||
|
try {
|
||
|
regeneratorRuntime = F2;
|
||
|
} catch (U3) {
|
||
|
typeof globalThis == "object" ? globalThis.regeneratorRuntime = F2 : Function("r", "regeneratorRuntime = r")(F2);
|
||
|
}
|
||
|
}({ get exports() {
|
||
|
return MU;
|
||
|
}, set exports(U2) {
|
||
|
MU = U2;
|
||
|
} });
|
||
|
var yU = (U2, F2) => `${U2}-${F2}-${Math.random().toString(16).slice(3, 8)}`;
|
||
|
var LU = yU;
|
||
|
var jU = 0;
|
||
|
var xU = ({ id: U2, action: F2, payload: Q2 = {} }) => {
|
||
|
let B2 = U2;
|
||
|
return B2 === void 0 && (B2 = LU("Job", jU), jU += 1), { id: B2, action: F2, payload: Q2 };
|
||
|
};
|
||
|
var DU = {};
|
||
|
var uU = false;
|
||
|
DU.logging = uU, DU.setLogging = (U2) => {
|
||
|
uU = U2;
|
||
|
}, DU.log = (...U2) => uU ? console.log.apply(void 0, U2) : null;
|
||
|
var sU = xU;
|
||
|
var { log: tU } = DU;
|
||
|
var zU = yU;
|
||
|
var HU = 0;
|
||
|
var KU = typeof global != "undefined" ? global : typeof self != "undefined" ? self : typeof window != "undefined" ? window : {};
|
||
|
function oU() {
|
||
|
throw new Error("setTimeout has not been defined");
|
||
|
}
|
||
|
function OU() {
|
||
|
throw new Error("clearTimeout has not been defined");
|
||
|
}
|
||
|
var wU = oU;
|
||
|
var vU = OU;
|
||
|
function eU(U2) {
|
||
|
if (wU === setTimeout)
|
||
|
return setTimeout(U2, 0);
|
||
|
if ((wU === oU || !wU) && setTimeout)
|
||
|
return wU = setTimeout, setTimeout(U2, 0);
|
||
|
try {
|
||
|
return wU(U2, 0);
|
||
|
} catch (F2) {
|
||
|
try {
|
||
|
return wU.call(null, U2, 0);
|
||
|
} catch (F3) {
|
||
|
return wU.call(this, U2, 0);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
typeof KU.setTimeout == "function" && (wU = setTimeout), typeof KU.clearTimeout == "function" && (vU = clearTimeout);
|
||
|
var gU;
|
||
|
var PU = [];
|
||
|
var rU = false;
|
||
|
var AU = -1;
|
||
|
function fU() {
|
||
|
rU && gU && (rU = false, gU.length ? PU = gU.concat(PU) : AU = -1, PU.length && qU());
|
||
|
}
|
||
|
function qU() {
|
||
|
if (!rU) {
|
||
|
var U2 = eU(fU);
|
||
|
rU = true;
|
||
|
for (var F2 = PU.length; F2; ) {
|
||
|
for (gU = PU, PU = []; ++AU < F2; )
|
||
|
gU && gU[AU].run();
|
||
|
AU = -1, F2 = PU.length;
|
||
|
}
|
||
|
gU = null, rU = false, function(U3) {
|
||
|
if (vU === clearTimeout)
|
||
|
return clearTimeout(U3);
|
||
|
if ((vU === OU || !vU) && clearTimeout)
|
||
|
return vU = clearTimeout, clearTimeout(U3);
|
||
|
try {
|
||
|
return vU(U3);
|
||
|
} catch (F3) {
|
||
|
try {
|
||
|
return vU.call(null, U3);
|
||
|
} catch (F4) {
|
||
|
return vU.call(this, U3);
|
||
|
}
|
||
|
}
|
||
|
}(U2);
|
||
|
}
|
||
|
}
|
||
|
function _U(U2, F2) {
|
||
|
this.fun = U2, this.array = F2;
|
||
|
}
|
||
|
_U.prototype.run = function() {
|
||
|
this.fun.apply(null, this.array);
|
||
|
};
|
||
|
function $U() {
|
||
|
}
|
||
|
var UF = $U;
|
||
|
var FF = $U;
|
||
|
var QF = $U;
|
||
|
var BF = $U;
|
||
|
var RF = $U;
|
||
|
var VF = $U;
|
||
|
var lF = $U;
|
||
|
var ZF = KU.performance || {};
|
||
|
var dF = ZF.now || ZF.mozNow || ZF.msNow || ZF.oNow || ZF.webkitNow || function() {
|
||
|
return new Date().getTime();
|
||
|
};
|
||
|
var WF = new Date();
|
||
|
var JF = { nextTick: function(U2) {
|
||
|
var F2 = new Array(arguments.length - 1);
|
||
|
if (arguments.length > 1)
|
||
|
for (var Q2 = 1; Q2 < arguments.length; Q2++)
|
||
|
F2[Q2 - 1] = arguments[Q2];
|
||
|
PU.push(new _U(U2, F2)), PU.length !== 1 || rU || eU(qU);
|
||
|
}, title: "browser", browser: true, env: {}, argv: [], version: "", versions: {}, on: UF, addListener: FF, once: QF, off: BF, removeListener: RF, removeAllListeners: VF, emit: lF, binding: function(U2) {
|
||
|
throw new Error("process.binding is not supported");
|
||
|
}, cwd: function() {
|
||
|
return "/";
|
||
|
}, chdir: function(U2) {
|
||
|
throw new Error("process.chdir is not supported");
|
||
|
}, umask: function() {
|
||
|
return 0;
|
||
|
}, hrtime: function(U2) {
|
||
|
var F2 = 1e-3 * dF.call(ZF), Q2 = Math.floor(F2), B2 = Math.floor(F2 % 1 * 1e9);
|
||
|
return U2 && (Q2 -= U2[0], (B2 -= U2[1]) < 0 && (Q2--, B2 += 1e9)), [Q2, B2];
|
||
|
}, platform: "browser", release: {}, config: {}, uptime: function() {
|
||
|
return (new Date() - WF) / 1e3;
|
||
|
} };
|
||
|
var NF = function() {
|
||
|
return typeof window != "undefined" && typeof window.process == "object" && window.process.type === "renderer" || (!(JF === void 0 || typeof JF.versions != "object" || !JF.versions.electron) || typeof navigator == "object" && typeof navigator.userAgent == "string" && navigator.userAgent.indexOf("Electron") >= 0);
|
||
|
};
|
||
|
var SF;
|
||
|
var IF = {};
|
||
|
var mF = { get exports() {
|
||
|
return IF;
|
||
|
}, set exports(U2) {
|
||
|
IF = U2;
|
||
|
} };
|
||
|
function iF() {
|
||
|
return SF || (SF = 1, mF.exports = function() {
|
||
|
function U2() {
|
||
|
var U3 = arguments.length;
|
||
|
if (U3 === 0)
|
||
|
throw new Error("resolveUrl requires at least one argument; got none.");
|
||
|
var F2 = document.createElement("base");
|
||
|
if (F2.href = arguments[0], U3 === 1)
|
||
|
return F2.href;
|
||
|
var Q2 = document.getElementsByTagName("head")[0];
|
||
|
Q2.insertBefore(F2, Q2.firstChild);
|
||
|
for (var B2, R2 = document.createElement("a"), V2 = 1; V2 < U3; V2++)
|
||
|
R2.href = arguments[V2], B2 = R2.href, F2.href = B2;
|
||
|
return Q2.removeChild(F2), B2;
|
||
|
}
|
||
|
return U2;
|
||
|
}()), IF;
|
||
|
}
|
||
|
var bF = ((U2) => {
|
||
|
const F2 = {};
|
||
|
return typeof WorkerGlobalScope != "undefined" ? F2.type = "webworker" : NF() ? F2.type = "electron" : typeof window == "object" ? F2.type = "browser" : typeof JF == "object" && (F2.type = "node"), U2 === void 0 ? F2 : F2[U2];
|
||
|
})("type") === "browser";
|
||
|
var EF = bF ? iF() : (U2) => U2;
|
||
|
var GF = { TESSERACT_ONLY: 0, LSTM_ONLY: 1, TESSERACT_LSTM_COMBINED: 2, DEFAULT: 3 };
|
||
|
var kF = { defaultOEM: GF.DEFAULT };
|
||
|
var nF = { name: "tesseract.js", version: "3.0.3", description: "Pure Javascript Multilingual OCR", main: "src/index.js", types: "src/index.d.ts", unpkg: "dist/tesseract.min.js", jsdelivr: "dist/tesseract.min.js", scripts: { start: "node scripts/server.js", build: "rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.js", "profile:tesseract": "webpack-bundle-analyzer dist/tesseract-stats.json", "profile:worker": "webpack-bundle-analyzer dist/worker-stats.json", prepublishOnly: "npm run build", wait: "rimraf dist && wait-on http://localhost:3000/dist/tesseract.dev.js", test: "npm-run-all -p -r start test:all", "test:all": "npm-run-all wait test:browser:* test:node:all", "test:node": "nyc mocha --exit --bail --require ./scripts/test-helper.js", "test:node:all": "npm run test:node -- ./tests/*.test.js", "test:browser-tpl": "mocha-headless-chrome -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000", "test:browser:detect": "npm run test:browser-tpl -- -f ./tests/detect.test.html", "test:browser:recognize": "npm run test:browser-tpl -- -f ./tests/recognize.test.html", "test:browser:scheduler": "npm run test:browser-tpl -- -f ./tests/scheduler.test.html", "test:browser:FS": "npm run test:browser-tpl -- -f ./tests/FS.test.html", lint: "eslint src", "lint:fix": "eslint --fix src", postinstall: "opencollective-postinstall || true" }, browser: { "./src/worker/node/index.js": "./src/worker/browser/index.js" }, author: "", contributors: ["jeromewu"], license: "Apache-2.0", devDependencies: { "@babel/core": "^7.18.7", "@babel/preset-env": "^7.18.7", "@rollup/plugin-commonjs": "^22.0.2", acorn: "^6.4.0", "babel-loader": "^8.2.0", buffer: "^6.0.3", cors: "^2.8.5", eslint: "^7.2.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-plugin-import": "^2.22.1", "expect.js": "^0.3.1", express: "^4.17.1", mocha: "^8.1.3", "mocha-headless-chrome": "^2.0.3", "npm-run-all": "^4.1.5", nyc: "^15.1.0", rimraf: "^2.7.1", rollup: "^2.79.0", "wait-on": "^3.3.0", webpack: "^5.74.0", "webpack-bundle-analyzer": "^4.6.0", "webpack-cli": "^4.10.0", "webpack-dev-middleware": "^5.3.3" }, dependencies: { "babel-eslint": "^10.1.0", "bmp-js": "^0.1.0", "file-type": "^12.4.1", "idb-keyval": "^3.2.0", "is-electron": "^2.2.0", "is-url": "^1.2.4", "node-fetch": "^2.6.0", "opencollective-postinstall": "^2.0.2", "regenerator-runtime": "^0.13.3", "resolve-url": "^0.2.1", "tesseract.js-core": "^3.0.2", "wasm-feature-detect": "^1.2.11", zlibjs: "^0.3.1" }, repository: { type: "git", url: "https://github.com/naptha/tesseract.js.git" }, bugs: { url: "https://github.com/naptha/tesseract.js/issues" }, homepage: "https://github.com/naptha/tesseract.js", collective: { type: "opencollective", url: "https://opencollective.com/tesseractjs" } };
|
||
|
var TF = iF();
|
||
|
var { version: cF } = nF;
|
||
|
var YF = { ...{ langPath: "https://tessdata.projectnaptha.com/4.0.0", workerBlobURL: true, logger: () => {
|
||
|
} }, workerPath: JF !== void 0 && JF.env.TESS_ENV === "development" ? TF(`/dist/worker.dev.js?nocache=${Math.random().toString(36).slice(3)}`) : `https://unpkg.com/tesseract.js@v${cF}/dist/worker.min.js`, corePath: null };
|
||
|
var XF = iF();
|
||
|
var hF = (U2) => new Promise((F2, Q2) => {
|
||
|
const B2 = new FileReader();
|
||
|
B2.onload = () => {
|
||
|
F2(B2.result);
|
||
|
}, B2.onerror = ({ target: { error: { code: U3 } } }) => {
|
||
|
Q2(Error(`File could not be read! Code=${U3}`));
|
||
|
}, B2.readAsArrayBuffer(U2);
|
||
|
});
|
||
|
var pF = async (U2) => {
|
||
|
let F2 = U2;
|
||
|
if (U2 === void 0)
|
||
|
return "undefined";
|
||
|
if (typeof U2 == "string")
|
||
|
if (/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(U2))
|
||
|
F2 = atob(U2.split(",")[1]).split("").map((U3) => U3.charCodeAt(0));
|
||
|
else {
|
||
|
const Q2 = await fetch(XF(U2));
|
||
|
F2 = await Q2.arrayBuffer();
|
||
|
}
|
||
|
else
|
||
|
U2 instanceof HTMLElement ? (U2.tagName === "IMG" && (F2 = await pF(U2.src)), U2.tagName === "VIDEO" && (F2 = await pF(U2.poster)), U2.tagName === "CANVAS" && await new Promise((Q2) => {
|
||
|
U2.toBlob(async (U3) => {
|
||
|
F2 = await hF(U3), Q2();
|
||
|
});
|
||
|
})) : (U2 instanceof File || U2 instanceof Blob) && (F2 = await hF(U2));
|
||
|
return new Uint8Array(F2);
|
||
|
};
|
||
|
var CF = (U2, F2) => {
|
||
|
U2.onmessage = ({ data: U3 }) => {
|
||
|
F2(U3);
|
||
|
};
|
||
|
};
|
||
|
var aF = { defaultOptions: YF, spawnWorker: ({ workerPath: U2, workerBlobURL: F2 }) => {
|
||
|
let Q2;
|
||
|
if (Blob && URL && F2) {
|
||
|
const F3 = new Blob([`importScripts("${U2}");`], { type: "application/javascript" });
|
||
|
Q2 = new Worker(URL.createObjectURL(F3));
|
||
|
} else
|
||
|
Q2 = new Worker(U2);
|
||
|
return Q2;
|
||
|
}, terminateWorker: (U2) => {
|
||
|
U2.terminate();
|
||
|
}, onMessage: CF, send: async (U2, F2) => {
|
||
|
U2.postMessage(F2);
|
||
|
}, loadImage: pF };
|
||
|
var MF = (U2) => {
|
||
|
const F2 = { ...U2 };
|
||
|
return ["corePath", "workerPath", "langPath"].forEach((Q2) => {
|
||
|
U2[Q2] && (F2[Q2] = EF(F2[Q2]));
|
||
|
}), F2;
|
||
|
};
|
||
|
var yF = (U2) => {
|
||
|
const F2 = [], Q2 = [], B2 = [], R2 = [], V2 = [];
|
||
|
return U2.blocks.forEach((l2) => {
|
||
|
l2.paragraphs.forEach((F3) => {
|
||
|
F3.lines.forEach((Q3) => {
|
||
|
Q3.words.forEach((B3) => {
|
||
|
B3.symbols.forEach((R3) => {
|
||
|
V2.push({ ...R3, page: U2, block: l2, paragraph: F3, line: Q3, word: B3 });
|
||
|
}), R2.push({ ...B3, page: U2, block: l2, paragraph: F3, line: Q3 });
|
||
|
}), B2.push({ ...Q3, page: U2, block: l2, paragraph: F3 });
|
||
|
}), Q2.push({ ...F3, page: U2, block: l2 });
|
||
|
}), F2.push({ ...l2, page: U2 });
|
||
|
}), { ...U2, blocks: F2, paragraphs: Q2, lines: B2, words: R2, symbols: V2 };
|
||
|
};
|
||
|
var LF = xU;
|
||
|
var { log: jF } = DU;
|
||
|
var xF = yU;
|
||
|
var { defaultOEM: DF } = kF;
|
||
|
var { defaultOptions: uF, spawnWorker: sF, terminateWorker: tF, onMessage: zF, loadImage: HF, send: KF } = aF;
|
||
|
var oF = 0;
|
||
|
var OF = (U2 = {}) => {
|
||
|
const F2 = xF("Worker", oF), { logger: Q2, errorHandler: B2, ...R2 } = MF({ ...uF, ...U2 }), V2 = {}, l2 = {};
|
||
|
let Z2 = sF(R2);
|
||
|
oF += 1;
|
||
|
const d2 = (U3, F3) => {
|
||
|
V2[U3] = F3;
|
||
|
}, W2 = (U3, F3) => {
|
||
|
l2[U3] = F3;
|
||
|
}, J2 = ({ id: U3, action: Q3, payload: B3 }) => new Promise((R3, V3) => {
|
||
|
jF(`[${F2}]: Start ${U3}, action=${Q3}`), d2(Q3, R3), W2(Q3, V3), KF(Z2, { workerId: F2, jobId: U3, action: Q3, payload: B3 });
|
||
|
});
|
||
|
return zF(Z2, ({ workerId: U3, jobId: F3, status: R3, action: Z3, data: d3 }) => {
|
||
|
if (R3 === "resolve") {
|
||
|
jF(`[${U3}]: Complete ${F3}`);
|
||
|
let Q3 = d3;
|
||
|
Z3 === "recognize" ? Q3 = yF(d3) : Z3 === "getPDF" && (Q3 = Array.from({ ...d3, length: Object.keys(d3).length })), V2[Z3]({ jobId: F3, data: Q3 });
|
||
|
} else if (R3 === "reject") {
|
||
|
if (l2[Z3](d3), !B2)
|
||
|
throw Error(d3);
|
||
|
B2(d3);
|
||
|
} else
|
||
|
R3 === "progress" && Q2({ ...d3, userJobId: F3 });
|
||
|
}), { id: F2, worker: Z2, setResolve: d2, setReject: W2, load: (U3) => J2(LF({ id: U3, action: "load", payload: { options: R2 } })), writeText: (U3, F3, Q3) => J2(LF({ id: Q3, action: "FS", payload: { method: "writeFile", args: [U3, F3] } })), readText: (U3, F3) => J2(LF({ id: F3, action: "FS", payload: { method: "readFile", args: [U3, { encoding: "utf8" }] } })), removeFile: (U3, F3) => J2(LF({ id: F3, action: "FS", payload: { method: "unlink", args: [U3] } })), FS: (U3, F3, Q3) => J2(LF({ id: Q3, action: "FS", payload: { method: U3, args: F3 } })), loadLanguage: (U3 = "eng", F3) => J2(LF({ id: F3, action: "loadLanguage", payload: { langs: U3, options: R2 } })), initialize: (U3 = "eng", F3 = DF, Q3) => J2(LF({ id: Q3, action: "initialize", payload: { langs: U3, oem: F3 } })), setParameters: (U3 = {}, F3) => J2(LF({ id: F3, action: "setParameters", payload: { params: U3 } })), recognize: async (U3, F3 = {}, Q3) => J2(LF({ id: Q3, action: "recognize", payload: { image: await HF(U3), options: F3 } })), getPDF: (U3 = "Tesseract OCR Result", F3 = false, Q3) => J2(LF({ id: Q3, action: "getPDF", payload: { title: U3, textonly: F3 } })), detect: async (U3, F3) => J2(LF({ id: F3, action: "detect", payload: { image: await HF(U3) } })), terminate: async () => (Z2 !== null && (tF(Z2), Z2 = null), Promise.resolve()) };
|
||
|
};
|
||
|
var wF = OF;
|
||
|
var vF = () => {
|
||
|
const U2 = zU("Scheduler", HU), F2 = {}, Q2 = {};
|
||
|
let B2 = [];
|
||
|
HU += 1;
|
||
|
const R2 = () => Object.keys(F2).length, V2 = () => {
|
||
|
if (B2.length !== 0) {
|
||
|
const U3 = Object.keys(F2);
|
||
|
for (let R3 = 0; R3 < U3.length; R3 += 1)
|
||
|
if (Q2[U3[R3]] === void 0) {
|
||
|
B2[0](F2[U3[R3]]);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
return { addWorker: (Q3) => (F2[Q3.id] = Q3, tU(`[${U2}]: Add ${Q3.id}`), tU(`[${U2}]: Number of workers=${R2()}`), V2(), Q3.id), addJob: async (F3, ...l2) => {
|
||
|
if (R2() === 0)
|
||
|
throw Error(`[${U2}]: You need to have at least one worker before adding jobs`);
|
||
|
return ((F4, R3) => new Promise((l3, Z2) => {
|
||
|
const d2 = sU({ action: F4, payload: R3 });
|
||
|
B2.push(async (U3) => {
|
||
|
B2.shift(), Q2[U3.id] = d2;
|
||
|
try {
|
||
|
l3(await U3[F4].apply(void 0, [...R3, d2.id]));
|
||
|
} catch (U4) {
|
||
|
Z2(U4);
|
||
|
} finally {
|
||
|
delete Q2[U3.id], V2();
|
||
|
}
|
||
|
}), tU(`[${U2}]: Add ${d2.id} to JobQueue`), tU(`[${U2}]: JobQueue length=${B2.length}`), V2();
|
||
|
}))(F3, l2);
|
||
|
}, terminate: async () => {
|
||
|
Object.keys(F2).forEach(async (U3) => {
|
||
|
await F2[U3].terminate();
|
||
|
}), B2 = [];
|
||
|
}, getQueueLen: () => B2.length, getNumWorkers: R2 };
|
||
|
};
|
||
|
var eF = OF;
|
||
|
var gF = { recognize: async (U2, F2, Q2) => {
|
||
|
const B2 = wF(Q2);
|
||
|
return await B2.load(), await B2.loadLanguage(F2), await B2.initialize(F2), B2.recognize(U2).finally(async () => {
|
||
|
await B2.terminate();
|
||
|
});
|
||
|
}, detect: async (U2, F2) => {
|
||
|
const Q2 = wF(F2);
|
||
|
return await Q2.load(), await Q2.loadLanguage("osd"), await Q2.initialize("osd"), Q2.detect(U2).finally(async () => {
|
||
|
await Q2.terminate();
|
||
|
});
|
||
|
} };
|
||
|
var PF = { AFR: "afr", AMH: "amh", ARA: "ara", ASM: "asm", AZE: "aze", AZE_CYRL: "aze_cyrl", BEL: "bel", BEN: "ben", BOD: "bod", BOS: "bos", BUL: "bul", CAT: "cat", CEB: "ceb", CES: "ces", CHI_SIM: "chi_sim", CHI_TRA: "chi_tra", CHR: "chr", CYM: "cym", DAN: "dan", DEU: "deu", DZO: "dzo", ELL: "ell", ENG: "eng", ENM: "enm", EPO: "epo", EST: "est", EUS: "eus", FAS: "fas", FIN: "fin", FRA: "fra", FRK: "frk", FRM: "frm", GLE: "gle", GLG: "glg", GRC: "grc", GUJ: "guj", HAT: "hat", HEB: "heb", HIN: "hin", HRV: "hrv", HUN: "hun", IKU: "iku", IND: "ind", ISL: "isl", ITA: "ita", ITA_OLD: "ita_old", JAV: "jav", JPN: "jpn", KAN: "kan", KAT: "kat", KAT_OLD: "kat_old", KAZ: "kaz", KHM: "khm", KIR: "kir", KOR: "kor", KUR: "kur", LAO: "lao", LAT: "lat", LAV: "lav", LIT: "lit", MAL: "mal", MAR: "mar", MKD: "mkd", MLT: "mlt", MSA: "msa", MYA: "mya", NEP: "nep", NLD: "nld", NOR: "nor", ORI: "ori", PAN: "pan", POL: "pol", POR: "por", PUS: "pus", RON: "ron", RUS: "rus", SAN: "san", SIN: "sin", SLK: "slk", SLV: "slv", SPA: "spa", SPA_OLD: "spa_old", SQI: "sqi", SRP: "srp", SRP_LATN: "srp_latn", SWA: "swa", SWE: "swe", SYR: "syr", TAM: "tam", TEL: "tel", TGK: "tgk", TGL: "tgl", THA: "tha", TIR: "tir", TUR: "tur", UIG: "uig", UKR: "ukr", URD: "urd", UZB: "uzb", UZB_CYRL: "uzb_cyrl", VIE: "vie", YID: "yid" };
|
||
|
var rF = GF;
|
||
|
var AF = { OSD_ONLY: "0", AUTO_OSD: "1", AUTO_ONLY: "2", AUTO: "3", SINGLE_COLUMN: "4", SINGLE_BLOCK_VERT_TEXT: "5", SINGLE_BLOCK: "6", SINGLE_LINE: "7", SINGLE_WORD: "8", CIRCLE_WORD: "9", SINGLE_CHAR: "10", SPARSE_TEXT: "11", SPARSE_TEXT_OSD: "12" };
|
||
|
var { setLogging: fF } = DU;
|
||
|
var qF;
|
||
|
var _F;
|
||
|
var $F;
|
||
|
var UQ;
|
||
|
var FQ;
|
||
|
var QQ;
|
||
|
var BQ;
|
||
|
var RQ = { languages: PF, OEM: rF, PSM: AF, createScheduler: vF, createWorker: eF, setLogging: fF, ...gF };
|
||
|
function VQ(U2) {
|
||
|
return U2.sort().join("+");
|
||
|
}
|
||
|
var lQ = class {
|
||
|
constructor(U2) {
|
||
|
this.worker = U2, $F.set(this, false), UQ.set(this, false);
|
||
|
}
|
||
|
static getWorker() {
|
||
|
const U2 = F(lQ, qF, "f", _F).find((U3) => !F(U3, $F, "f") && F(U3, UQ, "f"));
|
||
|
if (U2)
|
||
|
return U2;
|
||
|
const Q2 = new lQ(RQ.createWorker({ cachePath: "tesseract-" + app.appId }));
|
||
|
return F(lQ, qF, "f", _F).push(Q2), Q2;
|
||
|
}
|
||
|
static clearWorkers() {
|
||
|
F(lQ, qF, "f", _F).forEach((U2) => U2.worker.terminate()), Q(lQ, qF, [], "f", _F);
|
||
|
}
|
||
|
async run(U2) {
|
||
|
return new Promise(async (B2, R2) => {
|
||
|
Q(this, $F, true, "f");
|
||
|
const V2 = VQ(U2.options.langs);
|
||
|
F(this, UQ, "f") || (await this.worker.load(), await this.worker.loadLanguage(V2), await this.worker.initialize(V2), Q(this, UQ, true, "f"));
|
||
|
const l2 = setTimeout(() => {
|
||
|
this.worker.terminate(), console.warn("Text Extractor - OCR Worker timeout for " + U2.name), R2("timeout"), F(lQ, qF, "m", FQ).call(lQ, this);
|
||
|
}, $);
|
||
|
try {
|
||
|
const { data: F2 } = await this.worker.recognize(U2.imageData);
|
||
|
return clearTimeout(l2), B2({ text: F2.text, langs: V2 });
|
||
|
} catch (F2) {
|
||
|
console.error("Text Extractor - OCR Worker exception for " + U2.name), console.error(F2), B2({ text: "", langs: V2 });
|
||
|
} finally {
|
||
|
Q(this, $F, false, "f");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
qF = lQ, $F = /* @__PURE__ */ new WeakMap(), UQ = /* @__PURE__ */ new WeakMap(), FQ = function(U2) {
|
||
|
U2.worker.terminate(), Q(lQ, qF, F(lQ, qF, "f", _F).filter((F2) => F2 !== U2), "f", _F);
|
||
|
}, _F = { value: [] };
|
||
|
QQ = /* @__PURE__ */ new WeakSet(), BQ = async function(F2, Q2) {
|
||
|
var _a2;
|
||
|
const B2 = await iU(F2);
|
||
|
if (B2)
|
||
|
return (_a2 = B2.text) != null ? _a2 : BU;
|
||
|
if (import_obsidian.Platform.isMobile || !Buffer)
|
||
|
return RU;
|
||
|
const R2 = mU(F2), V2 = new Uint8ClampedArray(await app.vault.readBinary(F2)), l2 = lQ.getWorker(), Z2 = VQ(Q2.langs);
|
||
|
return new Promise(async (U2, B3) => {
|
||
|
try {
|
||
|
const B4 = (await l2.run({ imageData: Buffer.from(V2.buffer), name: F2.basename, options: Q2 })).text.replace(/\n/g, " ").replace(/ +/g, " ").trim();
|
||
|
await bU(R2.folder, R2.filename, B4, F2.path, Z2), U2(B4);
|
||
|
} catch (Q3) {
|
||
|
await bU(R2.folder, R2.filename, "", F2.path, Z2), U2("");
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
var ZQ = new class {
|
||
|
constructor() {
|
||
|
QQ.add(this);
|
||
|
}
|
||
|
async getImageText(U2, Q2) {
|
||
|
var _a2;
|
||
|
try {
|
||
|
return (_a2 = await FU.add(() => F(this, QQ, "m", BQ).call(this, U2, Q2))) != null ? _a2 : "";
|
||
|
} catch (F2) {
|
||
|
return console.warn(`Text Extractor - Error while extracting text from ${U2.basename}`), console.warn(F2), "";
|
||
|
}
|
||
|
}
|
||
|
}();
|
||
|
function dQ() {
|
||
|
lQ.clearWorkers();
|
||
|
}
|
||
|
var WQ = ["afr", "amh", "ara", "asm", "aze", "aze_cyrl", "bel", "ben", "bod", "bos", "bul", "cat", "ceb", "ces", "chi_sim", "chi_tra", "chr", "cym", "dan", "deu", "dzo", "ell", "eng", "enm", "epo", "est", "eus", "fas", "fin", "fra", "frk", "frm", "gle", "glg", "grc", "guj", "hat", "heb", "hin", "hrv", "hun", "iku", "ind", "isl", "ita", "ita_old", "jav", "jpn", "kan", "kat", "kat_old", "kaz", "khm", "kir", "kor", "kur", "lao", "lat", "lav", "lit", "mal", "mar", "mkd", "mlt", "msa", "mya", "nep", "nld", "nor", "ori", "pan", "pol", "por", "pus", "ron", "rus", "san", "sin", "slk", "slv", "spa", "spa_old", "sqi", "srp", "srp_latn", "swa", "swe", "syr", "tam", "tel", "tgk", "tgl", "tha", "tir", "tur", "uig", "ukr", "urd", "uzb", "uzb_cyrl", "vie", "yid"];
|
||
|
function JQ(U2, F2) {
|
||
|
const Q2 = Object.assign({}, { langs: ["eng"] }, F2);
|
||
|
if (NQ(U2.path))
|
||
|
return GU.getPdfText(U2);
|
||
|
if (SQ(U2.path))
|
||
|
return ZQ.getImageText(U2, Q2);
|
||
|
if (IQ(U2.path))
|
||
|
return aU.getOfficeText(U2);
|
||
|
throw new Error("File type not supported");
|
||
|
}
|
||
|
function NQ(U2) {
|
||
|
return U2.endsWith(".pdf");
|
||
|
}
|
||
|
function SQ(U2) {
|
||
|
return U2.endsWith(".png") || U2.endsWith(".jpg") || U2.endsWith(".jpeg") || U2.endsWith(".webp") || U2.endsWith(".gif") || U2.endsWith(".bmp");
|
||
|
}
|
||
|
function IQ(U2) {
|
||
|
return U2.endsWith(".docx") || U2.endsWith(".xlsx");
|
||
|
}
|
||
|
function mQ(U2) {
|
||
|
return NQ(U2) || SQ(U2) || IQ(U2);
|
||
|
}
|
||
|
function iQ() {
|
||
|
return WQ;
|
||
|
}
|
||
|
function bQ() {
|
||
|
UU.clear();
|
||
|
}
|
||
|
async function EQ(U2) {
|
||
|
const F2 = mU(U2);
|
||
|
return app.vault.adapter.exists(F2.fullpath);
|
||
|
}
|
||
|
async function GQ(U2) {
|
||
|
const F2 = mU(U2);
|
||
|
if (await EQ(U2))
|
||
|
return await app.vault.adapter.remove(F2.fullpath);
|
||
|
}
|
||
|
|
||
|
// src/components/LangSelector.svelte
|
||
|
function add_css3(target) {
|
||
|
append_styles(target, "svelte-b16yhr", ".text-extract.svelte-b16yhr div.multiselect{color:var(--text-primary);border:var(--input-border-width) solid var(--background-modifier-border);background-color:var(--background-secondary)}.text-extract.svelte-b16yhr div.multiselect > ul.options{background-color:var(--background-secondary)}.text-extract.svelte-b16yhr div.multiselect button{border-radius:0}.text-extract.svelte-b16yhr button:not(.clickable-icon){background-color:transparent;box-shadow:none;width:1em}");
|
||
|
}
|
||
|
function create_fragment7(ctx) {
|
||
|
let div;
|
||
|
let multiselect;
|
||
|
let updating_selected;
|
||
|
let current;
|
||
|
function multiselect_selected_binding(value) {
|
||
|
ctx[2](value);
|
||
|
}
|
||
|
let multiselect_props = { options: ctx[1], maxSelect: 3 };
|
||
|
if (ctx[0] !== void 0) {
|
||
|
multiselect_props.selected = ctx[0];
|
||
|
}
|
||
|
multiselect = new MultiSelect_default({ props: multiselect_props });
|
||
|
binding_callbacks.push(() => bind(multiselect, "selected", multiselect_selected_binding));
|
||
|
return {
|
||
|
c() {
|
||
|
div = element("div");
|
||
|
create_component(multiselect.$$.fragment);
|
||
|
attr(div, "class", "text-extract svelte-b16yhr");
|
||
|
},
|
||
|
m(target, anchor) {
|
||
|
insert(target, div, anchor);
|
||
|
mount_component(multiselect, div, null);
|
||
|
current = true;
|
||
|
},
|
||
|
p(ctx2, [dirty]) {
|
||
|
const multiselect_changes = {};
|
||
|
if (!updating_selected && dirty & 1) {
|
||
|
updating_selected = true;
|
||
|
multiselect_changes.selected = ctx2[0];
|
||
|
add_flush_callback(() => updating_selected = false);
|
||
|
}
|
||
|
multiselect.$set(multiselect_changes);
|
||
|
},
|
||
|
i(local) {
|
||
|
if (current)
|
||
|
return;
|
||
|
transition_in(multiselect.$$.fragment, local);
|
||
|
current = true;
|
||
|
},
|
||
|
o(local) {
|
||
|
transition_out(multiselect.$$.fragment, local);
|
||
|
current = false;
|
||
|
},
|
||
|
d(detaching) {
|
||
|
if (detaching)
|
||
|
detach(div);
|
||
|
destroy_component(multiselect);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
function instance7($$self, $$props, $$invalidate) {
|
||
|
let $selectedLanguages;
|
||
|
component_subscribe($$self, selectedLanguages, ($$value) => $$invalidate(0, $selectedLanguages = $$value));
|
||
|
const langs = iQ();
|
||
|
function multiselect_selected_binding(value) {
|
||
|
$selectedLanguages = value;
|
||
|
selectedLanguages.set($selectedLanguages);
|
||
|
}
|
||
|
return [$selectedLanguages, langs, multiselect_selected_binding];
|
||
|
}
|
||
|
var LangSelector = class extends SvelteComponent {
|
||
|
constructor(options) {
|
||
|
super();
|
||
|
init(this, options, instance7, create_fragment7, safe_not_equal, {}, add_css3);
|
||
|
}
|
||
|
};
|
||
|
var LangSelector_default = LangSelector;
|
||
|
|
||
|
// src/settings.ts
|
||
|
var TextExtractorSettingsTab = class extends import_obsidian2.PluginSettingTab {
|
||
|
constructor(plugin) {
|
||
|
super(app, plugin);
|
||
|
this.plugin = plugin;
|
||
|
selectedLanguages.subscribe(async (value) => {
|
||
|
settings.ocrLanguages = value;
|
||
|
dQ();
|
||
|
await saveSettings(this.plugin);
|
||
|
});
|
||
|
}
|
||
|
display() {
|
||
|
const { containerEl } = this;
|
||
|
containerEl.empty();
|
||
|
containerEl.createEl("h2", { text: "Text Extractor - Settings" });
|
||
|
const container = containerEl.createEl("div", {
|
||
|
cls: "setting-item"
|
||
|
});
|
||
|
const info = container.createDiv({ cls: "setting-item-info" });
|
||
|
info.createDiv({ cls: "setting-item-name", text: "OCR Languages" });
|
||
|
info.createDiv({
|
||
|
cls: "setting-item-description",
|
||
|
text: `A list of languages to use for OCR. e.g. if your vault contains documents in English and French, you'd want to add 'eng' and 'fra' here.
|
||
|
This setting only applies to images, not PDFs. You may have to clear the cache after changing this setting.`
|
||
|
});
|
||
|
new LangSelector_default({
|
||
|
target: container.createDiv({ cls: "setting-item-control" })
|
||
|
});
|
||
|
new import_obsidian2.Setting(containerEl).setName("Right click menu").setDesc('Add "Text Extractor" actions to the right click menu in the file explorer.').addToggle((toggle) => {
|
||
|
toggle.setValue(settings.rightClickMenu).onChange(async (v2) => {
|
||
|
settings.rightClickMenu = v2;
|
||
|
await saveSettings(this.plugin);
|
||
|
});
|
||
|
});
|
||
|
new import_obsidian2.Setting(containerEl).setName("Danger Zone").setHeading();
|
||
|
const resetCacheDesc = new DocumentFragment();
|
||
|
resetCacheDesc.createSpan({}, (span) => {
|
||
|
span.innerHTML = `Erase all Text Extractor cache data. Use this if you want to re-extract all your files, e.g after a change in language settings.<br>
|
||
|
Be careful that re-extracting all your files can take a long time.`;
|
||
|
});
|
||
|
new import_obsidian2.Setting(containerEl).setName("Clear cache data").setDesc(resetCacheDesc).addButton((cb) => {
|
||
|
cb.setButtonText("Clear cache");
|
||
|
cb.onClick(async () => {
|
||
|
await app.vault.adapter.rmdir(SU(), true);
|
||
|
new import_obsidian2.Notice("Text Extract - Cache cleared.");
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
var DEFAULT_SETTINGS = {
|
||
|
ocrLanguages: ["eng"],
|
||
|
rightClickMenu: true
|
||
|
};
|
||
|
var selectedLanguages = writable(DEFAULT_SETTINGS.ocrLanguages);
|
||
|
var settings = Object.assign({}, DEFAULT_SETTINGS);
|
||
|
async function loadSettings(plugin) {
|
||
|
settings = Object.assign({}, DEFAULT_SETTINGS, await plugin.loadData());
|
||
|
if (settings.ocrLanguages.length === 0) {
|
||
|
settings.ocrLanguages = DEFAULT_SETTINGS.ocrLanguages;
|
||
|
}
|
||
|
selectedLanguages.set(settings.ocrLanguages);
|
||
|
}
|
||
|
async function saveSettings(plugin) {
|
||
|
await plugin.saveData(settings);
|
||
|
}
|
||
|
|
||
|
// src/utils.ts
|
||
|
var import_obsidian3 = require("obsidian");
|
||
|
async function createNote(name, contents = "") {
|
||
|
var _a2, _b, _c;
|
||
|
try {
|
||
|
let pathPrefix;
|
||
|
switch (app.vault.getConfig("newFileLocation")) {
|
||
|
case "current":
|
||
|
pathPrefix = (_c = (_b = (_a2 = app.workspace.getActiveFile()) == null ? void 0 : _a2.parent) == null ? void 0 : _b.path) != null ? _c : "";
|
||
|
break;
|
||
|
case "folder":
|
||
|
pathPrefix = app.vault.getConfig("newFileFolderPath");
|
||
|
break;
|
||
|
default:
|
||
|
pathPrefix = "";
|
||
|
break;
|
||
|
}
|
||
|
if (pathPrefix) {
|
||
|
pathPrefix += "/";
|
||
|
}
|
||
|
let path = `${pathPrefix}${name}`;
|
||
|
if (app.vault.getAbstractFileByPath(`${path}.md`)) {
|
||
|
let i2 = 1;
|
||
|
while (await app.vault.getAbstractFileByPath(`${path} ${i2}.md`)) {
|
||
|
i2++;
|
||
|
}
|
||
|
path += ` ${i2}`;
|
||
|
}
|
||
|
await app.vault.create(`${path}.md`, contents);
|
||
|
await app.workspace.openLinkText(path, "");
|
||
|
} catch (e2) {
|
||
|
new import_obsidian3.Notice("Text Extract - Could not create note: " + e2.message);
|
||
|
throw e2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// src/main.ts
|
||
|
var TextExtractorPlugin = class extends import_obsidian4.Plugin {
|
||
|
constructor() {
|
||
|
super(...arguments);
|
||
|
this.api = {
|
||
|
async extractText(file) {
|
||
|
const langs = settings.ocrLanguages;
|
||
|
return await JQ(file, { langs });
|
||
|
},
|
||
|
canFileBeExtracted: mQ,
|
||
|
isInCache: EQ
|
||
|
};
|
||
|
}
|
||
|
async onload() {
|
||
|
await loadSettings(this);
|
||
|
await IU();
|
||
|
this.addSettingTab(new TextExtractorSettingsTab(this));
|
||
|
this.addCommand({
|
||
|
id: "extract-to-clipboard",
|
||
|
name: "Extract text to clipboard",
|
||
|
callback: () => {
|
||
|
const file = getActiveFile(this.app);
|
||
|
if (file != null && mQ(file.path)) {
|
||
|
extractToClipboard(file);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: "extract-to-new-note",
|
||
|
name: "Extract text into a new note",
|
||
|
callback: () => {
|
||
|
const file = getActiveFile(this.app);
|
||
|
if (file != null && mQ(file.path)) {
|
||
|
extractToNewNote(file);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
this.registerEvent(app.workspace.on("file-menu", (menu, file, _source) => {
|
||
|
if (file instanceof import_obsidian4.TFile && mQ(file.path)) {
|
||
|
if (import_obsidian4.Platform.isDesktopApp) {
|
||
|
menu.addItem((item) => {
|
||
|
item.setTitle("Text Extractor");
|
||
|
const submenu = item.setSubmenu();
|
||
|
submenu.addItem((item2) => {
|
||
|
item2.setTitle("Extract Text to clipboard").setIcon("clipboard-copy").onClick(async () => {
|
||
|
extractToClipboard(file);
|
||
|
});
|
||
|
});
|
||
|
submenu.addItem((item2) => {
|
||
|
item2.setTitle("Extract text into a new note").setIcon("document").onClick(async () => {
|
||
|
extractToNewNote(file);
|
||
|
});
|
||
|
});
|
||
|
if (import_obsidian4.Platform.isDesktopApp) {
|
||
|
submenu.addSeparator();
|
||
|
submenu.addItem((item2) => {
|
||
|
item2.setTitle("Clear cache for this file").setIcon("trash").onClick(async () => {
|
||
|
await GQ(file);
|
||
|
new import_obsidian4.Notice(`Text Extractor - Removed ${file.path} from cache`);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
menu.addItem((item) => {
|
||
|
item.setTitle("Extract text into a new note").setIcon("document").onClick(async () => {
|
||
|
extractToNewNote(file);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}));
|
||
|
}
|
||
|
onunload() {
|
||
|
bQ();
|
||
|
}
|
||
|
};
|
||
|
async function extractTextWithNotice(file) {
|
||
|
if (!await EQ(file)) {
|
||
|
new import_obsidian4.Notice(`Text Extractor - Extracting text from file ${file.path}, please wait...`);
|
||
|
}
|
||
|
try {
|
||
|
const langs = settings.ocrLanguages;
|
||
|
return await JQ(file, { langs });
|
||
|
} catch (e2) {
|
||
|
new import_obsidian4.Notice(`Text Extractor - Error extracting text from file ${file.path}`);
|
||
|
throw e2;
|
||
|
}
|
||
|
}
|
||
|
async function extractToClipboard(file) {
|
||
|
const { clipboard } = require("electron");
|
||
|
let text2 = await extractTextWithNotice(file);
|
||
|
await clipboard.writeText(text2);
|
||
|
new import_obsidian4.Notice("Text Extractor - Text copied to clipboard");
|
||
|
}
|
||
|
async function extractToNewNote(file) {
|
||
|
let contents = await extractTextWithNotice(file);
|
||
|
contents = `${contents}
|
||
|
|
||
|
![[${file.path}]]`;
|
||
|
await createNote(file.basename, contents);
|
||
|
}
|
||
|
function getActiveFile(app2) {
|
||
|
var _a2, _b;
|
||
|
return (_b = (_a2 = app2.workspace.activeEditor) == null ? void 0 : _a2.file) != null ? _b : app2.workspace.getActiveFile();
|
||
|
}
|
||
|
/*! *****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation.
|
||
|
|
||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
purpose with or without fee is hereby granted.
|
||
|
|
||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
***************************************************************************** */
|