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='',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='
',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? Help us translate Open WebUI!`;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;Ies[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{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;nes[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;dts.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;yEt(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;Cs[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;RI=!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;res[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{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='',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='',w,y,k='',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='',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='',w,y,k='',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='',m,g,_=s[4].t("Import Chats")+"",p,b,w,y,k='',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=``;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='',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=``;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='',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;Iae(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