nextclaw 0.27.3 → 0.27.5
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/package.json +16 -16
- package/ui-dist/assets/{app-presenter-provider-DcpcRgLn.js → app-presenter-provider-De7Zwitu.js} +14 -14
- package/ui-dist/assets/{appearance-settings-page-yJR6Kt9c.js → appearance-settings-page-BkQaPtQ-.js} +1 -1
- package/ui-dist/assets/{chat-page-CXYXMIQQ.js → chat-page-AvOuaxuv.js} +1 -1
- package/ui-dist/assets/{index-6Esxu-Pp.js → index-B5AoUrMf.js} +2 -2
- package/ui-dist/assets/index-QveCjxCj.css +1 -0
- package/ui-dist/assets/remote-B6TXClIg.js +1 -0
- package/ui-dist/assets/{runtime-config-page-CMLVC5UV.js → runtime-config-page-BLrTVO3n.js} +1 -1
- package/ui-dist/index.html +3 -3
- package/ui-dist/assets/index-BzSgA8tR.css +0 -1
- package/ui-dist/assets/remote-CPpTKDgX.js +0 -1
package/ui-dist/assets/{appearance-settings-page-yJR6Kt9c.js → appearance-settings-page-BkQaPtQ-.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{h as t,i as n,p as r,r as i,u as a}from"./react-DerwD2EA.js";import{S as o,T as s,a as c,v as l}from"./app-presenter-provider-
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{h as t,i as n,p as r,r as i,u as a}from"./react-DerwD2EA.js";import{S as o,T as s,a as c,v as l}from"./app-presenter-provider-De7Zwitu.js";import{Qt as u,Xt as d,Yt as f,Zt as p,wt as m}from"./api-D5UCLVE_.js";import{a as h,i as g,n as _,r as v,t as y,w as b}from"./select-C1zfp9zM.js";import{r as x}from"./use-confirm-dialog-CeUEE4p5.js";var S=e(t(),1);function C(){let{language:e,setLanguage:t}=x();return{currentLanguage:e,currentLanguageLabel:n.find(t=>t.value===e)?.label??e,languageOptions:n,selectLanguage:(0,S.useCallback)(n=>{e!==n&&(t(n),window.location.reload())},[e,t])}}var w=r(),T=[{value:`card`,labelKey:`chatMessageLayoutCard`,descriptionKey:`chatMessageLayoutCardDescription`},{value:`flat`,labelKey:`chatMessageLayoutFlat`,descriptionKey:`chatMessageLayoutFlatDescription`}];function E(){let{theme:e,setTheme:t}=l(),{currentLanguage:n,languageOptions:r,selectLanguage:x}=C(),S=s(e=>e.layout),E=s(e=>e.setLayout),D=c(e=>e.isVisible),O=c(e=>e.setVisible);return(0,w.jsx)(u,{title:i(`appearance`),children:(0,w.jsx)(p,{children:(0,w.jsxs)(d,{children:[(0,w.jsx)(f,{title:i(`theme`),control:(0,w.jsxs)(y,{value:e,onValueChange:e=>t(e),children:[(0,w.jsx)(g,{"aria-label":i(`theme`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:o.map(e=>(0,w.jsx)(v,{value:e.value,children:i(e.labelKey)},e.value))})]})}),(0,w.jsx)(f,{title:i(`language`),control:(0,w.jsxs)(y,{value:n,onValueChange:e=>x(e),children:[(0,w.jsx)(g,{"aria-label":i(`language`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:r.map(e=>(0,w.jsx)(v,{value:e.value,children:e.label},e.value))})]})}),(0,w.jsx)(f,{title:i(`chatMessageLayoutTitle`),description:i(`chatMessageLayoutDescription`),layout:`stacked`,children:(0,w.jsx)(`div`,{role:`radiogroup`,"aria-label":i(`chatMessageLayoutTitle`),className:`grid gap-1 rounded-xl bg-background/65 p-1 sm:grid-cols-2`,children:T.map(e=>{let t=e.value===S;return(0,w.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>E(e.value),className:a(`flex min-w-0 items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,t?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-card/60 hover:text-foreground`),children:[(0,w.jsx)(`span`,{className:a(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full ring-1`,t?`bg-primary text-primary-foreground ring-primary`:`bg-background ring-border`),children:t?(0,w.jsx)(b,{className:`h-2.5 w-2.5`,strokeWidth:3}):null}),(0,w.jsxs)(`span`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium`,children:i(e.labelKey)}),(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:i(e.descriptionKey)})]})]},e.value)})})}),(0,w.jsx)(f,{title:i(`sideDockVisibilityTitle`),description:i(`sideDockVisibilityDescription`),control:(0,w.jsx)(m,{id:`appearance-side-dock-visible`,"aria-label":i(`sideDockVisibilityTitle`),checked:D,onCheckedChange:O})})]})})})}export{E as AppearanceSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r,u as i}from"./react-DerwD2EA.js";import{A as a,C as o,F as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,_t as h,c as g,ct as _,d as v,et as y,gt as b,ht as x,it as S,j as C,k as ee,l as te,lt as ne,n as re,nt as w,o as T,rt as E,s as D,w as O,z as k}from"./app-presenter-provider-DcpcRgLn.js";import{$t as ie,Jt as ae,nn as A,on as oe,tn as j,vt as se}from"./api-D5UCLVE_.js";import{c as ce}from"./dist-Ca-jiFrK.js";import{i as M,r as le,t as ue}from"./popover-DHx55dbc.js";import{a as N,i as P,n as F,o as I,r as L,s as R}from"./confirm-dialog-e2YCUzt1.js";import{C as de,a as fe,i as pe,n as me,r as he,t as ge}from"./select-C1zfp9zM.js";import{t as _e}from"./provider-scoped-model-input-1TJxAhx6.js";import{a as ve,o as z,t as ye}from"./use-confirm-dialog-CeUEE4p5.js";import{n as B,t as V}from"./card-xVrS1b1T.js";import{n as be,t as xe}from"./eye-B30J471A.js";import{t as Se}from"./use-viewport-layout-DaKJ-kap.js";import{t as H}from"./plus-C45awBb1.js";import{t as Ce}from"./settings-2-Ba3cLSN2.js";import{t as we}from"./trash-2-CUpWjNHu.js";import{n as Te}from"./provider-models-CXUgDxGR.js";import{t as Ee}from"./tag-chip-2vwlVUwM.js";import{t as De}from"./index-6Esxu-Pp.js";import{l as U,t as W,u as G}from"./use-config-BvxDWV-M.js";var Oe=ce(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),K=e(t(),1),q=n(),J=new Intl.NumberFormat;function ke({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:i,defaultRuntimeLabel:a,onOpenChange:o,onEdit:s}){if(!e)return null;let c=Y(e.model,t?.model),l=Ae({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:i,defaultRuntimeLabel:a}),u=X(e.contextTokens,t?.contextTokens??2e5),d=X(e.reservedContextTokens,t?.reservedContextTokens),f=X(e.maxToolIterations,t?.maxToolIterations??1e3),p=Y(e.thinkingDefault,t?.thinkingDefault??`off`),m=Me(e.runtimeConfig??e.engineConfig,t?.engineConfig),h=Me(e.models,t?.models);return(0,q.jsx)(F,{open:e!==null,onOpenChange:o,children:(0,q.jsxs)(L,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-white p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,q.jsx)(I,{className:`text-left`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(C,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(R,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,q.jsxs)(P,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,q.jsxs)(Z,{icon:ne,title:r(`agentsDetailsIdentitySection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldDescription`),value:e.description?.trim()||r(`agentsDetailsEmptyValue`),wide:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldWorkspace`),value:e.workspace??r(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,q.jsxs)(Z,{icon:z,title:r(`agentsDetailsRuntimeSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldModel`),value:c.value,source:c.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldRuntime`),value:l.value,source:l.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldRuntimeConfig`),value:m.value,source:m.source,mono:!0,prewrap:!0})]}),(0,q.jsxs)(Z,{icon:Oe,title:r(`agentsDetailsContextSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldContextTokens`),value:u.value,source:u.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldReservedContextTokens`),value:d.value,source:d.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldMaxToolIterations`),value:f.value,source:f.source})]}),(0,q.jsxs)(Z,{icon:_,title:r(`agentsDetailsBehaviorSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldThinkingDefault`),value:p.value,source:p.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldModelOverrides`),value:h.value,source:h.source,mono:!0,prewrap:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldAvatar`),value:e.avatar??r(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,q.jsxs)(N,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:r(`cancel`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>s(e),children:[(0,q.jsx)(w,{className:`mr-2 h-4 w-4`}),r(`agentsDetailsEditAction`)]})]})]})})}function Y(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||r(`agentsDetailsUnsetValue`),source:`default`}}function X(e,t){return typeof e==`number`?{value:J.format(e),source:`override`}:{value:typeof t==`number`?J.format(t):r(`agentsDetailsUnsetValue`),source:`default`}}function Ae(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:je(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?je(s,r,a):a,source:`default`}}function je(e,t,n){let r=d(e);return r?t.find(e=>e.value===r)?.label??s(r):n}function Me(e,t){return Ne(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:Ne(t)?JSON.stringify(t,null,2):r(`agentsDetailsUnsetValue`),source:`default`}}function Ne(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function Z(e){let{icon:t,title:n,children:r}=e;return(0,q.jsxs)(`section`,{className:`space-y-2 border-t border-gray-100 pt-3 first:border-t-0 first:pt-0`,children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-gray-900`,children:[(0,q.jsx)(t,{className:`h-3.5 w-3.5 text-gray-400`}),n]}),(0,q.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function Q(e){let{label:t,value:n,source:r,mono:a=!1,prewrap:o=!1,wide:s=!1}=e,c=o&&n.trim().startsWith(`{`),l=a&&(!o||c);return(0,q.jsxs)(`div`,{className:i(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(s||c)&&`sm:col-span-2`),children:[(0,q.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,q.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-gray-500`,children:t})}),(0,q.jsxs)(`dd`,{className:i(`min-w-0 break-words text-xs leading-5 text-gray-900`,c?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-gray-50/70 px-2 py-1.5 text-left`:``),children:[(0,q.jsx)(`span`,{className:l?`font-mono`:void 0,children:n}),r?(0,q.jsx)(Pe,{source:r}):null]})]})}function Pe({source:e}){return(0,q.jsxs)(`span`,{className:i(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-gray-400`),children:[`(`,r(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function Fe({form:e,disabled:t=!1,onChange:n}){return(0,q.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200 bg-white`,children:[(0,q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-gray-800 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ce,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,q.jsx)(`span`,{className:`truncate`,children:r(`agentsAdvancedConfigToggle`)})]}),(0,q.jsx)(de,{className:`h-4 w-4 shrink-0 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-gray-100 px-4 py-4`,children:[(0,q.jsx)(`p`,{className:`text-xs leading-5 text-gray-500`,children:r(`agentsAdvancedConfigDescription`)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,q.jsx)(Ie,{label:r(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function Ie(e){let{label:t,value:n,min:i,step:a,disabled:o,onChange:s}=e;return(0,q.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-gray-700`,children:[(0,q.jsx)(`span`,{children:t}),(0,q.jsx)(j,{type:`number`,min:i,step:a,value:n,disabled:o,placeholder:r(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>s(e.target.value)})]})}function Le(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Re(e.contextTokens)}}function Re(e){return typeof e==`number`?String(e):``}var ze=K.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`textarea`,{className:i(`flex min-h-28 w-full rounded-xl border border-border/75 bg-card px-3.5 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/55 placeholder:font-normal transition-colors focus:outline-none focus:ring-0 focus:border-border disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));ze.displayName=`Textarea`;function Be(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=d(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:s(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Ve({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:i,onChange:a}){let o=e.trim()?d(e):``,s=Be({runtimeOptions:n,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?r(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(ge,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(pe,{"aria-label":r(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(fe,{placeholder:r(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(me,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(he,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function He({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(F,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(Ue,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Ue(e){let{agent:t,pending:n,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(Le(t));return(0,q.jsxs)(L,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(I,{className:`text-left`,children:[(0,q.jsx)(R,{children:r(`agentsEditDialogTitle`)}),(0,q.jsx)(P,{children:r(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(ve,{tone:`warning`,title:r(`agentsEditHomeReadonly`),description:r(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(j,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:r(`agentsFormNamePlaceholder`)}),(0,q.jsx)(ze,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:r(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(j,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:r(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(_e,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:n,className:`md:col-span-2`}),(0,q.jsx)(Ve,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:n})]}),(0,q.jsx)(Fe,{form:l,disabled:n,onChange:e=>u(t=>({...t,...e}))})]})}),(0,q.jsxs)(N,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:r(`cancel`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:n,children:[(0,q.jsx)(w,{className:`mr-2 h-4 w-4`}),r(`agentsEditSaveAction`)]})]})]})}var We=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Ge(e,t){let n=e.trim();if(!n)return null;let i=Number(n);if(!Number.isFinite(i))throw Error(r(`agentsAdvancedInvalidNumberError`));return Math.max(t,Math.trunc(i))}function Ke(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:Ge(e.contextTokens,1e3)}}function qe(e){let{agentCount:t,onCreate:n}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:r(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:r(`agentsHeroDescription`)})]}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:n,children:[(0,q.jsx)(H,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}function $(e){let{icon:t,label:n,disabled:r=!1,destructive:a=!1,onClick:o}=e;return(0,q.jsxs)(`button`,{type:`button`,className:i(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:r,children:[(0,q.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:n})]})}function Je(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:c,onView:l,onEdit:u,onDelete:f}=e,p=t.runtime?.trim()||t.engine?.trim()||``,m=p?n.find(e=>e.value===d(p))?.label??s(p):i;return(0,q.jsx)(V,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(B,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(C,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(Ee,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(y,{className:`h-3 w-3`}),r(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`agentsCardStartChat`),title:r(`agentsCardStartChat`),onClick:c,children:(0,q.jsx)(E,{className:`h-4 w-4`})}),(0,q.jsxs)(ue,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`chatSessionMoreActions`),title:r(`chatSessionMoreActions`),children:(0,q.jsx)(be,{className:`h-4 w-4`})})}),(0,q.jsxs)(le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)($,{icon:xe,label:r(`agentsViewDetailsAction`),onClick:l}),(0,q.jsx)($,{icon:w,label:r(`agentsEditAction`),onClick:u,disabled:a}),t.builtIn?null:(0,q.jsx)($,{icon:we,label:r(`agentsRemoveAction`),onClick:f,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?r(`agentsCardBuiltInSummary`):r(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:m})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Ye(){let e=k(),t=re(),n=b(),i=f(),o=W(),c=G(),l=U(),m=T(),h=a(),g=ee(),[_,v]=(0,K.useState)(null),[y,x]=(0,K.useState)(null),S=(0,K.useMemo)(()=>i.data?.agents??[],[i.data?.agents]),C=(0,K.useMemo)(()=>[...S].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[S]),te=(0,K.useMemo)(()=>Te({config:o.data,providersView:c.data,templatesView:l.data,onlyConfigured:!0}),[o.data,c.data,l.data]),w=(0,K.useMemo)(()=>u(m.data?.options??[]),[m.data?.options]),E=(0,K.useMemo)(()=>d(m.data?.defaultType??`native`),[m.data?.defaultType]),D=(0,K.useMemo)(()=>w.find(e=>e.value===E)?.label??s(E),[E,w]),O=o.data?.agents.defaults,ae=e=>{v(e)},j=e=>{x(e)},se=async(e,t)=>{let n;try{n=Ke(t)}catch(e){oe.error(e instanceof Error?e.message:r(`agentsAdvancedParseFailed`));return}await h.mutateAsync({agentId:e,data:n}),x(null)},ce=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,p(t,E))},M=()=>{n(`/chat`),t.chatDraftIntentManager.requestDraft(We)};return(0,q.jsxs)(ie,{className:`space-y-5`,children:[(0,q.jsx)(qe,{agentCount:S.length,onCreate:M}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:i.isLoading?(0,q.jsx)(V,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(B,{className:`py-14 text-center text-sm text-gray-500`,children:r(`agentsLoading`)})}):C.length===0?(0,q.jsx)(V,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(B,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(ne,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:r(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:r(`agentsEmptyDescription`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:M,children:[(0,q.jsx)(H,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}):C.map(e=>(0,q.jsx)(Je,{agent:e,runtimeOptions:w,defaultRuntimeLabel:D,updatePending:h.isPending,deletePending:g.isPending,onStartChat:()=>ce(e),onView:()=>ae(e),onEdit:()=>j(e),onDelete:()=>g.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(ke,{agent:_,defaults:O,runtimeOptions:w,defaultRuntime:E,defaultRuntimeLabel:D,onOpenChange:e=>{e||v(null)},onEdit:e=>{v(null),x(e)}}),(0,q.jsx)(He,{agent:y,pending:h.isPending,providerCatalog:te,runtimeOptions:w,defaultRuntime:E,onOpenChange:e=>{!e&&!h.isPending&&x(null)},onSubmit:se})]})}function Xe(e){let{view:t,routeSessionKey:n,syncRouteSessionSelection:r}=e;(0,K.useLayoutEffect)(()=>{r({isChatView:t===`chat`,routeSessionKey:n})},[n,r,t])}function Ze({view:e,confirmDialog:t}){let{isMobile:n}=Se();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(te,{}),e===`chat`?n?(0,q.jsx)(v,{}):(0,q.jsx)(o,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(O,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(Ye,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(De,{forcedType:`skills`})})})}),t]})}function Qe(e){let t=k(),n=W(),r=G(),i=U(),a=l({limit:200}),o=T(),s=e.sessionKey?.trim()||`draft-session`,u=c({sessionId:s});(0,K.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:u})},[n,t.chatQueryManager,r,s,u,a,o,i])}function $e(){let e=k();(0,K.useEffect)(()=>se.eventBus.on(ae.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function et(){let{sessionId:e}=h(),t=(0,K.useMemo)(()=>g(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function tt(){let e=k(),{confirm:t,ConfirmDialog:n}=ye(),r=x(),i=b();return(0,K.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,q.jsx)(n,{})}function nt({view:e}){let t=re();return(0,q.jsx)(m,{presenter:(0,K.useMemo)(()=>new D(t),[t]),children:(0,q.jsx)(rt,{view:e})})}function rt({view:e}){let t=k(),n=tt(),{routeSessionKey:r,sessionKey:i}=et();return Qe({sessionKey:i??null}),Xe({view:e,routeSessionKey:r,syncRouteSessionSelection:t.chatSessionListManager.syncRouteSessionSelection}),$e(),(0,q.jsx)(Ze,{view:e,confirmDialog:n})}function it({view:e}){return(0,q.jsx)(nt,{view:e})}export{it as ChatPage};
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r,u as i}from"./react-DerwD2EA.js";import{A as a,C as o,F as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,_t as h,c as g,ct as _,d as v,et as y,gt as b,ht as x,it as S,j as C,k as ee,l as te,lt as ne,n as re,nt as w,o as T,rt as E,s as D,w as O,z as k}from"./app-presenter-provider-De7Zwitu.js";import{$t as ie,Jt as ae,nn as A,on as oe,tn as j,vt as se}from"./api-D5UCLVE_.js";import{c as ce}from"./dist-Ca-jiFrK.js";import{i as M,r as le,t as ue}from"./popover-DHx55dbc.js";import{a as N,i as P,n as F,o as I,r as L,s as R}from"./confirm-dialog-e2YCUzt1.js";import{C as de,a as fe,i as pe,n as me,r as he,t as ge}from"./select-C1zfp9zM.js";import{t as _e}from"./provider-scoped-model-input-1TJxAhx6.js";import{a as ve,o as z,t as ye}from"./use-confirm-dialog-CeUEE4p5.js";import{n as B,t as V}from"./card-xVrS1b1T.js";import{n as be,t as xe}from"./eye-B30J471A.js";import{t as Se}from"./use-viewport-layout-DaKJ-kap.js";import{t as H}from"./plus-C45awBb1.js";import{t as Ce}from"./settings-2-Ba3cLSN2.js";import{t as we}from"./trash-2-CUpWjNHu.js";import{n as Te}from"./provider-models-CXUgDxGR.js";import{t as Ee}from"./tag-chip-2vwlVUwM.js";import{t as De}from"./index-B5AoUrMf.js";import{l as U,t as W,u as G}from"./use-config-BvxDWV-M.js";var Oe=ce(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),K=e(t(),1),q=n(),J=new Intl.NumberFormat;function ke({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:i,defaultRuntimeLabel:a,onOpenChange:o,onEdit:s}){if(!e)return null;let c=Y(e.model,t?.model),l=Ae({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:i,defaultRuntimeLabel:a}),u=X(e.contextTokens,t?.contextTokens??2e5),d=X(e.reservedContextTokens,t?.reservedContextTokens),f=X(e.maxToolIterations,t?.maxToolIterations??1e3),p=Y(e.thinkingDefault,t?.thinkingDefault??`off`),m=Me(e.runtimeConfig??e.engineConfig,t?.engineConfig),h=Me(e.models,t?.models);return(0,q.jsx)(F,{open:e!==null,onOpenChange:o,children:(0,q.jsxs)(L,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-white p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,q.jsx)(I,{className:`text-left`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(C,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(R,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,q.jsxs)(P,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,q.jsxs)(Z,{icon:ne,title:r(`agentsDetailsIdentitySection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldDescription`),value:e.description?.trim()||r(`agentsDetailsEmptyValue`),wide:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldWorkspace`),value:e.workspace??r(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,q.jsxs)(Z,{icon:z,title:r(`agentsDetailsRuntimeSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldModel`),value:c.value,source:c.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldRuntime`),value:l.value,source:l.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldRuntimeConfig`),value:m.value,source:m.source,mono:!0,prewrap:!0})]}),(0,q.jsxs)(Z,{icon:Oe,title:r(`agentsDetailsContextSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldContextTokens`),value:u.value,source:u.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldReservedContextTokens`),value:d.value,source:d.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldMaxToolIterations`),value:f.value,source:f.source})]}),(0,q.jsxs)(Z,{icon:_,title:r(`agentsDetailsBehaviorSection`),children:[(0,q.jsx)(Q,{label:r(`agentsDetailsFieldThinkingDefault`),value:p.value,source:p.source}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldModelOverrides`),value:h.value,source:h.source,mono:!0,prewrap:!0}),(0,q.jsx)(Q,{label:r(`agentsDetailsFieldAvatar`),value:e.avatar??r(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,q.jsxs)(N,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:r(`cancel`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>s(e),children:[(0,q.jsx)(w,{className:`mr-2 h-4 w-4`}),r(`agentsDetailsEditAction`)]})]})]})})}function Y(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||r(`agentsDetailsUnsetValue`),source:`default`}}function X(e,t){return typeof e==`number`?{value:J.format(e),source:`override`}:{value:typeof t==`number`?J.format(t):r(`agentsDetailsUnsetValue`),source:`default`}}function Ae(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:je(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?je(s,r,a):a,source:`default`}}function je(e,t,n){let r=d(e);return r?t.find(e=>e.value===r)?.label??s(r):n}function Me(e,t){return Ne(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:Ne(t)?JSON.stringify(t,null,2):r(`agentsDetailsUnsetValue`),source:`default`}}function Ne(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function Z(e){let{icon:t,title:n,children:r}=e;return(0,q.jsxs)(`section`,{className:`space-y-2 border-t border-gray-100 pt-3 first:border-t-0 first:pt-0`,children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-gray-900`,children:[(0,q.jsx)(t,{className:`h-3.5 w-3.5 text-gray-400`}),n]}),(0,q.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function Q(e){let{label:t,value:n,source:r,mono:a=!1,prewrap:o=!1,wide:s=!1}=e,c=o&&n.trim().startsWith(`{`),l=a&&(!o||c);return(0,q.jsxs)(`div`,{className:i(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(s||c)&&`sm:col-span-2`),children:[(0,q.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,q.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-gray-500`,children:t})}),(0,q.jsxs)(`dd`,{className:i(`min-w-0 break-words text-xs leading-5 text-gray-900`,c?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-gray-50/70 px-2 py-1.5 text-left`:``),children:[(0,q.jsx)(`span`,{className:l?`font-mono`:void 0,children:n}),r?(0,q.jsx)(Pe,{source:r}):null]})]})}function Pe({source:e}){return(0,q.jsxs)(`span`,{className:i(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-gray-400`),children:[`(`,r(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function Fe({form:e,disabled:t=!1,onChange:n}){return(0,q.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200 bg-white`,children:[(0,q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-gray-800 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ce,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,q.jsx)(`span`,{className:`truncate`,children:r(`agentsAdvancedConfigToggle`)})]}),(0,q.jsx)(de,{className:`h-4 w-4 shrink-0 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-gray-100 px-4 py-4`,children:[(0,q.jsx)(`p`,{className:`text-xs leading-5 text-gray-500`,children:r(`agentsAdvancedConfigDescription`)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,q.jsx)(Ie,{label:r(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function Ie(e){let{label:t,value:n,min:i,step:a,disabled:o,onChange:s}=e;return(0,q.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-gray-700`,children:[(0,q.jsx)(`span`,{children:t}),(0,q.jsx)(j,{type:`number`,min:i,step:a,value:n,disabled:o,placeholder:r(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>s(e.target.value)})]})}function Le(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:Re(e.contextTokens)}}function Re(e){return typeof e==`number`?String(e):``}var ze=K.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`textarea`,{className:i(`flex min-h-28 w-full rounded-xl border border-border/75 bg-card px-3.5 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/55 placeholder:font-normal transition-colors focus:outline-none focus:ring-0 focus:border-border disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));ze.displayName=`Textarea`;function Be(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=d(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:s(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Ve({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:i,onChange:a}){let o=e.trim()?d(e):``,s=Be({runtimeOptions:n,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?r(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(ge,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(pe,{"aria-label":r(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(fe,{placeholder:r(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(me,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(he,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function He({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(F,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(Ue,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Ue(e){let{agent:t,pending:n,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(Le(t));return(0,q.jsxs)(L,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(I,{className:`text-left`,children:[(0,q.jsx)(R,{children:r(`agentsEditDialogTitle`)}),(0,q.jsx)(P,{children:r(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(ve,{tone:`warning`,title:r(`agentsEditHomeReadonly`),description:r(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(j,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:r(`agentsFormNamePlaceholder`)}),(0,q.jsx)(ze,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:r(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(j,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:r(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(_e,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:n,className:`md:col-span-2`}),(0,q.jsx)(Ve,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:n})]}),(0,q.jsx)(Fe,{form:l,disabled:n,onChange:e=>u(t=>({...t,...e}))})]})}),(0,q.jsxs)(N,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:r(`cancel`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:n,children:[(0,q.jsx)(w,{className:`mr-2 h-4 w-4`}),r(`agentsEditSaveAction`)]})]})]})}var We=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Ge(e,t){let n=e.trim();if(!n)return null;let i=Number(n);if(!Number.isFinite(i))throw Error(r(`agentsAdvancedInvalidNumberError`));return Math.max(t,Math.trunc(i))}function Ke(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:Ge(e.contextTokens,1e3)}}function qe(e){let{agentCount:t,onCreate:n}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:r(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:r(`agentsHeroDescription`)})]}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:n,children:[(0,q.jsx)(H,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}function $(e){let{icon:t,label:n,disabled:r=!1,destructive:a=!1,onClick:o}=e;return(0,q.jsxs)(`button`,{type:`button`,className:i(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:r,children:[(0,q.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:n})]})}function Je(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:c,onView:l,onEdit:u,onDelete:f}=e,p=t.runtime?.trim()||t.engine?.trim()||``,m=p?n.find(e=>e.value===d(p))?.label??s(p):i;return(0,q.jsx)(V,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(B,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(C,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(Ee,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(y,{className:`h-3 w-3`}),r(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`agentsCardStartChat`),title:r(`agentsCardStartChat`),onClick:c,children:(0,q.jsx)(E,{className:`h-4 w-4`})}),(0,q.jsxs)(ue,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`chatSessionMoreActions`),title:r(`chatSessionMoreActions`),children:(0,q.jsx)(be,{className:`h-4 w-4`})})}),(0,q.jsxs)(le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)($,{icon:xe,label:r(`agentsViewDetailsAction`),onClick:l}),(0,q.jsx)($,{icon:w,label:r(`agentsEditAction`),onClick:u,disabled:a}),t.builtIn?null:(0,q.jsx)($,{icon:we,label:r(`agentsRemoveAction`),onClick:f,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?r(`agentsCardBuiltInSummary`):r(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:m})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Ye(){let e=k(),t=re(),n=b(),i=f(),o=W(),c=G(),l=U(),m=T(),h=a(),g=ee(),[_,v]=(0,K.useState)(null),[y,x]=(0,K.useState)(null),S=(0,K.useMemo)(()=>i.data?.agents??[],[i.data?.agents]),C=(0,K.useMemo)(()=>[...S].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[S]),te=(0,K.useMemo)(()=>Te({config:o.data,providersView:c.data,templatesView:l.data,onlyConfigured:!0}),[o.data,c.data,l.data]),w=(0,K.useMemo)(()=>u(m.data?.options??[]),[m.data?.options]),E=(0,K.useMemo)(()=>d(m.data?.defaultType??`native`),[m.data?.defaultType]),D=(0,K.useMemo)(()=>w.find(e=>e.value===E)?.label??s(E),[E,w]),O=o.data?.agents.defaults,ae=e=>{v(e)},j=e=>{x(e)},se=async(e,t)=>{let n;try{n=Ke(t)}catch(e){oe.error(e instanceof Error?e.message:r(`agentsAdvancedParseFailed`));return}await h.mutateAsync({agentId:e,data:n}),x(null)},ce=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,p(t,E))},M=()=>{n(`/chat`),t.chatDraftIntentManager.requestDraft(We)};return(0,q.jsxs)(ie,{className:`space-y-5`,children:[(0,q.jsx)(qe,{agentCount:S.length,onCreate:M}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:i.isLoading?(0,q.jsx)(V,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(B,{className:`py-14 text-center text-sm text-gray-500`,children:r(`agentsLoading`)})}):C.length===0?(0,q.jsx)(V,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(B,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(ne,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:r(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:r(`agentsEmptyDescription`)}),(0,q.jsxs)(A,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:M,children:[(0,q.jsx)(H,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}):C.map(e=>(0,q.jsx)(Je,{agent:e,runtimeOptions:w,defaultRuntimeLabel:D,updatePending:h.isPending,deletePending:g.isPending,onStartChat:()=>ce(e),onView:()=>ae(e),onEdit:()=>j(e),onDelete:()=>g.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(ke,{agent:_,defaults:O,runtimeOptions:w,defaultRuntime:E,defaultRuntimeLabel:D,onOpenChange:e=>{e||v(null)},onEdit:e=>{v(null),x(e)}}),(0,q.jsx)(He,{agent:y,pending:h.isPending,providerCatalog:te,runtimeOptions:w,defaultRuntime:E,onOpenChange:e=>{!e&&!h.isPending&&x(null)},onSubmit:se})]})}function Xe(e){let{view:t,routeSessionKey:n,syncRouteSessionSelection:r}=e;(0,K.useLayoutEffect)(()=>{r({isChatView:t===`chat`,routeSessionKey:n})},[n,r,t])}function Ze({view:e,confirmDialog:t}){let{isMobile:n}=Se();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(te,{}),e===`chat`?n?(0,q.jsx)(v,{}):(0,q.jsx)(o,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(O,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(Ye,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(De,{forcedType:`skills`})})})}),t]})}function Qe(e){let t=k(),n=W(),r=G(),i=U(),a=l({limit:200}),o=T(),s=e.sessionKey?.trim()||`draft-session`,u=c({sessionId:s});(0,K.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:u})},[n,t.chatQueryManager,r,s,u,a,o,i])}function $e(){let e=k();(0,K.useEffect)(()=>se.eventBus.on(ae.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function et(){let{sessionId:e}=h(),t=(0,K.useMemo)(()=>g(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function tt(){let e=k(),{confirm:t,ConfirmDialog:n}=ye(),r=x(),i=b();return(0,K.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,q.jsx)(n,{})}function nt({view:e}){let t=re();return(0,q.jsx)(m,{presenter:(0,K.useMemo)(()=>new D(t),[t]),children:(0,q.jsx)(rt,{view:e})})}function rt({view:e}){let t=k(),n=tt(),{routeSessionKey:r,sessionKey:i}=et();return Qe({sessionKey:i??null}),Xe({view:e,routeSessionKey:r,syncRouteSessionSelection:t.chatSessionListManager.syncRouteSessionSelection}),$e(),(0,q.jsx)(Ze,{view:e,confirmDialog:n})}function it({view:e}){return(0,q.jsx)(nt,{view:e})}export{it as ChatPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-D6ex3_NM.js","assets/chunk-DseTPa7n.js","assets/api-D5UCLVE_.js","assets/react-DerwD2EA.js","assets/book-open-WsEnuW9P.js","assets/dist-Ca-jiFrK.js","assets/provider-scoped-model-input-1TJxAhx6.js","assets/select-C1zfp9zM.js","assets/popover-DHx55dbc.js","assets/provider-models-CXUgDxGR.js","assets/navigation-link-qPPUiLt0.js","assets/host-capabilities-B-TtABsP.js","assets/loader-circle-DjwSRQHW.js","assets/doc-browser-context-CGz0LULR.js","assets/middleware-Df-a4x-q.js","assets/form-actions-CnSzu3WD.js","assets/skeleton-DL5npsVL.js","assets/use-config-BvxDWV-M.js","assets/config-hints-S3g-UVZb.js","assets/appearance-settings-page-
|
|
2
|
-
import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-DerwD2EA.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,D as l,E as u,V as d,_ as f,_t as p,a as m,at as h,b as g,dt as _,f as v,ft as y,gt as b,ht as x,i as S,m as C,mt as w,ot as T,p as ee,pt as E,r as te,st as D,t as O,u as ne,ut as re,y as ie}from"./app-presenter-provider-DcpcRgLn.js";import{$t as ae,At as k,B as oe,Cn as se,Dn as ce,En as le,Ft as ue,I as de,It as A,Jt as j,L as M,On as fe,R as pe,St as me,Tn as he,V as ge,_n as _e,an as ve,cn as ye,dn as be,fn as xe,gn as Se,hn as Ce,in as we,m as N,mn as Te,on as P,pn as Ee,sn as De,un as Oe,vn as ke,vt as F,wn as I,xt as Ae,yn as L,z as je}from"./api-D5UCLVE_.js";import{a as R,c as Me,d as Ne,f as Pe,i as Fe,l as Ie,n as Le,o as z,r as Re,s as B,u as V}from"./mcp-marketplace-page-CPcPzMUQ.js";import{c as H}from"./dist-Ca-jiFrK.js";import{n as ze}from"./search-D0HtJIL-.js";import{a as U,c as W,o as G,s as Be}from"./doc-browser-CZX6I6CU.js";import{i as Ve,n as He,o as Ue,r as K,t as We}from"./use-confirm-dialog-CeUEE4p5.js";import{o as Ge}from"./card-xVrS1b1T.js";import{t as Ke}from"./navigation-link-qPPUiLt0.js";import{i as qe,r as Je,t as Ye}from"./tabs-DmKgMKzb.js";import{t as Xe}from"./use-viewport-layout-DaKJ-kap.js";import{t as Ze}from"./refresh-cw-C7bynrWX.js";import{t as Qe}from"./trash-2-CUpWjNHu.js";import{n as $e,t as et}from"./doc-browser-context-CGz0LULR.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var tt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function nt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function rt(e,t,n){let r=e.slice(0);return r[t]=n,r}var it=class extends fe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,I.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ce(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(nt(e,n).forEach(e=>{e.destroy()}),nt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=le(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=rt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&I.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},q=e(n(),1);function at({queries:e,...t},n){let r=L(n),i=_e(),a=Se(),o=q.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Oe(e),Ee(e,a,r.getQueryCache().get(e.queryHash))}),Ce(a);let[s]=q.useState(()=>new it(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;q.useSyncExternalStore(q.useCallback(e=>d?s.subscribe(I.batchCalls(e)):he,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),q.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>xe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&xe(n,e)?be(n,new se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Te({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ot=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),st=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ct=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),lt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),ut=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),dt=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ft=tt();function J(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function pt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function mt(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=pt(e),a=r.records.findIndex(e=>mt(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:J(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!mt(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:J(e),total:e.length}}let a=i.records.map(e=>mt(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:J(a),total:a.length}}var vt=3e4;function yt(e){let t=Pe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>M({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,q.useMemo)(()=>Ne(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return ye({queryKey:[`marketplace-recent-items`,e],queryFn:()=>M({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return ye({queryKey:[`marketplace-skill-scenes`],queryFn:je,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=at({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>M({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,q.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return ye({queryKey:[`marketplace-installed`,e],queryFn:()=>de(e),staleTime:1e4})}function Tt(){let e=L();return De({mutationFn:e=>oe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||a(`marketplaceInstallFailed`))}})}function Et(){let e=L();return De({mutationFn:e=>ge(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);P.success(t.message||r)},onError:e=>{P.error(e.message||a(`marketplaceOperationFailed`))}})}var Y=i(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(i),r),children:a})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Be,{delayDuration:400,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(G,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(G,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,Y.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ze,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Be,{delayDuration:300,children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(D,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(D,{className:`h-4 w-4`})})}),(0,Y.jsx)(G,{className:`text-xs`,children:n})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=K(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,Y.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,Y.jsx)(Ie,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(D,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},n)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:dt,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ot,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:ut,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:h,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:T,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:lt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ue,tone:`teal`,span:`md:col-span-2`}],Gt={icon:Ue,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:ct,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(V,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:st,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:n,onSelect:r}=e,i=$t(t.scene),a=i.icon,s=Kt[i.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,Y.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,i,n)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,n)})]}),(0,Y.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:tn(t,i,n)})]})})}function Xt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},i),children:(0,Y.jsx)(ze,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,i)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,i)})})]})]}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(V,{count:24})}):n.length>0?(0,Y.jsx)(`div`,{className:qt,children:n.map(e=>(0,Y.jsx)(Rt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(V,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(Ke,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:a(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,q.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,q.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,q.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,q.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,q.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=We(),[i,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=$e(),n=(0,q.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Fe(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await pe(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,q.useMemo)(()=>s?.records??[],[s?.records]),h=(0,q.useMemo)(()=>o?.items??[],[o?.items]),g=(0,q.useMemo)(()=>sn(h),[h]),_=(0,q.useMemo)(()=>cn(m),[m]),v=(0,q.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,q.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${o.total} ${a(`marketplaceSkillsCountSuffix`)}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=b(),n=p(),{language:r}=K(),i=`skill`,o=(0,q.useMemo)(()=>z(r),[r]),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(`all`),[m,h]=(0,q.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:x}=pn(),{openItemDetail:S}=mn(o);(0,q.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:_n}),ee=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:E,sentinelRef:te}=Le({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,q.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,d,m,i]);let D=hn({scope:d,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),O=fn({items:D.allItems,recentItems:ee.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(ae,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Ye,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Je,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(qe,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(qe,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Me,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||T.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,Y.jsx)(Xt,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(O.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,Y.jsx)(Ie,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:te}),O.showShelves&&(0,Y.jsx)(Jt,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||ee.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,Y.jsx)(Lt,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:te},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(x,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return a(n);return a(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...u,...Re};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=$e();Ve();let{pathname:i}=x(),{language:a}=K(),{isMobile:o}=Xe(),s=C(),c=m(e=>e.isVisible);m(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,q.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(ee,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(ne,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(S,{manager:t}):null,children:e})}function On({children:e}){let t=te();return(0,Y.jsx)(et,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Xe();return e?(0,Y.jsx)(v,{}):(0,Y.jsx)(y,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let n=F.eventBus.on(j.connectionOpen,()=>{A.handleConnectionRestored(),k.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(j.connectionClose,()=>{A.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(j.connectionError,e=>{A.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(j.configUpdated,({path:t})=>{Mn(e,t)}),o=F.eventBus.on(j.runtimeUpdateSnapshot,e=>{k.reportSnapshot(e)}),s=F.eventBus.on(j.sessionRunStatus,t=>{N(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(j.sessionSummaryUpsert,t=>{N(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(j.sessionSummaryDelete,t=>{N(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(j.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var Pn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-D6ex3_NM.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-yJR6Kt9c.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-CXYXMIQQ.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-n1GElgij.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-BwHtHIPe.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-CAWuTHSM.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-CMLVC5UV.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-D5NIaimo.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-n2WHhHXV.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DbUc3Ggi.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-CPpTKDgX.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-BZa7p7Qf.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(q.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(E,{path:e.path,element:(0,Y.jsx)(y,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(E,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(w,{children:qn.map(Jn)})}function Xn(){return Nn(we),ue(),(0,q.useEffect)(()=>(k.start(),()=>{k.stop()}),[]),(0,Y.jsxs)(O,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(d,{}),(0,Y.jsx)(l,{})]})}function Zn(){let e=me(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(c,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,q.useEffect)(()=>{ie()},[]),(0,Y.jsxs)(ke,{client:we,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(g,{}),(0,Y.jsx)(ve,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?_:re;(0,ft.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(q.StrictMode,{children:(0,Y.jsx)(f,{children:(0,Y.jsx)(He,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-D6ex3_NM.js","assets/chunk-DseTPa7n.js","assets/api-D5UCLVE_.js","assets/react-DerwD2EA.js","assets/book-open-WsEnuW9P.js","assets/dist-Ca-jiFrK.js","assets/provider-scoped-model-input-1TJxAhx6.js","assets/select-C1zfp9zM.js","assets/popover-DHx55dbc.js","assets/provider-models-CXUgDxGR.js","assets/navigation-link-qPPUiLt0.js","assets/host-capabilities-B-TtABsP.js","assets/loader-circle-DjwSRQHW.js","assets/doc-browser-context-CGz0LULR.js","assets/middleware-Df-a4x-q.js","assets/form-actions-CnSzu3WD.js","assets/skeleton-DL5npsVL.js","assets/use-config-BvxDWV-M.js","assets/config-hints-S3g-UVZb.js","assets/appearance-settings-page-BkQaPtQ-.js","assets/app-presenter-provider-De7Zwitu.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-e2YCUzt1.js","assets/x-DGdYT7rH.js","assets/doc-browser-CZX6I6CU.js","assets/search-D0HtJIL-.js","assets/plus-C45awBb1.js","assets/refresh-cw-C7bynrWX.js","assets/use-confirm-dialog-CeUEE4p5.js","assets/card-xVrS1b1T.js","assets/eye-B30J471A.js","assets/tabs-DmKgMKzb.js","assets/use-viewport-layout-DaKJ-kap.js","assets/trash-2-CUpWjNHu.js","assets/logo-badge-CISsltAo.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/chat-page-AvOuaxuv.js","assets/settings-2-Ba3cLSN2.js","assets/tag-chip-2vwlVUwM.js","assets/search-config-page-n1GElgij.js","assets/config-split-page-xj0UtMow.js","assets/providers-config-page-BwHtHIPe.js","assets/channels-list-page-CAWuTHSM.js","assets/runtime-config-page-BLrTVO3n.js","assets/rotate-cw-Bhx0XkQP.js","assets/save-CsRsFtHS.js","assets/desktop-update-config-D5NIaimo.js","assets/security-config-n2WHhHXV.js","assets/secrets-config-page-DbUc3Ggi.js","assets/remote-B6TXClIg.js","assets/mcp-marketplace-page-BZa7p7Qf.js","assets/mcp-marketplace-page-CPcPzMUQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-DerwD2EA.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,D as l,E as u,V as d,_ as f,_t as p,a as m,at as h,b as g,dt as _,f as v,ft as y,gt as b,ht as x,i as S,m as C,mt as w,ot as T,p as ee,pt as E,r as te,st as D,t as O,u as ne,ut as re,y as ie}from"./app-presenter-provider-De7Zwitu.js";import{$t as ae,At as k,B as oe,Cn as se,Dn as ce,En as le,Ft as ue,I as de,It as A,Jt as j,L as M,On as fe,R as pe,St as me,Tn as he,V as ge,_n as _e,an as ve,cn as ye,dn as be,fn as xe,gn as Se,hn as Ce,in as we,m as N,mn as Te,on as P,pn as Ee,sn as De,un as Oe,vn as ke,vt as F,wn as I,xt as Ae,yn as L,z as je}from"./api-D5UCLVE_.js";import{a as R,c as Me,d as Ne,f as Pe,i as Fe,l as Ie,n as Le,o as z,r as Re,s as B,u as V}from"./mcp-marketplace-page-CPcPzMUQ.js";import{c as H}from"./dist-Ca-jiFrK.js";import{n as ze}from"./search-D0HtJIL-.js";import{a as U,c as W,o as G,s as Be}from"./doc-browser-CZX6I6CU.js";import{i as Ve,n as He,o as Ue,r as K,t as We}from"./use-confirm-dialog-CeUEE4p5.js";import{o as Ge}from"./card-xVrS1b1T.js";import{t as Ke}from"./navigation-link-qPPUiLt0.js";import{i as qe,r as Je,t as Ye}from"./tabs-DmKgMKzb.js";import{t as Xe}from"./use-viewport-layout-DaKJ-kap.js";import{t as Ze}from"./refresh-cw-C7bynrWX.js";import{t as Qe}from"./trash-2-CUpWjNHu.js";import{n as $e,t as et}from"./doc-browser-context-CGz0LULR.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var tt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function nt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function rt(e,t,n){let r=e.slice(0);return r[t]=n,r}var it=class extends fe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,I.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ce(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(nt(e,n).forEach(e=>{e.destroy()}),nt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=le(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=rt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&I.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},q=e(n(),1);function at({queries:e,...t},n){let r=L(n),i=_e(),a=Se(),o=q.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Oe(e),Ee(e,a,r.getQueryCache().get(e.queryHash))}),Ce(a);let[s]=q.useState(()=>new it(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;q.useSyncExternalStore(q.useCallback(e=>d?s.subscribe(I.batchCalls(e)):he,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),q.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>xe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&xe(n,e)?be(n,new se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Te({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ot=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),st=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ct=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),lt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),ut=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),dt=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ft=tt();function J(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function pt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function mt(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=pt(e),a=r.records.findIndex(e=>mt(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:J(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!mt(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:J(e),total:e.length}}let a=i.records.map(e=>mt(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:J(a),total:a.length}}var vt=3e4;function yt(e){let t=Pe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>M({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,q.useMemo)(()=>Ne(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return ye({queryKey:[`marketplace-recent-items`,e],queryFn:()=>M({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return ye({queryKey:[`marketplace-skill-scenes`],queryFn:je,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=at({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>M({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,q.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return ye({queryKey:[`marketplace-installed`,e],queryFn:()=>de(e),staleTime:1e4})}function Tt(){let e=L();return De({mutationFn:e=>oe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||a(`marketplaceInstallFailed`))}})}function Et(){let e=L();return De({mutationFn:e=>ge(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);P.success(t.message||r)},onError:e=>{P.error(e.message||a(`marketplaceOperationFailed`))}})}var Y=i(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(i),r),children:a})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Be,{delayDuration:400,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(G,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(G,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,Y.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ze,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Be,{delayDuration:300,children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(D,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(D,{className:`h-4 w-4`})})}),(0,Y.jsx)(G,{className:`text-xs`,children:n})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=K(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,Y.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,Y.jsx)(Ie,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(D,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},n)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ge,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:dt,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ot,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:ut,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:h,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:T,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:lt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ue,tone:`teal`,span:`md:col-span-2`}],Gt={icon:Ue,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:ct,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(V,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:st,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:n,onSelect:r}=e,i=$t(t.scene),a=i.icon,s=Kt[i.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,Y.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,i,n)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,n)})]}),(0,Y.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:tn(t,i,n)})]})})}function Xt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},i),children:(0,Y.jsx)(ze,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,i)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,i)})})]})]}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(V,{count:24})}):n.length>0?(0,Y.jsx)(`div`,{className:qt,children:n.map(e=>(0,Y.jsx)(Rt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(V,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(Ke,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:a(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,q.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,q.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,q.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,q.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,q.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=We(),[i,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=$e(),n=(0,q.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Fe(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await pe(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,q.useMemo)(()=>s?.records??[],[s?.records]),h=(0,q.useMemo)(()=>o?.items??[],[o?.items]),g=(0,q.useMemo)(()=>sn(h),[h]),_=(0,q.useMemo)(()=>cn(m),[m]),v=(0,q.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,q.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${o.total} ${a(`marketplaceSkillsCountSuffix`)}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=b(),n=p(),{language:r}=K(),i=`skill`,o=(0,q.useMemo)(()=>z(r),[r]),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(`all`),[m,h]=(0,q.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:x}=pn(),{openItemDetail:S}=mn(o);(0,q.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:_n}),ee=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:E,sentinelRef:te}=Le({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,q.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,d,m,i]);let D=hn({scope:d,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),O=fn({items:D.allItems,recentItems:ee.data?.items??[],installedRecordLookup:D.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(ae,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Ye,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Je,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(qe,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(qe,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Me,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||T.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,Y.jsx)(Xt,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(O.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,Y.jsx)(Ie,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:te}),O.showShelves&&(0,Y.jsx)(Jt,{recentEntries:O.recentEntries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton||ee.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,Y.jsx)(Lt,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:te},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(x,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return a(n);return a(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...u,...Re};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=$e();Ve();let{pathname:i}=x(),{language:a}=K(),{isMobile:o}=Xe(),s=C(),c=m(e=>e.isVisible);m(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,q.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(ee,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(ne,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(S,{manager:t}):null,children:e})}function On({children:e}){let t=te();return(0,Y.jsx)(et,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Xe();return e?(0,Y.jsx)(v,{}):(0,Y.jsx)(y,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let n=F.eventBus.on(j.connectionOpen,()=>{A.handleConnectionRestored(),k.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(j.connectionClose,()=>{A.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(j.connectionError,e=>{A.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(j.configUpdated,({path:t})=>{Mn(e,t)}),o=F.eventBus.on(j.runtimeUpdateSnapshot,e=>{k.reportSnapshot(e)}),s=F.eventBus.on(j.sessionRunStatus,t=>{N(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(j.sessionSummaryUpsert,t=>{N(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(j.sessionSummaryDelete,t=>{N(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(j.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var Pn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-D6ex3_NM.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-BkQaPtQ-.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-AvOuaxuv.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-n1GElgij.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-BwHtHIPe.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-CAWuTHSM.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-BLrTVO3n.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-D5NIaimo.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-n2WHhHXV.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-DbUc3Ggi.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,q.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-B6TXClIg.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,q.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-BZa7p7Qf.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(q.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(E,{path:e.path,element:(0,Y.jsx)(y,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(E,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(w,{children:qn.map(Jn)})}function Xn(){return Nn(we),ue(),(0,q.useEffect)(()=>(k.start(),()=>{k.stop()}),[]),(0,Y.jsxs)(O,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(d,{}),(0,Y.jsx)(l,{})]})}function Zn(){let e=me(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(c,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,q.useEffect)(()=>{ie()},[]),(0,Y.jsxs)(ke,{client:we,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(g,{}),(0,Y.jsx)(ve,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?_:re;(0,ft.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(q.StrictMode,{children:(0,Y.jsx)(f,{children:(0,Y.jsx)(He,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};
|