nextclaw 0.8.22 → 0.8.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/package.json +1 -1
  2. package/ui-dist/assets/{ChannelsList-Cq5-YX03.js → ChannelsList-GW0rzJh0.js} +1 -1
  3. package/ui-dist/assets/{CronConfig-CmAlEwgb.js → CronConfig-DJv3pHG6.js} +1 -1
  4. package/ui-dist/assets/{DocBrowser-BPQ0AwpS.js → DocBrowser-IzD4Evlq.js} +1 -1
  5. package/ui-dist/assets/MarketplacePage-rd97G8xD.js +1 -0
  6. package/ui-dist/assets/{ModelConfig-Ius4pGSn.js → ModelConfig-Dp5iCAC-.js} +1 -1
  7. package/ui-dist/assets/{ProvidersList-inCyPXqz.js → ProvidersList-csOpEGSj.js} +1 -1
  8. package/ui-dist/assets/{RuntimeConfig-BNMCl0Ei.js → RuntimeConfig-H0SSIQ3f.js} +1 -1
  9. package/ui-dist/assets/{SessionsConfig-Dm2kRLTa.js → SessionsConfig-8nUD5SGB.js} +1 -1
  10. package/ui-dist/assets/{action-link-C9ahVCKx.js → action-link-DXGkm9Hk.js} +1 -1
  11. package/ui-dist/assets/{card-C1ZzMnWw.js → card-7BTaMTaL.js} +1 -1
  12. package/ui-dist/assets/{dialog-Mk2G1dFX.js → dialog-CXsWIUTk.js} +2 -2
  13. package/ui-dist/assets/{index-tnzkPnqh.js → index-CJRpyLXg.js} +2 -2
  14. package/ui-dist/assets/{label-BROtAvYK.js → label-BAzOr1uc.js} +1 -1
  15. package/ui-dist/assets/{page-layout-DtdQjybK.js → page-layout-DJ75nLW5.js} +1 -1
  16. package/ui-dist/assets/{switch-CAm3AWPT.js → switch-DyifnPNj.js} +1 -1
  17. package/ui-dist/assets/{tabs-custom-FChgJMG3.js → tabs-custom-PWZmQDBG.js} +1 -1
  18. package/ui-dist/assets/{useConfig-K-hQK2hv.js → useConfig-B43ymz0l.js} +1 -1
  19. package/ui-dist/assets/{useConfirmDialog-04G_ys9F.js → useConfirmDialog-Bd2fAZGR.js} +1 -1
  20. package/ui-dist/assets/{vendor-CiFdXYu3.js → vendor-Dkx07DIh.js} +53 -53
  21. package/ui-dist/index.html +2 -2
  22. package/ui-dist/assets/MarketplacePage-DF0gJ8nx.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.8.22",
3
+ "version": "0.8.23",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -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-CiFdXYu3.js";import{u as _,a as q,e as me,f as pe,I as D,c as de}from"./useConfig-K-hQK2hv.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-tnzkPnqh.js";import{D as he,a as fe,b as we,c as je,d as ve,e as ke}from"./dialog-Mk2G1dFX.js";import{B as F,P as Ce,a as Pe}from"./page-layout-DtdQjybK.js";import{L as Ne}from"./label-BROtAvYK.js";import{S as Se}from"./switch-CAm3AWPT.js";import{h as T}from"./config-hints-CApS3K_7.js";import{T as Ie}from"./tabs-custom-FChgJMG3.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-C9ahVCKx.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-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 +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-CiFdXYu3.js";import{u as E}from"./useConfirmDialog-04G_ys9F.js";import{l as M,m as P,n as T,o as J,I as A}from"./useConfig-K-hQK2hv.js";import{P as F,a as z,B as o}from"./page-layout-DtdQjybK.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-tnzkPnqh.js";import{C as H,d as O}from"./card-C1ZzMnWw.js";import"./dialog-Mk2G1dFX.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
+ 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-Bd2fAZGR.js";import{l as M,m as P,n as T,o as J,I as A}from"./useConfig-B43ymz0l.js";import{P as F,a as z,B as o}from"./page-layout-DJ75nLW5.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-CJRpyLXg.js";import{C as H,d as O}from"./card-7BTaMTaL.js";import"./dialog-CXsWIUTk.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,aH as Z,aI as q,Z as Q,aJ as ee,a7 as te,aa as re,a6 as se,aK as oe}from"./vendor-CiFdXYu3.js";import{j as ae,D as W,t as x,c as B}from"./index-tnzkPnqh.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:z}=ae(),[b,y]=s.useState(""),[j,M]=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),k=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=k.current)!=null&&e.contentWindow)try{const r=new URL(i).pathname;k.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"&&z(r.data.url)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[z]);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"&&(M(!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=()=>{M(!1),c.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[j]);const L=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]),H=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]),T=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0);const r=e.clientX,o=a.w,w=l.x,u=V=>{const J=r-V.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:H}),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:k,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:T}),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:L,"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:L,"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:L,children:t.jsx(oe,{className:"w-3 h-3 rotate-[-45deg]"})})]})]})}export{ce as DocBrowser};
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-CJRpyLXg.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 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};
@@ -1 +1 @@
1
- import{j as e,r as c,m as M,F as k,D as C,E as P}from"./vendor-CiFdXYu3.js";import{P as S,a as E,B as F}from"./page-layout-DtdQjybK.js";import{C as b}from"./card-C1ZzMnWw.js";import{u as L,a as T,b as D,I as w}from"./useConfig-K-hQK2hv.js";import{L as p}from"./label-BROtAvYK.js";import{c as I,t,f as B}from"./index-tnzkPnqh.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
+ 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-DJ75nLW5.js";import{C as b}from"./card-7BTaMTaL.js";import{u as L,a as T,b as D,I as w}from"./useConfig-B43ymz0l.js";import{L as p}from"./label-BAzOr1uc.js";import{c as I,t,f as B}from"./index-CJRpyLXg.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-CiFdXYu3.js";import{I as E,u as L,c as O,a as F,d as H}from"./useConfig-K-hQK2hv.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-tnzkPnqh.js";import{D as q,a as Q,b as Z,c as ee,d as se,e as ae}from"./dialog-Mk2G1dFX.js";import{B as A,P as te,a as re}from"./page-layout-DtdQjybK.js";import{L as P}from"./label-BROtAvYK.js";import{h as w}from"./config-hints-CApS3K_7.js";import{T as ie}from"./tabs-custom-FChgJMG3.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-C9ahVCKx.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
+ 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-B43ymz0l.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-CJRpyLXg.js";import{D as q,a as Q,b as Z,c as ee,d as se,e as ae}from"./dialog-CXsWIUTk.js";import{B as A,P as te,a as re}from"./page-layout-DJ75nLW5.js";import{L as P}from"./label-BAzOr1uc.js";import{h as w}from"./config-hints-CApS3K_7.js";import{T as ie}from"./tabs-custom-PWZmQDBG.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-DXGkm9Hk.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-CiFdXYu3.js";import{u as oe,a as ce,g as de,I as d}from"./useConfig-K-hQK2hv.js";import{P as ie,a as me,B as N}from"./page-layout-DtdQjybK.js";import{C as O,a as B,b as M,c as R,d as $}from"./card-C1ZzMnWw.js";import{S as he}from"./switch-CAm3AWPT.js";import{t,S as ee,a as ae,b as se,d as te,e as P}from"./index-tnzkPnqh.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
+ 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-B43ymz0l.js";import{P as ie,a as me,B as N}from"./page-layout-DJ75nLW5.js";import{C as O,a as B,b as M,c as R,d as $}from"./card-7BTaMTaL.js";import{S as he}from"./switch-DyifnPNj.js";import{t,S as ee,a as ae,b as se,d as te,e as P}from"./index-CJRpyLXg.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-CiFdXYu3.js";import{u as Z}from"./useConfirmDialog-04G_ys9F.js";import{h as ee,i as se,j as te,k as ae,I as S}from"./useConfig-K-hQK2hv.js";import{P as re,a as le,B as u}from"./page-layout-DtdQjybK.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-tnzkPnqh.js";import"./dialog-Mk2G1dFX.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
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-Bd2fAZGR.js";import{h as ee,i as se,j as te,k as ae,I as S}from"./useConfig-B43ymz0l.js";import{P as re,a as le,B as u}from"./page-layout-DJ75nLW5.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-CJRpyLXg.js";import"./dialog-CXsWIUTk.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-CiFdXYu3.js";import{c as r}from"./index-tnzkPnqh.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
+ import{r as d,j as s,a7 as m}from"./vendor-Dkx07DIh.js";import{c as r}from"./index-CJRpyLXg.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-CiFdXYu3.js";import{c as d}from"./index-tnzkPnqh.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
+ import{r as s,j as t}from"./vendor-Dkx07DIh.js";import{c as d}from"./index-CJRpyLXg.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,5 +1,5 @@
1
- import{r as i,an as C,aA as I,al as ee,j as s,ak as A,as as te,ap as D,aq as v,at as ne,aB as oe,aC as ae,aD as re,aE as se,au as ie,aF as ce,aG as le,Z as de}from"./vendor-CiFdXYu3.js";import{c as x}from"./index-tnzkPnqh.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]),I(()=>{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]),I(()=>{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":b(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":b(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":b(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",z=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))})});z.displayName=G;function b(e){return e?"open":"closed"}var B="DialogTitleWarning",[Se,H]=le(B,{contentName:N,titleName:_,docsSlug:"dialog"}),he=({titleId:e})=>{const t=H(B),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
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-CJRpyLXg.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
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Re="DialogDescriptionWarning",Ce=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${H(Re).contentName}}.`;return i.useEffect(()=>{var r;const a=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Ee=w,Oe=S,V=F,q=W,Z=k,K=$,Ae=z;const Fe=Ee,Pe=Oe,X=i.forwardRef(({className:e,...t},n)=>s.jsx(V,{ref:n,className:x("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));X.displayName=V.displayName;const _e=i.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Pe,{children:[s.jsx(X,{}),s.jsxs(q,{ref:o,className:x("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl",e),...n,children:[t,s.jsxs(Ae,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(de,{className:"h-4 w-4 text-gray-500"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=q.displayName;const be=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col space-y-2 text-center sm:text-left",e),...t});be.displayName="DialogHeader";const Ie=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...t});Ie.displayName="DialogFooter";const Me=i.forwardRef(({className:e,...t},n)=>s.jsx(Z,{ref:n,className:x("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...t}));Me.displayName=Z.displayName;const we=i.forwardRef(({className:e,...t},n)=>s.jsx(K,{ref:n,className:x("text-sm text-gray-500 leading-relaxed",e),...t}));we.displayName=K.displayName;export{Fe as D,E as P,_e as a,be as b,Me as c,we as d,Ie as e};
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Re="DialogDescriptionWarning",Ce=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${B(Re).contentName}}.`;return i.useEffect(()=>{var r;const a=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Ee=w,Oe=S,V=F,q=W,Z=k,K=$,Ae=H;const Fe=Ee,Pe=Oe,X=i.forwardRef(({className:e,...t},n)=>s.jsx(V,{ref:n,className:x("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));X.displayName=V.displayName;const _e=i.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Pe,{children:[s.jsx(X,{}),s.jsxs(q,{ref:o,className:x("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl",e),...n,children:[t,s.jsxs(Ae,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(de,{className:"h-4 w-4 text-gray-500"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=q.displayName;const Ie=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ie.displayName="DialogHeader";const be=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...t});be.displayName="DialogFooter";const Me=i.forwardRef(({className:e,...t},n)=>s.jsx(Z,{ref:n,className:x("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...t}));Me.displayName=Z.displayName;const we=i.forwardRef(({className:e,...t},n)=>s.jsx(K,{ref:n,className:x("text-sm text-gray-500 leading-relaxed",e),...t}));we.displayName=K.displayName;export{Fe as D,E as P,_e as a,Ie as b,Me as c,we as d,be as e};