File size: 230,877 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import{s as ct,e as d,t as x,k as S,c as h,a as v,b as O,d as u,o as M,f as c,i as j,g as n,u as te,D as zl,h as $,n as xe,F as vt,p as gt,j as Se,C as Pe,y as ot,z as it,A as Ne,L as Is,q as ul,B as mt,H as Ml,I as Wt,J as Ht,G as fl,E as yt,K as Pl,N as Ds,r as dn,v as hn,w as vn,x as mn,l as $l,X as Mn,ag as Hl,Z as pt}from"../chunks/scheduler.DB3Sqaa-.js";import{S as ut,i as ft,b as he,d as ve,m as me,t as ee,g as bt,a as ae,c as wt,e as _e,f as Et,h as An}from"../chunks/index.CidI1d1E.js";import{t as Xe}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{f as Ys}from"../chunks/FileSaver.min.CimDdHIv.js";import{g as Al}from"../chunks/entry.JtQ7vg2d.js";import{p as _n,g as pn,q as Ln}from"../chunks/index.BS8UhGmM.js";import{v as Bn,w as Nn,x as xn,h as cl,y as On,z as tr,A as Hn,B as xs,C as gn,p as bn,D as Un,c as Pn,b as $n,f as jn,u as zn,e as Vl,E as Rn,i as Wn,d as wn,F as Zn}from"../chunks/index.CKAPQz6-.js";import{g as Fn}from"../chunks/index.j65IixI3.js";import{g as Yn}from"../chunks/index.DRsIFX6P.js";import{g as qn}from"../chunks/index.DPxQAFah.js";import{S as kn,g as Kn}from"../chunks/SensitiveInput.1HsQphUK.js";import{u as jl,B as Gn,W as yn,c as dl,j as bl,C as Xn,d as Vs,m as qs,v as Zt,w as Ot,y as Cl,h as Es,k as zs,D as Jn,x as Sl,s as il,E as Os,l as En,i as Rs,g as Qn,r as Hs,F as Us,p as eo,n as to,t as lo,f as so,z as ao}from"../chunks/index.DPWiq6NR.js";import{M as Rl}from"../chunks/Modal.DcRcsIox.js";import{e as ro,f as no,h as oo,i as io,j as co}from"../chunks/index.MWcCAAbc.js";import{g as uo}from"../chunks/index.BRB3dUu5.js";import{g as ql,j as fo,i as lr,c as Ws,d as ho,k as vo,l as mo}from"../chunks/index.DYGdzELC.js";import{T as Ft}from"../chunks/create.DJSy4-Dz.js";import{g as _o}from"../chunks/index.BDkw09Wf.js";import{e as nt}from"../chunks/each.cN4tVpvB.js";import{g as po}from"../chunks/index.CRzJ484K.js";import{A as go}from"../chunks/AdvancedParams.DH6VGWxz.js";import{b as bo}from"../chunks/index.FhJ0HtJK.js";import{S as In}from"../chunks/Switch.C2EOWhLk.js";import{d as Ts}from"../chunks/dayjs.min.CnqrW7zs.js";import{a as wo,u as ko,g as ys,d as yo,b as Eo,T as Io,A as Dn,S as Do,U as To,X as Vo}from"../chunks/XMark.DPj80KMq.js";import"../chunks/index.DQfRr7yB.js";import"../chunks/sha256.CRlV3BEV.js";import{D as Co,M as Ul}from"../chunks/Dropdown.6Kb6OfAV.js";import{b as So}from"../chunks/menu-trigger.Syw7IYi9.js";import{f as Mo}from"../chunks/index.DMdt0oYD.js";import{D as Ao,S as Lo,G as Tn}from"../chunks/DocumentDuplicate.B_gNfd5l.js";import{C as Bo}from"../chunks/ConfirmDialog.BhA26OgX.js";import{S as No}from"../chunks/Spinner.zSvxKTtJ.js";import{L as xo}from"../chunks/Loader.qRkPTPVG.js";import{g as Oo}from"../chunks/index.McBTOAZM.js";import{p as Ho}from"../chunks/stores.m3IJIQGn.js";import{f as Uo}from"../chunks/index.BronEFe7.js";const Po=(s,e)=>e.some(t=>s instanceof t);let sr,ar;function $o(){return sr||(sr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function jo(){return ar||(ar=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Vn=new WeakMap,Zs=new WeakMap,Cn=new WeakMap,Ps=new WeakMap,Ks=new WeakMap;function zo(s){const e=new Promise((t,l)=>{const a=()=>{s.removeEventListener("success",r),s.removeEventListener("error",o)},r=()=>{t(gl(s.result)),a()},o=()=>{l(s.error),a()};s.addEventListener("success",r),s.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Vn.set(t,s)}).catch(()=>{}),Ks.set(e,s),e}function Ro(s){if(Zs.has(s))return;const e=new Promise((t,l)=>{const a=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",o),s.removeEventListener("abort",o)},r=()=>{t(),a()},o=()=>{l(s.error||new DOMException("AbortError","AbortError")),a()};s.addEventListener("complete",r),s.addEventListener("error",o),s.addEventListener("abort",o)});Zs.set(s,e)}let Fs={get(s,e,t){if(s instanceof IDBTransaction){if(e==="done")return Zs.get(s);if(e==="objectStoreNames")return s.objectStoreNames||Cn.get(s);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return gl(s[e])},set(s,e,t){return s[e]=t,!0},has(s,e){return s instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in s}};function Wo(s){Fs=s(Fs)}function Zo(s){return s===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const l=s.call($s(this),e,...t);return Cn.set(l,e.sort?e.sort():[e]),gl(l)}:jo().includes(s)?function(...e){return s.apply($s(this),e),gl(Vn.get(this))}:function(...e){return gl(s.apply($s(this),e))}}function Fo(s){return typeof s=="function"?Zo(s):(s instanceof IDBTransaction&&Ro(s),Po(s,$o())?new Proxy(s,Fs):s)}function gl(s){if(s instanceof IDBRequest)return zo(s);if(Ps.has(s))return Ps.get(s);const e=Fo(s);return e!==s&&(Ps.set(s,e),Ks.set(e,s)),e}const $s=s=>Ks.get(s);function Yo(s,e,{blocked:t,upgrade:l,blocking:a,terminated:r}={}){const o=indexedDB.open(s,e),i=gl(o);return l&&o.addEventListener("upgradeneeded",f=>{l(gl(o.result),f.oldVersion,f.newVersion,gl(o.transaction),f)}),t&&o.addEventListener("blocked",f=>t(f.oldVersion,f.newVersion,f)),i.then(f=>{r&&f.addEventListener("close",()=>r()),a&&f.addEventListener("versionchange",m=>a(m.oldVersion,m.newVersion,m))}).catch(()=>{}),i}function rr(s,{blocked:e}={}){const t=indexedDB.deleteDatabase(s);return e&&t.addEventListener("blocked",l=>e(l.oldVersion,l)),gl(t).then(()=>{})}const qo=["get","getKey","getAll","getAllKeys","count"],Ko=["put","add","delete","clear"],js=new Map;function nr(s,e){if(!(s instanceof IDBDatabase&&!(e in s)&&typeof e=="string"))return;if(js.get(e))return js.get(e);const t=e.replace(/FromIndex$/,""),l=e!==t,a=Ko.includes(t);if(!(t in(l?IDBIndex:IDBObjectStore).prototype)||!(a||qo.includes(t)))return;const r=async function(o,...i){const f=this.transaction(o,a?"readwrite":"readonly");let m=f.store;return l&&(m=m.index(i.shift())),(await Promise.all([m[t](...i),a&&f.done]))[0]};return js.set(e,r),r}Wo(s=>({...s,get:(e,t,l)=>nr(e,t)||s.get(e,t,l),has:(e,t)=>!!nr(e,t)||s.has(e,t)}));function or(s){let e,t,l,a=s[4].t("Current Password")+"",r,o,i,f,m,g,_,p=s[4].t("New Password")+"",b,w,y,k,V,E,T,D=s[4].t("Confirm Password")+"",I,L,B,H,F,N,q,z=s[4].t("Update password")+"",C,A,R;return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("div"),f=d("input"),m=S(),g=d("div"),_=d("div"),b=x(p),w=S(),y=d("div"),k=d("input"),V=S(),E=d("div"),T=d("div"),I=x(D),L=S(),B=d("div"),H=d("input"),F=S(),N=d("div"),q=d("button"),C=x(z),this.h()},l(P){e=h(P,"DIV",{class:!0});var Z=v(e);t=h(Z,"DIV",{class:!0});var Y=v(t);l=h(Y,"DIV",{class:!0});var U=v(l);r=O(U,a),U.forEach(u),o=M(Y),i=h(Y,"DIV",{class:!0});var W=v(i);f=h(W,"INPUT",{class:!0,type:!0,autocomplete:!0}),W.forEach(u),Y.forEach(u),m=M(Z),g=h(Z,"DIV",{class:!0});var X=v(g);_=h(X,"DIV",{class:!0});var G=v(_);b=O(G,p),G.forEach(u),w=M(X),y=h(X,"DIV",{class:!0});var K=v(y);k=h(K,"INPUT",{class:!0,type:!0,autocomplete:!0}),K.forEach(u),X.forEach(u),V=M(Z),E=h(Z,"DIV",{class:!0});var J=v(E);T=h(J,"DIV",{class:!0});var Q=v(T);I=O(Q,D),Q.forEach(u),L=M(J),B=h(J,"DIV",{class:!0});var ue=v(B);H=h(ue,"INPUT",{class:!0,type:!0,autocomplete:!0}),ue.forEach(u),J.forEach(u),Z.forEach(u),F=M(P),N=h(P,"DIV",{class:!0});var ke=v(N);q=h(ke,"BUTTON",{class:!0});var Ee=v(q);C=O(Ee,z),Ee.forEach(u),ke.forEach(u),this.h()},h(){c(l,"class","mb-1 text-xs text-gray-500"),c(f,"class","w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"),c(f,"type","password"),c(f,"autocomplete","current-password"),f.required=!0,c(i,"class","flex-1"),c(t,"class","flex flex-col w-full"),c(_,"class","mb-1 text-xs text-gray-500"),c(k,"class","w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"),c(k,"type","password"),c(k,"autocomplete","new-password"),k.required=!0,c(y,"class","flex-1"),c(g,"class","flex flex-col w-full"),c(T,"class","mb-1 text-xs text-gray-500"),c(H,"class","w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"),c(H,"type","password"),c(H,"autocomplete","off"),H.required=!0,c(B,"class","flex-1"),c(E,"class","flex flex-col w-full"),c(e,"class","py-2.5 space-y-1.5"),c(q,"class","px-4 py-2 text-xs bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-800 text-gray-100 transition rounded-md font-medium"),c(N,"class","mt-3 flex justify-end")},m(P,Z){j(P,e,Z),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(i,f),Pe(f,s[1]),n(e,m),n(e,g),n(g,_),n(_,b),n(g,w),n(g,y),n(y,k),Pe(k,s[2]),n(e,V),n(e,E),n(E,T),n(T,I),n(E,L),n(E,B),n(B,H),Pe(H,s[3]),j(P,F,Z),j(P,N,Z),n(N,q),n(q,C),A||(R=[te(f,"input",s[8]),te(k,"input",s[9]),te(H,"input",s[10])],A=!0)},p(P,Z){Z&16&&a!==(a=P[4].t("Current Password")+"")&&$(r,a),Z&2&&f.value!==P[1]&&Pe(f,P[1]),Z&16&&p!==(p=P[4].t("New Password")+"")&&$(b,p),Z&4&&k.value!==P[2]&&Pe(k,P[2]),Z&16&&D!==(D=P[4].t("Confirm Password")+"")&&$(I,D),Z&8&&H.value!==P[3]&&Pe(H,P[3]),Z&16&&z!==(z=P[4].t("Update password")+"")&&$(C,z)},d(P){P&&(u(e),u(F),u(N)),A=!1,vt(R)}}}function Go(s){let e,t,l,a=s[4].t("Change Password")+"",r,o,i,f=(s[0]?s[4].t("Hide"):s[4].t("Show"))+"",m,g,_,p,b=s[0]&&or(s);return{c(){e=d("form"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),m=x(f),g=S(),b&&b.c(),this.h()},l(w){e=h(w,"FORM",{class:!0});var y=v(e);t=h(y,"DIV",{class:!0});var k=v(t);l=h(k,"DIV",{class:!0});var V=v(l);r=O(V,a),V.forEach(u),o=M(k),i=h(k,"BUTTON",{class:!0,type:!0});var E=v(i);m=O(E,f),E.forEach(u),k.forEach(u),g=M(y),b&&b.l(y),y.forEach(u),this.h()},h(){c(l,"class","font-medium"),c(i,"class","text-xs font-medium text-gray-500"),c(i,"type","button"),c(t,"class","flex justify-between items-center text-sm"),c(e,"class","flex flex-col text-sm")},m(w,y){j(w,e,y),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(i,m),n(e,g),b&&b.m(e,null),_||(p=[te(i,"click",s[7]),te(e,"submit",zl(s[11]))],_=!0)},p(w,[y]){y&16&&a!==(a=w[4].t("Change Password")+"")&&$(r,a),y&17&&f!==(f=(w[0]?w[4].t("Hide"):w[4].t("Show"))+"")&&$(m,f),w[0]?b?b.p(w,y):(b=or(w),b.c(),b.m(e,null)):b&&(b.d(1),b=null)},i:xe,o:xe,d(w){w&&u(e),b&&b.d(),_=!1,vt(p)}}}function Xo(s,e,t){let l;const a=gt("i18n");Se(s,a,y=>t(4,l=y));let r=!1,o="",i="",f="";const m=async()=>{i===f?(await ro(localStorage.token,o,i).catch(k=>(Xe.error(k),null))&&Xe.success(l.t("Successfully updated.")),t(1,o=""),t(2,i=""),t(3,f="")):(Xe.error("The passwords you entered don't quite match. Please double-check and try again."),t(2,i=""),t(3,f=""))},g=()=>{t(0,r=!r)};function _(){o=this.value,t(1,o)}function p(){i=this.value,t(2,i)}function b(){f=this.value,t(3,f)}return[r,o,i,f,l,a,m,g,_,p,b,()=>{m()}]}class Jo extends ut{constructor(e){super(),ft(this,e,Xo,Go,ct,{})}}function Qo(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var a=v(e);t=it(a,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"stroke-linecap","round"),c(t,"stroke-linejoin","round"),c(t,"d","M12 4.5v15m7.5-7.5h-15"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"fill","none"),c(e,"viewBox","0 0 24 24"),c(e,"stroke-width",s[1]),c(e,"stroke","currentColor"),c(e,"class",s[0])},m(l,a){j(l,e,a),n(e,t)},p(l,[a]){a&2&&c(e,"stroke-width",l[1]),a&1&&c(e,"class",l[0])},i:xe,o:xe,d(l){l&&u(e)}}}function ei(s,e,t){let{className:l="w-4 h-4"}=e,{strokeWidth:a="1.5"}=e;return s.$$set=r=>{"className"in r&&t(0,l=r.className),"strokeWidth"in r&&t(1,a=r.strokeWidth)},[l,a]}class ti extends ut{constructor(e){super(),ft(this,e,ei,Qo,ct,{className:0,strokeWidth:1})}}function ir(s){let e,t,l,a,r=s[9].t("JWT Token")+"",o,i,f,m,g,_,p,b,w,y,k=s[9].t("API Key")+"",V,E,T,D,I,L,B,H;m=new kn({props:{value:localStorage.token,readOnly:!0}});function F(R,P){return R[4]?si:li}let N=F(s),q=N(s);const z=[ri,ai],C=[];function A(R,P){return R[5]?0:1}return D=A(s),I=C[D]=z[D](s),{c(){e=d("div"),t=d("div"),l=d("div"),a=d("div"),o=x(r),i=S(),f=d("div"),he(m.$$.fragment),g=S(),_=d("button"),q.c(),p=S(),b=d("div"),w=d("div"),y=d("div"),V=x(k),E=S(),T=d("div"),I.c(),this.h()},l(R){e=h(R,"DIV",{class:!0});var P=v(e);t=h(P,"DIV",{class:!0});var Z=v(t);l=h(Z,"DIV",{class:!0});var Y=v(l);a=h(Y,"DIV",{class:!0});var U=v(a);o=O(U,r),U.forEach(u),Y.forEach(u),i=M(Z),f=h(Z,"DIV",{class:!0});var W=v(f);ve(m.$$.fragment,W),g=M(W),_=h(W,"BUTTON",{class:!0});var X=v(_);q.l(X),X.forEach(u),W.forEach(u),Z.forEach(u),p=M(P),b=h(P,"DIV",{class:!0});var G=v(b);w=h(G,"DIV",{class:!0});var K=v(w);y=h(K,"DIV",{class:!0});var J=v(y);V=O(J,k),J.forEach(u),K.forEach(u),E=M(G),T=h(G,"DIV",{class:!0});var Q=v(T);I.l(Q),Q.forEach(u),G.forEach(u),P.forEach(u),this.h()},h(){c(a,"class","self-center text-xs font-medium"),c(l,"class","flex justify-between w-full"),c(_,"class","ml-1.5 px-1.5 py-1 dark:hover:bg-gray-850 transition rounded-lg"),c(f,"class","flex mt-2"),c(t,"class","justify-between w-full"),c(y,"class","self-center text-xs font-medium"),c(w,"class","flex justify-between w-full"),c(T,"class","flex mt-2"),c(b,"class","justify-between w-full"),c(e,"class","flex flex-col gap-4")},m(R,P){j(R,e,P),n(e,t),n(t,l),n(l,a),n(a,o),n(t,i),n(t,f),me(m,f,null),n(f,g),n(f,_),q.m(_,null),n(e,p),n(e,b),n(b,w),n(w,y),n(y,V),n(b,E),n(b,T),C[D].m(T,null),L=!0,B||(H=te(_,"click",s[21]),B=!0)},p(R,P){(!L||P&512)&&r!==(r=R[9].t("JWT Token")+"")&&$(o,r),N!==(N=F(R))&&(q.d(1),q=N(R),q&&(q.c(),q.m(_,null))),(!L||P&512)&&k!==(k=R[9].t("API Key")+"")&&$(V,k);let Z=D;D=A(R),D===Z?C[D].p(R,P):(bt(),ae(C[Z],1,1,()=>{C[Z]=null}),wt(),I=C[D],I?I.p(R,P):(I=C[D]=z[D](R),I.c()),ee(I,1),I.m(T,null))},i(R){L||(ee(m.$$.fragment,R),ee(I),L=!0)},o(R){ae(m.$$.fragment,R),ae(I),L=!1},d(R){R&&u(e),_e(m),q.d(),C[D].d(),B=!1,H()}}}function li(s){let e,t,l;return{c(){e=ot("svg"),t=ot("path"),l=ot("path"),this.h()},l(a){e=it(a,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var r=v(e);t=it(r,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(t).forEach(u),l=it(r,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(l).forEach(u),r.forEach(u),this.h()},h(){c(t,"fill-rule","evenodd"),c(t,"d","M11.986 3H12a2 2 0 0 1 2 2v6a2 2 0 0 1-1.5 1.937V7A2.5 2.5 0 0 0 10 4.5H4.063A2 2 0 0 1 6 3h.014A2.25 2.25 0 0 1 8.25 1h1.5a2.25 2.25 0 0 1 2.236 2ZM10.5 4v-.75a.75.75 0 0 0-.75-.75h-1.5a.75.75 0 0 0-.75.75V4h3Z"),c(t,"clip-rule","evenodd"),c(l,"fill-rule","evenodd"),c(l,"d","M3 6a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm1.75 2.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5ZM4 11.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z"),c(l,"clip-rule","evenodd"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 16 16"),c(e,"fill","currentColor"),c(e,"class","w-4 h-4")},m(a,r){j(a,e,r),n(e,t),n(e,l)},d(a){a&&u(e)}}}function si(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var a=v(e);t=it(a,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"fill-rule","evenodd"),c(t,"d","M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"),c(t,"clip-rule","evenodd"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 20 20"),c(e,"fill","currentColor"),c(e,"class","w-4 h-4")},m(l,a){j(l,e,a),n(e,t)},d(l){l&&u(e)}}}function ai(s){let e,t,l,a=s[9].t("Create new secret key")+"",r,o,i,f;return t=new ti({props:{strokeWidth:"2",className:" size-3.5"}}),{c(){e=d("button"),he(t.$$.fragment),l=S(),r=x(a),this.h()},l(m){e=h(m,"BUTTON",{class:!0});var g=v(e);ve(t.$$.fragment,g),l=M(g),r=O(g,a),g.forEach(u),this.h()},h(){c(e,"class","flex gap-1.5 items-center font-medium px-3.5 py-1.5 rounded-lg bg-gray-100/70 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-850 transition")},m(m,g){j(m,e,g),me(t,e,null),n(e,l),n(e,r),o=!0,i||(f=te(e,"click",s[24]),i=!0)},p(m,g){(!o||g&512)&&a!==(a=m[9].t("Create new secret key")+"")&&$(r,a)},i(m){o||(ee(t.$$.fragment,m),o=!0)},o(m){ae(t.$$.fragment,m),o=!1},d(m){m&&u(e),_e(t),i=!1,f()}}}function ri(s){let e,t,l,a,r,o,i,f;e=new kn({props:{value:s[5],readOnly:!0}});function m(p,b){return p[6]?oi:ni}let g=m(s),_=g(s);return r=new Ft({props:{content:s[9].t("Create new key"),$$slots:{default:[ii]},$$scope:{ctx:s}}}),{c(){he(e.$$.fragment),t=S(),l=d("button"),_.c(),a=S(),he(r.$$.fragment),this.h()},l(p){ve(e.$$.fragment,p),t=M(p),l=h(p,"BUTTON",{class:!0});var b=v(l);_.l(b),b.forEach(u),a=M(p),ve(r.$$.fragment,p),this.h()},h(){c(l,"class","ml-1.5 px-1.5 py-1 dark:hover:bg-gray-850 transition rounded-lg")},m(p,b){me(e,p,b),j(p,t,b),j(p,l,b),_.m(l,null),j(p,a,b),me(r,p,b),o=!0,i||(f=te(l,"click",s[22]),i=!0)},p(p,b){const w={};b&32&&(w.value=p[5]),e.$set(w),g!==(g=m(p))&&(_.d(1),_=g(p),_&&(_.c(),_.m(l,null)));const y={};b&512&&(y.content=p[9].t("Create new key")),b&67108864&&(y.$$scope={dirty:b,ctx:p}),r.$set(y)},i(p){o||(ee(e.$$.fragment,p),ee(r.$$.fragment,p),o=!0)},o(p){ae(e.$$.fragment,p),ae(r.$$.fragment,p),o=!1},d(p){p&&(u(t),u(l),u(a)),_e(e,p),_.d(),_e(r,p),i=!1,f()}}}function ni(s){let e,t,l;return{c(){e=ot("svg"),t=ot("path"),l=ot("path"),this.h()},l(a){e=it(a,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var r=v(e);t=it(r,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(t).forEach(u),l=it(r,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(l).forEach(u),r.forEach(u),this.h()},h(){c(t,"fill-rule","evenodd"),c(t,"d","M11.986 3H12a2 2 0 0 1 2 2v6a2 2 0 0 1-1.5 1.937V7A2.5 2.5 0 0 0 10 4.5H4.063A2 2 0 0 1 6 3h.014A2.25 2.25 0 0 1 8.25 1h1.5a2.25 2.25 0 0 1 2.236 2ZM10.5 4v-.75a.75.75 0 0 0-.75-.75h-1.5a.75.75 0 0 0-.75.75V4h3Z"),c(t,"clip-rule","evenodd"),c(l,"fill-rule","evenodd"),c(l,"d","M3 6a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm1.75 2.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5ZM4 11.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z"),c(l,"clip-rule","evenodd"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 16 16"),c(e,"fill","currentColor"),c(e,"class","w-4 h-4")},m(a,r){j(a,e,r),n(e,t),n(e,l)},d(a){a&&u(e)}}}function oi(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var a=v(e);t=it(a,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"fill-rule","evenodd"),c(t,"d","M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"),c(t,"clip-rule","evenodd"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 20 20"),c(e,"fill","currentColor"),c(e,"class","w-4 h-4")},m(l,a){j(l,e,a),n(e,t)},d(l){l&&u(e)}}}function ii(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-4"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"></path></svg>',l,a;return{c(){e=d("button"),e.innerHTML=t,this.h()},l(r){e=h(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-olpspw"&&(e.innerHTML=t),this.h()},h(){c(e,"class","px-1.5 py-1 dark:hover:bg-gray-850transition rounded-lg")},m(r,o){j(r,e,o),l||(a=te(e,"click",s[23]),l=!0)},p:xe,d(r){r&&u(e),l=!1,a()}}}function ci(s){let e,t,l,a,r,o,i,f,m,g,_,p,b,w='<div class="my-auto text-gray-100"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"></path></svg></div>',y,k,V,E=s[9].t("Profile Image")+"",T,D,I,L,B=s[9].t("Use Initials")+"",H,F,N,q=s[9].t("Use Gravatar")+"",z,C,A,R=s[9].t("Remove")+"",P,Z,Y,U,W,X=s[9].t("Name")+"",G,K,J,Q,ue,ke,Ee,Me,Oe,je,pe,He,We=s[9].t("API keys")+"",Be,Qe,se,de=(s[3]?s[9].t("Hide"):s[9].t("Show"))+"",De,ie,Te,ge,ze,re=s[9].t("Save")+"",Ve,ce,ye,Je;Ee=new Jo({});let le=s[3]&&ir(s);return{c(){e=d("div"),t=d("div"),l=d("input"),a=S(),r=d("div"),o=d("div"),i=d("div"),f=d("div"),m=d("button"),g=d("img"),p=S(),b=d("div"),b.innerHTML=w,y=S(),k=d("div"),V=d("div"),T=x(E),D=S(),I=d("div"),L=d("button"),H=x(B),F=S(),N=d("button"),z=x(q),C=S(),A=d("button"),P=x(R),Z=S(),Y=d("div"),U=d("div"),W=d("div"),G=x(X),K=S(),J=d("div"),Q=d("input"),ue=S(),ke=d("div"),he(Ee.$$.fragment),Me=S(),Oe=d("hr"),je=S(),pe=d("div"),He=d("div"),Be=x(We),Qe=S(),se=d("button"),De=x(de),ie=S(),le&&le.c(),Te=S(),ge=d("div"),ze=d("button"),Ve=x(re),this.h()},l(oe){e=h(oe,"DIV",{class:!0});var be=v(e);t=h(be,"DIV",{class:!0});var Le=v(t);l=h(Le,"INPUT",{id:!0,type:!0,accept:!0}),a=M(Le),r=h(Le,"DIV",{class:!0});var et=v(r);o=h(et,"DIV",{class:!0});var $e=v(o);i=h($e,"DIV",{class:!0});var Re=v(i);f=h(Re,"DIV",{class:!0});var qe=v(f);m=h(qe,"BUTTON",{class:!0,type:!0});var tt=v(m);g=h(tt,"IMG",{src:!0,alt:!0,class:!0}),p=M(tt),b=h(tt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(b)!=="svelte-11ivb2j"&&(b.innerHTML=w),tt.forEach(u),qe.forEach(u),Re.forEach(u),y=M($e),k=h($e,"DIV",{class:!0});var lt=v(k);V=h(lt,"DIV",{class:!0});var Ze=v(V);T=O(Ze,E),Ze.forEach(u),D=M(lt),I=h(lt,"DIV",{});var st=v(I);L=h(st,"BUTTON",{class:!0});var Ye=v(L);H=O(Ye,B),Ye.forEach(u),F=M(st),N=h(st,"BUTTON",{class:!0});var Fe=v(N);z=O(Fe,q),Fe.forEach(u),C=M(st),A=h(st,"BUTTON",{class:!0});var Ae=v(A);P=O(Ae,R),Ae.forEach(u),st.forEach(u),lt.forEach(u),$e.forEach(u),Z=M(et),Y=h(et,"DIV",{class:!0});var at=v(Y);U=h(at,"DIV",{class:!0});var Tt=v(U);W=h(Tt,"DIV",{class:!0});var rt=v(W);G=O(rt,X),rt.forEach(u),K=M(Tt),J=h(Tt,"DIV",{class:!0});var _t=v(J);Q=h(_t,"INPUT",{class:!0,type:!0}),_t.forEach(u),Tt.forEach(u),at.forEach(u),et.forEach(u),ue=M(Le),ke=h(Le,"DIV",{class:!0});var Ue=v(ke);ve(Ee.$$.fragment,Ue),Ue.forEach(u),Me=M(Le),Oe=h(Le,"HR",{class:!0}),je=M(Le),pe=h(Le,"DIV",{class:!0});var Ie=v(pe);He=h(Ie,"DIV",{class:!0});var fe=v(He);Be=O(fe,We),fe.forEach(u),Qe=M(Ie),se=h(Ie,"BUTTON",{class:!0,type:!0});var we=v(se);De=O(we,de),we.forEach(u),Ie.forEach(u),ie=M(Le),le&&le.l(Le),Le.forEach(u),Te=M(be),ge=h(be,"DIV",{class:!0});var Ke=v(ge);ze=h(Ke,"BUTTON",{class:!0});var At=v(ze);Ve=O(At,re),At.forEach(u),Ke.forEach(u),be.forEach(u),this.h()},h(){c(l,"id","profile-image-input"),c(l,"type","file"),l.hidden=!0,c(l,"accept","image/*"),Is(g.src,_=s[1]!==""?s[1]:ql(s[2]))||c(g,"src",_),c(g,"alt","profile"),c(g,"class","rounded-full size-16 object-cover"),c(b,"class","absolute flex justify-center rounded-full bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-gray-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-50"),c(m,"class","relative rounded-full dark:bg-gray-700"),c(m,"type","button"),c(f,"class","self-center mt-2"),c(i,"class","flex flex-col"),c(V,"class","mb-0.5 text-sm font-medium"),c(L,"class","text-xs text-center text-gray-800 dark:text-gray-400 rounded-full px-4 py-0.5 bg-gray-100 dark:bg-gray-850"),c(N,"class","text-xs text-center text-gray-800 dark:text-gray-400 rounded-full px-4 py-0.5 bg-gray-100 dark:bg-gray-850"),c(A,"class","text-xs text-center text-gray-800 dark:text-gray-400 rounded-lg px-2 py-1"),c(k,"class","flex-1 flex flex-col self-center gap-0.5"),c(o,"class","flex space-x-5"),c(W,"class","mb-1 text-xs font-medium"),c(Q,"class","w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"),c(Q,"type","text"),Q.required=!0,c(J,"class","flex-1"),c(U,"class","flex flex-col w-full"),c(Y,"class","pt-0.5"),c(r,"class","space-y-1"),c(ke,"class","py-0.5"),c(Oe,"class","dark:border-gray-850 my-4"),c(He,"class","font-medium"),c(se,"class","text-xs font-medium text-gray-500"),c(se,"type","button"),c(pe,"class","flex justify-between items-center text-sm"),c(t,"class","space-y-3 pr-1.5 overflow-y-scroll max-h-[25rem]"),c(ze,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(ge,"class","flex justify-end pt-3 text-sm font-medium"),c(e,"class","flex flex-col h-full justify-between text-sm")},m(oe,be){j(oe,e,be),n(e,t),n(t,l),s[13](l),n(t,a),n(t,r),n(r,o),n(o,i),n(i,f),n(f,m),n(m,g),n(m,p),n(m,b),n(o,y),n(o,k),n(k,V),n(V,T),n(k,D),n(k,I),n(I,L),n(L,H),n(I,F),n(I,N),n(N,z),n(I,C),n(I,A),n(A,P),n(r,Z),n(r,Y),n(Y,U),n(U,W),n(W,G),n(U,K),n(U,J),n(J,Q),Pe(Q,s[2]),n(t,ue),n(t,ke),me(Ee,ke,null),n(t,Me),n(t,Oe),n(t,je),n(t,pe),n(pe,He),n(He,Be),n(pe,Qe),n(pe,se),n(se,De),n(t,ie),le&&le.m(t,null),n(e,Te),n(e,ge),n(ge,ze),n(ze,Ve),ce=!0,ye||(Je=[te(l,"change",s[14]),te(m,"click",s[15]),te(L,"click",s[16]),te(N,"click",s[17]),te(A,"click",s[18]),te(Q,"input",s[19]),te(se,"click",s[20]),te(ze,"click",s[25])],ye=!0)},p(oe,[be]){(!ce||be&6&&!Is(g.src,_=oe[1]!==""?oe[1]:ql(oe[2])))&&c(g,"src",_),(!ce||be&512)&&E!==(E=oe[9].t("Profile Image")+"")&&$(T,E),(!ce||be&512)&&B!==(B=oe[9].t("Use Initials")+"")&&$(H,B),(!ce||be&512)&&q!==(q=oe[9].t("Use Gravatar")+"")&&$(z,q),(!ce||be&512)&&R!==(R=oe[9].t("Remove")+"")&&$(P,R),(!ce||be&512)&&X!==(X=oe[9].t("Name")+"")&&$(G,X),be&4&&Q.value!==oe[2]&&Pe(Q,oe[2]),(!ce||be&512)&&We!==(We=oe[9].t("API keys")+"")&&$(Be,We),(!ce||be&520)&&de!==(de=(oe[3]?oe[9].t("Hide"):oe[9].t("Show"))+"")&&$(De,de),oe[3]?le?(le.p(oe,be),be&8&&ee(le,1)):(le=ir(oe),le.c(),ee(le,1),le.m(t,null)):le&&(bt(),ae(le,1,1,()=>{le=null}),wt()),(!ce||be&512)&&re!==(re=oe[9].t("Save")+"")&&$(Ve,re)},i(oe){ce||(ee(Ee.$$.fragment,oe),ee(le),ce=!0)},o(oe){ae(Ee.$$.fragment,oe),ae(le),ce=!1},d(oe){oe&&u(e),s[13](null),_e(Ee),le&&le.d(),ye=!1,vt(Je)}}}function ui(s,e,t){let l,a;Se(s,jl,C=>t(8,l=C));const r=gt("i18n");Se(s,r,C=>t(9,a=C));let{saveHandler:o}=e,i="",f="",m=!1,g=!1,_="",p=!1,b;const w=async()=>{f!==l.name&&(i===ql(l.name)||i==="")&&t(1,i=ql(f));const C=await oo(localStorage.token,f,i).catch(A=>{Xe.error(A)});return C?(await jl.set(C),!0):!1},y=async()=>{t(5,_=await io(localStorage.token)),_?Xe.success(a.t("API Key created.")):Xe.error(a.t("Failed to create API Key."))};ul(async()=>{t(2,f=l.name),t(1,i=l.profile_image_url),t(5,_=await no(localStorage.token).catch(C=>(console.log(C),"")))});function k(C){mt[C?"unshift":"push"](()=>{b=C,t(7,b)})}const V=C=>{const A=b.files??[];let R=new FileReader;R.onload=P=>{let Z=`${P.target.result}`;const Y=new Image;Y.src=Z,Y.onload=function(){const U=document.createElement("canvas"),W=U.getContext("2d"),X=Y.width/Y.height;let G,K;X>1?(G=100*X,K=100):(G=100,K=100/X),U.width=100,U.height=100;const J=(100-G)/2,Q=(100-K)/2;W.drawImage(Y,J,Q,G,K);const ue=U.toDataURL("image/jpeg");t(1,i=ue),t(7,b.files=null,b)}},A.length>0&&["image/gif","image/webp","image/jpeg","image/png"].includes(A[0].type)&&R.readAsDataURL(A[0])},E=()=>{b.click()},T=async()=>{fo()?t(1,i=ql(f)):Xe.info(a.t("Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image."),{duration:1e3*10})},D=async()=>{const C=await uo(l.email);t(1,i=C)},I=async()=>{t(1,i="/user.png")};function L(){f=this.value,t(2,f)}const B=()=>{t(3,m=!m)},H=()=>{lr(localStorage.token),t(4,g=!0),setTimeout(()=>{t(4,g=!1)},2e3)},F=()=>{lr(_),t(6,p=!0),setTimeout(()=>{t(6,p=!1)},2e3)},N=()=>{y()},q=()=>{y()},z=async()=>{await w()&&o()};return s.$$set=C=>{"saveHandler"in C&&t(0,o=C.saveHandler)},[o,i,f,m,g,_,p,b,l,a,r,w,y,k,V,E,T,D,I,L,B,H,F,N,q,z]}class fi extends ut{constructor(e){super(),ft(this,e,ui,ci,ct,{saveHandler:0})}}function di(s){let e,t;return{c(){e=x("v"),t=x(dl)},l(l){e=O(l,"v"),t=O(l,dl)},m(l,a){j(l,e,a),j(l,t,a)},p:xe,d(l){l&&(u(e),u(t))}}}function cr(s){let e,t,l,a,r=s[4].t("Ollama Version")+"",o,i,f,m,g=(s[0]??"N/A")+"",_;return{c(){e=d("hr"),t=S(),l=d("div"),a=d("div"),o=x(r),i=S(),f=d("div"),m=d("div"),_=x(g),this.h()},l(p){e=h(p,"HR",{class:!0}),t=M(p),l=h(p,"DIV",{});var b=v(l);a=h(b,"DIV",{class:!0});var w=v(a);o=O(w,r),w.forEach(u),i=M(b),f=h(b,"DIV",{class:!0});var y=v(f);m=h(y,"DIV",{class:!0});var k=v(m);_=O(k,g),k.forEach(u),y.forEach(u),b.forEach(u),this.h()},h(){c(e,"class","dark:border-gray-850"),c(a,"class","mb-2.5 text-sm font-medium"),c(m,"class","flex-1 text-xs text-gray-700 dark:text-gray-200"),c(f,"class","flex w-full")},m(p,b){j(p,e,b),j(p,t,b),j(p,l,b),n(l,a),n(a,o),n(l,i),n(l,f),n(f,m),n(m,_)},p(p,b){b&16&&r!==(r=p[4].t("Ollama Version")+"")&&$(o,r),b&1&&g!==(g=(p[0]??"N/A")+"")&&$(_,g)},d(p){p&&(u(e),u(t),u(l))}}}function ur(s){let e,t,l;return{c(){e=d("span"),t=x(s[3]),l=x(" -"),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);t=O(r,s[3]),r.forEach(u),l=O(a," -"),this.h()},h(){c(e,"class","text-gray-500 dark:text-gray-300 font-medium")},m(a,r){j(a,e,r),n(e,t),j(a,l,r)},p(a,r){r&8&&$(t,a[3])},d(a){a&&(u(e),u(l))}}}function hi(s){let e,t,l,a,r,o,i,f=s[4].t("Version")+"",m,g,_,p,b,w,y,k,V=(s[1]===null?s[4].t("Checking for updates..."):s[1]?`(v${s[2].latest} ${s[4].t("available!")})`:s[4].t("(latest)"))+"",E,T,D,I=s[4].t("Check for updates")+"",L,B,H,F,N,q,z=!s[3].includes("Open WebUI"),C,A=s[4].t("Created by")+"",R,P,Z,Y="ZD AI Lab",U,W,X;w=new Ft({props:{content:Gn,$$slots:{default:[di]},$$scope:{ctx:s}}});let G=s[0]&&cr(s),K=z&&ur(s);return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("div"),r=d("div"),o=x(s[3]),i=S(),m=x(f),g=S(),_=d("div"),p=d("div"),b=d("div"),he(w.$$.fragment),y=S(),k=d("a"),E=x(V),T=S(),D=d("button"),L=x(I),B=S(),G&&G.c(),H=S(),F=d("hr"),N=S(),q=d("div"),K&&K.c(),C=S(),R=x(A),P=S(),Z=d("a"),Z.textContent=Y,this.h()},l(J){e=h(J,"DIV",{class:!0});var Q=v(e);t=h(Q,"DIV",{class:!0});var ue=v(t);l=h(ue,"DIV",{});var ke=v(l);a=h(ke,"DIV",{class:!0});var Ee=v(a);r=h(Ee,"DIV",{});var Me=v(r);o=O(Me,s[3]),i=M(Me),m=O(Me,f),Me.forEach(u),Ee.forEach(u),g=M(ke),_=h(ke,"DIV",{class:!0});var Oe=v(_);p=h(Oe,"DIV",{class:!0});var je=v(p);b=h(je,"DIV",{class:!0});var pe=v(b);ve(w.$$.fragment,pe),y=M(pe),k=h(pe,"A",{href:!0,target:!0});var He=v(k);E=O(He,V),He.forEach(u),pe.forEach(u),je.forEach(u),T=M(Oe),D=h(Oe,"BUTTON",{class:!0});var We=v(D);L=O(We,I),We.forEach(u),Oe.forEach(u),ke.forEach(u),B=M(ue),G&&G.l(ue),H=M(ue),F=h(ue,"HR",{class:!0}),N=M(ue),q=h(ue,"DIV",{class:!0});var Be=v(q);K&&K.l(Be),C=M(Be),R=O(Be,A),P=M(Be),Z=h(Be,"A",{class:!0,href:!0,target:!0,"data-svelte-h":!0}),Ne(Z)!=="svelte-1axju8l"&&(Z.textContent=Y),Be.forEach(u),ue.forEach(u),Q.forEach(u),this.h()},h(){c(a,"class","mb-2.5 text-sm font-medium flex space-x-2 items-center"),c(k,"href","#"),c(k,"target","_blank"),c(b,"class","flex gap-1"),c(p,"class","flex flex-col text-xs text-gray-700 dark:text-gray-200"),c(D,"class","text-xs px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"),c(_,"class","flex w-full justify-between items-center"),c(F,"class","dark:border-gray-850"),c(Z,"class","text-gray-500 dark:text-gray-300 font-medium"),c(Z,"href","https://huggingface.co/zdAI"),c(Z,"target","_blank"),c(q,"class","mt-2 text-xs text-gray-400 dark:text-gray-500"),c(t,"class","space-y-3"),c(e,"class","flex flex-col h-full justify-between space-y-3 text-sm mb-6")},m(J,Q){j(J,e,Q),n(e,t),n(t,l),n(l,a),n(a,r),n(r,o),n(r,i),n(r,m),n(l,g),n(l,_),n(_,p),n(p,b),me(w,b,null),n(b,y),n(b,k),n(k,E),n(_,T),n(_,D),n(D,L),n(t,B),G&&G.m(t,null),n(t,H),n(t,F),n(t,N),n(t,q),K&&K.m(q,null),n(q,C),n(q,R),n(q,P),n(q,Z),U=!0,W||(X=te(D,"click",s[7]),W=!0)},p(J,[Q]){(!U||Q&8)&&$(o,J[3]),(!U||Q&16)&&f!==(f=J[4].t("Version")+"")&&$(m,f);const ue={};Q&256&&(ue.$$scope={dirty:Q,ctx:J}),w.$set(ue),(!U||Q&22)&&V!==(V=(J[1]===null?J[4].t("Checking for updates..."):J[1]?`(v${J[2].latest} ${J[4].t("available!")})`:J[4].t("(latest)"))+"")&&$(E,V),(!U||Q&16)&&I!==(I=J[4].t("Check for updates")+"")&&$(L,I),J[0]?G?G.p(J,Q):(G=cr(J),G.c(),G.m(t,H)):G&&(G.d(1),G=null),Q&8&&(z=!J[3].includes("Open WebUI")),z?K?K.p(J,Q):(K=ur(J),K.c(),K.m(q,C)):K&&(K.d(1),K=null),(!U||Q&16)&&A!==(A=J[4].t("Created by")+"")&&$(R,A)},i(J){U||(ee(w.$$.fragment,J),U=!0)},o(J){ae(w.$$.fragment,J),U=!1},d(J){J&&u(e),_e(w),G&&G.d(),K&&K.d(),W=!1,X()}}}function vi(s,e,t){let l,a;Se(s,yn,_=>t(3,l=_));const r=gt("i18n");Se(s,r,_=>t(4,a=_));let o="",i=null,f={current:"",latest:""};const m=async()=>{t(1,i=null),t(2,f=await _n().catch(_=>({current:dl,latest:dl}))),console.log(f),t(1,i=Ws(f.latest,f.current)),console.log(i)};return ul(async()=>{t(0,o=await _o(localStorage.token).catch(_=>"")),m()}),[o,i,f,l,a,r,m,()=>{m()}]}class mi extends ut{constructor(e){super(),ft(this,e,vi,hi,ct,{})}}function fr(s,e,t){const l=s.slice();return l[33]=e[t],l}function dr(s){let e,t=s[33].title+"",l,a;return{c(){e=d("option"),l=x(t),this.h()},l(r){e=h(r,"OPTION",{});var o=v(e);l=O(o,t),o.forEach(u),this.h()},h(){e.__value=a=s[33].code,Pe(e,e.__value)},m(r,o){j(r,e,o),n(e,l)},p(r,o){o[0]&4&&t!==(t=r[33].title+"")&&$(l,t),o[0]&4&&a!==(a=r[33].code)&&(e.__value=a,Pe(e,e.__value))},d(r){r&&u(e)}}}function hr(s){let e,t=`Couldn't find your language?
<a class="text-gray-300 font-medium underline" href="https://github.com/open-webui/open-webui/blob/main/docs/CONTRIBUTING.md#-translations-and-internationalization" target="_blank">Help us translate Open WebUI!</a>`;return{c(){e=d("div"),e.innerHTML=t,this.h()},l(l){e=h(l,"DIV",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-3hlwzt"&&(e.innerHTML=t),this.h()},h(){c(e,"class","mb-2 text-xs text-gray-400 dark:text-gray-500")},m(l,a){j(l,e,a)},d(l){l&&u(e)}}}function _i(s){let e,t=s[10].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function pi(s){let e,t=s[10].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function vr(s){var Y;let e,t,l,a,r,o,i,f,m=s[10].t("Keep Alive")+"",g,_,p,b,w,y,k,V,E=s[10].t("Request Mode")+"",T,D,I,L,B,H;function F(U){s[25](U)}let N={admin:((Y=s[11])==null?void 0:Y.role)==="admin"};s[9]!==void 0&&(N.params=s[9]),e=new go({props:N}),mt.push(()=>Et(e,"params",F));function q(U,W){return U[8]===null?bi:gi}let z=q(s),C=z(s),A=s[8]!==null&&mr(s);function R(U,W){if(U[7]==="")return ki;if(U[7]==="json")return wi}let P=R(s),Z=P&&P(s);return{c(){he(e.$$.fragment),l=S(),a=d("hr"),r=S(),o=d("div"),i=d("div"),f=d("div"),g=x(m),_=S(),p=d("button"),C.c(),b=S(),A&&A.c(),w=S(),y=d("div"),k=d("div"),V=d("div"),T=x(E),D=S(),I=d("button"),Z&&Z.c(),this.h()},l(U){ve(e.$$.fragment,U),l=M(U),a=h(U,"HR",{class:!0}),r=M(U),o=h(U,"DIV",{class:!0});var W=v(o);i=h(W,"DIV",{class:!0});var X=v(i);f=h(X,"DIV",{class:!0});var G=v(f);g=O(G,m),G.forEach(u),_=M(X),p=h(X,"BUTTON",{class:!0,type:!0});var K=v(p);C.l(K),K.forEach(u),X.forEach(u),b=M(W),A&&A.l(W),W.forEach(u),w=M(U),y=h(U,"DIV",{});var J=v(y);k=h(J,"DIV",{class:!0});var Q=v(k);V=h(Q,"DIV",{class:!0});var ue=v(V);T=O(ue,E),ue.forEach(u),D=M(Q),I=h(Q,"BUTTON",{class:!0});var ke=v(I);Z&&Z.l(ke),ke.forEach(u),Q.forEach(u),J.forEach(u),this.h()},h(){c(a,"class","dark:border-gray-850"),c(f,"class","self-center text-xs font-medium"),c(p,"class","p-1 px-3 text-xs flex rounded transition"),c(p,"type","button"),c(i,"class","flex w-full justify-between"),c(o,"class","py-1 w-full justify-between"),c(V,"class","self-center text-sm font-medium"),c(I,"class","p-1 px-3 text-xs flex rounded transition"),c(k,"class","py-1 flex w-full justify-between")},m(U,W){me(e,U,W),j(U,l,W),j(U,a,W),j(U,r,W),j(U,o,W),n(o,i),n(i,f),n(f,g),n(i,_),n(i,p),C.m(p,null),n(o,b),A&&A.m(o,null),j(U,w,W),j(U,y,W),n(y,k),n(k,V),n(V,T),n(k,D),n(k,I),Z&&Z.m(I,null),L=!0,B||(H=[te(p,"click",s[26]),te(I,"click",s[28])],B=!0)},p(U,W){var G;const X={};W[0]&2048&&(X.admin=((G=U[11])==null?void 0:G.role)==="admin"),!t&&W[0]&512&&(t=!0,X.params=U[9],yt(()=>t=!1)),e.$set(X),(!L||W[0]&1024)&&m!==(m=U[10].t("Keep Alive")+"")&&$(g,m),z===(z=q(U))&&C?C.p(U,W):(C.d(1),C=z(U),C&&(C.c(),C.m(p,null))),U[8]!==null?A?A.p(U,W):(A=mr(U),A.c(),A.m(o,null)):A&&(A.d(1),A=null),(!L||W[0]&1024)&&E!==(E=U[10].t("Request Mode")+"")&&$(T,E),P===(P=R(U))&&Z?Z.p(U,W):(Z&&Z.d(1),Z=P&&P(U),Z&&(Z.c(),Z.m(I,null)))},i(U){L||(ee(e.$$.fragment,U),L=!0)},o(U){ae(e.$$.fragment,U),L=!1},d(U){U&&(u(l),u(a),u(r),u(o),u(w),u(y)),_e(e,U),C.d(),A&&A.d(),Z&&Z.d(),B=!1,vt(H)}}}function gi(s){let e,t=s[10].t("Custom")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("Custom")+"")&&$(l,t)},d(a){a&&u(e)}}}function bi(s){let e,t=s[10].t("Default")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("Default")+"")&&$(l,t)},d(a){a&&u(e)}}}function mr(s){let e,t,l,a,r;return{c(){e=d("div"),t=d("input"),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=v(e);t=h(i,"INPUT",{class:!0,type:!0,placeholder:!0}),i.forEach(u),this.h()},h(){c(t,"class","w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"),c(t,"type","text"),c(t,"placeholder",l=s[10].t("e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.")),c(e,"class","flex mt-1 space-x-2")},m(o,i){j(o,e,i),n(e,t),Pe(t,s[8]),a||(r=te(t,"input",s[27]),a=!0)},p(o,i){i[0]&1024&&l!==(l=o[10].t("e.g. '30s','10m'. Valid time units are 's', 'm', 'h'."))&&c(t,"placeholder",l),i[0]&256&&t.value!==o[8]&&Pe(t,o[8])},d(o){o&&u(e),a=!1,r()}}}function wi(s){let e,t=s[10].t("JSON")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("JSON")+"")&&$(l,t)},d(a){a&&u(e)}}}function ki(s){let e,t=s[10].t("Default")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&1024&&t!==(t=a[10].t("Default")+"")&&$(l,t)},d(a){a&&u(e)}}}function yi(s){let e,t,l,a,r=s[10].t("WebUI Settings")+"",o,i,f,m,g=s[10].t("Theme")+"",_,p,b,w,y,k,V=s[10].t("System")+"",E,T,D,I=s[10].t("Dark")+"",L,B,H,F=s[10].t("OLED Dark")+"",N,q,z,C=s[10].t("Light")+"",A,R,P="🌷 Her",Z,Y,U,W=s[10].t("Language")+"",X,G,K,J,Q,ue,ke,Ee,Me,Oe=s[10].t("Notifications")+"",je,pe,He,We,Be,Qe,se,de,De=s[10].t("System Prompt")+"",ie,Te,ge,ze,re,Ve,ce,ye=s[10].t("Advanced Parameters")+"",Je,le,oe,be=(s[6]?s[10].t("Hide"):s[10].t("Show"))+"",Le,et,$e,Re,qe,tt=s[10].t("Save")+"",lt,Ze,st,Ye,Fe=nt(s[2]),Ae=[];for(let Ie=0;Ie<Fe.length;Ie+=1)Ae[Ie]=dr(fr(s,Fe,Ie));let at=s[10].language==="en-US"&&hr();function Tt(Ie,fe){return Ie[4]===!0?pi:_i}let rt=Tt(s),_t=rt(s),Ue=s[6]&&vr(s);return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("div"),o=x(r),i=S(),f=d("div"),m=d("div"),_=x(g),p=S(),b=d("div"),w=d("select"),y=d("option"),k=x("⚙️ "),E=x(V),T=d("option"),D=x("🌑 "),L=x(I),B=d("option"),H=x("🌃 "),N=x(F),q=d("option"),z=x("☀️ "),A=x(C),R=d("option"),R.textContent=P,Z=S(),Y=d("div"),U=d("div"),X=x(W),G=S(),K=d("div"),J=d("select");for(let Ie=0;Ie<Ae.length;Ie+=1)Ae[Ie].c();Q=S(),at&&at.c(),ue=S(),ke=d("div"),Ee=d("div"),Me=d("div"),je=x(Oe),pe=S(),He=d("button"),_t.c(),We=S(),Be=d("hr"),Qe=S(),se=d("div"),de=d("div"),ie=x(De),Te=S(),ge=d("textarea"),ze=S(),re=d("div"),Ve=d("div"),ce=d("div"),Je=x(ye),le=S(),oe=d("button"),Le=x(be),et=S(),Ue&&Ue.c(),$e=S(),Re=d("div"),qe=d("button"),lt=x(tt),this.h()},l(Ie){e=h(Ie,"DIV",{class:!0});var fe=v(e);t=h(fe,"DIV",{class:!0});var we=v(t);l=h(we,"DIV",{class:!0});var Ke=v(l);a=h(Ke,"DIV",{class:!0});var At=v(a);o=O(At,r),At.forEach(u),i=M(Ke),f=h(Ke,"DIV",{class:!0});var Lt=v(f);m=h(Lt,"DIV",{class:!0});var ht=v(m);_=O(ht,g),ht.forEach(u),p=M(Lt),b=h(Lt,"DIV",{class:!0});var It=v(b);w=h(It,"SELECT",{class:!0,placeholder:!0});var Ut=v(w);y=h(Ut,"OPTION",{});var Bt=v(y);k=O(Bt,"⚙️ "),E=O(Bt,V),Bt.forEach(u),T=h(Ut,"OPTION",{});var Ct=v(T);D=O(Ct,"🌑 "),L=O(Ct,I),Ct.forEach(u),B=h(Ut,"OPTION",{});var St=v(B);H=O(St,"🌃 "),N=O(St,F),St.forEach(u),q=h(Ut,"OPTION",{});var $t=v(q);z=O($t,"☀️ "),A=O($t,C),$t.forEach(u),R=h(Ut,"OPTION",{"data-svelte-h":!0}),Ne(R)!=="svelte-188ouwx"&&(R.textContent=P),Ut.forEach(u),It.forEach(u),Lt.forEach(u),Z=M(Ke),Y=h(Ke,"DIV",{class:!0});var jt=v(Y);U=h(jt,"DIV",{class:!0});var Yt=v(U);X=O(Yt,W),Yt.forEach(u),G=M(jt),K=h(jt,"DIV",{class:!0});var Mt=v(K);J=h(Mt,"SELECT",{class:!0,placeholder:!0});var qt=v(J);for(let ml=0;ml<Ae.length;ml+=1)Ae[ml].l(qt);qt.forEach(u),Mt.forEach(u),jt.forEach(u),Q=M(Ke),at&&at.l(Ke),ue=M(Ke),ke=h(Ke,"DIV",{});var Kt=v(ke);Ee=h(Kt,"DIV",{class:!0});var kt=v(Ee);Me=h(kt,"DIV",{class:!0});var zt=v(Me);je=O(zt,Oe),zt.forEach(u),pe=M(kt),He=h(kt,"BUTTON",{class:!0,type:!0});var Pt=v(He);_t.l(Pt),Pt.forEach(u),kt.forEach(u),Kt.forEach(u),Ke.forEach(u),We=M(we),Be=h(we,"HR",{class:!0}),Qe=M(we),se=h(we,"DIV",{});var Rt=v(se);de=h(Rt,"DIV",{class:!0});var hl=v(de);ie=O(hl,De),hl.forEach(u),Te=M(Rt),ge=h(Rt,"TEXTAREA",{class:!0,rows:!0}),v(ge).forEach(u),Rt.forEach(u),ze=M(we),re=h(we,"DIV",{class:!0});var Nt=v(re);Ve=h(Nt,"DIV",{class:!0});var wl=v(Ve);ce=h(wl,"DIV",{class:!0});var vl=v(ce);Je=O(vl,ye),vl.forEach(u),le=M(wl),oe=h(wl,"BUTTON",{class:!0,type:!0});var kl=v(oe);Le=O(kl,be),kl.forEach(u),wl.forEach(u),et=M(Nt),Ue&&Ue.l(Nt),Nt.forEach(u),we.forEach(u),$e=M(fe),Re=h(fe,"DIV",{class:!0});var Il=v(Re);qe=h(Il,"BUTTON",{class:!0});var Ll=v(qe);lt=O(Ll,tt),Ll.forEach(u),Il.forEach(u),fe.forEach(u),this.h()},h(){c(a,"class","mb-1 text-sm font-medium"),c(m,"class","self-center text-xs font-medium"),y.__value="system",Pe(y,y.__value),T.__value="dark",Pe(T,T.__value),B.__value="oled-dark",Pe(B,B.__value),q.__value="light",Pe(q,q.__value),R.__value="her",Pe(R,R.__value),c(w,"class","dark:bg-gray-900 w-fit pr-8 rounded py-2 px-2 text-xs bg-transparent outline-none text-right"),c(w,"placeholder","Select a theme"),s[1]===void 0&&Ml(()=>s[18].call(w)),c(b,"class","flex items-center relative"),c(f,"class","flex w-full justify-between"),c(U,"class","self-center text-xs font-medium"),c(J,"class","dark:bg-gray-900 w-fit pr-8 rounded py-2 px-2 text-xs bg-transparent outline-none text-right"),c(J,"placeholder","Select a language"),s[3]===void 0&&Ml(()=>s[20].call(J)),c(K,"class","flex items-center relative"),c(Y,"class","flex w-full justify-between"),c(Me,"class","self-center text-xs font-medium"),c(He,"class","p-1 px-3 text-xs flex rounded transition"),c(He,"type","button"),c(Ee,"class","py-0.5 flex w-full justify-between"),c(l,"class",""),c(Be,"class","dark:border-gray-850 my-3"),c(de,"class","my-2.5 text-sm font-medium"),c(ge,"class","w-full rounded-lg p-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none resize-none"),c(ge,"rows","4"),c(ce,"class","font-medium"),c(oe,"class","text-xs font-medium text-gray-500"),c(oe,"type","button"),c(Ve,"class","flex justify-between items-center text-sm"),c(re,"class","mt-2 space-y-3 pr-1.5"),c(t,"class","pr-1.5 overflow-y-scroll max-h-[25rem]"),c(qe,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(Re,"class","flex justify-end pt-3 text-sm font-medium"),c(e,"class","flex flex-col h-full justify-between text-sm")},m(Ie,fe){j(Ie,e,fe),n(e,t),n(t,l),n(l,a),n(a,o),n(l,i),n(l,f),n(f,m),n(m,_),n(f,p),n(f,b),n(b,w),n(w,y),n(y,k),n(y,E),n(w,T),n(T,D),n(T,L),n(w,B),n(B,H),n(B,N),n(w,q),n(q,z),n(q,A),n(w,R),Wt(w,s[1],!0),n(l,Z),n(l,Y),n(Y,U),n(U,X),n(Y,G),n(Y,K),n(K,J);for(let we=0;we<Ae.length;we+=1)Ae[we]&&Ae[we].m(J,null);Wt(J,s[3],!0),n(l,Q),at&&at.m(l,null),n(l,ue),n(l,ke),n(ke,Ee),n(Ee,Me),n(Me,je),n(Ee,pe),n(Ee,He),_t.m(He,null),n(t,We),n(t,Be),n(t,Qe),n(t,se),n(se,de),n(de,ie),n(se,Te),n(se,ge),Pe(ge,s[5]),n(t,ze),n(t,re),n(re,Ve),n(Ve,ce),n(ce,Je),n(Ve,le),n(Ve,oe),n(oe,Le),n(re,et),Ue&&Ue.m(re,null),n(e,$e),n(e,Re),n(Re,qe),n(qe,lt),Ze=!0,st||(Ye=[te(w,"change",s[18]),te(w,"change",s[19]),te(J,"change",s[20]),te(J,"change",s[21]),te(He,"click",s[22]),te(ge,"input",s[23]),te(oe,"click",s[24]),te(qe,"click",s[29])],st=!0)},p(Ie,fe){if((!Ze||fe[0]&1024)&&r!==(r=Ie[10].t("WebUI Settings")+"")&&$(o,r),(!Ze||fe[0]&1024)&&g!==(g=Ie[10].t("Theme")+"")&&$(_,g),(!Ze||fe[0]&1024)&&V!==(V=Ie[10].t("System")+"")&&$(E,V),(!Ze||fe[0]&1024)&&I!==(I=Ie[10].t("Dark")+"")&&$(L,I),(!Ze||fe[0]&1024)&&F!==(F=Ie[10].t("OLED Dark")+"")&&$(N,F),(!Ze||fe[0]&1024)&&C!==(C=Ie[10].t("Light")+"")&&$(A,C),fe[0]&2&&Wt(w,Ie[1]),(!Ze||fe[0]&1024)&&W!==(W=Ie[10].t("Language")+"")&&$(X,W),fe[0]&4){Fe=nt(Ie[2]);let we;for(we=0;we<Fe.length;we+=1){const Ke=fr(Ie,Fe,we);Ae[we]?Ae[we].p(Ke,fe):(Ae[we]=dr(Ke),Ae[we].c(),Ae[we].m(J,null))}for(;we<Ae.length;we+=1)Ae[we].d(1);Ae.length=Fe.length}fe[0]&12&&Wt(J,Ie[3]),Ie[10].language==="en-US"?at||(at=hr(),at.c(),at.m(l,ue)):at&&(at.d(1),at=null),(!Ze||fe[0]&1024)&&Oe!==(Oe=Ie[10].t("Notifications")+"")&&$(je,Oe),rt===(rt=Tt(Ie))&&_t?_t.p(Ie,fe):(_t.d(1),_t=rt(Ie),_t&&(_t.c(),_t.m(He,null))),(!Ze||fe[0]&1024)&&De!==(De=Ie[10].t("System Prompt")+"")&&$(ie,De),fe[0]&32&&Pe(ge,Ie[5]),(!Ze||fe[0]&1024)&&ye!==(ye=Ie[10].t("Advanced Parameters")+"")&&$(Je,ye),(!Ze||fe[0]&1088)&&be!==(be=(Ie[6]?Ie[10].t("Hide"):Ie[10].t("Show"))+"")&&$(Le,be),Ie[6]?Ue?(Ue.p(Ie,fe),fe[0]&64&&ee(Ue,1)):(Ue=vr(Ie),Ue.c(),ee(Ue,1),Ue.m(re,null)):Ue&&(bt(),ae(Ue,1,1,()=>{Ue=null}),wt()),(!Ze||fe[0]&1024)&&tt!==(tt=Ie[10].t("Save")+"")&&$(lt,tt)},i(Ie){Ze||(ee(Ue),Ze=!0)},o(Ie){ae(Ue),Ze=!1},d(Ie){Ie&&u(e),Ht(Ae,Ie),at&&at.d(),_t.d(),Ue&&Ue.d(),st=!1,vt(Ye)}}}function Ei(s,e,t){let l,a,r;Se(s,bl,W=>t(30,l=W)),Se(s,jl,W=>t(11,r=W));const o=fl(),i=gt("i18n");Se(s,i,W=>t(10,a=W));let{saveSettings:f}=e,{getModels:m}=e,g=["dark","light","rose-pine dark","rose-pine-dawn light","oled-dark"],_="system",p=[],b=a.language,w=!1,y="",k=!1;const V=async()=>{await Notification.requestPermission()==="granted"?(t(4,w=!w),f({notificationEnabled:w})):Xe.error(a.t("Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access."))};let E="",T=null,D={stream_response:null,seed:null,temperature:null,frequency_penalty:null,repeat_last_n:null,mirostat:null,mirostat_eta:null,mirostat_tau:null,top_k:null,top_p:null,stop:null,tfs_z:null,num_ctx:null,num_batch:null,num_keep:null,max_tokens:null,num_gpu:null};const I=async()=>{E===""?t(7,E="json"):t(7,E=""),f({requestFormat:E!==""?E:void 0})};ul(async()=>{var W,X;t(1,_=localStorage.theme??"system"),t(2,p=await po()),t(4,w=l.notificationEnabled??!1),t(5,y=l.system??""),t(7,E=l.requestFormat??""),t(8,T=l.keepAlive??null),t(9,D={...D,...l.params}),t(9,D.stop=(W=l==null?void 0:l.params)!=null&&W.stop?(((X=l==null?void 0:l.params)==null?void 0:X.stop)??[]).join(","):null,D)});const L=W=>{let X=W==="oled-dark"?"dark":W;W==="system"&&(X=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),X==="dark"&&!W.includes("oled")&&(document.documentElement.style.setProperty("--color-gray-800","#333"),document.documentElement.style.setProperty("--color-gray-850","#262626"),document.documentElement.style.setProperty("--color-gray-900","#171717"),document.documentElement.style.setProperty("--color-gray-950","#0d0d0d")),g.filter(K=>K!==X).forEach(K=>{K.split(" ").forEach(J=>{document.documentElement.classList.remove(J)})}),X.split(" ").forEach(K=>{document.documentElement.classList.add(K)});const G=document.querySelector('meta[name="theme-color"]');if(G)if(W.includes("system")){const K=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";console.log("Setting system meta theme color: "+K),G.setAttribute("content",K==="light"?"#ffffff":"#171717")}else console.log("Setting meta theme color: "+W),G.setAttribute("content",W==="dark"?"#171717":W==="oled-dark"?"#000000":W==="her"?"#983724":"#ffffff");console.log(W)},B=W=>{Xn.set(W),localStorage.setItem("theme",W),W.includes("oled")&&(document.documentElement.style.setProperty("--color-gray-800","#101010"),document.documentElement.style.setProperty("--color-gray-850","#050505"),document.documentElement.style.setProperty("--color-gray-900","#000000"),document.documentElement.style.setProperty("--color-gray-950","#000000"),document.documentElement.classList.add("dark")),L(W)};function H(){_=Pl(this),t(1,_)}const F=()=>B(_);function N(){b=Pl(this),t(3,b),t(2,p)}const q=W=>{a.changeLanguage(b)},z=()=>{V()};function C(){y=this.value,t(5,y)}const A=()=>{t(6,k=!k)};function R(W){D=W,t(9,D)}const P=()=>{t(8,T=T===null?"5m":null)};function Z(){T=this.value,t(8,T)}const Y=()=>{I()},U=()=>{f({system:y!==""?y:void 0,params:{stream_response:D.stream_response!==null?D.stream_response:void 0,seed:(D.seed!==null?D.seed:void 0)??void 0,stop:D.stop?D.stop.split(",").filter(W=>W):void 0,temperature:D.temperature!==null?D.temperature:void 0,frequency_penalty:D.frequency_penalty!==null?D.frequency_penalty:void 0,repeat_last_n:D.repeat_last_n!==null?D.repeat_last_n:void 0,mirostat:D.mirostat!==null?D.mirostat:void 0,mirostat_eta:D.mirostat_eta!==null?D.mirostat_eta:void 0,mirostat_tau:D.mirostat_tau!==null?D.mirostat_tau:void 0,top_k:D.top_k!==null?D.top_k:void 0,top_p:D.top_p!==null?D.top_p:void 0,tfs_z:D.tfs_z!==null?D.tfs_z:void 0,num_ctx:D.num_ctx!==null?D.num_ctx:void 0,num_batch:D.num_batch!==null?D.num_batch:void 0,num_keep:D.num_keep!==null?D.num_keep:void 0,max_tokens:D.max_tokens!==null?D.max_tokens:void 0,use_mmap:D.use_mmap!==null?D.use_mmap:void 0,use_mlock:D.use_mlock!==null?D.use_mlock:void 0,num_thread:D.num_thread!==null?D.num_thread:void 0,num_gpu:D.num_gpu!==null?D.num_gpu:void 0},keepAlive:T?isNaN(T)?T:parseInt(T):void 0}),o("save")};return s.$$set=W=>{"saveSettings"in W&&t(0,f=W.saveSettings),"getModels"in W&&t(17,m=W.getModels)},[f,_,p,b,w,y,k,E,T,D,a,r,o,i,V,I,B,m,H,F,N,q,z,C,A,R,P,Z,Y,U]}class Ii extends ut{constructor(e){super(),ft(this,e,Ei,yi,ct,{saveSettings:0,getModels:17},null,[-1,-1])}}function _r(s,e,t){const l=s.slice();return l[53]=e[t],l}function pr(s){let e,t=s[53].name+"",l,a;return{c(){e=d("option"),l=x(t),this.h()},l(r){e=h(r,"OPTION",{class:!0});var o=v(e);l=O(o,t),o.forEach(u),this.h()},h(){e.__value=a=s[53].id,Pe(e,e.__value),c(e,"class","bg-gray-100 dark:bg-gray-700")},m(r,o){j(r,e,o),n(e,l)},p(r,o){o[0]&524288&&t!==(t=r[53].name+"")&&$(l,t),o[0]&524288&&a!==(a=r[53].id)&&(e.__value=a,Pe(e,e.__value))},d(r){r&&u(e)}}}function Di(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ti(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function gr(s){let e,t,l,a=s[18].t("Display the username instead of You in the Chat")+"",r,o,i,f,m;function g(b,w){return b[11]===!0?Ci:Vi}let _=g(s),p=_(s);return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),p.c(),this.h()},l(b){e=h(b,"DIV",{});var w=v(e);t=h(w,"DIV",{class:!0});var y=v(t);l=h(y,"DIV",{class:!0});var k=v(l);r=O(k,a),k.forEach(u),o=M(y),i=h(y,"BUTTON",{class:!0,type:!0});var V=v(i);p.l(V),V.forEach(u),y.forEach(u),w.forEach(u),this.h()},h(){c(l,"class","self-center text-xs"),c(i,"class","p-1 px-3 text-xs flex rounded transition"),c(i,"type","button"),c(t,"class","py-0.5 flex w-full justify-between")},m(b,w){j(b,e,w),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),p.m(i,null),f||(m=te(i,"click",s[40]),f=!0)},p(b,w){w[0]&262144&&a!==(a=b[18].t("Display the username instead of You in the Chat")+"")&&$(r,a),_===(_=g(b))&&p?p.p(b,w):(p.d(1),p=_(b),p&&(p.c(),p.m(i,null)))},d(b){b&&u(e),p.d(),f=!1,m()}}}function Vi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ci(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Si(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Mi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ai(s){let e,t=s[18].t("RTL")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("RTL")+"")&&$(l,t)},d(a){a&&u(e)}}}function Li(s){let e,t=s[18].t("LTR")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("LTR")+"")&&$(l,t)},d(a){a&&u(e)}}}function Bi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ni(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function xi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Oi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Hi(s){let e,t=s[18].t("Upload")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Upload")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ui(s){let e,t=s[18].t("Reset")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Reset")+"")&&$(l,t)},d(a){a&&u(e)}}}function Pi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function $i(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function ji(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function zi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ri(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Wi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Zi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Fi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Yi(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function qi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ki(s){let e,t=s[18].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function Gi(s){let e,t=s[18].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&262144&&t!==(t=a[18].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Xi(s){let e,t,l,a,r,o,i,f,m=s[18].t("Default Model")+"",g,_,p,b,w,y=s[18].t("Select a model")+"",k,V,E,T,D,I,L=s[18].t("UI")+"",B,H,F,N,q,z=s[18].t("Chat Bubble UI")+"",C,A,R,P,Z,Y,U,W,X=s[18].t("Widescreen Mode")+"",G,K,J,Q,ue,ke,Ee,Me=s[18].t("Chat direction")+"",Oe,je,pe,He,We,Be,Qe,se=s[18].t("Fluidly stream large external response chunks")+"",de,De,ie,Te,ge,ze,re,Ve=s[18].t("Scroll to bottom when switching between branches")+"",ce,ye,Je,le,oe,be,Le,et=s[18].t("Chat Background Image")+"",$e,Re,qe,tt,lt,Ze=s[18].t("Chat")+"",st,Ye,Fe,Ae,at,Tt=s[18].t("Title Auto-Generation")+"",rt,_t,Ue,Ie,fe,we,Ke,At=s[18].t("Response AutoCopy to Clipboard")+"",Lt,ht,It,Ut,Bt,Ct,St,$t=s[18].t("Allow User Location")+"",jt,Yt,Mt,qt,Kt,kt,zt,Pt=s[18].t("Haptic Feedback")+"",Rt,hl,Nt,wl,vl,kl=s[18].t("Voice")+"",Il,Ll,ml,yl,Bl,Wl=s[18].t("Allow Voice Interruption in Call")+"",Kl,Cs,_l,Ss,Zl,El,Nl,Fl=s[18].t("Display Emoji in Call")+"",Gl,Ms,pl,As,xl,Dl,Yl=s[18].t("Save")+"",Xl,Ls,Gs,Ol=nt(s[19].filter(br)),Dt=[];for(let ne=0;ne<Ol.length;ne+=1)Dt[ne]=pr(_r(s,Ol,ne));function Xs(ne,Ce){return ne[12]===!0?Ti:Di}let Jl=Xs(s),Gt=Jl(s),Vt=!s[17].chatBubble&&gr(s);function Js(ne,Ce){return ne[6]===!0?Mi:Si}let Ql=Js(s),Xt=Ql(s);function Qs(ne,Ce){return ne[13]==="LTR"?Li:Ai}let es=Qs(s),Jt=es(s);function ea(ne,Ce){return ne[7]===!0?Ni:Bi}let ts=ea(s),Qt=ts(s);function ta(ne,Ce){return ne[8]===!0?Oi:xi}let ls=ta(s),el=ls(s);function la(ne,Ce){return ne[1]!==null?Ui:Hi}let ss=la(s),tl=ss(s);function sa(ne,Ce){return ne[4]===!0?$i:Pi}let as=sa(s),ll=as(s);function aa(ne,Ce){return ne[5]===!0?zi:ji}let rs=aa(s),sl=rs(s);function ra(ne,Ce){return ne[9]===!0?Wi:Ri}let ns=ra(s),al=ns(s);function na(ne,Ce){return ne[16]===!0?Fi:Zi}let os=na(s),rl=os(s);function oa(ne,Ce){return ne[15]===!0?qi:Yi}let is=oa(s),nl=is(s);function ia(ne,Ce){return ne[14]===!0?Gi:Ki}let cs=ia(s),ol=cs(s);return{c(){e=d("form"),t=d("input"),l=S(),a=d("div"),r=d("div"),o=d("div"),i=d("div"),f=d("div"),g=x(m),_=S(),p=d("div"),b=d("select"),w=d("option"),k=x(y);for(let ne=0;ne<Dt.length;ne+=1)Dt[ne].c();V=S(),E=d("hr"),T=S(),D=d("div"),I=d("div"),B=x(L),H=S(),F=d("div"),N=d("div"),q=d("div"),C=x(z),A=S(),R=d("button"),Gt.c(),P=S(),Vt&&Vt.c(),Z=S(),Y=d("div"),U=d("div"),W=d("div"),G=x(X),K=S(),J=d("button"),Xt.c(),Q=S(),ue=d("div"),ke=d("div"),Ee=d("div"),Oe=x(Me),je=S(),pe=d("button"),Jt.c(),He=S(),We=d("div"),Be=d("div"),Qe=d("div"),de=x(se),De=S(),ie=d("button"),Qt.c(),Te=S(),ge=d("div"),ze=d("div"),re=d("div"),ce=x(Ve),ye=S(),Je=d("button"),el.c(),le=S(),oe=d("div"),be=d("div"),Le=d("div"),$e=x(et),Re=S(),qe=d("button"),tl.c(),tt=S(),lt=d("div"),st=x(Ze),Ye=S(),Fe=d("div"),Ae=d("div"),at=d("div"),rt=x(Tt),_t=S(),Ue=d("button"),ll.c(),Ie=S(),fe=d("div"),we=d("div"),Ke=d("div"),Lt=x(At),ht=S(),It=d("button"),sl.c(),Ut=S(),Bt=d("div"),Ct=d("div"),St=d("div"),jt=x($t),Yt=S(),Mt=d("button"),al.c(),qt=S(),Kt=d("div"),kt=d("div"),zt=d("div"),Rt=x(Pt),hl=S(),Nt=d("button"),rl.c(),wl=S(),vl=d("div"),Il=x(kl),Ll=S(),ml=d("div"),yl=d("div"),Bl=d("div"),Kl=x(Wl),Cs=S(),_l=d("button"),nl.c(),Ss=S(),Zl=d("div"),El=d("div"),Nl=d("div"),Gl=x(Fl),Ms=S(),pl=d("button"),ol.c(),As=S(),xl=d("div"),Dl=d("button"),Xl=x(Yl),this.h()},l(ne){e=h(ne,"FORM",{class:!0});var Ce=v(e);t=h(Ce,"INPUT",{type:!0,accept:!0}),l=M(Ce),a=h(Ce,"DIV",{class:!0});var dt=v(a);r=h(dt,"DIV",{class:!0});var Tl=v(r);o=h(Tl,"DIV",{class:!0});var ca=v(o);i=h(ca,"DIV",{class:!0});var ua=v(i);f=h(ua,"DIV",{class:!0});var fa=v(f);g=O(fa,m),fa.forEach(u),ua.forEach(u),ca.forEach(u),_=M(Tl),p=h(Tl,"DIV",{class:!0});var da=v(p);b=h(da,"SELECT",{class:!0,placeholder:!0});var Bs=v(b);w=h(Bs,"OPTION",{});var ha=v(w);k=O(ha,y),ha.forEach(u);for(let Ns=0;Ns<Dt.length;Ns+=1)Dt[Ns].l(Bs);Bs.forEach(u),da.forEach(u),Tl.forEach(u),V=M(dt),E=h(dt,"HR",{class:!0}),T=M(dt),D=h(dt,"DIV",{});var Ge=v(D);I=h(Ge,"DIV",{class:!0});var va=v(I);B=O(va,L),va.forEach(u),H=M(Ge),F=h(Ge,"DIV",{});var ma=v(F);N=h(ma,"DIV",{class:!0});var us=v(N);q=h(us,"DIV",{class:!0});var _a=v(q);C=O(_a,z),_a.forEach(u),A=M(us),R=h(us,"BUTTON",{class:!0,type:!0});var pa=v(R);Gt.l(pa),pa.forEach(u),us.forEach(u),ma.forEach(u),P=M(Ge),Vt&&Vt.l(Ge),Z=M(Ge),Y=h(Ge,"DIV",{});var ga=v(Y);U=h(ga,"DIV",{class:!0});var fs=v(U);W=h(fs,"DIV",{class:!0});var ba=v(W);G=O(ba,X),ba.forEach(u),K=M(fs),J=h(fs,"BUTTON",{class:!0,type:!0});var wa=v(J);Xt.l(wa),wa.forEach(u),fs.forEach(u),ga.forEach(u),Q=M(Ge),ue=h(Ge,"DIV",{});var ka=v(ue);ke=h(ka,"DIV",{class:!0});var ds=v(ke);Ee=h(ds,"DIV",{class:!0});var ya=v(Ee);Oe=O(ya,Me),ya.forEach(u),je=M(ds),pe=h(ds,"BUTTON",{class:!0,type:!0});var Ea=v(pe);Jt.l(Ea),Ea.forEach(u),ds.forEach(u),ka.forEach(u),He=M(Ge),We=h(Ge,"DIV",{});var Ia=v(We);Be=h(Ia,"DIV",{class:!0});var hs=v(Be);Qe=h(hs,"DIV",{class:!0});var Da=v(Qe);de=O(Da,se),Da.forEach(u),De=M(hs),ie=h(hs,"BUTTON",{class:!0,type:!0});var Ta=v(ie);Qt.l(Ta),Ta.forEach(u),hs.forEach(u),Ia.forEach(u),Te=M(Ge),ge=h(Ge,"DIV",{});var Va=v(ge);ze=h(Va,"DIV",{class:!0});var vs=v(ze);re=h(vs,"DIV",{class:!0});var Ca=v(re);ce=O(Ca,Ve),Ca.forEach(u),ye=M(vs),Je=h(vs,"BUTTON",{class:!0,type:!0});var Sa=v(Je);el.l(Sa),Sa.forEach(u),vs.forEach(u),Va.forEach(u),le=M(Ge),oe=h(Ge,"DIV",{});var Ma=v(oe);be=h(Ma,"DIV",{class:!0});var ms=v(be);Le=h(ms,"DIV",{class:!0});var Aa=v(Le);$e=O(Aa,et),Aa.forEach(u),Re=M(ms),qe=h(ms,"BUTTON",{class:!0,type:!0});var La=v(qe);tl.l(La),La.forEach(u),ms.forEach(u),Ma.forEach(u),tt=M(Ge),lt=h(Ge,"DIV",{class:!0});var Ba=v(lt);st=O(Ba,Ze),Ba.forEach(u),Ye=M(Ge),Fe=h(Ge,"DIV",{});var Na=v(Fe);Ae=h(Na,"DIV",{class:!0});var _s=v(Ae);at=h(_s,"DIV",{class:!0});var xa=v(at);rt=O(xa,Tt),xa.forEach(u),_t=M(_s),Ue=h(_s,"BUTTON",{class:!0,type:!0});var Oa=v(Ue);ll.l(Oa),Oa.forEach(u),_s.forEach(u),Na.forEach(u),Ie=M(Ge),fe=h(Ge,"DIV",{});var Ha=v(fe);we=h(Ha,"DIV",{class:!0});var ps=v(we);Ke=h(ps,"DIV",{class:!0});var Ua=v(Ke);Lt=O(Ua,At),Ua.forEach(u),ht=M(ps),It=h(ps,"BUTTON",{class:!0,type:!0});var Pa=v(It);sl.l(Pa),Pa.forEach(u),ps.forEach(u),Ha.forEach(u),Ut=M(Ge),Bt=h(Ge,"DIV",{});var $a=v(Bt);Ct=h($a,"DIV",{class:!0});var gs=v(Ct);St=h(gs,"DIV",{class:!0});var ja=v(St);jt=O(ja,$t),ja.forEach(u),Yt=M(gs),Mt=h(gs,"BUTTON",{class:!0,type:!0});var za=v(Mt);al.l(za),za.forEach(u),gs.forEach(u),$a.forEach(u),qt=M(Ge),Kt=h(Ge,"DIV",{});var Ra=v(Kt);kt=h(Ra,"DIV",{class:!0});var bs=v(kt);zt=h(bs,"DIV",{class:!0});var Wa=v(zt);Rt=O(Wa,Pt),Wa.forEach(u),hl=M(bs),Nt=h(bs,"BUTTON",{class:!0,type:!0});var Za=v(Nt);rl.l(Za),Za.forEach(u),bs.forEach(u),Ra.forEach(u),wl=M(Ge),vl=h(Ge,"DIV",{class:!0});var Fa=v(vl);Il=O(Fa,kl),Fa.forEach(u),Ll=M(Ge),ml=h(Ge,"DIV",{});var Ya=v(ml);yl=h(Ya,"DIV",{class:!0});var ws=v(yl);Bl=h(ws,"DIV",{class:!0});var qa=v(Bl);Kl=O(qa,Wl),qa.forEach(u),Cs=M(ws),_l=h(ws,"BUTTON",{class:!0,type:!0});var Ka=v(_l);nl.l(Ka),Ka.forEach(u),ws.forEach(u),Ya.forEach(u),Ss=M(Ge),Zl=h(Ge,"DIV",{});var Ga=v(Zl);El=h(Ga,"DIV",{class:!0});var ks=v(El);Nl=h(ks,"DIV",{class:!0});var Xa=v(Nl);Gl=O(Xa,Fl),Xa.forEach(u),Ms=M(ks),pl=h(ks,"BUTTON",{class:!0,type:!0});var Ja=v(pl);ol.l(Ja),Ja.forEach(u),ks.forEach(u),Ga.forEach(u),Ge.forEach(u),dt.forEach(u),As=M(Ce),xl=h(Ce,"DIV",{class:!0});var Qa=v(xl);Dl=h(Qa,"BUTTON",{class:!0,type:!0});var er=v(Dl);Xl=O(er,Yl),er.forEach(u),Qa.forEach(u),Ce.forEach(u),this.h()},h(){c(t,"type","file"),t.hidden=!0,c(t,"accept","image/*"),c(f,"class","text-sm font-medium"),c(i,"class","flex justify-between items-center text-xs"),c(o,"class","mb-2"),w.__value="",Pe(w,w.__value),w.disabled=!0,w.selected=!0,c(b,"class","w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"),c(b,"placeholder","Select a model"),s[10]===void 0&&Ml(()=>s[38].call(b)),c(p,"class","flex-1 mr-2"),c(r,"class","space-y-1 mb-3"),c(E,"class","dark:border-gray-850"),c(I,"class","mb-1.5 text-sm font-medium"),c(q,"class","self-center text-xs"),c(R,"class","p-1 px-3 text-xs flex rounded transition"),c(R,"type","button"),c(N,"class","py-0.5 flex w-full justify-between"),c(W,"class","self-center text-xs"),c(J,"class","p-1 px-3 text-xs flex rounded transition"),c(J,"type","button"),c(U,"class","py-0.5 flex w-full justify-between"),c(Ee,"class","self-center text-xs"),c(pe,"class","p-1 px-3 text-xs flex rounded transition"),c(pe,"type","button"),c(ke,"class","py-0.5 flex w-full justify-between"),c(Qe,"class","self-center text-xs"),c(ie,"class","p-1 px-3 text-xs flex rounded transition"),c(ie,"type","button"),c(Be,"class","py-0.5 flex w-full justify-between"),c(re,"class","self-center text-xs"),c(Je,"class","p-1 px-3 text-xs flex rounded transition"),c(Je,"type","button"),c(ze,"class","py-0.5 flex w-full justify-between"),c(Le,"class","self-center text-xs"),c(qe,"class","p-1 px-3 text-xs flex rounded transition"),c(qe,"type","button"),c(be,"class","py-0.5 flex w-full justify-between"),c(lt,"class","my-1.5 text-sm font-medium"),c(at,"class","self-center text-xs"),c(Ue,"class","p-1 px-3 text-xs flex rounded transition"),c(Ue,"type","button"),c(Ae,"class","py-0.5 flex w-full justify-between"),c(Ke,"class","self-center text-xs"),c(It,"class","p-1 px-3 text-xs flex rounded transition"),c(It,"type","button"),c(we,"class","py-0.5 flex w-full justify-between"),c(St,"class","self-center text-xs"),c(Mt,"class","p-1 px-3 text-xs flex rounded transition"),c(Mt,"type","button"),c(Ct,"class","py-0.5 flex w-full justify-between"),c(zt,"class","self-center text-xs"),c(Nt,"class","p-1 px-3 text-xs flex rounded transition"),c(Nt,"type","button"),c(kt,"class","py-0.5 flex w-full justify-between"),c(vl,"class","my-1.5 text-sm font-medium"),c(Bl,"class","self-center text-xs"),c(_l,"class","p-1 px-3 text-xs flex rounded transition"),c(_l,"type","button"),c(yl,"class","py-0.5 flex w-full justify-between"),c(Nl,"class","self-center text-xs"),c(pl,"class","p-1 px-3 text-xs flex rounded transition"),c(pl,"type","button"),c(El,"class","py-0.5 flex w-full justify-between"),c(a,"class","space-y-3 pr-1.5 overflow-y-scroll max-h-[25rem] scrollbar-hidden"),c(Dl,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(Dl,"type","submit"),c(xl,"class","flex justify-end text-sm font-medium"),c(e,"class","flex flex-col h-full justify-between space-y-3 text-sm")},m(ne,Ce){j(ne,e,Ce),n(e,t),s[35](t),n(e,l),n(e,a),n(a,r),n(r,o),n(o,i),n(i,f),n(f,g),n(r,_),n(r,p),n(p,b),n(b,w),n(w,k);for(let dt=0;dt<Dt.length;dt+=1)Dt[dt]&&Dt[dt].m(b,null);Wt(b,s[10],!0),n(a,V),n(a,E),n(a,T),n(a,D),n(D,I),n(I,B),n(D,H),n(D,F),n(F,N),n(N,q),n(q,C),n(N,A),n(N,R),Gt.m(R,null),n(D,P),Vt&&Vt.m(D,null),n(D,Z),n(D,Y),n(Y,U),n(U,W),n(W,G),n(U,K),n(U,J),Xt.m(J,null),n(D,Q),n(D,ue),n(ue,ke),n(ke,Ee),n(Ee,Oe),n(ke,je),n(ke,pe),Jt.m(pe,null),n(D,He),n(D,We),n(We,Be),n(Be,Qe),n(Qe,de),n(Be,De),n(Be,ie),Qt.m(ie,null),n(D,Te),n(D,ge),n(ge,ze),n(ze,re),n(re,ce),n(ze,ye),n(ze,Je),el.m(Je,null),n(D,le),n(D,oe),n(oe,be),n(be,Le),n(Le,$e),n(be,Re),n(be,qe),tl.m(qe,null),n(D,tt),n(D,lt),n(lt,st),n(D,Ye),n(D,Fe),n(Fe,Ae),n(Ae,at),n(at,rt),n(Ae,_t),n(Ae,Ue),ll.m(Ue,null),n(D,Ie),n(D,fe),n(fe,we),n(we,Ke),n(Ke,Lt),n(we,ht),n(we,It),sl.m(It,null),n(D,Ut),n(D,Bt),n(Bt,Ct),n(Ct,St),n(St,jt),n(Ct,Yt),n(Ct,Mt),al.m(Mt,null),n(D,qt),n(D,Kt),n(Kt,kt),n(kt,zt),n(zt,Rt),n(kt,hl),n(kt,Nt),rl.m(Nt,null),n(D,wl),n(D,vl),n(vl,Il),n(D,Ll),n(D,ml),n(ml,yl),n(yl,Bl),n(Bl,Kl),n(yl,Cs),n(yl,_l),nl.m(_l,null),n(D,Ss),n(D,Zl),n(Zl,El),n(El,Nl),n(Nl,Gl),n(El,Ms),n(El,pl),ol.m(pl,null),n(e,As),n(e,xl),n(xl,Dl),n(Dl,Xl),Ls||(Gs=[te(t,"change",s[36]),te(t,"change",s[37]),te(b,"change",s[38]),te(R,"click",s[39]),te(J,"click",s[41]),te(pe,"click",s[33]),te(ie,"click",s[42]),te(Je,"click",s[43]),te(qe,"click",s[44]),te(Ue,"click",s[45]),te(It,"click",s[46]),te(Mt,"click",s[47]),te(Nt,"click",s[48]),te(_l,"click",s[49]),te(pl,"click",s[50]),te(e,"submit",zl(s[51]))],Ls=!0)},p(ne,Ce){if(Ce[0]&262144&&m!==(m=ne[18].t("Default Model")+"")&&$(g,m),Ce[0]&262144&&y!==(y=ne[18].t("Select a model")+"")&&$(k,y),Ce[0]&524288){Ol=nt(ne[19].filter(br));let dt;for(dt=0;dt<Ol.length;dt+=1){const Tl=_r(ne,Ol,dt);Dt[dt]?Dt[dt].p(Tl,Ce):(Dt[dt]=pr(Tl),Dt[dt].c(),Dt[dt].m(b,null))}for(;dt<Dt.length;dt+=1)Dt[dt].d(1);Dt.length=Ol.length}Ce[0]&525312&&Wt(b,ne[10]),Ce[0]&262144&&L!==(L=ne[18].t("UI")+"")&&$(B,L),Ce[0]&262144&&z!==(z=ne[18].t("Chat Bubble UI")+"")&&$(C,z),Jl===(Jl=Xs(ne))&&Gt?Gt.p(ne,Ce):(Gt.d(1),Gt=Jl(ne),Gt&&(Gt.c(),Gt.m(R,null))),ne[17].chatBubble?Vt&&(Vt.d(1),Vt=null):Vt?Vt.p(ne,Ce):(Vt=gr(ne),Vt.c(),Vt.m(D,Z)),Ce[0]&262144&&X!==(X=ne[18].t("Widescreen Mode")+"")&&$(G,X),Ql===(Ql=Js(ne))&&Xt?Xt.p(ne,Ce):(Xt.d(1),Xt=Ql(ne),Xt&&(Xt.c(),Xt.m(J,null))),Ce[0]&262144&&Me!==(Me=ne[18].t("Chat direction")+"")&&$(Oe,Me),es===(es=Qs(ne))&&Jt?Jt.p(ne,Ce):(Jt.d(1),Jt=es(ne),Jt&&(Jt.c(),Jt.m(pe,null))),Ce[0]&262144&&se!==(se=ne[18].t("Fluidly stream large external response chunks")+"")&&$(de,se),ts===(ts=ea(ne))&&Qt?Qt.p(ne,Ce):(Qt.d(1),Qt=ts(ne),Qt&&(Qt.c(),Qt.m(ie,null))),Ce[0]&262144&&Ve!==(Ve=ne[18].t("Scroll to bottom when switching between branches")+"")&&$(ce,Ve),ls===(ls=ta(ne))&&el?el.p(ne,Ce):(el.d(1),el=ls(ne),el&&(el.c(),el.m(Je,null))),Ce[0]&262144&&et!==(et=ne[18].t("Chat Background Image")+"")&&$($e,et),ss===(ss=la(ne))&&tl?tl.p(ne,Ce):(tl.d(1),tl=ss(ne),tl&&(tl.c(),tl.m(qe,null))),Ce[0]&262144&&Ze!==(Ze=ne[18].t("Chat")+"")&&$(st,Ze),Ce[0]&262144&&Tt!==(Tt=ne[18].t("Title Auto-Generation")+"")&&$(rt,Tt),as===(as=sa(ne))&&ll?ll.p(ne,Ce):(ll.d(1),ll=as(ne),ll&&(ll.c(),ll.m(Ue,null))),Ce[0]&262144&&At!==(At=ne[18].t("Response AutoCopy to Clipboard")+"")&&$(Lt,At),rs===(rs=aa(ne))&&sl?sl.p(ne,Ce):(sl.d(1),sl=rs(ne),sl&&(sl.c(),sl.m(It,null))),Ce[0]&262144&&$t!==($t=ne[18].t("Allow User Location")+"")&&$(jt,$t),ns===(ns=ra(ne))&&al?al.p(ne,Ce):(al.d(1),al=ns(ne),al&&(al.c(),al.m(Mt,null))),Ce[0]&262144&&Pt!==(Pt=ne[18].t("Haptic Feedback")+"")&&$(Rt,Pt),os===(os=na(ne))&&rl?rl.p(ne,Ce):(rl.d(1),rl=os(ne),rl&&(rl.c(),rl.m(Nt,null))),Ce[0]&262144&&kl!==(kl=ne[18].t("Voice")+"")&&$(Il,kl),Ce[0]&262144&&Wl!==(Wl=ne[18].t("Allow Voice Interruption in Call")+"")&&$(Kl,Wl),is===(is=oa(ne))&&nl?nl.p(ne,Ce):(nl.d(1),nl=is(ne),nl&&(nl.c(),nl.m(_l,null))),Ce[0]&262144&&Fl!==(Fl=ne[18].t("Display Emoji in Call")+"")&&$(Gl,Fl),cs===(cs=ia(ne))&&ol?ol.p(ne,Ce):(ol.d(1),ol=cs(ne),ol&&(ol.c(),ol.m(pl,null))),Ce[0]&262144&&Yl!==(Yl=ne[18].t("Save")+"")&&$(Xl,Yl)},i:xe,o:xe,d(ne){ne&&u(e),s[35](null),Ht(Dt,ne),Gt.d(),Vt&&Vt.d(),Xt.d(),Jt.d(),Qt.d(),el.d(),tl.d(),ll.d(),sl.d(),al.d(),rl.d(),nl.d(),ol.d(),Ls=!1,vt(Gs)}}}const br=s=>s.id;function Ji(s,e,t){let l,a,r,o;Se(s,bl,ie=>t(17,l=ie)),Se(s,Vs,ie=>t(52,a=ie)),Se(s,qs,ie=>t(19,o=ie));const i=fl(),f=gt("i18n");Se(s,f,ie=>t(18,r=ie));let{saveSettings:m}=e,g=null,_=null,p,b=!0,w=!1,y=!1,k=!1,V=!0,E=!1,T="",D=!1,I=!0,L="LTR",B=!1,H=!1,F=!1;const N=async()=>{t(7,k=!k),m({splitLargeChunks:k})},q=async()=>{t(8,V=!V),m({scrollOnBranchChange:V})},z=async()=>{t(6,y=!y),m({widescreenMode:y})},C=async()=>{t(12,I=!I),m({chatBubble:I})},A=async()=>{t(11,D=!D),m({showUsername:D})},R=async()=>{t(14,B=!B),m({showEmojiInCall:B})},P=async()=>{t(15,H=!H),m({voiceInterruption:H})},Z=async()=>{t(16,F=!F),m({hapticFeedback:F})},Y=async()=>{if(t(9,E=!E),E){const ie=await ho().catch(Te=>(Xe.error(Te.message),null));ie?(await Bn(localStorage.token,{location:ie}),Xe.success(r.t("User location successfully retrieved."))):t(9,E=!1)}m({userLocation:E})},U=async()=>{t(4,b=!b),m({title:{...l.title,auto:b}})},W=async()=>{const ie=await navigator.clipboard.readText().then(()=>"granted").catch(()=>"");console.log(ie),ie==="granted"?(t(5,w=!w),m({responseAutoCopy:w})):Xe.error(r.t("Clipboard write permission denied. Please check your browser settings to grant the necessary access."))},X=async()=>{t(13,L=L==="LTR"?"RTL":"LTR"),m({chatDirection:L})},G=async()=>{m({models:[T]})};ul(async()=>{var ie,Te;t(4,b=((ie=l==null?void 0:l.title)==null?void 0:ie.auto)??!0),t(5,w=l.responseAutoCopy??!1),t(11,D=l.showUsername??!1),t(14,B=l.showEmojiInCall??!1),t(15,H=l.voiceInterruption??!1),t(12,I=l.chatBubble??!0),t(6,y=l.widescreenMode??!1),t(7,k=l.splitLargeChunks??!1),t(8,V=l.scrollOnBranchChange??!0),t(13,L=l.chatDirection??"LTR"),t(9,E=l.userLocation??!1),t(16,F=l.hapticFeedback??!1),t(10,T=((Te=l==null?void 0:l.models)==null?void 0:Te.at(0))??""),a!=null&&a.default_models&&t(10,T=a.default_models.split(",")[0]),t(1,g=l.backgroundImageUrl??null)});function K(ie){mt[ie?"unshift":"push"](()=>{p=ie,t(3,p)})}function J(){_=this.files,t(2,_)}const Q=()=>{let ie=new FileReader;ie.onload=Te=>{let ge=`${Te.target.result}`;t(1,g=ge),m({backgroundImageUrl:g})},_&&_.length>0&&["image/gif","image/webp","image/jpeg","image/png"].includes(_[0].type)?ie.readAsDataURL(_[0]):(console.log(`Unsupported File Type '${_[0].type}'.`),t(2,_=null))};function ue(){T=Pl(this),t(10,T)}const ke=()=>{C()},Ee=()=>{A()},Me=()=>{z()},Oe=()=>{N()},je=()=>{q()},pe=()=>{g!==null?(t(1,g=null),m({backgroundImageUrl:g})):p.click()},He=()=>{U()},We=()=>{W()},Be=()=>{Y()},Qe=()=>{Z()},se=()=>{P()},de=()=>{R()},De=()=>{G(),i("save")};return s.$$set=ie=>{"saveSettings"in ie&&t(0,m=ie.saveSettings)},[m,g,_,p,b,w,y,k,V,E,T,D,I,L,B,H,F,l,r,o,i,f,N,q,z,C,A,R,P,Z,Y,U,W,X,G,K,J,Q,ue,ke,Ee,Me,Oe,je,pe,He,We,Be,Qe,se,de,De]}class Qi extends ut{constructor(e){super(),ft(this,e,Ji,Xi,ct,{saveSettings:0},null,[-1,-1])}}function wr(s,e,t){const l=s.slice();return l[9]=e[t],l}function kr(s,e,t){const l=s.slice();return l[27]=e[t],l}function yr(s,e,t){const l=s.slice();return l[32]=e[t],l}function Er(s){let e,t,l=s[8].t("Speech-to-Text Engine")+"",a,r,o,i,f,m=s[8].t("Default")+"",g,_,p=s[8].t("Web API")+"",b,w,y;return{c(){e=d("div"),t=d("div"),a=x(l),r=S(),o=d("div"),i=d("select"),f=d("option"),g=x(m),_=d("option"),b=x(p),this.h()},l(k){e=h(k,"DIV",{class:!0});var V=v(e);t=h(V,"DIV",{class:!0});var E=v(t);a=O(E,l),E.forEach(u),r=M(V),o=h(V,"DIV",{class:!0});var T=v(o);i=h(T,"SELECT",{class:!0,placeholder:!0});var D=v(i);f=h(D,"OPTION",{});var I=v(f);g=O(I,m),I.forEach(u),_=h(D,"OPTION",{});var L=v(_);b=O(L,p),L.forEach(u),D.forEach(u),T.forEach(u),V.forEach(u),this.h()},h(){c(t,"class","self-center text-xs font-medium"),f.__value="",Pe(f,f.__value),_.__value="web",Pe(_,_.__value),c(i,"class","dark:bg-gray-900 w-fit pr-8 rounded px-2 p-1 text-xs bg-transparent outline-none text-right"),c(i,"placeholder","Select an engine"),s[4]===void 0&&Ml(()=>s[15].call(i)),c(o,"class","flex items-center relative"),c(e,"class","py-0.5 flex w-full justify-between")},m(k,V){j(k,e,V),n(e,t),n(t,a),n(e,r),n(e,o),n(o,i),n(i,f),n(f,g),n(i,_),n(_,b),Wt(i,s[4],!0),w||(y=te(i,"change",s[15]),w=!0)},p(k,V){V[0]&256&&l!==(l=k[8].t("Speech-to-Text Engine")+"")&&$(a,l),V[0]&256&&m!==(m=k[8].t("Default")+"")&&$(g,m),V[0]&256&&p!==(p=k[8].t("Web API")+"")&&$(b,p),V[0]&16&&Wt(i,k[4])},d(k){k&&u(e),w=!1,y()}}}function ec(s){let e,t=s[8].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&256&&t!==(t=a[8].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function tc(s){let e,t=s[8].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&256&&t!==(t=a[8].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function lc(s){let e,t=s[8].t("Off")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&256&&t!==(t=a[8].t("Off")+"")&&$(l,t)},d(a){a&&u(e)}}}function sc(s){let e,t=s[8].t("On")+"",l;return{c(){e=d("span"),l=x(t),this.h()},l(a){e=h(a,"SPAN",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","ml-2 self-center")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&256&&t!==(t=a[8].t("On")+"")&&$(l,t)},d(a){a&&u(e)}}}function Ir(s){let e,t=s[32]+"",l,a,r;return{c(){e=d("option"),l=x(t),a=x("x"),this.h()},l(o){e=h(o,"OPTION",{});var i=v(e);l=O(i,t),a=O(i,"x"),i.forEach(u),this.h()},h(){e.__value=s[32],Pe(e,e.__value),e.selected=r=s[6]===s[32]},m(o,i){j(o,e,i),n(e,l),n(e,a)},p(o,i){i[0]&4160&&r!==(r=o[6]===o[32])&&(e.selected=r)},d(o){o&&u(e)}}}function ac(s){let e,t,l=s[8].t("Set Voice")+"",a,r,o,i,f,m,g,_,p,b=nt(s[5]),w=[];for(let y=0;y<b.length;y+=1)w[y]=Dr(wr(s,b,y));return{c(){e=d("div"),t=d("div"),a=x(l),r=S(),o=d("div"),i=d("div"),f=d("input"),m=S(),g=d("datalist");for(let y=0;y<w.length;y+=1)w[y].c();this.h()},l(y){e=h(y,"DIV",{});var k=v(e);t=h(k,"DIV",{class:!0});var V=v(t);a=O(V,l),V.forEach(u),r=M(k),o=h(k,"DIV",{class:!0});var E=v(o);i=h(E,"DIV",{class:!0});var T=v(i);f=h(T,"INPUT",{list:!0,class:!0,placeholder:!0}),m=M(T),g=h(T,"DATALIST",{id:!0});var D=v(g);for(let I=0;I<w.length;I+=1)w[I].l(D);D.forEach(u),T.forEach(u),E.forEach(u),k.forEach(u),this.h()},h(){c(t,"class","mb-2.5 text-sm font-medium"),c(f,"list","voice-list"),c(f,"class","w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"),c(f,"placeholder","Select a voice"),c(g,"id","voice-list"),c(i,"class","flex-1"),c(o,"class","flex w-full")},m(y,k){j(y,e,k),n(e,t),n(t,a),n(e,r),n(e,o),n(o,i),n(i,f),Pe(f,s[9]),n(i,m),n(i,g);for(let V=0;V<w.length;V+=1)w[V]&&w[V].m(g,null);_||(p=te(f,"input",s[22]),_=!0)},p(y,k){if(k[0]&256&&l!==(l=y[8].t("Set Voice")+"")&&$(a,l),k[0]&552&&f.value!==y[9]&&Pe(f,y[9]),k[0]&32){b=nt(y[5]);let V;for(V=0;V<b.length;V+=1){const E=wr(y,b,V);w[V]?w[V].p(E,k):(w[V]=Dr(E),w[V].c(),w[V].m(g,null))}for(;V<w.length;V+=1)w[V].d(1);w.length=b.length}},i:xe,o:xe,d(y){y&&u(e),Ht(w,y),_=!1,p()}}}function rc(s){let e,t,l=s[8].t("Set Voice")+"",a,r,o,i,f,m,g=s[8].t("Default")+"",_,p,b,w,y,k=s[8].t("Allow non-local voices")+"",V,E,T,D,I,L,B,H,F=nt(s[5].filter(s[19])),N=[];for(let C=0;C<F.length;C+=1)N[C]=Tr(kr(s,F,C));function q(C){s[21](C)}let z={};return s[3]!==void 0&&(z.state=s[3]),D=new In({props:z}),mt.push(()=>Et(D,"state",q)),{c(){e=d("div"),t=d("div"),a=x(l),r=S(),o=d("div"),i=d("div"),f=d("select"),m=d("option"),_=x(g);for(let C=0;C<N.length;C+=1)N[C].c();b=S(),w=d("div"),y=d("div"),V=x(k),E=S(),T=d("div"),he(D.$$.fragment),this.h()},l(C){e=h(C,"DIV",{});var A=v(e);t=h(A,"DIV",{class:!0});var R=v(t);a=O(R,l),R.forEach(u),r=M(A),o=h(A,"DIV",{class:!0});var P=v(o);i=h(P,"DIV",{class:!0});var Z=v(i);f=h(Z,"SELECT",{class:!0});var Y=v(f);m=h(Y,"OPTION",{});var U=v(m);_=O(U,g),U.forEach(u);for(let K=0;K<N.length;K+=1)N[K].l(Y);Y.forEach(u),Z.forEach(u),P.forEach(u),b=M(A),w=h(A,"DIV",{class:!0});var W=v(w);y=h(W,"DIV",{class:!0});var X=v(y);V=O(X,k),X.forEach(u),E=M(W),T=h(W,"DIV",{class:!0});var G=v(T);ve(D.$$.fragment,G),G.forEach(u),W.forEach(u),A.forEach(u),this.h()},h(){c(t,"class","mb-2.5 text-sm font-medium"),m.__value="",Pe(m,m.__value),m.selected=p=s[9]!=="",c(f,"class","w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"),s[9]===void 0&&Ml(()=>s[20].call(f)),c(i,"class","flex-1"),c(o,"class","flex w-full"),c(y,"class","text-xs"),c(T,"class","mt-1"),c(w,"class","flex items-center justify-between my-1.5")},m(C,A){j(C,e,A),n(e,t),n(t,a),n(e,r),n(e,o),n(o,i),n(i,f),n(f,m),n(m,_);for(let R=0;R<N.length;R+=1)N[R]&&N[R].m(f,null);Wt(f,s[9],!0),n(e,b),n(e,w),n(w,y),n(y,V),n(w,E),n(w,T),me(D,T,null),L=!0,B||(H=te(f,"change",s[20]),B=!0)},p(C,A){if((!L||A[0]&256)&&l!==(l=C[8].t("Set Voice")+"")&&$(a,l),(!L||A[0]&256)&&g!==(g=C[8].t("Default")+"")&&$(_,g),(!L||A[0]&552&&p!==(p=C[9]!==""))&&(m.selected=p),A[0]&552){F=nt(C[5].filter(C[19]));let P;for(P=0;P<F.length;P+=1){const Z=kr(C,F,P);N[P]?N[P].p(Z,A):(N[P]=Tr(Z),N[P].c(),N[P].m(f,null))}for(;P<N.length;P+=1)N[P].d(1);N.length=F.length}A[0]&552&&Wt(f,C[9]),(!L||A[0]&256)&&k!==(k=C[8].t("Allow non-local voices")+"")&&$(V,k);const R={};!I&&A[0]&8&&(I=!0,R.state=C[3],yt(()=>I=!1)),D.$set(R)},i(C){L||(ee(D.$$.fragment,C),L=!0)},o(C){ae(D.$$.fragment,C),L=!1},d(C){C&&u(e),Ht(N,C),_e(D),B=!1,H()}}}function Dr(s){let e,t=s[9].name+"",l,a;return{c(){e=d("option"),l=x(t),this.h()},l(r){e=h(r,"OPTION",{});var o=v(e);l=O(o,t),o.forEach(u),this.h()},h(){e.__value=a=s[9].id,Pe(e,e.__value)},m(r,o){j(r,e,o),n(e,l)},p(r,o){o[0]&32&&t!==(t=r[9].name+"")&&$(l,t),o[0]&32&&a!==(a=r[9].id)&&(e.__value=a,Pe(e,e.__value))},d(r){r&&u(e)}}}function Tr(s){let e,t=s[27].name+"",l,a,r;return{c(){e=d("option"),l=x(t),this.h()},l(o){e=h(o,"OPTION",{class:!0});var i=v(e);l=O(i,t),i.forEach(u),this.h()},h(){e.__value=a=s[27].name,Pe(e,e.__value),c(e,"class","bg-gray-100 dark:bg-gray-700"),e.selected=r=s[9]===s[27].name},m(o,i){j(o,e,i),n(e,l)},p(o,i){i[0]&40&&t!==(t=o[27].name+"")&&$(l,t),i[0]&40&&a!==(a=o[27].name)&&(e.__value=a,Pe(e,e.__value)),i[0]&552&&r!==(r=o[9]===o[27].name)&&(e.selected=r)},d(o){o&&u(e)}}}function nc(s){let e,t,l,a,r=s[8].t("STT Settings")+"",o,i,f,m,g,_=s[8].t("Instant Auto-Send After Voice Transcription")+"",p,b,w,y,k,V,E=s[8].t("TTS Settings")+"",T,D,I,L,B=s[8].t("Auto-playback response")+"",H,F,N,q,z,C,A=s[8].t("Speech Playback Speed")+"",R,P,Z,Y,U,W,X,G,K,J,Q,ue,ke=s[8].t("Save")+"",Ee,Me,Oe,je,pe=s[7].audio.stt.engine!=="web"&&Er(s);function He(re,Ve){return re[1]===!0?tc:ec}let We=He(s),Be=We(s);function Qe(re,Ve){return re[2]===!0?sc:lc}let se=Qe(s),de=se(s),De=nt(s[12]),ie=[];for(let re=0;re<De.length;re+=1)ie[re]=Ir(yr(s,De,re));const Te=[rc,ac],ge=[];function ze(re,Ve){return re[7].audio.tts.engine===""?0:re[7].audio.tts.engine!==""?1:-1}return~(G=ze(s))&&(K=ge[G]=Te[G](s)),{c(){e=d("form"),t=d("div"),l=d("div"),a=d("div"),o=x(r),i=S(),pe&&pe.c(),f=S(),m=d("div"),g=d("div"),p=x(_),b=S(),w=d("button"),Be.c(),y=S(),k=d("div"),V=d("div"),T=x(E),D=S(),I=d("div"),L=d("div"),H=x(B),F=S(),N=d("button"),de.c(),q=S(),z=d("div"),C=d("div"),R=x(A),P=S(),Z=d("div"),Y=d("select");for(let re=0;re<ie.length;re+=1)ie[re].c();U=S(),W=d("hr"),X=S(),K&&K.c(),J=S(),Q=d("div"),ue=d("button"),Ee=x(ke),this.h()},l(re){e=h(re,"FORM",{class:!0});var Ve=v(e);t=h(Ve,"DIV",{class:!0});var ce=v(t);l=h(ce,"DIV",{});var ye=v(l);a=h(ye,"DIV",{class:!0});var Je=v(a);o=O(Je,r),Je.forEach(u),i=M(ye),pe&&pe.l(ye),f=M(ye),m=h(ye,"DIV",{class:!0});var le=v(m);g=h(le,"DIV",{class:!0});var oe=v(g);p=O(oe,_),oe.forEach(u),b=M(le),w=h(le,"BUTTON",{class:!0,type:!0});var be=v(w);Be.l(be),be.forEach(u),le.forEach(u),ye.forEach(u),y=M(ce),k=h(ce,"DIV",{});var Le=v(k);V=h(Le,"DIV",{class:!0});var et=v(V);T=O(et,E),et.forEach(u),D=M(Le),I=h(Le,"DIV",{class:!0});var $e=v(I);L=h($e,"DIV",{class:!0});var Re=v(L);H=O(Re,B),Re.forEach(u),F=M($e),N=h($e,"BUTTON",{class:!0,type:!0});var qe=v(N);de.l(qe),qe.forEach(u),$e.forEach(u),q=M(Le),z=h(Le,"DIV",{class:!0});var tt=v(z);C=h(tt,"DIV",{class:!0});var lt=v(C);R=O(lt,A),lt.forEach(u),P=M(tt),Z=h(tt,"DIV",{class:!0});var Ze=v(Z);Y=h(Ze,"SELECT",{class:!0});var st=v(Y);for(let Ae=0;Ae<ie.length;Ae+=1)ie[Ae].l(st);st.forEach(u),Ze.forEach(u),tt.forEach(u),Le.forEach(u),U=M(ce),W=h(ce,"HR",{class:!0}),X=M(ce),K&&K.l(ce),ce.forEach(u),J=M(Ve),Q=h(Ve,"DIV",{class:!0});var Ye=v(Q);ue=h(Ye,"BUTTON",{class:!0,type:!0});var Fe=v(ue);Ee=O(Fe,ke),Fe.forEach(u),Ye.forEach(u),Ve.forEach(u),this.h()},h(){c(a,"class","mb-1 text-sm font-medium"),c(g,"class","self-center text-xs font-medium"),c(w,"class","p-1 px-3 text-xs flex rounded transition"),c(w,"type","button"),c(m,"class","py-0.5 flex w-full justify-between"),c(V,"class","mb-1 text-sm font-medium"),c(L,"class","self-center text-xs font-medium"),c(N,"class","p-1 px-3 text-xs flex rounded transition"),c(N,"type","button"),c(I,"class","py-0.5 flex w-full justify-between"),c(C,"class","self-center text-xs font-medium"),c(Y,"class","dark:bg-gray-900 w-fit pr-8 rounded px-2 p-1 text-xs bg-transparent outline-none text-right"),s[6]===void 0&&Ml(()=>s[18].call(Y)),c(Z,"class","flex items-center relative"),c(z,"class","py-0.5 flex w-full justify-between"),c(W,"class","dark:border-gray-850"),c(t,"class","space-y-3 pr-1.5 overflow-y-scroll max-h-[25rem]"),c(ue,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(ue,"type","submit"),c(Q,"class","flex justify-end text-sm font-medium"),c(e,"class","flex flex-col h-full justify-between space-y-3 text-sm")},m(re,Ve){j(re,e,Ve),n(e,t),n(t,l),n(l,a),n(a,o),n(l,i),pe&&pe.m(l,null),n(l,f),n(l,m),n(m,g),n(g,p),n(m,b),n(m,w),Be.m(w,null),n(t,y),n(t,k),n(k,V),n(V,T),n(k,D),n(k,I),n(I,L),n(L,H),n(I,F),n(I,N),de.m(N,null),n(k,q),n(k,z),n(z,C),n(C,R),n(z,P),n(z,Z),n(Z,Y);for(let ce=0;ce<ie.length;ce+=1)ie[ce]&&ie[ce].m(Y,null);Wt(Y,s[6],!0),n(t,U),n(t,W),n(t,X),~G&&ge[G].m(t,null),n(e,J),n(e,Q),n(Q,ue),n(ue,Ee),Me=!0,Oe||(je=[te(w,"click",s[16]),te(N,"click",s[17]),te(Y,"change",s[18]),te(e,"submit",zl(s[23]))],Oe=!0)},p(re,Ve){if((!Me||Ve[0]&256)&&r!==(r=re[8].t("STT Settings")+"")&&$(o,r),re[7].audio.stt.engine!=="web"?pe?pe.p(re,Ve):(pe=Er(re),pe.c(),pe.m(l,f)):pe&&(pe.d(1),pe=null),(!Me||Ve[0]&256)&&_!==(_=re[8].t("Instant Auto-Send After Voice Transcription")+"")&&$(p,_),We===(We=He(re))&&Be?Be.p(re,Ve):(Be.d(1),Be=We(re),Be&&(Be.c(),Be.m(w,null))),(!Me||Ve[0]&256)&&E!==(E=re[8].t("TTS Settings")+"")&&$(T,E),(!Me||Ve[0]&256)&&B!==(B=re[8].t("Auto-playback response")+"")&&$(H,B),se===(se=Qe(re))&&de?de.p(re,Ve):(de.d(1),de=se(re),de&&(de.c(),de.m(N,null))),(!Me||Ve[0]&256)&&A!==(A=re[8].t("Speech Playback Speed")+"")&&$(R,A),Ve[0]&4160){De=nt(re[12]);let ye;for(ye=0;ye<De.length;ye+=1){const Je=yr(re,De,ye);ie[ye]?ie[ye].p(Je,Ve):(ie[ye]=Ir(Je),ie[ye].c(),ie[ye].m(Y,null))}for(;ye<ie.length;ye+=1)ie[ye].d(1);ie.length=De.length}Ve[0]&4160&&Wt(Y,re[6]);let ce=G;G=ze(re),G===ce?~G&&ge[G].p(re,Ve):(K&&(bt(),ae(ge[ce],1,1,()=>{ge[ce]=null}),wt()),~G?(K=ge[G],K?K.p(re,Ve):(K=ge[G]=Te[G](re),K.c()),ee(K,1),K.m(t,null)):K=null),(!Me||Ve[0]&256)&&ke!==(ke=re[8].t("Save")+"")&&$(Ee,ke)},i(re){Me||(ee(K),Me=!0)},o(re){ae(K),Me=!1},d(re){re&&u(e),pe&&pe.d(),Be.d(),de.d(),Ht(ie,re),~G&&ge[G].d(),Oe=!1,vt(je)}}}function oc(s,e,t){let l,a,r;Se(s,bl,C=>t(25,l=C)),Se(s,Vs,C=>t(7,a=C));const o=fl(),i=gt("i18n");Se(s,i,C=>t(8,r=C));let{saveSettings:f}=e,m=!1,g=!1,_=!1,p="",b=[],w="",y=1;const k=[2,1.75,1.5,1.25,1,.75,.5],V=async()=>{if(a.audio.tts.engine===""){const C=setInterval(async()=>{t(5,b=await speechSynthesis.getVoices()),b.length>0&&clearInterval(C)},100)}else{const C=await bo(localStorage.token).catch(A=>{Xe.error(A)});C&&(console.log(C),t(5,b=C.voices))}},E=async()=>{t(2,g=!g),f({responseAutoPlayback:g})},T=async()=>{t(1,m=!m),f({speechAutoSend:m})};ul(async()=>{var C,A,R,P,Z,Y,U,W,X,G;t(6,y=((A=(C=l.audio)==null?void 0:C.tts)==null?void 0:A.playbackRate)??1),l.conversationMode,t(1,m=l.speechAutoSend??!1),t(2,g=l.responseAutoPlayback??!1),t(4,p=((P=(R=l==null?void 0:l.audio)==null?void 0:R.stt)==null?void 0:P.engine)??""),((Y=(Z=l==null?void 0:l.audio)==null?void 0:Z.tts)==null?void 0:Y.defaultVoice)===a.audio.tts.voice?t(9,w=((W=(U=l==null?void 0:l.audio)==null?void 0:U.tts)==null?void 0:W.voice)??a.audio.tts.voice??""):t(9,w=a.audio.tts.voice??""),t(3,_=((G=(X=l.audio)==null?void 0:X.tts)==null?void 0:G.nonLocalVoices)??!1),await V()});function D(){p=Pl(this),t(4,p)}const I=()=>{T()},L=()=>{E()};function B(){y=Pl(this),t(6,y),t(12,k)}const H=C=>_||C.localService===!0;function F(){w=Pl(this),t(9,w),t(5,b),t(3,_)}function N(C){_=C,t(3,_)}function q(){w=this.value,t(9,w),t(5,b),t(3,_)}const z=async()=>{var C,A;f({audio:{stt:{engine:p!==""?p:void 0},tts:{playbackRate:y,voice:w!==""?w:void 0,defaultVoice:((A=(C=a==null?void 0:a.audio)==null?void 0:C.tts)==null?void 0:A.voice)??"",nonLocalVoices:a.audio.tts.engine===""?_:void 0}}}),o("save")};return s.$$set=C=>{"saveSettings"in C&&t(0,f=C.saveSettings)},[f,m,g,_,p,b,y,a,r,w,o,i,k,E,T,D,I,L,B,H,F,N,q,z]}class ic extends ut{constructor(e){super(),ft(this,e,oc,nc,ct,{saveSettings:0},null,[-1,-1])}}function cc(s){let e,t,l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-4"><path d="M3.375 3C2.339 3 1.5 3.84 1.5 4.875v.75c0 1.036.84 1.875 1.875 1.875h17.25c1.035 0 1.875-.84 1.875-1.875v-.75C22.5 3.839 21.66 3 20.625 3H3.375Z"></path><path fill-rule="evenodd" d="m3.087 9 .54 9.176A3 3 0 0 0 6.62 21h10.757a3 3 0 0 0 2.995-2.824L20.913 9H3.087Zm6.163 3.75A.75.75 0 0 1 10 12h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.75-.75Z" clip-rule="evenodd"></path></svg>',a,r,o=s[4].t("Archive All Chats")+"",i,f,m;return{c(){e=d("button"),t=d("div"),t.innerHTML=l,a=S(),r=d("div"),i=x(o),this.h()},l(g){e=h(g,"BUTTON",{class:!0});var _=v(e);t=h(_,"DIV",{class:!0,"data-svelte-h":!0}),Ne(t)!=="svelte-1duozwn"&&(t.innerHTML=l),a=M(_),r=h(_,"DIV",{class:!0});var p=v(r);i=O(p,o),p.forEach(u),_.forEach(u),this.h()},h(){c(t,"class","self-center mr-3"),c(r,"class","self-center text-sm font-medium"),c(e,"class","flex rounded-md py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition")},m(g,_){j(g,e,_),n(e,t),n(e,a),n(e,r),n(r,i),f||(m=te(e,"click",s[16]),f=!0)},p(g,_){_&16&&o!==(o=g[4].t("Archive All Chats")+"")&&$(i,o)},d(g){g&&u(e),f=!1,m()}}}function uc(s){let e,t,l,a,r,o,i,f=s[4].t("Are you sure?")+"",m,g,_,p,b='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd"></path></svg>',w,y,k='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',V,E;return{c(){e=d("div"),t=d("div"),l=ot("svg"),a=ot("path"),r=ot("path"),o=S(),i=d("span"),m=x(f),g=S(),_=d("div"),p=d("button"),p.innerHTML=b,w=S(),y=d("button"),y.innerHTML=k,this.h()},l(T){e=h(T,"DIV",{class:!0});var D=v(e);t=h(D,"DIV",{class:!0});var I=v(t);l=it(I,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var L=v(l);a=it(L,"path",{d:!0}),v(a).forEach(u),r=it(L,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(r).forEach(u),L.forEach(u),o=M(I),i=h(I,"SPAN",{});var B=v(i);m=O(B,f),B.forEach(u),I.forEach(u),g=M(D),_=h(D,"DIV",{class:!0});var H=v(_);p=h(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(p)!=="svelte-88c061"&&(p.innerHTML=b),w=M(H),y=h(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(y)!=="svelte-1601eo8"&&(y.innerHTML=k),H.forEach(u),D.forEach(u),this.h()},h(){c(a,"d","M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3Z"),c(r,"fill-rule","evenodd"),c(r,"d","M13 6H3v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V6ZM5.72 7.47a.75.75 0 0 1 1.06 0L8 8.69l1.22-1.22a.75.75 0 1 1 1.06 1.06L9.06 9.75l1.22 1.22a.75.75 0 1 1-1.06 1.06L8 10.81l-1.22 1.22a.75.75 0 0 1-1.06-1.06l1.22-1.22-1.22-1.22a.75.75 0 0 1 0-1.06Z"),c(r,"clip-rule","evenodd"),c(l,"xmlns","http://www.w3.org/2000/svg"),c(l,"viewBox","0 0 16 16"),c(l,"fill","currentColor"),c(l,"class","w-4 h-4"),c(t,"class","flex items-center space-x-3"),c(p,"class","hover:text-white transition"),c(y,"class","hover:text-white transition"),c(_,"class","flex space-x-1.5 items-center"),c(e,"class","flex justify-between rounded-md items-center py-2 px-3.5 w-full transition")},m(T,D){j(T,e,D),n(e,t),n(t,l),n(l,a),n(l,r),n(t,o),n(t,i),n(i,m),n(e,g),n(e,_),n(_,p),n(_,w),n(_,y),V||(E=[te(p,"click",s[14]),te(y,"click",s[15])],V=!0)},p(T,D){D&16&&f!==(f=T[4].t("Are you sure?")+"")&&$(m,f)},d(T){T&&u(e),V=!1,vt(E)}}}function fc(s){let e,t,l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm7 7a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h4.5A.75.75 0 0 1 11 9Z" clip-rule="evenodd"></path></svg>',a,r,o=s[4].t("Delete All Chats")+"",i,f,m;return{c(){e=d("button"),t=d("div"),t.innerHTML=l,a=S(),r=d("div"),i=x(o),this.h()},l(g){e=h(g,"BUTTON",{class:!0});var _=v(e);t=h(_,"DIV",{class:!0,"data-svelte-h":!0}),Ne(t)!=="svelte-15aqp4h"&&(t.innerHTML=l),a=M(_),r=h(_,"DIV",{class:!0});var p=v(r);i=O(p,o),p.forEach(u),_.forEach(u),this.h()},h(){c(t,"class","self-center mr-3"),c(r,"class","self-center text-sm font-medium"),c(e,"class","flex rounded-md py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition")},m(g,_){j(g,e,_),n(e,t),n(e,a),n(e,r),n(r,i),f||(m=te(e,"click",s[19]),f=!0)},p(g,_){_&16&&o!==(o=g[4].t("Delete All Chats")+"")&&$(i,o)},d(g){g&&u(e),f=!1,m()}}}function dc(s){let e,t,l,a,r,o,i,f=s[4].t("Are you sure?")+"",m,g,_,p,b='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd"></path></svg>',w,y,k='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',V,E;return{c(){e=d("div"),t=d("div"),l=ot("svg"),a=ot("path"),r=ot("path"),o=S(),i=d("span"),m=x(f),g=S(),_=d("div"),p=d("button"),p.innerHTML=b,w=S(),y=d("button"),y.innerHTML=k,this.h()},l(T){e=h(T,"DIV",{class:!0});var D=v(e);t=h(D,"DIV",{class:!0});var I=v(t);l=it(I,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var L=v(l);a=it(L,"path",{d:!0}),v(a).forEach(u),r=it(L,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(r).forEach(u),L.forEach(u),o=M(I),i=h(I,"SPAN",{});var B=v(i);m=O(B,f),B.forEach(u),I.forEach(u),g=M(D),_=h(D,"DIV",{class:!0});var H=v(_);p=h(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(p)!=="svelte-19nv6qp"&&(p.innerHTML=b),w=M(H),y=h(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(y)!=="svelte-ekcykx"&&(y.innerHTML=k),H.forEach(u),D.forEach(u),this.h()},h(){c(a,"d","M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3Z"),c(r,"fill-rule","evenodd"),c(r,"d","M13 6H3v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V6ZM5.72 7.47a.75.75 0 0 1 1.06 0L8 8.69l1.22-1.22a.75.75 0 1 1 1.06 1.06L9.06 9.75l1.22 1.22a.75.75 0 1 1-1.06 1.06L8 10.81l-1.22 1.22a.75.75 0 0 1-1.06-1.06l1.22-1.22-1.22-1.22a.75.75 0 0 1 0-1.06Z"),c(r,"clip-rule","evenodd"),c(l,"xmlns","http://www.w3.org/2000/svg"),c(l,"viewBox","0 0 16 16"),c(l,"fill","currentColor"),c(l,"class","w-4 h-4"),c(t,"class","flex items-center space-x-3"),c(p,"class","hover:text-white transition"),c(y,"class","hover:text-white transition"),c(_,"class","flex space-x-1.5 items-center"),c(e,"class","flex justify-between rounded-md items-center py-2 px-3.5 w-full transition")},m(T,D){j(T,e,D),n(e,t),n(t,l),n(l,a),n(l,r),n(t,o),n(t,i),n(i,m),n(e,g),n(e,_),n(_,p),n(_,w),n(_,y),V||(E=[te(p,"click",s[17]),te(y,"click",s[18])],V=!0)},p(T,D){D&16&&f!==(f=T[4].t("Are you sure?")+"")&&$(m,f)},d(T){T&&u(e),V=!1,vt(E)}}}function hc(s){let e,t,l,a,r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 9.5a.75.75 0 0 1-.75-.75V8.06l-.72.72a.75.75 0 0 1-1.06-1.06l2-2a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-.72-.72v2.69a.75.75 0 0 1-.75.75Z" clip-rule="evenodd"></path></svg>',m,g,_=s[4].t("Import Chats")+"",p,b,w,y,k='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 3.5a.75.75 0 0 1 .75.75v2.69l.72-.72a.75.75 0 1 1 1.06 1.06l-2 2a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 0 1 1.06-1.06l.72.72V6.25A.75.75 0 0 1 8 5.5Z" clip-rule="evenodd"></path></svg>',V,E,T=s[4].t("Export Chats")+"",D,I,L,B,H,F,N,q;function z(Y,U){return Y[1]?uc:cc}let C=z(s),A=C(s);function R(Y,U){return Y[2]?dc:fc}let P=R(s),Z=P(s);return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("input"),r=S(),o=d("button"),i=d("div"),i.innerHTML=f,m=S(),g=d("div"),p=x(_),b=S(),w=d("button"),y=d("div"),y.innerHTML=k,V=S(),E=d("div"),D=x(T),I=S(),L=d("hr"),B=S(),H=d("div"),A.c(),F=S(),Z.c(),this.h()},l(Y){e=h(Y,"DIV",{class:!0});var U=v(e);t=h(U,"DIV",{class:!0});var W=v(t);l=h(W,"DIV",{class:!0});var X=v(l);a=h(X,"INPUT",{id:!0,type:!0,accept:!0}),r=M(X),o=h(X,"BUTTON",{class:!0});var G=v(o);i=h(G,"DIV",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-135keqh"&&(i.innerHTML=f),m=M(G),g=h(G,"DIV",{class:!0});var K=v(g);p=O(K,_),K.forEach(u),G.forEach(u),b=M(X),w=h(X,"BUTTON",{class:!0});var J=v(w);y=h(J,"DIV",{class:!0,"data-svelte-h":!0}),Ne(y)!=="svelte-7e4f4y"&&(y.innerHTML=k),V=M(J),E=h(J,"DIV",{class:!0});var Q=v(E);D=O(Q,T),Q.forEach(u),J.forEach(u),X.forEach(u),I=M(W),L=h(W,"HR",{class:!0}),B=M(W),H=h(W,"DIV",{class:!0});var ue=v(H);A.l(ue),F=M(ue),Z.l(ue),ue.forEach(u),W.forEach(u),U.forEach(u),this.h()},h(){c(a,"id","chat-import-input"),c(a,"type","file"),c(a,"accept",".json"),a.hidden=!0,c(i,"class","self-center mr-3"),c(g,"class","self-center text-sm font-medium"),c(o,"class","flex rounded-md py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition"),c(y,"class","self-center mr-3"),c(E,"class","self-center text-sm font-medium"),c(w,"class","flex rounded-md py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition"),c(l,"class","flex flex-col"),c(L,"class","dark:border-gray-850"),c(H,"class","flex flex-col"),c(t,"class","space-y-2"),c(e,"class","flex flex-col h-full justify-between space-y-3 text-sm max-h-[22rem]")},m(Y,U){j(Y,e,U),n(e,t),n(t,l),n(l,a),s[10](a),n(l,r),n(l,o),n(o,i),n(o,m),n(o,g),n(g,p),n(l,b),n(l,w),n(w,y),n(w,V),n(w,E),n(E,D),n(t,I),n(t,L),n(t,B),n(t,H),A.m(H,null),n(H,F),Z.m(H,null),N||(q=[te(a,"change",s[11]),te(o,"click",s[12]),te(w,"click",s[13])],N=!0)},p(Y,[U]){U&16&&_!==(_=Y[4].t("Import Chats")+"")&&$(p,_),U&16&&T!==(T=Y[4].t("Export Chats")+"")&&$(D,T),C===(C=z(Y))&&A?A.p(Y,U):(A.d(1),A=C(Y),A&&(A.c(),A.m(H,F))),P===(P=R(Y))&&Z?Z.p(Y,U):(Z.d(1),Z=P(Y),Z&&(Z.c(),Z.m(H,null)))},i:xe,o:xe,d(Y){Y&&u(e),s[10](null),A.d(),Z.d(),N=!1,vt(q)}}}function vc(s,e,t){let l,a;Se(s,Zt,N=>t(20,l=N));const{saveAs:r}=Ys,o=gt("i18n");Se(s,o,N=>t(4,a=N));let{saveSettings:i}=e,f,m=!1,g=!1,_;const p=async N=>{for(const q of N)console.log(q),q.chat?await tr(localStorage.token,q.chat):await tr(localStorage.token,q);Zt.set(1),await Ot.set(await cl(localStorage.token,l)),Cl.set(!0)},b=async()=>{let N=new Blob([JSON.stringify(await Nn(localStorage.token))],{type:"application/json"});r(N,`chat-export-${Date.now()}.json`)},w=async()=>{await Al("/"),await xn(localStorage.token).catch(N=>{Xe.error(N)}),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),Cl.set(!0)},y=async()=>{await Al("/"),await On(localStorage.token).catch(N=>{Xe.error(N)}),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),Cl.set(!0)};function k(N){mt[N?"unshift":"push"](()=>{_=N,t(3,_)})}function V(){f=this.files,t(0,f)}const E=()=>{_.click()},T=()=>{b()},D=()=>{w(),t(1,m=!1)},I=()=>{t(1,m=!1)},L=()=>{t(1,m=!0)},B=()=>{y(),t(2,g=!1)},H=()=>{t(2,g=!1)},F=()=>{t(2,g=!0)};return s.$$set=N=>{"saveSettings"in N&&t(9,i=N.saveSettings)},s.$$.update=()=>{if(s.$$.dirty&1&&f){console.log(f);let N=new FileReader;N.onload=q=>{let z=JSON.parse(q.target.result);if(console.log(z),vo(z)=="openai")try{z=mo(z)}catch(C){console.log("Unable to import chats:",C)}p(z)},f.length>0&&N.readAsText(f[0])}},[f,m,g,_,a,o,b,w,y,i,k,V,E,T,D,I,L,B,H,F]}class mc extends ut{constructor(e){super(),ft(this,e,vc,hc,ct,{saveSettings:9})}}function _c(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,viewBox:!0,fill:!0,class:!0});var a=v(e);t=it(a,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"fill-rule","evenodd"),c(t,"d","M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z"),c(t,"clip-rule","evenodd"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 24 24"),c(e,"fill","currentColor"),c(e,"class",s[0])},m(l,a){j(l,e,a),n(e,t)},p(l,[a]){a&1&&c(e,"class",l[0])},i:xe,o:xe,d(l){l&&u(e)}}}function pc(s,e,t){let{className:l="w-4 h-4"}=e;return s.$$set=a=>{"className"in a&&t(0,l=a.className)},[l]}class gc extends ut{constructor(e){super(),ft(this,e,pc,_c,ct,{className:0})}}function Vr(s){let e,t=`<svg class="w-4 h-4" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><style>.spinner_ajPY {
transform-origin: center;
animation: spinner_AtaB 0.75s infinite linear;
}
@keyframes spinner_AtaB {
100% {
transform: rotate(360deg);
}
}
</style><path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"></path><path d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" class="spinner_ajPY"></path></svg>`;return{c(){e=d("div"),e.innerHTML=t,this.h()},l(l){e=h(l,"DIV",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1vuzrxa"&&(e.innerHTML=t),this.h()},h(){c(e,"class","ml-2 self-center")},m(l,a){j(l,e,a)},d(l){l&&u(e)}}}function bc(s){let e,t,l,a=s[3].t("Add Memory")+"",r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',m,g,_,p,b,w,y,k,V,E,T=s[3].t('Refer to yourself as "User" (e.g., "User is learning Spanish")')+"",D,I,L,B,H=s[3].t("Add")+"",F,N,q,z,C,A=s[1]&&Vr();return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),i.innerHTML=f,m=S(),g=d("div"),_=d("div"),p=d("form"),b=d("div"),w=d("textarea"),k=S(),V=d("div"),E=x("ⓘ "),D=x(T),I=S(),L=d("div"),B=d("button"),F=x(H),N=S(),A&&A.c(),this.h()},l(R){e=h(R,"DIV",{});var P=v(e);t=h(P,"DIV",{class:!0});var Z=v(t);l=h(Z,"DIV",{class:!0});var Y=v(l);r=O(Y,a),Y.forEach(u),o=M(Z),i=h(Z,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-745w2y"&&(i.innerHTML=f),Z.forEach(u),m=M(P),g=h(P,"DIV",{class:!0});var U=v(g);_=h(U,"DIV",{class:!0});var W=v(_);p=h(W,"FORM",{class:!0});var X=v(p);b=h(X,"DIV",{class:!0});var G=v(b);w=h(G,"TEXTAREA",{class:!0,rows:!0,placeholder:!0}),v(w).forEach(u),k=M(G),V=h(G,"DIV",{class:!0});var K=v(V);E=O(K,"ⓘ "),D=O(K,T),K.forEach(u),G.forEach(u),I=M(X),L=h(X,"DIV",{class:!0});var J=v(L);B=h(J,"BUTTON",{class:!0,type:!0});var Q=v(B);F=O(Q,H),N=M(Q),A&&A.l(Q),Q.forEach(u),J.forEach(u),X.forEach(u),W.forEach(u),U.forEach(u),P.forEach(u),this.h()},h(){c(l,"class","text-lg font-medium self-center"),c(i,"class","self-center"),c(t,"class","flex justify-between dark:text-gray-300 px-5 pt-4 pb-2"),c(w,"class","bg-transparent w-full text-sm resize-none rounded-xl p-3 outline outline-1 outline-gray-100 dark:outline-gray-800"),c(w,"rows","3"),c(w,"placeholder",y=s[3].t("Enter a detail about yourself for your LLMs to recall")),c(V,"class","text-xs text-gray-500"),c(b,"class",""),c(B,"class",q="px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-3xl flex flex-row space-x-1 items-center "+(s[1]?" cursor-not-allowed":"")),c(B,"type","submit"),B.disabled=s[1],c(L,"class","flex justify-end pt-1 text-sm font-medium"),c(p,"class","flex flex-col w-full"),c(_,"class","flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6"),c(g,"class","flex flex-col md:flex-row w-full px-5 pb-4 md:space-x-4 dark:text-gray-200")},m(R,P){j(R,e,P),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(e,m),n(e,g),n(g,_),n(_,p),n(p,b),n(b,w),Pe(w,s[2]),n(b,k),n(b,V),n(V,E),n(V,D),n(p,I),n(p,L),n(L,B),n(B,F),n(B,N),A&&A.m(B,null),z||(C=[te(i,"click",s[6]),te(w,"input",s[7]),te(p,"submit",zl(s[8]))],z=!0)},p(R,P){P&8&&a!==(a=R[3].t("Add Memory")+"")&&$(r,a),P&8&&y!==(y=R[3].t("Enter a detail about yourself for your LLMs to recall"))&&c(w,"placeholder",y),P&4&&Pe(w,R[2]),P&8&&T!==(T=R[3].t('Refer to yourself as "User" (e.g., "User is learning Spanish")')+"")&&$(D,T),P&8&&H!==(H=R[3].t("Add")+"")&&$(F,H),R[1]?A||(A=Vr(),A.c(),A.m(B,null)):A&&(A.d(1),A=null),P&2&&q!==(q="px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-3xl flex flex-row space-x-1 items-center "+(R[1]?" cursor-not-allowed":""))&&c(B,"class",q),P&2&&(B.disabled=R[1])},d(R){R&&u(e),A&&A.d(),z=!1,vt(C)}}}function wc(s){let e,t,l;function a(o){s[9](o)}let r={size:"sm",$$slots:{default:[bc]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.show=s[0]),e=new Rl({props:r}),mt.push(()=>Et(e,"show",a)),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&2063&&(f.$$scope={dirty:i,ctx:o}),!t&&i&1&&(t=!0,f.show=o[0],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}function kc(s,e,t){let l;const a=fl();let{show:r}=e;const o=gt("i18n");Se(s,o,w=>t(3,l=w));let i=!1,f="";const m=async()=>{t(1,i=!0);const w=await wo(localStorage.token,f).catch(y=>(Xe.error(y),null));w&&(console.log(w),Xe.success(l.t("Memory added successfully")),t(2,f=""),t(0,r=!1),a("save")),t(1,i=!1)},g=()=>{t(0,r=!1)};function _(){f=this.value,t(2,f)}const p=()=>{m()};function b(w){r=w,t(0,r)}return s.$$set=w=>{"show"in w&&t(0,r=w.show)},[r,i,f,l,o,m,g,_,p,b]}class yc extends ut{constructor(e){super(),ft(this,e,kc,wc,ct,{show:0})}}function Cr(s){let e,t=`<svg class="w-4 h-4" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><style>.spinner_ajPY {
transform-origin: center;
animation: spinner_AtaB 0.75s infinite linear;
}
@keyframes spinner_AtaB {
100% {
transform: rotate(360deg);
}
}
</style><path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"></path><path d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" class="spinner_ajPY"></path></svg>`;return{c(){e=d("div"),e.innerHTML=t,this.h()},l(l){e=h(l,"DIV",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1vuzrxa"&&(e.innerHTML=t),this.h()},h(){c(e,"class","ml-2 self-center")},m(l,a){j(l,e,a)},d(l){l&&u(e)}}}function Ec(s){let e,t,l,a=s[3].t("Edit Memory")+"",r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',m,g,_,p,b,w,y,k,V,E,T=s[3].t('Refer to yourself as "User" (e.g., "User is learning Spanish")')+"",D,I,L,B,H=s[3].t("Update")+"",F,N,q,z,C,A=s[1]&&Cr();return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),i.innerHTML=f,m=S(),g=d("div"),_=d("div"),p=d("form"),b=d("div"),w=d("textarea"),k=S(),V=d("div"),E=x("ⓘ "),D=x(T),I=S(),L=d("div"),B=d("button"),F=x(H),N=S(),A&&A.c(),this.h()},l(R){e=h(R,"DIV",{});var P=v(e);t=h(P,"DIV",{class:!0});var Z=v(t);l=h(Z,"DIV",{class:!0});var Y=v(l);r=O(Y,a),Y.forEach(u),o=M(Z),i=h(Z,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-745w2y"&&(i.innerHTML=f),Z.forEach(u),m=M(P),g=h(P,"DIV",{class:!0});var U=v(g);_=h(U,"DIV",{class:!0});var W=v(_);p=h(W,"FORM",{class:!0});var X=v(p);b=h(X,"DIV",{class:!0});var G=v(b);w=h(G,"TEXTAREA",{class:!0,rows:!0,placeholder:!0}),v(w).forEach(u),k=M(G),V=h(G,"DIV",{class:!0});var K=v(V);E=O(K,"ⓘ "),D=O(K,T),K.forEach(u),G.forEach(u),I=M(X),L=h(X,"DIV",{class:!0});var J=v(L);B=h(J,"BUTTON",{class:!0,type:!0});var Q=v(B);F=O(Q,H),N=M(Q),A&&A.l(Q),Q.forEach(u),J.forEach(u),X.forEach(u),W.forEach(u),U.forEach(u),P.forEach(u),this.h()},h(){c(l,"class","text-lg font-medium self-center"),c(i,"class","self-center"),c(t,"class","flex justify-between dark:text-gray-300 px-5 pt-4 pb-2"),c(w,"class","bg-transparent w-full text-sm resize-none rounded-xl p-3 outline outline-1 outline-gray-100 dark:outline-gray-800"),c(w,"rows","3"),c(w,"placeholder",y=s[3].t("Enter a detail about yourself for your LLMs to recall")),c(V,"class","text-xs text-gray-500"),c(b,"class",""),c(B,"class",q="px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-3xl flex flex-row space-x-1 items-center "+(s[1]?" cursor-not-allowed":"")),c(B,"type","submit"),B.disabled=s[1],c(L,"class","flex justify-end pt-1 text-sm font-medium"),c(p,"class","flex flex-col w-full"),c(_,"class","flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6"),c(g,"class","flex flex-col md:flex-row w-full px-5 pb-4 md:space-x-4 dark:text-gray-200")},m(R,P){j(R,e,P),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(e,m),n(e,g),n(g,_),n(_,p),n(p,b),n(b,w),Pe(w,s[2]),n(b,k),n(b,V),n(V,E),n(V,D),n(p,I),n(p,L),n(L,B),n(B,F),n(B,N),A&&A.m(B,null),z||(C=[te(i,"click",s[7]),te(w,"input",s[8]),te(p,"submit",zl(s[9]))],z=!0)},p(R,P){P&8&&a!==(a=R[3].t("Edit Memory")+"")&&$(r,a),P&8&&y!==(y=R[3].t("Enter a detail about yourself for your LLMs to recall"))&&c(w,"placeholder",y),P&4&&Pe(w,R[2]),P&8&&T!==(T=R[3].t('Refer to yourself as "User" (e.g., "User is learning Spanish")')+"")&&$(D,T),P&8&&H!==(H=R[3].t("Update")+"")&&$(F,H),R[1]?A||(A=Cr(),A.c(),A.m(B,null)):A&&(A.d(1),A=null),P&2&&q!==(q="px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-3xl flex flex-row space-x-1 items-center "+(R[1]?" cursor-not-allowed":""))&&c(B,"class",q),P&2&&(B.disabled=R[1])},d(R){R&&u(e),A&&A.d(),z=!1,vt(C)}}}function Ic(s){let e,t,l;function a(o){s[10](o)}let r={size:"sm",$$slots:{default:[Ec]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.show=s[0]),e=new Rl({props:r}),mt.push(()=>Et(e,"show",a)),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&8207&&(f.$$scope={dirty:i,ctx:o}),!t&&i&1&&(t=!0,f.show=o[0],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}function Dc(s,e,t){let l;const a=fl();let{show:r}=e,{memory:o={}}=e;const i=gt("i18n");Se(s,i,k=>t(3,l=k));let f=!1,m="";const g=()=>{t(2,m=o.content)},_=async()=>{t(1,f=!0);const k=await ko(localStorage.token,o.id,m).catch(V=>(Xe.error(V),null));k&&(console.log(k),Xe.success(l.t("Memory updated successfully")),a("save"),t(0,r=!1)),t(1,f=!1)},p=()=>{t(0,r=!1)};function b(){m=this.value,t(2,m)}const w=()=>{_()};function y(k){r=k,t(0,r)}return s.$$set=k=>{"show"in k&&t(0,r=k.show),"memory"in k&&t(6,o=k.memory)},s.$$.update=()=>{s.$$.dirty&1&&r&&g()},[r,f,m,l,i,_,o,p,b,w,y]}class Tc extends ut{constructor(e){super(),ft(this,e,Dc,Ic,ct,{show:0,memory:6})}}function Sr(s,e,t){const l=s.slice();return l[19]=e[t],l}function Vc(s){let e,t,l=s[5].t("Memories accessible by LLMs will be shown here.")+"",a;return{c(){e=d("div"),t=d("div"),a=x(l),this.h()},l(r){e=h(r,"DIV",{class:!0});var o=v(e);t=h(o,"DIV",{class:!0});var i=v(t);a=O(i,l),i.forEach(u),o.forEach(u),this.h()},h(){c(t,"class","my-auto pb-10 px-4 w-full text-gray-500"),c(e,"class","text-center flex h-full text-sm w-full")},m(r,o){j(r,e,o),n(e,t),n(t,a)},p(r,o){o&32&&l!==(l=r[5].t("Memories accessible by LLMs will be shown here.")+"")&&$(a,l)},i:xe,o:xe,d(r){r&&u(e)}}}function Cc(s){let e,t,l,a,r,o,i=s[5].t("Name")+"",f,m,g,_=s[5].t("Last Modified")+"",p,b,w,y,k,V,E=nt(s[1]),T=[];for(let I=0;I<E.length;I+=1)T[I]=Mr(Sr(s,E,I));const D=I=>ae(T[I],1,1,()=>{T[I]=null});return{c(){e=d("div"),t=d("div"),l=d("table"),a=d("thead"),r=d("tr"),o=d("th"),f=x(i),m=S(),g=d("th"),p=x(_),b=S(),w=d("th"),y=S(),k=d("tbody");for(let I=0;I<T.length;I+=1)T[I].c();this.h()},l(I){e=h(I,"DIV",{class:!0});var L=v(e);t=h(L,"DIV",{class:!0});var B=v(t);l=h(B,"TABLE",{class:!0});var H=v(l);a=h(H,"THEAD",{class:!0});var F=v(a);r=h(F,"TR",{});var N=v(r);o=h(N,"TH",{scope:!0,class:!0});var q=v(o);f=O(q,i),q.forEach(u),m=M(N),g=h(N,"TH",{scope:!0,class:!0});var z=v(g);p=O(z,_),z.forEach(u),b=M(N),w=h(N,"TH",{scope:!0,class:!0}),v(w).forEach(u),N.forEach(u),F.forEach(u),y=M(H),k=h(H,"TBODY",{});var C=v(k);for(let A=0;A<T.length;A+=1)T[A].l(C);C.forEach(u),H.forEach(u),B.forEach(u),L.forEach(u),this.h()},h(){c(o,"scope","col"),c(o,"class","px-3 py-2"),c(g,"scope","col"),c(g,"class","px-3 py-2 hidden md:flex"),c(w,"scope","col"),c(w,"class","px-3 py-2 text-right"),c(a,"class","text-xs text-gray-700 uppercase bg-transparent dark:text-gray-200 border-b-2 dark:border-gray-800"),c(l,"class","w-full text-sm text-left text-gray-600 dark:text-gray-400 table-auto"),c(t,"class","relative overflow-x-auto"),c(e,"class","text-left text-sm w-full mb-4 overflow-y-scroll")},m(I,L){j(I,e,L),n(e,t),n(t,l),n(l,a),n(a,r),n(r,o),n(o,f),n(r,m),n(r,g),n(g,p),n(r,b),n(r,w),n(l,y),n(l,k);for(let B=0;B<T.length;B+=1)T[B]&&T[B].m(k,null);V=!0},p(I,L){if((!V||L&32)&&i!==(i=I[5].t("Name")+"")&&$(f,i),(!V||L&32)&&_!==(_=I[5].t("Last Modified")+"")&&$(p,_),L&58){E=nt(I[1]);let B;for(B=0;B<E.length;B+=1){const H=Sr(I,E,B);T[B]?(T[B].p(H,L),ee(T[B],1)):(T[B]=Mr(H),T[B].c(),ee(T[B],1),T[B].m(k,null))}for(bt(),B=E.length;B<T.length;B+=1)D(B);wt()}},i(I){if(!V){for(let L=0;L<E.length;L+=1)ee(T[L]);V=!0}},o(I){T=T.filter(Boolean);for(let L=0;L<T.length;L+=1)ae(T[L]);V=!1},d(I){I&&u(e),Ht(T,I)}}}function Sc(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 s-FoVA_WMOgxUD"><path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" class="s-FoVA_WMOgxUD"></path></svg>',l,a;function r(){return s[9](s[19])}return{c(){e=d("button"),e.innerHTML=t,this.h()},l(o){e=h(o,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1hkti8u"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl")},m(o,i){j(o,e,i),l||(a=te(e,"click",r),l=!0)},p(o,i){s=o},d(o){o&&u(e),l=!1,a()}}}function Mc(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4"><path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"></path></svg>',l,a;function r(){return s[10](s[19])}return{c(){e=d("button"),e.innerHTML=t,this.h()},l(o){e=h(o,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-12t315d"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl")},m(o,i){j(o,e,i),l||(a=te(e,"click",r),l=!0)},p(o,i){s=o},d(o){o&&u(e),l=!1,a()}}}function Mr(s){let e,t,l,a=s[19].content+"",r,o,i,f,m=Ts(s[19].updated_at*1e3).format(s[5].t("MMMM DD, YYYY hh:mm:ss A"))+"",g,_,p,b,w,y,k,V,E;return w=new Ft({props:{content:"Edit",$$slots:{default:[Sc]},$$scope:{ctx:s}}}),k=new Ft({props:{content:"Delete",$$slots:{default:[Mc]},$$scope:{ctx:s}}}),{c(){e=d("tr"),t=d("td"),l=d("div"),r=x(a),o=S(),i=d("td"),f=d("div"),g=x(m),_=S(),p=d("td"),b=d("div"),he(w.$$.fragment),y=S(),he(k.$$.fragment),V=S(),this.h()},l(T){e=h(T,"TR",{class:!0});var D=v(e);t=h(D,"TD",{class:!0});var I=v(t);l=h(I,"DIV",{class:!0});var L=v(l);r=O(L,a),L.forEach(u),I.forEach(u),o=M(D),i=h(D,"TD",{class:!0});var B=v(i);f=h(B,"DIV",{class:!0});var H=v(f);g=O(H,m),H.forEach(u),B.forEach(u),_=M(D),p=h(D,"TD",{class:!0});var F=v(p);b=h(F,"DIV",{class:!0});var N=v(b);ve(w.$$.fragment,N),y=M(N),ve(k.$$.fragment,N),N.forEach(u),F.forEach(u),V=M(D),D.forEach(u),this.h()},h(){c(l,"class","line-clamp-1"),c(t,"class","px-3 py-1"),c(f,"class","my-auto whitespace-nowrap"),c(i,"class","px-3 py-1 hidden md:flex h-[2.5rem]"),c(b,"class","flex justify-end w-full"),c(p,"class","px-3 py-1"),c(e,"class","border-b dark:border-gray-800 items-center")},m(T,D){j(T,e,D),n(e,t),n(t,l),n(l,r),n(e,o),n(e,i),n(i,f),n(f,g),n(e,_),n(e,p),n(p,b),me(w,b,null),n(b,y),me(k,b,null),n(e,V),E=!0},p(T,D){(!E||D&2)&&a!==(a=T[19].content+"")&&$(r,a),(!E||D&34)&&m!==(m=Ts(T[19].updated_at*1e3).format(T[5].t("MMMM DD, YYYY hh:mm:ss A"))+"")&&$(g,m);const I={};D&4194330&&(I.$$scope={dirty:D,ctx:T}),w.$set(I);const L={};D&4194338&&(L.$$scope={dirty:D,ctx:T}),k.$set(L)},i(T){E||(ee(w.$$.fragment,T),ee(k.$$.fragment,T),E=!0)},o(T){ae(w.$$.fragment,T),ae(k.$$.fragment,T),E=!1},d(T){T&&u(e),_e(w),_e(k)}}}function Ac(s){let e,t,l,a=s[5].t("Memory")+"",r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',m,g,_,p,b,w,y,k,V=s[5].t("Add Memory")+"",E,T,D,I=s[5].t("Clear memory")+"",L,B,H,F;const N=[Cc,Vc],q=[];function z(C,A){return C[1].length>0?0:1}return p=z(s),b=q[p]=N[p](s),{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),i.innerHTML=f,m=S(),g=d("div"),_=d("div"),b.c(),w=S(),y=d("div"),k=d("button"),E=x(V),T=S(),D=d("button"),L=x(I),this.h()},l(C){e=h(C,"DIV",{});var A=v(e);t=h(A,"DIV",{class:!0});var R=v(t);l=h(R,"DIV",{class:!0});var P=v(l);r=O(P,a),P.forEach(u),o=M(R),i=h(R,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-745w2y"&&(i.innerHTML=f),R.forEach(u),m=M(A),g=h(A,"DIV",{class:!0});var Z=v(g);_=h(Z,"DIV",{class:!0});var Y=v(_);b.l(Y),Y.forEach(u),w=M(Z),y=h(Z,"DIV",{class:!0});var U=v(y);k=h(U,"BUTTON",{class:!0});var W=v(k);E=O(W,V),W.forEach(u),T=M(U),D=h(U,"BUTTON",{class:!0});var X=v(D);L=O(X,I),X.forEach(u),U.forEach(u),Z.forEach(u),A.forEach(u),this.h()},h(){c(l,"class","text-lg font-medium self-center"),c(i,"class","self-center"),c(t,"class","flex justify-between dark:text-gray-300 px-5 pt-4 pb-1"),c(_,"class","flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6 h-[28rem] max-h-screen outline outline-1 rounded-xl outline-gray-100 dark:outline-gray-800 mb-4 mt-1"),c(k,"class","px-3.5 py-1.5 font-medium hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-gray-300 dark:outline-gray-800 rounded-3xl"),c(D,"class","px-3.5 py-1.5 font-medium text-red-500 hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-red-300 dark:outline-red-800 rounded-3xl"),c(y,"class","flex text-sm font-medium gap-1.5"),c(g,"class","flex flex-col w-full px-5 pb-5 dark:text-gray-200")},m(C,A){j(C,e,A),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(e,m),n(e,g),n(g,_),q[p].m(_,null),n(g,w),n(g,y),n(y,k),n(k,E),n(y,T),n(y,D),n(D,L),B=!0,H||(F=[te(i,"click",s[8]),te(k,"click",s[11]),te(D,"click",s[12])],H=!0)},p(C,A){(!B||A&32)&&a!==(a=C[5].t("Memory")+"")&&$(r,a);let R=p;p=z(C),p===R?q[p].p(C,A):(bt(),ae(q[R],1,1,()=>{q[R]=null}),wt(),b=q[p],b?b.p(C,A):(b=q[p]=N[p](C),b.c()),ee(b,1),b.m(_,null)),(!B||A&32)&&V!==(V=C[5].t("Add Memory")+"")&&$(E,V),(!B||A&32)&&I!==(I=C[5].t("Clear memory")+"")&&$(L,I)},i(C){B||(ee(b),B=!0)},o(C){ae(b),B=!1},d(C){C&&u(e),q[p].d(),H=!1,vt(F)}}}function Lc(s){let e,t,l,a,r,o,i,f,m;function g(k){s[13](k)}let _={size:"xl",$$slots:{default:[Ac]},$$scope:{ctx:s}};s[0]!==void 0&&(_.show=s[0]),e=new Rl({props:_}),mt.push(()=>Et(e,"show",g));function p(k){s[14](k)}let b={};s[2]!==void 0&&(b.show=s[2]),a=new yc({props:b}),mt.push(()=>Et(a,"show",p)),a.$on("save",s[15]);function w(k){s[16](k)}let y={memory:s[4]};return s[3]!==void 0&&(y.show=s[3]),i=new Tc({props:y}),mt.push(()=>Et(i,"show",w)),i.$on("save",s[17]),{c(){he(e.$$.fragment),l=S(),he(a.$$.fragment),o=S(),he(i.$$.fragment)},l(k){ve(e.$$.fragment,k),l=M(k),ve(a.$$.fragment,k),o=M(k),ve(i.$$.fragment,k)},m(k,V){me(e,k,V),j(k,l,V),me(a,k,V),j(k,o,V),me(i,k,V),m=!0},p(k,[V]){const E={};V&4194367&&(E.$$scope={dirty:V,ctx:k}),!t&&V&1&&(t=!0,E.show=k[0],yt(()=>t=!1)),e.$set(E);const T={};!r&&V&4&&(r=!0,T.show=k[2],yt(()=>r=!1)),a.$set(T);const D={};V&16&&(D.memory=k[4]),!f&&V&8&&(f=!0,D.show=k[3],yt(()=>f=!1)),i.$set(D)},i(k){m||(ee(e.$$.fragment,k),ee(a.$$.fragment,k),ee(i.$$.fragment,k),m=!0)},o(k){ae(e.$$.fragment,k),ae(a.$$.fragment,k),ae(i.$$.fragment,k),m=!1},d(k){k&&(u(l),u(o)),_e(e,k),_e(a,k),_e(i,k)}}}function Bc(s,e,t){let l;fl();const a=gt("i18n");Se(s,a,I=>t(5,l=I));let{show:r=!1}=e,o=[],i=!0,f=!1,m=!1,g=null;const _=()=>{t(0,r=!1)},p=I=>{t(4,g=I),t(3,m=!0)},b=async I=>{await yo(localStorage.token,I.id).catch(B=>(Xe.error(B),null))&&(Xe.success(l.t("Memory deleted successfully")),t(1,o=await ys(localStorage.token)))},w=()=>{t(2,f=!0)},y=async()=>{await Eo(localStorage.token).catch(L=>(Xe.error(L),null))&&(Xe.success(l.t("Memory cleared successfully")),t(1,o=[]))};function k(I){r=I,t(0,r)}function V(I){f=I,t(2,f)}const E=async()=>{t(1,o=await ys(localStorage.token))};function T(I){m=I,t(3,m)}const D=async()=>{t(1,o=await ys(localStorage.token))};return s.$$set=I=>{"show"in I&&t(0,r=I.show)},s.$$.update=()=>{s.$$.dirty&131&&r&&o.length===0&&i&&(async()=>(t(1,o=await ys(localStorage.token)),t(7,i=!1)))()},[r,o,f,m,g,l,a,i,_,p,b,w,y,k,V,E,T,D]}class Nc extends ut{constructor(e){super(),ft(this,e,Bc,Lc,ct,{show:0})}}function xc(s){let e,t=s[3].t("Memory")+"",l,a,r,o,i=s[3].t("Experimental")+"",f,m;return{c(){e=d("div"),l=x(t),a=S(),r=d("span"),o=x("("),f=x(i),m=x(")"),this.h()},l(g){e=h(g,"DIV",{class:!0});var _=v(e);l=O(_,t),a=M(_),r=h(_,"SPAN",{class:!0});var p=v(r);o=O(p,"("),f=O(p,i),m=O(p,")"),p.forEach(u),_.forEach(u),this.h()},h(){c(r,"class","text-xs text-gray-500"),c(e,"class","text-sm font-medium")},m(g,_){j(g,e,_),n(e,l),n(e,a),n(e,r),n(r,o),n(r,f),n(r,m)},p(g,_){_&8&&t!==(t=g[3].t("Memory")+"")&&$(l,t),_&8&&i!==(i=g[3].t("Experimental")+"")&&$(f,i)},d(g){g&&u(e)}}}function Oc(s){let e,t,l,a,r,o,i,f,m,g,_,p,b,w,y,k=s[3].t("You can personalize your interactions with LLMs by adding memories through the 'Manage' button below, making them more helpful and tailored to you.")+"",V,E,T,D,I=s[3].t("Manage")+"",L,B,H,F,N=s[3].t("Save")+"",q,z,C,A;function R(U){s[6](U)}let P={};s[1]!==void 0&&(P.show=s[1]),e=new Nc({props:P}),mt.push(()=>Et(e,"show",R)),f=new Ft({props:{content:s[3].t("This is an experimental feature, it may not function as expected and is subject to change at any time."),$$slots:{default:[xc]},$$scope:{ctx:s}}});function Z(U){s[7](U)}let Y={};return s[2]!==void 0&&(Y.state=s[2]),_=new In({props:Y}),mt.push(()=>Et(_,"state",Z)),_.$on("change",s[8]),{c(){he(e.$$.fragment),l=S(),a=d("form"),r=d("div"),o=d("div"),i=d("div"),he(f.$$.fragment),m=S(),g=d("div"),he(_.$$.fragment),b=S(),w=d("div"),y=d("div"),V=x(k),E=S(),T=d("div"),D=d("button"),L=x(I),B=S(),H=d("div"),F=d("button"),q=x(N),this.h()},l(U){ve(e.$$.fragment,U),l=M(U),a=h(U,"FORM",{class:!0});var W=v(a);r=h(W,"DIV",{class:!0});var X=v(r);o=h(X,"DIV",{});var G=v(o);i=h(G,"DIV",{class:!0});var K=v(i);ve(f.$$.fragment,K),m=M(K),g=h(K,"DIV",{class:!0});var J=v(g);ve(_.$$.fragment,J),J.forEach(u),K.forEach(u),G.forEach(u),b=M(X),w=h(X,"DIV",{class:!0});var Q=v(w);y=h(Q,"DIV",{});var ue=v(y);V=O(ue,k),ue.forEach(u),Q.forEach(u),E=M(X),T=h(X,"DIV",{class:!0});var ke=v(T);D=h(ke,"BUTTON",{type:!0,class:!0});var Ee=v(D);L=O(Ee,I),Ee.forEach(u),ke.forEach(u),X.forEach(u),B=M(W),H=h(W,"DIV",{class:!0});var Me=v(H);F=h(Me,"BUTTON",{class:!0,type:!0});var Oe=v(F);q=O(Oe,N),Oe.forEach(u),Me.forEach(u),W.forEach(u),this.h()},h(){c(g,"class",""),c(i,"class","flex items-center justify-between mb-1"),c(w,"class","text-xs text-gray-600 dark:text-gray-400"),c(D,"type","button"),c(D,"class","px-3.5 py-1.5 font-medium hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-gray-300 dark:outline-gray-800 rounded-3xl"),c(T,"class","mt-3 mb-1 ml-1"),c(r,"class","pr-1.5 py-1 overflow-y-scroll max-h-[25rem]"),c(F,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(F,"type","submit"),c(H,"class","flex justify-end text-sm font-medium"),c(a,"class","flex flex-col h-full justify-between space-y-3 text-sm")},m(U,W){me(e,U,W),j(U,l,W),j(U,a,W),n(a,r),n(r,o),n(o,i),me(f,i,null),n(i,m),n(i,g),me(_,g,null),n(r,b),n(r,w),n(w,y),n(y,V),n(r,E),n(r,T),n(T,D),n(D,L),n(a,B),n(a,H),n(H,F),n(F,q),z=!0,C||(A=[te(D,"click",s[9]),te(a,"submit",zl(s[10]))],C=!0)},p(U,[W]){const X={};!t&&W&2&&(t=!0,X.show=U[1],yt(()=>t=!1)),e.$set(X);const G={};W&8&&(G.content=U[3].t("This is an experimental feature, it may not function as expected and is subject to change at any time.")),W&4104&&(G.$$scope={dirty:W,ctx:U}),f.$set(G);const K={};!p&&W&4&&(p=!0,K.state=U[2],yt(()=>p=!1)),_.$set(K),(!z||W&8)&&k!==(k=U[3].t("You can personalize your interactions with LLMs by adding memories through the 'Manage' button below, making them more helpful and tailored to you.")+"")&&$(V,k),(!z||W&8)&&I!==(I=U[3].t("Manage")+"")&&$(L,I),(!z||W&8)&&N!==(N=U[3].t("Save")+"")&&$(q,N)},i(U){z||(ee(e.$$.fragment,U),ee(f.$$.fragment,U),ee(_.$$.fragment,U),z=!0)},o(U){ae(e.$$.fragment,U),ae(f.$$.fragment,U),ae(_.$$.fragment,U),z=!1},d(U){U&&(u(l),u(a)),_e(e,U),_e(f),_e(_),C=!1,vt(A)}}}function Hc(s,e,t){let l,a;Se(s,bl,y=>t(11,l=y));const r=fl(),o=gt("i18n");Se(s,o,y=>t(3,a=y));let{saveSettings:i}=e,f=!1,m=!1;ul(async()=>{t(2,m=(l==null?void 0:l.memory)??!1)});function g(y){f=y,t(1,f)}function _(y){m=y,t(2,m)}const p=async()=>{i({memory:m})},b=()=>{t(1,f=!0)},w=()=>{r("save")};return s.$$set=y=>{"saveSettings"in y&&t(0,i=y.saveSettings)},[i,f,m,a,r,o,g,_,p,b,w]}class Uc extends ut{constructor(e){super(),ft(this,e,Hc,Oc,ct,{saveSettings:0})}}function Ar(s){let e,t,l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-4"><path fill-rule="evenodd" d="M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z" clip-rule="evenodd"></path></svg>',a,r,o=s[2].t("Admin Settings")+"",i,f,m,g;return{c(){e=d("button"),t=d("div"),t.innerHTML=l,a=S(),r=d("div"),i=x(o),this.h()},l(_){e=h(_,"BUTTON",{class:!0});var p=v(e);t=h(p,"DIV",{class:!0,"data-svelte-h":!0}),Ne(t)!=="svelte-wp87ko"&&(t.innerHTML=l),a=M(p),r=h(p,"DIV",{class:!0});var b=v(r);i=O(b,o),b.forEach(u),p.forEach(u),this.h()},h(){c(t,"class","self-center mr-2"),c(r,"class","self-center"),c(e,"class",f="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="admin"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850"))},m(_,p){j(_,e,p),n(e,t),n(e,a),n(e,r),n(r,i),m||(g=te(e,"click",s[14]),m=!0)},p(_,p){p&4&&o!==(o=_[2].t("Admin Settings")+"")&&$(i,o),p&2&&f!==(f="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(_[1]==="admin"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850"))&&c(e,"class",f)},d(_){_&&u(e),m=!1,g()}}}function Pc(s){let e,t;return e=new mi({}),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function $c(s){let e,t;return e=new fi({props:{saveHandler:s[20]}}),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p(l,a){const r={};a&4&&(r.saveHandler=l[20]),e.$set(r)},i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function jc(s){let e,t;return e=new mc({props:{saveSettings:s[5]}}),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function zc(s){let e,t;return e=new ic({props:{saveSettings:s[5]}}),e.$on("save",s[19]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function Rc(s){let e,t;return e=new Uc({props:{saveSettings:s[5]}}),e.$on("save",s[18]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function Wc(s){let e,t;return e=new Qi({props:{saveSettings:s[5]}}),e.$on("save",s[17]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function Zc(s){let e,t;return e=new Ii({props:{getModels:s[6],saveSettings:s[5]}}),e.$on("save",s[16]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function Fc(s){let e,t,l,a=s[2].t("Settings")+"",r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',m,g,_,p,b,w='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M8.34 1.804A1 1 0 019.32 1h1.36a1 1 0 01.98.804l.295 1.473c.497.144.971.342 1.416.587l1.25-.834a1 1 0 011.262.125l.962.962a1 1 0 01.125 1.262l-.834 1.25c.245.445.443.919.587 1.416l1.473.294a1 1 0 01.804.98v1.361a1 1 0 01-.804.98l-1.473.295a6.95 6.95 0 01-.587 1.416l.834 1.25a1 1 0 01-.125 1.262l-.962.962a1 1 0 01-1.262.125l-1.25-.834a6.953 6.953 0 01-1.416.587l-.294 1.473a1 1 0 01-.98.804H9.32a1 1 0 01-.98-.804l-.295-1.473a6.957 6.957 0 01-1.416-.587l-1.25.834a1 1 0 01-1.262-.125l-.962-.962a1 1 0 01-.125-1.262l.834-1.25a6.957 6.957 0 01-.587-1.416l-1.473-.294A1 1 0 011 10.68V9.32a1 1 0 01.804-.98l1.473-.295c.144-.497.342-.971.587-1.416l-.834-1.25a1 1 0 01.125-1.262l.962-.962A1 1 0 015.38 3.03l1.25.834a6.957 6.957 0 011.416-.587l.294-1.473zM13 10a3 3 0 11-6 0 3 3 0 016 0z" clip-rule="evenodd"></path></svg>',y,k,V=s[2].t("General")+"",E,T,D,I,L,B='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M2 4.25A2.25 2.25 0 0 1 4.25 2h7.5A2.25 2.25 0 0 1 14 4.25v5.5A2.25 2.25 0 0 1 11.75 12h-1.312c.1.128.21.248.328.36a.75.75 0 0 1 .234.545v.345a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1-.75-.75v-.345a.75.75 0 0 1 .234-.545c.118-.111.228-.232.328-.36H4.25A2.25 2.25 0 0 1 2 9.75v-5.5Zm2.25-.75a.75.75 0 0 0-.75.75v4.5c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 0 0-.75-.75h-7.5Z" clip-rule="evenodd"></path></svg>',H,F,N=s[2].t("Interface")+"",q,z,C,A,R,P,Z,Y,U=s[2].t("Personalization")+"",W,X,G,K,J,Q='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path d="M7.557 2.066A.75.75 0 0 1 8 2.75v10.5a.75.75 0 0 1-1.248.56L3.59 11H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.59l3.162-2.81a.75.75 0 0 1 .805-.124ZM12.95 3.05a.75.75 0 1 0-1.06 1.06 5.5 5.5 0 0 1 0 7.78.75.75 0 1 0 1.06 1.06 7 7 0 0 0 0-9.9Z"></path><path d="M10.828 5.172a.75.75 0 1 0-1.06 1.06 2.5 2.5 0 0 1 0 3.536.75.75 0 1 0 1.06 1.06 4 4 0 0 0 0-5.656Z"></path></svg>',ue,ke,Ee=s[2].t("Audio")+"",Me,Oe,je,pe,He,We='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M8 2C4.262 2 1 4.57 1 8c0 1.86.98 3.486 2.455 4.566a3.472 3.472 0 0 1-.469 1.26.75.75 0 0 0 .713 1.14 6.961 6.961 0 0 0 3.06-1.06c.403.062.818.094 1.241.094 3.738 0 7-2.57 7-6s-3.262-6-7-6ZM5 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm7-1a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clip-rule="evenodd"></path></svg>',Be,Qe,se=s[2].t("Chats")+"",de,De,ie,Te,ge,ze='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-5-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 9c-1.825 0-3.422.977-4.295 2.437A5.49 5.49 0 0 0 8 13.5a5.49 5.49 0 0 0 4.294-2.063A4.997 4.997 0 0 0 8 9Z" clip-rule="evenodd"></path></svg>',re,Ve,ce=s[2].t("Account")+"",ye,Je,le,oe,be,Le,et='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg>',$e,Re,qe=s[2].t("About")+"",tt,lt,Ze,st,Ye,Fe,Ae,at,Tt;P=new gc({});let rt=s[3].role==="admin"&&Ar(s);const _t=[Zc,Wc,Rc,zc,jc,$c,Pc],Ue=[];function Ie(fe,we){return fe[1]==="general"?0:fe[1]==="interface"?1:fe[1]==="personalization"?2:fe[1]==="audio"?3:fe[1]==="chats"?4:fe[1]==="account"?5:fe[1]==="about"?6:-1}return~(Ye=Ie(s))&&(Fe=Ue[Ye]=_t[Ye](s)),{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),i.innerHTML=f,m=S(),g=d("div"),_=d("div"),p=d("button"),b=d("div"),b.innerHTML=w,y=S(),k=d("div"),E=x(V),D=S(),I=d("button"),L=d("div"),L.innerHTML=B,H=S(),F=d("div"),q=x(N),C=S(),A=d("button"),R=d("div"),he(P.$$.fragment),Z=S(),Y=d("div"),W=x(U),G=S(),K=d("button"),J=d("div"),J.innerHTML=Q,ue=S(),ke=d("div"),Me=x(Ee),je=S(),pe=d("button"),He=d("div"),He.innerHTML=We,Be=S(),Qe=d("div"),de=x(se),ie=S(),Te=d("button"),ge=d("div"),ge.innerHTML=ze,re=S(),Ve=d("div"),ye=x(ce),le=S(),rt&&rt.c(),oe=S(),be=d("button"),Le=d("div"),Le.innerHTML=et,$e=S(),Re=d("div"),tt=x(qe),Ze=S(),st=d("div"),Fe&&Fe.c(),this.h()},l(fe){e=h(fe,"DIV",{class:!0});var we=v(e);t=h(we,"DIV",{class:!0});var Ke=v(t);l=h(Ke,"DIV",{class:!0});var At=v(l);r=O(At,a),At.forEach(u),o=M(Ke),i=h(Ke,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-745w2y"&&(i.innerHTML=f),Ke.forEach(u),m=M(we),g=h(we,"DIV",{class:!0});var Lt=v(g);_=h(Lt,"DIV",{id:!0,class:!0});var ht=v(_);p=h(ht,"BUTTON",{class:!0});var It=v(p);b=h(It,"DIV",{class:!0,"data-svelte-h":!0}),Ne(b)!=="svelte-qy1dha"&&(b.innerHTML=w),y=M(It),k=h(It,"DIV",{class:!0});var Ut=v(k);E=O(Ut,V),Ut.forEach(u),It.forEach(u),D=M(ht),I=h(ht,"BUTTON",{class:!0});var Bt=v(I);L=h(Bt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(L)!=="svelte-16cea28"&&(L.innerHTML=B),H=M(Bt),F=h(Bt,"DIV",{class:!0});var Ct=v(F);q=O(Ct,N),Ct.forEach(u),Bt.forEach(u),C=M(ht),A=h(ht,"BUTTON",{class:!0});var St=v(A);R=h(St,"DIV",{class:!0});var $t=v(R);ve(P.$$.fragment,$t),$t.forEach(u),Z=M(St),Y=h(St,"DIV",{class:!0});var jt=v(Y);W=O(jt,U),jt.forEach(u),St.forEach(u),G=M(ht),K=h(ht,"BUTTON",{class:!0});var Yt=v(K);J=h(Yt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(J)!=="svelte-36jwmy"&&(J.innerHTML=Q),ue=M(Yt),ke=h(Yt,"DIV",{class:!0});var Mt=v(ke);Me=O(Mt,Ee),Mt.forEach(u),Yt.forEach(u),je=M(ht),pe=h(ht,"BUTTON",{class:!0});var qt=v(pe);He=h(qt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(He)!=="svelte-1gtbwe5"&&(He.innerHTML=We),Be=M(qt),Qe=h(qt,"DIV",{class:!0});var Kt=v(Qe);de=O(Kt,se),Kt.forEach(u),qt.forEach(u),ie=M(ht),Te=h(ht,"BUTTON",{class:!0});var kt=v(Te);ge=h(kt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(ge)!=="svelte-amityv"&&(ge.innerHTML=ze),re=M(kt),Ve=h(kt,"DIV",{class:!0});var zt=v(Ve);ye=O(zt,ce),zt.forEach(u),kt.forEach(u),le=M(ht),rt&&rt.l(ht),oe=M(ht),be=h(ht,"BUTTON",{class:!0});var Pt=v(be);Le=h(Pt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(Le)!=="svelte-15t8s7e"&&(Le.innerHTML=et),$e=M(Pt),Re=h(Pt,"DIV",{class:!0});var Rt=v(Re);tt=O(Rt,qe),Rt.forEach(u),Pt.forEach(u),ht.forEach(u),Ze=M(Lt),st=h(Lt,"DIV",{class:!0});var hl=v(st);Fe&&Fe.l(hl),hl.forEach(u),Lt.forEach(u),we.forEach(u),this.h()},h(){c(l,"class","text-lg font-medium self-center"),c(i,"class","self-center"),c(t,"class","flex justify-between dark:text-gray-300 px-5 pt-4 pb-1"),c(b,"class","self-center mr-2"),c(k,"class","self-center"),c(p,"class",T="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="general"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(L,"class","self-center mr-2"),c(F,"class","self-center"),c(I,"class",z="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="interface"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(R,"class","self-center mr-2"),c(Y,"class","self-center"),c(A,"class",X="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="personalization"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(J,"class","self-center mr-2"),c(ke,"class","self-center"),c(K,"class",Oe="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="audio"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(He,"class","self-center mr-2"),c(Qe,"class","self-center"),c(pe,"class",De="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="chats"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(ge,"class","self-center mr-2"),c(Ve,"class","self-center"),c(Te,"class",Je="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="account"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(Le,"class","self-center mr-2"),c(Re,"class","self-center"),c(be,"class",lt="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(s[1]==="about"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")),c(_,"id","settings-tabs-container"),c(_,"class","tabs flex flex-row overflow-x-auto space-x-1 md:space-x-0 md:space-y-1 md:flex-col flex-1 md:flex-none md:w-40 dark:text-gray-200 text-xs text-left mb-3 md:mb-0 svelte-1vx7r9s"),c(st,"class","flex-1 md:min-h-[28rem]"),c(g,"class","flex flex-col md:flex-row w-full p-4 md:space-x-4"),c(e,"class","text-gray-700 dark:text-gray-100")},m(fe,we){j(fe,e,we),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(e,m),n(e,g),n(g,_),n(_,p),n(p,b),n(p,y),n(p,k),n(k,E),n(_,D),n(_,I),n(I,L),n(I,H),n(I,F),n(F,q),n(_,C),n(_,A),n(A,R),me(P,R,null),n(A,Z),n(A,Y),n(Y,W),n(_,G),n(_,K),n(K,J),n(K,ue),n(K,ke),n(ke,Me),n(_,je),n(_,pe),n(pe,He),n(pe,Be),n(pe,Qe),n(Qe,de),n(_,ie),n(_,Te),n(Te,ge),n(Te,re),n(Te,Ve),n(Ve,ye),n(_,le),rt&&rt.m(_,null),n(_,oe),n(_,be),n(be,Le),n(be,$e),n(be,Re),n(Re,tt),n(g,Ze),n(g,st),~Ye&&Ue[Ye].m(st,null),Ae=!0,at||(Tt=[te(i,"click",s[7]),te(p,"click",s[8]),te(I,"click",s[9]),te(A,"click",s[10]),te(K,"click",s[11]),te(pe,"click",s[12]),te(Te,"click",s[13]),te(be,"click",s[15])],at=!0)},p(fe,we){(!Ae||we&4)&&a!==(a=fe[2].t("Settings")+"")&&$(r,a),(!Ae||we&4)&&V!==(V=fe[2].t("General")+"")&&$(E,V),(!Ae||we&2&&T!==(T="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="general"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(p,"class",T),(!Ae||we&4)&&N!==(N=fe[2].t("Interface")+"")&&$(q,N),(!Ae||we&2&&z!==(z="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="interface"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(I,"class",z),(!Ae||we&4)&&U!==(U=fe[2].t("Personalization")+"")&&$(W,U),(!Ae||we&2&&X!==(X="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="personalization"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(A,"class",X),(!Ae||we&4)&&Ee!==(Ee=fe[2].t("Audio")+"")&&$(Me,Ee),(!Ae||we&2&&Oe!==(Oe="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="audio"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(K,"class",Oe),(!Ae||we&4)&&se!==(se=fe[2].t("Chats")+"")&&$(de,se),(!Ae||we&2&&De!==(De="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="chats"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(pe,"class",De),(!Ae||we&4)&&ce!==(ce=fe[2].t("Account")+"")&&$(ye,ce),(!Ae||we&2&&Je!==(Je="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="account"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(Te,"class",Je),fe[3].role==="admin"?rt?rt.p(fe,we):(rt=Ar(fe),rt.c(),rt.m(_,oe)):rt&&(rt.d(1),rt=null),(!Ae||we&4)&&qe!==(qe=fe[2].t("About")+"")&&$(tt,qe),(!Ae||we&2&<!==(lt="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition "+(fe[1]==="about"?"bg-gray-200 dark:bg-gray-800":" hover:bg-gray-100 dark:hover:bg-gray-850")))&&c(be,"class",lt);let Ke=Ye;Ye=Ie(fe),Ye===Ke?~Ye&&Ue[Ye].p(fe,we):(Fe&&(bt(),ae(Ue[Ke],1,1,()=>{Ue[Ke]=null}),wt()),~Ye?(Fe=Ue[Ye],Fe?Fe.p(fe,we):(Fe=Ue[Ye]=_t[Ye](fe),Fe.c()),ee(Fe,1),Fe.m(st,null)):Fe=null)},i(fe){Ae||(ee(P.$$.fragment,fe),ee(Fe),Ae=!0)},o(fe){ae(P.$$.fragment,fe),ae(Fe),Ae=!1},d(fe){fe&&u(e),_e(P),rt&&rt.d(),~Ye&&Ue[Ye].d(),at=!1,vt(Tt)}}}function Yc(s){let e,t,l;function a(o){s[21](o)}let r={$$slots:{default:[Fc]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.show=s[0]),e=new Rl({props:r}),mt.push(()=>Et(e,"show",a)),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&67108879&&(f.$$scope={dirty:i,ctx:o}),!t&&i&1&&(t=!0,f.show=o[0],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}function qc(s,e,t){let l,a,r;Se(s,bl,C=>t(22,l=C)),Se(s,jl,C=>t(3,r=C));const o=gt("i18n");Se(s,o,C=>t(2,a=C));let{show:i=!1}=e;const f=async C=>{console.log(C),await bl.set({...l,...C}),await qs.set(await m()),await Hn(localStorage.token,{ui:l})},m=async()=>await pn(localStorage.token);let g="general";const _=C=>{const A=document.getElementById("settings-tabs-container");A&&(C.preventDefault(),A.scrollLeft+=C.deltaY)},p=async()=>{await Ds();const C=document.getElementById("settings-tabs-container");C&&C.addEventListener("wheel",_)},b=async()=>{await Ds();const C=document.getElementById("settings-tabs-container");C&&C.removeEventListener("wheel",_)},w=()=>{t(0,i=!1)},y=()=>{t(1,g="general")},k=()=>{t(1,g="interface")},V=()=>{t(1,g="personalization")},E=()=>{t(1,g="audio")},T=()=>{t(1,g="chats")},D=()=>{t(1,g="account")},I=async()=>{await Al("/admin/settings"),t(0,i=!1)},L=()=>{t(1,g="about")},B=()=>{Xe.success(a.t("Settings saved successfully!"))},H=()=>{Xe.success(a.t("Settings saved successfully!"))},F=()=>{Xe.success(a.t("Settings saved successfully!"))},N=()=>{Xe.success(a.t("Settings saved successfully!"))},q=()=>{Xe.success(a.t("Settings saved successfully!"))};function z(C){i=C,t(0,i)}return s.$$set=C=>{"show"in C&&t(0,i=C.show)},s.$$.update=()=>{s.$$.dirty&1&&(i?p():b())},[i,g,a,r,o,f,m,w,y,k,V,E,T,D,I,L,B,H,F,N,q,z]}class Kc extends ut{constructor(e){super(),ft(this,e,qc,Yc,ct,{show:0})}}function Lr(s,e,t){const l=s.slice();return l[17]=e[t],l[19]=t,l}function Gc(s){let e,t=s[3].t("You have no archived conversations.")+"",l;return{c(){e=d("div"),l=x(t),this.h()},l(a){e=h(a,"DIV",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","text-left text-sm w-full mb-8")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r&8&&t!==(t=a[3].t("You have no archived conversations.")+"")&&$(l,t)},i:xe,o:xe,d(a){a&&u(e)}}}function Xc(s){let e,t,l,a,r,o,i,f=s[3].t("Name")+"",m,g,_,p=s[3].t("Created At")+"",b,w,y,k,V,E,T,D,I="Export All Archived Chats",L,B,H,F=nt(s[2].filter(s[10])),N=[];for(let z=0;z<F.length;z+=1)N[z]=Br(Lr(s,F,z));const q=z=>ae(N[z],1,1,()=>{N[z]=null});return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("table"),r=d("thead"),o=d("tr"),i=d("th"),m=x(f),g=S(),_=d("th"),b=x(p),w=S(),y=d("th"),k=S(),V=d("tbody");for(let z=0;z<N.length;z+=1)N[z].c();E=S(),T=d("div"),D=d("button"),D.textContent=I,this.h()},l(z){e=h(z,"DIV",{class:!0});var C=v(e);t=h(C,"DIV",{class:!0});var A=v(t);l=h(A,"DIV",{class:!0});var R=v(l);a=h(R,"TABLE",{class:!0});var P=v(a);r=h(P,"THEAD",{class:!0});var Z=v(r);o=h(Z,"TR",{});var Y=v(o);i=h(Y,"TH",{scope:!0,class:!0});var U=v(i);m=O(U,f),U.forEach(u),g=M(Y),_=h(Y,"TH",{scope:!0,class:!0});var W=v(_);b=O(W,p),W.forEach(u),w=M(Y),y=h(Y,"TH",{scope:!0,class:!0}),v(y).forEach(u),Y.forEach(u),Z.forEach(u),k=M(P),V=h(P,"TBODY",{});var X=v(V);for(let K=0;K<N.length;K+=1)N[K].l(X);X.forEach(u),P.forEach(u),R.forEach(u),A.forEach(u),E=M(C),T=h(C,"DIV",{class:!0});var G=v(T);D=h(G,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(D)!=="svelte-1kobxt8"&&(D.textContent=I),G.forEach(u),C.forEach(u),this.h()},h(){c(i,"scope","col"),c(i,"class","px-3 py-2"),c(_,"scope","col"),c(_,"class","px-3 py-2 hidden md:flex"),c(y,"scope","col"),c(y,"class","px-3 py-2 text-right"),c(r,"class","text-xs text-gray-700 uppercase bg-transparent dark:text-gray-200 border-b-2 dark:border-gray-800"),c(a,"class","w-full text-sm text-left text-gray-600 dark:text-gray-400 table-auto"),c(l,"class","relative overflow-x-auto"),c(t,"class","text-left text-sm w-full mb-3 max-h-[22rem] overflow-y-scroll"),c(D,"class","px-3.5 py-1.5 font-medium hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-gray-300 dark:outline-gray-800 rounded-3xl"),c(T,"class","flex flex-wrap text-sm font-medium gap-1.5 mt-2 m-1"),c(e,"class","w-full")},m(z,C){j(z,e,C),n(e,t),n(t,l),n(l,a),n(a,r),n(r,o),n(o,i),n(i,m),n(o,g),n(o,_),n(_,b),n(o,w),n(o,y),n(a,k),n(a,V);for(let A=0;A<N.length;A+=1)N[A]&&N[A].m(V,null);n(e,E),n(e,T),n(T,D),L=!0,B||(H=te(D,"click",s[13]),B=!0)},p(z,C){if((!L||C&8)&&f!==(f=z[3].t("Name")+"")&&$(m,f),(!L||C&8)&&p!==(p=z[3].t("Created At")+"")&&$(b,p),C&110){F=nt(z[2].filter(z[10]));let A;for(A=0;A<F.length;A+=1){const R=Lr(z,F,A);N[A]?(N[A].p(R,C),ee(N[A],1)):(N[A]=Br(R),N[A].c(),ee(N[A],1),N[A].m(V,null))}for(bt(),A=F.length;A<N.length;A+=1)q(A);wt()}},i(z){if(!L){for(let C=0;C<F.length;C+=1)ee(N[C]);L=!0}},o(z){N=N.filter(Boolean);for(let C=0;C<N.length;C+=1)ae(N[C]);L=!1},d(z){z&&u(e),Ht(N,z),B=!1,H()}}}function Jc(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4"><path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15m0-3-3-3m0 0-3 3m3-3V15"></path></svg>',l,a;function r(){return s[11](s[17])}return{c(){e=d("button"),e.innerHTML=t,this.h()},l(o){e=h(o,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1x4djqv"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl")},m(o,i){j(o,e,i),l||(a=te(e,"click",r),l=!0)},p(o,i){s=o},d(o){o&&u(e),l=!1,a()}}}function Qc(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4"><path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"></path></svg>',l,a;function r(){return s[12](s[17])}return{c(){e=d("button"),e.innerHTML=t,this.h()},l(o){e=h(o,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1pagubv"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl")},m(o,i){j(o,e,i),l||(a=te(e,"click",r),l=!0)},p(o,i){s=o},d(o){o&&u(e),l=!1,a()}}}function Br(s){let e,t,l,a,r=s[17].title+"",o,i,f,m,g,_=Ts(s[17].created_at*1e3).format(s[3].t("MMMM DD, YYYY HH:mm"))+"",p,b,w,y,k,V,E,T,D,I;return k=new Ft({props:{content:"Unarchive Chat",$$slots:{default:[Jc]},$$scope:{ctx:s}}}),E=new Ft({props:{content:"Delete Chat",$$slots:{default:[Qc]},$$scope:{ctx:s}}}),{c(){e=d("tr"),t=d("td"),l=d("a"),a=d("div"),o=x(r),f=S(),m=d("td"),g=d("div"),p=x(_),b=S(),w=d("td"),y=d("div"),he(k.$$.fragment),V=S(),he(E.$$.fragment),T=S(),this.h()},l(L){e=h(L,"TR",{class:!0});var B=v(e);t=h(B,"TD",{class:!0});var H=v(t);l=h(H,"A",{href:!0,target:!0});var F=v(l);a=h(F,"DIV",{class:!0});var N=v(a);o=O(N,r),N.forEach(u),F.forEach(u),H.forEach(u),f=M(B),m=h(B,"TD",{class:!0});var q=v(m);g=h(q,"DIV",{class:!0});var z=v(g);p=O(z,_),z.forEach(u),q.forEach(u),b=M(B),w=h(B,"TD",{class:!0});var C=v(w);y=h(C,"DIV",{class:!0});var A=v(y);ve(k.$$.fragment,A),V=M(A),ve(E.$$.fragment,A),A.forEach(u),C.forEach(u),T=M(B),B.forEach(u),this.h()},h(){c(a,"class","underline line-clamp-1"),c(l,"href",i="/c/"+s[17].id),c(l,"target","_blank"),c(t,"class","px-3 py-1 w-2/3"),c(g,"class","my-auto"),c(m,"class","px-3 py-1 hidden md:flex h-[2.5rem]"),c(y,"class","flex justify-end w-full"),c(w,"class","px-3 py-1 text-right"),c(e,"class",D="bg-transparent "+(s[19]!==s[2].length-1&&"border-b")+" dark:bg-gray-900 dark:border-gray-850 text-xs")},m(L,B){j(L,e,B),n(e,t),n(t,l),n(l,a),n(a,o),n(e,f),n(e,m),n(m,g),n(g,p),n(e,b),n(e,w),n(w,y),me(k,y,null),n(y,V),me(E,y,null),n(e,T),I=!0},p(L,B){(!I||B&6)&&r!==(r=L[17].title+"")&&$(o,r),(!I||B&6&&i!==(i="/c/"+L[17].id))&&c(l,"href",i),(!I||B&14)&&_!==(_=Ts(L[17].created_at*1e3).format(L[3].t("MMMM DD, YYYY HH:mm"))+"")&&$(p,_);const H={};B&1048582&&(H.$$scope={dirty:B,ctx:L}),k.$set(H);const F={};B&1048582&&(F.$$scope={dirty:B,ctx:L}),E.$set(F),(!I||B&4&&D!==(D="bg-transparent "+(L[19]!==L[2].length-1&&"border-b")+" dark:bg-gray-900 dark:border-gray-850 text-xs"))&&c(e,"class",D)},i(L){I||(ee(k.$$.fragment,L),ee(E.$$.fragment,L),I=!0)},o(L){ae(k.$$.fragment,L),ae(E.$$.fragment,L),I=!1},d(L){L&&u(e),_e(k),_e(E)}}}function eu(s){let e,t,l,a=s[3].t("Archived Chats")+"",r,o,i,f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',m,g,_,p,b,w='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd"></path></svg>',y,k,V,E,T,D,I,L,B,H,F,N;const q=[Xc,Gc],z=[];function C(A,R){return A[2].length>0?0:1}return L=C(s),B=z[L]=q[L](s),{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=d("button"),i.innerHTML=f,m=S(),g=d("div"),_=d("div"),p=d("div"),b=d("div"),b.innerHTML=w,y=S(),k=d("input"),E=S(),T=d("hr"),D=S(),I=d("div"),B.c(),this.h()},l(A){e=h(A,"DIV",{});var R=v(e);t=h(R,"DIV",{class:!0});var P=v(t);l=h(P,"DIV",{class:!0});var Z=v(l);r=O(Z,a),Z.forEach(u),o=M(P),i=h(P,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(i)!=="svelte-745w2y"&&(i.innerHTML=f),P.forEach(u),m=M(R),g=h(R,"DIV",{class:!0});var Y=v(g);_=h(Y,"DIV",{class:!0});var U=v(_);p=h(U,"DIV",{class:!0});var W=v(p);b=h(W,"DIV",{class:!0,"data-svelte-h":!0}),Ne(b)!=="svelte-kinl2y"&&(b.innerHTML=w),y=M(W),k=h(W,"INPUT",{class:!0,placeholder:!0}),W.forEach(u),U.forEach(u),E=M(Y),T=h(Y,"HR",{class:!0}),D=M(Y),I=h(Y,"DIV",{class:!0});var X=v(I);B.l(X),X.forEach(u),Y.forEach(u),R.forEach(u),this.h()},h(){c(l,"class","text-lg font-medium self-center"),c(i,"class","self-center"),c(t,"class","flex justify-between dark:text-gray-300 px-5 pt-4 pb-1"),c(b,"class","self-center ml-1 mr-3"),c(k,"class","w-full text-sm pr-4 py-1 rounded-r-xl outline-none bg-transparent"),c(k,"placeholder",V=s[3].t("Search Chats")),c(p,"class","flex flex-1"),c(_,"class","flex w-full mt-2 space-x-2"),c(T,"class","dark:border-gray-850 my-2"),c(I,"class","flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6"),c(g,"class","flex flex-col w-full px-5 pb-4 dark:text-gray-200")},m(A,R){j(A,e,R),n(e,t),n(t,l),n(l,r),n(t,o),n(t,i),n(e,m),n(e,g),n(g,_),n(_,p),n(p,b),n(p,y),n(p,k),Pe(k,s[1]),n(g,E),n(g,T),n(g,D),n(g,I),z[L].m(I,null),H=!0,F||(N=[te(i,"click",s[8]),te(k,"input",s[9])],F=!0)},p(A,R){(!H||R&8)&&a!==(a=A[3].t("Archived Chats")+"")&&$(r,a),(!H||R&8&&V!==(V=A[3].t("Search Chats")))&&c(k,"placeholder",V),R&2&&k.value!==A[1]&&Pe(k,A[1]);let P=L;L=C(A),L===P?z[L].p(A,R):(bt(),ae(z[P],1,1,()=>{z[P]=null}),wt(),B=z[L],B?B.p(A,R):(B=z[L]=q[L](A),B.c()),ee(B,1),B.m(I,null))},i(A){H||(ee(B),H=!0)},o(A){ae(B),H=!1},d(A){A&&u(e),z[L].d(),F=!1,vt(N)}}}function tu(s){let e,t,l;function a(o){s[14](o)}let r={size:"lg",$$slots:{default:[eu]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.show=s[0]),e=new Rl({props:r}),mt.push(()=>Et(e,"show",a)),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&1048591&&(f.$$scope={dirty:i,ctx:o}),!t&&i&1&&(t=!0,f.show=o[0],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}function lu(s,e,t){let l;const{saveAs:a}=Ys,r=fl(),o=gt("i18n");Se(s,o,D=>t(3,l=D));let{show:i=!1}=e,f="",m=[];const g=async D=>{await gn(localStorage.token,D).catch(I=>{Xe.error(I)}),t(2,m=await xs(localStorage.token)),r("change")},_=async D=>{await bn(localStorage.token,D).catch(I=>{Xe.error(I)}),t(2,m=await xs(localStorage.token))},p=async()=>{const D=await Un(localStorage.token);let I=new Blob([JSON.stringify(D)],{type:"application/json"});a(I,`archived-chat-export-${Date.now()}.json`)},b=()=>{t(0,i=!1)};function w(){f=this.value,t(1,f)}const y=D=>f===""||D.title.toLowerCase().includes(f.toLowerCase()),k=async D=>{g(D.id)},V=async D=>{_(D.id)},E=()=>{p()};function T(D){i=D,t(0,i)}return s.$$set=D=>{"show"in D&&t(0,i=D.show)},s.$$.update=()=>{s.$$.dirty&1&&i&&(async()=>t(2,m=await xs(localStorage.token)))()},[i,f,m,l,o,g,_,p,b,w,y,k,V,E,T]}class su extends ut{constructor(e){super(),ft(this,e,lu,tu,ct,{show:0})}}function au(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var a=v(e);t=it(a,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"stroke-linecap","round"),c(t,"stroke-linejoin","round"),c(t,"d","M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"fill","none"),c(e,"viewBox","0 0 24 24"),c(e,"stroke-width",s[1]),c(e,"stroke","currentColor"),c(e,"class",s[0])},m(l,a){j(l,e,a),n(e,t)},p(l,[a]){a&2&&c(e,"stroke-width",l[1]),a&1&&c(e,"class",l[0])},i:xe,o:xe,d(l){l&&u(e)}}}function ru(s,e,t){let{className:l="w-4 h-4"}=e,{strokeWidth:a="1.5"}=e;return s.$$set=r=>{"className"in r&&t(0,l=r.className),"strokeWidth"in r&&t(1,a=r.strokeWidth)},[l,a]}class nu extends ut{constructor(e){super(),ft(this,e,ru,au,ct,{className:0,strokeWidth:1})}}function ou(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var a=v(e);t=it(a,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"stroke-linecap","round"),c(t,"stroke-linejoin","round"),c(t,"d","M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0Z"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"fill","none"),c(e,"viewBox","0 0 24 24"),c(e,"stroke-width",s[1]),c(e,"stroke","currentColor"),c(e,"class",s[0])},m(l,a){j(l,e,a),n(e,t)},p(l,[a]){a&2&&c(e,"stroke-width",l[1]),a&1&&c(e,"class",l[0])},i:xe,o:xe,d(l){l&&u(e)}}}function iu(s,e,t){let{className:l="w-4 h-4"}=e,{strokeWidth:a="1.5"}=e;return s.$$set=r=>{"className"in r&&t(0,l=r.className),"strokeWidth"in r&&t(1,a=r.strokeWidth)},[l,a]}class cu extends ut{constructor(e){super(),ft(this,e,iu,ou,ct,{className:0,strokeWidth:1})}}function uu(s){let e,t;return{c(){e=ot("svg"),t=ot("path"),this.h()},l(l){e=it(l,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var a=v(e);t=it(a,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),v(t).forEach(u),a.forEach(u),this.h()},h(){c(t,"stroke-linecap","round"),c(t,"stroke-linejoin","round"),c(t,"d","m3 3 1.664 1.664M21 21l-1.5-1.5m-5.485-1.242L12 17.25 4.5 21V8.742m.164-4.078a2.15 2.15 0 0 1 1.743-1.342 48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185V19.5M4.664 4.664 19.5 19.5"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"fill","none"),c(e,"viewBox","0 0 24 24"),c(e,"stroke-width",s[1]),c(e,"stroke","currentColor"),c(e,"class",s[0])},m(l,a){j(l,e,a),n(e,t)},p(l,[a]){a&2&&c(e,"stroke-width",l[1]),a&1&&c(e,"class",l[0])},i:xe,o:xe,d(l){l&&u(e)}}}function fu(s,e,t){let{className:l="w-4 h-4"}=e,{strokeWidth:a="1.5"}=e;return s.$$set=r=>{"className"in r&&t(0,l=r.className),"strokeWidth"in r&&t(1,a=r.strokeWidth)},[l,a]}class du extends ut{constructor(e){super(),ft(this,e,fu,uu,ct,{className:0,strokeWidth:1})}}function hu(s){let e;const t=s[12].default,l=dn(t,s,s[22],null);return{c(){l&&l.c()},l(a){l&&l.l(a)},m(a,r){l&&l.m(a,r),e=!0},p(a,r){l&&l.p&&(!e||r&4194304)&&hn(l,t,a,a[22],e?mn(t,a[22],r,null):vn(a[22]),null)},i(a){e||(ee(l,a),e=!0)},o(a){ae(l,a),e=!1},d(a){l&&l.d(a)}}}function vu(s){let e,t;return e=new Ft({props:{content:s[9].t("More"),$$slots:{default:[hu]},$$scope:{ctx:s}}}),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p(l,a){const r={};a&512&&(r.content=l[9].t("More")),a&4194304&&(r.$$scope={dirty:a,ctx:l}),e.$set(r)},i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function mu(s){let e,t,l,a=s[9].t("Pin")+"",r,o;return e=new cu({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Pin")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function _u(s){let e,t,l,a=s[9].t("Unpin")+"",r,o;return e=new du({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Unpin")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function pu(s){let e,t,l,a;const r=[_u,mu],o=[];function i(f,m){return f[8]?0:1}return e=i(s),t=o[e]=r[e](s),{c(){t.c(),l=$l()},l(f){t.l(f),l=$l()},m(f,m){o[e].m(f,m),j(f,l,m),a=!0},p(f,m){let g=e;e=i(f),e===g?o[e].p(f,m):(bt(),ae(o[g],1,1,()=>{o[g]=null}),wt(),t=o[e],t?t.p(f,m):(t=o[e]=r[e](f),t.c()),ee(t,1),t.m(l.parentNode,l))},i(f){a||(ee(t),a=!0)},o(f){ae(t),a=!1},d(f){f&&u(l),o[e].d(f)}}}function gu(s){let e,t,l,a=s[9].t("Rename")+"",r,o;return e=new nu({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Rename")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function bu(s){let e,t,l,a=s[9].t("Clone")+"",r,o;return e=new Ao({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Clone")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function wu(s){let e,t,l,a=s[9].t("Archive")+"",r,o;return e=new Dn({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Archive")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function ku(s){let e,t,l,a=s[9].t("Share")+"",r,o;return e=new Lo({}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Share")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function yu(s){let e,t,l,a=s[9].t("Delete")+"",r,o;return e=new Tn({props:{strokeWidth:"2"}}),{c(){he(e.$$.fragment),t=S(),l=d("div"),r=x(a),this.h()},l(i){ve(e.$$.fragment,i),t=M(i),l=h(i,"DIV",{class:!0});var f=v(l);r=O(f,a),f.forEach(u),this.h()},h(){c(l,"class","flex items-center")},m(i,f){me(e,i,f),j(i,t,f),j(i,l,f),n(l,r),o=!0},p(i,f){(!o||f&512)&&a!==(a=i[9].t("Delete")+"")&&$(r,a)},i(i){o||(ee(e.$$.fragment,i),o=!0)},o(i){ae(e.$$.fragment,i),o=!1},d(i){i&&(u(t),u(l)),_e(e,i)}}}function Eu(s){let e,t,l,a,r,o,i,f,m,g,_,p,b,w,y,k,V;return e=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[pu]},$$scope:{ctx:s}}}),e.$on("click",s[13]),l=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[gu]},$$scope:{ctx:s}}}),l.$on("click",s[14]),r=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[bu]},$$scope:{ctx:s}}}),r.$on("click",s[15]),i=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[wu]},$$scope:{ctx:s}}}),i.$on("click",s[16]),m=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[ku]},$$scope:{ctx:s}}}),m.$on("click",s[17]),_=new Ul({props:{class:"flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md",$$slots:{default:[yu]},$$scope:{ctx:s}}}),_.$on("click",s[18]),k=new Io({props:{chatId:s[6]}}),k.$on("close",s[19]),{c(){he(e.$$.fragment),t=S(),he(l.$$.fragment),a=S(),he(r.$$.fragment),o=S(),he(i.$$.fragment),f=S(),he(m.$$.fragment),g=S(),he(_.$$.fragment),p=S(),b=d("hr"),w=S(),y=d("div"),he(k.$$.fragment),this.h()},l(E){ve(e.$$.fragment,E),t=M(E),ve(l.$$.fragment,E),a=M(E),ve(r.$$.fragment,E),o=M(E),ve(i.$$.fragment,E),f=M(E),ve(m.$$.fragment,E),g=M(E),ve(_.$$.fragment,E),p=M(E),b=h(E,"HR",{class:!0}),w=M(E),y=h(E,"DIV",{class:!0});var T=v(y);ve(k.$$.fragment,T),T.forEach(u),this.h()},h(){c(b,"class","border-gray-100 dark:border-gray-800 mt-2.5 mb-1.5"),c(y,"class","flex p-1")},m(E,T){me(e,E,T),j(E,t,T),me(l,E,T),j(E,a,T),me(r,E,T),j(E,o,T),me(i,E,T),j(E,f,T),me(m,E,T),j(E,g,T),me(_,E,T),j(E,p,T),j(E,b,T),j(E,w,T),j(E,y,T),me(k,y,null),V=!0},p(E,T){const D={};T&4195072&&(D.$$scope={dirty:T,ctx:E}),e.$set(D);const I={};T&4194816&&(I.$$scope={dirty:T,ctx:E}),l.$set(I);const L={};T&4194816&&(L.$$scope={dirty:T,ctx:E}),r.$set(L);const B={};T&4194816&&(B.$$scope={dirty:T,ctx:E}),i.$set(B);const H={};T&4194816&&(H.$$scope={dirty:T,ctx:E}),m.$set(H);const F={};T&4194816&&(F.$$scope={dirty:T,ctx:E}),_.$set(F);const N={};T&64&&(N.chatId=E[6]),k.$set(N)},i(E){V||(ee(e.$$.fragment,E),ee(l.$$.fragment,E),ee(r.$$.fragment,E),ee(i.$$.fragment,E),ee(m.$$.fragment,E),ee(_.$$.fragment,E),ee(k.$$.fragment,E),V=!0)},o(E){ae(e.$$.fragment,E),ae(l.$$.fragment,E),ae(r.$$.fragment,E),ae(i.$$.fragment,E),ae(m.$$.fragment,E),ae(_.$$.fragment,E),ae(k.$$.fragment,E),V=!1},d(E){E&&(u(t),u(a),u(o),u(f),u(g),u(p),u(b),u(w),u(y)),_e(e,E),_e(l,E),_e(r,E),_e(i,E),_e(m,E),_e(_,E),_e(k)}}}function Iu(s){let e,t,l;return t=new So({props:{class:"w-full max-w-[180px] rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow",sideOffset:-2,side:"bottom",align:"start",transition:Mo,$$slots:{default:[Eu]},$$scope:{ctx:s}}}),{c(){e=d("div"),he(t.$$.fragment),this.h()},l(a){e=h(a,"DIV",{slot:!0});var r=v(e);ve(t.$$.fragment,r),r.forEach(u),this.h()},h(){c(e,"slot","content")},m(a,r){j(a,e,r),me(t,e,null),l=!0},p(a,r){const o={};r&4195327&&(o.$$scope={dirty:r,ctx:a}),t.$set(o)},i(a){l||(ee(t.$$.fragment,a),l=!0)},o(a){ae(t.$$.fragment,a),l=!1},d(a){a&&u(e),_e(t)}}}function Du(s){let e,t,l;function a(o){s[20](o)}let r={$$slots:{content:[Iu],default:[vu]},$$scope:{ctx:s}};return s[7]!==void 0&&(r.show=s[7]),e=new Co({props:r}),mt.push(()=>Et(e,"show",a)),e.$on("change",s[21]),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&4195327&&(f.$$scope={dirty:i,ctx:o}),!t&&i&128&&(t=!0,f.show=o[7],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}function Tu(s,e,t){let l,{$$slots:a={},$$scope:r}=e;const o=fl(),i=gt("i18n");Se(s,i,z=>t(9,l=z));let{shareHandler:f}=e,{cloneChatHandler:m}=e,{archiveChatHandler:g}=e,{renameHandler:_}=e,{deleteHandler:p}=e,{onClose:b}=e,{chatId:w=""}=e,y=!1,k=!1;const V=async()=>{k?await jn(localStorage.token,w,"pinned"):await Pn(localStorage.token,w,"pinned"),o("change")},E=async()=>{t(8,k=(await $n(localStorage.token,w).catch(async z=>[])).find(z=>z.name==="pinned"))},T=()=>{V()},D=()=>{_()},I=()=>{m()},L=()=>{g()},B=()=>{f()},H=()=>{p()},F=()=>{t(7,y=!1),b()};function N(z){y=z,t(7,y)}const q=z=>{z.detail===!1&&b()};return s.$$set=z=>{"shareHandler"in z&&t(0,f=z.shareHandler),"cloneChatHandler"in z&&t(1,m=z.cloneChatHandler),"archiveChatHandler"in z&&t(2,g=z.archiveChatHandler),"renameHandler"in z&&t(3,_=z.renameHandler),"deleteHandler"in z&&t(4,p=z.deleteHandler),"onClose"in z&&t(5,b=z.onClose),"chatId"in z&&t(6,w=z.chatId),"$$scope"in z&&t(22,r=z.$$scope)},s.$$.update=()=>{s.$$.dirty&128&&y&&E()},[f,m,g,_,p,b,w,y,k,l,i,V,a,T,D,I,L,B,H,F,N,q,r]}class Vu extends ut{constructor(e){super(),ft(this,e,Tu,Du,ct,{shareHandler:0,cloneChatHandler:1,archiveChatHandler:2,renameHandler:3,deleteHandler:4,onClose:5,chatId:6})}}function Cu(s){let e,t,l,a=s[0].title+"",r,o,i,f,m;return{c(){e=d("a"),t=d("div"),l=d("div"),r=x(a),this.h()},l(g){e=h(g,"A",{class:!0,href:!0,draggable:!0});var _=v(e);t=h(_,"DIV",{class:!0});var p=v(t);l=h(p,"DIV",{class:!0});var b=v(l);r=O(b,a),b.forEach(u),p.forEach(u),_.forEach(u),this.h()},h(){c(l,"class","text-left self-center overflow-hidden w-full h-[20px]"),c(t,"class","flex self-center flex-1 w-full"),c(e,"class",o="w-full flex justify-between rounded-xl px-3 py-2 "+(s[0].id===s[7]||s[5]?"bg-gray-200 dark:bg-gray-900":s[1]?"bg-gray-100 dark:bg-gray-950":" group-hover:bg-gray-100 dark:group-hover:bg-gray-950")+" whitespace-nowrap text-ellipsis"),c(e,"href",i="/c/"+s[0].id),c(e,"draggable","false")},m(g,_){j(g,e,_),n(e,t),n(t,l),n(l,r),f||(m=[te(e,"click",s[18]),te(e,"dblclick",s[19]),te(e,"mouseenter",s[20]),te(e,"mouseleave",s[21]),te(e,"focus",Pu)],f=!0)},p(g,_){_[0]&1&&a!==(a=g[0].title+"")&&$(r,a),_[0]&163&&o!==(o="w-full flex justify-between rounded-xl px-3 py-2 "+(g[0].id===g[7]||g[5]?"bg-gray-200 dark:bg-gray-900":g[1]?"bg-gray-100 dark:bg-gray-950":" group-hover:bg-gray-100 dark:group-hover:bg-gray-950")+" whitespace-nowrap text-ellipsis")&&c(e,"class",o),_[0]&1&&i!==(i="/c/"+g[0].id)&&c(e,"href",i)},d(g){g&&u(e),f=!1,vt(m)}}}function Su(s){let e,t,l,a,r;return{c(){e=d("div"),t=d("input"),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=v(e);t=h(i,"INPUT",{class:!0}),i.forEach(u),this.h()},h(){c(t,"class","bg-transparent w-full outline-none mr-10"),c(e,"class",l="w-full flex justify-between rounded-xl px-3 py-2 "+(s[0].id===s[7]||s[5]?"bg-gray-200 dark:bg-gray-900":s[1]?"bg-gray-100 dark:bg-gray-950":"group-hover:bg-gray-100 dark:group-hover:bg-gray-950")+" whitespace-nowrap text-ellipsis")},m(o,i){j(o,e,i),n(e,t),Pe(t,s[6]),a||(r=[Mn(s[15].call(null,t)),te(t,"input",s[17])],a=!0)},p(o,i){i[0]&64&&t.value!==o[6]&&Pe(t,o[6]),i[0]&163&&l!==(l="w-full flex justify-between rounded-xl px-3 py-2 "+(o[0].id===o[7]||o[5]?"bg-gray-200 dark:bg-gray-900":o[1]?"bg-gray-100 dark:bg-gray-950":"group-hover:bg-gray-100 dark:group-hover:bg-gray-950")+" whitespace-nowrap text-ellipsis")&&c(e,"class",l)},d(o){o&&u(e),a=!1,vt(r)}}}function Mu(s){let e,t,l,a;t=new Vu({props:{chatId:s[0].id,cloneChatHandler:s[27],shareHandler:s[28],archiveChatHandler:s[29],renameHandler:s[30],deleteHandler:s[31],onClose:s[32],$$slots:{default:[Bu]},$$scope:{ctx:s}}}),t.$on("change",s[33]);let r=s[0].id===s[7]&&Nr(s);return{c(){e=d("div"),he(t.$$.fragment),l=S(),r&&r.c(),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=v(e);ve(t.$$.fragment,i),l=M(i),r&&r.l(i),i.forEach(u),this.h()},h(){c(e,"class","flex self-center space-x-1 z-10")},m(o,i){j(o,e,i),me(t,e,null),n(e,l),r&&r.m(e,null),a=!0},p(o,i){const f={};i[0]&1&&(f.chatId=o[0].id),i[0]&1&&(f.cloneChatHandler=o[27]),i[0]&16&&(f.shareHandler=o[28]),i[0]&1&&(f.archiveChatHandler=o[29]),i[0]&97&&(f.renameHandler=o[30]),i[1]&128&&(f.$$scope={dirty:i,ctx:o}),t.$set(f),o[0].id===o[7]?r?r.p(o,i):(r=Nr(o),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i(o){a||(ee(t.$$.fragment,o),a=!0)},o(o){ae(t.$$.fragment,o),a=!1},d(o){o&&u(e),_e(t),r&&r.d()}}}function Au(s){let e,t,l,a,r;return t=new Ft({props:{content:s[8].t("Archive"),className:"flex items-center",$$slots:{default:[Nu]},$$scope:{ctx:s}}}),a=new Ft({props:{content:s[8].t("Delete"),$$slots:{default:[xu]},$$scope:{ctx:s}}}),{c(){e=d("div"),he(t.$$.fragment),l=S(),he(a.$$.fragment),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=v(e);ve(t.$$.fragment,i),l=M(i),ve(a.$$.fragment,i),i.forEach(u),this.h()},h(){c(e,"class","flex items-center self-center space-x-1.5")},m(o,i){j(o,e,i),me(t,e,null),n(e,l),me(a,e,null),r=!0},p(o,i){const f={};i[0]&256&&(f.content=o[8].t("Archive")),i[0]&1|i[1]&128&&(f.$$scope={dirty:i,ctx:o}),t.$set(f);const m={};i[0]&256&&(m.content=o[8].t("Delete")),i[1]&128&&(m.$$scope={dirty:i,ctx:o}),a.$set(m)},i(o){r||(ee(t.$$.fragment,o),ee(a.$$.fragment,o),r=!0)},o(o){ae(t.$$.fragment,o),ae(a.$$.fragment,o),r=!1},d(o){o&&u(e),_e(t),_e(a)}}}function Lu(s){let e,t,l,a,r;return t=new Ft({props:{content:s[8].t("Confirm"),$$slots:{default:[Ou]},$$scope:{ctx:s}}}),a=new Ft({props:{content:s[8].t("Cancel"),$$slots:{default:[Hu]},$$scope:{ctx:s}}}),{c(){e=d("div"),he(t.$$.fragment),l=S(),he(a.$$.fragment),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=v(e);ve(t.$$.fragment,i),l=M(i),ve(a.$$.fragment,i),i.forEach(u),this.h()},h(){c(e,"class","flex self-center space-x-1.5 z-10")},m(o,i){j(o,e,i),me(t,e,null),n(e,l),me(a,e,null),r=!0},p(o,i){const f={};i[0]&256&&(f.content=o[8].t("Confirm")),i[0]&97|i[1]&128&&(f.$$scope={dirty:i,ctx:o}),t.$set(f);const m={};i[0]&256&&(m.content=o[8].t("Cancel")),i[0]&96|i[1]&128&&(m.$$scope={dirty:i,ctx:o}),a.$set(m)},i(o){r||(ee(t.$$.fragment,o),ee(a.$$.fragment,o),r=!0)},o(o){ae(t.$$.fragment,o),ae(a.$$.fragment,o),r=!1},d(o){o&&u(e),_e(t),_e(a)}}}function Bu(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"></path></svg>',l,a;return{c(){e=d("button"),e.innerHTML=t,this.h()},l(r){e=h(r,"BUTTON",{"aria-label":!0,class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-1nmly1h"&&(e.innerHTML=t),this.h()},h(){c(e,"aria-label","Chat Menu"),c(e,"class","self-center dark:hover:text-white transition")},m(r,o){j(r,e,o),l||(a=te(e,"click",s[26]),l=!0)},p:xe,d(r){r&&u(e),l=!1,a()}}}function Nr(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"></path></svg>',l,a;return{c(){e=d("button"),e.innerHTML=t,this.h()},l(r){e=h(r,"BUTTON",{id:!0,class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-17232xf"&&(e.innerHTML=t),this.h()},h(){c(e,"id","delete-chat-button"),c(e,"class","hidden")},m(r,o){j(r,e,o),l||(a=te(e,"click",s[34]),l=!0)},p:xe,d(r){r&&u(e),l=!1,a()}}}function Nu(s){let e,t,l,a,r;return t=new Dn({props:{className:"size-4 translate-y-[0.5px]",strokeWidth:"2"}}),{c(){e=d("button"),he(t.$$.fragment),this.h()},l(o){e=h(o,"BUTTON",{class:!0,type:!0});var i=v(e);ve(t.$$.fragment,i),i.forEach(u),this.h()},h(){c(e,"class","self-center dark:hover:text-white transition"),c(e,"type","button")},m(o,i){j(o,e,i),me(t,e,null),l=!0,a||(r=te(e,"click",s[24]),a=!0)},p:xe,i(o){l||(ee(t.$$.fragment,o),l=!0)},o(o){ae(t.$$.fragment,o),l=!1},d(o){o&&u(e),_e(t),a=!1,r()}}}function xu(s){let e,t,l,a,r;return t=new Tn({props:{strokeWidth:"2"}}),{c(){e=d("button"),he(t.$$.fragment),this.h()},l(o){e=h(o,"BUTTON",{class:!0,type:!0});var i=v(e);ve(t.$$.fragment,i),i.forEach(u),this.h()},h(){c(e,"class","self-center dark:hover:text-white transition"),c(e,"type","button")},m(o,i){j(o,e,i),me(t,e,null),l=!0,a||(r=te(e,"click",s[25]),a=!0)},p:xe,i(o){l||(ee(t.$$.fragment,o),l=!0)},o(o){ae(t.$$.fragment,o),l=!1},d(o){o&&u(e),_e(t),a=!1,r()}}}function Ou(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd"></path></svg>',l,a;return{c(){e=d("button"),e.innerHTML=t,this.h()},l(r){e=h(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-15k98vn"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center dark:hover:text-white transition")},m(r,o){j(r,e,o),l||(a=te(e,"click",s[22]),l=!0)},p:xe,d(r){r&&u(e),l=!1,a()}}}function Hu(s){let e,t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',l,a;return{c(){e=d("button"),e.innerHTML=t,this.h()},l(r){e=h(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(e)!=="svelte-19qct0m"&&(e.innerHTML=t),this.h()},h(){c(e,"class","self-center dark:hover:text-white transition")},m(r,o){j(r,e,o),l||(a=te(e,"click",s[23]),l=!0)},p:xe,d(r){r&&u(e),l=!1,a()}}}function Uu(s){let e,t,l,a,r,o,i,f,m,g,_,p;function b(I){s[16](I)}let w={chatId:s[0].id};s[4]!==void 0&&(w.show=s[4]),e=new Do({props:w}),mt.push(()=>Et(e,"show",b));function y(I,L){return I[5]?Su:Cu}let k=y(s),V=k(s);const E=[Lu,Au,Mu],T=[];function D(I,L){return I[5]?0:I[2]&&I[3]?1:2}return i=D(s),f=T[i]=E[i](s),{c(){he(e.$$.fragment),l=S(),a=d("div"),V.c(),r=S(),o=d("div"),f.c(),this.h()},l(I){ve(e.$$.fragment,I),l=M(I),a=h(I,"DIV",{class:!0});var L=v(a);V.l(L),r=M(L),o=h(L,"DIV",{class:!0});var B=v(o);f.l(B),B.forEach(u),L.forEach(u),this.h()},h(){c(o,"class",m=(s[0].id===s[7]||s[5]?"from-gray-200 dark:from-gray-900":s[1]?"from-gray-100 dark:from-gray-950":"invisible group-hover:visible from-gray-100 dark:from-gray-950")+" absolute right-[10px] top-[6px] py-1 pr-2 pl-5 bg-gradient-to-l from-80% to-transparent"),c(a,"class","w-full pr-2 relative group")},m(I,L){me(e,I,L),j(I,l,L),j(I,a,L),V.m(a,null),n(a,r),n(a,o),T[i].m(o,null),g=!0,_||(p=[te(o,"mouseenter",s[35]),te(o,"mouseleave",s[36])],_=!0)},p(I,L){const B={};L[0]&1&&(B.chatId=I[0].id),!t&&L[0]&16&&(t=!0,B.show=I[4],yt(()=>t=!1)),e.$set(B),k===(k=y(I))&&V?V.p(I,L):(V.d(1),V=k(I),V&&(V.c(),V.m(a,r)));let H=i;i=D(I),i===H?T[i].p(I,L):(bt(),ae(T[H],1,1,()=>{T[H]=null}),wt(),f=T[i],f?f.p(I,L):(f=T[i]=E[i](I),f.c()),ee(f,1),f.m(o,null)),(!g||L[0]&163&&m!==(m=(I[0].id===I[7]||I[5]?"from-gray-200 dark:from-gray-900":I[1]?"from-gray-100 dark:from-gray-950":"invisible group-hover:visible from-gray-100 dark:from-gray-950")+" absolute right-[10px] top-[6px] py-1 pr-2 pl-5 bg-gradient-to-l from-80% to-transparent"))&&c(o,"class",m)},i(I){g||(ee(e.$$.fragment,I),ee(f),g=!0)},o(I){ae(e.$$.fragment,I),ae(f),g=!1},d(I){I&&(u(l),u(a)),_e(e,I),V.d(),T[i].d(),_=!1,vt(p)}}}const Pu=s=>{};function $u(s,e,t){let l,a,r,o;Se(s,Zt,Q=>t(37,l=Q)),Se(s,Es,Q=>t(7,a=Q)),Se(s,zs,Q=>t(9,o=Q));const i=gt("i18n");Se(s,i,Q=>t(8,r=Q));const f=fl();let{chat:m}=e,{selected:g=!1}=e,{shiftKey:_=!1}=e,p=!1,b=!1,w=!1,y=m.title;const k=async(Q,ue)=>{ue===""?Xe.error(r.t("Title cannot be an empty string.")):(await zn(localStorage.token,Q,{title:ue}),Q===a&&Jn.set(ue),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),await Sl.set(await Vl(localStorage.token,"pinned")))},V=async Q=>{const ue=await Rn(localStorage.token,Q).catch(ke=>(Xe.error(ke),null));ue&&(Al(`/c/${ue.id}`),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),await Sl.set(await Vl(localStorage.token,"pinned")))},E=async Q=>{await gn(localStorage.token,Q),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),await Sl.set(await Vl(localStorage.token,"pinned"))},T=async Q=>{Q.focus()};function D(Q){b=Q,t(4,b)}function I(){y=this.value,t(6,y)}const L=()=>{f("select"),o&&il.set(!1)},B=()=>{t(6,y=m.title),t(5,w=!0)},H=Q=>{t(3,p=!0)},F=Q=>{t(3,p=!1)},N=()=>{k(m.id,y),t(5,w=!1),t(6,y="")},q=()=>{t(5,w=!1),t(6,y="")},z=()=>{E(m.id)},C=()=>{f("delete","shift")},A=()=>{f("select")},R=()=>{V(m.id)},P=()=>{t(4,b=!0)},Z=()=>{E(m.id)},Y=()=>{t(6,y=m.title),t(5,w=!0)},U=()=>{f("delete")},W=()=>{f("unselect")},X=async()=>{await Sl.set(await Vl(localStorage.token,"pinned"))},G=()=>{f("delete")},K=Q=>{t(3,p=!0)},J=Q=>{t(3,p=!1)};return s.$$set=Q=>{"chat"in Q&&t(0,m=Q.chat),"selected"in Q&&t(1,g=Q.selected),"shiftKey"in Q&&t(2,_=Q.shiftKey)},[m,g,_,p,b,w,y,a,r,o,i,f,k,V,E,T,D,I,L,B,H,F,N,q,z,C,A,R,P,Z,Y,U,W,X,G,K,J]}class Sn extends ut{constructor(e){super(),ft(this,e,$u,Uu,ct,{chat:0,selected:1,shiftKey:2},null,[-1,-1])}}function xr(s,e,t){const l=s.slice();return l[52]=e[t],l[54]=t,l}function Or(s,e,t){const l=s.slice();return l[52]=e[t],l[54]=t,l}function Hr(s,e,t){const l=s.slice();return l[56]=e[t],l}function ju(s){let e,t=s[14].t("This will delete")+"",l,a,r,o=s[5].title+"",i,f;return{c(){e=d("div"),l=x(t),a=S(),r=d("span"),i=x(o),f=x("."),this.h()},l(m){e=h(m,"DIV",{class:!0});var g=v(e);l=O(g,t),a=M(g),r=h(g,"SPAN",{class:!0});var _=v(r);i=O(_,o),_.forEach(u),f=O(g,"."),g.forEach(u),this.h()},h(){c(r,"class","font-semibold"),c(e,"class","text-sm text-gray-500 flex-1 line-clamp-3")},m(m,g){j(m,e,g),n(e,l),n(e,a),n(e,r),n(r,i),n(e,f)},p(m,g){g[0]&16384&&t!==(t=m[14].t("This will delete")+"")&&$(l,t),g[0]&32&&o!==(o=m[5].title+"")&&$(i,o)},d(m){m&&u(e)}}}function Ur(s){let e,t,l;return{c(){e=d("div"),this.h()},l(a){e=h(a,"DIV",{class:!0}),v(e).forEach(u),this.h()},h(){c(e,"class","fixed md:hidden z-40 top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center overflow-hidden overscroll-contain")},m(a,r){j(a,e,r),t||(l=te(e,"mousedown",s[30]),t=!0)},p:xe,d(a){a&&u(e),t=!1,l()}}}function Pr(s){let e,t,l,a='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-[1.1rem]"><path stroke-linecap="round" stroke-linejoin="round" d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"></path></svg>',r,o,i,f=s[14].t("Workspace")+"",m,g,_;return{c(){e=d("div"),t=d("a"),l=d("div"),l.innerHTML=a,r=S(),o=d("div"),i=d("div"),m=x(f),this.h()},l(p){e=h(p,"DIV",{class:!0});var b=v(e);t=h(b,"A",{class:!0,href:!0,draggable:!0});var w=v(t);l=h(w,"DIV",{class:!0,"data-svelte-h":!0}),Ne(l)!=="svelte-zod9jr"&&(l.innerHTML=a),r=M(w),o=h(w,"DIV",{class:!0});var y=v(o);i=h(y,"DIV",{class:!0});var k=v(i);m=O(k,f),k.forEach(u),y.forEach(u),w.forEach(u),b.forEach(u),this.h()},h(){c(l,"class","self-center"),c(i,"class","self-center font-medium text-sm font-primary"),c(o,"class","flex self-center"),c(t,"class","flex-grow flex space-x-3 rounded-xl px-2.5 py-2 hover:bg-gray-100 dark:hover:bg-gray-900 transition"),c(t,"href","/workspace"),c(t,"draggable","false"),c(e,"class","px-2.5 flex justify-center text-gray-800 dark:text-gray-200")},m(p,b){j(p,e,b),n(e,t),n(t,l),n(t,r),n(t,o),n(o,i),n(i,m),g||(_=te(t,"click",s[33]),g=!0)},p(p,b){b[0]&16384&&f!==(f=p[14].t("Workspace")+"")&&$(m,f)},d(p){p&&u(e),g=!1,_()}}}function $r(s){let e;return{c(){e=d("div"),this.h()},l(t){e=h(t,"DIV",{class:!0}),v(e).forEach(u),this.h()},h(){c(e,"class","absolute z-40 w-full h-full flex justify-center")},m(t,l){j(t,e,l)},d(t){t&&u(e)}}}function jr(s){let e,t,l=s[14].t("all")+"",a,r,o,i,f,m=nt(s[18].filter(Gr)),g=[];for(let _=0;_<m.length;_+=1)g[_]=zr(Hr(s,m,_));return{c(){e=d("div"),t=d("button"),a=x(l),o=S();for(let _=0;_<g.length;_+=1)g[_].c();this.h()},l(_){e=h(_,"DIV",{class:!0});var p=v(e);t=h(p,"BUTTON",{class:!0});var b=v(t);a=O(b,l),b.forEach(u),o=M(p);for(let w=0;w<g.length;w+=1)g[w].l(p);p.forEach(u),this.h()},h(){c(t,"class",r="px-2.5 py-[1px] text-xs transition "+(s[8]===null?"bg-gray-100 dark:bg-gray-900":" ")+" rounded-md font-medium"),c(e,"class","px-3.5 mb-1 flex gap-0.5 flex-wrap")},m(_,p){j(_,e,p),n(e,t),n(t,a),n(e,o);for(let b=0;b<g.length;b+=1)g[b]&&g[b].m(e,null);i||(f=te(t,"click",s[36]),i=!0)},p(_,p){if(p[0]&16384&&l!==(l=_[14].t("all")+"")&&$(a,l),p[0]&256&&r!==(r="px-2.5 py-[1px] text-xs transition "+(_[8]===null?"bg-gray-100 dark:bg-gray-900":" ")+" rounded-md font-medium")&&c(t,"class",r),p[0]&4457728){m=nt(_[18].filter(Gr));let b;for(b=0;b<m.length;b+=1){const w=Hr(_,m,b);g[b]?g[b].p(w,p):(g[b]=zr(w),g[b].c(),g[b].m(e,null))}for(;b<g.length;b+=1)g[b].d(1);g.length=m.length}},d(_){_&&u(e),Ht(g,_),i=!1,f()}}}function zr(s){let e,t=s[56].name+"",l,a,r,o,i;function f(){return s[37](s[56])}return{c(){e=d("button"),l=x(t),a=S(),this.h()},l(m){e=h(m,"BUTTON",{class:!0});var g=v(e);l=O(g,t),a=M(g),g.forEach(u),this.h()},h(){c(e,"class",r="px-2.5 py-[1px] text-xs transition "+(s[8]===s[56].name?"bg-gray-100 dark:bg-gray-900":"")+" rounded-md font-medium")},m(m,g){j(m,e,g),n(e,l),n(e,a),o||(i=te(e,"click",f),o=!0)},p(m,g){s=m,g[0]&262144&&t!==(t=s[56].name+"")&&$(l,t),g[0]&262400&&r!==(r="px-2.5 py-[1px] text-xs transition "+(s[8]===s[56].name?"bg-gray-100 dark:bg-gray-900":"")+" rounded-md font-medium")&&c(e,"class",r)},d(m){m&&u(e),o=!1,i()}}}function Rr(s){let e,t,l,a=s[14].t("Pinned")+"",r,o,i,f=nt(s[19]),m=[];for(let _=0;_<f.length;_+=1)m[_]=Wr(Or(s,f,_));const g=_=>ae(m[_],1,1,()=>{m[_]=null});return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S();for(let _=0;_<m.length;_+=1)m[_].c();this.h()},l(_){e=h(_,"DIV",{class:!0});var p=v(e);t=h(p,"DIV",{class:!0});var b=v(t);l=h(b,"DIV",{class:!0});var w=v(l);r=O(w,a),w.forEach(u),o=M(b);for(let y=0;y<m.length;y+=1)m[y].l(b);b.forEach(u),p.forEach(u),this.h()},h(){c(l,"class","w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium pb-1.5"),c(t,"class",""),c(e,"class","pl-2 py-2 flex flex-col space-y-1")},m(_,p){j(_,e,p),n(e,t),n(t,l),n(l,r),n(t,o);for(let b=0;b<m.length;b+=1)m[b]&&m[b].m(t,null);i=!0},p(_,p){if((!i||p[0]&16384)&&a!==(a=_[14].t("Pinned")+"")&&$(r,a),p[0]&34078840){f=nt(_[19]);let b;for(b=0;b<f.length;b+=1){const w=Or(_,f,b);m[b]?(m[b].p(w,p),ee(m[b],1)):(m[b]=Wr(w),m[b].c(),ee(m[b],1),m[b].m(t,null))}for(bt(),b=f.length;b<m.length;b+=1)g(b);wt()}},i(_){if(!i){for(let p=0;p<f.length;p+=1)ee(m[p]);i=!0}},o(_){m=m.filter(Boolean);for(let p=0;p<m.length;p+=1)ae(m[p]);i=!1},d(_){_&&u(e),Ht(m,_)}}}function Wr(s){let e,t;function l(){return s[38](s[52])}function a(...r){return s[40](s[52],...r)}return e=new Sn({props:{chat:s[52],shiftKey:s[3],selected:s[4]===s[52].id}}),e.$on("select",l),e.$on("unselect",s[39]),e.$on("delete",a),{c(){he(e.$$.fragment)},l(r){ve(e.$$.fragment,r)},m(r,o){me(e,r,o),t=!0},p(r,o){s=r;const i={};o[0]&524288&&(i.chat=s[52]),o[0]&8&&(i.shiftKey=s[3]),o[0]&524304&&(i.selected=s[4]===s[52].id),e.$set(i)},i(r){t||(ee(e.$$.fragment,r),t=!0)},o(r){ae(e.$$.fragment,r),t=!1},d(r){_e(e,r)}}}function Zr(s){let e,t=s[14].t(s[52].time_range)+"",l;return{c(){e=d("div"),l=x(t),this.h()},l(a){e=h(a,"DIV",{class:!0});var r=v(e);l=O(r,t),r.forEach(u),this.h()},h(){c(e,"class","w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium "+(s[54]===0?"":"pt-5")+" pb-0.5")},m(a,r){j(a,e,r),n(e,l)},p(a,r){r[0]&16896&&t!==(t=a[14].t(a[52].time_range)+"")&&$(l,t)},d(a){a&&u(e)}}}function Fr(s){let e,t,l,a=(s[54]===0||s[54]>0&&s[52].time_range!==s[9][s[54]-1].time_range)&&Zr(s);function r(){return s[41](s[52])}function o(...i){return s[43](s[52],...i)}return t=new Sn({props:{chat:s[52],shiftKey:s[3],selected:s[4]===s[52].id}}),t.$on("select",r),t.$on("unselect",s[42]),t.$on("delete",o),{c(){a&&a.c(),e=S(),he(t.$$.fragment)},l(i){a&&a.l(i),e=M(i),ve(t.$$.fragment,i)},m(i,f){a&&a.m(i,f),j(i,e,f),me(t,i,f),l=!0},p(i,f){s=i,s[54]===0||s[54]>0&&s[52].time_range!==s[9][s[54]-1].time_range?a?a.p(s,f):(a=Zr(s),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null);const m={};f[0]&512&&(m.chat=s[52]),f[0]&8&&(m.shiftKey=s[3]),f[0]&528&&(m.selected=s[4]===s[52].id),t.$set(m)},i(i){l||(ee(t.$$.fragment,i),l=!0)},o(i){ae(t.$$.fragment,i),l=!1},d(i){i&&u(e),a&&a.d(i),_e(t,i)}}}function Yr(s){let e,t;return e=new xo({props:{$$slots:{default:[zu]},$$scope:{ctx:s}}}),e.$on("visible",s[44]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p(l,a){const r={};a[1]&268435456&&(r.$$scope={dirty:a,ctx:l}),e.$set(r)},i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function zu(s){let e,t,l,a,r="Loading...",o;return t=new No({props:{className:" size-4"}}),{c(){e=d("div"),he(t.$$.fragment),l=S(),a=d("div"),a.textContent=r,this.h()},l(i){e=h(i,"DIV",{class:!0});var f=v(e);ve(t.$$.fragment,f),l=M(f),a=h(f,"DIV",{class:!0,"data-svelte-h":!0}),Ne(a)!=="svelte-17uns3n"&&(a.textContent=r),f.forEach(u),this.h()},h(){c(a,"class",""),c(e,"class","w-full flex justify-center py-1 text-xs animate-pulse items-center gap-2")},m(i,f){j(i,e,f),me(t,e,null),n(e,l),n(e,a),o=!0},p:xe,i(i){o||(ee(t.$$.fragment,i),o=!0)},o(i){ae(t.$$.fragment,i),o=!1},d(i){i&&u(e),_e(t)}}}function qr(s){let e,t;return e=new To({props:{role:s[16].role,$$slots:{default:[Ru]},$$scope:{ctx:s}}}),e.$on("show",s[46]),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p(l,a){const r={};a[0]&65536&&(r.role=l[16].role),a[0]&65664|a[1]&268435456&&(r.$$scope={dirty:a,ctx:l}),e.$set(r)},i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function Ru(s){let e,t,l,a,r,o,i=s[16].name+"",f,m,g;return{c(){e=d("button"),t=d("div"),l=d("img"),r=S(),o=d("div"),f=x(i),this.h()},l(_){e=h(_,"BUTTON",{class:!0});var p=v(e);t=h(p,"DIV",{class:!0});var b=v(t);l=h(b,"IMG",{src:!0,class:!0,alt:!0}),b.forEach(u),r=M(p),o=h(p,"DIV",{class:!0});var w=v(o);f=O(w,i),w.forEach(u),p.forEach(u),this.h()},h(){Is(l.src,a=s[16].profile_image_url)||c(l,"src",a),c(l,"class","max-w-[30px] object-cover rounded-full"),c(l,"alt","User profile"),c(t,"class","self-center mr-3"),c(o,"class","self-center font-medium"),c(e,"class","flex rounded-xl py-3 px-3.5 w-full hover:bg-gray-100 dark:hover:bg-gray-900 transition")},m(_,p){j(_,e,p),n(e,t),n(t,l),n(e,r),n(e,o),n(o,f),m||(g=te(e,"click",s[45]),m=!0)},p(_,p){p[0]&65536&&!Is(l.src,a=_[16].profile_image_url)&&c(l,"src",a),p[0]&65536&&i!==(i=_[16].name+"")&&$(f,i)},d(_){_&&u(e),m=!1,g()}}}function Wu(s){var Je;let e,t,l,a,r,o,i,f,m,g,_,p,b=`<img crossorigin="anonymous" src="${Qn}/static/favicon.png" class="size-6 -translate-x-1.5 rounded-full" alt="logo"/>`,w,y,k=s[14].t("New Chat")+"",V,E,T,D='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-5"><path d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z"></path><path d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z"></path></svg>',I,L,B='<div class="m-auto self-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-5"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"></path></svg></div>',H,F,N,q,z,C,A,R='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4"><path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd"></path></svg>',P,Z,Y,U,W=s[18].filter(Kr).length>0,X,G,K,J,Q,ue,ke,Ee,Me,Oe,je,pe,He;function We(le){s[26](le)}let Be={};s[13]!==void 0&&(Be.show=s[13]),e=new su({props:Be}),mt.push(()=>Et(e,"show",We)),e.$on("change",s[27]);function Qe(le){s[28](le)}let se={title:s[14].t("Delete chat?"),$$slots:{default:[ju]},$$scope:{ctx:s}};s[6]!==void 0&&(se.show=s[6]),a=new Bo({props:se}),mt.push(()=>Et(a,"show",Qe)),a.$on("confirm",s[29]);let de=s[12]&&Ur(s),De=((Je=s[16])==null?void 0:Je.role)==="admin"&&Pr(s),ie=s[17]&&$r(),Te=W&&jr(s),ge=!s[0]&&s[19].length>0&&Rr(s),ze=nt(s[9]),re=[];for(let le=0;le<ze.length;le+=1)re[le]=Fr(xr(s,ze,le));const Ve=le=>ae(re[le],1,1,()=>{re[le]=null});let ce=s[20]&&!s[11]&&Yr(s),ye=s[16]!==void 0&&qr(s);return{c(){he(e.$$.fragment),l=S(),he(a.$$.fragment),o=S(),de&&de.c(),i=S(),f=d("div"),m=d("div"),g=d("div"),_=d("a"),p=d("div"),p.innerHTML=b,w=S(),y=d("div"),V=x(k),E=S(),T=d("div"),T.innerHTML=D,I=S(),L=d("button"),L.innerHTML=B,H=S(),De&&De.c(),F=S(),N=d("div"),ie&&ie.c(),q=S(),z=d("div"),C=d("div"),A=d("div"),A.innerHTML=R,P=S(),Z=d("input"),U=S(),Te&&Te.c(),X=S(),ge&&ge.c(),G=S(),K=d("div");for(let le=0;le<re.length;le+=1)re[le].c();J=S(),ce&&ce.c(),ue=S(),ke=d("div"),Ee=d("div"),ye&&ye.c(),this.h()},l(le){ve(e.$$.fragment,le),l=M(le),ve(a.$$.fragment,le),o=M(le),de&&de.l(le),i=M(le),f=h(le,"DIV",{id:!0,class:!0,"data-state":!0});var oe=v(f);m=h(oe,"DIV",{class:!0});var be=v(m);g=h(be,"DIV",{class:!0});var Le=v(g);_=h(Le,"A",{id:!0,class:!0,href:!0,draggable:!0});var et=v(_);p=h(et,"DIV",{class:!0,"data-svelte-h":!0}),Ne(p)!=="svelte-r2hfwb"&&(p.innerHTML=b),w=M(et),y=h(et,"DIV",{class:!0});var $e=v(y);V=O($e,k),$e.forEach(u),E=M(et),T=h(et,"DIV",{class:!0,"data-svelte-h":!0}),Ne(T)!=="svelte-aq723q"&&(T.innerHTML=D),et.forEach(u),I=M(Le),L=h(Le,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(L)!=="svelte-d56ezf"&&(L.innerHTML=B),Le.forEach(u),H=M(be),De&&De.l(be),F=M(be),N=h(be,"DIV",{class:!0});var Re=v(N);ie&&ie.l(Re),q=M(Re),z=h(Re,"DIV",{class:!0});var qe=v(z);C=h(qe,"DIV",{class:!0,id:!0});var tt=v(C);A=h(tt,"DIV",{class:!0,"data-svelte-h":!0}),Ne(A)!=="svelte-1yg7etj"&&(A.innerHTML=R),P=M(tt),Z=h(tt,"INPUT",{class:!0,placeholder:!0}),tt.forEach(u),qe.forEach(u),U=M(Re),Te&&Te.l(Re),X=M(Re),ge&&ge.l(Re),G=M(Re),K=h(Re,"DIV",{class:!0});var lt=v(K);for(let Ye=0;Ye<re.length;Ye+=1)re[Ye].l(lt);J=M(lt),ce&&ce.l(lt),lt.forEach(u),Re.forEach(u),ue=M(be),ke=h(be,"DIV",{class:!0});var Ze=v(ke);Ee=h(Ze,"DIV",{class:!0});var st=v(Ee);ye&&ye.l(st),st.forEach(u),Ze.forEach(u),be.forEach(u),oe.forEach(u),this.h()},h(){c(p,"class","self-center mx-1.5"),c(y,"class","self-center font-medium text-sm text-gray-850 dark:text-white font-primary"),c(T,"class","self-center ml-auto"),c(_,"id","sidebar-new-chat-button"),c(_,"class","flex flex-1 justify-between rounded-xl px-2 h-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"),c(_,"href","/"),c(_,"draggable","false"),c(L,"class","cursor-pointer px-2 py-2 flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-900 transition"),c(g,"class","px-2.5 flex justify-between space-x-1 text-gray-600 dark:text-gray-400"),c(A,"class","self-center pl-3 py-2 rounded-l-xl bg-transparent"),c(Z,"class","w-full rounded-r-xl py-1.5 pl-2.5 pr-4 text-sm bg-transparent dark:text-gray-300 outline-none"),c(Z,"placeholder",Y=s[14].t("Search")),c(C,"class","flex w-full rounded-xl"),c(C,"id","chat-search"),c(z,"class","px-2 mt-0.5 mb-2 flex justify-center space-x-2"),c(K,"class","pl-2 my-2 flex-1 flex flex-col space-y-1 overflow-y-auto scrollbar-hidden svelte-141e0sl"),c(N,"class",Q="relative flex flex-col flex-1 overflow-y-auto "+(s[17]?"opacity-20":"")),c(Ee,"class","flex flex-col font-primary"),c(ke,"class","px-2.5 pb-safe-bottom"),c(m,"class",Me="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] z-50 "+(s[12]?"":"invisible")),c(f,"id","sidebar"),c(f,"class",Oe="h-screen max-h-[100dvh] min-h-screen select-none "+(s[12]?"md:relative w-[260px]":"-translate-x-[260px] w-[0px]")+" bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0"),c(f,"data-state",s[12])},m(le,oe){me(e,le,oe),j(le,l,oe),me(a,le,oe),j(le,o,oe),de&&de.m(le,oe),j(le,i,oe),j(le,f,oe),n(f,m),n(m,g),n(g,_),n(_,p),n(_,w),n(_,y),n(y,V),n(_,E),n(_,T),n(g,I),n(g,L),n(m,H),De&&De.m(m,null),n(m,F),n(m,N),ie&&ie.m(N,null),n(N,q),n(N,z),n(z,C),n(C,A),n(C,P),n(C,Z),Pe(Z,s[0]),n(N,U),Te&&Te.m(N,null),n(N,X),ge&&ge.m(N,null),n(N,G),n(N,K);for(let be=0;be<re.length;be+=1)re[be]&&re[be].m(K,null);n(K,J),ce&&ce.m(K,null),n(m,ue),n(m,ke),n(ke,Ee),ye&&ye.m(Ee,null),s[47](f),je=!0,pe||(He=[te(_,"click",s[31]),te(L,"click",s[32]),te(Z,"input",s[34]),te(Z,"focus",s[35])],pe=!0)},p(le,oe){var et;const be={};!t&&oe[0]&8192&&(t=!0,be.show=le[13],yt(()=>t=!1)),e.$set(be);const Le={};if(oe[0]&16384&&(Le.title=le[14].t("Delete chat?")),oe[0]&16416|oe[1]&268435456&&(Le.$$scope={dirty:oe,ctx:le}),!r&&oe[0]&64&&(r=!0,Le.show=le[6],yt(()=>r=!1)),a.$set(Le),le[12]?de?de.p(le,oe):(de=Ur(le),de.c(),de.m(i.parentNode,i)):de&&(de.d(1),de=null),(!je||oe[0]&16384)&&k!==(k=le[14].t("New Chat")+"")&&$(V,k),((et=le[16])==null?void 0:et.role)==="admin"?De?De.p(le,oe):(De=Pr(le),De.c(),De.m(m,F)):De&&(De.d(1),De=null),le[17]?ie||(ie=$r(),ie.c(),ie.m(N,q)):ie&&(ie.d(1),ie=null),(!je||oe[0]&16384&&Y!==(Y=le[14].t("Search")))&&c(Z,"placeholder",Y),oe[0]&1&&Z.value!==le[0]&&Pe(Z,le[0]),oe[0]&262144&&(W=le[18].filter(Kr).length>0),W?Te?Te.p(le,oe):(Te=jr(le),Te.c(),Te.m(N,X)):Te&&(Te.d(1),Te=null),!le[0]&&le[19].length>0?ge?(ge.p(le,oe),oe[0]&524289&&ee(ge,1)):(ge=Rr(le),ge.c(),ee(ge,1),ge.m(N,G)):ge&&(bt(),ae(ge,1,1,()=>{ge=null}),wt()),oe[0]&33571448){ze=nt(le[9]);let $e;for($e=0;$e<ze.length;$e+=1){const Re=xr(le,ze,$e);re[$e]?(re[$e].p(Re,oe),ee(re[$e],1)):(re[$e]=Fr(Re),re[$e].c(),ee(re[$e],1),re[$e].m(K,J))}for(bt(),$e=ze.length;$e<re.length;$e+=1)Ve($e);wt()}le[20]&&!le[11]?ce?(ce.p(le,oe),oe[0]&1050624&&ee(ce,1)):(ce=Yr(le),ce.c(),ee(ce,1),ce.m(K,null)):ce&&(bt(),ae(ce,1,1,()=>{ce=null}),wt()),(!je||oe[0]&131072&&Q!==(Q="relative flex flex-col flex-1 overflow-y-auto "+(le[17]?"opacity-20":"")))&&c(N,"class",Q),le[16]!==void 0?ye?(ye.p(le,oe),oe[0]&65536&&ee(ye,1)):(ye=qr(le),ye.c(),ee(ye,1),ye.m(Ee,null)):ye&&(bt(),ae(ye,1,1,()=>{ye=null}),wt()),(!je||oe[0]&4096&&Me!==(Me="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] z-50 "+(le[12]?"":"invisible")))&&c(m,"class",Me),(!je||oe[0]&4096&&Oe!==(Oe="h-screen max-h-[100dvh] min-h-screen select-none "+(le[12]?"md:relative w-[260px]":"-translate-x-[260px] w-[0px]")+" bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0"))&&c(f,"class",Oe),(!je||oe[0]&4096)&&c(f,"data-state",le[12])},i(le){if(!je){ee(e.$$.fragment,le),ee(a.$$.fragment,le),ee(ge);for(let oe=0;oe<ze.length;oe+=1)ee(re[oe]);ee(ce),ee(ye),je=!0}},o(le){ae(e.$$.fragment,le),ae(a.$$.fragment,le),ae(ge),re=re.filter(Boolean);for(let oe=0;oe<re.length;oe+=1)ae(re[oe]);ae(ce),ae(ye),je=!1},d(le){le&&(u(l),u(o),u(i),u(f)),_e(e,le),_e(a,le),de&&de.d(le),De&&De.d(),ie&&ie.d(),Te&&Te.d(),ge&&ge.d(),Ht(re,le),ce&&ce.d(),ye&&ye.d(),s[47](null),pe=!1,vt(He)}}}const Zu=768,Kr=s=>s.name!=="pinned",Gr=s=>s.name!=="pinned";function Fu(s,e,t){let l,a,r,o,i,f,m,g,_,p,b,w;Se(s,Zt,se=>t(48,l=se)),Se(s,Es,se=>t(49,a=se)),Se(s,bl,se=>t(50,se)),Se(s,il,se=>t(12,r=se)),Se(s,Ot,se=>t(1,o=se)),Se(s,Os,se=>t(13,i=se)),Se(s,zs,se=>t(15,m=se)),Se(s,jl,se=>t(16,g=se)),Se(s,En,se=>t(17,_=se)),Se(s,Rs,se=>t(18,p=se)),Se(s,Sl,se=>t(19,b=se)),Se(s,Cl,se=>t(20,w=se));const y=gt("i18n");Se(s,y,se=>t(14,f=se));let k,V="",E=!1,T=null,D=null,I=!1,L=!1,B=null,H=[],F=!1,N=!1;const q=async()=>{Zt.set(1),t(11,N=!1),await Ot.set(await cl(localStorage.token,l)),Cl.set(!0)},z=async()=>{t(10,F=!0),Zt.set(l+1);const se=await cl(localStorage.token,l);t(11,N=se.length===0),await Ot.set([...o,...se]),t(10,F=!1)};ul(async()=>{zs.subscribe(ce=>{r&&ce&&il.set(!1),!r&&!ce&&il.set(!0)}),il.set(window.innerWidth>Zu),await Sl.set(await Vl(localStorage.token,"pinned")),await q();let se,de;function De(){const ce=window.innerWidth,ye=Math.abs(de.screenX-se.screenX);se.clientX<40&&ye>=ce/8&&(de.screenX<se.screenX&&il.set(!1),de.screenX>se.screenX&&il.set(!0))}const ie=ce=>{se=ce.changedTouches[0],console.log(se.clientX)},Te=ce=>{de=ce.changedTouches[0],De()},ge=ce=>{ce.key==="Shift"&&t(3,E=!0)},ze=ce=>{ce.key==="Shift"&&t(3,E=!1)},re=()=>{},Ve=()=>{t(3,E=!1),t(4,T=null)};return window.addEventListener("keydown",ge),window.addEventListener("keyup",ze),window.addEventListener("touchstart",ie),window.addEventListener("touchend",Te),window.addEventListener("focus",re),window.addEventListener("blur",Ve),()=>{window.removeEventListener("keydown",ge),window.removeEventListener("keyup",ze),window.removeEventListener("touchstart",ie),window.removeEventListener("touchend",Te),window.removeEventListener("focus",re),window.removeEventListener("blur",Ve)}});const C=async se=>{const de=await Promise.all(se.map(async De=>{const ie=await Wn(localStorage.token,De.id).catch(Te=>null);return ie&&(De.chat=ie.chat),De}));await Ot.set(de)},A=async se=>{await bn(localStorage.token,se).catch(De=>(Xe.error(De),null))&&(a===se&&(await Es.set(""),await Ds(),Al("/")),t(11,N=!1),Zt.set(1),await Ot.set(await cl(localStorage.token,l)),await Sl.set(await Vl(localStorage.token,"pinned")))};function R(se){i=se,Os.set(i)}const P=async()=>{await Ot.set(await cl(localStorage.token))};function Z(se){I=se,t(6,I)}const Y=()=>{A(D.id)},U=()=>{il.set(!r)},W=async()=>{t(4,T=null),await Al("/");const se=document.getElementById("new-chat-button");setTimeout(()=>{se==null||se.click(),m&&il.set(!1)},0)},X=()=>{il.set(!r)},G=()=>{t(4,T=null),Es.set(""),m&&il.set(!1)};function K(){V=this.value,t(0,V)}const J=async()=>{Cl.set(!1),await Ot.set(await cl(localStorage.token)),C(o)},Q=async()=>{t(8,B=null),await q()},ue=async se=>{t(8,B=se.name),Cl.set(!1);let de=await Vl(localStorage.token,se.name);de.length===0&&(await Rs.set(await wn(localStorage.token)),await q()),await Ot.set(de),t(10,F=!1)},ke=se=>{t(4,T=se.id)},Ee=()=>{t(4,T=null)},Me=(se,de)=>{((de==null?void 0:de.detail)??"")==="shift"?A(se.id):(t(5,D=se),t(6,I=!0))},Oe=se=>{t(4,T=se.id)},je=()=>{t(4,T=null)},pe=(se,de)=>{((de==null?void 0:de.detail)??"")==="shift"?A(se.id):(t(5,D=se),t(6,I=!0))},He=se=>{F||z()},We=()=>{t(7,L=!L)},Be=se=>{se.detail==="archived-chat"&&Os.set(!0)};function Qe(se){mt[se?"unshift":"push"](()=>{k=se,t(2,k)})}return s.$$.update=()=>{s.$$.dirty[0]&3&&t(9,H=o.filter(se=>{if(V==="")return!0;{let de=se.title.toLowerCase();const De=V.toLowerCase();let ie=!1;return se.chat&&se.chat.messages&&Array.isArray(se.chat.messages)&&(ie=se.chat.messages.some(Te=>Te.content&&Te.content.toLowerCase().includes(De))),de.includes(De)||ie}}))},[V,o,k,E,T,D,I,L,B,H,F,N,r,i,f,m,g,_,p,b,w,y,q,z,C,A,R,P,Z,Y,U,W,X,G,K,J,Q,ue,ke,Ee,Me,Oe,je,pe,He,We,Be,Qe]}class Yu extends ut{constructor(e){super(),ft(this,e,Fu,Wu,ct,{},null,[-1,-1])}}function Xr(s,e,t){const l=s.slice();return l[18]=e[t],l}function Jr(s){let e,t=nt({length:s[6]}),l=[];for(let a=0;a<t.length;a+=1)l[a]=Qr(Xr(s,t,a));return{c(){e=d("div");for(let a=0;a<l.length;a+=1)l[a].c();this.h()},l(a){e=h(a,"DIV",{class:!0});var r=v(e);for(let o=0;o<l.length;o+=1)l[o].l(r);r.forEach(u),this.h()},h(){c(e,"class","confetti-holder svelte-io58ff"),Hl(e,"rounded",s[9]),Hl(e,"cone",s[10]),Hl(e,"no-gravity",s[11])},m(a,r){j(a,e,r);for(let o=0;o<l.length;o+=1)l[o]&&l[o].m(e,null)},p(a,r){if(r&20991){t=nt({length:a[6]});let o;for(o=0;o<t.length;o+=1){const i=Xr(a,t,o);l[o]?l[o].p(i,r):(l[o]=Qr(i),l[o].c(),l[o].m(e,null))}for(;o<l.length;o+=1)l[o].d(1);l.length=t.length}r&512&&Hl(e,"rounded",a[9]),r&1024&&Hl(e,"cone",a[10]),r&2048&&Hl(e,"no-gravity",a[11])},d(a){a&&u(e),Ht(l,a)}}}function Qr(s){let e;return{c(){e=d("div"),this.h()},l(t){e=h(t,"DIV",{class:!0,style:!0}),v(e).forEach(u),this.h()},h(){c(e,"class","confetti svelte-io58ff"),pt(e,"--fall-distance",s[8]),pt(e,"--size",s[0]+"px"),pt(e,"--color",s[14]()),pt(e,"--skew",xt(-45,45)+"deg,"+xt(-45,45)+"deg"),pt(e,"--rotation-xyz",xt(-10,10)+", "+xt(-10,10)+", "+xt(-10,10)),pt(e,"--rotation-deg",xt(0,360)+"deg"),pt(e,"--translate-y-multiplier",xt(s[2][0],s[2][1])),pt(e,"--translate-x-multiplier",xt(s[1][0],s[1][1])),pt(e,"--scale",.1*xt(2,10)),pt(e,"--transition-duration",s[4]?`calc(${s[3]}ms * var(--scale))`:`${s[3]}ms`),pt(e,"--transition-delay",xt(s[5][0],s[5][1])+"ms"),pt(e,"--transition-iteration-count",s[4]?"infinite":s[7]),pt(e,"--x-spread",1-s[12])},m(t,l){j(t,e,l)},p(t,l){l&256&&pt(e,"--fall-distance",t[8]),l&1&&pt(e,"--size",t[0]+"px"),l&4&&pt(e,"--translate-y-multiplier",xt(t[2][0],t[2][1])),l&2&&pt(e,"--translate-x-multiplier",xt(t[1][0],t[1][1])),l&24&&pt(e,"--transition-duration",t[4]?`calc(${t[3]}ms * var(--scale))`:`${t[3]}ms`),l&32&&pt(e,"--transition-delay",xt(t[5][0],t[5][1])+"ms"),l&144&&pt(e,"--transition-iteration-count",t[4]?"infinite":t[7]),l&4096&&pt(e,"--x-spread",1-t[12])},d(t){t&&u(e)}}}function qu(s){let e,t=!s[13]&&Jr(s);return{c(){t&&t.c(),e=$l()},l(l){t&&t.l(l),e=$l()},m(l,a){t&&t.m(l,a),j(l,e,a)},p(l,[a]){l[13]?t&&(t.d(1),t=null):t?t.p(l,a):(t=Jr(l),t.c(),t.m(e.parentNode,e))},i:xe,o:xe,d(l){l&&u(e),t&&t.d(l)}}}function xt(s,e){return Math.random()*(e-s)+s}function Ku(s,e,t){let{size:l=10}=e,{x:a=[-.5,.5]}=e,{y:r=[.25,1]}=e,{duration:o=2e3}=e,{infinite:i=!1}=e,{delay:f=[0,50]}=e,{colorRange:m=[0,360]}=e,{colorArray:g=[]}=e,{amount:_=50}=e,{iterationCount:p=1}=e,{fallDistance:b="100px"}=e,{rounded:w=!1}=e,{cone:y=!1}=e,{noGravity:k=!1}=e,{xSpread:V=.15}=e,{destroyOnComplete:E=!0}=e,T=!1;ul(()=>{!E||i||p=="infinite"||setTimeout(()=>t(13,T=!0),(o+f[1])*p)});function D(){return g.length?g[Math.round(Math.random()*(g.length-1))]:`hsl(${Math.round(xt(m[0],m[1]))}, 75%, 50%)`}return s.$$set=I=>{"size"in I&&t(0,l=I.size),"x"in I&&t(1,a=I.x),"y"in I&&t(2,r=I.y),"duration"in I&&t(3,o=I.duration),"infinite"in I&&t(4,i=I.infinite),"delay"in I&&t(5,f=I.delay),"colorRange"in I&&t(15,m=I.colorRange),"colorArray"in I&&t(16,g=I.colorArray),"amount"in I&&t(6,_=I.amount),"iterationCount"in I&&t(7,p=I.iterationCount),"fallDistance"in I&&t(8,b=I.fallDistance),"rounded"in I&&t(9,w=I.rounded),"cone"in I&&t(10,y=I.cone),"noGravity"in I&&t(11,k=I.noGravity),"xSpread"in I&&t(12,V=I.xSpread),"destroyOnComplete"in I&&t(17,E=I.destroyOnComplete)},[l,a,r,o,i,f,_,p,b,w,y,k,V,T,D,m,g,E]}class Gu extends ut{constructor(e){super(),ft(this,e,Ku,qu,ct,{size:0,x:1,y:2,duration:3,infinite:4,delay:5,colorRange:15,colorArray:16,amount:6,iterationCount:7,fallDistance:8,rounded:9,cone:10,noGravity:11,xSpread:12,destroyOnComplete:17})}}function en(s,e,t){const l=s.slice();return l[9]=e[t],l}function tn(s,e,t){const l=s.slice();return l[12]=e[t],l}function ln(s,e,t){const l=s.slice();return l[15]=e[t],l}function sn(s){let e,t=nt(Object.keys(s[1])),l=[];for(let a=0;a<t.length;a+=1)l[a]=nn(en(s,t,a));return{c(){for(let a=0;a<l.length;a+=1)l[a].c();e=$l()},l(a){for(let r=0;r<l.length;r+=1)l[r].l(a);e=$l()},m(a,r){for(let o=0;o<l.length;o+=1)l[o]&&l[o].m(a,r);j(a,e,r)},p(a,r){if(r&2){t=nt(Object.keys(a[1]));let o;for(o=0;o<t.length;o+=1){const i=en(a,t,o);l[o]?l[o].p(i,r):(l[o]=nn(i),l[o].c(),l[o].m(e.parentNode,e))}for(;o<l.length;o+=1)l[o].d(1);l.length=t.length}},d(a){a&&u(e),Ht(l,a)}}}function an(s){let e,t,l=s[1][s[9]][s[12]][s[15]].title+"",a,r,o,i=s[1][s[9]][s[12]][s[15]].content+"",f;return{c(){e=d("div"),t=d("div"),a=x(l),r=S(),o=d("div"),f=x(i),this.h()},l(m){e=h(m,"DIV",{class:!0});var g=v(e);t=h(g,"DIV",{class:!0});var _=v(t);a=O(_,l),_.forEach(u),r=M(g),o=h(g,"DIV",{class:!0});var p=v(o);f=O(p,i),p.forEach(u),g.forEach(u),this.h()},h(){c(t,"class","font-semibold uppercase"),c(o,"class","mb-2 mt-1"),c(e,"class","text-sm mb-2")},m(m,g){j(m,e,g),n(e,t),n(t,a),n(e,r),n(e,o),n(o,f)},p(m,g){g&2&&l!==(l=m[1][m[9]][m[12]][m[15]].title+"")&&$(a,l),g&2&&i!==(i=m[1][m[9]][m[12]][m[15]].content+"")&&$(f,i)},d(m){m&&u(e)}}}function rn(s){let e,t,l=s[12]+"",a,r,o,i,f=nt(Object.keys(s[1][s[9]][s[12]])),m=[];for(let g=0;g<f.length;g+=1)m[g]=an(ln(s,f,g));return{c(){e=d("div"),t=d("div"),a=x(l),o=S(),i=d("div");for(let g=0;g<m.length;g+=1)m[g].c();this.h()},l(g){e=h(g,"DIV",{class:!0});var _=v(e);t=h(_,"DIV",{class:!0});var p=v(t);a=O(p,l),p.forEach(u),o=M(_),i=h(_,"DIV",{class:!0});var b=v(i);for(let w=0;w<m.length;w+=1)m[w].l(b);b.forEach(u),_.forEach(u),this.h()},h(){c(t,"class",r="font-semibold uppercase text-xs "+(s[12]==="added"?"text-white bg-blue-600":s[12]==="fixed"?"text-white bg-green-600":s[12]==="changed"?"text-white bg-yellow-600":s[12]==="removed"?"text-white bg-red-600":"")+" w-fit px-3 rounded-full my-2.5"),c(i,"class","my-2.5 px-1.5"),c(e,"class","")},m(g,_){j(g,e,_),n(e,t),n(t,a),n(e,o),n(e,i);for(let p=0;p<m.length;p+=1)m[p]&&m[p].m(i,null)},p(g,_){if(_&2&&l!==(l=g[12]+"")&&$(a,l),_&2&&r!==(r="font-semibold uppercase text-xs "+(g[12]==="added"?"text-white bg-blue-600":g[12]==="fixed"?"text-white bg-green-600":g[12]==="changed"?"text-white bg-yellow-600":g[12]==="removed"?"text-white bg-red-600":"")+" w-fit px-3 rounded-full my-2.5")&&c(t,"class",r),_&2){f=nt(Object.keys(g[1][g[9]][g[12]]));let p;for(p=0;p<f.length;p+=1){const b=ln(g,f,p);m[p]?m[p].p(b,_):(m[p]=an(b),m[p].c(),m[p].m(i,null))}for(;p<m.length;p+=1)m[p].d(1);m.length=f.length}},d(g){g&&u(e),Ht(m,g)}}}function nn(s){let e,t,l,a=s[9]+"",r,o,i=s[1][s[9]].date+"",f,m,g,_,p,b=nt(Object.keys(s[1][s[9]]).filter(on)),w=[];for(let y=0;y<b.length;y+=1)w[y]=rn(tn(s,b,y));return{c(){e=d("div"),t=d("div"),l=x("v"),r=x(a),o=x(" - "),f=x(i),m=S(),g=d("hr"),_=S();for(let y=0;y<w.length;y+=1)w[y].c();p=S(),this.h()},l(y){e=h(y,"DIV",{class:!0});var k=v(e);t=h(k,"DIV",{class:!0});var V=v(t);l=O(V,"v"),r=O(V,a),o=O(V," - "),f=O(V,i),V.forEach(u),m=M(k),g=h(k,"HR",{class:!0}),_=M(k);for(let E=0;E<w.length;E+=1)w[E].l(k);p=M(k),k.forEach(u),this.h()},h(){c(t,"class","font-semibold text-xl mb-1 dark:text-white"),c(g,"class","dark:border-gray-800 my-2"),c(e,"class","mb-3 pr-2")},m(y,k){j(y,e,k),n(e,t),n(t,l),n(t,r),n(t,o),n(t,f),n(e,m),n(e,g),n(e,_);for(let V=0;V<w.length;V+=1)w[V]&&w[V].m(e,null);n(e,p)},p(y,k){if(k&2&&a!==(a=y[9]+"")&&$(r,a),k&2&&i!==(i=y[1][y[9]].date+"")&&$(f,i),k&2){b=nt(Object.keys(y[1][y[9]]).filter(on));let V;for(V=0;V<b.length;V+=1){const E=tn(y,b,V);w[V]?w[V].p(E,k):(w[V]=rn(E),w[V].c(),w[V].m(e,p))}for(;V<w.length;V+=1)w[V].d(1);w.length=b.length}},d(y){y&&u(e),Ht(w,y)}}}function Xu(s){let e,t,l,a=s[2].t("What’s New in")+"",r,o,i,f,m,g,_,p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>',b,w,y,k=s[2].t("Release Notes")+"",V,E,T,D,I,L,B,H,F,N,q,z,C,A,R,P=s[2].t("Okay, Let's Go!")+"",Z,Y,U,W;m=new Gu({props:{x:[-1,-.25],y:[0,.5]}});let X=s[1]&&sn(s);return{c(){e=d("div"),t=d("div"),l=d("div"),r=x(a),o=S(),i=x(s[3]),f=S(),he(m.$$.fragment),g=S(),_=d("button"),_.innerHTML=p,b=S(),w=d("div"),y=d("div"),V=x(k),E=S(),T=d("div"),D=S(),I=d("div"),L=x("v"),B=x(dl),H=S(),F=d("div"),N=d("div"),q=d("div"),X&&X.c(),z=S(),C=d("div"),A=d("button"),R=d("span"),Z=x(P),this.h()},l(G){e=h(G,"DIV",{class:!0});var K=v(e);t=h(K,"DIV",{class:!0});var J=v(t);l=h(J,"DIV",{class:!0});var Q=v(l);r=O(Q,a),o=M(Q),i=O(Q,s[3]),f=M(Q),ve(m.$$.fragment,Q),Q.forEach(u),g=M(J),_=h(J,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(_)!=="svelte-14wj4tl"&&(_.innerHTML=p),J.forEach(u),b=M(K),w=h(K,"DIV",{class:!0});var ue=v(w);y=h(ue,"DIV",{class:!0});var ke=v(y);V=O(ke,k),ke.forEach(u),E=M(ue),T=h(ue,"DIV",{class:!0}),v(T).forEach(u),D=M(ue),I=h(ue,"DIV",{class:!0});var Ee=v(I);L=O(Ee,"v"),B=O(Ee,dl),Ee.forEach(u),ue.forEach(u),K.forEach(u),H=M(G),F=h(G,"DIV",{class:!0});var Me=v(F);N=h(Me,"DIV",{class:!0});var Oe=v(N);q=h(Oe,"DIV",{class:!0});var je=v(q);X&&X.l(je),je.forEach(u),Oe.forEach(u),z=M(Me),C=h(Me,"DIV",{class:!0});var pe=v(C);A=h(pe,"BUTTON",{class:!0});var He=v(A);R=h(He,"SPAN",{class:!0});var We=v(R);Z=O(We,P),We.forEach(u),He.forEach(u),pe.forEach(u),Me.forEach(u),this.h()},h(){c(l,"class","text-xl font-semibold"),c(_,"class","self-center"),c(t,"class","flex justify-between items-start"),c(y,"class","text-sm dark:text-gray-200"),c(T,"class","flex self-center w-[1px] h-6 mx-2.5 bg-gray-200 dark:bg-gray-700"),c(I,"class","text-sm dark:text-gray-200"),c(w,"class","flex items-center mt-1"),c(e,"class","px-5 pt-4 dark:text-gray-300 text-gray-700"),c(q,"class","mb-3"),c(N,"class","overflow-y-scroll max-h-80 scrollbar-hidden"),c(R,"class","relative"),c(A,"class","px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"),c(C,"class","flex justify-end pt-3 text-sm font-medium"),c(F,"class","w-full p-4 px-5 text-gray-700 dark:text-gray-100")},m(G,K){j(G,e,K),n(e,t),n(t,l),n(l,r),n(l,o),n(l,i),n(l,f),me(m,l,null),n(t,g),n(t,_),n(e,b),n(e,w),n(w,y),n(y,V),n(w,E),n(w,T),n(w,D),n(w,I),n(I,L),n(I,B),j(G,H,K),j(G,F,K),n(F,N),n(N,q),X&&X.m(q,null),n(F,z),n(F,C),n(C,A),n(A,R),n(R,Z),Y=!0,U||(W=[te(_,"click",s[6]),te(A,"click",s[7])],U=!0)},p(G,K){(!Y||K&4)&&a!==(a=G[2].t("What’s New in")+"")&&$(r,a),(!Y||K&8)&&$(i,G[3]),(!Y||K&4)&&k!==(k=G[2].t("Release Notes")+"")&&$(V,k),G[1]?X?X.p(G,K):(X=sn(G),X.c(),X.m(q,null)):X&&(X.d(1),X=null),(!Y||K&4)&&P!==(P=G[2].t("Okay, Let's Go!")+"")&&$(Z,P)},i(G){Y||(ee(m.$$.fragment,G),Y=!0)},o(G){ae(m.$$.fragment,G),Y=!1},d(G){G&&(u(e),u(H),u(F)),_e(m),X&&X.d(),U=!1,vt(W)}}}function Ju(s){let e,t,l;function a(o){s[8](o)}let r={$$slots:{default:[Xu]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.show=s[0]),e=new Rl({props:r}),mt.push(()=>Et(e,"show",a)),{c(){he(e.$$.fragment)},l(o){ve(e.$$.fragment,o)},m(o,i){me(e,o,i),l=!0},p(o,[i]){const f={};i&262175&&(f.$$scope={dirty:i,ctx:o}),!t&&i&1&&(t=!0,f.show=o[0],yt(()=>t=!1)),e.$set(f)},i(o){l||(ee(e.$$.fragment,o),l=!0)},o(o){ae(e.$$.fragment,o),l=!1},d(o){_e(e,o)}}}const on=s=>s!=="date";function Qu(s,e,t){let l,a,r;Se(s,yn,p=>t(3,a=p)),Se(s,Vs,p=>t(4,r=p));const o=gt("i18n");Se(s,o,p=>t(2,l=p));let{show:i=!1}=e,f=null;ul(async()=>{const p=await Ln();t(1,f=p)});const m=()=>{localStorage.version=r.version,t(0,i=!1)},g=()=>{localStorage.version=r.version,t(0,i=!1)};function _(p){i=p,t(0,i)}return s.$$set=p=>{"show"in p&&t(0,i=p.show)},[i,f,l,a,r,o,m,g,_]}class ef extends ut{constructor(e){super(),ft(this,e,Qu,Ju,ct,{show:0})}}function cn(s){let e,t,l=s[1].t("Admin")+"",a,r,o=s[0].name+"",i,f,m=s[0].email+"",g,_;return{c(){e=d("div"),t=d("div"),a=x(l),r=x(": "),i=x(o),f=x(" ("),g=x(m),_=x(")"),this.h()},l(p){e=h(p,"DIV",{class:!0});var b=v(e);t=h(b,"DIV",{});var w=v(t);a=O(w,l),r=O(w,": "),i=O(w,o),f=O(w," ("),g=O(w,m),_=O(w,")"),w.forEach(u),b.forEach(u),this.h()},h(){c(e,"class","mt-4 text-sm font-medium text-center")},m(p,b){j(p,e,b),n(e,t),n(t,a),n(t,r),n(t,i),n(t,f),n(t,g),n(t,_)},p(p,b){b&2&&l!==(l=p[1].t("Admin")+"")&&$(a,l),b&1&&o!==(o=p[0].name+"")&&$(i,o),b&1&&m!==(m=p[0].email+"")&&$(g,m)},d(p){p&&u(e)}}}function tf(s){let e,t,l,a,r,o=s[1].t("Account Activation Pending")+"",i,f,m,g=s[1].t("Contact Admin for WebUI Access")+"",_,p,b,w=s[1].t("Your account status is currently pending activation.")+"",y,k,V,E=s[1].t("To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.")+"",T,D,I,L,B,H=s[1].t("Check Again")+"",F,N,q,z=s[1].t("Sign Out")+"",C,A,R,P=s[0]&&cn(s);return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("div"),r=d("div"),i=x(o),f=d("br"),m=S(),_=x(g),p=S(),b=d("div"),y=x(w),k=d("br"),V=S(),T=x(E),D=S(),P&&P.c(),I=S(),L=d("div"),B=d("button"),F=x(H),N=S(),q=d("button"),C=x(z),this.h()},l(Z){e=h(Z,"DIV",{class:!0});var Y=v(e);t=h(Y,"DIV",{class:!0});var U=v(t);l=h(U,"DIV",{class:!0});var W=v(l);a=h(W,"DIV",{class:!0});var X=v(a);r=h(X,"DIV",{class:!0});var G=v(r);i=O(G,o),f=h(G,"BR",{}),m=M(G),_=O(G,g),G.forEach(u),p=M(X),b=h(X,"DIV",{class:!0});var K=v(b);y=O(K,w),k=h(K,"BR",{}),V=M(K),T=O(K,E),K.forEach(u),D=M(X),P&&P.l(X),I=M(X),L=h(X,"DIV",{class:!0});var J=v(L);B=h(J,"BUTTON",{class:!0});var Q=v(B);F=O(Q,H),Q.forEach(u),N=M(J),q=h(J,"BUTTON",{class:!0});var ue=v(q);C=O(ue,z),ue.forEach(u),J.forEach(u),X.forEach(u),W.forEach(u),U.forEach(u),Y.forEach(u),this.h()},h(){c(r,"class","text-center dark:text-white text-2xl font-medium z-50"),c(b,"class","mt-4 text-center text-sm dark:text-gray-200 w-full"),c(B,"class","relative z-20 flex px-5 py-2 rounded-full bg-white border border-gray-100 dark:border-none hover:bg-gray-100 text-gray-700 transition font-medium text-sm"),c(q,"class","text-xs text-center w-full mt-2 text-gray-400 underline"),c(L,"class","mt-6 mx-auto relative group w-fit"),c(a,"class","max-w-md"),c(l,"class","m-auto pb-10 flex flex-col justify-center"),c(t,"class","absolute w-full h-full backdrop-blur-lg bg-white/10 dark:bg-gray-900/50 flex justify-center"),c(e,"class","fixed w-full h-full flex z-[999]")},m(Z,Y){j(Z,e,Y),n(e,t),n(t,l),n(l,a),n(a,r),n(r,i),n(r,f),n(r,m),n(r,_),n(a,p),n(a,b),n(b,y),n(b,k),n(b,V),n(b,T),n(a,D),P&&P.m(a,null),n(a,I),n(a,L),n(L,B),n(B,F),n(L,N),n(L,q),n(q,C),A||(R=[te(B,"click",s[3]),te(q,"click",s[4])],A=!0)},p(Z,[Y]){Y&2&&o!==(o=Z[1].t("Account Activation Pending")+"")&&$(i,o),Y&2&&g!==(g=Z[1].t("Contact Admin for WebUI Access")+"")&&$(_,g),Y&2&&w!==(w=Z[1].t("Your account status is currently pending activation.")+"")&&$(y,w),Y&2&&E!==(E=Z[1].t("To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.")+"")&&$(T,E),Z[0]?P?P.p(Z,Y):(P=cn(Z),P.c(),P.m(a,I)):P&&(P.d(1),P=null),Y&2&&H!==(H=Z[1].t("Check Again")+"")&&$(F,H),Y&2&&z!==(z=Z[1].t("Sign Out")+"")&&$(C,z)},i:xe,o:xe,d(Z){Z&&u(e),P&&P.d(),A=!1,vt(R)}}}function lf(s,e,t){let l;const a=gt("i18n");Se(s,a,f=>t(1,l=f));let r=null;return ul(async()=>{t(0,r=await co(localStorage.token).catch(f=>(console.error(f),null)))}),[r,l,a,async()=>{location.href="/"},async()=>{localStorage.removeItem("token"),location.href="/auth"}]}class sf extends ut{constructor(e){super(),ft(this,e,lf,tf,ct,{})}}function af(s){let e,t,l=s[1].t("A new version (v{{LATEST_VERSION}}) is now available.",{LATEST_VERSION:s[0].latest})+"",a,r,o,i=s[1].t("Update for the latest features and improvements.")+"",f,m,g,_,p,b,w,y,k;return b=new Vo({}),{c(){e=d("div"),t=d("div"),a=x(l),r=S(),o=d("a"),f=x(i),g=S(),_=d("div"),p=d("button"),he(b.$$.fragment),this.h()},l(V){e=h(V,"DIV",{class:!0});var E=v(e);t=h(E,"DIV",{class:!0});var T=v(t);a=O(T,l),r=M(T),o=h(T,"A",{href:!0,target:!0,class:!0});var D=v(o);f=O(D,i),D.forEach(u),T.forEach(u),g=M(E),_=h(E,"DIV",{class:!0});var I=v(_);p=h(I,"BUTTON",{class:!0});var L=v(p);ve(b.$$.fragment,L),L.forEach(u),I.forEach(u),E.forEach(u),this.h()},h(){c(o,"href",m="https://github.com/open-webui/open-webui/releases/tag/v"+s[0].latest),c(o,"target","_blank"),c(o,"class","underline"),c(t,"class","flex-1 font-medium"),c(p,"class","hover:text-blue-900 dark:hover:text-blue-300 transition"),c(_,"class","flex-shrink-0 pl-2"),c(e,"class","flex items-start bg-[#F1F8FE] dark:bg-[#020C1D] border border-[3371D5] dark:border-[#03113B] text-[#3371D5] dark:text-[#6795EC] rounded-lg px-3.5 py-3 text-xs max-w-80 pr-2 w-full shadow-lg")},m(V,E){j(V,e,E),n(e,t),n(t,a),n(t,r),n(t,o),n(o,f),n(e,g),n(e,_),n(_,p),me(b,p,null),w=!0,y||(k=te(p,"click",s[4]),y=!0)},p(V,[E]){(!w||E&3)&&l!==(l=V[1].t("A new version (v{{LATEST_VERSION}}) is now available.",{LATEST_VERSION:V[0].latest})+"")&&$(a,l),(!w||E&2)&&i!==(i=V[1].t("Update for the latest features and improvements.")+"")&&$(f,i),(!w||E&1&&m!==(m="https://github.com/open-webui/open-webui/releases/tag/v"+V[0].latest))&&c(o,"href",m)},i(V){w||(ee(b.$$.fragment,V),w=!0)},o(V){ae(b.$$.fragment,V),w=!1},d(V){V&&u(e),_e(b),y=!1,k()}}}function rf(s,e,t){let l;const a=fl(),r=gt("i18n");Se(s,r,f=>t(1,l=f));let{version:o={current:dl,latest:dl}}=e;const i=()=>{console.log("closeToast"),localStorage.setItem("dismissedUpdateToast",Date.now().toString()),a("closeToast")};return s.$$set=f=>{"version"in f&&t(0,o=f.version)},[o,l,a,r,i]}class nf extends ut{constructor(e){super(),ft(this,e,rf,af,ct,{version:0})}}function un(s){let e,t,l,a;return t=new nf({props:{version:s[3]}}),{c(){e=d("div"),he(t.$$.fragment),this.h()},l(r){e=h(r,"DIV",{class:!0});var o=v(e);ve(t.$$.fragment,o),o.forEach(u),this.h()},h(){c(e,"class","absolute bottom-8 right-8 z-50")},m(r,o){j(r,e,o),me(t,e,null),a=!0},p(r,o){const i={};o&8&&(i.version=r[3]),t.$set(i)},i(r){a||(ee(t.$$.fragment,r),r&&(l||Ml(()=>{l=An(e,Uo,{duration:100}),l.start()})),a=!0)},o(r){ae(t.$$.fragment,r),a=!1},d(r){r&&u(e),_e(t)}}}function fn(s){let e,t,l,a,r,o,i;const f=[cf,of],m=[];function g(b,w){return w&16&&(e=null),e==null&&(e=!["user","admin"].includes(b[4].role)),e?0:b[2].length>0?1:-1}~(t=g(s,-1))&&(l=m[t]=f[t](s)),r=new Yu({});const _=s[11].default,p=dn(_,s,s[10],null);return{c(){l&&l.c(),a=S(),he(r.$$.fragment),o=S(),p&&p.c()},l(b){l&&l.l(b),a=M(b),ve(r.$$.fragment,b),o=M(b),p&&p.l(b)},m(b,w){~t&&m[t].m(b,w),j(b,a,w),me(r,b,w),j(b,o,w),p&&p.m(b,w),i=!0},p(b,w){let y=t;t=g(b,w),t===y?~t&&m[t].p(b,w):(l&&(bt(),ae(m[y],1,1,()=>{m[y]=null}),wt()),~t?(l=m[t],l?l.p(b,w):(l=m[t]=f[t](b),l.c()),ee(l,1),l.m(a.parentNode,a)):l=null),p&&p.p&&(!i||w&1024)&&hn(p,_,b,b[10],i?mn(_,b[10],w,null):vn(b[10]),null)},i(b){i||(ee(l),ee(r.$$.fragment,b),ee(p,b),i=!0)},o(b){ae(l),ae(r.$$.fragment,b),ae(p,b),i=!1},d(b){b&&(u(a),u(o)),~t&&m[t].d(b),_e(r,b),p&&p.d(b)}}}function of(s){let e,t,l,a,r,o="Important Update<br/> Action Required for Chat Log Storage",i,f,m=s[7].t("Saving chat logs directly to your browser's storage is no longer supported. Please take a moment to download and delete your chat logs by clicking the button below. Don't worry, you can easily re-import your chat logs to the backend through")+"",g,_,p,b=s[7].t("Settings")+"",w,y,k=s[7].t("Chats")+"",V,E,T=s[7].t("Import Chats")+"",D,I,L=s[7].t("This ensures that your valuable conversations are securely saved to your backend database. Thank you!")+"",B,H,F,N,q="Download & Delete",z,C,A=s[7].t("Close")+"",R,P,Z;return{c(){e=d("div"),t=d("div"),l=d("div"),a=d("div"),r=d("div"),r.innerHTML=o,i=S(),f=d("div"),g=x(m),_=S(),p=d("span"),w=x(b),y=x(" > "),V=x(k),E=x(" > "),D=x(T),I=x(". "),B=x(L),H=S(),F=d("div"),N=d("button"),N.textContent=q,z=S(),C=d("button"),R=x(A),this.h()},l(Y){e=h(Y,"DIV",{class:!0});var U=v(e);t=h(U,"DIV",{class:!0});var W=v(t);l=h(W,"DIV",{class:!0});var X=v(l);a=h(X,"DIV",{class:!0});var G=v(a);r=h(G,"DIV",{class:!0,"data-svelte-h":!0}),Ne(r)!=="svelte-mnqwc6"&&(r.innerHTML=o),i=M(G),f=h(G,"DIV",{class:!0});var K=v(f);g=O(K,m),_=M(K),p=h(K,"SPAN",{class:!0});var J=v(p);w=O(J,b),y=O(J," > "),V=O(J,k),E=O(J," > "),D=O(J,T),J.forEach(u),I=O(K,". "),B=O(K,L),K.forEach(u),H=M(G),F=h(G,"DIV",{class:!0});var Q=v(F);N=h(Q,"BUTTON",{class:!0,"data-svelte-h":!0}),Ne(N)!=="svelte-1ia8i9q"&&(N.textContent=q),z=M(Q),C=h(Q,"BUTTON",{class:!0});var ue=v(C);R=O(ue,A),ue.forEach(u),Q.forEach(u),G.forEach(u),X.forEach(u),W.forEach(u),U.forEach(u),this.h()},h(){c(r,"class","text-center dark:text-white text-2xl font-medium z-50"),c(p,"class","font-semibold dark:text-white"),c(f,"class","mt-4 text-center text-sm dark:text-gray-200 w-full"),c(N,"class","relative z-20 flex px-5 py-2 rounded-full bg-white border border-gray-100 dark:border-none hover:bg-gray-100 transition font-medium text-sm"),c(C,"class","text-xs text-center w-full mt-2 text-gray-400 underline"),c(F,"class","mt-6 mx-auto relative group w-fit"),c(a,"class","max-w-md"),c(l,"class","m-auto pb-44 flex flex-col justify-center"),c(t,"class","absolute w-full h-full backdrop-blur-md bg-white/20 dark:bg-gray-900/50 flex justify-center"),c(e,"class","fixed w-full h-full flex z-50")},m(Y,U){j(Y,e,U),n(e,t),n(t,l),n(l,a),n(a,r),n(a,i),n(a,f),n(f,g),n(f,_),n(f,p),n(p,w),n(p,y),n(p,V),n(p,E),n(p,D),n(f,I),n(f,B),n(a,H),n(a,F),n(F,N),n(F,z),n(F,C),n(C,R),P||(Z=[te(N,"click",s[14]),te(C,"click",s[15])],P=!0)},p(Y,U){U&128&&m!==(m=Y[7].t("Saving chat logs directly to your browser's storage is no longer supported. Please take a moment to download and delete your chat logs by clicking the button below. Don't worry, you can easily re-import your chat logs to the backend through")+"")&&$(g,m),U&128&&b!==(b=Y[7].t("Settings")+"")&&$(w,b),U&128&&k!==(k=Y[7].t("Chats")+"")&&$(V,k),U&128&&T!==(T=Y[7].t("Import Chats")+"")&&$(D,T),U&128&&L!==(L=Y[7].t("This ensures that your valuable conversations are securely saved to your backend database. Thank you!")+"")&&$(B,L),U&128&&A!==(A=Y[7].t("Close")+"")&&$(R,A)},i:xe,o:xe,d(Y){Y&&u(e),P=!1,vt(Z)}}}function cf(s){let e,t;return e=new sf({}),{c(){he(e.$$.fragment)},l(l){ve(e.$$.fragment,l)},m(l,a){me(e,l,a),t=!0},p:xe,i(l){t||(ee(e.$$.fragment,l),t=!0)},o(l){ae(e.$$.fragment,l),t=!1},d(l){_e(e,l)}}}function uf(s){let e,t,l,a,r,o,i=s[3]&&Ws(s[3].latest,s[3].current),f,m,g,_;function p(E){s[12](E)}let b={};s[5]!==void 0&&(b.show=s[5]),e=new Kc({props:b}),mt.push(()=>Et(e,"show",p));function w(E){s[13](E)}let y={};s[6]!==void 0&&(y.show=s[6]),a=new ef({props:y}),mt.push(()=>Et(a,"show",w));let k=i&&un(s),V=s[0]&&fn(s);return{c(){he(e.$$.fragment),l=S(),he(a.$$.fragment),o=S(),k&&k.c(),f=S(),m=d("div"),g=d("div"),V&&V.c(),this.h()},l(E){ve(e.$$.fragment,E),l=M(E),ve(a.$$.fragment,E),o=M(E),k&&k.l(E),f=M(E),m=h(E,"DIV",{class:!0});var T=v(m);g=h(T,"DIV",{class:!0});var D=v(g);V&&V.l(D),D.forEach(u),T.forEach(u),this.h()},h(){c(g,"class","text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900 h-screen max-h-[100dvh] overflow-auto flex flex-row"),c(m,"class","app relative")},m(E,T){me(e,E,T),j(E,l,T),me(a,E,T),j(E,o,T),k&&k.m(E,T),j(E,f,T),j(E,m,T),n(m,g),V&&V.m(g,null),_=!0},p(E,[T]){const D={};!t&&T&32&&(t=!0,D.show=E[5],yt(()=>t=!1)),e.$set(D);const I={};!r&&T&64&&(r=!0,I.show=E[6],yt(()=>r=!1)),a.$set(I),T&8&&(i=E[3]&&Ws(E[3].latest,E[3].current)),i?k?(k.p(E,T),T&8&&ee(k,1)):(k=un(E),k.c(),ee(k,1),k.m(f.parentNode,f)):k&&(bt(),ae(k,1,1,()=>{k=null}),wt()),E[0]?V?(V.p(E,T),T&1&&ee(V,1)):(V=fn(E),V.c(),ee(V,1),V.m(g,null)):V&&(bt(),ae(V,1,1,()=>{V=null}),wt())},i(E){_||(ee(e.$$.fragment,E),ee(a.$$.fragment,E),ee(k),ee(V),_=!0)},o(E){ae(e.$$.fragment,E),ae(a.$$.fragment,E),ae(k),ae(V),_=!1},d(E){E&&(u(l),u(o),u(f),u(m)),_e(e,E),_e(a,E),k&&k.d(E),V&&V.d()}}}function ff(s,e,t){let l,a,r,o,i,f;Se(s,jl,B=>t(4,l=B)),Se(s,Ho,B=>t(16,a=B)),Se(s,Vs,B=>t(17,r=B)),Se(s,Hs,B=>t(5,o=B)),Se(s,Us,B=>t(6,i=B));let{$$slots:m={},$$scope:g}=e;const{saveAs:_}=Ys,p=gt("i18n");Se(s,p,B=>t(7,f=B));let b=!1,w=null,y=[],k;const V=async()=>pn(localStorage.token);ul(async()=>{if(l===void 0)await Al("/auth");else if(["user","admin"].includes(l.role)){try{if(t(1,w=await Yo("Chats",1)),w){const H=await w.getAllFromIndex("chats","timestamp");t(2,y=H.map((F,N)=>H[H.length-1-N])),y.length===0&&await rr("Chats")}console.log(w)}catch{}const B=await Zn(localStorage.token).catch(H=>(console.error(H),null));if(B)bl.set(B.ui);else{let H={};try{H=JSON.parse(localStorage.getItem("settings")??"{}")}catch(F){console.error("Failed to parse settings from localStorage",F)}bl.set(H)}if(await Promise.all([(async()=>{qs.set(await V())})(),(async()=>{eo.set(await Fn(localStorage.token))})(),(async()=>{to.set(await Yn(localStorage.token))})(),(async()=>{lo.set(await qn(localStorage.token))})(),(async()=>{so.set(await Oo(localStorage.token))})(),(async()=>{ao.set(await Kn(localStorage.token))})(),(async()=>{Rs.set(await wn(localStorage.token))})()]),document.addEventListener("keydown",function(H){var q,z,C,A,R;const F=H.ctrlKey||H.metaKey,N=H.shiftKey;if(F&&N&&H.key.toLowerCase()==="o"&&(H.preventDefault(),console.log("newChat"),(q=document.getElementById("sidebar-new-chat-button"))==null||q.click()),N&&H.key==="Escape"&&(H.preventDefault(),console.log("focusInput"),(z=document.getElementById("chat-textarea"))==null||z.focus()),F&&N&&H.key===";"){H.preventDefault(),console.log("copyLastCodeBlock");const P=[...document.getElementsByClassName("copy-code-button")].at(-1);P==null||P.click()}if(F&&N&&H.key.toLowerCase()==="c"){H.preventDefault(),console.log("copyLastResponse");const P=[...document.getElementsByClassName("copy-response-button")].at(-1);console.log(P),P==null||P.click()}F&&N&&H.key.toLowerCase()==="s"&&(H.preventDefault(),console.log("toggleSidebar"),(C=document.getElementById("sidebar-toggle-button"))==null||C.click()),F&&N&&H.key==="Backspace"&&(H.preventDefault(),console.log("deleteChat"),(A=document.getElementById("delete-chat-button"))==null||A.click()),F&&H.key==="."&&(H.preventDefault(),console.log("openSettings"),Hs.set(!o)),F&&H.key==="/"&&(H.preventDefault(),console.log("showShortcuts"),(R=document.getElementById("show-shortcuts-button"))==null||R.click())}),l.role==="admin"&&Us.set(localStorage.version!==r.version),a.url.searchParams.get("temporary-chat")==="true"&&En.set(!0),l.role==="admin")if(localStorage.dismissedUpdateToast){const H=new Date(Number(localStorage.dismissedUpdateToast));new Date-H>24*60*60*1e3&&await E()}else await E();await Ds()}t(0,b=!0)});const E=async()=>{t(3,k=await _n().catch(B=>({current:dl,latest:dl})))};function T(B){o=B,Hs.set(o)}function D(B){i=B,Us.set(i)}const I=async()=>{let B=new Blob([JSON.stringify(y)],{type:"application/json"});_(B,`chat-export-${Date.now()}.json`);const H=w.transaction("chats","readwrite");await Promise.all([H.store.clear(),H.done]),await rr("Chats"),t(2,y=[])},L=async()=>{t(2,y=[])};return s.$$set=B=>{"$$scope"in B&&t(10,g=B.$$scope)},[b,w,y,k,l,o,i,f,_,p,g,m,T,D,I,L]}class Kf extends ut{constructor(e){super(),ft(this,e,ff,uf,ct,{})}}export{Kf as component};
//# sourceMappingURL=2.DPBLEyBj.js.map
|