nn-ui-v2 / build /server /chunks /_page.svelte-IDJdT7Zl.js
muryshev's picture
build update
7895d85
raw
history blame
91.5 kB
import { c as create_ssr_component, o as onDestroy, v as validate_component, e as escape, b as add_attribute, g as getContext, s as setContext, d as compute_rest_props, f as createEventDispatcher, h as spread, i as escape_attribute_value, j as escape_object, a as subscribe, k as each, l as set_store_value, n as hasContext, p as compute_slots, q as split_css_unit } from './ssr-IdY0EU5r.js';
import './client-_MkdHwD5.js';
import { w as writable } from './index2-KUnGpG6g.js';
import { p as prefersReducedMotionStore } from './ProgressBar.svelte_svelte_type_style_lang-5Gb3pa2y.js';
import 'docx';
import 'file-saver';
import './exports-mq_1S73-.js';
const DRAWER_STORE_KEY = "drawerStore";
function initializeDrawerStore() {
const drawerStore = drawerService();
return setContext(DRAWER_STORE_KEY, drawerStore);
}
function drawerService() {
const { subscribe: subscribe2, set, update: update2 } = writable({});
return {
subscribe: subscribe2,
set,
update: update2,
/** Open the drawer. */
open: (newSettings) => update2(() => {
return { open: true, ...newSettings };
}),
/** Close the drawer. */
close: () => update2((d) => {
d.open = false;
return d;
})
};
}
const MODAL_STORE_KEY = "modalStore";
function initializeModalStore() {
const modalStore = modalService();
return setContext(MODAL_STORE_KEY, modalStore);
}
function modalService() {
const { subscribe: subscribe2, set, update: update2 } = writable([]);
return {
subscribe: subscribe2,
set,
update: update2,
/** Append to end of queue. */
trigger: (modal) => update2((mStore) => {
mStore.push(modal);
return mStore;
}),
/** Remove first item in queue. */
close: () => update2((mStore) => {
if (mStore.length > 0)
mStore.shift();
return mStore;
}),
/** Remove all items from queue. */
clear: () => set([])
};
}
const toastDefaults = { message: "Missing Toast Message", autohide: true, timeout: 5e3 };
const TOAST_STORE_KEY = "toastStore";
function getToastStore() {
const toastStore = getContext(TOAST_STORE_KEY);
if (!toastStore)
throw new Error("toastStore is not initialized. Please ensure that `initializeStores()` is invoked in the root layout file of this app!");
return toastStore;
}
function initializeToastStore() {
const toastStore = toastService();
return setContext(TOAST_STORE_KEY, toastStore);
}
function randomUUID() {
const random = Math.random();
return Number(random).toString(32);
}
function toastService() {
const { subscribe: subscribe2, set, update: update2 } = writable([]);
const close = (id) => update2((tStore) => {
if (tStore.length > 0) {
const index = tStore.findIndex((t) => t.id === id);
const selectedToast = tStore[index];
if (selectedToast) {
if (selectedToast.callback)
selectedToast.callback({ id, status: "closed" });
if (selectedToast.timeoutId)
clearTimeout(selectedToast.timeoutId);
tStore.splice(index, 1);
}
}
return tStore;
});
function handleAutoHide(toast) {
if (toast.autohide === true) {
return setTimeout(() => {
close(toast.id);
}, toast.timeout);
}
}
return {
subscribe: subscribe2,
close,
/** Add a new toast to the queue. */
trigger: (toast) => {
const id = randomUUID();
update2((tStore) => {
if (toast && toast.callback)
toast.callback({ id, status: "queued" });
if (toast.hideDismiss)
toast.autohide = true;
const tMerged = { ...toastDefaults, ...toast, id };
tMerged.timeoutId = handleAutoHide(tMerged);
tStore.push(tMerged);
return tStore;
});
return id;
},
/** Remain visible on hover */
freeze: (index) => update2((tStore) => {
if (tStore.length > 0)
clearTimeout(tStore[index].timeoutId);
return tStore;
}),
/** Cancel remain visible on leave */
unfreeze: (index) => update2((tStore) => {
if (tStore.length > 0)
tStore[index].timeoutId = handleAutoHide(tStore[index]);
return tStore;
}),
/** Remove all toasts from queue */
clear: () => set([])
};
}
function initializeStores() {
initializeModalStore();
initializeToastStore();
initializeDrawerStore();
}
function cubicOut(t) {
const f = t - 1;
return f * f * f + 1;
}
function fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) {
const style = getComputedStyle(node);
const target_opacity = +style.opacity;
const transform = style.transform === "none" ? "" : style.transform;
const od = target_opacity * (1 - opacity);
const [xValue, xUnit] = split_css_unit(x);
const [yValue, yUnit] = split_css_unit(y);
return {
delay,
duration,
easing,
css: (t, u) => `
transform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit});
opacity: ${target_opacity - od * u}`
};
}
function slide(node, { delay = 0, duration = 400, easing = cubicOut, axis = "y" } = {}) {
const style = getComputedStyle(node);
const opacity = +style.opacity;
const primary_property = axis === "y" ? "height" : "width";
const primary_property_value = parseFloat(style[primary_property]);
const secondary_properties = axis === "y" ? ["top", "bottom"] : ["left", "right"];
const capitalized_secondary_properties = secondary_properties.map(
(e) => `${e[0].toUpperCase()}${e.slice(1)}`
);
const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]);
const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]);
const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]);
const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]);
const border_width_start_value = parseFloat(
style[`border${capitalized_secondary_properties[0]}Width`]
);
const border_width_end_value = parseFloat(
style[`border${capitalized_secondary_properties[1]}Width`]
);
return {
delay,
duration,
easing,
css: (t) => `overflow: hidden;opacity: ${Math.min(t * 20, 1) * opacity};${primary_property}: ${t * primary_property_value}px;padding-${secondary_properties[0]}: ${t * padding_start_value}px;padding-${secondary_properties[1]}: ${t * padding_end_value}px;margin-${secondary_properties[0]}: ${t * margin_start_value}px;margin-${secondary_properties[1]}: ${t * margin_end_value}px;border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;`
};
}
const Accordion = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let classesBase;
let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore;
$$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value);
let { autocollapse = false } = $$props;
let { width = "w-full" } = $$props;
let { spacing = "space-y-1" } = $$props;
let { disabled = false } = $$props;
let { padding = "py-2 px-4" } = $$props;
let { hover = "hover:bg-primary-hover-token" } = $$props;
let { rounded = "rounded-container-token" } = $$props;
let { caretOpen = "rotate-180" } = $$props;
let { caretClosed = "" } = $$props;
let { regionControl = "" } = $$props;
let { regionPanel = "space-y-4" } = $$props;
let { regionCaret = "" } = $$props;
let { transitions = !$prefersReducedMotionStore } = $$props;
let { transitionIn = slide } = $$props;
let { transitionInParams = { duration: 200 } } = $$props;
let { transitionOut = slide } = $$props;
let { transitionOutParams = { duration: 200 } } = $$props;
const active = writable(null);
setContext("active", active);
setContext("autocollapse", autocollapse);
setContext("disabled", disabled);
setContext("padding", padding);
setContext("hover", hover);
setContext("rounded", rounded);
setContext("caretOpen", caretOpen);
setContext("caretClosed", caretClosed);
setContext("regionControl", regionControl);
setContext("regionPanel", regionPanel);
setContext("regionCaret", regionCaret);
setContext("transitions", transitions);
setContext("transitionIn", transitionIn);
setContext("transitionInParams", transitionInParams);
setContext("transitionOut", transitionOut);
setContext("transitionOutParams", transitionOutParams);
if ($$props.autocollapse === void 0 && $$bindings.autocollapse && autocollapse !== void 0)
$$bindings.autocollapse(autocollapse);
if ($$props.width === void 0 && $$bindings.width && width !== void 0)
$$bindings.width(width);
if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0)
$$bindings.spacing(spacing);
if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0)
$$bindings.disabled(disabled);
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0)
$$bindings.padding(padding);
if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0)
$$bindings.hover(hover);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.caretOpen === void 0 && $$bindings.caretOpen && caretOpen !== void 0)
$$bindings.caretOpen(caretOpen);
if ($$props.caretClosed === void 0 && $$bindings.caretClosed && caretClosed !== void 0)
$$bindings.caretClosed(caretClosed);
if ($$props.regionControl === void 0 && $$bindings.regionControl && regionControl !== void 0)
$$bindings.regionControl(regionControl);
if ($$props.regionPanel === void 0 && $$bindings.regionPanel && regionPanel !== void 0)
$$bindings.regionPanel(regionPanel);
if ($$props.regionCaret === void 0 && $$bindings.regionCaret && regionCaret !== void 0)
$$bindings.regionCaret(regionCaret);
if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0)
$$bindings.transitions(transitions);
if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0)
$$bindings.transitionIn(transitionIn);
if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0)
$$bindings.transitionInParams(transitionInParams);
if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0)
$$bindings.transitionOut(transitionOut);
if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0)
$$bindings.transitionOutParams(transitionOutParams);
classesBase = `${width} ${spacing} ${$$props.class ?? ""}`;
$$unsubscribe_prefersReducedMotionStore();
return ` <div class="${"accordion " + escape(classesBase, true)}" data-testid="accordion">${slots.default ? slots.default({}) : ``}</div>`;
});
const cBase$3 = "";
const cControl = "text-start w-full flex items-center space-x-4";
const cControlIcons = "fill-current w-3 transition-transform duration-[200ms]";
const cPanel = "";
const AccordionItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let openState;
let classesBase;
let classesControl;
let classesCaretState;
let classesControlCaret;
let classesControlIcons;
let classesPanel;
let $$slots = compute_slots(slots);
let $active, $$unsubscribe_active;
const dispatch = createEventDispatcher();
let { open = false } = $$props;
let { id = String(Math.random()) } = $$props;
let { autocollapse = getContext("autocollapse") } = $$props;
let { active = getContext("active") } = $$props;
$$unsubscribe_active = subscribe(active, (value) => $active = value);
let { disabled = getContext("disabled") } = $$props;
let { padding = getContext("padding") } = $$props;
let { hover = getContext("hover") } = $$props;
let { rounded = getContext("rounded") } = $$props;
let { caretOpen = getContext("caretOpen") } = $$props;
let { caretClosed = getContext("caretClosed") } = $$props;
let { regionControl = getContext("regionControl") } = $$props;
let { regionPanel = getContext("regionPanel") } = $$props;
let { regionCaret = getContext("regionCaret") } = $$props;
let { transitions = getContext("transitions") } = $$props;
let { transitionIn = getContext("transitionIn") } = $$props;
let { transitionInParams = getContext("transitionInParams") } = $$props;
let { transitionOut = getContext("transitionOut") } = $$props;
let { transitionOutParams = getContext("transitionOutParams") } = $$props;
const svgCaretIcon = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class={classesControlCaret}>
<path d="M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z" />
</svg>`;
function setActive(event) {
if (autocollapse === true) {
active.set(id);
} else {
open = !open;
}
onToggle(event);
}
function onToggle(event) {
const currentOpenState = autocollapse ? $active === id : open;
dispatch("toggle", {
event,
id,
panelId: `accordion-panel-${id}`,
open: currentOpenState,
autocollapse
});
}
if (autocollapse && open)
setActive();
if ($$props.open === void 0 && $$bindings.open && open !== void 0)
$$bindings.open(open);
if ($$props.id === void 0 && $$bindings.id && id !== void 0)
$$bindings.id(id);
if ($$props.autocollapse === void 0 && $$bindings.autocollapse && autocollapse !== void 0)
$$bindings.autocollapse(autocollapse);
if ($$props.active === void 0 && $$bindings.active && active !== void 0)
$$bindings.active(active);
if ($$props.disabled === void 0 && $$bindings.disabled && disabled !== void 0)
$$bindings.disabled(disabled);
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0)
$$bindings.padding(padding);
if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0)
$$bindings.hover(hover);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.caretOpen === void 0 && $$bindings.caretOpen && caretOpen !== void 0)
$$bindings.caretOpen(caretOpen);
if ($$props.caretClosed === void 0 && $$bindings.caretClosed && caretClosed !== void 0)
$$bindings.caretClosed(caretClosed);
if ($$props.regionControl === void 0 && $$bindings.regionControl && regionControl !== void 0)
$$bindings.regionControl(regionControl);
if ($$props.regionPanel === void 0 && $$bindings.regionPanel && regionPanel !== void 0)
$$bindings.regionPanel(regionPanel);
if ($$props.regionCaret === void 0 && $$bindings.regionCaret && regionCaret !== void 0)
$$bindings.regionCaret(regionCaret);
if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0)
$$bindings.transitions(transitions);
if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0)
$$bindings.transitionIn(transitionIn);
if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0)
$$bindings.transitionInParams(transitionInParams);
if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0)
$$bindings.transitionOut(transitionOut);
if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0)
$$bindings.transitionOutParams(transitionOutParams);
{
if (open && autocollapse)
setActive();
}
openState = autocollapse ? $active === id : open;
classesBase = `${cBase$3} ${$$props.class ?? ""}`;
classesControl = `${cControl} ${padding} ${hover} ${rounded} ${regionControl}`;
classesCaretState = openState ? caretOpen : caretClosed;
classesControlCaret = `${cControlIcons} ${regionCaret} ${classesCaretState}`;
classesControlIcons = `${cControlIcons} ${regionCaret}`;
classesPanel = `${cPanel} ${padding} ${rounded} ${regionPanel}`;
$$unsubscribe_active();
return ` <div class="${"accordion-item " + escape(classesBase, true)}" data-testid="accordion-item"> <button type="button" class="${"accordion-control " + escape(classesControl, true)}"${add_attribute("id", id, 0)}${add_attribute("aria-expanded", openState, 0)} aria-controls="${"accordion-panel-" + escape(id, true)}" ${disabled ? "disabled" : ""}> ${$$slots.lead ? `<div class="accordion-lead">${slots.lead ? slots.lead({}) : ``}</div>` : ``} <div class="accordion-summary flex-1">${slots.summary ? slots.summary({}) : `(summary)`}</div> ${$$slots.iconClosed || $$slots.iconOpen ? ` <div class="${"accordion-summary-icons " + escape(classesControlIcons, true)}">${openState ? `${slots.iconClosed ? slots.iconClosed({}) : `<!-- HTML_TAG_START -->${svgCaretIcon}<!-- HTML_TAG_END -->`}` : `${slots.iconOpen ? slots.iconOpen({}) : `<!-- HTML_TAG_START -->${svgCaretIcon}<!-- HTML_TAG_END -->`}`}</div>` : ` <div class="${"accordion-summary-caret " + escape(classesControlCaret, true)}"><!-- HTML_TAG_START -->${svgCaretIcon}<!-- HTML_TAG_END --></div>`}</button> ${openState ? `<div class="${"accordion-panel " + escape(classesPanel, true)}" id="${"accordion-panel-" + escape(id, true)}" role="region"${add_attribute("aria-hidden", !openState, 0)}${add_attribute("aria-labelledby", id, 0)}>${slots.content ? slots.content({}) : `(content)`}</div>` : ``}</div>`;
});
const cBase$2 = "p-1";
const RadioGroup = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let classesBase;
let { display = "inline-flex" } = $$props;
let { flexDirection = "flex-row" } = $$props;
let { gap = "gap-1" } = $$props;
let { background = "bg-surface-200-700-token" } = $$props;
let { border = "border-token border-surface-400-500-token" } = $$props;
let { rounded = "rounded-token" } = $$props;
let { padding = "px-4 py-1" } = $$props;
let { active = "variant-filled" } = $$props;
let { hover = "hover:variant-soft" } = $$props;
let { color = "" } = $$props;
let { fill = "" } = $$props;
let { regionLabel = "" } = $$props;
let { labelledby = "" } = $$props;
setContext("rounded", rounded);
setContext("padding", padding);
setContext("active", active);
setContext("hover", hover);
setContext("color", color);
setContext("fill", fill);
setContext("regionLabel", regionLabel);
if ($$props.display === void 0 && $$bindings.display && display !== void 0)
$$bindings.display(display);
if ($$props.flexDirection === void 0 && $$bindings.flexDirection && flexDirection !== void 0)
$$bindings.flexDirection(flexDirection);
if ($$props.gap === void 0 && $$bindings.gap && gap !== void 0)
$$bindings.gap(gap);
if ($$props.background === void 0 && $$bindings.background && background !== void 0)
$$bindings.background(background);
if ($$props.border === void 0 && $$bindings.border && border !== void 0)
$$bindings.border(border);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0)
$$bindings.padding(padding);
if ($$props.active === void 0 && $$bindings.active && active !== void 0)
$$bindings.active(active);
if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0)
$$bindings.hover(hover);
if ($$props.color === void 0 && $$bindings.color && color !== void 0)
$$bindings.color(color);
if ($$props.fill === void 0 && $$bindings.fill && fill !== void 0)
$$bindings.fill(fill);
if ($$props.regionLabel === void 0 && $$bindings.regionLabel && regionLabel !== void 0)
$$bindings.regionLabel(regionLabel);
if ($$props.labelledby === void 0 && $$bindings.labelledby && labelledby !== void 0)
$$bindings.labelledby(labelledby);
classesBase = `${cBase$2} ${display} ${flexDirection} ${gap} ${background} ${border} ${rounded} ${$$props.class ?? ""}`;
return `<div class="${"radio-group " + escape(classesBase, true)}" data-testid="radio-group" role="radiogroup"${add_attribute("aria-labelledby", labelledby, 0)}>${slots.default ? slots.default({}) : ``}</div>`;
});
const cBase$1 = "flex-auto";
const cWrapper$1 = "text-base text-center cursor-pointer";
const cDisabled = "opacity-50 cursor-not-allowed";
const RadioItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let checked;
let classesActive;
let classesDisabled;
let classsBase;
let classesWrapper;
let $$restProps = compute_rest_props($$props, [
"group",
"name",
"value",
"title",
"label",
"rounded",
"padding",
"active",
"hover",
"color",
"fill",
"regionLabel"
]);
let { group } = $$props;
let { name } = $$props;
let { value } = $$props;
let { title = "" } = $$props;
let { label = "" } = $$props;
let { rounded = getContext("rounded") } = $$props;
let { padding = getContext("padding") } = $$props;
let { active = getContext("active") } = $$props;
let { hover = getContext("hover") } = $$props;
let { color = getContext("color") } = $$props;
let { fill = getContext("fill") } = $$props;
let { regionLabel = getContext("regionLabel") } = $$props;
let elemInput;
function prunedRestProps() {
delete $$restProps.class;
return $$restProps;
}
if ($$props.group === void 0 && $$bindings.group && group !== void 0)
$$bindings.group(group);
if ($$props.name === void 0 && $$bindings.name && name !== void 0)
$$bindings.name(name);
if ($$props.value === void 0 && $$bindings.value && value !== void 0)
$$bindings.value(value);
if ($$props.title === void 0 && $$bindings.title && title !== void 0)
$$bindings.title(title);
if ($$props.label === void 0 && $$bindings.label && label !== void 0)
$$bindings.label(label);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0)
$$bindings.padding(padding);
if ($$props.active === void 0 && $$bindings.active && active !== void 0)
$$bindings.active(active);
if ($$props.hover === void 0 && $$bindings.hover && hover !== void 0)
$$bindings.hover(hover);
if ($$props.color === void 0 && $$bindings.color && color !== void 0)
$$bindings.color(color);
if ($$props.fill === void 0 && $$bindings.fill && fill !== void 0)
$$bindings.fill(fill);
if ($$props.regionLabel === void 0 && $$bindings.regionLabel && regionLabel !== void 0)
$$bindings.regionLabel(regionLabel);
checked = value === group;
classesActive = checked ? `${active} ${color} ${fill}` : hover;
classesDisabled = $$props.disabled ? cDisabled : "";
classsBase = `${cBase$1}`;
classesWrapper = `${cWrapper$1} ${padding} ${rounded} ${classesActive} ${classesDisabled} ${$$props.class ?? ""}`;
return `<label class="${"radio-label " + escape(classsBase, true) + " " + escape(regionLabel, true)}"> <div class="${"radio-item " + escape(classesWrapper, true)}" data-testid="radio-item" role="radio"${add_attribute("aria-checked", checked, 0)}${add_attribute("aria-label", label, 0)} tabindex="0"${add_attribute("title", title, 0)}> <div class="h-0 w-0 overflow-hidden"><input${spread(
[
{ type: "radio" },
{ name: escape_attribute_value(name) },
{ value: escape_attribute_value(value) },
escape_object(prunedRestProps()),
{ tabindex: "-1" }
],
{}
)}${add_attribute("this", elemInput, 0)}${value === group ? add_attribute("checked", true, 1) : ""}></div> ${slots.default ? slots.default({}) : ``}</div></label>`;
});
const cBase = "inline-block";
const cLabel = "unstyled flex items-center";
const cTrack = "flex transition-all duration-[200ms] cursor-pointer";
const cThumb = "w-[50%] h-full scale-[0.8] transition-all duration-[200ms] shadow";
const SlideToggle = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let cTrackActive;
let cThumbBackground;
let cThumbPos;
let classesDisabled;
let classesBase;
let classesLabel;
let classesTrack;
let classesThumb;
let $$restProps = compute_rest_props($$props, ["name", "checked", "size", "background", "active", "border", "rounded", "label"]);
let $$slots = compute_slots(slots);
createEventDispatcher();
let { name } = $$props;
let { checked = false } = $$props;
let { size = "md" } = $$props;
let { background = "bg-surface-400 dark:bg-surface-700" } = $$props;
let { active = "bg-surface-900 dark:bg-surface-300" } = $$props;
let { border = "" } = $$props;
let { rounded = "rounded-full" } = $$props;
let { label = "" } = $$props;
let trackSize;
switch (size) {
case "sm":
trackSize = "w-12 h-6";
break;
case "lg":
trackSize = "w-20 h-10";
break;
default:
trackSize = "w-16 h-8";
}
function prunedRestProps() {
delete $$restProps.class;
return $$restProps;
}
if ($$props.name === void 0 && $$bindings.name && name !== void 0)
$$bindings.name(name);
if ($$props.checked === void 0 && $$bindings.checked && checked !== void 0)
$$bindings.checked(checked);
if ($$props.size === void 0 && $$bindings.size && size !== void 0)
$$bindings.size(size);
if ($$props.background === void 0 && $$bindings.background && background !== void 0)
$$bindings.background(background);
if ($$props.active === void 0 && $$bindings.active && active !== void 0)
$$bindings.active(active);
if ($$props.border === void 0 && $$bindings.border && border !== void 0)
$$bindings.border(border);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.label === void 0 && $$bindings.label && label !== void 0)
$$bindings.label(label);
cTrackActive = checked ? active : `${background} cursor-pointer`;
cThumbBackground = checked ? "bg-white/75" : "bg-white";
cThumbPos = checked ? "translate-x-full" : "";
classesDisabled = $$props.disabled === true ? "opacity-50" : "hover:brightness-[105%] dark:hover:brightness-110 cursor-pointer";
classesBase = `${cBase} ${rounded} ${classesDisabled} ${$$props.class ?? ""}`;
classesLabel = `${cLabel}`;
classesTrack = `${cTrack} ${border} ${rounded} ${trackSize} ${cTrackActive}`;
classesThumb = `${cThumb} ${rounded} ${cThumbBackground} ${cThumbPos}`;
return `<div${add_attribute("id", label, 0)} class="${"slide-toggle " + escape(classesBase, true)}" data-testid="slide-toggle" role="switch"${add_attribute("aria-label", label, 0)}${add_attribute("aria-checked", checked, 0)} tabindex="0"><label class="${"slide-toggle-label " + escape(classesLabel, true)}"> <input${spread(
[
{ type: "checkbox" },
{ class: "slide-toggle-input hidden" },
{ name: escape_attribute_value(name) },
escape_object(prunedRestProps()),
{ disabled: $$props.disabled || null }
],
{}
)}${add_attribute("checked", checked, 1)}> <div class="${[
"slide-toggle-track " + escape(classesTrack, true),
$$props.disabled ? "cursor-not-allowed" : ""
].join(" ").trim()}"><div class="${[
"slide-toggle-thumb " + escape(classesThumb, true),
$$props.disabled ? "cursor-not-allowed" : ""
].join(" ").trim()}"></div></div> ${$$slots.default ? `<div class="slide-toggle-text ml-3">${slots.default ? slots.default({}) : ``}</div>` : ``}</label></div>`;
});
const cWrapper = "flex fixed top-0 left-0 right-0 bottom-0 pointer-events-none";
const cSnackbar = "flex flex-col gap-y-2";
const cToast = "flex justify-between items-center pointer-events-auto";
const cToastActions = "flex items-center space-x-2";
const Toast = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let classesWrapper;
let classesSnackbar;
let classesToast;
let filteredToasts;
let $toastStore, $$unsubscribe_toastStore;
let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore;
$$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value);
const toastStore = getToastStore();
$$unsubscribe_toastStore = subscribe(toastStore, (value) => $toastStore = value);
let { position = "b" } = $$props;
let { max = 3 } = $$props;
let { background = "variant-filled-secondary" } = $$props;
let { width = "max-w-[640px]" } = $$props;
let { color = "" } = $$props;
let { padding = "p-4" } = $$props;
let { spacing = "space-x-4" } = $$props;
let { rounded = "rounded-container-token" } = $$props;
let { shadow = "shadow-lg" } = $$props;
let { zIndex = "z-[888]" } = $$props;
let { buttonAction = "btn variant-filled" } = $$props;
let { buttonDismiss = "btn-icon btn-icon-sm variant-filled" } = $$props;
let { buttonDismissLabel = "✕" } = $$props;
let { transitions = !$prefersReducedMotionStore } = $$props;
let { transitionIn = fly } = $$props;
let { transitionInParams = { duration: 250 } } = $$props;
let { transitionOut = fly } = $$props;
let { transitionOutParams = { duration: 250 } } = $$props;
let cPosition;
let cAlign;
switch (position) {
case "t":
cPosition = "justify-center items-start";
cAlign = "items-center";
break;
case "b":
cPosition = "justify-center items-end";
cAlign = "items-center";
break;
case "l":
cPosition = "justify-start items-center";
cAlign = "items-start";
break;
case "r":
cPosition = "justify-end items-center";
cAlign = "items-end";
break;
case "tl":
cPosition = "justify-start items-start";
cAlign = "items-start";
break;
case "tr":
cPosition = "justify-end items-start";
cAlign = "items-end";
break;
case "bl":
cPosition = "justify-start items-end";
cAlign = "items-start";
break;
case "br":
cPosition = "justify-end items-end";
cAlign = "items-end";
break;
}
if ($$props.position === void 0 && $$bindings.position && position !== void 0)
$$bindings.position(position);
if ($$props.max === void 0 && $$bindings.max && max !== void 0)
$$bindings.max(max);
if ($$props.background === void 0 && $$bindings.background && background !== void 0)
$$bindings.background(background);
if ($$props.width === void 0 && $$bindings.width && width !== void 0)
$$bindings.width(width);
if ($$props.color === void 0 && $$bindings.color && color !== void 0)
$$bindings.color(color);
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0)
$$bindings.padding(padding);
if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0)
$$bindings.spacing(spacing);
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0)
$$bindings.rounded(rounded);
if ($$props.shadow === void 0 && $$bindings.shadow && shadow !== void 0)
$$bindings.shadow(shadow);
if ($$props.zIndex === void 0 && $$bindings.zIndex && zIndex !== void 0)
$$bindings.zIndex(zIndex);
if ($$props.buttonAction === void 0 && $$bindings.buttonAction && buttonAction !== void 0)
$$bindings.buttonAction(buttonAction);
if ($$props.buttonDismiss === void 0 && $$bindings.buttonDismiss && buttonDismiss !== void 0)
$$bindings.buttonDismiss(buttonDismiss);
if ($$props.buttonDismissLabel === void 0 && $$bindings.buttonDismissLabel && buttonDismissLabel !== void 0)
$$bindings.buttonDismissLabel(buttonDismissLabel);
if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0)
$$bindings.transitions(transitions);
if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0)
$$bindings.transitionIn(transitionIn);
if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0)
$$bindings.transitionInParams(transitionInParams);
if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0)
$$bindings.transitionOut(transitionOut);
if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0)
$$bindings.transitionOutParams(transitionOutParams);
classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`;
classesSnackbar = `${cSnackbar} ${cAlign} ${padding}`;
classesToast = `${cToast} ${width} ${color} ${padding} ${spacing} ${rounded} ${shadow}`;
filteredToasts = Array.from($toastStore).slice(0, max);
$$unsubscribe_toastStore();
$$unsubscribe_prefersReducedMotionStore();
return `${$toastStore.length ? ` <div class="${"snackbar-wrapper " + escape(classesWrapper, true)}" data-testid="snackbar-wrapper"> <div class="${"snackbar " + escape(classesSnackbar, true)}">${each(filteredToasts, (t, i) => {
return `<div${add_attribute("role", t.hideDismiss ? "alert" : "alertdialog", 0)} aria-live="polite"> <div class="${"toast " + escape(classesToast, true) + " " + escape(t.background ?? background, true) + " " + escape(t.classes ?? "", true)}" data-testid="toast"><div class="text-base"><!-- HTML_TAG_START -->${t.message}<!-- HTML_TAG_END --></div> ${t.action || !t.hideDismiss ? `<div class="${"toast-actions " + escape(cToastActions, true)}">${t.action ? `<button${add_attribute("class", buttonAction, 0)}><!-- HTML_TAG_START -->${t.action.label}<!-- HTML_TAG_END --></button>` : ``} ${!t.hideDismiss ? `<button${add_attribute("class", buttonDismiss, 0)} aria-label="Dismiss toast">${escape(buttonDismissLabel)}</button>` : ``} </div>` : ``}</div> </div>`;
})}</div></div>` : ``}`;
});
const gatheringKey = {};
const GatheringRound = create_ssr_component(($$result, $$props, $$bindings, slots) => {
setContext(gatheringKey, true);
return `${slots.default ? slots.default({}) : ``}`;
});
const getDimensionName = (horizontal) => horizontal ? "height" : "width";
const css$8 = {
code: 'div.splitpanes--horizontal.splitpanes--dragging{cursor:row-resize}div.splitpanes--vertical.splitpanes--dragging{cursor:col-resize}.splitpanes{display:flex;width:100%;height:100%}.splitpanes--vertical{flex-direction:row}.splitpanes--horizontal{flex-direction:column}.splitpanes--dragging *{-webkit-user-select:none;-moz-user-select:none;user-select:none}.splitpanes__pane{width:100%;height:100%;overflow:hidden}.splitpanes--vertical .splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal .splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--vertical>.splitpanes__pane{transition:width 0.2s ease-out}.splitpanes--horizontal>.splitpanes__pane{transition:height 0.2s ease-out}.splitpanes--dragging .splitpanes__pane{transition:none;pointer-events:none}.splitpanes--freeze .splitpanes__pane{transition:none}.splitpanes__splitter{touch-action:none}.splitpanes--vertical>.splitpanes__splitter{min-width:1px}.splitpanes--horizontal>.splitpanes__splitter{min-height:1px}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;box-sizing:border-box;position:relative;flex-shrink:0}.splitpanes.default-theme .splitpanes__splitter:before,.splitpanes.default-theme .splitpanes__splitter:after{content:"";position:absolute;top:50%;left:50%;background-color:rgba(0, 0, 0, 0.15);transition:background-color 0.3s}.splitpanes.default-theme .splitpanes__splitter:hover:before,.splitpanes.default-theme .splitpanes__splitter:hover:after{background-color:rgba(0, 0, 0, 0.25)}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme.splitpanes--vertical>.splitpanes__splitter,.default-theme .splitpanes--vertical>.splitpanes__splitter{width:7px;border-left:1px solid #eee;cursor:col-resize}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{transform:translateY(-50%);width:1px;height:30px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter,.default-theme .splitpanes--horizontal>.splitpanes__splitter{height:7px;border-top:1px solid #eee;cursor:row-resize}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{transform:translateX(-50%);width:30px;height:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}',
map: null
};
const KEY = {};
const Splitpanes = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey;
let $showFirstSplitter, $$unsubscribe_showFirstSplitter;
let $isHorizontal, $$unsubscribe_isHorizontal;
let { id = void 0 } = $$props;
let { horizontal = false } = $$props;
let { pushOtherPanes = true } = $$props;
let { dblClickSplitter = true } = $$props;
let { rtl = "auto" } = $$props;
let { firstSplitter = false } = $$props;
let { style = null } = $$props;
let { theme = "default-theme" } = $$props;
let { class: clazz = "" } = $$props;
createEventDispatcher();
let container;
new Array();
let isHorizontal = writable(horizontal);
$$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value);
const showFirstSplitter = writable(firstSplitter);
$$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value);
const veryFirstPaneKey = writable(void 0);
$$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value);
let ssrPaneDefinedSizeSum = 0;
let ssrPaneUndefinedSizeCount = 0;
function ssrRegisterPaneSize(size) {
if (size == null) {
++ssrPaneUndefinedSizeCount;
} else {
ssrPaneDefinedSizeSum += size;
}
}
const onPaneInit = (key) => {
if ($veryFirstPaneKey === void 0) {
set_store_value(veryFirstPaneKey, $veryFirstPaneKey = key, $veryFirstPaneKey);
}
return {
undefinedPaneInitSize: (100 - ssrPaneDefinedSizeSum) / ssrPaneUndefinedSizeCount
};
};
setContext(KEY, {
showFirstSplitter,
veryFirstPaneKey,
isHorizontal,
ssrRegisterPaneSize: ssrRegisterPaneSize,
onPaneInit,
clientOnly: void 0
});
if ($$props.id === void 0 && $$bindings.id && id !== void 0)
$$bindings.id(id);
if ($$props.horizontal === void 0 && $$bindings.horizontal && horizontal !== void 0)
$$bindings.horizontal(horizontal);
if ($$props.pushOtherPanes === void 0 && $$bindings.pushOtherPanes && pushOtherPanes !== void 0)
$$bindings.pushOtherPanes(pushOtherPanes);
if ($$props.dblClickSplitter === void 0 && $$bindings.dblClickSplitter && dblClickSplitter !== void 0)
$$bindings.dblClickSplitter(dblClickSplitter);
if ($$props.rtl === void 0 && $$bindings.rtl && rtl !== void 0)
$$bindings.rtl(rtl);
if ($$props.firstSplitter === void 0 && $$bindings.firstSplitter && firstSplitter !== void 0)
$$bindings.firstSplitter(firstSplitter);
if ($$props.style === void 0 && $$bindings.style && style !== void 0)
$$bindings.style(style);
if ($$props.theme === void 0 && $$bindings.theme && theme !== void 0)
$$bindings.theme(theme);
if ($$props.class === void 0 && $$bindings.class && clazz !== void 0)
$$bindings.class(clazz);
$$result.css.add(css$8);
set_store_value(isHorizontal, $isHorizontal = horizontal, $isHorizontal);
set_store_value(showFirstSplitter, $showFirstSplitter = firstSplitter, $showFirstSplitter);
$$unsubscribe_veryFirstPaneKey();
$$unsubscribe_showFirstSplitter();
$$unsubscribe_isHorizontal();
return `<div${add_attribute("id", id, 0)} class="${[
escape(`splitpanes ${theme || ""} ${clazz || ""}`, true),
(horizontal ? "splitpanes--horizontal" : "") + " " + (!horizontal ? "splitpanes--vertical" : "") + " " + ("") + " splitpanes--freeze"
].join(" ").trim()}"${add_attribute("style", style, 0)}${add_attribute("this", container, 0)}>${`${validate_component(GatheringRound, "GatheringRound").$$render($$result, {}, {}, {
default: () => {
return `${slots.default ? slots.default({}) : ``}`;
}
})}` } ${slots.default ? slots.default({}) : ``} </div>`;
});
const Pane = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let dimension;
let style;
let $isHorizontal, $$unsubscribe_isHorizontal;
let $veryFirstPaneKey, $$unsubscribe_veryFirstPaneKey;
let $showFirstSplitter, $$unsubscribe_showFirstSplitter;
const { ssrRegisterPaneSize, onPaneInit, clientOnly: clientOnlyContext, isHorizontal, showFirstSplitter, veryFirstPaneKey } = getContext(KEY);
$$unsubscribe_isHorizontal = subscribe(isHorizontal, (value) => $isHorizontal = value);
$$unsubscribe_showFirstSplitter = subscribe(showFirstSplitter, (value) => $showFirstSplitter = value);
$$unsubscribe_veryFirstPaneKey = subscribe(veryFirstPaneKey, (value) => $veryFirstPaneKey = value);
let { size = null } = $$props;
let { minSize = 0 } = $$props;
let { maxSize = 100 } = $$props;
let { snapSize = 0 } = $$props;
let { class: clazz = "" } = $$props;
const key = {};
const gathering = hasContext(gatheringKey);
const { undefinedPaneInitSize } = !gathering ? onPaneInit(key) : {};
let element;
let sz = size ?? undefinedPaneInitSize;
if (gathering) {
ssrRegisterPaneSize(size);
}
if ($$props.size === void 0 && $$bindings.size && size !== void 0)
$$bindings.size(size);
if ($$props.minSize === void 0 && $$bindings.minSize && minSize !== void 0)
$$bindings.minSize(minSize);
if ($$props.maxSize === void 0 && $$bindings.maxSize && maxSize !== void 0)
$$bindings.maxSize(maxSize);
if ($$props.snapSize === void 0 && $$bindings.snapSize && snapSize !== void 0)
$$bindings.snapSize(snapSize);
if ($$props.class === void 0 && $$bindings.class && clazz !== void 0)
$$bindings.class(clazz);
dimension = getDimensionName($isHorizontal);
style = `${dimension}: ${sz}%;`;
$$unsubscribe_isHorizontal();
$$unsubscribe_veryFirstPaneKey();
$$unsubscribe_showFirstSplitter();
return `${!gathering ? ` ${$veryFirstPaneKey !== key || $showFirstSplitter ? ` <div class="${"splitpanes__splitter " + escape("", true)}"></div>` : ``} <div${add_attribute("class", `splitpanes__pane ${clazz || ""}`, 0)}${add_attribute("style", style, 0)}${add_attribute("this", element, 0)}>${slots.default ? slots.default({}) : ``}</div>` : ``}`;
});
const LoadingSpinner = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { size = 20 } = $$props;
if ($$props.size === void 0 && $$bindings.size && size !== void 0)
$$bindings.size(size);
return `<svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve"><circle fill="#1976d2" stroke="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate></circle><circle fill="#1976d2" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate></circle><circle fill="#1976d2" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate></circle></svg>`;
});
const css$7 = {
code: ".llm-health-status.svelte-a20mi8{color:slategray;font-size:12px;display:inline-flex;align-items:center;min-width:200px\r\n }.dot.svelte-a20mi8{width:20px;height:20px}",
map: null
};
const LlmHealthStatus = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { status = "unknown" } = $$props;
let color = "";
let shadowColor = "";
let text = "";
switch (status) {
case "ok":
color = "#4CAF50";
shadowColor = "rgba(0, 128, 0, 0.7)";
text = "Сервис LLM работает";
break;
case "error":
text = "Сервис LLM не работает";
break;
case "loading model":
color = "yellow";
shadowColor = "rgba(255, 255, 0, 0.7)";
text = "Сервис LLM запускается...";
break;
case "unavailable":
color = "#af4f4c";
shadowColor = "#af4f4c";
text = "Сервис LLM не запущен";
break;
case "unknown":
color = "#af4f4c";
shadowColor = "#af4f4c";
text = "Сервис LLM недоступен";
break;
}
if ($$props.status === void 0 && $$bindings.status && status !== void 0)
$$bindings.status(status);
$$result.css.add(css$7);
return `<div class="llm-health-status svelte-a20mi8"><svg class="dot svelte-a20mi8" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="5"${add_attribute("fill", color, 0)} style="${"filter: drop-shadow(0 0 1px " + escape(shadowColor, true) + ")"}"></circle></svg> ${escape(text)} </div>`;
});
const css$6 = {
code: ".llm-health-status.svelte-1wcf73j{color:slategray;font-size:12px;display:inline-flex;align-items:center}.dot.svelte-1wcf73j{width:20px;height:20px}",
map: null
};
const SearchApiHealthStatus = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { status = "unavailable" } = $$props;
let color = "";
let shadowColor = "";
let text = "";
switch (status) {
case "ok":
color = "#4CAF50";
shadowColor = "rgba(0, 128, 0, 0.7)";
text = "Поиск работает";
break;
case "unavailable":
color = "#af4f4c";
shadowColor = "#af4f4c";
text = "Поиск не запущен";
break;
case "unknown":
color = "#af4f4c";
shadowColor = "#af4f4c";
text = "Поиск недоступен";
break;
}
if ($$props.status === void 0 && $$bindings.status && status !== void 0)
$$bindings.status(status);
$$result.css.add(css$6);
return `<div class="llm-health-status svelte-1wcf73j"><svg class="dot svelte-1wcf73j" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="5"${add_attribute("fill", color, 0)} style="${"filter: drop-shadow(0 0 1px " + escape(shadowColor, true) + ")"}"></circle></svg> ${escape(text)} </div>`;
});
class SearchResultsSorter {
static findDateInText(text) {
const dateStringRegex = /\b\d{1,2}\.\d{1,2}\.\d{4}\b/g;
const matches = text.match(dateStringRegex);
if (matches && matches.length > 0) {
const dateString = matches[0];
const [day, month, year] = dateString.split(".").map(Number);
return new Date(year, month - 1, day);
}
return null;
}
static sortByRelevanceAndDate(data) {
return data.sort((a, b) => {
const relevanceComparison = b.relevance - a.relevance;
if (relevanceComparison !== 0) {
return relevanceComparison;
}
const dateA = SearchResultsSorter.findDateInText(a.title);
const dateB = SearchResultsSorter.findDateInText(b.title);
if (dateA && dateB) {
return dateB.getTime() - dateA.getTime();
} else if (dateA) {
return -1;
} else if (dateB) {
return 1;
} else {
return 0;
}
});
}
static sortByDate(dataArray) {
const entriesWithDates = dataArray.filter((item) => SearchResultsSorter.findDateInText(item.title));
const entriesWithoutDates = dataArray.filter((item) => !SearchResultsSorter.findDateInText(item.title));
const sortedEntriesWithDates = entriesWithDates.sort((a, b) => {
const dateA = SearchResultsSorter.findDateInText(a.title);
const dateB = SearchResultsSorter.findDateInText(b.title);
if (dateA && dateB) {
return dateB.getTime() - dateA.getTime();
} else if (dateA) {
return -1;
} else if (dateB) {
return 1;
} else {
return 0;
}
});
const resultArray = [];
let indexWithoutDates = 0;
for (const entry of dataArray) {
if (SearchResultsSorter.findDateInText(entry.title)) {
let val = sortedEntriesWithDates.shift();
if (val)
resultArray.push(val);
} else {
resultArray.push(entriesWithoutDates[indexWithoutDates]);
indexWithoutDates++;
}
}
return resultArray;
}
static sortByRelevance(data) {
return data.sort((a, b) => {
if (a.relevance && b.relevance) {
return b.relevance - a.relevance;
} else if (a.relevance) {
return -1;
} else if (b.relevance) {
return 1;
} else {
return 0;
}
});
}
static identifyDocumentType(data) {
const regexps = [
{ regexp: /(ФАС |АС |КС |ВС |[Сс]удебн|[Сс]уд)|(\(Судебный документ\))/, docType: "Решение суда" },
{ regexp: /[Пп]исьмо [Мм]инфина/, docType: "Письмо Минфина" },
{ regexp: /[Пп]исьмо (ФНС|фнс)/, docType: "Письмо ФНС" },
{ regexp: /(НКРФ)|(НК РФ)/, docType: "Налоговый кодекс" },
{ regexp: /(ГКРФ)|(ГК РФ)/, docType: "Гражданский кодекс" },
{ regexp: /(ТКРФ)|(ТК РФ)/, docType: "Трудовой кодекс" },
{ regexp: /Приказ ФНС РФ/, docType: "Приказ ФНС РФ" },
{ regexp: /Постановление Правительства РФ/, docType: "Постановление Правительства РФ" },
{ regexp: /Решение Коллегии Евразийской экономической комиссии/, docType: "Решение Коллегии ЕЭК" },
{ regexp: /Федеральный закон/, docType: "Федеральные законы" },
{ regexp: /\(Внутренний документ\)/, docType: "Внутренние документы" }
];
return data.map((result) => {
for (const { regexp, docType } of regexps) {
if (regexp.test(result.title)) {
result.docType = docType;
return result;
}
}
result.docType = "Другие документы";
return result;
});
}
static mergeResultsByTitle(data) {
const regex = /(ст\.\d+)\s(НКРФ|НК РФ|ГКРФ|ГК РФ|ТКРФ|ТК РФ)$/;
const grouped = {};
const mergedResults = [];
const extractArticleAndCode = (title) => {
const match = title.match(regex);
return match ? match[0] : null;
};
data.forEach((item) => {
const key = extractArticleAndCode(item.title);
if (key) {
if (grouped[key]) {
grouped[key].relevance = Math.max(
grouped[key].relevance,
item.relevance
);
const existingTitle = grouped[key].title.match(/п[\w\.]+/g) || [];
const newTitle = item.title.match(/п[\w\.]+/g) || [];
const combinedTitle = [.../* @__PURE__ */ new Set([...existingTitle, ...newTitle])].join(", ");
grouped[key].title = `${combinedTitle} ст.${key.split(" ")[0].split(".")[1]} ${key.split(" ")[1]}`;
grouped[key].text += `
${item.title}
${item.text}`;
} else {
grouped[key] = { ...item };
}
} else {
mergedResults.push(item);
}
});
Object.keys(grouped).forEach((key) => {
mergedResults.push(grouped[key]);
});
return mergedResults;
}
}
const css$5 = {
code: ".search-result.svelte-1srbk6k{margin-bottom:20px}.title.svelte-1srbk6k{font-weight:bold}.annotation.svelte-1srbk6k{overflow:hidden;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}a.svelte-1srbk6k{cursor:pointer}.full-text.svelte-1srbk6k{display:block;white-space:normal}.title.svelte-1srbk6k{color:#1a0dab}",
map: null
};
const SearchResultsItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { showFullText = Array(10).fill(false) } = $$props;
let { useSearchResult } = $$props;
let { index } = $$props;
let { title } = $$props;
let { teaser } = $$props;
let { text } = $$props;
let { enableDocumentDb = false } = $$props;
let { documentDbUrl = "" } = $$props;
let { enableSearchResultSelection = false } = $$props;
if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
$$bindings.showFullText(showFullText);
if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0)
$$bindings.useSearchResult(useSearchResult);
if ($$props.index === void 0 && $$bindings.index && index !== void 0)
$$bindings.index(index);
if ($$props.title === void 0 && $$bindings.title && title !== void 0)
$$bindings.title(title);
if ($$props.teaser === void 0 && $$bindings.teaser && teaser !== void 0)
$$bindings.teaser(teaser);
if ($$props.text === void 0 && $$bindings.text && text !== void 0)
$$bindings.text(text);
if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0)
$$bindings.enableDocumentDb(enableDocumentDb);
if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0)
$$bindings.documentDbUrl(documentDbUrl);
if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0)
$$bindings.enableSearchResultSelection(enableSearchResultSelection);
$$result.css.add(css$5);
return `<div class="search-result svelte-1srbk6k"><div class="title svelte-1srbk6k"><label style="cursor:pointer">${enableSearchResultSelection ? `<input type="checkbox"${add_attribute("checked", useSearchResult[title], 1)}>` : ``} ${escape(title)}</label></div> ${showFullText[index] ? `<div class="annotation full-text svelte-1srbk6k">${each(text.split("\n"), (line) => {
return `<p>${escape(line)}</p>`;
})}</div>` : `<div class="annotation svelte-1srbk6k">${escape(teaser)}</div>`} ${enableDocumentDb && documentDbUrl ? `<a href="${escape(documentDbUrl, true) + "s/" + escape(encodeURIComponent(title), true)}" target="_blank" style="font-weight: 500" class="svelte-1srbk6k">Открыть документ</a>` : ``} ${text.length > 100 ? `${showFullText[index] ? `<a class="svelte-1srbk6k" data-svelte-h="svelte-18vtpy5">свернуть</a>` : `<a class="svelte-1srbk6k" data-svelte-h="svelte-lqw9hz">развернуть</a>`}` : ``} </div>`;
});
const css$4 = {
code: ".search-results.svelte-1ptibtq.svelte-1ptibtq{flex:1;overflow-y:auto;padding:1rem}.settings-bar.svelte-1ptibtq.svelte-1ptibtq{margin-bottom:10px}.settings-bar.svelte-1ptibtq label.svelte-1ptibtq{margin-right:10px}",
map: null
};
const SearchResults = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { enableDocumentDb = false } = $$props;
let { documentDbUrl = "" } = $$props;
let { showFullText = Array(10).fill(false) } = $$props;
let { useSearchResult } = $$props;
let groupByChecked = false;
let sortSearchResultsBy = "rel";
let { searchResults = [] } = $$props;
let groupedSearchResults;
let { enableSearchResultSelection = false } = $$props;
const groupByType = (searchResults2) => {
return searchResults2.reduce(
(result, item) => {
const docType = item.docType || "Другие документы";
if (!result[docType]) {
result[docType] = [];
}
result[docType].push(item);
return result;
},
{}
);
};
if ($$props.enableDocumentDb === void 0 && $$bindings.enableDocumentDb && enableDocumentDb !== void 0)
$$bindings.enableDocumentDb(enableDocumentDb);
if ($$props.documentDbUrl === void 0 && $$bindings.documentDbUrl && documentDbUrl !== void 0)
$$bindings.documentDbUrl(documentDbUrl);
if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
$$bindings.showFullText(showFullText);
if ($$props.useSearchResult === void 0 && $$bindings.useSearchResult && useSearchResult !== void 0)
$$bindings.useSearchResult(useSearchResult);
if ($$props.searchResults === void 0 && $$bindings.searchResults && searchResults !== void 0)
$$bindings.searchResults(searchResults);
if ($$props.enableSearchResultSelection === void 0 && $$bindings.enableSearchResultSelection && enableSearchResultSelection !== void 0)
$$bindings.enableSearchResultSelection(enableSearchResultSelection);
$$result.css.add(css$4);
let $$settled;
let $$rendered;
let previous_head = $$result.head;
do {
$$settled = true;
$$result.head = previous_head;
{
{
if (groupByChecked) {
groupedSearchResults = groupByType(searchResults);
}
if (sortSearchResultsBy == "date") {
searchResults = SearchResultsSorter.sortByDate(searchResults);
} else if (sortSearchResultsBy == "rel") {
searchResults = SearchResultsSorter.sortByRelevance(searchResults);
}
}
}
{
if (useSearchResult === void 0) {
useSearchResult = {};
}
}
$$rendered = `<div class="search-results svelte-1ptibtq">${searchResults && searchResults.length > 0 ? `<div class="settings-bar svelte-1ptibtq"><div class="card w-full flex p-2 space-y-2" style="align-items: center; flex-wrap: wrap;"><label style="display: inline-block;flex-wrap: wrap;" class="svelte-1ptibtq" data-svelte-h="svelte-12wnwfn">Сортировать по:</label> ${validate_component(RadioGroup, "RadioGroup").$$render($$result, { background: "", border: "" }, {}, {
default: () => {
return `${validate_component(RadioItem, "RadioItem").$$render(
$$result,
{
name: "sortBy",
value: "rel",
group: sortSearchResultsBy
},
{
group: ($$value) => {
sortSearchResultsBy = $$value;
$$settled = false;
}
},
{
default: () => {
return `релевантности`;
}
}
)} ${validate_component(RadioItem, "RadioItem").$$render(
$$result,
{
name: "sortBy",
value: "date",
group: sortSearchResultsBy
},
{
group: ($$value) => {
sortSearchResultsBy = $$value;
$$settled = false;
}
},
{
default: () => {
return `дате`;
}
}
)}`;
}
})} ${validate_component(SlideToggle, "SlideToggle").$$render(
$$result,
{
name: "groupByChecked",
size: "sm",
label: "Группировать по типу",
checked: groupByChecked
},
{
checked: ($$value) => {
groupByChecked = $$value;
$$settled = false;
}
},
{
default: () => {
return `Группировать по типу`;
}
}
)}</div></div>` : ``} ${groupByChecked && groupedSearchResults ? `${validate_component(Accordion, "Accordion").$$render($$result, {}, {}, {
default: () => {
return `${each(Object.entries(groupedSearchResults), ([docType, results]) => {
return `${validate_component(AccordionItem, "AccordionItem").$$render($$result, {}, {}, {
content: () => {
return `${each(results, ({ title, text, teaser }, index) => {
return `${validate_component(SearchResultsItem, "SearchResultsItem").$$render(
$$result,
{
title,
text,
teaser,
index,
enableSearchResultSelection,
useSearchResult,
showFullText
},
{},
{}
)}`;
})} `;
},
summary: () => {
return `${escape(docType)}`;
},
lead: () => {
return `${enableSearchResultSelection ? `<input type="checkbox"${add_attribute("data-doctype", docType, 0)}>` : ``} `;
}
})}`;
})}`;
}
})}` : `${each(searchResults, ({ title, text, teaser }, index) => {
return `${validate_component(SearchResultsItem, "SearchResultsItem").$$render(
$$result,
{
title,
text,
teaser,
index,
enableSearchResultSelection,
useSearchResult,
showFullText,
enableDocumentDb,
documentDbUrl
},
{},
{}
)}`;
})}`}</div> ${``}`;
} while (!$$settled);
return $$rendered;
});
const css$3 = {
code: ".consultation-item.svelte-13z9n8v{margin-bottom:20px}.title.svelte-13z9n8v{font-weight:bold}.annotation.svelte-13z9n8v{overflow:hidden;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:normal}a.svelte-13z9n8v{cursor:pointer;color:#1a0dab}.full-text.svelte-13z9n8v{display:block;white-space:normal}p.svelte-13z9n8v{margin-top:10px;margin-bottom:10px}",
map: null
};
const ConsultationItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { showFullText = Array(10).fill(false) } = $$props;
let { index } = $$props;
let { title } = $$props;
let { text } = $$props;
if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
$$bindings.showFullText(showFullText);
if ($$props.index === void 0 && $$bindings.index && index !== void 0)
$$bindings.index(index);
if ($$props.title === void 0 && $$bindings.title && title !== void 0)
$$bindings.title(title);
if ($$props.text === void 0 && $$bindings.text && text !== void 0)
$$bindings.text(text);
$$result.css.add(css$3);
return `<div class="consultation-item svelte-13z9n8v"><div class="title svelte-13z9n8v"><a class="svelte-13z9n8v">${escape(title)}</a></div> ${showFullText[index] ? `<div class="annotation full-text svelte-13z9n8v">${each(text.split("\n"), (line) => {
return `<p class="svelte-13z9n8v">${escape(line)}</p>`;
})}</div>` : ``} </div>`;
});
const css$2 = {
code: "h2.svelte-s2jiei{margin-bottom:10px;font-size:large}.relevant-consultations.svelte-s2jiei{flex:1;overflow-y:auto;padding:1rem}",
map: null
};
const RelevantConsultations = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { showFullText = Array(10).fill(false) } = $$props;
let { consultations = [] } = $$props;
if ($$props.showFullText === void 0 && $$bindings.showFullText && showFullText !== void 0)
$$bindings.showFullText(showFullText);
if ($$props.consultations === void 0 && $$bindings.consultations && consultations !== void 0)
$$bindings.consultations(consultations);
$$result.css.add(css$2);
return `<div class="relevant-consultations svelte-s2jiei"><h2 class="w-full p-5 space-y-2 svelte-s2jiei" style="border-bottom:2px solid #ccc;border-top:2px solid #ccc" data-svelte-h="svelte-1ttwfrn">Релевантные консультации</h2> ${each(consultations, ({ title, text }, index) => {
return `${validate_component(ConsultationItem, "ConsultationItem").$$render($$result, { title, text, index, showFullText }, {}, {})}`;
})}</div> ${``}`;
});
const HISTORY_KEY_PREFIX = "clarificationHistory_";
const HISTORY_INDEX_KEY = "clarificationHistoryIndex";
const HISTORY_ITEMS_LIMIT = 2;
class ClarificationHistoryService {
// Загружает историю как массив, собирая данные из ключей с префиксом
static loadHistory() {
const history = [];
const index = this.getHistoryIndex();
for (let i = 0; i < index; i++) {
const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${i}`);
if (item) {
history.push(JSON.parse(item));
}
}
return history;
}
// Сохраняет элемент истории с новым индексом и управляет лимитом элементов
static addHistoryItem(item) {
const index = this.getHistoryIndex();
localStorage.setItem(`${HISTORY_KEY_PREFIX}${index}`, JSON.stringify(item));
this.setHistoryIndex(index + 1);
this.manageHistoryLimit();
}
// Обновляет элемент истории с заданным индексом
static updateHistoryItem(index, item) {
localStorage.setItem(`${HISTORY_KEY_PREFIX}${index}`, JSON.stringify(item));
}
// Возвращает элемент истории по индексу
static getHistoryItem(index) {
const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${index}`);
return item ? JSON.parse(item) : null;
}
// Возвращает количество элементов в истории
static getHistoryLength() {
return this.getHistoryIndex();
}
// Удаляет все элементы истории
static clearHistory() {
const index = this.getHistoryIndex();
for (let i = 0; i < index; i++) {
localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`);
}
localStorage.removeItem(HISTORY_INDEX_KEY);
}
// Вспомогательная функция для управления лимитом истории
static manageHistoryLimit() {
const index = this.getHistoryIndex();
if (index > HISTORY_ITEMS_LIMIT) {
const excessCount = index - HISTORY_ITEMS_LIMIT;
for (let i = 0; i < excessCount; i++) {
localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`);
}
this.shiftHistoryKeys(excessCount);
this.setHistoryIndex(HISTORY_ITEMS_LIMIT);
}
}
// Смещает ключи истории при удалении старых элементов
static shiftHistoryKeys(shiftAmount) {
const index = this.getHistoryIndex();
for (let i = shiftAmount; i < index; i++) {
const item = localStorage.getItem(`${HISTORY_KEY_PREFIX}${i}`);
if (item) {
localStorage.setItem(`${HISTORY_KEY_PREFIX}${i - shiftAmount}`, item);
}
localStorage.removeItem(`${HISTORY_KEY_PREFIX}${i}`);
}
}
// Вспомогательная функция для получения текущего индекса истории
static getHistoryIndex() {
const index = localStorage.getItem(HISTORY_INDEX_KEY);
return index ? parseInt(index, 10) : 0;
}
// Вспомогательная функция для установки индекса истории
static setHistoryIndex(index) {
localStorage.setItem(HISTORY_INDEX_KEY, index.toString());
}
}
const css$1 = {
code: "textarea.svelte-wjelcf{border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;padding:1rem}button.svelte-wjelcf{margin:5px}",
map: null
};
const UserClarification = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { userRequest = "" } = $$props;
let { searchClarification = "" } = $$props;
let { llmClarification = "" } = $$props;
let { searchResults } = $$props;
let { relevantConsultations } = $$props;
let { llmResponse = "" } = $$props;
let { historyIsNotEmpty = false } = $$props;
let currentHistoryIndex = 0;
let history = [];
let historyLength = 0;
function loadCurrentHistoryItem() {
const item = ClarificationHistoryService.getHistoryItem(currentHistoryIndex);
if (item) {
searchClarification = item.searchClarification;
llmClarification = item.llmClarification;
searchResults = item.searchResults;
relevantConsultations = item.relevantConsultations;
llmResponse = item.llmResponse;
userRequest = item.userRequest;
}
return item;
}
function getCurrentState() {
return ClarificationHistoryService.getHistoryItem(currentHistoryIndex);
}
function addState(request) {
console.log("addState called");
const newItem = {
userRequest: request,
searchClarification,
llmClarification,
searchResults: [],
llmResponse: "",
relevantConsultations: [],
transactionMaps: []
};
historyLength = ClarificationHistoryService.getHistoryLength();
ClarificationHistoryService.addHistoryItem(newItem);
currentHistoryIndex = historyLength - 1;
}
function updateCurrentState(request, searchResults2, llmResponse2, relevantConsultations2, transactionMaps) {
console.log("updateCurrentState called");
const item = ClarificationHistoryService.getHistoryItem(currentHistoryIndex);
if (item) {
item.userRequest = request ?? item.userRequest;
item.searchClarification = searchClarification ?? item.searchClarification;
item.llmClarification = llmClarification ?? item.llmClarification;
item.searchResults = searchResults2 ?? item.searchResults;
item.llmResponse = llmResponse2 ?? item.llmResponse;
item.relevantConsultations = relevantConsultations2 ?? item.relevantConsultations;
item.transactionMaps = transactionMaps ?? item.transactionMaps;
console.log(item);
ClarificationHistoryService.updateHistoryItem(currentHistoryIndex, item);
}
}
function prevHistory() {
if (currentHistoryIndex > 0) {
currentHistoryIndex -= 1;
loadCurrentHistoryItem();
}
}
function nextHistory() {
if (currentHistoryIndex < history.length - 1) {
currentHistoryIndex += 1;
loadCurrentHistoryItem();
}
}
function clear() {
llmClarification = "";
searchClarification = "";
}
if ($$props.userRequest === void 0 && $$bindings.userRequest && userRequest !== void 0)
$$bindings.userRequest(userRequest);
if ($$props.searchClarification === void 0 && $$bindings.searchClarification && searchClarification !== void 0)
$$bindings.searchClarification(searchClarification);
if ($$props.llmClarification === void 0 && $$bindings.llmClarification && llmClarification !== void 0)
$$bindings.llmClarification(llmClarification);
if ($$props.searchResults === void 0 && $$bindings.searchResults && searchResults !== void 0)
$$bindings.searchResults(searchResults);
if ($$props.relevantConsultations === void 0 && $$bindings.relevantConsultations && relevantConsultations !== void 0)
$$bindings.relevantConsultations(relevantConsultations);
if ($$props.llmResponse === void 0 && $$bindings.llmResponse && llmResponse !== void 0)
$$bindings.llmResponse(llmResponse);
if ($$props.historyIsNotEmpty === void 0 && $$bindings.historyIsNotEmpty && historyIsNotEmpty !== void 0)
$$bindings.historyIsNotEmpty(historyIsNotEmpty);
if ($$props.loadCurrentHistoryItem === void 0 && $$bindings.loadCurrentHistoryItem && loadCurrentHistoryItem !== void 0)
$$bindings.loadCurrentHistoryItem(loadCurrentHistoryItem);
if ($$props.getCurrentState === void 0 && $$bindings.getCurrentState && getCurrentState !== void 0)
$$bindings.getCurrentState(getCurrentState);
if ($$props.addState === void 0 && $$bindings.addState && addState !== void 0)
$$bindings.addState(addState);
if ($$props.updateCurrentState === void 0 && $$bindings.updateCurrentState && updateCurrentState !== void 0)
$$bindings.updateCurrentState(updateCurrentState);
if ($$props.prevHistory === void 0 && $$bindings.prevHistory && prevHistory !== void 0)
$$bindings.prevHistory(prevHistory);
if ($$props.nextHistory === void 0 && $$bindings.nextHistory && nextHistory !== void 0)
$$bindings.nextHistory(nextHistory);
if ($$props.clear === void 0 && $$bindings.clear && clear !== void 0)
$$bindings.clear(clear);
$$result.css.add(css$1);
return `<div class="w-full flex p-2 space-x-2"><textarea rows="3" placeholder="Уточнение для поиска" class="svelte-wjelcf">${escape(searchClarification || "")}</textarea> <textarea rows="3" placeholder="Уточнение для LLM" class="svelte-wjelcf">${escape(llmClarification || "")}</textarea></div> ${``}`;
});
const referenceId = "66d6a6c5ac59a1dde4b24a6e";
const css = {
code: '.loading-container.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:center;align-items:center;align-self:center;width:3rem;height:90%;margin-left:5px}.loading-status.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:center;align-items:center;align-self:center}.grow-wrap.svelte-rgnwju.svelte-rgnwju{display:grid}.grow-wrap.svelte-rgnwju.svelte-rgnwju::after{content:attr(data-replicated-value) " ";white-space:pre-wrap;visibility:hidden;max-width:100%;max-height:250px;display:block;overflow-x:hidden}.grow-wrap.svelte-rgnwju>textarea.svelte-rgnwju{resize:none}.grow-wrap.svelte-rgnwju>textarea.svelte-rgnwju,.grow-wrap.svelte-rgnwju.svelte-rgnwju::after{padding:1rem;border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;grid-area:1/1/2/2}.grow-wrap.svelte-rgnwju>textarea .svelte-rgnwju:focus,.grow-wrap.svelte-rgnwju::after .svelte-rgnwju:focus{outline:none;border-color:#1976d2}.grow-wrap.svelte-rgnwju>textarea .svelte-rgnwju:placeholder,.grow-wrap.svelte-rgnwju::after .svelte-rgnwju:placeholder{color:#aaa}.auto-expand-textarea.svelte-rgnwju.svelte-rgnwju{box-sizing:border-box;width:100%;font-size:16px;border:1px solid #ccc;resize:vertical;overflow-y:auto;min-height:1rem}.search-column.svelte-rgnwju.svelte-rgnwju{flex:1;display:flex;flex-direction:column;border-right:1px solid #ccc}.search-bar.svelte-rgnwju.svelte-rgnwju{padding:1rem}.search-bar.svelte-rgnwju textarea.svelte-rgnwju{width:100%;max-width:100%;padding:1rem;box-sizing:border-box}.textarea-column.svelte-rgnwju.svelte-rgnwju{flex:1;display:flex;flex-direction:column}.textarea.svelte-rgnwju.svelte-rgnwju{width:100%;height:100%;margin:10px;border:none;outline:none;resize:none;background:transparent}@media(max-width: 767px){.search-column.svelte-rgnwju.svelte-rgnwju,.textarea-column.svelte-rgnwju.svelte-rgnwju{border-right:none}}.search-second-bar.svelte-rgnwju.svelte-rgnwju{display:flex;justify-content:space-between;flex-wrap:wrap}.search-second-bar.svelte-rgnwju .status-components.svelte-rgnwju{flex:1;margin-right:10px;margin-top:10px}@media(max-width: 600px){.search-second-bar.svelte-rgnwju.svelte-rgnwju{flex-direction:column}.search-second-bar.svelte-rgnwju .status-components.svelte-rgnwju{width:100%;margin-right:0;margin-bottom:10px}}textarea.svelte-rgnwju.svelte-rgnwju{border:1px solid #ccc;border-radius:4px;width:100%;font-size:14px;margin-bottom:10px;box-sizing:border-box;padding:1rem}a.svelte-rgnwju.svelte-rgnwju{cursor:pointer}.reference-btn.svelte-rgnwju.svelte-rgnwju{text-decoration:none;color:black}.reference-btn.svelte-rgnwju svg.svelte-rgnwju{margin-right:10px}.reference-btn.svelte-rgnwju.svelte-rgnwju:hover{text-decoration:none;color:black}',
map: null
};
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { data } = $$props;
const { ENV_DOCUMENT_DB_URL, ENV_ENABLE_DOCUMENT_DB, ENV_ENABLE_DB_SUPPORT } = data;
let userClarificationComponent;
initializeStores();
getToastStore();
let userSearchClarification = "";
let userLlmClarification = "";
let historyIsNotEmpty = true;
let llmHealthStatus = "unknown";
let searchHealthStatus = "unknown";
let healthInterval;
onDestroy(() => {
clearInterval(healthInterval);
cancelLlmRequest();
});
let searchResults = [];
let relevantConsultations = [];
let isLlmLoading = false;
let currentLlmResponse = "";
let baseLlmResponse = "";
let currentUserRequest = "";
let savedUserRequest = "";
let loadingStatusText = "";
let showFullText = Array(searchResults.length).fill(false);
let showConsultationFullText = Array(relevantConsultations.length).fill(false);
let useSearchResult;
let enableSearchResultSelection = false;
let enableLLMForTeasers = false;
let doMultistepSearch = false;
let useAccountingDocs = false;
let useReranking = false;
let useLLMForFiltering = false;
let useKeywords = false;
let disableThresholds = false;
let searchInTransactionLedger = false;
let searchInTransactionLedgerByQuestion = false;
let searchInTransactionLedgerByOperation = false;
let useShortestPrompt = false;
let shortestPromptGenerationFinished = false;
let enableRealtimeLlmReponse = false;
let sendConsultationToLlm = false;
let showClarifyLlmResponseButton = false;
let abortController = new AbortController();
const cancelLlmRequest = () => {
abortController.abort("user canceled");
abortController = new AbortController();
isLlmLoading = false;
loadingStatusText = "";
};
if ($$props.data === void 0 && $$bindings.data && data !== void 0)
$$bindings.data(data);
$$result.css.add(css);
let $$settled;
let $$rendered;
let previous_head = $$result.head;
do {
$$settled = true;
$$result.head = previous_head;
{
{
{
searchInTransactionLedger = false;
}
if (
// clarificationEntry &&
// isClarificationPaneVisible &&
userLlmClarification && // clarificationEntry.userRequest == currentUserRequest &&
searchResults.length > 0 && baseLlmResponse && savedUserRequest == currentUserRequest && !isLlmLoading
) {
showClarifyLlmResponseButton = true;
} else {
showClarifyLlmResponseButton = false;
}
}
}
$$rendered = `${$$result.head += `<!-- HEAD_svelte-1wpbm1r_START -->${$$result.title = `<title>LLM demo app</title>`, ""}<meta name="description" content="LLM demo app"><!-- HEAD_svelte-1wpbm1r_END -->`, ""} ${validate_component(Toast, "Toast").$$render($$result, {}, {}, {})} <section><div class="search-bar flex flex-wrap svelte-rgnwju"><div class="grow-wrap w-full svelte-rgnwju"> <textarea class="auto-expand-textarea svelte-rgnwju" rows="1" placeholder="Введите ваш запрос...">${escape(currentUserRequest || "")}</textarea></div> <div class="search-second-bar w-full svelte-rgnwju"><div class="status-components svelte-rgnwju">${validate_component(LlmHealthStatus, "LlmHealthStatus").$$render($$result, { status: llmHealthStatus }, {}, {})} ${validate_component(SearchApiHealthStatus, "SearchApiHealthStatus").$$render($$result, { status: searchHealthStatus }, {}, {})}</div> <div class="flex space-x-2 items-center"> <a${add_attribute("href", `${ENV_DOCUMENT_DB_URL}file/view/id/${referenceId}`, 0)} target="_blank" rel="noopener noreferrer" class="btn variant-outline-tertiary reference-btn svelte-rgnwju"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-question-circle svelte-rgnwju" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path><path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286m1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94"></path></svg>
Справка</a> <button class="btn variant-outline-tertiary">${escape("Уточнить")}</button> <button class="btn variant-outline-tertiary w-48 justify-between" data-svelte-h="svelte-7w234r">Инструменты
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 20" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M12 14.5a.75.75 0 01-.53-.22l-4.25-4.25a.75.75 0 011.06-1.06L12 12.69l3.72-3.72a.75.75 0 011.06 1.06l-4.25 4.25a.75.75 0 01-.53.22z" clip-rule="evenodd"></path></svg></button> <div class="card p-4 w-150 shadow-xl z-10" data-popup="popupFeatured"><div><label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", doMultistepSearch, 1)}> <p data-svelte-h="svelte-o1whuo">Использовать многоступенчатый поиск</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", enableLLMForTeasers, 1)}> <p data-svelte-h="svelte-9zxjq1">Использовать LLM для тизеров</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", useLLMForFiltering, 1)}> <p data-svelte-h="svelte-1uul1f7">Использовать LLM для фильтрации источников</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", disableThresholds, 1)}> <p data-svelte-h="svelte-jhmp61">Выключить фильтрацию по порогам</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", useShortestPrompt, 1)}> <p data-svelte-h="svelte-1548adw">Получить более короткий ответ</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", enableRealtimeLlmReponse, 1)}> <p data-svelte-h="svelte-tnawxy">Выводить ответ в реальном времени</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", sendConsultationToLlm, 1)}> <p data-svelte-h="svelte-vv6jwf">Учитывать консультации в ответе</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox" ${searchInTransactionLedger ? "disabled" : ""}${add_attribute("checked", useReranking, 1)}> <p data-svelte-h="svelte-qkyc7c">Использовать переранжирование</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox"${add_attribute("checked", searchInTransactionLedgerByQuestion, 1)}> <p data-svelte-h="svelte-17zslqw">Карты проводок по вопросу</p></label> <label class="flex items-center space-x-2"><input class="checkbox accent-white" type="checkbox"${add_attribute("checked", searchInTransactionLedgerByOperation, 1)}> <p data-svelte-h="svelte-1esqmyo">Карты проводок по хоз. операциям</p></label></div></div> ${currentUserRequest ? `<button class="btn variant-filled" data-svelte-h="svelte-1rjqwcg">Очистить</button>` : ``} ${isLlmLoading ? `<button class="btn variant-filled" data-svelte-h="svelte-a5kyut">Остановить</button>` : ``} <button title="Ctrl+Enter" class="btn variant-filled" data-svelte-h="svelte-w5ppob">Отправить</button></div> <div class="flex space-x-2 items-center justify-center w-full">${isLlmLoading ? `<div class="loading-status svelte-rgnwju">${escape(loadingStatusText)}</div> <div class="loading-container svelte-rgnwju">${validate_component(LoadingSpinner, "LoadingSpinner").$$render($$result, {}, {}, {})}</div>` : ``}</div> <div class="${["w-full", "hidden"].join(" ").trim()}">${validate_component(UserClarification, "UserClarification").$$render(
$$result,
{
this: userClarificationComponent,
llmClarification: userLlmClarification,
searchClarification: userSearchClarification,
searchResults,
relevantConsultations,
llmResponse: currentLlmResponse,
historyIsNotEmpty,
userRequest: currentUserRequest
},
{
this: ($$value) => {
userClarificationComponent = $$value;
$$settled = false;
},
llmClarification: ($$value) => {
userLlmClarification = $$value;
$$settled = false;
},
searchClarification: ($$value) => {
userSearchClarification = $$value;
$$settled = false;
},
searchResults: ($$value) => {
searchResults = $$value;
$$settled = false;
},
relevantConsultations: ($$value) => {
relevantConsultations = $$value;
$$settled = false;
},
llmResponse: ($$value) => {
currentLlmResponse = $$value;
$$settled = false;
},
historyIsNotEmpty: ($$value) => {
historyIsNotEmpty = $$value;
$$settled = false;
},
userRequest: ($$value) => {
currentUserRequest = $$value;
$$settled = false;
}
},
{}
)}</div> <div class="w-full my-2"></div> <div class="card w-[calc(50%-0.5rem)] p-2 mr-2"><div>${validate_component(SlideToggle, "SlideToggle").$$render(
$$result,
{
name: "slider-label",
size: "sm",
checked: enableSearchResultSelection,
disabled: searchInTransactionLedger
},
{
checked: ($$value) => {
enableSearchResultSelection = $$value;
$$settled = false;
},
disabled: ($$value) => {
searchInTransactionLedger = $$value;
$$settled = false;
}
},
{
default: () => {
return `Выбрать источники для LLM`;
}
}
)}</div> <div>${validate_component(SlideToggle, "SlideToggle").$$render(
$$result,
{
name: "slider-label",
size: "sm",
checked: useKeywords,
disabled: searchInTransactionLedger
},
{
checked: ($$value) => {
useKeywords = $$value;
$$settled = false;
},
disabled: ($$value) => {
searchInTransactionLedger = $$value;
$$settled = false;
}
},
{
default: () => {
return `Использовать ключевые слова`;
}
}
)}</div> <div>${validate_component(SlideToggle, "SlideToggle").$$render(
$$result,
{
name: "slider-label",
size: "sm",
checked: useAccountingDocs,
disabled: searchInTransactionLedger
},
{
checked: ($$value) => {
useAccountingDocs = $$value;
$$settled = false;
},
disabled: ($$value) => {
searchInTransactionLedger = $$value;
$$settled = false;
}
},
{
default: () => {
return `Выполнить поиск по БУ`;
}
}
)}</div> <div></div> ${``}</div> <div class="w-full my-2">${``}</div> ${``} ${(historyIsNotEmpty && searchResults.length > 0 || relevantConsultations && relevantConsultations.length > 0) && !searchInTransactionLedger ? `${`${validate_component(Splitpanes, "Splitpanes").$$render($$result, { theme: "modern-theme" }, {}, {
default: () => {
return `${validate_component(Pane, "Pane").$$render(
$$result,
{
minSize: 20,
class: "search-column",
size: 49
},
{},
{
default: () => {
return `<div class="search-column svelte-rgnwju">${validate_component(SearchResults, "SearchResults").$$render(
$$result,
{
enableDocumentDb: ENV_ENABLE_DOCUMENT_DB,
documentDbUrl: ENV_DOCUMENT_DB_URL,
searchResults,
showFullText,
useSearchResult,
enableSearchResultSelection
},
{
searchResults: ($$value) => {
searchResults = $$value;
$$settled = false;
},
showFullText: ($$value) => {
showFullText = $$value;
$$settled = false;
},
useSearchResult: ($$value) => {
useSearchResult = $$value;
$$settled = false;
},
enableSearchResultSelection: ($$value) => {
enableSearchResultSelection = $$value;
$$settled = false;
}
},
{}
)} ${relevantConsultations && relevantConsultations.length > 0 ? `${validate_component(RelevantConsultations, "RelevantConsultations").$$render(
$$result,
{
consultations: relevantConsultations,
showFullText: showConsultationFullText
},
{
consultations: ($$value) => {
relevantConsultations = $$value;
$$settled = false;
},
showFullText: ($$value) => {
showConsultationFullText = $$value;
$$settled = false;
}
},
{}
)}` : ``}</div>`;
}
}
)} ${validate_component(Pane, "Pane").$$render($$result, { size: 49 }, {}, {
default: () => {
return `<div class="textarea-column svelte-rgnwju"><div class="textarea svelte-rgnwju"><button class="${[
"btn variant-filled",
!(enableSearchResultSelection && searchResults.length > 0 && !showClarifyLlmResponseButton) ? "hidden" : ""
].join(" ").trim()}" data-svelte-h="svelte-qvwp3t">Получить ответ</button> <button class="${[
"btn variant-filled",
!showClarifyLlmResponseButton ? "hidden" : ""
].join(" ").trim()}" data-svelte-h="svelte-zcineo">Уточнить ответ</button> <button class="btn variant-filled" data-svelte-h="svelte-1ddim4b">Скачать ответ в Word</button> <div class="textarea svelte-rgnwju">${!isLlmLoading || enableRealtimeLlmReponse || currentLlmResponse && useShortestPrompt && shortestPromptGenerationFinished ? `<!-- HTML_TAG_START -->${currentLlmResponse}<!-- HTML_TAG_END -->` : ``}</div> ${``}</div></div>`;
}
})}`;
}
})}`}` : ``}</div></div> </section>`;
} while (!$$settled);
return $$rendered;
});
export { Page as default };
//# sourceMappingURL=_page.svelte-IDJdT7Zl.js.map