libre-webui 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +118 -247
  2. package/backend/dist/routes/chat.d.ts.map +1 -1
  3. package/backend/dist/routes/chat.js +5 -1
  4. package/backend/dist/routes/chat.js.map +1 -1
  5. package/backend/dist/services/titleGenerationService.d.ts +5 -0
  6. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  7. package/backend/dist/services/titleGenerationService.js +30 -6
  8. package/backend/dist/services/titleGenerationService.js.map +1 -1
  9. package/backend/package.json +1 -1
  10. package/frontend/dist/assets/index-CXKTQEWS.js +5 -0
  11. package/frontend/dist/assets/index-ClnPpnM5.css +1 -0
  12. package/frontend/dist/index.html +3 -3
  13. package/frontend/dist/js/{ArtifactContainer-urMJnZ_h.js → ArtifactContainer-DiRnahHG.js} +1 -1
  14. package/frontend/dist/js/{ArtifactDemoPage-CVxPfyus.js → ArtifactDemoPage-DlROHIWC.js} +1 -1
  15. package/frontend/dist/js/{ArtifactSlideOutPanel-MP4ap9If.js → ArtifactSlideOutPanel-Bsj35Ixs.js} +1 -1
  16. package/frontend/dist/js/{ChatPage-D35quAJJ.js → ChatPage-CjrNWkGe.js} +3 -3
  17. package/frontend/dist/js/{FirstTimeSetup-B9NVXnGv.js → FirstTimeSetup-DHqRxGnu.js} +1 -1
  18. package/frontend/dist/js/{GalleryPage-BNdUukNh.js → GalleryPage-D6JI9-bu.js} +1 -1
  19. package/frontend/dist/js/{LibreClawPage-D_N9GBg7.js → LibreClawPage-C5UCG3UO.js} +1 -1
  20. package/frontend/dist/js/{ModelManagerModals-C7wlZoV2.js → ModelManagerModals-ibSD3Sfs.js} +1 -1
  21. package/frontend/dist/js/{ModelsPage-1ykVyEI4.js → ModelsPage-4isgqfxd.js} +2 -2
  22. package/frontend/dist/js/{PersonasPage-Dg1AQ0e8.js → PersonasPage-CQPSBBkb.js} +1 -1
  23. package/frontend/dist/js/{RichMessageContent-tAv_35Ur.js → RichMessageContent-DmV_QHWo.js} +1 -1
  24. package/frontend/dist/js/{SettingsModal-BRQcVyKI.js → SettingsModal-CMgPDKKF.js} +1 -1
  25. package/frontend/dist/js/{UserManagementPage-CA15W6yb.js → UserManagementPage-KmYKTbzm.js} +1 -1
  26. package/frontend/dist/js/{api-BsUaU_IW.js → api-CdKv5S1E.js} +2 -2
  27. package/frontend/dist/js/{useBaseQuery-DDZrESRv.js → useBaseQuery-4Pd5VVAl.js} +1 -1
  28. package/frontend/dist/js/useQuery-BgOybVfP.js +1 -0
  29. package/package.json +1 -1
  30. package/frontend/dist/assets/index-BJsjOpGD.css +0 -1
  31. package/frontend/dist/assets/index-DgL4shIj.js +0 -5
  32. package/frontend/dist/js/useQuery-BFOeNWc6.js +0 -1
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/api-BsUaU_IW.js","js/rolldown-runtime-QTnfLwEv.js","js/logger-BmpKNkls.js","js/demoMode-BhEpMVh5.js","js/utils-vendor-BX3ZwoIK.js","js/markdown-core-fkbHPd-g.js","js/RichMessageContent-tAv_35Ur.js","js/ui-vendor-njo77ljx.js","js/utils-D0l9J3P-.js","js/markdown-math-Ci4QOsf-.js","assets/markdown-math-CYlHEDRF.css","js/SettingsModal-BRQcVyKI.js","js/useQuery-BFOeNWc6.js","js/useBaseQuery-DDZrESRv.js","js/Button-BZBnLKRn.js","js/ChatPage-D35quAJJ.js","js/react-vendor-Co1u1rWb.js","js/artifactHtml-B7Oy2e__.js","js/ArtifactContainer-urMJnZ_h.js","js/OptimizedSyntaxHighlighter-Fr-hsdRj.js","js/syntax-highlight-D5wpTVgr.js","js/ModelsPage-1ykVyEI4.js","js/PersonasPage-Dg1AQ0e8.js","js/GalleryPage-BNdUukNh.js","js/LibreClawPage-D_N9GBg7.js","js/UserManagementPage-CA15W6yb.js","js/ArtifactDemoPage-CVxPfyus.js","js/ArtifactSlideOutPanel-MP4ap9If.js","js/FirstTimeSetup-B9NVXnGv.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"../js/rolldown-runtime-QTnfLwEv.js";import{d as r,f as i}from"../js/markdown-core-fkbHPd-g.js";import{n as a,t as o}from"../js/react-vendor-Co1u1rWb.js";import{r as s,t as c}from"../js/logger-BmpKNkls.js";import{At as l,B as u,Bt as d,D as f,Ft as p,H as m,L as h,M as g,Mt as _,Nt as v,Ot as y,P as b,R as x,St as S,T as ee,Vt as C,Z as w,at as T,c as te,ct as ne,g as E,gt as re,ht as ie,it as ae,n as oe,o as se,ot as ce,p as le,s as ue,u as de,v as fe,vt as pe,yt as me,zt as he}from"../js/ui-vendor-njo77ljx.js";import{a as ge,o as _e,t as ve}from"../js/utils-vendor-BX3ZwoIK.js";import{n as ye,t as be}from"../js/demoMode-BhEpMVh5.js";import{_ as xe,b as Se,c as Ce,d as we,o as Te,s as D,v as Ee,y as De}from"../js/api-BsUaU_IW.js";import{a as Oe,n as ke,r as Ae,t as O}from"../js/utils-D0l9J3P-.js";import{t as k}from"../js/Button-BZBnLKRn.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function je(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function A(e,t,n){je(e,t),t.set(e,n)}function j(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function M(e,t){return e.get(j(e,t))}function N(e,t,n){return e.set(j(e,t),n),n}var Me,Ne,Pe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fe=new(Me=new WeakMap,Ne=new WeakMap,class{constructor(){A(this,Me,Pe),A(this,Ne,!1)}setTimeoutProvider(e){N(Me,this,e)}setTimeout(e,t){return M(Me,this).setTimeout(e,t)}clearTimeout(e){M(Me,this).clearTimeout(e)}setInterval(e,t){return M(Me,this).setInterval(e,t)}clearInterval(e){M(Me,this).clearInterval(e)}});function Ie(e){setTimeout(e,0)}var Le=typeof window>`u`||`Deno`in globalThis;function P(){}function Re(e,t){return typeof e==`function`?e(t):e}function ze(e){return typeof e==`number`&&e>=0&&e!==1/0}function Be(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ve(e,t){return typeof e==`function`?e(t):e}function He(e,t){return typeof e==`function`?e(t):e}function Ue(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ge(o,t.options))return!1}else if(!qe(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function We(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ke(t.options.mutationKey)!==Ke(a))return!1}else if(!qe(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ge(e,t){return(t?.queryKeyHashFn||Ke)(e)}function Ke(e){return JSON.stringify(e,(e,t)=>Qe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function qe(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>qe(e[n],t[n])):!1}var Je=Object.prototype.hasOwnProperty;function Ye(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ze(e)&&Ze(t);if(!r&&!(Qe(e)&&Qe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Je.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ye(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Xe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ze(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qe(e){if(!$e(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!$e(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function $e(e){return Object.prototype.toString.call(e)===`[object Object]`}function et(e){return new Promise(t=>{Fe.setTimeout(t,e)})}function tt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ye(e,t)}function nt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function rt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var it=Symbol();function at(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===it?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ot(e,t){return typeof e==`function`?e(...t):!!e}function st(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ct=(()=>{let e=()=>Le;return{isServer(){return e()},setIsServer(t){e=t}}})(),lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ut,dt,ft,pt=new(ut=new WeakMap,dt=new WeakMap,ft=new WeakMap,class extends lt{constructor(){super(),A(this,ut,void 0),A(this,dt,void 0),A(this,ft,void 0),N(ft,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){M(dt,this)||this.setEventListener(M(ft,this))}onUnsubscribe(){this.hasListeners()||(M(dt,this)?.call(this),N(dt,this,void 0))}setEventListener(e){N(ft,this,e),M(dt,this)?.call(this),N(dt,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){M(ut,this)!==e&&(N(ut,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof M(ut,this)==`boolean`?M(ut,this):globalThis.document?.visibilityState!==`hidden`}}),mt=Ie;function ht(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=mt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var F=ht(),gt,_t,vt,yt=new(gt=new WeakMap,_t=new WeakMap,vt=new WeakMap,class extends lt{constructor(){super(),A(this,gt,!0),A(this,_t,void 0),A(this,vt,void 0),N(vt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){M(_t,this)||this.setEventListener(M(vt,this))}onUnsubscribe(){this.hasListeners()||(M(_t,this)?.call(this),N(_t,this,void 0))}setEventListener(e){N(vt,this,e),M(_t,this)?.call(this),N(_t,this,e(this.setOnline.bind(this)))}setOnline(e){M(gt,this)!==e&&(N(gt,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return M(gt,this)}});function bt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function xt(e){return Math.min(1e3*2**e,3e4)}function St(e){return(e??`online`)===`online`?yt.isOnline():!0}var Ct=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function wt(e){let t=!1,n=0,r,i=bt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ct(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>pt.isFocused()&&(e.networkMode===`always`||yt.isOnline())&&e.canRun(),u=()=>St(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ct.isServer()?0:3),o=e.retryDelay??xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),et(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Tt,Et=(Tt=new WeakMap,class{constructor(){A(this,Tt,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ze(this.gcTime)&&N(Tt,this,Fe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ct.isServer()?1/0:300*1e3))}clearGcTimeout(){M(Tt,this)!==void 0&&(Fe.clearTimeout(M(Tt,this)),N(Tt,this,void 0))}});function Dt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{st(e,()=>t.signal,()=>n=!0)},u=at(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?rt:nt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?kt:Ot,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ot(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ot(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function kt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function At(e,t){return t?Ot(e,t)!=null:!1}function jt(e,t){return!t||!e.getPreviousPageParam?!1:kt(e,t)!=null}function Mt(e,t){je(e,t),t.add(e)}var Nt,Pt,Ft,It,Lt,I,Rt,zt,L,Bt=(Nt=new WeakMap,Pt=new WeakMap,Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap,I=new WeakMap,Rt=new WeakMap,zt=new WeakMap,L=new WeakSet,class extends Et{constructor(e){super(),Mt(this,L),A(this,Nt,void 0),A(this,Pt,void 0),A(this,Ft,void 0),A(this,It,void 0),A(this,Lt,void 0),A(this,I,void 0),A(this,Rt,void 0),A(this,zt,void 0),N(zt,this,!1),N(Rt,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],N(Lt,this,e.client),N(It,this,M(Lt,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,N(Pt,this,Gt(this.options)),this.state=e.state??M(Pt,this),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return M(Nt,this)}get promise(){return M(I,this)?.promise}setOptions(e){if(this.options={...M(Rt,this),...e},e?._type&&N(Nt,this,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Gt(this.options);e.data!==void 0&&(this.setState(Wt(e.data,e.dataUpdatedAt)),N(Pt,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&M(It,this).remove(this)}setData(e,t){let n=tt(this.state.data,e,this.options);return j(L,this,Ht).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){j(L,this,Ht).call(this,{type:`setState`,state:e})}cancel(e){let t=M(I,this)?.promise;return M(I,this)?.cancel(e),t?t.then(P).catch(P):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return M(Pt,this)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>He(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===it||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ve(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Be(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),M(I,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),M(I,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),M(It,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(M(I,this)&&(M(zt,this)||j(L,this,Vt).call(this)?M(I,this).cancel({revert:!0}):M(I,this).cancelRetry()),this.scheduleGc()),M(It,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||j(L,this,Ht).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&M(I,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(M(I,this))return M(I,this).continueRetry(),M(I,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(N(zt,this,!0),n.signal)})},i=()=>{let e=at(this.options,t),n=(()=>{let e={client:M(Lt,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return N(zt,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:M(Lt,this),state:this.state,fetchFn:i};return r(e),e})();(M(Nt,this)===`infinite`?Dt(this.options.pages):this.options.behavior)?.onFetch(a,this),N(Ft,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&j(L,this,Ht).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),N(I,this,wt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ct&&e.revert&&this.setState({...M(Ft,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{j(L,this,Ht).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j(L,this,Ht).call(this,{type:`pause`})},onContinue:()=>{j(L,this,Ht).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await M(I,this).start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),M(It,this).config.onSuccess?.(e,this),M(It,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ct){if(e.silent)return M(I,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw j(L,this,Ht).call(this,{type:`error`,error:e}),M(It,this).config.onError?.(e,this),M(It,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function Vt(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}function Ht(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ut(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Wt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return N(Ft,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),F.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),M(It,this).notify({query:this,type:`updated`,action:e})})}function Ut(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:St(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Wt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Gt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Kt,qt=(Kt=new WeakMap,class extends lt{constructor(e={}){super(),A(this,Kt,void 0),this.config=e,N(Kt,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ge(r,t),a=this.get(i);return a||(a=new Bt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){M(Kt,this).has(e.queryHash)||(M(Kt,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=M(Kt,this).get(e.queryHash);t&&(e.destroy(),t===e&&M(Kt,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return M(Kt,this).get(e)}getAll(){return[...M(Kt,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ue(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ue(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),Jt,Yt,R,Xt,Zt,Qt=(Jt=new WeakMap,Yt=new WeakMap,R=new WeakMap,Xt=new WeakMap,Zt=new WeakSet,class extends Et{constructor(e){super(),Mt(this,Zt),A(this,Jt,void 0),A(this,Yt,void 0),A(this,R,void 0),A(this,Xt,void 0),N(Jt,this,e.client),this.mutationId=e.mutationId,N(R,this,e.mutationCache),N(Yt,this,[]),this.state=e.state||en(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){M(Yt,this).includes(e)||(M(Yt,this).push(e),this.clearGcTimeout(),M(R,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){N(Yt,this,M(Yt,this).filter(t=>t!==e)),this.scheduleGc(),M(R,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){M(Yt,this).length||(this.state.status===`pending`?this.scheduleGc():M(R,this).remove(this))}continue(){return M(Xt,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{j(Zt,this,$t).call(this,{type:`continue`})},n={client:M(Jt,this),meta:this.options.meta,mutationKey:this.options.mutationKey};N(Xt,this,wt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{j(Zt,this,$t).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{j(Zt,this,$t).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(R,this).canRun(this)}));let r=this.state.status===`pending`,i=!M(Xt,this).canStart();try{if(r)t();else{j(Zt,this,$t).call(this,{type:`pending`,variables:e,isPaused:i}),M(R,this).config.onMutate&&await M(R,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&j(Zt,this,$t).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await M(Xt,this).start();return await M(R,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await M(R,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),j(Zt,this,$t).call(this,{type:`success`,data:a}),a}catch(t){try{await M(R,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await M(R,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw j(Zt,this,$t).call(this,{type:`error`,error:t}),t}finally{M(R,this).runNext(this)}}});function $t(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),F.batch(()=>{M(Yt,this).forEach(t=>{t.onMutationUpdate(e)}),M(R,this).notify({mutation:this,type:`updated`,action:e})})}function en(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var tn,nn,rn,an=(tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,class extends lt{constructor(e={}){super(),A(this,tn,void 0),A(this,nn,void 0),A(this,rn,void 0),this.config=e,N(tn,this,new Set),N(nn,this,new Map),N(rn,this,0)}build(e,t,n){var r;let i=new Qt({client:e,mutationCache:this,mutationId:N(rn,this,(r=M(rn,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){M(tn,this).add(e);let t=on(e);if(typeof t==`string`){let n=M(nn,this).get(t);n?n.push(e):M(nn,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(M(tn,this).delete(e)){let t=on(e);if(typeof t==`string`){let n=M(nn,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&M(nn,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=on(e);if(typeof t==`string`){let n=M(nn,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=on(e);return typeof t==`string`?(M(nn,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{M(tn,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),M(tn,this).clear(),M(nn,this).clear()})}getAll(){return Array.from(M(tn,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>We(t,e))}findAll(e={}){return this.getAll().filter(t=>We(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(P))))}});function on(e){return e.options.scope?.id}var z,sn,cn,ln,un,dn,fn,pn,mn=(z=new WeakMap,sn=new WeakMap,cn=new WeakMap,ln=new WeakMap,un=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,class{constructor(e={}){A(this,z,void 0),A(this,sn,void 0),A(this,cn,void 0),A(this,ln,void 0),A(this,un,void 0),A(this,dn,void 0),A(this,fn,void 0),A(this,pn,void 0),N(z,this,e.queryCache||new qt),N(sn,this,e.mutationCache||new an),N(cn,this,e.defaultOptions||{}),N(ln,this,new Map),N(un,this,new Map),N(dn,this,0)}mount(){var e;N(dn,this,(e=M(dn,this),e++,e)),M(dn,this)===1&&(N(fn,this,pt.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(z,this).onFocus())})),N(pn,this,yt.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(z,this).onOnline())})))}unmount(){var e;N(dn,this,(e=M(dn,this),e--,e)),M(dn,this)===0&&(M(fn,this)?.call(this),N(fn,this,void 0),M(pn,this)?.call(this),N(pn,this,void 0))}isFetching(e){return M(z,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return M(sn,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return M(z,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=M(z,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ve(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(z,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=M(z,this).get(r.queryHash)?.state.data,a=Re(t,i);if(a!==void 0)return M(z,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>M(z,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return M(z,this).get(t.queryHash)?.state}removeQueries(e){let t=M(z,this);F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=M(z,this);return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>M(z,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(P).catch(P)}invalidateQueries(e,t={}){return F.batch(()=>(M(z,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>M(z,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(P)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(P)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=M(z,this).build(this,t);return n.isStaleByTime(Ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(P).catch(P)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(P).catch(P)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return yt.isOnline()?M(sn,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(z,this)}getMutationCache(){return M(sn,this)}getDefaultOptions(){return M(cn,this)}setDefaultOptions(e){N(cn,this,e)}setQueryDefaults(e,t){M(ln,this).set(Ke(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...M(ln,this).values()],n={};return t.forEach(t=>{qe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){M(un,this).set(Ke(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...M(un,this).values()],n={};return t.forEach(t=>{qe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...M(cn,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ge(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===it&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...M(cn,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(z,this).clear(),M(sn,this).clear()}}),B=t(i(),1),V=r(),hn=B.createContext(void 0),gn=e=>{let t=B.useContext(hn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_n=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(hn.Provider,{value:e,children:t})),vn=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,yn=/^[\\/]{2}/;function bn(e,t){return t+e.replace(/\\/g,`/`)}var xn=`popstate`;function Sn(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Cn(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Dn(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:On(t)}return An(t,n,null,e)}function wn(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=kn(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),Dn(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:On(t))}function r(e,t){U(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return An(t,n,r,e)}function H(e,t){if(e===!1||e==null)throw Error(t)}function U(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Tn(){return Math.random().toString(36).substring(2,10)}function En(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Dn(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?kn(t):t,state:n,key:t&&t.key||r||Tn(),mask:i}}function On({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function kn(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function An(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Sn(e)?e:Dn(h.location,e,t);n&&n(r,e),l=u()+1;let d=En(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Sn(e)?e:Dn(h.location,e,t);n&&n(r,e),l=u();let i=En(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return jn(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(xn,d),c=e,()=>{i.removeEventListener(xn,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function jn(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),H(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:On(t);return i=i.replace(/ $/,`%20`),!n&&yn.test(i)&&(i=r+i),new URL(i,r)}function Mn(e,t,n=`/`){return Nn(e,t,n,!1)}function Nn(e,t,n,r,i){let a=$n((typeof t==`string`?kn(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Fn(e),s=null,c=Qn(a);for(let e=0;s==null&&e<o.length;++e)s=Jn(o[e],c,r);return s}function Pn(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Fn(e){let t=In(e);return Rn(t),t}function In(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;H(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=sr([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(H(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),In(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Kn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Zn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Ln(e.path))a(e,t,!0,n)}),t}function Ln(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Ln(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Rn(e){e.sort((e,t)=>e.score===t.score?qn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var zn=/^:[\w-]+$/,Bn=3,Vn=2,Hn=1,Un=10,Wn=-2,Gn=e=>e===`*`;function Kn(e,t){let n=e.split(`/`),r=n.length;return n.some(Gn)&&(r+=Wn),t&&(r+=Vn),n.filter(e=>!Gn(e)).reduce((e,t)=>e+(zn.test(t)?Bn:t===``?Hn:Un),r)}function qn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Jn(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Xn(u,l,s.matcher,s.compiledParams):Yn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Yn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:sr([a,d.pathname]),pathnameBase:lr(sr([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=sr([a,d.pathnameBase]))}return o}function Yn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Zn(e.path,e.caseSensitive,e.end);return Xn(e,t,n,r)}function Xn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Zn(e,t=!1,n=!0){U(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Qn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return U(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $n(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function er(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?kn(e):e,a;return n?(n=or(n),a=n.startsWith(`/`)?tr(n.substring(1),`/`):tr(n,t)):a=t,{pathname:a,search:ur(r),hash:dr(i)}}function tr(e,t){let n=cr(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function nr(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function rr(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ir(e){let t=rr(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function ar(e,t,n,r=!1){let i;typeof e==`string`?i=kn(e):(i={...e},H(!i.pathname||!i.pathname.includes(`?`),nr(`?`,`pathname`,`search`,i)),H(!i.pathname||!i.pathname.includes(`#`),nr(`#`,`pathname`,`hash`,i)),H(!i.search||!i.search.includes(`#`),nr(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=er(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var or=e=>e.replace(/[\\/]{2,}/g,`/`),sr=e=>or(e.join(`/`)),cr=e=>e.replace(/\/+$/,``),lr=e=>cr(e).replace(/^\/*/,`/`),ur=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,dr=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,fr=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function pr(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function mr(e){return sr(e.map(e=>e.route.path).filter(Boolean))||`/`}var hr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function gr(e,t){let n=e;if(typeof n!=`string`||!vn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(hr)try{let e=new URL(window.location.href),r=yn.test(n)?new URL(bn(n,e.protocol)):new URL(n),a=$n(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{U(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var _r=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(_r);var vr=[`GET`,..._r];new Set(vr);var yr=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function br(e){try{return yr.includes(new URL(e).protocol)}catch{return!1}}var xr=B.createContext(null);xr.displayName=`DataRouter`;var Sr=B.createContext(null);Sr.displayName=`DataRouterState`;var Cr=B.createContext(!1);function wr(){return B.useContext(Cr)}var Tr=B.createContext({isTransitioning:!1});Tr.displayName=`ViewTransition`;var Er=B.createContext(new Map);Er.displayName=`Fetchers`;var Dr=B.createContext(null);Dr.displayName=`Await`;var W=B.createContext(null);W.displayName=`Navigation`;var Or=B.createContext(null);Or.displayName=`Location`;var kr=B.createContext({outlet:null,matches:[],isDataRoute:!1});kr.displayName=`Route`;var Ar=B.createContext(null);Ar.displayName=`RouteError`;var jr=`REACT_ROUTER_ERROR`,Mr=`REDIRECT`,Nr=`ROUTE_ERROR_RESPONSE`;function Pr(e){if(e.startsWith(`${jr}:${Mr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Fr(e){if(e.startsWith(`${jr}:${Nr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new fr(t.status,t.statusText,t.data)}catch{}}function Ir(e,{relative:t}={}){H(Lr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=B.useContext(W),{hash:i,pathname:a,search:o}=Ur(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:sr([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Lr(){return B.useContext(Or)!=null}function G(){return H(Lr(),`useLocation() may be used only in the context of a <Router> component.`),B.useContext(Or).location}var Rr=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function zr(e){B.useContext(W).static||B.useLayoutEffect(e)}function Br(){let{isDataRoute:e}=B.useContext(kr);return e?ci():Vr()}function Vr(){H(Lr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=B.useContext(xr),{basename:t,navigator:n}=B.useContext(W),{matches:r}=B.useContext(kr),{pathname:i}=G(),a=JSON.stringify(ir(r)),o=B.useRef(!1);return zr(()=>{o.current=!0}),B.useCallback((r,s={})=>{if(U(o.current,Rr),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=ar(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:sr([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}B.createContext(null);function Hr(){let{matches:e}=B.useContext(kr);return e[e.length-1]?.params??{}}function Ur(e,{relative:t}={}){let{matches:n}=B.useContext(kr),{pathname:r}=G(),i=JSON.stringify(ir(n));return B.useMemo(()=>ar(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Wr(e,t){return Gr(e,t)}function Gr(e,t,n){H(Lr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=B.useContext(W),{matches:i}=B.useContext(kr),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ui(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
-
4
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=G(),d;if(t){let e=typeof t==`string`?kn(t):t;H(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Mn(e,{pathname:p});U(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),U(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Qr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:sr([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:sr([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?B.createElement(Or.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Kr(){let e=si(),t=pr(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=B.createElement(B.Fragment,null,B.createElement(`p`,null,`💿 Hey developer 👋`),B.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,B.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,B.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),B.createElement(B.Fragment,null,B.createElement(`h2`,null,`Unexpected Application Error!`),B.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?B.createElement(`pre`,{style:i},n):null,o)}var qr=B.createElement(Kr,null),Jr=class extends B.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Fr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:B.createElement(kr.Provider,{value:this.props.routeContext},B.createElement(Ar.Provider,{value:e,children:this.props.component}));return this.context?B.createElement(Xr,{error:e},t):t}};Jr.contextType=Cr;var Yr=new WeakMap;function Xr({children:e,error:t}){let{basename:n}=B.useContext(W);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Pr(t.digest);if(e){let r=Yr.get(t);if(r)throw r;let i=gr(e.location,n),a=i.absoluteURL||i.to;if(br(a))throw Error(`Invalid redirect location`);if(hr&&!Yr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Yr.set(t,n),n}return B.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Zr({routeContext:e,match:t,children:n}){let r=B.useContext(xr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),B.createElement(kr.Provider,{value:e},n)}function Qr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);H(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:mr(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||qr,o&&(s<0&&c===0?(ui(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?B.createElement(n.route.Component,null):n.route.element?n.route.element:e,B.createElement(Zr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?B.createElement(Jr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function $r(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ei(e){let t=B.useContext(xr);return H(t,$r(e)),t}function ti(e){let t=B.useContext(Sr);return H(t,$r(e)),t}function ni(e){let t=B.useContext(kr);return H(t,$r(e)),t}function ri(e){let t=ni(e),n=t.matches[t.matches.length-1];return H(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ii(){return ri(`useRouteId`)}function ai(){let e=ti(`useNavigation`);return B.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function oi(){let{matches:e,loaderData:t}=ti(`useMatches`);return B.useMemo(()=>e.map(e=>Pn(e,t)),[e,t])}function si(){let e=B.useContext(Ar),t=ti(`useRouteError`),n=ri(`useRouteError`);return e===void 0?t.errors?.[n]:e}function ci(){let{router:e}=ei(`useNavigate`),t=ri(`useNavigate`),n=B.useRef(!1);return zr(()=>{n.current=!0}),B.useCallback(async(r,i={})=>{U(n.current,Rr),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var li={};function ui(e,t,n){!t&&!li[e]&&(li[e]=!0,U(!1,n))}B.memo(di);function di({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Gr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function fi({to:e,replace:t,state:n,relative:r}){H(Lr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=B.useContext(W);U(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=B.useContext(kr),{pathname:o}=G(),s=Br(),c=ar(e,ir(a),o,r===`path`),l=JSON.stringify(c);return B.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function K(e){H(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function pi({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){H(!Lr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=B.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=kn(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=B.useMemo(()=>{let e=$n(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return U(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:B.createElement(W.Provider,{value:c},B.createElement(Or.Provider,{children:t,value:h}))}function mi({children:e,location:t}){return Wr(hi(e),t)}B.Component;function hi(e,t=[]){let n=[];return B.Children.forEach(e,(e,r)=>{if(!B.isValidElement(e))return;let i=[...t,r];if(e.type===B.Fragment){n.push.apply(n,hi(e.props.children,i));return}H(e.type===K,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),H(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=hi(e.props.children,i)),n.push(a)}),n}var gi=`get`,_i=`application/x-www-form-urlencoded`;function vi(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function yi(e){return vi(e)&&e.tagName.toLowerCase()===`button`}function bi(e){return vi(e)&&e.tagName.toLowerCase()===`form`}function xi(e){return vi(e)&&e.tagName.toLowerCase()===`input`}function Si(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ci(e,t){return e.button===0&&(!t||t===`_self`)&&!Si(e)}var wi=null;function Ti(){if(wi===null)try{new FormData(document.createElement(`form`),0),wi=!1}catch{wi=!0}return wi}var Ei=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Di(e){return e!=null&&!Ei.has(e)?(U(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_i}"`),null):e}function Oi(e,t){let n,r,i,a,o;if(bi(e)){let o=e.getAttribute(`action`);r=o?$n(o,t):null,n=e.getAttribute(`method`)||gi,i=Di(e.getAttribute(`enctype`))||_i,a=new FormData(e)}else if(yi(e)||xi(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?$n(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||gi,i=Di(e.getAttribute(`formenctype`))||Di(o.getAttribute(`enctype`))||_i,a=new FormData(o,e),!Ti()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(vi(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=gi,r=null,i=_i,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ki={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Ai=/[&><\u2028\u2029]/g;function ji(e){return e.replace(Ai,e=>ki[e])}function Mi(e,t){if(e===!1||e==null)throw Error(t)}function Ni(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&$n(i.pathname,t)===`/`?i.pathname=`${cr(t)}/_root.${r}`:i.pathname=`${cr(i.pathname)}.${r}`,i}async function Pi(e,t){if(e.id in t)return t[e.id];try{let n=await s(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Fi(e){return e!=null&&typeof e.page==`string`}function Ii(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Li(e,t,n){return Hi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Pi(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ii).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ri(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function zi(e,t,{includeHydrateFallback:n}={}){return Bi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Bi(e){return[...new Set(e)]}function Vi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Hi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Fi(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Vi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Ui(){let e=B.useContext(xr);return Mi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Wi(){let e=B.useContext(Sr);return Mi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Gi=B.createContext(void 0);Gi.displayName=`FrameworkContext`;function Ki(){let e=B.useContext(Gi);return Mi(e,`You must render this element inside a <HydratedRouter> element`),e}function qi(e,t){let n=B.useContext(Gi),[r,i]=B.useState(!1),[a,o]=B.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=B.useRef(null);B.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),B.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Ji(s,p),onBlur:Ji(c,m),onMouseEnter:Ji(l,p),onMouseLeave:Ji(u,m),onTouchStart:Ji(d,p)}]:[a,f,{}]:[!1,f,{}]}function Ji(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Yi({page:e,...t}){let n=wr(),{nonce:r}=Ki(),{router:i}=Ui(),a=B.useMemo(()=>Mn(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?B.createElement(Zi,{page:e,matches:a,...t}):B.createElement(Qi,{page:e,matches:a,...t})):null}function Xi(e){let{manifest:t,routeModules:n}=Ki(),[r,i]=B.useState([]);return B.useEffect(()=>{let r=!1;return Li(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Zi({page:e,matches:t,...n}){let r=G(),{future:i}=Ki(),{basename:a}=Ui(),o=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ni(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return B.createElement(B.Fragment,null,o.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Qi({page:e,matches:t,...n}){let r=G(),{future:i,manifest:a,routeModules:o}=Ki(),{basename:s}=Ui(),{loaderData:c,matches:l}=Wi(),u=B.useMemo(()=>Ri(e,t,l,a,r,`data`),[e,t,l,a,r]),d=B.useMemo(()=>Ri(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ni(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=B.useMemo(()=>zi(d,a),[d,a]),m=Xi(d);return B.createElement(B.Fragment,null,f.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>B.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>B.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function $i(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}B.Component;var ea=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ea&&(window.__reactRouterVersion=`7.18.1`)}catch{}function ta({basename:e,children:t,useTransitions:n,window:r}){let i=B.useRef();i.current??(i.current=Cn({window:r,v5Compat:!0}));let a=i.current,[o,s]=B.useState({action:a.action,location:a.location}),c=B.useCallback(e=>{n===!1?s(e):B.startTransition(()=>s(e))},[n]);return B.useLayoutEffect(()=>a.listen(c),[a,c]),B.createElement(pi,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function na({basename:e,children:t,useTransitions:n,window:r}){let i=B.useRef();i.current??(i.current=wn({window:r,v5Compat:!0}));let a=i.current,[o,s]=B.useState({action:a.action,location:a.location}),c=B.useCallback(e=>{n===!1?s(e):B.startTransition(()=>s(e))},[n]);return B.useLayoutEffect(()=>a.listen(c),[a,c]),B.createElement(pi,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ra({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=B.useState({action:n.action,location:n.location}),o=B.useCallback(e=>{r===!1?a(e):B.startTransition(()=>a(e))},[r]);return B.useLayoutEffect(()=>n.listen(o),[n,o]),B.createElement(pi,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ra.displayName=`unstable_HistoryRouter`;var ia=B.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=B.useContext(W),v=typeof l==`string`&&vn.test(l),y=gr(l,h);l=y.to;let b=Ir(l,{relative:r}),x=G(),S=null;if(o){let e=ar(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:sr([h,e.pathname])),S=g.createHref(e)}let[ee,C,w]=qi(n,p),T=da(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function te(t){e&&e(t),t.defaultPrevented||T(t)}let ne=!(y.isExternal||i),E=B.createElement(`a`,{...p,...w,href:(ne?S:void 0)||y.absoluteURL||b,onClick:ne?te:e,ref:$i(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?B.createElement(B.Fragment,null,E,B.createElement(Yi,{page:b})):E});ia.displayName=`Link`;var aa=B.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Ur(a,{relative:c.relative}),d=G(),f=B.useContext(Sr),{navigator:p,basename:m}=B.useContext(W),h=f!=null&&xa(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=$n(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,C;C=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let w=typeof i==`function`?i(S):i;return B.createElement(ia,{...c,"aria-current":ee,className:C,ref:l,style:w,to:a,viewTransition:o},typeof s==`function`?s(S):s)});aa.displayName=`NavLink`;var oa=B.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=gi,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=B.useContext(W),g=ma(),_=ha(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&vn.test(s);return B.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?B.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});oa.displayName=`Form`;function sa({getKey:e,storageKey:t,...n}){let r=B.useContext(Gi),{basename:i}=B.useContext(W),a=G(),o=oi();ya({getKey:e,storageKey:t});let s=B.useMemo(()=>{if(!r||!e)return null;let t=va(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),B.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${ji(JSON.stringify(t||ga))}, ${ji(JSON.stringify(s))})`}})}sa.displayName=`ScrollRestoration`;function ca(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function la(e){let t=B.useContext(xr);return H(t,ca(e)),t}function ua(e){let t=B.useContext(Sr);return H(t,ca(e)),t}function da(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Br(),d=G(),f=Ur(e,{relative:o});return B.useCallback(p=>{if(Ci(p,t)){p.preventDefault();let t=n===void 0?On(d)===On(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?B.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var fa=0,pa=()=>`__${String(++fa)}__`;function ma(){let{router:e}=la(`useSubmit`),{basename:t}=B.useContext(W),n=ii(),r=e.fetch,i=e.navigate;return B.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Oi(e,t);a.navigate===!1?await r(a.fetcherKey||pa(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function ha(e,{relative:t}={}){let{basename:n}=B.useContext(W),r=B.useContext(kr);H(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Ur(e||`.`,{relative:t})},o=G();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:sr([n,a.pathname])),On(a)}var ga=`react-router-scroll-positions`,_a={};function va(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:$n(e.pathname,n)||e.pathname},t)),i??(i=e.key),i}function ya({getKey:e,storageKey:t}={}){let{router:n}=la(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=ua(`useScrollRestoration`),{basename:a}=B.useContext(W),o=G(),s=oi(),c=ai();B.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),ba(B.useCallback(()=>{if(c.state===`idle`){let t=va(o,s,a,e);_a[t]=window.scrollY}try{sessionStorage.setItem(t||ga,JSON.stringify(_a))}catch(e){U(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(B.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||ga);e&&(_a=JSON.parse(e))}catch{}},[t]),B.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(_a,()=>window.scrollY,e?(t,n)=>va(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),B.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{U(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function ba(e,t){let{capture:n}=t||{};B.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function xa(e,{relative:t}={}){let n=B.useContext(Tr);H(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=la(`useViewTransitionState`),i=Ur(e,{relative:t});if(!n.isTransitioning)return!1;let a=$n(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=$n(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Yn(i.pathname,o)!=null||Yn(i.pathname,a)!=null}var Sa=t(o(),1),q=e=>typeof e==`string`,Ca=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},wa=e=>e==null?``:String(e),Ta=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Ea=/###/g,Da=e=>e&&e.includes(`###`)?e.replace(Ea,`.`):e,Oa=e=>!e||q(e),ka=(e,t,n)=>{let r=q(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(Oa(e))return{};let t=Da(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Oa(e)?{}:{obj:e,k:Da(r[i])}},Aa=(e,t,n)=>{let{obj:r,k:i}=ka(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=ka(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ka(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ja=(e,t,n,r)=>{let{obj:i,k:a}=ka(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Ma=(e,t)=>{let{obj:n,k:r}=ka(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Na=(e,t,n)=>{let r=Ma(e,n);return r===void 0?Ma(t,n):r},Pa=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?q(e[r])||e[r]instanceof String||q(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Pa(e[r],t[r],n):e[r]=t[r]);return e},Fa=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Ia={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},La=e=>q(e)?e.replace(/[&<>"'\/]/g,e=>Ia[e]):e,Ra=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},za=[` `,`,`,`?`,`!`,`;`],Ba=new Ra(20),Va=(e,t,n)=>{t=t||``,n=n||``;let r=za.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Ba.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Ha=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Ua=e=>e?.replace(/_/g,`-`),Wa={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Ga=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Wa,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>q(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),q(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Ka=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},qa=class extends Ka{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):q(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Ma(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!q(n)?s:Ha(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Aa(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(q(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Ma(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Pa(s,n,i):s={...s,...n},Aa(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Ja={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Ya=Symbol(`i18next/PATH_KEY`);function Xa(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Ya?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Za(e,t){let{[Ya]:n}=e(Xa()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Qa=e=>!q(e)&&typeof e!=`boolean`&&typeof e!=`number`,$a=class e extends Ka{constructor(e,t={}){super(),Ta([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Ga.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Qa(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Va(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:q(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:q(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||(i={}),t==null)return``;typeof t==`function`&&(t=Za(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Za(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!q(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,ee=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,C=b&&!i.ordinal&&i.count===0,w=C&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${ee}`]||i.defaultValue,T=m;y&&!m&&x&&(T=w);let te=Qa(T),ne=Object.prototype.toString.apply(T);if(y&&T&&te&&!_.includes(ne)&&!(q(v)&&Array.isArray(T))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,T,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(T),t=e?[]:{},n=e?g:h;for(let e in T)if(Object.prototype.hasOwnProperty.call(T,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:Qa(w)?w[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=T[e])}m=t}}else if(y&&q(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,t,i,r));else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=w),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&w!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?w:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);C&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||w)})}):n(e,s,w))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=q(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!q(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=q(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Ja.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return q(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Za(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!q(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(q(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!q(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},eo=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ga.create(`languageUtils`)}getScriptPartFromCode(e){if(e=Ua(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Ua(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(q(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),q(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return q(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):q(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},to={zero:0,one:1,two:2,few:3,many:4,other:5},no={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},ro=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Ga.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Ua(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),no;if(!e.match(/-|_/))return no;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>to[e]-to[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},io=(e,t,n,r=`.`,i=!0)=>{let a=Na(e,t,n);return!a&&i&&q(n)&&(a=Ha(e,n,r),a===void 0&&(a=Ha(t,n,r))),a},ao=e=>e.replace(/\$/g,`$$$$`),oo=class{constructor(e={}){this.logger=Ga.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?La:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?Fa(i):a||`{{`,this.suffix=o?Fa(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?Fa(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?Fa(l):``,this.nestingPrefix=d?Fa(d):f||Fa(`$t(`),this.nestingSuffix=p?Fa(p):m||Fa(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=io(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(io(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>ao(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ao(this.escape(e)):ao(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=q(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!q(a)&&!this.useRawValueToEscape&&(a=wa(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${Fa(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!q(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!q(i))return i;q(i)||(i=wa(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},so=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||(n.currency=i.trim()):t===`relativetime`&&!i.includes(`:`)?n.range||(n.range=i.trim()):i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},co=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Ua(r),i),t[o]=s),s(n)}},lo=e=>(t,n,r)=>e(Ua(n),r)(t),uo=class{constructor(e={}){this.logger=Ga.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?co:lo;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=co(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=so(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},fo=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},po=class extends Ka{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Ga.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{ja(n.loaded,[i],a),fo(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();q(e)&&(e=this.languageUtils.toResolveHierarchy(e)),q(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},mo=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),q(e[1])&&(t.defaultValue=e[1]),q(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ho=e=>(q(e.ns)&&(e.ns=[e.ns]),q(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),q(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),go=()=>{},_o=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},J=class e extends Ka{constructor(e={},t){if(super(),this.options=ho(e),this.services={},this.logger=Ga,this.modules={external:[]},_o(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(q(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=mo();this.options={...n,...this.options,...ho(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Ga.init(r(this.modules.logger),this.options):Ga.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:uo;let t=new eo(this.options);this.store=new qa(this.options.resources,this.options);let n=this.services;n.logger=Ga,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new ro(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new oo(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new po(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new $a(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=go),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Ca(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=go){let n=t,r=q(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Ca();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=go),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Ja.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Ca();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=q(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(q(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Za(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Za(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Za(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return q(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Ca();return this.options.ns?(q(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Ca();q(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new eo(mo());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=go){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new qa(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...mo().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new oo(n)}return a.translator=new $a(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();J.createInstance,J.dir,J.init,J.loadResources,J.reloadResources,J.use,J.changeLanguage,J.getFixedT,J.t,J.exists,J.setDefaultNamespace,J.hasLoadedNamespace,J.loadNamespaces,J.loadLanguages;var vo=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);To(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},yo={},bo=(e,t,n,r)=>{To(n)&&yo[n]||(To(n)&&(yo[n]=new Date),vo(e,t,n,r))},xo=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},So=(e,t,n)=>{e.loadNamespaces(t,xo(e,n))},Co=(e,t,n,r)=>{if(To(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return So(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,xo(e,r))},wo=(e,t,n={})=>!t.languages||!t.languages.length?(bo(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),To=e=>typeof e==`string`,Eo=e=>typeof e==`object`&&!!e,Do=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Oo={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},ko=e=>Oo[e],Ao=e=>e.replace(Do,ko),jo={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:Ao,transDefaultProps:void 0},Mo=(e={})=>{jo={...jo,...e}},No=()=>jo,Po,Fo=e=>{Po=e},Io=()=>Po,Lo={type:`3rdParty`,init(e){Mo(e.options.react),Fo(e)}},Ro=(0,B.createContext)(),zo=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},Bo=n((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Vo=n(((e,t)=>{t.exports=Bo()}))(),Ho={t:(e,t)=>{if(To(t))return t;if(Eo(t)&&To(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Uo=()=>()=>{},Y=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,B.useContext)(Ro)||{},a=n||r||Io();a&&!a.reportNamespaces&&(a.reportNamespaces=new zo),a||bo(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,B.useMemo)(()=>({...No(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=To(l)?[l]:l||[`translation`],d=(0,B.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,B.useRef)(0),p=(0,B.useCallback)(e=>{if(!a)return Uo;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,B.useRef)(),h=(0,B.useCallback)(()=>{if(!a)return Ho;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>wo(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c,{scopeNs:d}),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,B.useState)(0),{t:v,ready:y}=(0,Vo.useSyncExternalStore)(p,h,h);(0,B.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?Co(a,t.lng,d,e):So(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,B.useRef)(null),S=(0,B.useRef)(),ee=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},C=(0,B.useMemo)(()=>{let e=b,t=e?.language,n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=ee(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(bo(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y)throw new Promise(e=>{let n=()=>e();t.lng?Co(a,t.lng,d,n):So(a,d,n)});return C},{slice:Wo,forEach:Go}=[];function Ko(e){return Go.call(Wo.call(arguments,1),t=>{if(t)for(let n in t)e[n]===void 0&&(e[n]=t[n])}),e}function qo(e){return typeof e==`string`?[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e)):!1}var Jo=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Yo=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:`/`},r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error(`maxAge should be a Number`);r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!Jo.test(n.domain))throw TypeError(`option domain is invalid`);r+=`; Domain=${n.domain}`}if(n.path){if(!Jo.test(n.path))throw TypeError(`option path is invalid`);r+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!=`function`)throw TypeError(`option expires is invalid`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:r+=`; SameSite=Strict`;break;case`lax`:r+=`; SameSite=Lax`;break;case`strict`:r+=`; SameSite=Strict`;break;case`none`:r+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return n.partitioned&&(r+=`; Partitioned`),r},Xo={create(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:`/`,sameSite:`strict`};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=Yo(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(`;`);for(let e=0;e<n.length;e++){let r=n[e];for(;r.charAt(0)===` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return r.substring(t.length,r.length)}return null},remove(e,t){this.create(e,``,-1,t)}},Zo={name:`cookie`,lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<`u`)return Xo.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:a}=t;n&&typeof document<`u`&&Xo.create(n,e,r,i,a)}},Qo={name:`querystring`,lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<`u`){let{search:e}=window.location;!window.location.search&&window.location.hash?.indexOf(`?`)>-1&&(e=window.location.hash.substring(window.location.hash.indexOf(`?`)));let r=e.substring(1).split(`&`);for(let e=0;e<r.length;e++){let i=r[e].indexOf(`=`);i>0&&r[e].substring(0,i)===t&&(n=r[e].substring(i+1))}}return n}},$o={name:`hash`,lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<`u`){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(t){let e=i.split(`&`);for(let n=0;n<e.length;n++){let i=e[n].indexOf(`=`);i>0&&e[n].substring(0,i)===t&&(r=e[n].substring(i+1))}}if(r)return r;if(!r&&n>-1){let t=e.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof n==`number`?n:0]?.replace(`/`,``):void 0}}}return r}},es=null,ts=()=>{if(es!==null)return es;try{if(es=typeof window<`u`&&window.localStorage!==null,!es)return!1;let e=`i18next.translate.boo`;window.localStorage.setItem(e,`foo`),window.localStorage.removeItem(e)}catch{es=!1}return es},ns={name:`localStorage`,lookup(e){let{lookupLocalStorage:t}=e;if(t&&ts())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&ts()&&window.localStorage.setItem(n,e)}},rs=null,is=()=>{if(rs!==null)return rs;try{if(rs=typeof window<`u`&&window.sessionStorage!==null,!rs)return!1;let e=`i18next.translate.boo`;window.sessionStorage.setItem(e,`foo`),window.sessionStorage.removeItem(e)}catch{rs=!1}return rs},as={name:`sessionStorage`,lookup(e){let{lookupSessionStorage:t}=e;if(t&&is())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&is()&&window.sessionStorage.setItem(n,e)}},os={name:`navigator`,lookup(e){let t=[];if(typeof navigator<`u`){let{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let n=0;n<e.length;n++)t.push(e[n]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},ss={name:`htmlTag`,lookup(e){let{htmlTag:t}=e,n,r=t||(typeof document<`u`?document.documentElement:null);return r&&typeof r.getAttribute==`function`&&(n=r.getAttribute(`lang`)),n}},cs={name:`path`,lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>`u`)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n[typeof t==`number`?t:0]?.replace(`/`,``)}},ls={name:`subdomain`,lookup(e){let{lookupFromSubdomainIndex:t}=e,n=typeof t==`number`?t+1:1,r=typeof window<`u`&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},us=!1;try{document.cookie,us=!0}catch{}var ds=[`querystring`,`cookie`,`localStorage`,`sessionStorage`,`navigator`,`htmlTag`];us||ds.splice(1,1);var fs=()=>({order:ds,lookupQuerystring:`lng`,lookupCookie:`i18next`,lookupLocalStorage:`i18nextLng`,lookupSessionStorage:`i18nextLng`,caches:[`localStorage`],excludeCacheFor:[`cimode`],convertDetectedLanguage:e=>e}),ps=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type=`languageDetector`,this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Ko(t,this.options||{},fs()),typeof this.options.convertDetectedLanguage==`string`&&this.options.convertDetectedLanguage.indexOf(`15897`)>-1&&(this.options.convertDetectedLanguage=e=>e.replace(`-`,`_`)),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Zo),this.addDetector(Qo),this.addDetector(ns),this.addDetector(as),this.addDetector(os),this.addDetector(ss),this.addDetector(cs),this.addDetector(ls),this.addDetector($o)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&typeof n==`string`&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>e!=null&&!qo(e)).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}};ps.type=`languageDetector`;var ms={common:{loading:`Loading...`,save:`Save`,saving:`Saving...`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,close:`Close`,back:`Back`,next:`Next`,confirm:`Confirm`,error:`Error`,success:`Success`,warning:`Warning`,or:`or`,optional:`optional`,enabled:`Enabled`,disabled:`Disabled`,on:`On`,off:`Off`,yes:`Yes`,no:`No`,search:`Search`,noResults:`No results found`,retry:`Retry`,refresh:`Refresh`,download:`Download`,upload:`Upload`,export:`Export`,import:`Import`,reset:`Reset`,apply:`Apply`,clear:`Clear`,all:`All`,none:`None`,default:`Default`,custom:`Custom`,remove:`Remove`},brand:{name:`Libre WebUI`,shortName:`Libre`},auth:{login:{title:`Welcome Back`,subtitle:`Sign in to your account to continue`,username:`Username`,usernamePlaceholder:`Enter your username`,password:`Password`,passwordPlaceholder:`Enter your password`,signIn:`Sign In`,signingIn:`Signing in...`,noAccount:`Don't have an account?`,signUpHere:`Sign up here`,loginSuccess:`Login successful!`,loginFailed:`Login failed`,checkCredentials:`Login failed. Please check your credentials.`,enterBoth:`Please enter both username and password`,githubSuccess:`GitHub login successful!`,githubFailed:`GitHub authentication failed`,githubVerifyFailed:`Failed to verify GitHub authentication`},signup:{title:`Create Account`,subtitle:`Sign up for your new account`,username:`Username`,usernamePlaceholder:`Choose a username`,email:`Email`,emailPlaceholder:`your@email.com`,password:`Password`,passwordPlaceholder:`Choose a password`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm your password`,createAccount:`Create Account`,creatingAccount:`Creating account...`,hasAccount:`Already have an account?`,signInHere:`Sign in here`,signupSuccess:`Account created successfully!`,signupFailed:`Signup failed`,tryAgain:`Signup failed. Please try again.`,usernameRequired:`Username and password are required`,passwordMismatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters long`},logout:{button:`Log out`,success:`Logged out successfully`},oauth:{continueWith:`Continue with {{provider}}`,connectingTo:`Connecting to {{provider}}...`,github:`GitHub`,huggingFace:`Hugging Face`},checkingAuth:`Checking authentication...`,welcome:`Welcome`,noEmail:`No email provided`,role:`Role`,id:`ID`,userId:`User ID`,signInDescription:`Sign in with your GitHub account to continue`,signInWithGitHub:`Sign in with GitHub`,jwtActive:`JWT Authentication Active`,jwtDescription:`JWT-based authentication with GitHub OAuth`,github:`GitHub`,provider:`Provider`},setup:{welcome:{title:`Welcome to Libre WebUI`,subtitle:`Let's Get Started`,description:`Set up your Libre WebUI instance in just a few steps`,createAdmin:`Create Admin Account`,features:{secure:{title:`Secure & Private`,description:`Your conversations stay on your device`},fast:{title:`Fast & Responsive`,description:`Optimized for speed and performance`},openSource:{title:`Open Source`,description:`Free and open source software`}}},admin:{title:`Create Admin Account`,subtitle:`Administrator Setup`,description:`Create the first admin account for your Libre WebUI instance`,usernamePlaceholder:`Enter admin username`,passwordPlaceholder:`Enter password (min 6 characters)`,confirmPlaceholder:`Confirm your password`,creating:`Creating...`,createAdmin:`Create Admin`,success:`Admin account created successfully!`,failed:`Failed to create admin account`,fillAllFields:`Please fill in all fields`,note:`This will be the primary administrator account for your Libre WebUI instance`},encryptionKey:{title:`Save Your Encryption Key`,subtitle:`Important: Save This Key`,description:`This encryption key protects your sensitive data. Store it securely - you'll need it if you ever need to restore your database.`,warning:`Warning`,warningText:`If you lose this key and need to restore your database, your encrypted data (API keys, preferences) will be unrecoverable.`,label:`Your Encryption Key`,loading:`Loading...`,copyToClipboard:`Copy to clipboard`,copied:`Encryption key copied to clipboard!`,copyFailed:`Failed to copy key to clipboard`,envNote:`This key is also saved in your backend/.env file as ENCRYPTION_KEY`,acknowledgment:`I have saved my encryption key in a secure location and understand that losing it may result in data loss.`,confirmRequired:`Please confirm that you have saved the encryption key`,continue:`Continue to Libre WebUI`}},chat:{greeting:{morning:`Good morning`,afternoon:`Good afternoon`,evening:`Good evening`,night:`Good night`},welcome:{helpToday:`What can I help with today?`,helpTonight:`What can I help with tonight?`,variety:{create:{title:`What should we make?`,subtitle:`Start with a thought, a sketch, or a stubborn problem.`},explore:{title:`Where should we begin?`,subtitle:`Bring the question you keep returning to.`},imagine:{title:`What are you imagining?`,subtitle:`We can shape it together.`},focus:{title:`What deserves your attention?`,subtitle:`Let's make the next step clear.`},untangle:{title:`What's tangled?`,subtitle:`Give me the messy version first.`},momentum:{title:`Ready when you are.`,subtitle:`Pick up an idea, plan, or unfinished thread.`},open:{title:`What's on your mind?`,subtitle:`Small thought or ambitious project. Both work.`},challenge:{title:`What are we solving?`,subtitle:`Tell me what isn't working yet.`},draft:{title:`Let's start somewhere.`,subtitle:`It doesn't have to be polished.`},possibility:{title:`What could this become?`,subtitle:`Show me the raw material.`},unexpected:{title:`Make something unexpected.`,subtitle:`Give me a constraint, a mood, or a half-formed idea.`}}},input:{placeholder:`Send a message`,messagePlaceholder:`Message...`,attachImages:`Attach images`,attachments:`Attachments and advanced features`,sendMessage:`Send message`,stopGeneration:`Stop generation`},session:{new:`New Chat`,private:`Private`,privateMode:`Private Mode`,privateDescription:`This conversation won't be saved`,privateTooltip:`Start a private conversation that won't be saved`,deleteConfirm:`Are you sure you want to delete this chat?`,generatingTitle:`Generating title`,noChats:`No chats yet`,createFirst:`Create your first chat above`,chats:`Chats`,renameChat:`Rename chat`,deleteChat:`Delete chat`},persona:{applied:`Persona applied`,label:`Persona`},model:{updated:`Model updated`,noModels:`No models available`,noModelsDescription:`No models available. Make sure Ollama is running and has models installed.`,pullCommand:`ollama pull llama3.2:3b`,noModelsTooltip:`No models available. Please ensure Ollama is running and models are installed.`},footer:{disclaimer:`LLM can make mistakes - verify important information`,images:`{{count}} image`,images_plural:`{{count}} images`,structuredOutput:`Structured output`},mediaUpload:{dropImagesHere:`Drop images here or`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 10MB each)`,browse:`browse`},structuredOutput:{title:`Response Format`,none:`None (Natural Language)`,noneDescription:`Default natural language response`,json:`JSON`,jsonDescription:`Structured JSON format`,list:`List`,listDescription:`Array of items`,summary:`Summary`,summaryDescription:`Document summary with key points`,analysis:`Analysis`,analysisDescription:`Structured analysis with pros/cons`,custom:`Custom Schema`,customDescription:`Define your own JSON schema`,customSchema:`Custom JSON schema`,schemaPreview:`Schema Preview`,applySchema:`Apply Schema`,cancel:`Cancel`,enabled:`Structured output enabled`}},sidebar:{navigation:{chat:`Chat`,models:`Models`,personas:`Personas`,imagine:`Imagine`,agents:`Libre Claw`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`},toggleSize:`Toggle sidebar size`,expandSidebar:`Expand sidebar`},user:{menu:{changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,logout:`Log out`},avatar:{title:`Change Profile Picture`,updated:`Profile picture updated`,updateFailed:`Failed to update profile picture`,saving:`Saving...`,label:`Avatar`,uploadAvatarImage:`Upload avatar image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 2MB). Square images work best.`,customAvatar:`Custom avatar image`,clickToChange:`Click to change or remove`,removed:`Avatar removed`,uploaded:`Avatar uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Avatar image size must be less than 2MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload avatar image`},profile:{noEmail:`No email provided`}},settings:JSON.parse(`{"title":"Settings","tabs":{"appearance":"Appearance","model":"Model","systemMessage":"System Message","plugins":"Plugins","generation":"Generation","documents":"Documents","tts":"Text-to-Speech","imageGen":"Image Generation","data":"Data","about":"About"},"appearance":{"title":"Appearance","language":{"title":"Language","description":"Select your preferred language"},"theme":{"title":"Theme","light":"Light","dark":"Dark","amoled":"Pure Black","system":"System"},"accent":{"title":"Accent color","custom":"Custom color","useColor":"Use {{color}} accent","behaviorTitle":"Interface palette","behaviorDescription":"Choose whether the accent stays on controls or adapts the entire light or dark interface.","defaultStyle":"Default","defaultStyleDescription":"Keep the neutral light and dark surfaces.","adaptedStyle":"Adapt to accent","adaptedStyleDescription":"Tint surfaces, borders, and text with your accent."},"chatInterface":{"title":"Chat Interface","showUsername":"Show Username","showUsernameDescription":"Display username in chat messages"},"background":{"title":"Background Image","enable":"Enable background image","enableDescription":"Show custom background with blur effect","blur":"Blur","opacity":"Opacity","upload":"Upload background image","dragDrop":"Drag and drop an image or click to browse","chooseImage":"Choose Image"}},"saveSettings":"Save Settings","model":{"title":"Model Settings","defaultModel":"Default Model","defaultModelDescription":"This model will be used by default for new conversations","selectModel":"Select a model","persona":"Persona","updateAll":"Update All Models","updateAllDescription":"Check for updates and pull latest versions of all installed models","updateAllButton":"Update All","updating":"Updating models...","currentModelInfo":"Current Model Info","name":"Name","size":"Size","family":"Family","format":"Format","status":"Status","statusStarting":"Starting...","statusComplete":"Complete","statusError":"Error","bulkOperations":"Bulk Operations","autoTitle":{"title":"Auto Title Generation","enable":"Enable Auto Title","enableDescription":"Automatically generate titles for new conversations","taskModel":"Task Model","selectTaskModel":"Select task model","taskModelDescription":"Model used for generating conversation titles"},"updatingModel":"Updating {{name}} ({{current}}/{{total}})","modelsProgress":"{{current}} of {{total}} models","modelPullAccess":"Model Install Access","modelPullAccessDescription":"Allow non-admin users to pull and install new models.","modelPullAccessSaved":"Model install permissions updated","modelPullAccessSaveFailed":"Failed to update model install permissions"},"systemMessage":{"title":"System Message","description":"Set a custom system message that will be used for all new conversations.","placeholder":"Enter a system message...","saved":"System message saved","saveFailed":"Failed to save system message"},"plugins":{"title":"Plugins","description":"Manage your installed plugins","addNew":"Add New Plugin","upload":"Upload Plugin","addJson":"Add JSON","uploading":"Uploading...","jsonPlaceholder":"Paste plugin JSON configuration...","install":"Install Plugin","noPlugins":"No plugins installed","noPluginsDescription":"Add a plugin to extend functionality","loading":"Loading plugins...","installed":"Installed Plugins","active":"Active Plugins","activeLabel":"Active","inactive":"Inactive","activate":"Activate","deactivate":"Deactivate","models":"models","apiKeySet":"API Key Set","apiKeyConfiguration":"API Key Configuration","apiKeyEnvAlternative":"Alternatively, set the","environmentVariable":"environment variable","apiKeyConfigured":"API key configured","apiKeyPlaceholder":"Enter your API key...","saveApiKey":"Save API Key","apiKey":{"title":"API Key","placeholder":"Enter API key","save":"Save Key","remove":"Remove Key","configured":"API Key Configured","notConfigured":"API Key Required","saved":"API key saved successfully","removed":"API key removed","saveFailed":"Failed to save API key","removeFailed":"Failed to remove API key","enterKey":"Please enter an API key"},"variables":"Variables"},"generation":{"title":"Generation Options","description":"Configure how the AI generates responses","coreParameters":"Core Parameters","temperature":"Temperature","temperatureDescription":"Controls randomness. Lower values are more focused, higher values more creative.","topP":"Top P","topPDescription":"Controls diversity via nucleus sampling. Lower values focus on likely tokens.","topK":"Top K","topKDescription":"Limits token selection to top K most likely. Set to 0 to disable.","minP":"Min P","minPDescription":"Minimum probability threshold for token selection.","generationControl":"Generation Control","maxTokens":"Max Tokens","maxTokensDescription":"Maximum number of tokens to generate in the response.","repeatPenalty":"Repeat Penalty","repeatPenaltyDescription":"Penalizes repeated tokens. Higher values reduce repetition.","contextLength":"Context Length","contextLengthDescription":"Maximum context window size for conversations.","seed":"Seed","optional":"optional","random":"Random","seedDescription":"Set a specific seed for reproducible outputs.","advancedOptions":"Advanced Options","presencePenalty":"Presence Penalty","presencePenaltyDescription":"Penalizes tokens that appear in the context.","frequencyPenalty":"Frequency Penalty","frequencyPenaltyDescription":"Penalizes frequently used tokens.","stopSequences":"Stop Sequences","commaSeparated":"comma separated","stopSequencesDescription":"Custom tokens that will stop generation when encountered.","resetDefaults":"Reset to Defaults","saveOptions":"Save Options","embeddingSettings":"Embedding Settings","enableEmbeddings":"Enable Document Embeddings"},"documents":{"title":"Document Settings","embeddings":{"title":"Embeddings","enable":"Enable document embeddings","model":"Embedding Model","modelDescription":"Select the model used for document embedding","chunkSize":"Chunk Size","chunkSizeInTokens":"(in tokens)","chunkSizeDescription":"Size of text chunks for embedding","chunkOverlap":"Chunk Overlap","chunkOverlapInTokens":"(in tokens)","chunkOverlapDescription":"Overlap between consecutive chunks","similarityThreshold":"Similarity Threshold","similarityDescription":"Minimum similarity score to include results","status":"Embedding Status","statusLabel":"Status","available":"Available","unavailable":"Unavailable","chunksWithEmbeddings":"Chunks with embeddings","coverage":"Coverage","regenerate":"Regenerate Embeddings","regenerating":"Regenerating..."}},"tts":{"title":"Text-to-Speech","description":"Configure text-to-speech settings for reading messages aloud","loadingProviders":"Loading TTS providers...","noProviders":"No TTS Providers","noProvidersDescription":"Configure a plugin with TTS support to enable text-to-speech","enable":"Enable TTS","enableDescription":"Allow text-to-speech for assistant messages","autoPlay":"Auto-play Responses","autoPlayDescription":"Automatically read new assistant messages aloud","streamSentences":"Stream Sentences","streamSentencesDescription":"Play audio sentence by sentence instead of waiting for the full message. Recommended for local TTS to avoid timeouts on long messages.","voiceConfiguration":"Voice Configuration","model":"TTS Model","modelDescription":"Select the model for text-to-speech generation","voice":"Voice","selectVoice":"Select a voice","voiceDescription":"Choose the voice for text-to-speech","speed":"Speed","speedSlow":"0.5x","speedNormal":"1.0x","speedFast":"2.0x","availableProviders":"Available Providers","models":"models","test":"Test","testing":"Testing...","stop":"Stop"},"imageGen":{"title":"Image Generation","description":"Configure image generation settings and providers","loadingProviders":"Loading image generation providers...","noProviders":"No Image Generation Providers","noProvidersDescription":"Configure a plugin with image generation support","enable":"Enable Image Generation","enableDescription":"Allow AI image generation in conversations","configuration":"Configuration","model":"Model","modelDescription":"Select the model for image generation","size":"Size","sizeDescription":"Resolution of generated images","quality":"Quality","qualityDescription":"Quality level of generated images","style":"Style","styleDescription":"Style preset for generated images","availableProviders":"Available Providers","models":"models"},"data":{"title":"Data Management","export":"Export Data","exportDescription":"Download all your data including preferences, sessions, and documents.","exportAll":"Export All Data","import":"Import Data","importDescription":"Import data from a previous export.","importData":"Import Data","importing":"Importing...","clearSessions":"Clear Sessions","clearSessionsDescription":"Delete all chat sessions. This action cannot be undone.","clearAll":"Clear All","clearing":"Clearing...","importOptions":"Import Options","importOptionsDescription":"Choose how to handle existing data","skipDuplicates":"Skip duplicates","overwrite":"Overwrite existing","importResults":"Import Results","preferences":"Preferences","imported":"Imported","failed":"Failed","sessions":"Sessions","importedLabel":"imported","skipped":"skipped","documents":"Documents","errors":"Errors"},"about":{"title":"About","versionLabel":"Version","ollama":{"title":"Ollama Status","version":"Version","healthy":"Healthy","unhealthy":"Unhealthy"},"stats":{"models":"Models","sessions":"Sessions"},"features":{"privacy":{"title":"Privacy First","description":"Your data stays on your device"},"openSource":{"title":"Open Source","description":"Free and open source software"},"localInference":{"title":"Local Inference","description":"Run AI models locally with Ollama"}},"openSourceBy":"Open source by {{company}}","links":{"title":"Links","github":"GitHub","githubDescription":"View source code and contribute","website":"Website","websiteDescription":"Visit our website","ollama":"Ollama","ollamaDescription":"Learn more about Ollama","documentation":"Documentation","reportIssue":"Report Issues","reportIssueDescription":"Bug reports & feature requests","gitlab":"GitLab Mirror","gitlabDescription":"Self-hosted GitLab repository","documentationDescription":"Guides, tutorials and API reference"},"version":"Version {{version}}"}}`),models:{title:`Models`,subtitle:`Pull, manage, and monitor your Ollama models`,installed:`Installed Models`,available:`Available Models`,pull:`Pull Model`,pulling:`Pulling...`,delete:`Delete Model`,deleting:`Deleting...`,size:`Size`,modified:`Modified`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,noModels:`No models installed`,pullFirst:`Pull a model to get started`,noModelsFound:`No models found`},personas:{title:`Personas`,create:`Create Persona`,edit:`Edit Persona`,delete:`Delete Persona`,name:`Name`,description:`Description`,systemPrompt:`System Prompt`,model:`Model`,avatar:`Avatar`,background:`Background`,noPersonas:`No personas created`,createFirst:`Create your first persona to customize your chat experience`},gallery:{title:`Gallery`,subtitle:`Your AI-generated image gallery`,imageCount:`{{count}} images`,generate:`Generate Image`,generateDescription:`Create images with AI`,generating:`Generating...`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to generate...`,noImages:`No images generated yet`,download:`Download`,delete:`Delete`,regenerate:`Regenerate`,model:`Model`,size:`Size`,quality:`Quality`,created:`Created`},errors:{generic:`An error occurred`,network:`Network error. Please check your connection.`,unauthorized:`You are not authorized to perform this action.`,notFound:`The requested resource was not found.`,serverError:`Server error. Please try again later.`,validation:`Please check your input and try again.`},keyboard:{title:`Keyboard Shortcuts`,toggleSidebar:`Toggle sidebar`,openSettings:`Open settings`,toggleDarkMode:`Toggle dark mode`,showShortcuts:`Show keyboard shortcuts`,closeModals:`Close modals`,groups:{navigation:`Navigation`,settings:`Settings`,general:`General`,chat:`Chat`},actions:{sendMessage:`Send message`,newLine:`New line in message`},footer:`Press {{key1}} or {{key2}} to show this help`,tooltip:`Keyboard shortcuts`},modelManager:{title:`Models`,loading:`Loading models...`,systemStatus:{online:`Ollama Online`,offline:`Ollama Offline`,models:`model`,models_plural:`models`,running:`running`,vram:`VRAM`},sections:{pull:`Pull New Model`,library:`Browse Library`,huggingface:`HuggingFace Hub`,running:`Running Models`,local:`Local Models`,advanced:`Advanced Actions`},pull:{placeholder:`Enter model name (e.g., llama3.2:3b, deepseek-r1:14b)`,button:`Pull`,cancel:`Cancel`,popular:`Popular models:`,browseAll:`Browse all models on ollama.com`,success:`Model {{name}} pulled successfully`,cancelled:`Model pull cancelled`,failed:`Failed to pull model`,enterName:`Please enter a model name`,restricted:`Model installation is restricted to administrators on this instance.`},progress:{starting:`Initializing...`,pulling:`Downloading model...`,pullingLayer:`pulling`,verifying:`Verifying integrity...`,verifyingDigest:`verifying sha256 digest`,writing:`Writing manifest...`,cleaning:`Cleaning up...`},library:{available:`available`,search:`Search models...`,noResults:`No models found matching your criteria`,installed:`Installed`,more:`+{{count}} more`,refresh:`Refresh Library`},huggingface:{browseAll:`Browse all on HuggingFace`,checkingGguf:`Checking for GGUF files...`,noGgufAvailable:`No GGUF files available for direct Ollama pull`,ggufFilesCount:`GGUF Files ({{count}}) - Pull directly to Ollama`,noModelsFound:`No models found`,noResults:`No models found. Try adjusting your search or filters.`,browseAllLink:`Browse all`,search:`Search HuggingFace models...`,by:`by`,gated:`Gated`,viewOnHF:`View on HuggingFace`,sortDownloads:`Downloads`,sortLikes:`Likes`,sortRecent:`Recent`,taskTextGeneration:`Text Generation`,taskTextToSpeech:`Text to Speech`,taskTextToImage:`Text to Image`,taskSpeechRecognition:`Speech Recognition`,tasks:{textGen:`Text Generation`,tts:`Text to Speech`,image:`Text to Image`,stt:`Speech Recognition`},sort:{downloads:`Most Downloads`,likes:`Most Liked`,recent:`Recently Updated`}},local:{noModels:`No models installed yet`,pullToStart:`Pull a model above to get started`,installed:`installed`,running:`Running`,info:`Info`,copy:`Copy`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete model "{{name}}"?`,deleteSuccess:`Model {{name}} deleted successfully`,deleteFailed:`Failed to delete model`},advanced:{createModel:`Create Model`,fromModelfile:`From Modelfile`,copyModel:`Copy Model`,duplicateExisting:`Duplicate existing`,testEmbeddings:`Test Embeddings`,generateVectors:`Generate vectors`,healthCheck:`Health Check`,testConnection:`Test connection`,healthy:`Ollama is healthy!`},modals:{details:{title:`Model Details`,info:`Model Information`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,format:`Format`,systemPrompt:`System Prompt`,template:`Template`,license:`License`,modelfile:`Modelfile`,noDetails:`No details available`},copy:{title:`Copy Model`,source:`Source Model`,selectModel:`Select a model...`,newName:`New Model Name`,placeholder:`e.g., my-custom-model`,copying:`Copying...`,button:`Copy Model`,success:`Model copied to {{name}}`,failed:`Failed to copy model`,enterBoth:`Please enter both source and destination names`},create:{title:`Create Custom Model`,name:`Model Name`,namePlaceholder:`e.g., my-assistant`,modelfile:`Modelfile`,modelfilePlaceholder:`FROM llama3.2
5
- SYSTEM You are a helpful assistant.`,see:`See`,docs:`Modelfile docs`,docsLink:`for syntax reference`,creating:`Creating...`,button:`Create Model`,success:`Model {{name}} created successfully`,failed:`Failed to create model`,enterBoth:`Please enter model name and Modelfile content`},embeddings:{title:`Test Embeddings`,model:`Embedding Model`,selectModel:`Select a model...`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large`,input:`Input Text`,placeholder:`Enter text to generate embeddings for...`,generating:`Generating...`,button:`Generate Embeddings`,result:`Result ({{count}} dimensions)`,success:`Generated {{count}}-dimensional embedding vector`,failed:`Failed to generate embeddings`,enterBoth:`Please select a model and enter text`}}},personaManager:{title:`Personas`,subtitle:`Create and manage AI personas with custom personalities, memories, and behaviors`,loading:`Loading personas...`,createButton:`Create Persona`,importExport:`Import/Export`,stats:{title:`Your Personas`,count:`{{count}} persona created`,count_plural:`{{count}} personas created`},empty:{title:`No personas yet`,description:`Create your first persona to get started with personalized AI interactions`,button:`Create Your First Persona`},deleteConfirm:`Are you sure you want to delete "{{name}}"?`,deleteSuccess:`Persona "{{name}}" deleted successfully`,downloadSuccess:`Persona "{{name}}" downloaded successfully`,failed:`Failed to {{action}} persona`},personaForm:{title:{create:`Create New Persona`,edit:`Edit Persona`},subtitle:{create:`Create a new AI persona with custom personality, memory systems, and adaptive learning capabilities`,edit:`Customize your AI persona with advanced memory, adaptive learning, and intelligent parameters`},loading:`Loading form...`,saved:`Saved`,tabs:{basic:`Basic`,parameters:`Parameters`,memory:`Memory & Learning`,advanced:`Advanced`},basic:{name:`Name`,namePlaceholder:`Enter persona name`,model:`Model`,selectModel:`Select a model`,description:`Description`,descriptionPlaceholder:`Describe your persona...`,systemPrompt:`System Prompt`,systemPromptPlaceholder:`Enter the system prompt that defines your persona behavior...`,systemPromptHint:`The system prompt defines how your persona will behave and respond.`},parameters:{temperature:`Temperature`,temperatureHint:`Controls creativity vs consistency`,topP:`Top-P`,topPHint:`Controls response diversity`,topK:`Top-K`,topKHint:`Limits vocabulary to top-k tokens`,contextWindow:`Context Window`,contextWindowHint:`Maximum conversation history length`,maxTokens:`Max Tokens`,maxTokensHint:`Maximum response length`,repeatPenalty:`Repeat Penalty`,repeatPenaltyHint:`Reduces repetitive responses`},memory:{title:`Memory System`,subtitle:`Persona remembers conversations over time`,enableHint:`Enable the memory system to let your persona remember conversations and build context over time.`,loading:`Loading memory status...`,noData:`No memory data yet`,memories:`Memories`,mbUsed:`MB Used`,lastBackup:`Last Backup`,never:`Never`,maxMemories:`Maximum Memories`,maxMemoriesHint:`How many memories this persona can store`,retention:`Memory Retention`,retentionHint:`Days to keep memories before cleanup`,autoCleanup:`Auto-cleanup old memories`,wipeAll:`Wipe All Memories`,wipeCannot:`This cannot be undone`,wipeButton:`Wipe`,wiping:`Wiping...`,wipeConfirm:`Are you sure you want to wipe all memories? This cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`},learning:{title:`Adaptive Learning`,subtitle:`Persona evolves based on interactions`,enableHint:`Enable adaptive learning to let your persona evolve and personalize responses based on your interactions.`,speed:`Learning Speed`,slow:`Slow`,slowDesc:`Gradual changes`,balanced:`Balanced`,balancedDesc:`Moderate pace`,fast:`Fast`,fastDesc:`Quick adaptation`,autoAdapt:`Auto-adapt to user preferences`,whatLearns:`What the persona learns:`,conversationTone:`Conversation tone`,responseStyle:`Response style`,userPreferences:`User preferences`,topicInterests:`Topic interests`},advanced:{embeddingModel:`Embedding Model`,embeddingHint:`Select the model used for memory encoding and semantic search. Embedding models are shown first, followed by other available models.`,noModels:`No models found`,embeddingModels:`Embedding Models`,otherModels:`Other Models`,installHint:`Install an embedding model:`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large, bge-m3, snowflake-arctic-embed`,aboutTitle:`About Advanced Settings`,aboutDescription:`The embedding model is used by the memory system to understand semantic meaning and find relevant memories during conversations. Choose a model that matches your use case and available resources.`},actions:{cancel:`Cancel`,save:`Save`,saving:`Saving...`,saveClose:`Save & Close`,create:`Create`},success:{created:`Persona created`,updated:`Persona updated`},error:{saveFailed:`Failed to save`}},personaCard:{enhanced:`Enhanced`,systemPrompt:`System Prompt`,memories:`memories`,use:`Use`,editTooltip:`Edit persona`,downloadTooltip:`Download persona`,backup:`Backup`,exportDNA:`Export DNA`,wipeMemories:`Wipe Memories`,wipeConfirm:`Are you sure you want to wipe all memories for this persona? This action cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`,backupSuccess:`Persona backup downloaded successfully`,dnaSuccess:`Persona DNA exported successfully`,failed:`Failed to {{action}}`},userManager:{title:`User Management`,subtitle:`Manage user accounts and permissions`,pageDescription:`Manage user accounts, permissions, and access controls for your Libre WebUI instance.`,loading:`Loading users...`,createUser:`Create User`,search:`Search users...`,noUsers:`No users found`,noUsersMatching:`No users matching your search`,columns:{user:`User`,email:`Email`,role:`Role`,created:`Created`,actions:`Actions`},roles:{admin:`Admin`,user:`User`},noEmail:`No email`,deleteConfirm:`Are you sure you want to delete user "{{name}}"?`,deleteSuccess:`User deleted successfully`,deleteFailed:`Failed to delete user`,cannotDeleteSelf:`You cannot delete your own account`,form:{title:{create:`Create User`,edit:`Edit User`},username:`Username`,usernamePlaceholder:`Enter username`,email:`Email`,emailPlaceholder:`Enter email (optional)`,password:`Password`,passwordPlaceholder:`Enter password`,passwordHint:`Leave blank to keep current password`,role:`Role`,creating:`Creating...`,updating:`Updating...`,createButton:`Create User`,updateButton:`Update User`,createSuccess:`User created successfully`,updateSuccess:`User updated successfully`,createFailed:`Failed to create user`,updateFailed:`Failed to update user`}},chatMessage:{you:`You`,assistant:`Assistant`,system:`System`,copy:`Copy`,copyMessage:`Copy message`,copied:`Copied!`,regenerate:`Regenerate`,regenerateResponse:`Regenerate response`,edit:`Edit`,editSystemMessage:`Edit system message`,saveChanges:`Save changes`,cancelEditing:`Cancel editing`,delete:`Delete`,deleteConfirm:`Delete this message?`,branch:`Branch`,speaking:`Speaking...`,speakMessage:`Speak message`,stopSpeaking:`Stop speaking`,showMore:`Show more`,showLess:`Show less`,thinking:`Thinking`,systemMessagePlaceholder:`Enter your system message...`,fullSizeImage:`Full size image`,startConversation:`Start a conversation`,startConversationDescription:`Send a message to begin chatting with your AI assistant. Ask questions, get help with code, or have a natural conversation.`,scrollToBottom:`Scroll to bottom`,newMessages:`New messages`},imageGallery:{title:`Image Gallery`,noImages:`No images yet`,noImagesHint:`Generate your first image using the panel on the right`,delete:`Delete`,download:`Download`,deleteConfirm:`Are you sure you want to delete this image?`,deleteSuccess:`Image deleted`,deleteFailed:`Failed to delete image`,downloadFailed:`Failed to download image`,loadMore:`Load More ({{current}} of {{total}})`,loadFailed:`Failed to load gallery`},imageGeneration:{title:`Generate Image`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to create...`,model:`Model`,selectModel:`Select model`,noModels:`No image generation models available`,configurePlugin:`Configure a plugin with image generation support`,size:`Size`,quality:`Quality`,style:`Style`,generate:`Generate`,generating:`Generating...`,success:`Image generated successfully`,failed:`Failed to generate image`,enterPrompt:`Please enter a prompt`,promptTooLong:`Prompt exceeds maximum length of {{max}} characters`},errorBoundary:{title:`Something went wrong`,description:`We encountered an unexpected error. Please try refreshing the page.`,tryAgain:`Refresh Page`,goHome:`Go to Home`,errorDetails:`Error Details (Development)`},documents:{title:`Documents`,upload:`Upload Document`,uploading:`Uploading...`,noDocuments:`No documents uploaded`,uploadHint:`Upload documents to use in your conversations`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete this document?`,deleteSuccess:`Document deleted`,deleteFailed:`Failed to delete document`,uploadSuccess:`Document uploaded successfully`,uploadFailed:`Failed to upload document`,types:`Supported: PDF, TXT, MD, DOCX`,unsupportedFileType:`Only PDF and TXT files are supported`,fileSizeTooLarge:`File size must be less than 10MB`,uploadSuccessWithName:`Document "{{name}}" uploaded successfully`,removeSuccess:`Document removed successfully`,removeFailed:`Failed to remove document`,removeError:`An error occurred while removing the document`,clickToUpload:`Click to upload`,orDragAndDrop:`or drag and drop`,fileTypesAndSize:`PDF or TXT files up to 10MB`,uploadedDocuments:`Uploaded Documents`,removeDocument:`Remove document`},ttsButton:{speak:`Speak`,stop:`Stop`,speaking:`Speaking...`,generateFailed:`Failed to generate speech`,playbackFailed:`Audio playback failed`,stopSpeaking:`Stop speaking`,generatingSpeech:`Generating speech...`,readAloud:`Read aloud`},artifacts:{title:`Artifacts`,code:`Code`,preview:`Preview`,copy:`Copy code`,copied:`Copied!`,download:`Download`,expand:`Expand`,collapse:`Collapse`,openInNewTab:`Open in new tab`,invalidSvg:`Invalid SVG content`,invalidJson:`Invalid JSON content`,previewMode:`Preview mode`,codeMode:`Code mode`,copyContent:`Copy content`,openInPanel:`Open in panel`,openInNewWindow:`Open in new window`,created:`Created`,closePanelEsc:`Close panel (Esc)`,copyButton:`Copy`,open:`Open`,dragEdgeToResize:`Drag edge to resize`,previewUnavailable:`Preview unavailable`,previewUnavailableDescription:`This artifact does not contain renderable preview content. Switch to code view to inspect the source.`},personaImportExport:{title:`Import & Export Personas`,description:`Export your personas to share them or import personas from others`,exportPersonas:`Export Personas`,importPersonas:`Import Personas`,noPersonasToExport:`No personas to export`,personasAvailable:`{{count}} persona available`,personasAvailable_plural:`{{count}} personas available`,exportAll:`Export All`,uploadJsonFile:`Upload JSON File`,pasteJsonLabel:`Paste JSON Data`,pasteJsonPlaceholder:`Paste persona JSON data here...`,importing:`Importing...`,importButton:`Import Persona(s)`,expectedFormat:`Expected JSON Format:`,exportSuccess:`Persona "{{name}}" exported successfully`,exportFailed:`Failed to export persona`,exportAllSuccess:`All {{count}} personas exported successfully`,exportAllFailed:`Failed to export personas`,pasteJsonData:`Please paste the persona JSON data`,importMultipleSuccess:`Successfully imported {{count}} personas`,importMultipleFailed:`Failed to import {{count}} personas`,importNoneFailed:`Failed to import any personas`,importSuccess:`Persona imported successfully`,importFailed:`Failed to import persona`},generationStats:{details:`Details`,promptTokens:`Prompt tokens:`,generatedTokens:`Generated tokens:`,totalTokens:`Total tokens:`,speed:`Speed:`,promptEval:`Prompt eval:`,generation:`Generation:`,modelLoad:`Model load:`,totalTime:`Total time:`,generatedAt:`Generated at:`},userMenu:{loggedOut:`Logged out successfully`,pictureUpdated:`Profile picture updated`,failedUpdateAvatar:`Failed to update avatar`,failedUpdatePicture:`Failed to update profile picture`,noEmail:`No email provided`,changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`,changeProfilePicture:`Change Profile Picture`},pluginManager:{title:`Plugin Manager`,upload:`Upload`,addJson:`Add JSON`,browseHF:`Browse HF Hub`,confirmDelete:`Are you sure you want to delete this plugin?`,uploading:`Uploading plugin...`,pasteJson:`Paste plugin JSON here...`,installPlugin:`Install Plugin`,loading:`Loading plugins...`,noPlugins:`No Plugins Installed`,noPluginsDescription:`Upload a plugin file or add a plugin from JSON to get started.`,active:`Active`,id:`ID`,endpoint:`Endpoint`,activate:`Activate`,deactivate:`Deactivate`,activePlugin:`Active Plugin`,activePluginDescription:`All chat requests will be routed through this plugin`,variables:{title:`Variables`,save:`Save`,saving:`Saving...`,saved:`Variables saved`,saveFailed:`Failed to save variables`,resetDefaults:`Reset to Defaults`,reset:`Variables reset to defaults`,sensitiveSet:`Value is set (enter new value to change)`}},huggingface:{title:`HuggingFace Model Browser`,subtitle:`Browse and select models from the Hub`,searchPlaceholder:`Search models...`,filters:`Filters`,task:`Task`,sortBy:`Sort By`,noModels:`No models found`,adjustSearch:`Try adjusting your search or filters`,gated:`Gated`,selected:`Selected`,select:`Select`,refresh:`Refresh`,modelsFound:`models found`},demoMode:{title:`Demo Mode`,github:`GitHub`},libreClaw:{title:`Libre Claw`,subtitle:`Local agent runs, approvals, schedules, memory, tools, and usage.`,dashboard:`Dashboard`,connection:{disconnectedTitle:`Libre Claw daemon is not connected`,disconnectedDescription:`Start it locally with <command>libre-claw start</command> or set <env>LIBRE_CLAW_BASE_URL</env> in the backend environment.`},status:{connected:`Connected`,disconnected:`Disconnected`,activeRuns:`{{count}} active`,activeRuns_plural:`{{count}} active`},states:{queued:`Queued`,running:`Running`,blocked:`Blocked`,done:`Done`,failed:`Failed`,cancelled:`Cancelled`},startRun:{title:`Start Agent Run`,placeholder:`Ask Libre Claw to inspect a repo, fix a bug, run a review, schedule a report...`,chatRun:`Chat run`,goalMode:`Goal mode`,providerOverride:`Provider override`,modelOverride:`Model override`,run:`Run`},modelRoute:{title:`Model Route`,providerPlaceholder:`provider`,modelPlaceholder:`model`,persistGlobal:`Persist to Libre Claw global config`,saveModel:`Save model`,theme:`Libre Claw theme`,saveTheme:`Save theme`},runs:{title:`Runs`,empty:`No Libre Claw runs yet.`},timeline:{title:`Run Timeline`,empty:`Select a run to inspect its events.`,streaming:`Streaming...`,assistantResponse:`Assistant response`,resultOk:`ok`,resultError:`error`,labels:{userMessage:`User message`,toolCall:`Tool call`,toolResult:`Tool result`,approvalRequest:`Approval request`,approvalResponse:`Approval response`,runStarted:`Run started`,runFinished:`Run finished`,usage:`Usage`,error:`Error`}},approvals:{needed:`Approval needed`,allowOnce:`Allow once`,alwaysAllowTool:`Always allow tool`,deny:`Deny`,toolApprovalRequested:`Tool approval requested`},automations:{title:`Automations`,namePlaceholder:`Name`,schedulePlaceholder:`daily 09:00`,promptPlaceholder:`Automation prompt`,create:`Create`,empty:`No scheduled Libre Claw automations.`,runNow:`Run now`,pause:`Pause`,resume:`Resume`,routes:{report:`Report`,telegram:`Telegram`},status:{active:`Active`,paused:`Paused`}},usageFallback:{title:`Usage And Fallback`,usage:`Usage`,fallbackRoute:`Fallback Route`,noUsage:`No usage records yet.`},metrics:{provider:`Provider`,model:`Model`,input:`Input`,output:`Output`,cached:`Cached`,reasoning:`Reasoning`,cost:`Cost`,tool:`Tool`,resolution:`Resolution`,state:`State`,stopReason:`Stop reason`,tokens:`{{formatted}} token`,tokens_plural:`{{formatted}} tokens`},fallbacks:{tool:`tool`,unknown:`unknown`,resolved:`resolved`,unknownError:`Unknown error`},toasts:{loadStatusFailed:`Could not load Libre Claw status`,enterTask:`Enter a task for Libre Claw`,runStarted:`Libre Claw run started`,startRunFailed:`Could not start Libre Claw run`,runCancelled:`Run cancelled`,cancelRunFailed:`Could not cancel run`,approved:`Approved`,denied:`Denied`,resolvePermissionFailed:`Could not resolve permission`,providerModelRequired:`Provider and model are required`,modelUpdated:`Libre Claw model updated`,updateModelFailed:`Could not update model`,themeUpdated:`Libre Claw theme updated`,updateThemeFailed:`Could not update theme`,automationRequired:`Automation name, schedule, and prompt are required`,automationCreated:`Automation created`,createAutomationFailed:`Could not create automation`,automationUpdated:`Automation updated`,updateAutomationFailed:`Could not update automation`}},personaBackground:{label:`Background Image`,uploadBackgroundImage:`Upload background image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 5MB). Wide landscape images work best.`,customBackground:`Custom background image`,clickToChange:`Click to change or remove`,removed:`Background removed`,uploaded:`Background uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Background image size must be less than 5MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload background image`},modelSelector:{searchInstalled:`Search installed models...`,searchOllama:`Search Ollama library...`,searchHuggingFace:`Search HuggingFace...`,selectModel:`Select Model`,personas:`Personas`,ollamaModels:`Ollama Models`,pluginModels:`Plugin Models`,actions:`Actions`,installed:`Installed`,use:`Use`,pull:`Pull`,pullRestricted:`Model installation is restricted to administrators on this instance.`,adminOnlyPull:`Admins only`}},hs={en:{translation:ms}},gs=[{code:`en`,name:`English`,nativeName:`English`,dir:`ltr`},{code:`ar`,name:`Arabic`,nativeName:`العربية`,dir:`rtl`},{code:`bn`,name:`Bengali`,nativeName:`বাংলা`,dir:`ltr`},{code:`cs`,name:`Czech`,nativeName:`Čeština`,dir:`ltr`},{code:`da`,name:`Danish`,nativeName:`Dansk`,dir:`ltr`},{code:`de`,name:`German`,nativeName:`Deutsch`,dir:`ltr`},{code:`es`,name:`Spanish`,nativeName:`Español`,dir:`ltr`},{code:`fr`,name:`French`,nativeName:`Français`,dir:`ltr`},{code:`hi`,name:`Hindi`,nativeName:`हिन्दी`,dir:`ltr`},{code:`id`,name:`Indonesian`,nativeName:`Bahasa Indonesia`,dir:`ltr`},{code:`is`,name:`Icelandic`,nativeName:`Íslenska`,dir:`ltr`},{code:`it`,name:`Italian`,nativeName:`Italiano`,dir:`ltr`},{code:`ja`,name:`Japanese`,nativeName:`日本語`,dir:`ltr`},{code:`ko`,name:`Korean`,nativeName:`한국어`,dir:`ltr`},{code:`ms`,name:`Malay`,nativeName:`Bahasa Melayu`,dir:`ltr`},{code:`nl`,name:`Dutch`,nativeName:`Nederlands`,dir:`ltr`},{code:`pl`,name:`Polish`,nativeName:`Polski`,dir:`ltr`},{code:`pt`,name:`Portuguese`,nativeName:`Português`,dir:`ltr`},{code:`ru`,name:`Russian`,nativeName:`Русский`,dir:`ltr`},{code:`sv`,name:`Swedish`,nativeName:`Svenska`,dir:`ltr`},{code:`th`,name:`Thai`,nativeName:`ไทย`,dir:`ltr`},{code:`tr`,name:`Turkish`,nativeName:`Türkçe`,dir:`ltr`},{code:`uk`,name:`Ukrainian`,nativeName:`Українська`,dir:`ltr`},{code:`vi`,name:`Vietnamese`,nativeName:`Tiếng Việt`,dir:`ltr`},{code:`zh`,name:`Chinese`,nativeName:`中文`,dir:`ltr`}],_s=[`ar`,`he`,`fa`,`ur`],vs=gs.map(e=>e.code),ys={en:()=>Promise.resolve(ms),ar:()=>s(()=>import(`../js/ar-CxLY7ABG.js`).then(e=>e.default),[]),bn:()=>s(()=>import(`../js/bn-DREExDzT.js`).then(e=>e.default),[]),cs:()=>s(()=>import(`../js/cs-LDpGwqlb.js`).then(e=>e.default),[]),da:()=>s(()=>import(`../js/da-Csupo97j.js`).then(e=>e.default),[]),de:()=>s(()=>import(`../js/de-EOghQcPX.js`).then(e=>e.default),[]),es:()=>s(()=>import(`../js/es-CiX_CYKt.js`).then(e=>e.default),[]),fr:()=>s(()=>import(`../js/fr-1IIacQYp.js`).then(e=>e.default),[]),hi:()=>s(()=>import(`../js/hi-DGT4fx6S.js`).then(e=>e.default),[]),id:()=>s(()=>import(`../js/id-0UGudeEI.js`).then(e=>e.default),[]),is:()=>s(()=>import(`../js/is-BQzgz0LG.js`).then(e=>e.default),[]),it:()=>s(()=>import(`../js/it-3PfovgDw.js`).then(e=>e.default),[]),ja:()=>s(()=>import(`../js/ja-BaXdHNz8.js`).then(e=>e.default),[]),ko:()=>s(()=>import(`../js/ko-DNqxLzw3.js`).then(e=>e.default),[]),ms:()=>s(()=>import(`../js/ms-D_X86VRO.js`).then(e=>e.default),[]),nl:()=>s(()=>import(`../js/nl-B832wh-7.js`).then(e=>e.default),[]),pl:()=>s(()=>import(`../js/pl-BDMgy2lk.js`).then(e=>e.default),[]),pt:()=>s(()=>import(`../js/pt-CbhjHMrx.js`).then(e=>e.default),[]),ru:()=>s(()=>import(`../js/ru-CEe0KRO9.js`).then(e=>e.default),[]),sv:()=>s(()=>import(`../js/sv-BWwpkP0M.js`).then(e=>e.default),[]),th:()=>s(()=>import(`../js/th-Dm5aEMnB.js`).then(e=>e.default),[]),tr:()=>s(()=>import(`../js/tr-DMaVgSRT.js`).then(e=>e.default),[]),uk:()=>s(()=>import(`../js/uk-Cu1mMWfT.js`).then(e=>e.default),[]),vi:()=>s(()=>import(`../js/vi-B_DGmAUD.js`).then(e=>e.default),[]),zh:()=>s(()=>import(`../js/zh-DIKyA5Kk.js`).then(e=>e.default),[])},bs=e=>{let t=e?.toLowerCase().split(`-`)[0];return vs.includes(t)?t:`en`},xs=e=>_s.includes(bs(e)),Ss=e=>{if(typeof document>`u`)return;let t=bs(e);document.documentElement.lang=t,document.documentElement.dir=xs(t)?`rtl`:`ltr`},Cs=async e=>{let t=bs(e);if(!J.hasResourceBundle(t,`translation`)){let e=await ys[t]();J.addResourceBundle(t,`translation`,e,!0,!0)}return t},ws=async e=>{let t=await Cs(e);return await J.changeLanguage(t),t};if(typeof window<`u`){let e=navigator.language;try{e=window.localStorage.getItem(`i18nextLng`)||e}catch{}Ss(e),J.on(`languageChanged`,Ss)}var Ts=(async()=>{J.isInitialized||await J.use(ps).use(Lo).init({resources:hs,fallbackLng:`en`,supportedLngs:vs,nonExplicitSupportedLngs:!0,load:`languageOnly`,debug:!1,interpolation:{escapeValue:!1},detection:{order:[`localStorage`,`navigator`,`htmlTag`],caches:[`localStorage`],lookupLocalStorage:`i18nextLng`}});let e=bs(J.language||J.resolvedLanguage);if(e!==`en`)try{await Cs(e),bs(J.language)===e&&await J.changeLanguage(e)}catch{await J.changeLanguage(`en`)}Ss(J.resolvedLanguage||J.language||`en`)})(),Es=(e,t)=>{if(e&&typeof e==`object`&&`response`in e){let t=e;if(t.response?.data?.error)return t.response.data.error}return e instanceof Error?e.message:t};function Ds(e){return{...e,id:e.id||Ae(),timestamp:Date.now()}}function Os(e,t){return e.currentSession?.isPrivate&&e.currentSession?.id===t}function ks(e,t){return e.sessions.some(e=>e.id===t)}function As(e,t){return!!e.currentSession&&(Os(e,t)||ks(e,e.currentSession.id))}function js(e,t,n){if(Os(e,t))return e.currentSession.messages.find(e=>e.id===n.id)?e:{currentSession:{...e.currentSession,messages:[...e.currentSession.messages,n],updatedAt:Date.now()},sessions:e.sessions};if(e.sessions.find(e=>e.id===t)?.messages.some(e=>e.id===n.id))return e;let r=e.sessions.map(e=>{if(e.id!==t)return e;let r=[...e.messages];if(n.parentId){let e=n.parentId;r=r.map(t=>t.id===e||t.parentId===e?{...t,isActive:!1,branchIndex:t.branchIndex??0,siblingCount:(n.branchIndex||0)+1}:t)}return{...e,messages:[...r,n],updatedAt:Date.now()}});return{sessions:r,currentSession:e.currentSession?.id===t&&r.find(e=>e.id===t)||e.currentSession}}function Ms(e,t,n,r){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate){let t=e.currentSession.messages.find(e=>e.id===n);return!t||t.content===r?e:{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}}}let i=e.sessions.find(e=>e.id===t),a=i?.messages.find(e=>e.id===n);if(!i||!a||a.content===r)return e;let o=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r}:e),updatedAt:Date.now()}:e);return{sessions:o,currentSession:e.currentSession?.id===t&&o.find(e=>e.id===t)||e.currentSession}}function Ns(e,t,n,r,i){if(e.currentSession?.id!==t)return e;if(e.currentSession?.isPrivate)return{sessions:e.sessions,currentSession:{...e.currentSession,messages:e.currentSession.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}};let a=e.sessions.map(e=>e.id===t?{...e,messages:e.messages.map(e=>e.id===n?{...e,content:r,statistics:i}:e),updatedAt:Date.now()}:e);return{sessions:a,currentSession:e.currentSession?.id===t&&a.find(e=>e.id===t)||e.currentSession}}function Ps(e){return e.reduce((e,t)=>(e[t.id]=t,e),{})}function Fs(e){return e.map(e=>({name:`persona:${e.id}`,model:e.model,size:0,digest:``,details:{parent_model:e.model,format:`persona`,family:`persona`,families:[`persona`],parameter_size:``,quantization_level:``},modified_at:new Date(e.updated_at).toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPersona:!0,personaName:e.name,personaDescription:e.description}))}function Is(e){return e.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`).flatMap(e=>(e.model_map||[]).map(t=>({name:t,model:t,size:0,digest:``,details:{parent_model:``,format:``,family:``,families:[],parameter_size:``,quantization_level:``},modified_at:new Date().toISOString(),expires_at:new Date().toISOString(),size_vram:0,isPlugin:!0,pluginName:e.name})))}var X=c(`chat-store`),Ls=_e((e,t)=>({sessions:[],currentSession:null,setCurrentSession:t=>{e({currentSession:t})},createSession:async(t,n,r)=>{try{e({loading:!0,error:null});let i=await xe.createSession(t,n,r);if(i.success&&i.data){let t=i.data;return e(e=>({sessions:[t,...e.sessions],currentSession:t,loading:!1})),C.success(`New chat created`),t}}catch(t){let n=Es(t,`Failed to create session`);e({error:n,loading:!1}),C.error(n)}},loadSessions:async()=>{try{e({loading:!0,error:null});let t=await xe.getSessions();t.success&&t.data&&e(e=>{let n=t.data||[],r=n.map(e=>e.id),i=null;return e.currentSession&&r.includes(e.currentSession.id)?i=n.find(t=>t.id===e.currentSession.id)||null:n.length>0&&(i=n[0],e.currentSession&&X.warn(`Previous currentSession not found in backend sessions:`,e.currentSession.id)),{sessions:n,currentSession:i,loading:!1}})}catch(t){let n=Es(t,`Failed to load sessions`);e({error:n,loading:!1}),C.error(n)}},deleteSession:async t=>{try{let n=await xe.deleteSession(t);n.success?(e(e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.currentSession?.id===t?n[0]||null:e.currentSession;return X.debug(`Store: Updating state, sessions count:`,n.length),{sessions:n,currentSession:r}}),C.success(`Chat deleted`)):(X.error(`Store: deleteSession failed:`,n),C.error(`Failed to delete chat`))}catch(e){X.error(`Store: deleteSession error:`,e);let t=Es(e,`Failed to delete session`);C.error(t)}},clearAllSessions:async()=>{try{e({loading:!0,error:null});let t=await xe.clearAllSessions();t.success?(e({sessions:[],currentSession:null,loading:!1}),C.success(`All chat history cleared`)):(X.error(`Store: clearAllSessions failed:`,t),C.error(`Failed to clear chat history`),e({loading:!1}))}catch(t){X.error(`Store: clearAllSessions error:`,t);let n=Es(t,`Failed to clear chat history`);C.error(n),e({loading:!1})}},clearAllState:()=>{e({sessions:[],currentSession:null,models:[],selectedModel:``,systemMessage:``,loading:!1,error:null})},updateSessionTitle:async(t,n)=>{try{let r=await xe.updateSession(t,{title:n});if(r.success&&r.data){let n=r.data.title,i=r.data.updatedAt??Date.now();e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,title:n,updatedAt:i}:e),currentSession:e.currentSession?.id===t?{...e.currentSession,title:n,updatedAt:i}:e.currentSession})),C.success(`Chat title updated`)}}catch(e){let t=Es(e,`Failed to update session`);C.error(t)}},addMessage:(n,r)=>{let i=t(),a=Os(i,n);if(!As(i,n)){C.error(`No valid chat session. Please create or select a chat.`),X.error(`addMessage blocked: currentSession is not valid`,i.currentSession?.id);return}if(!a&&!ks(i,n)){C.error(`Session not found or invalid. Please select or create a valid chat session.`),X.error(`addMessage blocked: sessionId not found in sessions`,n);return}let o=Ds(r);e(e=>js(e,n,o))},updateMessage:(t,n,r)=>{e(e=>Ms(e,t,n,r))},updateMessageWithStatistics:(t,n,r,i)=>{e(e=>Ns(e,t,n,r,i))},models:[],loadModels:async()=>{try{e({loading:!0,error:null}),X.debug(`Loading models from API...`);let n=await we.getModels(),r=[];n.success&&n.data&&(r=[...n.data],X.debug(`Ollama models loaded:`,n.data.length));try{let e=await D.getAllPlugins();if(e.success&&e.data){let t=e.data.filter(e=>e.active&&e.type!==`tts`&&e.type!==`image`);X.debug(`🔌 Active plugins found:`,t.map(e=>e.name));let n=Is(t);r.push(...n),X.debug(`Plugin models added:`,n.length)}}catch(e){X.error(`❌ Failed to load plugin models:`,e),e instanceof Error&&X.error(`❌ Plugin error details:`,{message:e.message,response:e.response?.data,status:e.response?.status,url:e.config?.url})}try{let{personaApi:t}=await s(async()=>{let{personaApi:e}=await import(`../js/api-BsUaU_IW.js`).then(e=>e.t);return{personaApi:e}},__vite__mapDeps([0,1,2,3,4,5])),n=await t.getPersonas();if(n.success&&n.data){let t=Ps(n.data),i=Fs(n.data);r.push(...i),e(e=>({...e,personas:t}))}}catch(e){X.error(`❌ Failed to load personas:`,e)}X.debug(`Total models loaded:`,r.length);let i=t().selectedModel,a=r.some(e=>e.name===i);if(i&&!a&&r.length>0){let t=r[0].name;X.debug(`⚠️ Selected model "${i}" no longer available, falling back to "${t}"`),e({models:r,loading:!1,selectedModel:t}),C.success(`Switched to ${t} (previous model no longer available)`)}else e({models:r,loading:!1})}catch(t){X.error(`Error loading models:`,t);let n=Es(t,`Failed to load models`);e({error:n,loading:!1}),C.error(n)}},loadPreferences:async()=>{try{let t=await Te.getPreferences();if(t.success&&t.data){let{defaultModel:n,systemMessage:r}=t.data;n&&(e({selectedModel:n}),X.debug(`✅ Loaded default model from backend:`,n)),r!==void 0&&(e({systemMessage:r}),X.debug(`✅ Loaded system message from backend`))}}catch(e){X.warn(`❌ Failed to load preferences from backend:`,e)}},selectedModel:``,setSelectedModel:t=>{e({selectedModel:t}),Te.setDefaultModel(t).catch(e=>{X.warn(`Failed to save default model to backend:`,e)})},updateCurrentSessionModel:async n=>{let r=t();if(!r.currentSession)throw Error(`No current session to update`);try{let t=await xe.updateSession(r.currentSession.id,{model:n});t.success&&t.data&&(e(e=>({sessions:e.sessions.map(n=>n.id===e.currentSession?.id?t.data:n),currentSession:t.data,selectedModel:n})),C.success(`Model updated for current chat`))}catch(e){let t=Es(e,`Failed to update session model`);throw C.error(t),e}},personas:{},loadPersonas:async()=>{try{e({loading:!0,error:null});let t=await Ce.getPersonas();if(t.success&&t.data){let n=t.data;e({personas:Ps(n),loading:!1}),X.debug(`✅ Personas loaded:`,n.length)}}catch(t){let n=Es(t,`Failed to load personas`);e({error:n,loading:!1}),X.error(`❌ Failed to load personas:`,n)}},getCurrentPersona:()=>{let e=t();if(!e.currentSession||!e.currentSession.model?.startsWith(`persona:`))return null;let n=e.currentSession.model.replace(`persona:`,``);return e.personas[n]||null},systemMessage:``,setSystemMessage:n=>{let r=t();if(e({systemMessage:n}),Te.setSystemMessage(n).catch(e=>{X.warn(`Failed to save system message to backend:`,e)}),r.currentSession){let t=r.currentSession.messages.findIndex(e=>e.role===`system`);if(t!==-1){e(e=>{let r=e.sessions.map(r=>{if(r.id===e.currentSession?.id){let e=r.messages.map((e,r)=>r===t&&e.role===`system`?{...e,content:n,timestamp:Date.now()}:e);return{...r,messages:e,updatedAt:Date.now()}}return r});return{sessions:r,currentSession:e.currentSession?r.find(t=>t.id===e.currentSession.id)||e.currentSession:null}});let i=r.currentSession.messages[t];xe.updateMessage(r.currentSession.id,i.id,{content:n}).catch(e=>{X.warn(`Failed to sync system message update to backend:`,e)}),X.debug(`✅ Updated system message in current session`)}}},loading:!1,error:null,setError:t=>e({error:t}),generatingTitleForSession:null,setGeneratingTitleForSession:t=>e({generatingTitleForSession:t}),...typeof window<`u`&&{testPluginApi:async()=>{try{X.debug(`🧪 Testing plugin API...`);let e=await D.getAllPlugins();return X.debug(`✅ Plugin API test result:`,e),e}catch(e){return X.error(`❌ Plugin API test failed:`,e),{error:e}}}}})),Rs=`blue`,zs=`#2563eb`,Bs=[{id:`violet`,label:`Violet`,color:`#7c3aed`},{id:`blue`,label:`Blue`,color:`#2563eb`},{id:`cyan`,label:`Cyan`,color:`#0e7490`},{id:`teal`,label:`Teal`,color:`#0f766e`},{id:`emerald`,label:`Emerald`,color:`#15803d`},{id:`amber`,label:`Amber`,color:`#b45309`},{id:`rose`,label:`Rose`,color:`#e11d48`},{id:`slate`,label:`Slate`,color:`#475569`}],Vs=[`50`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`950`],Hs=[`25`,...Vs],Us=[`canvas`,`surface`,`surface-subtle`,`surface-raised`,`surface-overlay`,`surface-inverse`,`ink`,`ink-muted`,`ink-subtle`,`ink-inverse`,`line`,`line-strong`],Ws={25:99,50:97,100:94,200:88,300:80,400:66,500:48,600:36,700:27,800:18,900:11,950:6},Gs={25:13,50:4,100:7,200:10,300:16,400:27,500:46,600:65,700:82,800:89,900:95,950:99},Ks={canvas:{lightness:96,saturationFactor:1},surface:{lightness:98,saturationFactor:.9},"surface-subtle":{lightness:93,saturationFactor:1},"surface-raised":{lightness:99,saturationFactor:.8},"surface-overlay":{lightness:100,saturationFactor:0},"surface-inverse":{lightness:10,saturationFactor:.7},ink:{lightness:10,saturationFactor:.45},"ink-muted":{lightness:38,saturationFactor:.35},"ink-subtle":{lightness:54,saturationFactor:.4},"ink-inverse":{lightness:98,saturationFactor:.4},line:{lightness:86,saturationFactor:.8},"line-strong":{lightness:75,saturationFactor:.65}},qs={canvas:{lightness:5,saturationFactor:.9},surface:{lightness:7,saturationFactor:.9},"surface-subtle":{lightness:9,saturationFactor:1},"surface-raised":{lightness:11,saturationFactor:1},"surface-overlay":{lightness:13,saturationFactor:1},"surface-inverse":{lightness:96,saturationFactor:.35},ink:{lightness:96,saturationFactor:.3},"ink-muted":{lightness:67,saturationFactor:.35},"ink-subtle":{lightness:48,saturationFactor:.4},"ink-inverse":{lightness:7,saturationFactor:.45},line:{lightness:18,saturationFactor:.8},"line-strong":{lightness:28,saturationFactor:.65}},Js={violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#7c3aed`,600:`#6d28d9`,700:`#5b21b6`,800:`#4c1d95`,900:`#3b0764`,950:`#2e1065`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#2563eb`,600:`#1d4ed8`,700:`#1e40af`,800:`#1e3a8a`,900:`#172554`,950:`#0f172a`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#0e7490`,600:`#155e75`,700:`#164e63`,800:`#083344`,900:`#092f3f`,950:`#062634`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#0f766e`,600:`#0f625d`,700:`#115e59`,800:`#134e4a`,900:`#042f2e`,950:`#022c22`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#15803d`,600:`#166534`,700:`#14532d`,800:`#064e3b`,900:`#052e16`,950:`#022c22`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#f59e0b`,500:`#b45309`,600:`#92400e`,700:`#78350f`,800:`#5f2c0b`,900:`#451a03`,950:`#2f1200`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#e11d48`,600:`#be123c`,700:`#9f1239`,800:`#881337`,900:`#4c0519`,950:`#2d0714`},slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#475569`,600:`#334155`,700:`#1e293b`,800:`#0f172a`,900:`#020617`,950:`#010313`}},Ys={50:97,100:94,200:88,300:76,400:64,500:42,600:34,700:27,800:21,900:16,950:10},Xs=(e,t,n)=>Math.min(Math.max(e,t),n),Zs=e=>{if(!e)return null;let t=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let n=t[1];return`#${(n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n).toLowerCase()}`},Qs=e=>{let t=Zs(e)||`#2563eb`,n=parseInt(t.slice(1),16);return{r:n>>16&255,g:n>>8&255,b:n&255}},$s=(e,t,n)=>`#${[e,t,n].map(e=>Xs(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,ec=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c*100};let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d=0;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,{h:d*60,s:u*100,l:c*100}},tc=(e,t,n)=>{let r=Xs(t,0,100)/100,i=Xs(n,0,100)/100,a=(1-Math.abs(2*i-1))*r,o=(e%360+360)%360,s=a*(1-Math.abs(o/60%2-1)),c=i-a/2,l=0,u=0,d=0;return o<60?(l=a,u=s):o<120?(l=s,u=a):o<180?(u=a,d=s):o<240?(u=s,d=a):o<300?(l=s,d=a):(l=a,d=s),$s((l+c)*255,(u+c)*255,(d+c)*255)},nc=e=>{let{r:t,g:n,b:r}=Qs(e),i=[t,n,r].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return i[0]*.2126+i[1]*.7152+i[2]*.0722},rc=(e,t)=>{let n=nc(e),r=nc(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)},ic=(e,t,n)=>{let r=n,i=tc(e,t,r);for(;rc(`#ffffff`,i)<4.5&&r>12;)r-=2,i=tc(e,t,r);return i},ac=e=>{let{r:t,g:n,b:r}=Qs(Zs(e)||`#2563eb`),{h:i,s:a}=ec(t,n,r),o=a<8?a:Xs(a,42,88);return Vs.reduce((e,t)=>{let n=Ys[t],r=Number(t)<300?o*.72:o;return e[t]=t===`500`||t===`600`?ic(i,r,n):tc(i,r,n),e},{})},Z=e=>{let t=e?.mode===`dark`?`dark`:`light`,n=e?.accent===`custom`?`custom`:e?.accent,r=Bs.some(e=>e.id===n)?n:Rs,i=Zs(e?.customAccent)||`#2563eb`;return{mode:t,adaptToAccent:e?.adaptToAccent===!0,accent:n===`custom`?`custom`:r,customAccent:i}},oc=e=>{let t=Z(e);return t.accent===`custom`?ac(t.customAccent):Js[t.accent||`blue`]},sc=e=>{let t=Z(e);return t.accent===`custom`?t.customAccent||`#2563eb`:Bs.find(e=>e.id===t.accent)?.color||`#2563eb`},cc=(e,t)=>t===0||e<8?e*t:Xs(e*.24*t,6*t,24*t),lc=(e,t,n)=>Hs.reduce((r,i)=>(r[i]=tc(e,cc(t,1),n[i]),r),{}),uc=(e,t,n)=>Us.reduce((r,i)=>{let a=n[i];return r[i]=tc(e,cc(t,a.saturationFactor),a.lightness),r},{}),dc=(e,t,n)=>{let{r,g:i,b:a}=Qs(n);e.style.setProperty(t,`${r} ${i} ${a}`)},fc=e=>{for(let t of Hs)e.style.removeProperty(`--color-gray-${t}`),e.style.removeProperty(`--color-dark-${t}`);for(let t of Us)e.style.removeProperty(`--color-${t}`)},pc=(e,t)=>{let{r:n,g:r,b:i}=Qs(sc(t)),{h:a,s:o}=ec(n,r,i),s=lc(a,o,Ws),c=lc(a,o,Gs),l=uc(a,o,t.mode===`dark`?qs:Ks);for(let t of Hs)dc(e,`--color-gray-${t}`,s[t]),dc(e,`--color-dark-${t}`,c[t]);for(let t of Us)dc(e,`--color-${t}`,l[t])},mc=e=>{if(typeof document>`u`)return;let t=Z(e),n=document.documentElement,r=oc(t);n.classList.remove(`dark`,`ophelia`),t.mode===`dark`&&n.classList.add(`dark`),n.style.colorScheme=t.mode,n.dataset.accent=t.accent||`blue`,n.dataset.themeStyle=t.adaptToAccent?`accent`:`default`;for(let e of Vs){let{r:t,g:i,b:a}=Qs(r[e]),o=`${t} ${i} ${a}`;n.style.setProperty(`--color-primary-${e}`,o),n.style.setProperty(`--color-accent-${e}`,o)}t.adaptToAccent?pc(n,t):fc(n)},hc=c(`store:app-store`),gc=250,_c=null,vc=_e()(ve((e,t)=>({theme:{mode:`light`,adaptToAccent:!1,accent:Rs,customAccent:zs},themeSyncPending:!1,syncThemePreference:async n=>{if(_c&&(clearTimeout(_c),_c=null),!(!ye()&&!localStorage.getItem(`auth-token`)))try{let{preferencesApi:r}=await s(async()=>{let{preferencesApi:e}=await import(`../js/api-BsUaU_IW.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));if(!(await r.updatePreferences({theme:n})).success){hc.warn(`Failed to save theme preference to backend`);return}let i=Z(t().theme),a=Z(n);i.mode===a.mode&&i.adaptToAccent===a.adaptToAccent&&i.accent===a.accent&&i.customAccent===a.customAccent?e({themeSyncPending:!1}):(e({themeSyncPending:!0}),t().scheduleThemePreferenceSync())}catch(e){hc.warn(`Failed to save theme preference to backend:`,e)}},scheduleThemePreferenceSync:()=>{_c&&clearTimeout(_c),_c=setTimeout(()=>{_c=null,t().syncThemePreference(Z(t().theme))},gc)},setTheme:t=>{let n=Z(t);e(e=>({theme:n,preferences:{...e.preferences,theme:n}})),mc(n)},updateTheme:n=>{let r=Z(n);t().setTheme(r),e({themeSyncPending:!0}),t().scheduleThemePreferenceSync()},toggleTheme:()=>{let e=t().theme,n=e.mode===`dark`?`light`:`dark`;t().updateTheme({...e,mode:n})},sidebarOpen:!0,sidebarCompact:!1,setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarCompact:t=>e({sidebarCompact:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),toggleSidebarCompact:()=>e(e=>({sidebarCompact:!e.sidebarCompact})),artifactPanelOpen:!1,artifactPanelArtifact:null,openArtifactPanel:t=>e({artifactPanelOpen:!0,artifactPanelArtifact:t}),closeArtifactPanel:()=>e({artifactPanelOpen:!1,artifactPanelArtifact:null}),preferences:{theme:{mode:`light`,adaptToAccent:!1,accent:Rs,customAccent:zs},defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},setPreferences:t=>{let n=t.theme?Z(t.theme):null;e(e=>({...n&&{theme:n},preferences:{...e.preferences,...t,...n&&{theme:n}}})),n&&mc(n)},loadPreferences:async()=>{try{let{preferencesApi:n}=await s(async()=>{let{preferencesApi:e}=await import(`../js/api-BsUaU_IW.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5])),r=await n.getPreferences();if(r.success&&r.data){let n=r.data,i=t().themeSyncPending?Z(t().theme):null;t().setPreferences(i?{...n,theme:i}:n),e({backgroundImage:n.backgroundSettings?.imageUrl||null}),i&&t().syncThemePreference(i)}}catch(e){hc.warn(`Failed to load preferences from backend:`,e)}},isGenerating:!1,setIsGenerating:t=>e({isGenerating:t}),hasSeenSettingsNotification:!1,markSettingsNotificationAsSeen:()=>e({hasSeenSettingsNotification:!0}),isDemoMode:ye(),demoConfig:be(),setDemoMode:t=>{e({isDemoMode:t,demoConfig:be()})},backgroundImage:null,setBackgroundImage:async n=>{if(e({backgroundImage:n}),n){let e=t(),r={...e.preferences,backgroundSettings:{enabled:!0,imageUrl:n,blurAmount:e.preferences.backgroundSettings?.blurAmount||10,opacity:e.preferences.backgroundSettings?.opacity||.6}};e.setPreferences(r);try{let{preferencesApi:e}=await s(async()=>{let{preferencesApi:e}=await import(`../js/api-BsUaU_IW.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r.backgroundSettings})}catch(e){hc.warn(`Failed to save background settings to backend:`,e)}}},uploadBackgroundImage:async e=>{try{let n=new FileReader;return new Promise((r,i)=>{n.onload=async e=>{try{let n=e.target?.result;await t().setBackgroundImage(n),r()}catch(e){i(e)}},n.onerror=i,n.readAsDataURL(e)})}catch(e){throw hc.error(`Failed to upload background image:`,e),e}},removeBackgroundImage:async()=>{e({backgroundImage:null});let n=t(),r={enabled:!1,imageUrl:``,blurAmount:n.preferences.backgroundSettings?.blurAmount||10,opacity:n.preferences.backgroundSettings?.opacity||.6};n.setPreferences({backgroundSettings:r});try{let{preferencesApi:e}=await s(async()=>{let{preferencesApi:e}=await import(`../js/api-BsUaU_IW.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.updatePreferences({backgroundSettings:r})}catch(e){hc.warn(`Failed to save background removal to backend:`,e)}},clearUserState:()=>{let t=Z({mode:`light`,adaptToAccent:!1,accent:Rs,customAccent:zs});_c&&(clearTimeout(_c),_c=null),e({theme:t,themeSyncPending:!1,backgroundImage:null,preferences:{theme:t,defaultModel:``,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``},showUsername:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}}}),mc(t)}}),{name:`libre-webui-app-state`,onRehydrateStorage:()=>e=>{e&&e.setTheme(Z(e.theme))},partialize:e=>{let{backgroundSettings:t,...n}=e.preferences;return{theme:e.theme,themeSyncPending:e.themeSyncPending,sidebarOpen:e.sidebarOpen,sidebarCompact:e.sidebarCompact,preferences:n,hasSeenSettingsNotification:e.hasSeenSettingsNotification}}}));typeof window<`u`&&(()=>{let{theme:e,setTheme:t}=vc.getState();t(e)})();var yc=c(`store:plugin-store`),bc=_e((e,t)=>({plugins:[],pluginStatus:[],pluginVariables:{},isLoading:!1,isUploading:!1,error:null,loadPlugins:async()=>{e({isLoading:!0,error:null});try{let t=await D.getAllPlugins();t.success&&t.data?e({plugins:t.data}):e({error:t.error||`Failed to load plugins`})}catch(t){e({error:t instanceof Error?t.message:`Failed to load plugins`})}finally{e({isLoading:!1})}},uploadPlugin:async n=>{e({isUploading:!0,error:null});try{let r=await D.uploadPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to upload plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to upload plugin`})}finally{e({isUploading:!1})}},installPlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.installPlugin(n);r.success&&r.data?await t().loadPlugins():e({error:r.error||`Failed to install plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to install plugin`})}finally{e({isLoading:!1})}},updatePlugin:async(n,r)=>{e({isLoading:!0,error:null});try{let i=await D.updatePlugin(n,r);i.success&&i.data?await t().loadPlugins():e({error:i.error||`Failed to update plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to update plugin`})}finally{e({isLoading:!1})}},deletePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deletePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to delete plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to delete plugin`})}finally{e({isLoading:!1})}},activatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.activatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to activate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to activate plugin`})}finally{e({isLoading:!1})}},deactivatePlugin:async n=>{e({isLoading:!0,error:null});try{let r=await D.deactivatePlugin(n);r.success?await t().loadPlugins():e({error:r.error||`Failed to deactivate plugin`})}catch(t){e({error:t instanceof Error?t.message:`Failed to deactivate plugin`})}finally{e({isLoading:!1})}},loadPluginStatus:async()=>{try{let t=await D.getPluginStatus();t.success&&t.data&&e({pluginStatus:t.data})}catch(e){yc.error(`Failed to load plugin status:`,e)}},exportPlugin:async t=>{e({isLoading:!0,error:null});try{let e=await D.exportPlugin(t),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`${t}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}catch(t){e({error:t instanceof Error?t.message:`Failed to export plugin`})}finally{e({isLoading:!1})}},fetchPluginVariables:async t=>{try{let n=await D.getVariables(t);n.success&&n.data&&e(e=>({pluginVariables:{...e.pluginVariables,[t]:n.data}}))}catch(e){yc.error(`Failed to fetch plugin variables:`,e)}},updatePluginVariables:async(e,n)=>{try{return(await D.setVariables(e,n)).success?(await t().fetchPluginVariables(e),!0):!1}catch(e){return yc.error(`Failed to update plugin variables:`,e),!1}},resetPluginVariables:async t=>{try{(await D.resetVariables(t)).success&&e(e=>{let n={...e.pluginVariables};return delete n[t],{pluginVariables:n}})}catch(e){yc.error(`Failed to reset plugin variables:`,e)}},clearError:()=>e({error:null}),setError:t=>e({error:t})}));function xc(e){"@babel/helpers - typeof";return xc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},xc(e)}function Sc(e,t){if(xc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(xc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Cc(e){var t=Sc(e,`string`);return xc(t)==`symbol`?t:t+``}function wc(e,t,n){return(t=Cc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=c(`websocket`),Tc=new class{constructor(){wc(this,`ws`,null),wc(this,`url`,void 0),wc(this,`reconnectAttempts`,0),wc(this,`maxReconnectAttempts`,5),wc(this,`reconnectDelay`,1e3),wc(this,`messageHandlers`,new Map);let e;e=window.location.protocol===`file:`?`ws://localhost:3001`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`,this.url=`${e}/ws`,Q.debug(`WebSocket URL constructed:`,this.url)}connect(){return ye()?(Q.debug(`Demo mode active: skipping WebSocket connection.`),Promise.resolve()):(Q.debug(`WebSocket: Attempting to connect to:`,this.url),new Promise((e,t)=>{try{let n=localStorage.getItem(`auth-token`),r=n?`${this.url}?token=${encodeURIComponent(n)}`:this.url;Q.debug(`WebSocket: Connecting to:`,r.replace(/token=[^&]+/,`token=***`)),this.ws=new WebSocket(r),this.ws.onopen=()=>{Q.debug(`WebSocket connected successfully`),this.reconnectAttempts=0,e()},this.ws.onmessage=e=>{try{let t=JSON.parse(e.data),n=this.messageHandlers.get(t.type);n?n(t.data):t.type===`connected`?Q.debug(`WebSocket: Server confirmed connection`):Q.warn(`WebSocket: No handler for message type:`,t.type)}catch(e){Q.error(`Failed to parse WebSocket message:`,e)}},this.ws.onclose=()=>{Q.debug(`WebSocket disconnected`),this.ws=null,this.attemptReconnect()},this.ws.onerror=e=>{Q.error(`WebSocket error:`,e),t(e)}}catch(e){t(e)}}))}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN?(Q.debug(`WebSocket: Sending message:`,e),this.ws.send(JSON.stringify(e))):Q.warn(`WebSocket is not connected. ReadyState:`,this.ws?.readyState)}onMessage(e,t){this.messageHandlers.delete(e),this.messageHandlers.set(e,t)}offMessage(e){this.messageHandlers.delete(e)}attemptReconnect(){if(ye()){Q.debug(`Demo mode active: skipping WebSocket reconnection.`);return}this.reconnectAttempts<this.maxReconnectAttempts?(this.reconnectAttempts++,Q.debug(`Attempting to reconnect... (${this.reconnectAttempts}/${this.maxReconnectAttempts})`),setTimeout(()=>{this.connect().catch(()=>{})},this.reconnectDelay*this.reconnectAttempts)):Q.error(`Max reconnection attempts reached`)}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}},Ec=e({useAuthStore:()=>$}),Dc=c(`auth-store`),$=_e()(ve((e,t)=>({user:null,token:null,systemInfo:null,isAuthenticated:!1,isLoading:!1,login:(n,r,i)=>{let a=t().user?.id===n.id;localStorage.setItem(`auth-token`,r);let o=Ls.getState();o.clearAllState&&o.clearAllState(),a||vc.getState().clearUserState(),e({user:n,token:r,systemInfo:i,isAuthenticated:!0,isLoading:!1}),setTimeout(async()=>{try{let e=bc.getState();Dc.debug(`Reinitializing app after login...`),Dc.debug(`Reconnecting WebSocket with auth token...`),Tc.disconnect(),await Tc.connect(),!(await we.checkHealth()).success&&!ye()&&Dc.warn(`Ollama service not available after login`);let t=vc.getState();await Promise.all([o.loadModels(),o.loadSessions(),o.loadPreferences(),t.loadPreferences(),e.loadPlugins()]),Dc.debug(`Reinitialized app after login`)}catch(e){Dc.error(`Failed to reinitialize app after login:`,e)}},100)},logout:()=>{localStorage.removeItem(`auth-token`),Dc.debug(`Disconnecting WebSocket on logout...`),Tc.disconnect();let t=Ls.getState();t.clearAllState&&t.clearAllState(),vc.getState().clearUserState(),e({user:null,token:null,isAuthenticated:!1,isLoading:!1})},setUser:t=>{e({user:t})},setSystemInfo:t=>{e({systemInfo:t})},setLoading:t=>{e({isLoading:t})},isAdmin:()=>{let{user:e}=t();return e?.role===`admin`},requiresAuth:()=>{let{systemInfo:e}=t();return e?.requiresAuth??!1}}),{name:`auth-store`,partialize:e=>({user:e.user,token:e.token,systemInfo:e.systemInfo,isAuthenticated:e.isAuthenticated})})),Oc=`welcomePromptIndex`,kc=`libre:welcome-prompt-change`,Ac=[`time`,`create`,`explore`,`imagine`,`focus`,`untangle`,`momentum`,`open`,`challenge`,`draft`,`possibility`,`unexpected`],jc=0,Mc=e=>Number.isInteger(e)&&e>=0&&e<Ac.length,Nc=()=>{if(typeof window>`u`)return jc;try{let e=window.sessionStorage.getItem(Oc),t=Number(e);e!==null&&Mc(t)&&(jc=t)}catch{}return jc},Pc=()=>{let e=(Nc()+1)%Ac.length;if(jc=e,typeof window<`u`){try{window.sessionStorage.setItem(Oc,String(e))}catch{}window.dispatchEvent(new Event(kc))}return e},Fc=e=>Ac[e]??`time`,Ic=a(),Lc=({label:e,error:t,helper:n,className:r,id:i,...a})=>{let o=(0,B.useId)(),s=i||`input-${o}`;return(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,V.jsx)(`label`,{htmlFor:s,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,V.jsx)(`input`,{id:s,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},Rc=B.forwardRef(({label:e,error:t,helper:n,className:r,id:i,...a},o)=>{let s=(0,B.useId)(),c=i||`textarea-${s}`;return(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,V.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,V.jsx)(`textarea`,{ref:o,id:c,className:O(`block w-full resize-none rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})});Rc.displayName=`Textarea`;var zc=({label:e,error:t,helper:n,options:r,className:i,id:a,...o})=>{let s=(0,B.useId)(),c=a||`select-${s}`;return(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,V.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,V.jsx)(`select`,{id:c,className:O(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,i),...o,children:r.map((e,t)=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.key??`${e.value}-${t}`))}),t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},Bc=[/```/,/`[^`\n]+`/,/^\s{0,3}#{1,6}\s/m,/^\s{0,3}[-*+]\s/m,/^\s{0,3}\d+\.\s/m,/^\s{0,3}>\s/m,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*]\([^)]+\)/,/\|.*\|/,/\*\*[^*]+\*\*/,/__[^_]+__/,/~~[^~]+~~/,/\\\[[\s\S]*?\\\]/,/\\\([\s\S]*?\\\)/,/\$\$[\s\S]*?\$\$/,/(^|[^$])\$[^$\n]+\$/];function Vc(e){return Bc.some(t=>t.test(e))}function Hc(e){return e.includes("```")}function Uc(e){let t=[],n=/^```([^\n\r]*)\r?\n?/gm,r=0,i;for(;i=n.exec(e);){let a=e.slice(r,i.index);a&&t.push({type:`text`,content:a});let o=i[1].trim().split(/\s+/)[0]||null,s=n.lastIndex,c=/^```\s*(?:\r?\n|$)/gm;c.lastIndex=s;let l=c.exec(e);if(!l){t.push({type:`code`,language:o,content:e.slice(s),complete:!1}),r=e.length;break}t.push({type:`code`,language:o,content:e.slice(s,l.index),complete:!0}),r=c.lastIndex,n.lastIndex=r}let a=e.slice(r);return(a||t.length===0)&&t.push({type:`text`,content:a}),t}function Wc(e){let t=[],n=e.replace(/```[\s\S]*?```|`[^`\n]+`/g,e=>(t.push(e),`__CODE_BLOCK_${t.length-1}__`));return n=n.replace(/\\\[([\s\S]*?)\\\]/g,(e,t)=>`$$${t}$$`),n=n.replace(/\\\(([\s\S]*?)\\\)/g,(e,t)=>`$${t}$`),t.forEach((e,t)=>{n=n.replace(`__CODE_BLOCK_${t}__`,e)}),n}function Gc({content:e}){return e?(0,V.jsx)(`div`,{dir:`auto`,className:`whitespace-pre-wrap break-words leading-relaxed`,children:e}):null}function Kc({content:e,language:t,complete:n}){return(0,V.jsxs)(`div`,{dir:`ltr`,className:`my-4 overflow-hidden rounded-xl border border-gray-200 bg-gray-950 text-left shadow-sm dark:border-dark-300 dark:bg-black/40`,children:[(0,V.jsxs)(`div`,{className:`flex h-11 items-center justify-between border-b border-white/10 bg-gray-900 px-4 dark:bg-dark-200`,children:[(0,V.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-wide text-gray-300 dark:text-dark-700`,children:t||`code`}),!n&&(0,V.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center rounded-full bg-primary-500/10 text-primary-300 dark:text-primary-400`,"aria-label":`Streaming code block`,children:(0,V.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-current animate-pulse`})})]}),(0,V.jsx)(`pre`,{className:`max-h-[60vh] min-h-[3rem] overflow-auto p-4 text-sm leading-relaxed text-gray-100 font-mono whitespace-pre tabular-nums`,children:(0,V.jsxs)(`code`,{children:[e,!n&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`ms-0.5 inline-block h-4 w-2 translate-y-0.5 animate-pulse rounded-sm bg-primary-300 align-baseline dark:bg-primary-400`})]})})]})}var qc=({content:e,className:t})=>{let n=B.useMemo(()=>Uc(e),[e]);return(0,V.jsx)(`div`,{className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700`,t),children:n.map((e,t)=>e.type===`code`?(0,V.jsx)(Kc,{...e},`${e.type}-${t}`):(0,V.jsx)(Gc,{content:e.content},`${e.type}-${t}`))})},Jc=B.lazy(()=>s(()=>import(`../js/RichMessageContent-tAv_35Ur.js`),__vite__mapDeps([6,1,5,2,3,7,8,4,9,10])));function Yc({content:e,className:t}){return(0,V.jsx)(`div`,{dir:`auto`,className:O(`text-sm leading-relaxed text-gray-700 dark:text-dark-700 whitespace-pre-wrap break-words`,t),children:e})}var Xc=({content:e,className:t,isStreaming:n=!1})=>n&&Hc(e)?(0,V.jsx)(qc,{content:e,className:t}):Vc(e)?(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Yc,{content:e,className:t}),children:(0,V.jsx)(Jc,{content:e,className:t})}):(0,V.jsx)(Yc,{content:e,className:t}),Zc=({children:e,htmlFor:t,className:n=``})=>(0,V.jsx)(`label`,{htmlFor:t,className:O(`text-sm font-medium tracking-[-0.005em] text-ink-muted`,n),children:e}),Qc=({children:e,className:t=``})=>(0,V.jsx)(`div`,{className:O(`rounded-2xl border border-line bg-surface-raised shadow-card`,t),children:e}),$c=({children:e,className:t=``})=>(0,V.jsx)(`div`,{className:O(`flex flex-col space-y-1.5 p-6`,t),children:e}),el=({children:e,className:t=``})=>(0,V.jsx)(`h3`,{className:O(`text-lg font-semibold leading-tight tracking-[-0.02em] text-ink`,t),children:e}),tl=({children:e,className:t=``})=>(0,V.jsx)(`p`,{className:O(`text-sm leading-relaxed text-ink-muted`,t),children:e}),nl=({children:e,className:t=``})=>(0,V.jsx)(`div`,{className:O(`p-6 pt-0`,t),children:e}),rl={narrow:`max-w-4xl`,default:`max-w-6xl`,wide:`max-w-7xl`},il=({children:e,width:t=`default`,className:n,contentClassName:r,...i})=>(0,V.jsx)(`div`,{className:O(`h-full overflow-y-auto overscroll-y-contain scrollbar-thin`,n),...i,children:(0,V.jsx)(`div`,{className:O(`mx-auto w-full px-4 pb-16 pt-7 sm:px-6 sm:pb-20 sm:pt-10 lg:px-8`,rl[t],r),children:e})}),al=({title:e,description:t,eyebrow:n,actions:r,meta:i,className:a,...o})=>(0,V.jsxs)(`header`,{className:O(`mb-8 flex flex-col gap-6 border-b border-gray-200/70 pb-7 text-start dark:border-white/[0.08] sm:mb-10 sm:pb-9 md:flex-row md:items-end md:justify-between`,a),...o,children:[(0,V.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[n&&(0,V.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:n}),(0,V.jsx)(`h1`,{className:`text-balance text-3xl font-normal leading-[1.02] tracking-[-0.04em] text-gray-950 dark:text-dark-950 sm:text-5xl rtl:leading-[1.15] rtl:tracking-normal`,children:e}),t&&(0,V.jsx)(`p`,{className:`mt-4 max-w-2xl text-sm leading-6 text-gray-600 dark:text-dark-600 sm:text-base sm:leading-7`,children:t}),i&&(0,V.jsx)(`div`,{className:`mt-4`,children:i})]}),r&&(0,V.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 md:justify-end`,children:r})]}),ol=c(`components:avatar-upload`),sl=({value:e,onChange:t,className:n=``})=>{let{t:r}=Y(),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),l=async e=>{if(!e.type.startsWith(`image/`)){C.error(r(`user.avatar.invalidFile`));return}if(e.size>2*1024*1024){C.error(r(`user.avatar.fileTooLarge`));return}o(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),C.success(r(`user.avatar.uploaded`))},n.onerror=()=>{C.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){ol.error(`Failed to upload avatar:`,e),C.error(r(`user.avatar.uploadFailed`))}finally{o(!1)}},u=e=>{let t=e.target.files?.[0];t&&l(t)},d=e=>{e.preventDefault(),c(!0)},f=e=>{e.preventDefault(),c(!1)},p=e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&l(t)},m=()=>{t(``),C.success(r(`user.avatar.removed`))},h=()=>e||null;return(0,V.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,V.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0`,children:(0,V.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:h()?(0,V.jsx)(`img`,{src:h(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,V.jsx)(se,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:m,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,V.jsx)(oe,{className:`h-4 w-4`})})]}):(0,V.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${s?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:d,onDragLeave:f,onDrop:p,onClick:()=>i.current?.click(),children:[(0,V.jsx)(te,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,V.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:a,className:`mx-auto`,children:[(0,V.jsx)(te,{className:`h-4 w-4 mr-2`}),r(a?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,V.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,V.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:u,className:`hidden`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};function cl({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=Y();return e?(0,Ic.createPortal)((0,V.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,V.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-modal-title`,className:`bg-white dark:bg-dark-25 rounded-3xl shadow-[0_24px_80px_rgba(0,0,0,0.24)] p-6 w-full max-w-md border border-black/[0.07] dark:border-white/[0.08] animate-scale-in`,onClick:e=>e.stopPropagation(),children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,V.jsx)(`h3`,{id:`avatar-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:o(`user.avatar.title`)}),(0,V.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,V.jsx)(oe,{size:20,className:`text-gray-500`})})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(sl,{value:t,onChange:r}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,V.jsx)(`button`,{onClick:i,className:`px-4 py-2 text-sm font-medium text-gray-700 dark:text-dark-700 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:o(`common.cancel`)}),(0,V.jsx)(`button`,{onClick:a,disabled:n,className:`px-4 py-2 text-sm font-medium text-white bg-gray-950 hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors`,children:o(n?`common.saving`:`common.save`)})]})]})]})}),document.body):null}var ll={sm:`text-[1.0625rem] leading-none`,md:`text-[1.625rem] leading-none`,lg:`text-[2.5rem] leading-none`},ul=({className:e,size:t=`md`,wordmark:n=!0})=>(0,V.jsxs)(`span`,{dir:`ltr`,className:O(`libre-brand inline-flex items-baseline whitespace-nowrap`,ll[t],e),children:[`Libre`,n&&(0,V.jsx)(`span`,{className:`ms-1 font-normal tracking-[-0.035em]`,children:`WebUI`})]}),dl=()=>{let{theme:e,toggleTheme:t}=vc(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,V.jsx)(g,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}):(0,V.jsx)(le,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}),i=`Switch to ${n} mode`;return(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function fl({sidebarCompact:e,isElectron:t,selectedModel:n,modelCount:r,onToggleCompact:i,onCreateSession:a}){let{t:o}=Y(),s=!n||r===0,c=s?o(`chat.model.noModelsTooltip`):``;return(0,V.jsxs)(`div`,{className:O(e?`px-2 pb-3 pt-3`:`px-4 pb-4 pt-4`,t&&`pt-10`),children:[(0,V.jsx)(`div`,{className:O(`flex items-center`,e?`justify-center mb-3`:`justify-between mb-4`),children:e?(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,V.jsx)(ul,{size:`sm`,wordmark:!1,className:`text-gray-950 dark:text-dark-950 text-base tracking-[-0.035em]`}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.expandSidebar`),"aria-label":o(`sidebar.expandSidebar`),children:(0,V.jsx)(ie,{className:`h-4 w-4 rtl:rotate-180`})}),(0,V.jsx)(dl,{})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ul,{size:`sm`,className:`text-gray-950 dark:text-dark-950 tracking-[-0.035em]`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,V.jsx)(dl,{}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:i,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:o(`sidebar.toggleSize`),"aria-label":o(`sidebar.toggleSize`),children:(0,V.jsx)(re,{className:`h-4 w-4 rtl:rotate-180`})})]})]})}),e?(0,V.jsx)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation p-0`,title:s?c:o(`chat.session.new`),"aria-label":o(`chat.session.new`),children:(0,V.jsx)(f,{className:`h-4 w-4`})}):(0,V.jsxs)(k,{onClick:a,disabled:s,className:`w-full h-10 rounded-xl bg-gray-950 hover:bg-gray-800 active:bg-gray-900 text-white dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 dark:active:bg-gray-200 shadow-none transition-colors duration-150 border-0 touch-manipulation`,size:`sm`,title:c,children:[(0,V.jsx)(f,{className:`h-4 w-4 me-2`}),o(`chat.session.new`)]})]})}function pl({sidebarCompact:e,activePath:t,onChatClick:n,onMobileNavigate:r}){let{t:i}=Y(),a=t=>O(`flex items-center gap-3 rounded-xl text-[13px] font-medium transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,e?`w-11 h-11 justify-center p-0`:`w-full px-3 py-2.5`,t?`bg-white text-gray-950 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:text-dark-950 dark:ring-white/[0.06]`:`text-gray-600 dark:text-dark-600 hover:bg-white/60 dark:hover:bg-dark-200/60 hover:text-gray-950 dark:hover:text-dark-950 active:bg-white dark:active:bg-dark-200`),o=t===`/chat`||t===`/`||t.startsWith(`/c/`);return(0,V.jsx)(`div`,{className:O(`pb-3`,e?`px-2`:`px-3`),children:(0,V.jsxs)(`nav`,{className:O(`space-y-0.5`,e&&`flex flex-col items-center`),children:[(0,V.jsxs)(`button`,{onClick:n,className:O(a(o),`text-start`),title:e?i(`sidebar.navigation.chat`):void 0,"aria-current":o?`page`:void 0,children:[(0,V.jsx)(b,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.chat`)]}),(0,V.jsxs)(ia,{to:`/models`,onClick:r,className:a(t===`/models`),title:e?i(`sidebar.navigation.models`):void 0,"aria-current":t===`/models`?`page`:void 0,children:[(0,V.jsx)(ne,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.models`)]}),(0,V.jsxs)(ia,{to:`/personas`,onClick:r,className:a(t===`/personas`),title:e?i(`sidebar.navigation.personas`):void 0,"aria-current":t===`/personas`?`page`:void 0,children:[(0,V.jsx)(se,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.personas`)]}),(0,V.jsxs)(ia,{to:`/gallery`,onClick:r,className:a(t===`/gallery`),title:e?i(`sidebar.navigation.imagine`):void 0,"aria-current":t===`/gallery`?`page`:void 0,children:[(0,V.jsx)(l,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.imagine`)]}),(0,V.jsxs)(ia,{to:`/agents`,onClick:r,className:a(t===`/agents`),title:e?i(`sidebar.navigation.agents`):void 0,"aria-current":t===`/agents`?`page`:void 0,children:[(0,V.jsx)(S,{className:`h-[18px] w-[18px] shrink-0`}),!e&&i(`sidebar.navigation.agents`)]})]})})}function ml({sessions:e,personas:t,currentSessionId:n,generatingTitleForSession:r,sidebarCompact:i,editingSessionId:a,editingTitle:o,onEditingTitleChange:s,onSelectSession:c,onStartEditing:l,onSaveEdit:u,onCancelEdit:d,onDeleteSession:f}){let{t:p,i18n:m}=Y();return(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto scrollbar-thin border-t border-black/[0.05] dark:border-white/[0.05]`,style:{WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`,willChange:`scroll-position`},children:(0,V.jsxs)(`div`,{className:O(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-2 px-1`,children:[(0,V.jsx)(`h3`,{className:`text-[10px] font-semibold text-gray-500 dark:text-dark-500 uppercase tracking-[0.16em] rtl:tracking-normal`,children:p(`chat.session.chats`)}),(0,V.jsx)(`span`,{className:`text-[10px] tabular-nums text-gray-400 dark:text-dark-500 font-medium`,children:e.length})]}),e.length===0?(0,V.jsxs)(`div`,{className:O(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,V.jsx)(`div`,{className:O(`mx-auto mb-3 bg-white/70 dark:bg-dark-200 rounded-xl flex items-center justify-center ring-1 ring-black/[0.04] dark:ring-white/[0.05]`,i?`w-8 h-8`:`w-12 h-12`),children:(0,V.jsx)(b,{className:O(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:p(`chat.session.noChats`)}),(0,V.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:p(`chat.session.createFirst`)})]})]}):(0,V.jsx)(`div`,{className:O(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let h=n===e.id,g=e.personaId?t[e.personaId]:null;return(0,V.jsx)(`div`,{className:O(`group relative cursor-pointer transition-colors duration-150 touch-manipulation outline-none`,i?`rounded-xl p-1 flex items-center justify-center`:`rounded-xl px-3 py-2.5`,h?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),onClick:()=>c(e),title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,V.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,V.jsx)(`div`,{className:O(`flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,r===e.id?`bg-white text-primary-600 animate-pulse dark:bg-dark-200 dark:text-primary-400`:h?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:e.title.trim().charAt(0)||`•`})}):a===e.id?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(Lc,{value:o,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?u(e.id):t.key===`Escape`&&d()},className:`text-sm h-8`,autoFocus:!0}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>u(e.id),className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,V.jsx)(pe,{className:`h-3 w-3`})}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:d,className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,V.jsx)(oe,{className:`h-3 w-3`})})]}):(0,V.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0 me-2`,children:[(0,V.jsx)(`h3`,{className:`text-[13px] font-medium truncate leading-tight text-gray-900 dark:text-dark-900`,children:r===e.id?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,V.jsx)(`span`,{className:`animate-pulse`,children:p(`chat.session.generatingTitle`)}),(0,V.jsxs)(`span`,{className:`inline-flex`,children:[(0,V.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`0ms`},children:`.`}),(0,V.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`150ms`},children:`.`}),(0,V.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`300ms`},children:`.`})]})]}):Oe(e.title,32)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[(0,V.jsx)(`span`,{dir:`auto`,className:O(`text-[11px] tabular-nums`,h?`text-gray-500 dark:text-dark-600`:`text-gray-400 dark:text-dark-500`),children:ke(e.updatedAt,m.language)}),(0,V.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),e.personaId?g?(0,V.jsxs)(`span`,{className:O(`flex items-center gap-1 text-[11px] font-medium`,h?`text-primary-600 dark:text-primary-400`:`text-primary-500 dark:text-primary-500`),title:g.description||g.name,children:[g.avatar&&!g.avatar.startsWith(`data:`)&&(0,V.jsx)(`span`,{className:`text-[10px]`,children:g.avatar}),(0,V.jsx)(`span`,{className:`truncate max-w-[100px]`,children:g.name})]}):(0,V.jsx)(`span`,{className:O(`text-[11px] font-medium italic`,h?`text-gray-500 dark:text-gray-500`:`text-gray-400 dark:text-gray-600`),children:`Persona`}):(0,V.jsx)(`span`,{dir:`ltr`,className:O(`text-[11px] font-medium truncate max-w-[108px]`,h?`text-gray-700 dark:text-gray-300`:`text-gray-600 dark:text-gray-400`),title:e.model,children:e.model})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity duration-150 shrink-0`,children:[(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>l(e,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:p(`chat.session.renameChat`),children:(0,V.jsx)(_,{className:`h-3 w-3`})}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t=>f(e.id,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg touch-manipulation`,title:p(`chat.session.deleteChat`),children:(0,V.jsx)(de,{className:`h-3 w-3`})})]})]})},e.id)})})]})})}function hl({user:e,size:t}){let n=t===`sm`?`w-7 h-7`:`w-8 h-8`,r=t===`sm`?`text-xs`:`text-sm`;return e.avatar?(0,V.jsx)(`img`,{src:e.avatar,alt:e.username,className:`${n} rounded-full object-cover ring-1 ring-black/10 dark:ring-white/10`,title:`${e.username} (${e.role})`}):(0,V.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,V.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function gl({requiresAuth:e,user:t,isAdmin:n,sidebarCompact:r,userMenuOpen:i,userMenuRef:a,onToggleUserMenu:o,onOpenSettings:s,onOpenAvatar:c,onLogout:l,onMobileNavigate:u,onCloseUserMenu:d}){let{t:f}=Y();return!e||!t?null:(0,V.jsx)(`div`,{className:O(`border-t border-black/[0.05] dark:border-white/[0.05]`,r?`p-2`:`p-3`),children:r?(0,V.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,V.jsx)(hl,{user:t,size:`sm`}),(0,V.jsx)(`button`,{onClick:s,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.settings`),children:(0,V.jsx)(fe,{className:`h-4 w-4`})}),n&&(0,V.jsx)(ia,{to:`/users`,onClick:u,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.userManagement`),children:(0,V.jsx)(se,{className:`h-4 w-4`})}),(0,V.jsx)(`button`,{onClick:l,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-500 dark:text-dark-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600 dark:hover:text-red-400 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.signOut`),children:(0,V.jsx)(h,{className:`h-4 w-4`})})]}):(0,V.jsxs)(`div`,{className:`relative`,ref:a,children:[(0,V.jsx)(`button`,{onClick:o,className:`w-full p-2.5 rounded-xl hover:bg-white/70 dark:hover:bg-dark-200 transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,V.jsx)(hl,{user:t,size:`sm`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,V.jsxs)(`div`,{className:`flex items-center mt-0.5`,children:[t.role===`admin`&&(0,V.jsx)(E,{size:10,className:`text-primary-500 me-1`}),(0,V.jsx)(`span`,{className:`text-[11px] text-gray-500 dark:text-dark-500 capitalize`,children:t.role})]})]}),(0,V.jsx)(ie,{className:O(`h-4 w-4 text-gray-400 dark:text-dark-500 transition-transform duration-150 rtl:rotate-180`,i&&`rotate-90 rtl:rotate-90`)})]})}),i&&(0,V.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 mb-2 py-2 bg-white/95 dark:bg-dark-25/95 rounded-2xl shadow-[0_18px_60px_rgba(15,23,42,0.16)] border border-black/[0.07] dark:border-white/[0.08] backdrop-blur-xl z-50 animate-scale-in`,children:[(0,V.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,V.jsx)(hl,{user:t,size:`md`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||f(`user.profile.noEmail`)})]})]})}),(0,V.jsxs)(`div`,{className:`py-1`,children:[(0,V.jsxs)(`button`,{onClick:()=>{c(t.avatar||``),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,V.jsx)(me,{className:`h-4 w-4 shrink-0`}),f(`user.menu.changePicture`)]}),(0,V.jsxs)(`button`,{onClick:()=>{s(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,V.jsx)(fe,{className:`h-4 w-4 shrink-0`}),f(`user.menu.settings`)]}),n&&(0,V.jsxs)(ia,{to:`/users`,onClick:()=>{d(),u()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,V.jsx)(se,{className:`h-4 w-4 shrink-0`}),f(`user.menu.userManagement`)]}),(0,V.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,V.jsxs)(`button`,{onClick:()=>{l(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-150 text-start`,children:[(0,V.jsx)(h,{className:`h-4 w-4 shrink-0`}),f(`user.menu.logout`)]})]})]})]})})}var _l=c(`components:sidebar`),vl=B.lazy(()=>s(()=>import(`../js/SettingsModal-BRQcVyKI.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([11,1,5,12,13,2,3,7,0,4,8,14]))),yl=({isOpen:e,onClose:t,className:n})=>{let{t:r}=Y(),i=G(),a=Br(),{sessions:o,deleteSession:s,updateSessionTitle:c,selectedModel:l,models:u,currentSession:f,generatingTitleForSession:p,personas:m}=Ls(),{user:h,isAdmin:g,systemInfo:_,setUser:v}=$(),{backgroundImage:y,sidebarCompact:b,toggleSidebarCompact:x}=vc(),[S,ee]=(0,B.useState)(null),[C,w]=(0,B.useState)(``),[T,te]=(0,B.useState)(!1),[ne,E]=(0,B.useState)(!1),[re,ie]=(0,B.useState)(!1),[ae,oe]=(0,B.useState)(``),[se,ce]=(0,B.useState)(!1),le=(0,B.useRef)(null),ue=(0,B.useRef)(null),{sessionId:de}=Hr(),fe=de||null,pe=f?.id||fe,me=()=>{window.innerWidth<768&&!b&&x()},he=()=>{let{setCurrentSession:e}=Ls.getState();Pc(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,B.useEffect)(()=>{let e=e=>{le.current&&!le.current.contains(e.target)&&E(!1)};if(ne)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[ne]),(0,B.useEffect)(()=>{let t=t=>{ue.current&&!ue.current.contains(t.target)&&window.innerWidth<768&&e&&!b&&x()};if(e&&!b&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,b,x]);let ge=async()=>{ce(!0);try{let e=await De.updateMyAvatar(ae||null);e.success&&e.data?(v(e.data),d.success(r(`user.avatar.updated`)),ie(!1)):d.error(e.message||r(`user.avatar.updateFailed`))}catch(e){_l.error(`Failed to update avatar:`,e),d.error(r(`user.avatar.updateFailed`))}finally{ce(!1)}},_e=()=>{he(),a(`/chat`,{replace:!0}),me()},ve=()=>{he(),a(`/chat`,{replace:!0}),me()},ye=e=>{a(`/c/${e.id}`,{replace:!0}),me()},be=async(e,t)=>{if(t.stopPropagation(),_l.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`)))try{_l.debug(`Attempting to delete session:`,e);let t=pe===e;if(await s(e),_l.debug(`Session deleted successfully`),t){let t=o.filter(t=>t.id!==e);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}}catch(e){_l.error(`Error deleting session:`,e)}},xe=(e,t)=>{t.stopPropagation(),ee(e.id),w(e.title)},Se=async e=>{C.trim()&&await c(e,C.trim()),ee(null),w(``)},Ce=()=>{ee(null),w(``)},we=async()=>{try{await Ee.logout();let{logout:e}=$.getState();e(),a(`/login`),d.success(r(`auth.logout.success`))}catch(e){_l.error(`Logout error:`,e);let{logout:t}=$.getState();t(),a(`/login`)}},Te=()=>{te(!0),me()},D=e=>{oe(e),ie(!0)},Oe=window.location.protocol===`file:`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:ue,"data-testid":`sidebar`,className:O(`fixed inset-y-0 start-0 z-50 border-e border-black/[0.06] dark:border-white/[0.06] transform transition-[width,transform,background-color] duration-200 ease-out shadow-[0_24px_80px_rgba(15,23,42,0.12)]`,b?`w-18`:`w-72 max-sm:w-64`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,y?`bg-gray-100/75 dark:bg-dark-50/75 backdrop-blur-xl`:`bg-gray-100 dark:bg-dark-50`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Oe&&(0,V.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,V.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,V.jsx)(fl,{sidebarCompact:b,isElectron:Oe,selectedModel:l,modelCount:u.length,onToggleCompact:x,onCreateSession:_e}),(0,V.jsx)(pl,{sidebarCompact:b,activePath:i.pathname,onChatClick:ve,onMobileNavigate:me}),(0,V.jsx)(ml,{sessions:o,personas:m,currentSessionId:pe,generatingTitleForSession:p,sidebarCompact:b,editingSessionId:S,editingTitle:C,onEditingTitleChange:w,onSelectSession:ye,onStartEditing:xe,onSaveEdit:Se,onCancelEdit:Ce,onDeleteSession:be}),(0,V.jsx)(gl,{requiresAuth:_?.requiresAuth,user:h,isAdmin:g(),sidebarCompact:b,userMenuOpen:ne,userMenuRef:le,onToggleUserMenu:()=>E(e=>!e),onOpenSettings:Te,onOpenAvatar:D,onLogout:we,onMobileNavigate:me,onCloseUserMenu:()=>E(!1)})]})]}),T&&(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(vl,{isOpen:T,onClose:()=>te(!1)})}),(0,V.jsx)(cl,{open:re,value:ae,saving:se,onChange:oe,onClose:()=>ie(!1),onSave:ge})]})},bl=({children:e,requireAuth:t=!0,requireAdmin:n=!1})=>{let{isAuthenticated:r,user:i,systemInfo:a,isLoading:o}=$();return G(),o?(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-200 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):a&&!a.requiresAuth?(0,V.jsx)(V.Fragment,{children:e}):t&&!r?(0,V.jsx)(fi,{to:`/login`,replace:!0}):n&&(!i||i.role!==`admin`)?(0,V.jsx)(fi,{to:`/`,replace:!0}):(0,V.jsx)(V.Fragment,{children:e})},xl=c(`components:error-boundary`),Sl=({error:e})=>{let{t}=Y();return(0,V.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4 text-gray-900 dark:text-dark-800`,children:(0,V.jsx)(`div`,{className:`w-full max-w-md rounded-2xl border border-gray-200 dark:border-dark-300 bg-white/95 dark:bg-dark-100/95 shadow-card backdrop-blur-sm`,children:(0,V.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,V.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-700 dark:bg-primary-900/35 dark:text-primary-300 ring-1 ring-primary-200 dark:ring-primary-800/60`,children:(0,V.jsx)(y,{className:`h-6 w-6`})}),(0,V.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,V.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,V.jsxs)(`button`,{onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl bg-primary-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-primary-700 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-dark-100`,children:[(0,V.jsx)(ee,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,V.jsxs)(`button`,{onClick:()=>{window.location.assign(`/`)},className:`inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-all hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-700 dark:hover:bg-dark-200 dark:focus:ring-offset-dark-100`,children:[(0,V.jsx)(p,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},Cl=class extends B.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){xl.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,V.jsx)(Sl,{error:this.state.error}):this.props.children}},wl=(e,t=!0)=>{let n=(0,B.useCallback)(n=>{if(!t)return;let r=n.target;if(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.contentEditable===`true`||r.isContentEditable)return;if(n.key===`?`||n.key===`/`&&n.shiftKey){let t=e.find(e=>e.key===`?`||e.key===`h`);if(t){n.preventDefault(),n.stopPropagation(),t.action();return}}let i=e.find(e=>{let t=e.key.toLowerCase()===n.key.toLowerCase(),r=!!e.metaKey,i=n.metaKey||n.ctrlKey,a=r?i:!0,o=e.ctrlKey?n.ctrlKey:!0,s=!!e.shiftKey===n.shiftKey,c=!!e.altKey===n.altKey;return t&&a&&o&&s&&c});i&&(n.preventDefault(),n.stopPropagation(),i.action())},[e,t]);(0,B.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},Tl=e=>{let t=[];e.metaKey&&t.push(navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`),e.ctrlKey&&t.push(`Ctrl`),e.shiftKey&&t.push(`⇧`),e.altKey&&t.push(navigator.platform.includes(`Mac`)?`⌥`:`Alt`);let n=e.key.toUpperCase();return e.key===`,`&&(n=`,`),e.key===` `&&(n=`Space`),e.key===`Enter`&&(n=`↩`),e.key===`Escape`&&(n=`Esc`),t.push(n),t.join(`+`)},El=({isOpen:e,onClose:t,shortcuts:n})=>{let{t:r}=Y();if(!e)return null;let i={navigation:n.filter(e=>e.description.includes(`sidebar`)||e.description.includes(`Toggle`)),settings:n.filter(e=>e.description.includes(`settings`)||e.description.includes(`dark mode`)),general:n.filter(e=>!e.description.includes(`sidebar`)&&!e.description.includes(`settings`)&&!e.description.includes(`dark mode`)&&!e.description.includes(`Toggle`))};return(0,V.jsx)(`div`,{className:`fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4`,children:(0,V.jsxs)(`div`,{className:`bg-white dark:bg-dark-100 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-b border-gray-200 dark:border-dark-300`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(u,{className:`h-5 w-5 text-gray-700 dark:text-dark-600`}),(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:r(`keyboard.title`)})]}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:t,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,V.jsx)(oe,{className:`h-4 w-4`})})]}),(0,V.jsxs)(`div`,{className:`p-6 space-y-6 overflow-y-auto max-h-[60vh]`,children:[Object.entries(i).map(([e,t])=>t.length===0?null:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.${e}`)}),(0,V.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:e.description}),(0,V.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:Tl(e)})]},t))})]},e)),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.chat`)}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.sendMessage`)}),(0,V.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Enter`})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.newLine`)}),(0,V.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Shift+Enter`})]})]})]})]}),(0,V.jsx)(`div`,{className:`px-6 py-4 bg-gray-50 dark:bg-dark-200 border-t border-gray-200 dark:border-dark-300`,children:(0,V.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-400 text-center`,children:[r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[0],(0,V.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`?`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[1].split(`H`)[0],(0,V.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`H`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`H`)[1]]})})]})})},Dl=({onClick:e,className:t})=>{let{t:n}=Y(),[r,i]=(0,B.useState)(!1);return(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:O(`fixed bottom-4 end-4 h-10 w-10 p-0 bg-white/80 dark:bg-dark-100/80 backdrop-blur-sm border border-gray-200 dark:border-dark-300 shadow-lg hover:shadow-xl transition-all duration-200 z-50`,`hover:bg-white dark:hover:bg-dark-100`,t),title:n(`keyboard.tooltip`),children:[(0,V.jsx)(u,{className:`h-4 w-4`}),r&&(0,V.jsx)(`div`,{className:`absolute bottom-full mb-2 end-0 px-2 py-1 text-xs bg-gray-900 text-white rounded whitespace-nowrap`,children:n(`keyboard.tooltip`)})]})},Ol=({message:e=`This is a demo version for presentation purposes only. The Ollama backend is not connected.`,onDismiss:t,className:n})=>{let[r,i]=(0,B.useState)(!1),{t:a}=Y();return r?null:(0,V.jsx)(`div`,{className:O(`bg-gray-950 text-white dark:bg-white dark:text-gray-950`,`border-b border-black/10 dark:border-white/10`,`px-4 py-2`,n),children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0`,children:(0,V.jsx)(m,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,V.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,onClick:()=>window.open(`https://github.com/libre-webui/libre-webui`,`_blank`),title:`View on GitHub`,children:[(0,V.jsx)(ce,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,V.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>{i(!0),t?.()},className:`h-8 w-8 p-0 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,title:`Dismiss`,children:(0,V.jsx)(oe,{className:`h-4 w-4`})})]})]})})},kl=()=>{let{preferences:e,backgroundImage:t}=vc(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,V.jsx)(`div`,{className:`fixed inset-0 pointer-events-none z-0`,style:{backgroundImage:`url(${r})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,filter:`blur(${n.blurAmount}px)`,opacity:n.opacity,transform:`scale(1.1)`}})},Al=c(`user-service`),jl=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=$.getState();try{e(!0),Al.debug(`Starting auth initialization...`),Al.debug(`Fetching system info...`);let r=await Ee.getSystemInfo();Al.debug(`System info response:`,r),r.success&&r.data?(Al.debug(`Setting system info:`,r.data),t(r.data)):Al.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await s(async()=>{let{default:e}=await import(`../js/utils-vendor-BX3ZwoIK.js`).then(e=>e.i);return{default:e}},__vite__mapDeps([4,1,5]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await Ee.verifyToken();if(r.success&&r.data){let e=$.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){Al.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){Al.error(`Auth initialization error:`,e)}finally{e(!1)}}};ge.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),ge.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=$.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var Ml=c(`initialize`),Nl=()=>{let e=(0,B.useRef)(!1),{loadSessions:t,loadModels:n,loadPreferences:r,setSelectedModel:i,models:a}=Ls(),{loadPreferences:o}=vc(),{loadPlugins:s,plugins:c}=bc();(0,B.useEffect)(()=>{e.current||(async()=>{try{if(Ml.debug(`Initializing Libre WebUI...`),e.current=!0,await jl.initializeAuth(),!(await we.checkHealth()).success)if(ye()){await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]);return}else{C.error(`Ollama service is not available. Please make sure it's running.`);return}await Promise.all([o(),r()]),await Promise.all([n(),t(),s()]),Ml.debug(`Libre WebUI initialized successfully`)}catch(e){ye()?(await Promise.all([o(),r()]),await Promise.all([n(),t(),s()])):(Ml.error(`Failed to initialize app:`,e),C.error(`Failed to connect to the backend service`))}})()},[o,r,n,t,s]),(0,B.useEffect)(()=>{if(a.length>0){let e=a.filter(e=>!e.name.includes(`embed`))[0]||a[0],{selectedModel:t}=Ls.getState();t?a.map(e=>e.name).includes(t)||(Ml.debug(`Selected model not available, falling back to:`,e.name),i(e.name)):(Ml.debug(`No model selected, using first available:`,e.name),i(e.name))}},[a,i]),(0,B.useEffect)(()=>{c.filter(e=>e.active).length>0&&(Ml.debug(`Active plugins changed, reloading models...`),n())},[c,n])},Pl=c(`components:git-hub-auth-button`),Fl=()=>{let{t:e}=Y(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Se}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Pl.debug(`GitHub OAuth configured:`,t.configured)}else Pl.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Pl.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,V.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Se}/auth/oauth/github`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(v,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(w,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Il=c(`components:hugging-face-auth-button`),Ll=()=>{let{t:e}=Y(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Se}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Il.debug(`Hugging Face OAuth configured:`,t.configured)}else Il.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Il.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,V.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Se}/auth/oauth/huggingface`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(v,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Rl=c(`components:login-form`),zl={username:`demo`,password:`demo`},Bl=({onLogin:e,onShowSignup:t})=>{let{t:n}=Y(),r=ye(),[i,a]=(0,B.useState)(r?zl.username:``),[o,s]=(0,B.useState)(r?zl.password:``),[c,l]=(0,B.useState)(!1),[u,f]=(0,B.useState)(!1),p=Br(),{login:m}=$(),h=async t=>{t.preventDefault();let a=r?zl.username:i.trim(),s=r?zl.password:o.trim();if(!a||!s){d.error(n(`auth.login.enterBoth`));return}f(!0);try{localStorage.removeItem(`auth-token`);let t=await Ee.login({username:a,password:s});t.success&&t.data?(m(t.data.user,t.data.token,t.data.systemInfo),d.success(n(`auth.login.loginSuccess`)),e?.(),p(`/`)):d.error(t.message||n(`auth.login.loginFailed`))}catch(e){Rl.error(`Login error:`,e),d.error(n(`auth.login.checkCredentials`))}finally{f(!1)}},g=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,V.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,V.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.login.title`)}),(0,V.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.login.subtitle`)})]}),(0,V.jsxs)(`form`,{onSubmit:h,className:`space-y-5`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.username`)}),(0,V.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:g,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.usernamePlaceholder`),required:!0,disabled:u||r})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.login.password`)}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`input`,{id:`password`,type:c?`text`:`password`,value:o,onChange:e=>s(e.target.value),onKeyDown:g,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:n(`auth.login.passwordPlaceholder`),required:!0,disabled:u||r}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(!c),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:u||r,"aria-label":c?`Hide characters`:`Reveal characters`,children:c?(0,V.jsx)(ae,{size:20}):(0,V.jsx)(T,{size:20})})]})]}),(0,V.jsx)(`button`,{type:`submit`,disabled:u,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:u?(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.login.signingIn`)]}):(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(x,{size:16,className:`me-2`}),n(`auth.login.signIn`)]})})]}),!r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`mt-6`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,V.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,V.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,V.jsx)(`span`,{className:`bg-surface-raised px-2 text-ink-muted`,children:n(`common.or`)})})]}),(0,V.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[(0,V.jsx)(Fl,{}),(0,V.jsx)(Ll,{})]})]}),(0,V.jsx)(`div`,{className:`mt-6 text-center`,children:(0,V.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.login.noAccount`),` `,(0,V.jsx)(`button`,{onClick:()=>t?.(),className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.login.signUpHere`)})]})})]})]})},Vl=c(`components:turnstile-widget`),Hl=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,Ul=null,Wl=()=>window.turnstile?Promise.resolve():Ul||(Ul=new Promise((e,t)=>{let n=document.querySelector(`script[src="${Hl}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=Hl,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),Ul),Gl=({siteKey:e,disabled:t=!1,errorMessage:n,onTokenChange:r})=>{let i=(0,B.useRef)(null),a=(0,B.useRef)(null),[o,s]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let t=!1,n=i.current;return r(``),Wl().then(()=>{t||!n||!window.turnstile||(n.innerHTML=``,a.current=window.turnstile.render(n,{sitekey:e,theme:`auto`,callback:e=>r(e),"expired-callback":()=>r(``),"error-callback":()=>r(``)}))}).catch(e=>{Vl.error(`Turnstile script failed to load:`,e),t||s(!0)}),()=>{t=!0,r(``),a.current&&window.turnstile?.remove?window.turnstile.remove(a.current):n&&(n.innerHTML=``),a.current=null}},[r,e]),(0,B.useEffect)(()=>{t&&a.current&&(window.turnstile?.reset(a.current),r(``))},[t,r]),o?(0,V.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:n}):(0,V.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${t?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,V.jsx)(`div`,{ref:i,className:`min-h-[65px]`})})},Kl=c(`components:signup-form`),ql=({onSignup:e,onBackToLogin:t})=>{let{t:n}=Y(),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(``),b=Br(),{login:x,systemInfo:S}=$(),ee=S?.turnstile?.siteKey,C=!!(S?.turnstile?.enabled&&ee),w=(0,B.useCallback)(e=>{y(e)},[]),te=(0,B.useMemo)(()=>g||C&&!v,[g,C,v]),ne=async t=>{if(t.preventDefault(),!r.trim()||!s.trim()){d.error(n(`auth.signup.usernameRequired`));return}if(s!==l){d.error(n(`auth.signup.passwordMismatch`));return}if(s.length<6){d.error(n(`auth.signup.passwordTooShort`));return}if(C&&!v){d.error(n(`auth.signup.tryAgain`));return}_(!0);try{let t=await Ee.signup({username:r,password:s,email:a,turnstileToken:v});t.success&&t.data?(x(t.data.user,t.data.token,t.data.systemInfo),d.success(n(`auth.signup.signupSuccess`)),e?.(),b(`/`)):d.error(t.message||n(`auth.signup.signupFailed`))}catch(e){Kl.error(`Signup error:`,e),d.error(n(`auth.signup.tryAgain`))}finally{y(``),_(!1)}},E=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`,children:[(0,V.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,V.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:n(`auth.signup.title`)}),(0,V.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:n(`auth.signup.subtitle`)})]}),(0,V.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.username`)}),(0,V.jsx)(`input`,{id:`username`,type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.usernamePlaceholder`),required:!0,disabled:g})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[n(`auth.signup.email`),` `,(0,V.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,n(`common.optional`),`)`]})]}),(0,V.jsx)(`input`,{id:`email`,type:`email`,value:a,onChange:e=>o(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.emailPlaceholder`),disabled:g})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.password`)}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`input`,{id:`password`,type:f?`text`:`password`,value:s,onChange:e=>c(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.passwordPlaceholder`),required:!0,disabled:g}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>p(!f),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:g,"aria-label":f?`Hide characters`:`Reveal characters`,children:f?(0,V.jsx)(ae,{size:20}):(0,V.jsx)(T,{size:20})})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:n(`auth.signup.confirmPassword`)}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`input`,{id:`confirmPassword`,type:m?`text`:`password`,value:l,onChange:e=>u(e.target.value),onKeyDown:E,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:n(`auth.signup.confirmPasswordPlaceholder`),required:!0,disabled:g}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(!m),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:g,"aria-label":m?`Hide confirmation`:`Reveal confirmation`,children:m?(0,V.jsx)(ae,{size:20}):(0,V.jsx)(T,{size:20})})]})]}),C&&ee&&(0,V.jsx)(Gl,{siteKey:ee,disabled:g,errorMessage:n(`auth.signup.tryAgain`),onTokenChange:w}),(0,V.jsx)(`button`,{type:`submit`,disabled:te,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:g?(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),n(`auth.signup.creatingAccount`)]}):(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(ue,{size:16,className:`me-2`}),n(`auth.signup.createAccount`)]})})]}),(0,V.jsx)(Fl,{}),(0,V.jsx)(`div`,{className:`mt-6 text-center`,children:(0,V.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[n(`auth.signup.hasAccount`),` `,(0,V.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:n(`auth.signup.signInHere`)})]})})]})},Jl=()=>{let{t:e}=Y(),t=Br(),{isAuthenticated:n,requiresAuth:r}=$(),[i,a]=(0,B.useState)(!1),o=r();return(0,B.useEffect)(()=>{(n||!o)&&t(`/`)},[o,n,t]),n||!o?null:(0,V.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-gray-50 text-gray-950 dark:bg-dark-50 dark:text-dark-950`,children:[(0,V.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-10 flex h-16 items-center justify-between border-b border-gray-200/70 px-5 dark:border-white/[0.08] sm:px-8`,children:[(0,V.jsx)(ul,{size:`sm`,className:`text-gray-950 dark:text-dark-950 lg:invisible`}),(0,V.jsx)(dl,{})]}),(0,V.jsxs)(`main`,{className:`grid min-h-screen pt-16 lg:grid-cols-[minmax(20rem,0.9fr)_minmax(32rem,1.1fr)]`,children:[(0,V.jsxs)(`section`,{className:`relative hidden overflow-hidden border-e border-gray-200/70 p-10 dark:border-white/[0.08] lg:flex lg:flex-col lg:justify-between xl:p-16`,children:[(0,V.jsx)(ul,{size:`lg`,className:`relative z-10 text-gray-950 dark:text-dark-950`}),(0,V.jsx)(`div`,{className:`relative z-10 max-w-xl border-s border-gray-300 ps-6 dark:border-white/15`,children:(0,V.jsx)(`p`,{className:`text-4xl font-light leading-[1.08] tracking-[-0.04em] text-gray-900 dark:text-dark-900 xl:text-5xl`,children:e(`setup.welcome.features.secure.description`)})})]}),(0,V.jsx)(`section`,{className:`flex items-center justify-center px-4 py-12 sm:px-8 lg:py-16`,children:(0,V.jsx)(`div`,{className:`w-full max-w-md [&>div]:!max-w-none [&>div]:!rounded-none [&>div]:!border-0 [&>div]:!bg-transparent [&>div]:!p-0 [&>div]:!shadow-none`,children:i?(0,V.jsx)(ql,{onBackToLogin:()=>a(!1),onSignup:()=>a(!1)}):(0,V.jsx)(Bl,{onShowSignup:()=>a(!0)})})})]})]})},Yl=window.location.protocol===`file:`?na:ta,Xl=window.location.protocol===`file:`,Zl=()=>Xl?(0,V.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,Ql=c(`app`),$l=B.lazy(()=>s(()=>import(`../js/ChatPage-D35quAJJ.js`),__vite__mapDeps([15,1,5,16,12,13,2,3,7,0,4,8,14,17,18,19,20]))),eu=B.lazy(()=>s(()=>import(`../js/ModelsPage-1ykVyEI4.js`),__vite__mapDeps([21,1,5,12,13,2,3,7,0,4,8,14]))),tu=B.lazy(()=>s(()=>import(`../js/PersonasPage-Dg1AQ0e8.js`),__vite__mapDeps([22,1,5,12,13,2,3,7,0,4,8,14]))),nu=B.lazy(()=>s(()=>import(`../js/GalleryPage-BNdUukNh.js`),__vite__mapDeps([23,1,5,16,13,2,3,7,0,4,8,14]))),ru=B.lazy(()=>s(()=>import(`../js/LibreClawPage-D_N9GBg7.js`),__vite__mapDeps([24,1,5,2,3,7,0,4,8,14]))),iu=B.lazy(()=>s(()=>import(`../js/UserManagementPage-CA15W6yb.js`),__vite__mapDeps([25,1,5,12,13,2,3,7,0,4,14,8]))),au=B.lazy(()=>s(()=>import(`../js/ArtifactDemoPage-CVxPfyus.js`),__vite__mapDeps([26,1,5,14,8,4,18,2,3,7,19,20,17]))),ou=B.lazy(()=>s(()=>import(`../js/SettingsModal-BRQcVyKI.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([11,1,5,12,13,2,3,7,0,4,8,14]))),su=B.lazy(()=>s(()=>import(`../js/ArtifactSlideOutPanel-MP4ap9If.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([27,1,5,16,2,3,7,8,4,14,19,20,17]))),cu=B.lazy(()=>s(()=>import(`../js/FirstTimeSetup-B9NVXnGv.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([28,1,5,2,3,7,0,4]))),lu=()=>{let{t:e}=Y();return(0,V.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`h-8 w-8 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin dark:border-dark-300 dark:border-t-primary-400`}),(0,V.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},uu=({isOpen:e,compact:t})=>(0,V.jsx)(`div`,{"aria-hidden":`true`,className:O(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-18`:`w-72`:`w-0`)}),du=({onClick:e})=>{let t=G();return t.pathname===`/`||t.pathname===`/chat`||t.pathname.startsWith(`/c/`)?(0,V.jsx)(`div`,{className:`hidden lg:block`,children:(0,V.jsx)(Dl,{onClick:e})}):null},fu=()=>{let{t:e,i18n:t}=Y(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)(!1),{sidebarOpen:u,sidebarCompact:d,setSidebarOpen:f,setSidebarCompact:p,toggleSidebar:m,toggleSidebarCompact:h,toggleTheme:g,backgroundImage:_,preferences:v,artifactPanelOpen:y}=vc(),{systemInfo:b,isLoading:x,user:S,isAuthenticated:ee}=$(),{isDemoMode:w,demoConfig:T}=vc(),[te,ne]=B.useState(!1),E=B.useRef(!1);B.useEffect(()=>{(async()=>{if(E.current){Ql.debug(`OAuth already processing, skipping...`);return}Ql.debug(`Starting OAuth callback processing...`),E.current=!0;let e=new URLSearchParams(window.location.search),t=e.get(`token`),n=e.get(`auth`);if(t&&n===`success`){try{let e=await fetch(`${Se}/auth/me`,{headers:{Authorization:`Bearer ${t}`},credentials:`include`});if(e.ok){let n=await e.json();if(n.success&&n.data){let{login:e,systemInfo:r}=$.getState();e(n.data,t,r||{requiresAuth:!0,hasUsers:!0,userCount:1,version:`0.1.6`}),Ql.debug(`OAuth login successful, showing toast`),C.success(`GitHub login successful!`)}else C.error(`Failed to verify GitHub authentication`)}else C.error(`GitHub authentication verification failed`)}catch(e){Ql.error(`OAuth processing error:`,e),C.error(`GitHub authentication failed`)}window.history.replaceState({},document.title,window.location.pathname)}Ql.debug(`OAuth processing completed`),ne(!0),E.current=!1})()},[]),Nl();let re=()=>{if(_)return!0;let e=v.backgroundSettings;return e?.enabled&&e?.imageUrl},ie=[{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?u?h():(p(!1),m()):(!u&&d&&p(!1),m())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>r(!0),description:e(`keyboard.openSettings`)},{key:`d`,metaKey:!0,action:g,description:e(`keyboard.toggleDarkMode`)},{key:`h`,action:()=>a(!0),description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>{r(!1),a(!1)},description:e(`keyboard.closeModals`)}];wl(ie),B.useEffect(()=>(Tc.connect().catch(Ql.error),()=>{Tc.disconnect()}),[]),B.useEffect(()=>{if(!b&&!x&&o<15){let e=setTimeout(async()=>{s(e=>e+1);try{await jl.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[b,x,o]);let ae=!c&&b?.requiresAuth===!0&&b?.hasUsers===!1;return x?(0,V.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8`,children:[(0,V.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,V.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,V.jsx)(ul,{className:`text-gray-900 dark:text-gray-100`})})}),(0,V.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})})]}):b?ae&&!c?(0,V.jsx)(Cl,{children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(lu,{}),children:(0,V.jsx)(cu,{onComplete:()=>{l(!0)}})})}):te?(0,V.jsx)(Cl,{children:(0,V.jsxs)(Yl,{children:[b&&!b.requiresAuth?(0,V.jsxs)(`div`,{className:O(`flex h-screen text-gray-950 dark:text-dark-900 relative overflow-hidden`,re()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,V.jsx)(Zl,{}),(0,V.jsx)(kl,{}),(0,V.jsx)(yl,{isOpen:u,onClose:()=>f(!1)}),(0,V.jsx)(uu,{isOpen:u,compact:d}),(0,V.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,u&&d?`max-lg:ms-18`:`max-lg:ms-0`,re()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&T.showBanner&&(0,V.jsx)(Ol,{message:T.message}),(0,V.jsx)(`main`,{className:O(`flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,re()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,V.jsx)(Cl,{children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(lu,{}),children:(0,V.jsxs)(mi,{children:[(0,V.jsx)(K,{path:`/`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/chat`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/c/:sessionId`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/models`,element:(0,V.jsx)(eu,{})}),(0,V.jsx)(K,{path:`/personas`,element:(0,V.jsx)(tu,{})}),(0,V.jsx)(K,{path:`/login`,element:(0,V.jsx)(Jl,{})})]})})})})]})]}):(0,V.jsxs)(mi,{children:[(0,V.jsx)(K,{path:`/login`,element:(0,V.jsx)(Jl,{})}),(0,V.jsx)(K,{path:`/*`,element:(0,V.jsx)(bl,{children:(0,V.jsxs)(`div`,{className:O(`flex h-screen text-gray-950 dark:text-dark-900 relative overflow-hidden`,re()?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,V.jsx)(Zl,{}),(0,V.jsx)(kl,{}),(0,V.jsx)(yl,{isOpen:u,onClose:()=>f(!1)}),(0,V.jsx)(uu,{isOpen:u,compact:d}),(0,V.jsxs)(`div`,{"data-testid":`app-shell-content`,className:O(`flex-1 basis-0 flex flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:py-2 lg:pe-2`,u&&d?`max-lg:ms-18`:`max-lg:ms-0`,re()?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[w&&T.showBanner&&(0,V.jsx)(Ol,{message:T.message}),(0,V.jsx)(`main`,{className:O(`flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,re()?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,V.jsx)(Cl,{children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(lu,{}),children:(0,V.jsxs)(mi,{children:[(0,V.jsx)(K,{path:`/`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/chat`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/c/:sessionId`,element:(0,V.jsx)($l,{})}),(0,V.jsx)(K,{path:`/models`,element:(0,V.jsx)(eu,{})}),(0,V.jsx)(K,{path:`/personas`,element:(0,V.jsx)(tu,{})}),(0,V.jsx)(K,{path:`/gallery`,element:(0,V.jsx)(nu,{})}),(0,V.jsx)(K,{path:`/agents`,element:(0,V.jsx)(ru,{})}),(0,V.jsx)(K,{path:`/artifacts`,element:(0,V.jsx)(au,{})}),(0,V.jsx)(K,{path:`/users`,element:(0,V.jsx)(bl,{requireAdmin:!0,children:(0,V.jsx)(iu,{})})})]})})})})]})]})})})]}),n&&(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(ou,{isOpen:n,onClose:()=>r(!1)})}),(0,V.jsx)(El,{isOpen:i,onClose:()=>a(!1),shortcuts:ie}),(0,V.jsx)(du,{onClick:()=>a(!0)}),y&&(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(su,{})}),(0,V.jsx)(he,{position:xs(t.language)?`top-left`:`top-right`,toastOptions:{duration:4e3,className:`animate-slide-up`,style:{background:`var(--toast-bg)`,color:`var(--toast-color)`,border:`1px solid var(--toast-border)`,borderRadius:`0.75rem`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,cursor:`pointer`},success:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}},error:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}}},containerStyle:{top:80,insetInlineEnd:20}})]})}):(0,V.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):(0,V.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`mb-8`,children:(0,V.jsx)(ul,{className:`text-gray-900 dark:text-white`})}),(0,V.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}),(0,V.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:o>0?`Connecting to backend... (${o}/15)`:`Starting up...`})]})})},pu=new mn({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});Ts.catch(()=>{Ss(`en`)}).then(()=>{Sa.createRoot(document.getElementById(`root`)).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(_n,{client:pu,children:(0,V.jsx)(fu,{})})}))});export{bt as $,Ls as A,Eo as B,bc as C,zs as D,Rs as E,Y as F,G,vo as H,Ro as I,gn as J,Br as K,Io as L,xs as M,bs as N,sc as O,gs as P,jt as Q,No as R,Tc as S,Bs as T,bo as U,To as V,Za as W,Mt as X,Ut as Y,At as Z,kc as _,il as a,P as at,Ec as b,tl as c,Ve as ct,Zc as d,Be as dt,F as et,Xc as f,Fe as ft,Lc as g,A as gt,Rc as h,j as ht,al as i,ze as it,ws as j,Z as k,$c as l,Xe as lt,zc as m,M as mt,ul as n,lt as nt,Qc as o,tt as ot,Wc as p,N as pt,Hr as q,sl as r,ct as rt,nl as s,He as st,Gl as t,pt as tt,el as u,ot as ut,Fc as v,vc as w,$ as x,Nc as y,Ao as z};