@nextclaw/ui 0.12.25 → 0.12.27

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 (48) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/assets/{channels-list-page-FJDuPwU6.js → channels-list-page-DkPvpAqc.js} +1 -1
  3. package/dist/assets/chat-page-b7Zf32fF.js +1 -0
  4. package/dist/assets/{desktop-kk7qvZ-v.js → desktop-DVUbOWbR.js} +1 -1
  5. package/dist/assets/index-DmWo8dX2.css +1 -0
  6. package/dist/assets/{index-D-AAMKCt.js → index-DqJ3CYwi.js} +34 -37
  7. package/dist/assets/marketplace-page-BVqFjnEB.js +105 -0
  8. package/dist/assets/marketplace-page-DkQ2hTs1.js +1 -0
  9. package/dist/assets/{mcp-marketplace-page-DIq_SpMe.js → mcp-marketplace-page-BOYJO0kp.js} +1 -1
  10. package/dist/assets/mcp-marketplace-page-DSML7NN0.js +1 -0
  11. package/dist/assets/{model-config-Bc6VVnxy.js → model-config-Bg2yycmn.js} +1 -1
  12. package/dist/assets/{providers-list-DN0tvISH.js → providers-list-DC1q3fvC.js} +1 -1
  13. package/dist/assets/{runtime-config-page-CRWOwBbl.js → runtime-config-page-q-nC0C5i.js} +1 -1
  14. package/dist/assets/{search-config-C4c1yZSP.js → search-config-CcKHif8O.js} +1 -1
  15. package/dist/assets/{secrets-config-zAF30YfO.js → secrets-config-DSg6O92a.js} +1 -1
  16. package/dist/assets/{use-infinite-scroll-loader-Cvz8ZteY.js → use-infinite-scroll-loader-DF2e6nQ2.js} +1 -1
  17. package/dist/index.html +3 -3
  18. package/package.json +9 -9
  19. package/src/features/agents/components/agents-page.test.tsx +1 -1
  20. package/src/features/agents/components/agents-page.tsx +1 -1
  21. package/src/features/chat/components/chat-session-workspace-panel.tsx +31 -45
  22. package/src/features/chat/components/chat-sidebar-session-item.tsx +7 -9
  23. package/src/features/chat/components/conversation/chat-conversation-header.test.tsx +5 -2
  24. package/src/features/chat/components/conversation/chat-conversation-header.tsx +2 -2
  25. package/src/features/chat/components/conversation/chat-conversation-panel.test.tsx +106 -78
  26. package/src/features/chat/components/conversation/chat-conversation-panel.tsx +172 -167
  27. package/src/features/chat/components/conversation/chat-input-bar.container.tsx +11 -1
  28. package/src/features/chat/components/conversation/session-header/chat-session-header-actions.tsx +2 -2
  29. package/src/features/chat/components/providers/chat-presenter.provider.tsx +2 -0
  30. package/src/features/chat/hooks/use-ncp-agent-runtime.test.tsx +147 -88
  31. package/src/features/chat/managers/ncp-chat-input.manager.test.ts +20 -0
  32. package/src/features/chat/managers/ncp-chat-input.manager.ts +18 -0
  33. package/src/features/chat/managers/ncp-chat-presenter.manager.ts +1 -0
  34. package/src/features/chat/pages/ncp-chat-page.tsx +4 -1
  35. package/src/features/chat/stores/chat-input.store.ts +3 -1
  36. package/src/features/chat/utils/ncp-chat-input-availability.utils.test.ts +1 -0
  37. package/src/features/marketplace/components/curated-shelves/marketplace-curated-scene-route.test.tsx +54 -16
  38. package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.tsx +96 -24
  39. package/src/features/marketplace/components/marketplace-page.test.tsx +4 -0
  40. package/src/features/marketplace/components/marketplace-page.tsx +16 -12
  41. package/src/features/marketplace/hooks/use-marketplace-curated-scene-route.ts +14 -5
  42. package/src/platforms/desktop/components/desktop-app-shell.test.tsx +1 -0
  43. package/src/platforms/desktop/components/desktop-app-shell.tsx +1 -1
  44. package/dist/assets/chat-page-D1fMNBrT.js +0 -1
  45. package/dist/assets/index-DnBeV2Xm.css +0 -1
  46. package/dist/assets/marketplace-page-BrCLRIc4.js +0 -105
  47. package/dist/assets/marketplace-page-odDpPYEs.js +0 -1
  48. package/dist/assets/mcp-marketplace-page-CfbOBgKK.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # @nextclaw/ui
2
2
 
3
+ ## 0.12.27
4
+
5
+ ### Patch Changes
6
+
7
+ - Release frontend UI changes only.
8
+
9
+ ## 0.12.26
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated full public beta release batch.
14
+
15
+ Packages:
16
+ - @nextclaw/agent-chat
17
+ - @nextclaw/agent-chat-ui
18
+ - @nextclaw/app-runtime
19
+ - @nextclaw/app-sdk
20
+ - @nextclaw/channel-extension-feishu
21
+ - @nextclaw/channel-extension-weixin
22
+ - @nextclaw/channel-plugin-dingtalk
23
+ - @nextclaw/channel-plugin-discord
24
+ - @nextclaw/channel-plugin-email
25
+ - @nextclaw/channel-plugin-mochat
26
+ - @nextclaw/channel-plugin-qq
27
+ - @nextclaw/channel-plugin-slack
28
+ - @nextclaw/channel-plugin-telegram
29
+ - @nextclaw/channel-plugin-wecom
30
+ - @nextclaw/channel-plugin-whatsapp
31
+ - @nextclaw/channel-runtime
32
+ - @nextclaw/client-sdk
33
+ - @nextclaw/companion
34
+ - @nextclaw/core
35
+ - @nextclaw/extension-sdk
36
+ - @nextclaw/feishu-core
37
+ - @nextclaw/kernel
38
+ - @nextclaw/mcp
39
+ - @nextclaw/ncp
40
+ - @nextclaw/ncp-agent-runtime
41
+ - @nextclaw/ncp-http-agent-client
42
+ - @nextclaw/ncp-http-agent-server
43
+ - @nextclaw/ncp-mcp
44
+ - @nextclaw/ncp-react
45
+ - @nextclaw/ncp-react-ui
46
+ - @nextclaw/ncp-toolkit
47
+ - @nextclaw/nextclaw-hermes-acp-bridge
48
+ - @nextclaw/nextclaw-narp-runtime-claude-code-sdk
49
+ - @nextclaw/nextclaw-narp-runtime-codex-sdk
50
+ - @nextclaw/nextclaw-narp-stdio-runtime-wrapper
51
+ - @nextclaw/nextclaw-ncp-runtime-adapter-hermes-http
52
+ - @nextclaw/nextclaw-ncp-runtime-claude-code-sdk
53
+ - @nextclaw/nextclaw-ncp-runtime-codex-sdk
54
+ - @nextclaw/nextclaw-ncp-runtime-http-client
55
+ - @nextclaw/nextclaw-ncp-runtime-plugin-claude-code-sdk
56
+ - @nextclaw/nextclaw-ncp-runtime-plugin-codex-sdk
57
+ - @nextclaw/nextclaw-ncp-runtime-stdio-client
58
+ - @nextclaw/openclaw-compat
59
+ - @nextclaw/remote
60
+ - @nextclaw/runtime
61
+ - @nextclaw/server
62
+ - @nextclaw/service
63
+ - @nextclaw/shared
64
+ - @nextclaw/ui
65
+ - nextclaw
66
+
67
+ - Updated dependencies
68
+ - @nextclaw/agent-chat@0.1.16
69
+ - @nextclaw/agent-chat-ui@0.3.18
70
+ - @nextclaw/client-sdk@0.1.6
71
+ - @nextclaw/ncp@0.5.11
72
+ - @nextclaw/ncp-http-agent-client@0.3.23
73
+ - @nextclaw/ncp-react@0.4.31
74
+ - @nextclaw/server@0.12.18
75
+ - @nextclaw/shared@0.1.5
76
+
3
77
  ## 0.12.25
4
78
 
5
79
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import{_ as e,a as t,h as n,m as r,p as i,r as a,t as o,u as s}from"./i18n-D1144VAA.js";import{At as c,Ct as l,Lt as u,Mt as d,Nt as f,Rt as p,Xt as m,ft as h,jt as g,kt as _,nt as v,ot as y,tt as b,zt as x}from"./api-DGD9_Bg4.js";import{t as S}from"./createLucideIcon-DzY6wN61.js";import{t as C}from"./search-CRtQwr-h.js";import{t as w}from"./book-open-BcnAiKde.js";import{O as ee,a as T,i as E,n as D,r as te,t as ne}from"./select-BUTwE_lC.js";import{t as O}from"./external-link-CpEvG65F.js";import{t as re}from"./key-round-DUq47t0P.js";import{n as ie,t as ae}from"./settings-MWL2SMyk.js";import{t as oe}from"./x-BeyYA_h6.js";import{t as k}from"./status-dot-l3kPFdq_.js";import{i as A,l as se,n as j,r as M,v as ce}from"./use-config-Cyv5IuSt.js";import{J as le,Q as ue,Y as de,et as fe,q as pe}from"./index-D-AAMKCt.js";import{t as me}from"./tabs-custom-D48zdZoc.js";import{t as he}from"./tag-chip-Dm2Lqnpu.js";import{t as N}from"./config-hints-BNfpOL4J.js";import{a as P,c as F,i as ge,n as _e,o as I,r as ve,s as ye,t as be}from"./config-split-page-CcrEUtwu.js";var xe=S(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Se=S(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),Ce=S(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),L=S(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=S(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),R=e(r(),1),z=i();function Te({value:e,onChange:t,className:n,placeholder:r=``}){let[i,o]=(0,R.useState)(``),c=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),o(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,z.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,z.jsxs)(he,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,z.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,z.jsx)(oe,{className:`h-3 w-3`})})]},t)),(0,z.jsx)(`input`,{type:`text`,value:i,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||a(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,z.jsx)(re,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,z.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,z.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,z.jsx)(xe,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,z.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,z.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:o,uiHints:s}){return(0,z.jsx)(z.Fragment,{children:t.map(t=>{let c=N(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,z.jsxs)(g,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,z.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,z.jsx)(h,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,z.jsx)(d,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,z.jsx)(d,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,z.jsx)(d,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,z.jsx)(Te,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,z.jsxs)(ne,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,z.jsx)(E,{className:`rounded-xl`,children:(0,z.jsx)(T,{})}),(0,z.jsx)(D,{children:(t.options??[]).map(e=>(0,z.jsx)(te,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,z.jsx)(`textarea`,{id:t.name,value:r[t.name]??`{}`,onChange:e=>i(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),B=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),V=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ke=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ae=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),je=n((e=>{var t=B().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Me=n((e=>{var t=B().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),H=n((e=>{var t=V(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Pe=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Fe=n((e=>{var t=Pe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ie=n(((e,t)=>{var n=Fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),U=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),W=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
1
+ import{_ as e,a as t,h as n,m as r,p as i,r as a,t as o,u as s}from"./i18n-D1144VAA.js";import{At as c,Ct as l,Lt as u,Mt as d,Nt as f,Rt as p,Xt as m,ft as h,jt as g,kt as _,nt as v,ot as y,tt as b,zt as x}from"./api-DGD9_Bg4.js";import{t as S}from"./createLucideIcon-DzY6wN61.js";import{t as C}from"./search-CRtQwr-h.js";import{t as w}from"./book-open-BcnAiKde.js";import{O as ee,a as T,i as E,n as D,r as te,t as ne}from"./select-BUTwE_lC.js";import{t as O}from"./external-link-CpEvG65F.js";import{t as re}from"./key-round-DUq47t0P.js";import{n as ie,t as ae}from"./settings-MWL2SMyk.js";import{t as oe}from"./x-BeyYA_h6.js";import{t as k}from"./status-dot-l3kPFdq_.js";import{i as A,l as se,n as j,r as M,v as ce}from"./use-config-Cyv5IuSt.js";import{J as le,Q as ue,Y as de,et as fe,q as pe}from"./index-DqJ3CYwi.js";import{t as me}from"./tabs-custom-D48zdZoc.js";import{t as he}from"./tag-chip-Dm2Lqnpu.js";import{t as N}from"./config-hints-BNfpOL4J.js";import{a as P,c as F,i as ge,n as _e,o as I,r as ve,s as ye,t as be}from"./config-split-page-CcrEUtwu.js";var xe=S(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Se=S(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),Ce=S(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),L=S(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=S(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),R=e(r(),1),z=i();function Te({value:e,onChange:t,className:n,placeholder:r=``}){let[i,o]=(0,R.useState)(``),c=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),o(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,z.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,z.jsxs)(he,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,z.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,z.jsx)(oe,{className:`h-3 w-3`})})]},t)),(0,z.jsx)(`input`,{type:`text`,value:i,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||a(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,z.jsx)(re,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,z.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,z.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,z.jsx)(xe,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,z.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,z.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:o,uiHints:s}){return(0,z.jsx)(z.Fragment,{children:t.map(t=>{let c=N(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,z.jsxs)(g,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,z.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,z.jsx)(h,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,z.jsx)(d,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,z.jsx)(d,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,z.jsx)(d,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,z.jsx)(Te,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,z.jsxs)(ne,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,z.jsx)(E,{className:`rounded-xl`,children:(0,z.jsx)(T,{})}),(0,z.jsx)(D,{children:(t.options??[]).map(e=>(0,z.jsx)(te,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,z.jsx)(`textarea`,{id:t.name,value:r[t.name]??`{}`,onChange:e=>i(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),B=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),V=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ke=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ae=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),je=n((e=>{var t=B().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Me=n((e=>{var t=B().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),H=n((e=>{var t=V(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Pe=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Fe=n((e=>{var t=Pe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ie=n(((e,t)=>{var n=Fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),U=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),W=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
2
  ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),G=n((e=>{var t=U(),n=W();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Le=n((e=>{var t=B(),n=H(),r=V(),i=G(),a=U(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Re=n((e=>{var t=B(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),ze=n(((e,t)=>{var n=G();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Be=n(((e,t)=>{var n=G(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ve=n(((e,t)=>{var n=G();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),He=n(((e,t)=>{var n=G(),r=B();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
3
  Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ue=n(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),We=n((e=>{var t=G(),n=ze(),r=Be(),i=Ve(),a=He(),o=W(),s=B(),c=Ue();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
4
  Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ge=n((e=>{var t=B(),n=V(),r=ke(),i=Ae(),a=je(),o=Me(),s=Ne(),c=H(),l=Ie(),u=Le(),d=Re(),f=G(),p=We();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
@@ -0,0 +1 @@
1
+ import{_ as e,m as t,p as n,r,u as i}from"./i18n-D1144VAA.js";import{At as a,Mt as o,Nt as s,Tt as c,_t as l,kt as u,wt as d}from"./api-DGD9_Bg4.js";import{c as f,l as p,u as m}from"./cpu-DPPwMzoC.js";import{n as h,t as g}from"./marketplace-page-BVqFjnEB.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./dialog-BKo0RItd.js";import{t as C}from"./createLucideIcon-DzY6wN61.js";import{D as w,O as T,w as E}from"./desktop-DVUbOWbR.js";import{a as D,i as O,n as k,r as A,t as j}from"./select-BUTwE_lC.js";import{i as ee,n as M,r as te,t as ne}from"./provider-scoped-model-input-BMTp4BEH.js";import"./mcp-marketplace-page-BOYJO0kp.js";import{t as re}from"./play-AqrNslHI.js";import{t as N}from"./plus-B-YHtTNC.js";import{t as ie}from"./refresh-cw-CrbD8EkT.js";import{t as ae}from"./sparkles-BmgOD4nY.js";import{t as oe}from"./notice-card-Dr6xCwva.js";import{_ as se,d as ce,f as le,m as ue,n as P,o as de,r as F,s as fe}from"./use-config-Cyv5IuSt.js";import{n as pe,r as me,t as he}from"./popover-BDFNiLlg.js";import{$ as ge,A as _e,B as I,C as L,D as R,E as ve,F as ye,G as be,H as xe,I as Se,K as Ce,L as we,M as z,N as B,O as Te,P as Ee,R as De,S as Oe,T as V,U as ke,V as Ae,W as H,X as U,Y as je,Z as W,a as Me,b as Ne,c as Pe,d as Fe,f as Ie,h as G,i as Le,j as Re,k as ze,l as Be,m as K,n as q,o as Ve,p as He,r as Ue,s as J,t as We,w as Ge,x as Ke,z as Y}from"./index-DqJ3CYwi.js";import{t as qe}from"./tag-chip-Dm2Lqnpu.js";var Je=C(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ye=C(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),X=e(t(),1),Z=n(),Q=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`textarea`,{className:i(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));Q.displayName=`Textarea`;function Xe(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ze(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=L(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:V(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Qe({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:i,onChange:a}){let o=e.trim()?L(e):``,s=Ze({runtimeOptions:n,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?r(`agentsRuntimeUnavailableHelp`):``);return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(j,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,Z.jsx)(O,{"aria-label":r(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Z.jsx)(D,{placeholder:r(`agentsRuntimeSelectPlaceholder`)})}),(0,Z.jsx)(k,{className:`rounded-xl`,children:s.map(e=>(0,Z.jsx)(A,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Z.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function $e({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(S,{open:e!==null,onOpenChange:a,children:e?(0,Z.jsx)(et,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function et(e){let{agent:t,pending:n,providerCatalog:i,runtimeOptions:a,defaultRuntime:c,onOpenChange:l,onSubmit:u}=e,[d,f]=(0,X.useState)(Xe(t));return(0,Z.jsxs)(y,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(_,{className:`text-left`,children:[(0,Z.jsx)(b,{children:r(`agentsEditDialogTitle`)}),(0,Z.jsx)(x,{children:r(`agentsEditDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(oe,{tone:`warning`,title:r(`agentsEditHomeReadonly`),description:r(`agentsEditHomeReadonlyHint`),children:(0,Z.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(o,{value:d.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:r(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:d.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:r(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(o,{value:d.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:r(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(ne,{value:d.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:n,className:`md:col-span-2`}),(0,Z.jsx)(Qe,{value:d.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:c,disabled:n})]})]})}),(0,Z.jsxs)(v,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>l(!1),disabled:n,children:r(`cancel`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>u(t.id,d),disabled:n,children:[(0,Z.jsx)(W,{className:`mr-2 h-4 w-4`}),r(`agentsEditSaveAction`)]})]})]})}var tt=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function nt(e){let{agentCount:t,onCreate:n}=e;return(0,Z.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:r(`agentsHeroEyebrow`)}),(0,Z.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,Z.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:r(`agentsHeroDescription`)})]}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:n,children:[(0,Z.jsx)(N,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}function $(e){let{icon:t,label:n,disabled:r=!1,destructive:a=!1,onClick:o}=e;return(0,Z.jsxs)(`button`,{type:`button`,className:i(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:r,children:[(0,Z.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{children:n})]})}function rt(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:l,onEdit:u,onDelete:f}=e,p=t.runtime?.trim()||t.engine?.trim()||``,m=p?n.find(e=>e.value===L(p))?.label??V(p):i;return(0,Z.jsx)(d,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,Z.jsxs)(c,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,Z.jsx)(Ce,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,Z.jsxs)(qe,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,Z.jsx)(Ye,{className:`h-3 w-3`}),r(`agentsCardBuiltInTag`)]}):null]}),(0,Z.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,Z.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`agentsCardStartChat`),title:r(`agentsCardStartChat`),onClick:l,children:(0,Z.jsx)(E,{className:`h-4 w-4`})}),(0,Z.jsxs)(he,{children:[(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":r(`chatSessionMoreActions`),title:r(`chatSessionMoreActions`),children:(0,Z.jsx)(Je,{className:`h-4 w-4`})})}),(0,Z.jsxs)(pe,{align:`end`,className:`w-44 p-1.5`,children:[(0,Z.jsx)($,{icon:W,label:r(`agentsEditAction`),onClick:u,disabled:a}),t.builtIn?null:(0,Z.jsx)($,{icon:U,label:r(`agentsRemoveAction`),onClick:f,disabled:o,destructive:!0})]})]})]}),(0,Z.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?r(`agentsCardBuiltInSummary`):r(`agentsCardCustomSummary`))}),(0,Z.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ae,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,Z.jsx)(`span`,{className:`truncate`,children:m})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ge,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function it(){let e=ke(),t=R(),n=P(),i=F(),o=J(),l=ze(),u=Te(),[f,p]=(0,X.useState)(null),m=(0,X.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),h=(0,X.useMemo)(()=>[...m].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[m]),g=(0,X.useMemo)(()=>M({config:n.data,meta:i.data,onlyConfigured:!0}),[i.data,n.data]),_=(0,X.useMemo)(()=>Oe(o.data?.options??[]),[o.data?.options]),v=(0,X.useMemo)(()=>L(o.data?.defaultType??`native`),[o.data?.defaultType]),y=(0,X.useMemo)(()=>_.find(e=>e.value===v)?.label??V(v),[v,_]),b=e=>{p(e)},x=async(e,t)=>{await l.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),p(null)},S=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,Ge(t,v))};return(0,Z.jsxs)(a,{className:`space-y-5`,children:[(0,Z.jsx)(nt,{agentCount:m.length,onCreate:()=>e.startAgentCreationDraft(tt)}),(0,Z.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,Z.jsx)(d,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Z.jsx)(c,{className:`py-14 text-center text-sm text-gray-500`,children:r(`agentsLoading`)})}):h.length===0?(0,Z.jsx)(d,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,Z.jsxs)(c,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Z.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,Z.jsx)(w,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Z.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:r(`agentsEmpty`)}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:r(`agentsEmptyDescription`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(tt),children:[(0,Z.jsx)(N,{className:`mr-2 h-4 w-4`}),r(`agentsCreateButton`)]})]})}):h.map(e=>(0,Z.jsx)(rt,{agent:e,runtimeOptions:_,defaultRuntimeLabel:y,updatePending:l.isPending,deletePending:u.isPending,onStartChat:()=>S(e),onEdit:()=>b(e),onDelete:()=>u.mutate({agentId:e.id})},e.id))}),(0,Z.jsx)($e,{agent:f,pending:l.isPending,providerCatalog:g,runtimeOptions:_,defaultRuntime:v,onOpenChange:e=>{!e&&!l.isPending&&p(null)},onSubmit:x})]})}function at(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function ot(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function st(e){let{job:t,onDelete:n,onRun:a,onToggle:o}=e;return(0,Z.jsx)(d,{className:`border border-gray-200`,children:(0,Z.jsx)(c,{className:`pt-5 pb-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:t.name||t.id}),(0,Z.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:t.id}),(0,Z.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,t.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:t.enabled?r(`enabled`):r(`disabled`)}),t.deleteAfterRun?(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:r(`cronOneShot`)}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[r(`cronScheduleLabel`),`: `,Ie(t)]}),(0,Z.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:t.payload.message}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[r(`cronSessionLabel`),`: `,He(t)]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[r(`cronDeliverTo`),`: `,Fe(t)]})]}),(0,Z.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[r(`cronNextRun`),`:`]}),` `,K(t.state.nextRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[r(`cronLastRun`),`:`]}),` `,K(t.state.lastRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[r(`cronLastStatus`),`:`]}),` `,t.state.lastStatus??`-`]}),t.state.lastError?(0,Z.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:t.state.lastError}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Z.jsxs)(s,{variant:`subtle`,size:`sm`,onClick:()=>a(t),className:`gap-1`,children:[(0,Z.jsx)(re,{className:`h-3.5 w-3.5`}),r(`cronRunNow`)]}),(0,Z.jsxs)(s,{variant:t.enabled?`outline`:`primary`,size:`sm`,onClick:()=>o(t),className:`gap-1`,children:[(0,Z.jsx)(h,{className:`h-3.5 w-3.5`}),t.enabled?r(`cronDisable`):r(`cronEnable`)]}),(0,Z.jsxs)(s,{variant:`destructive`,size:`sm`,onClick:()=>n(t),className:`gap-1`,children:[(0,Z.jsx)(U,{className:`h-3.5 w-3.5`}),r(`delete`)]})]})]})})})}function ct(){let[e,t]=(0,X.useState)(``),[n,c]=(0,X.useState)(`all`),l=de({all:!0}),d=fe(),f=se(),p=ue(),{confirm:m,ConfirmDialog:h}=G(),g=(0,X.useMemo)(()=>(l.data?.jobs??[]).filter(t=>at(t,e)).filter(e=>ot(e,n)),[l.data,e,n]),_=async e=>{await m({title:`${r(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:r(`delete`)})&&d.mutate({id:e.id})},v=async e=>{let t=!e.enabled;await m({title:t?`${r(`cronEnableConfirm`)}?`:`${r(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:r(t?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:t})},y=async e=>{let t=!e.enabled;await m({title:t?`${r(`cronRunForceConfirm`)}?`:`${r(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:r(`cronRunNow`)})&&p.mutate({id:e.id,force:t})};return(0,Z.jsxs)(a,{fullHeight:!0,children:[(0,Z.jsx)(u,{title:r(`cronPageTitle`),description:r(`cronPageDescription`),actions:(0,Z.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>l.refetch(),children:(0,Z.jsx)(ie,{className:i(`h-4 w-4`,l.isFetching&&`animate-spin`)})})}),(0,Z.jsx)(`div`,{className:`mb-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Z.jsx)(o,{value:e,onChange:e=>t(e.target.value),placeholder:r(`cronSearchPlaceholder`),className:`pl-9`}),(0,Z.jsx)(T,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Z.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Z.jsxs)(j,{value:n,onValueChange:e=>c(e),children:[(0,Z.jsx)(O,{className:`w-full`,children:(0,Z.jsx)(D,{placeholder:r(`cronStatusLabel`)})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(A,{value:`all`,children:r(`cronStatusAll`)}),(0,Z.jsx)(A,{value:`enabled`,children:r(`cronStatusEnabled`)}),(0,Z.jsx)(A,{value:`disabled`,children:r(`cronStatusDisabled`)})]})]})}),(0,Z.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[r(`cronTotalLabel`),`: `,l.data?.total??0,` / `,g.length]})]})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:l.isLoading?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:r(`cronLoading`)}):g.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:r(`cronEmpty`)}):(0,Z.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Z.jsx)(st,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Z.jsx)(h,{})]})}function lt(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,X.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,X.useEffect)(()=>{a.current=r},[r,a])}function ut({view:e,confirmDialog:t}){let{isMobile:n}=je();return(0,Z.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Z.jsx)(Pe,{}),e===`chat`?n?(0,Z.jsx)(We,{}):(0,Z.jsx)(Be,{}):(0,Z.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(ct,{})})}):e===`agents`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(it,{})})}):(0,Z.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(g,{forcedType:`skills`})})})}),t]})}function dt(e,t){return e.filter(e=>be(e,t))}function ft(e){let{config:t,meta:n}=e;return(0,X.useMemo)(()=>{let e=M({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=te(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:ee(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function pt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,X.useMemo)(()=>q({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,X.useMemo)(()=>q({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function mt(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,X.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,X.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,X.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function ht(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function gt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=P(),u=F(),d=le({limit:200}),f=J(),p=ce({sessionId:a?.trim()||`draft-session`,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ft({config:l.data,meta:u.data}),g=(0,X.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,X.useMemo)(()=>Re(g),[g]),v=(0,X.useMemo)(()=>dt(_,i),[_,i]),y=(0,X.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,X.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=ve({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,X.useMemo)(()=>ht({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=pt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=mt({currentSelectedModel:t,modelOptions:S});return Ue({modelOptions:S,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),Le({supportedThinkingLevels:T,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function _t(e){return e.parentSessionKey?e.sessionSummaries.map(z).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function vt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?H(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,X.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?z(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??V(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,X.useMemo)(()=>_t({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function yt(e){(0,X.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey??null,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:_e(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?H(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function bt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function xt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=Ee(e.projectRoot);n&&(t.project_root=n);let r=bt(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?Se(e.composerNodes):[];return i.length>0&&(t[ye]=i),t}function St(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Ct(e){let t=Y(e=>e.snapshot.query),n=Y(e=>e.snapshot.selectedSessionKey),r=Y(e=>e.snapshot.selectedAgentId),i=I(e=>e.snapshot.pendingSessionType),a=I(e=>e.snapshot.pendingProjectRoot),o=I(e=>e.snapshot.pendingProjectRootSessionKey),s=I(e=>e.snapshot.selectedModel),c=l(),u=we(c),d=R(),{confirm:h,ConfirmDialog:g}=G(),_=f(),v=p(),{sessionId:y}=m(),b=(0,X.useRef)(null),x=(0,X.useRef)(n),S=(0,X.useMemo)(()=>Ve(y),[y]),C=S??void 0,w=a!==null&&(!C||o===C),T=gt({query:t,sessionKey:C??null,projectRootOverride:w?a:void 0,currentSelectedModel:s,pendingSessionType:i,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:r,pendingProjectRoot:a,pendingProjectRootSessionKey:o,systemStatus:c,isRuntimeBlocked:u,agentsQuery:d,confirm:h,ConfirmDialog:g,location:_,navigate:v,threadRef:b,selectedSessionKeyRef:x,routeSessionKey:S,sessionKey:C,hasSessionProjectRootOverride:w,agent:Ke(C),...T}}function wt(e){let t=Ct(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?B(m):l?.projectName??B(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&Ne(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=vt({sessionKey:d??null,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p}),b=n.isRunning||l?.status===`running`;return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||b,isAwaitingAssistantOutput:b,canStopCurrentRun:b,stopDisabledReason:b?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:De({message:_,status:s}),...y}}function Tt(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKeyRef:o,sessionKey:s}=e;(0,X.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if((e.sessionKey??null)!==(s??null))return;let o=xt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:!e.sessionKey||e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),c=Ae({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(c)try{let n=await t.send(c);!e.sessionKey&&n?.sessionId&&i.chatSessionListManager.materializeRootSessionRoute(n.sessionId)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===s&&await t.streamRun()},resetStreamState:()=>{o.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,a?.projectRoot,o,s])}function Et(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r}=e;(0,X.useEffect)(()=>{!r||!St({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||I.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r])}function Dt(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,X.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function Ot(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,X.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function kt(e){let{agent:t,presenter:n,routeSessionKey:r}=e,i=t.snapshot.activeRun?.sessionId??t.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null;(0,X.useEffect)(()=>{r||!i||n.chatSessionListManager.materializeRootSessionRoute(i)},[i,n,r])}function At({view:e}){let[t]=(0,X.useState)(()=>new Me),n=wt(t);return Tt(n),Et(n),Dt(n),Ot(n),kt(n),lt({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),yt({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Z.jsx)(xe,{presenter:t,children:(0,Z.jsx)(ut,{view:e,confirmDialog:(0,Z.jsx)(n.ConfirmDialog,{})})})}function jt({view:e}){return(0,Z.jsx)(At,{view:e})}export{jt as ChatPage};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-p9DDNPWB.js","assets/doc-browser-rZIQIjuw.js","assets/i18n-D1144VAA.js","assets/createLucideIcon-DzY6wN61.js","assets/search-CRtQwr-h.js","assets/book-open-BcnAiKde.js","assets/external-link-CpEvG65F.js","assets/plus-B-YHtTNC.js","assets/x-BeyYA_h6.js","assets/doc-browser-context-FukQHvyo.js"])))=>i.map(i=>d[i]);
2
2
  import{_ as e,i as t,m as n,p as r,r as i,u as a}from"./i18n-D1144VAA.js";import{Dt as o,Et as s,Lt as c,Nt as l,Ot as u,Tt as d,bt as f,gt as p,mt as m,pt as h,wt as g,yt as ee}from"./api-DGD9_Bg4.js";import{d as _,i as v,t as y}from"./cpu-DPPwMzoC.js";import{t as b}from"./createLucideIcon-DzY6wN61.js";import{n as te,t as ne}from"./search-CRtQwr-h.js";import{t as re}from"./book-open-BcnAiKde.js";import{i as ie,k as ae,n as oe,r as x,t as se}from"./select-BUTwE_lC.js";import{t as S}from"./download-CMM8po31.js";import{t as ce}from"./key-round-DUq47t0P.js";import{h as le,n as ue}from"./app-manager-provider-oYdeYPSv.js";import{n as de,t as fe}from"./settings-MWL2SMyk.js";import{t as pe}from"./refresh-cw-CrbD8EkT.js";import{t as me}from"./sparkles-BmgOD4nY.js";import{t as he}from"./x-BeyYA_h6.js";import{i as ge}from"./doc-browser-context-FukQHvyo.js";import{n as _e}from"./doc-browser-CAhfnm0D.js";import{t as ve}from"./use-config-Cyv5IuSt.js";import{n as ye,r as be,t as xe}from"./popover-BDFNiLlg.js";var C=b(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),w=b(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),T=b(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),E=b(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),D=b(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),O=b(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Se=b(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Ce=b(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),we=b(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Te=b(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),k=b(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),A=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Ee=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}A.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();A.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){A.setState({supported:!0,initialized:!0,busyAction:null}),c.error(`${i(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{A.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(i(`runtimePresenceLaunchAtLoginUnavailable`));A.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return A.setState({supported:!0,initialized:!0,snapshot:n}),c.success(i(`runtimePresenceSaved`)),n}catch(e){throw c.error(`${i(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{A.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`)}},j=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){j.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{j.setState({supported:!0,initialized:!0,snapshot:e})}),j.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();j.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){j.setState({supported:!0,initialized:!0}),c.error(`${i(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,i(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){c.success(i(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){c.success(i(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??i(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){c.success(i(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&c.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,i(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&c.success(i(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,i(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,i(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(j.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,i(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){c.success(i(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}c.success(i(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(i(`desktopUpdatesDesktopOnlyDescription`));j.setState({busyAction:e});try{let e=await n(r);return j.setState({snapshot:e}),e}catch(e){throw c.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{j.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`),this.getChannelLabel=e=>i(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function De(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Oe(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function ke(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Ae(e){return[{target:`/chat`,label:e(`chat`),icon:D},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:e(`agentsPageTitle`),icon:w},{target:`/settings`,label:e(`settings`),icon:fe}]}function je(e){return[{target:`/model`,label:e(`model`),icon:y},{target:`/providers`,label:e(`providers`),icon:me},{target:`/channels`,label:e(`channels`),icon:de},{target:`/search`,label:e(`searchChannels`),icon:ne},{target:`/runtime`,label:e(`runtime`),icon:y},{target:`/updates`,label:e(`updates`),icon:S},{target:`/remote`,label:e(`remote`),icon:Te},{target:`/security`,label:e(`security`),icon:Ce},{target:`/secrets`,label:e(`secrets`),icon:ce},{target:`/cron`,label:e(`cron`),icon:C},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:Se},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:k}]}function M(e){return[{target:`/language`,label:e(`language`),icon:E},...je(e)]}function Me(e){let t=e.toLowerCase();return t===`/settings`?!0:M(e=>e).some(e=>De(t,e.target))}function Ne(e,t){let n=e.toLowerCase(),r=M(t);if(ke(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(De(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var Pe=`nextclaw.ui.theme`,N=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],P=`warm`,F=!1,I=new Set;function Fe(e){return e===`warm`||e===`cool`}function L(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Ie(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(Pe);if(Fe(e))return e}catch{}return`warm`}function R(){return F||=(P=Ie(),L(P),!0),P}function Le(){return F?P:R()}function Re(e){if(R(),e!==P){if(P=e,L(P),typeof window<`u`)try{window.localStorage.setItem(Pe,P)}catch{}I.forEach(e=>e(P))}}function ze(e){return I.add(e),()=>{I.delete(e)}}var z=r(),Be={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Ve(){let e=p(),t=e.actionLabel===i(`runtimeStatusRestartAction`),n=async()=>{if(t)try{let e=await ee.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let t=e instanceof Error?e.message:i(`runtimeControlActionFailed`);c.error(`${i(`runtimeControlActionFailed`)}: ${t}`)}};return(0,z.jsxs)(xe,{children:[(0,z.jsx)(be,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,z.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-full`,Be[e.tone])})})}),(0,z.jsxs)(ye,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,z.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,z.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,z.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:i(`runtimeStatusActionHint`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void n(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?i(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}var B=e(n(),1);function V({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=ve(),i=r?.name??`NextClaw`,o=r?.productVersion?.trim(),s=o?`v${o}`:null,c=n??(0,z.jsx)(Ve,{}),l=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,u=t===`chrome`;return(0,z.jsxs)(`div`,{className:a(e??`flex min-w-0 items-center gap-2`,l&&`pl-[58px]`),children:[(0,z.jsx)(`div`,{className:a(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,z.jsx)(`img`,{src:`/logo.svg`,alt:i,className:`h-full w-full object-contain`})}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,z.jsx)(`span`,{className:a(`shrink-0 font-semibold text-gray-800`,u?`text-[15px]`:`text-[14px]`),children:i}),s?(0,z.jsx)(He,{versionLabel:s,density:t}):null]}),(0,z.jsx)(Ue,{}),c?(0,z.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:c}):null]})]})}function He({versionLabel:e,density:t}){let[n,r]=(0,B.useState)(!1);return(0,z.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),children:[(0,z.jsx)(`span`,{tabIndex:0,"aria-label":e,className:a(`block min-w-0 truncate font-medium text-gray-500 outline-none`,`text-[12px]`),children:e}),n?(0,z.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function Ue(){let{supported:e,busyAction:t,snapshot:n}=m();return!e||!n?null:n.status===`downloading`||n.status===`blocked`||n.status===`failed`?(0,z.jsx)(We,{snapshot:n}):n.status===`downloaded`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void h.applyDownloadedUpdate(),children:i(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):n.status===`update-available`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void h.downloadUpdate(),children:i(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function We({snapshot:e}){if(e.status===`blocked`||e.status===`failed`)return(0,z.jsx)(Ge,{snapshot:e});let t=e.status===`downloading`?Ke(e):null;return t?(0,z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,title:i(`updates`),children:t}):null}function Ge({snapshot:e}){let t=e.status===`failed`?i(`desktopUpdatesStatusFailed`):i(`desktopUpdatesStatusBlocked`),n=e.recoveryCommand?.trim()||null,r=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?i(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,r,n].filter(Boolean).join(`
3
- `);return(0,z.jsx)(`span`,{role:`img`,"aria-label":t,title:a,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100`,children:`!`})}function Ke(e){let t=e.progress?.percent;return t==null?i(`desktopUpdatesInlineDownloading`):i(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var qe={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function H(e){return qe[e]}function U({to:e,label:t,icon:n,density:r=`default`,className:i}){let o=H(r);return(0,z.jsx)(v,{to:e,className:({isActive:e})=>a(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:a(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function W({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=H(r);return(0,z.jsxs)(`button`,{type:`button`,onClick:n,className:a(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,i),"data-testid":l,children:[(0,z.jsx)(t,{className:a(d.icon,`shrink-0 text-gray-400`)}),(0,z.jsx)(`span`,{className:a(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,z.jsx)(`span`,{className:a(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function G({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:o=`default`,children:s}){let c=H(o);return(0,z.jsxs)(se,{value:n,onValueChange:i,children:[(0,z.jsxs)(ie,{className:a(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,z.jsxs)(`div`,{className:a(`flex min-w-0 items-center`,c.gap),children:[(0,z.jsx)(t,{className:a(c.icon,`text-gray-400`)}),(0,z.jsx)(`span`,{className:`text-left`,children:e})]}),(0,z.jsx)(`span`,{className:a(`ml-auto text-gray-500`,c.value),children:r})]}),(0,z.jsx)(oe,{children:s})]})}var K=`nextclaw-pwa-install-banner-dismissed`,q=`nextclaw-pwa-install-banner-dismissed-until`;function Je(){let e=J();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Ze(e):!1}function Ye(){let e=J();e?.setItem(K,`1`),e?.removeItem(q)}function Xe(){let e=J();e?.removeItem(K),e?.removeItem(q)}function J(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(e){let t=e.getItem(q);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(q),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(K,`1`),!0)}function Qe(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Je(),updateAvailable:!1,registrationFailed:!1}}var Y=f(()=>Qe()),X=`nextclaw-pwa-dev-sw-reset`,Z=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Y.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Y.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Y.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Y.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(X,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(X)}catch{}}}},Q=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Y.setState(Qe())},this.refreshState=()=>{let e=this.resolveInstallability();Y.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Je()})),Z.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ye(),Y.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Xe(),this.refreshState(),c.success(i(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Xe(),Y.setState({dismissedInstallPrompt:!0}),c.success(i(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function $e(){let e=Y(e=>e.installability);return(0,z.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:et(e)})}function et(e){return i(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function tt(e,t,n){return i(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function nt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.blockedReason);return(0,z.jsxs)(g,{children:[(0,z.jsxs)(o,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(u,{children:i(`pwaInstallTitle`)}),(0,z.jsx)(s,{children:i(`pwaInstallDescription`)})]}),(0,z.jsx)($e,{})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:tt(e,t,n)})}),e===`available`&&t===`prompt`?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,z.jsx)(we,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallManualHint`)})]}):null]})]})}function rt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,z.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaInstallBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallBannerDescription`)})]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":i(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Q.dismissInstallPrompt()},children:(0,z.jsx)(he,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Q.dismissInstallPrompt()},children:i(`pwaInstallDismiss`)})]})]})}function it(){let e=Y(e=>e.updateAvailable),t=Y(e=>e.installability);return!e||t!==`installed`?null:(0,z.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaUpdateBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaUpdateBannerDescription`)})]})}),(0,z.jsx)(`div`,{className:`mt-4`,children:(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Z.applyUpdate()},children:[(0,z.jsx)(pe,{className:`h-4 w-4`}),i(`pwaUpdateAction`)]})})]})}var $=!1;function at(){$||typeof window>`u`||($=!0,Q.start(),Z.start())}var ot={warm:`#F9F8F5`,cool:`#F8FAFB`},st=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=ot[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},ct=(0,B.createContext)(null);function lt({children:e}){let[t,n]=(0,B.useState)(()=>R());(0,B.useEffect)(()=>{st.syncTheme(t),window.nextclawDesktop?.setShellTheme?.(t)},[t]),(0,B.useEffect)(()=>ze(e=>{n(e)}),[]);let r=(0,B.useCallback)(e=>{Re(e),n(Le())},[]),i=(0,B.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,z.jsx)(ct.Provider,{value:i,children:e})}function ut(){let e=(0,B.useContext)(ct);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function dt(){let{language:e,setLanguage:n}=_e();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,B.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function ft(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:r}=dt();return(0,z.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,z.jsx)(E,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:i(`language`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(t.value),className:a(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,z.jsx)(ae,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function pt({mode:e}){let t=ue(),n=ge(),r=le(),{currentLanguage:o,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=dt(),{theme:u,setTheme:d}=ut(),f=e===`settings`,p=i(N.find(e=>e.value===u)?.labelKey??`themeWarm`),m=r.data?.account.email?.trim(),h=!!r.data?.account.loggedIn,g=e=>{u!==e&&d(e)},ee=[{target:`/chat`,label:i(`chat`),icon:D},{target:`/chat/cron`,label:i(`cron`),icon:C},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:i(`agentsPageTitle`),icon:w}],_=je(i),y=f?_:ee,b=f?`compact`:`default`;return(0,z.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,z.jsxs)(v,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,z.jsx)(te,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,z.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,z.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,z.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,z.jsx)(V,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,z.jsx)(`ul`,{className:a(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(U,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,z.jsxs)(`div`,{className:a(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,z.jsx)(W,{onClick:()=>t.accountManager.openAccountPanel(),icon:ce,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(U,{to:`/settings`,label:i(`settings`),icon:fe})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:u,onValueChange:e=>g(e),icon:O,label:i(`theme`),valueLabel:p,density:b,children:N.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:o,onValueChange:e=>l(e),icon:E,label:i(`language`),valueLabel:s,density:b,children:c.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,z.jsx)(W,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:re,label:i(`docBrowserHelp`),density:b})]})]})]})}function mt(){return(0,z.jsxs)(`header`,{className:`flex h-[var(--desktop-titlebar-height)] shrink-0 bg-background`,"data-testid":`desktop-window-chrome`,children:[(0,z.jsxs)(`div`,{className:`desktop-window-drag flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary pl-4 pr-3 text-secondary-foreground`,"data-testid":`desktop-window-chrome-sidebar`,children:[(0,z.jsx)(`div`,{className:`desktop-window-no-drag flex min-w-0 shrink-0 items-center`,children:(0,z.jsx)(V,{className:`flex min-w-0 items-center gap-2.5`,density:`chrome`})}),(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`,"aria-hidden":`true`})]}),(0,z.jsx)(`div`,{className:`desktop-window-drag flex min-w-0 flex-1 items-center border-b border-[#ebe7dc]/80 bg-secondary pr-[var(--desktop-caption-safe-right)]`,"aria-hidden":`true`,"data-testid":`desktop-window-chrome-main`,children:(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`})})]})}function ht(){return typeof window>`u`?null:vt()??window.nextclawDesktop?.platform??null}function gt(){return ht()===`darwin`}function _t(){return ht()===`win32`}function vt(){return null}var yt=(0,B.lazy)(async()=>({default:(await _(async()=>{let{DocBrowser:e}=await import(`./doc-browser-p9DDNPWB.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function bt(e){return{"--desktop-titlebar-height":`34px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":e?`280px`:`240px`}}function xt({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=Oe(e),o=_t();return(0,z.jsxs)(`div`,{className:a(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,o?`rounded-[10px]`:null),style:o?bt(i):void 0,children:[o?(0,z.jsx)(mt,{}):null,(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!i&&(0,z.jsx)(pt,{mode:`settings`}),(0,z.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,z.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,z.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,z.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})]}),t&&n===`floating`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})}export{O as C,w as D,T as E,C as O,k as S,E as T,Oe as _,lt as a,Ee as b,rt as c,U as d,V as f,ke as g,M as h,ft as i,nt as l,Ae as m,gt as n,ut as o,N as p,_t as r,at as s,xt as t,it as u,Me as v,D as w,A as x,Ne as y};
3
+ `);return(0,z.jsx)(`span`,{role:`img`,"aria-label":t,title:a,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100`,children:`!`})}function Ke(e){let t=e.progress?.percent;return t==null?i(`desktopUpdatesInlineDownloading`):i(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var qe={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function H(e){return qe[e]}function U({to:e,label:t,icon:n,density:r=`default`,className:i}){let o=H(r);return(0,z.jsx)(v,{to:e,className:({isActive:e})=>a(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:a(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function W({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=H(r);return(0,z.jsxs)(`button`,{type:`button`,onClick:n,className:a(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,i),"data-testid":l,children:[(0,z.jsx)(t,{className:a(d.icon,`shrink-0 text-gray-400`)}),(0,z.jsx)(`span`,{className:a(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,z.jsx)(`span`,{className:a(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function G({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:o=`default`,children:s}){let c=H(o);return(0,z.jsxs)(se,{value:n,onValueChange:i,children:[(0,z.jsxs)(ie,{className:a(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,z.jsxs)(`div`,{className:a(`flex min-w-0 items-center`,c.gap),children:[(0,z.jsx)(t,{className:a(c.icon,`text-gray-400`)}),(0,z.jsx)(`span`,{className:`text-left`,children:e})]}),(0,z.jsx)(`span`,{className:a(`ml-auto text-gray-500`,c.value),children:r})]}),(0,z.jsx)(oe,{children:s})]})}var K=`nextclaw-pwa-install-banner-dismissed`,q=`nextclaw-pwa-install-banner-dismissed-until`;function Je(){let e=J();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Ze(e):!1}function Ye(){let e=J();e?.setItem(K,`1`),e?.removeItem(q)}function Xe(){let e=J();e?.removeItem(K),e?.removeItem(q)}function J(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(e){let t=e.getItem(q);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(q),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(K,`1`),!0)}function Qe(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Je(),updateAvailable:!1,registrationFailed:!1}}var Y=f(()=>Qe()),X=`nextclaw-pwa-dev-sw-reset`,Z=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Y.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Y.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Y.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Y.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(X,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(X)}catch{}}}},Q=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Y.setState(Qe())},this.refreshState=()=>{let e=this.resolveInstallability();Y.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Je()})),Z.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ye(),Y.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Xe(),this.refreshState(),c.success(i(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Xe(),Y.setState({dismissedInstallPrompt:!0}),c.success(i(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function $e(){let e=Y(e=>e.installability);return(0,z.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:et(e)})}function et(e){return i(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function tt(e,t,n){return i(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function nt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.blockedReason);return(0,z.jsxs)(g,{children:[(0,z.jsxs)(o,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(u,{children:i(`pwaInstallTitle`)}),(0,z.jsx)(s,{children:i(`pwaInstallDescription`)})]}),(0,z.jsx)($e,{})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:tt(e,t,n)})}),e===`available`&&t===`prompt`?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,z.jsx)(we,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallManualHint`)})]}):null]})]})}function rt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,z.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaInstallBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallBannerDescription`)})]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":i(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Q.dismissInstallPrompt()},children:(0,z.jsx)(he,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Q.dismissInstallPrompt()},children:i(`pwaInstallDismiss`)})]})]})}function it(){let e=Y(e=>e.updateAvailable),t=Y(e=>e.installability);return!e||t!==`installed`?null:(0,z.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaUpdateBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaUpdateBannerDescription`)})]})}),(0,z.jsx)(`div`,{className:`mt-4`,children:(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Z.applyUpdate()},children:[(0,z.jsx)(pe,{className:`h-4 w-4`}),i(`pwaUpdateAction`)]})})]})}var $=!1;function at(){$||typeof window>`u`||($=!0,Q.start(),Z.start())}var ot={warm:`#F9F8F5`,cool:`#F8FAFB`},st=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=ot[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},ct=(0,B.createContext)(null);function lt({children:e}){let[t,n]=(0,B.useState)(()=>R());(0,B.useEffect)(()=>{st.syncTheme(t),window.nextclawDesktop?.setShellTheme?.(t)},[t]),(0,B.useEffect)(()=>ze(e=>{n(e)}),[]);let r=(0,B.useCallback)(e=>{Re(e),n(Le())},[]),i=(0,B.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,z.jsx)(ct.Provider,{value:i,children:e})}function ut(){let e=(0,B.useContext)(ct);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function dt(){let{language:e,setLanguage:n}=_e();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,B.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function ft(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:r}=dt();return(0,z.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,z.jsx)(E,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:i(`language`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(t.value),className:a(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,z.jsx)(ae,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function pt({mode:e}){let t=ue(),n=ge(),r=le(),{currentLanguage:o,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=dt(),{theme:u,setTheme:d}=ut(),f=e===`settings`,p=i(N.find(e=>e.value===u)?.labelKey??`themeWarm`),m=r.data?.account.email?.trim(),h=!!r.data?.account.loggedIn,g=e=>{u!==e&&d(e)},ee=[{target:`/chat`,label:i(`chat`),icon:D},{target:`/chat/cron`,label:i(`cron`),icon:C},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:i(`agentsPageTitle`),icon:w}],_=je(i),y=f?_:ee,b=f?`compact`:`default`;return(0,z.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,z.jsxs)(v,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,z.jsx)(te,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,z.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,z.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,z.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,z.jsx)(V,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,z.jsx)(`ul`,{className:a(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(U,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,z.jsxs)(`div`,{className:a(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,z.jsx)(W,{onClick:()=>t.accountManager.openAccountPanel(),icon:ce,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(U,{to:`/settings`,label:i(`settings`),icon:fe})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:u,onValueChange:e=>g(e),icon:O,label:i(`theme`),valueLabel:p,density:b,children:N.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:o,onValueChange:e=>l(e),icon:E,label:i(`language`),valueLabel:s,density:b,children:c.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,z.jsx)(W,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:re,label:i(`docBrowserHelp`),density:b})]})]})]})}function mt(){return(0,z.jsxs)(`header`,{className:`flex h-[var(--desktop-titlebar-height)] shrink-0 bg-background`,"data-testid":`desktop-window-chrome`,children:[(0,z.jsxs)(`div`,{className:`desktop-window-drag flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary pl-4 pr-3 text-secondary-foreground`,"data-testid":`desktop-window-chrome-sidebar`,children:[(0,z.jsx)(`div`,{className:`desktop-window-no-drag flex min-w-0 shrink-0 items-center`,children:(0,z.jsx)(V,{className:`flex min-w-0 items-center gap-2.5`,density:`chrome`})}),(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`,"aria-hidden":`true`})]}),(0,z.jsx)(`div`,{className:`desktop-window-drag flex min-w-0 flex-1 items-center border-b border-[#ebe7dc]/80 bg-secondary pr-[var(--desktop-caption-safe-right)]`,"aria-hidden":`true`,"data-testid":`desktop-window-chrome-main`,children:(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`})})]})}function ht(){return typeof window>`u`?null:vt()??window.nextclawDesktop?.platform??null}function gt(){return ht()===`darwin`}function _t(){return ht()===`win32`}function vt(){return null}var yt=(0,B.lazy)(async()=>({default:(await _(async()=>{let{DocBrowser:e}=await import(`./doc-browser-p9DDNPWB.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function bt(e){return{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":e?`280px`:`240px`}}function xt({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=Oe(e),o=_t();return(0,z.jsxs)(`div`,{className:a(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,o?`rounded-[10px]`:null),style:o?bt(i):void 0,children:[o?(0,z.jsx)(mt,{}):null,(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!i&&(0,z.jsx)(pt,{mode:`settings`}),(0,z.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,z.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,z.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,z.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})]}),t&&n===`floating`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})}export{O as C,w as D,T as E,C as O,k as S,E as T,Oe as _,lt as a,Ee as b,rt as c,U as d,V as f,ke as g,M as h,ft as i,nt as l,Ae as m,gt as n,ut as o,N as p,_t as r,at as s,xt as t,it as u,Me as v,D as w,A as x,Ne as y};