nextclaw 0.8.23 → 0.8.24
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 +2 -2
- package/ui-dist/assets/{ChannelsList-GW0rzJh0.js → ChannelsList-DHBUkGsA.js} +1 -1
- package/ui-dist/assets/{CronConfig-DJv3pHG6.js → CronConfig-9YgJQTmP.js} +1 -1
- package/ui-dist/assets/{DocBrowser-IzD4Evlq.js → DocBrowser-CBY75a92.js} +1 -1
- package/ui-dist/assets/MarketplacePage-Dw_0TLNd.js +1 -0
- package/ui-dist/assets/{ModelConfig-Dp5iCAC-.js → ModelConfig-CBmc0ERp.js} +1 -1
- package/ui-dist/assets/{ProvidersList-csOpEGSj.js → ProvidersList-CZfmOr6_.js} +1 -1
- package/ui-dist/assets/{RuntimeConfig-H0SSIQ3f.js → RuntimeConfig-DX6nI_b5.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-8nUD5SGB.js → SessionsConfig-wH-647_6.js} +1 -1
- package/ui-dist/assets/{action-link-DXGkm9Hk.js → action-link-DNRpMv1A.js} +1 -1
- package/ui-dist/assets/{card-7BTaMTaL.js → card-KMt_4CgV.js} +1 -1
- package/ui-dist/assets/{dialog-CXsWIUTk.js → dialog-CqY6jnQm.js} +1 -1
- package/ui-dist/assets/{index-CJRpyLXg.js → index-CVOQiX2_.js} +2 -2
- package/ui-dist/assets/{label-BAzOr1uc.js → label-C7WCjHWk.js} +1 -1
- package/ui-dist/assets/{page-layout-DJ75nLW5.js → page-layout-CMuYE4DA.js} +1 -1
- package/ui-dist/assets/{switch-DyifnPNj.js → switch-DQmUTN4L.js} +1 -1
- package/ui-dist/assets/{tabs-custom-PWZmQDBG.js → tabs-custom-C5xYS25o.js} +1 -1
- package/ui-dist/assets/{useConfig-B43ymz0l.js → useConfig-Bv2DQ4BE.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-Bd2fAZGR.js → useConfirmDialog-BOcIsqiA.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/MarketplacePage-rd97G8xD.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.24",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"chokidar": "^3.6.0",
|
|
40
40
|
"commander": "^12.1.0",
|
|
41
41
|
"@nextclaw/core": "^0.6.32",
|
|
42
|
-
"@nextclaw/server": "^0.5.
|
|
42
|
+
"@nextclaw/server": "^0.5.11",
|
|
43
43
|
"@nextclaw/openclaw-compat": "^0.1.26"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as a,Z as ae,_ as S,a0 as M,a1 as N,W as te,X as ne,Y as le,a2 as se,a3 as oe,M as H,a4 as re,a5 as ce,a6 as ie}from"./vendor-Dkx07DIh.js";import{u as _,a as q,e as me,f as pe,I as D,c as de}from"./useConfig-B43ymz0l.js";import{t as e,c as G,u as J,S as be,a as ue,b as ye,d as ge,e as xe}from"./index-CJRpyLXg.js";import{D as he,a as fe,b as we,c as je,d as ve,e as ke}from"./dialog-CXsWIUTk.js";import{B as F,P as Ce,a as Pe}from"./page-layout-DJ75nLW5.js";import{L as Ne}from"./label-BAzOr1uc.js";import{S as Se}from"./switch-DyifnPNj.js";import{h as T}from"./config-hints-CApS3K_7.js";import{T as Ie}from"./tabs-custom-PWZmQDBG.js";import{C as De,a as Fe,L as Te,d as Me,S as Ae,b as Le,c as Ue,A as Ee}from"./action-link-DXGkm9Hk.js";function Be({value:n,onChange:d,className:i,placeholder:m=""}){const[c,g]=v.useState(""),b=u=>{u.key==="Enter"&&c.trim()?(u.preventDefault(),d([...n,c.trim()]),g("")):u.key==="Backspace"&&!c&&n.length>0&&d(n.slice(0,-1))},f=u=>{d(n.filter((o,y)=>y!==u))};return a.jsxs("div",{className:G("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",i),children:[n.map((u,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[u,a.jsx("button",{type:"button",onClick:()=>f(o),className:"hover:text-red-300 transition-colors",children:a.jsx(ae,{className:"h-3 w-3"})})]},o)),a.jsx("input",{type:"text",value:c,onChange:u=>g(u.target.value),onKeyDown:b,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:m||e("enterTag")})]})}const U=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],E=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],Oe=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}],$e=n=>n.includes("token")||n.includes("secret")||n.includes("password")?a.jsx(te,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("url")||n.includes("host")?a.jsx(ne,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("email")||n.includes("mail")?a.jsx(M,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("id")||n.includes("from")?a.jsx(le,{className:"h-3.5 w-3.5 text-gray-500"}):n==="enabled"||n==="consentGranted"?a.jsx(se,{className:"h-3.5 w-3.5 text-gray-500"}):a.jsx(oe,{className:"h-3.5 w-3.5 text-gray-500"});function B(){return{telegram:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"proxy",type:"text",label:e("proxy")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:U},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:E},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"gatewayUrl",type:"text",label:e("gatewayUrl")},{name:"intents",type:"number",label:e("intents")},{name:"proxy",type:"text",label:e("proxy")},{name:"mediaMaxMb",type:"number",label:e("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:e("streamingMode"),options:Oe},{name:"draftChunk",type:"json",label:e("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:e("textChunkLimit")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:U},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:E},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"bridgeUrl",type:"text",label:e("bridgeUrl")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"appSecret",type:"password",label:e("appSecret")},{name:"encryptKey",type:"password",label:e("encryptKey")},{name:"verificationToken",type:"password",label:e("verificationToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],dingtalk:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"clientId",type:"text",label:e("clientId")},{name:"clientSecret",type:"password",label:e("clientSecret")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"corpId",type:"text",label:e("corpId")},{name:"agentId",type:"text",label:e("agentId")},{name:"secret",type:"password",label:e("secret")},{name:"token",type:"password",label:e("token")},{name:"callbackPort",type:"number",label:e("callbackPort")},{name:"callbackPath",type:"text",label:e("callbackPath")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],slack:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"mode",type:"text",label:e("mode")},{name:"webhookPath",type:"text",label:e("webhookPath")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"botToken",type:"password",label:e("botToken")},{name:"appToken",type:"password",label:e("appToken")}],email:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"consentGranted",type:"boolean",label:e("consentGranted")},{name:"imapHost",type:"text",label:e("imapHost")},{name:"imapPort",type:"number",label:e("imapPort")},{name:"imapUsername",type:"text",label:e("imapUsername")},{name:"imapPassword",type:"password",label:e("imapPassword")},{name:"fromAddress",type:"email",label:e("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"baseUrl",type:"text",label:e("baseUrl")},{name:"clawToken",type:"password",label:e("clawToken")},{name:"agentUserId",type:"text",label:e("agentUserId")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"secret",type:"password",label:e("appSecret")},{name:"markdownSupport",type:"boolean",label:e("markdownSupport")},{name:"allowFrom",type:"tags",label:e("allowFrom")}]}}const O={telegram:S,slack:S,email:M,default:S},$={telegram:"from-primary-300 to-primary-600",slack:"from-primary-200 to-primary-500",email:"from-primary-100 to-primary-400",default:"from-gray-300 to-gray-500"};function I(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function K(n,d){const i={...n};for(const[m,c]of Object.entries(d)){const g=i[m];if(I(g)&&I(c)){i[m]=K(g,c);continue}i[m]=c}return i}function Re(n,d){const i=n.split("."),m={};let c=m;for(let g=0;g<i.length-1;g+=1){const b=i[g];c[b]={},c=c[b]}return c[i[i.length-1]]=d,m}function He(){var A,L;const{channelModal:n,closeChannelModal:d}=J(),{data:i}=_(),{data:m}=q(),c=me(),g=pe(),[b,f]=v.useState({}),[u,o]=v.useState({}),[y,x]=v.useState(null),l=n.channel,w=l?i==null?void 0:i.channels[l]:null,k=l?B()[l]??[]:[],C=m==null?void 0:m.uiHints,P=l?`channels.${l}`:null,Y=((A=m==null?void 0:m.actions)==null?void 0:A.filter(t=>t.scope===P))??[],z=l&&(((L=T(`channels.${l}`,C))==null?void 0:L.label)??l);v.useEffect(()=>{if(w){f({...w});const t={};(l?B()[l]??[]:[]).filter(r=>r.type==="json").forEach(r=>{const h=w[r.name];t[r.name]=JSON.stringify(h??{},null,2)}),o(t)}else f({}),o({})},[w,l]);const j=(t,s)=>{f(r=>({...r,[t]:s}))},V=t=>{if(t.preventDefault(),!l)return;const s={...b};for(const r of k){if(r.type!=="json")continue;const h=u[r.name]??"";try{s[r.name]=h.trim()?JSON.parse(h):{}}catch{N.error(`${e("invalidJson")}: ${r.name}`);return}}c.mutate({channel:l,data:s},{onSuccess:()=>d()})},W=t=>{if(!t||!l)return;const s=t.channels;if(!I(s))return;const r=s[l];I(r)&&f(h=>K(h,r))},X=async t=>{if(!(!l||!P)){x(t.id);try{let s={...b};t.saveBeforeRun&&(s={...s,...t.savePatch??{}},f(s),await c.mutateAsync({channel:l,data:s}));const r=await g.mutateAsync({actionId:t.id,data:{scope:P,draftConfig:Re(P,s)}});W(r.patch),r.ok?N.success(r.message||e("success")):N.error(r.message||e("error"))}catch(s){const r=s instanceof Error?s.message:String(s);N.error(`${e("error")}: ${r}`)}finally{x(null)}}},Z=O[l||""]||O.default,Q=$[l||""]||$.default;return a.jsx(he,{open:n.open,onOpenChange:d,children:a.jsxs(fe,{className:"sm:max-w-[550px] max-h-[85vh] overflow-hidden flex flex-col",children:[a.jsx(we,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`h-10 w-10 rounded-xl bg-gradient-to-br ${Q} flex items-center justify-center`,children:a.jsx(Z,{className:"h-5 w-5 text-white"})}),a.jsxs("div",{children:[a.jsx(je,{className:"capitalize",children:z}),a.jsx(ve,{children:e("configureMessageChannelParameters")})]})]})}),a.jsxs("form",{onSubmit:V,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar py-2 pr-2 space-y-5",children:k.map(t=>{const s=l?T(`channels.${l}.${t.name}`,C):void 0,r=(s==null?void 0:s.label)??t.label,h=s==null?void 0:s.placeholder;return a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs(Ne,{htmlFor:t.name,className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[$e(t.name),r]}),t.type==="boolean"&&a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-gray-50",children:[a.jsx("span",{className:"text-sm text-gray-500",children:b[t.name]?e("enabled"):e("disabled")}),a.jsx(Se,{id:t.name,checked:b[t.name]||!1,onCheckedChange:p=>j(t.name,p),className:"data-[state=checked]:bg-emerald-500"})]}),(t.type==="text"||t.type==="email")&&a.jsx(D,{id:t.name,type:t.type,value:b[t.name]||"",onChange:p=>j(t.name,p.target.value),placeholder:h,className:"rounded-xl"}),t.type==="password"&&a.jsx(D,{id:t.name,type:"password",value:b[t.name]||"",onChange:p=>j(t.name,p.target.value),placeholder:h??e("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),t.type==="number"&&a.jsx(D,{id:t.name,type:"number",value:b[t.name]||0,onChange:p=>j(t.name,parseInt(p.target.value)||0),placeholder:h,className:"rounded-xl"}),t.type==="tags"&&a.jsx(Be,{value:b[t.name]||[],onChange:p=>j(t.name,p)}),t.type==="select"&&a.jsxs(be,{value:b[t.name]||"",onValueChange:p=>j(t.name,p),children:[a.jsx(ue,{className:"rounded-xl",children:a.jsx(ye,{})}),a.jsx(ge,{children:(t.options??[]).map(p=>a.jsx(xe,{value:p.value,children:p.label},p.value))})]}),t.type==="json"&&a.jsx("textarea",{id:t.name,value:u[t.name]??"{}",onChange:p=>o(ee=>({...ee,[t.name]:p.target.value})),className:"min-h-[120px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},t.name)})}),a.jsxs(ke,{className:"pt-4 flex-shrink-0",children:[a.jsx(F,{type:"button",variant:"outline",onClick:d,children:e("cancel")}),a.jsx(F,{type:"submit",disabled:c.isPending||!!y,children:c.isPending?e("saving"):e("save")}),Y.filter(t=>t.trigger==="manual").map(t=>a.jsx(F,{type:"button",onClick:()=>X(t),disabled:c.isPending||!!y,variant:"secondary",children:y===t.id?e("connecting"):t.title},t.id))]})]})]})})}const R={telegram:S,slack:ce,email:M,webhook:re,default:H},_e={telegram:"channelDescTelegram",slack:"channelDescSlack",email:"channelDescEmail",webhook:"channelDescWebhook",discord:"channelDescDiscord",feishu:"channelDescFeishu"};function Qe(){const{data:n}=_(),{data:d}=de(),{data:i}=q(),{openChannelModal:m}=J(),[c,g]=v.useState("active"),b=i==null?void 0:i.uiHints;if(!n||!d)return a.jsx("div",{className:"p-8 text-gray-400",children:e("channelsLoading")});const f=[{id:"active",label:e("channelsTabEnabled"),count:d.channels.filter(o=>{var y;return(y=n.channels[o.name])==null?void 0:y.enabled}).length},{id:"all",label:e("channelsTabAll"),count:d.channels.length}],u=d.channels.filter(o=>{var x;const y=((x=n.channels[o.name])==null?void 0:x.enabled)||!1;return c==="all"||y});return a.jsxs(Ce,{children:[a.jsx(Pe,{title:e("channelsPageTitle")}),a.jsx(Ie,{tabs:f,activeTab:c,onChange:g}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map(o=>{const y=n.channels[o.name],x=(y==null?void 0:y.enabled)||!1,l=R[o.name]||R.default,w=T(`channels.${o.name}`,b),k=(w==null?void 0:w.help)||e(_e[o.name]||"channelDescriptionDefault");return a.jsxs(De,{onClick:()=>m(o.name),children:[a.jsxs(Fe,{children:[a.jsx(Te,{name:o.name,src:Me(o.name),className:G("h-11 w-11 rounded-xl border transition-all",x?"bg-white border-primary/30":"bg-white border-gray-200/60 group-hover:border-gray-300"),imgClassName:"h-5 w-5",fallback:a.jsx(l,{className:"h-5 w-5"})}),a.jsx(Ae,{status:x?"active":"inactive",label:x?e("statusActive"):e("statusInactive")})]}),a.jsx(Le,{title:o.displayName||o.name,description:k}),a.jsxs(Ue,{children:[a.jsx(Ee,{label:x?e("actionConfigure"):e("actionEnable")}),o.tutorialUrl&&a.jsx("a",{href:o.tutorialUrl,target:"_blank",rel:"noreferrer",onClick:C=>C.stopPropagation(),className:"flex items-center justify-center h-6 w-6 rounded-md text-gray-300 hover:text-gray-500 hover:bg-gray-100/60 transition-colors",title:e("channelsGuideTitle"),children:a.jsx(ie,{className:"h-3.5 w-3.5"})})]})]},o.name)})}),u.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-14 w-14 flex items-center justify-center rounded-xl bg-gray-100/80 mb-4",children:a.jsx(H,{className:"h-6 w-6 text-gray-300"})}),a.jsx("h3",{className:"text-[14px] font-semibold text-gray-900 mb-1.5",children:e("channelsEmptyTitle")}),a.jsx("p",{className:"text-[13px] text-gray-400 max-w-sm",children:e("channelsEmptyDescription")})]}),a.jsx(He,{})]})}export{Qe as ChannelsList};
|
|
1
|
+
import{r as v,j as a,Z as ae,_ as S,a0 as M,a1 as N,W as te,X as ne,Y as le,a2 as se,a3 as oe,M as H,a4 as re,a5 as ce,a6 as ie}from"./vendor-Dkx07DIh.js";import{u as _,a as q,e as me,f as pe,I as D,c as de}from"./useConfig-Bv2DQ4BE.js";import{t as e,c as G,u as J,S as be,a as ue,b as ye,d as ge,e as xe}from"./index-CVOQiX2_.js";import{D as he,a as fe,b as we,c as je,d as ve,e as ke}from"./dialog-CqY6jnQm.js";import{B as F,P as Ce,a as Pe}from"./page-layout-CMuYE4DA.js";import{L as Ne}from"./label-C7WCjHWk.js";import{S as Se}from"./switch-DQmUTN4L.js";import{h as T}from"./config-hints-CApS3K_7.js";import{T as Ie}from"./tabs-custom-C5xYS25o.js";import{C as De,a as Fe,L as Te,d as Me,S as Ae,b as Le,c as Ue,A as Ee}from"./action-link-DNRpMv1A.js";function Be({value:n,onChange:d,className:i,placeholder:m=""}){const[c,g]=v.useState(""),b=u=>{u.key==="Enter"&&c.trim()?(u.preventDefault(),d([...n,c.trim()]),g("")):u.key==="Backspace"&&!c&&n.length>0&&d(n.slice(0,-1))},f=u=>{d(n.filter((o,y)=>y!==u))};return a.jsxs("div",{className:G("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",i),children:[n.map((u,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[u,a.jsx("button",{type:"button",onClick:()=>f(o),className:"hover:text-red-300 transition-colors",children:a.jsx(ae,{className:"h-3 w-3"})})]},o)),a.jsx("input",{type:"text",value:c,onChange:u=>g(u.target.value),onKeyDown:b,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:m||e("enterTag")})]})}const U=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],E=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],Oe=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}],$e=n=>n.includes("token")||n.includes("secret")||n.includes("password")?a.jsx(te,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("url")||n.includes("host")?a.jsx(ne,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("email")||n.includes("mail")?a.jsx(M,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("id")||n.includes("from")?a.jsx(le,{className:"h-3.5 w-3.5 text-gray-500"}):n==="enabled"||n==="consentGranted"?a.jsx(se,{className:"h-3.5 w-3.5 text-gray-500"}):a.jsx(oe,{className:"h-3.5 w-3.5 text-gray-500"});function B(){return{telegram:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"proxy",type:"text",label:e("proxy")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:U},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:E},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"gatewayUrl",type:"text",label:e("gatewayUrl")},{name:"intents",type:"number",label:e("intents")},{name:"proxy",type:"text",label:e("proxy")},{name:"mediaMaxMb",type:"number",label:e("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:e("streamingMode"),options:Oe},{name:"draftChunk",type:"json",label:e("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:e("textChunkLimit")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:U},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:E},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"bridgeUrl",type:"text",label:e("bridgeUrl")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"appSecret",type:"password",label:e("appSecret")},{name:"encryptKey",type:"password",label:e("encryptKey")},{name:"verificationToken",type:"password",label:e("verificationToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],dingtalk:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"clientId",type:"text",label:e("clientId")},{name:"clientSecret",type:"password",label:e("clientSecret")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"corpId",type:"text",label:e("corpId")},{name:"agentId",type:"text",label:e("agentId")},{name:"secret",type:"password",label:e("secret")},{name:"token",type:"password",label:e("token")},{name:"callbackPort",type:"number",label:e("callbackPort")},{name:"callbackPath",type:"text",label:e("callbackPath")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],slack:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"mode",type:"text",label:e("mode")},{name:"webhookPath",type:"text",label:e("webhookPath")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"botToken",type:"password",label:e("botToken")},{name:"appToken",type:"password",label:e("appToken")}],email:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"consentGranted",type:"boolean",label:e("consentGranted")},{name:"imapHost",type:"text",label:e("imapHost")},{name:"imapPort",type:"number",label:e("imapPort")},{name:"imapUsername",type:"text",label:e("imapUsername")},{name:"imapPassword",type:"password",label:e("imapPassword")},{name:"fromAddress",type:"email",label:e("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"baseUrl",type:"text",label:e("baseUrl")},{name:"clawToken",type:"password",label:e("clawToken")},{name:"agentUserId",type:"text",label:e("agentUserId")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"secret",type:"password",label:e("appSecret")},{name:"markdownSupport",type:"boolean",label:e("markdownSupport")},{name:"allowFrom",type:"tags",label:e("allowFrom")}]}}const O={telegram:S,slack:S,email:M,default:S},$={telegram:"from-primary-300 to-primary-600",slack:"from-primary-200 to-primary-500",email:"from-primary-100 to-primary-400",default:"from-gray-300 to-gray-500"};function I(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function K(n,d){const i={...n};for(const[m,c]of Object.entries(d)){const g=i[m];if(I(g)&&I(c)){i[m]=K(g,c);continue}i[m]=c}return i}function Re(n,d){const i=n.split("."),m={};let c=m;for(let g=0;g<i.length-1;g+=1){const b=i[g];c[b]={},c=c[b]}return c[i[i.length-1]]=d,m}function He(){var A,L;const{channelModal:n,closeChannelModal:d}=J(),{data:i}=_(),{data:m}=q(),c=me(),g=pe(),[b,f]=v.useState({}),[u,o]=v.useState({}),[y,x]=v.useState(null),l=n.channel,w=l?i==null?void 0:i.channels[l]:null,k=l?B()[l]??[]:[],C=m==null?void 0:m.uiHints,P=l?`channels.${l}`:null,Y=((A=m==null?void 0:m.actions)==null?void 0:A.filter(t=>t.scope===P))??[],z=l&&(((L=T(`channels.${l}`,C))==null?void 0:L.label)??l);v.useEffect(()=>{if(w){f({...w});const t={};(l?B()[l]??[]:[]).filter(r=>r.type==="json").forEach(r=>{const h=w[r.name];t[r.name]=JSON.stringify(h??{},null,2)}),o(t)}else f({}),o({})},[w,l]);const j=(t,s)=>{f(r=>({...r,[t]:s}))},V=t=>{if(t.preventDefault(),!l)return;const s={...b};for(const r of k){if(r.type!=="json")continue;const h=u[r.name]??"";try{s[r.name]=h.trim()?JSON.parse(h):{}}catch{N.error(`${e("invalidJson")}: ${r.name}`);return}}c.mutate({channel:l,data:s},{onSuccess:()=>d()})},W=t=>{if(!t||!l)return;const s=t.channels;if(!I(s))return;const r=s[l];I(r)&&f(h=>K(h,r))},X=async t=>{if(!(!l||!P)){x(t.id);try{let s={...b};t.saveBeforeRun&&(s={...s,...t.savePatch??{}},f(s),await c.mutateAsync({channel:l,data:s}));const r=await g.mutateAsync({actionId:t.id,data:{scope:P,draftConfig:Re(P,s)}});W(r.patch),r.ok?N.success(r.message||e("success")):N.error(r.message||e("error"))}catch(s){const r=s instanceof Error?s.message:String(s);N.error(`${e("error")}: ${r}`)}finally{x(null)}}},Z=O[l||""]||O.default,Q=$[l||""]||$.default;return a.jsx(he,{open:n.open,onOpenChange:d,children:a.jsxs(fe,{className:"sm:max-w-[550px] max-h-[85vh] overflow-hidden flex flex-col",children:[a.jsx(we,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`h-10 w-10 rounded-xl bg-gradient-to-br ${Q} flex items-center justify-center`,children:a.jsx(Z,{className:"h-5 w-5 text-white"})}),a.jsxs("div",{children:[a.jsx(je,{className:"capitalize",children:z}),a.jsx(ve,{children:e("configureMessageChannelParameters")})]})]})}),a.jsxs("form",{onSubmit:V,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar py-2 pr-2 space-y-5",children:k.map(t=>{const s=l?T(`channels.${l}.${t.name}`,C):void 0,r=(s==null?void 0:s.label)??t.label,h=s==null?void 0:s.placeholder;return a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs(Ne,{htmlFor:t.name,className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[$e(t.name),r]}),t.type==="boolean"&&a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-gray-50",children:[a.jsx("span",{className:"text-sm text-gray-500",children:b[t.name]?e("enabled"):e("disabled")}),a.jsx(Se,{id:t.name,checked:b[t.name]||!1,onCheckedChange:p=>j(t.name,p),className:"data-[state=checked]:bg-emerald-500"})]}),(t.type==="text"||t.type==="email")&&a.jsx(D,{id:t.name,type:t.type,value:b[t.name]||"",onChange:p=>j(t.name,p.target.value),placeholder:h,className:"rounded-xl"}),t.type==="password"&&a.jsx(D,{id:t.name,type:"password",value:b[t.name]||"",onChange:p=>j(t.name,p.target.value),placeholder:h??e("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),t.type==="number"&&a.jsx(D,{id:t.name,type:"number",value:b[t.name]||0,onChange:p=>j(t.name,parseInt(p.target.value)||0),placeholder:h,className:"rounded-xl"}),t.type==="tags"&&a.jsx(Be,{value:b[t.name]||[],onChange:p=>j(t.name,p)}),t.type==="select"&&a.jsxs(be,{value:b[t.name]||"",onValueChange:p=>j(t.name,p),children:[a.jsx(ue,{className:"rounded-xl",children:a.jsx(ye,{})}),a.jsx(ge,{children:(t.options??[]).map(p=>a.jsx(xe,{value:p.value,children:p.label},p.value))})]}),t.type==="json"&&a.jsx("textarea",{id:t.name,value:u[t.name]??"{}",onChange:p=>o(ee=>({...ee,[t.name]:p.target.value})),className:"min-h-[120px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},t.name)})}),a.jsxs(ke,{className:"pt-4 flex-shrink-0",children:[a.jsx(F,{type:"button",variant:"outline",onClick:d,children:e("cancel")}),a.jsx(F,{type:"submit",disabled:c.isPending||!!y,children:c.isPending?e("saving"):e("save")}),Y.filter(t=>t.trigger==="manual").map(t=>a.jsx(F,{type:"button",onClick:()=>X(t),disabled:c.isPending||!!y,variant:"secondary",children:y===t.id?e("connecting"):t.title},t.id))]})]})]})})}const R={telegram:S,slack:ce,email:M,webhook:re,default:H},_e={telegram:"channelDescTelegram",slack:"channelDescSlack",email:"channelDescEmail",webhook:"channelDescWebhook",discord:"channelDescDiscord",feishu:"channelDescFeishu"};function Qe(){const{data:n}=_(),{data:d}=de(),{data:i}=q(),{openChannelModal:m}=J(),[c,g]=v.useState("active"),b=i==null?void 0:i.uiHints;if(!n||!d)return a.jsx("div",{className:"p-8 text-gray-400",children:e("channelsLoading")});const f=[{id:"active",label:e("channelsTabEnabled"),count:d.channels.filter(o=>{var y;return(y=n.channels[o.name])==null?void 0:y.enabled}).length},{id:"all",label:e("channelsTabAll"),count:d.channels.length}],u=d.channels.filter(o=>{var x;const y=((x=n.channels[o.name])==null?void 0:x.enabled)||!1;return c==="all"||y});return a.jsxs(Ce,{children:[a.jsx(Pe,{title:e("channelsPageTitle")}),a.jsx(Ie,{tabs:f,activeTab:c,onChange:g}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map(o=>{const y=n.channels[o.name],x=(y==null?void 0:y.enabled)||!1,l=R[o.name]||R.default,w=T(`channels.${o.name}`,b),k=(w==null?void 0:w.help)||e(_e[o.name]||"channelDescriptionDefault");return a.jsxs(De,{onClick:()=>m(o.name),children:[a.jsxs(Fe,{children:[a.jsx(Te,{name:o.name,src:Me(o.name),className:G("h-11 w-11 rounded-xl border transition-all",x?"bg-white border-primary/30":"bg-white border-gray-200/60 group-hover:border-gray-300"),imgClassName:"h-5 w-5",fallback:a.jsx(l,{className:"h-5 w-5"})}),a.jsx(Ae,{status:x?"active":"inactive",label:x?e("statusActive"):e("statusInactive")})]}),a.jsx(Le,{title:o.displayName||o.name,description:k}),a.jsxs(Ue,{children:[a.jsx(Ee,{label:x?e("actionConfigure"):e("actionEnable")}),o.tutorialUrl&&a.jsx("a",{href:o.tutorialUrl,target:"_blank",rel:"noreferrer",onClick:C=>C.stopPropagation(),className:"flex items-center justify-center h-6 w-6 rounded-md text-gray-300 hover:text-gray-500 hover:bg-gray-100/60 transition-colors",title:e("channelsGuideTitle"),children:a.jsx(ie,{className:"h-3.5 w-3.5"})})]})]},o.name)})}),u.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-14 w-14 flex items-center justify-center rounded-xl bg-gray-100/80 mb-4",children:a.jsx(H,{className:"h-6 w-6 text-gray-300"})}),a.jsx("h3",{className:"text-[14px] font-semibold text-gray-900 mb-1.5",children:e("channelsEmptyTitle")}),a.jsx("p",{className:"text-[13px] text-gray-400 max-w-sm",children:e("channelsEmptyDescription")})]}),a.jsx(He,{})]})}export{Qe as ChannelsList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,a9 as j,A as D,af as L,ag as R,O as k}from"./vendor-Dkx07DIh.js";import{u as E}from"./useConfirmDialog-
|
|
1
|
+
import{r as x,j as e,a9 as j,A as D,af as L,ag as R,O as k}from"./vendor-Dkx07DIh.js";import{u as E}from"./useConfirmDialog-BOcIsqiA.js";import{l as M,m as P,n as T,o as J,I as A}from"./useConfig-Bv2DQ4BE.js";import{P as F,a as z,B as o}from"./page-layout-CMuYE4DA.js";import{c as p,t,S as B,a as I,b as Q,d as q,e as f,h as y}from"./index-CVOQiX2_.js";import{C as H,d as O}from"./card-KMt_4CgV.js";import"./dialog-CqY6jnQm.js";function g(s){return y(s??void 0)}function V(s){return typeof s!="number"||!Number.isFinite(s)?"-":y(new Date(s))}function G(s){if(typeof s!="number"||!Number.isFinite(s))return"-";const r=Math.round(s/1e3);if(r<60)return`${r}s`;const n=Math.round(r/60);if(n<60)return`${n}m`;const c=Math.round(n/60);return c<24?`${c}h`:`${Math.round(c/24)}d`}function K(s){const r=s.schedule;return r.kind==="cron"?r.expr?`cron ${r.expr}`:"cron":r.kind==="every"?`every ${G(r.everyMs)}`:r.kind==="at"?`at ${V(r.atMs)}`:"-"}function U(s){if(!s.payload.deliver)return"-";const r=s.payload.channel??"-",n=s.payload.to??"-";return`${r}:${n}`}function W(s,r){const n=r.trim().toLowerCase();return n?[s.id,s.name,s.payload.message,s.payload.channel??"",s.payload.to??""].join(" ").toLowerCase().includes(n):!0}function X(s,r){return r==="all"?!0:r==="enabled"?s.enabled:!s.enabled}function re(){var h;const[s,r]=x.useState(""),[n,c]=x.useState("all"),i=M({all:!0}),v=P(),N=T(),w=J(),{confirm:m,ConfirmDialog:C}=E(),u=x.useMemo(()=>{var l;return(((l=i.data)==null?void 0:l.jobs)??[]).filter(d=>W(d,s)).filter(d=>X(d,n))},[i.data,s,n]),b=async a=>{await m({title:`${t("cronDeleteConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,variant:"destructive",confirmLabel:t("delete")})&&v.mutate({id:a.id})},S=async a=>{const l=!a.enabled;await m({title:l?`${t("cronEnableConfirm")}?`:`${t("cronDisableConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,variant:l?"default":"destructive",confirmLabel:l?t("cronEnable"):t("cronDisable")})&&N.mutate({id:a.id,enabled:l})},$=async a=>{const l=!a.enabled;await m({title:l?`${t("cronRunForceConfirm")}?`:`${t("cronRunConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,confirmLabel:t("cronRunNow")})&&w.mutate({id:a.id,force:l})};return e.jsxs(F,{fullHeight:!0,children:[e.jsx(z,{title:t("cronPageTitle"),description:t("cronPageDescription"),actions:e.jsx(o,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>i.refetch(),children:e.jsx(j,{className:p("h-4 w-4",i.isFetching&&"animate-spin")})})}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[e.jsxs("div",{className:"relative flex-1 min-w-[240px]",children:[e.jsx(A,{value:s,onChange:a=>r(a.target.value),placeholder:t("cronSearchPlaceholder"),className:"pl-9"}),e.jsx(D,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"min-w-[180px]",children:e.jsxs(B,{value:n,onValueChange:a=>c(a),children:[e.jsx(I,{className:"w-full",children:e.jsx(Q,{placeholder:t("cronStatusLabel")})}),e.jsxs(q,{children:[e.jsx(f,{value:"all",children:t("cronStatusAll")}),e.jsx(f,{value:"enabled",children:t("cronStatusEnabled")}),e.jsx(f,{value:"disabled",children:t("cronStatusDisabled")})]})]})}),e.jsxs("div",{className:"text-xs text-gray-500 ml-auto",children:[t("cronTotalLabel"),": ",((h=i.data)==null?void 0:h.total)??0," / ",u.length]})]})}),e.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:i.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("cronLoading")}):u.length===0?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("cronEmpty")}):e.jsx("div",{className:"space-y-4",children:u.map(a=>e.jsx(H,{className:"border border-gray-200",children:e.jsx(O,{className:"pt-5 pb-5",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-[220px] flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:a.name||a.id}),e.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500",children:a.id}),e.jsx("span",{className:p("text-[10px] font-semibold px-2 py-0.5 rounded-full",a.enabled?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-500"),children:a.enabled?t("enabled"):t("disabled")}),a.deleteAfterRun&&e.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-700",children:t("cronOneShot")})]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[t("cronScheduleLabel"),": ",K(a)]}),e.jsx("div",{className:"mt-2 text-sm text-gray-700 whitespace-pre-wrap break-words",children:a.payload.message}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[t("cronDeliverTo"),": ",U(a)]})]}),e.jsxs("div",{className:"min-w-[220px] text-xs text-gray-500 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronNextRun"),":"]})," ",g(a.state.nextRunAt)]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronLastRun"),":"]})," ",g(a.state.lastRunAt)]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronLastStatus"),":"]})," ",a.state.lastStatus??"-"]}),a.state.lastError&&e.jsx("div",{className:"text-[11px] text-red-500 break-words",children:a.state.lastError})]}),e.jsxs("div",{className:"flex items-start gap-2 flex-wrap justify-end",children:[e.jsxs(o,{variant:"subtle",size:"sm",onClick:()=>$(a),className:"gap-1",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),t("cronRunNow")]}),e.jsxs(o,{variant:a.enabled?"outline":"primary",size:"sm",onClick:()=>S(a),className:"gap-1",children:[e.jsx(R,{className:"h-3.5 w-3.5"}),a.enabled?t("cronDisable"):t("cronEnable")]}),e.jsxs(o,{variant:"destructive",size:"sm",onClick:()=>b(a),className:"gap-1",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),t("delete")]})]})]})})},a.id))})}),e.jsx(C,{})]})}export{re as CronConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as t,B as K,aJ as Z,aK as q,Z as Q,aL as ee,a7 as te,aa as re,a6 as se,aM as oe}from"./vendor-Dkx07DIh.js";import{j as ae,D as W,t as x,c as B}from"./index-
|
|
1
|
+
import{r as s,j as t,B as K,aJ as Z,aK as q,Z as Q,aL as ee,a7 as te,aa as re,a6 as se,aM as oe}from"./vendor-Dkx07DIh.js";import{j as ae,D as W,t as x,c as B}from"./index-CVOQiX2_.js";function ce(){const{isOpen:C,mode:h,currentUrl:i,navVersion:f,close:P,toggleMode:U,goBack:Y,goForward:F,canGoBack:I,canGoForward:O,navigate:v,syncUrl:M}=ae(),[b,y]=s.useState(""),[j,z]=s.useState(!1),[A,m]=s.useState(!1),[l,N]=s.useState(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[a,R]=s.useState({w:480,h:600}),[E,_]=s.useState(420),c=s.useRef(null),d=s.useRef(null),p=s.useRef(null),L=s.useRef(null),X=s.useRef(f);s.useEffect(()=>{try{const e=new URL(i);y(e.pathname)}catch{y(i)}},[i]),s.useEffect(()=>{var e;if(f!==X.current){X.current=f;return}if((e=L.current)!=null&&e.contentWindow)try{const r=new URL(i).pathname;L.current.contentWindow.postMessage({type:"docs-navigate",path:r},"*")}catch{}},[i,f]),s.useEffect(()=>{h==="floating"&&N(e=>({x:Math.max(40,window.innerWidth-a.w-40),y:e.y}))},[h,a.w]),s.useEffect(()=>{const e=r=>{var o;((o=r.data)==null?void 0:o.type)==="docs-route-change"&&typeof r.data.url=="string"&&M(r.data.url)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[M]);const $=s.useCallback(e=>{e.preventDefault();const r=b.trim();r&&(r.startsWith("/")?v(`${W}${r}`):r.startsWith("http")?v(r):v(`${W}/${r}`))},[b,v]),G=s.useCallback(e=>{h==="floating"&&(z(!0),c.current={startX:e.clientX,startY:e.clientY,startPosX:l.x,startPosY:l.y})},[h,l]);s.useEffect(()=>{if(!j)return;const e=o=>{c.current&&N({x:c.current.startPosX+(o.clientX-c.current.startX),y:c.current.startPosY+(o.clientY-c.current.startY)})},r=()=>{z(!1),c.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[j]);const k=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0);const r=e.currentTarget.dataset.axis;d.current={startX:e.clientX,startY:e.clientY,startW:a.w,startH:a.h};const o=u=>{d.current&&R(g=>({w:r==="y"?g.w:Math.max(360,d.current.startW+(u.clientX-d.current.startX)),h:r==="x"?g.h:Math.max(400,d.current.startH+(u.clientY-d.current.startY))}))},w=()=>{m(!1),d.current=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",w)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",w)},[a]),T=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0),p.current={startX:e.clientX,startW:E};const r=w=>{if(!p.current)return;const u=p.current.startX-w.clientX;_(Math.max(320,Math.min(800,p.current.startW+u)))},o=()=>{m(!1),p.current=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[E]),V=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0);const r=e.clientX,o=a.w,w=l.x,u=H=>{const J=r-H.clientX,S=Math.max(360,o+J);R(D=>({...D,w:S})),N(D=>({...D,x:w-(S-o)}))},g=()=>{m(!1),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",g)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",g)},[a.w,l.x]);if(!C)return null;const n=h==="docked";return t.jsxs("div",{className:B("flex flex-col bg-white overflow-hidden relative",n?"h-full border-l border-gray-200 shrink-0":"rounded-2xl shadow-2xl border border-gray-200"),style:n?{width:E}:{position:"fixed",left:l.x,top:l.y,width:a.w,height:a.h,zIndex:9999},children:[n&&t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:T}),t.jsxs("div",{className:B("flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none",!n&&"cursor-grab active:cursor-grabbing"),onMouseDown:n?void 0:G,children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(K,{className:"w-4 h-4 text-primary"}),t.jsx("span",{className:"text-sm font-semibold text-gray-900",children:x("docBrowserTitle")})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:U,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:n?x("docBrowserFloatMode"):x("docBrowserDockMode"),children:n?t.jsx(Z,{className:"w-3.5 h-3.5"}):t.jsx(q,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:P,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:x("docBrowserClose"),children:t.jsx(Q,{className:"w-3.5 h-3.5"})})]})]}),t.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0",children:[t.jsx("button",{onClick:Y,disabled:!I,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(ee,{className:"w-4 h-4"})}),t.jsx("button",{onClick:F,disabled:!O,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(te,{className:"w-4 h-4"})}),t.jsxs("form",{onSubmit:$,className:"flex-1 relative",children:[t.jsx(re,{className:"w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),t.jsx("input",{type:"text",value:b,onChange:e=>y(e.target.value),placeholder:x("docBrowserSearchPlaceholder"),className:"w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400"})]})]}),t.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[t.jsx("iframe",{ref:L,src:i,className:"absolute inset-0 w-full h-full border-0",title:"NextClaw Documentation",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",allow:"clipboard-read; clipboard-write"},f),(A||j)&&t.jsx("div",{className:"absolute inset-0 z-10"})]}),t.jsx("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0",children:t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer","data-doc-external":!0,className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors",children:[x("docBrowserOpenExternal"),t.jsx(se,{className:"w-3 h-3"})]})}),!n&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:V}),t.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:k,"data-axis":"x"}),t.jsx("div",{className:"absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:k,"data-axis":"y"}),t.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors",onMouseDown:k,children:t.jsx(oe,{className:"w-3 h-3 rotate-[-45deg]"})})]})]})}export{ce as DocBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as a,ak as _e,al as $e,am as Oe,an as fe,ao as Fe,ap as qe,aq as N,ar as xe,as as He,at as Ke,au as Ue,av as ze,aw as Qe,ax as Be,ay as Ge,ah as he,ai as ye,aj as be,a1 as O,az as Ve,aA as Ye,aB as Xe}from"./vendor-Dkx07DIh.js";import{c as ve,i as F,t as c,S as We,a as Ze,b as Je,d as et,e as pe}from"./index-CVOQiX2_.js";import{T as me}from"./tabs-custom-C5xYS25o.js";import{P as ke}from"./dialog-CqY6jnQm.js";import{u as tt}from"./useConfirmDialog-BOcIsqiA.js";import{P as nt,a as at}from"./page-layout-CMuYE4DA.js";var[q]=Ke("Tooltip",[xe]),H=xe(),Te="TooltipProvider",st=700,G="tooltip.open",[rt,X]=q(Te),Ce=e=>{const{__scopeTooltip:t,delayDuration:n=st,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:o}=e,u=l.useRef(!0),b=l.useRef(!1),i=l.useRef(0);return l.useEffect(()=>{const h=i.current;return()=>window.clearTimeout(h)},[]),a.jsx(rt,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:l.useCallback(()=>{window.clearTimeout(i.current),u.current=!1},[]),onClose:l.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>u.current=!0,s)},[s]),isPointerInTransitRef:b,onPointerInTransitChange:l.useCallback(h=>{b.current=h},[]),disableHoverableContent:r,children:o})};Ce.displayName=Te;var L="Tooltip",[ot,D]=q(L),we=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:o,disableHoverableContent:u,delayDuration:b}=e,i=X(L,e.__scopeTooltip),h=H(t),[p,y]=l.useState(null),v=_e(),m=l.useRef(0),g=u??i.disableHoverableContent,f=b??i.delayDuration,k=l.useRef(!1),[T,C]=$e({prop:s,defaultProp:r??!1,onChange:A=>{A?(i.onOpen(),document.dispatchEvent(new CustomEvent(G))):i.onClose(),o==null||o(A)},caller:L}),j=l.useMemo(()=>T?k.current?"delayed-open":"instant-open":"closed",[T]),P=l.useCallback(()=>{window.clearTimeout(m.current),m.current=0,k.current=!1,C(!0)},[C]),w=l.useCallback(()=>{window.clearTimeout(m.current),m.current=0,C(!1)},[C]),M=l.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{k.current=!0,C(!0),m.current=0},f)},[f,C]);return l.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),a.jsx(Oe,{...h,children:a.jsx(ot,{scope:t,contentId:v,open:T,stateAttribute:j,trigger:p,onTriggerChange:y,onTriggerEnter:l.useCallback(()=>{i.isOpenDelayedRef.current?M():P()},[i.isOpenDelayedRef,M,P]),onTriggerLeave:l.useCallback(()=>{g?w():(window.clearTimeout(m.current),m.current=0)},[w,g]),onOpen:P,onClose:w,disableHoverableContent:g,children:n})})};we.displayName=L;var V="TooltipTrigger",je=l.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=D(V,n),o=X(V,n),u=H(n),b=l.useRef(null),i=fe(t,b,r.onTriggerChange),h=l.useRef(!1),p=l.useRef(!1),y=l.useCallback(()=>h.current=!1,[]);return l.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),a.jsx(Fe,{asChild:!0,...u,children:a.jsx(qe.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:i,onPointerMove:N(e.onPointerMove,v=>{v.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(r.onTriggerEnter(),p.current=!0)}),onPointerLeave:N(e.onPointerLeave,()=>{r.onTriggerLeave(),p.current=!1}),onPointerDown:N(e.onPointerDown,()=>{r.open&&r.onClose(),h.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:N(e.onFocus,()=>{h.current||r.onOpen()}),onBlur:N(e.onBlur,r.onClose),onClick:N(e.onClick,r.onClose)})})});je.displayName=V;var W="TooltipPortal",[lt,it]=q(W,{forceMount:void 0}),Pe=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,o=D(W,t);return a.jsx(lt,{scope:t,forceMount:n,children:a.jsx(ke,{present:n||o.open,children:a.jsx(He,{asChild:!0,container:r,children:s})})})};Pe.displayName=W;var I="TooltipContent",Se=l.forwardRef((e,t)=>{const n=it(I,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...o}=e,u=D(I,e.__scopeTooltip);return a.jsx(ke,{present:s||u.open,children:u.disableHoverableContent?a.jsx(Ne,{side:r,...o,ref:t}):a.jsx(ct,{side:r,...o,ref:t})})}),ct=l.forwardRef((e,t)=>{const n=D(I,e.__scopeTooltip),s=X(I,e.__scopeTooltip),r=l.useRef(null),o=fe(t,r),[u,b]=l.useState(null),{trigger:i,onClose:h}=n,p=r.current,{onPointerInTransitChange:y}=s,v=l.useCallback(()=>{b(null),y(!1)},[y]),m=l.useCallback((g,f)=>{const k=g.currentTarget,T={x:g.clientX,y:g.clientY},C=gt(T,k.getBoundingClientRect()),j=ft(T,C),P=xt(f.getBoundingClientRect()),w=yt([...j,...P]);b(w),y(!0)},[y]);return l.useEffect(()=>()=>v(),[v]),l.useEffect(()=>{if(i&&p){const g=k=>m(k,p),f=k=>m(k,i);return i.addEventListener("pointerleave",g),p.addEventListener("pointerleave",f),()=>{i.removeEventListener("pointerleave",g),p.removeEventListener("pointerleave",f)}}},[i,p,m,v]),l.useEffect(()=>{if(u){const g=f=>{const k=f.target,T={x:f.clientX,y:f.clientY},C=(i==null?void 0:i.contains(k))||(p==null?void 0:p.contains(k)),j=!ht(T,u);C?v():j&&(v(),h())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[i,p,u,h,v]),a.jsx(Ne,{...e,ref:o})}),[ut,dt]=q(L,{isInside:!1}),pt=Be("TooltipContent"),Ne=l.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:o,onPointerDownOutside:u,...b}=e,i=D(I,n),h=H(n),{onClose:p}=i;return l.useEffect(()=>(document.addEventListener(G,p),()=>document.removeEventListener(G,p)),[p]),l.useEffect(()=>{if(i.trigger){const y=v=>{const m=v.target;m!=null&&m.contains(i.trigger)&&p()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[i.trigger,p]),a.jsx(Ue,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:y=>y.preventDefault(),onDismiss:p,children:a.jsxs(ze,{"data-state":i.stateAttribute,...h,...b,ref:t,style:{...b.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(pt,{children:s}),a.jsx(ut,{scope:n,isInside:!0,children:a.jsx(Qe,{id:i.contentId,role:"tooltip",children:r||s})})]})})});Se.displayName=I;var Ee="TooltipArrow",mt=l.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=H(n);return dt(Ee,n).isInside?null:a.jsx(Ge,{...r,...s,ref:t})});mt.displayName=Ee;function gt(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,r,o)){case o:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function ft(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function xt(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function ht(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const b=t[o],i=t[u],h=b.x,p=b.y,y=i.x,v=i.y;p>s!=v>s&&n<(y-h)*(s-p)/(v-p)+h&&(r=!r)}return r}function yt(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),bt(t)}function bt(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const o=t[t.length-1],u=t[t.length-2];if((o.x-u.x)*(r.y-u.y)>=(o.y-u.y)*(r.x-u.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const o=n[n.length-1],u=n[n.length-2];if((o.x-u.x)*(r.y-u.y)>=(o.y-u.y)*(r.x-u.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vt=Ce,kt=we,Tt=je,Ct=Pe,Ie=Se;const wt=vt,Q=kt,B=Tt,$=l.forwardRef(({className:e,sideOffset:t=4,...n},s)=>a.jsx(Ct,{children:a.jsx(Ie,{ref:s,sideOffset:t,className:ve("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));$.displayName=Ie.displayName;function K(e){return e==="plugin"?"plugins":"skills"}async function jt(e){var o,u;const t=new URLSearchParams,n=K(e.type);(o=e.q)!=null&&o.trim()&&t.set("q",e.q.trim()),(u=e.tag)!=null&&u.trim()&&t.set("tag",e.tag.trim()),e.sort&&t.set("sort",e.sort),typeof e.page=="number"&&Number.isFinite(e.page)&&t.set("page",String(Math.max(1,Math.trunc(e.page)))),typeof e.pageSize=="number"&&Number.isFinite(e.pageSize)&&t.set("pageSize",String(Math.max(1,Math.trunc(e.pageSize))));const s=t.toString(),r=await F.get(s?`/api/marketplace/${n}/items?${s}`:`/api/marketplace/${n}/items`);if(!r.ok)throw new Error(r.error.message);return r.data}async function Pt(e){const t=K(e.type),n=await F.post(`/api/marketplace/${t}/install`,e);if(!n.ok)throw new Error(n.error.message);return n.data}async function St(e){const t=K(e),n=await F.get(`/api/marketplace/${t}/installed`);if(!n.ok)throw new Error(n.error.message);return n.data}async function Nt(e){const t=K(e.type),n=await F.post(`/api/marketplace/${t}/manage`,e);if(!n.ok)throw new Error(n.error.message);return n.data}function Et(e){return he({queryKey:["marketplace-items",e],queryFn:()=>jt(e),staleTime:15e3})}function It(e){return he({queryKey:["marketplace-installed",e],queryFn:()=>St(e),staleTime:1e4})}function Mt(){const e=ye();return be({mutationFn:t=>Pt(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed",t.type]}),e.refetchQueries({queryKey:["marketplace-installed",t.type],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"}),O.success(t.message||`${t.type} ${c("marketplaceInstalledCountSuffix")}`)},onError:t=>{O.error(t.message||c("marketplaceInstallFailed"))}})}function Rt(){const e=ye();return be({mutationFn:t=>Nt(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed",t.type]}),e.invalidateQueries({queryKey:["marketplace-items"]}),e.refetchQueries({queryKey:["marketplace-installed",t.type],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"}),O.success(t.message||`${t.action} success`)},onError:t=>{O.error(t.message||c("marketplaceOperationFailed"))}})}const Lt=12;function Y(e){return(e??"").trim().toLowerCase()}function E(e,t){const n=Y(t);return n.length>0?`${e}:${n}`:""}function Dt(e){const t=new Map;for(const n of e){const s=[n.install.spec,n.slug,n.id];for(const r of s){const o=E(n.type,r);!o||t.has(o)||t.set(o,n)}}return t}function At(e){const t=new Map;for(const n of e){const s=[n.spec,n.id,n.label];for(const r of s){const o=E(n.type,r);!o||t.has(o)||t.set(o,n)}}return t}function _t(e,t){const n=[e.install.spec,e.slug,e.id];for(const s of n){const r=E(e.type,s);if(!r)continue;const o=t.get(r);if(o)return o}}function $t(e,t){const n=t.get(E(e.type,e.spec));if(n)return n;const s=t.get(E(e.type,e.id));return s||t.get(E(e.type,e.label))}function Ot(e,t,n){const s=Y(n);return s?[e.id,e.spec,e.label,t==null?void 0:t.name,t==null?void 0:t.slug,t==null?void 0:t.summary,...(t==null?void 0:t.tags)??[]].map(o=>Y(o)).filter(Boolean).some(o=>o.includes(s)):!0}function Ft(e){const t=["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"];let n=0;for(let s=0;s<e.length;s++)n=e.charCodeAt(s)+((n<<5)-n);return t[Math.abs(n)%t.length]}function qt({name:e,fallback:t}){const n=e||t,s=n.substring(0,2).toUpperCase(),r=Ft(n);return a.jsx("div",{className:ve("flex items-center justify-center w-10 h-10 rounded-xl text-white font-semibold text-sm shrink-0",r),children:s})}function Ht(e){return a.jsx("div",{className:"mb-4",children:a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.jsx(Xe,{className:"h-4 w-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{value:e.searchText,onChange:t=>e.onSearchTextChange(t.target.value),placeholder:c("marketplaceSearchPlaceholder"),className:"w-full h-9 border border-gray-200/80 rounded-xl pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40"})]}),e.scope==="all"&&a.jsxs(We,{value:e.sort,onValueChange:t=>e.onSortChange(t),children:[a.jsx(Ze,{className:"h-9 w-[150px] shrink-0 rounded-lg",children:a.jsx(Je,{})}),a.jsxs(et,{children:[a.jsx(pe,{value:"relevance",children:c("marketplaceSortRelevance")}),a.jsx(pe,{value:"updated",children:c("marketplaceSortUpdated")})]})]})]})})}function ge(e){var k,T,C,j;const t=e.record,n=(t==null?void 0:t.type)==="plugin"?t:void 0,s=((k=e.item)==null?void 0:k.type)??(t==null?void 0:t.type),r=((T=e.item)==null?void 0:T.name)??(t==null?void 0:t.label)??(t==null?void 0:t.id)??(t==null?void 0:t.spec)??c("marketplaceUnknownItem"),o=((C=e.item)==null?void 0:C.summary)??(t?c("marketplaceInstalledLocalSummary"):""),u=((j=e.item)==null?void 0:j.install.spec)??(t==null?void 0:t.spec)??"",b=(t==null?void 0:t.id)||(t==null?void 0:t.spec),i=!!b&&e.manageState.isPending&&e.manageState.targetId===b,h=!!n,p=(t==null?void 0:t.type)==="plugin"&&t.origin!=="bundled",y=(t==null?void 0:t.type)==="skill"&&t.source==="workspace",v=!!(p||y),m=t?t.enabled===!1||t.runtimeStatus==="disabled":!1,g=e.installState.isPending&&e.item&&e.installState.installingSpec===e.item.install.spec,f=s==="plugin"?c("marketplaceTypePlugin"):s==="skill"?c("marketplaceTypeSkill"):c("marketplaceTypeExtension");return a.jsxs("article",{className:"group bg-white border border-gray-200/40 hover:border-gray-200/80 rounded-2xl px-5 py-4 hover:shadow-md shadow-sm transition-all flex items-start gap-3.5 justify-between cursor-default",children:[a.jsxs("div",{className:"flex gap-3 min-w-0 flex-1 h-full items-start",children:[a.jsx(qt,{name:r,fallback:u||c("marketplaceTypeExtension")}),a.jsx("div",{className:"min-w-0 flex-1 flex flex-col justify-center h-full",children:a.jsxs(wt,{delayDuration:400,children:[a.jsxs(Q,{children:[a.jsx(B,{asChild:!0,children:a.jsx("div",{className:"text-[14px] font-semibold text-gray-900 truncate leading-tight cursor-default",children:r})}),a.jsx($,{className:"max-w-[300px] text-xs",children:r})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 mb-1.5",children:[a.jsx("span",{className:"text-[11px] text-gray-500 font-medium",children:f}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[10px] text-gray-300",children:"•"}),a.jsxs(Q,{children:[a.jsx(B,{asChild:!0,children:a.jsx("span",{className:"text-[11px] text-gray-400 truncate max-w-full font-mono cursor-default",children:u})}),a.jsx($,{className:"max-w-[300px] text-xs font-mono break-all",children:u})]})]})]}),a.jsxs(Q,{children:[a.jsx(B,{asChild:!0,children:a.jsx("p",{className:"text-[12px] text-gray-500/90 line-clamp-1 transition-colors leading-relaxed text-left cursor-default",children:o})}),o&&a.jsx($,{className:"max-w-[400px] text-xs leading-relaxed",children:o})]})]})})]}),a.jsxs("div",{className:"shrink-0 flex items-center h-full",children:[e.item&&!t&&a.jsx("button",{onClick:()=>e.onInstall(e.item),disabled:e.installState.isPending,className:"inline-flex items-center gap-1.5 h-8 px-4 rounded-xl text-xs font-medium bg-primary text-white hover:bg-primary-600 disabled:opacity-50 transition-colors",children:g?c("marketplaceInstalling"):c("marketplaceInstall")}),n&&h&&a.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage(m?"enable":"disable",n),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-gray-200/80 text-gray-600 bg-white hover:bg-gray-50 hover:border-gray-300 disabled:opacity-50 transition-colors",children:i&&e.manageState.action!=="uninstall"?e.manageState.action==="enable"?c("marketplaceEnabling"):c("marketplaceDisabling"):m?c("marketplaceEnable"):c("marketplaceDisable")}),t&&v&&a.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage("uninstall",t),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-rose-100 text-rose-500 bg-white hover:bg-rose-50 hover:border-rose-200 disabled:opacity-50 transition-colors",children:i&&e.manageState.action==="uninstall"?c("marketplaceRemoving"):c("marketplaceUninstall")})]})]})}function Kt(e){return a.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[a.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onPrev,disabled:e.page<=1||e.busy,children:c("prev")}),a.jsx("div",{className:"text-sm text-gray-600 min-w-20 text-center",children:e.totalPages===0?"0 / 0":`${e.page} / ${e.totalPages}`}),a.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onNext,disabled:e.totalPages===0||e.page>=e.totalPages||e.busy,children:c("next")})]})}function Yt(){var ae,se,re,oe,le,ie,ce,ue,de;const e=Ve(),t=Ye(),n=l.useMemo(()=>t.type==="plugins"||t.type==="skills"?t.type:null,[t.type]);l.useEffect(()=>{n||e("/marketplace/plugins",{replace:!0})},[n,e]);const s=n==="skills"?"skill":"plugin",[r,o]=l.useState(""),[u,b]=l.useState(""),[i,h]=l.useState("all"),[p,y]=l.useState("relevance"),[v,m]=l.useState(1);l.useEffect(()=>{const d=setTimeout(()=>{m(1),b(r.trim())},250);return()=>clearTimeout(d)},[r]),l.useEffect(()=>{m(1)},[s]);const g=It(s),f=Et({q:u||void 0,type:s,sort:p,page:v,pageSize:Lt}),k=Mt(),T=Rt(),{confirm:C,ConfirmDialog:j}=tt(),P=l.useMemo(()=>{var d;return((d=g.data)==null?void 0:d.records)??[]},[(ae=g.data)==null?void 0:ae.records]),w=l.useMemo(()=>{var d;return((d=f.data)==null?void 0:d.items)??[]},[(se=f.data)==null?void 0:se.items]),M=l.useMemo(()=>Dt(w),[w]),A=l.useMemo(()=>At(P),[P]),R=l.useMemo(()=>{const d=P.filter(x=>x.type===s).map(x=>({key:`${x.type}:${x.spec}:${x.id??""}`,record:x,item:$t(x,M)})).filter(x=>Ot(x.record,x.item,u));return d.sort((x,S)=>{const _=x.record.installedAt?Date.parse(x.record.installedAt):Number.NaN,z=S.record.installedAt?Date.parse(S.record.installedAt):Number.NaN,De=!Number.isNaN(_),Ae=!Number.isNaN(z);return De&&Ae&&_!==z?z-_:x.record.spec.localeCompare(S.record.spec)}),d},[P,s,M,u]),Z=i==="installed"?R.length:((re=f.data)==null?void 0:re.total)??0,U=i==="installed"?1:((oe=f.data)==null?void 0:oe.totalPages)??0,Me=l.useMemo(()=>i==="installed"?g.isLoading?c("loading"):`${R.length} ${c("marketplaceInstalledCountSuffix")}`:f.data?`${w.length} / ${Z}`:c("loading"),[i,g.isLoading,R.length,f.data,w.length,Z]),J={isPending:k.isPending,installingSpec:(le=k.variables)==null?void 0:le.spec},ee={isPending:T.isPending,targetId:((ie=T.variables)==null?void 0:ie.id)||((ce=T.variables)==null?void 0:ce.spec),action:(ue=T.variables)==null?void 0:ue.action},Re=[{id:"all",label:c("marketplaceTabMarketplace")},{id:"installed",label:c("marketplaceTabInstalled"),count:((de=g.data)==null?void 0:de.total)??0}],Le=[{id:"plugins",label:c("marketplaceFilterPlugins")},{id:"skills",label:c("marketplaceFilterSkills")}],te=d=>{k.isPending||k.mutate({type:d.type,spec:d.install.spec,kind:d.install.kind})},ne=async(d,x)=>{if(T.isPending)return;const S=x.id||x.spec;S&&(d==="uninstall"&&!await C({title:`${c("marketplaceUninstallTitle")} ${S}?`,description:c("marketplaceUninstallDescription"),confirmLabel:c("marketplaceUninstall"),variant:"destructive"})||T.mutate({type:x.type,action:d,id:S,spec:x.spec}))};return a.jsxs(nt,{children:[a.jsx(at,{title:c("marketplacePageTitle"),description:c("marketplacePageDescription")}),a.jsx(me,{tabs:Le,activeTab:n??"plugins",onChange:d=>{const x=d==="skills"?"skills":"plugins";n!==x&&e(`/marketplace/${x}`)},className:"mb-4"}),a.jsx(me,{tabs:Re,activeTab:i,onChange:d=>{h(d),m(1)},className:"mb-4"}),a.jsx(Ht,{scope:i,searchText:r,sort:p,onSearchTextChange:o,onSortChange:d=>{m(1),y(d)}}),a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"text-[14px] font-semibold text-gray-900",children:[i==="installed"?c("marketplaceSectionInstalled"):c("marketplaceSectionExtensions")," · ",s==="plugin"?c("marketplaceFilterPlugins"):c("marketplaceFilterSkills")]}),a.jsx("span",{className:"text-[12px] text-gray-500",children:Me})]}),i==="all"&&f.isError&&a.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c("marketplaceErrorLoadingData"),": ",f.error.message]}),i==="installed"&&g.isError&&a.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c("marketplaceErrorLoadingInstalled"),": ",g.error.message]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-3",children:[i==="all"&&w.map(d=>a.jsx(ge,{item:d,record:_t(d,A),installState:J,manageState:ee,onInstall:te,onManage:ne},d.id)),i==="installed"&&R.map(d=>a.jsx(ge,{item:d.item,record:d.record,installState:J,manageState:ee,onInstall:te,onManage:ne},d.key))]}),i==="all"&&!f.isLoading&&!f.isError&&w.length===0&&a.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c("marketplaceNoItems")}),i==="installed"&&!g.isLoading&&!g.isError&&R.length===0&&a.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c("marketplaceNoInstalledItems")})]}),i==="all"&&a.jsx(Kt,{page:v,totalPages:U,busy:f.isFetching,onPrev:()=>m(d=>Math.max(1,d-1)),onNext:()=>m(d=>U>0?Math.min(U,d+1):d+1)}),a.jsx(j,{})]})}export{Yt as MarketplacePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as c,m as M,F as k,D as C,E as P}from"./vendor-Dkx07DIh.js";import{P as S,a as E,B as F}from"./page-layout-
|
|
1
|
+
import{j as e,r as c,m as M,F as k,D as C,E as P}from"./vendor-Dkx07DIh.js";import{P as S,a as E,B as F}from"./page-layout-CMuYE4DA.js";import{C as b}from"./card-KMt_4CgV.js";import{u as L,a as T,b as D,I as w}from"./useConfig-Bv2DQ4BE.js";import{L as p}from"./label-C7WCjHWk.js";import{c as I,t,f as B}from"./index-CVOQiX2_.js";import{h as u}from"./config-hints-CApS3K_7.js";function s({className:l,...i}){return e.jsx("div",{className:I("animate-pulse rounded-md bg-slate-200",l),...i})}function G(){const{data:l,isLoading:i}=L(),{data:n}=T(),o=D(),[g,j]=c.useState(""),[y,f]=c.useState(""),[m,N]=c.useState(8192),x=n==null?void 0:n.uiHints,r=u("agents.defaults.model",x),d=u("agents.defaults.workspace",x),h=u("agents.defaults.maxTokens",x);c.useEffect(()=>{var a;(a=l==null?void 0:l.agents)!=null&&a.defaults&&(j(l.agents.defaults.model||""),f(l.agents.defaults.workspace||""),N(l.agents.defaults.maxTokens||8192))},[l]);const v=a=>{a.preventDefault(),o.mutate({model:g,maxTokens:m})};return i?e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-8 w-32"}),e.jsx(s,{className:"h-4 w-48"})]}),e.jsxs(b,{className:"rounded-2xl border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(s,{className:"h-12 w-12 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-5 w-24"}),e.jsx(s,{className:"h-3 w-32"})]})]}),e.jsx(s,{className:"h-4 w-20 mb-2"}),e.jsx(s,{className:"h-10 w-full rounded-xl"})]}),e.jsxs(b,{className:"rounded-2xl border-gray-200 p-6",children:[e.jsx(s,{className:"h-5 w-24 mb-2"}),e.jsx(s,{className:"h-3 w-40 mb-6"}),e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx(s,{className:"h-4 w-28 mb-3"}),e.jsx(s,{className:"h-2 w-full rounded-full"})]})})]})]}):e.jsxs(S,{children:[e.jsx(E,{title:t("modelPageTitle"),description:t("modelPageDescription")}),e.jsxs("form",{onSubmit:v,className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"p-8 rounded-2xl bg-white border border-gray-200 shadow-card",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center text-white",children:e.jsx(M,{className:"h-5 w-5"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t("defaultModel")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"model",className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:(r==null?void 0:r.label)??"Model Name"}),e.jsx(w,{id:"model",value:g,onChange:a=>j(a.target.value),placeholder:(r==null?void 0:r.placeholder)??"minimax/MiniMax-M2.1",className:"h-12 px-4 rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-400",children:(r==null?void 0:r.help)??"Examples: minimax/MiniMax-M2.5 · minimax/MiniMax-M2.1 · openrouter/anthropic/claude-3.5-sonnet · openrouter/openai/gpt-4o-mini"})]})]}),e.jsxs("div",{className:"p-8 rounded-2xl bg-white border border-gray-200 shadow-card",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center text-white",children:e.jsx(k,{className:"h-5 w-5"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t("workspace")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"workspace",className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:(d==null?void 0:d.label)??"Default Path"}),e.jsx(w,{id:"workspace",value:y,onChange:a=>f(a.target.value),placeholder:(d==null?void 0:d.placeholder)??"/path/to/workspace",className:"h-12 px-4 rounded-xl"})]})]})]}),e.jsxs("div",{className:"p-8 rounded-2xl bg-white border border-gray-200 shadow-card",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-10",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center text-white",children:e.jsx(C,{className:"h-5 w-5"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t("generationParameters")})]}),e.jsx("div",{className:"grid grid-cols-1 gap-12",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx(p,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:(h==null?void 0:h.label)??t("maxTokens")}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:B(m)})]}),e.jsx("input",{type:"range",min:"1000",max:"32000",step:"1000",value:m,onChange:a=>N(parseInt(a.target.value)),className:"w-full h-1 bg-gray-200 rounded-full appearance-none cursor-pointer accent-primary"})]})})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(F,{type:"submit",disabled:o.isPending,size:"lg",children:o.isPending?e.jsx(P,{className:"h-5 w-5 animate-spin"}):t("saveChanges")})})]})]})}export{G as ModelConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as e,J as I,K as R,O as V,U as z,W as k,X as U,Y as B}from"./vendor-Dkx07DIh.js";import{I as E,u as L,c as O,a as F,d as H}from"./useConfig-
|
|
1
|
+
import{r as v,j as e,J as I,K as R,O as V,U as z,W as k,X as U,Y as B}from"./vendor-Dkx07DIh.js";import{I as E,u as L,c as O,a as F,d as H}from"./useConfig-Bv2DQ4BE.js";import{t as s,c as S,u as W,S as G,a as J,b as X,d as Y,e as _}from"./index-CVOQiX2_.js";import{D as q,a as Q,b as Z,c as ee,d as se,e as ae}from"./dialog-CqY6jnQm.js";import{B as A,P as te,a as re}from"./page-layout-CMuYE4DA.js";import{L as P}from"./label-C7WCjHWk.js";import{h as w}from"./config-hints-CApS3K_7.js";import{T as ie}from"./tabs-custom-C5xYS25o.js";import{C as le,a as ne,L as oe,g as ce,S as de,b as xe,c as me,A as pe}from"./action-link-DNRpMv1A.js";function he({maskedValue:l,isSet:n,className:m,...p}){const[x,g]=v.useState(!1);return e.jsxs("div",{className:"relative",children:[e.jsx(E,{type:x?"text":"password",className:S("pr-20",m),placeholder:n?`${s("apiKeySet")} (${s("unchanged")})`:"",...p}),e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:(n||l)&&e.jsx(A,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(!x),children:x?e.jsx(I,{className:"h-4 w-4"}):e.jsx(R,{className:"h-4 w-4"})})})]})}function ue({value:l,onChange:n,className:m}){const p=l?Object.entries(l):[],x=(h,o,a)=>{const r=[...p];r[h]=[o,a],n(Object.fromEntries(r))},g=()=>{n({...l,"":""})},f=h=>{const o=p.filter((a,r)=>r!==h);n(Object.fromEntries(o))};return e.jsxs("div",{className:S("space-y-2",m),children:[p.map(([h,o],a)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(E,{type:"text",value:h,onChange:r=>x(a,r.target.value,o),placeholder:s("headerName"),className:"flex-1"}),e.jsx(E,{type:"text",value:o,onChange:r=>x(a,h,r.target.value),placeholder:s("headerValue"),className:"flex-1"}),e.jsx(A,{type:"button",variant:"ghost",size:"icon",onClick:()=>f(a),children:e.jsx(V,{className:"h-4 w-4 text-red-500"})})]},a)),e.jsxs(A,{type:"button",variant:"outline",size:"sm",onClick:g,children:[e.jsx(z,{className:"h-4 w-4 mr-2"}),s("add")]})]})}function ge(){const{providerModal:l,closeProviderModal:n}=W(),{data:m}=L(),{data:p}=O(),{data:x}=F(),g=H(),[f,h]=v.useState(""),[o,a]=v.useState(""),[r,j]=v.useState(null),[y,C]=v.useState("auto"),c=l.provider,t=p==null?void 0:p.providers.find(i=>i.name===c),d=c?m==null?void 0:m.providers[c]:null,K=x==null?void 0:x.uiHints,N=c?w(`providers.${c}.apiKey`,K):void 0,u=c?w(`providers.${c}.apiBase`,K):void 0,D=c?w(`providers.${c}.extraHeaders`,K):void 0,T=c?w(`providers.${c}.wireApi`,K):void 0;v.useEffect(()=>{if(d){a(d.apiBase||(t==null?void 0:t.defaultApiBase)||""),j(d.extraHeaders||null),h("");const i=d.wireApi||(t==null?void 0:t.defaultWireApi)||"auto";C(i)}},[d,t]);const $=i=>{i.preventDefault();const b={};if(f!==""&&(b.apiKey=f),o&&o!==(t==null?void 0:t.defaultApiBase)&&(b.apiBase=o),r&&Object.keys(r).length>0&&(b.extraHeaders=r),t!=null&&t.supportsWireApi){const M=(d==null?void 0:d.wireApi)||t.defaultWireApi||"auto";y!==M&&(b.wireApi=y)}c&&g.mutate({provider:c,data:b},{onSuccess:()=>n()})};return e.jsx(q,{open:l.open,onOpenChange:n,children:e.jsxs(Q,{className:"sm:max-w-[500px]",children:[e.jsx(Z,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center",children:e.jsx(k,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx(ee,{children:(t==null?void 0:t.displayName)||c}),e.jsx(se,{children:s("providerFormDescription")})]})]})}),e.jsxs("form",{onSubmit:$,className:"flex flex-col pt-2",children:[e.jsxs("div",{className:"space-y-5 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(P,{htmlFor:"apiKey",className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[e.jsx(k,{className:"h-3.5 w-3.5 text-gray-500"}),(N==null?void 0:N.label)??s("apiKey")]}),e.jsx(he,{id:"apiKey",value:f,isSet:d==null?void 0:d.apiKeySet,onChange:i=>h(i.target.value),placeholder:d!=null&&d.apiKeySet?s("apiKeySet"):(N==null?void 0:N.placeholder)??s("enterApiKey"),className:"rounded-xl"})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(P,{htmlFor:"apiBase",className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[e.jsx(U,{className:"h-3.5 w-3.5 text-gray-500"}),(u==null?void 0:u.label)??s("apiBase")]}),e.jsx(E,{id:"apiBase",type:"text",value:o,onChange:i=>a(i.target.value),placeholder:(t==null?void 0:t.defaultApiBase)||(u==null?void 0:u.placeholder)||"https://api.example.com",className:"rounded-xl"}),(u==null?void 0:u.help)&&e.jsx("p",{className:"text-xs text-gray-500",children:u.help})]}),(t==null?void 0:t.supportsWireApi)&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(P,{htmlFor:"wireApi",className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[e.jsx(B,{className:"h-3.5 w-3.5 text-gray-500"}),(T==null?void 0:T.label)??s("wireApi")]}),e.jsxs(G,{value:y,onValueChange:i=>C(i),children:[e.jsx(J,{className:"rounded-xl",children:e.jsx(X,{})}),e.jsx(Y,{children:(t.wireApiOptions||["auto","chat","responses"]).map(i=>e.jsx(_,{value:i,children:i==="chat"?s("wireApiChat"):i==="responses"?s("wireApiResponses"):s("wireApiAuto")},i))})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(P,{className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[e.jsx(B,{className:"h-3.5 w-3.5 text-gray-500"}),(D==null?void 0:D.label)??s("extraHeaders")]}),e.jsx(ue,{value:r,onChange:j})]})]}),e.jsxs(ae,{className:"pt-4 flex-shrink-0",children:[e.jsx(A,{type:"button",variant:"outline",onClick:n,children:s("cancel")}),e.jsx(A,{type:"submit",disabled:g.isPending,children:g.isPending?s("saving"):s("save")})]})]})]})})}function Ke(){const{data:l}=L(),{data:n}=O(),{data:m}=F(),{openProviderModal:p}=W(),[x,g]=v.useState("installed"),f=m==null?void 0:m.uiHints;if(!l||!n)return e.jsx("div",{className:"p-8",children:s("providersLoading")});const h=[{id:"installed",label:s("providersTabConfigured"),count:l.providers?Object.keys(l.providers).filter(a=>l.providers[a].apiKeySet).length:0},{id:"all",label:s("providersTabAll"),count:n.providers.length}],o=x==="installed"?n.providers.filter(a=>{var r;return(r=l.providers[a.name])==null?void 0:r.apiKeySet}):n.providers;return e.jsxs(te,{children:[e.jsx(re,{title:s("providersPageTitle")}),e.jsx(ie,{tabs:h,activeTab:x,onChange:g}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:o.map(a=>{const r=l.providers[a.name],j=r==null?void 0:r.apiKeySet,y=w(`providers.${a.name}`,f),C=(y==null?void 0:y.help)||s("providersDefaultDescription");return e.jsxs(le,{onClick:()=>p(a.name),children:[e.jsxs(ne,{children:[e.jsx(oe,{name:a.name,src:ce(a.name),className:S("h-11 w-11 rounded-xl border transition-all",j?"bg-white border-primary/30":"bg-white border-gray-200/60 group-hover:border-gray-300"),imgClassName:"h-6 w-6",fallback:e.jsx("span",{className:S("text-base font-semibold uppercase",j?"text-gray-800":"text-gray-400"),children:a.name[0]})}),e.jsx(de,{status:j?"ready":"setup",label:j?s("statusReady"):s("statusSetup")})]}),e.jsx(xe,{title:a.displayName||a.name,description:C}),e.jsx(me,{children:e.jsx(pe,{label:j?s("actionConfigure"):s("actionAddProvider")})})]},a.name)})}),o.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"h-14 w-14 flex items-center justify-center rounded-xl bg-gray-100/80 mb-4",children:e.jsx(k,{className:"h-6 w-6 text-gray-300"})}),e.jsx("h3",{className:"text-[14px] font-semibold text-gray-900 mb-1.5",children:s("providersEmptyTitle")}),e.jsx("p",{className:"text-[13px] text-gray-400 max-w-sm",children:s("providersEmptyDescription")})]}),e.jsx(ge,{})]})}export{Ke as ProvidersList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as e,O as Y,U as Z,a8 as le,a1 as H}from"./vendor-Dkx07DIh.js";import{u as oe,a as ce,g as de,I as d}from"./useConfig-
|
|
1
|
+
import{r as p,j as e,O as Y,U as Z,a8 as le,a1 as H}from"./vendor-Dkx07DIh.js";import{u as oe,a as ce,g as de,I as d}from"./useConfig-Bv2DQ4BE.js";import{P as ie,a as me,B as N}from"./page-layout-CMuYE4DA.js";import{C as O,a as B,b as M,c as R,d as $}from"./card-KMt_4CgV.js";import{S as he}from"./switch-DQmUTN4L.js";import{t,S as ee,a as ae,b as se,d as te,e as P}from"./index-CVOQiX2_.js";import{h as I}from"./config-hints-CApS3K_7.js";const ue=[{value:"main",label:"main"},{value:"per-peer",label:"per-peer"},{value:"per-channel-peer",label:"per-channel-peer"},{value:"per-account-channel-peer",label:"per-account-channel-peer"}];function pe(){return{id:"",default:!1,workspace:"",model:"",maxTokens:void 0,contextTokens:void 0,maxToolIterations:void 0}}function xe(){return{agentId:"",match:{channel:"",accountId:""}}}function z(i){const w=i.trim();if(!w)return;const x=Number.parseInt(w,10);return Number.isFinite(x)?x:void 0}function ye(){const{data:i,isLoading:w}=oe(),{data:x}=ce(),_=de(),[S,y]=p.useState([]),[D,b]=p.useState([]),[L,q]=p.useState("per-channel-peer"),[K,F]=p.useState(0),[V,U]=p.useState(2e5);p.useEffect(()=>{var a,r,n;i&&(y((i.agents.list??[]).map(s=>({id:s.id??"",default:!!s.default,workspace:s.workspace??"",model:s.model??"",maxTokens:s.maxTokens,contextTokens:s.contextTokens,maxToolIterations:s.maxToolIterations}))),b((i.bindings??[]).map(s=>{var o,l,c;return{agentId:s.agentId??"",match:{channel:((o=s.match)==null?void 0:o.channel)??"",accountId:((l=s.match)==null?void 0:l.accountId)??"",peer:(c=s.match)!=null&&c.peer?{kind:s.match.peer.kind,id:s.match.peer.id}:void 0}}})),q(((a=i.session)==null?void 0:a.dmScope)??"per-channel-peer"),F(((n=(r=i.session)==null?void 0:r.agentToAgent)==null?void 0:n.maxPingPongTurns)??0),U(i.agents.defaults.contextTokens??2e5))},[i]);const g=x==null?void 0:x.uiHints,h=I("session.dmScope",g),j=I("session.agentToAgent.maxPingPongTurns",g),f=I("agents.defaults.contextTokens",g),A=I("agents.list.*.contextTokens",g),v=I("agents.list",g),k=I("bindings",g),re=p.useMemo(()=>{const a=new Set(["main"]);return S.forEach(r=>{const n=r.id.trim();n&&a.add(n)}),a},[S]),u=(a,r)=>{y(n=>n.map((s,o)=>o===a?{...s,...r}:s))},T=(a,r)=>{b(n=>n.map((s,o)=>o===a?r:s))},ne=()=>{try{const a=S.map((s,o)=>{var m,C;const l=s.id.trim();if(!l)throw new Error(t("agentIdRequiredError").replace("{index}",String(o)));const c={id:l};return s.default&&(c.default=!0),(m=s.workspace)!=null&&m.trim()&&(c.workspace=s.workspace.trim()),(C=s.model)!=null&&C.trim()&&(c.model=s.model.trim()),typeof s.maxTokens=="number"&&(c.maxTokens=s.maxTokens),typeof s.contextTokens=="number"&&(c.contextTokens=Math.max(1e3,s.contextTokens)),typeof s.maxToolIterations=="number"&&(c.maxToolIterations=s.maxToolIterations),c}),r=a.map(s=>s.id).filter((s,o,l)=>l.indexOf(s)!==o);if(r.length>0){H.error(`${t("duplicateAgentId")}: ${r[0]}`);return}const n=D.map((s,o)=>{var J,Q,W,X;const l=s.agentId.trim(),c=s.match.channel.trim(),m=((J=s.match.accountId)==null?void 0:J.trim())??"",C=(Q=s.match.peer)==null?void 0:Q.kind,G=((X=(W=s.match.peer)==null?void 0:W.id)==null?void 0:X.trim())??"";if(!l)throw new Error(t("bindingAgentIdRequired").replace("{index}",String(o)));if(!re.has(l))throw new Error(`${t("bindingAgentIdNotFound").replace("{index}",String(o))}: ${l}`);if(!c)throw new Error(t("bindingChannelRequired").replace("{index}",String(o)));const E={agentId:l,match:{channel:c}};if(m&&(E.match.accountId=m),C){if(!G)throw new Error(t("bindingPeerIdRequired").replace("{index}",String(o)));E.match.peer={kind:C,id:G}}return E});_.mutate({data:{agents:{defaults:{contextTokens:Math.max(1e3,V)},list:a},bindings:n,session:{dmScope:L,agentToAgent:{maxPingPongTurns:Math.min(5,Math.max(0,K))}}}})}catch(a){const r=a instanceof Error?a.message:String(a);H.error(r)}};return w||!i?e.jsx("div",{className:"p-8 text-gray-400",children:t("runtimeLoading")}):e.jsxs(ie,{className:"space-y-6",children:[e.jsx(me,{title:t("runtimePageTitle"),description:t("runtimePageDescription")}),e.jsxs(O,{children:[e.jsxs(B,{children:[e.jsx(M,{children:(h==null?void 0:h.label)??t("dmScope")}),e.jsx(R,{children:(h==null?void 0:h.help)??t("dmScopeHelp")})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(f==null?void 0:f.label)??t("defaultContextTokens")}),e.jsx(d,{type:"number",min:1e3,step:1e3,value:V,onChange:a=>U(Math.max(1e3,Number.parseInt(a.target.value,10)||1e3))}),e.jsx("p",{className:"text-xs text-gray-500",children:(f==null?void 0:f.help)??t("defaultContextTokensHelp")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(h==null?void 0:h.label)??t("dmScope")}),e.jsxs(ee,{value:L,onValueChange:a=>q(a),children:[e.jsx(ae,{children:e.jsx(se,{})}),e.jsx(te,{children:ue.map(a=>e.jsx(P,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(j==null?void 0:j.label)??t("maxPingPongTurns")}),e.jsx(d,{type:"number",min:0,max:5,value:K,onChange:a=>F(Math.max(0,Number.parseInt(a.target.value,10)||0))}),e.jsx("p",{className:"text-xs text-gray-500",children:(j==null?void 0:j.help)??t("maxPingPongTurnsHelp")})]})]})]}),e.jsxs(O,{children:[e.jsxs(B,{children:[e.jsx(M,{children:(v==null?void 0:v.label)??t("agentList")}),e.jsx(R,{children:(v==null?void 0:v.help)??t("agentListHelp")})]}),e.jsxs($,{className:"space-y-3",children:[S.map((a,r)=>e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(d,{value:a.id,onChange:n=>u(r,{id:n.target.value}),placeholder:t("agentIdPlaceholder")}),e.jsx(d,{value:a.workspace??"",onChange:n=>u(r,{workspace:n.target.value}),placeholder:t("workspaceOverridePlaceholder")}),e.jsx(d,{value:a.model??"",onChange:n=>u(r,{model:n.target.value}),placeholder:t("modelOverridePlaceholder")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[e.jsx(d,{type:"number",min:1,value:a.maxTokens??"",onChange:n=>u(r,{maxTokens:z(n.target.value)}),placeholder:t("maxTokensPlaceholder")}),e.jsx(d,{type:"number",min:1e3,step:1e3,value:a.contextTokens??"",onChange:n=>u(r,{contextTokens:z(n.target.value)}),placeholder:(A==null?void 0:A.label)??t("contextTokensPlaceholder")}),e.jsx(d,{type:"number",min:1,value:a.maxToolIterations??"",onChange:n=>u(r,{maxToolIterations:z(n.target.value)}),placeholder:t("maxToolsPlaceholder")})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(he,{checked:!!a.default,onCheckedChange:n=>{if(!n){u(r,{default:!1});return}y(s=>s.map((o,l)=>({...o,default:l===r})))}}),e.jsx("span",{children:t("defaultAgent")})]}),e.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:()=>y(n=>n.filter((s,o)=>o!==r)),children:[e.jsx(Y,{className:"h-4 w-4 mr-1"}),t("remove")]})]})]},`${r}-${a.id}`)),e.jsxs(N,{type:"button",variant:"outline",onClick:()=>y(a=>[...a,pe()]),children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),t("addAgent")]})]})]}),e.jsxs(O,{children:[e.jsxs(B,{children:[e.jsx(M,{children:(k==null?void 0:k.label)??t("bindings")}),e.jsx(R,{children:(k==null?void 0:k.help)??t("bindingsHelp")})]}),e.jsxs($,{className:"space-y-3",children:[D.map((a,r)=>{var s,o;const n=((s=a.match.peer)==null?void 0:s.kind)??"";return e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[e.jsx(d,{value:a.agentId,onChange:l=>T(r,{...a,agentId:l.target.value}),placeholder:t("targetAgentIdPlaceholder")}),e.jsx(d,{value:a.match.channel,onChange:l=>T(r,{...a,match:{...a.match,channel:l.target.value}}),placeholder:t("channelPlaceholder")}),e.jsx(d,{value:a.match.accountId??"",onChange:l=>T(r,{...a,match:{...a.match,accountId:l.target.value}}),placeholder:t("accountIdOptionalPlaceholder")}),e.jsxs(ee,{value:n||"__none__",onValueChange:l=>{var m;const c=l==="__none__"?"":l;if(!c){T(r,{...a,match:{...a.match,peer:void 0}});return}T(r,{...a,match:{...a.match,peer:{kind:c,id:((m=a.match.peer)==null?void 0:m.id)??""}}})},children:[e.jsx(ae,{children:e.jsx(se,{})}),e.jsxs(te,{children:[e.jsx(P,{value:"__none__",children:t("peerKindOptional")}),e.jsx(P,{value:"direct",children:"direct"}),e.jsx(P,{value:"group",children:"group"}),e.jsx(P,{value:"channel",children:"channel"})]})]}),e.jsx(d,{value:((o=a.match.peer)==null?void 0:o.id)??"",onChange:l=>T(r,{...a,match:{...a.match,peer:n?{kind:n,id:l.target.value}:void 0}}),placeholder:t("peerIdPlaceholder")})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:()=>b(l=>l.filter((c,m)=>m!==r)),children:[e.jsx(Y,{className:"h-4 w-4 mr-1"}),t("remove")]})})]},`${r}-${a.agentId}`)}),e.jsxs(N,{type:"button",variant:"outline",onClick:()=>b(a=>[...a,xe()]),children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),t("addBinding")]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(N,{type:"button",onClick:ne,disabled:_.isPending,children:[e.jsx(le,{className:"h-4 w-4 mr-2"}),_.isPending?t("saving"):t("saveRuntimeSettings")]})})]})}export{ye as RuntimeConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as l,j as e,a9 as A,aa as Y,ab as K,Y as $,a3 as W,_ as U,ac as G,ad as J,ae as X}from"./vendor-Dkx07DIh.js";import{u as Z}from"./useConfirmDialog-
|
|
1
|
+
import{r as l,j as e,a9 as A,aa as Y,ab as K,Y as $,a3 as W,_ as U,ac as G,ad as J,ae as X}from"./vendor-Dkx07DIh.js";import{u as Z}from"./useConfirmDialog-BOcIsqiA.js";import{h as ee,i as se,j as te,k as ae,I as S}from"./useConfig-Bv2DQ4BE.js";import{P as re,a as le,B as u}from"./page-layout-CMuYE4DA.js";import{t,c as i,S as ne,a as ie,b as oe,d as de,e as T,g as ce,h as xe}from"./index-CVOQiX2_.js";import"./dialog-CqY6jnQm.js";const g="__unknown_channel__";function me(a){return xe(a)}function j(a){const n=a.indexOf(":");return n<=0?g:a.slice(0,n).trim()||g}function C(a){return a===g?t("sessionsUnknownChannel"):a}function he({session:a,channel:n,isSelected:d,onSelect:f}){const r=C(n),b=a.label||a.key.split(":").pop()||a.key;return e.jsxs("button",{onClick:f,className:i("w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group",d?"bg-brand-50 border border-brand-100/50":"bg-transparent border border-transparent hover:bg-gray-50/80"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-1.5",children:[e.jsx("div",{className:i("font-semibold truncate pr-2 flex-1 text-sm",d?"text-brand-800":"text-gray-900"),children:b}),e.jsx("div",{className:i("text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize",d?"bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]":"bg-gray-100 text-gray-500"),children:r})]}),e.jsxs("div",{className:i("flex items-center text-xs justify-between mt-2 font-medium",d?"text-brand-600/80":"text-gray-400"),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(G,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{className:"truncate max-w-[100px]",children:ce(a.updatedAt)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{children:a.messageCount})]})]})]})}function ue({message:a}){const n=a.role.toLowerCase()==="user";return e.jsx("div",{className:i("flex w-full mb-6",n?"justify-end":"justify-start"),children:e.jsxs("div",{className:i("max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm",n?"bg-primary text-white rounded-tr-sm":"bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50"),children:[e.jsx("div",{className:"shrink-0 pt-0.5",children:n?e.jsx(J,{className:"w-4 h-4 text-primary-100"}):e.jsx(X,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("div",{className:"flex-1 space-y-1 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4 mb-2",children:[e.jsx("span",{className:i("font-semibold text-xs",n?"text-primary-50":"text-gray-900 capitalize"),children:a.role}),e.jsx("span",{className:i("text-[10px]",n?"text-primary-200":"text-gray-400"),children:me(a.timestamp)})]}),e.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-[15px]",children:a.content})]})]})})}function ve(){var z,H,E;const[a,n]=l.useState(""),[d]=l.useState(100),[f]=l.useState(0),[r,b]=l.useState(null),[p,B]=l.useState("all"),[M,v]=l.useState(""),[L,N]=l.useState(""),[w,k]=l.useState(!1),F=l.useMemo(()=>({q:a.trim()||void 0,limit:d,activeMinutes:f}),[a,d,f]),h=ee(F),x=se(r,200),y=te(),_=ae(),{confirm:D,ConfirmDialog:Q}=Z(),c=l.useMemo(()=>{var s;return((s=h.data)==null?void 0:s.sessions)??[]},[(z=h.data)==null?void 0:z.sessions]),o=l.useMemo(()=>c.find(s=>s.key===r),[c,r]),q=l.useMemo(()=>{const s=new Set;for(const m of c)s.add(j(m.key));return Array.from(s).sort((m,I)=>m===g?1:I===g?-1:m.localeCompare(I))},[c]),P=l.useMemo(()=>p==="all"?c:c.filter(s=>j(s.key)===p),[c,p]);l.useEffect(()=>{o?(v(o.label||""),N(o.preferredModel||"")):(v(""),N("")),k(!1)},[o]);const O=()=>{r&&(y.mutate({key:r,data:{label:M.trim()||null,preferredModel:L.trim()||null}}),k(!1))},R=async()=>{if(!r)return;await D({title:t("sessionsClearHistory")+"?",variant:"destructive",confirmLabel:t("sessionsClearHistory")})&&y.mutate({key:r,data:{clearHistory:!0}})},V=async()=>{if(!r)return;await D({title:t("sessionsDeleteConfirm")+"?",variant:"destructive",confirmLabel:t("sessionsDeleteConfirm")})&&_.mutate({key:r},{onSuccess:()=>b(null)})};return e.jsxs(re,{fullHeight:!0,children:[e.jsx(le,{title:t("sessionsPageTitle"),description:t("sessionsPageDescription")}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 relative",children:[e.jsxs("div",{className:"w-[320px] flex flex-col shrink-0 bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-4 border-b border-gray-100 bg-white z-10 shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:[c.length," ",t("sessionsListTitle")]}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>h.refetch(),children:e.jsx(A,{className:i("h-3.5 w-3.5",h.isFetching&&"animate-spin")})})]}),e.jsxs(ne,{value:p,onValueChange:B,children:[e.jsx(ie,{className:"w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700",children:e.jsx(oe,{placeholder:t("sessionsAllChannels")})}),e.jsxs(de,{className:"rounded-xl shadow-lg border-gray-100 max-w-[280px]",children:[e.jsx(T,{value:"all",className:"rounded-lg text-xs",children:t("sessionsAllChannels")}),q.map(s=>e.jsx(T,{value:s,className:"rounded-lg text-xs truncate pr-6",children:C(s)},s))]})]}),e.jsxs("div",{className:"relative w-full",children:[e.jsx(Y,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),e.jsx(S,{value:a,onChange:s=>n(s.target.value),placeholder:t("sessionsSearchPlaceholder"),className:"pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-1 pb-10 custom-scrollbar relative",children:h.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("sessionsLoading")}):P.length===0?e.jsxs("div",{className:"text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4",children:[e.jsx(K,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),t("sessionsEmpty")]}):P.map(s=>e.jsx(he,{session:s,channel:j(s.key),isSelected:r===s.key,onSelect:()=>b(s.key)},s.key))})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200",children:[(y.isPending||_.isPending)&&e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20",children:e.jsx("div",{className:"h-full bg-primary animate-pulse w-1/3 rounded-r-full"})}),r&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-gray-100 bg-white px-8 py-5 z-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0",children:e.jsx($,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-1.5",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 tracking-tight",children:o.label||o.key.split(":").pop()||o.key}),e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest",children:C(j(o.key))})]}),e.jsx("div",{className:"text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70",title:r,children:r})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>k(!w),className:i("h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold",w?"bg-gray-100 text-gray-900":"hover:bg-gray-50 hover:text-gray-900"),children:[e.jsx(W,{className:"w-3.5 h-3.5 mr-1.5"}),t("sessionsMetadata")]}),e.jsx(u,{variant:"outline",size:"sm",onClick:R,className:"h-8.5 rounded-lg shadow-none hover:bg-gray-50 hover:text-gray-900 border-gray-200 text-xs font-semibold text-gray-500",children:t("sessionsClearHistory")}),e.jsx(u,{variant:"outline",size:"sm",onClick:V,className:"h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500",children:t("delete")})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in",children:[e.jsx(S,{placeholder:t("sessionsLabelPlaceholder"),value:M,onChange:s=>v(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(S,{placeholder:t("sessionsModelPlaceholder"),value:L,onChange:s=>N(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(u,{size:"sm",onClick:O,className:"h-8 px-4 shrink-0 shadow-none",disabled:y.isPending,children:t("sessionsSaveMeta")})]})]}),e.jsxs("div",{className:`flex-1 overflow-y-auto p-6 relative
|
|
2
2
|
[&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full`,children:[x.isLoading&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx(A,{className:"w-6 h-6 text-primary animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-gray-500",children:t("sessionsHistoryLoading")})]})}),x.error&&e.jsx("div",{className:"text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm",children:x.error.message}),!x.isLoading&&((H=x.data)==null?void 0:H.messages.length)===0&&e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(U,{className:"w-12 h-12 mb-3 text-gray-300"}),e.jsx("p",{className:"text-sm",children:t("sessionsEmpty")})]}),e.jsx("div",{className:"max-w-3xl mx-auto",children:(((E=x.data)==null?void 0:E.messages)??[]).map((s,m)=>e.jsx(ue,{message:s},`${s.timestamp}-${m}`))})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3",children:e.jsx(K,{className:"h-8 w-8 text-gray-300 -rotate-3"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:t("sessionsNoSelectionTitle")}),e.jsx("p",{className:"text-sm text-center max-w-sm leading-relaxed",children:t("sessionsNoSelectionDescription")})]})]})]}),e.jsx(Q,{})]})}export{ve as SessionsConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as s,a7 as m}from"./vendor-Dkx07DIh.js";import{c as r}from"./index-
|
|
1
|
+
import{r as d,j as s,a7 as m}from"./vendor-Dkx07DIh.js";import{c as r}from"./index-CVOQiX2_.js";function v({name:e,src:t,className:a,imgClassName:o,fallback:i}){const[g,l]=d.useState(!1),c=!!t&&!g;return s.jsx("div",{className:r("flex items-center justify-center",a),children:c?s.jsx("img",{src:t,alt:`${e} logo`,className:r("h-6 w-6 object-contain",o),onError:()=>l(!0),draggable:!1}):i??s.jsx("span",{className:"text-lg font-bold uppercase",children:e.slice(0,1)})})}const x={openrouter:"openrouter.svg",aihubmix:"aihubmix.png",anthropic:"anthropic.svg",openai:"openai.svg",gemini:"gemini.svg",deepseek:"deepseek.png",zhipu:"zhipu.svg",dashscope:"dashscope.png",moonshot:"moonshot.png",minimax:"minimax.svg",vllm:"vllm.svg",groq:"groq.svg"},u={telegram:"telegram.svg",slack:"slack.svg",discord:"discord.svg",whatsapp:"whatsapp.svg",qq:"qq.svg",feishu:"feishu.svg",dingtalk:"dingtalk.svg",wecom:"wecom.svg",mochat:"mochat.svg",email:"email.svg"};function n(e,t){const a=t.toLowerCase(),o=e[a];return o?`/logos/${o}`:null}function b(e){return n(x,e)}function y(e){return n(u,e)}function j({children:e,onClick:t,className:a}){return s.jsx("div",{onClick:t,className:r("group relative flex flex-col p-6 rounded-2xl border border-gray-200/50 bg-white shadow-card","transition-all duration-base cursor-pointer","hover:shadow-card-hover hover:border-gray-200",a),children:e})}function w({children:e,className:t}){return s.jsx("div",{className:r("flex items-start justify-between mb-4",t),children:e})}function N({title:e,description:t,className:a}){return s.jsxs("div",{className:r("flex-1",a),children:[s.jsx("h3",{className:"text-[14px] font-bold text-gray-900 mb-0.5",children:e}),t&&s.jsx("p",{className:"text-[12px] text-gray-400 leading-relaxed line-clamp-2",children:t})]})}function C({children:e,className:t}){return s.jsx("div",{className:r("mt-4 pt-3 flex items-center justify-between",t),children:e})}const p={active:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},ready:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},inactive:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},setup:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},warning:{dot:"bg-amber-400",text:"text-amber-600",bg:"bg-amber-50"}};function L({status:e,label:t,className:a}){const o=p[e];return s.jsxs("div",{className:r("flex items-center gap-1.5 px-2 py-0.5 rounded-full",o.bg,a),children:[s.jsx("span",{className:r("h-1.5 w-1.5 rounded-full",o.dot)}),s.jsx("span",{className:r("text-[11px] font-medium",o.text),children:t})]})}function k({label:e,className:t,onClick:a}){return s.jsxs("span",{onClick:a,className:r("inline-flex items-center gap-1 text-[13px] font-medium text-gray-600 hover:text-primary transition-colors cursor-pointer group/action",t),children:[e,s.jsx(m,{className:"h-3 w-3 transition-transform group-hover/action:translate-x-0.5"})]})}export{k as A,j as C,v as L,L as S,w as a,N as b,C as c,y as d,b as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as t}from"./vendor-Dkx07DIh.js";import{c as d}from"./index-
|
|
1
|
+
import{r as s,j as t}from"./vendor-Dkx07DIh.js";import{c as d}from"./index-CVOQiX2_.js";const i=s.forwardRef(({className:a,hover:e=!0,...r},o)=>t.jsx("div",{ref:o,className:d("rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base",e&&"hover:shadow-card-hover hover:border-gray-200",a),...r}));i.displayName="Card";const c=s.forwardRef(({className:a,...e},r)=>t.jsx("div",{ref:r,className:d("flex flex-col space-y-1.5 p-6",a),...e}));c.displayName="CardHeader";const l=s.forwardRef(({className:a,...e},r)=>t.jsx("h3",{ref:r,className:d("text-[15px] font-semibold leading-tight tracking-tight text-gray-900",a),...e}));l.displayName="CardTitle";const n=s.forwardRef(({className:a,...e},r)=>t.jsx("p",{ref:r,className:d("text-[13px] text-gray-400 leading-relaxed",a),...e}));n.displayName="CardDescription";const p=s.forwardRef(({className:a,...e},r)=>t.jsx("div",{ref:r,className:d("p-6 pt-0",a),...e}));p.displayName="CardContent";const x=s.forwardRef(({className:a,...e},r)=>t.jsx("div",{ref:r,className:d("flex items-center justify-between p-6 pt-0",a),...e}));x.displayName="CardFooter";export{i as C,c as a,l as b,n as c,p as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,an as C,aC as b,al as ee,j as s,ak as A,as as te,ap as D,aq as v,at as ne,aD as oe,aE as ae,aF as re,aG as se,au as ie,aH as ce,aI as le,Z as de}from"./vendor-Dkx07DIh.js";import{c as x}from"./index-
|
|
1
|
+
import{r as i,an as C,aC as b,al as ee,j as s,ak as A,as as te,ap as D,aq as v,at as ne,aD as oe,aE as ae,aF as re,aG as se,au as ie,aH as ce,aI as le,Z as de}from"./vendor-Dkx07DIh.js";import{c as x}from"./index-CVOQiX2_.js";function ue(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var E=e=>{const{present:t,children:n}=e,o=fe(t),a=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),r=C(o.ref,ge(a));return typeof n=="function"||o.isPresent?i.cloneElement(a,{ref:r}):null};E.displayName="Presence";function fe(e){const[t,n]=i.useState(),o=i.useRef(null),a=i.useRef(e),r=i.useRef("none"),c=e?"mounted":"unmounted",[d,u]=ue(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const l=h(o.current);r.current=d==="mounted"?l:"none"},[d]),b(()=>{const l=o.current,g=a.current;if(g!==e){const y=r.current,p=h(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(g&&y!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),b(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const J=h(o.current).includes(CSS.escape(p.animationName));if(p.target===t&&J&&(u("ANIMATION_END"),!a.current)){const Q=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=Q)})}},y=p=>{p.target===t&&(r.current=h(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:i.useCallback(l=>{o.current=l?getComputedStyle(l):null,n(l)},[])}}function h(e){return(e==null?void 0:e.animationName)||"none"}function ge(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var O="Dialog",[M]=ne(O),[me,f]=M(O),w=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:a,onOpenChange:r,modal:c=!0}=e,d=i.useRef(null),u=i.useRef(null),[l,g]=ee({prop:o,defaultProp:a??!1,onChange:r,caller:O});return s.jsx(me,{scope:t,triggerRef:d,contentRef:u,contentId:A(),titleId:A(),descriptionId:A(),open:l,onOpenChange:g,onOpenToggle:i.useCallback(()=>g(m=>!m),[g]),modal:c,children:n})};w.displayName=O;var T="DialogTrigger",pe=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(T,n),r=C(t,a.triggerRef);return s.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":I(a.open),...o,ref:r,onClick:v(e.onClick,a.onOpenToggle)})});pe.displayName=T;var P="DialogPortal",[Ne,j]=M(P,{forceMount:void 0}),S=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:a}=e,r=f(P,t);return s.jsx(Ne,{scope:t,forceMount:n,children:i.Children.map(o,c=>s.jsx(E,{present:n||r.open,children:s.jsx(te,{asChild:!0,container:a,children:c})}))})};S.displayName=P;var R="DialogOverlay",F=i.forwardRef((e,t)=>{const n=j(R,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=f(R,e.__scopeDialog);return r.modal?s.jsx(E,{present:o||r.open,children:s.jsx(ve,{...a,ref:t})}):null});F.displayName=R;var xe=ce("DialogOverlay.RemoveScroll"),ve=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(R,n);return s.jsx(ae,{as:xe,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(D.div,{"data-state":I(a.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),N="DialogContent",W=i.forwardRef((e,t)=>{const n=j(N,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=f(N,e.__scopeDialog);return s.jsx(E,{present:o||r.open,children:r.modal?s.jsx(De,{...a,ref:t}):s.jsx(ye,{...a,ref:t})})});W.displayName=N;var De=i.forwardRef((e,t)=>{const n=f(N,e.__scopeDialog),o=i.useRef(null),a=C(t,n.contentRef,o);return i.useEffect(()=>{const r=o.current;if(r)return oe(r)},[]),s.jsx(L,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,r=>{var c;r.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,r=>{const c=r.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&r.preventDefault()}),onFocusOutside:v(e.onFocusOutside,r=>r.preventDefault())})}),ye=i.forwardRef((e,t)=>{const n=f(N,e.__scopeDialog),o=i.useRef(!1),a=i.useRef(!1);return s.jsx(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,r),r.defaultPrevented||(o.current||(d=n.triggerRef.current)==null||d.focus(),r.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:r=>{var u,l;(u=e.onInteractOutside)==null||u.call(e,r),r.defaultPrevented||(o.current=!0,r.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=r.target;((l=n.triggerRef.current)==null?void 0:l.contains(c))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&a.current&&r.preventDefault()}})}),L=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:r,...c}=e,d=f(N,n),u=i.useRef(null),l=C(t,u);return re(),s.jsxs(s.Fragment,{children:[s.jsx(se,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:r,children:s.jsx(ie,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":I(d.open),...c,ref:l,onDismiss:()=>d.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(he,{titleId:d.titleId}),s.jsx(Ce,{contentRef:u,descriptionId:d.descriptionId})]})]})}),_="DialogTitle",k=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(_,n);return s.jsx(D.h2,{id:a.titleId,...o,ref:t})});k.displayName=_;var U="DialogDescription",$=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(U,n);return s.jsx(D.p,{id:a.descriptionId,...o,ref:t})});$.displayName=U;var G="DialogClose",H=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(G,n);return s.jsx(D.button,{type:"button",...o,ref:t,onClick:v(e.onClick,()=>a.onOpenChange(!1))})});H.displayName=G;function I(e){return e?"open":"closed"}var z="DialogTitleWarning",[Se,B]=le(z,{contentName:N,titleName:_,docsSlug:"dialog"}),he=({titleId:e})=>{const t=B(z),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-
|
|
2
|
-
import{t as pe,c as ge,r as a,j as n,T as X,I as fe,C as Z,S as ee,a as ze,b as ne,P as xe,d as te,V as ye,L as se,e as ae,f as we,g as be,h as Se,i as oe,R as ke,k as Pe,l as Ie,m as Ce,M as ve,G as Te,H as Ae,A as De,n as je,N as Le,o as Ne,p as Me,B as Ee,q as Re,Q as Ue,u as Oe,s as _e,v as Be,w as z,x as D,$ as Fe,y as He,z as Ve}from"./vendor-Dkx07DIh.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=s(r);fetch(r.href,c)}})();const We="modulepreload",$e=function(e){return"/"+e},W={},b=function(t,s,o){let r=Promise.resolve();if(s&&s.length>0){let l=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),w=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));r=l(s.map(m=>{if(m=$e(m),m in W)return;W[m]=!0;const g=m.endsWith(".css"),f=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${f}`))return;const i=document.createElement("link");if(i.rel=g?"stylesheet":We,g||(i.as="script"),i.crossOrigin="",i.href=m,w&&i.setAttribute("nonce",w),document.head.appendChild(i),g)return new Promise((P,d)=>{i.addEventListener("load",P),i.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(l){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=l,window.dispatchEvent(h),!h.defaultPrevented)throw l}return r.then(l=>{for(const h of l||[])h.status==="rejected"&&c(h.reason);return t().catch(c)})};function x(...e){return pe(ge(e))}const re="nextclaw.ui.language",$=[{value:"en",label:"English"},{value:"zh",label:"中文"}],Ge={en:"en-US",zh:"zh-CN"};let C="en",L=!1;const N=new Set;function Ke(e){return e==="en"||e==="zh"}function qe(){var t;return typeof navigator>"u"?"en":(((t=navigator.language)==null?void 0:t.toLowerCase())??"en").startsWith("zh")?"zh":"en"}function Je(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(re);if(Ke(e))return e}catch{}return qe()}function B(){return L||(C=Je(),L=!0),C}function k(){return L?C:B()}function Qe(e){if(B(),C!==e){if(C=e,typeof window<"u")try{window.localStorage.setItem(re,e)}catch{}N.forEach(t=>t(e))}}function Ye(e){return N.add(e),()=>{N.delete(e)}}function F(e=k()){return Ge[e]}function jn(e,t=k()){if(!e)return"-";const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?typeof e=="string"?e:"-":s.toLocaleString(F(t))}function Ln(e,t=k()){if(!e)return"-";const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?typeof e=="string"?e:"-":new Intl.DateTimeFormat(F(t),{year:"numeric",month:"2-digit",day:"2-digit"}).format(s)}function Nn(e,t=k()){return new Intl.NumberFormat(F(t)).format(e)}const G={model:{zh:"模型",en:"Model"},providers:{zh:"提供商",en:"Providers"},channels:{zh:"渠道",en:"Channels"},cron:{zh:"定时任务",en:"Cron Jobs"},runtime:{zh:"路由与运行时",en:"Routing & Runtime"},marketplace:{zh:"市场",en:"Marketplace"},enabled:{zh:"启用",en:"Enabled"},disabled:{zh:"禁用",en:"Disabled"},save:{zh:"保存",en:"Save"},cancel:{zh:"取消",en:"Cancel"},delete:{zh:"删除",en:"Delete"},add:{zh:"添加",en:"Add"},edit:{zh:"编辑",en:"Edit"},loading:{zh:"加载中...",en:"Loading..."},success:{zh:"成功",en:"Success"},error:{zh:"错误",en:"Error"},confirm:{zh:"确认",en:"Confirm"},unchanged:{zh:"未修改",en:"Unchanged"},saving:{zh:"保存中...",en:"Saving..."},remove:{zh:"移除",en:"Remove"},all:{zh:"全部",en:"All"},prev:{zh:"上一页",en:"Prev"},next:{zh:"下一页",en:"Next"},language:{zh:"语言",en:"Language"},theme:{zh:"主题",en:"Theme"},themeWarm:{zh:"暖色",en:"Warm"},themeCool:{zh:"冷色",en:"Cool"},modelPageTitle:{zh:"模型配置",en:"Model Configuration"},modelPageDescription:{zh:"配置默认 AI 模型和运行参数限制",en:"Configure default AI model and runtime limits"},defaultModel:{zh:"默认模型",en:"Default Model"},workspace:{zh:"工作空间",en:"Workspace"},generationParameters:{zh:"生成参数",en:"Generation Parameters"},modelName:{zh:"模型",en:"Model"},maxTokens:{zh:"最大 Token 数",en:"Max Tokens"},maxToolIterations:{zh:"最大工具迭代次数",en:"Max Tool Iterations"},saveChanges:{zh:"保存变更",en:"Save Changes"},providersPageTitle:{zh:"AI 提供商",en:"AI Providers"},providersLoading:{zh:"加载中...",en:"Loading..."},providersTabConfigured:{zh:"已配置",en:"Configured"},providersTabAll:{zh:"全部提供商",en:"All Providers"},providersDefaultDescription:{zh:"为你的 Agent 配置 AI 服务",en:"Configure AI services for your agents"},providersEmptyTitle:{zh:"尚未配置提供商",en:"No providers configured"},providersEmptyDescription:{zh:"添加一个 AI 提供商后即可开始使用。",en:"Add an AI provider to start using the platform."},apiKey:{zh:"API 密钥",en:"API Key"},apiBase:{zh:"API Base",en:"API Base"},extraHeaders:{zh:"额外请求头",en:"Extra Headers"},wireApi:{zh:"请求接口",en:"Wire API"},wireApiAuto:{zh:"自动(优先 Chat,必要时 Responses)",en:"Auto (Chat with fallback)"},wireApiChat:{zh:"Chat Completions",en:"Chat Completions"},wireApiResponses:{zh:"Responses",en:"Responses"},apiKeySet:{zh:"已设置",en:"Set"},apiKeyNotSet:{zh:"未设置",en:"Not Set"},showKey:{zh:"显示密钥",en:"Show Key"},hideKey:{zh:"隐藏密钥",en:"Hide Key"},providerFormDescription:{zh:"配置 AI 提供商的 API 密钥与参数",en:"Configure API keys and parameters for AI provider"},enterApiKey:{zh:"请输入 API 密钥",en:"Enter API Key"},leaveBlankToKeepUnchanged:{zh:"留空则保持不变",en:"Leave blank to keep unchanged"},channelsPageTitle:{zh:"消息渠道",en:"Message Channels"},channelsLoading:{zh:"加载渠道中...",en:"Loading channels..."},channelsTabEnabled:{zh:"已启用",en:"Enabled"},channelsTabAll:{zh:"全部渠道",en:"All Channels"},channelsEmptyTitle:{zh:"暂无启用渠道",en:"No channels enabled"},channelsEmptyDescription:{zh:"启用一个消息渠道以开始接收消息。",en:"Enable a messaging channel to start receiving messages."},channelDescriptionDefault:{zh:"配置该通信渠道",en:"Configure this communication channel"},channelDescTelegram:{zh:"连接 Telegram 机器人以进行即时消息收发",en:"Connect with Telegram bots for instant messaging"},channelDescSlack:{zh:"接入 Slack 工作区进行团队协作消息处理",en:"Integrate with Slack workspaces for team collaboration"},channelDescEmail:{zh:"通过邮件协议收发消息",en:"Send and receive messages via email protocols"},channelDescWebhook:{zh:"接收 HTTP Webhook 以支持自定义集成",en:"Receive HTTP webhooks for custom integrations"},channelDescDiscord:{zh:"将 Discord 机器人连接到你的社区服务器",en:"Connect Discord bots to your community servers"},channelDescFeishu:{zh:"企业消息与协作平台接入",en:"Enterprise messaging and collaboration platform"},configureMessageChannelParameters:{zh:"配置消息渠道参数",en:"Configure message channel parameters"},channelsGuideTitle:{zh:"查看指南",en:"View Guide"},allowFrom:{zh:"允许来源",en:"Allow From"},token:{zh:"Token",en:"Token"},botToken:{zh:"Bot Token",en:"Bot Token"},appToken:{zh:"App Token",en:"App Token"},appId:{zh:"App ID",en:"App ID"},corpId:{zh:"企业 ID",en:"Corp ID"},agentId:{zh:"应用 Agent ID",en:"Agent ID"},appSecret:{zh:"App Secret",en:"App Secret"},markdownSupport:{zh:"Markdown 支持",en:"Markdown Support"},clientId:{zh:"Client ID",en:"Client ID"},clientSecret:{zh:"Client Secret",en:"Client Secret"},encryptKey:{zh:"加密密钥",en:"Encrypt Key"},verificationToken:{zh:"验证令牌",en:"Verification Token"},bridgeUrl:{zh:"桥接 URL",en:"Bridge URL"},gatewayUrl:{zh:"网关 URL",en:"Gateway URL"},proxy:{zh:"代理",en:"Proxy"},intents:{zh:"Intents",en:"Intents"},mode:{zh:"模式",en:"Mode"},webhookPath:{zh:"Webhook 路径",en:"Webhook Path"},callbackPort:{zh:"回调端口",en:"Callback Port"},callbackPath:{zh:"回调路径",en:"Callback Path"},groupPolicy:{zh:"群组策略",en:"Group Policy"},consentGranted:{zh:"同意条款",en:"Consent Granted"},imapHost:{zh:"IMAP 服务器",en:"IMAP Host"},imapPort:{zh:"IMAP 端口",en:"IMAP Port"},imapUsername:{zh:"IMAP 用户名",en:"IMAP Username"},imapPassword:{zh:"IMAP 密码",en:"IMAP Password"},imapMailbox:{zh:"IMAP 邮箱",en:"IMAP Mailbox"},imapUseSsl:{zh:"IMAP 使用 SSL",en:"IMAP Use SSL"},smtpHost:{zh:"SMTP 服务器",en:"SMTP Host"},smtpPort:{zh:"SMTP 端口",en:"SMTP Port"},smtpUsername:{zh:"SMTP 用户名",en:"SMTP Username"},smtpPassword:{zh:"SMTP 密码",en:"SMTP Password"},smtpUseTls:{zh:"SMTP 使用 TLS",en:"SMTP Use TLS"},smtpUseSsl:{zh:"SMTP 使用 SSL",en:"SMTP Use SSL"},fromAddress:{zh:"发件地址",en:"From Address"},autoReplyEnabled:{zh:"自动回复已启用",en:"Auto Reply Enabled"},pollIntervalSeconds:{zh:"轮询间隔(秒)",en:"Poll Interval (s)"},markSeen:{zh:"标记为已读",en:"Mark Seen"},maxBodyChars:{zh:"最大正文字符数",en:"Max Body Chars"},subjectPrefix:{zh:"主题前缀",en:"Subject Prefix"},baseUrl:{zh:"Base URL",en:"Base URL"},socketUrl:{zh:"Socket URL",en:"Socket URL"},socketPath:{zh:"Socket 路径",en:"Socket Path"},socketDisableMsgpack:{zh:"禁用 Msgpack",en:"Disable Msgpack"},socketReconnectDelayMs:{zh:"重连延迟(ms)",en:"Reconnect Delay (ms)"},socketMaxReconnectDelayMs:{zh:"最大重连延迟(ms)",en:"Max Reconnect Delay (ms)"},socketConnectTimeoutMs:{zh:"连接超时(ms)",en:"Connect Timeout (ms)"},refreshIntervalMs:{zh:"刷新间隔(ms)",en:"Refresh Interval (ms)"},watchTimeoutMs:{zh:"监视超时(ms)",en:"Watch Timeout (ms)"},watchLimit:{zh:"监视限制",en:"Watch Limit"},retryDelayMs:{zh:"重试延迟(ms)",en:"Retry Delay (ms)"},maxRetryAttempts:{zh:"最大重试次数",en:"Max Retry Attempts"},clawToken:{zh:"Claw Token",en:"Claw Token"},agentUserId:{zh:"代理用户ID",en:"Agent User ID"},sessions:{zh:"会话",en:"Sessions"},panels:{zh:"面板",en:"Panels"},mentionRequireInGroups:{zh:"群组中需要@",en:"Require Mention in Groups"},groups:{zh:"群组",en:"Groups"},replyDelayMode:{zh:"回复延迟模式",en:"Reply Delay Mode"},replyDelayMs:{zh:"回复延迟(ms)",en:"Reply Delay (ms)"},secret:{zh:"密钥",en:"Secret"},accountId:{zh:"账号 ID",en:"Account ID"},dmPolicy:{zh:"私聊策略",en:"DM Policy"},groupAllowFrom:{zh:"群组允许来源",en:"Group Allow From"},requireMention:{zh:"需要 @ 提及",en:"Require Mention"},mentionPatterns:{zh:"提及匹配规则",en:"Mention Patterns"},groupRulesJson:{zh:"群组规则(JSON)",en:"Group Rules (JSON)"},allowBotMessages:{zh:"允许机器人消息",en:"Allow Bot Messages"},attachmentMaxSizeMb:{zh:"附件最大体积(MB)",en:"Attachment Max Size (MB)"},streamingMode:{zh:"流式模式",en:"Streaming Mode"},draftChunkingJson:{zh:"草稿分块(JSON)",en:"Draft Chunking (JSON)"},textChunkLimit:{zh:"文本分块上限",en:"Text Chunk Limit"},invalidJson:{zh:"JSON 格式无效",en:"Invalid JSON"},runtimePageTitle:{zh:"路由与运行时",en:"Routing & Runtime"},runtimePageDescription:{zh:"对齐 OpenClaw 的多 Agent 路由:绑定规则、Agent 池、私聊范围。",en:"Align multi-agent routing with OpenClaw: bindings, agent pool, and DM scope."},runtimeLoading:{zh:"加载运行时配置中...",en:"Loading runtime settings..."},dmScope:{zh:"私聊范围",en:"DM Scope"},dmScopeHelp:{zh:"控制私聊会话如何隔离。",en:"Control how direct-message sessions are isolated."},defaultContextTokens:{zh:"默认上下文 Token",en:"Default Context Tokens"},defaultContextTokensHelp:{zh:"当 Agent 未设置单独值时使用该上下文预算。",en:"Input context budget for agents when no per-agent override is set."},maxPingPongTurns:{zh:"最大乒乓轮次",en:"Max Ping-Pong Turns"},maxPingPongTurnsHelp:{zh:"设为 0 可阻止 Agent 间自动 ping-pong。",en:"Set to 0 to block automatic agent-to-agent ping-pong loops."},agentList:{zh:"Agent 列表",en:"Agent List"},agentListHelp:{zh:"在同一个网关进程中运行多个固定角色 Agent。",en:"Run multiple fixed-role agents in one gateway process."},bindings:{zh:"绑定规则",en:"Bindings"},bindingsHelp:{zh:"根据渠道 + 账号 + 对端将入站消息路由到目标 Agent。",en:"Route inbound message by channel + account + peer to target agent."},agentIdRequiredError:{zh:"agents.list[{index}].id 必填",en:"agents.list[{index}].id is required"},duplicateAgentId:{zh:"重复的 agent id",en:"Duplicate agent id"},bindingAgentIdRequired:{zh:"bindings[{index}].agentId 必填",en:"bindings[{index}].agentId is required"},bindingAgentIdNotFound:{zh:"bindings[{index}].agentId 未在 agents.list/main 中找到",en:"bindings[{index}].agentId not found in agents.list/main"},bindingChannelRequired:{zh:"bindings[{index}].match.channel 必填",en:"bindings[{index}].match.channel is required"},bindingPeerIdRequired:{zh:"设置 peer.kind 时,bindings[{index}].match.peer.id 必填",en:"bindings[{index}].match.peer.id is required when peer.kind is set"},agentIdPlaceholder:{zh:"Agent ID(例如 engineer)",en:"Agent ID (e.g. engineer)"},workspaceOverridePlaceholder:{zh:"工作空间覆盖(可选)",en:"Workspace override (optional)"},modelOverridePlaceholder:{zh:"模型覆盖(可选)",en:"Model override (optional)"},maxTokensPlaceholder:{zh:"最大 tokens",en:"Max tokens"},contextTokensPlaceholder:{zh:"上下文 tokens",en:"Context tokens"},maxToolsPlaceholder:{zh:"最大工具次数",en:"Max tools"},defaultAgent:{zh:"默认 Agent",en:"Default agent"},addAgent:{zh:"添加 Agent",en:"Add Agent"},targetAgentIdPlaceholder:{zh:"目标 Agent ID",en:"Target agent ID"},channelPlaceholder:{zh:"渠道(例如 discord)",en:"Channel (e.g. discord)"},accountIdOptionalPlaceholder:{zh:"账号 ID(可选)",en:"Account ID (optional)"},peerKindOptional:{zh:"对端类型(可选)",en:"Peer kind (optional)"},peerIdPlaceholder:{zh:"对端 ID(需先设置对端类型)",en:"Peer ID (requires peer kind)"},addBinding:{zh:"添加绑定",en:"Add Binding"},saveRuntimeSettings:{zh:"保存运行时设置",en:"Save Runtime Settings"},sessionsPageTitle:{zh:"会话管理",en:"Sessions"},sessionsPageDescription:{zh:"管理会话:筛选、按渠道分组、查看历史、改标签/偏好模型、清空和删除。",en:"Manage sessions: filter, group by channel, inspect history, edit metadata, clear, and delete."},sessionsFiltersTitle:{zh:"筛选",en:"Filters"},sessionsFiltersDescription:{zh:"按关键词、活跃窗口和分组方式筛选会话。",en:"Filter sessions by query, activity window, and grouping mode."},sessionsSearchPlaceholder:{zh:"搜索 key 或标签",en:"Search session key or label"},sessionsActiveMinutesPlaceholder:{zh:"活跃分钟(0=不限)",en:"Active minutes (0 = no limit)"},sessionsLimitPlaceholder:{zh:"展示上限",en:"Limit"},sessionsGroupModeLabel:{zh:"分组方式",en:"Grouping"},sessionsGroupModeAll:{zh:"不分组 / 全部",en:"All (No grouping)"},sessionsGroupModeByChannel:{zh:"按渠道分组",en:"Group by channel"},sessionsListTitle:{zh:"会话列表",en:"Session list"},sessionsTotalLabel:{zh:"总数",en:"Total"},sessionsCurrentLabel:{zh:"当前展示",en:"Showing"},sessionsLoading:{zh:"加载会话中...",en:"Loading sessions..."},sessionsEmpty:{zh:"暂无会话。",en:"No sessions yet."},sessionsKeyLabel:{zh:"键",en:"Key"},sessionsChannelLabel:{zh:"渠道",en:"Channel"},sessionsMessagesLabel:{zh:"消息数",en:"Messages"},sessionsUpdatedLabel:{zh:"更新时间",en:"Updated"},sessionsLastRoleLabel:{zh:"最后角色",en:"Last Role"},sessionsLabelPlaceholder:{zh:"会话标签(可选)",en:"Session label (optional)"},sessionsModelPlaceholder:{zh:"偏好模型(可选)",en:"Preferred model (optional)"},sessionsShowHistory:{zh:"查看历史",en:"View history"},sessionsHideHistory:{zh:"隐藏历史",en:"Hide history"},sessionsSaveMeta:{zh:"保存元信息",en:"Save metadata"},sessionsClearHistory:{zh:"清空历史",en:"Clear history"},sessionsDeleteConfirm:{zh:"确认删除会话",en:"Delete session"},sessionsHistoryTitle:{zh:"历史",en:"History"},sessionsHistoryDescription:{zh:"最近 200 条消息(展示窗口)。",en:"Latest 200 messages (display window)."},sessionsHistoryLoading:{zh:"加载历史中...",en:"Loading history..."},sessionsApplyingChanges:{zh:"正在应用会话变更...",en:"Applying session changes..."},sessionsUnknownChannel:{zh:"未知渠道",en:"Unknown channel"},sessionsAllChannels:{zh:"全部渠道",en:"All Channels"},sessionsMetadata:{zh:"元信息",en:"Metadata"},sessionsNoSelectionTitle:{zh:"未选择会话",en:"No Session Selected"},sessionsNoSelectionDescription:{zh:"从左侧列表选择一个会话以查看聊天历史并配置其元信息。",en:"Select a session from the list on the left to view its chat history and configure its metadata."},cronPageTitle:{zh:"定时任务",en:"Cron Jobs"},cronPageDescription:{zh:"查看与删除定时任务,关注执行时间与状态。",en:"View and delete cron jobs, track schedule and status."},cronSearchPlaceholder:{zh:"搜索名称 / 消息 / ID",en:"Search name / message / ID"},cronStatusLabel:{zh:"状态",en:"Status"},cronStatusAll:{zh:"全部",en:"All"},cronStatusEnabled:{zh:"仅启用",en:"Enabled"},cronStatusDisabled:{zh:"仅禁用",en:"Disabled"},cronTotalLabel:{zh:"总数",en:"Total"},cronLoading:{zh:"加载定时任务中...",en:"Loading cron jobs..."},cronEmpty:{zh:"暂无定时任务。",en:"No cron jobs yet."},cronScheduleLabel:{zh:"计划",en:"Schedule"},cronDeliverTo:{zh:"投递到",en:"Deliver to"},cronNextRun:{zh:"下次执行",en:"Next run"},cronLastRun:{zh:"上次执行",en:"Last run"},cronLastStatus:{zh:"上次状态",en:"Last status"},cronDeleteConfirm:{zh:"确认删除定时任务",en:"Delete cron job"},cronOneShot:{zh:"一次性",en:"One-shot"},cronEnable:{zh:"启用",en:"Enable"},cronDisable:{zh:"禁用",en:"Disable"},cronRunNow:{zh:"立即执行",en:"Run now"},cronEnableConfirm:{zh:"确认启用定时任务",en:"Enable cron job"},cronDisableConfirm:{zh:"确认禁用定时任务",en:"Disable cron job"},cronRunConfirm:{zh:"确认立即执行定时任务",en:"Run cron job now"},cronRunForceConfirm:{zh:"任务已禁用,仍要立即执行",en:"Cron job disabled. Force run now"},marketplacePageTitle:{zh:"市场",en:"Marketplace"},marketplacePageDescription:{zh:"更清爽的扩展列表,聚焦安装/启用/禁用。",en:"A cleaner extension list focused on install / enable / disable."},marketplaceTabMarketplace:{zh:"市场",en:"Marketplace"},marketplaceTabInstalled:{zh:"已安装",en:"Installed"},marketplaceSearchPlaceholder:{zh:"搜索扩展...",en:"Search extensions..."},marketplaceFilterAll:{zh:"全部",en:"All"},marketplaceFilterPlugins:{zh:"插件",en:"Plugins"},marketplaceFilterSkills:{zh:"技能",en:"Skills"},marketplaceSortRelevance:{zh:"相关性",en:"Relevance"},marketplaceSortUpdated:{zh:"最近更新",en:"Recently Updated"},marketplaceUnknownItem:{zh:"未知项目",en:"Unknown Item"},marketplaceInstalledLocalSummary:{zh:"已在本地安装,市场暂无详情。",en:"Installed locally. Details are currently unavailable from marketplace."},marketplaceTypePlugin:{zh:"插件",en:"Plugin"},marketplaceTypeSkill:{zh:"技能",en:"Skill"},marketplaceTypeExtension:{zh:"扩展",en:"Extension"},marketplaceInstall:{zh:"安装",en:"Install"},marketplaceInstalling:{zh:"安装中...",en:"Installing..."},marketplaceEnable:{zh:"启用",en:"Enable"},marketplaceDisable:{zh:"禁用",en:"Disable"},marketplaceEnabling:{zh:"启用中...",en:"Enabling..."},marketplaceDisabling:{zh:"禁用中...",en:"Disabling..."},marketplaceUninstall:{zh:"卸载",en:"Uninstall"},marketplaceRemoving:{zh:"卸载中...",en:"Removing..."},marketplaceSectionInstalled:{zh:"已安装",en:"Installed"},marketplaceSectionExtensions:{zh:"扩展",en:"Extensions"},marketplaceErrorLoadingData:{zh:"加载市场数据失败",en:"Failed to load marketplace data"},marketplaceErrorLoadingInstalled:{zh:"加载已安装项目失败",en:"Failed to load installed items"},marketplaceNoItems:{zh:"未找到项目。",en:"No items found."},marketplaceNoInstalledItems:{zh:"未找到已安装项目。",en:"No installed items found."},marketplaceUninstallTitle:{zh:"确认卸载",en:"Uninstall"},marketplaceUninstallDescription:{zh:"该操作会移除扩展,后续可在市场中重新安装。",en:"This will remove the extension. You can install it again from the marketplace."},marketplaceInstallFailed:{zh:"安装失败",en:"Install failed"},marketplaceOperationFailed:{zh:"操作失败",en:"Operation failed"},marketplaceInstalledCountSuffix:{zh:"已安装",en:"installed"},connected:{zh:"已连接",en:"Connected"},disconnected:{zh:"未连接",en:"Disconnected"},connecting:{zh:"连接中...",en:"Connecting..."},feishuConnecting:{zh:"验证 / 连接中...",en:"Verifying / connecting..."},statusReady:{zh:"就绪",en:"Ready"},statusSetup:{zh:"待配置",en:"Setup"},statusActive:{zh:"活跃",en:"Active"},statusInactive:{zh:"未启用",en:"Inactive"},actionConfigure:{zh:"配置",en:"Configure"},actionAddProvider:{zh:"添加提供商",en:"Add Provider"},actionEnable:{zh:"启用",en:"Enable"},configSaved:{zh:"配置已保存",en:"Configuration saved"},configSavedApplied:{zh:"配置已保存并已应用",en:"Configuration saved and applied"},configSaveFailed:{zh:"保存配置失败",en:"Failed to save configuration"},configReloaded:{zh:"配置已重载",en:"Configuration reloaded"},configReloadFailed:{zh:"重载配置失败",en:"Failed to reload configuration"},feishuVerifySuccess:{zh:"验证成功,请到飞书开放平台完成事件订阅与发布后再开始使用。",en:"Verified. Please finish Feishu event subscription and app publishing before using."},feishuVerifyFailed:{zh:"验证失败",en:"Verification failed"},enterTag:{zh:"输入后按回车...",en:"Type and press Enter..."},headerName:{zh:"Header 名称",en:"Header Name"},headerValue:{zh:"Header 值",en:"Header Value"},docBrowserTitle:{zh:"帮助文档",en:"Help Docs"},docBrowserSearchPlaceholder:{zh:"搜索,也可以输入文档地址直接打开",en:"Search, or enter a doc URL to open"},docBrowserUrlPlaceholder:{zh:"输入文档路径,如 /guide/channels",en:"Enter a doc path, e.g. /guide/channels"},docBrowserOpenExternal:{zh:"文档中心打开",en:"Open in Docs"},docBrowserFloatMode:{zh:"悬浮窗口",en:"Float Window"},docBrowserDockMode:{zh:"固定到侧栏",en:"Dock to Sidebar"},docBrowserClose:{zh:"关闭",en:"Close"},docBrowserHelp:{zh:"帮助文档",en:"Help Docs"}};function p(e,t=k()){var s,o;return((s=G[e])==null?void 0:s[t])||((o=G[e])==null?void 0:o.en)||e}const ie="nextclaw.ui.theme",K=[{value:"warm",labelKey:"themeWarm"},{value:"cool",labelKey:"themeCool"}];let y="warm",M=!1;const E=new Set;function Xe(e){return e==="warm"||e==="cool"}function le(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function Ze(){if(typeof window>"u")return"warm";try{const e=window.localStorage.getItem(ie);if(Xe(e))return e}catch{}return"warm"}function H(){return M||(y=Ze(),le(y),M=!0),y}function en(){return M?y:H()}function nn(e){if(H(),e!==y){if(y=e,le(y),typeof window<"u")try{window.localStorage.setItem(ie,y)}catch{}E.forEach(t=>t(y))}}function tn(e){return E.add(e),()=>{E.delete(e)}}const R="docs.nextclaw.io",q="nextclaw-docs.pages.dev",sn=new Set([R,`www.${R}`,q,`www.${q}`]),j=`https://${R}`;function v(e){try{return new URL(e).pathname.replace(/\.html$/,"").replace(/\/$/,"")}catch{return e}}const ce=a.createContext(null);function V(){const e=a.useContext(ce);if(!e)throw new Error("useDocBrowser must be used within DocBrowserProvider");return e}function an(e){try{const t=new URL(e,window.location.origin);return sn.has(t.hostname)}catch{return!1}}function on({children:e}){const[t,s]=a.useState({isOpen:!1,mode:"docked",currentUrl:`${j}/guide/getting-started`,history:[`${j}/guide/getting-started`],historyIndex:0,navVersion:0}),o=a.useCallback(d=>{const u=d||t.currentUrl||`${j}/guide/getting-started`;s(I=>({...I,isOpen:!0,currentUrl:u,history:[...I.history.slice(0,I.historyIndex+1),u],historyIndex:I.historyIndex+1,navVersion:I.navVersion+1}))},[t.currentUrl]),r=a.useCallback(()=>{s(d=>({...d,isOpen:!1}))},[]),c=a.useCallback(()=>{s(d=>({...d,mode:d.mode==="floating"?"docked":"floating"}))},[]),l=a.useCallback(d=>{s(u=>({...u,mode:d}))},[]),h=a.useCallback(d=>{s(u=>v(d)===v(u.currentUrl)?u:{...u,currentUrl:d,history:[...u.history.slice(0,u.historyIndex+1),d],historyIndex:u.historyIndex+1,navVersion:u.navVersion+1})},[]),w=a.useCallback(d=>{s(u=>v(d)===v(u.currentUrl)?u:{...u,currentUrl:d,history:[...u.history.slice(0,u.historyIndex+1),d],historyIndex:u.historyIndex+1})},[]),m=a.useCallback(()=>{s(d=>{if(d.historyIndex<=0)return d;const u=d.historyIndex-1;return{...d,historyIndex:u,currentUrl:d.history[u]}})},[]),g=a.useCallback(()=>{s(d=>{if(d.historyIndex>=d.history.length-1)return d;const u=d.historyIndex+1;return{...d,historyIndex:u,currentUrl:d.history[u]}})},[]),f=t.historyIndex>0,i=t.historyIndex<t.history.length-1,P=a.useMemo(()=>({...t,open:o,close:r,toggleMode:c,setMode:l,navigate:h,syncUrl:w,goBack:m,goForward:g,canGoBack:f,canGoForward:i}),[t,o,r,c,l,h,w,m,g,f,i]);return n.jsx(ce.Provider,{value:P,children:e})}function rn(){const e=V();a.useEffect(()=>{const t=s=>{const o=s.target.closest("a[href]");if(!o)return;const r=o.getAttribute("href")||"";an(r)&&(o.hasAttribute("data-doc-external")||s.ctrlKey||s.metaKey||s.shiftKey||(s.preventDefault(),s.stopPropagation(),e.open(r)))};return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[e])}const de=a.createContext(null);function ln({children:e}){const[t,s]=a.useState(()=>B());a.useEffect(()=>Ye(h=>{s(h)}),[]);const o=a.useCallback(l=>{Qe(l),s(k())},[]),r=a.useCallback(()=>{o(t==="en"?"zh":"en")},[t,o]),c=a.useMemo(()=>({language:t,setLanguage:o,toggleLanguage:r}),[t,o,r]);return n.jsx(de.Provider,{value:c,children:e})}function cn(){const e=a.useContext(de);if(!e)throw new Error("useI18n must be used within I18nProvider");return{...e,t:p}}const he=a.createContext(null);function dn({children:e}){const[t,s]=a.useState(()=>H());a.useEffect(()=>tn(l=>{s(l)}),[]);const o=a.useCallback(c=>{nn(c),s(en())},[]),r=a.useMemo(()=>({theme:t,setTheme:o}),[t,o]);return n.jsx(he.Provider,{value:r,children:e})}function hn(){const e=a.useContext(he);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const J=ke,Mn=Pe,U=a.forwardRef(({className:e,children:t,...s},o)=>n.jsxs(X,{ref:o,className:x("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 bg-white",e),...s,children:[t,n.jsx(fe,{asChild:!0,children:n.jsx(Z,{className:"h-4 w-4 opacity-50"})})]}));U.displayName=X.displayName;const ue=a.forwardRef(({className:e,...t},s)=>n.jsx(ee,{ref:s,className:x("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(ze,{className:"h-4 w-4"})}));ue.displayName=ee.displayName;const me=a.forwardRef(({className:e,...t},s)=>n.jsx(ne,{ref:s,className:x("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(Z,{className:"h-4 w-4"})}));me.displayName=ne.displayName;const O=a.forwardRef(({className:e,children:t,position:s="popper",...o},r)=>n.jsx(xe,{children:n.jsxs(te,{ref:r,className:x("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-white",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:[n.jsx(ue,{}),n.jsx(ye,{className:x("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),n.jsx(me,{})]})}));O.displayName=te.displayName;const un=a.forwardRef(({className:e,...t},s)=>n.jsx(se,{ref:s,className:x("px-2 py-1.5 text-sm font-semibold",e),...t}));un.displayName=se.displayName;const _=a.forwardRef(({className:e,children:t,...s},o)=>n.jsxs(ae,{ref:o,className:x("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100",e),...s,children:[n.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(we,{children:n.jsx(be,{className:"h-4 w-4"})})}),n.jsx(Se,{children:t})]}));_.displayName=ae.displayName;const mn=a.forwardRef(({className:e,...t},s)=>n.jsx(oe,{ref:s,className:x("-mx-1 my-1 h-px bg-muted",e),...t}));mn.displayName=oe.displayName;function pn(){var g,f;const e=V(),{language:t,setLanguage:s}=cn(),{theme:o,setTheme:r}=hn(),c=((g=$.find(i=>i.value===t))==null?void 0:g.label)??t,l=p(((f=K.find(i=>i.value===o))==null?void 0:f.labelKey)??"themeWarm"),h=i=>{t!==i&&(s(i),window.location.reload())},w=i=>{o!==i&&r(i)},m=[{target:"/model",label:p("model"),icon:Ie},{target:"/providers",label:p("providers"),icon:Ce},{target:"/channels",label:p("channels"),icon:ve},{target:"/runtime",label:p("runtime"),icon:Te},{target:"/sessions",label:p("sessions"),icon:Ae},{target:"/cron",label:p("cron"),icon:De},{target:"/marketplace",label:p("marketplace"),icon:je}];return n.jsxs("aside",{className:"w-[240px] shrink-0 flex flex-col h-full py-6 px-4 bg-secondary",children:[n.jsx("div",{className:"px-2 mb-8",children:n.jsxs("div",{className:"flex items-center gap-2.5 cursor-pointer",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center",children:n.jsx("img",{src:"/logo.svg",alt:"NextClaw",className:"h-full w-full object-contain"})}),n.jsx("span",{className:"text-[15px] font-semibold text-gray-800 tracking-[-0.01em]",children:"NextClaw"})]})}),n.jsx("nav",{className:"flex-1",children:n.jsx("ul",{className:"space-y-1",children:m.map(i=>{const P=i.icon;return n.jsx("li",{children:n.jsx(Le,{to:i.target,className:({isActive:d})=>x("group w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base",d?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:d})=>n.jsxs(n.Fragment,{children:[n.jsx(P,{className:x("h-[17px] w-[17px] transition-colors",d?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),n.jsx("span",{className:"flex-1 text-left",children:i.label})]})})},i.target)})})}),n.jsxs("div",{className:"pt-3 border-t border-[#dde0ea] mt-3",children:[n.jsx("div",{className:"mb-2",children:n.jsxs(J,{value:o,onValueChange:i=>w(i),children:[n.jsxs(U,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx(Ne,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"text-left",children:p("theme")})]}),n.jsx("span",{className:"ml-auto text-xs text-gray-500",children:l})]}),n.jsx(O,{children:K.map(i=>n.jsx(_,{value:i.value,className:"text-xs",children:p(i.labelKey)},i.value))})]})}),n.jsx("div",{className:"mb-2",children:n.jsxs(J,{value:t,onValueChange:i=>h(i),children:[n.jsxs(U,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx(Me,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"text-left",children:p("language")})]}),n.jsx("span",{className:"ml-auto text-xs text-gray-500",children:c})]}),n.jsx(O,{children:$.map(i=>n.jsx(_,{value:i.value,className:"text-xs",children:i.label},i.value))})]})}),n.jsxs("button",{onClick:()=>e.open(),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base text-gray-600 hover:bg-[#e4e7ef] hover:text-gray-800",children:[n.jsx(Ee,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"flex-1 text-left",children:p("docBrowserHelp")})]})]})]})}const Q=a.lazy(async()=>({default:(await b(async()=>{const{DocBrowser:e}=await import("./DocBrowser-IzD4Evlq.js");return{DocBrowser:e}},__vite__mapDeps([0,1]))).DocBrowser}));function gn({children:e}){const{isOpen:t,mode:s}=V();return rn(),n.jsxs("div",{className:"h-screen flex bg-background font-sans text-foreground",children:[n.jsx(pn,{}),n.jsxs("div",{className:"flex-1 flex min-w-0 overflow-hidden relative",children:[n.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:n.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar p-8",children:n.jsx("div",{className:"max-w-6xl mx-auto animate-fade-in h-full",children:e})})}),t&&s==="docked"&&n.jsx(a.Suspense,{fallback:null,children:n.jsx(Q,{})})]}),t&&s==="floating"&&n.jsx(a.Suspense,{fallback:null,children:n.jsx(Q,{})})]})}function fn({children:e}){return n.jsx(on,{children:n.jsx(gn,{children:e})})}class zn{constructor(t){this.url=t,this.ws=null,this.handlers=new Map,this.reconnectTimer=null,this.manualClose=!1}connect(){this.manualClose=!1,this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("WebSocket connected"),this.emit({type:"connection.open",payload:{}})},this.ws.onmessage=t=>{try{const s=JSON.parse(t.data);this.emit(s)}catch(s){console.error("Failed to parse WebSocket message:",s)}},this.ws.onclose=()=>{console.log("WebSocket disconnected"),this.manualClose||this.scheduleReconnect()},this.ws.onerror=t=>{console.error("WebSocket error:",t)}}on(t,s){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(s)}off(t,s){var o;(o=this.handlers.get(t))==null||o.delete(s)}emit(t){const s=this.handlers.get(t.type);s==null||s.forEach(o=>o(t))}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}disconnect(){var t;this.manualClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}}const xn="http://127.0.0.1:18791",A=(()=>{var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)?window.location.origin:xn})();async function T(e,t={}){const s=`${A}${e}`,o=await fetch(s,{headers:{"Content-Type":"application/json",...t.headers},...t}),r=await o.text();let c=null;if(r)try{c=JSON.parse(r)}catch{}if(!c){const l=r?r.slice(0,200):"";return{ok:!1,error:{code:"INVALID_RESPONSE",message:`Non-JSON response (${o.status} ${o.statusText})${l?`: ${l}`:""}`}}}return o.ok,c}const En={get:e=>T(e,{method:"GET"}),put:(e,t)=>T(e,{method:"PUT",body:JSON.stringify(t)}),post:(e,t)=>T(e,{method:"POST",body:JSON.stringify(t)}),delete:e=>T(e,{method:"DELETE"})},yn=Re(e=>({connectionStatus:"disconnected",setConnectionStatus:t=>e({connectionStatus:t}),providerModal:{open:!1},openProviderModal:t=>e({providerModal:{open:!0,provider:t}}),closeProviderModal:()=>e({providerModal:{open:!1}}),channelModal:{open:!1},openChannelModal:t=>e({channelModal:{open:!0,channel:t}}),closeChannelModal:()=>e({channelModal:{open:!1}})}));function wn(e){const[t,s]=a.useState(null),{setConnectionStatus:o}=yn();return a.useEffect(()=>{const r=(()=>{const l=A==null?void 0:A.replace(/\/$/,"");if(!l)return"ws://127.0.0.1:18791/ws";try{const h=new URL(l,window.location.origin);return`${h.protocol==="https:"?"wss:":h.protocol==="http:"?"ws:":h.protocol}//${h.host}/ws`}catch{return l.startsWith("wss://")||l.startsWith("ws://")?`${l}/ws`:l.startsWith("https://")?`${l.replace(/^https:/,"wss:")}/ws`:l.startsWith("http://")?`${l.replace(/^http:/,"ws:")}/ws`:`${l}/ws`}})(),c=new zn(r);return c.on("connection.open",()=>{o("connected")}),c.on("config.updated",()=>{e&&e.invalidateQueries({queryKey:["config"]})}),c.on("error",l=>{l.type==="error"&&console.error("WebSocket error:",l.payload.message)}),c.connect(),s(c),()=>c.disconnect()},[o,e]),t}const Y=new Ue({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),bn=a.lazy(async()=>({default:(await b(async()=>{const{ModelConfig:e}=await import("./ModelConfig-Dp5iCAC-.js");return{ModelConfig:e}},__vite__mapDeps([2,1,3,4,5,6,7]))).ModelConfig})),Sn=a.lazy(async()=>({default:(await b(async()=>{const{ProvidersList:e}=await import("./ProvidersList-csOpEGSj.js");return{ProvidersList:e}},__vite__mapDeps([8,1,5,9,3,6,7,10,11]))).ProvidersList})),kn=a.lazy(async()=>({default:(await b(async()=>{const{ChannelsList:e}=await import("./ChannelsList-GW0rzJh0.js");return{ChannelsList:e}},__vite__mapDeps([12,1,5,9,3,6,13,7,10,11]))).ChannelsList})),Pn=a.lazy(async()=>({default:(await b(async()=>{const{RuntimeConfig:e}=await import("./RuntimeConfig-H0SSIQ3f.js");return{RuntimeConfig:e}},__vite__mapDeps([14,1,5,3,4,13,7]))).RuntimeConfig})),In=a.lazy(async()=>({default:(await b(async()=>{const{SessionsConfig:e}=await import("./SessionsConfig-8nUD5SGB.js");return{SessionsConfig:e}},__vite__mapDeps([15,1,16,9,3,5]))).SessionsConfig})),Cn=a.lazy(async()=>({default:(await b(async()=>{const{CronConfig:e}=await import("./CronConfig-DJv3pHG6.js");return{CronConfig:e}},__vite__mapDeps([17,1,16,9,3,5,4]))).CronConfig})),vn=a.lazy(async()=>({default:(await b(async()=>{const{MarketplacePage:e}=await import("./MarketplacePage-rd97G8xD.js");return{MarketplacePage:e}},__vite__mapDeps([18,1,10,9,16,3]))).MarketplacePage}));function Tn(){return n.jsx("div",{className:"h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40"})}function S({children:e}){return n.jsx(a.Suspense,{fallback:n.jsx(Tn,{}),children:e})}function An(){wn(Y);const e=Oe();return n.jsxs(_e,{client:Y,children:[n.jsx(fn,{children:n.jsx("div",{className:"animate-fade-in w-full h-full",children:n.jsxs(Be,{children:[n.jsx(z,{path:"/model",element:n.jsx(S,{children:n.jsx(bn,{})})}),n.jsx(z,{path:"/providers",element:n.jsx(S,{children:n.jsx(Sn,{})})}),n.jsx(z,{path:"/channels",element:n.jsx(S,{children:n.jsx(kn,{})})}),n.jsx(z,{path:"/runtime",element:n.jsx(S,{children:n.jsx(Pn,{})})}),n.jsx(z,{path:"/sessions",element:n.jsx(S,{children:n.jsx(In,{})})}),n.jsx(z,{path:"/cron",element:n.jsx(S,{children:n.jsx(Cn,{})})}),n.jsx(z,{path:"/marketplace",element:n.jsx(D,{to:"/marketplace/plugins",replace:!0})}),n.jsx(z,{path:"/marketplace/:type",element:n.jsx(S,{children:n.jsx(vn,{})})}),n.jsx(z,{path:"/",element:n.jsx(D,{to:"/model",replace:!0})}),n.jsx(z,{path:"*",element:n.jsx(D,{to:"/model",replace:!0})})]})},e.pathname)}),n.jsx(Fe,{position:"top-right",richColors:!0})]})}He.createRoot(document.getElementById("root")).render(n.jsx(a.StrictMode,{children:n.jsx(dn,{children:n.jsx(ln,{children:n.jsx(Ve,{children:n.jsx(An,{})})})})}));export{j as D,J as S,U as a,Mn as b,x as c,O as d,_ as e,Nn as f,Ln as g,jn as h,En as i,V as j,p as t,yn as u};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-CBY75a92.js","assets/vendor-Dkx07DIh.js","assets/ModelConfig-CBmc0ERp.js","assets/page-layout-CMuYE4DA.js","assets/card-KMt_4CgV.js","assets/useConfig-Bv2DQ4BE.js","assets/label-C7WCjHWk.js","assets/config-hints-CApS3K_7.js","assets/ProvidersList-CZfmOr6_.js","assets/dialog-CqY6jnQm.js","assets/tabs-custom-C5xYS25o.js","assets/action-link-DNRpMv1A.js","assets/ChannelsList-DHBUkGsA.js","assets/switch-DQmUTN4L.js","assets/RuntimeConfig-DX6nI_b5.js","assets/SessionsConfig-wH-647_6.js","assets/useConfirmDialog-BOcIsqiA.js","assets/CronConfig-9YgJQTmP.js","assets/MarketplacePage-Dw_0TLNd.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as pe,c as ge,r as a,j as n,T as X,I as fe,C as Z,S as ee,a as ze,b as ne,P as xe,d as te,V as ye,L as se,e as ae,f as we,g as be,h as Se,i as oe,R as ke,k as Pe,l as Ie,m as Ce,M as ve,G as Te,H as Ae,A as De,n as je,N as Le,o as Ne,p as Me,B as Ee,q as Re,Q as Ue,u as Oe,s as _e,v as Be,w as z,x as D,$ as Fe,y as He,z as Ve}from"./vendor-Dkx07DIh.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=s(r);fetch(r.href,c)}})();const We="modulepreload",$e=function(e){return"/"+e},W={},b=function(t,s,o){let r=Promise.resolve();if(s&&s.length>0){let l=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),w=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));r=l(s.map(m=>{if(m=$e(m),m in W)return;W[m]=!0;const g=m.endsWith(".css"),f=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${f}`))return;const i=document.createElement("link");if(i.rel=g?"stylesheet":We,g||(i.as="script"),i.crossOrigin="",i.href=m,w&&i.setAttribute("nonce",w),document.head.appendChild(i),g)return new Promise((P,d)=>{i.addEventListener("load",P),i.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(l){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=l,window.dispatchEvent(h),!h.defaultPrevented)throw l}return r.then(l=>{for(const h of l||[])h.status==="rejected"&&c(h.reason);return t().catch(c)})};function x(...e){return pe(ge(e))}const re="nextclaw.ui.language",$=[{value:"en",label:"English"},{value:"zh",label:"中文"}],Ge={en:"en-US",zh:"zh-CN"};let C="en",L=!1;const N=new Set;function Ke(e){return e==="en"||e==="zh"}function qe(){var t;return typeof navigator>"u"?"en":(((t=navigator.language)==null?void 0:t.toLowerCase())??"en").startsWith("zh")?"zh":"en"}function Je(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(re);if(Ke(e))return e}catch{}return qe()}function B(){return L||(C=Je(),L=!0),C}function k(){return L?C:B()}function Qe(e){if(B(),C!==e){if(C=e,typeof window<"u")try{window.localStorage.setItem(re,e)}catch{}N.forEach(t=>t(e))}}function Ye(e){return N.add(e),()=>{N.delete(e)}}function F(e=k()){return Ge[e]}function jn(e,t=k()){if(!e)return"-";const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?typeof e=="string"?e:"-":s.toLocaleString(F(t))}function Ln(e,t=k()){if(!e)return"-";const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?typeof e=="string"?e:"-":new Intl.DateTimeFormat(F(t),{year:"numeric",month:"2-digit",day:"2-digit"}).format(s)}function Nn(e,t=k()){return new Intl.NumberFormat(F(t)).format(e)}const G={model:{zh:"模型",en:"Model"},providers:{zh:"提供商",en:"Providers"},channels:{zh:"渠道",en:"Channels"},cron:{zh:"定时任务",en:"Cron Jobs"},runtime:{zh:"路由与运行时",en:"Routing & Runtime"},marketplace:{zh:"市场",en:"Marketplace"},enabled:{zh:"启用",en:"Enabled"},disabled:{zh:"禁用",en:"Disabled"},save:{zh:"保存",en:"Save"},cancel:{zh:"取消",en:"Cancel"},delete:{zh:"删除",en:"Delete"},add:{zh:"添加",en:"Add"},edit:{zh:"编辑",en:"Edit"},loading:{zh:"加载中...",en:"Loading..."},success:{zh:"成功",en:"Success"},error:{zh:"错误",en:"Error"},confirm:{zh:"确认",en:"Confirm"},unchanged:{zh:"未修改",en:"Unchanged"},saving:{zh:"保存中...",en:"Saving..."},remove:{zh:"移除",en:"Remove"},all:{zh:"全部",en:"All"},prev:{zh:"上一页",en:"Prev"},next:{zh:"下一页",en:"Next"},language:{zh:"语言",en:"Language"},theme:{zh:"主题",en:"Theme"},themeWarm:{zh:"暖色",en:"Warm"},themeCool:{zh:"冷色",en:"Cool"},modelPageTitle:{zh:"模型配置",en:"Model Configuration"},modelPageDescription:{zh:"配置默认 AI 模型和运行参数限制",en:"Configure default AI model and runtime limits"},defaultModel:{zh:"默认模型",en:"Default Model"},workspace:{zh:"工作空间",en:"Workspace"},generationParameters:{zh:"生成参数",en:"Generation Parameters"},modelName:{zh:"模型",en:"Model"},maxTokens:{zh:"最大 Token 数",en:"Max Tokens"},maxToolIterations:{zh:"最大工具迭代次数",en:"Max Tool Iterations"},saveChanges:{zh:"保存变更",en:"Save Changes"},providersPageTitle:{zh:"AI 提供商",en:"AI Providers"},providersLoading:{zh:"加载中...",en:"Loading..."},providersTabConfigured:{zh:"已配置",en:"Configured"},providersTabAll:{zh:"全部提供商",en:"All Providers"},providersDefaultDescription:{zh:"为你的 Agent 配置 AI 服务",en:"Configure AI services for your agents"},providersEmptyTitle:{zh:"尚未配置提供商",en:"No providers configured"},providersEmptyDescription:{zh:"添加一个 AI 提供商后即可开始使用。",en:"Add an AI provider to start using the platform."},apiKey:{zh:"API 密钥",en:"API Key"},apiBase:{zh:"API Base",en:"API Base"},extraHeaders:{zh:"额外请求头",en:"Extra Headers"},wireApi:{zh:"请求接口",en:"Wire API"},wireApiAuto:{zh:"自动(优先 Chat,必要时 Responses)",en:"Auto (Chat with fallback)"},wireApiChat:{zh:"Chat Completions",en:"Chat Completions"},wireApiResponses:{zh:"Responses",en:"Responses"},apiKeySet:{zh:"已设置",en:"Set"},apiKeyNotSet:{zh:"未设置",en:"Not Set"},showKey:{zh:"显示密钥",en:"Show Key"},hideKey:{zh:"隐藏密钥",en:"Hide Key"},providerFormDescription:{zh:"配置 AI 提供商的 API 密钥与参数",en:"Configure API keys and parameters for AI provider"},enterApiKey:{zh:"请输入 API 密钥",en:"Enter API Key"},leaveBlankToKeepUnchanged:{zh:"留空则保持不变",en:"Leave blank to keep unchanged"},channelsPageTitle:{zh:"消息渠道",en:"Message Channels"},channelsLoading:{zh:"加载渠道中...",en:"Loading channels..."},channelsTabEnabled:{zh:"已启用",en:"Enabled"},channelsTabAll:{zh:"全部渠道",en:"All Channels"},channelsEmptyTitle:{zh:"暂无启用渠道",en:"No channels enabled"},channelsEmptyDescription:{zh:"启用一个消息渠道以开始接收消息。",en:"Enable a messaging channel to start receiving messages."},channelDescriptionDefault:{zh:"配置该通信渠道",en:"Configure this communication channel"},channelDescTelegram:{zh:"连接 Telegram 机器人以进行即时消息收发",en:"Connect with Telegram bots for instant messaging"},channelDescSlack:{zh:"接入 Slack 工作区进行团队协作消息处理",en:"Integrate with Slack workspaces for team collaboration"},channelDescEmail:{zh:"通过邮件协议收发消息",en:"Send and receive messages via email protocols"},channelDescWebhook:{zh:"接收 HTTP Webhook 以支持自定义集成",en:"Receive HTTP webhooks for custom integrations"},channelDescDiscord:{zh:"将 Discord 机器人连接到你的社区服务器",en:"Connect Discord bots to your community servers"},channelDescFeishu:{zh:"企业消息与协作平台接入",en:"Enterprise messaging and collaboration platform"},configureMessageChannelParameters:{zh:"配置消息渠道参数",en:"Configure message channel parameters"},channelsGuideTitle:{zh:"查看指南",en:"View Guide"},allowFrom:{zh:"允许来源",en:"Allow From"},token:{zh:"Token",en:"Token"},botToken:{zh:"Bot Token",en:"Bot Token"},appToken:{zh:"App Token",en:"App Token"},appId:{zh:"App ID",en:"App ID"},corpId:{zh:"企业 ID",en:"Corp ID"},agentId:{zh:"应用 Agent ID",en:"Agent ID"},appSecret:{zh:"App Secret",en:"App Secret"},markdownSupport:{zh:"Markdown 支持",en:"Markdown Support"},clientId:{zh:"Client ID",en:"Client ID"},clientSecret:{zh:"Client Secret",en:"Client Secret"},encryptKey:{zh:"加密密钥",en:"Encrypt Key"},verificationToken:{zh:"验证令牌",en:"Verification Token"},bridgeUrl:{zh:"桥接 URL",en:"Bridge URL"},gatewayUrl:{zh:"网关 URL",en:"Gateway URL"},proxy:{zh:"代理",en:"Proxy"},intents:{zh:"Intents",en:"Intents"},mode:{zh:"模式",en:"Mode"},webhookPath:{zh:"Webhook 路径",en:"Webhook Path"},callbackPort:{zh:"回调端口",en:"Callback Port"},callbackPath:{zh:"回调路径",en:"Callback Path"},groupPolicy:{zh:"群组策略",en:"Group Policy"},consentGranted:{zh:"同意条款",en:"Consent Granted"},imapHost:{zh:"IMAP 服务器",en:"IMAP Host"},imapPort:{zh:"IMAP 端口",en:"IMAP Port"},imapUsername:{zh:"IMAP 用户名",en:"IMAP Username"},imapPassword:{zh:"IMAP 密码",en:"IMAP Password"},imapMailbox:{zh:"IMAP 邮箱",en:"IMAP Mailbox"},imapUseSsl:{zh:"IMAP 使用 SSL",en:"IMAP Use SSL"},smtpHost:{zh:"SMTP 服务器",en:"SMTP Host"},smtpPort:{zh:"SMTP 端口",en:"SMTP Port"},smtpUsername:{zh:"SMTP 用户名",en:"SMTP Username"},smtpPassword:{zh:"SMTP 密码",en:"SMTP Password"},smtpUseTls:{zh:"SMTP 使用 TLS",en:"SMTP Use TLS"},smtpUseSsl:{zh:"SMTP 使用 SSL",en:"SMTP Use SSL"},fromAddress:{zh:"发件地址",en:"From Address"},autoReplyEnabled:{zh:"自动回复已启用",en:"Auto Reply Enabled"},pollIntervalSeconds:{zh:"轮询间隔(秒)",en:"Poll Interval (s)"},markSeen:{zh:"标记为已读",en:"Mark Seen"},maxBodyChars:{zh:"最大正文字符数",en:"Max Body Chars"},subjectPrefix:{zh:"主题前缀",en:"Subject Prefix"},baseUrl:{zh:"Base URL",en:"Base URL"},socketUrl:{zh:"Socket URL",en:"Socket URL"},socketPath:{zh:"Socket 路径",en:"Socket Path"},socketDisableMsgpack:{zh:"禁用 Msgpack",en:"Disable Msgpack"},socketReconnectDelayMs:{zh:"重连延迟(ms)",en:"Reconnect Delay (ms)"},socketMaxReconnectDelayMs:{zh:"最大重连延迟(ms)",en:"Max Reconnect Delay (ms)"},socketConnectTimeoutMs:{zh:"连接超时(ms)",en:"Connect Timeout (ms)"},refreshIntervalMs:{zh:"刷新间隔(ms)",en:"Refresh Interval (ms)"},watchTimeoutMs:{zh:"监视超时(ms)",en:"Watch Timeout (ms)"},watchLimit:{zh:"监视限制",en:"Watch Limit"},retryDelayMs:{zh:"重试延迟(ms)",en:"Retry Delay (ms)"},maxRetryAttempts:{zh:"最大重试次数",en:"Max Retry Attempts"},clawToken:{zh:"Claw Token",en:"Claw Token"},agentUserId:{zh:"代理用户ID",en:"Agent User ID"},sessions:{zh:"会话",en:"Sessions"},panels:{zh:"面板",en:"Panels"},mentionRequireInGroups:{zh:"群组中需要@",en:"Require Mention in Groups"},groups:{zh:"群组",en:"Groups"},replyDelayMode:{zh:"回复延迟模式",en:"Reply Delay Mode"},replyDelayMs:{zh:"回复延迟(ms)",en:"Reply Delay (ms)"},secret:{zh:"密钥",en:"Secret"},accountId:{zh:"账号 ID",en:"Account ID"},dmPolicy:{zh:"私聊策略",en:"DM Policy"},groupAllowFrom:{zh:"群组允许来源",en:"Group Allow From"},requireMention:{zh:"需要 @ 提及",en:"Require Mention"},mentionPatterns:{zh:"提及匹配规则",en:"Mention Patterns"},groupRulesJson:{zh:"群组规则(JSON)",en:"Group Rules (JSON)"},allowBotMessages:{zh:"允许机器人消息",en:"Allow Bot Messages"},attachmentMaxSizeMb:{zh:"附件最大体积(MB)",en:"Attachment Max Size (MB)"},streamingMode:{zh:"流式模式",en:"Streaming Mode"},draftChunkingJson:{zh:"草稿分块(JSON)",en:"Draft Chunking (JSON)"},textChunkLimit:{zh:"文本分块上限",en:"Text Chunk Limit"},invalidJson:{zh:"JSON 格式无效",en:"Invalid JSON"},runtimePageTitle:{zh:"路由与运行时",en:"Routing & Runtime"},runtimePageDescription:{zh:"对齐 OpenClaw 的多 Agent 路由:绑定规则、Agent 池、私聊范围。",en:"Align multi-agent routing with OpenClaw: bindings, agent pool, and DM scope."},runtimeLoading:{zh:"加载运行时配置中...",en:"Loading runtime settings..."},dmScope:{zh:"私聊范围",en:"DM Scope"},dmScopeHelp:{zh:"控制私聊会话如何隔离。",en:"Control how direct-message sessions are isolated."},defaultContextTokens:{zh:"默认上下文 Token",en:"Default Context Tokens"},defaultContextTokensHelp:{zh:"当 Agent 未设置单独值时使用该上下文预算。",en:"Input context budget for agents when no per-agent override is set."},maxPingPongTurns:{zh:"最大乒乓轮次",en:"Max Ping-Pong Turns"},maxPingPongTurnsHelp:{zh:"设为 0 可阻止 Agent 间自动 ping-pong。",en:"Set to 0 to block automatic agent-to-agent ping-pong loops."},agentList:{zh:"Agent 列表",en:"Agent List"},agentListHelp:{zh:"在同一个网关进程中运行多个固定角色 Agent。",en:"Run multiple fixed-role agents in one gateway process."},bindings:{zh:"绑定规则",en:"Bindings"},bindingsHelp:{zh:"根据渠道 + 账号 + 对端将入站消息路由到目标 Agent。",en:"Route inbound message by channel + account + peer to target agent."},agentIdRequiredError:{zh:"agents.list[{index}].id 必填",en:"agents.list[{index}].id is required"},duplicateAgentId:{zh:"重复的 agent id",en:"Duplicate agent id"},bindingAgentIdRequired:{zh:"bindings[{index}].agentId 必填",en:"bindings[{index}].agentId is required"},bindingAgentIdNotFound:{zh:"bindings[{index}].agentId 未在 agents.list/main 中找到",en:"bindings[{index}].agentId not found in agents.list/main"},bindingChannelRequired:{zh:"bindings[{index}].match.channel 必填",en:"bindings[{index}].match.channel is required"},bindingPeerIdRequired:{zh:"设置 peer.kind 时,bindings[{index}].match.peer.id 必填",en:"bindings[{index}].match.peer.id is required when peer.kind is set"},agentIdPlaceholder:{zh:"Agent ID(例如 engineer)",en:"Agent ID (e.g. engineer)"},workspaceOverridePlaceholder:{zh:"工作空间覆盖(可选)",en:"Workspace override (optional)"},modelOverridePlaceholder:{zh:"模型覆盖(可选)",en:"Model override (optional)"},maxTokensPlaceholder:{zh:"最大 tokens",en:"Max tokens"},contextTokensPlaceholder:{zh:"上下文 tokens",en:"Context tokens"},maxToolsPlaceholder:{zh:"最大工具次数",en:"Max tools"},defaultAgent:{zh:"默认 Agent",en:"Default agent"},addAgent:{zh:"添加 Agent",en:"Add Agent"},targetAgentIdPlaceholder:{zh:"目标 Agent ID",en:"Target agent ID"},channelPlaceholder:{zh:"渠道(例如 discord)",en:"Channel (e.g. discord)"},accountIdOptionalPlaceholder:{zh:"账号 ID(可选)",en:"Account ID (optional)"},peerKindOptional:{zh:"对端类型(可选)",en:"Peer kind (optional)"},peerIdPlaceholder:{zh:"对端 ID(需先设置对端类型)",en:"Peer ID (requires peer kind)"},addBinding:{zh:"添加绑定",en:"Add Binding"},saveRuntimeSettings:{zh:"保存运行时设置",en:"Save Runtime Settings"},sessionsPageTitle:{zh:"会话管理",en:"Sessions"},sessionsPageDescription:{zh:"管理会话:筛选、按渠道分组、查看历史、改标签/偏好模型、清空和删除。",en:"Manage sessions: filter, group by channel, inspect history, edit metadata, clear, and delete."},sessionsFiltersTitle:{zh:"筛选",en:"Filters"},sessionsFiltersDescription:{zh:"按关键词、活跃窗口和分组方式筛选会话。",en:"Filter sessions by query, activity window, and grouping mode."},sessionsSearchPlaceholder:{zh:"搜索 key 或标签",en:"Search session key or label"},sessionsActiveMinutesPlaceholder:{zh:"活跃分钟(0=不限)",en:"Active minutes (0 = no limit)"},sessionsLimitPlaceholder:{zh:"展示上限",en:"Limit"},sessionsGroupModeLabel:{zh:"分组方式",en:"Grouping"},sessionsGroupModeAll:{zh:"不分组 / 全部",en:"All (No grouping)"},sessionsGroupModeByChannel:{zh:"按渠道分组",en:"Group by channel"},sessionsListTitle:{zh:"会话列表",en:"Session list"},sessionsTotalLabel:{zh:"总数",en:"Total"},sessionsCurrentLabel:{zh:"当前展示",en:"Showing"},sessionsLoading:{zh:"加载会话中...",en:"Loading sessions..."},sessionsEmpty:{zh:"暂无会话。",en:"No sessions yet."},sessionsKeyLabel:{zh:"键",en:"Key"},sessionsChannelLabel:{zh:"渠道",en:"Channel"},sessionsMessagesLabel:{zh:"消息数",en:"Messages"},sessionsUpdatedLabel:{zh:"更新时间",en:"Updated"},sessionsLastRoleLabel:{zh:"最后角色",en:"Last Role"},sessionsLabelPlaceholder:{zh:"会话标签(可选)",en:"Session label (optional)"},sessionsModelPlaceholder:{zh:"偏好模型(可选)",en:"Preferred model (optional)"},sessionsShowHistory:{zh:"查看历史",en:"View history"},sessionsHideHistory:{zh:"隐藏历史",en:"Hide history"},sessionsSaveMeta:{zh:"保存元信息",en:"Save metadata"},sessionsClearHistory:{zh:"清空历史",en:"Clear history"},sessionsDeleteConfirm:{zh:"确认删除会话",en:"Delete session"},sessionsHistoryTitle:{zh:"历史",en:"History"},sessionsHistoryDescription:{zh:"最近 200 条消息(展示窗口)。",en:"Latest 200 messages (display window)."},sessionsHistoryLoading:{zh:"加载历史中...",en:"Loading history..."},sessionsApplyingChanges:{zh:"正在应用会话变更...",en:"Applying session changes..."},sessionsUnknownChannel:{zh:"未知渠道",en:"Unknown channel"},sessionsAllChannels:{zh:"全部渠道",en:"All Channels"},sessionsMetadata:{zh:"元信息",en:"Metadata"},sessionsNoSelectionTitle:{zh:"未选择会话",en:"No Session Selected"},sessionsNoSelectionDescription:{zh:"从左侧列表选择一个会话以查看聊天历史并配置其元信息。",en:"Select a session from the list on the left to view its chat history and configure its metadata."},cronPageTitle:{zh:"定时任务",en:"Cron Jobs"},cronPageDescription:{zh:"查看与删除定时任务,关注执行时间与状态。",en:"View and delete cron jobs, track schedule and status."},cronSearchPlaceholder:{zh:"搜索名称 / 消息 / ID",en:"Search name / message / ID"},cronStatusLabel:{zh:"状态",en:"Status"},cronStatusAll:{zh:"全部",en:"All"},cronStatusEnabled:{zh:"仅启用",en:"Enabled"},cronStatusDisabled:{zh:"仅禁用",en:"Disabled"},cronTotalLabel:{zh:"总数",en:"Total"},cronLoading:{zh:"加载定时任务中...",en:"Loading cron jobs..."},cronEmpty:{zh:"暂无定时任务。",en:"No cron jobs yet."},cronScheduleLabel:{zh:"计划",en:"Schedule"},cronDeliverTo:{zh:"投递到",en:"Deliver to"},cronNextRun:{zh:"下次执行",en:"Next run"},cronLastRun:{zh:"上次执行",en:"Last run"},cronLastStatus:{zh:"上次状态",en:"Last status"},cronDeleteConfirm:{zh:"确认删除定时任务",en:"Delete cron job"},cronOneShot:{zh:"一次性",en:"One-shot"},cronEnable:{zh:"启用",en:"Enable"},cronDisable:{zh:"禁用",en:"Disable"},cronRunNow:{zh:"立即执行",en:"Run now"},cronEnableConfirm:{zh:"确认启用定时任务",en:"Enable cron job"},cronDisableConfirm:{zh:"确认禁用定时任务",en:"Disable cron job"},cronRunConfirm:{zh:"确认立即执行定时任务",en:"Run cron job now"},cronRunForceConfirm:{zh:"任务已禁用,仍要立即执行",en:"Cron job disabled. Force run now"},marketplacePageTitle:{zh:"市场",en:"Marketplace"},marketplacePageDescription:{zh:"更清爽的扩展列表,聚焦安装/启用/禁用。",en:"A cleaner extension list focused on install / enable / disable."},marketplaceTabMarketplace:{zh:"市场",en:"Marketplace"},marketplaceTabInstalled:{zh:"已安装",en:"Installed"},marketplaceSearchPlaceholder:{zh:"搜索扩展...",en:"Search extensions..."},marketplaceFilterAll:{zh:"全部",en:"All"},marketplaceFilterPlugins:{zh:"插件",en:"Plugins"},marketplaceFilterSkills:{zh:"技能",en:"Skills"},marketplaceSortRelevance:{zh:"相关性",en:"Relevance"},marketplaceSortUpdated:{zh:"最近更新",en:"Recently Updated"},marketplaceUnknownItem:{zh:"未知项目",en:"Unknown Item"},marketplaceInstalledLocalSummary:{zh:"已在本地安装,市场暂无详情。",en:"Installed locally. Details are currently unavailable from marketplace."},marketplaceTypePlugin:{zh:"插件",en:"Plugin"},marketplaceTypeSkill:{zh:"技能",en:"Skill"},marketplaceTypeExtension:{zh:"扩展",en:"Extension"},marketplaceInstall:{zh:"安装",en:"Install"},marketplaceInstalling:{zh:"安装中...",en:"Installing..."},marketplaceEnable:{zh:"启用",en:"Enable"},marketplaceDisable:{zh:"禁用",en:"Disable"},marketplaceEnabling:{zh:"启用中...",en:"Enabling..."},marketplaceDisabling:{zh:"禁用中...",en:"Disabling..."},marketplaceUninstall:{zh:"卸载",en:"Uninstall"},marketplaceRemoving:{zh:"卸载中...",en:"Removing..."},marketplaceSectionInstalled:{zh:"已安装",en:"Installed"},marketplaceSectionExtensions:{zh:"扩展",en:"Extensions"},marketplaceErrorLoadingData:{zh:"加载市场数据失败",en:"Failed to load marketplace data"},marketplaceErrorLoadingInstalled:{zh:"加载已安装项目失败",en:"Failed to load installed items"},marketplaceNoItems:{zh:"未找到项目。",en:"No items found."},marketplaceNoInstalledItems:{zh:"未找到已安装项目。",en:"No installed items found."},marketplaceUninstallTitle:{zh:"确认卸载",en:"Uninstall"},marketplaceUninstallDescription:{zh:"该操作会移除扩展,后续可在市场中重新安装。",en:"This will remove the extension. You can install it again from the marketplace."},marketplaceInstallFailed:{zh:"安装失败",en:"Install failed"},marketplaceOperationFailed:{zh:"操作失败",en:"Operation failed"},marketplaceInstalledCountSuffix:{zh:"已安装",en:"installed"},connected:{zh:"已连接",en:"Connected"},disconnected:{zh:"未连接",en:"Disconnected"},connecting:{zh:"连接中...",en:"Connecting..."},feishuConnecting:{zh:"验证 / 连接中...",en:"Verifying / connecting..."},statusReady:{zh:"就绪",en:"Ready"},statusSetup:{zh:"待配置",en:"Setup"},statusActive:{zh:"活跃",en:"Active"},statusInactive:{zh:"未启用",en:"Inactive"},actionConfigure:{zh:"配置",en:"Configure"},actionAddProvider:{zh:"添加提供商",en:"Add Provider"},actionEnable:{zh:"启用",en:"Enable"},configSaved:{zh:"配置已保存",en:"Configuration saved"},configSavedApplied:{zh:"配置已保存并已应用",en:"Configuration saved and applied"},configSaveFailed:{zh:"保存配置失败",en:"Failed to save configuration"},configReloaded:{zh:"配置已重载",en:"Configuration reloaded"},configReloadFailed:{zh:"重载配置失败",en:"Failed to reload configuration"},feishuVerifySuccess:{zh:"验证成功,请到飞书开放平台完成事件订阅与发布后再开始使用。",en:"Verified. Please finish Feishu event subscription and app publishing before using."},feishuVerifyFailed:{zh:"验证失败",en:"Verification failed"},enterTag:{zh:"输入后按回车...",en:"Type and press Enter..."},headerName:{zh:"Header 名称",en:"Header Name"},headerValue:{zh:"Header 值",en:"Header Value"},docBrowserTitle:{zh:"帮助文档",en:"Help Docs"},docBrowserSearchPlaceholder:{zh:"搜索,也可以输入文档地址直接打开",en:"Search, or enter a doc URL to open"},docBrowserUrlPlaceholder:{zh:"输入文档路径,如 /guide/channels",en:"Enter a doc path, e.g. /guide/channels"},docBrowserOpenExternal:{zh:"文档中心打开",en:"Open in Docs"},docBrowserFloatMode:{zh:"悬浮窗口",en:"Float Window"},docBrowserDockMode:{zh:"固定到侧栏",en:"Dock to Sidebar"},docBrowserClose:{zh:"关闭",en:"Close"},docBrowserHelp:{zh:"帮助文档",en:"Help Docs"}};function p(e,t=k()){var s,o;return((s=G[e])==null?void 0:s[t])||((o=G[e])==null?void 0:o.en)||e}const ie="nextclaw.ui.theme",K=[{value:"warm",labelKey:"themeWarm"},{value:"cool",labelKey:"themeCool"}];let y="warm",M=!1;const E=new Set;function Xe(e){return e==="warm"||e==="cool"}function le(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function Ze(){if(typeof window>"u")return"warm";try{const e=window.localStorage.getItem(ie);if(Xe(e))return e}catch{}return"warm"}function H(){return M||(y=Ze(),le(y),M=!0),y}function en(){return M?y:H()}function nn(e){if(H(),e!==y){if(y=e,le(y),typeof window<"u")try{window.localStorage.setItem(ie,y)}catch{}E.forEach(t=>t(y))}}function tn(e){return E.add(e),()=>{E.delete(e)}}const R="docs.nextclaw.io",q="nextclaw-docs.pages.dev",sn=new Set([R,`www.${R}`,q,`www.${q}`]),j=`https://${R}`;function v(e){try{return new URL(e).pathname.replace(/\.html$/,"").replace(/\/$/,"")}catch{return e}}const ce=a.createContext(null);function V(){const e=a.useContext(ce);if(!e)throw new Error("useDocBrowser must be used within DocBrowserProvider");return e}function an(e){try{const t=new URL(e,window.location.origin);return sn.has(t.hostname)}catch{return!1}}function on({children:e}){const[t,s]=a.useState({isOpen:!1,mode:"docked",currentUrl:`${j}/guide/getting-started`,history:[`${j}/guide/getting-started`],historyIndex:0,navVersion:0}),o=a.useCallback(d=>{const u=d||t.currentUrl||`${j}/guide/getting-started`;s(I=>({...I,isOpen:!0,currentUrl:u,history:[...I.history.slice(0,I.historyIndex+1),u],historyIndex:I.historyIndex+1,navVersion:I.navVersion+1}))},[t.currentUrl]),r=a.useCallback(()=>{s(d=>({...d,isOpen:!1}))},[]),c=a.useCallback(()=>{s(d=>({...d,mode:d.mode==="floating"?"docked":"floating"}))},[]),l=a.useCallback(d=>{s(u=>({...u,mode:d}))},[]),h=a.useCallback(d=>{s(u=>v(d)===v(u.currentUrl)?u:{...u,currentUrl:d,history:[...u.history.slice(0,u.historyIndex+1),d],historyIndex:u.historyIndex+1,navVersion:u.navVersion+1})},[]),w=a.useCallback(d=>{s(u=>v(d)===v(u.currentUrl)?u:{...u,currentUrl:d,history:[...u.history.slice(0,u.historyIndex+1),d],historyIndex:u.historyIndex+1})},[]),m=a.useCallback(()=>{s(d=>{if(d.historyIndex<=0)return d;const u=d.historyIndex-1;return{...d,historyIndex:u,currentUrl:d.history[u]}})},[]),g=a.useCallback(()=>{s(d=>{if(d.historyIndex>=d.history.length-1)return d;const u=d.historyIndex+1;return{...d,historyIndex:u,currentUrl:d.history[u]}})},[]),f=t.historyIndex>0,i=t.historyIndex<t.history.length-1,P=a.useMemo(()=>({...t,open:o,close:r,toggleMode:c,setMode:l,navigate:h,syncUrl:w,goBack:m,goForward:g,canGoBack:f,canGoForward:i}),[t,o,r,c,l,h,w,m,g,f,i]);return n.jsx(ce.Provider,{value:P,children:e})}function rn(){const e=V();a.useEffect(()=>{const t=s=>{const o=s.target.closest("a[href]");if(!o)return;const r=o.getAttribute("href")||"";an(r)&&(o.hasAttribute("data-doc-external")||s.ctrlKey||s.metaKey||s.shiftKey||(s.preventDefault(),s.stopPropagation(),e.open(r)))};return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[e])}const de=a.createContext(null);function ln({children:e}){const[t,s]=a.useState(()=>B());a.useEffect(()=>Ye(h=>{s(h)}),[]);const o=a.useCallback(l=>{Qe(l),s(k())},[]),r=a.useCallback(()=>{o(t==="en"?"zh":"en")},[t,o]),c=a.useMemo(()=>({language:t,setLanguage:o,toggleLanguage:r}),[t,o,r]);return n.jsx(de.Provider,{value:c,children:e})}function cn(){const e=a.useContext(de);if(!e)throw new Error("useI18n must be used within I18nProvider");return{...e,t:p}}const he=a.createContext(null);function dn({children:e}){const[t,s]=a.useState(()=>H());a.useEffect(()=>tn(l=>{s(l)}),[]);const o=a.useCallback(c=>{nn(c),s(en())},[]),r=a.useMemo(()=>({theme:t,setTheme:o}),[t,o]);return n.jsx(he.Provider,{value:r,children:e})}function hn(){const e=a.useContext(he);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const J=ke,Mn=Pe,U=a.forwardRef(({className:e,children:t,...s},o)=>n.jsxs(X,{ref:o,className:x("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 bg-white",e),...s,children:[t,n.jsx(fe,{asChild:!0,children:n.jsx(Z,{className:"h-4 w-4 opacity-50"})})]}));U.displayName=X.displayName;const ue=a.forwardRef(({className:e,...t},s)=>n.jsx(ee,{ref:s,className:x("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(ze,{className:"h-4 w-4"})}));ue.displayName=ee.displayName;const me=a.forwardRef(({className:e,...t},s)=>n.jsx(ne,{ref:s,className:x("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(Z,{className:"h-4 w-4"})}));me.displayName=ne.displayName;const O=a.forwardRef(({className:e,children:t,position:s="popper",...o},r)=>n.jsx(xe,{children:n.jsxs(te,{ref:r,className:x("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-white",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:[n.jsx(ue,{}),n.jsx(ye,{className:x("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),n.jsx(me,{})]})}));O.displayName=te.displayName;const un=a.forwardRef(({className:e,...t},s)=>n.jsx(se,{ref:s,className:x("px-2 py-1.5 text-sm font-semibold",e),...t}));un.displayName=se.displayName;const _=a.forwardRef(({className:e,children:t,...s},o)=>n.jsxs(ae,{ref:o,className:x("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100",e),...s,children:[n.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(we,{children:n.jsx(be,{className:"h-4 w-4"})})}),n.jsx(Se,{children:t})]}));_.displayName=ae.displayName;const mn=a.forwardRef(({className:e,...t},s)=>n.jsx(oe,{ref:s,className:x("-mx-1 my-1 h-px bg-muted",e),...t}));mn.displayName=oe.displayName;function pn(){var g,f;const e=V(),{language:t,setLanguage:s}=cn(),{theme:o,setTheme:r}=hn(),c=((g=$.find(i=>i.value===t))==null?void 0:g.label)??t,l=p(((f=K.find(i=>i.value===o))==null?void 0:f.labelKey)??"themeWarm"),h=i=>{t!==i&&(s(i),window.location.reload())},w=i=>{o!==i&&r(i)},m=[{target:"/model",label:p("model"),icon:Ie},{target:"/providers",label:p("providers"),icon:Ce},{target:"/channels",label:p("channels"),icon:ve},{target:"/runtime",label:p("runtime"),icon:Te},{target:"/sessions",label:p("sessions"),icon:Ae},{target:"/cron",label:p("cron"),icon:De},{target:"/marketplace",label:p("marketplace"),icon:je}];return n.jsxs("aside",{className:"w-[240px] shrink-0 flex flex-col h-full py-6 px-4 bg-secondary",children:[n.jsx("div",{className:"px-2 mb-8",children:n.jsxs("div",{className:"flex items-center gap-2.5 cursor-pointer",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center",children:n.jsx("img",{src:"/logo.svg",alt:"NextClaw",className:"h-full w-full object-contain"})}),n.jsx("span",{className:"text-[15px] font-semibold text-gray-800 tracking-[-0.01em]",children:"NextClaw"})]})}),n.jsx("nav",{className:"flex-1",children:n.jsx("ul",{className:"space-y-1",children:m.map(i=>{const P=i.icon;return n.jsx("li",{children:n.jsx(Le,{to:i.target,className:({isActive:d})=>x("group w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base",d?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:d})=>n.jsxs(n.Fragment,{children:[n.jsx(P,{className:x("h-[17px] w-[17px] transition-colors",d?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),n.jsx("span",{className:"flex-1 text-left",children:i.label})]})})},i.target)})})}),n.jsxs("div",{className:"pt-3 border-t border-[#dde0ea] mt-3",children:[n.jsx("div",{className:"mb-2",children:n.jsxs(J,{value:o,onValueChange:i=>w(i),children:[n.jsxs(U,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx(Ne,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"text-left",children:p("theme")})]}),n.jsx("span",{className:"ml-auto text-xs text-gray-500",children:l})]}),n.jsx(O,{children:K.map(i=>n.jsx(_,{value:i.value,className:"text-xs",children:p(i.labelKey)},i.value))})]})}),n.jsx("div",{className:"mb-2",children:n.jsxs(J,{value:t,onValueChange:i=>h(i),children:[n.jsxs(U,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx(Me,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"text-left",children:p("language")})]}),n.jsx("span",{className:"ml-auto text-xs text-gray-500",children:c})]}),n.jsx(O,{children:$.map(i=>n.jsx(_,{value:i.value,className:"text-xs",children:i.label},i.value))})]})}),n.jsxs("button",{onClick:()=>e.open(),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base text-gray-600 hover:bg-[#e4e7ef] hover:text-gray-800",children:[n.jsx(Ee,{className:"h-[17px] w-[17px] text-gray-400"}),n.jsx("span",{className:"flex-1 text-left",children:p("docBrowserHelp")})]})]})]})}const Q=a.lazy(async()=>({default:(await b(async()=>{const{DocBrowser:e}=await import("./DocBrowser-CBY75a92.js");return{DocBrowser:e}},__vite__mapDeps([0,1]))).DocBrowser}));function gn({children:e}){const{isOpen:t,mode:s}=V();return rn(),n.jsxs("div",{className:"h-screen flex bg-background font-sans text-foreground",children:[n.jsx(pn,{}),n.jsxs("div",{className:"flex-1 flex min-w-0 overflow-hidden relative",children:[n.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:n.jsx("main",{className:"flex-1 overflow-auto custom-scrollbar p-8",children:n.jsx("div",{className:"max-w-6xl mx-auto animate-fade-in h-full",children:e})})}),t&&s==="docked"&&n.jsx(a.Suspense,{fallback:null,children:n.jsx(Q,{})})]}),t&&s==="floating"&&n.jsx(a.Suspense,{fallback:null,children:n.jsx(Q,{})})]})}function fn({children:e}){return n.jsx(on,{children:n.jsx(gn,{children:e})})}class zn{constructor(t){this.url=t,this.ws=null,this.handlers=new Map,this.reconnectTimer=null,this.manualClose=!1}connect(){this.manualClose=!1,this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("WebSocket connected"),this.emit({type:"connection.open",payload:{}})},this.ws.onmessage=t=>{try{const s=JSON.parse(t.data);this.emit(s)}catch(s){console.error("Failed to parse WebSocket message:",s)}},this.ws.onclose=()=>{console.log("WebSocket disconnected"),this.manualClose||this.scheduleReconnect()},this.ws.onerror=t=>{console.error("WebSocket error:",t)}}on(t,s){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(s)}off(t,s){var o;(o=this.handlers.get(t))==null||o.delete(s)}emit(t){const s=this.handlers.get(t.type);s==null||s.forEach(o=>o(t))}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}disconnect(){var t;this.manualClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}}const xn="http://127.0.0.1:18791",A=(()=>{var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)?window.location.origin:xn})();async function T(e,t={}){const s=`${A}${e}`,o=await fetch(s,{headers:{"Content-Type":"application/json",...t.headers},...t}),r=await o.text();let c=null;if(r)try{c=JSON.parse(r)}catch{}if(!c){const l=r?r.slice(0,200):"";return{ok:!1,error:{code:"INVALID_RESPONSE",message:`Non-JSON response (${o.status} ${o.statusText})${l?`: ${l}`:""}`}}}return o.ok,c}const En={get:e=>T(e,{method:"GET"}),put:(e,t)=>T(e,{method:"PUT",body:JSON.stringify(t)}),post:(e,t)=>T(e,{method:"POST",body:JSON.stringify(t)}),delete:e=>T(e,{method:"DELETE"})},yn=Re(e=>({connectionStatus:"disconnected",setConnectionStatus:t=>e({connectionStatus:t}),providerModal:{open:!1},openProviderModal:t=>e({providerModal:{open:!0,provider:t}}),closeProviderModal:()=>e({providerModal:{open:!1}}),channelModal:{open:!1},openChannelModal:t=>e({channelModal:{open:!0,channel:t}}),closeChannelModal:()=>e({channelModal:{open:!1}})}));function wn(e){const[t,s]=a.useState(null),{setConnectionStatus:o}=yn();return a.useEffect(()=>{const r=(()=>{const l=A==null?void 0:A.replace(/\/$/,"");if(!l)return"ws://127.0.0.1:18791/ws";try{const h=new URL(l,window.location.origin);return`${h.protocol==="https:"?"wss:":h.protocol==="http:"?"ws:":h.protocol}//${h.host}/ws`}catch{return l.startsWith("wss://")||l.startsWith("ws://")?`${l}/ws`:l.startsWith("https://")?`${l.replace(/^https:/,"wss:")}/ws`:l.startsWith("http://")?`${l.replace(/^http:/,"ws:")}/ws`:`${l}/ws`}})(),c=new zn(r);return c.on("connection.open",()=>{o("connected")}),c.on("config.updated",()=>{e&&e.invalidateQueries({queryKey:["config"]})}),c.on("error",l=>{l.type==="error"&&console.error("WebSocket error:",l.payload.message)}),c.connect(),s(c),()=>c.disconnect()},[o,e]),t}const Y=new Ue({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),bn=a.lazy(async()=>({default:(await b(async()=>{const{ModelConfig:e}=await import("./ModelConfig-CBmc0ERp.js");return{ModelConfig:e}},__vite__mapDeps([2,1,3,4,5,6,7]))).ModelConfig})),Sn=a.lazy(async()=>({default:(await b(async()=>{const{ProvidersList:e}=await import("./ProvidersList-CZfmOr6_.js");return{ProvidersList:e}},__vite__mapDeps([8,1,5,9,3,6,7,10,11]))).ProvidersList})),kn=a.lazy(async()=>({default:(await b(async()=>{const{ChannelsList:e}=await import("./ChannelsList-DHBUkGsA.js");return{ChannelsList:e}},__vite__mapDeps([12,1,5,9,3,6,13,7,10,11]))).ChannelsList})),Pn=a.lazy(async()=>({default:(await b(async()=>{const{RuntimeConfig:e}=await import("./RuntimeConfig-DX6nI_b5.js");return{RuntimeConfig:e}},__vite__mapDeps([14,1,5,3,4,13,7]))).RuntimeConfig})),In=a.lazy(async()=>({default:(await b(async()=>{const{SessionsConfig:e}=await import("./SessionsConfig-wH-647_6.js");return{SessionsConfig:e}},__vite__mapDeps([15,1,16,9,3,5]))).SessionsConfig})),Cn=a.lazy(async()=>({default:(await b(async()=>{const{CronConfig:e}=await import("./CronConfig-9YgJQTmP.js");return{CronConfig:e}},__vite__mapDeps([17,1,16,9,3,5,4]))).CronConfig})),vn=a.lazy(async()=>({default:(await b(async()=>{const{MarketplacePage:e}=await import("./MarketplacePage-Dw_0TLNd.js");return{MarketplacePage:e}},__vite__mapDeps([18,1,10,9,16,3]))).MarketplacePage}));function Tn(){return n.jsx("div",{className:"h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40"})}function S({children:e}){return n.jsx(a.Suspense,{fallback:n.jsx(Tn,{}),children:e})}function An(){wn(Y);const e=Oe();return n.jsxs(_e,{client:Y,children:[n.jsx(fn,{children:n.jsx("div",{className:"animate-fade-in w-full h-full",children:n.jsxs(Be,{children:[n.jsx(z,{path:"/model",element:n.jsx(S,{children:n.jsx(bn,{})})}),n.jsx(z,{path:"/providers",element:n.jsx(S,{children:n.jsx(Sn,{})})}),n.jsx(z,{path:"/channels",element:n.jsx(S,{children:n.jsx(kn,{})})}),n.jsx(z,{path:"/runtime",element:n.jsx(S,{children:n.jsx(Pn,{})})}),n.jsx(z,{path:"/sessions",element:n.jsx(S,{children:n.jsx(In,{})})}),n.jsx(z,{path:"/cron",element:n.jsx(S,{children:n.jsx(Cn,{})})}),n.jsx(z,{path:"/marketplace",element:n.jsx(D,{to:"/marketplace/plugins",replace:!0})}),n.jsx(z,{path:"/marketplace/:type",element:n.jsx(S,{children:n.jsx(vn,{})})}),n.jsx(z,{path:"/",element:n.jsx(D,{to:"/model",replace:!0})}),n.jsx(z,{path:"*",element:n.jsx(D,{to:"/model",replace:!0})})]})},e.pathname)}),n.jsx(Fe,{position:"top-right",richColors:!0})]})}He.createRoot(document.getElementById("root")).render(n.jsx(a.StrictMode,{children:n.jsx(dn,{children:n.jsx(ln,{children:n.jsx(Ve,{children:n.jsx(An,{})})})})}));export{j as D,J as S,U as a,Mn as b,x as c,O as d,_ as e,Nn as f,Ln as g,jn as h,En as i,V as j,p as t,yn as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as o}from"./vendor-Dkx07DIh.js";import{c as t}from"./index-
|
|
1
|
+
import{r as s,j as o}from"./vendor-Dkx07DIh.js";import{c as t}from"./index-CVOQiX2_.js";const l=s.forwardRef(({className:e,...a},r)=>o.jsx("label",{ref:r,className:t("text-sm font-medium leading-none text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...a}));l.displayName="Label";export{l as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,r as N,j as n}from"./vendor-Dkx07DIh.js";import{c as v}from"./index-
|
|
1
|
+
import{c as p,r as N,j as n}from"./vendor-Dkx07DIh.js";import{c as v}from"./index-CVOQiX2_.js";const y=r=>typeof r=="boolean"?`${r}`:r===0?"0":r,f=p,w=(r,t)=>e=>{var i;if((t==null?void 0:t.variants)==null)return f(r,e==null?void 0:e.class,e==null?void 0:e.className);const{variants:u,defaultVariants:o}=t,g=Object.keys(u).map(a=>{const s=e==null?void 0:e[a],d=o==null?void 0:o[a];if(s===null)return null;const l=y(s)||y(d);return u[a][l]}),m=e&&Object.entries(e).reduce((a,s)=>{let[d,l]=s;return l===void 0||(a[d]=l),a},{}),b=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((a,s)=>{let{class:d,className:l,...h}=s;return Object.entries(h).every(j=>{let[x,c]=j;return Array.isArray(c)?c.includes({...o,...m}[x]):{...o,...m}[x]===c})?[...a,d,l]:a},[]);return f(r,g,b,e==null?void 0:e.class,e==null?void 0:e.className)},V=w("inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600",secondary:"bg-gray-100 text-gray-700 hover:bg-gray-200/80",ghost:"hover:bg-gray-100/80 hover:text-gray-800",link:"text-primary underline-offset-4 hover:underline",primary:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",subtle:"bg-gray-100 text-gray-600 hover:bg-gray-200/80","primary-outline":"border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-11 px-5 text-[14px]",xl:"h-12 px-6 text-[15px]",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),k=N.forwardRef(({className:r,variant:t,size:e,...i},u)=>n.jsx("button",{className:v(V({variant:t,size:e,className:r})),ref:u,...i}));k.displayName="Button";function O({children:r,fullHeight:t=!1,className:e}){return n.jsx("div",{className:v("animate-fade-in",t?"h-[calc(100vh-80px)] w-full flex flex-col":"pb-16",e),children:r})}function B({title:r,description:t,actions:e,className:i}){return n.jsxs("div",{className:v("flex items-center justify-between mb-6 shrink-0",i),children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:r}),t&&n.jsx("p",{className:"text-sm text-gray-500 mt-1",children:t})]}),e&&n.jsx("div",{className:"flex items-center gap-2 shrink-0",children:e})]})}export{k as B,O as P,B as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as i}from"./vendor-Dkx07DIh.js";import{c as t}from"./index-
|
|
1
|
+
import{r as e,j as i}from"./vendor-Dkx07DIh.js";import{c as t}from"./index-CVOQiX2_.js";const l=e.forwardRef(({className:o,checked:r=!1,onCheckedChange:s,...a},n)=>i.jsx("button",{type:"button",role:"switch","aria-checked":r,ref:n,className:t("peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r?"bg-primary":"bg-gray-200/80 hover:bg-gray-300/80",o),onClick:()=>s==null?void 0:s(!r),...a,children:i.jsx("span",{className:t("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast",r?"translate-x-5":"translate-x-0")})}));l.displayName="Switch";export{l as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-Dkx07DIh.js";import{f as m,c as s}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-Dkx07DIh.js";import{f as m,c as s}from"./index-CVOQiX2_.js";function c({tabs:a,activeTab:i,onChange:o,className:n}){return e.jsx("div",{className:s("flex items-center gap-6 border-b border-gray-200/60 mb-6",n),children:a.map(t=>{const r=i===t.id;return e.jsxs("button",{onClick:()=>o(t.id),className:s("relative pb-3 text-[14px] font-medium transition-all duration-fast flex items-center gap-1.5",r?"text-gray-900":"text-gray-600 hover:text-gray-900"),children:[t.label,t.count!==void 0&&e.jsx("span",{className:s("text-[11px] font-medium","text-gray-500"),children:m(t.count)}),r&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-primary rounded-full"})]},t.id)})})}export{c as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as l,ah as c,ai as u,aj as i,a1 as o}from"./vendor-Dkx07DIh.js";import{c as g,i as s,t}from"./index-
|
|
1
|
+
import{r as d,j as l,ah as c,ai as u,aj as i,a1 as o}from"./vendor-Dkx07DIh.js";import{c as g,i as s,t}from"./index-CVOQiX2_.js";const y=d.forwardRef(({className:e,type:n,...r},a)=>l.jsx("input",{type:n,className:g("flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...r}));y.displayName="Input";async function p(){const e=await s.get("/api/config");if(!e.ok)throw new Error(e.error.message);return e.data}async function m(){const e=await s.get("/api/config/meta");if(!e.ok)throw new Error(e.error.message);return e.data}async function w(){const e=await s.get("/api/config/schema");if(!e.ok)throw new Error(e.error.message);return e.data}async function h(e){const n=await s.put("/api/config/model",e);if(!n.ok)throw new Error(n.error.message);return n.data}async function S(e,n){const r=await s.put(`/api/config/providers/${e}`,n);if(!r.ok)throw new Error(r.error.message);return r.data}async function q(e,n){const r=await s.put(`/api/config/channels/${e}`,n);if(!r.ok)throw new Error(r.error.message);return r.data}async function v(e){const n=await s.put("/api/config/runtime",e);if(!n.ok)throw new Error(n.error.message);return n.data}async function C(e,n){const r=await s.post(`/api/config/actions/${e}/execute`,n);if(!r.ok)throw new Error(r.error.message);return r.data}async function E(e){var f;const n=new URLSearchParams;(f=e==null?void 0:e.q)!=null&&f.trim()&&n.set("q",e.q.trim()),typeof(e==null?void 0:e.limit)=="number"&&Number.isFinite(e.limit)&&n.set("limit",String(Math.max(0,Math.trunc(e.limit)))),typeof(e==null?void 0:e.activeMinutes)=="number"&&Number.isFinite(e.activeMinutes)&&n.set("activeMinutes",String(Math.max(0,Math.trunc(e.activeMinutes))));const r=n.toString(),a=await s.get(r?"/api/sessions?"+r:"/api/sessions");if(!a.ok)throw new Error(a.error.message);return a.data}async function F(e,n=200){const r=await s.get(`/api/sessions/${encodeURIComponent(e)}/history?limit=${Math.max(1,Math.trunc(n))}`);if(!r.ok)throw new Error(r.error.message);return r.data}async function b(e,n){const r=await s.put(`/api/sessions/${encodeURIComponent(e)}`,n);if(!r.ok)throw new Error(r.error.message);return r.data}async function x(e){const n=await s.delete(`/api/sessions/${encodeURIComponent(e)}`);if(!n.ok)throw new Error(n.error.message);return n.data}async function K(e){const n=new URLSearchParams;e!=null&&e.all&&n.set("all","1");const r=n.toString(),a=await s.get(r?"/api/cron?"+r:"/api/cron");if(!a.ok)throw new Error(a.error.message);return a.data}async function k(e){const n=await s.delete(`/api/cron/${encodeURIComponent(e)}`);if(!n.ok)throw new Error(n.error.message);return n.data}async function M(e,n){const r=await s.put(`/api/cron/${encodeURIComponent(e)}/enable`,n);if(!r.ok)throw new Error(r.error.message);return r.data}async function Q(e,n){const r=await s.post(`/api/cron/${encodeURIComponent(e)}/run`,n);if(!r.ok)throw new Error(r.error.message);return r.data}function I(){return c({queryKey:["config"],queryFn:p,staleTime:3e4,refetchOnWindowFocus:!0})}function $(){return c({queryKey:["config-meta"],queryFn:m,staleTime:1/0})}function A(){return c({queryKey:["config-schema"],queryFn:w,staleTime:1/0})}function J(){const e=u();return i({mutationFn:h,onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),o.success(t("configSaved"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function T(){const e=u();return i({mutationFn:({provider:n,data:r})=>S(n,r),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),o.success(t("configSaved"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function j(){const e=u();return i({mutationFn:({channel:n,data:r})=>q(n,r),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function N(){const e=u();return i({mutationFn:({data:n})=>v(n),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function P(){return i({mutationFn:({actionId:e,data:n})=>C(e,n),onError:e=>{o.error(t("error")+": "+e.message)}})}function D(e){return c({queryKey:["sessions",e],queryFn:()=>E(e),staleTime:1e4})}function H(e,n=200){return c({queryKey:["session-history",e,n],queryFn:()=>F(e,n),enabled:!!e,staleTime:5e3})}function L(){const e=u();return i({mutationFn:({key:n,data:r})=>b(n,r),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history",r.key]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function B(){const e=u();return i({mutationFn:({key:n})=>x(n),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function O(e={all:!0}){return c({queryKey:["cron",e],queryFn:()=>K(e),staleTime:1e4})}function W(){const e=u();return i({mutationFn:({id:n})=>k(n),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function _(){const e=u();return i({mutationFn:({id:n,enabled:r})=>M(n,{enabled:r}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}function z(){const e=u();return i({mutationFn:({id:n,force:r})=>Q(n,{force:r}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),o.success(t("configSavedApplied"))},onError:n=>{o.error(t("configSaveFailed")+": "+n.message)}})}export{y as I,A as a,J as b,$ as c,T as d,j as e,P as f,N as g,D as h,H as i,L as j,B as k,O as l,W as m,_ as n,z as o,I as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,r as t}from"./vendor-Dkx07DIh.js";import{D as p,a as C,b as h,c as x,d as D,e as g}from"./dialog-
|
|
1
|
+
import{j as a,r as t}from"./vendor-Dkx07DIh.js";import{D as p,a as C,b as h,c as x,d as D,e as g}from"./dialog-CqY6jnQm.js";import{B as m}from"./page-layout-CMuYE4DA.js";import{t as i}from"./index-CVOQiX2_.js";const j=({open:l,onOpenChange:r,title:c,description:o,confirmLabel:s=i("confirm"),cancelLabel:e=i("cancel"),variant:n="default",onConfirm:f,onCancel:u})=>{const d=()=>{f(),r(!1)},v=()=>{u(),r(!1)};return a.jsx(p,{open:l,onOpenChange:r,children:a.jsxs(C,{className:"[&>:last-child]:hidden",onCloseAutoFocus:b=>b.preventDefault(),children:[a.jsxs(h,{children:[a.jsx(x,{children:c}),o?a.jsx(D,{children:o}):null]}),a.jsxs(g,{className:"gap-2 sm:gap-0",children:[a.jsx(m,{type:"button",variant:"outline",onClick:v,children:e}),a.jsx(m,{type:"button",variant:n==="destructive"?"destructive":"default",onClick:d,children:s})]})]})})},L={open:!1,title:"",description:"",confirmLabel:i("confirm"),cancelLabel:i("cancel"),variant:"default",resolve:null};function F(){const[l,r]=t.useState(L),c=t.useCallback(e=>new Promise(n=>{r({open:!0,title:e.title,description:e.description??"",confirmLabel:e.confirmLabel??i("confirm"),cancelLabel:e.cancelLabel??i("cancel"),variant:e.variant??"default",resolve:f=>{n(f),r(u=>({...u,open:!1,resolve:null}))}})}),[]),o=t.useCallback(e=>{r(n=>(!e&&n.resolve&&n.resolve(!1),{...n,open:e,resolve:e?n.resolve:null}))},[]),s=t.useCallback(()=>a.jsx(j,{open:l.open,onOpenChange:o,title:l.title,description:l.description||void 0,confirmLabel:l.confirmLabel,cancelLabel:l.cancelLabel,variant:l.variant,onConfirm:()=>{var e;return(e=l.resolve)==null?void 0:e.call(l,!0)},onCancel:()=>{var e;return(e=l.resolve)==null?void 0:e.call(l,!1)}}),[l,o]);return{confirm:c,ConfirmDialog:s}}export{F as u};
|
package/ui-dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>NextClaw - 系统配置</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-CVOQiX2_.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-Dkx07DIh.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-DdpR1fdj.css">
|
|
12
12
|
</head>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as a,ak as Ae,al as _e,am as Oe,an as ge,ao as Fe,ap as $e,aq as S,ar as fe,as as qe,at as He,au as Ke,av as Ue,aw as ze,ax as Qe,ay as Be,ah as xe,ai as he,aj as ye,a1 as F,az as Ge,aA as Ve,aB as Ye}from"./vendor-Dkx07DIh.js";import{c as be,i as $,t as c,S as Xe,a as We,b as Ze,d as Je,e as de}from"./index-CJRpyLXg.js";import{T as pe}from"./tabs-custom-PWZmQDBG.js";import{P as ve}from"./dialog-CXsWIUTk.js";import{u as et}from"./useConfirmDialog-Bd2fAZGR.js";import{P as tt,a as nt}from"./page-layout-DJ75nLW5.js";var[q]=He("Tooltip",[fe]),H=fe(),ke="TooltipProvider",at=700,B="tooltip.open",[st,Y]=q(ke),Te=e=>{const{__scopeTooltip:t,delayDuration:n=at,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:o}=e,u=l.useRef(!0),b=l.useRef(!1),i=l.useRef(0);return l.useEffect(()=>{const h=i.current;return()=>window.clearTimeout(h)},[]),a.jsx(st,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:l.useCallback(()=>{window.clearTimeout(i.current),u.current=!1},[]),onClose:l.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>u.current=!0,s)},[s]),isPointerInTransitRef:b,onPointerInTransitChange:l.useCallback(h=>{b.current=h},[]),disableHoverableContent:r,children:o})};Te.displayName=ke;var L="Tooltip",[rt,D]=q(L),Ce=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:o,disableHoverableContent:u,delayDuration:b}=e,i=Y(L,e.__scopeTooltip),h=H(t),[p,y]=l.useState(null),v=Ae(),m=l.useRef(0),g=u??i.disableHoverableContent,f=b??i.delayDuration,k=l.useRef(!1),[T,C]=_e({prop:s,defaultProp:r??!1,onChange:A=>{A?(i.onOpen(),document.dispatchEvent(new CustomEvent(B))):i.onClose(),o==null||o(A)},caller:L}),j=l.useMemo(()=>T?k.current?"delayed-open":"instant-open":"closed",[T]),P=l.useCallback(()=>{window.clearTimeout(m.current),m.current=0,k.current=!1,C(!0)},[C]),w=l.useCallback(()=>{window.clearTimeout(m.current),m.current=0,C(!1)},[C]),M=l.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{k.current=!0,C(!0),m.current=0},f)},[f,C]);return l.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),a.jsx(Oe,{...h,children:a.jsx(rt,{scope:t,contentId:v,open:T,stateAttribute:j,trigger:p,onTriggerChange:y,onTriggerEnter:l.useCallback(()=>{i.isOpenDelayedRef.current?M():P()},[i.isOpenDelayedRef,M,P]),onTriggerLeave:l.useCallback(()=>{g?w():(window.clearTimeout(m.current),m.current=0)},[w,g]),onOpen:P,onClose:w,disableHoverableContent:g,children:n})})};Ce.displayName=L;var G="TooltipTrigger",we=l.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=D(G,n),o=Y(G,n),u=H(n),b=l.useRef(null),i=ge(t,b,r.onTriggerChange),h=l.useRef(!1),p=l.useRef(!1),y=l.useCallback(()=>h.current=!1,[]);return l.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),a.jsx(Fe,{asChild:!0,...u,children:a.jsx($e.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:i,onPointerMove:S(e.onPointerMove,v=>{v.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(r.onTriggerEnter(),p.current=!0)}),onPointerLeave:S(e.onPointerLeave,()=>{r.onTriggerLeave(),p.current=!1}),onPointerDown:S(e.onPointerDown,()=>{r.open&&r.onClose(),h.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:S(e.onFocus,()=>{h.current||r.onOpen()}),onBlur:S(e.onBlur,r.onClose),onClick:S(e.onClick,r.onClose)})})});we.displayName=G;var X="TooltipPortal",[ot,lt]=q(X,{forceMount:void 0}),je=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,o=D(X,t);return a.jsx(ot,{scope:t,forceMount:n,children:a.jsx(ve,{present:n||o.open,children:a.jsx(qe,{asChild:!0,container:r,children:s})})})};je.displayName=X;var I="TooltipContent",Pe=l.forwardRef((e,t)=>{const n=lt(I,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...o}=e,u=D(I,e.__scopeTooltip);return a.jsx(ve,{present:s||u.open,children:u.disableHoverableContent?a.jsx(Ne,{side:r,...o,ref:t}):a.jsx(it,{side:r,...o,ref:t})})}),it=l.forwardRef((e,t)=>{const n=D(I,e.__scopeTooltip),s=Y(I,e.__scopeTooltip),r=l.useRef(null),o=ge(t,r),[u,b]=l.useState(null),{trigger:i,onClose:h}=n,p=r.current,{onPointerInTransitChange:y}=s,v=l.useCallback(()=>{b(null),y(!1)},[y]),m=l.useCallback((g,f)=>{const k=g.currentTarget,T={x:g.clientX,y:g.clientY},C=mt(T,k.getBoundingClientRect()),j=gt(T,C),P=ft(f.getBoundingClientRect()),w=ht([...j,...P]);b(w),y(!0)},[y]);return l.useEffect(()=>()=>v(),[v]),l.useEffect(()=>{if(i&&p){const g=k=>m(k,p),f=k=>m(k,i);return i.addEventListener("pointerleave",g),p.addEventListener("pointerleave",f),()=>{i.removeEventListener("pointerleave",g),p.removeEventListener("pointerleave",f)}}},[i,p,m,v]),l.useEffect(()=>{if(u){const g=f=>{const k=f.target,T={x:f.clientX,y:f.clientY},C=(i==null?void 0:i.contains(k))||(p==null?void 0:p.contains(k)),j=!xt(T,u);C?v():j&&(v(),h())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[i,p,u,h,v]),a.jsx(Ne,{...e,ref:o})}),[ct,ut]=q(L,{isInside:!1}),dt=Qe("TooltipContent"),Ne=l.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:o,onPointerDownOutside:u,...b}=e,i=D(I,n),h=H(n),{onClose:p}=i;return l.useEffect(()=>(document.addEventListener(B,p),()=>document.removeEventListener(B,p)),[p]),l.useEffect(()=>{if(i.trigger){const y=v=>{const m=v.target;m!=null&&m.contains(i.trigger)&&p()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[i.trigger,p]),a.jsx(Ke,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:y=>y.preventDefault(),onDismiss:p,children:a.jsxs(Ue,{"data-state":i.stateAttribute,...h,...b,ref:t,style:{...b.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(dt,{children:s}),a.jsx(ct,{scope:n,isInside:!0,children:a.jsx(ze,{id:i.contentId,role:"tooltip",children:r||s})})]})})});Pe.displayName=I;var Se="TooltipArrow",pt=l.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=H(n);return ut(Se,n).isInside?null:a.jsx(Be,{...r,...s,ref:t})});pt.displayName=Se;function mt(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,r,o)){case o:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function gt(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function ft(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function xt(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const b=t[o],i=t[u],h=b.x,p=b.y,y=i.x,v=i.y;p>s!=v>s&&n<(y-h)*(s-p)/(v-p)+h&&(r=!r)}return r}function ht(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),yt(t)}function yt(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const o=t[t.length-1],u=t[t.length-2];if((o.x-u.x)*(r.y-u.y)>=(o.y-u.y)*(r.x-u.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const o=n[n.length-1],u=n[n.length-2];if((o.x-u.x)*(r.y-u.y)>=(o.y-u.y)*(r.x-u.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var bt=Te,vt=Ce,kt=we,Tt=je,Ee=Pe;const Ct=bt,z=vt,Q=kt,O=l.forwardRef(({className:e,sideOffset:t=4,...n},s)=>a.jsx(Tt,{children:a.jsx(Ee,{ref:s,sideOffset:t,className:be("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));O.displayName=Ee.displayName;async function wt(e={}){var r,o;const t=new URLSearchParams;(r=e.q)!=null&&r.trim()&&t.set("q",e.q.trim()),e.type&&t.set("type",e.type),(o=e.tag)!=null&&o.trim()&&t.set("tag",e.tag.trim()),e.sort&&t.set("sort",e.sort),typeof e.page=="number"&&Number.isFinite(e.page)&&t.set("page",String(Math.max(1,Math.trunc(e.page)))),typeof e.pageSize=="number"&&Number.isFinite(e.pageSize)&&t.set("pageSize",String(Math.max(1,Math.trunc(e.pageSize))));const n=t.toString(),s=await $.get(n?`/api/marketplace/items?${n}`:"/api/marketplace/items");if(!s.ok)throw new Error(s.error.message);return s.data}async function jt(e){const t=await $.post("/api/marketplace/install",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Pt(){const e=await $.get("/api/marketplace/installed");if(!e.ok)throw new Error(e.error.message);return e.data}async function Nt(e){const t=await $.post("/api/marketplace/manage",e);if(!t.ok)throw new Error(t.error.message);return t.data}function St(e){return xe({queryKey:["marketplace-items",e],queryFn:()=>wt(e),staleTime:15e3})}function Et(){return xe({queryKey:["marketplace-installed"],queryFn:Pt,staleTime:1e4})}function It(){const e=he();return ye({mutationFn:t=>jt(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed"]}),e.refetchQueries({queryKey:["marketplace-installed"],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"}),F.success(t.message||`${t.type} ${c("marketplaceInstalledCountSuffix")}`)},onError:t=>{F.error(t.message||c("marketplaceInstallFailed"))}})}function Mt(){const e=he();return ye({mutationFn:t=>Nt(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed"]}),e.invalidateQueries({queryKey:["marketplace-items"]}),e.refetchQueries({queryKey:["marketplace-installed"],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"}),F.success(t.message||`${t.action} success`)},onError:t=>{F.error(t.message||c("marketplaceOperationFailed"))}})}const Rt=12;function V(e){return(e??"").trim().toLowerCase()}function E(e,t){const n=V(t);return n.length>0?`${e}:${n}`:""}function Lt(e){const t=new Map;for(const n of e){const s=[n.install.spec,n.slug,n.id];for(const r of s){const o=E(n.type,r);!o||t.has(o)||t.set(o,n)}}return t}function Dt(e){const t=new Map;for(const n of e){const s=[n.spec,n.id,n.label];for(const r of s){const o=E(n.type,r);!o||t.has(o)||t.set(o,n)}}return t}function At(e,t){const n=[e.install.spec,e.slug,e.id];for(const s of n){const r=E(e.type,s);if(!r)continue;const o=t.get(r);if(o)return o}}function _t(e,t){const n=t.get(E(e.type,e.spec));if(n)return n;const s=t.get(E(e.type,e.id));return s||t.get(E(e.type,e.label))}function Ot(e,t,n){const s=V(n);return s?[e.id,e.spec,e.label,t==null?void 0:t.name,t==null?void 0:t.slug,t==null?void 0:t.summary,...(t==null?void 0:t.tags)??[]].map(o=>V(o)).filter(Boolean).some(o=>o.includes(s)):!0}function Ft(e){const t=["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"];let n=0;for(let s=0;s<e.length;s++)n=e.charCodeAt(s)+((n<<5)-n);return t[Math.abs(n)%t.length]}function $t({name:e,fallback:t}){const n=e||t,s=n.substring(0,2).toUpperCase(),r=Ft(n);return a.jsx("div",{className:be("flex items-center justify-center w-10 h-10 rounded-xl text-white font-semibold text-sm shrink-0",r),children:s})}function qt(e){return a.jsx("div",{className:"mb-4",children:a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.jsx(Ye,{className:"h-4 w-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),a.jsx("input",{value:e.searchText,onChange:t=>e.onSearchTextChange(t.target.value),placeholder:c("marketplaceSearchPlaceholder"),className:"w-full h-9 border border-gray-200/80 rounded-xl pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40"})]}),e.scope==="all"&&a.jsxs(Xe,{value:e.sort,onValueChange:t=>e.onSortChange(t),children:[a.jsx(We,{className:"h-9 w-[150px] shrink-0 rounded-lg",children:a.jsx(Ze,{})}),a.jsxs(Je,{children:[a.jsx(de,{value:"relevance",children:c("marketplaceSortRelevance")}),a.jsx(de,{value:"updated",children:c("marketplaceSortUpdated")})]})]})]})})}function me(e){var k,T,C,j;const t=e.record,n=(t==null?void 0:t.type)==="plugin"?t:void 0,s=((k=e.item)==null?void 0:k.type)??(t==null?void 0:t.type),r=((T=e.item)==null?void 0:T.name)??(t==null?void 0:t.label)??(t==null?void 0:t.id)??(t==null?void 0:t.spec)??c("marketplaceUnknownItem"),o=((C=e.item)==null?void 0:C.summary)??(t?c("marketplaceInstalledLocalSummary"):""),u=((j=e.item)==null?void 0:j.install.spec)??(t==null?void 0:t.spec)??"",b=(t==null?void 0:t.id)||(t==null?void 0:t.spec),i=!!b&&e.manageState.isPending&&e.manageState.targetId===b,h=!!n,p=(t==null?void 0:t.type)==="plugin"&&t.origin!=="bundled",y=(t==null?void 0:t.type)==="skill"&&t.source==="workspace",v=!!(p||y),m=t?t.enabled===!1||t.runtimeStatus==="disabled":!1,g=e.installState.isPending&&e.item&&e.installState.installingSpec===e.item.install.spec,f=s==="plugin"?c("marketplaceTypePlugin"):s==="skill"?c("marketplaceTypeSkill"):c("marketplaceTypeExtension");return a.jsxs("article",{className:"group bg-white border border-gray-200/40 hover:border-gray-200/80 rounded-2xl px-5 py-4 hover:shadow-md shadow-sm transition-all flex items-start gap-3.5 justify-between cursor-default",children:[a.jsxs("div",{className:"flex gap-3 min-w-0 flex-1 h-full items-start",children:[a.jsx($t,{name:r,fallback:u||c("marketplaceTypeExtension")}),a.jsx("div",{className:"min-w-0 flex-1 flex flex-col justify-center h-full",children:a.jsxs(Ct,{delayDuration:400,children:[a.jsxs(z,{children:[a.jsx(Q,{asChild:!0,children:a.jsx("div",{className:"text-[14px] font-semibold text-gray-900 truncate leading-tight cursor-default",children:r})}),a.jsx(O,{className:"max-w-[300px] text-xs",children:r})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 mb-1.5",children:[a.jsx("span",{className:"text-[11px] text-gray-500 font-medium",children:f}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[10px] text-gray-300",children:"•"}),a.jsxs(z,{children:[a.jsx(Q,{asChild:!0,children:a.jsx("span",{className:"text-[11px] text-gray-400 truncate max-w-full font-mono cursor-default",children:u})}),a.jsx(O,{className:"max-w-[300px] text-xs font-mono break-all",children:u})]})]})]}),a.jsxs(z,{children:[a.jsx(Q,{asChild:!0,children:a.jsx("p",{className:"text-[12px] text-gray-500/90 line-clamp-1 transition-colors leading-relaxed text-left cursor-default",children:o})}),o&&a.jsx(O,{className:"max-w-[400px] text-xs leading-relaxed",children:o})]})]})})]}),a.jsxs("div",{className:"shrink-0 flex items-center h-full",children:[e.item&&!t&&a.jsx("button",{onClick:()=>e.onInstall(e.item),disabled:e.installState.isPending,className:"inline-flex items-center gap-1.5 h-8 px-4 rounded-xl text-xs font-medium bg-primary text-white hover:bg-primary-600 disabled:opacity-50 transition-colors",children:g?c("marketplaceInstalling"):c("marketplaceInstall")}),n&&h&&a.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage(m?"enable":"disable",n),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-gray-200/80 text-gray-600 bg-white hover:bg-gray-50 hover:border-gray-300 disabled:opacity-50 transition-colors",children:i&&e.manageState.action!=="uninstall"?e.manageState.action==="enable"?c("marketplaceEnabling"):c("marketplaceDisabling"):m?c("marketplaceEnable"):c("marketplaceDisable")}),t&&v&&a.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage("uninstall",t),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-rose-100 text-rose-500 bg-white hover:bg-rose-50 hover:border-rose-200 disabled:opacity-50 transition-colors",children:i&&e.manageState.action==="uninstall"?c("marketplaceRemoving"):c("marketplaceUninstall")})]})]})}function Ht(e){return a.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[a.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onPrev,disabled:e.page<=1||e.busy,children:c("prev")}),a.jsx("div",{className:"text-sm text-gray-600 min-w-20 text-center",children:e.totalPages===0?"0 / 0":`${e.page} / ${e.totalPages}`}),a.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onNext,disabled:e.totalPages===0||e.page>=e.totalPages||e.busy,children:c("next")})]})}function Vt(){var ne,ae,se,re,oe,le,ie,ce,ue;const e=Ge(),t=Ve(),n=l.useMemo(()=>t.type==="plugins"||t.type==="skills"?t.type:null,[t.type]);l.useEffect(()=>{n||e("/marketplace/plugins",{replace:!0})},[n,e]);const s=n==="skills"?"skill":"plugin",[r,o]=l.useState(""),[u,b]=l.useState(""),[i,h]=l.useState("all"),[p,y]=l.useState("relevance"),[v,m]=l.useState(1);l.useEffect(()=>{const d=setTimeout(()=>{m(1),b(r.trim())},250);return()=>clearTimeout(d)},[r]),l.useEffect(()=>{m(1)},[s]);const g=Et(),f=St({q:u||void 0,type:s,sort:p,page:v,pageSize:Rt}),k=It(),T=Mt(),{confirm:C,ConfirmDialog:j}=et(),P=l.useMemo(()=>{var d;return((d=g.data)==null?void 0:d.records)??[]},[(ne=g.data)==null?void 0:ne.records]),w=l.useMemo(()=>{var d;return((d=f.data)==null?void 0:d.items)??[]},[(ae=f.data)==null?void 0:ae.items]),M=l.useMemo(()=>Lt(w),[w]),A=l.useMemo(()=>Dt(P),[P]),R=l.useMemo(()=>{const d=P.filter(x=>x.type===s).map(x=>({key:`${x.type}:${x.spec}:${x.id??""}`,record:x,item:_t(x,M)})).filter(x=>Ot(x.record,x.item,u));return d.sort((x,N)=>{const _=x.record.installedAt?Date.parse(x.record.installedAt):Number.NaN,U=N.record.installedAt?Date.parse(N.record.installedAt):Number.NaN,Le=!Number.isNaN(_),De=!Number.isNaN(U);return Le&&De&&_!==U?U-_:x.record.spec.localeCompare(N.record.spec)}),d},[P,s,M,u]),W=i==="installed"?R.length:((se=f.data)==null?void 0:se.total)??0,K=i==="installed"?1:((re=f.data)==null?void 0:re.totalPages)??0,Ie=l.useMemo(()=>i==="installed"?g.isLoading?c("loading"):`${R.length} ${c("marketplaceInstalledCountSuffix")}`:f.data?`${w.length} / ${W}`:c("loading"),[i,g.isLoading,R.length,f.data,w.length,W]),Z={isPending:k.isPending,installingSpec:(oe=k.variables)==null?void 0:oe.spec},J={isPending:T.isPending,targetId:((le=T.variables)==null?void 0:le.id)||((ie=T.variables)==null?void 0:ie.spec),action:(ce=T.variables)==null?void 0:ce.action},Me=[{id:"all",label:c("marketplaceTabMarketplace")},{id:"installed",label:c("marketplaceTabInstalled"),count:((ue=g.data)==null?void 0:ue.total)??0}],Re=[{id:"plugins",label:c("marketplaceFilterPlugins")},{id:"skills",label:c("marketplaceFilterSkills")}],ee=d=>{k.isPending||k.mutate({type:d.type,spec:d.install.spec,kind:d.install.kind})},te=async(d,x)=>{if(T.isPending)return;const N=x.id||x.spec;N&&(d==="uninstall"&&!await C({title:`${c("marketplaceUninstallTitle")} ${N}?`,description:c("marketplaceUninstallDescription"),confirmLabel:c("marketplaceUninstall"),variant:"destructive"})||T.mutate({type:x.type,action:d,id:N,spec:x.spec}))};return a.jsxs(tt,{children:[a.jsx(nt,{title:c("marketplacePageTitle"),description:c("marketplacePageDescription")}),a.jsx(pe,{tabs:Re,activeTab:n??"plugins",onChange:d=>{const x=d==="skills"?"skills":"plugins";n!==x&&e(`/marketplace/${x}`)},className:"mb-4"}),a.jsx(pe,{tabs:Me,activeTab:i,onChange:d=>{h(d),m(1)},className:"mb-4"}),a.jsx(qt,{scope:i,searchText:r,sort:p,onSearchTextChange:o,onSortChange:d=>{m(1),y(d)}}),a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"text-[14px] font-semibold text-gray-900",children:[i==="installed"?c("marketplaceSectionInstalled"):c("marketplaceSectionExtensions")," · ",s==="plugin"?c("marketplaceFilterPlugins"):c("marketplaceFilterSkills")]}),a.jsx("span",{className:"text-[12px] text-gray-500",children:Ie})]}),i==="all"&&f.isError&&a.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c("marketplaceErrorLoadingData"),": ",f.error.message]}),i==="installed"&&g.isError&&a.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c("marketplaceErrorLoadingInstalled"),": ",g.error.message]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-3",children:[i==="all"&&w.map(d=>a.jsx(me,{item:d,record:At(d,A),installState:Z,manageState:J,onInstall:ee,onManage:te},d.id)),i==="installed"&&R.map(d=>a.jsx(me,{item:d.item,record:d.record,installState:Z,manageState:J,onInstall:ee,onManage:te},d.key))]}),i==="all"&&!f.isLoading&&!f.isError&&w.length===0&&a.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c("marketplaceNoItems")}),i==="installed"&&!g.isLoading&&!g.isError&&R.length===0&&a.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c("marketplaceNoInstalledItems")})]}),i==="all"&&a.jsx(Ht,{page:v,totalPages:K,busy:f.isFetching,onPrev:()=>m(d=>Math.max(1,d-1)),onNext:()=>m(d=>K>0?Math.min(K,d+1):d+1)}),a.jsx(j,{})]})}export{Vt as MarketplacePage};
|