libre-webui 0.15.1 → 0.16.0
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.
- package/backend/dist/db.d.ts.map +1 -1
- package/backend/dist/db.js +63 -0
- package/backend/dist/db.js.map +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +4 -4
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/routes/chat.d.ts.map +1 -1
- package/backend/dist/routes/chat.js +93 -10
- package/backend/dist/routes/chat.js.map +1 -1
- package/backend/dist/routes/imageGen.d.ts.map +1 -1
- package/backend/dist/routes/imageGen.js +52 -29
- package/backend/dist/routes/imageGen.js.map +1 -1
- package/backend/dist/routes/plugins.d.ts.map +1 -1
- package/backend/dist/routes/plugins.js +218 -41
- package/backend/dist/routes/plugins.js.map +1 -1
- package/backend/dist/routes/preferences.d.ts.map +1 -1
- package/backend/dist/routes/preferences.js +5 -4
- package/backend/dist/routes/preferences.js.map +1 -1
- package/backend/dist/routes/tts.js +2 -2
- package/backend/dist/routes/tts.js.map +1 -1
- package/backend/dist/services/assistantCompletionService.d.ts +2 -1
- package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
- package/backend/dist/services/assistantCompletionService.js +3 -1
- package/backend/dist/services/assistantCompletionService.js.map +1 -1
- package/backend/dist/services/chatGenerationService.d.ts +5 -3
- package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/chatGenerationService.js +18 -6
- package/backend/dist/services/chatGenerationService.js.map +1 -1
- package/backend/dist/services/chatRequestService.d.ts +6 -4
- package/backend/dist/services/chatRequestService.d.ts.map +1 -1
- package/backend/dist/services/chatRequestService.js +10 -2
- package/backend/dist/services/chatRequestService.js.map +1 -1
- package/backend/dist/services/chatService.d.ts +2 -2
- package/backend/dist/services/chatService.d.ts.map +1 -1
- package/backend/dist/services/chatService.js +29 -17
- package/backend/dist/services/chatService.js.map +1 -1
- package/backend/dist/services/embeddingService.js +1 -1
- package/backend/dist/services/embeddingService.js.map +1 -1
- package/backend/dist/services/pluginActivationService.d.ts +11 -0
- package/backend/dist/services/pluginActivationService.d.ts.map +1 -0
- package/backend/dist/services/pluginActivationService.js +163 -0
- package/backend/dist/services/pluginActivationService.js.map +1 -0
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts +1 -1
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
- package/backend/dist/services/pluginCapabilityRegistryService.js +1 -1
- package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
- package/backend/dist/services/pluginCredentialsService.d.ts +16 -8
- package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
- package/backend/dist/services/pluginCredentialsService.js +47 -14
- package/backend/dist/services/pluginCredentialsService.js.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.d.ts +2 -2
- package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.js +33 -13
- package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.d.ts +11 -7
- package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.js +265 -81
- package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
- package/backend/dist/services/pluginService.d.ts +55 -25
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +658 -170
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/pluginTTSService.d.ts +4 -4
- package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
- package/backend/dist/services/pluginTTSService.js +24 -28
- package/backend/dist/services/pluginTTSService.js.map +1 -1
- package/backend/dist/services/pluginVariablesService.d.ts +6 -1
- package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
- package/backend/dist/services/pluginVariablesService.js +59 -1
- package/backend/dist/services/pluginVariablesService.js.map +1 -1
- package/backend/dist/services/preferencesService.d.ts +2 -2
- package/backend/dist/services/preferencesService.d.ts.map +1 -1
- package/backend/dist/services/preferencesService.js +78 -10
- package/backend/dist/services/preferencesService.js.map +1 -1
- package/backend/dist/services/titleGenerationService.d.ts +6 -4
- package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
- package/backend/dist/services/titleGenerationService.js +9 -5
- package/backend/dist/services/titleGenerationService.js.map +1 -1
- package/backend/dist/services/workAgentService.d.ts +5 -2
- package/backend/dist/services/workAgentService.d.ts.map +1 -1
- package/backend/dist/services/workAgentService.js +315 -44
- package/backend/dist/services/workAgentService.js.map +1 -1
- package/backend/dist/services/workModelProviderService.d.ts +6 -3
- package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
- package/backend/dist/services/workModelProviderService.js +243 -19
- package/backend/dist/services/workModelProviderService.js.map +1 -1
- package/backend/dist/services/workTaskService.d.ts +2 -0
- package/backend/dist/services/workTaskService.d.ts.map +1 -1
- package/backend/dist/services/workTaskService.js +89 -14
- package/backend/dist/services/workTaskService.js.map +1 -1
- package/backend/dist/storage.d.ts.map +1 -1
- package/backend/dist/storage.js +9 -6
- package/backend/dist/storage.js.map +1 -1
- package/backend/dist/storageMappers.d.ts +3 -0
- package/backend/dist/storageMappers.d.ts.map +1 -1
- package/backend/dist/storageMappers.js +3 -0
- package/backend/dist/storageMappers.js.map +1 -1
- package/backend/dist/types/index.d.ts +54 -1
- package/backend/dist/types/index.d.ts.map +1 -1
- package/backend/dist/types/index.js.map +1 -1
- package/backend/dist/types/work.d.ts +1 -1
- package/backend/dist/types/work.d.ts.map +1 -1
- package/backend/dist/utils/chatContext.d.ts +13 -1
- package/backend/dist/utils/chatContext.d.ts.map +1 -1
- package/backend/dist/utils/chatContext.js +52 -0
- package/backend/dist/utils/chatContext.js.map +1 -1
- package/backend/dist/utils/chatProviderSelection.d.ts +15 -0
- package/backend/dist/utils/chatProviderSelection.d.ts.map +1 -0
- package/backend/dist/utils/chatProviderSelection.js +59 -0
- package/backend/dist/utils/chatProviderSelection.js.map +1 -0
- package/backend/dist/utils/imageGenerationValidation.d.ts +3 -0
- package/backend/dist/utils/imageGenerationValidation.d.ts.map +1 -0
- package/backend/dist/utils/imageGenerationValidation.js +55 -0
- package/backend/dist/utils/imageGenerationValidation.js.map +1 -0
- package/backend/dist/utils/openAIResponsesAdapter.d.ts +88 -0
- package/backend/dist/utils/openAIResponsesAdapter.d.ts.map +1 -0
- package/backend/dist/utils/openAIResponsesAdapter.js +521 -0
- package/backend/dist/utils/openAIResponsesAdapter.js.map +1 -0
- package/backend/dist/utils/pluginChatAdapter.d.ts +7 -4
- package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.js +33 -5
- package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
- package/backend/dist/utils/pluginChatContext.d.ts.map +1 -1
- package/backend/dist/utils/pluginChatContext.js +5 -1
- package/backend/dist/utils/pluginChatContext.js.map +1 -1
- package/backend/dist/utils/pluginConnectionVariables.d.ts +6 -0
- package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -0
- package/backend/dist/utils/pluginConnectionVariables.js +52 -0
- package/backend/dist/utils/pluginConnectionVariables.js.map +1 -0
- package/backend/dist/utils/pluginDefinitionTrust.d.ts +9 -0
- package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -0
- package/backend/dist/utils/pluginDefinitionTrust.js +71 -0
- package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -0
- package/backend/dist/utils/pluginStreamAdapter.d.ts +3 -0
- package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreamAdapter.js +410 -0
- package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
- package/backend/dist/utils/pluginStreaming.d.ts +7 -1
- package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreaming.js +12 -1
- package/backend/dist/utils/pluginStreaming.js.map +1 -1
- package/backend/dist/utils/pluginValidation.d.ts +20 -2
- package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginValidation.js +187 -17
- package/backend/dist/utils/pluginValidation.js.map +1 -1
- package/backend/dist/utils/pluginVariableValidation.d.ts +7 -0
- package/backend/dist/utils/pluginVariableValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginVariableValidation.js +79 -4
- package/backend/dist/utils/pluginVariableValidation.js.map +1 -1
- package/backend/dist/websocketServer.d.ts.map +1 -1
- package/backend/dist/websocketServer.js +16 -3
- package/backend/dist/websocketServer.js.map +1 -1
- package/backend/package.json +1 -1
- package/frontend/dist/assets/index-CKV9Lnj8.js +5 -0
- package/frontend/dist/assets/index-Dme2Ozol.css +1 -0
- package/frontend/dist/index.html +3 -3
- package/frontend/dist/js/{ArtifactContainer-BHSBrlQB.js → ArtifactContainer-B0uVR8Z9.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-BHGJmJAT.js → ArtifactDemoPage-DBVPHFxk.js} +1 -1
- package/frontend/dist/js/{ArtifactSlideOutPanel-s8vcE5Ea.js → ArtifactSlideOutPanel-Cg5kAwv9.js} +1 -1
- package/frontend/dist/js/ChatPage-CPHlIZqU.js +16 -0
- package/frontend/dist/js/{FirstTimeSetup-BYWAVAdE.js → FirstTimeSetup-DksL5arK.js} +1 -1
- package/frontend/dist/js/GalleryPage-1mdUGo_N.js +1 -0
- package/frontend/dist/js/LibreClawPage-qGr1Jy8p.js +1 -0
- package/frontend/dist/js/ModelSelector-CUnwRmNU.js +1 -0
- package/frontend/dist/js/ModelsPage-DMYVg3LT.js +2 -0
- package/frontend/dist/js/PersonasPage-Ct-KKW-j.js +13 -0
- package/frontend/dist/js/{RichMessageContent-BdU5vXz9.js → RichMessageContent-CGBAcUES.js} +1 -1
- package/frontend/dist/js/SettingsModal-BVj3gFCS.js +1 -0
- package/frontend/dist/js/UserManagementPage-D3tLGtTu.js +1 -0
- package/frontend/dist/js/WorkPage-DhTjy-kf.js +2 -0
- package/frontend/dist/js/api-YWoSobKv.js +19 -0
- package/frontend/dist/js/{estree-Bu_-Wi6O.js → estree-PDLT672k.js} +1 -1
- package/frontend/dist/js/{html-Ca764Rus.js → html-CkhF9wDQ.js} +1 -1
- package/frontend/dist/js/{markdown-DaiQGPEs.js → markdown-B1iNUbse.js} +1 -1
- package/frontend/dist/js/{standalone-DWWnsbIr.js → standalone-CCd6rkf-.js} +1 -1
- package/frontend/dist/js/{typescript-CatjJeHm.js → typescript-DKJ1uM5L.js} +1 -1
- package/frontend/dist/js/useBaseQuery-MuQj7vA5.js +1 -0
- package/frontend/dist/js/useQuery-CYGPkxWR.js +1 -0
- package/package.json +2 -2
- package/plugins/github.json +1 -2
- package/plugins/huggingface.json +30 -30
- package/plugins/openai.json +53 -22
- package/frontend/dist/assets/index-DkShhNBf.js +0 -5
- package/frontend/dist/assets/index-bdSWBsAM.css +0 -1
- package/frontend/dist/js/ChatPage-B6Hm_pdu.js +0 -16
- package/frontend/dist/js/GalleryPage-CH4f65q8.js +0 -1
- package/frontend/dist/js/LibreClawPage-CcH7M3mJ.js +0 -1
- package/frontend/dist/js/ModelSelector-T1KZtIde.js +0 -1
- package/frontend/dist/js/ModelsPage-C1bM_Yoc.js +0 -2
- package/frontend/dist/js/PersonasPage-T_PrhnPG.js +0 -13
- package/frontend/dist/js/SettingsModal-BVj-D1L4.js +0 -1
- package/frontend/dist/js/UserManagementPage-Pix71oRW.js +0 -1
- package/frontend/dist/js/WorkPage-DdOVGyj_.js +0 -2
- package/frontend/dist/js/api-Do6u0tMM.js +0 -19
- package/frontend/dist/js/useBaseQuery-CVNuhuID.js +0 -1
- package/frontend/dist/js/useQuery-CYhC_da4.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/babel-BnLuavNv.js","js/router-vendor-BjDI9mRe.js","js/rolldown-runtime-QTnfLwEv.js","js/markdown-core-GI9BPwrB.js","js/estree-PDLT672k.js","assets/index-CKV9Lnj8.js","js/react-vendor-DyG_ODzn.js","js/useTranslation-Cs6iTP4m.js","js/ui-vendor-CAFEDSaO.js","js/utils-vendor-Cbaj0BC5.js","js/demoMode-BhEpMVh5.js","js/logger-DbNs3-DK.js","js/api-YWoSobKv.js","js/utils-pTFqSV8c.js","js/Button-DBk-AREB.js","assets/index-Dme2Ozol.css","js/typescript-DKJ1uM5L.js","js/postcss-DSDkwgFE.js","js/html-CkhF9wDQ.js","js/markdown-B1iNUbse.js","js/yaml-mLy9chOK.js","js/standalone-CCd6rkf-.js","js/OptimizedSyntaxHighlighter-Ci9sRc78.js","js/syntax-highlight-pM1xnNpY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-GI9BPwrB.js";import{d as r,f as i,i as a,l as o,u as s}from"./router-vendor-BjDI9mRe.js";import{t as c}from"./useTranslation-Cs6iTP4m.js";import{At as l,C as u,Et as d,F as f,Gt as p,It as m,J as h,N as g,Nt as _,O as v,Pt as y,Rt as b,T as x,Tt as S,Vt as C,Xt as w,bt as T,h as E,jt as D,lt as O,n as k,nt as ee,o as te,qt as A,rt as ne,tt as re,u as ie,x as j,xt as ae,yt as oe}from"./ui-vendor-CAFEDSaO.js";import{o as se,s as ce}from"./api-YWoSobKv.js";import{t as M}from"./utils-pTFqSV8c.js";import{t as N}from"./Button-DBk-AREB.js";import{$ as le,A as ue,F as de,H as P,M as fe,N as pe,O as me,V as F,j as he,m as I,n as ge}from"../assets/index-CKV9Lnj8.js";import{t as _e}from"./RichMessageContent-CGBAcUES.js";import{t as ve}from"./ModelSelector-CUnwRmNU.js";var L=e(n(),1),ye=e=>e.status===`preparing`||e.status===`running`,R=e=>{let t=encodeURIComponent(e.model);return e.providerType===`plugin`?`plugin:${encodeURIComponent(e.providerId||``)}:${t}`:`ollama:${t}`},z=t(),be=e=>R({model:e.name,providerType:e.isPlugin?`plugin`:`ollama`,providerId:e.isPlugin?e.pluginId:void 0}),B=e=>{let t=e.name.split(`/`).filter(Boolean),n=t[t.length-1]||e.name;return t.length>1?n.replace(/[-_]+/g,` `):n},V=e=>{let t=`${e.model} · `;return{name:e.model,model:e.model,size:0,digest:``,modified_at:``,details:{},isPlugin:e.providerType===`plugin`,pluginId:e.providerId,pluginName:e.providerType===`plugin`?e.label.startsWith(t)?e.label.slice(t.length):e.providerId:void 0}};function H({models:e,selectorModels:t,modelKey:n,running:r,loading:i,variant:a=`task`,disabled:o=!1,remoteDisclosureDismissed:s,remoteDisclosureSaving:l,onModelChange:u,onDismissRemoteDisclosure:d,onModelsRefresh:f,onSubmit:p,onCancel:m}){let{t:h}=c(),[g,_]=(0,L.useState)(``),v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=e.find(e=>e.key===n),S=x?.remote===!0,w=a===`landing`,T=(0,L.useMemo)(()=>{let n=new Set(t.map(be)),r=e.filter(e=>!n.has(e.key)).map(V);return[...t,...r]},[e,t]);(0,L.useEffect)(()=>{let e=v.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[g]);let D=async()=>{await d()&&([y.current,b.current].find(e=>e&&e.offsetParent!==null)||y.current)?.focus()},O=t=>{let n=e.find(e=>e.key===t)||e.find(e=>e.providerType===`ollama`&&e.model===t);n&&u(n.key)},ee=async()=>{let e=g.trim();!e||i||r||o||!x||await p(e)&&_(``)};return(0,z.jsxs)(`div`,{"data-testid":w?`work-landing-composer`:`work-task-composer`,"data-variant":a,className:M(`relative shrink-0`,w?`mt-10 w-full`:`border-t border-line bg-surface/95 px-3 py-3 backdrop-blur md:px-5`),children:[S&&!s&&(0,z.jsx)(`div`,{className:M(`absolute inset-x-3 z-30 mx-auto max-w-3xl md:inset-x-5`,`bottom-full mb-3`),children:(0,z.jsxs)(`aside`,{"data-testid":`work-provider-disclosure-popover`,"aria-labelledby":`work-provider-disclosure-title`,"aria-live":`polite`,className:`relative rounded-2xl border border-warning-500/40 bg-surface-overlay p-3 pe-10 shadow-overlay backdrop-blur dark:border-warning-500/45`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:l,className:`absolute end-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-warning-500/20 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-500 disabled:cursor-wait disabled:opacity-50`,"aria-label":h(`work.composer.remoteDismissLabel`,{defaultValue:`Dismiss remote provider notice`}),children:(0,z.jsx)(k,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-warning-500/20`,children:(0,z.jsx)(A,{"data-testid":`work-provider-disclosure-accent`,className:`h-4 w-4 text-warning-500`,"aria-hidden":`true`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`p`,{id:`work-provider-disclosure-title`,className:`text-sm font-semibold text-ink`,children:h(`work.composer.remoteTitle`,{defaultValue:`Remote provider`})}),(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-ink-muted`,children:h(`work.composer.remoteHint`,{defaultValue:`Conversation and tool output are sent to the configured service. One autonomous run can make multiple provider calls and may incur charges. Workspace files stay local unless a tool returns their contents.`})}),(0,z.jsx)(`div`,{className:`mt-2.5 flex justify-end`,children:(0,z.jsx)(N,{"data-testid":`work-provider-disclosure-dismiss`,type:`button`,variant:`ghost`,size:`sm`,loading:l,className:`h-7 border-warning-500 bg-warning-500 px-2.5 text-xs text-[#3d120c] hover:bg-warning-500/90 hover:text-[#3d120c]`,onClick:()=>void D(),children:h(`work.composer.remoteDismiss`,{defaultValue:`Dismiss`})})})]})]})]})}),(0,z.jsx)(`form`,{className:`mx-auto w-full max-w-3xl`,onSubmit:e=>{e.preventDefault(),ee()},children:(0,z.jsxs)(`div`,{"data-testid":`work-composer-surface`,className:M(`flex items-end gap-2 rounded-[1.6rem] border p-2.5 transition-[border-color,box-shadow,background-color] duration-200 sm:p-3`,`border-black/[0.08] bg-surface/90 dark:border-white/[0.09] dark:bg-dark-200/90`,`shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_50px_rgba(15,23,42,0.08)] backdrop-blur-xl`,`focus-within:border-primary-500/35 focus-within:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_22px_65px_rgba(15,23,42,0.12)]`),children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(`textarea`,{ref:v,"data-testid":`work-composer-input`,dir:`auto`,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ee())},disabled:o||r,rows:1,className:`m-0 block max-h-[160px] min-h-10 w-full resize-none overflow-y-auto rounded-none border-0 bg-transparent p-2 text-base leading-relaxed text-ink shadow-none outline-none placeholder:text-ink-subtle focus:border-0 focus:bg-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-60`,placeholder:h(`work.composer.placeholder`,{defaultValue:`Describe what you want to build or change…`})})}),(0,z.jsx)(`div`,{className:`hidden shrink-0 sm:block`,children:(0,z.jsx)(ve,{models:T,selectedModel:n,onModelChange:e=>O(e.target.value),onModelsRefresh:()=>void f(),getModelValue:be,getModelLabel:B,getModelTitle:e=>e.name,triggerRef:y,triggerTestId:`work-model-selector-trigger`,selectTestId:`work-model-select`,ariaLabel:h(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`min-w-[150px] max-w-[230px]`,compact:!0})}),r?(0,z.jsx)(N,{"data-testid":`work-cancel-button`,type:`button`,variant:`ghost`,size:`sm`,disabled:i,className:`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full bg-error-500/15 p-0 text-error-600 transition-colors duration-150 hover:bg-error-500/25 dark:text-error-400 sm:h-10 sm:w-10`,title:h(`work.composer.cancel`,{defaultValue:`Stop`}),"aria-label":h(`work.composer.cancel`,{defaultValue:`Stop`}),onClick:()=>void m(),children:i?(0,z.jsx)(C,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(E,{className:`h-4 w-4 fill-current`})}):(0,z.jsx)(N,{"data-testid":`work-submit-button`,type:`submit`,variant:`ghost`,size:`sm`,disabled:i||o||!g.trim()||!x,className:M(`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full p-0 transition-colors duration-150 sm:h-10 sm:w-10`,`bg-gray-950 text-white hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100`,`disabled:bg-gray-100 disabled:text-gray-400 disabled:hover:bg-gray-100 dark:disabled:bg-dark-300 dark:disabled:text-dark-500 dark:disabled:hover:bg-dark-300`,g.trim()&&x&&!o&&`shadow-sm`),title:h(`work.composer.send`,{defaultValue:`Run`}),"aria-label":h(`work.composer.send`,{defaultValue:`Run`}),children:i?(0,z.jsx)(C,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(j,{className:`h-4 w-4`})})]})}),(0,z.jsx)(`div`,{className:`mx-auto mt-3 w-full max-w-3xl sm:hidden`,children:(0,z.jsx)(ve,{models:T,selectedModel:n,onModelChange:e=>O(e.target.value),onModelsRefresh:()=>void f(),getModelValue:be,getModelLabel:B,getModelTitle:e=>e.name,triggerRef:b,triggerTestId:`work-model-selector-trigger-mobile`,selectTestId:`work-model-select-mobile`,ariaLabel:h(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`w-full`,compact:!0})})]})}var xe=e=>{if(e==null||e===``)return null;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},Se=e=>{if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}`:`${r}s`},Ce=e=>{if(!e)return 0;let t=Array.from(e).length,n=e.trim()?e.trim().split(/\s+/u).length:0;return Math.max(n,Math.ceil(t/4))};function we({run:e}){let[t,n]=(0,L.useState)();if((0,L.useEffect)(()=>{if(e.terminal||!e.startedAt)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e.startedAt,e.terminal]),!e.startedAt)return null;let r=e.finishedAt||t;return r?(0,z.jsx)(`span`,{dir:`ltr`,className:`tabular-nums text-ink-subtle`,"aria-hidden":`true`,children:Se(r-e.startedAt)}):null}function Te({tool:e,expandedByDefault:t}){let{t:n}=c(),[r]=(0,L.useState)(e.status),[i,a]=(0,L.useState)(null),o=(0,L.useMemo)(()=>xe(e.arguments),[e.arguments]),s=e.output||null,l=!!(o||s),u=e.status===`error`,d=e.status===`running`,f=(0,L.useId)(),p=u?n(`work.activity.kinds.error`,{defaultValue:`Error`}):d?n(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}):n(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),m=i??(e.status===r?t:e.status===`error`);return(0,z.jsxs)(`div`,{"data-testid":`work-live-tool`,"data-tool-id":e.id,className:M(`overflow-hidden rounded-xl border bg-surface-raised transition-colors`,u?`border-error-500/30`:`border-line`),children:[(0,z.jsxs)(`button`,{type:`button`,disabled:!l,onClick:()=>{a(!m)},"aria-expanded":l?m:void 0,"aria-controls":l?f:void 0,"aria-label":`${p}: ${e.name}`,className:`flex min-h-10 w-full items-center gap-2 px-3 py-2 text-start outline-none hover:bg-surface-subtle focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52] disabled:cursor-default disabled:hover:bg-transparent`,children:[(0,z.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center`,children:u?(0,z.jsx)(A,{className:`h-3.5 w-3.5 text-error-500`}):d?(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin text-[rgb(48,121,255)] motion-reduce:animate-none`}):(0,z.jsx)(ae,{className:`h-3.5 w-3.5 text-[rgb(76,212,117)]`})}),(0,z.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-xs text-ink`,children:e.name}),e.durationMs!==void 0&&(0,z.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-ink-subtle`,children:Se(e.durationMs)}),l&&(0,z.jsx)(T,{"aria-hidden":`true`,className:M(`h-3.5 w-3.5 shrink-0 text-ink-subtle transition-transform`,m&&`rotate-180`)})]}),l&&m&&(0,z.jsxs)(`div`,{id:f,className:`border-t border-line bg-surface-subtle/50`,children:[o&&(0,z.jsx)(`pre`,{dir:`ltr`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:o}),s&&(0,z.jsx)(`pre`,{dir:`ltr`,className:M(`max-h-64 overflow-auto whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed`,u?`text-error-600`:`text-ink-muted`),children:s})]})]})}function U({content:e,streaming:t}){let{t:n}=c(),[r,i]=(0,L.useState)(!0);return(0,z.jsxs)(`details`,{"data-testid":`work-live-reasoning`,open:r,onToggle:e=>i(e.currentTarget.open),className:`group mb-3 overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-xs font-medium text-ink-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`}),(0,z.jsxs)(`span`,{className:`truncate`,children:[n(`libreClaw.metrics.provider`,{defaultValue:`Provider`}),` ·`,` `,n(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})]})]}),(0,z.jsx)(T,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),(0,z.jsx)(`div`,{className:`border-t border-line px-3 py-2.5`,children:(0,z.jsx)(I,{content:e,isStreaming:t,className:`text-xs text-ink-muted`})})]})}var Ee=(e,t,n)=>e===`queued`||e===`preparing`?t(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):e===`using_tool`?n?.name?`${t(`work.activity.toolActivity`,{defaultValue:`Tool activity`})} · ${n.name}`:t(`work.activity.toolActivity`,{defaultValue:`Tool activity`}):e===`completed`?t(`work.statusLabels.complete`,{defaultValue:`Complete`}):e===`needs_input`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`failed`?t(`work.statusLabels.error`,{defaultValue:`Error`}):e===`cancelled`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`responding`?t(`work.status.running`,{defaultValue:`Working in the local workspace…`}):t(`work.statusLabels.thinking`,{defaultValue:`Thinking`}),De=(e,t)=>{if(e===`connecting`)return t(`work.live.connecting`,{defaultValue:`Connecting to live updates…`});if(e===`reconnecting`)return t(`work.live.reconnecting`,{defaultValue:`Reconnecting to live updates…`});if(e===`error`)return t(`work.live.unavailable`,{defaultValue:`Live updates unavailable`})};function Oe({run:e,variant:t=`conversation`}){let{t:n}=c(),r=[...e.tools].reverse().find(e=>e.status===`running`),i=De(e.connection,n)||Ee(e.phase,n,r),a=!e.terminal,o=e.usage?.outputTokens,s=e.reasoning+e.response,l=o!==void 0&&o>0?o:s?Ce(s):o,u=(o===void 0||o===0)&&!!s&&l!==void 0,d=e.usage?.tokensPerSecond;return(0,z.jsxs)(`section`,{"data-testid":`work-live-run`,"data-run-id":e.runId,"data-phase":e.phase,"aria-busy":a||void 0,className:M(`min-w-0`,t===`activity`&&`rounded-2xl border border-line bg-surface p-3 shadow-subtle`),children:[(0,z.jsxs)(`div`,{className:`mb-3 flex min-h-6 items-center gap-2 text-xs`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:M(`h-2 w-2 shrink-0 rounded-full`,e.phase===`failed`?`bg-[rgb(255,61,129)]`:e.phase===`completed`?`bg-[rgb(76,212,117)]`:e.phase===`needs_input`||e.phase===`cancelled`?`bg-[rgb(255,204,0)]`:e.connection===`error`?`bg-[rgb(255,61,129)]`:`bg-[rgb(48,121,255)]`,a&&`animate-pulse motion-reduce:animate-none`)}),(0,z.jsx)(`span`,{dir:`auto`,title:e.connectionError,className:`min-w-0 flex-1 truncate font-medium text-ink-muted`,children:i}),e.round!==void 0&&(0,z.jsx)(`span`,{dir:`ltr`,className:`shrink-0 tabular-nums text-ink-subtle`,children:e.roundLimit===void 0?`#${e.round}`:`${e.round}/${e.roundLimit}`}),(0,z.jsx)(we,{run:e})]}),t===`conversation`&&(0,z.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:i}),e.skills.length>0&&(0,z.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,children:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line bg-surface-raised px-2 py-1 text-[10px] text-ink-muted`,children:[(0,z.jsx)(b,{className:`h-3 w-3 text-[#ff7b52]`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{dir:`auto`,children:n(`work.live.skillsLoaded`,{count:e.skills.length,defaultValue:`Workspace skills · {{count}}`})})]})}),e.reasoning&&(0,z.jsx)(U,{content:e.reasoning,streaming:a&&e.phase!==`responding`}),e.tools.length>0&&(0,z.jsx)(`div`,{"data-testid":`work-live-tools`,className:M(`mb-3 space-y-1.5`,t===`activity`&&`mb-0`),children:e.tools.map(e=>(0,z.jsx)(Te,{tool:e,expandedByDefault:e.status===`running`||e.status===`error`},e.id))}),t===`conversation`&&e.response&&(0,z.jsx)(I,{content:e.response,isStreaming:a,className:`text-ink`}),e.error&&(0,z.jsxs)(`div`,{role:`alert`,dir:`auto`,className:`mt-3 flex items-start gap-2 rounded-xl border border-error-500/30 bg-error-500/10 px-3 py-2.5 text-xs leading-relaxed text-error-600`,children:[(0,z.jsx)(A,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{children:e.error})]}),(l!==void 0||d!==void 0)&&(0,z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line pt-2 text-[10px] tabular-nums text-ink-subtle`,children:[l!==void 0&&(0,z.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.generatedTokens`,{defaultValue:`Generated tokens:`}),` `,(0,z.jsxs)(`bdi`,{dir:`ltr`,children:[u&&`≈`,l.toLocaleString()]})]}),d!==void 0&&(0,z.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.speed`,{defaultValue:`Speed:`}),` `,(0,z.jsxs)(`bdi`,{dir:`ltr`,children:[d.toFixed(1),` t/s`]})]})]}),a&&!e.reasoning&&!e.response&&e.tools.length===0&&(0,z.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-5 items-center gap-1 text-[rgb(48,121,255)]`,children:[(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current motion-reduce:animate-none`}),(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:160ms] motion-reduce:animate-none`}),(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:320ms] motion-reduce:animate-none`})]}),t===`activity`&&e.tools.length===0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-ink-muted`,children:[(0,z.jsx)(m,{className:`h-3.5 w-3.5`}),n(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]})]})}function ke({role:e,user:t,size:n=`message`}){let[r,i]=(0,L.useState)(null);if(e===`assistant`)return(0,z.jsx)(`div`,{role:`img`,"aria-label":`Libre WebUI`,"data-testid":`work-assistant-avatar`,className:M(`flex shrink-0 items-center justify-center rounded-full border border-line bg-surface-raised shadow-subtle`,n===`empty`?`mx-auto mb-4 h-12 px-3`:`mt-0.5 h-8 px-2`),children:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:M(`libre-brand text-ink`,n===`empty`?`text-sm`:`text-[11px]`),children:`Libre`})});let a=t?.username||`User`,o=t?.avatar?.trim()||``,s=!!o&&o!==r;return(0,z.jsx)(`div`,{role:s?void 0:`img`,"aria-label":s?void 0:a,"data-testid":`work-user-avatar`,className:M(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full`,s?`border border-line bg-surface-raised`:`bg-ink text-ink-inverse`),title:a,children:s?(0,z.jsx)(`img`,{src:o,alt:a,className:`h-full w-full object-cover`,onError:()=>i(o)}):t?(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium uppercase leading-none`,children:t.username.charAt(0)}):(0,z.jsx)(te,{"aria-hidden":`true`,className:`h-4 w-4`})})}var Ae=e=>{if(!e||Object.keys(e).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return null}},je=(e,t)=>{let n=e.metadata,r=n?.name??n?.toolName??n?.tool??n?.command;return typeof r==`string`&&r?r:t};function Me({message:e}){let{t}=c();return(0,z.jsxs)(`details`,{"data-testid":`work-provider-reasoning`,className:`group ms-14 overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-xs font-medium text-ink-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`}),(0,z.jsxs)(`span`,{className:`truncate`,children:[t(`libreClaw.metrics.provider`,{defaultValue:`Provider`}),` ·`,` `,t(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})]})]}),(0,z.jsx)(T,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),(0,z.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-xs leading-relaxed text-ink-muted`,children:e.content})]})}function W({message:e}){let{t}=c(),n=Ae(e.metadata),r=e.kind===`error`,i={message:t(`work.activity.kinds.message`,{defaultValue:`Message`}),reasoning:t(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`}),tool_call:t(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}),tool_result:t(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),error:t(`work.activity.kinds.error`,{defaultValue:`Error`})}[e.kind];return(0,z.jsxs)(`div`,{className:M(`rounded-xl border bg-surface-subtle`,r?`border-error-500/30`:`border-line`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-2`,children:[r?(0,z.jsx)(A,{className:`h-4 w-4 text-error-500`}):(0,z.jsx)(m,{className:`h-4 w-4 text-ink-muted`}),(0,z.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate font-mono text-xs font-medium text-ink`,children:je(e,t(`work.activity.toolActivity`,{defaultValue:`Tool activity`}))}),(0,z.jsx)(`span`,{className:`rounded-md bg-surface-raised px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-ink-muted rtl:tracking-normal`,children:i})]}),e.content&&(0,z.jsx)(`pre`,{dir:`ltr`,className:`max-h-56 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 text-left font-mono text-xs leading-relaxed text-ink-muted`,children:e.content}),n&&(0,z.jsxs)(`details`,{className:`border-t border-line px-3 py-2`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-[11px] font-medium text-ink-muted`,children:t(`work.activity.details`,{defaultValue:`Details`})}),(0,z.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all text-left font-mono text-[11px] text-ink-muted`,children:n})]})]})}function Ne({task:e,user:t,loading:n,loadingOlder:r,liveRun:i,onLoadOlder:a}){let{t:o}=c(),s=(0,L.useRef)(null),l=(0,L.useRef)(!0),[u,d]=(0,L.useState)(!1),f=(0,L.useMemo)(()=>[...e.messages||[]].sort((e,t)=>e.messageIndex-t.messageIndex||e.createdAt-t.createdAt||e.id.localeCompare(t.id)),[e.messages]),p=[...f].reverse().find(e=>e.role===`assistant`&&e.kind===`message`)?.id;(0,L.useEffect)(()=>{l.current=!0;let e=s.current;e&&(e.scrollTop=e.scrollHeight);let t=window.requestAnimationFrame(()=>d(!1));return()=>window.cancelAnimationFrame(t)},[e.id]),(0,L.useEffect)(()=>{let e=s.current,t;return e&&l.current?(e.scrollTop=e.scrollHeight,t=window.requestAnimationFrame(()=>d(!1))):e&&i&&(t=window.requestAnimationFrame(()=>d(!0))),()=>{t!==void 0&&window.cancelAnimationFrame(t)}},[i,f,e.status]);let m=async()=>{let e=s.current,t=e?.scrollHeight??0,n=e?.scrollTop??0;l.current=!1;try{await a(),requestAnimationFrame(()=>{let e=s.current;e&&(e.scrollTop=n+e.scrollHeight-t)})}catch{}};return n&&f.length===0?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-ink-muted`,children:(0,z.jsx)(C,{className:`h-6 w-6 animate-spin`})}):(0,z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,z.jsx)(`div`,{ref:s,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,l.current&&d(!1)},className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsx)(`div`,{className:`mx-auto flex min-h-full max-w-3xl flex-col px-4 py-6 md:px-6`,children:f.length===0&&!i?(0,z.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,z.jsx)(ke,{role:`assistant`,size:`empty`}),(0,z.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-ink`,children:o(`work.conversation.ready`,{defaultValue:`Workspace ready`})}),(0,z.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-ink-muted`,children:o(`work.conversation.empty`,{defaultValue:`Continue the task below. This conversation and its files stay attached to this workspace.`})})]}):(0,z.jsxs)(`div`,{className:`space-y-6`,children:[e.hasMoreMessages&&(0,z.jsx)(`div`,{className:`flex justify-center`,children:(0,z.jsxs)(`button`,{type:`button`,"data-testid":`work-load-older-messages`,disabled:r,onClick:()=>void m(),className:`inline-flex items-center gap-2 rounded-lg border border-line bg-surface-raised px-3 py-1.5 text-xs font-medium text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-60`,children:[r&&(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}),o(`work.conversation.loadOlder`,{defaultValue:`Load older messages`})]})}),f.map(n=>{if(i&&n.runId===i.runId&&n.role!==`user`)return null;if(n.kind===`reasoning`)return(0,z.jsx)(Me,{message:n},n.id);if(n.role===`tool`||n.kind!==`message`)return(0,z.jsx)(W,{message:n},n.id);let r=n.role===`user`,a=!r&&e.status===`running`&&n.id===p&&n.runId===e.activeRun?.id;return(0,z.jsxs)(`article`,{className:M(`flex gap-3`,r&&`flex-row-reverse`),children:[(0,z.jsx)(ke,{role:r?`user`:`assistant`,user:r?t:void 0}),(0,z.jsx)(`div`,{className:M(`min-w-0 max-w-[88%]`,r&&`rounded-2xl rounded-se-md bg-ink px-4 py-2.5 text-ink-inverse`),children:r?(0,z.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-relaxed`,children:n.content}):a?(0,z.jsx)(I,{content:n.content,className:`text-ink`}):(0,z.jsx)(_e,{content:n.content,className:`text-sm text-ink`})})]},n.id)}),i&&(0,z.jsxs)(`article`,{className:`flex gap-3`,"data-testid":`work-live-run-message`,children:[(0,z.jsx)(ke,{role:`assistant`}),(0,z.jsx)(`div`,{className:`min-w-0 max-w-[92%] flex-1`,children:(0,z.jsx)(Oe,{run:i})})]}),!i&&(e.status===`preparing`||e.status===`running`)&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 ps-14 text-xs text-ink-muted`,children:[(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}),e.status===`preparing`?o(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):o(`work.status.running`,{defaultValue:`Working in the local workspace…`})]})]})})}),u&&(0,z.jsxs)(`button`,{type:`button`,"data-testid":`work-new-activity-button`,onClick:()=>{let e=s.current;e&&(e.scrollTop=e.scrollHeight),l.current=!0,d(!1)},className:`absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-line bg-surface-overlay/95 px-3 py-2 text-xs font-medium text-ink shadow-overlay backdrop-blur transition-colors hover:bg-surface-raised`,children:[(0,z.jsx)(D,{className:`h-3.5 w-3.5`}),o(`work.live.newActivity`,{defaultValue:`New activity`})]})]})}var G=45,Pe=30,K=70,q=360,Fe=480,Ie=9,J=2,Le=10,Re=`libre-webui-work-split:`,ze=(e,t,n)=>Math.min(n,Math.max(t,e)),Be=e=>`${Re}${encodeURIComponent(e||`local`)}`,Ve=e=>{if(typeof window>`u`)return G;try{let t=window.localStorage.getItem(e);if(t===null||t.trim()===``)return G;let n=Number(t);return Number.isFinite(n)?ze(n,Pe,K):G}catch{return G}},He=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toFixed(2))}catch{}},Ue=e=>{let t=Math.max(0,e-Ie);if(t===0)return{min:Pe,max:K};let n=Math.max(Pe,q/t*100),r=Math.min(K,(t-Fe)/t*100);if(n<=r)return{min:n,max:r};let i=ze(q/840*100,Pe,K);return{min:i,max:i}},Y=(e,t)=>ze(e,t.min,t.max);function We({conversation:e,workspace:t,userId:n,mobileSurface:r=`conversation`,className:i}){let{t:a,i18n:o}=c(),s=le(o.language),l=Be(n),[u,d]=(0,L.useState)(()=>({storageKey:l,percent:Ve(l)})),[f,p]=(0,L.useState)(0),[m,h]=(0,L.useState)(!1),g=(0,L.useRef)(null),_=(0,L.useRef)(null),v=(0,L.useRef)(null),y=(0,L.useRef)(l),b=(0,L.useRef)(u.percent),x=(0,L.useRef)(null),S=u.storageKey===l?u.percent:Ve(l),C=(0,L.useMemo)(()=>Ue(f),[f]),w=Y(S,C),T=Math.round(w),E=100-T,D=(0,L.useCallback)(e=>{d({storageKey:l,percent:e})},[l]),O=(0,L.useCallback)(e=>{b.current=Y(e,Ue(g.current?.getBoundingClientRect().width??0)),x.current===null&&(x.current=window.requestAnimationFrame(()=>{x.current=null,D(b.current)}))},[D]),k=(0,L.useCallback)(()=>{if(v.current===null&&!m)return;x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null);let e=g.current?.getBoundingClientRect().width??0,t=Y(b.current,Ue(e));b.current=t,D(t),He(y.current,t);let n=v.current;v.current=null,n!==null&&_.current?.hasPointerCapture(n)&&_.current.releasePointerCapture(n),h(!1)},[m,D]),ee=(0,L.useCallback)(e=>{let t=g.current?.getBoundingClientRect();if(!t)return b.current;let n=Math.max(1,t.width-Ie);return((s?t.right-e:e-t.left)-Ie/2)/n*100},[s]),te=e=>{e.button!==0||!e.isPrimary||(e.preventDefault(),e.stopPropagation(),v.current=e.pointerId,y.current=l,b.current=w,e.currentTarget.setPointerCapture(e.pointerId),h(!0))},A=(0,L.useCallback)(e=>{let t=Y(e,C);b.current=t,D(t),He(l,t)},[C,D,l]),ne=(0,L.useCallback)(()=>{A(G)},[A]),re=e=>{let t=e.shiftKey?Le:J,n=null;e.key===`ArrowLeft`?n=w+(s?t:-t):e.key===`ArrowRight`?n=w+(s?-t:t):e.key===`Home`?n=C.min:e.key===`End`?n=C.max:e.key===`Enter`&&(n=G),n!==null&&(e.preventDefault(),A(n))};(0,L.useEffect)(()=>{let e=g.current;if(!e)return;if(typeof ResizeObserver>`u`){let t=()=>p(e.getBoundingClientRect().width);return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)}let t=new ResizeObserver(e=>{let t=e[0];t&&p(t.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]),(0,L.useEffect)(()=>{if(!m)return;let e=document.body.style.cursor,t=document.body.style.userSelect;document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e=>{e.pointerId===v.current&&(e.preventDefault(),O(ee(e.clientX)))},r=e=>{e.pointerId===v.current&&k()};return window.addEventListener(`pointermove`,n,{passive:!1}),window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r),window.addEventListener(`blur`,k),()=>{window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),window.removeEventListener(`blur`,k),document.body.style.cursor=e,document.body.style.userSelect=t}},[k,m,ee,O]),(0,L.useEffect)(()=>()=>{x.current!==null&&window.cancelAnimationFrame(x.current),v.current!==null&&He(y.current,b.current)},[]);let ie={gridTemplateColumns:`minmax(0, ${w}fr) ${Ie}px minmax(0, ${100-w}fr)`};return(0,z.jsxs)(`div`,{ref:g,"data-testid":`work-split-pane`,"data-split-percent":w.toFixed(2),"data-resizing":m?`true`:`false`,className:M(`relative flex min-h-0 min-w-0 flex-1 overflow-hidden xl:grid`,i),style:ie,children:[(0,z.jsx)(`section`,{id:`work-conversation-panel`,"data-testid":`work-conversation-panel`,className:M(`min-h-0 min-w-0 flex-1 flex-col bg-surface xl:flex`,r===`conversation`?`flex`:`hidden`),children:e}),(0,z.jsxs)(`div`,{ref:_,role:`separator`,"aria-orientation":`vertical`,"aria-controls":`work-conversation-panel work-workspace-panel`,"aria-label":a(`work.workspace.resize`,{defaultValue:`Resize conversation and workspace`}),"aria-valuemin":Math.round(C.min),"aria-valuemax":Math.round(C.max),"aria-valuenow":T,"aria-valuetext":a(`work.workspace.splitSize`,{conversation:T,workspace:E,defaultValue:`Conversation {{conversation}}%, workspace {{workspace}}%`}),title:a(`work.workspace.resizeHint`,{defaultValue:`Drag to resize. Use arrow keys for precise control. Double-click or press Enter to reset.`}),tabIndex:0,"data-testid":`work-split-resizer`,onPointerDown:te,onDoubleClick:ne,onKeyDown:re,className:M(`group relative z-40 hidden h-full cursor-col-resize touch-none select-none items-center justify-center outline-none xl:flex`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52]`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:M(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-line transition-colors`,`group-hover:bg-[#ff7b52] group-focus-visible:bg-[#ff7b52]`,m&&`bg-[#ff7b52]`)}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:M(`pointer-events-none relative h-14 w-1 rounded-full bg-ink-subtle/50 opacity-60 transition-[height,background-color,opacity]`,`group-hover:h-20 group-hover:bg-[#ff7b52] group-hover:opacity-100`,`group-focus-visible:h-20 group-focus-visible:bg-[#ff7b52] group-focus-visible:opacity-100`,m&&`h-20 bg-[#ff7b52] opacity-100`)})]}),(0,z.jsx)(`section`,{id:`work-workspace-panel`,"data-testid":`work-workspace-panel`,className:M(`min-h-0 min-w-0 flex-1 flex-col bg-surface-raised xl:flex`,r===`workspace`?`flex`:`hidden`),children:t}),m&&(0,z.jsx)(`div`,{"data-testid":`work-split-drag-shield`,"aria-hidden":`true`,className:`absolute inset-0 z-30 hidden cursor-col-resize select-none xl:block`})]})}var Ge=1e5,Ke=4e3,qe={bash:`bash`,c:`c`,cc:`cpp`,cjs:`javascript`,cpp:`cpp`,cs:`csharp`,csh:`bash`,css:`css`,cts:`typescript`,cxx:`cpp`,diff:`diff`,go:`go`,h:`c`,hpp:`cpp`,htm:`markup`,html:`markup`,java:`java`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,less:`css`,md:`markdown`,mdx:`markdown`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,py:`python`,rb:`ruby`,rs:`rust`,scss:`css`,sh:`bash`,sql:`sql`,svg:`markup`,swift:`swift`,ts:`typescript`,tsx:`tsx`,xml:`markup`,yaml:`yaml`,yml:`yaml`,zsh:`bash`},Je={".bashrc":`bash`,".zshrc":`bash`},Ye={cjs:{family:`babel`,parser:`babel`},css:{family:`postcss`,parser:`css`},cts:{family:`typescript`,parser:`typescript`},htm:{family:`html`,parser:`html`},html:{family:`html`,parser:`html`},js:{family:`babel`,parser:`babel`},json:{family:`babel`,parser:`json`},json5:{family:`babel`,parser:`json5`},jsonc:{family:`babel`,parser:`json`},jsx:{family:`babel`,parser:`babel`},less:{family:`postcss`,parser:`less`},md:{family:`markdown`,parser:`markdown`},mdx:{family:`markdown`,parser:`mdx`},mjs:{family:`babel`,parser:`babel`},mts:{family:`typescript`,parser:`typescript`},scss:{family:`postcss`,parser:`scss`},ts:{family:`typescript`,parser:`typescript`},tsx:{family:`typescript`,parser:`typescript`},yaml:{family:`yaml`,parser:`yaml`},yml:{family:`yaml`,parser:`yaml`}},X=e=>e.split(/[\\/]/).pop()?.toLowerCase()??``,Xe=e=>{let t=X(e),n=t.lastIndexOf(`.`);return n>-1?t.slice(n+1):``},Ze=e=>Je[X(e)]??qe[Xe(e)]??`text`,Qe=e=>Ye[Xe(e)],$e=e=>Qe(e)!==void 0,et=e=>{if(e.length>1e5)return!1;let t=1;for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===10&&(t+=1,t>4e3))return!1;return!0},Z=async e=>(await e).default,tt=async(e,t)=>{switch(e.family){case`babel`:return Promise.all([Z(a(()=>import(`./babel-BnLuavNv.js`),__vite__mapDeps([0,1,2,3]))),Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))]);case`typescript`:return Promise.all([Z(a(()=>import(`./typescript-DKJ1uM5L.js`),__vite__mapDeps([16,1,2,3,5,6,7,8,9,10,11,12,13,14,15]))),Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))]);case`postcss`:return[await Z(a(()=>import(`./postcss-DSDkwgFE.js`),__vite__mapDeps([17,1,2,3])))];case`html`:{let e=[await Z(a(()=>import(`./html-CkhF9wDQ.js`),__vite__mapDeps([18,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))];return/<script\b/i.test(t)&&e.push(await Z(a(()=>import(`./babel-BnLuavNv.js`),__vite__mapDeps([0,1,2,3]))),await Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))),/<script\b[^>]*\blang\s*=\s*["']?(?:ts|typescript)/i.test(t)&&e.push(await Z(a(()=>import(`./typescript-DKJ1uM5L.js`),__vite__mapDeps([16,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))),/<style\b/i.test(t)&&e.push(await Z(a(()=>import(`./postcss-DSDkwgFE.js`),__vite__mapDeps([17,1,2,3])))),[...new Set(e)]}case`markdown`:{let n=[await Z(a(()=>import(`./markdown-B1iNUbse.js`),__vite__mapDeps([19,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))],r=e=>RegExp(`^(?: {0,3})(?:\`{3,}|~{3,})\\s*(?:${e})(?:\\s|$)`,`im`).test(t);return e.parser===`mdx`&&n.push(await Z(a(()=>import(`./babel-BnLuavNv.js`),__vite__mapDeps([0,1,2,3]))),await Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))),r(`js|jsx|javascript|json|json5|jsonc`)&&n.push(await Z(a(()=>import(`./babel-BnLuavNv.js`),__vite__mapDeps([0,1,2,3]))),await Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))),r(`ts|tsx|typescript`)&&n.push(await Z(a(()=>import(`./typescript-DKJ1uM5L.js`),__vite__mapDeps([16,1,2,3,5,6,7,8,9,10,11,12,13,14,15]))),await Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15])))),r(`css|scss|less`)&&n.push(await Z(a(()=>import(`./postcss-DSDkwgFE.js`),__vite__mapDeps([17,1,2,3])))),r(`html`)&&n.push(await Z(a(()=>import(`./html-CkhF9wDQ.js`),__vite__mapDeps([18,1,2,3,5,6,7,8,9,10,11,12,13,14,15]))),await Z(a(()=>import(`./babel-BnLuavNv.js`),__vite__mapDeps([0,1,2,3]))),await Z(a(()=>import(`./estree-PDLT672k.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15]))),await Z(a(()=>import(`./typescript-DKJ1uM5L.js`),__vite__mapDeps([16,1,2,3,5,6,7,8,9,10,11,12,13,14,15]))),await Z(a(()=>import(`./postcss-DSDkwgFE.js`),__vite__mapDeps([17,1,2,3])))),r(`yaml|yml`)&&n.push(await Z(a(()=>import(`./yaml-mLy9chOK.js`),__vite__mapDeps([20,1,2,3])))),[...new Set(n)]}case`yaml`:return[await Z(a(()=>import(`./yaml-mLy9chOK.js`),__vite__mapDeps([20,1,2,3])))]}},nt=async(e,t)=>{let n=Qe(e);if(!n)throw Error(`Formatting is not supported for “${X(e)||e}”.`);if(!et(t))throw Error(`Could not format “${X(e)||e}”: files are limited to ${Ge.toLocaleString()} characters and ${Ke.toLocaleString()} lines.`);try{let[{format:e},r]=await Promise.all([a(()=>import(`./standalone-CCd6rkf-.js`),__vite__mapDeps([21,1,2,3,5,6,7,8,9,10,11,12,13,14,15])),tt(n,t)]);return await e(t,{parser:n.parser,plugins:r,tabWidth:2,useTabs:!1})}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Could not format “${X(e)||e}”: ${n}`)}},rt=(0,L.lazy)(async()=>({default:(await a(()=>import(`./OptimizedSyntaxHighlighter-Ci9sRc78.js`).then(e=>e.n),__vite__mapDeps([22,2,3,23]))).OptimizedSyntaxHighlighter})),it=8e3,at=400,ot=500;function st({path:e,value:t,ariaLabel:n,disabled:r=!1,onChange:i,onSaveShortcut:a,onFormatShortcut:o}){let{t:s}=c(),l=de(e=>e.theme.mode===`dark`),u=(0,L.useRef)(null),d=(0,L.useRef)(null),[f,p]=(0,L.useState)(``),m=(0,L.useMemo)(()=>Ze(e),[e]),h=(0,L.useMemo)(()=>{if(t.length>it)return 401;let e=1;for(let n=0;n<t.length&&!(t.charCodeAt(n)===10&&(e+=1,e>at));n+=1);return e},[t]),g=t.length>it||h>at,_=m!==`text`&&!g,v=_&&f===t;return(0,L.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>p(t),ot);return()=>window.clearTimeout(e)},[_,e,t]),(0,L.useLayoutEffect)(()=>{!v||!u.current||!d.current||(u.current.style.transform=`translate3d(${-d.current.scrollLeft}px, ${-d.current.scrollTop}px, 0)`)},[v,e]),(0,z.jsxs)(`div`,{dir:`ltr`,className:M(`relative min-h-0 flex-1 overflow-hidden bg-surface focus-within:ring-1 focus-within:ring-inset focus-within:ring-primary-500/60`,r&&`opacity-60`),"data-language":m,"data-highlighted":v?`true`:`false`,children:[v&&(0,z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`work-file-highlight`,className:`pointer-events-none absolute inset-0 z-0 overflow-hidden`,children:(0,z.jsx)(`div`,{ref:u,"data-testid":`work-file-highlight-content`,className:`min-h-full min-w-full origin-top-left will-change-transform`,children:(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(`pre`,{className:`m-0 min-h-full min-w-full whitespace-pre p-4 text-left font-mono text-[12px] leading-5 text-ink`,children:t||``}),children:(0,z.jsx)(rt,{language:m,isDark:l,backgroundColor:`transparent`,borderRadius:0,customStyle:{margin:0,minHeight:`100%`,minWidth:`100%`,width:`max-content`,overflow:`visible`,padding:`1rem`,fontSize:`12px`,lineHeight:`20px`,tabSize:2,whiteSpace:`pre`},children:f||``})})})}),(0,z.jsx)(`textarea`,{ref:d,"data-testid":`work-file-editor`,"data-language":m,"aria-label":n,value:t,onChange:e=>i(e.target.value),onScroll:e=>{u.current&&(u.current.style.transform=`translate3d(${-e.currentTarget.scrollLeft}px, ${-e.currentTarget.scrollTop}px, 0)`)},onKeyDown:e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`s`){e.preventDefault(),a();return}e.altKey&&e.shiftKey&&t===`f`&&(e.preventDefault(),o())},disabled:r,spellCheck:!1,wrap:`off`,className:M(`absolute inset-0 z-10 h-full w-full resize-none overflow-auto whitespace-pre border-0 bg-transparent p-4 text-left font-mono text-[12px] leading-5 outline-none selection:bg-primary-500/25 disabled:cursor-not-allowed`,v?`text-transparent caret-ink`:`text-ink`),style:v?{WebkitTextFillColor:`transparent`,caretColor:`rgb(var(--color-ink))`,tabSize:2}:{tabSize:2}}),g&&(0,z.jsx)(`span`,{dir:`auto`,className:`pointer-events-none absolute bottom-2 end-3 z-20 rounded-md border border-line bg-surface-overlay/90 px-2 py-1 text-[10px] text-ink-muted shadow-subtle`,title:s(`work.files.highlightPaused`,{defaultValue:`Live highlighting is paused for large files to keep editing responsive.`}),children:s(`work.files.plainTextLarge`,{defaultValue:`Plain text · large file`})})]})}var ct=e=>{if(!e)return null;try{let t=new URL(e);return(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)&&(t.protocol===`http:`||t.protocol===`https:`)?t.toString():null}catch{return null}},lt=e=>{let t=e.split(`/`).filter(Boolean);return t.pop(),t.join(`/`)},ut=(e,t)=>{let n=e.metadata?.name??e.metadata?.toolName??e.metadata?.tool??e.metadata?.command;return typeof n==`string`&&n?n:t};function dt({task:e,liveRun:t,files:n,selectedFile:r,loadingFiles:i,actionLoading:a,onLoadFiles:o,onLoadFile:s,onClearSelectedFile:d,onSaveFile:f,onStartPreview:p,onStopPreview:h,onDirtyChange:b}){let{t:S,i18n:T}=c(),D=le(T.language),[k,te]=(0,L.useState)(`files`),[A,ie]=(0,L.useState)(``),[j,ae]=(0,L.useState)(``),[oe,se]=(0,L.useState)(),[ce,de]=(0,L.useState)(``),[P,me]=(0,L.useState)(!1),F=ct(e.previewUrl),he=t?.runId,I=t?.error,ge=t?.tools,_e=(0,L.useMemo)(()=>{let t=new Set(ge?.map(e=>e.id)||[]);return(e.messages||[]).filter(e=>{if(e.kind===`reasoning`||e.role!==`tool`&&e.kind===`message`)return!1;if(!he||e.runId!==he)return!0;if(e.kind===`error`&&I)return!1;let n=e.metadata?.toolCallId;return typeof n!=`string`||!t.has(n)})},[I,he,ge,e.messages]),ve=_e.length+(ge?.length||0),ye=!!r&&j!==(r?.content??``),R=e.status===`preparing`||e.status===`running`,be=(0,L.useRef)(R),B=(0,L.useRef)(0),V=(0,L.useRef)(j),H=(0,L.useRef)(oe),xe=(0,L.useRef)(r),Se=(0,L.useRef)(e.id),Ce=(0,L.useRef)(o),we=(0,L.useRef)(s),Te=(0,L.useRef)(b),U=(0,L.useRef)(!0),Ee=r?$e(r.path):!1,De=!r||et(j),ke=Ee&&De;(0,L.useEffect)(()=>{V.current=j,H.current=oe,xe.current=r,Se.current=e.id,Te.current=b},[oe,j,b,r,e.id]),(0,L.useEffect)(()=>{Ce.current=o,we.current=s},[s,o]),(0,L.useEffect)(()=>(U.current=!0,()=>{U.current=!1,B.current+=1,Te.current(!1)}),[]),(0,L.useEffect)(()=>{if(be.current&&!R&&(Ce.current(A),r&&!ye)){let e=++B.current,t=r.path,n=V.current,i=H.current;we.current(t).then(r=>{!U.current||e!==B.current||r.path!==t||V.current!==n||H.current!==i||(V.current=r.content,H.current=r.updatedAt??r.modifiedAt,ae(r.content),se(r.updatedAt??r.modifiedAt))}).catch(()=>void 0)}be.current=R},[A,ye,r,R]);let Ae=()=>!ye||window.confirm(S(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),je=()=>{r&&ue(e.id,r.path)},Me=async e=>{Ae()&&(B.current+=1,je(),d(),b(!1),ie(e),await o(e).catch(()=>void 0))},W=async t=>{if(!Ae())return;let n=++B.current;je();let r=await s(t).catch(()=>void 0);if(!U.current||!r||n!==B.current)return;let i=fe(e.id,r.path),a=i?.content??r.content,o=i?.baseUpdatedAt??r.updatedAt??r.modifiedAt;V.current=a,H.current=o,ae(a),se(o),b(i!==null&&i.content!==r.content)},Ne=()=>{Ae()&&(B.current+=1,je(),d(),b(!1))},G=t=>{r&&(V.current=t,ae(t),t===r.content?ue(e.id,r.path):pe(e.id,r.path,{content:t,baseUpdatedAt:oe??r.updatedAt??r.modifiedAt}),b(t!==r.content))},Pe=async()=>{if(!r)return;let t=e.id,n=r.path,i=j,a=B.current,o=await f(n,i,oe).catch(()=>!1);if(!U.current||o===!1||a!==B.current||Se.current!==t||xe.current?.path!==n)return;let s=o.updatedAt??o.modifiedAt;H.current=s,se(s);let c=V.current;if(c===i){ue(t,n),b(!1);return}pe(t,n,{content:c,baseUpdatedAt:s}),b(!0)},K=async()=>{if(!r||R||P||!ke)return;me(!0);let e=B.current,t=r.path,n=V.current;try{let r=await nt(t,n);if(!U.current||e!==B.current||xe.current?.path!==t||V.current!==n)return;G(r),w.success(S(`work.files.formatted`,{defaultValue:`Code formatted.`}))}catch(r){if(!U.current||e!==B.current||xe.current?.path!==t||V.current!==n)return;w.error(r instanceof Error?r.message:S(`work.files.formatFailed`,{defaultValue:`Could not format this file.`}))}finally{U.current&&me(!1)}},q=[{id:`files`,label:S(`work.workspace.files`,{defaultValue:`Files`}),icon:ee,testId:`work-files-tab`},{id:`activity`,label:S(`work.workspace.activity`,{defaultValue:`Activity`}),icon:_,testId:`work-activity-tab`},{id:`preview`,label:S(`work.workspace.preview`,{defaultValue:`Preview`}),icon:g,testId:`work-preview-tab`}],Fe=(e,t)=>{let n=null;if(e.key===`ArrowRight`&&(n=(t+(D?-1:1)+q.length)%q.length),e.key===`ArrowLeft`&&(n=(t+(D?1:-1)+q.length)%q.length),e.key===`Home`&&(n=0),e.key===`End`&&(n=q.length-1),n===null)return;e.preventDefault();let r=q[n];te(r.id),e.currentTarget.parentElement?.querySelector(`#work-workspace-tab-${r.id}`)?.focus()};return(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-surface-raised`,children:[(0,z.jsxs)(`div`,{"data-testid":`work-workspace-toolbar`,className:`flex h-12 shrink-0 items-center gap-2 border-b border-line bg-surface-raised px-2`,children:[(0,z.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,"aria-label":S(`work.workspace.label`,{defaultValue:`Workspace views`}),className:`flex shrink-0 items-center rounded-xl border border-line bg-surface-subtle p-0.5`,children:q.map((e,t)=>{let n=e.icon;return(0,z.jsxs)(`button`,{type:`button`,role:`tab`,id:`work-workspace-tab-${e.id}`,"aria-selected":k===e.id,"aria-controls":k===e.id?`work-workspace-panel-${e.id}`:void 0,"aria-label":e.label,tabIndex:k===e.id?0:-1,title:e.label,"data-testid":e.testId,onClick:()=>te(e.id),onKeyDown:e=>Fe(e,t),className:M(`flex h-7 items-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow]`,k===e.id?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:text-ink`),children:[(0,z.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`hidden xs:inline`,children:e.label}),e.id===`activity`&&ve>0&&(0,z.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-[10px] text-ink-muted`,children:ve})]},e.id)})}),k===`files`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[r&&(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-ink-muted hover:bg-surface-subtle hover:text-ink sm:hidden`,onClick:Ne,"aria-label":S(`work.files.back`,{defaultValue:`Back to files`}),children:(0,z.jsx)(l,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,z.jsxs)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink-muted`,title:r?.path??`/workspace${A?`/${A}`:``}`,children:[r?.path??`/workspace${A?`/${A}`:``}`,ye&&` •`]})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:!A,onClick:()=>void Me(lt(A)),className:M(`hidden h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink disabled:opacity-30 sm:inline-flex`,!r&&`inline-flex`),"aria-label":S(`work.files.up`,{defaultValue:`Parent folder`}),title:S(`work.files.up`,{defaultValue:`Parent folder`}),children:(0,z.jsx)(l,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,z.jsx)(`button`,{type:`button`,"data-testid":`work-refresh-files-button`,onClick:()=>void o(A).catch(()=>void 0),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink`,"aria-label":S(`common.refresh`,{defaultValue:`Refresh`}),title:S(`common.refresh`,{defaultValue:`Refresh`}),children:(0,z.jsx)(x,{className:M(`h-3.5 w-3.5`,i&&`animate-spin`)})}),r&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(N,{"data-testid":`work-format-file-button`,size:`sm`,variant:`ghost`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:R||P||!ke,onClick:()=>void K(),"aria-busy":P||void 0,title:ke?S(`work.files.formatShortcut`,{defaultValue:`Format (Shift+Alt+F)`}):Ee?S(`work.files.formatTooLarge`,{defaultValue:`Formatting is limited to files under 100,000 characters and 4,000 lines.`}):S(`work.files.formatUnsupported`,{defaultValue:`Formatting is not available for this file type.`}),"aria-label":S(`work.files.format`,{defaultValue:`Format file`}),children:[P?(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(y,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.files.format`,{defaultValue:`Format`})})]}),(0,z.jsxs)(N,{"data-testid":`work-save-file-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:!ye||R||P||a,onClick:()=>void Pe(),"aria-busy":a||void 0,title:S(`work.files.saveShortcut`,{defaultValue:`Save (⌘/Ctrl+S)`}),"aria-label":S(`common.save`),children:[a?(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(u,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`common.save`)})]})]})]})]}),k===`activity`&&(0,z.jsx)(`div`,{className:`min-w-0 flex-1`}),k===`preview`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`input`,{dir:`auto`,value:ce,onChange:e=>de(e.target.value),placeholder:S(`work.preview.command`,{defaultValue:`Optional start command`}),"aria-label":S(`work.preview.command`,{defaultValue:`Optional start command`}),className:`h-8 min-w-0 flex-1 rounded-lg border border-line bg-surface px-2.5 font-mono text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.previewStatus===`running`||e.previewStatus===`starting`?(0,z.jsxs)(N,{"data-testid":`work-stop-preview-button`,variant:`danger`,size:`sm`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void h(),"aria-busy":a||void 0,"aria-label":S(`work.preview.stop`,{defaultValue:`Stop preview`}),children:[a?(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(E,{className:`h-3.5 w-3.5 fill-current`}),(0,z.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.preview.stop`,{defaultValue:`Stop preview`})})]}):(0,z.jsxs)(N,{"data-testid":`work-start-preview-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void p(ce.trim()||void 0),"aria-busy":a||void 0,"aria-label":S(`work.preview.start`,{defaultValue:`Start preview`}),children:[a?(0,z.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,z.jsx)(v,{className:`h-3.5 w-3.5 fill-current`}),(0,z.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.preview.start`,{defaultValue:`Start preview`})})]}),F&&(0,z.jsx)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,"aria-label":S(`work.preview.open`,{defaultValue:`Open`}),title:S(`work.preview.open`,{defaultValue:`Open`}),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-line text-ink-muted hover:bg-surface-subtle hover:text-ink`,children:(0,z.jsx)(O,{className:`h-3.5 w-3.5`})})]})]})]}),k===`files`&&(0,z.jsxs)(`div`,{id:`work-workspace-panel-files`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-files`,className:`flex min-h-0 flex-1`,children:[(0,z.jsx)(`div`,{className:M(`flex min-h-0 w-full flex-col border-e border-line bg-surface-raised`,r?`hidden sm:flex sm:w-52 xl:w-60`:`flex`),children:(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1.5`,children:i&&n.length===0?(0,z.jsx)(`div`,{className:`flex justify-center py-8 text-ink-muted`,children:(0,z.jsx)(C,{className:`h-5 w-5 animate-spin`})}):n.length===0?(0,z.jsx)(`p`,{className:`px-3 py-8 text-center text-xs text-ink-muted`,children:S(`work.files.empty`,{defaultValue:`No files in this folder yet.`})}):[...n].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1).map(e=>(0,z.jsxs)(`button`,{type:`button`,"data-testid":`work-file-item`,"data-path":e.path,onClick:()=>{e.type===`directory`?Me(e.path):W(e.path)},className:M(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-xs hover:bg-surface-subtle`,r?.path===e.path?`bg-surface-subtle text-ink`:`text-ink-muted`),children:[e.type===`directory`?(0,z.jsx)(re,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`}):(0,z.jsx)(ne,{className:`h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{dir:`auto`,className:`truncate`,children:e.name})]},e.path))})}),(0,z.jsx)(`div`,{className:M(`min-h-0 min-w-0 flex-1 flex-col`,r?`flex`:`hidden sm:flex`),children:r?(0,z.jsx)(st,{path:r.path,value:j,ariaLabel:S(`work.files.editorLabel`,{path:r.path,defaultValue:`File editor: {{path}}`}),onChange:G,onSaveShortcut:()=>{ye&&!R&&!a&&!P&&Pe()},onFormatShortcut:()=>void K(),disabled:R||P}):(0,z.jsxs)(`div`,{className:`m-auto px-6 text-center text-xs text-ink-muted`,children:[(0,z.jsx)(ne,{className:`mx-auto mb-3 h-7 w-7 text-ink-subtle`}),S(`work.files.select`,{defaultValue:`Select a file to inspect and edit it.`})]})})]}),k===`activity`&&(0,z.jsxs)(`div`,{id:`work-workspace-panel-activity`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-activity`,className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[t&&(0,z.jsx)(`div`,{className:`mb-3`,children:(0,z.jsx)(Oe,{run:t,variant:`activity`})}),_e.length===0&&!t?(0,z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center text-xs text-ink-muted`,children:[(0,z.jsx)(m,{className:`mb-3 h-7 w-7 text-ink-subtle`}),S(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]}):(0,z.jsx)(`div`,{className:`space-y-2`,children:_e.map(e=>(0,z.jsxs)(`div`,{className:`rounded-xl border border-line bg-surface p-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{dir:`auto`,className:`truncate font-mono text-xs font-medium text-ink`,children:ut(e,S(`work.activity.toolActivity`,{defaultValue:`Tool activity`}))}),(0,z.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-ink-subtle rtl:tracking-normal`,children:{message:S(`work.activity.kinds.message`,{defaultValue:`Message`}),reasoning:S(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`}),tool_call:S(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}),tool_result:S(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),error:S(`work.activity.kinds.error`,{defaultValue:`Error`})}[e.kind]})]}),e.content&&(0,z.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:e.content})]},e.id))})]}),k===`preview`&&(0,z.jsx)(`div`,{id:`work-workspace-panel-preview`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-preview`,className:`flex min-h-0 flex-1 flex-col`,children:e.previewStatus===`starting`?(0,z.jsxs)(`div`,{className:`m-auto flex items-center gap-2 text-xs text-ink-muted`,children:[(0,z.jsx)(C,{className:`h-4 w-4 animate-spin`}),S(`work.preview.starting`,{defaultValue:`Starting preview…`})]}):F&&e.previewStatus===`running`?(0,z.jsx)(`iframe`,{"data-testid":`work-preview-frame`,title:S(`work.preview.frameTitle`,{defaultValue:`Workspace preview`}),src:F,sandbox:`allow-scripts allow-forms allow-modals allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 flex-1 border-0 bg-white`}):(0,z.jsxs)(`div`,{className:`m-auto max-w-sm px-6 text-center text-xs leading-relaxed text-ink-muted`,children:[(0,z.jsx)(g,{className:`mx-auto mb-3 h-8 w-8 text-ink-subtle`}),e.previewStatus===`failed`?S(`work.preview.failed`,{defaultValue:`The preview could not start. Check Activity, then try another command.`}):S(`work.preview.empty`,{defaultValue:`Start the app inside this workspace to inspect it here.`})]})})]})}var ft=e=>{let t=e.trim().toLowerCase();return!!t&&!t.includes(`embed`)},pt=(e,t)=>e instanceof Error&&e.message?e.message:t,mt=(e,t)=>new Promise(n=>{if(t.aborted){n();return}let r,i=()=>{r!==void 0&&window.clearTimeout(r),t.removeEventListener(`abort`,i),n()};r=window.setTimeout(i,e),t.addEventListener(`abort`,i,{once:!0})});function Q(){let{t:e}=c(),t=s(),n=r(),{taskId:a}=i(),l=de(e=>e.preferences),u=de(e=>e.setPreferences),m=me(e=>e.user),_=m?.id??null,[v,y]=(0,L.useState)(!1),b=P(e=>e.models),x=P(e=>e.selectedModel),S=P(e=>e.selectedProviderType),C=P(e=>e.selectedProviderId),T=P(e=>e.loadModels),{capabilities:E,tasks:D,selectedTask:O,files:k,selectedFile:ee,liveRuns:te,loadingTask:ne,loadingOlderMessages:re,loadingFiles:j,actionLoading:ae,error:N,loadCapabilities:le,loadTasks:fe,selectTask:pe,loadTask:I,loadOlderMessages:_e,createTask:ve,updateTask:be,deleteTask:B,startRun:V,cancelRun:xe,beginLiveRun:Se,applyRunEvents:Ce,setLiveRunConnection:we,clearLiveRun:Te,loadFiles:U,loadFile:Ee,clearSelectedFile:De,saveFile:Oe,startPreview:ke,stopPreview:Ae,clearError:je}=F(),Me=(0,L.useMemo)(()=>b.filter(e=>!e.isPersona&&ft(e.name)&&(!e.isPlugin||!!e.pluginId)),[b]),W=(0,L.useMemo)(()=>Me.flatMap(e=>{if(e.isPlugin&&!e.pluginId)return[];let t=e.isPlugin?`plugin`:`ollama`,n=e.isPlugin?e.pluginId:void 0,r=e.name.trim().toLowerCase(),i={model:e.name,providerType:t,providerId:n};return[{...i,key:R(i),label:e.isPlugin&&e.pluginName?`${e.name} · ${e.pluginName}`:e.name,remote:e.isPlugin||r.endsWith(`:cloud`)||r.endsWith(`-cloud`)}]}),[Me]),[G,Pe]=(0,L.useState)(``),[K,q]=(0,L.useState)({locationKey:t.key,value:`conversation`}),Fe=K.locationKey===t.key?K.value:`conversation`,Ie=e=>q({locationKey:t.key,value:e}),[J,Le]=(0,L.useState)(!1),[Re,ze]=(0,L.useState)({taskId:null,open:!1}),Be=Re.open&&Re.taskId===O?.id,Ve=(0,L.useRef)(null),He=(0,L.useRef)(null),Ue=(0,L.useRef)(null),Y=(0,L.useCallback)((e=!1)=>{ze(e=>({...e,open:!1})),e&&window.requestAnimationFrame(()=>He.current?.focus())},[]);(0,L.useEffect)(()=>{if(!Be)return;let e=window.requestAnimationFrame(()=>{Ue.current?.querySelector(`[role="menuitem"]`)?.focus()}),t=e=>{e.target instanceof Node&&!Ve.current?.contains(e.target)&&Y()},n=e=>{e.key===`Escape`&&(e.preventDefault(),Y(!0))};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[Y,Be]);let Ge=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),Y(!0);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=[...Ue.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]];if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`?(n-1+t.length)%t.length:(n+1)%t.length]?.focus()};(0,L.useEffect)(()=>{le(),fe()},[le,fe]),(0,L.useEffect)(()=>{if(!a){pe(null);return}pe(a),I(a).catch(()=>void 0),U(a,``).catch(()=>void 0)},[a,U,I,pe]);let Ke=W.find(e=>e.key===G)||W.find(e=>e.model===x&&(S===`plugin`?e.providerType===`plugin`&&e.providerId===C:e.providerType===`ollama`))||W[0],qe=a?D.find(e=>e.id===a):void 0,Je=qe?.status??O?.status,Ye=O?.activeRun??qe?.activeRun??null,X=Ye?.id,Xe=Ye?.status===`queued`||Ye?.status===`preparing`||Ye?.status===`running`,Ze=a&&te[a]?.runId===X?te[a]:void 0,Qe=Je===`preparing`||Je===`running`?1e3:4e3;(0,L.useEffect)(()=>{let e,t=!1,n=async()=>{await fe(!0),t||(e=setTimeout(n,Qe))};return e=setTimeout(n,Qe),()=>{t=!0,e&&clearTimeout(e)}},[fe,Qe]);let $e=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!a||!Je){$e.current=null;return}let e=$e.current;$e.current={taskId:a,status:Je},e?.taskId===a&&(e.status===`preparing`||e.status===`running`)&&Je!==`preparing`&&Je!==`running`&&(I(a,!0).catch(()=>void 0),U(a,``).catch(()=>void 0))},[U,I,Je,a]),(0,L.useEffect)(()=>{if(!a||!X||!Xe)return;let e=new AbortController,t=!1,n=0,r=F.getState().liveRuns[a]?.runId===X&&F.getState().liveRuns[a]?.lastEventId||0,i=!1,o=[],s=null,c=()=>{if(s!==null&&(window.cancelAnimationFrame(s),s=null),o.length===0)return;let e=o;o=[],Ce(e)},l=e=>{if(e.type!==`snapshot`&&(n=0),r=Math.max(r,e.id),o.push(e),e.type===`done`||e.type===`error`&&e.data.terminal!==!1){i=!0,c();return}s===null&&(s=window.requestAnimationFrame(c))};return Se(a,X,Ye?.startedAt||void 0),(async()=>{for(;!t&&!e.signal.aborted&&!i;){we(a,X,n>=3?`error`:n===0?`connecting`:`reconnecting`);let o=Date.now();try{if(await se.streamRunEvents({taskId:a,runId:X,after:r,signal:e.signal,onEvent:l}),c(),i||t||e.signal.aborted)break;throw Error(`The live Work connection closed.`)}catch(r){if(c(),t||e.signal.aborted)return;Date.now()-o>=5e3&&(n=0),n+=1,we(a,X,n>=3?`error`:`reconnecting`,n>=3?pt(r,`Live updates are reconnecting in the background.`):void 0),await mt(Math.min(4e3,250*2**Math.min(n,4)),e.signal)}}if(c(),!(!i||e.signal.aborted)){we(a,X,`closed`);try{await Promise.all([I(a,!0),U(a,``),fe(!0)])}catch{}finally{Te(a,X)}}})(),()=>{t=!0,e.abort(),c()}},[Ce,Se,Te,U,I,fe,Ye?.startedAt,Xe,X,we,a]),(0,L.useEffect)(()=>{if(!J)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[J]);let et=(0,L.useCallback)(()=>!J||window.confirm(e(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),[e,J]),Z=(0,L.useCallback)(()=>!J||window.confirm(e(`work.files.leaveWithDraft`,{defaultValue:`Leave this file? Your unsaved edit will remain as a browser draft.`})),[e,J]),tt=()=>{O&&ee&&ue(O.id,ee.path)},nt=o(({currentLocation:e,nextLocation:t})=>{let n=t.state;return J&&n?.deletedWorkTaskId!==a&&`${e.pathname}${e.search}${e.hash}`!=`${t.pathname}${t.search}${t.hash}`});(0,L.useEffect)(()=>{if(nt.state!==`blocked`)return;if(!Z()){nt.reset();return}let e=nt.proceed,t=window.setTimeout(()=>{Le(!1),window.setTimeout(e,0)},0);return()=>window.clearTimeout(t)},[Z,nt]);let rt=()=>{je(),Ie(`conversation`),n(`/work`)},it=async t=>{if(O&&!et())return!1;O&&J&&(tt(),De(),Le(!1));try{if(O)await V(O.id,{message:t,model:O.model,providerType:O.providerType,providerId:O.providerId||void 0});else{if(!Ke)throw Error(e(`work.composer.noModelSelected`,{defaultValue:`No Work-compatible model is selected.`}));n(`/work/${(await ve({message:t,model:Ke.model,providerType:Ke.providerType,providerId:Ke.providerId,networkEnabled:!0})).id}`)}return!0}catch(t){return w.error(pt(t,e(`work.toasts.runFailed`,{defaultValue:`Could not start the Work task.`}))),!1}},at=async t=>{let n=bt.find(e=>e.key===t);if(n){if(!O){Pe(t);return}try{await be(O.id,{model:n.model,providerType:n.providerType,providerId:n.providerId})}catch(t){w.error(pt(t,e(`work.toasts.updateFailed`,{defaultValue:`Could not update this task.`})))}}},ot=async()=>{if(O)try{await xe(O.id),w.success(e(`work.toasts.cancelled`,{defaultValue:`Work run stopped.`}))}catch(t){w.error(pt(t,e(`work.toasts.cancelFailed`,{defaultValue:`Could not stop the Work run.`})))}},st=async t=>{let r=D.find(e=>e.id===t);if(!window.confirm(e(`work.tasks.deleteConfirm`,{defaultValue:`Delete “{{title}}” and its workspace permanently?`,title:r?.title||e(`work.tasks.untitled`,{defaultValue:`Untitled task`})})))return;let i=a===t&&J;i&&Le(!1);try{await B(t),he(t),a===t&&n(`/work`)}catch(t){i&&Le(!0),w.error(pt(t,e(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`})))}},ct=async t=>{if(!O)return!1;let n=t.trim();if(!n||n===O.title)return!!n;try{return await be(O.id,{title:n}),!0}catch(t){return w.error(pt(t,e(`work.toasts.renameFailed`,{defaultValue:`Could not rename this task.`}))),!1}},lt=async(e,t,n)=>{try{return await e(),n&&w.success(n),!0}catch(e){return w.error(pt(e,t)),!1}},ut=async(t,n,r)=>{if(!O)return!1;let i=O.id;try{let a=await Oe(i,t,n,r);return F.getState().selectedTaskId===i&&w.success(e(`work.toasts.saved`,{defaultValue:`File saved.`})),a}catch(t){return F.getState().selectedTaskId===i&&w.error(pt(t,e(`work.toasts.saveFailed`,{defaultValue:`Could not save this file.`}))),!1}},Q=E?.available===!1,ht=E?.pluginAvailable?E.ollamaAvailable?e(`work.runtime.readyHybrid`,{defaultValue:`Docker + models ready`}):e(`work.runtime.readyPlugin`,{defaultValue:`Docker + plugin ready`}):e(`work.runtime.readyOllama`,{defaultValue:`Docker ready`}),gt=e(`work.runtime.ready`,{defaultValue:`Runtime ready`}),_t=O?ye(O):!1,$=O?{model:O.model,providerType:O.providerType,providerId:O.providerId||void 0}:void 0,vt=$?R($):Ke?.key||``,yt=$&&!W.some(e=>e.key===vt)?{...$,key:vt,label:`${$.model} · ${$.providerType===`plugin`?$.providerId||`plugin`:`Ollama`}`,remote:$.providerType===`plugin`||$.model.toLowerCase().endsWith(`:cloud`)||$.model.toLowerCase().endsWith(`-cloud`)}:void 0,bt=yt?[yt,...W]:W,xt=ge[O?.status??`idle`],St=e(xt.labelKey,{defaultValue:xt.label}),Ct=async()=>{if(l.workRemoteProviderDisclosureDismissed||v)return!1;let t=_;y(!0);try{let n=await ce.updatePreferences({workRemoteProviderDisclosureDismissed:!0});if(!n.success)throw Error(n.error||e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`}));return(me.getState().user?.id??null)===t?(u({workRemoteProviderDisclosureDismissed:!0}),!0):!1}catch{return w.error(e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`})),!1}finally{y(!1)}};return(0,z.jsx)(`div`,{"data-testid":`work-page`,className:`relative flex h-full min-h-0 overflow-hidden bg-surface`,children:(0,z.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3 border-b border-line bg-surface px-3 md:px-4`,children:[O?(0,z.jsx)(`input`,{"data-testid":`work-task-title`,dir:`auto`,defaultValue:O.title,onBlur:e=>{let t=e.currentTarget;if(!t.value.trim()){t.value=O.title;return}ct(t.value).then(e=>{e||(t.value=O.title)})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=O.title,e.currentTarget.blur())},className:`min-w-0 max-w-sm flex-1 truncate rounded-lg border border-transparent bg-transparent px-2 py-1 text-sm font-semibold text-ink outline-none hover:border-line focus:border-primary-500 focus:bg-surface`,"aria-label":e(`work.tasks.rename`,{defaultValue:`Task title`})},`${O.id}:${O.title}`):(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(`h1`,{className:`truncate text-sm font-semibold text-ink`,children:e(`work.title`,{defaultValue:`Work`})})}),O&&(0,z.jsxs)(`span`,{"data-testid":`work-compact-status`,className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface px-2 text-[11px] font-medium text-ink-muted xl:hidden`,"aria-label":e(`work.tasks.status`,{status:St,defaultValue:`Status: {{status}}`}),title:e(`work.tasks.status`,{status:St,defaultValue:`Status: {{status}}`}),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-compact-status-indicator`,className:M(`h-1.5 w-1.5 rounded-full`,xt.animated&&`animate-pulse`,O.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:xt.color}}),(0,z.jsx)(`span`,{className:`hidden md:inline`,children:St})]}),O&&(0,z.jsxs)(`div`,{className:`ms-auto inline-flex h-9 shrink-0 items-center rounded-xl border border-line bg-surface-subtle p-1 shadow-subtle xl:hidden`,role:`group`,"aria-label":e(`work.mobile.surface`,{defaultValue:`Task surface`}),children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Ie(`conversation`),"aria-label":e(`work.mobile.conversation`,{defaultValue:`Conversation`}),"aria-pressed":Fe===`conversation`,className:M(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Fe===`conversation`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,z.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.conversation`,{defaultValue:`Conversation`})})]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Ie(`workspace`),"aria-label":e(`work.mobile.workspace`,{defaultValue:`Workspace`}),"aria-pressed":Fe===`workspace`,className:M(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Fe===`workspace`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,z.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.workspace`,{defaultValue:`Workspace`})})]})]}),(0,z.jsxs)(`div`,{className:M(`ms-auto hidden min-w-0 items-center gap-2`,O?`xl:flex`:`sm:flex`),children:[O&&(0,z.jsxs)(`span`,{"data-testid":`work-status`,className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-status-indicator`,className:M(`h-1.5 w-1.5 rounded-full`,xt.animated&&`animate-pulse`,O.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:xt.color}}),St]}),(0,z.jsxs)(`span`,{"data-testid":`work-runtime-status`,className:M(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium`,Q?`border-transparent bg-error-500 text-[#0D0D0C]`:`border-transparent bg-success-500 text-[#0D0D0C]`),title:Q?E?.reason||e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):E?.image?`${ht} · ${E.image}`:ht,children:[(0,z.jsx)(d,{className:`h-3.5 w-3.5`}),Q?e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):gt]}),O&&(0,z.jsxs)(`span`,{className:`hidden h-7 max-w-44 items-center gap-1.5 truncate rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted md:inline-flex`,children:[(0,z.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,z.jsx)(`span`,{dir:`ltr`,className:`truncate`,children:O.model})]})]}),O&&(0,z.jsxs)(`div`,{ref:Ve,className:`relative shrink-0`,children:[(0,z.jsx)(`button`,{ref:He,id:`work-task-actions-trigger`,type:`button`,"data-testid":`work-task-actions-button`,onClick:()=>ze(e=>({taskId:O.id,open:e.taskId===O.id?!e.open:!0})),onKeyDown:e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),ze({taskId:O.id,open:!0}))},className:`inline-flex h-9 w-9 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink`,"aria-label":e(`work.tasks.actions`,{defaultValue:`Task actions`}),"aria-haspopup":`menu`,"aria-expanded":Be,"aria-controls":Be?`work-task-actions-menu`:void 0,children:(0,z.jsx)(p,{className:`h-4 w-4`})}),Be&&(0,z.jsx)(`div`,{ref:Ue,id:`work-task-actions-menu`,role:`menu`,"aria-labelledby":`work-task-actions-trigger`,onKeyDown:Ge,className:`absolute end-0 top-10 z-40 min-w-44 rounded-xl border border-line bg-surface-overlay p-1.5 shadow-overlay`,children:(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`work-delete-task-button`,onClick:()=>{Y(!0),st(O.id)},className:`flex h-9 w-full items-center gap-2 rounded-lg px-2.5 text-start text-xs font-medium text-error-600 transition-colors hover:bg-error-500/10`,children:[(0,z.jsx)(ie,{className:`h-3.5 w-3.5`}),e(`work.tasks.delete`,{defaultValue:`Delete task`})]})})]})]}),(Q||N)&&(0,z.jsxs)(`div`,{className:M(`flex shrink-0 items-center gap-2 border-b px-4 py-2 text-xs`,Q?`border-error-500/20 bg-error-500/10 text-error-700`:`border-amber-500/20 bg-amber-500/10 text-ink`),children:[(0,z.jsx)(A,{className:`h-4 w-4 shrink-0`}),(0,z.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1`,children:Q?E?.reason||e(`work.runtime.reason`,{defaultValue:`Docker and an available Ollama or plugin model provider are required.`}):N}),N&&!Q&&(0,z.jsx)(`button`,{type:`button`,className:`rounded-md p-1 hover:bg-black/5`,onClick:je,"aria-label":e(`common.close`),children:`×`})]}),a?O?(0,z.jsx)(We,{userId:_,mobileSurface:Fe,conversation:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ne,{task:O,user:m,liveRun:Ze,loading:ne,loadingOlder:re,onLoadOlder:()=>_e(O.id)}),(0,z.jsx)(H,{models:bt,selectorModels:Me,modelKey:vt,running:_t,loading:ae,disabled:Q,remoteDisclosureDismissed:l.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:v,onModelChange:at,onDismissRemoteDisclosure:Ct,onModelsRefresh:T,onSubmit:it,onCancel:ot},O.id)]}),workspace:(0,z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:(0,z.jsx)(dt,{task:O,liveRun:Ze,files:k,selectedFile:ee,loadingFiles:j,actionLoading:ae,onLoadFiles:e=>U(O.id,e),onLoadFile:e=>Ee(O.id,e),onClearSelectedFile:De,onSaveFile:ut,onStartPreview:t=>lt(()=>ke(O.id,t),e(`work.toasts.previewFailed`,{defaultValue:`Could not start the preview.`})),onStopPreview:()=>lt(()=>Ae(O.id),e(`work.toasts.previewStopFailed`,{defaultValue:`Could not stop the preview.`})),onDirtyChange:Le},O.id)})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 text-center`,children:ne?(0,z.jsx)(`div`,{className:`text-sm text-ink-muted`,children:e(`work.tasks.loading`,{defaultValue:`Loading task…`})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(A,{className:`mb-3 h-8 w-8 text-ink-subtle`}),(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-ink`,children:e(`work.tasks.notFound`,{defaultValue:`This Work task is unavailable`})}),(0,z.jsxs)(`button`,{type:`button`,onClick:rt,className:`mt-4 inline-flex items-center gap-1.5 text-sm font-medium text-primary-600 hover:text-primary-700`,children:[(0,z.jsx)(oe,{className:`h-4 w-4 rtl:rotate-180`}),e(`work.tasks.back`,{defaultValue:`Start a new task`})]})]})}):(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`section`,{"data-testid":`work-landing`,className:`mx-auto flex min-h-full w-full max-w-3xl flex-col items-center justify-center px-4 py-20 sm:px-8 sm:py-24`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,z.jsx)(`h2`,{className:`max-w-3xl text-balance text-[clamp(2.65rem,7vw,5.25rem)] font-light leading-[0.98] tracking-[-0.055em] text-ink rtl:leading-[1.12] rtl:tracking-normal`,children:e(`work.landing.title`,{defaultValue:`Start a new Work task`})}),(0,z.jsx)(`p`,{className:`mt-4 max-w-xl text-balance text-base leading-relaxed text-ink-muted sm:text-lg`,children:e(`work.landing.description`,{defaultValue:`Give a local model a durable, isolated workspace. It can inspect files, run tools, and continue where it left off when you return.`})})]}),(0,z.jsx)(H,{variant:`landing`,models:W,selectorModels:Me,modelKey:Ke?.key||``,running:!1,loading:ae,disabled:Q,remoteDisclosureDismissed:l.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:v,onModelChange:at,onDismissRemoteDisclosure:Ct,onModelsRefresh:T,onSubmit:it,onCancel:ot}),(0,z.jsxs)(`div`,{"data-testid":`work-workspace-note`,role:`note`,className:`mt-4 flex max-w-2xl flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center text-[10px] leading-relaxed text-ink-subtle`,children:[(0,z.jsx)(d,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{children:e(`work.composer.hint`,{defaultValue:`Each task keeps its own files and history. Review model output before using it.`})})]})]})})]})})}export{Q as default};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CKV9Lnj8.js","js/rolldown-runtime-QTnfLwEv.js","js/markdown-core-GI9BPwrB.js","js/react-vendor-DyG_ODzn.js","js/router-vendor-BjDI9mRe.js","js/useTranslation-Cs6iTP4m.js","js/ui-vendor-CAFEDSaO.js","js/utils-vendor-Cbaj0BC5.js","js/demoMode-BhEpMVh5.js","js/logger-DbNs3-DK.js","js/utils-pTFqSV8c.js","js/Button-DBk-AREB.js","assets/index-Dme2Ozol.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,p as n}from"./router-vendor-BjDI9mRe.js";import{a as r}from"./utils-vendor-Cbaj0BC5.js";import{n as i}from"./demoMode-BhEpMVh5.js";import{n as a,t as o}from"./logger-DbNs3-DK.js";var s=o(`config`),c=window.location.protocol===`file:`?`http://localhost:3001/api`:`${window.location.origin}/api`,l=a(),u=()=>{l&&(s.debug(`API_BASE_URL configured as:`,c),s.debug(`Window location:`,window.location),s.debug(`Environment variables:`,{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.16.0`}))},d=o(`api`);u(),d.debug(`User agent:`,navigator.userAgent),d.debug(`Demo mode detected:`,i());var f=(e,t=!0)=>new Promise(n=>{setTimeout(()=>{n({success:t,data:e,error:t?void 0:`Demo mode: Backend not available`})},500)}),p=r.create({baseURL:c,timeout:3e5});p.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),p.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){d.warn(`Session expired or unauthorized, logging out...`),localStorage.removeItem(`auth-token`),t(async()=>{let{useAuthStore:e}=await import(`../assets/index-CKV9Lnj8.js`).then(e=>e.D);return{useAuthStore:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(({useAuthStore:e})=>{e.getState().logout()});let e=window.location.protocol===`file:`;return(e?window.location.hash:window.location.pathname).includes(`/login`)||(window.location.href=e?`#/login`:`/login`),Promise.reject(Error(`Session expired`))}return d.error(`API Error:`,e),Promise.reject(e)});var m=`0.16.0`,h={login:e=>i()?f({user:{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,allowUserModelPull:!0,version:m}}):p.post(`/auth/login`,e).then(e=>e.data),signup:e=>i()?f({user:{id:`demo-user-new`,username:e.username,email:e.email||``,role:`user`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token-new`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,allowUserModelPull:!0,version:m,turnstile:{enabled:!1}}}):p.post(`/auth/signup`,e).then(e=>e.data),logout:()=>i()?f(void 0):p.post(`/auth/logout`).then(e=>e.data),getSystemInfo:()=>(d.debug(`getSystemInfo called, demo mode:`,i()),i()?f({requiresAuth:!0,hasUsers:!0,userCount:1,allowUserModelPull:!0,version:m,turnstile:{enabled:!1}}):(d.debug(`Making API call to:`,c+`/auth/system-info`),d.debug(`Full URL from:`,window.location.origin,`-> API:`,c+`/auth/system-info`),p.get(`/auth/system-info`).then(e=>(d.debug(`getSystemInfo response:`,e.data),e.data)).catch(e=>{throw d.debug(`getSystemInfo error:`,e),e.response&&(d.debug(`Error response data:`,e.response.data),d.debug(`Error status:`,e.response.status),d.debug(`Error headers:`,e.response.headers)),e.request&&d.debug(`Network error - no response received:`,e.request),d.debug(`Error config:`,e.config),e}))),verifyToken:()=>i()?f({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):p.get(`/auth/verify`).then(e=>e.data),getEncryptionKey:()=>i()?f({encryptionKey:`demo-encryption-key-not-real`}):p.get(`/auth/encryption-key`).then(e=>e.data),updateModelPullSetting:e=>i()?f({requiresAuth:!0,hasUsers:!0,userCount:1,allowUserModelPull:e,version:m,turnstile:{enabled:!1}}):p.patch(`/auth/system-settings/model-pull`,{allowUserModelPull:e}).then(e=>e.data)},ee={getUsers:()=>i()?f([{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}]):p.get(`/users`).then(e=>e.data),createUser:e=>i()?f({id:`new-user-`+Date.now(),username:e.username,email:e.email,role:e.role,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):p.post(`/users`,e).then(e=>e.data),updateUser:(e,t)=>i()?f({id:e,username:t.username||`demo`,email:t.email||`demo@example.com`,role:t.role||`user`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):p.patch(`/users/${e}`,t).then(e=>e.data),deleteUser:e=>i()?f(void 0):p.delete(`/users/${e}`).then(e=>e.data),updateMyAvatar:e=>i()?f({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,avatar:e,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):p.patch(`/users/me/avatar`,{avatar:e}).then(e=>e.data)},g=[{name:`llama3.2:3b`,size:2048e6,digest:`demo-digest-1`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`llama`,families:[`llama`],parameter_size:`3B`,quantization_level:`Q4_0`}},{name:`qwen2.5:7b`,size:4096e6,digest:`demo-digest-2`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`qwen`,families:[`qwen`],parameter_size:`7B`,quantization_level:`Q4_0`}}],_=()=>[{id:`demo-session-1`,title:`Demo Chat Session`,model:g[0].name,providerType:`ollama`,providerId:null,messages:[{id:`demo-msg-1`,role:`user`,content:`Hello! Can you tell me about this demo?`,timestamp:Date.now()},{id:`demo-msg-2`,role:`assistant`,content:`This is a demo of Libre WebUI! In a real deployment, I would be powered by Ollama running locally on your machine. This demo shows the beautiful interface and features without the backend connection.`,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()}],v=_(),y={theme:{mode:`dark`,adaptToAccent:!1,accent:`blue`,customAccent:`#2563eb`},defaultModel:`llama3.2:3b`,defaultProviderType:`ollama`,defaultProviderId:null,systemMessage:`You are a helpful assistant.`,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.7},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},b={...y,theme:{...y.theme},generationOptions:{...y.generationOptions},embeddingSettings:{...y.embeddingSettings},titleSettings:{...y.titleSettings},backgroundSettings:{...y.backgroundSettings}},te=()=>b,x=e=>{let t=b.backgroundSettings||y.backgroundSettings;return b={...b,...e,theme:{...b.theme,...e.theme},generationOptions:{...b.generationOptions,...e.generationOptions},embeddingSettings:{...b.embeddingSettings,...e.embeddingSettings},titleSettings:e.titleSettings?{...b.titleSettings||y.titleSettings,...e.titleSettings}:b.titleSettings,backgroundSettings:e.backgroundSettings?{...t,...e.backgroundSettings}:b.backgroundSettings},b},S={getSessions:()=>p.get(`/chat/sessions`).then(e=>e.data),createSession:(e,t,n,r,i)=>p.post(`/chat/sessions`,{model:e,title:t,personaId:n,providerType:r,providerId:i}).then(e=>e.data),getSession:e=>{if(i()){let t=_().find(t=>t.id===e);return t?f(t):Promise.resolve({success:!1,error:`Session not found in demo mode`})}return p.get(`/chat/sessions/${e}`).then(e=>e.data)},updateSession:(e,t)=>{if(i()){let n=v.findIndex(t=>t.id===e),r=v[n];if(r){let e={...r,...t,updatedAt:Date.now()};return v[n]=e,f(e)}return Promise.resolve({success:!1,error:`Session not found in demo mode`})}return p.put(`/chat/sessions/${e}`,t).then(e=>e.data)},deleteSession:e=>i()?f(null):p.delete(`/chat/sessions/${e}`).then(e=>e.data),clearAllSessions:()=>p.delete(`/chat/sessions`).then(e=>e.data),generateTitle:(e,t,n,r,a)=>i()?f({title:n.substring(0,30)+(n.length>30?`...`:``),source:`fallback`,updatedAt:Date.now()}):p.post(`/chat/sessions/${e}/generate-title`,{model:t,message:n,providerType:r,providerId:a}).then(e=>e.data),sendMessage:(e,t,n)=>p.post(`/chat/sessions/${e}/messages`,{content:t,options:n}).then(e=>e.data),saveMessage:(e,t)=>p.post(`/chat/sessions/${e}/messages`,t).then(e=>e.data),updateMessage:(e,t,n)=>i()?f({}):p.put(`/chat/sessions/${e}/messages/${t}`,n).then(e=>e.data),generateChatResponse:(e,t,n)=>p.post(`/chat/sessions/${e}/generate`,{message:t,options:n}).then(e=>e.data),generateChatStreamResponse:(e,t,n)=>({subscribe:async(r,i,a)=>{try{let o=await fetch(`${c}/chat/sessions/${e}/generate/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:t,options:n})});if(!o.ok)throw Error(`HTTP error! status: ${o.status}`);let s=o.body?.getReader();if(!s)throw Error(`No response body reader available`);let l=new TextDecoder,u=``,f=()=>{s.read().then(({done:e,value:t})=>{if(e){a?.();return}u+=l.decode(t,{stream:!0});let n=u.split(`
|
|
3
|
+
`);u=n.pop()||``;for(let e of n){let t=e.trim();if(t.startsWith(`data: `)){let e=t.slice(6);if(e===`[DONE]`){a?.();return}try{let t=JSON.parse(e);if(r(t),t.type===`done`||t.type===`error`){t.type===`error`?i?.(t.error):a?.();return}}catch(e){d.error(`Failed to parse SSE data:`,e)}}}f()}).catch(e=>{i?.(e instanceof Error?e:Error(String(e)))})};return f(),()=>s.cancel()}catch(e){return i?.(e instanceof Error?e:Error(String(e))),()=>{}}}}),getMessageBranches:(e,t)=>i()?f([]):p.get(`/chat/sessions/${e}/messages/${t}/branches`).then(e=>e.data),switchMessageBranch:(e,t,n)=>i()?f({}):p.post(`/chat/sessions/${e}/messages/${t}/branch`,{branchIndex:n}).then(e=>e.data),createMessageBranch:(e,t,n)=>i()?f({}):p.post(`/chat/sessions/${e}/messages/${t}/branches`,{...n}).then(e=>e.data)},C={uploadDocument:(e,t)=>{if(i())return f({id:`demo-doc-`+Date.now(),filename:e.name,fileType:e.name.endsWith(`.pdf`)?`pdf`:`txt`,size:e.size,sessionId:t,uploadedAt:Date.now()});let n=new FormData;return n.append(`document`,e),t&&n.append(`sessionId`,t),p.post(`/documents/upload`,n).then(e=>e.data)},getDocuments:e=>{if(i())return f([]);let t=e?`/documents/session/${e}`:`/documents`;return p.get(t).then(e=>e.data)},getDocument:e=>i()?f({id:e,filename:`demo-document.pdf`,fileType:`pdf`,size:1024,content:`Demo document content...`,uploadedAt:Date.now()}):p.get(`/documents/${e}`).then(e=>e.data),searchDocuments:(e,t,n)=>i()?f([]):p.post(`/documents/search`,{query:e,sessionId:t,limit:n}).then(e=>e.data),deleteDocument:e=>i()?f(void 0):p.delete(`/documents/${e}`).then(e=>e.data),getEmbeddingStatus:()=>i()?f({available:!1,model:`nomic-embed-text`,chunksWithEmbeddings:0,totalChunks:0}):p.get(`/documents/embeddings/status`).then(e=>e.data),regenerateEmbeddings:()=>i()?f(void 0):p.post(`/documents/embeddings/regenerate`).then(e=>e.data)},w={getModels:()=>i()?f([{id:`nomic-embed-text`,name:`nomic-embed-text`,description:`Ollama - Default embedding model`,provider:`ollama`,dimensions:0,isDetectedEmbedding:!0}]):p.get(`/embeddings/models`).then(e=>e.data)},T={getModels:e=>i()?f([{id:`meta-llama/Llama-3.3-70B-Instruct`,modelId:`meta-llama/Llama-3.3-70B-Instruct`,author:`meta-llama`,downloads:1e6,likes:5e3,tags:[`text-generation`,`llama`],pipeline_tag:`text-generation`,gated:!1}]):p.get(`/huggingface-hub/models`,{params:e}).then(e=>e.data),getTrending:e=>i()?f([]):p.get(`/huggingface-hub/trending`,{params:e}).then(e=>e.data),getModel:(e,t)=>i()?f({id:`${e}/${t}`,modelId:`${e}/${t}`,author:e,downloads:0,likes:0,tags:[],gated:!1}):p.get(`/huggingface-hub/models/${e}/${t}`).then(e=>e.data),getTasks:()=>i()?f([`text-generation`,`text-to-speech`,`text-to-image`]):p.get(`/huggingface-hub/tasks`).then(e=>e.data),clearCache:()=>i()?f(!0):p.post(`/huggingface-hub/cache/clear`).then(e=>e.data),getGgufFiles:(e,t)=>i()?f([{filename:`model-Q4_K_M.gguf`,size:45e8,sizeFormatted:`4.19 GB`,quantization:`Q4_K_M`,url:`https://huggingface.co/${e}/${t}/resolve/main/model-Q4_K_M.gguf`,ollamaCommand:`hf.co/${e}/${t}:Q4_K_M`}]):p.get(`/huggingface-hub/models/${e}/${t}/gguf`).then(e=>e.data),hasGgufFiles:(e,t)=>i()?f({hasGguf:!1,count:0}):p.get(`/huggingface-hub/models/${e}/${t}/has-gguf`).then(e=>e.data)},E=/^data:image\/[a-z0-9][a-z0-9.+-]*(?:;[a-z0-9!#$&^_.+-]+=[^;,]*)*;base64,[a-z0-9+/]+={0,2}$/i,D=/^data:(image\/[a-z0-9][a-z0-9.+-]*)(?:;[a-z0-9!#$&^_.+-]+=[^;,]*)*;base64,/i,ne={"image/jpg":`image/jpeg`,"image/x-png":`image/png`},re=new Set([`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/heic`,`image/heif`,`image/jpeg`,`image/png`,`image/tiff`,`image/vnd.microsoft.icon`,`image/webp`,`image/x-icon`]);function O(e){if(!e)return null;let t=e.split(`;`,1)[0].trim().toLowerCase(),n=ne[t]||t;return re.has(n)?n:null}function k(e,t,n){if(t)return e.find(e=>e.model===t&&(!n||e.plugin===n))}function ie(e,t,n){let r=k(e,t,n);return r||n?r:e[0]}function ae(e,t){return t?.pluginId?e.find(e=>e.id===t.pluginId):(t?.model?e.find(e=>e.models.includes(t.model)):void 0)||e[0]}function oe(e){let t=e.b64_json?.trim();if(t)return`data:${O(e.mime_type)||`image/png`};base64,${t}`;let n=e.url?.trim();if(!n)return null;let r=D.exec(n)?.[1];if(E.test(n)&&O(r))return n;try{let e=new URL(n);return e.protocol===`http:`||e.protocol===`https:`?n:null}catch{return null}}function A(e){switch(D.exec(e.trim())?.[1].toLowerCase()){case`image/jpeg`:case`image/jpg`:return`jpg`;case`image/webp`:return`webp`;case`image/gif`:return`gif`;case`image/avif`:return`avif`;default:return`png`}}function j(e){return`${encodeURIComponent(e.plugin)}::${encodeURIComponent(e.model)}`}function M(e,t,n,r){let i=(e??[]).filter(Boolean);return i.length===0?t||n||r:t&&i.includes(t)?t:n&&i.includes(n)?n:i[0]}var N={getModels:()=>i()?f([{model:`gpt-image-2`,plugin:`openai`,config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):p.get(`/image-gen/models`).then(e=>e.data),getPlugins:()=>i()?f([{id:`openai`,name:`OpenAI GPT Image`,models:[`gpt-image-2`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):p.get(`/image-gen/plugins`).then(e=>e.data),getConfig:e=>i()?f({sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}):p.get(`/image-gen/config/${e}`).then(e=>e.data),generate:e=>i()?f({images:[{url:`https://placehold.co/1024x1024/purple/white?text=Demo+Image`,revised_prompt:e.prompt}],model:e.model,pluginId:e.pluginId}):p.post(`/image-gen/generate`,e).then(e=>e.data),getGallery:e=>i()?f({images:[],total:0}):p.get(`/image-gen/gallery`,{params:e}).then(e=>e.data),getGalleryImage:e=>i()?f({id:e,userId:`demo`,prompt:`Demo image prompt`,model:`dall-e-3`,imageData:`https://placehold.co/1024x1024/purple/white?text=Demo`,createdAt:Date.now()}):p.get(`/image-gen/gallery/${e}`).then(e=>e.data),deleteGalleryImage:e=>i()?f(void 0):p.delete(`/image-gen/gallery/${e}`).then(e=>e.data)},P={connected:!1,baseUrl:`http://127.0.0.1:8766`,dashboardUrl:`http://127.0.0.1:8766/dashboard`,error:`Libre Claw daemon is not connected in demo mode.`},F={status:()=>i()?f(P):p.get(`/libre-claw/status`).then(e=>e.data),dashboard:()=>i()?f({url:P.dashboardUrl}):p.get(`/libre-claw/dashboard`).then(e=>e.data),currentModel:()=>i()?f({provider:`openrouter`,model:`openrouter/auto`}):p.get(`/libre-claw/config/model`).then(e=>e.data),updateModel:(e,t,n=!1)=>i()?f({provider:e,model:t,persist_global:n}):p.patch(`/libre-claw/config/model`,{provider:e,model:t,persist_global:n}).then(e=>e.data),currentFallback:()=>i()?f({enabled:!1,routes:[]}):p.get(`/libre-claw/config/fallback`).then(e=>e.data),updateFallback:e=>i()?f(e):p.patch(`/libre-claw/config/fallback`,e).then(e=>e.data),updateTheme:(e,t=!0)=>i()?f({theme:e,label:e,persist_global:t}):p.patch(`/libre-claw/config/theme`,{theme:e,persist_global:t}).then(e=>e.data),usage:(e=``,t=250)=>{let n=new URLSearchParams({limit:String(t)});return e&&n.set(`provider`,e),i()?f({summary:{},records:[],text:``}):p.get(`/libre-claw/usage?${n.toString()}`).then(e=>e.data)},listRuns:(e=20)=>i()?f({runs:[]}):p.get(`/libre-claw/runs?limit=${e}`).then(e=>e.data),startRun:e=>{if(i()){let t=new Date().toISOString();return f({run:{run_id:`demo-${Date.now()}`,state:`queued`,title:e.message.slice(0,80)||`Libre Claw demo run`,kind:e.kind||`chat`,provider:e.provider||`openrouter`,model:e.model||`openrouter/auto`,working_directory:``,created_at:t,updated_at:t}})}return p.post(`/libre-claw/runs`,e).then(e=>e.data)},getRun:e=>i()?f({run_id:e}):p.get(`/libre-claw/runs/${encodeURIComponent(e)}`).then(e=>e.data),getEvents:(e,t=0)=>i()?f({events:[]}):p.get(`/libre-claw/runs/${encodeURIComponent(e)}/events?after=${t}`).then(e=>e.data),cancelRun:e=>i()?f({run_id:e,cancelled:!0}):p.post(`/libre-claw/runs/${encodeURIComponent(e)}/cancel`).then(e=>e.data),resolvePermission:(e,t,n)=>i()?f({run_id:e,tool_call_id:t,resolution:n}):p.post(`/libre-claw/runs/${encodeURIComponent(e)}/permissions/${encodeURIComponent(t)}`,{resolution:n}).then(e=>e.data),listAutomations:(e=50)=>i()?f({automations:[]}):p.get(`/libre-claw/automations?limit=${e}`).then(e=>e.data),createAutomation:e=>i()?f({...e,automation_id:`demo-${Date.now()}`}):p.post(`/libre-claw/automations`,e).then(e=>e.data),updateAutomation:(e,t)=>i()?f({...t,automation_id:e}):p.patch(`/libre-claw/automations/${encodeURIComponent(e)}`,t).then(e=>e.data),pauseAutomation:e=>i()?f({automation_id:e,status:`paused`}):p.post(`/libre-claw/automations/${encodeURIComponent(e)}/pause`).then(e=>e.data),resumeAutomation:e=>i()?f({automation_id:e,status:`active`}):p.post(`/libre-claw/automations/${encodeURIComponent(e)}/resume`).then(e=>e.data),runAutomationNow:e=>i()?f({automation_id:e,run:!0}):p.post(`/libre-claw/automations/${encodeURIComponent(e)}/run`).then(e=>e.data),deleteAutomation:e=>i()?f({automation_id:e,deleted:!0}):p.delete(`/libre-claw/automations/${encodeURIComponent(e)}`).then(e=>e.data)},I={checkHealth:()=>i()?f({status:`offline`},!1):p.get(`/ollama/health`).then(e=>e.data),getModels:()=>i()?f(g):p.get(`/ollama/models`).then(e=>e.data),pullModel:e=>i()?f(null,!1):p.post(`/ollama/models/pull`,{name:e}).then(e=>e.data),pullModelStream:(e,t,n,r)=>{if(i()){let e=0,r=setInterval(()=>{e+=Math.random()*20,e>=100?(e=100,t({status:`success`,total:100,completed:100,percent:100}),clearInterval(r),setTimeout(n,500)):t({status:`pulling`,total:100,completed:e,percent:Math.round(e)})},1e3);return()=>clearInterval(r)}let a=new URLSearchParams({model:e}),o=localStorage.getItem(`auth-token`);o&&a.set(`token`,o);let s=new EventSource(`${c}/ollama/pull/stream?${a.toString()}`);return s.onmessage=e=>{let i=JSON.parse(e.data);switch(i.type){case`progress`:t({status:i.status,digest:i.digest,total:i.total,completed:i.completed,percent:i.percent});break;case`complete`:s.close(),n();break;case`error`:s.close(),r(i.error);break}},s.onerror=()=>{s.close(),r(`Connection to server lost`)},()=>{s.close()}},deleteModel:e=>i()?f(null,!1):p.delete(`/ollama/models`,{params:{name:e}}).then(e=>e.data),showModel:(e,t=!1)=>{if(i()){let t=g.find(t=>t.name===e);return f(t||null,!!t)}return p.get(`/ollama/models/show`,{params:{name:e,verbose:t}}).then(e=>e.data)},createModel:e=>i()?f(null,!1):p.post(`/ollama/models`,e).then(e=>e.data),copyModel:(e,t)=>i()?f(null,!1):p.post(`/ollama/models/copy`,{source:e,destination:t}).then(e=>e.data),pushModel:e=>i()?f(null,!1):p.post(`/ollama/models/push`,{name:e}).then(e=>e.data),pullAllModels:()=>i()?f(null,!1):p.post(`/ollama/models/pull-all`).then(e=>e.data),pullAllModelsStream:(e,t,n)=>{if(i()){let n=g,r=0,i=setInterval(()=>{r++,r<=n.length&&e({current:r,total:n.length,modelName:n[r-1]?.name||`demo-model`,status:Math.random()>.1?`success`:`error`,error:Math.random()>.1?void 0:`Demo error`}),r>=n.length&&(clearInterval(i),setTimeout(t,500))},1e3);return}let r=new EventSource(`${c}/ollama/models/pull-all/stream`);r.onmessage=i=>{let a=JSON.parse(i.data);switch(a.type){case`progress`:e({current:a.current,total:a.total,modelName:a.modelName,status:a.status,error:a.error});break;case`complete`:r.close(),t();break;case`error`:r.close(),n(a.error);break}},r.onerror=()=>{r.close(),n(`Connection to server lost`)}},generateEmbeddings:e=>i()?f({embeddings:[[]]},!1):p.post(`/ollama/embed`,e).then(e=>e.data),listRunningModels:()=>i()?f([]):p.get(`/ollama/running`).then(e=>e.data),unloadModel:e=>i()?f(null):p.post(`/ollama/models/unload`,{name:e}).then(e=>e.data),unloadAllModels:()=>i()?f(null):p.post(`/ollama/models/unload-all`).then(e=>e.data),getVersion:()=>i()?f({version:`demo-mode`},!1):p.get(`/ollama/version`).then(e=>e.data),chatCompletion:e=>i()?f({message:{content:`Demo response`,role:`assistant`}},!1):p.post(`/ollama/chat`,e).then(e=>e.data),checkBlobExists:e=>i()?Promise.resolve(!1):p.head(`/ollama/blobs/${e}`).then(()=>!0).catch(()=>!1),pushBlob:(e,t)=>i()?f(null,!1):p.post(`/ollama/blobs/${e}`,t,{headers:{"Content-Type":`application/octet-stream`}}).then(e=>e.data),generateLegacyEmbeddings:e=>i()?f({embedding:[]},!1):p.post(`/ollama/embeddings`,e).then(e=>e.data),getLibraryModels:e=>{if(i())return e?.category===`cloud`?f([{name:`gpt-oss:cloud`,description:`Demo cloud model using Ollama cloud naming`,category:`cloud`,sizes:[`cloud`],pulls:`Cloud`,tags:[`cloud`]}]):f([{name:`llama3.2`,description:`Meta's latest Llama model`,category:`general`,sizes:[`1b`,`3b`],pulls:`50M+`,tags:[`general`]},{name:`deepseek-r1`,description:`Open reasoning model`,category:`reasoning`,sizes:[`7b`,`14b`,`32b`],pulls:`200M+`,tags:[`reasoning`]}]);let t=new URLSearchParams;e?.search&&t.set(`search`,e.search),e?.sort&&t.set(`sort`,e.sort),e?.category&&t.set(`category`,e.category);let n=t.toString();return p.get(`/ollama/library${n?`?${n}`:``}`).then(e=>e.data)}},L=[[`#2563eb`,`#7c3aed`],[`#0891b2`,`#2563eb`],[`#0f766e`,`#2563eb`],[`#be123c`,`#7c3aed`],[`#ff7b52`,`#dc2626`]],R=e=>{let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)},z=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),B=e=>{let t=e.trim().split(/[\s._-]+/).filter(Boolean);return t.length===0?`AI`:t.slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`AI`},V=(e,t=128)=>{let n=e.trim()||`AI Persona`,r=R(n),[i,a]=L[r%L.length],o=z(B(n)),s=`persona-avatar-${r}-${t}`,c=t>=96?44:24,l=`
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}" role="img" aria-label="${z(n)} avatar">
|
|
5
|
+
<defs>
|
|
6
|
+
<linearGradient id="${s}" x1="0" y1="0" x2="1" y2="1">
|
|
7
|
+
<stop offset="0%" stop-color="${i}" />
|
|
8
|
+
<stop offset="100%" stop-color="${a}" />
|
|
9
|
+
</linearGradient>
|
|
10
|
+
</defs>
|
|
11
|
+
<rect width="${t}" height="${t}" rx="${Math.round(t*.22)}" fill="url(#${s})" />
|
|
12
|
+
<circle cx="${t*.22}" cy="${t*.22}" r="${t*.26}" fill="rgba(255,255,255,0.16)" />
|
|
13
|
+
<text x="50%" y="52%" dominant-baseline="middle" text-anchor="middle" fill="white" font-family="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" font-size="${c}" font-weight="700">${o}</text>
|
|
14
|
+
</svg>
|
|
15
|
+
`;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`},H=(e,t=128)=>e.avatar?.trim()||V(e.name,t),U=(e,t,n=128)=>{e.onerror=null,e.src=V(t,n)},W={getPersonas:()=>i()?f([{id:`demo-1`,user_id:`default`,name:`Creative Assistant`,description:`Helpful assistant for creative tasks`,model:`llama3.3:latest`,parameters:{temperature:.8,top_p:.9,context_window:4096,system_prompt:`You are a creative and helpful assistant. Provide thoughtful and engaging responses.`},avatar:V(`Creative Assistant`,128),created_at:Date.now()-864e5,updated_at:Date.now()-864e5},{id:`demo-2`,user_id:`default`,name:`Research Assistant`,description:`Academic assistant for research and learning`,model:`qwen3:7b`,parameters:{temperature:.3,top_p:.8,context_window:8192,system_prompt:`You are a knowledgeable research assistant. Provide detailed, informative explanations.`},avatar:V(`Research Assistant`,128),created_at:Date.now()-1728e5,updated_at:Date.now()-1728e5}]):p.get(`/personas`).then(e=>e.data),getPersona:e=>i()?f({id:e,user_id:`default`,name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()}):p.get(`/personas/${e}`).then(e=>e.data),createPersona:e=>i()?f({id:`demo-`+Date.now(),user_id:`default`,...e,created_at:Date.now(),updated_at:Date.now()}):p.post(`/personas`,e).then(e=>e.data),updatePersona:(e,t)=>i()?f({id:e,user_id:`default`,name:t.name||`Updated Sample Assistant`,description:t.description,model:t.model||`llama3.2:latest`,parameters:t.parameters||{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},avatar:t.avatar,background:t.background,created_at:Date.now()-864e5,updated_at:Date.now()}):p.put(`/personas/${e}`,t).then(e=>e.data),deletePersona:e=>i()?f(void 0):p.delete(`/personas/${e}`).then(e=>e.data),exportPersona:e=>{if(i()){let e={name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,params:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},exportedAt:Date.now(),version:`1.0.0`};return Promise.resolve(e)}return p.get(`/personas/${e}/export`).then(e=>e.data)},importPersona:e=>i()?f({id:`demo-imported-`+Date.now(),user_id:`default`,name:e.name,description:e.description,model:e.model,parameters:e.params,avatar:e.avatar,background:e.background,created_at:Date.now(),updated_at:Date.now(),embedding_model:e.embedding_model,memory_settings:e.memory_settings,mutation_settings:e.mutation_settings}):p.post(`/personas/import`,e).then(e=>e.data),getPersonasCount:()=>i()?f({count:2}):p.get(`/personas/stats/count`).then(e=>e.data),getDefaultParameters:()=>i()?f({temperature:.7,top_p:.9,top_k:40,context_window:4096,max_tokens:1024,system_prompt:``,repeat_penalty:1.1,presence_penalty:0,frequency_penalty:0}):p.get(`/personas/defaults/parameters`).then(e=>e.data),getMemoryStatus:e=>i()?f({status:`active`,memory_count:42,last_backup:Date.now()-864e5,size_mb:2.3}):p.get(`/personas/${e}/memory/status`).then(e=>e.data),wipeMemories:e=>i()?f({deleted_count:42}):p.delete(`/personas/${e}/memory`).then(e=>e.data),backupPersona:e=>{if(i()){let t=JSON.stringify({persona_id:e,backup_date:new Date().toISOString(),data:`demo backup data`});return Promise.resolve(new Blob([t],{type:`application/json`}))}return p.get(`/personas/${e}/backup`,{responseType:`blob`}).then(e=>e.data)},exportPersonaDNA:e=>{if(i()){let t=JSON.stringify({persona_id:e,export_date:new Date().toISOString(),dna:`demo DNA data`,memories:[],learned_behaviors:{}});return Promise.resolve(new Blob([t],{type:`application/json`}))}return p.get(`/personas/${e}/export/dna`,{responseType:`blob`}).then(e=>e.data)},importPersonaDNA:e=>{if(i())return f({id:`demo-dna-`+Date.now(),user_id:`default`,name:`Imported Persona`,description:`Persona imported from DNA`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()});let t=new FormData;return t.append(`dnaFile`,e),p.post(`/personas/import/dna`,t).then(e=>e.data)},downloadPersona:async(e,t)=>{try{let n=await W.exportPersona(e),r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){throw d.error(`Error while downloading persona:`,e),Error(`Failed to download persona: ${e instanceof Error?e.message:String(e)}`)}}},G={getAllPlugins:()=>i()?f([]):p.get(`/plugins`).then(e=>e.data),discoverModels:e=>i()?f([]):p.post(`/plugins/discover/${encodeURIComponent(e)}`).then(e=>e.data),uploadPlugin:e=>{if(i())return f({},!1);let t=new FormData;return t.append(`plugin`,e),p.post(`/plugins/upload`,t).then(e=>e.data)},installPlugin:e=>i()?f({},!1):p.post(`/plugins/install`,e).then(e=>e.data),updatePlugin:(e,t)=>i()?f({},!1):p.put(`/plugins/${e}`,t).then(e=>e.data),deletePlugin:e=>i()?f(void 0):p.delete(`/plugins/${e}`).then(e=>e.data),activatePlugin:e=>i()?f(!1,!1):p.post(`/plugins/activate/${e}`).then(e=>e.data),deactivatePlugin:e=>{if(i())return f(void 0);let t=e?`/plugins/deactivate/${e}`:`/plugins/deactivate`;return p.post(t).then(e=>e.data)},getActivePlugin:()=>i()?f(null):p.get(`/plugins/active`).then(e=>e.data),getPluginStatus:()=>i()?f([]):p.get(`/plugins/status`).then(e=>e.data),exportPlugin:e=>i()?Promise.resolve(new Blob([`{}`],{type:`application/json`})):p.get(`/plugins/${e}/export`,{responseType:`blob`}).then(e=>e.data),getCredentials:()=>i()?f([]):p.get(`/plugins/credentials/all`).then(e=>e.data),setApiKey:(e,t)=>i()?f(!1,!1):p.post(`/plugins/${e}/credentials`,{api_key:t}).then(e=>e.data),deleteApiKey:e=>i()?f(!1,!1):p.delete(`/plugins/${e}/credentials`).then(e=>e.data),checkApiKey:e=>i()?f(!1):p.get(`/plugins/${e}/credentials/check`).then(e=>e.data),getVariables:e=>i()?f({}):p.get(`/plugins/${e}/variables`).then(e=>e.data),setVariables:(e,t,n=[])=>i()?f(!0):p.put(`/plugins/${e}/variables`,{variables:t,unset:n}).then(e=>e.data),resetVariables:e=>i()?f(!0):p.delete(`/plugins/${e}/variables`).then(e=>e.data)},K={getPreferences:()=>i()?f(te()):p.get(`/preferences`).then(e=>e.data),updatePreferences:e=>i()?f(x(e)):p.put(`/preferences`,e).then(e=>e.data),setDefaultModel:(e,t,n)=>i()?f(x({defaultModel:e,defaultProviderType:t,defaultProviderId:t===`plugin`?n:null})):p.put(`/preferences/default-model`,{model:e,providerType:t,providerId:n}).then(e=>e.data),setSystemMessage:e=>i()?f(x({systemMessage:e})):p.put(`/preferences/system-message`,{message:e}).then(e=>e.data),setGenerationOptions:e=>i()?f(x({generationOptions:e})):p.put(`/preferences/generation-options`,e).then(e=>e.data),resetGenerationOptions:()=>i()?f(x({generationOptions:y.generationOptions})):p.post(`/preferences/generation-options/reset`).then(e=>e.data),setEmbeddingSettings:e=>i()?f(x({embeddingSettings:e})):p.put(`/preferences/embedding-settings`,e).then(e=>e.data),resetEmbeddingSettings:()=>i()?f(x({embeddingSettings:y.embeddingSettings})):p.post(`/preferences/embedding-settings/reset`).then(e=>e.data),importData:(e,t=`replace`)=>i()?f({theme:{mode:`dark`,adaptToAccent:!1,accent:`blue`,customAccent:`#2563eb`},defaultModel:`llama3.2`,systemMessage:`You are a helpful assistant.`,generationOptions:{},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.7},showUsername:!1,workRemoteProviderDisclosureDismissed:!1}):p.post(`/preferences/import`,{data:e,mergeStrategy:t}).then(e=>e.data)},se=new Set([`snapshot`,`run_state`,`reasoning_delta`,`assistant_delta`,`tool_call`,`tool_result`,`usage`,`skill_loaded`,`error`,`done`]),q=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:void 0,ce=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t;let n=Date.parse(e);if(Number.isFinite(n))return n}return Date.now()},J=(e,t,n,r,i)=>{let a=q(e);if(!a)return;let o=Number(a.id??t),s=String(a.type??n??``),c=String(a.taskId??r),l=String(a.runId??i);if(!Number.isSafeInteger(o)||o<0||!se.has(s)||c!==r||l!==i)return;let u=a.data;return{id:o,type:s,taskId:c,runId:l,timestamp:ce(a.timestamp),data:q(u)||(u===void 0?{}:{content:u})}},Y=(e,t,n)=>{let r,i,a=[];for(let t of e.split(`
|
|
16
|
+
`)){if(!t||t.startsWith(`:`))continue;let e=t.indexOf(`:`),n=e===-1?t:t.slice(0,e),o=e===-1?``:t.slice(e+1),s=o.startsWith(` `)?o.slice(1):o;n===`id`&&(r=s),n===`event`&&(i=s),n===`data`&&a.push(s)}if(a.length===0)return;let o=a.join(`
|
|
17
|
+
`);if(o===`[DONE]`)return J({id:r,type:`done`,taskId:t,runId:n,timestamp:Date.now(),data:{}},r,i,t,n);try{return J(JSON.parse(o),r,i,t,n)}catch{return}},le=class{constructor(e,t,r){n(this,`taskId`,void 0),n(this,`runId`,void 0),n(this,`onEvent`,void 0),n(this,`buffer`,``),this.taskId=e,this.runId=t,this.onEvent=r}push(e){e&&(this.buffer+=e,this.drain())}finish(e=``){if(this.buffer+=e,this.drain(),!this.buffer.trim()){this.buffer=``;return}let t=Y(this.buffer.replace(/\r\n?/g,`
|
|
18
|
+
`),this.taskId,this.runId);this.buffer=``,t&&this.onEvent(t)}drain(){let e=/\r?\n\r?\n/.exec(this.buffer);for(;e?.index!==void 0;){let t=this.buffer.slice(0,e.index).replace(/\r\n?/g,`
|
|
19
|
+
`);this.buffer=this.buffer.slice(e.index+e[0].length);let n=Y(t,this.taskId,this.runId);n&&this.onEvent(n),e=/\r?\n\r?\n/.exec(this.buffer)}}},X=async e=>{try{let t=await e.json(),n=typeof t.error==`string`?t.error:typeof t.message==`string`?t.message:void 0;if(n)return Error(n)}catch{}return Error(`Work event stream failed with status ${e.status}.`)},ue=async({taskId:e,runId:t,after:n,signal:r,onEvent:i})=>{let a=localStorage.getItem(`auth-token`),o=new URL(`${c}/work/tasks/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/events`,window.location.origin);o.searchParams.set(`after`,String(Math.max(0,Math.trunc(n))));let s=await fetch(o,{method:`GET`,headers:{Accept:`text/event-stream`,...a?{Authorization:`Bearer ${a}`}:{}},cache:`no-store`,credentials:`same-origin`,signal:r});if(!s.ok)throw await X(s);if(!s.body)throw Error(`Work event stream has no response body.`);let l=s.body.getReader(),u=new TextDecoder,d=new le(e,t,i);try{for(;!r.aborted;){let{done:e,value:t}=await l.read();if(e)break;d.push(u.decode(t,{stream:!0}))}d.finish(u.decode())}finally{l.releaseLock()}},Z=e=>`/work/tasks/${encodeURIComponent(e)}`,de={capabilities:()=>p.get(`/work/capabilities`).then(e=>e.data),listTasks:()=>p.get(`/work/tasks`).then(e=>e.data),createTask:e=>p.post(`/work/tasks`,e).then(e=>e.data),getTask:e=>p.get(Z(e)).then(e=>e.data),getMessages:(e,t,n=200)=>p.get(`${Z(e)}/messages`,{params:{before:t,limit:n}}).then(e=>e.data),updateTask:(e,t)=>p.patch(Z(e),t).then(e=>e.data),deleteTask:e=>p.delete(Z(e)).then(e=>e.data),startRun:(e,t)=>p.post(`${Z(e)}/runs`,t).then(e=>e.data),cancelRun:e=>p.post(`${Z(e)}/cancel`).then(e=>e.data),streamRunEvents:e=>ue(e),listFiles:(e,t=``)=>p.get(`${Z(e)}/files`,{params:{path:t}}).then(e=>{let t=e.data;return t.data&&!Array.isArray(t.data)?{...t,data:t.data.entries}:t}),getFile:(e,t)=>p.get(`${Z(e)}/file`,{params:{path:t}}).then(e=>e.data),saveFile:(e,t,n,r)=>p.put(`${Z(e)}/file`,{content:n,expectedUpdatedAt:r},{params:{path:t}}).then(e=>e.data),startPreview:(e,t)=>p.post(`${Z(e)}/preview/start`,t?{command:t}:{}).then(e=>e.data),stopPreview:e=>p.post(`${Z(e)}/preview/stop`).then(e=>e.data)};function Q(e,t,n){if(t)return e.find(e=>e.model===t&&(!n||e.plugin===n))}function fe(e,t,n){return Q(e,t,n)||e[0]}function pe(e){return`${encodeURIComponent(e.plugin)}::${encodeURIComponent(e.model)}`}var $={getModels:()=>i()?f([{model:`tts-1`,plugin:`openai`,config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096}}]):p.get(`/tts/models`).then(e=>e.data),getPlugins:()=>i()?f([{id:`openai`,name:`OpenAI GPT`,models:[`tts-1`,`tts-1-hd`],config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`}}]):p.get(`/tts/plugins`).then(e=>e.data),getVoices:e=>i()?f({voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096,supports_streaming:!1}):p.get(`/tts/voices/${e}`).then(e=>e.data),generateBase64:e=>{if(i())return f({audio:``,format:e.response_format||`mp3`,mimeType:`audio/mpeg`,size:0});let t={...e,pluginId:e.pluginId||void 0};return p.post(`/tts/generate-base64`,t).then(e=>e.data)},generate:async e=>{if(i())return new Blob([],{type:`audio/mpeg`});let t={...e,pluginId:e.pluginId||void 0};return(await p.post(`/tts/generate`,t,{responseType:`blob`})).data},speak:async(e,t={})=>{try{t.onStart?.();let n=await $.generateBase64({model:t.model||`tts-1`,pluginId:t.pluginId,input:e,voice:t.voice,speed:t.speed,response_format:t.responseFormat});if(!n.success||!n.data?.audio)throw Error(n.message||`Failed to generate speech`);let r=`data:${n.data.mimeType};base64,${n.data.audio}`,i=new Audio(r);return i.onended=()=>t.onEnd?.(),i.onerror=()=>t.onError?.(Error(`Audio playback failed`)),await i.play(),i}catch(e){let n=e instanceof Error?e:Error(`Unknown error`);return t.onError?.(n),null}}},me=e({personaApi:()=>W,preferencesApi:()=>K});export{C,ee as D,h as E,c as O,T as S,S as T,A as _,$ as a,ie as b,G as c,U as d,I as f,ae as g,k as h,fe as i,W as l,N as m,Q as n,de as o,F as p,pe as r,K as s,me as t,H as u,oe as v,w,M as x,j as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{at as a}from"../assets/index-CKV9Lnj8.js";var o,s,c,l,u,d,f,p,m=Object.defineProperty,h=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},g={};h(g,{languages:()=>um,options:()=>cm,printers:()=>lm});var ee=[{name:`JavaScript`,type:`programming`,aceMode:`javascript`,extensions:`.js,._js,.bones,.cjs,.es,.es6,.gs,.jake,.javascript,.jsb,.jscad,.jsfl,.jslib,.jsm,.jspre,.jss,.mjs,.njs,.pac,.sjs,.ssjs,.xsjs,.xsjslib,.start.frag,.end.frag,.wxs`.split(`,`),filenames:[`Jakefile`,`start.frag`,`end.frag`],tmScope:`source.js`,aliases:[`js`,`node`],codemirrorMode:`javascript`,codemirrorMimeType:`text/javascript`,interpreters:[`bun`,`chakra`,`d8`,`deno`,`gjs`,`js`,`node`,`nodejs`,`qjs`,`rhino`,`v8`,`v8-shell`,`zx`],parsers:[`babel`,`acorn`,`espree`,`meriyah`,`babel-flow`,`babel-ts`,`flow`,`typescript`],vscodeLanguageIds:[`javascript`,`mongo`],linguistLanguageId:183},{name:`Flow`,type:`programming`,aceMode:`javascript`,extensions:[`.js.flow`],filenames:[],tmScope:`source.js`,aliases:[],codemirrorMode:`javascript`,codemirrorMimeType:`text/javascript`,interpreters:[`bun`,`chakra`,`d8`,`deno`,`gjs`,`js`,`node`,`nodejs`,`qjs`,`rhino`,`v8`,`v8-shell`],parsers:[`flow`,`babel-flow`],vscodeLanguageIds:[`javascript`],linguistLanguageId:183},{name:`JSX`,type:`programming`,aceMode:`javascript`,extensions:[`.jsx`],filenames:void 0,tmScope:`source.js.jsx`,aliases:void 0,codemirrorMode:`jsx`,codemirrorMimeType:`text/jsx`,interpreters:void 0,parsers:[`babel`,`babel-flow`,`babel-ts`,`flow`,`typescript`,`espree`,`meriyah`],vscodeLanguageIds:[`javascriptreact`],group:`JavaScript`,linguistLanguageId:183},{name:`TypeScript`,type:`programming`,aceMode:`typescript`,extensions:[`.ts`,`.cts`,`.mts`],tmScope:`source.ts`,aliases:[`ts`],codemirrorMode:`javascript`,codemirrorMimeType:`application/typescript`,interpreters:[`bun`,`deno`,`ts-node`,`tsx`],parsers:[`typescript`,`babel-ts`],vscodeLanguageIds:[`typescript`],linguistLanguageId:378},{name:`TSX`,type:`programming`,aceMode:`tsx`,extensions:[`.tsx`],tmScope:`source.tsx`,aliases:[`typescriptreact`],codemirrorMode:`jsx`,codemirrorMimeType:`text/typescript-jsx`,group:`TypeScript`,parsers:[`typescript`,`babel-ts`],vscodeLanguageIds:[`typescriptreact`],linguistLanguageId:94901924}],_={};h(_,{estree:()=>Xp});function te(e){return Array.isArray(e)&&e.length>0}var v=te,y=()=>{};function b(e){let t=new Set(e);return e=>t.has(e?.type)}var ne=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i);function re(e){return this[e<0?this.length+e:e]}var x=ne(`at`,function(){if(Array.isArray(this)||typeof this==`string`)return re});function S(e,t,n){if(!e.has(t)){let r=n(t);e.set(t,r)}return e.get(t)}function ie(e){let t=[];return e.this&&t.push(e.this),t.push(...e.params),e.rest&&t.push(e.rest),t}var ae=new WeakMap;function C(e){return S(ae,e,ie)}function oe(e,t){let{node:n}=e,r=0,i=()=>t(e,r++);n.this&&e.call(i,`this`),e.each(i,`params`),n.rest&&e.call(i,`rest`)}function se(e){return e.rest?!0:x(0,C(e),-1)?.type===`RestElement`}var ce=e=>e?.type===`TSAsExpression`&&e.typeAnnotation.type===`TSTypeReference`&&e.typeAnnotation.typeName.type===`Identifier`&&e.typeAnnotation.typeName.name===`const`;function le({node:e,parent:t}){return e?.type===`EmptyStatement`?t.type===`IfStatement`?t.consequent===e||t.alternate===e:t.type===`DoWhileStatement`||t.type===`ForInStatement`||t.type===`ForOfStatement`||t.type===`ForStatement`||t.type===`LabeledStatement`||t.type===`WithStatement`||t.type===`WhileStatement`?t.body===e:!1:!1}function ue(e){return e.method&&e.kind===`init`||e.kind===`get`||e.kind===`set`}var de=e=>Number.isSafeInteger(e)&&e>=0;function fe(e){return e.range?.[1]??e.end}function w(e){let t=e.range?.[0]??e.start,n=(e.declaration?.decorators??e.decorators)?.[0];return n?Math.min(w(n),t):t}var pe=5,me=8,he=8,ge=e=>t=>t.label?T(t.label):w(t)+e,_e=e=>e.__contentEnd??fe(e),ve=[`ExpressionStatement`,`Directive`,`ImportDeclaration`,`ExportDefaultDeclaration`,`ExportNamedDeclaration`,`ExportAllDeclaration`,`ReturnStatement`,`ThrowStatement`,`DoWhileStatement`],ye=new Map([[`BreakStatement`,ge(pe)],[`ContinueStatement`,ge(me)],[`DebuggerStatement`,e=>w(e)+he],[`VariableDeclaration`,e=>T(x(0,e.declarations,-1))],...ve.map(e=>[e,_e])]),be=b(ve),xe=e=>{if(be(e)&&e.__contentEnd)return!0;let{type:t}=e;return t===`BreakStatement`||t===`ContinueStatement`||t===`DebuggerStatement`||t===`VariableDeclaration`?!0:t===`IfStatement`?xe(e.alternate??e.consequent):t===`ForInStatement`||t===`ForOfStatement`||t===`ForStatement`||t===`LabeledStatement`||t===`WithStatement`||t===`WhileStatement`?xe(e.body):!1};function T(e){let{type:t}=e;return t===`IfStatement`?T(e.alternate??e.consequent):t===`ForInStatement`||t===`ForOfStatement`||t===`ForStatement`||t===`LabeledStatement`||t===`WithStatement`||t===`WhileStatement`?T(e.body):ye.get(t)?.(e)??fe(e)}function Se(e,t){let n=w(e);return de(n)&&n===w(t)}function Ce(e,t){let n=T(e);return de(n)&&n===T(t)}function we(e,t){return Se(e,t)&&Ce(e,t)}function Te(e){return e.extra?.raw??e.raw}function Ee(e){return e.type===`BigIntLiteral`||e.type===`Literal`&&!!e.bigint}function De(e){return e.type===`BooleanLiteral`||e.type===`Literal`&&typeof e.value==`boolean`}function Oe(e){return e.type===`NumericLiteral`||e.type===`Literal`&&typeof e.value==`number`}function ke(e){return e.type===`RegExpLiteral`||e.type===`Literal`&&!!e.regex}function E(e){return e?.type===`StringLiteral`||e?.type===`Literal`&&typeof e.value==`string`}var Ae=b([`TSAsExpression`,`TSSatisfiesExpression`,`AsExpression`,`AsConstExpression`,`SatisfiesExpression`]),je=b([`SatisfiesExpression`,`TSSatisfiesExpression`]),Me=b([`TSUnionType`,`UnionTypeAnnotation`]),Ne=b([`TSIntersectionType`,`IntersectionTypeAnnotation`]),Pe=b([`TupleTypeAnnotation`,`TSTupleType`]),Fe=b([`TSConditionalType`,`ConditionalTypeAnnotation`]),Ie=b([`TSTypeAliasDeclaration`,`TypeAlias`]),Le=b([`ReturnStatement`,`ThrowStatement`]),Re=b([`ExportDefaultDeclaration`,`DeclareExportDeclaration`,`ExportNamedDeclaration`,`ExportAllDeclaration`,`DeclareExportAllDeclaration`]),D=b([`ArrayExpression`]),ze=b([`ObjectExpression`]),Be=b([`Literal`,`BooleanLiteral`,`BigIntLiteral`,`DirectiveLiteral`,`NullLiteral`,`NumericLiteral`,`RegExpLiteral`,`StringLiteral`]),Ve=b([`ObjectTypeAnnotation`,`TSTypeLiteral`,`TSMappedType`]),He=b([`FunctionExpression`,`ArrowFunctionExpression`]),O=b([`JSXElement`,`JSXFragment`]),Ue=b([`BinaryExpression`,`LogicalExpression`,`NGPipeExpression`]),k=b([`CallExpression`,`OptionalCallExpression`]),A=b([`MemberExpression`,`OptionalMemberExpression`]),We=b([`CallExpression`,`OptionalCallExpression`,`NewExpression`]),Ge=b([`CallExpression`,`OptionalCallExpression`,`NewExpression`,`ImportExpression`]),Ke=b([`ChainExpression`,`TSNonNullExpression`]),qe=b([`TSArrayType`,`ArrayTypeAnnotation`]),Je=b([`TSTypeParameterInstantiation`,`TypeParameterInstantiation`]);function Ye(e){if(e.type!==`ImportSpecifier`&&e.type!==`ExportSpecifier`)return!1;let{local:t,[e.type===`ImportSpecifier`?`imported`:`exported`]:n}=e;return t.type!==n.type||!we(t,n)?!1:E(t)?t.value===n.value&&Te(t)===Te(n):t.type===`Identifier`?t.name===n.name:!1}var Xe=b([`File`,`TemplateElement`,`TSEmptyBodyFunctionExpression`,`ChainExpression`]),Ze=(e,[t])=>t?.type===`ComponentParameter`&&t.shorthand&&t.name===e&&t.local!==t.name||t?.type===`MatchObjectPatternProperty`&&t.shorthand&&t.key===e||t?.type===`ObjectProperty`&&t.shorthand&&t.key===e&&t.value!==t.key||t?.type===`Property`&&t.shorthand&&t.key===e&&!ue(t)&&t.value!==t.key||t?.type===`ImportSpecifier`&&Ye(t)&&t.imported===e&&t.imported!==t.local||t?.type===`ExportSpecifier`&&Ye(t)&&t.local===e&&t.local!==t.exported,Qe=(e,[t])=>!!(e.type===`FunctionExpression`&&t.type===`MethodDefinition`&&t.value===e&&C(e).length===0&&!e.returnType&&!v(e.typeParameters)&&e.body),$e=(e,[t])=>t?.typeAnnotation===e&&ce(t),et=(e,[t,...n])=>$e(e,[t])||t?.typeName===e&&$e(t,n);function tt(e,t){return Xe(e)||Ze(e,t)||Qe(e,t)?!1:e.type===`EmptyStatement`?le({node:e,parent:t[0]}):!(et(e,t)||e.type===`TSTypeAnnotation`&&t[0].type===`TSPropertySignature`)}var nt=tt;function rt(e){let t=e.type||e.kind||`(unknown type)`,n=String(e.name||e.id&&(typeof e.id==`object`?e.id.name:e.id)||e.key&&(typeof e.key==`object`?e.key.name:e.key)||e.value&&(typeof e.value==`object`?``:String(e.value))||e.operator||``);return n.length>20&&(n=n.slice(0,19)+`…`),t+(n?` `+n:``)}function it(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=rt(e)}function j(e,t){t.leading=!0,t.trailing=!1,it(e,t)}function at(e,t,n){t.leading=!1,t.trailing=!1,n&&(t.marker=n),it(e,t)}function M(e,t){t.leading=!1,t.trailing=!0,it(e,t)}function ot(e){return(t,n,r)=>{if(n===!1)return!1;let i=!!r?.backwards,{length:a}=t,o=n;for(;o>=0&&o<a;){let n=t.charAt(o);if(e instanceof RegExp){if(!e.test(n))return o}else if(!e.includes(n))return o;i?o--:o++}return o===-1||o===a?o:!1}}var st=ot(` `),ct=ot(`,; `),lt=ot(/[^\n\r]/);function ut(e,t){if(t===!1)return!1;if(e.charAt(t)===`/`&&e.charAt(t+1)===`*`){for(let n=t+2;n<e.length;++n)if(e.charAt(n)===`*`&&e.charAt(n+1)===`/`)return n+2}return t}var dt=ut,ft=e=>e===`
|
|
2
2
|
`||e===`\r`||e===`\u2028`||e===`\u2029`;function pt(e,t,n){if(t===!1)return!1;let r=!!n?.backwards,i=e.charAt(t);if(r){if(e.charAt(t-1)===`\r`&&i===`
|
|
3
3
|
`)return t-2;if(ft(i))return t-1}else{if(i===`\r`&&e.charAt(t+1)===`
|
|
4
4
|
`)return t+2;if(ft(i))return t+1}return t}var mt=pt;function ht(e,t){return t===!1?!1:e.charAt(t)===`/`&&e.charAt(t+1)===`/`?lt(e,t):t}var gt=ht;function _t(e,t){let n=null,r=t;for(;r!==n;)n=r,r=st(e,r),r=dt(e,r),r=gt(e,r),r=mt(e,r);return r}var vt=_t;function yt(e,t){let n=vt(e,t);return n===!1?``:e.charAt(n)}var bt=yt;function xt(e,t,n={}){let r=st(e,n.backwards?t-1:t,n);return r!==mt(e,r,n)}var N=xt;function St(e,t,n){for(let r=t;r<n;++r)if(e.charAt(r)===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{at as a}from"../assets/index-CKV9Lnj8.js";var o,s,c=Object.defineProperty,l=e=>{throw TypeError(e)},u=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},f=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),p=(e,t,n)=>t.has(e)||l(`Cannot `+n),m=(e,t,n)=>(p(e,t,`read from private field`),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?l(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),te={};d(te,{languages:()=>lo,options:()=>po,parsers:()=>mo,printers:()=>as});var ne=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i),re=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},h=ne(`replaceAll`,function(){if(typeof this==`string`)return re});function ie(e){return this[e<0?this.length+e:e]}var g=ne(`at`,function(){if(Array.isArray(this)||typeof this==`string`)return ie}),ae=()=>{},oe=`string`,se=`array`,ce=`cursor`,le=`indent`,ue=`align`,de=`trim`,fe=`group`,pe=`fill`,me=`if-break`,he=`indent-if-break`,ge=`line-suffix`,_e=`line-suffix-boundary`,_=`line`,ve=`label`,ye=`break-parent`,be=new Set([ce,le,ue,de,fe,pe,me,he,ge,_e,_,ve,ye]);function xe(e,t,n){if(!e.has(t)){let r=n(t);e.set(t,r)}return e.get(t)}function Se(e){if(typeof e==`string`)return oe;if(Array.isArray(e))return se;if(!e)return;let{type:t}=e;if(be.has(t))return t}var Ce=Se,we=e=>new Intl.ListFormat(`en-US`,{type:`disjunction`}).format(e);function Te(e){let t=e===null?`null`:typeof e;if(t!==`string`&&t!==`object`)return`Unexpected doc '${t}',
|
|
2
2
|
Expected it to be 'string' or 'object'.`;if(Ce(e))throw Error(`doc is valid.`);let n=Object.prototype.toString.call(e);if(n!==`[object Object]`)return`Unexpected doc '${n}'.`;let r=we([...be].map(e=>`'${e}'`));return`Unexpected doc.type '${e.type}'.
|
|
3
3
|
Expected it to be ${r}.`}var Ee=class extends Error{constructor(e){((...e)=>(super(...e),i(this,`name`,`InvalidDocError`),this))(Te(e)),this.doc=e}};function De(e,t){if(typeof e==`string`)return t(e);let n=new Map;return r(e);function r(e){return xe(n,e,i)}function i(e){switch(Ce(e)){case se:return t(e.map(r));case pe:return t({...e,parts:e.parts.map(r)});case me:return t({...e,breakContents:r(e.breakContents),flatContents:r(e.flatContents)});case fe:{let{expandedStates:n,contents:i}=e;return n?(n=n.map(r),i=n[0]):i=r(i),t({...e,contents:i,expandedStates:n})}case ue:case le:case he:case ve:case ge:return t({...e,contents:r(e.contents)});case oe:case ce:case de:case _e:case _:case ye:return t(e);default:throw new Ee(e)}}}function v(e,t=Le){return De(e,e=>typeof e==`string`?S(t,e.split(`
|
|
4
4
|
`)):e)}var y=ae,Oe=ae,ke=ae,Ae=ae;function b(e){return y(e),{type:le,contents:e}}function je(e,t){return Ae(e),y(t),{type:ue,contents:t,n:e}}function Me(e){return je(-1/0,e)}var Ne={type:ye};function Pe(e){return ke(e),{type:pe,parts:e}}function x(e,t={}){return y(e),Oe(t.expandedStates,!0),{type:fe,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function Fe(e,t=``,n={}){return y(e),t!==``&&y(t),{type:me,breakContents:e,flatContents:t,groupId:n.groupId}}function Ie(e,t){return y(e),{type:he,contents:e,groupId:t.groupId,negate:t.negate}}function S(e,t){y(e),Oe(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}var C={type:_},w={type:_,soft:!0},T=[{type:_,hard:!0},Ne],Le=[{type:_,hard:!0,literal:!0},Ne],Re=Object.freeze({character:`'`,codePoint:39}),ze=Object.freeze({character:`"`,codePoint:34}),Be=Object.freeze({preferred:Re,alternate:ze}),Ve=Object.freeze({preferred:ze,alternate:Re});function He(e,t){let{preferred:n,alternate:r}=t===!0||t===`'`?Be:Ve,{length:i}=e,a=0,o=0;for(let t=0;t<i;t++){let i=e.charCodeAt(t);i===n.codePoint?a++:i===r.codePoint&&o++}return(a>o?r:n).character}function Ue(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}var We=(o=new WeakMap,s=new WeakSet,class{constructor(t){a(this,s),e(this,o,void 0),r(o,this,new Set(t))}getLeadingWhitespaceCount(e){let t=n(o,this),r=0;for(let n=0;n<e.length&&t.has(e.charAt(n));n++)r++;return r}getTrailingWhitespaceCount(e){let t=n(o,this),r=0;for(let n=e.length-1;n>=0&&t.has(e.charAt(n));n--)r++;return r}getLeadingWhitespace(e){let t=this.getLeadingWhitespaceCount(e);return e.slice(0,t)}getTrailingWhitespace(e){let t=this.getTrailingWhitespaceCount(e);return e.slice(e.length-t)}hasLeadingWhitespace(e){return n(o,this).has(e.charAt(0))}hasTrailingWhitespace(e){return n(o,this).has(g(0,e,-1))}trimStart(e){let t=this.getLeadingWhitespaceCount(e);return e.slice(t)}trimEnd(e){let t=this.getTrailingWhitespaceCount(e);return e.slice(0,e.length-t)}trim(e){return this.trimEnd(this.trimStart(e))}split(e,t=!1){let r=`[${Ue([...n(o,this)].join(``))}]+`,i=new RegExp(t?`(${r})`:r);return e.split(i)}hasWhitespaceCharacter(e){let t=n(o,this);return Array.prototype.some.call(e,e=>t.has(e))}hasNonWhitespaceCharacter(e){let t=n(o,this);return Array.prototype.some.call(e,e=>!t.has(e))}isWhitespaceOnly(e){let t=n(o,this);return Array.prototype.every.call(e,e=>t.has(e))}dedentString(e){let n=t(s,this,Ge).call(this,e);return n===0?e:e.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{at as a}from"../assets/index-CKV9Lnj8.js";var o,s,c,l,u,d,f,p,m=Object.create,h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,b=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},x=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},S=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of _(t))!y.call(e,i)&&i!==n&&h(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e},C=(e,t,n)=>(n=e==null?{}:m(v(e)),S(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),w=b((e,t)=>{t.exports=m;var n=9,r=10,i=32,a=33,o=58,s=91,c=92,l=93,u=94,d=96,f=4,p=1024;function m(e){var t=this.Parser,n=this.Compiler;h(t)&&_(t,e),g(n)&&v(n)}function h(e){return!!(e&&e.prototype&&e.prototype.blockTokenizers)}function g(e){return!!(e&&e.prototype&&e.prototype.visitors)}function _(e,t){for(var m=t||{},h=e.prototype,g=h.blockTokenizers,_=h.inlineTokenizers,v=h.blockMethods,x=h.inlineMethods,S=g.definition,C=_.reference,w=[],T=-1,E=v.length,D;++T<E;)D=v[T],!(D===`newline`||D===`indentedCode`||D===`paragraph`||D===`footnoteDefinition`)&&w.push([D]);w.push([`footnoteDefinition`]),m.inlineNotes&&(y(x,`reference`,`inlineNote`),_.inlineNote=A),y(v,`definition`,`footnoteDefinition`),y(x,`reference`,`footnoteCall`),g.definition=M,g.footnoteDefinition=O,_.footnoteCall=k,_.reference=j,h.interruptFootnoteDefinition=w,j.locator=C.locator,k.locator=N,A.locator=P;function O(e,t,a){for(var c=this,d=c.interruptFootnoteDefinition,m=c.offset,h=t.length+1,_=0,v=[],y,x,S,C,w,T,E,D,O,k,A,j,M;_<h&&(C=t.charCodeAt(_),!(C!==n&&C!==i));)_++;if(t.charCodeAt(_++)===s&&t.charCodeAt(_++)===u){for(x=_;_<h;){if(C=t.charCodeAt(_),C!==C||C===r||C===n||C===i)return;if(C===l){S=_,_++;break}_++}if(!(S===void 0||x===S||t.charCodeAt(_++)!==o)){if(a)return!0;for(y=t.slice(x,S),w=e.now(),O=0,k=0,A=_,j=[];_<h;){if(C=t.charCodeAt(_),C!==C||C===r)M={start:O,contentStart:A||_,contentEnd:_,end:_},j.push(M),C===r&&(O=_+1,k=0,A=void 0,M.end=O);else if(k!==void 0)if(C===i||C===n)k+=C===i?1:f-k%f,k>f&&(k=void 0,A=_);else{if(k<f&&M&&(M.contentStart===M.contentEnd||b(d,g,c,[e,t.slice(_,p),!0])))break;k=void 0,A=_}_++}for(_=-1,h=j.length;h>0&&(M=j[h-1],M.contentStart===M.contentEnd);)h--;for(T=e(t.slice(0,M.contentEnd));++_<h;)M=j[_],m[w.line+_]=(m[w.line+_]||0)+(M.contentStart-M.start),v.push(t.slice(M.contentStart,M.end));return E=c.enterBlock(),D=c.tokenizeBlock(v.join(``),w),E(),T({type:`footnoteDefinition`,identifier:y.toLowerCase(),label:y,children:D})}}}function k(e,t,a){var o=t.length+1,c=0,d,f,p,m;if(t.charCodeAt(c++)===s&&t.charCodeAt(c++)===u){for(f=c;c<o;){if(m=t.charCodeAt(c),m!==m||m===r||m===n||m===i)return;if(m===l){p=c,c++;break}c++}if(!(p===void 0||f===p))return a?!0:(d=t.slice(f,p),e(t.slice(0,c))({type:`footnoteReference`,identifier:d.toLowerCase(),label:d}))}}function A(e,t,n){var r=this,i=t.length+1,a=0,o=0,f,p,m,h,g,_,v;if(t.charCodeAt(a++)===u&&t.charCodeAt(a++)===s){for(m=a;a<i;){if(p=t.charCodeAt(a),p!==p)return;if(_===void 0)if(p===c)a+=2;else if(p===s)o++,a++;else if(p===l)if(o===0){h=a,a++;break}else o--,a++;else if(p===d){for(g=a,_=1;t.charCodeAt(g+_)===d;)_++;a+=_}else a++;else if(p===d){for(g=a,v=1;t.charCodeAt(g+v)===d;)v++;a+=v,_===v&&(_=void 0),v=void 0}else a++}if(h!==void 0)return n?!0:(f=e.now(),f.column+=2,f.offset+=2,e(t.slice(0,a))({type:`footnote`,children:r.tokenizeInline(t.slice(m,h),f)}))}}function j(e,t,n){var r=0;if(t.charCodeAt(r)===a&&r++,t.charCodeAt(r)===s&&t.charCodeAt(r+1)!==u)return C.call(this,e,t,n)}function M(e,t,r){for(var a=0,o=t.charCodeAt(a);o===i||o===n;)o=t.charCodeAt(++a);if(o===s&&t.charCodeAt(a+1)!==u)return S.call(this,e,t,r)}function N(e,t){return e.indexOf(`[`,t)}function P(e,t){return e.indexOf(`^[`,t)}}function v(e){var t=e.prototype.visitors,n=` `;t.footnote=r,t.footnoteReference=i,t.footnoteDefinition=a;function r(e){return`^[`+this.all(e).join(``)+`]`}function i(e){return`[^`+(e.label||e.identifier)+`]`}function a(e){for(var t=this.all(e).join(`
|
|
2
2
|
|
|
3
3
|
`).split(`
|
|
4
4
|
`),r=0,i=t.length,a;++r<i;)a=t[r],a!==``&&(t[r]=n+a);return`[^`+(e.label||e.identifier)+`]: `+t.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,p as i}from"./router-vendor-BjDI9mRe.js";import{at as a}from"../assets/index-CKV9Lnj8.js";var o,s,c,l,u,d,f,p=Object.defineProperty,m=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},h={};m(h,{__debug:()=>mo,check:()=>fo,doc:()=>Ea,format:()=>uo,formatWithCursor:()=>lo,getSupportInfo:()=>po,util:()=>ja,version:()=>Aa});var g=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i),_=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},v=g(`replaceAll`,function(){if(typeof this==`string`)return _}),ee=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},te=new class extends ee{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function ne(e,t,n){return te.diff(e,t,n)}var re=()=>{},ie=`cr`,ae=`crlf`,oe=`lf`,se=`\r`,ce=`\r
|
|
2
2
|
`,le=`
|
|
3
3
|
`,ue=le;function de(e){let t=e.indexOf(se);return t===-1?oe:e.charAt(t+1)===le?ae:ie}function fe(e){return e===ie?se:e===ae?ce:ue}var pe=new Map([[le,/\n/g],[se,/\r/g],[ce,/\r\n/g]]);function me(e,t){let n=pe.get(t);return e.match(n)?.length??0}var he=/\r\n?/g;function ge(e){return v(0,e,he,le)}var _e=Symbol.for(`comments`);function ve(e){return this[e<0?this.length+e:e]}var y=g(`at`,function(){if(Array.isArray(this)||typeof this==`string`)return ve}),b=`string`,x=`array`,S=`cursor`,C=`indent`,w=`align`,T=`trim`,E=`group`,D=`fill`,O=`if-break`,k=`indent-if-break`,A=`line-suffix`,j=`line-suffix-boundary`,M=`line`,N=`label`,P=`break-parent`,ye=new Set([S,C,w,T,E,D,O,k,A,j,M,N,P]);function be(e){let t=e.length;for(;t>0&&(e[t-1]===`\r`||e[t-1]===`
|
|
4
4
|
`);)t--;return t<e.length?e.slice(0,t):e}function xe(e,t,n){if(!e.has(t)){let r=n(t);e.set(t,r)}return e.get(t)}function Se(e){if(typeof e==`string`)return b;if(Array.isArray(e))return x;if(!e)return;let{type:t}=e;if(ye.has(t))return t}var F=Se,Ce=e=>new Intl.ListFormat(`en-US`,{type:`disjunction`}).format(e);function we(e){let t=e===null?`null`:typeof e;if(t!==`string`&&t!==`object`)return`Unexpected doc '${t}',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as e,p as t}from"./router-vendor-BjDI9mRe.js";import{
|
|
1
|
+
import{g as e,p as t}from"./router-vendor-BjDI9mRe.js";import{at as n}from"../assets/index-CKV9Lnj8.js";var r,i=Object.defineProperty,a=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},o={};a(o,{parsers:()=>s});var s={};a(s,{typescript:()=>Xm});var c=()=>()=>{},l=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i),u=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},d=l(`replaceAll`,function(){if(typeof this==`string`)return u}),f=`6.0`,p=[],m=new Map;function h(e){return e===void 0?0:e.length}function ee(e,t){if(e!==void 0)for(let n=0;n<e.length;n++){let r=t(e[n],n);if(r)return r}}function te(e,t){if(e!==void 0)for(let n=0;n<e.length;n++){let r=t(e[n],n);if(r!==void 0)return r}}function ne(e,t,n){let r=[];T.assertEqual(e.length,t.length);for(let i=0;i<e.length;i++)r.push(n(e[i],t[i],i));return r}function re(e,t){if(e!==void 0){for(let n=0;n<e.length;n++)if(!t(e[n],n))return!1}return!0}function g(e,t,n){if(e!==void 0)for(let r=n??0;r<e.length;r++){let n=e[r];if(t(n,r))return n}}function _(e,t,n){if(e===void 0)return-1;for(let r=n??0;r<e.length;r++)if(t(e[r],r))return r;return-1}function v(e,t,n=Ie){if(e!==void 0){for(let r=0;r<e.length;r++)if(n(e[r],t))return!0}return!1}function y(e,t){if(e!==void 0){let n=e.length,r=0;for(;r<n&&t(e[r]);)r++;if(r<n){let i=e.slice(0,r);for(r++;r<n;){let n=e[r];t(n)&&i.push(n),r++}return i}}return e}function b(e,t){let n;if(e!==void 0){n=[];for(let r=0;r<e.length;r++)n.push(t(e[r],r))}return n}function x(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];r&&(Oe(r)?S(t,r):t.push(r))}return t}function ie(e,t){let n;if(e!==void 0)for(let r=0;r<e.length;r++){let i=t(e[r],r);i&&(n=Oe(i)?S(n,i):ue(n,i))}return n??p}function ae(e,t){let n;if(e!==void 0)for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r);(n||i!==a||Oe(a))&&(n||(n=e.slice(0,r)),Oe(a)?S(n,a):n.push(a))}return n??e}function oe(e,t){let n=[];if(e!==void 0)for(let r=0;r<e.length;r++){let i=t(e[r],r);i!==void 0&&n.push(i)}return n}function se(e,t){if(e!==void 0)if(t!==void 0){for(let n=0;n<e.length;n++)if(t(e[n]))return!0}else return e.length>0;return!1}function ce(e,t){return t===void 0||t.length===0?e:e===void 0||e.length===0?t:[...e,...t]}function le(e,t,n=Ie){if(e===void 0||t===void 0)return e===t;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r],r))return!1;return!0}function ue(e,t){return t===void 0?e:e===void 0?[t]:(e.push(t),e)}function de(e,t){return t<0?e.length+t:t}function S(e,t,n,r){if(t===void 0||t.length===0)return e;if(e===void 0)return t.slice(n,r);n=n===void 0?0:de(t,n),r=r===void 0?t.length:de(t,r);for(let i=n;i<r&&i<t.length;i++)t[i]!==void 0&&e.push(t[i]);return e}function fe(e,t,n){return v(e,t,n)?!1:(e.push(t),!0)}function pe(e,t,n){return e===void 0?[t]:(fe(e,t,n),e)}function me(e,t){return e.length===0?p:e.slice().sort(t)}Array.prototype.at;function he(e){return e===void 0||e.length===0?void 0:e[0]}function ge(e){return e===void 0||e.length===0?void 0:e[e.length-1]}function _e(e){return T.assert(e.length!==0),e[e.length-1]}function ve(e){return e!==void 0&&e.length===1?e[0]:void 0}function ye(e,t,n,r,i){return be(e,n(t),n,r,i)}function be(e,t,n,r,i){if(!se(e))return-1;let a=i??0,o=e.length-1;for(;a<=o;){let i=a+(o-a>>1),s=n(e[i],i);switch(Math.sign(r(s,t))){case-1:a=i+1;break;case 0:return i;case 1:o=i-1;break}}return~a}function xe(e,t,n,r,i){if(e&&e.length>0){let a=e.length;if(a>0){let o=r===void 0||r<0?0:r,s=i===void 0||o+i>a-1?a-1:o+i,c;for(arguments.length<=2?(c=e[o],o++):c=n;o<=s;)c=t(c,e[o],o),o++;return c}}return n}var Se=Object.prototype.hasOwnProperty;function Ce(e,t){return Se.call(e,t)}function we(e){let t=[];for(let n in e)Se.call(e,n)&&t.push(n);return t}function Te(){let e=new Map;return e.add=Ee,e.remove=De,e}function Ee(e,t){let n=this.get(e);return n===void 0?this.set(e,n=[t]):n.push(t),n}function De(e,t){let n=this.get(e);n!==void 0&&(Ge(n,t),n.length||this.delete(e))}function Oe(e){return Array.isArray(e)}function ke(e){return Oe(e)?e:[e]}function C(e,t){return e!==void 0&&t(e)?e:void 0}function Ae(e,t){return e!==void 0&&t(e)?e:T.fail(`Invalid cast. The supplied value ${e} did not pass the test '${T.getFunctionName(t)}'.`)}function je(e){}function Me(){return!0}function Ne(e){return e}function Pe(e){let t;return()=>(e&&(t=e(),e=void 0),t)}function Fe(e){let t=new Map;return n=>{let r=`${typeof n}:${n}`,i=t.get(r);return i===void 0&&!t.has(r)&&(i=e(n),t.set(r,i)),i}}function Ie(e,t){return e===t}function Le(e,t){return e===t||e!==void 0&&t!==void 0&&e.toUpperCase()===t.toUpperCase()}function Re(e,t){return Ie(e,t)}function ze(e,t){return e===t?0:e===void 0?-1:t===void 0?1:e<t?-1:1}function w(e,t){return ze(e,t)}function Be(e,t,n){for(let r=0;r<e.length;r++)t=Math.max(t,n(e[r]));return t}function Ve(e,t,n){let r=Math.max(2,Math.floor(e.length*.34)),i=Math.floor(e.length*.4)+1,a;for(let o of t){let t=n(o);if(t!==void 0&&Math.abs(t.length-e.length)<=r){if(t===e||t.length<3&&t.toLowerCase()!==e.toLowerCase())continue;let n=He(e,t,i-.1);if(n===void 0)continue;T.assert(n<i),i=n,a=o}}return a}function He(e,t,n){let r=Array(t.length+1),i=Array(t.length+1),a=n+.01;for(let e=0;e<=t.length;e++)r[e]=e;for(let o=1;o<=e.length;o++){let s=e.charCodeAt(o-1),c=Math.ceil(o>n?o-n:1),l=Math.floor(t.length>n+o?n+o:t.length);i[0]=o;let u=o;for(let e=1;e<c;e++)i[e]=a;for(let n=c;n<=l;n++){let a=e[o-1].toLowerCase()===t[n-1].toLowerCase()?r[n-1]+.1:r[n-1]+2,c=s===t.charCodeAt(n-1)?r[n-1]:Math.min(r[n]+1,i[n-1]+1,a);i[n]=c,u=Math.min(u,c)}for(let e=l+1;e<=t.length;e++)i[e]=a;if(u>n)return;let d=r;r=i,i=d}let o=r[t.length];return o>n?void 0:o}function Ue(e,t,n){let r=e.length-t.length;return r>=0&&(n?Le(e.slice(r),t):e.indexOf(t,r)===r)}function We(e,t){e[t]=e[e.length-1],e.pop()}function Ge(e,t){return Ke(e,e=>e===t)}function Ke(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return We(e,n),!0;return!1}function qe(e,t,n){return n?Le(e.slice(0,t.length),t):e.lastIndexOf(t,0)===0}function Je(e){return e===void 0?void 0:[e]}var T;(e=>{let t=0;e.currentLogLevel=2,e.isDebugging=!1;function n(t){return e.currentLogLevel<=t}e.shouldLog=n;function r(t,r){e.loggingHost&&n(t)&&e.loggingHost.log(t,r)}function i(e){r(3,e)}e.log=i,(e=>{function t(e){r(1,e)}e.error=t;function n(e){r(2,e)}e.warn=n;function i(e){r(3,e)}e.log=i;function a(e){r(4,e)}e.trace=a})(i=e.log||(e.log={}));let a={};function o(){return t}e.getAssertionLevel=o;function s(n){let r=t;if(t=n,n>r)for(let t of we(a)){let r=a[t];r!==void 0&&e[t]!==r.assertion&&n>=r.level&&(e[t]=r,a[t]=void 0)}}e.setAssertionLevel=s;function c(e){return t>=e}e.shouldAssert=c;function l(t,n){return c(t)?!0:(a[n]={level:t,assertion:e[n]},e[n]=je,!1)}function u(e,t){let n=Error(e?`Debug Failure. ${e}`:`Debug Failure.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,t||u),n}e.fail=u;function d(e,t,n){return u(`${t||`Unexpected node.`}\r
|
|
2
2
|
Node ${he(e.kind)} was unexpected.`,n||d)}e.failBadSyntaxKind=d;function f(e,t,n,r){e||(t=t?`False expression: ${t}`:`False expression.`,n&&(t+=`\r
|
|
3
3
|
Verbose Debug Information: `+(typeof n==`string`?n:n())),u(t,r||f))}e.assert=f;function p(e,t,n,r,i){e!==t&&u(`Expected ${e} === ${t}. ${n?r?`${n} ${r}`:n:``}`,i||p)}e.assertEqual=p;function m(e,t,n,r){e>=t&&u(`Expected ${e} < ${t}. ${n||``}`,r||m)}e.assertLessThan=m;function h(e,t,n){e>t&&u(`Expected ${e} <= ${t}`,n||h)}e.assertLessThanOrEqual=h;function ee(e,t,n){e<t&&u(`Expected ${e} >= ${t}`,n||ee)}e.assertGreaterThanOrEqual=ee;function te(e,t,n){e??u(t,n||te)}e.assertIsDefined=te;function g(e,t,n){return te(e,t,n||g),e}e.checkDefined=g;function _(e,t,n){for(let r of e)te(r,t,n||_)}e.assertEachIsDefined=_;function v(e,t,n){return _(e,t,n||v),e}e.checkEachDefined=v;function y(e,t=`Illegal value:`,n){return u(`${t} ${typeof e==`object`&&Ce(e,`kind`)&&Ce(e,`pos`)?`SyntaxKind: `+he(e.kind):JSON.stringify(e)}`,n||y)}e.assertNever=y;function x(e,t,n,r){l(1,`assertEachNode`)&&f(t===void 0||re(e,t),n||`Unexpected node.`,()=>`Node array did not pass test '${ue(t)}'.`,r||x)}e.assertEachNode=x;function ie(e,t,n,r){l(1,`assertNode`)&&f(e!==void 0&&(t===void 0||t(e)),n||`Unexpected node.`,()=>`Node ${he(e?.kind)} did not pass test '${ue(t)}'.`,r||ie)}e.assertNode=ie;function ae(e,t,n,r){l(1,`assertNotNode`)&&f(e===void 0||t===void 0||!t(e),n||`Unexpected node.`,()=>`Node ${he(e.kind)} should not have passed test '${ue(t)}'.`,r||ae)}e.assertNotNode=ae;function oe(e,t,n,r){l(1,`assertOptionalNode`)&&f(t===void 0||e===void 0||t(e),n||`Unexpected node.`,()=>`Node ${he(e?.kind)} did not pass test '${ue(t)}'.`,r||oe)}e.assertOptionalNode=oe;function se(e,t,n,r){l(1,`assertOptionalToken`)&&f(t===void 0||e===void 0||e.kind===t,n||`Unexpected node.`,()=>`Node ${he(e?.kind)} was not a '${he(t)}' token.`,r||se)}e.assertOptionalToken=se;function ce(e,t,n){l(1,`assertMissingNode`)&&f(e===void 0,t||`Unexpected node.`,()=>`Node ${he(e.kind)} was unexpected'.`,n||ce)}e.assertMissingNode=ce;function le(e){}e.type=le;function ue(e){if(typeof e!=`function`)return``;if(Ce(e,`name`))return e.name;{let t=Function.prototype.toString.call(e),n=/^function\s+([\w$]+)\s*\(/.exec(t);return n?n[1]:``}}e.getFunctionName=ue;function de(e){return`{ name: ${Zn(e.escapedName)}; flags: ${Te(e.flags)}; declarations: ${b(e.declarations,e=>he(e.kind))} }`}e.formatSymbol=de;function S(e=0,t,n){let r=pe(t);if(e===0)return r.length>0&&r[0][0]===0?r[0][1]:`0`;if(n){let t=[],n=e;for(let[i,a]of r){if(i>e)break;i!==0&&i&e&&(t.push(a),n&=~i)}if(n===0)return t.join(`|`)}else for(let[t,n]of r)if(t===e)return n;return e.toString()}e.formatEnum=S;let fe=new Map;function pe(e){let t=fe.get(e);if(t)return t;let n=[];for(let t in e){let r=e[t];typeof r==`number`&&n.push([r,t])}let r=me(n,(e,t)=>w(e[0],t[0]));return fe.set(e,r),r}function he(e){return S(e,E,!1)}e.formatSyntaxKind=he;function ge(e){return S(e,lt,!1)}e.formatSnippetKind=ge;function _e(e){return S(e,it,!1)}e.formatScriptKind=_e;function ve(e){return S(e,D,!0)}e.formatNodeFlags=ve;function ye(e){return S(e,et,!0)}e.formatNodeCheckFlags=ye;function be(e){return S(e,Xe,!0)}e.formatModifierFlags=be;function xe(e){return S(e,ct,!0)}e.formatTransformFlags=xe;function Se(e){return S(e,ut,!0)}e.formatEmitFlags=Se;function Te(e){return S(e,$e,!0)}e.formatSymbolFlags=Te;function Ee(e){return S(e,tt,!0)}e.formatTypeFlags=Ee;function De(e){return S(e,rt,!0)}e.formatSignatureFlags=De;function Oe(e){return S(e,nt,!0)}e.formatObjectFlags=Oe;function ke(e){return S(e,Qe,!0)}e.formatFlowFlags=ke;function C(e){return S(e,Ze,!0)}e.formatRelationComparisonResult=C;function Ae(e){return S(e,CheckMode,!0)}e.formatCheckMode=Ae;function Me(e){return S(e,SignatureCheckMode,!0)}e.formatSignatureCheckMode=Me;function Ne(e){return S(e,TypeFacts,!0)}e.formatTypeFacts=Ne;let Pe=!1,Fe;function Ie(e){`__debugFlowFlags`in e||Object.defineProperties(e,{__tsDebuggerDisplay:{value(){let e=this.flags&2?`FlowStart`:this.flags&4?`FlowBranchLabel`:this.flags&8?`FlowLoopLabel`:this.flags&16?`FlowAssignment`:this.flags&32?`FlowTrueCondition`:this.flags&64?`FlowFalseCondition`:this.flags&128?`FlowSwitchClause`:this.flags&256?`FlowArrayMutation`:this.flags&512?`FlowCall`:this.flags&1024?`FlowReduceLabel`:this.flags&1?`FlowUnreachable`:`UnknownFlow`,t=this.flags&-2048;return`${e}${t?` (${ke(t)})`:``}`}},__debugFlowFlags:{get(){return S(this.flags,Qe,!0)}},__debugToString:{value(){return qe(this)}}})}function Le(e){return Pe&&(typeof Object.setPrototypeOf==`function`?(Fe||(Fe=Object.create(Object.prototype),Ie(Fe)),Object.setPrototypeOf(e,Fe)):Ie(e)),e}e.attachFlowNodeDebugInfo=Le;let Re;function ze(e){`__tsDebuggerDisplay`in e||Object.defineProperties(e,{__tsDebuggerDisplay:{value(e){return e=String(e).replace(/(?:,[\s\w]+:[^,]+)+\]$/,`]`),`NodeArray ${e}`}}})}function Ve(e){Pe&&(typeof Object.setPrototypeOf==`function`?(Re||(Re=Object.create(Array.prototype),ze(Re)),Object.setPrototypeOf(e,Re)):ze(e))}e.attachNodeArrayDebugInfo=Ve;function He(){if(Pe)return;let e=new WeakMap,t=new WeakMap;Object.defineProperties(So.getSymbolConstructor().prototype,{__tsDebuggerDisplay:{value(){let e=this.flags&33554432?`TransientSymbol`:`Symbol`,t=this.flags&-33554433;return`${e} '${er(this)}'${t?` (${Te(t)})`:``}`}},__debugFlags:{get(){return Te(this.flags)}}}),Object.defineProperties(So.getTypeConstructor().prototype,{__tsDebuggerDisplay:{value(){let e=this.flags&402431?`IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName?` (${this.debugIntrinsicName})`:``}`:this.flags&12?`NullableType`:this.flags&3072?`LiteralType ${JSON.stringify(this.value)}`:this.flags&4096?`LiteralType ${this.value.negative?`-`:``}${this.value.base10Value}n`:this.flags&16384?`UniqueESSymbolType`:this.flags&65536?`EnumType`:this.flags&134217728?`UnionType`:this.flags&268435456?`IntersectionType`:this.flags&2097152?`IndexType`:this.flags&33554432?`IndexedAccessType`:this.flags&67108864?`ConditionalType`:this.flags&16777216?`SubstitutionType`:this.flags&524288?`TypeParameter`:this.flags&1048576?this.objectFlags&3?`InterfaceType`:this.objectFlags&4?`TypeReference`:this.objectFlags&8?`TupleType`:this.objectFlags&16?`AnonymousType`:this.objectFlags&32?`MappedType`:this.objectFlags&1024?`ReverseMappedType`:this.objectFlags&256?`EvolvingArrayType`:`ObjectType`:`Type`,t=this.flags&1048576?this.objectFlags&-142607680:0;return`${e}${this.symbol?` '${er(this.symbol)}'`:``}${t?` (${Oe(t)})`:``}`}},__debugFlags:{get(){return Ee(this.flags)}},__debugObjectFlags:{get(){return this.flags&1048576?Oe(this.objectFlags):``}},__debugTypeToString:{value(){let t=e.get(this);return t===void 0&&(t=this.checker.typeToString(this),e.set(this,t)),t}}}),Object.defineProperties(So.getSignatureConstructor().prototype,{__debugFlags:{get(){return De(this.flags)}},__debugSignatureToString:{value(){return this.checker?.signatureToString(this)}}});let n=[So.getNodeConstructor(),So.getIdentifierConstructor(),So.getTokenConstructor(),So.getSourceFileConstructor()];for(let e of n)Ce(e.prototype,`__debugKind`)||Object.defineProperties(e.prototype,{__tsDebuggerDisplay:{value(){return`${Hr(this)?`GeneratedIdentifier`:V(this)?`Identifier '${Qn(this)}'`:Ms(this)?`PrivateIdentifier '${Qn(this)}'`:Ds(this)?`StringLiteral ${JSON.stringify(this.text.length<10?this.text:this.text.slice(10)+`...`)}`:Ts(this)?`NumericLiteral ${this.text}`:Es(this)?`BigIntLiteral ${this.text}n`:zs(this)?`TypeParameterDeclaration`:Bs(this)?`ParameterDeclaration`:Ks(this)?`ConstructorDeclaration`:qs(this)?`GetAccessorDeclaration`:Js(this)?`SetAccessorDeclaration`:Ys(this)?`CallSignatureDeclaration`:Xs(this)?`ConstructSignatureDeclaration`:Zs(this)?`IndexSignatureDeclaration`:Qs(this)?`TypePredicateNode`:$s(this)?`TypeReferenceNode`:ec(this)?`FunctionTypeNode`:tc(this)?`ConstructorTypeNode`:nc(this)?`TypeQueryNode`:rc(this)?`TypeLiteralNode`:ic(this)?`ArrayTypeNode`:ac(this)?`TupleTypeNode`:sc(this)?`OptionalTypeNode`:cc(this)?`RestTypeNode`:lc(this)?`UnionTypeNode`:uc(this)?`IntersectionTypeNode`:dc(this)?`ConditionalTypeNode`:fc(this)?`InferTypeNode`:pc(this)?`ParenthesizedTypeNode`:mc(this)?`ThisTypeNode`:hc(this)?`TypeOperatorNode`:gc(this)?`IndexedAccessTypeNode`:_c(this)?`MappedTypeNode`:vc(this)?`LiteralTypeNode`:oc(this)?`NamedTupleMember`:yc(this)?`ImportTypeNode`:he(this.kind)}${this.flags?` (${ve(this.flags)})`:``}`}},__debugKind:{get(){return he(this.kind)}},__debugNodeFlags:{get(){return ve(this.flags)}},__debugModifierFlags:{get(){return be(eo(this))}},__debugTransformFlags:{get(){return xe(this.transformFlags)}},__debugIsParseTreeNode:{get(){return Jn(this)}},__debugEmitFlags:{get(){return Se(Bi(this))}},__debugGetText:{value(e){if(Ra(this))return``;let n=t.get(this);if(n===void 0){let r=Yn(this),i=r&&Ni(r);n=i?Li(i,r,e):``,t.set(this,n)}return n}}});Pe=!0}e.enableDebugInfo=He;function Ue(e){let t=e&7,n=t===0?`in out`:t===3?`[bivariant]`:t===2?`in`:t===1?`out`:t===4?`[independent]`:``;return e&8?n+=` (unmeasurable)`:e&16&&(n+=` (unreliable)`),n}e.formatVariance=Ue;class We{__debugToString(){switch(this.kind){case 3:return this.debugInfo?.call(this)||`(function mapper)`;case 0:return`${this.source.__debugTypeToString()} -> ${this.target.__debugTypeToString()}`;case 1:return ne(this.sources,this.targets||b(this.sources,()=>`any`),(e,t)=>`${e.__debugTypeToString()} -> ${typeof t==`string`?t:t.__debugTypeToString()}`).join(`, `);case 2:return ne(this.sources,this.targets,(e,t)=>`${e.__debugTypeToString()} -> ${t().__debugTypeToString()}`).join(`, `);case 5:case 4:return`m1: ${this.mapper1.__debugToString().split(`
|
|
4
4
|
`).join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-GI9BPwrB.js";import{_ as r,g as i,h as a,m as o}from"./router-vendor-BjDI9mRe.js";import{_t as s,at as c,bt as l,ct as u,dt as d,ft as f,gt as p,ht as m,it as ee,lt as h,mt as g,pt as _,rt as v,ut as y,vt as b,xt as x,yt as S}from"../assets/index-CKV9Lnj8.js";var C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,te=(C=new WeakMap,w=new WeakMap,T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,k=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakSet,class extends d{constructor(e,t){super(),c(this,R),r(this,C,void 0),r(this,w,void 0),r(this,T,void 0),r(this,E,void 0),r(this,D,void 0),r(this,O,void 0),r(this,k,void 0),r(this,A,void 0),r(this,j,void 0),r(this,M,void 0),r(this,N,void 0),r(this,P,void 0),r(this,F,void 0),r(this,I,void 0),r(this,L,new Set),this.options=t,o(C,this,e),o(A,this,null),o(k,this,u()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(w,this).addObserver(this),q(a(w,this),this.options)?i(R,this,z).call(this):this.updateResult(),i(R,this,U).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(a(w,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(a(w,this),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,i(R,this,W).call(this),i(R,this,G).call(this),a(w,this).removeObserver(this)}setOptions(e){let t=this.options,n=a(w,this);if(this.options=a(C,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof p(this.options.enabled,a(w,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);i(R,this,K).call(this),a(w,this).setOptions(this.options),t._defaulted&&!b(this.options,t)&&a(C,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:a(w,this),observer:this});let r=this.hasListeners();r&&Y(a(w,this),n,this.options,t)&&i(R,this,z).call(this),this.updateResult(),r&&(a(w,this)!==n||p(this.options.enabled,a(w,this))!==p(t.enabled,a(w,this))||s(this.options.staleTime,a(w,this))!==s(t.staleTime,a(w,this)))&&i(R,this,B).call(this);let o=i(R,this,V).call(this);r&&(a(w,this)!==n||p(this.options.enabled,a(w,this))!==p(t.enabled,a(w,this))||o!==a(I,this))&&i(R,this,H).call(this,o)}getOptimisticResult(e){let t=a(C,this).getQueryCache().build(a(C,this),e),n=this.createResult(t,e);return ie(this,n)&&(o(E,this,n),o(O,this,this.options),o(D,this,a(w,this).state)),n}getCurrentResult(){return a(E,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&a(k,this).status===`pending`&&a(k,this).reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){a(L,this).add(e)}getCurrentQuery(){return a(w,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=a(C,this).defaultQueryOptions(e),n=a(C,this).getQueryCache().build(a(C,this),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return i(R,this,z).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(E,this)))}createResult(e,t){let n=a(w,this),r=this.options,i=a(E,this),s=a(D,this),c=a(O,this),l=e===n?a(T,this):e.state,{state:d}=e,f={...d},h=!1,g;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&q(e,t),o=i&&Y(e,n,t,r);(a||o)&&(f={...f,...ee(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:_,errorUpdatedAt:v,status:y}=f;g=f.data;let b=!1;if(t.placeholderData!==void 0&&g===void 0&&y===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=i.data,b=!0):e=typeof t.placeholderData==`function`?t.placeholderData(a(N,this)?.state.data,a(N,this)):t.placeholderData,e!==void 0&&(y=`success`,g=m(i?.data,e,t),h=!0)}if(t.select&&g!==void 0&&!b)if(i&&g===s?.data&&t.select===a(j,this))g=a(M,this);else try{o(j,this,t.select),g=t.select(g),g=m(i?.data,g,t),o(M,this,g),o(A,this,null)}catch(e){o(A,this,e)}a(A,this)&&(_=a(A,this),g=a(M,this),v=Date.now(),y=`error`);let x=f.fetchStatus===`fetching`,S=y===`pending`,C=y===`error`,P=S&&x,F=g!==void 0,I={status:y,fetchStatus:f.fetchStatus,isPending:S,isSuccess:y===`success`,isError:C,isInitialLoading:P,isLoading:P,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:C&&!F,isPaused:f.fetchStatus===`paused`,isPlaceholderData:h,isRefetchError:C&&F,isStale:X(e,t),refetch:this.refetch,promise:a(k,this),isEnabled:p(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=I.data!==void 0,r=I.status===`error`&&!t,i=e=>{r?e.reject(I.error):t&&e.resolve(I.data)},s=()=>{i(o(k,this,I.promise=u()))},c=a(k,this);switch(c.status){case`pending`:e.queryHash===n.queryHash&&i(c);break;case`fulfilled`:(r||I.data!==c.value)&&s();break;case`rejected`:(!r||I.error!==c.reason)&&s();break}}return I}updateResult(){let e=a(E,this),t=this.createResult(a(w,this),this.options);o(D,this,a(w,this).state),o(O,this,this.options),a(D,this).data!==void 0&&o(N,this,a(w,this)),!b(t,e)&&(o(E,this,t),i(R,this,ne).call(this,{listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!a(L,this).size)return!0;let r=new Set(n??a(L,this));return this.options.throwOnError&&r.add(`error`),Object.keys(a(E,this)).some(t=>{let n=t;return a(E,this)[n]!==e[n]&&r.has(n)})})()}))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&i(R,this,U).call(this)}});function z(e){i(R,this,K).call(this);let t=a(w,this).fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}function B(){i(R,this,W).call(this);let e=s(this.options.staleTime,a(w,this));if(f.isServer()||a(E,this).isStale||!_(e))return;let t=l(a(E,this).dataUpdatedAt,e)+1;o(P,this,x.setTimeout(()=>{a(E,this).isStale||this.updateResult()},t))}function V(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(a(w,this)):this.options.refetchInterval)??!1}function H(e){i(R,this,G).call(this),o(I,this,e),!(f.isServer()||p(this.options.enabled,a(w,this))===!1||!_(a(I,this))||a(I,this)===0)&&o(F,this,x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&i(R,this,z).call(this)},a(I,this)))}function U(){i(R,this,B).call(this),i(R,this,H).call(this,i(R,this,V).call(this))}function W(){a(P,this)!==void 0&&(x.clearTimeout(a(P,this)),o(P,this,void 0))}function G(){a(F,this)!==void 0&&(x.clearInterval(a(F,this)),o(F,this,void 0))}function K(){let e=a(C,this).getQueryCache().build(a(C,this),this.options);if(e===a(w,this))return;let t=a(w,this);o(w,this,e),o(T,this,e.state),this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}function ne(e){h.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(a(E,this))}),a(C,this).getQueryCache().notify({query:a(w,this),type:`observerResultsUpdated`})})}function re(e,t){return p(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&p(t.retryOnMount,e)===!1)}function q(e,t){return re(e,t)||e.state.data!==void 0&&J(e,t,t.refetchOnMount)}function J(e,t,n){if(p(t.enabled,e)!==!1&&s(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&X(e,t)}return!1}function Y(e,t,n,r){return(e!==t||p(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return p(t.enabled,e)!==!1&&e.isStaleByTime(s(t.staleTime,e))}function ie(e,t){return!b(e.getCurrentResult(),t)}var Z=e(n(),1);t();function ae(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oe=Z.createContext(ae()),se=()=>Z.useContext(oe),ce=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?S(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},le=e=>{Z.useEffect(()=>{e.clearReset()},[e])},ue=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||S(n,[e.error,r])),Q=Z.createContext(!1),de=()=>Z.useContext(Q);Q.Provider;var fe=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},pe=(e,t)=>e.isLoading&&e.isFetching&&!t,me=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function he(e,t,n){let r=de(),i=se(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,fe(o),ce(o,i,s),le(i);let l=!a.getQueryCache().get(o.queryHash),[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),p=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=p?u.subscribe(h.batchCalls(e)):g;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),me(o,d))throw $(o,u,i);if(ue({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f.isServer()&&pe(d,r)&&(l?$(o,u,i):s?.promise)?.catch(g).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}export{te as n,he as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./useBaseQuery-MuQj7vA5.js";function n(n,r){return t(n,e,r)}export{n as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libre-webui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Privacy-first AI chat interface. Self-hosted, open source, extensible.",
|
|
5
5
|
"main": "electron/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "npm run build:frontend && npm run build:backend",
|
|
29
29
|
"build:frontend": "cd frontend && npm run build",
|
|
30
30
|
"build:backend": "cd backend && npm run build",
|
|
31
|
-
"test:package": "node --test scripts/test-deprecated-dependencies.mjs && node --test scripts/test-helm-versioning.mjs && node --test scripts/test-tts-example-security.mjs && npm run test:unit --workspace=frontend && npm run build && node --test scripts/test-ollama-library.mjs && node --test scripts/test-chat-context.mjs && node --test scripts/test-tts-routing.mjs && node --test scripts/test-work-runtime.mjs && node --test scripts/test-work-provider.mjs && node --test scripts/test-work-agent-guidance.mjs && node --test scripts/test-work-agent-loop.mjs && node --test scripts/test-work-events.mjs && node --test scripts/test-package-layout.mjs && node --test scripts/test-release-notes.mjs && node --test scripts/test-release-status.mjs && node --test scripts/test-docker-layout.mjs && node --test scripts/test-electron-macos-signing.mjs && node --test scripts/test-homebrew-publishing.mjs && node --test scripts/test-forgejo-release-mirror.mjs",
|
|
31
|
+
"test:package": "node --test scripts/test-deprecated-dependencies.mjs && node --test scripts/test-helm-versioning.mjs && node --test scripts/test-tts-example-security.mjs && npm run test:unit --workspace=frontend && npm run build && node --test scripts/test-ollama-library.mjs && node --test scripts/test-chat-context.mjs && node --test scripts/test-chat-rest-responses.mjs && node --test scripts/test-plugin-endpoint-routing.mjs && node --test scripts/test-plugin-capability-routing.mjs && node --test scripts/test-chat-provider-selection.mjs && node --test scripts/test-provider-api-modes.mjs && node --test scripts/test-plugin-variable-overrides.mjs && node --test scripts/test-tts-routing.mjs && node --test scripts/test-image-generation-routing.mjs && node --test scripts/test-work-runtime.mjs && node --test scripts/test-work-provider.mjs && node --test scripts/test-work-agent-guidance.mjs && node --test scripts/test-work-agent-loop.mjs && node --test scripts/test-work-events.mjs && node --test scripts/test-package-layout.mjs && node --test scripts/test-release-notes.mjs && node --test scripts/test-release-status.mjs && node --test scripts/test-docker-layout.mjs && node --test scripts/test-electron-macos-signing.mjs && node --test scripts/test-pr-quality-gates.mjs && node --test scripts/test-homebrew-publishing.mjs && node --test scripts/test-forgejo-release-mirror.mjs",
|
|
32
32
|
"test:e2e": "npm run e2e --workspace=frontend",
|
|
33
33
|
"test:work": "npm run build:backend && node --test scripts/test-work-runtime.mjs && node --test scripts/test-work-provider.mjs && node --test scripts/test-work-agent-guidance.mjs && node --test scripts/test-work-agent-loop.mjs && node --test scripts/test-work-events.mjs",
|
|
34
34
|
"security:audit": "npm audit --audit-level=moderate",
|
package/plugins/github.json
CHANGED
|
@@ -50,8 +50,7 @@
|
|
|
50
50
|
"name": "endpoint",
|
|
51
51
|
"type": "string",
|
|
52
52
|
"label": "API Endpoint",
|
|
53
|
-
"description": "
|
|
54
|
-
"default": "https://models.inference.ai.azure.com/chat/completions"
|
|
53
|
+
"description": "Optional full endpoint override. Leave blank to use the bundled GitHub Models endpoint."
|
|
55
54
|
},
|
|
56
55
|
{
|
|
57
56
|
"name": "temperature",
|