|
import{b as lt,P as Ie,L as We,e as T,c as j,d as C,f as P,j as O,i as m,a8 as ct,u as h,B as ne,k as S,l as A,w as z,M as Ge,N as Qe,O as Je,r as mt,a9 as ft,R as Et,Q as Ve,S as te,p as Me,t as ye,q as me,h as Ae,n as kt,I as At,s as Xe,T as Zt,g as Ye,o as qe,A as xt,F as Pe,aa as he,ab as Jt,x as Ze,v as Tt,m as dt,H as Oe,C as Ne}from"../chunks/scheduler.5WtVptCO.js";import{S as nt,i as st,a as M,g as Ce,t as W,f as Le,c as Fe,d as Ue,m as ze,e as je,b as xe}from"../chunks/index.7IiDzEZn.js";import{e as ht,u as Kt,o as $t,d as el}from"../chunks/each.C7pZUaX1.js";import{w as De}from"../chunks/index.G3yBo0_P.js";import{E as Ct}from"../chunks/exceljs.min.OMVfBD1L.js";import"../chunks/ProgressBar.svelte_svelte_type_style_lang.7yc35pDe.js";import{g as Xt}from"../chunks/ModalPromptEditor.x-CfuIKj.js";import{S as tl,I as ll,L as Be,a as nl,U as Lt}from"../chunks/InvestigatorSettings.Y2o9I9Xj.js";import{S as sl}from"../chunks/SearchUtils.dqpKCG0P.js";import{L as Yt}from"../chunks/LlmSelector.Snki38ql.js";const al=t=>({}),It=t=>({}),ul=t=>({}),Dt=t=>({}),rl=t=>({}),wt=t=>({});function St(t){let e,l,s;const n=t[18].lead,a=We(n,t,t[17],wt);return{c(){e=T("div"),a&&a.c(),this.h()},l(r){e=C(r,"DIV",{class:!0});var i=P(e);a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class",l="dropzone-lead "+t[5])},m(r,i){S(r,e,i),a&&a.m(e,null),s=!0},p(r,i){a&&a.p&&(!s||i[0]&131072)&&Ge(a,n,r,r[17],s?Je(n,r[17],i,rl):Qe(r[17]),wt),(!s||i[0]&32&&l!==(l="dropzone-lead "+r[5]))&&h(e,"class",l)},i(r){s||(M(a,r),s=!0)},o(r){W(a,r),s=!1},d(r){r&&m(e),a&&a.d(r)}}}function il(t){let e,l="Upload a file",s;return{c(){e=T("strong"),e.textContent=l,s=ye(" or drag and drop")},l(n){e=C(n,"STRONG",{"data-svelte-h":!0}),me(e)!=="svelte-13uz6lq"&&(e.textContent=l),s=Ae(n," or drag and drop")},m(n,a){S(n,e,a),S(n,s,a)},p:kt,d(n){n&&(m(e),m(s))}}}function Rt(t){let e,l,s;const n=t[18].meta,a=We(n,t,t[17],It);return{c(){e=T("small"),a&&a.c(),this.h()},l(r){e=C(r,"SMALL",{class:!0});var i=P(e);a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class",l="dropzone-meta "+t[7])},m(r,i){S(r,e,i),a&&a.m(e,null),s=!0},p(r,i){a&&a.p&&(!s||i[0]&131072)&&Ge(a,n,r,r[17],s?Je(n,r[17],i,al):Qe(r[17]),It),(!s||i[0]&128&&l!==(l="dropzone-meta "+r[7]))&&h(e,"class",l)},i(r){s||(M(a,r),s=!0)},o(r){W(a,r),s=!1},d(r){r&&m(e),a&&a.d(r)}}}function ol(t){let e,l,s,n,a,r,i,o,u,c,E,_,I,D,F,U,N=[{type:"file"},{name:t[2]},{class:s="dropzone-input "+t[9]},t[11]()],g={};for(let k=0;k<N.length;k+=1)g=Ie(g,N[k]);let B=t[13].lead&&St(t);const V=t[18].message,p=We(V,t,t[17],Dt),w=p||il();let R=t[13].meta&&Rt(t);return{c(){e=T("div"),l=T("input"),n=j(),a=T("div"),r=T("div"),B&&B.c(),i=j(),o=T("div"),w&&w.c(),c=j(),R&&R.c(),this.h()},l(k){e=C(k,"DIV",{class:!0,"data-testid":!0});var f=P(e);l=C(f,"INPUT",{type:!0,name:!0,class:!0}),n=O(f),a=C(f,"DIV",{class:!0});var H=P(a);r=C(H,"DIV",{class:!0});var q=P(r);B&&B.l(q),i=O(q),o=C(q,"DIV",{class:!0});var se=P(o);w&&w.l(se),se.forEach(m),c=O(q),R&&R.l(q),q.forEach(m),H.forEach(m),f.forEach(m),this.h()},h(){ct(l,g),h(o,"class",u="dropzone-message "+t[6]),h(r,"class",E="dropzone-interface-text "+t[4]),h(a,"class",_="dropzone-interface "+t[8]+" "+t[3]),h(e,"class",I="dropzone "+t[10]),h(e,"data-testid","file-dropzone"),ne(e,"opacity-50",t[12].disabled)},m(k,f){S(k,e,f),A(e,l),l.autofocus&&l.focus(),t[32](l),A(e,n),A(e,a),A(a,r),B&&B.m(r,null),A(r,i),A(r,o),w&&w.m(o,null),A(r,c),R&&R.m(r,null),D=!0,F||(U=[z(l,"change",t[31]),z(l,"change",t[19]),z(l,"dragenter",t[20]),z(l,"dragover",t[21]),z(l,"dragleave",t[22]),z(l,"drop",t[23]),z(l,"click",t[24]),z(l,"keydown",t[25]),z(l,"keyup",t[26]),z(l,"keypress",t[27]),z(l,"focus",t[28]),z(l,"focusin",t[29]),z(l,"focusout",t[30])],F=!0)},p(k,f){ct(l,g=Xt(N,[{type:"file"},(!D||f[0]&4)&&{name:k[2]},(!D||f[0]&512&&s!==(s="dropzone-input "+k[9]))&&{class:s},k[11]()])),k[13].lead?B?(B.p(k,f),f[0]&8192&&M(B,1)):(B=St(k),B.c(),M(B,1),B.m(r,i)):B&&(Ce(),W(B,1,1,()=>{B=null}),Le()),p&&p.p&&(!D||f[0]&131072)&&Ge(p,V,k,k[17],D?Je(V,k[17],f,ul):Qe(k[17]),Dt),(!D||f[0]&64&&u!==(u="dropzone-message "+k[6]))&&h(o,"class",u),k[13].meta?R?(R.p(k,f),f[0]&8192&&M(R,1)):(R=Rt(k),R.c(),M(R,1),R.m(r,null)):R&&(Ce(),W(R,1,1,()=>{R=null}),Le()),(!D||f[0]&16&&E!==(E="dropzone-interface-text "+k[4]))&&h(r,"class",E),(!D||f[0]&264&&_!==(_="dropzone-interface "+k[8]+" "+k[3]))&&h(a,"class",_),(!D||f[0]&1024&&I!==(I="dropzone "+k[10]))&&h(e,"class",I),(!D||f[0]&5120)&&ne(e,"opacity-50",k[12].disabled)},i(k){D||(M(B),M(w,k),M(R),D=!0)},o(k){W(B),W(w,k),W(R),D=!1},d(k){k&&m(e),t[32](null),B&&B.d(),w&&w.d(k),R&&R.d(),F=!1,mt(U)}}}const cl="textarea relative flex justify-center items-center",fl="w-full absolute top-0 left-0 right-0 bottom-0 z-[1] opacity-0 disabled:!opacity-0 cursor-pointer",dl="flex justify-center items-center text-center";function hl(t,e,l){let s,n,a;const r=["files","fileInput","name","border","padding","rounded","regionInterface","regionInterfaceText","slotLead","slotMessage","slotMeta"];let i=ft(e,r),{$$slots:o={},$$scope:u}=e;const c=Et(o);let{files:E=void 0}=e,{fileInput:_=void 0}=e,{name:I}=e,{border:D="border-2 border-dashed"}=e,{padding:F="p-4 py-8"}=e,{rounded:U="rounded-container-token"}=e,{regionInterface:N=""}=e,{regionInterfaceText:g=""}=e,{slotLead:B="mb-4"}=e,{slotMessage:V=""}=e,{slotMeta:p="opacity-75"}=e;function w(){return delete i.class,i}function R(v){te.call(this,t,v)}function k(v){te.call(this,t,v)}function f(v){te.call(this,t,v)}function H(v){te.call(this,t,v)}function q(v){te.call(this,t,v)}function se(v){te.call(this,t,v)}function oe(v){te.call(this,t,v)}function x(v){te.call(this,t,v)}function _e(v){te.call(this,t,v)}function le(v){te.call(this,t,v)}function re(v){te.call(this,t,v)}function ge(v){te.call(this,t,v)}function pe(){E=this.files,l(0,E)}function L(v){Me[v?"unshift":"push"](()=>{_=v,l(1,_)})}return t.$$set=v=>{l(33,e=Ie(Ie({},e),Ve(v))),l(12,i=ft(e,r)),"files"in v&&l(0,E=v.files),"fileInput"in v&&l(1,_=v.fileInput),"name"in v&&l(2,I=v.name),"border"in v&&l(14,D=v.border),"padding"in v&&l(15,F=v.padding),"rounded"in v&&l(16,U=v.rounded),"regionInterface"in v&&l(3,N=v.regionInterface),"regionInterfaceText"in v&&l(4,g=v.regionInterfaceText),"slotLead"in v&&l(5,B=v.slotLead),"slotMessage"in v&&l(6,V=v.slotMessage),"slotMeta"in v&&l(7,p=v.slotMeta),"$$scope"in v&&l(17,u=v.$$scope)},t.$$.update=()=>{l(10,s=`${cl} ${D} ${F} ${U} ${e.class??""}`)},l(9,n=`${fl}`),l(8,a=`${dl}`),e=Ve(e),[E,_,I,N,g,B,V,p,a,n,s,w,i,c,D,F,U,u,o,R,k,f,H,q,se,oe,x,_e,le,re,ge,pe,L]}class ml extends nt{constructor(e){super(),st(this,e,hl,ol,lt,{files:0,fileInput:1,name:2,border:14,padding:15,rounded:16,regionInterface:3,regionInterfaceText:4,slotLead:5,slotMessage:6,slotMeta:7},null,[-1,-1])}}function _l(t){let e,l,s,n=`${t[4]?100:t[7]}%`,a,r;return{c(){e=T("div"),l=T("div"),this.h()},l(i){e=C(i,"DIV",{class:!0,"data-testid":!0,role:!0,"aria-labelledby":!0,"aria-valuenow":!0,"aria-valuemin":!0,"aria-valuemax":!0});var o=P(e);l=C(o,"DIV",{class:!0}),P(l).forEach(m),o.forEach(m),this.h()},h(){h(l,"class",s="progress-bar-meter "+t[5]+" svelte-12wvf64"),At(l,"width",n),h(e,"class",a="progress-bar "+t[6]+" svelte-12wvf64"),h(e,"data-testid","progress-bar"),h(e,"role","progressbar"),h(e,"aria-labelledby",t[3]),h(e,"aria-valuenow",t[0]),h(e,"aria-valuemin",t[1]),h(e,"aria-valuemax",r=t[2]-t[1])},m(i,o){S(i,e,o),A(e,l)},p(i,[o]){o&32&&s!==(s="progress-bar-meter "+i[5]+" svelte-12wvf64")&&h(l,"class",s),o&144&&n!==(n=`${i[4]?100:i[7]}%`)&&At(l,"width",n),o&64&&a!==(a="progress-bar "+i[6]+" svelte-12wvf64")&&h(e,"class",a),o&8&&h(e,"aria-labelledby",i[3]),o&1&&h(e,"aria-valuenow",i[0]),o&2&&h(e,"aria-valuemin",i[1]),o&6&&r!==(r=i[2]-i[1])&&h(e,"aria-valuemax",r)},i:kt,o:kt,d(i){i&&m(e)}}}const gl="w-full overflow-hidden",bl="h-full";function pl(t,e,l){let s,n,a,r,i,{value:o=void 0}=e,{min:u=0}=e,{max:c=100}=e,{height:E="h-2"}=e,{rounded:_="rounded-token"}=e,{transition:I="transition-[width]"}=e,{animIndeterminate:D="anim-indeterminate"}=e,{meter:F="bg-surface-900-50-token"}=e,{track:U="bg-surface-200-700-token"}=e,{labelledby:N=""}=e;return t.$$set=g=>{l(15,e=Ie(Ie({},e),Ve(g))),"value"in g&&l(0,o=g.value),"min"in g&&l(1,u=g.min),"max"in g&&l(2,c=g.max),"height"in g&&l(8,E=g.height),"rounded"in g&&l(9,_=g.rounded),"transition"in g&&l(10,I=g.transition),"animIndeterminate"in g&&l(11,D=g.animIndeterminate),"meter"in g&&l(12,F=g.meter),"track"in g&&l(13,U=g.track),"labelledby"in g&&l(3,N=g.labelledby)},t.$$.update=()=>{t.$$.dirty&7&&l(7,s=o?100*(o-u)/(c-u):0),t.$$.dirty&1&&l(4,n=o===void 0||o<0),t.$$.dirty&2064&&l(14,a=n?D:""),l(6,r=`${gl} ${U} ${E} ${_} ${e.class??""}`),t.$$.dirty&22016&&l(5,i=`${bl} ${F} ${_} ${a} ${I}`)},e=Ve(e),[o,u,c,N,n,i,r,s,E,_,I,D,F,U,a]}class vl extends nt{constructor(e){super(),st(this,e,pl,_l,lt,{value:0,min:1,max:2,height:8,rounded:9,transition:10,animIndeterminate:11,meter:12,track:13,labelledby:3})}}const kl=t=>({}),qt=t=>({});function Bt(t){let e,l,s;const n=t[17].panel,a=We(n,t,t[16],qt);return{c(){e=T("div"),a&&a.c(),this.h()},l(r){e=C(r,"DIV",{class:!0,role:!0,"aria-labelledby":!0,tabindex:!0});var i=P(e);a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class",l="tab-panel "+t[2]),h(e,"role","tabpanel"),h(e,"aria-labelledby",t[1]),h(e,"tabindex","0")},m(r,i){S(r,e,i),a&&a.m(e,null),s=!0},p(r,i){a&&a.p&&(!s||i&65536)&&Ge(a,n,r,r[16],s?Je(n,r[16],i,kl):Qe(r[16]),qt),(!s||i&4&&l!==(l="tab-panel "+r[2]))&&h(e,"class",l),(!s||i&2)&&h(e,"aria-labelledby",r[1])},i(r){s||(M(a,r),s=!0)},o(r){W(a,r),s=!1},d(r){r&&m(e),a&&a.d(r)}}}function El(t){let e,l,s,n,a,r,i,o;const u=t[17].default,c=We(u,t,t[16],null);let E=t[5].panel&&Bt(t);return{c(){e=T("div"),l=T("div"),c&&c.c(),n=j(),E&&E.c(),this.h()},l(_){e=C(_,"DIV",{class:!0,"data-testid":!0});var I=P(e);l=C(I,"DIV",{class:!0,role:!0,"aria-labelledby":!0});var D=P(l);c&&c.l(D),D.forEach(m),n=O(I),E&&E.l(I),I.forEach(m),this.h()},h(){h(l,"class",s="tab-list "+t[3]),h(l,"role","tablist"),h(l,"aria-labelledby",t[0]),h(e,"class",a="tab-group "+t[4]),h(e,"data-testid","tab-group")},m(_,I){S(_,e,I),A(e,l),c&&c.m(l,null),A(e,n),E&&E.m(e,null),r=!0,i||(o=[z(e,"click",t[18]),z(e,"keypress",t[19]),z(e,"keydown",t[20]),z(e,"keyup",t[21])],i=!0)},p(_,[I]){c&&c.p&&(!r||I&65536)&&Ge(c,u,_,_[16],r?Je(u,_[16],I,null):Qe(_[16]),null),(!r||I&8&&s!==(s="tab-list "+_[3]))&&h(l,"class",s),(!r||I&1)&&h(l,"aria-labelledby",_[0]),_[5].panel?E?(E.p(_,I),I&32&&M(E,1)):(E=Bt(_),E.c(),M(E,1),E.m(e,null)):E&&(Ce(),W(E,1,1,()=>{E=null}),Le()),(!r||I&16&&a!==(a="tab-group "+_[4]))&&h(e,"class",a)},i(_){r||(M(c,_),M(E),r=!0)},o(_){W(c,_),W(E),r=!1},d(_){_&&m(e),c&&c.d(_),E&&E.d(),i=!1,mt(o)}}}const yl="space-y-4",Al="flex overflow-x-auto hide-scrollbar",Tl="";function Cl(t,e,l){let s,n,a,{$$slots:r={},$$scope:i}=e;const o=Et(r);let{justify:u="justify-start"}=e,{border:c="border-b border-surface-400-500-token"}=e,{active:E="border-b-2 border-surface-900-50-token"}=e,{hover:_="hover:variant-soft"}=e,{flex:I="flex-none"}=e,{padding:D="px-4 py-2"}=e,{rounded:F="rounded-tl-container-token rounded-tr-container-token"}=e,{spacing:U="space-y-1"}=e,{regionList:N=""}=e,{regionPanel:g=""}=e,{labelledby:B=""}=e,{panel:V=""}=e;Xe("active",E),Xe("hover",_),Xe("flex",I),Xe("padding",D),Xe("rounded",F),Xe("spacing",U);function p(f){te.call(this,t,f)}function w(f){te.call(this,t,f)}function R(f){te.call(this,t,f)}function k(f){te.call(this,t,f)}return t.$$set=f=>{l(22,e=Ie(Ie({},e),Ve(f))),"justify"in f&&l(6,u=f.justify),"border"in f&&l(7,c=f.border),"active"in f&&l(8,E=f.active),"hover"in f&&l(9,_=f.hover),"flex"in f&&l(10,I=f.flex),"padding"in f&&l(11,D=f.padding),"rounded"in f&&l(12,F=f.rounded),"spacing"in f&&l(13,U=f.spacing),"regionList"in f&&l(14,N=f.regionList),"regionPanel"in f&&l(15,g=f.regionPanel),"labelledby"in f&&l(0,B=f.labelledby),"panel"in f&&l(1,V=f.panel),"$$scope"in f&&l(16,i=f.$$scope)},t.$$.update=()=>{l(4,s=`${yl} ${e.class??""}`),t.$$.dirty&16576&&l(3,n=`${Al} ${u} ${c} ${N}`),t.$$.dirty&32768&&l(2,a=`${Tl} ${g}`)},e=Ve(e),[B,V,a,n,s,o,u,c,E,_,I,D,F,U,N,g,i,r,p,w,R,k]}class Ll extends nt{constructor(e){super(),st(this,e,Cl,El,lt,{justify:6,border:7,active:8,hover:9,flex:10,padding:11,rounded:12,spacing:13,regionList:14,regionPanel:15,labelledby:0,panel:1})}}const Il=t=>({}),Mt=t=>({});function Vt(t){let e,l;const s=t[22].lead,n=We(s,t,t[21],Mt);return{c(){e=T("div"),n&&n.c(),this.h()},l(a){e=C(a,"DIV",{class:!0});var r=P(e);n&&n.l(r),r.forEach(m),this.h()},h(){h(e,"class","tab-lead")},m(a,r){S(a,e,r),n&&n.m(e,null),l=!0},p(a,r){n&&n.p&&(!l||r[0]&2097152)&&Ge(n,s,a,a[21],l?Je(s,a[21],r,Il):Qe(a[21]),Mt)},i(a){l||(M(n,a),l=!0)},o(a){W(n,a),l=!1},d(a){a&&m(e),n&&n.d(a)}}}function Dl(t){let e,l,s,n,a,r,i,o,u,c,E,_,I,D,F,U=[{type:"radio"},{name:t[1]},{__value:t[2]},t[11](),{tabindex:"-1"}],N={};for(let p=0;p<U.length;p+=1)N=Ie(N,U[p]);let g=t[12].lead&&Vt(t);const B=t[22].default,V=We(B,t,t[21],null);return I=Zt(t[30][0]),{c(){e=T("label"),l=T("div"),s=T("div"),n=T("input"),a=j(),r=T("div"),g&&g.c(),i=j(),o=T("div"),V&&V.c(),this.h()},l(p){e=C(p,"LABEL",{class:!0,title:!0});var w=P(e);l=C(w,"DIV",{class:!0,"data-testid":!0,role:!0,"aria-controls":!0,"aria-selected":!0,tabindex:!0});var R=P(l);s=C(R,"DIV",{class:!0});var k=P(s);n=C(k,"INPUT",{type:!0,name:!0,tabindex:!0}),k.forEach(m),a=O(R),r=C(R,"DIV",{class:!0});var f=P(r);g&&g.l(f),i=O(f),o=C(f,"DIV",{class:!0});var H=P(o);V&&V.l(H),H.forEach(m),f.forEach(m),R.forEach(m),w.forEach(m),this.h()},h(){ct(n,N),h(s,"class","h-0 w-0 overflow-hidden"),h(o,"class","tab-label"),h(r,"class",u="tab-interface "+t[8]),h(l,"class",c="tab "+t[7]),h(l,"data-testid","tab"),h(l,"role","tab"),h(l,"aria-controls",t[4]),h(l,"aria-selected",t[5]),h(l,"tabindex",E=t[5]?0:-1),h(e,"class",t[9]),h(e,"title",t[3]),I.p(n)},m(p,w){S(p,e,w),A(e,l),A(l,s),A(s,n),n.autofocus&&n.focus(),t[28](n),n.checked=n.__value===t[0],A(l,a),A(l,r),g&&g.m(r,null),A(r,i),A(r,o),V&&V.m(o,null),_=!0,D||(F=[z(n,"change",t[29]),z(n,"click",t[26]),z(n,"change",t[27]),z(l,"keydown",t[10]),z(l,"keydown",t[23]),z(l,"keyup",t[24]),z(l,"keypress",t[25])],D=!0)},p(p,w){ct(n,N=Xt(U,[{type:"radio"},(!_||w[0]&2)&&{name:p[1]},(!_||w[0]&4)&&{__value:p[2]},p[11](),{tabindex:"-1"}])),w[0]&1&&(n.checked=n.__value===p[0]),p[12].lead?g?(g.p(p,w),w[0]&4096&&M(g,1)):(g=Vt(p),g.c(),M(g,1),g.m(r,i)):g&&(Ce(),W(g,1,1,()=>{g=null}),Le()),V&&V.p&&(!_||w[0]&2097152)&&Ge(V,B,p,p[21],_?Je(B,p[21],w,null):Qe(p[21]),null),(!_||w[0]&256&&u!==(u="tab-interface "+p[8]))&&h(r,"class",u),(!_||w[0]&128&&c!==(c="tab "+p[7]))&&h(l,"class",c),(!_||w[0]&16)&&h(l,"aria-controls",p[4]),(!_||w[0]&32)&&h(l,"aria-selected",p[5]),(!_||w[0]&32&&E!==(E=p[5]?0:-1))&&h(l,"tabindex",E),(!_||w[0]&512)&&h(e,"class",p[9]),(!_||w[0]&8)&&h(e,"title",p[3])},i(p){_||(M(g),M(V,p),_=!0)},o(p){W(g),W(V,p),_=!1},d(p){p&&m(e),t[28](null),g&&g.d(),V&&V.d(p),I.r(),D=!1,mt(F)}}}const wl="text-center cursor-pointer transition-colors duration-100",Sl="";function Rl(t,e,l){let s,n,a,r,i;const o=["group","name","value","title","controls","regionTab","active","hover","flex","padding","rounded","spacing"];let u=ft(e,o),{$$slots:c={},$$scope:E}=e;const _=Et(c);let{group:I}=e,{name:D}=e,{value:F}=e,{title:U=""}=e,{controls:N=""}=e,{regionTab:g=""}=e,{active:B=Ye("active")}=e,{hover:V=Ye("hover")}=e,{flex:p=Ye("flex")}=e,{padding:w=Ye("padding")}=e,{rounded:R=Ye("rounded")}=e,{spacing:k=Ye("spacing")}=e,f;function H(L){if(["Enter","Space"].includes(L.code))L.preventDefault(),f.click();else if(L.code==="ArrowRight"){const v=f.closest(".tab-list");if(!v)return;const ce=Array.from(v.querySelectorAll(".tab")),ve=f.closest(".tab");if(!ve)return;const ie=ce.indexOf(ve),we=ie+1>=ce.length?0:ie+1,fe=ce[we],ae=fe?.querySelector("input");fe&&ae&&(ae.click(),fe.focus())}else if(L.code==="ArrowLeft"){const v=f.closest(".tab-list");if(!v)return;const ce=Array.from(v.querySelectorAll(".tab")),ve=f.closest(".tab");if(!ve)return;const ie=ce.indexOf(ve),we=ie-1<0?ce.length-1:ie-1,fe=ce[we],ae=fe?.querySelector("input");fe&&ae&&(ae.click(),fe.focus())}}function q(){return delete u.class,u}const se=[[]];function oe(L){te.call(this,t,L)}function x(L){te.call(this,t,L)}function _e(L){te.call(this,t,L)}function le(L){te.call(this,t,L)}function re(L){te.call(this,t,L)}function ge(L){Me[L?"unshift":"push"](()=>{f=L,l(6,f)})}function pe(){I=this.__value,l(0,I)}return t.$$set=L=>{l(32,e=Ie(Ie({},e),Ve(L))),l(31,u=ft(e,o)),"group"in L&&l(0,I=L.group),"name"in L&&l(1,D=L.name),"value"in L&&l(2,F=L.value),"title"in L&&l(3,U=L.title),"controls"in L&&l(4,N=L.controls),"regionTab"in L&&l(13,g=L.regionTab),"active"in L&&l(14,B=L.active),"hover"in L&&l(15,V=L.hover),"flex"in L&&l(16,p=L.flex),"padding"in L&&l(17,w=L.padding),"rounded"in L&&l(18,R=L.rounded),"spacing"in L&&l(19,k=L.spacing),"$$scope"in L&&l(21,E=L.$$scope)},t.$$.update=()=>{t.$$.dirty[0]&5&&l(5,s=F===I),t.$$.dirty[0]&49184&&l(20,n=s?B:V),l(9,a=`${wl} ${p} ${w} ${R} ${n} ${e.class??""}`),t.$$.dirty[0]&524288&&l(8,r=`${Sl} ${k}`),t.$$.dirty[0]&8192&&l(7,i=`${g}`)},e=Ve(e),[I,D,F,U,N,s,f,i,r,a,H,q,_,g,B,V,p,w,R,k,n,E,c,oe,x,_e,le,re,ge,pe,se]}class ql extends nt{constructor(e){super(),st(this,e,Rl,Dl,lt,{group:0,name:1,value:2,title:3,controls:4,regionTab:13,active:14,hover:15,flex:16,padding:17,rounded:18,spacing:19},null,[-1,-1])}}var ot,Bl=new Uint8Array(16);function Ml(){if(!ot&&(ot=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ot))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ot(Bl)}const Vl=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Pl(t){return typeof t=="string"&&Vl.test(t)}var ue=[];for(var vt=0;vt<256;++vt)ue.push((vt+256).toString(16).substr(1));function Fl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=(ue[t[e+0]]+ue[t[e+1]]+ue[t[e+2]]+ue[t[e+3]]+"-"+ue[t[e+4]]+ue[t[e+5]]+"-"+ue[t[e+6]]+ue[t[e+7]]+"-"+ue[t[e+8]]+ue[t[e+9]]+"-"+ue[t[e+10]]+ue[t[e+11]]+ue[t[e+12]]+ue[t[e+13]]+ue[t[e+14]]+ue[t[e+15]]).toLowerCase();if(!Pl(l))throw TypeError("Stringified UUID is invalid");return l}function Pt(t,e,l){t=t||{};var s=t.random||(t.rng||Ml)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){l=l||0;for(var n=0;n<16;++n)e[l+n]=s[n];return e}return Fl(s)}function Ft(t,e,l){const s=t.slice();return s[61]=e[l],s[63]=l,s}function Ut(t,e,l){const s=t.slice();return s[58]=e[l],s}function Ul(t){let e;return{c(){e=ye("Перетащите файл сюда или нажмите, чтобы выбрать файл.")},l(l){e=Ae(l,"Перетащите файл сюда или нажмите, чтобы выбрать файл.")},m(l,s){S(l,e,s)},d(l){l&&m(e)}}}function zl(t){let e;return{c(){e=ye("Только xlsx")},l(l){e=Ae(l,"Только xlsx")},m(l,s){S(l,e,s)},d(l){l&&m(e)}}}function zt(t){let e,l;return e=new Ll({props:{$$slots:{panel:[Yl],default:[Ol]},$$scope:{ctx:t}}}),{c(){Fe(e.$$.fragment)},l(s){Ue(e.$$.fragment,s)},m(s,n){ze(e,s,n),l=!0},p(s,n){const a={};n[0]&262143|n[2]&4&&(a.$$scope={dirty:n,ctx:s}),e.$set(a)},i(s){l||(M(e.$$.fragment,s),l=!0)},o(s){W(e.$$.fragment,s),l=!1},d(s){je(e,s)}}}function jl(t){let e,l=t[61].id+"",s,n,a=t[61].name+"",r,i;return{c(){e=T("span"),s=ye(l),n=j(),r=ye(a),i=j()},l(o){e=C(o,"SPAN",{});var u=P(e);s=Ae(u,l),n=O(u),r=Ae(u,a),u.forEach(m),i=O(o)},m(o,u){S(o,e,u),A(e,s),A(e,n),A(e,r),S(o,i,u)},p(o,u){u[0]&1&&l!==(l=o[61].id+"")&&dt(s,l),u[0]&1&&a!==(a=o[61].name+"")&&dt(r,a)},d(o){o&&(m(e),m(i))}}}function jt(t,e){let l,s,n,a;function r(u){e[51](u)}function i(){return e[52](e[61])}let o={name:e[61].name,value:e[63],$$slots:{default:[jl]},$$scope:{ctx:e}};return e[17]!==void 0&&(o.group=e[17]),s=new ql({props:o}),Me.push(()=>xe(s,"group",r)),s.$on("click",i),{key:t,first:null,c(){l=Pe(),Fe(s.$$.fragment),this.h()},l(u){l=Pe(),Ue(s.$$.fragment,u),this.h()},h(){this.first=l},m(u,c){S(u,l,c),ze(s,u,c),a=!0},p(u,c){e=u;const E={};c[0]&1&&(E.name=e[61].name),c[0]&1&&(E.value=e[63]),c[0]&1|c[2]&4&&(E.$$scope={dirty:c,ctx:e}),!n&&c[0]&131072&&(n=!0,E.group=e[17],Ze(()=>n=!1)),s.$set(E)},i(u){a||(M(s.$$.fragment,u),a=!0)},o(u){W(s.$$.fragment,u),a=!1},d(u){u&&m(l),je(s,u)}}}function Ol(t){let e=[],l=new Map,s,n,a=ht(t[0]);const r=i=>i[61].id;for(let i=0;i<a.length;i+=1){let o=Ft(t,a,i),u=r(o);l.set(u,e[i]=jt(u,o))}return{c(){for(let i=0;i<e.length;i+=1)e[i].c();s=Pe()},l(i){for(let o=0;o<e.length;o+=1)e[o].l(i);s=Pe()},m(i,o){for(let u=0;u<e.length;u+=1)e[u]&&e[u].m(i,o);S(i,s,o),n=!0},p(i,o){o[0]&132097&&(a=ht(i[0]),Ce(),e=Kt(e,o,r,1,i,a,l,s.parentNode,$t,jt,s,Ft),Le())},i(i){if(!n){for(let o=0;o<a.length;o+=1)M(e[o]);n=!0}},o(i){for(let o=0;o<e.length;o+=1)W(e[o]);n=!1},d(i){i&&m(s);for(let o=0;o<e.length;o+=1)e[o].d(i)}}}function Ot(t){let e,l,s,n,a,r,i,o,u,c,E,_,I,D,F,U,N,g,B="Оценивать ответ",V,p,w,R,k,f,H,q,se="Тип поиска:",oe,x,_e,le,re,ge,pe,L,v,ce,ve,ie,we="Скачать",fe,ae,Se,at='<tr><th class="border p-2">Вопрос пользователя</th> <th class="border p-2">Ответ эксперта</th> <th class="border p-2">Ответ LLM</th> <th class="border p-2">Ответ оценки LLM</th> <th class="border p-2">Оценка</th></tr>',$e,Re,de=[],ut=new Map,He,et,rt,K=t[12][t[10].id].processingStarted&&Nt(t),X=t[5]&&t[2].investigatorSettings&&Ht(t);function _t(d){t[35](d)}let it={};t[4]!==void 0&&(it.selectedLLM=t[4]),_=new Yt({props:it}),Me.push(()=>xe(_,"selectedLLM",_t));let Y=t[8]&&Wt(t);function gt(d){t[39](d)}function bt(d){t[40](d)}let tt={};t[7]!==void 0&&(tt.use_olympic=t[7]),t[6]!==void 0&&(tt.use_qe=t[6]),x=new tl({props:tt}),Me.push(()=>xe(x,"use_olympic",gt)),Me.push(()=>xe(x,"use_qe",bt));let b=ht(t[10].data);const $=d=>d[58].id;for(let d=0;d<b.length;d+=1){let y=Ut(t,b,d),J=$(y);ut.set(J,de[d]=Qt(J,y))}return{c(){K&&K.c(),e=j(),l=T("div"),s=T("div"),n=T("label"),a=T("input"),r=ye(` |
|
Почемучка`),Z.forEach(m),J.forEach(m),i=O(y),X&&X.l(y),y.forEach(m),o=O(d),u=C(d,"DIV",{class:!0});var be=P(u);c=C(be,"DIV",{});var Te=P(c);E=Ae(Te,"Отвечает: "),Ue(_.$$.fragment,Te),Te.forEach(m),D=O(be),F=C(be,"DIV",{class:!0});var ke=P(F);U=C(ke,"INPUT",{type:!0,class:!0}),N=O(ke),g=C(ke,"P",{"data-svelte-h":!0}),me(g)!=="svelte-da92hf"&&(g.textContent=B),ke.forEach(m),V=O(be),Y&&Y.l(be),be.forEach(m),p=O(d),w=C(d,"DIV",{class:!0});var G=P(w);R=C(G,"LABEL",{});var ee=P(R);k=Ae(ee,"Количество потоков: "),f=C(ee,"INPUT",{type:!0,min:!0,max:!0,class:!0}),ee.forEach(m),H=O(G),q=C(G,"DIV",{"data-svelte-h":!0}),me(q)!=="svelte-711pt3"&&(q.textContent=se),oe=O(G),Ue(x.$$.fragment,G),G.forEach(m),re=O(d),ge=C(d,"DIV",{class:!0}),P(ge).forEach(m),pe=O(d),L=C(d,"DIV",{class:!0});var Q=P(L);v=C(Q,"BUTTON",{class:!0});var Ee=P(v);ce=Ae(Ee,t[11]),Ee.forEach(m),ve=O(Q),ie=C(Q,"BUTTON",{class:!0,"data-svelte-h":!0}),me(ie)!=="svelte-1lfta1"&&(ie.textContent=we),Q.forEach(m),fe=O(d),ae=C(d,"TABLE",{class:!0});var Ke=P(ae);Se=C(Ke,"THEAD",{"data-svelte-h":!0}),me(Se)!=="svelte-7jjxgh"&&(Se.innerHTML=at),$e=O(Ke),Re=C(Ke,"TBODY",{});var yt=P(Re);for(let pt=0;pt<de.length;pt+=1)de[pt].l(yt);yt.forEach(m),Ke.forEach(m),this.h()},h(){h(a,"type","checkbox"),h(a,"class","checkbox"),h(s,"class","flex items-center space-x-2"),h(l,"class","flex justify-start mt-4 space-x-5"),h(U,"type","checkbox"),h(U,"class","checkbox"),h(F,"class","flex items-center space-x-2"),h(u,"class","flex justify-start mt-4 space-x-5"),h(f,"type","number"),h(f,"min","1"),h(f,"max","100"),h(f,"class","input input-bordered w-32"),h(w,"class","flex justify-start mt-4 space-x-5 items-center"),h(ge,"class","flex justify-start mt-4 space-x-5"),h(v,"class","btn variant-filled-primary space-x-2 m-2 w-60"),h(ie,"class","btn variant-filled-primary space-x-2 m-2 w-60"),h(L,"class","flex justify-between mt-4"),h(ae,"class","table-auto w-full mt-4")},m(d,y){K&&K.m(d,y),S(d,e,y),S(d,l,y),A(l,s),A(s,n),A(n,a),a.checked=t[5],A(n,r),A(l,i),X&&X.m(l,null),S(d,o,y),S(d,u,y),A(u,c),A(c,E),ze(_,c,null),A(u,D),A(u,F),A(F,U),U.checked=t[8],A(F,N),A(F,g),A(u,V),Y&&Y.m(u,null),S(d,p,y),S(d,w,y),A(w,R),A(R,k),A(R,f),Tt(f,t[9]),A(w,H),A(w,q),A(w,oe),ze(x,w,null),S(d,re,y),S(d,ge,y),S(d,pe,y),S(d,L,y),A(L,v),A(v,ce),A(L,ve),A(L,ie),S(d,fe,y),S(d,ae,y),A(ae,Se),A(ae,$e),A(ae,Re);for(let J=0;J<de.length;J+=1)de[J]&&de[J].m(Re,null);He=!0,et||(rt=[z(a,"change",t[33]),z(U,"change",t[36]),z(f,"input",t[38]),z(v,"click",t[41]),z(ie,"click",t[42])],et=!0)},p(d,y){d[12][d[10].id].processingStarted?K?(K.p(d,y),y[0]&5120&&M(K,1)):(K=Nt(d),K.c(),M(K,1),K.m(e.parentNode,e)):K&&(Ce(),W(K,1,1,()=>{K=null}),Le()),y[0]&32&&(a.checked=d[5]),d[5]&&d[2].investigatorSettings?X?(X.p(d,y),y[0]&36&&M(X,1)):(X=Ht(d),X.c(),M(X,1),X.m(l,null)):X&&(Ce(),W(X,1,1,()=>{X=null}),Le());const J={};!I&&y[0]&16&&(I=!0,J.selectedLLM=d[4],Ze(()=>I=!1)),_.$set(J),y[0]&256&&(U.checked=d[8]),d[8]?Y?(Y.p(d,y),y[0]&256&&M(Y,1)):(Y=Wt(d),Y.c(),M(Y,1),Y.m(u,null)):Y&&(Ce(),W(Y,1,1,()=>{Y=null}),Le()),y[0]&512&&Jt(f.value)!==d[9]&&Tt(f,d[9]);const Z={};!_e&&y[0]&128&&(_e=!0,Z.use_olympic=d[7],Ze(()=>_e=!1)),!le&&y[0]&64&&(le=!0,Z.use_qe=d[6],Ze(()=>le=!1)),x.$set(Z),(!He||y[0]&2048)&&dt(ce,d[11]),y[0]&123904&&(b=ht(d[10].data),de=Kt(de,y,$,1,d,b,ut,Re,el,Qt,null,Ut))},i(d){He||(M(K),M(X),M(_.$$.fragment,d),M(Y),M(x.$$.fragment,d),He=!0)},o(d){W(K),W(X),W(_.$$.fragment,d),W(Y),W(x.$$.fragment,d),He=!1},d(d){d&&(m(e),m(l),m(o),m(u),m(p),m(w),m(re),m(ge),m(pe),m(L),m(fe),m(ae)),K&&K.d(d),X&&X.d(),je(_),Y&&Y.d(),je(x);for(let y=0;y<de.length;y+=1)de[y].d();et=!1,mt(rt)}}}function Nt(t){let e,l;return e=new vl({props:{value:t[12][t[10].id].completedTasks/t[12][t[10].id].totalTasks*100,max:100}}),{c(){Fe(e.$$.fragment)},l(s){Ue(e.$$.fragment,s)},m(s,n){ze(e,s,n),l=!0},p(s,n){const a={};n[0]&5120&&(a.value=s[12][s[10].id].completedTasks/s[12][s[10].id].totalTasks*100),e.$set(a)},i(s){l||(M(e.$$.fragment,s),l=!0)},o(s){W(e.$$.fragment,s),l=!1},d(s){je(e,s)}}}function Ht(t){let e,l,s,n;function a(i){t[34](i)}let r={};return t[2].investigatorSettings!==void 0&&(r.settings=t[2].investigatorSettings),l=new ll({props:r}),Me.push(()=>xe(l,"settings",a)),{c(){e=T("div"),Fe(l.$$.fragment)},l(i){e=C(i,"DIV",{});var o=P(e);Ue(l.$$.fragment,o),o.forEach(m)},m(i,o){S(i,e,o),ze(l,e,null),n=!0},p(i,o){const u={};!s&&o[0]&4&&(s=!0,u.settings=i[2].investigatorSettings,Ze(()=>s=!1)),l.$set(u)},i(i){n||(M(l.$$.fragment,i),n=!0)},o(i){W(l.$$.fragment,i),n=!1},d(i){i&&m(e),je(l)}}}function Wt(t){let e,l,s,n,a;function r(o){t[37](o)}let i={};return t[3]!==void 0&&(i.selectedLLM=t[3]),s=new Yt({props:i}),Me.push(()=>xe(s,"selectedLLM",r)),{c(){e=T("div"),l=ye("Оценивает: "),Fe(s.$$.fragment)},l(o){e=C(o,"DIV",{});var u=P(e);l=Ae(u,"Оценивает: "),Ue(s.$$.fragment,u),u.forEach(m)},m(o,u){S(o,e,u),A(e,l),ze(s,e,null),a=!0},p(o,u){const c={};!n&&u[0]&8&&(n=!0,c.selectedLLM=o[3],Ze(()=>n=!1)),s.$set(c)},i(o){a||(M(s.$$.fragment,o),a=!0)},o(o){W(s.$$.fragment,o),a=!1},d(o){o&&m(e),je(s)}}}function Nl(t){let e,l=(t[58].request?.replace(/\n/g,"<br>").length>100?t[58].request?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].request?.replace(/\n/g,"<br>"))+"",s,n,a="Развернуть",r,i;function o(){return t[44](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{href:!0,class:!0,"data-svelte-h":!0}),me(n)!=="svelte-ywkf0q"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"href","#"),h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].request?.replace(/\n/g,"<br>").length<=100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=(t[58].request?.replace(/\n/g,"<br>").length>100?t[58].request?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].request?.replace(/\n/g,"<br>"))+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].request?.replace(/\n/g,"<br>").length<=100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Hl(t){let e,l=t[58].request?.replace(/\n/g,"<br>")+"",s,n,a="Свернуть",r,i;function o(){return t[43](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{href:!0,class:!0,"data-svelte-h":!0}),me(n)!=="svelte-4wwxnw"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"href","#"),h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].request?.replace(/\n/g,"<br>").length>100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=t[58].request?.replace(/\n/g,"<br>")+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].request?.replace(/\n/g,"<br>").length>100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Wl(t){let e,l=(t[58].expertAnswer?.replace(/\n/g,"<br>").length>100?t[58].expertAnswer?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].expertAnswer?.replace(/\n/g,"<br>"))+"",s,n,a="Развернуть",r,i;function o(){return t[46](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{href:!0,class:!0,"data-svelte-h":!0}),me(n)!=="svelte-vvsd3m"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"href","#"),h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].expertAnswer?.replace(/\n/g,"<br>").length<=100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=(t[58].expertAnswer?.replace(/\n/g,"<br>").length>100?t[58].expertAnswer?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].expertAnswer?.replace(/\n/g,"<br>"))+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].expertAnswer?.replace(/\n/g,"<br>").length<=100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Gl(t){let e,l=t[58].expertAnswer.replace(/\n/g,"<br>")+"",s,n,a="Свернуть",r,i;function o(){return t[45](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{href:!0,class:!0,"data-svelte-h":!0}),me(n)!=="svelte-12lel02"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"href","#"),h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length>100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=t[58].expertAnswer.replace(/\n/g,"<br>")+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length>100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Ql(t){let e,l=(t[58].llmAnswer?.replace(/\n/g,"<br>").length>100?t[58].llmAnswer?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].llmAnswer?.replace(/\n/g,"<br>"))+"",s,n,a="Развернуть",r,i;function o(){return t[48](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{class:!0,"data-svelte-h":!0}),me(n)!=="svelte-12v4ty"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length<=100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=(t[58].llmAnswer?.replace(/\n/g,"<br>").length>100?t[58].llmAnswer?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].llmAnswer?.replace(/\n/g,"<br>"))+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length<=100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Jl(t){let e,l=t[58].llmAnswer?.replace(/\n/g,"<br>")+"",s,n,a="Свернуть",r,i;function o(){return t[47](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{class:!0,"data-svelte-h":!0}),me(n)!=="svelte-8hufxq"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length>100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=t[58].llmAnswer?.replace(/\n/g,"<br>")+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].llmAnswer?.replace(/\n/g,"<br>").length>100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Gt(t){let e;function l(a,r){return a[16][a[58].id]?Xl:Kl}let s=l(t),n=s(t);return{c(){n.c(),e=Pe()},l(a){n.l(a),e=Pe()},m(a,r){n.m(a,r),S(a,e,r)},p(a,r){s===(s=l(a))&&n?n.p(a,r):(n.d(1),n=s(a),n&&(n.c(),n.m(e.parentNode,e)))},d(a){a&&m(e),n.d(a)}}}function Kl(t){let e,l=(t[58].evaluation?.replace(/\n/g,"<br>").length>100?t[58].evaluation?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].evaluation?.replace(/\n/g,"<br>"))+"",s,n,a="Развернуть",r,i;function o(){return t[50](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{class:!0,"data-svelte-h":!0}),me(n)!=="svelte-ank2y6"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].evaluation?.replace(/\n/g,"<br>").length<=100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=(t[58].evaluation?.replace(/\n/g,"<br>").length>100?t[58].evaluation?.replace(/\n/g,"<br>").slice(0,100)+"...":t[58].evaluation?.replace(/\n/g,"<br>"))+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].evaluation?.replace(/\n/g,"<br>").length<=100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Xl(t){let e,l=t[58].evaluation?.replace(/\n/g,"<br>")+"",s,n,a="Свернуть",r,i;function o(){return t[49](t[58])}return{c(){e=new Oe(!1),s=j(),n=T("a"),n.textContent=a,this.h()},l(u){e=Ne(u,!1),s=O(u),n=C(u,"A",{class:!0,"data-svelte-h":!0}),me(n)!=="svelte-1ympil6"&&(n.textContent=a),this.h()},h(){e.a=s,h(n,"class","text-blue-500 cursor-pointer"),ne(n,"hidden",t[58].evaluation?.replace(/\n/g,"<br>").length>100)},m(u,c){e.m(l,u,c),S(u,s,c),S(u,n,c),r||(i=z(n,"click",o),r=!0)},p(u,c){t=u,c[0]&1024&&l!==(l=t[58].evaluation?.replace(/\n/g,"<br>")+"")&&e.p(l),c[0]&1024&&ne(n,"hidden",t[58].evaluation?.replace(/\n/g,"<br>").length>100)},d(u){u&&(e.d(),m(s),m(n)),r=!1,i()}}}function Qt(t,e){let l,s,n,a,r,i,o,u,c,E,_,I=e[58].mark+"",D,F;function U(H,q){return H[13][H[58].id]?Hl:Nl}let N=U(e),g=N(e);function B(H,q){return H[14][H[58].id]?Gl:Wl}let V=B(e),p=V(e);function w(H,q){return H[15][H[58].id]?Jl:Ql}let R=w(e),k=R(e),f=e[58].evaluation&&Gt(e);return{key:t,first:null,c(){l=T("tr"),s=T("td"),g.c(),n=j(),a=T("td"),p.c(),r=j(),i=T("td"),o=T("div"),k.c(),u=j(),c=T("td"),f&&f.c(),E=j(),_=T("td"),D=ye(I),F=j(),this.h()},l(H){l=C(H,"TR",{});var q=P(l);s=C(q,"TD",{class:!0});var se=P(s);g.l(se),se.forEach(m),n=O(q),a=C(q,"TD",{class:!0});var oe=P(a);p.l(oe),oe.forEach(m),r=O(q),i=C(q,"TD",{class:!0});var x=P(i);o=C(x,"DIV",{class:!0});var _e=P(o);k.l(_e),_e.forEach(m),x.forEach(m),u=O(q),c=C(q,"TD",{class:!0});var le=P(c);f&&f.l(le),le.forEach(m),E=O(q),_=C(q,"TD",{class:!0});var re=P(_);D=Ae(re,I),re.forEach(m),F=O(q),q.forEach(m),this.h()},h(){h(s,"class","border p-2"),h(a,"class","border p-2"),h(o,"class","whitespace-pre-wrap"),h(i,"class","border p-2"),h(c,"class","border p-2"),h(_,"class","border p-2"),this.first=l},m(H,q){S(H,l,q),A(l,s),g.m(s,null),A(l,n),A(l,a),p.m(a,null),A(l,r),A(l,i),A(i,o),k.m(o,null),A(l,u),A(l,c),f&&f.m(c,null),A(l,E),A(l,_),A(_,D),A(l,F)},p(H,q){e=H,N===(N=U(e))&&g?g.p(e,q):(g.d(1),g=N(e),g&&(g.c(),g.m(s,null))),V===(V=B(e))&&p?p.p(e,q):(p.d(1),p=V(e),p&&(p.c(),p.m(a,null))),R===(R=w(e))&&k?k.p(e,q):(k.d(1),k=R(e),k&&(k.c(),k.m(o,null))),e[58].evaluation?f?f.p(e,q):(f=Gt(e),f.c(),f.m(c,null)):f&&(f.d(1),f=null),q[0]&1024&&I!==(I=e[58].mark+"")&&dt(D,I)},d(H){H&&m(l),g.d(),p.d(),k.d(),f&&f.d()}}}function Yl(t){let e,l="Удалить файл",s,n,a,r,i,o=t[10]&&Ot(t);return{c(){e=T("button"),e.textContent=l,s=j(),o&&o.c(),n=Pe(),this.h()},l(u){e=C(u,"BUTTON",{class:!0,"data-svelte-h":!0}),me(e)!=="svelte-1wp71c2"&&(e.textContent=l),s=O(u),o&&o.l(u),n=Pe(),this.h()},h(){h(e,"class","mb-4 chip variant-filled-error")},m(u,c){S(u,e,c),S(u,s,c),o&&o.m(u,c),S(u,n,c),a=!0,r||(i=z(e,"click",t[32]),r=!0)},p(u,c){u[10]?o?(o.p(u,c),c[0]&1024&&M(o,1)):(o=Ot(u),o.c(),M(o,1),o.m(n.parentNode,n)):o&&(Ce(),W(o,1,1,()=>{o=null}),Le())},i(u){a||(M(o),a=!0)},o(u){W(o),a=!1},d(u){u&&(m(e),m(s),m(n)),o&&o.d(u),r=!1,i()}}}function Zl(t){let e,l,s,n;l=new ml({props:{$$slots:{meta:[zl],message:[Ul]},$$scope:{ctx:t}}}),l.$on("change",t[31]);let a=t[0].length>0&&zt(t);return{c(){e=T("div"),Fe(l.$$.fragment),s=j(),a&&a.c(),this.h()},l(r){e=C(r,"DIV",{class:!0});var i=P(e);Ue(l.$$.fragment,i),s=O(i),a&&a.l(i),i.forEach(m),this.h()},h(){h(e,"class","flex flex-col items-center justify-center p-4")},m(r,i){S(r,e,i),ze(l,e,null),A(e,s),a&&a.m(e,null),n=!0},p(r,i){const o={};i[2]&4&&(o.$$scope={dirty:i,ctx:r}),l.$set(o),r[0].length>0?a?(a.p(r,i),i[0]&1&&M(a,1)):(a=zt(r),a.c(),M(a,1),a.m(e,null)):a&&(Ce(),W(a,1,1,()=>{a=null}),Le())},i(r){n||(M(l.$$.fragment,r),M(a),n=!0)},o(r){W(l.$$.fragment,r),W(a),n=!1},d(r){r&&m(e),je(l),a&&a.d()}}}function xl(t,e,l){let s,n,a,r,i,o,u,c,{data:E}=e,_=E.Model,I,D,F=!1,U=!1,N=!1,g=!0,B=1,V="",p=new AbortController;const w=async b=>{if(D!==null)if(_.useInvestigator&&_.investigatorSettings){const $=systemPrompt+userPrompt+(_.search.modifiedQuery||currentUserRequest),d=await Be.sendTrimByTokens(llmParams.name,sources,$,p);sources=d.result,lastRequestOriginalTokenLength=d.originalTokenCount,lastRequestSlicedTokenLength=d.slicedTokenCount;const y={llm_params:searchLlmParams,query:""},J=new nl(_.investigatorSettings,y,5);_.investigatorSettings&&J.applySettings(_.investigatorSettings);const Z=await J.getResponse(currentUserRequest,sources,p);l(2,_.llmFinalAnswer=Z.result,_),console.log(Z.generatedQA)}else{const $=await sl.doRequest({query:b,use_olympic:N,use_qe:U,find_transaction_maps_by_question:!1,find_transaction_maps_by_operation:!1},p);let d=Be.convertSearchResultsToLlmSources($.searchResults,null);const y=await Be.sendTrimByTokens(D.name,d,(D?.predict_params?.system_prompt||"")+(D?.predict_params?.user_prompt||"")+b,p);d=y.result;const J=Be.buildLlmResponsePrompt(b,d,D.predict_params?.user_prompt);let Z=await Be.doRequest(D.name,J,Lt.Raw,5,p,null,null,D.predict_params,"Конец ответ");return{originalResponse:Z,processedResponse:Be.postProcessLlmAnswer(Z),sourcesTokenCount:y.slicedTokenCount,sourcesOriginalTokenCount:y.originalTokenCount}}},R=async(b,$,d)=>{if(I===null)return;const y=Be.buildResponseEvaluationPrompt(b,d,$);return await Be.doRequest(I.name.replace(" (изменено)",""),y,Lt.Raw,2,p,null,I.predict_params)},k=De(0);qe(t,k,b=>l(17,c=b));let f=De([]);qe(t,f,b=>l(0,s=b));let H=De(null);qe(t,H,b=>l(1,a=b));let q=De({});qe(t,q,b=>l(15,o=b));let se=De({});qe(t,se,b=>l(16,u=b));let oe=De({});qe(t,oe,b=>l(13,r=b));let x=De({});qe(t,x,b=>l(14,i=b));let _e=De({}),le=De({});qe(t,le,b=>l(12,n=b));let re="Запустить обработку";const ge=async b=>{const d=b.target.files?.item(0);if(!d)return;let y=new Ct.Workbook;if(y=await y.xlsx.load(await d.arrayBuffer()),y.worksheets.length>0){const J=y.worksheets[0].id,Z=y.getWorksheet(J),be=Z.getRow(1).values.slice(1),Te=[];let ke=0,G=0;Z.eachRow((Q,Ee)=>{Ee!==1&&(Te.push({id:Pt(),request:Q.values[1]||"",expertAnswer:Q.values[2]||"",llmAnswer:Q.values[3]||"",evaluation:Q.values[4]||"",mark:Q.values[5]||""}),ke+=2,Q.values[3]&&++G,Q.values[4]&&++G)});const ee={id:Pt(),name:d.name,data:Te};f.update(Q=>[...Q,ee]),he(le,n[ee.id]={totalTasks:ke,completedTasks:G},n),H.set(ee.id),_e.set({..._e,[ee.id]:be})}},pe=async b=>{if(I===null){alert("Выберите LLM, которая будет оценивать ответ");return}if(D===null){alert("Выберите LLM, которая будет отвечать на вопрос пользователя");return}if(n[b].processingStarted==!0){p.abort(),p=new AbortController,l(11,re="Запустить обработку"),he(le,n[b].processingStarted=!1,n);return}he(le,n[b].processingStarted=!0,n),l(11,re="Остановить");try{await L(b,g)}catch($){if($ instanceof DOMException&&$.name==="AbortError")return;throw alert("Возникла ошибка, смотри консоль."),console.error($),$}finally{he(le,n[b].processingStarted=!1,n),l(11,re="Запустить обработку")}},L=async(b,$)=>{const d=s.find(G=>G.id===b),y=d.data,J=B,Z=[...y],be=async G=>{if(!G.llmAnswer){const ee=await w(G.request);G.llmAnswer=ee?.processedResponse,G.llmFullAnswer=ee?.originalResponse,G.sourcesTokenCount=ee?.sourcesTokenCount,G.sourcesOriginalTokenCount=ee?.sourcesOriginalTokenCount,f.update(Q=>Q.map(Ee=>Ee.id===b?d:Ee)),he(le,n[b].completedTasks+=1,n)}if($&&!G.evaluation){G.evaluation=await R(G.request,G.llmAnswer,G.expertAnswer);const ee=G.evaluation.match(/\[(\d)([+-]?)\]/);G.mark=ee?ee[1]+ee[2]:"-",f.update(Q=>Q.map(Ee=>Ee.id===b?d:Ee)),he(le,n[b].completedTasks+=1,n)}},Te=async()=>{for(;Z.length>0;){const G=Z.shift();await be(G)}},ke=Array.from({length:J},()=>Te());await Promise.all(ke)},v=b=>{p.abort(),f.update($=>$.filter(d=>d.id!==b))},ce=async b=>{const $=s.find(Q=>Q.id===b),d=new Ct.Workbook,y=d.addWorksheet("Таблица"),J=d.addWorksheet("Оценка");J.addRow(["Средняя оценка"]);const Z=d.addWorksheet("Результаты токенизатора");y.columns=[{header:"Вопрос пользователя",width:70,font:{bold:!0}},{header:"Ответ эксперта",width:70},{header:"Ответ LLM",width:70},{header:"Ответ оценки LLM",width:70},{header:"Оценка",width:10},{header:"Ответ LLM до обработки",width:70}],Z.columns=[{header:"Вопрос пользователя",width:70,font:{bold:!0}},{header:"Токенов до обрезки",width:30},{header:"Токенов после обрезки",width:30}],$.data.forEach(Q=>{y.addRow([Q.request,Q.expertAnswer,Q.llmAnswer,Q.evaluation,Q.mark,Q.llmFullAnswer]).eachCell(Ke=>{Ke.alignment={wrapText:!0,vertical:"top"}}),Z.addRow([Q.request,Q.sourcesOriginalTokenCount,Q.sourcesTokenCount])});const be=y.rowCount;J.getCell("A2").value={formula:`AVERAGE(Таблица!E2:Таблица!E${be})`,result:void 0},J.getCell("A2").font={bold:!0};const Te=await d.xlsx.writeBuffer(),ke=new Blob([Te],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),G=window.URL.createObjectURL(ke),ee=document.createElement("a");ee.href=G,ee.download=`${$.name}`,ee.click()};xt(()=>{setTimeout(()=>{s.length>0&&l(10,V=s[0])},1)});const ve=b=>ge(b),ie=()=>v(V.id);function we(){F=this.checked,l(5,F)}function fe(b){t.$$.not_equal(_.investigatorSettings,b)&&(_.investigatorSettings=b,l(2,_))}function ae(b){D=b,l(4,D)}function Se(){g=this.checked,l(8,g)}function at(b){I=b,l(3,I)}function $e(){B=Jt(this.value),l(9,B)}function Re(b){N=b,l(7,N)}function de(b){U=b,l(6,U)}const ut=()=>pe(a),He=()=>ce(a),et=b=>{he(oe,r[b.id]=!1,r)},rt=b=>{he(oe,r[b.id]=!0,r)},K=b=>{he(q,o[b.id]=!1,o)},X=b=>{he(x,i[b.id]=!0,i)},_t=b=>{he(q,o[b.id]=!1,o)},it=b=>{he(q,o[b.id]=!0,o)},Y=b=>{he(se,u[b.id]=!1,u)},gt=b=>{he(se,u[b.id]=!0,u)};function bt(b){c=b,k.set(c)}const tt=b=>l(10,V=b);return t.$$set=b=>{"data"in b&&l(30,E=b.data)},t.$$.update=()=>{t.$$.dirty[0]&3&&l(10,V=s.find(b=>b.id===a))},[s,a,_,I,D,F,U,N,g,B,V,re,n,r,i,o,u,c,k,f,H,q,se,oe,x,le,ge,pe,v,ce,E,ve,ie,we,fe,ae,Se,at,$e,Re,de,ut,He,et,rt,K,X,_t,it,Y,gt,bt,tt]}class cn extends nt{constructor(e){super(),st(this,e,xl,Zl,lt,{data:30},null,[-1,-1,-1])}}export{cn as component}; |