muryshev's picture
update
9923f3d
raw
history blame
58.3 kB
import{b as _e,ah as Pe,ai as Ve,f as D,i as m,u as h,k as I,l as d,n as P,e as E,c as y,t as oe,d as v,j as L,h as ce,I as xe,m as Fe,A as E4,ae as Uu,q as Le,v as nu,w as Q,r as wu,y as pu,F as yu,B as me,z as C4,p as ee,x as le,H as D4,C as w4}from"../chunks/scheduler.5WtVptCO.js";import{S as ge,i as be,a as F,g as Se,f as Te,t as T,c as W,d as Y,m as Z,e as x,b as se}from"../chunks/index.7IiDzEZn.js";import{S as F4,P as Pu,a as A4}from"../chunks/SearchResults.3ZkY-Bmy.js";import{L as Ge,P as Me,H as Ze,F as B4,b as k4,f as S4,T as Vu,I as T4,S as R4,M as y4,U as Ru,a as L4}from"../chunks/InvestigatorSettings.5lll9SsD.js";import{e as Ae}from"../chunks/each.C7pZUaX1.js";import{L as qu}from"../chunks/LogService.hUlSDADx.js";import{g as I4}from"../chunks/stores.Cb2RXlYi.js";import"../chunks/ProgressBar.svelte_svelte_type_style_lang.7yc35pDe.js";import{D as N4,S as ju}from"../chunks/SearchUtils.tAbMbmlw.js";import{L as U4}from"../chunks/LlmSelector.Snki38ql.js";import{g as v4}from"../chunks/stores.XS_YoCyo.js";import{p as O4}from"../chunks/popup.dE7t2hhe.js";const M4=!1,Y0=Object.freeze(Object.defineProperty({__proto__:null,prerender:M4},Symbol.toStringTag,{value:"Module"}));function P4(l){let e,u,t,n,r,s,a;return{c(){e=Pe("svg"),u=Pe("circle"),t=Pe("animate"),n=Pe("circle"),r=Pe("animate"),s=Pe("circle"),a=Pe("animate"),this.h()},l(c){e=Ve(c,"svg",{version:!0,id:!0,xmlns:!0,"xmlns:xlink":!0,x:!0,y:!0,viewBox:!0,"enable-background":!0,"xml:space":!0});var i=D(e);u=Ve(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var o=D(u);t=Ve(o,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(t).forEach(m),o.forEach(m),n=Ve(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var f=D(n);r=Ve(f,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(r).forEach(m),f.forEach(m),s=Ve(i,"circle",{fill:!0,stroke:!0,cx:!0,cy:!0,r:!0});var p=D(s);a=Ve(p,"animate",{attributeName:!0,dur:!0,values:!0,repeatCount:!0,begin:!0}),D(a).forEach(m),p.forEach(m),i.forEach(m),this.h()},h(){h(t,"attributeName","opacity"),h(t,"dur","1s"),h(t,"values","0;1;0"),h(t,"repeatCount","indefinite"),h(t,"begin","0.1"),h(u,"fill","#1976d2"),h(u,"stroke","none"),h(u,"cx","6"),h(u,"cy","50"),h(u,"r","6"),h(r,"attributeName","opacity"),h(r,"dur","1s"),h(r,"values","0;1;0"),h(r,"repeatCount","indefinite"),h(r,"begin","0.2"),h(n,"fill","#1976d2"),h(n,"stroke","none"),h(n,"cx","26"),h(n,"cy","50"),h(n,"r","6"),h(a,"attributeName","opacity"),h(a,"dur","1s"),h(a,"values","0;1;0"),h(a,"repeatCount","indefinite"),h(a,"begin","0.3"),h(s,"fill","#1976d2"),h(s,"stroke","none"),h(s,"cx","46"),h(s,"cy","50"),h(s,"r","6"),h(e,"version","1.1"),h(e,"id","L4"),h(e,"xmlns","http://www.w3.org/2000/svg"),h(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),h(e,"x","0px"),h(e,"y","0px"),h(e,"viewBox","0 0 100 100"),h(e,"enable-background","new 0 0 0 0"),h(e,"xml:space","preserve")},m(c,i){I(c,e,i),d(e,u),d(u,t),d(e,n),d(n,r),d(e,s),d(s,a)},p:P,i:P,o:P,d(c){c&&m(e)}}}function V4(l,e,u){let{size:t=20}=e;return l.$$set=n=>{"size"in n&&u(0,t=n.size)},[t]}class q4 extends ge{constructor(e){super(),be(this,e,V4,P4,_e,{size:0})}}function j4(l){let e,u,t,n,r;return{c(){e=E("div"),u=Pe("svg"),t=Pe("circle"),n=y(),r=oe(l[2]),this.h()},l(s){e=v(s,"DIV",{class:!0});var a=D(e);u=Ve(a,"svg",{class:!0,viewBox:!0,xmlns:!0});var c=D(u);t=Ve(c,"circle",{cx:!0,cy:!0,r:!0,fill:!0,style:!0}),D(t).forEach(m),c.forEach(m),n=L(a),r=ce(a,l[2]),a.forEach(m),this.h()},h(){h(t,"cx","10"),h(t,"cy","10"),h(t,"r","5"),h(t,"fill",l[0]),xe(t,"filter","drop-shadow(0 0 1px "+l[1]+")"),h(u,"class","dot svelte-1wcf73j"),h(u,"viewBox","0 0 20 20"),h(u,"xmlns","http://www.w3.org/2000/svg"),h(e,"class","llm-health-status w-40 inline-block svelte-1wcf73j")},m(s,a){I(s,e,a),d(e,u),d(u,t),d(e,n),d(e,r)},p(s,[a]){a&1&&h(t,"fill",s[0]),a&2&&xe(t,"filter","drop-shadow(0 0 1px "+s[1]+")"),a&4&&Fe(r,s[2])},i:P,o:P,d(s){s&&m(e)}}}function H4(l,e,u){let{disableIntervalChecks:t=!1}=e,{llmName:n=""}=e,r="#af4f4c",s="#af4f4c",a="Сервис LLM недоступен",c=new AbortController;async function i(){const f=`${window.location.origin}/llm/health`;switch((await Ge.fetchHealthStatus(f,{llm:n},"Error fetching Llama health status",c))?.status){case"ok":u(0,r="#4CAF50"),u(1,s="rgba(0, 128, 0, 0.7)"),u(2,a="Сервис LLM работает");break;case"error":u(2,a="Сервис LLM не работает");break;case"loading model":u(0,r="yellow"),u(1,s="rgba(255, 255, 0, 0.7)"),u(2,a="Сервис LLM запускается...");break;case"unavailable":u(0,r="#af4f4c"),u(1,s="#af4f4c"),u(2,a="Сервис LLM не запущен");break;case"unknown":u(0,r="#af4f4c"),u(1,s="#af4f4c"),u(2,a="Сервис LLM недоступен");break}}let o;return E4(async()=>{i(),o=setInterval(async()=>{i()},3e4),t&&clearInterval(o)}),Uu(()=>{clearInterval(o),c.abort("user canceled"),c=new AbortController}),l.$$set=f=>{"disableIntervalChecks"in f&&u(3,t=f.disableIntervalChecks),"llmName"in f&&u(4,n=f.llmName)},[r,s,a,t,n]}class z4 extends ge{constructor(e){super(),be(this,e,H4,j4,_e,{disableIntervalChecks:3,llmName:4})}}function Q4(l){let e,u,t,n,r;return{c(){e=E("div"),u=Pe("svg"),t=Pe("circle"),n=y(),r=oe(l[2]),this.h()},l(s){e=v(s,"DIV",{class:!0});var a=D(e);u=Ve(a,"svg",{class:!0,viewBox:!0,xmlns:!0});var c=D(u);t=Ve(c,"circle",{cx:!0,cy:!0,r:!0,fill:!0,style:!0}),D(t).forEach(m),c.forEach(m),n=L(a),r=ce(a,l[2]),a.forEach(m),this.h()},h(){h(t,"cx","10"),h(t,"cy","10"),h(t,"r","5"),h(t,"fill",l[0]),xe(t,"filter","drop-shadow(0 0 1px "+l[1]+")"),h(u,"class","dot svelte-1wcf73j"),h(u,"viewBox","0 0 20 20"),h(u,"xmlns","http://www.w3.org/2000/svg"),h(e,"class","llm-health-status w-40 inline-block svelte-1wcf73j")},m(s,a){I(s,e,a),d(e,u),d(u,t),d(e,n),d(e,r)},p(s,[a]){a&1&&h(t,"fill",s[0]),a&2&&xe(t,"filter","drop-shadow(0 0 1px "+s[1]+")"),a&4&&Fe(r,s[2])},i:P,o:P,d(s){s&&m(e)}}}function G4(l,e,u){let{disableIntervalChecks:t=!1}=e,n="#af4f4c",r="#af4f4c",s="Поиск недоступен",a=new AbortController;async function c(f,p){try{const k=await fetch(f,{method:"GET",headers:{"Content-Type":"application/json"},signal:a.signal});if(!k.ok)throw new Error(`${p}: ${k.statusText}`);return k.json()}catch(k){return console.error(p,k.message),null}}async function i(){const f=`${window.location.origin}/search/health`,p=await c(f,"Error fetching search health status");if(p)switch(p.status){case"ok":u(0,n="#4CAF50"),u(1,r="rgba(0, 128, 0, 0.7)"),u(2,s="Поиск работает");break;case"unavailable":u(0,n="#af4f4c"),u(1,r="#af4f4c"),u(2,s="Поиск не запущен");break;case"unknown":u(0,n="#af4f4c"),u(1,r="#af4f4c"),u(2,s="Поиск недоступен");break}}let o;return E4(async()=>{i(),o=setInterval(async()=>{i()},3e4),t&&clearInterval(o)}),Uu(()=>{clearInterval(o),a.abort("user canceled"),a=new AbortController}),l.$$set=f=>{"disableIntervalChecks"in f&&u(3,t=f.disableIntervalChecks)},[n,r,s,t]}class J4 extends ge{constructor(e){super(),be(this,e,G4,Q4,_e,{disableIntervalChecks:3})}}function X4(l){let e,u,t,n,r,s="Сохранить",a,c,i="Сбросить",o,f;return{c(){e=E("div"),u=E("div"),t=E("textarea"),n=y(),r=E("button"),r.textContent=s,a=y(),c=E("button"),c.textContent=i,this.h()},l(p){e=v(p,"DIV",{class:!0});var k=D(e);u=v(k,"DIV",{class:!0});var A=D(u);t=v(A,"TEXTAREA",{class:!0}),D(t).forEach(m),n=L(A),r=v(A,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(r)!=="svelte-g0hhac"&&(r.textContent=s),a=L(A),c=v(A,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(c)!=="svelte-16kemh0"&&(c.textContent=i),A.forEach(m),k.forEach(m),this.h()},h(){h(t,"class","svelte-sfudwy"),h(r,"class","svelte-sfudwy"),h(c,"class","svelte-sfudwy"),h(u,"class","popup svelte-sfudwy"),h(e,"class","modal svelte-sfudwy")},m(p,k){I(p,e,k),d(e,u),d(u,t),nu(t,l[0]),d(u,n),d(u,r),d(u,a),d(u,c),o||(f=[Q(t,"input",l[6]),Q(r,"click",l[1]),Q(c,"click",l[2])],o=!0)},p(p,[k]){k&1&&nu(t,p[0])},i:P,o:P,d(p){p&&m(e),o=!1,wu(f)}}}let K4='Ты бухгалтер. Ты отвечаешь на русском языке. Ты всегда следуешь моим инструкциям. Ты отвечаешь на вопросы клиентов. Чтобы ответить, ты обязательно используешь только "источники", которые я тебе предоставляю. Ты используешь только официально-деловой стиль и необходимую терминологию. Соблюдай этические нормы. При ответе на вопрос ты используешь только такой формат ответа: 1) Четкий и краткий ответ на поставленный вопрос. Ты можешь начать свой ответ так: "По Вашему вопросу сообщаем...". Используй по возможности слова: да, можно, нет, нельзя. 2) Обоснование (ты используешь для обоснования "источники". Ты используешь только "источники" для поиска необходимых "законов", "статей", "пунктов" и "подпунктов" для ответа на вопрос пользователя). 3) Аргументация (Ты используешь только "источники" для поиска необходимых "писем" и "судебных решений", чтобы аргументировать свой ответ)." 4) Заключение (ты подводишь итоги всего, что сказал выше. Избегай повторения и сложных конструкций). Если в источниках нельзя найти подходящую информацию для ответа, ты отвечаешь так: "Мы не можем ответить на данный вопрос. Обратитесь к специалисту." Вопрос: {{ВОПРОС}} Источники: {{ИСТОЧНИКИ}}';function W4(l,e,u){let{onSave:t}=e,{onClose:n}=e,{text:r=""}=e,s=r;function a(){t(s),n()}function c(){u(0,s=K4)}function i(){s=this.value,u(0,s)}return l.$$set=o=>{"onSave"in o&&u(3,t=o.onSave),"onClose"in o&&u(4,n=o.onClose),"text"in o&&u(5,r=o.text)},[s,a,c,t,n,r,i]}class Y4 extends ge{constructor(e){super(),be(this,e,W4,X4,_e,{onSave:3,onClose:4,text:5})}}function Hu(l,e,u){const t=l.slice();return t[6]=e[u],t}function zu(l){let e,u=Ae(l[3].split(`
`)),t=[];for(let n=0;n<u.length;n+=1)t[n]=Qu(Hu(l,u,n));return{c(){e=E("div");for(let n=0;n<t.length;n+=1)t[n].c();this.h()},l(n){e=v(n,"DIV",{class:!0});var r=D(e);for(let s=0;s<t.length;s+=1)t[s].l(r);r.forEach(m),this.h()},h(){h(e,"class","annotation svelte-1uvb5ib")},m(n,r){I(n,e,r);for(let s=0;s<t.length;s+=1)t[s]&&t[s].m(e,null)},p(n,r){if(r&8){u=Ae(n[3].split(`
`));let s;for(s=0;s<u.length;s+=1){const a=Hu(n,u,s);t[s]?t[s].p(a,r):(t[s]=Qu(a),t[s].c(),t[s].m(e,null))}for(;s<t.length;s+=1)t[s].d(1);t.length=u.length}},d(n){n&&m(e),pu(t,n)}}}function Qu(l){let e,u=l[6]+"",t;return{c(){e=E("p"),t=oe(u),this.h()},l(n){e=v(n,"P",{class:!0});var r=D(e);t=ce(r,u),r.forEach(m),this.h()},h(){h(e,"class","mt-3 mb-3")},m(n,r){I(n,e,r),d(e,t)},p(n,r){r&8&&u!==(u=n[6]+"")&&Fe(t,u)},d(n){n&&m(e)}}}function Z4(l){let e,u,t,n,r,s,a,c=l[0][l[1]]&&zu(l);return{c(){e=E("div"),u=E("div"),t=E("button"),n=oe(l[2]),r=y(),c&&c.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);t=v(f,"BUTTON",{class:!0});var p=D(t);n=ce(p,l[2]),p.forEach(m),f.forEach(m),r=L(o),c&&c.l(o),o.forEach(m),this.h()},h(){h(t,"class","btn-link ml-3 text-left"),h(u,"class","font-bold"),h(e,"class","mb-5")},m(i,o){I(i,e,o),d(e,u),d(u,t),d(t,n),d(e,r),c&&c.m(e,null),s||(a=Q(t,"click",l[5]),s=!0)},p(i,[o]){o&4&&Fe(n,i[2]),i[0][i[1]]?c?c.p(i,o):(c=zu(i),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:P,o:P,d(i){i&&m(e),c&&c.d(),s=!1,a()}}}function x4(l,e,u){let{showFullText:t=Array(10).fill(!1)}=e,{index:n}=e,{title:r}=e,{text:s}=e;function a(i){u(0,t[i]=!t[i],t)}const c=()=>a(n);return l.$$set=i=>{"showFullText"in i&&u(0,t=i.showFullText),"index"in i&&u(1,n=i.index),"title"in i&&u(2,r=i.title),"text"in i&&u(3,s=i.text)},[t,n,r,s,a,c]}class $4 extends ge{constructor(e){super(),be(this,e,x4,Z4,_e,{showFullText:0,index:1,title:2,text:3})}}function Gu(l,e,u){const t=l.slice();return t[3]=e[u].title,t[4]=e[u].text,t[6]=u,t}function Ju(l){let e,u;return e=new $4({props:{title:l[3],text:l[4],index:l[6],showFullText:l[1]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&1&&(r.title=t[3]),n&1&&(r.text=t[4]),n&2&&(r.showFullText=t[1]),e.$set(r)},i(t){u||(F(e.$$.fragment,t),u=!0)},o(t){T(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function e0(l){let e,u,t="Консультации",n,r,s=Ae(l[0]),a=[];for(let i=0;i<s.length;i+=1)a[i]=Ju(Gu(l,s,i));const c=i=>T(a[i],1,1,()=>{a[i]=null});return{c(){e=E("div"),u=E("h2"),u.textContent=t,n=y();for(let i=0;i<a.length;i+=1)a[i].c();this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"H2",{class:!0,style:!0,"data-svelte-h":!0}),Le(u)!=="svelte-bhrtd7"&&(u.textContent=t),n=L(o);for(let f=0;f<a.length;f+=1)a[f].l(o);o.forEach(m),this.h()},h(){h(u,"class","w-full p-5 space-y-2 mb-3 text-lg"),xe(u,"border-bottom","2px solid #ccc"),xe(u,"border-top","2px solid #ccc"),h(e,"class","flex-1 overflow-y-auto p-4")},m(i,o){I(i,e,o),d(e,u),d(e,n);for(let f=0;f<a.length;f+=1)a[f]&&a[f].m(e,null);r=!0},p(i,[o]){if(o&3){s=Ae(i[0]);let f;for(f=0;f<s.length;f+=1){const p=Gu(i,s,f);a[f]?(a[f].p(p,o),F(a[f],1)):(a[f]=Ju(p),a[f].c(),F(a[f],1),a[f].m(e,null))}for(Se(),f=s.length;f<a.length;f+=1)c(f);Te()}},i(i){if(!r){for(let o=0;o<s.length;o+=1)F(a[o]);r=!0}},o(i){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)T(a[o]);r=!1},d(i){i&&m(e),pu(a,i)}}}function u0(l,e,u){let t=Array(10).fill(!1),{consultations:n=[]}=e,r=[];return l.$$set=s=>{"consultations"in s&&u(0,n=s.consultations)},l.$$.update=()=>{l.$$.dirty&5&&n!==r&&(u(1,t=Array(n.length).fill(!1)),u(2,r=n))},[n,t,r]}class t0 extends ge{constructor(e){super(),be(this,e,u0,e0,_e,{consultations:0})}}function l0(l){let e,u,t,n;return{c(){e=E("div"),u=E("textarea"),this.h()},l(r){e=v(r,"DIV",{class:!0});var s=D(e);u=v(s,"TEXTAREA",{rows:!0,placeholder:!0,class:!0}),D(u).forEach(m),s.forEach(m),this.h()},h(){h(u,"rows","3"),h(u,"placeholder","Уточнение для LLM"),h(u,"class","svelte-3qvypm"),h(e,"class","w-full flex p-2 space-x-2")},m(r,s){I(r,e,s),d(e,u),nu(u,l[0]),t||(n=Q(u,"input",l[1]),t=!0)},p(r,[s]){s&1&&nu(u,r[0])},i:P,o:P,d(r){r&&m(e),t=!1,n()}}}function s0(l,e,u){let{llmClarification:t=""}=e;function n(){t=this.value,u(0,t)}return l.$$set=r=>{"llmClarification"in r&&u(0,t=r.llmClarification)},[t,n]}class n0 extends ge{constructor(e){super(),be(this,e,s0,l0,_e,{llmClarification:0})}}function r0(l){let e;return{c(){e=oe(l[0])},l(u){e=ce(u,l[0])},m(u,t){I(u,e,t)},p(u,t){t&1&&Fe(e,u[0])},d(u){u&&m(e)}}}function a0(l){let e,u,t;return{c(){e=E("a"),u=oe(l[0]),this.h()},l(n){e=v(n,"A",{href:!0,target:!0,class:!0});var r=D(e);u=ce(r,l[0]),r.forEach(m),this.h()},h(){h(e,"href",t=l[2]+"file/download/name/"+encodeURIComponent(l[0])),h(e,"target","_blank"),h(e,"class","svelte-1ijmx03")},m(n,r){I(n,e,r),d(e,u)},p(n,r){r&1&&Fe(u,n[0]),r&5&&t!==(t=n[2]+"file/download/name/"+encodeURIComponent(n[0]))&&h(e,"href",t)},d(n){n&&m(e)}}}function i0(l){let e,u,t,n,r;function s(i,o){return i[1]&&i[2]?a0:r0}let a=s(l),c=a(l);return{c(){e=E("div"),u=E("div"),c.c(),t=y(),n=E("div"),r=oe(l[3]),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);c.l(f),f.forEach(m),t=L(o),n=v(o,"DIV",{});var p=D(n);r=ce(p,l[3]),p.forEach(m),o.forEach(m),this.h()},h(){h(u,"class","title svelte-1ijmx03"),h(e,"class","search-result svelte-1ijmx03")},m(i,o){I(i,e,o),d(e,u),c.m(u,null),d(e,t),d(e,n),d(n,r)},p(i,[o]){a===(a=s(i))&&c?c.p(i,o):(c.d(1),c=a(i),c&&(c.c(),c.m(u,null))),o&8&&Fe(r,i[3])},i:P,o:P,d(i){i&&m(e),c.d()}}}function o0(l,e,u){let{title:t}=e,{enableDocumentDb:n=!1}=e,{documentDbUrl:r=""}=e,{source:s=""}=e;return l.$$set=a=>{"title"in a&&u(0,t=a.title),"enableDocumentDb"in a&&u(1,n=a.enableDocumentDb),"documentDbUrl"in a&&u(2,r=a.documentDbUrl),"source"in a&&u(3,s=a.source)},[t,n,r,s]}class c0 extends ge{constructor(e){super(),be(this,e,o0,i0,_e,{title:0,enableDocumentDb:1,documentDbUrl:2,source:3})}}function Xu(l,e,u){const t=l.slice();return t[3]=e[u],t}function Ku(l){let e,u;return e=new c0({props:{title:l[3],enableDocumentDb:l[0],documentDbUrl:l[1],source:l[2][l[3]]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&4&&(r.title=t[3]),n&1&&(r.enableDocumentDb=t[0]),n&2&&(r.documentDbUrl=t[1]),n&4&&(r.source=t[2][t[3]]),e.$set(r)},i(t){u||(F(e.$$.fragment,t),u=!0)},o(t){T(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function f0(l){let e,u,t,n,r=Ae(Object.keys(l[2])),s=[];for(let i=0;i<r.length;i+=1)s[i]=Ku(Xu(l,r,i));const a=i=>T(s[i],1,1,()=>{s[i]=null});let c=h0;return{c(){e=E("div");for(let i=0;i<s.length;i+=1)s[i].c();u=y(),t=yu(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);for(let f=0;f<s.length;f+=1)s[f].l(o);o.forEach(m),u=L(i),t=yu(),this.h()},h(){h(e,"class","search-results svelte-14obzoi")},m(i,o){I(i,e,o);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(e,null);I(i,u,o),I(i,t,o),n=!0},p(i,[o]){if(o&7){r=Ae(Object.keys(i[2]));let f;for(f=0;f<r.length;f+=1){const p=Xu(i,r,f);s[f]?(s[f].p(p,o),F(s[f],1)):(s[f]=Ku(p),s[f].c(),F(s[f],1),s[f].m(e,null))}for(Se(),f=r.length;f<s.length;f+=1)a(f);Te()}},i(i){if(!n){for(let o=0;o<r.length;o+=1)F(s[o]);F(c),n=!0}},o(i){s=s.filter(Boolean);for(let o=0;o<s.length;o+=1)T(s[o]);T(c),n=!1},d(i){i&&(m(e),m(u),m(t)),pu(s,i)}}}let h0=!1;function m0(l,e,u){let{enableDocumentDb:t=!1}=e,{documentDbUrl:n=""}=e,{transactionMaps:r={}}=e;return l.$$set=s=>{"enableDocumentDb"in s&&u(0,t=s.enableDocumentDb),"documentDbUrl"in s&&u(1,n=s.documentDbUrl),"transactionMaps"in s&&u(2,r=s.transactionMaps)},[t,n,r]}class d0 extends ge{constructor(e){super(),be(this,e,m0,f0,_e,{enableDocumentDb:0,documentDbUrl:1,transactionMaps:2})}}const{saveAs:p0}=S4;class _0{static createDocxFromObject(e){const u=[],t=c=>c.replace(/[^\r\n\u0020-\u007E\u00A0-\uFFFF]/g,"").replace(/<[^>]*>/g,""),n=c=>t(c).split(`
`).map(i=>new Me({children:[new Vu({text:i,font:"Calibri"})],spacing:{line:276}})),r=c=>[{label:"Выбрать источники для LLM",value:c.enableSearchResultSelection},{label:"Использовать расширенный поиск",value:c.enableQueryExpansionSearch},{label:"Использовать многоступенчатый поиск",value:c.enableOlympicSearch},{label:"Карты проводок по вопросу",value:c.searchInTransactionLedgerByQuestion}].map(o=>new Me({children:[new Vu({text:`${t(o.label)}: ${o.value?"да":"нет"}`,font:"Calibri"})],spacing:{line:276}}));u.push(new Me({text:"Вопрос:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...n(e.userRequest)),u.push(new Me({text:"Ответ системы:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...n(e.llmResponse)),e.searchResults.length>0&&(u.push(new Me({text:"Найденные источники:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.searchResults.forEach(c=>{u.push(new Me({text:t(c.title),heading:Ze.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(c.text))})),e.consultations.length>0&&(u.push(new Me({text:"Найденные консультации:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.consultations.forEach(c=>{const i=JSON.parse(c);u.push(new Me({text:t(i.title),heading:Ze.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(i.text))})),e.explanations.length>0&&(u.push(new Me({text:"Релевантные разъяснения:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"})),e.explanations.forEach(c=>{const i=JSON.parse(c);u.push(new Me({text:t(i.title),heading:Ze.HEADING_2,spacing:{line:360,before:200},font:"Calibri"}),...n(i.text))})),u.push(new Me({text:"Параметры запроса:",heading:Ze.HEADING_1,spacing:{line:360,before:300},font:"Calibri"}),...r(e.uiSettings));const s=new B4({sections:[{properties:{},children:u}]}),a=()=>{const c=new Date,i=c.toISOString().slice(0,10),o=c.toTimeString().slice(0,8).replace(/:/g,"-");return`Document_${i}_${o}.docx`};k4.toBlob(s).then(c=>{p0(c,a())})}}function Wu(l,e,u){const t=l.slice();return t[18]=e[u],t[20]=u,t}function Yu(l){let e,u,t,n,r;function s(){return l[10](l[20])}function a(){return l[11](l[20])}function c(){return l[12](l[20])}return{c(){e=E("button"),u=oe(`★\r
`),this.h()},l(i){e=v(i,"BUTTON",{class:!0});var o=D(e);u=ce(o,`★\r
`),o.forEach(m),this.h()},h(){h(e,"class",t="star "+(l[1]>=l[20]+1||l[0]>=l[20]+1?"selected":"")+" svelte-zykxm3")},m(i,o){I(i,e,o),d(e,u),n||(r=[Q(e,"click",s),Q(e,"mouseover",a),Q(e,"focus",c)],n=!0)},p(i,o){l=i,o&3&&t!==(t="star "+(l[1]>=l[20]+1||l[0]>=l[20]+1?"selected":"")+" svelte-zykxm3")&&h(e,"class",t)},d(i){i&&m(e),n=!1,wu(r)}}}function g0(l){let e,u,t="Оцените ответ:",n,r,s,a,c,i,o,f,p,k,A,S=Ae(Array(5)),U=[];for(let w=0;w<S.length;w+=1)U[w]=Yu(Wu(l,S,w));return{c(){e=E("div"),u=E("span"),u.textContent=t,n=y(),r=E("div");for(let w=0;w<U.length;w+=1)U[w].c();s=y(),a=E("textarea"),i=y(),o=E("button"),f=oe(l[4]),this.h()},l(w){e=v(w,"DIV",{});var _=D(e);u=v(_,"SPAN",{"data-svelte-h":!0}),Le(u)!=="svelte-9pssby"&&(u.textContent=t),n=L(_),r=v(_,"DIV",{class:!0,role:!0});var g=D(r);for(let R=0;R<U.length;R+=1)U[R].l(g);g.forEach(m),s=L(_),a=v(_,"TEXTAREA",{rows:!0,placeholder:!0,class:!0}),D(a).forEach(m),i=L(_),o=v(_,"BUTTON",{class:!0});var B=D(o);f=ce(B,l[4]),B.forEach(m),_.forEach(m),this.h()},h(){h(r,"class","star-rating svelte-zykxm3"),h(r,"role","none"),h(a,"rows","3"),h(a,"placeholder","Комментарий"),a.disabled=c=l[0]===0,h(a,"class","textarea bg-white p-1 svelte-zykxm3"),h(o,"class","btn variant-form-material svelte-zykxm3"),o.disabled=p=l[0]===0||l[3]},m(w,_){I(w,e,_),d(e,u),d(e,n),d(e,r);for(let g=0;g<U.length;g+=1)U[g]&&U[g].m(r,null);d(e,s),d(e,a),nu(a,l[2]),d(e,i),d(e,o),d(o,f),k||(A=[Q(r,"mouseleave",l[7]),Q(a,"input",l[13]),Q(o,"click",l[8])],k=!0)},p(w,[_]){if(_&99){S=Ae(Array(5));let g;for(g=0;g<S.length;g+=1){const B=Wu(w,S,g);U[g]?U[g].p(B,_):(U[g]=Yu(B),U[g].c(),U[g].m(r,null))}for(;g<U.length;g+=1)U[g].d(1);U.length=S.length}_&1&&c!==(c=w[0]===0)&&(a.disabled=c),_&4&&nu(a,w[2]),_&16&&Fe(f,w[4]),_&9&&p!==(p=w[0]===0||w[3])&&(o.disabled=p)},i:P,o:P,d(w){w&&m(e),pu(U,w),k=!1,wu(A)}}}function b0(l,e,u){const t={message:"Спасибо за оценку!",timeout:5e3},n=I4();let r=0,{onSubmit:s=function(R){}}=e,a=0,c="",i=!1,o="Отправить";function f(R){u(0,r=R)}function p(R){u(1,a=R)}function k(){u(1,a=0)}async function A(){r>0&&(s&&(U(),await s({rating:r,comment:c})),S(),n.trigger(t))}function S(){u(0,r=0),u(2,c=""),u(3,i=!1),u(4,o="Отправить")}function U(){u(3,i=!0),u(4,o="Отправляем...")}const w=R=>f(R+1),_=R=>p(R+1),g=R=>p(R+1);function B(){c=this.value,u(2,c)}return l.$$set=R=>{"onSubmit"in R&&u(9,s=R.onSubmit)},[r,a,c,i,o,f,p,k,A,s,w,_,g,B]}class E0 extends ge{constructor(e){super(),be(this,e,b0,g0,_e,{onSubmit:9})}}function v0(l){let e,u="Настроить поиск",t,n;return{c(){e=E("button"),e.textContent=u,this.h()},l(r){e=v(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(e)!=="svelte-1np4oyj"&&(e.textContent=u),this.h()},h(){h(e,"class","btn variant-outline-tertiary")},m(r,s){I(r,e,s),t||(n=Q(e,"click",l[0]),t=!0)},p:P,i:P,o:P,d(r){r&&m(e),t=!1,n()}}}function C0(l,e,u){const t=v4();let{llmParams:n}=e;function r(){console.log("openModal",n);const s={type:"component",title:"Настройки поиска",component:"searchSettingsModal",meta:n,response:a=>{u(1,n=a)}};t.trigger(s)}return l.$$set=s=>{"llmParams"in s&&u(1,n=s.llmParams)},[r,n]}class D0 extends ge{constructor(e){super(),be(this,e,C0,v0,_e,{llmParams:1})}}function Zu(l,e,u){const t=l.slice();return t[6]=e[u],t}function xu(l){let e,u=Ae(l[3].split(`
`)),t=[];for(let n=0;n<u.length;n+=1)t[n]=$u(Zu(l,u,n));return{c(){e=E("div");for(let n=0;n<t.length;n+=1)t[n].c();this.h()},l(n){e=v(n,"DIV",{class:!0});var r=D(e);for(let s=0;s<t.length;s+=1)t[s].l(r);r.forEach(m),this.h()},h(){h(e,"class","annotation svelte-1uvb5ib")},m(n,r){I(n,e,r);for(let s=0;s<t.length;s+=1)t[s]&&t[s].m(e,null)},p(n,r){if(r&8){u=Ae(n[3].split(`
`));let s;for(s=0;s<u.length;s+=1){const a=Zu(n,u,s);t[s]?t[s].p(a,r):(t[s]=$u(a),t[s].c(),t[s].m(e,null))}for(;s<t.length;s+=1)t[s].d(1);t.length=u.length}},d(n){n&&m(e),pu(t,n)}}}function $u(l){let e,u=l[6]+"",t;return{c(){e=E("p"),t=oe(u),this.h()},l(n){e=v(n,"P",{class:!0});var r=D(e);t=ce(r,u),r.forEach(m),this.h()},h(){h(e,"class","mt-3 mb-3")},m(n,r){I(n,e,r),d(e,t)},p(n,r){r&8&&u!==(u=n[6]+"")&&Fe(t,u)},d(n){n&&m(e)}}}function w0(l){let e,u,t,n,r,s,a,c=l[0][l[1]]&&xu(l);return{c(){e=E("div"),u=E("div"),t=E("button"),n=oe(l[2]),r=y(),c&&c.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"DIV",{class:!0});var f=D(u);t=v(f,"BUTTON",{class:!0});var p=D(t);n=ce(p,l[2]),p.forEach(m),f.forEach(m),r=L(o),c&&c.l(o),o.forEach(m),this.h()},h(){h(t,"class","btn-link ml-3 text-left"),h(u,"class","font-bold"),h(e,"class","mb-5")},m(i,o){I(i,e,o),d(e,u),d(u,t),d(t,n),d(e,r),c&&c.m(e,null),s||(a=Q(t,"click",l[5]),s=!0)},p(i,[o]){o&4&&Fe(n,i[2]),i[0][i[1]]?c?c.p(i,o):(c=xu(i),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:P,o:P,d(i){i&&m(e),c&&c.d(),s=!1,a()}}}function F0(l,e,u){let{showFullText:t=Array(10).fill(!1)}=e,{index:n}=e,{title:r}=e,{text:s}=e;function a(i){u(0,t[i]=!t[i],t)}const c=()=>a(n);return l.$$set=i=>{"showFullText"in i&&u(0,t=i.showFullText),"index"in i&&u(1,n=i.index),"title"in i&&u(2,r=i.title),"text"in i&&u(3,s=i.text)},[t,n,r,s,a,c]}class A0 extends ge{constructor(e){super(),be(this,e,F0,w0,_e,{showFullText:0,index:1,title:2,text:3})}}function e4(l,e,u){const t=l.slice();return t[3]=e[u].title,t[4]=e[u].text,t[6]=u,t}function u4(l){let e,u;return e=new A0({props:{title:l[3],text:l[4],index:l[6],showFullText:l[1]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n&1&&(r.title=t[3]),n&1&&(r.text=t[4]),n&2&&(r.showFullText=t[1]),e.$set(r)},i(t){u||(F(e.$$.fragment,t),u=!0)},o(t){T(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function B0(l){let e,u,t="Разъяснения",n,r,s=Ae(l[0]),a=[];for(let i=0;i<s.length;i+=1)a[i]=u4(e4(l,s,i));const c=i=>T(a[i],1,1,()=>{a[i]=null});return{c(){e=E("div"),u=E("h2"),u.textContent=t,n=y();for(let i=0;i<a.length;i+=1)a[i].c();this.h()},l(i){e=v(i,"DIV",{class:!0});var o=D(e);u=v(o,"H2",{class:!0,style:!0,"data-svelte-h":!0}),Le(u)!=="svelte-81a5qt"&&(u.textContent=t),n=L(o);for(let f=0;f<a.length;f+=1)a[f].l(o);o.forEach(m),this.h()},h(){h(u,"class","w-full p-5 space-y-2 mb-3 text-lg"),xe(u,"border-bottom","2px solid #ccc"),xe(u,"border-top","2px solid #ccc"),h(e,"class","flex-1 overflow-y-auto p-4")},m(i,o){I(i,e,o),d(e,u),d(e,n);for(let f=0;f<a.length;f+=1)a[f]&&a[f].m(e,null);r=!0},p(i,[o]){if(o&3){s=Ae(i[0]);let f;for(f=0;f<s.length;f+=1){const p=e4(i,s,f);a[f]?(a[f].p(p,o),F(a[f],1)):(a[f]=u4(p),a[f].c(),F(a[f],1),a[f].m(e,null))}for(Se(),f=s.length;f<a.length;f+=1)c(f);Te()}},i(i){if(!r){for(let o=0;o<s.length;o+=1)F(a[o]);r=!0}},o(i){a=a.filter(Boolean);for(let o=0;o<a.length;o+=1)T(a[o]);r=!1},d(i){i&&m(e),pu(a,i)}}}function k0(l,e,u){let t=Array(10).fill(!1),{explanations:n=[]}=e,r=[];return l.$$set=s=>{"explanations"in s&&u(0,n=s.explanations)},l.$$.update=()=>{l.$$.dirty&5&&n!==r&&(u(1,t=Array(n.length).fill(!1)),u(2,r=n))},[n,t,r]}class S0 extends ge{constructor(e){super(),be(this,e,k0,B0,_e,{explanations:0})}}function t4(l,e,u){const t=l.slice();return t[8]=e[u][0],t[9]=e[u][1],t[10]=e,t[11]=u,t}function l4(l){let e,u,t,n,r=l[9]+"",s,a,c,i;function o(){l[6].call(u,l[8])}return{c(){e=E("label"),u=E("input"),t=y(),n=E("p"),s=oe(r),a=y(),this.h()},l(f){e=v(f,"LABEL",{class:!0});var p=D(e);u=v(p,"INPUT",{class:!0,type:!0}),t=L(p),n=v(p,"P",{});var k=D(n);s=ce(k,r),k.forEach(m),a=L(p),p.forEach(m),this.h()},h(){h(u,"class","checkbox accent-white"),h(u,"type","checkbox"),u.disabled=l[1],h(e,"class","flex items-center space-x-2")},m(f,p){I(f,e,p),d(e,u),u.checked=l[0][l[8]],d(e,t),d(e,n),d(n,s),d(e,a),c||(i=Q(u,"change",o),c=!0)},p(f,p){l=f,p&2&&(u.disabled=l[1]),p&17&&(u.checked=l[0][l[8]])},d(f){f&&m(e),c=!1,i()}}}function T0(l){let e,u,t,n,r,s,a,c,i,o=Ae(Object.entries(l[4])),f=[];for(let p=0;p<o.length;p+=1)f[p]=l4(t4(l,o,p));return{c(){e=E("button"),u=oe(l[3]),t=y(),n=E("i"),r=y(),s=E("div"),a=E("div");for(let p=0;p<f.length;p+=1)f[p].c();this.h()},l(p){e=v(p,"BUTTON",{class:!0});var k=D(e);u=ce(k,l[3]),t=L(k),n=v(k,"I",{class:!0}),D(n).forEach(m),k.forEach(m),r=L(p),s=v(p,"DIV",{class:!0,"data-popup":!0});var A=D(s);a=v(A,"DIV",{});var S=D(a);for(let U=0;U<f.length;U+=1)f[U].l(S);S.forEach(m),A.forEach(m),this.h()},h(){h(n,"class","fa-solid fa-angle-down ml-1"),h(e,"class","chip variant-soft-primary flex items-center min-w-64"),me(e,"variant-soft-error",l[2]),h(s,"class","card p-4 w-150 shadow-xl z-10"),h(s,"data-popup","popupFeatured")},m(p,k){I(p,e,k),d(e,u),d(e,t),d(e,n),I(p,r,k),I(p,s,k),d(s,a);for(let A=0;A<f.length;A+=1)f[A]&&f[A].m(a,null);c||(i=C4(O4.call(null,e,l[5])),c=!0)},p(p,[k]){if(k&8&&Fe(u,p[3]),k&4&&me(e,"variant-soft-error",p[2]),k&19){o=Ae(Object.entries(p[4]));let A;for(A=0;A<o.length;A+=1){const S=t4(p,o,A);f[A]?f[A].p(S,k):(f[A]=l4(S),f[A].c(),f[A].m(a,null))}for(;A<f.length;A+=1)f[A].d(1);f.length=o.length}},i:P,o:P,d(p){p&&(m(e),m(r),m(s)),pu(f,p),c=!1,i()}}}function s4(l,e,u,t){const n=l%10,r=l%100;return r>=11&&r<=19?t:n===1?e:n>=2&&n<=4?u:t}function R0(l,e,u){let t,{disabled:n=!1}=e,{selected:r={НКРФ:!1,ГКРФ:!1,ТКРФ:!1,"Федеральный закон":!1,"Письмо Минфина":!1,"Письмо ФНС":!1,"Приказ ФНС":!1,"Постановление Правительства":!1,"Судебный документ":!1,ВНД:!1,"Бухгалтерский документ":!1}}=e;v4();let s={НКРФ:"НК РФ",ГКРФ:"ГК РФ",ТКРФ:"ТК РФ","Федеральный закон":"Федеральный Закон","Письмо Минфина":"Письмо Минфина","Письмо ФНС":"Письмо ФНС","Приказ ФНС":"Приказ ФНС","Постановление Правительства":"Постановление Правительства","Судебный документ":"Судебный документ",ВНД:"ВНД","Бухгалтерский документ":"ФСБУ"};const a={event:"click",target:"popupFeatured",placement:"bottom",middleware:{flip:{mainAxis:!1}}};let c="Выбрать типы источников для поиска";function i(o){r[o]=this.checked,u(0,r)}return l.$$set=o=>{"disabled"in o&&u(1,n=o.disabled),"selected"in o&&u(0,r=o.selected)},l.$$.update=()=>{l.$$.dirty&1&&u(2,t=Object.values(r).filter(o=>o===!0).length),l.$$.dirty&4&&u(3,c=t>0?`${s4(t,"Выбран","Выбрано","Выбрано")} ${t} ${s4(t,"тип","типа","типов")} источников`:"Выбрать типы источников для поиска")},[r,n,t,c,s,a,i]}class y0 extends ge{constructor(e){super(),be(this,e,R0,T0,_e,{disabled:1,selected:0})}}function n4(l){let e,u,t;function n(s){l[52](s)}let r={};return l[21]!==void 0&&(r.llmParams=l[21]),e=new D0({props:r}),ee.push(()=>se(e,"llmParams",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&2097152&&(u=!0,c.llmParams=s[21],le(()=>u=!1)),e.$set(c)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){T(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function r4(l){let e,u,t;function n(s){l[53](s)}let r={};return l[0].investigatorSettings!==void 0&&(r.settings=l[0].investigatorSettings),e=new T4({props:r}),ee.push(()=>se(e,"settings",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&1&&(u=!0,c.settings=s[0].investigatorSettings,le(()=>u=!1)),e.$set(c)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){T(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function a4(l){let e,u,t,n;function r(c){l[55](c)}function s(c){l[56](c)}let a={};return l[20]!==void 0&&(a.use_olympic=l[20]),l[19]!==void 0&&(a.use_qe=l[19]),e=new R4({props:a}),ee.push(()=>se(e,"use_olympic",r)),ee.push(()=>se(e,"use_qe",s)),{c(){W(e.$$.fragment)},l(c){Y(e.$$.fragment,c)},m(c,i){Z(e,c,i),n=!0},p(c,i){const o={};!u&&i[0]&1048576&&(u=!0,o.use_olympic=c[20],le(()=>u=!1)),!t&&i[0]&524288&&(t=!0,o.use_qe=c[19],le(()=>t=!1)),e.$set(o)},i(c){n||(F(e.$$.fragment,c),n=!0)},o(c){T(e.$$.fragment,c),n=!1},d(c){x(e,c)}}}function i4(l){let e,u='<i class="fa-solid fa-check"></i>';return{c(){e=E("span"),e.innerHTML=u},l(t){e=v(t,"SPAN",{"data-svelte-h":!0}),Le(e)!=="svelte-104b754"&&(e.innerHTML=u)},m(t,n){I(t,e,n)},d(t){t&&m(e)}}}function o4(l){let e,u,t,n,r,s;return r=new q4({}),{c(){e=E("div"),u=oe(l[14]),t=y(),n=E("div"),W(r.$$.fragment),this.h()},l(a){e=v(a,"DIV",{class:!0});var c=D(e);u=ce(c,l[14]),c.forEach(m),t=L(a),n=v(a,"DIV",{class:!0});var i=D(n);Y(r.$$.fragment,i),i.forEach(m),this.h()},h(){h(e,"class","loading-status svelte-fiifsz"),h(n,"class","loading-container svelte-fiifsz")},m(a,c){I(a,e,c),d(e,u),I(a,t,c),I(a,n,c),Z(r,n,null),s=!0},p(a,c){(!s||c[0]&16384)&&Fe(u,a[14])},i(a){s||(F(r.$$.fragment,a),s=!0)},o(a){T(r.$$.fragment,a),s=!1},d(a){a&&(m(e),m(t),m(n)),x(r)}}}function c4(l){let e,u;return e=new Y4({props:{onSave:l[38],onClose:l[39],text:l[9]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p(t,n){const r={};n[0]&512&&(r.text=t[9]),e.$set(r)},i(t){u||(F(e.$$.fragment,t),u=!0)},o(t){T(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function f4(l){let e,u,t,n;function r(a){l[61](a)}let s={enableDocumentDb:l[33],documentDbUrl:l[32]};return l[13]!==void 0&&(s.transactionMaps=l[13]),u=new d0({props:s}),ee.push(()=>se(u,"transactionMaps",r)),{c(){e=E("div"),W(u.$$.fragment),this.h()},l(a){e=v(a,"DIV",{class:!0});var c=D(e);Y(u.$$.fragment,c),c.forEach(m),this.h()},h(){h(e,"class","search-column svelte-fiifsz")},m(a,c){I(a,e,c),Z(u,e,null),n=!0},p(a,c){const i={};!t&&c[0]&8192&&(t=!0,i.transactionMaps=a[13],le(()=>t=!1)),u.$set(i)},i(a){n||(F(u.$$.fragment,a),n=!0)},o(a){T(u.$$.fragment,a),n=!1},d(a){a&&m(e),x(u)}}}function h4(l){let e,u='<div class="alert-message"><p>Не могу предоставить консультацию по вашему вопросу, т.к. поиск ничего не нашел.</p> <p>Пожалуйста, попробуйте переформулировать запрос.</p></div>';return{c(){e=E("aside"),e.innerHTML=u,this.h()},l(t){e=v(t,"ASIDE",{class:!0,style:!0,"data-svelte-h":!0}),Le(e)!=="svelte-1jj0c90"&&(e.innerHTML=u),this.h()},h(){h(e,"class","alert variant-filled"),xe(e,"margin","1rem")},m(t,n){I(t,e,n)},d(t){t&&m(e)}}}function m4(l){let e,u,t,n,r,s,a,c,i;function o(_){l[63](_)}function f(_){l[64](_)}function p(_){l[65](_)}function k(_){l[66](_)}function A(_){l[67](_)}function S(_){l[68](_)}function U(_){l[69](_)}let w={enableDocumentDb:l[33],documentDbUrl:l[32]};return l[0].search.searchResults!==void 0&&(w.searchResults=l[0].search.searchResults),l[11]!==void 0&&(w.usedSearchResults=l[11]),l[15]!==void 0&&(w.showFullText=l[15]),l[16]!==void 0&&(w.useSearchResult=l[16]),l[17]!==void 0&&(w.enableSearchResultSelection=l[17]),l[18]!==void 0&&(w.searchInTransactionLedger=l[18]),l[29]!==void 0&&(w.showOnlyLlmUsed=l[29]),e=new A4({props:w}),l[62](e),ee.push(()=>se(e,"searchResults",o)),ee.push(()=>se(e,"usedSearchResults",f)),ee.push(()=>se(e,"showFullText",p)),ee.push(()=>se(e,"useSearchResult",k)),ee.push(()=>se(e,"enableSearchResultSelection",A)),ee.push(()=>se(e,"searchInTransactionLedger",S)),ee.push(()=>se(e,"showOnlyLlmUsed",U)),{c(){W(e.$$.fragment)},l(_){Y(e.$$.fragment,_)},m(_,g){Z(e,_,g),i=!0},p(_,g){const B={};!u&&g[0]&1&&(u=!0,B.searchResults=_[0].search.searchResults,le(()=>u=!1)),!t&&g[0]&2048&&(t=!0,B.usedSearchResults=_[11],le(()=>t=!1)),!n&&g[0]&32768&&(n=!0,B.showFullText=_[15],le(()=>n=!1)),!r&&g[0]&65536&&(r=!0,B.useSearchResult=_[16],le(()=>r=!1)),!s&&g[0]&131072&&(s=!0,B.enableSearchResultSelection=_[17],le(()=>s=!1)),!a&&g[0]&262144&&(a=!0,B.searchInTransactionLedger=_[18],le(()=>a=!1)),!c&&g[0]&536870912&&(c=!0,B.showOnlyLlmUsed=_[29],le(()=>c=!1)),e.$set(B)},i(_){i||(F(e.$$.fragment,_),i=!0)},o(_){T(e.$$.fragment,_),i=!1},d(_){l[62](null),x(e,_)}}}function d4(l){let e,u,t;function n(s){l[70](s)}let r={};return l[0].search.explanations!==void 0&&(r.explanations=l[0].search.explanations),e=new S0({props:r}),ee.push(()=>se(e,"explanations",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&1&&(u=!0,c.explanations=s[0].search.explanations,le(()=>u=!1)),e.$set(c)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){T(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function p4(l){let e,u,t;function n(s){l[71](s)}let r={};return l[12]!==void 0&&(r.consultations=l[12]),e=new t0({props:r}),ee.push(()=>se(e,"consultations",n)),{c(){W(e.$$.fragment)},l(s){Y(e.$$.fragment,s)},m(s,a){Z(e,s,a),t=!0},p(s,a){const c={};!u&&a[0]&4096&&(u=!0,c.consultations=s[12],le(()=>u=!1)),e.$set(c)},i(s){t||(F(e.$$.fragment,s),t=!0)},o(s){T(e.$$.fragment,s),t=!1},d(s){x(e,s)}}}function L0(l){let e,u,t,n,r=l[0].search?.searchResults&&m4(l),s=l[0].search?.explanations&&d4(l),a=l[12]&&l[12].length>0&&p4(l);return{c(){e=E("div"),r&&r.c(),u=y(),s&&s.c(),t=y(),a&&a.c(),this.h()},l(c){e=v(c,"DIV",{class:!0});var i=D(e);r&&r.l(i),u=L(i),s&&s.l(i),t=L(i),a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class","search-column svelte-fiifsz")},m(c,i){I(c,e,i),r&&r.m(e,null),d(e,u),s&&s.m(e,null),d(e,t),a&&a.m(e,null),n=!0},p(c,i){c[0].search?.searchResults?r?(r.p(c,i),i[0]&1&&F(r,1)):(r=m4(c),r.c(),F(r,1),r.m(e,u)):r&&(Se(),T(r,1,1,()=>{r=null}),Te()),c[0].search?.explanations?s?(s.p(c,i),i[0]&1&&F(s,1)):(s=d4(c),s.c(),F(s,1),s.m(e,t)):s&&(Se(),T(s,1,1,()=>{s=null}),Te()),c[12]&&c[12].length>0?a?(a.p(c,i),i[0]&4096&&F(a,1)):(a=p4(c),a.c(),F(a,1),a.m(e,null)):a&&(Se(),T(a,1,1,()=>{a=null}),Te())},i(c){n||(F(r),F(s),F(a),n=!0)},o(c){T(r),T(s),T(a),n=!1},d(c){c&&m(e),r&&r.d(),s&&s.d(),a&&a.d()}}}function _4(l){let e,u=l[0].llmFinalAnswer.replaceAll(`
`,"<br>")+"",t;return{c(){e=new D4(!1),t=yu(),this.h()},l(n){e=w4(n,!1),t=yu(),this.h()},h(){e.a=t},m(n,r){e.m(u,n,r),I(n,t,r)},p(n,r){r[0]&1&&u!==(u=n[0].llmFinalAnswer.replaceAll(`
`,"<br>")+"")&&e.p(u)},d(n){n&&(m(t),e.d())}}}function g4(l){let e,u;return e=new E0({props:{onSubmit:l[46]}}),{c(){W(e.$$.fragment)},l(t){Y(e.$$.fragment,t)},m(t,n){Z(e,t,n),u=!0},p:P,i(t){u||(F(e.$$.fragment,t),u=!0)},o(t){T(e.$$.fragment,t),u=!1},d(t){x(e,t)}}}function I0(l){let e,u,t,n="Получить ответ",r,s,a="Уточнить ответ",c,i,o,f,p="Скачать ответ в Word",k,A,S,U,w=(l[24]&&l[3]||!l[24]&&!l[3]||l[24]&&l[0].llmFinalAnswer&&!l[22]||l[0].llmFinalAnswer&&l[22]&&l[23])&&_4(l),_=l[0].llmFinalAnswer&&l[25]&&l[34]&&g4(l);return{c(){e=E("div"),u=E("div"),t=E("button"),t.textContent=n,r=y(),s=E("button"),s.textContent=a,c=y(),i=E("div"),w&&w.c(),o=y(),f=E("button"),f.textContent=p,k=y(),_&&_.c(),this.h()},l(g){e=v(g,"DIV",{class:!0});var B=D(e);u=v(B,"DIV",{class:!0});var R=D(u);t=v(R,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(t)!=="svelte-1fu5ju8"&&(t.textContent=n),r=L(R),s=v(R,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(s)!=="svelte-1jv1usb"&&(s.textContent=a),c=L(R),i=v(R,"DIV",{class:!0});var j=D(i);w&&w.l(j),j.forEach(m),o=L(R),f=v(R,"BUTTON",{class:!0,"data-svelte-h":!0}),Le(f)!=="svelte-1n8n71z"&&(f.textContent=p),k=L(R),_&&_.l(R),R.forEach(m),B.forEach(m),this.h()},h(){h(t,"class","btn variant-filled"),me(t,"hidden",!(l[17]&&(l[0].search?.searchResults||[]).length>0&&!l[27])),h(s,"class","btn variant-filled"),me(s,"hidden",!l[27]||!l[28]),h(i,"class","textarea svelte-fiifsz"),h(f,"class","btn variant-filled mb-4 mt-4"),me(f,"hidden",!l[0].llmFinalAnswer),h(u,"class","textarea svelte-fiifsz"),h(e,"class","textarea-column svelte-fiifsz")},m(g,B){I(g,e,B),d(e,u),d(u,t),d(u,r),d(u,s),d(u,c),d(u,i),w&&w.m(i,null),d(u,o),d(u,f),d(u,k),_&&_.m(u,null),A=!0,S||(U=[Q(t,"click",l[45]),Q(s,"click",l[43]),Q(f,"click",l[47])],S=!0)},p(g,B){(!A||B[0]&134348801)&&me(t,"hidden",!(g[17]&&(g[0].search?.searchResults||[]).length>0&&!g[27])),(!A||B[0]&402653184)&&me(s,"hidden",!g[27]||!g[28]),g[24]&&g[3]||!g[24]&&!g[3]||g[24]&&g[0].llmFinalAnswer&&!g[22]||g[0].llmFinalAnswer&&g[22]&&g[23]?w?w.p(g,B):(w=_4(g),w.c(),w.m(i,null)):w&&(w.d(1),w=null),(!A||B[0]&1)&&me(f,"hidden",!g[0].llmFinalAnswer),g[0].llmFinalAnswer&&g[25]&&g[34]?_?(_.p(g,B),B[0]&33554433&&F(_,1)):(_=g4(g),_.c(),F(_,1),_.m(u,null)):_&&(Se(),T(_,1,1,()=>{_=null}),Te())},i(g){A||(F(_),A=!0)},o(g){T(_),A=!1},d(g){g&&m(e),w&&w.d(),_&&_.d(),S=!1,wu(U)}}}function N0(l){let e,u,t,n;return e=new Pu({props:{minSize:20,class:"search-column",size:49,$$slots:{default:[L0]},$$scope:{ctx:l}}}),t=new Pu({props:{size:49,$$slots:{default:[I0]},$$scope:{ctx:l}}}),{c(){W(e.$$.fragment),u=y(),W(t.$$.fragment)},l(r){Y(e.$$.fragment,r),u=L(r),Y(t.$$.fragment,r)},m(r,s){Z(e,r,s),I(r,u,s),Z(t,r,s),n=!0},p(r,s){const a={};s[0]&537368705|s[3]&1&&(a.$$scope={dirty:s,ctx:r}),e.$set(a);const c={};s[0]&465698825|s[3]&1&&(c.$$scope={dirty:s,ctx:r}),t.$set(c)},i(r){n||(F(e.$$.fragment,r),F(t.$$.fragment,r),n=!0)},o(r){T(e.$$.fragment,r),T(t.$$.fragment,r),n=!1},d(r){r&&m(u),x(e,r),x(t,r)}}}function U0(l){let e,u,t,n,r,s,a,c,i,o,f,p,k,A,S,U,w,_,g,B,R,j,qe,Ee,fe,O=l[28]?"Свернуть уточнение":"Уточнить",Ie,he,$e,Re,V,ru,Je,bu="Искать карту проводок по вопросу",au,Be,$,je,He,Xe,de,iu,eu,ou,ke,uu,ye,ve,ze,cu,Ke,Ne,tu=l[13]&&Object.keys(l[13]).length>0,lu,fu,We,Qe,Ce,Eu,vu;r=new z4({props:{disableIntervalChecks:!!l[36]}}),a=new J4({props:{disableIntervalChecks:!!l[36]}});function Fu(b){l[51](b)}let Ue={};l[31]!==void 0&&(Ue.selectedLLM=l[31]),i=new U4({props:Ue}),ee.push(()=>se(i,"selectedLLM",Fu));let H=l[21]&&n4(l),q=l[0].useInvestigator&&l[0].investigatorSettings!==null&&r4(l),G=!l[6]&&a4(l),ne=l[6]&&i4();function Lu(b){l[58](b)}function re(b){l[59](b)}let Cu={};l[18]!==void 0&&(Cu.disabled=l[18]),l[10]!==void 0&&(Cu.selected=l[10]),$=new y0({props:Cu}),ee.push(()=>se($,"disabled",Lu)),ee.push(()=>se($,"selected",re));let J=(l[2]||l[3])&&o4(l);function Iu(b){l[60](b)}let Au={};l[1]!==void 0&&(Au.llmClarification=l[1]),ve=new n0({props:Au}),ee.push(()=>se(ve,"llmClarification",Iu));let X=l[8]&&c4(l),K=tu&&f4(l),ae=l[26]&&h4();return Qe=new F4({props:{theme:"modern-theme",$$slots:{default:[N0]},$$scope:{ctx:l}}}),{c(){e=E("div"),u=E("div"),t=E("div"),n=E("div"),W(r.$$.fragment),s=y(),W(a.$$.fragment),c=y(),W(i.$$.fragment),f=y(),H&&H.c(),p=y(),q&&q.c(),k=y(),A=E("section"),S=E("div"),U=E("div"),w=E("textarea"),_=y(),g=E("div"),B=E("div"),R=E("a"),j=E("i"),qe=oe(" Справка"),Ee=y(),fe=E("button"),Ie=oe(O),$e=y(),G&&G.c(),Re=y(),V=E("button"),ne&&ne.c(),ru=y(),Je=E("span"),Je.textContent=bu,Be=y(),W($.$$.fragment),Xe=y(),de=E("button"),iu=oe(l[30]),ou=y(),ke=E("div"),J&&J.c(),uu=y(),ye=E("div"),W(ve.$$.fragment),cu=y(),X&&X.c(),Ke=y(),Ne=E("div"),K&&K.c(),lu=y(),ae&&ae.c(),fu=y(),We=E("div"),W(Qe.$$.fragment),this.h()},l(b){e=v(b,"DIV",{class:!0});var N=D(e);u=v(N,"DIV",{class:!0});var hu=D(u);t=v(hu,"DIV",{class:!0});var su=D(t);n=v(su,"DIV",{class:!0});var pe=D(n);Y(r.$$.fragment,pe),s=L(pe),Y(a.$$.fragment,pe),c=L(pe),Y(i.$$.fragment,pe),f=L(pe),H&&H.l(pe),p=L(pe),q&&q.l(pe),pe.forEach(m),su.forEach(m),hu.forEach(m),N.forEach(m),k=L(b),A=v(b,"SECTION",{});var mu=D(A);S=v(mu,"DIV",{class:!0});var ue=D(S);U=v(ue,"DIV",{class:!0});var Bu=D(U);w=v(Bu,"TEXTAREA",{class:!0,rows:!0,placeholder:!0}),D(w).forEach(m),Bu.forEach(m),_=L(ue),g=v(ue,"DIV",{class:!0});var ku=D(g);B=v(ku,"DIV",{class:!0});var De=D(B);R=v(De,"A",{href:!0,target:!0,rel:!0,class:!0});var Du=D(R);j=v(Du,"I",{class:!0}),D(j).forEach(m),qe=ce(Du," Справка"),Du.forEach(m),Ee=L(De),fe=v(De,"BUTTON",{class:!0});var Su=D(fe);Ie=ce(Su,O),Su.forEach(m),$e=L(De),G&&G.l(De),Re=L(De),V=v(De,"BUTTON",{class:!0});var _u=D(V);ne&&ne.l(_u),ru=L(_u),Je=v(_u,"SPAN",{"data-svelte-h":!0}),Le(Je)!=="svelte-1cu0b9t"&&(Je.textContent=bu),_u.forEach(m),Be=L(De),Y($.$$.fragment,De),Xe=L(De),de=v(De,"BUTTON",{title:!0,class:!0});var Tu=D(de);iu=ce(Tu,l[30]),Tu.forEach(m),De.forEach(m),ku.forEach(m),ou=L(ue),ke=v(ue,"DIV",{class:!0});var C=D(ke);J&&J.l(C),C.forEach(m),uu=L(ue),ye=v(ue,"DIV",{class:!0});var z=D(ye);Y(ve.$$.fragment,z),z.forEach(m),cu=L(ue),X&&X.l(ue),Ke=L(ue),Ne=v(ue,"DIV",{class:!0});var M=D(Ne);K&&K.l(M),M.forEach(m),lu=L(ue),ae&&ae.l(ue),fu=L(ue),We=v(ue,"DIV",{});var te=D(We);Y(Qe.$$.fragment,te),te.forEach(m),ue.forEach(m),mu.forEach(m),this.h()},h(){h(n,"class","flex-wrap justify-between"),h(t,"class","status-components justify-between align-middle flex m-2"),h(u,"class","mx-auto flex items-center justify-between"),h(e,"class","absolute top-0 left-0 w-full bg-black text-white shadow-lg z-50 h-15"),me(e,"hidden",!l[35]),h(w,"class","auto-expand-textarea rounded-sm svelte-fiifsz"),h(w,"rows","1"),h(w,"placeholder","Введите ваш запрос (Ctrl+Enter для отправки)"),h(U,"class","grow-wrap w-full svelte-fiifsz"),h(j,"class","fa-regular fa-circle-question"),h(R,"href",`${l[32]}file/view/id/${l[37]}`),h(R,"target","_blank"),h(R,"rel","noopener noreferrer"),h(R,"class","btn variant-outline-tertiary reference-btn svelte-fiifsz"),h(fe,"class",he="chip "+(l[28]?"variant-filled-primary":"variant-soft-primary")),me(fe,"hidden",!l[4]),h(V,"class",au="chip "+(l[6]?"variant-filled-primary":"variant-soft-primary")),V.disabled=!0,h(de,"title","Ctrl+Enter"),de.disabled=eu=!l[5]&&!l[14],h(de,"class","btn variant-filled-primary w-40"),h(B,"class","flex justify-end flex-wrap gap-2 m-2 mr-0 ml-0"),h(g,"class","search-second-bar w-full flex justify-end svelte-fiifsz"),h(ke,"class","flex space-x-2 items-center justify-center w-full"),h(ye,"class","w-full"),me(ye,"hidden",!l[28]),h(Ne,"class","w-full my-2"),me(We,"hidden",!(((l[0].search?.searchResults||[]).length>0||l[12]&&l[12].length>0)&&!l[18])),h(S,"class","search-bar flex flex-wrap px-2 pt-2 svelte-fiifsz"),me(A,"mt-16",l[35])},m(b,N){I(b,e,N),d(e,u),d(u,t),d(t,n),Z(r,n,null),d(n,s),Z(a,n,null),d(n,c),Z(i,n,null),d(n,f),H&&H.m(n,null),d(n,p),q&&q.m(n,null),I(b,k,N),I(b,A,N),d(A,S),d(S,U),d(U,w),nu(w,l[5]),d(S,_),d(S,g),d(g,B),d(B,R),d(R,j),d(R,qe),d(B,Ee),d(B,fe),d(fe,Ie),d(B,$e),G&&G.m(B,null),d(B,Re),d(B,V),ne&&ne.m(V,null),d(V,ru),d(V,Je),d(B,Be),Z($,B,null),d(B,Xe),d(B,de),d(de,iu),d(S,ou),d(S,ke),J&&J.m(ke,null),d(S,uu),d(S,ye),Z(ve,ye,null),d(S,cu),X&&X.m(S,null),d(S,Ke),d(S,Ne),K&&K.m(Ne,null),d(S,lu),ae&&ae.m(S,null),d(S,fu),d(S,We),Z(Qe,We,null),Ce=!0,Eu||(vu=[Q(w,"input",l[54]),Q(w,"input",l[41]),Q(w,"keydown",l[42]),Q(fe,"click",l[40]),Q(V,"click",l[57]),Q(de,"click",l[44])],Eu=!0)},p(b,N){const hu={};!o&&N[1]&1&&(o=!0,hu.selectedLLM=b[31],le(()=>o=!1)),i.$set(hu),b[21]?H?(H.p(b,N),N[0]&2097152&&F(H,1)):(H=n4(b),H.c(),F(H,1),H.m(n,p)):H&&(Se(),T(H,1,1,()=>{H=null}),Te()),b[0].useInvestigator&&b[0].investigatorSettings!==null?q?(q.p(b,N),N[0]&1&&F(q,1)):(q=r4(b),q.c(),F(q,1),q.m(n,null)):q&&(Se(),T(q,1,1,()=>{q=null}),Te()),N[0]&32&&nu(w,b[5]),(!Ce||N[0]&268435456)&&O!==(O=b[28]?"Свернуть уточнение":"Уточнить")&&Fe(Ie,O),(!Ce||N[0]&268435456&&he!==(he="chip "+(b[28]?"variant-filled-primary":"variant-soft-primary")))&&h(fe,"class",he),(!Ce||N[0]&268435472)&&me(fe,"hidden",!b[4]),b[6]?G&&(Se(),T(G,1,1,()=>{G=null}),Te()):G?(G.p(b,N),N[0]&64&&F(G,1)):(G=a4(b),G.c(),F(G,1),G.m(B,Re)),b[6]?ne||(ne=i4(),ne.c(),ne.m(V,ru)):ne&&(ne.d(1),ne=null),(!Ce||N[0]&64&&au!==(au="chip "+(b[6]?"variant-filled-primary":"variant-soft-primary")))&&h(V,"class",au);const su={};!je&&N[0]&262144&&(je=!0,su.disabled=b[18],le(()=>je=!1)),!He&&N[0]&1024&&(He=!0,su.selected=b[10],le(()=>He=!1)),$.$set(su),(!Ce||N[0]&1073741824)&&Fe(iu,b[30]),(!Ce||N[0]&16416&&eu!==(eu=!b[5]&&!b[14]))&&(de.disabled=eu),b[2]||b[3]?J?(J.p(b,N),N[0]&12&&F(J,1)):(J=o4(b),J.c(),F(J,1),J.m(ke,null)):J&&(Se(),T(J,1,1,()=>{J=null}),Te());const pe={};!ze&&N[0]&2&&(ze=!0,pe.llmClarification=b[1],le(()=>ze=!1)),ve.$set(pe),(!Ce||N[0]&268435456)&&me(ye,"hidden",!b[28]),b[8]?X?(X.p(b,N),N[0]&256&&F(X,1)):(X=c4(b),X.c(),F(X,1),X.m(S,Ke)):X&&(Se(),T(X,1,1,()=>{X=null}),Te()),N[0]&8192&&(tu=b[13]&&Object.keys(b[13]).length>0),tu?K?(K.p(b,N),N[0]&8192&&F(K,1)):(K=f4(b),K.c(),F(K,1),K.m(Ne,null)):K&&(Se(),T(K,1,1,()=>{K=null}),Te()),b[26]?ae||(ae=h4(),ae.c(),ae.m(S,fu)):ae&&(ae.d(1),ae=null);const mu={};N[0]&1002936457|N[3]&1&&(mu.$$scope={dirty:N,ctx:b}),Qe.$set(mu),(!Ce||N[0]&266241)&&me(We,"hidden",!(((b[0].search?.searchResults||[]).length>0||b[12]&&b[12].length>0)&&!b[18]))},i(b){Ce||(F(r.$$.fragment,b),F(a.$$.fragment,b),F(i.$$.fragment,b),F(H),F(q),F(G),F($.$$.fragment,b),F(J),F(ve.$$.fragment,b),F(X),F(K),F(Qe.$$.fragment,b),Ce=!0)},o(b){T(r.$$.fragment,b),T(a.$$.fragment,b),T(i.$$.fragment,b),T(H),T(q),T(G),T($.$$.fragment,b),T(J),T(ve.$$.fragment,b),T(X),T(K),T(Qe.$$.fragment,b),Ce=!1},d(b){b&&(m(e),m(k),m(A)),x(r),x(a),x(i),H&&H.d(),q&&q.d(),G&&G.d(),ne&&ne.d(),x($),J&&J.d(),x(ve),X&&X.d(),K&&K.d(),ae&&ae.d(),x(Qe),Eu=!1,wu(vu)}}}let b4=!1,O0="";function M0(l,e,u){let{data:t}=e;const{ENV_DOCUMENT_DB_URL:n,ENV_ENABLE_DOCUMENT_DB:r,ENV_ENABLE_DB_SUPPORT:s,ENV_ENABLE_DEV_FEATURES:a,ENV_DISABLE_HEALTH_CHECKS:c,ENV_FAQ_DOCUMENT_ID:i}=t;let o=t.Model,f,p="",k=!1,A=y4,S={НКРФ:!1,ГКРФ:!1,ТКРФ:!1,"Федеральный закон":!1,"Письмо Минфина":!1,"Письмо ФНС":!1,"Приказ ФНС":!1,"Постановление Правительства":!1,"Судебный документ":!1,ВНД:!1,"Бухгалтерский документ":!1};function U(C){u(9,A=C)}function w(){u(8,k=!1)}Uu(()=>{q()});let _=[],g=[],B=null,R=!1,j=!1,qe=!1,Ee="",fe=!0,O="",Ie="",he="",$e=[];Array(g.length).fill(!1);let Re,V=!1,ru=!0,Je=!0,bu=!1,au=!0,Be=!1,$=!0,je=!1,He=!1,Xe=N4.llm_params,de=!1,iu=!1,eu=!1,ou=!1,ke=!1,uu=!1,ye=!1,ve=!1,ze=!1,cu,Ke=null,Ne,tu=-1,lu=-1,fu="Отправить";const We=async C=>{u(28,ve=!ve)},Qe=C=>{u(5,O=C.target.value);const z=C.target.parentNode;z&&(z.dataset.replicatedValue=O)},Ce=C=>{C.ctrlKey&&C.key==="Enter"&&(C.preventDefault(),H())};async function Eu(){if(!(p&&Ee)||(fe=!1,!o.search?.searchResults))return;let C=o.search.searchResults,z=o.search.explanations;if(u(3,j=!0),u(14,he="Преобразуем результаты поиска в запрос для ИИ"),V&&(C=o.search.searchResults.filter((te,we)=>Re[te.title]),!C)){u(0,o.llmFinalAnswer="Выберите хотя бы один документ из результатов поиска.",o);return}let M=Ge.convertSearchResultsToLlmSources(C,uu?g:null,z);if(M){let te="",we="",Oe=Ru.Clarification,ie={...re,name:re.name.replace(" (изменено)","")};V?(we=re.predict_params?.user_selected_sources_clarification_system_prompt||"",te=re.predict_params?.user_selected_sources_clarification_prompt||"",Oe=Ru.UserSelectedSearchResults):(we=re.predict_params?.clarification_prompt||"",te=re.predict_params?.clarification_system_prompt||"");const gu=te+we+(o.search.modifiedQuery||O),du=await Ge.sendTrimByTokens(ie.name,M,gu,Ue);M=du.result,tu=du.originalTokenCount,lu=du.slicedTokenCount;const Ye=Ge.buildClarificationPrompt(o.search.modifiedQuery||O,M,Ee,p,we);u(0,o.llmFinalAnswer="",o),await Fu(Ye,Ne,ie,Oe)}}const vu=async C=>{if(!o.search?.searchResults)return;let z=o.search.searchResults,M=o.search.explanations;if(u(3,j=!0),u(14,he="Преобразуем результаты поиска в запрос для ИИ"),V&&(z=o.search.searchResults.filter((we,Oe)=>Re[we.title]),!z)){u(0,o.llmFinalAnswer="Выберите хотя бы один документ из результатов поиска.",o);return}let te=Ge.convertSearchResultsToLlmSources(z,uu?g:null,M);if(te){let we="",Oe="",ie=Ru.Regular,gu={...re,name:re.name.replace(" (изменено)","")};if(o.useInvestigator&&o.investigatorSettings){const du=we+Oe+(o.search.modifiedQuery||O),Ye=await Ge.sendTrimByTokens(gu.name,te,du,Ue);te=Ye.result,tu=Ye.originalTokenCount,lu=Ye.slicedTokenCount;const Nu={llm_params:Xe,query:""},Ou=new L4(o.investigatorSettings,Nu,5);o.investigatorSettings&&Ou.applySettings(o.investigatorSettings);const Mu=await Ou.getResponse(O,te,Ue);u(0,o.llmFinalAnswer=Mu.result,o),u(14,he=""),u(3,j=!1),console.log(Mu.generatedQA)}else{V?(Oe=re.predict_params?.user_selected_sources_prompt||"",we=re.predict_params?.user_selected_sources_system_prompt||"",ie=Ru.UserSelectedSearchResults):(Oe=re.predict_params?.user_prompt||"",we=re.predict_params?.system_prompt||"");const du=we+Oe+(o.search.modifiedQuery||O),Ye=await Ge.sendTrimByTokens(gu.name,te,du,Ue);te=Ye.result,tu=Ye.originalTokenCount,lu=Ye.slicedTokenCount;const Nu=Ge.buildLlmResponsePrompt(o.search.modifiedQuery||O,te,Oe);u(0,o.llmFinalAnswer="",o),await Fu(Nu,o.search.modifiedQuery,gu,ie)}}},Fu=async(C,z,M,te)=>{u(3,j=!0),u(14,he="Запрос поставлен в очередь на генерацию ответа"),u(50,Ie=O);const we=ie=>{u(14,he=ie)};u(0,o.llmFinalAnswer=await Ge.doRequest(M.name,C,te,1,Ue,we,null,M.predict_params,"Конец ответ"),o),u(0,o.llmFinalAnswer=Ge.postProcessLlmAnswer(o.llmFinalAnswer),o);const Oe=await ju.extractUsedSearchResults(o.llmFinalAnswer,o.search?.searchResults||[]);u(29,ze=!0),u(11,_=Oe.searchResults),f.blinkButton(),de||(u(14,he=""),u(3,j=!1),u(25,ou=!0),u(4,Ee=o.llmFinalAnswer),Ke=await qu.log({consultations:(g||[]).map(ie=>JSON.stringify(ie)),explanations:(o.search?.explanations||[]).map(ie=>JSON.stringify(ie)),llmPrompt:C,llmResponse:o.llmFinalAnswer,searchResults:o.search?.searchResults.map(ie=>JSON.stringify(ie)),selectedSearchResults:o.search?.searchResults.filter((ie,gu)=>Re[ie.title]).map(ie=>JSON.stringify(ie)),userScore:void 0,userComment:O0,userRequest:O,modifiedUserRequest:z,searchMetrics:cu,requestOriginalTokenCount:tu,requestSlicedTokenCount:lu,uiSettings:{enableSearchResultSelection:V,enableLLMForTeasers:He,doMultistepSearch:je,useAccountingDocs:ru,useReranking:Je,useLLMForFiltering:bu,disableThresholds:au,searchInTransactionLedgerByOperation:b4,searchInTransactionLedgerByQuestion:$,useShortestPrompt:de,enableRealtimeLlmReponse:eu,sendConsultationToLlm:uu}}))};let Ue=new AbortController;const H=async C=>{if(j||R){await q();return}if(!O)return;u(15,$e=Array(10).fill(!1)),Array(10).fill(!1),u(16,Re={}),u(0,o.llmFinalAnswer="",o),u(4,Ee=""),fe=!0,u(23,iu=!1),u(25,ou=!1),u(2,R=!0),u(3,j=!1),u(49,qe=!0),u(26,ke=!1),u(11,_=[]),u(29,ze=!1),cu=void 0,u(14,he="Ищем релевантные документы"),Ne=void 0,u(28,ve=!1),u(1,p="");let z;try{const M=await ju.doRequest({query:O,use_olympic:He,use_qe:je,find_transaction_maps_by_question:$,find_transaction_maps_by_operation:b4,categories:S,llm_params:Xe},Ue);u(0,o.search=M,o),Ne=M.modifiedQuery,u(12,g=M.relevantConsultations),z=M.explanations||[],u(13,B=M.transactionMaps||null),cu=M.metrics,u(26,ke=Be&&!B),u(14,he=""),u(2,R=!1),u(49,qe=!1)}catch(M){if(u(26,ke=!0),M instanceof Error&&M.name==="AbortError")alert("Сервис поиска не отвечает. Попробуйте изменить и повторить запрос"),console.error("Request was aborted due to timeout"),M.message&&console.error("Fetch error:",M.message);else throw console.error("Fetch error:",M),M}finally{u(14,he=""),u(2,R=!1),u(26,ke=!1),u(49,qe=!1)}Be||(o.search?.searchResults||[]).length>0&&(V||await vu())},q=()=>{Ue.abort("user canceled"),Ue=new AbortController,u(3,j=!1),u(14,he=""),Ke=null,u(49,qe=!1),fe=!0,u(2,R=!1),u(11,_=[]),u(29,ze=!1)};async function G(){u(0,o.llmFinalAnswer="",o),u(4,Ee=""),fe=!0,await q(),setTimeout(async()=>{console.log(fe),await vu()},1e3)}async function ne(C){console.log(`Оценка: ${C.rating} звезд, Комментарий: ${C.comment}`),Ke!==null&&await qu.logUserScore(Ke,C.rating,C.comment)}async function Lu(){let C={consultations:(g||[]).map(z=>JSON.stringify(z)),explanations:(o.search?.explanations||[]).map(z=>JSON.stringify(z)),llmResponse:o.llmFinalAnswer,searchResults:o.search?.searchResults.map(z=>({title:z.title,text:z.text_for_llm||z.text})),userRequest:O,uiSettings:{enableSearchResultSelection:V,enableOlympicSearch:He,enableQueryExpansionSearch:je}};_0.createDocxFromObject(C)}let re;function Cu(C){re=C,u(31,re)}function J(C){Xe=C,u(21,Xe)}function Iu(C){l.$$.not_equal(o.investigatorSettings,C)&&(o.investigatorSettings=C,u(0,o))}function Au(){O=this.value,u(5,O)}function X(C){He=C,u(20,He)}function K(C){je=C,u(19,je)}const ae=()=>{u(6,$=!$)};function b(C){Be=C,u(18,Be),u(6,$),u(1,p),u(0,o),u(4,Ee),u(50,Ie),u(5,O),u(3,j)}function N(C){S=C,u(10,S)}function hu(C){p=C,u(1,p)}function su(C){B=C,u(13,B)}function pe(C){ee[C?"unshift":"push"](()=>{f=C,u(7,f)})}function mu(C){l.$$.not_equal(o.search.searchResults,C)&&(o.search.searchResults=C,u(0,o))}function ue(C){_=C,u(11,_)}function Bu(C){$e=C,u(15,$e)}function ku(C){Re=C,u(16,Re)}function De(C){V=C,u(17,V),u(6,$),u(1,p),u(0,o),u(4,Ee),u(50,Ie),u(5,O),u(3,j)}function Du(C){Be=C,u(18,Be),u(6,$),u(1,p),u(0,o),u(4,Ee),u(50,Ie),u(5,O),u(3,j)}function Su(C){ze=C,u(29,ze)}function _u(C){l.$$.not_equal(o.search.explanations,C)&&(o.search.explanations=C,u(0,o))}function Tu(C){g=C,u(12,g)}return l.$$set=C=>{"data"in C&&u(48,t=C.data)},l.$$.update=()=>{l.$$.dirty[0]&123|l.$$.dirty[1]&524288&&($?(u(18,Be=!0),u(17,V=!1),ru=!1,Je=!1,bu=!1,au=!1,u(22,de=!1),u(24,eu=!1),uu=!1):u(18,Be=!1),p&&(o.search?.searchResults||[]).length>0&&Ee&&Ie==O&&!j?u(27,ye=!0):u(27,ye=!1)),l.$$.dirty[0]&12|l.$$.dirty[1]&262144&&u(30,fu=qe||j||R?"Стоп":"Отправить")},[o,p,R,j,Ee,O,$,f,k,A,S,_,g,B,he,$e,Re,V,Be,je,He,Xe,de,iu,eu,ou,ke,ye,ve,ze,fu,re,n,r,s,a,c,i,U,w,We,Qe,Ce,Eu,H,G,ne,Lu,t,qe,Ie,Cu,J,Iu,Au,X,K,ae,b,N,hu,su,pe,mu,ue,Bu,ku,De,Du,Su,_u,Tu]}class Z0 extends ge{constructor(e){super(),be(this,e,M0,U0,_e,{data:48},null,[-1,-1,-1,-1])}}export{Z0 as component,Y0 as universal};