@xopcai/xopc 0.0.135 → 0.0.136

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 (79) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DSNW1_XP.js → agent-avatar-dicebear-CER17NHM.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-Cp0OvolD.js → agents-Bv5R-N8Q.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-DCudxzyC.js → app-management-settings-panel-B3Ap_wpX.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-4iY3hTlX.js → appearance-settings-3kBO22Xd.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-B3t69uNn.js → apps-page-BHYbGQcZ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-p9SmqSsD.js → archive-plugin-D_vGeNB8.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-BaouYEWE.js → attachment-load-hWV_8pHL.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automation-suggestion-card-D8u5JlzD.js → automation-suggestion-card-DVKmVTIo.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-DwbpG9vH.js → automations-page-BCTXpOBp.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-LNDWi0Gl.js → binary-plugins-BuXIeSPc.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-asA_N0Fu.js → block-editor-C1m0u-UU.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-D52r4pWa.js → browser-settings-page-ChUF08V5.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capability-presets-api-Du-_-Q07.js → capability-presets-api-B7WWYaEh.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-8Gf1EFrk.js → capability-presets-settings-panel-D_Bh1PnA.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-DgT9LnaF.js → channels-settings-BI2ChQc7.js} +1 -1
  18. package/dist/gateway/static/root/assets/{connectors-page-D6S3aoYT.js → connectors-page-qgvEp09M.js} +1 -1
  19. package/dist/gateway/static/root/assets/{desktop-pet-NPHqSQCF.js → desktop-pet-BxMJlvb-.js} +1 -1
  20. package/dist/gateway/static/root/assets/{desktop-pet-settings-CkyEB9mt.js → desktop-pet-settings-DCvpDImn.js} +1 -1
  21. package/dist/gateway/static/root/assets/{directory-picker-path-field-BOIuEkkg.js → directory-picker-path-field-D1nxs9PA.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dreaming-settings-fWPtm9_y.js → dreaming-settings-EAWkpOgw.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-debug-page-DUQA0Owx.js → extension-debug-page-LUQ8dE8z.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-page-CWkgZ7Sq.js → extension-page-B_mnhoRd.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-settings-page-D5i-d8_-.js → extension-settings-page-BWQsGmvW.js} +1 -1
  26. package/dist/gateway/static/root/assets/{gateway-config-api-DHZ9l6mK.js → gateway-config-api-M9bzPASf.js} +1 -1
  27. package/dist/gateway/static/root/assets/{gateway-settings-CjfkqqD2.js → gateway-settings-CbgtpprN.js} +1 -1
  28. package/dist/gateway/static/root/assets/{goal-create-dialog-BYsB6qWy.js → goal-create-dialog-CbP4t9aM.js} +1 -1
  29. package/dist/gateway/static/root/assets/{goal-detail-page-Bi3B3s8m.js → goal-detail-page-DlwI-MZZ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{goals-config-api-CLaB-6Ad.js → goals-config-api-BBhFVzBS.js} +1 -1
  31. package/dist/gateway/static/root/assets/{goals-page-DY4KL2QC.js → goals-page-D26r7knp.js} +1 -1
  32. package/dist/gateway/static/root/assets/{goals-settings-Be63XRCO.js → goals-settings-DdmVG_TR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{heartbeat-settings-CdbAl_lg.js → heartbeat-settings-DZW2Xq-U.js} +1 -1
  34. package/dist/gateway/static/root/assets/index-CPwVzi9x.css +1 -0
  35. package/dist/gateway/static/root/assets/{index-jlZ7Y0f4.js → index-DZOm5_ex.js} +7 -7
  36. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DilldBT9.js → keyboard-shortcuts-settings-1IWd88-T.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-DTKvJJMY.js → logs-page-DxoKJO7-.js} +1 -1
  38. package/dist/gateway/static/root/assets/{markdown-split-DimiuTSx.js → markdown-split-BtdBj32h.js} +1 -1
  39. package/dist/gateway/static/root/assets/{media-plugins-Cep9JyW4.js → media-plugins-CpoPj3s8.js} +1 -1
  40. package/dist/gateway/static/root/assets/{models-hub-panel-UYswNIEe.js → models-hub-panel-D1Rp__dV.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-Ddz6sLv9.js → notes-page-CgR1bO2W.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-Dda4cPxy.js → notes-workbench-ozsnmDTV.js} +2 -2
  43. package/dist/gateway/static/root/assets/{page-tabs-BhskfCr7.js → page-tabs-CVLqCfQB.js} +1 -1
  44. package/dist/gateway/static/root/assets/{preview-open-alternatives-3_YS56ud.js → preview-open-alternatives-CKUXJk2t.js} +1 -1
  45. package/dist/gateway/static/root/assets/{project-detail-page-BiBDFc6h.js → project-detail-page-B4dqFAQF.js} +1 -1
  46. package/dist/gateway/static/root/assets/{projects-page-BNa9AOC5.js → projects-page-DlRGXv4a.js} +1 -1
  47. package/dist/gateway/static/root/assets/{remote-access-hub-DL-f9OKe.js → remote-access-hub-rZEYQMZV.js} +1 -1
  48. package/dist/gateway/static/root/assets/{save-bar-controls-oeQDgMWi.js → save-bar-controls-BtGni268.js} +1 -1
  49. package/dist/gateway/static/root/assets/{schedule-field-D81RPAY6.js → schedule-field-BDGzKVWn.js} +1 -1
  50. package/dist/gateway/static/root/assets/{schema-form-Ca6WThnD.js → schema-form-DQJsKMCE.js} +1 -1
  51. package/dist/gateway/static/root/assets/{sessions-page-CEXXqYus.js → sessions-page-DxGoCGU8.js} +1 -1
  52. package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +1 -0
  53. package/dist/gateway/static/root/assets/{settings-collapsible-section-BuqHg9_W.js → settings-collapsible-section-c8XGd4-8.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-form-section-tavxDK2i.js → settings-form-section-By0YiDWo.js} +1 -1
  55. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DfGpkOk3.js → settings-loading-skeleton-SYCPY-WM.js} +1 -1
  56. package/dist/gateway/static/root/assets/{settings-page-2VX4D8w8.js → settings-page-D9NwvnBt.js} +1 -1
  57. package/dist/gateway/static/root/assets/{settings-page-layout-DIav-9MW.js → settings-page-layout-CrICyGob.js} +1 -1
  58. package/dist/gateway/static/root/assets/{setup-status-panel-HGjdE0XN.js → setup-status-panel-IjK-hDxf.js} +1 -1
  59. package/dist/gateway/static/root/assets/{share-preview-page-CIWy_4PV.js → share-preview-page-Dfnk9M_m.js} +1 -1
  60. package/dist/gateway/static/root/assets/{shares-settings-C8wbZ_AW.js → shares-settings-vQiRBra7.js} +1 -1
  61. package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +1 -0
  62. package/dist/gateway/static/root/assets/{skills-page-CkxDlDbR.js → skills-page-CruV215G.js} +1 -1
  63. package/dist/gateway/static/root/assets/{system-settings-panel-CDiuJRGT.js → system-settings-panel-BBVbSDFD.js} +1 -1
  64. package/dist/gateway/static/root/assets/{typed-models-lib-B7wPY6yX.js → typed-models-lib-CwFayhxu.js} +1 -1
  65. package/dist/gateway/static/root/assets/{user-profile-settings-panel-mJd8h8wp.js → user-profile-settings-panel-_KDWzagh.js} +1 -1
  66. package/dist/gateway/static/root/assets/{utils-B6mAul6d.js → utils-BiUjIHb4.js} +1 -1
  67. package/dist/gateway/static/root/assets/{voice-api-key-field-2piOqvIc.js → voice-api-key-field-agJqlm4o.js} +1 -1
  68. package/dist/gateway/static/root/assets/{work-item-detail-page-BQkBfIo7.js → work-item-detail-page-Bdw4ATCb.js} +1 -1
  69. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bsu_O633.js → workflow-run-setup-panel-D-Dy6mTy.js} +1 -1
  70. package/dist/gateway/static/root/assets/{workflow-start-dialog-BfmCq61y.js → workflow-start-dialog-GammZ2GK.js} +1 -1
  71. package/dist/gateway/static/root/assets/{workflows-page-CyzWdCfz.js → workflows-page-Cw5zrqti.js} +1 -1
  72. package/dist/gateway/static/root/index.html +2 -2
  73. package/dist/package.js +1 -1
  74. package/dist/src/session/client-history.js +3 -4
  75. package/dist/src/session/client-history.js.map +1 -1
  76. package/package.json +1 -1
  77. package/dist/gateway/static/root/assets/index-ChHE66XC.css +0 -1
  78. package/dist/gateway/static/root/assets/settings-advanced-gate-2qm18PmB.js +0 -1
  79. package/dist/gateway/static/root/assets/skill-reload-api-COlSgZV2.js +0 -1
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{a as o,n as s,o as c}from"./fetch-BWXmBizE.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$r as p,$s as m,Ac as h,Ao as g,At as _,Ba as v,Bi as y,Bo as b,C as x,Cs as S,Dl as C,Eo as w,Fi as T,Ft as E,Ga as D,Ha as O,Hs as k,Ii as A,Io as j,Jn as M,Ka as N,Li as P,Lo as F,Mt as I,Ni as ee,Nt as L,Ol as te,Oo as R,Pi as z,Po as ne,Qn as re,Qo as ie,Qr as B,Qs as V,Rc as H,Ri as U,Rt as W,Ua as ae,Va as oe,Vi as G,Vo as K,Vt as se,Wa as ce,Xn as le,Yn as ue,Za as q,Zn as de,_a as J,_s as fe,ao as pe,ar as me,bo as he,ca as ge,cl as _e,co as ve,cr as ye,do as be,dr as xe,ei as Y,er as Se,es as Ce,fl as we,ga as Te,gl as Ee,ic as De,ii as Oe,io as ke,kc as Ae,kl as je,ko as Me,ks as Ne,lo as Pe,n as Fe,ni as Ie,nr as Le,ns as Re,ol as ze,oo as Be,or as Ve,qa as He,r as Ue,ri as X,ro as We,rr as Ge,si as Ke,so as qe,sr as Je,ti as Ye,to as Xe,tr as Ze,ul as Qe,uo as $e,ur as et,us as tt,w as nt,wl as rt,wo as it,xc as at,yc as ot,yl as st,yo as ct,za as lt,zi as ut,zt as dt}from"./index-jlZ7Y0f4.js";import{t as ft}from"./markdown-editor-jD1LPiP-.js";import{n as pt,t as mt}from"./settings-page-layout-DIav-9MW.js";import{r as ht,t as gt}from"./settings-loading-skeleton-DfGpkOk3.js";import{n as _t,t as vt}from"./settings-form-section-tavxDK2i.js";import{t as yt}from"./page-tabs-BhskfCr7.js";import{n as bt}from"./agent-avatar-dicebear-DSNW1_XP.js";import{n as xt,r as St,t as Ct}from"./channel-recipient-api-sV06LCht.js";import{n as wt,r as Tt,t as Et}from"./utils-B6mAul6d.js";import{a as Dt,i as Ot,n as kt,o as At,t as jt}from"./typed-models-lib-B7wPY6yX.js";import{a as Mt,o as Nt,r as Pt,s as Ft}from"./capability-presets-api-Du-_-Q07.js";import{t as It}from"./directory-picker-path-field-BOIuEkkg.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ae,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=o?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(O,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(y=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(b=(0,Q.jsx)(w,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=b):b=t[17];let x=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,S;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(S=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=S):S=t[22];let C=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==S||t[25]!==C||t[26]!==x?(T=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:C}),t[23]=u,t[24]=S,t[25]=C,t[26]=x,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==b?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[b,T]}),t[28]=T,t[29]=b,t[30]=E):E=t[30];let k;t[31]!==E||t[32]!==g||t[33]!==v||t[34]!==y?(k=(0,Q.jsxs)(ce,{children:[p,(0,Q.jsxs)(oe,{className:m,onOpenAutoFocus:Rt,children:[g,v,y,E]})]}),t[31]=E,t[32]=g,t[33]=v,t[34]=y,t[35]=k):k=t[35];let A;return t[36]!==r||t[37]!==n||t[38]!==k?(A=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:k}),t[36]=r,t[37]=n,t[38]=k,t[39]=A):A=t[39],A}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:ot},{id:`behavior`,labelKey:`navBehavior`,icon:Ce},{id:`tools`,labelKey:`navTools`,icon:g},{id:`skills`,labelKey:`navSkills`,icon:R},{id:`memory`,labelKey:`navMemory`,icon:_e},{id:`connections`,labelKey:`navConnections`,icon:ze},{id:`config`,labelKey:`navConfig`,icon:Re},{id:`dangerZone`,labelKey:`navDangerZone`,icon:b}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,he.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Vt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,g=p===void 0?!0:p,[_,y]=(0,$.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=b):b=t[0];let x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,pe,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=x):x=t[1];let S;t[2]===o?S=t[3]:(S=(0,Q.jsx)(N,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=S);let C;t[4]===s?C=t[5]:(C=(0,Q.jsx)(O,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=C);let T;t[6]!==S||t[7]!==C?(T=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[S,C]}),t[6]=S,t[7]=C,t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=E):E=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===a.closeDialogAria?A=t[12]:(A=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E,"aria-label":a.closeDialogAria,children:k})}),t[11]=a.closeDialogAria,t[12]=A);let j;t[13]!==T||t[14]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[T,A]}),t[13]=T,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==a||t[17]!==l||t[18]!==c?(M=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Bt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=M):M=t[19];let P;t[20]===h?P=t[21]:(P=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=P);let F;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(F=g?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(w,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=F):F=t[30];let I;t[31]!==P||t[32]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[P,F]}),t[31]=P,t[32]=F,t[33]=I):I=t[33];let ee;t[34]!==M||t[35]!==I?(ee=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,I]}),t[34]=M,t[35]=I,t[36]=ee):ee=t[36];let L;t[37]!==_||t[38]!==ee||t[39]!==j?(L=(0,Q.jsxs)(ce,{children:[b,(0,Q.jsx)(oe,{ref:y,className:x,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:_,children:[j,ee]})})]}),t[37]=_,t[38]=ee,t[39]=j,t[40]=L):L=t[40];let te;return t[41]!==r||t[42]!==n||t[43]!==L?(te=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:L}),t[41]=r,t[42]=n,t[43]=L,t[44]=te):te=t[44],te}function Ht(e){return e.preventDefault()}var Ut=e=>s(e);function Wt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Gt(e){let t=Wt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Kt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`article`,{className:`px-4 py-3`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{className:`h-3 w-16`}),(0,Q.jsx)(J,{className:`h-3 w-20`}),(0,Q.jsx)(J,{className:`h-3 w-24`})]}),(0,Q.jsx)(J,{className:`mt-3 h-4 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-5/6`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-2/3`})]}),e[0]=t):t=e[0],t}function qt({embedded:e=!1,agentId:t}){let n=a(l(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[o,u]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),[g,_]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:v,isLoading:y}=d(c(`/api/memory/providers`),Ut),{data:b,isLoading:x,mutate:S}=d(c(`/api/memory/records?status=active&limit=80`),Ut),{data:C,isLoading:T,mutate:E}=d(c(`/api/memory/records?status=candidate&limit=80`),Ut),{data:D,isLoading:O}=d(c(`/api/memory/signals?limit=50`),Ut),{data:k,isLoading:A,mutate:j}=d(c(`/api/memory/traces?limit=80`),Ut),{data:M,isLoading:N}=d(c(`/api/memory/feedback-summary?limit=1000`),Ut),{data:P,isLoading:F,mutate:I}=d(c(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:ee,isLoading:L}=d(o?c(`/api/memory/search`):null,e=>s(e,{method:`POST`,body:JSON.stringify({query:o,maxResults:20})})),te=ee?.results.map(e=>({...e.record,score:e.score}))??b?.records??[],R=v?.providers.length??0,z=b?.records.length??0,ne=C?.records.length??0,re=D?.signals.length??0,ie=k?.traces.length??0,B=M?.summaries??[],V=y||x||T||O||A||N||F,H=(0,$.useMemo)(()=>new Map(B.map(e=>[e.recordId,e])),[B]),U=B.reduce((e,t)=>e+t.total,0),W=B.reduce((e,t)=>e+t.helpful,0),ae=U>0?Math.round(W/U*100):null,oe=(0,$.useMemo)(()=>[{label:n.providers,value:R},{label:n.records,value:z},{label:n.inbox,value:ne},{label:n.signals,value:re},{label:n.traceEvents,value:ie},{label:n.recallQuality,value:ae==null?`—`:`${ae}%`}],[ne,ae,R,z,re,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ie]);(0,$.useEffect)(()=>{let e=P?.memory.providerRouting;e&&_({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[P]);async function G(){if(P){p(n.saving);try{await s(c(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:P.agentId,memory:{...P.memory,providerRouting:g}})}),await I(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function K(e){h(t=>({...t,[e]:n.testing}));try{let t=(await s(c(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),j()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function se(e,t){await s(c(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([E(),S()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:oe.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),V?(0,Q.jsx)(J,{className:`mt-2 h-7 w-16`}):(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.searchStrategy,onChange:e=>_(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.writeStrategy,onChange:e=>_(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowExternalWrites,onChange:e=>_(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(J,{className:`h-10 w-28 rounded-md`},t)):(v?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowedProviderIds?.includes(e.id)??!1,onChange:t=>_(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:G,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:ne})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[T?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(C?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:()=>se(e.id,`active`),children:n.approve}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),!T&&ne===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),u(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(w,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:o?`${n.searchResults}${L?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[L||x&&!o?Array.from({length:5}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):te.map(e=>{let t=H.get(e.id),r=Wt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Gt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),!x&&!L&&te.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(v?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>K(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[N?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):B.slice(0,8).map(e=>{let t=(b?.records??[]).find(t=>t.id===e.recordId),r=Wt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Gt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),!N&&B.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:O?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(D?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:A?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(k?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Jt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Yt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,h=d?r||l.unset:a,g=p?i||l.unset:o,_;t[5]!==l.subtitle||t[6]!==l.title?(_=(0,Q.jsx)(_t,{icon:m,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=_):_=t[7];let v=d?`inherit`:`override`,y;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(y=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=y):y=t[11];let b;t[12]!==h||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==v||t[18]!==y?(b=(0,Q.jsx)(Jt,{label:l.modelLabel,mode:v,value:h,inheritedFrom:y,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=h,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=v,t[18]=y,t[19]=b):b=t[19];let x=p?`inherit`:`override`,S;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(S=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=S):S=t[23];let C;t[24]!==g||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==x||t[30]!==S?(C=(0,Q.jsx)(Jt,{label:l.workspaceLabel,mode:x,value:g,inheritedFrom:S,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=g,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=x,t[30]=S,t[31]=C):C=t[31];let w;t[32]!==b||t[33]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[b,C]}),t[32]=b,t[33]=C,t[34]=w):w=t[34];let T;return t[35]!==_||t[36]!==w?(T=(0,Q.jsxs)(vt,{children:[_,w]}),t[35]=_,t[36]=w,t[37]=T):T=t[37],T}function Xt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Zt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function Qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Zt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function $t(e,t){return e&&e.length>0?e.join(`, `):t}function en(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>Ze(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(nn),i=Object.entries(u?.tools?.builtin??{}).sort(tn),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(_t,{icon:V,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(vt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Xt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.model,monoValue:!0,source:Xt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.mode,source:Xt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:a?.mode??`all`,source:Xt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Qt,{name:`allow`,value:$t(a.allow,`—`),source:Xt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Qt,{name:`deny`,value:$t(a.deny,`—`),source:Xt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:o?.mode??`off`,source:Xt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Qt,{name:`sources`,value:$t(o?.sources,`—`),source:Xt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`requiresConfirmation`,value:$t(d?.requiresConfirmation,`—`),source:Xt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`forbidden`,value:$t(d?.forbidden,`—`),source:Xt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`escalation`,value:$t(d?.escalation,`—`),source:Xt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function tn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function nn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function rn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function an(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function on(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(an,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(an,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(an,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(sn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(cn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(dn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function sn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(rn,{children:(0,Q.jsx)(Yt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function cn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(un)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(ln).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=rn,m=vt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let x;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[36]=x):x=t[36];let C;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(C=(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[x,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=C):C=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==C?(_=(0,Q.jsx)(_t,{icon:Ce,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:C}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=C,t[44]=_):_=t[44];let T;t[45]!==p.id||t[46]!==c?(T=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=T):T=t[47];let E=p.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===p.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=A);let j=p.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==T||t[60]!==k||t[61]!==A||t[62]!==M?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:T,children:[k,A,M]})}),t[59]=T,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(st,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(Xe,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(We,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let x;return t[69]!==g||t[70]!==b?(x=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=x):x=t[71],x}function ln(e){return e.id}function un(e){return[e.id,e]}function dn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(rn,{children:(0,Q.jsx)(en,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function fn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(rn,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(vt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(K,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var pn=i(it,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function mn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:h,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,T=!u&&(d||l.length>0),E;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(E=(0,Q.jsx)(_t,{className:`shrink-0`,icon:m,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=E):E=t[2];let D;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s?(D=a?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(hn)}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${Tt(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=D):D=t[9];let O;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==b||t[18]!==v||t[19]!==d?(O=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-24`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Et(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(Xe,{className:i(Et(),`py-2`),value:f,onChange:e=>{p(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(We,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=b,t[18]=v,t[19]=d,t[20]=O):O=t[20];let k;t[21]!==n.channelsCustomPeerHint||t[22]!==n.channelsCustomPeerPlaceholder||t[23]!==n.channelsNoSessionsHint||t[24]!==n.channelsPeerAny||t[25]!==n.channelsPeerFromSessions||t[26]!==n.channelsRefreshSessions||t[27]!==n.channelsRefreshSessionsHint||t[28]!==n.channelsSessionLabel||t[29]!==n.peerIdLabel||t[30]!==h||t[31]!==r||t[32]!==S||t[33]!==f||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==C||t[38]!==g||t[39]!==b||t[40]!==v||t[41]!==T?(k=T&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(fe,{className:i(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&h.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-32`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(Xe,{className:i(Et(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(We,{value:``,children:n.channelsPeerAny}),h.map((e,t)=>(0,Q.jsx)(We,{value:String(t),children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),h.length===0&&f.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Et(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Xe,{className:pn,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(We,{value:``,children:C}),h.map(e=>(0,Q.jsx)(We,{value:e.chatId,children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[21]=n.channelsCustomPeerHint,t[22]=n.channelsCustomPeerPlaceholder,t[23]=n.channelsNoSessionsHint,t[24]=n.channelsPeerAny,t[25]=n.channelsPeerFromSessions,t[26]=n.channelsRefreshSessions,t[27]=n.channelsRefreshSessionsHint,t[28]=n.channelsSessionLabel,t[29]=n.peerIdLabel,t[30]=h,t[31]=r,t[32]=S,t[33]=f,t[34]=y,t[35]=_,t[36]=x,t[37]=C,t[38]=g,t[39]=b,t[40]=v,t[41]=T,t[42]=k):k=t[42];let A;t[43]!==r||t[44]!==u||t[45]!==f?(A=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=A):A=t[46];let j;t[47]!==n.addBinding||t[48]!==A?(j=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(w,{type:`submit`,disabled:A,children:n.addBinding})}),t[47]=n.addBinding,t[48]=A,t[49]=j):j=t[49];let M;t[50]!==c||t[51]!==O||t[52]!==k||t[53]!==j?(M=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[O,k,j]}),t[50]=c,t[51]=O,t[52]=k,t[53]=j,t[54]=M):M=t[54];let N;return t[55]!==E||t[56]!==D||t[57]!==M?(N=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[E,D,M]}),t[55]=E,t[56]=D,t[57]=M,t[58]=N):N=t[58],N}function hn(e,t){return(0,Q.jsx)(J,{className:`h-10 rounded-lg`},t)}function gn(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:s,filesViewMode:c,setFilesViewMode:l,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=u(_n),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let y=v,b;t[3]===n.filesHint?b=t[4]:(b=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=b);let x;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==y||t[18]!==a||t[19]!==r||t[20]!==c||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==s||t[26]!==f||t[27]!==l?(x=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:y,activeTab:o??``,onChange:s,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(Ae,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(k,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),c===`edit`?(0,Q.jsx)(`div`,{className:i(Et(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Et(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(Ke,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=y,t[18]=a,t[19]=r,t[20]=c,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=s,t[26]=f,t[27]=l,t[28]=x):x=t[28];let S;return t[29]!==b||t[30]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function _n(e){return e.resolved===`dark`}function vn(e){let t=(0,Z.c)(68),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:De,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames||t[39]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=y):y=t[41];let b;t[42]!==a||t[43]!==r||t[44]!==o||t[45]!==i.typedModels.defaultRole||t[46]!==s||t[47]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ft,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[42]=a,t[43]=r,t[44]=o,t[45]=i.typedModels.defaultRole,t[46]=s,t[47]=y,t[48]=b):b=t[48];let x;t[49]!==n.modelsSave||t[50]!==a||t[51]!==u||t[52]!==c?(x=u?null:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=u,t[52]=c,t[53]=x):x=t[53];let S;t[54]===l?S=t[55]:(S=()=>void l(),t[54]=l,t[55]=S);let C;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==S?(C=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=S,t[59]=C):C=t[59];let T;t[60]!==x||t[61]!==C?(T=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[60]=x,t[61]=C,t[62]=T):T=t[62];let E;return t[63]!==d||t[64]!==T||t[65]!==v||t[66]!==b?(E=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,T]}),t[63]=d,t[64]=T,t[65]=v,t[66]=b,t[67]=E):E=t[67],E}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=y(n.trim());return e&&ut(e.styleId)?e.styleId:A[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await de(t)}catch{}r(U(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await xe(t,n),G(t),r(P)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),_=(e,t)=>{let r=y(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:A.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,T[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,he.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)($e,{open:f,onOpenChange:p,children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,he.press),children:a.avatarMore})}),(0,Q.jsx)(Pe,{children:(0,Q.jsxs)(ve,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(ee,{agentId:t,avatar:n,size:40}),n.trim()&&!y(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function xn(e){let t=(0,Z.c)(206),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:T,profileMarkdownLoading:A,profileDraft:j,updateIdentity:M,handleSoulTemplateChange:P,handleSoulContentChange:F,setAvatarDialogOpen:I,toggleSoulPreviewMode:te,onTryInChat:R}=e,z=l(wn),re=u(Cn),ie;t[0]===j?.identity?ie=t[1]:(ie=j?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=j?.identity,t[1]=ie);let B=ie,V=j?.soulTemplate??`professional`,U=j?.soulCustomContent??``,W=j?.soulEditorNonce??0,G=j?.soulPreviewMode??!1,K=j?.avatarDialogOpen??!1,se;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(se=Et(),t[2]=se):se=t[2];let le=se,ue;t[3]===z?ue=t[4]:(ue=(e,t)=>z===`zh`?t:e,t[3]=z,t[4]=ue);let q=ue;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let de;t[7]!==B.avatar||t[8]!==a.id?(de=(0,Q.jsx)(ee,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=de):de=t[9];let J;t[10]===I?J=t[11]:(J=()=>I(!0),t[10]=I,t[11]=J);let fe;t[12]!==n.avatarOpenSettingsAria||t[13]!==J?(fe={onClick:J,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=J,t[14]=fe):fe=t[14];let me;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(me=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=me):me=t[21];let ge;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==o||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(ge=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=o,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=ge):ge=t[29];let _e;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==de||t[33]!==fe||t[34]!==me||t[35]!==ge?(_e=(0,Q.jsx)(_t,{icon:Ce,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:de,iconInteractive:fe,titleAccessory:me,trailing:ge}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=de,t[33]=fe,t[34]=me,t[35]=ge,t[36]=_e):_e=t[36];let ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(ae,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,Be)}),t[37]=ve):ve=t[37];let ye;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ye=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,pe),t[38]=ye):ye=t[38];let be;t[39]===n.avatarPickerTitle?be=t[40]:(be=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=xe):xe=t[41];let Y;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[42]=Y):Y=t[42];let Se;t[43]===n.closeDialogAria?Se=t[44]:(Se=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:xe,"aria-label":n.closeDialogAria,children:Y})}),t[43]=n.closeDialogAria,t[44]=Se);let we;t[45]!==be||t[46]!==Se?(we=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[be,Se]}),t[45]=be,t[46]=Se,t[47]=we):we=t[47];let Te;t[48]===n.avatarRowHint?Te=t[49]:(Te=(0,Q.jsx)(O,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Te);let Ee;t[50]===M?Ee=t[51]:(Ee=e=>M({avatar:e}),t[50]=M,t[51]=Ee);let De;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Ee?(De=(0,Q.jsx)(bn,{agentId:a.id,value:B.avatar,onChange:Ee,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Ee,t[56]=De):De=t[56];let Oe;t[57]!==we||t[58]!==Te||t[59]!==De?(Oe=(0,Q.jsxs)(ce,{children:[ve,(0,Q.jsxs)(oe,{className:ye,onOpenAutoFocus:Sn,children:[we,Te,De]})]}),t[57]=we,t[58]=Te,t[59]=De,t[60]=Oe):Oe=t[60];let ke;t[61]!==K||t[62]!==I||t[63]!==Oe?(ke=(0,Q.jsx)(D,{open:K,onOpenChange:I,children:Oe}),t[61]=K,t[62]=I,t[63]=Oe,t[64]=ke):ke=t[64];let je;t[65]===n.displayName?je=t[66]:(je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=je);let Pe;t[67]!==c||t[68]!==M?(Pe=e=>{c(e.target.value),M({name:e.target.value})},t[67]=c,t[68]=M,t[69]=Pe):Pe=t[69];let Fe;t[70]!==n.personaNamePlaceholder||t[71]!==s||t[72]!==Pe?(Fe=(0,Q.jsx)(`input`,{className:le,value:s,onChange:Pe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=s,t[72]=Pe,t[73]=Fe):Fe=t[73];let Ie;t[74]!==je||t[75]!==Fe?(Ie=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[je,Fe]}),t[74]=je,t[75]=Fe,t[76]=Ie):Ie=t[76];let Le;t[77]===n.personaEmoji?Le=t[78]:(Le=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Le);let Re;t[79]===M?Re=t[80]:(Re=e=>M({emoji:e.target.value}),t[79]=M,t[80]=Re);let ze;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Re?(ze=(0,Q.jsx)(`input`,{className:le,value:B.emoji,onChange:Re,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Re,t[84]=ze):ze=t[84];let Ve;t[85]!==Le||t[86]!==ze?(Ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Le,ze]}),t[85]=Le,t[86]=ze,t[87]=Ve):Ve=t[87];let He;t[88]===n.agentDescription?He=t[89]:(He=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=He);let Ue;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=i(le,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Ue):Ue=t[90];let X;t[91]!==f||t[92]!==M?(X=e=>{f(e.target.value),M({description:e.target.value})},t[91]=f,t[92]=M,t[93]=X):X=t[93];let Ge;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==X?(Ge=(0,Q.jsx)(`textarea`,{className:Ue,value:d,onChange:X,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=X,t[97]=Ge):Ge=t[97];let qe;t[98]!==He||t[99]!==Ge?(qe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[He,Ge]}),t[98]=He,t[99]=Ge,t[100]=qe):qe=t[100];let Je;t[101]===n.personaCreature?Je=t[102]:(Je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Je);let Ye;t[103]===B.creature?Ye=t[104]:(Ye=L.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=Ye);let Ze;t[105]===M?Ze=t[106]:(Ze=e=>{if(e.target.value===`__custom__`){M({creature:``});return}M({creature:e.target.value})},t[105]=M,t[106]=Ze);let Qe;t[107]===q?Qe=t[108]:(Qe=L.map(e=>(0,Q.jsx)(We,{value:e.value,children:q(e.labelEn,e.labelZh)},e.value)),t[107]=q,t[108]=Qe);let $e;t[109]===q?$e=t[110]:($e=q(`Custom…`,`自定义…`),t[109]=q,t[110]=$e);let et;t[111]===$e?et=t[112]:(et=(0,Q.jsx)(We,{value:`__custom__`,children:$e}),t[111]=$e,t[112]=et);let tt;t[113]!==Ye||t[114]!==Ze||t[115]!==Qe||t[116]!==et?(tt=(0,Q.jsxs)(Xe,{className:le,value:Ye,onChange:Ze,children:[Qe,et]}),t[113]=Ye,t[114]=Ze,t[115]=Qe,t[116]=et,t[117]=tt):tt=t[117];let nt;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==M?(nt=L.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(le,`mt-1 text-xs`),value:B.creature,onChange:e=>M({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=M,t[121]=nt):nt=t[121];let rt;t[122]!==Je||t[123]!==tt||t[124]!==nt?(rt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Je,tt,nt]}),t[122]=Je,t[123]=tt,t[124]=nt,t[125]=rt):rt=t[125];let it;t[126]!==Ie||t[127]!==Ve||t[128]!==qe||t[129]!==rt?(it=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Ie,Ve,qe,rt]}),t[126]=Ie,t[127]=Ve,t[128]=qe,t[129]=rt,t[130]=it):it=t[130];let at;t[131]!==ke||t[132]!==it||t[133]!==_e?(at=(0,Q.jsxs)(vt,{children:[_e,ke,it]}),t[131]=ke,t[132]=it,t[133]=_e,t[134]=at):at=t[134];let ot;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(ot=(0,Q.jsx)(_t,{icon:H,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=ot):ot=t[137];let st;t[138]===n.modelPrimary?st=t[139]:(st=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=st);let lt;t[140]===g?lt=t[141]:(lt=e=>g(e),t[140]=g,t[141]=lt);let ut;t[142]!==o||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==h||t[147]!==lt?(ut=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:h,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:lt}),t[142]=o,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=h,t[147]=lt,t[148]=ut):ut=t[148];let dt;t[149]!==n.modelClear||t[150]!==o||t[151]!==h||t[152]!==g?(dt=h.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>g(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=o,t[151]=h,t[152]=g,t[153]=dt):dt=t[153];let pt;t[154]!==ut||t[155]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,dt]}),t[154]=ut,t[155]=dt,t[156]=pt):pt=t[156];let mt;t[157]!==st||t[158]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[st,pt]}),t[157]=st,t[158]=pt,t[159]=mt):mt=t[159];let gt;t[160]===n.workspacePath?gt=t[161]:(gt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=gt);let yt=r.workingDirectory,bt=r.workingDirectory.notSet,xt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(xt=i(le,`font-mono text-xs`),t[162]=xt):xt=t[162];let St;t[163]!==o||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==m?(St=(0,Q.jsx)(It,{value:p,onChange:m,disabled:o,wd:yt,placeholder:bt,inputClassName:xt}),t[163]=o,t[164]=r.workingDirectory,t[165]=p,t[166]=m,t[167]=St):St=t[167];let Ct;t[168]!==gt||t[169]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[gt,St]}),t[168]=gt,t[169]=St,t[170]=Ct):Ct=t[170];let wt;t[171]!==mt||t[172]!==Ct?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[mt,Ct]}),t[171]=mt,t[172]=Ct,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==o||t[177]!==T||t[178]!==C||t[179]!==R?(Tt=T?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void C(),children:n.save}),R?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:R,children:[(0,Q.jsx)(k,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=o,t[177]=T,t[178]=C,t[179]=R,t[180]=Tt):Tt=t[180];let Dt;t[181]!==ot||t[182]!==wt||t[183]!==Tt?(Dt=(0,Q.jsxs)(vt,{children:[ot,wt,Tt]}),t[181]=ot,t[182]=wt,t[183]=Tt,t[184]=Dt):Dt=t[184];let Ot;t[185]!==n.personaSectionSoul||t[186]!==n.personaSectionSoulHint||t[187]!==n.personaSoulCustomEdit||t[188]!==n.personaSoulEdit||t[189]!==n.personaSoulPreview||t[190]!==n.personaSoulTemplate||t[191]!==F||t[192]!==P||t[193]!==re||t[194]!==q||t[195]!==A||t[196]!==U||t[197]!==W||t[198]!==G||t[199]!==V||t[200]!==te?(Ot=A?(0,Q.jsx)(ht,{rows:2}):(0,Q.jsxs)(vt,{children:[(0,Q.jsx)(_t,{icon:ne,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:E.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,he.pressCard,V===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>P(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:q(e.labelEn,e.labelZh)})]},e.id))})]}),V===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(ct,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:G?n.personaSoulEdit:n.personaSoulPreview,"aria-label":G?n.personaSoulEdit:n.personaSoulPreview,onClick:te,children:G?(0,Q.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(le,`flex min-h-64 flex-col overflow-hidden p-0`),children:G?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(Ke,{content:U})}):(0,Q.jsx)(ft,{initialContent:U,onChange:F,isDark:re,className:`min-h-0 flex-1`},`soul-${W}`)})]}):null]}),t[185]=n.personaSectionSoul,t[186]=n.personaSectionSoulHint,t[187]=n.personaSoulCustomEdit,t[188]=n.personaSoulEdit,t[189]=n.personaSoulPreview,t[190]=n.personaSoulTemplate,t[191]=F,t[192]=P,t[193]=re,t[194]=q,t[195]=A,t[196]=U,t[197]=W,t[198]=G,t[199]=V,t[200]=te,t[201]=Ot):Ot=t[201];let kt;return t[202]!==at||t[203]!==Dt||t[204]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[at,Dt,Ot]}),t[202]=at,t[203]=Dt,t[204]=Ot,t[205]=kt):kt=t[205],kt}function Sn(e){return e.preventDefault()}function Cn(e){return e.resolved===`dark`}function wn(e){return e.language}function Tn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function En(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Dn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=ue(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=M(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,T=r.skills.effectiveAllowlist?.length,E;t[14]!==r.avatar||t[15]!==r.id?(E=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(ee,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=E):E=t[16];let D;t[17]===p?D=t[18]:(D=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=D);let O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let A;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(A=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=A):A=t[26];let j;t[27]!==D||t[28]!==O||t[29]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[D,O,A]}),t[27]=D,t[28]=O,t[29]=A,t[30]=j):j=t[30];let N;t[31]===r.id?N=t[32]:(N=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=N);let P;t[33]!==N||t[34]!==j?(P=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[j,N]}),t[33]=N,t[34]=j,t[35]=P):P=t[35];let F;t[36]!==P||t[37]!==E?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[E,P]}),t[36]=P,t[37]=E,t[38]=F):F=t[38];let I;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(I=d?(0,Q.jsxs)(w,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(k,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=I):I=t[42];let L;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(L=r.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=L):L=t[47];let te;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(te=o?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=te):te=t[52];let R;t[53]!==I||t[54]!==L||t[55]!==te?(R=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[I,L,te]}),t[53]=I,t[54]=L,t[55]=te,t[56]=R):R=t[56];let z;t[57]!==F||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[F,R]}),t[57]=F,t[58]=R,t[59]=z):z=t[59];let ne;t[60]===h?ne=t[61]:(ne=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=ne);let re;t[62]!==z||t[63]!==ne?(re=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[z,ne]})}),t[62]=z,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ie=(0,Q.jsx)(_t,{icon:Ce,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ie):ie=t[67];let B;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(B=(0,Q.jsx)(Tn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=B):B=t[71];let V;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(V=(0,Q.jsx)(Tn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=V):V=t[75];let H;t[76]!==B||t[77]!==V?(H=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,V]}),t[76]=B,t[77]=V,t[78]=H):H=t[78];let U;t[79]!==ie||t[80]!==H?(U=(0,Q.jsxs)(vt,{children:[ie,H]}),t[79]=ie,t[80]=H,t[81]=U):U=t[81];let W;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(W=(0,Q.jsx)(_t,{icon:Qe,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=W):W=t[84];let ae;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(ae=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=ae):ae=t[88];let oe;t[89]!==n.listToolsLabel||t[90]!==ae?(oe=(0,Q.jsx)(En,{icon:g,label:n.listToolsLabel,value:ae}),t[89]=n.listToolsLabel,t[90]=ae,t[91]=oe):oe=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==T?(G=T?n.listSkillsCount.replace(`{{count}}`,String(T)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=T,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(En,{icon:Ce,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let se;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(se=(0,Q.jsx)(En,{icon:_e,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=se):se=t[101];let ce;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(ce=(0,Q.jsx)(En,{icon:ze,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=ce):ce=t[104];let le;t[105]!==n.listWorkspaceLabel||t[106]!==b?(le=(0,Q.jsx)(En,{icon:at,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=le):le=t[107];let q;t[108]!==oe||t[109]!==K||t[110]!==se||t[111]!==ce||t[112]!==le?(q=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[oe,K,se,ce,le]}),t[108]=oe,t[109]=K,t[110]=se,t[111]=ce,t[112]=le,t[113]=q):q=t[113];let de;t[114]!==W||t[115]!==q?(de=(0,Q.jsxs)(vt,{children:[W,q]}),t[114]=W,t[115]=q,t[116]=de):de=t[116];let J;return t[117]!==re||t[118]!==U||t[119]!==de?(J=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[re,U,de]}),t[117]=re,t[118]=U,t[119]=de,t[120]=J):J=t[120],J}function On(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(kn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(_t,{className:`shrink-0`,icon:we,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=q(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(rt,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==C||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,E]}),t[28]=C,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==a||t[46]!==s||t[47]!==h||t[48]!==d||t[49]!==o||t[50]!==c||t[51]!==u?(M=o?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(gt,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=a,t[46]=s,t[47]=h,t[48]=d,t[49]=o,t[50]=c,t[51]=u,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==a||t[55]!==p||t[56]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=a,t[55]=p,t[56]=f,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==v?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=v,t[64]=P):P=t[64],P}function kn(e){return e.name||e.directoryId}var An=[`write_file`,`apply_patch`,`exec_command`],jn=[`exec_command`,`image_generate`,`extensions`],Mn=[`send_message`,`send_media`];function Nn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let T=C,E;t[14]===s?E=t[15]:(E=()=>{s(new Set)},t[14]=s,t[15]=E);let D=E,O;t[16]!==r||t[17]!==s||t[18]!==h?(O=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=O):O=t[19];let k=O,A;t[20]===r?A=t[21]:(A=Nt(r),t[20]=r,t[21]=A);let j=A,M;if(t[22]!==v||t[23]!==j||t[24]!==n||t[25]!==h){if(M=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(Fn),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),M.push(n)}for(let e of Mt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&M.push({key:e.key,ids:[...t]})}if(j.length>0){let e;t[31]===j?e=t[32]:(e={key:`misc`,ids:j},t[31]=j,t[32]=e),M.push(e)}t[22]=v,t[23]=j,t[24]=n,t[25]=h,t[26]=M}else M=t[26];let N=M,P=N.some(Pn),F=g||a,I;t[33]===f.quickActionsLabel?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=I);let ee=F||r.length===0&&h.length===0,L;t[35]!==D||t[36]!==f.quickEnableAll||t[37]!==ee?(L=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ee,onClick:D,children:f.quickEnableAll}),t[35]=D,t[36]=f.quickEnableAll,t[37]=ee,t[38]=L):L=t[38];let te=F||r.length===0&&h.length===0,R;t[39]!==k||t[40]!==f.quickDisableAll||t[41]!==te?(R=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:te,onClick:k,children:f.quickDisableAll}),t[39]=k,t[40]=f.quickDisableAll,t[41]=te,t[42]=R):R=t[42];let z=F||r.length===0,ne;t[43]===T?ne=t[44]:(ne=()=>T(An),t[43]=T,t[44]=ne);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==z||t[47]!==ne?(re=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:z,onClick:ne,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=z,t[47]=ne,t[48]=re):re=t[48];let ie=F||r.length===0,B;t[49]===T?B=t[50]:(B=()=>T(jn),t[49]=T,t[50]=B);let V;t[51]!==f.quickHighRiskOff||t[52]!==ie||t[53]!==B?(V=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ie,onClick:B,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ie,t[53]=B,t[54]=V):V=t[54];let H=F||r.length===0,U;t[55]===T?U=t[56]:(U=()=>T(Mn),t[55]=T,t[56]=U);let W;t[57]!==f.quickNoOutbound||t[58]!==H||t[59]!==U?(W=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:H,onClick:U,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=H,t[59]=U,t[60]=W):W=t[60];let ae;t[61]!==L||t[62]!==R||t[63]!==re||t[64]!==V||t[65]!==W?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,re,V,W]}),t[61]=L,t[62]=R,t[63]=re,t[64]=V,t[65]=W,t[66]=ae):ae=t[66];let oe;t[67]!==I||t[68]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[I,ae]}),t[67]=I,t[68]=ae,t[69]=oe):oe=t[69];let G;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==N||t[75]!==P||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==a||t[80]!==n||t[81]!==F||t[82]!==S?(G=a?(0,Q.jsx)(gt,{rows:4}):P?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:N.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||F,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=N,t[75]=P,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=a,t[80]=n,t[81]=F,t[82]=S,t[83]=G):G=t[83];let K;return t[84]!==oe||t[85]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[oe,G]}),t[84]=oe,t[85]=G,t[86]=K):K=t[86],K}function Pn(e){return e.ids.length>0}function Fn(e,t){return e.localeCompare(t)}function In(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:o,toolEntryDisable:s,setToolEntryDisable:c,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=l(Rn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,_;t[2]===i.tools.presetDenied?_=t[3]:(_=new Set(i.tools.presetDenied.flatMap(Ln)),t[2]=i.tools.presetDenied,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=e=>{c(e)},t[4]=c,t[5]=y);let b=y,x=n.toolsDisableGroups,S;t[6]===x?S=t[7]:(S=e=>x[e],t[6]=x,t[7]=S);let C=S,T;t[8]===n.toolDescriptions?T=t[9]:(T=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=T);let E=T,D;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(D=(0,Q.jsx)(_t,{className:`shrink-0`,icon:g,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=D):D=t[12];let O;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(O={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=O):O=t[23];let k;t[24]!==o||t[25]!==r.builtinToolIds||t[26]!==C||t[27]!==E||t[28]!==b||t[29]!==v||t[30]!==O||t[31]!==s?(k=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Nn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:s,onDisableSetChange:b,defaultsDisableSet:v,getToolDescription:E,getGroupTitle:C,quickActionsDisabled:o,labels:O})}),t[24]=o,t[25]=r.builtinToolIds,t[26]=C,t[27]=E,t[28]=b,t[29]=v,t[30]=O,t[31]=s,t[32]=k):k=t[32];let A;t[33]!==n.toolsSave||t[34]!==o||t[35]!==f||t[36]!==u?(A=f?null:(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=o,t[35]=f,t[36]=u,t[37]=A):A=t[37];let j;t[38]===d?j=t[39]:(j=()=>void d(),t[38]=d,t[39]=j);let M;t[40]!==n.toolsClearEntry||t[41]!==o||t[42]!==j?(M=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:j,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=o,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==M||t[45]!==A?(N=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[A,M]}),t[44]=M,t[45]=A,t[46]=N):N=t[46];let P;return t[47]!==N||t[48]!==D||t[49]!==k?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[D,k,N]}),t[47]=N,t[48]=D,t[49]=k,t[50]=P):P=t[50],P}function Ln(e){let t=String(e).trim();return t?[t]:[]}function Rn(e){return e.language}function zn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce,bindingsLoading:le,agentBindings:ue,bindChannelStatuses:q,bindChannelsLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Y,onTryInChat:Se}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Se||t[11]!==a?(e=(0,Q.jsx)(Dn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Se}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Se,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Se||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(xn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Se}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Se,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==U||t[44]!==H||t[45]!==a||t[46]!==V?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(vn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=U,t[44]=H,t[45]=a,t[46]=V,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==L||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Se||t[56]!==R||t[57]!==te||t[58]!==N||t[59]!==ee||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(gn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,onTryInChat:Se})}),t[48]=n,t[49]=M,t[50]=I,t[51]=L,t[52]=j,t[53]=A,t[54]=P,t[55]=Se,t[56]=R,t[57]=te,t[58]=N,t[59]=ee,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==ie||t[70]!==re||t[71]!==a||t[72]!==ne||t[73]!==z?(e=(0,Q.jsx)(In,{a:n,data:s,selected:a,busy:c,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie}),t[66]=n,t[67]=c,t[68]=s,t[69]=ie,t[70]=re,t[71]=a,t[72]=ne,t[73]=z,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==ae||t[78]!==ce||t[79]!==a||t[80]!==G||t[81]!==se||t[82]!==W||t[83]!==oe||t[84]!==K?(e=(0,Q.jsx)(On,{a:n,selected:a,busy:c,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce}),t[75]=n,t[76]=c,t[77]=ae,t[78]=ce,t[79]=a,t[80]=G,t[81]=se,t[82]=W,t[83]=oe,t[84]=K,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(qt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==q||t[91]!==de||t[92]!==me||t[93]!==he||t[94]!==le||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==fe||t[99]!==ve||t[100]!==ge||t[101]!==Y||t[102]!==xe||t[103]!==be||t[104]!==pe||t[105]!==ye||t[106]!==_e||t[107]!==J?(e=(0,Q.jsx)(mn,{a:n,busy:c,bindingsLoading:le,agentBindings:ue,channelStatuses:q,channelsStatusLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Y}),t[88]=n,t[89]=ue,t[90]=q,t[91]=de,t[92]=me,t[93]=he,t[94]=le,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=fe,t[99]=ve,t[100]=ge,t[101]=Y,t[102]=xe,t[103]=be,t[104]=pe,t[105]=ye,t[106]=_e,t[107]=J,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(on,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let Ce;return t[126]===n.selectAgentHint?Ce=t[127]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Ce),Ce}function Bn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=ue(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=M(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Vn(e,t){return e.replace(`{{count}}`,String(t))}function Hn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Un(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Wn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,qe),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(B,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Y,{children:(0,Q.jsxs)(p,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Ye,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(Ie,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Gn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Bn(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=ue(e,n),r=e.id,c=M(e,n),f=Hn(e,n),p=Un(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,he.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(ee,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Kn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(k,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function Kn(e){return(0,Q.jsx)(Wn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function qn(e){let t=(0,Z.c)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:h,createWorkspace:g,setCreateWorkspace:y,createModel:b,setCreateModel:x,onCreate:S,onSuggestWorkspace:C,agents:T,duplicateSourceId:E,onSelectDuplicateSource:k}=e,[A,M]=(0,$.useState)(null),P;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=P):P=t[0];let F;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(F=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,pe,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=F):F=t[1];let I;t[2]===a.addAgent?I=t[3]:(I=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=I);let ee;t[4]===a.addAgentHint?ee=t[5]:(ee=(0,Q.jsx)(O,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=ee);let L;t[6]!==I||t[7]!==ee?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[I,ee]}),t[6]=I,t[7]=ee,t[8]=L):L=t[8];let te;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(te=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=te):te=t[9];let R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=R):R=t[10];let z;t[11]===a.closeDialogAria?z=t[12]:(z=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":a.closeDialogAria,children:R})}),t[11]=a.closeDialogAria,t[12]=z);let ne;t[13]!==L||t[14]!==z?(ne=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[L,z]}),t[13]=L,t[14]=z,t[15]=ne):ne=t[15];let re;t[16]!==a||t[17]!==T||t[18]!==E||t[19]!==k?(re=T.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(Xe,{className:i(Et(),`bg-surface-panel`),value:E??``,onChange:e=>k(e.target.value||null),children:[(0,Q.jsx)(We,{value:``,children:a.copyFromExistingAgentNone}),T.map(e=>(0,Q.jsxs)(We,{value:e.id,children:[ue(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=T,t[18]=E,t[19]=k,t[20]=re):re=t[20];let ie;t[21]===c?ie=t[22]:(ie=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ie);let B;t[23]!==a.newAgentLabel||t[24]!==l?(B=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=B):B=t[25];let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=Et(),t[26]=V):V=t[26];let H;t[27]===d?H=t[28]:(H=e=>d(e.target.value),t[27]=d,t[28]=H);let U;t[29]===C?U=t[30]:(U=()=>C(),t[29]=C,t[30]=U);let W;t[31]!==u||t[32]!==H||t[33]!==U?(W=(0,Q.jsx)(`input`,{className:V,value:u,onChange:H,onBlur:U,required:!0,autoComplete:`off`}),t[31]=u,t[32]=H,t[33]=U,t[34]=W):W=t[34];let G;t[35]!==B||t[36]!==W?(G=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[B,W]}),t[35]=B,t[36]=W,t[37]=G):G=t[37];let K;t[38]===a.newAgentIdOptional?K=t[39]:(K=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=K);let se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se=i(Et(),`font-mono text-xs`),t[40]=se):se=t[40];let le;t[41]===p?le=t[42]:(le=e=>p(e.target.value),t[41]=p,t[42]=le);let q;t[43]===C?q=t[44]:(q=()=>C(),t[43]=C,t[44]=q);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==le||t[49]!==q?(de=(0,Q.jsx)(`input`,{className:se,value:f,onChange:le,onBlur:q,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=le,t[49]=q,t[50]=de):de=t[50];let J;t[51]===a.newAgentIdRules?J=t[52]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=J);let fe;t[53]!==K||t[54]!==de||t[55]!==J?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[K,de,J]}),t[53]=K,t[54]=de,t[55]=J,t[56]=fe):fe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let he;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Et(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=he):he=t[60];let ge;t[61]===h?ge=t[62]:(ge=e=>h(e.target.value),t[61]=h,t[62]=ge);let _e;t[63]!==a.agentDescriptionPlaceholder||t[64]!==m||t[65]!==ge?(_e=(0,Q.jsx)(`textarea`,{className:he,value:m,onChange:ge,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=m,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==me||t[68]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[67]=me,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]===a.newWorkspace?ye=t[71]:(ye=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=ye);let be;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(be=i(Et(),`font-mono text-xs`),t[72]=be):be=t[72];let xe;t[73]===y?xe=t[74]:(xe=e=>y(e.target.value),t[73]=y,t[74]=xe);let Y;t[75]!==g||t[76]!==xe?(Y=(0,Q.jsx)(`input`,{className:be,value:g,onChange:xe,required:!0,autoComplete:`off`}),t[75]=g,t[76]=xe,t[77]=Y):Y=t[77];let Se;t[78]!==ye||t[79]!==Y?(Se=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ye,Y]}),t[78]=ye,t[79]=Y,t[80]=Se):Se=t[80];let Ce;t[81]===a.newModelOptional?Ce=t[82]:(Ce=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=Ce);let we;t[83]===x?we=t[84]:(we=e=>x(e),t[83]=x,t[84]=we);let Te;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==b||t[90]!==we?(Te=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:b,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:we}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=b,t[90]=we,t[91]=Te):Te=t[91];let Ee;t[92]!==a.modelClear||t[93]!==s||t[94]!==b||t[95]!==x?(Ee=b.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>x(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=b,t[95]=x,t[96]=Ee):Ee=t[96];let De;t[97]!==Te||t[98]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Te,Ee]}),t[97]=Te,t[98]=Ee,t[99]=De):De=t[99];let Oe;t[100]!==Ce||t[101]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Ce,De]}),t[100]=Ce,t[101]=De,t[102]=Oe):Oe=t[102];let Ae;t[103]!==a.createModalCancel||t[104]!==s?(Ae=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ae):Ae=t[105];let je;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Q.jsx)(j,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=je):je=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(w,{type:`submit`,disabled:s,children:[je,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Pe;t[110]!==Ae||t[111]!==Ne?(Pe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ae,Ne]}),t[110]=Ae,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]!==S||t[114]!==ie||t[115]!==G||t[116]!==fe||t[117]!==ve||t[118]!==Se||t[119]!==Oe||t[120]!==Pe||t[121]!==re?(Fe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:S,children:[re,ie,G,fe,ve,Se,Oe,Pe]}),t[113]=S,t[114]=ie,t[115]=G,t[116]=fe,t[117]=ve,t[118]=Se,t[119]=Oe,t[120]=Pe,t[121]=re,t[122]=Fe):Fe=t[122];let Ie;t[123]!==A||t[124]!==Fe||t[125]!==ne?(Ie=(0,Q.jsxs)(ce,{children:[P,(0,Q.jsx)(oe,{ref:M,className:F,onOpenAutoFocus:Jn,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:A,children:[ne,Fe]})})]}),t[123]=A,t[124]=Fe,t[125]=ne,t[126]=Ie):Ie=t[126];let Le;return t[127]!==r||t[128]!==n||t[129]!==Ie?(Le=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:Ie}),t[127]=r,t[128]=n,t[129]=Ie,t[130]=Le):Le=t[130],Le}function Jn(e){return e.preventDefault()}var Yn=`~/.xopc/workspace`;function Xn(e){let t=e.trim();return t?`${Yn}/${x(t)}`:``}function Zn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(tt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(w,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function $n(e){let{agentId:t,enabled:n,saveRef:r}=e,i=lt(async()=>{if(!t)return null;let[e,n]=await Promise.all([f(t,`IDENTITY.md`).catch(()=>``),f(t,`SOUL.md`).catch(()=>``)]),r=dt(e);return{identity:r,soulTemplate:W(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let p=c??(a?Qn(a):null),m=(0,$.useMemo)(()=>p?JSON.stringify(p.identity)!==p.identityBaseline||p.soulCustomContent!==p.soulBaseline:!1,[p]),h=(0,$.useRef)(t);h.current=t;let g=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Qn(a):null);return n?e(n):null})},[a]),_=(0,$.useCallback)(e=>{g(t=>({...t,identity:{...t.identity,...e}}))},[g]),v=(0,$.useCallback)(e=>{g(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=E.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[g]),y=(0,$.useCallback)(e=>{g(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[g]),b=(0,$.useCallback)(e=>{g(t=>({...t,avatarDialogOpen:e}))},[g]),x=(0,$.useCallback)(()=>{g(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[g]),S=(0,$.useCallback)(async()=>{let e=h.current;!e||!p||(await Promise.all([ye(e,`IDENTITY.md`,se(p.identity)),ye(e,`SOUL.md`,p.soulCustomContent)]),s.current=!1,l(e=>{let t=e??p;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[p]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:p,dirty:m,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:x}}var er={draft:``,editorNonce:0,loadedKey:``};function tr(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function nr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=lt(()=>n?Se(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,p]=(0,$.useState)(null),[m,h]=(0,$.useReducer)(tr,er),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,p(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);p(e?e.name:c.files[0].name)}},[c,d]);let x=m.draft,S=m.editorNonce,C=(0,$.useRef)(x);C.current=x;let w=(0,$.useRef)(n);w.current=n;let T=(0,$.useRef)(d);T.current=d;let E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=lt(()=>d&&n?f(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=Oe(async()=>{let e=w.current,t=T.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=C.current;if(n!==O.current){_(!0),o(null);try{await ye(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{_(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){h({type:`clear`});return}M||(D.current=F,O.current=j.data,h({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),p(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{h({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),N()},[N]),fileSaving:g,filesViewMode:v,setFilesViewMode:y,profileFileLoading:M,profileEditorNonce:S,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function rr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=lt(()=>xt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=lt(()=>St(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),M=(0,$.useRef)(S);M.current!==S&&(M.current=S,k(null));let N=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),P=(0,$.useCallback)(()=>{let e=y.trim();e&&St(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),F=!_&&g.length===0,I=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Ve(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:N,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:I,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=wt(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Ve(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:P,useManualChannel:F}}function ir(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(sr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=lt(or,s,d),m;n[10]===f?m=n[11]:(m=f.filter(ar),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function ar(e){return e.enabled!==!1}function or(){return Ge()}function sr(e){return e+1}function cr(e){return ir(e.panel===`skills`,e.hasToken)}function lr(e){return new Set(e.tools.entryDisable)}function ur(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function dr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(lr(n)),n&&t===`skills`){let e=ur(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Ot(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function fr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function pr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function mr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function hr(){let e=l(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!o(e=>e.token),[v,y]=je(),b=C(),{agentId:x}=te(),S=He(e=>e.setPageHeader),w=He(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,Le,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,Pt,{revalidateOnFocus:!1}),j=Te(_),{data:N}=j,P=(0,$.useMemo)(()=>me(N?.payload?.config??{}),[N]),F=T??null,ee=(0,$.useMemo)(()=>F?F.agents.find(e=>e.id===F.defaultId)??F.agents[0]??null:null,[F]),L=!!(_&&D),[R,z]=(0,$.useState)(null),ne=E instanceof Error?E.message:E?n.loadError:null,ie=R??ne,[B,V]=(0,$.useState)(null),[H,U]=(0,$.useState)(`overview`),[W,ae]=(0,$.useState)(``),[oe,G]=(0,$.useState)(``),[K,se]=(0,$.useState)(``),[ce,q]=(0,$.useState)(``),[de,J]=(0,$.useState)(``),[fe,pe]=(0,$.useState)(null),[he,_e]=(0,$.useState)(!1),ve=(0,$.useRef)(``),[ye,be]=(0,$.useState)(null),[xe,Y]=(0,$.useState)(!1),[Se,Ce]=(0,$.useState)(``),[we,Ee]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Ie]=(0,$.useState)(``),Re=(0,$.useRef)(null),[ze,Be]=(0,$.useState)(!1),Ve=(0,$.useRef)({data:null,routeAgentId:void 0});F&&(F!==Ve.current.data||x!==Ve.current.routeAgentId)&&(Ve.current={data:F,routeAgentId:x},x&&F.agents.some(e=>e.id===x)?V(x):V(e=>e&&F.agents.some(t=>t.id===e)?e:F.defaultId)),(0,$.useEffect)(()=>{!F||!x||F.agents.some(e=>e.id===x)||b(Fe,{replace:!0})},[F,x,b]),(0,$.useEffect)(()=>{x&&U(`overview`)},[x]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&b(x?Ue(x):Fe,{replace:!0,state:{[I]:x?Ue(x):Fe}})},[v,x,b]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!x||(U(`overview`),L||!F?.agents.some(e=>e.id===x)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),y(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,x,L,F,y]);let X=(0,$.useMemo)(()=>F?.agents.find(e=>e.id===B)??null,[F,B]),We=(0,$.useMemo)(()=>{let e=N?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[N]),Ge=(0,$.useMemo)(()=>!F||We&&F.agents.some(e=>e.id===We)?We:F.defaultId||F.agents[0]?.id||We,[F,We]),Ke=!!(F&&We&&!F.agents.some(e=>e.id===We));(0,$.useEffect)(()=>{Ee(Ke?``:We)},[We,Ke]);let qe=(0,$.useRef)(null),Ye=X?X.id:null;X&&qe.current!==Ye?(qe.current=Ye,Oe(X.workspace),Ae(X.model?.primary??``),Ne(ue(X,a(e).agentsSettings)),Ie(M(X,a(e).agentsSettings))):!X&&qe.current!==null&&(qe.current=null,Oe(``),Ae(``),Ne(``),Ie(``));let Xe=$n({agentId:X?.id??null,enabled:H===`behavior`&&!!X,saveRef:Re}),Ze=nr({panel:H,selectedId:B,hasToken:_,dataAgentsLength:F?.agents.length,saveErrorMessage:n.saveError,setError:z}),Qe=dr({panel:H,selected:X}),$e=rr({panel:H,hasToken:_,bindingsFromConfig:P,gatewayCfgLoading:N===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:z}),tt=cr({panel:H,hasToken:_}),rt=(0,$.useCallback)(()=>{let e=Xn(oe.trim()||W);q(t=>t===``||t===ve.current?(ve.current=e,e):t)},[oe,W]),it=(0,$.useCallback)(()=>{ve.current=``,ae(``),G(``),se(``),q(``),J(``),pe(null),be(null),_e(!0)},[]),at=(0,$.useCallback)(e=>{let t=new Set(F?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,F]),ot=(0,$.useCallback)(e=>{if(be(e),!e)return;let t=F?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=at(t.id),o=t.description??``;ve.current=``,ae(i),G(a),se(o),q(t.workspace),J(t.model?.primary??``),pe(null)},[n.duplicateName,F,at]),st=(0,$.useCallback)(e=>{ot(e),_e(!0)},[ot]),ct=(0,$.useMemo)(()=>(0,Q.jsx)(Zn,{a:n,busy:xe,listSearchQuery:Se,onListSearchQueryChange:Ce,onAddAgent:()=>it()}),[n,xe,Se,it]);(0,$.useLayoutEffect)(()=>_?(S({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:ct}),()=>w()):(w(),()=>w()),[n.title,ct,w,_,S]);async function lt(t){t.preventDefault();let r=W.trim();if(!r)return;let i=nt(oe,r);if(i.ok===!1){pe(i.error);return}let a=ce.trim()||Xn(oe.trim()||r);if(a){Y(!0),pe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${K.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{a as o,n as s,o as c}from"./fetch-BWXmBizE.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$r as p,$s as m,Ac as h,Ao as g,At as _,Ba as v,Bi as y,Bo as b,C as x,Cs as S,Dl as C,Eo as w,Fi as T,Ft as E,Ga as D,Ha as O,Hs as k,Ii as A,Io as j,Jn as M,Ka as N,Li as P,Lo as F,Mt as I,Ni as ee,Nt as L,Ol as te,Oo as R,Pi as z,Po as ne,Qn as re,Qo as ie,Qr as B,Qs as V,Rc as H,Ri as U,Rt as W,Ua as ae,Va as oe,Vi as G,Vo as K,Vt as se,Wa as ce,Xn as le,Yn as ue,Za as q,Zn as de,_a as J,_s as fe,ao as pe,ar as me,bo as he,ca as ge,cl as _e,co as ve,cr as ye,do as be,dr as xe,ei as Y,er as Se,es as Ce,fl as we,ga as Te,gl as Ee,ic as De,ii as Oe,io as ke,kc as Ae,kl as je,ko as Me,ks as Ne,lo as Pe,n as Fe,ni as Ie,nr as Le,ns as Re,ol as ze,oo as Be,or as Ve,qa as He,r as Ue,ri as X,ro as We,rr as Ge,si as Ke,so as qe,sr as Je,ti as Ye,to as Xe,tr as Ze,ul as Qe,uo as $e,ur as et,us as tt,w as nt,wl as rt,wo as it,xc as at,yc as ot,yl as st,yo as ct,za as lt,zi as ut,zt as dt}from"./index-DZOm5_ex.js";import{t as ft}from"./markdown-editor-jD1LPiP-.js";import{n as pt,t as mt}from"./settings-page-layout-CrICyGob.js";import{r as ht,t as gt}from"./settings-loading-skeleton-SYCPY-WM.js";import{n as _t,t as vt}from"./settings-form-section-By0YiDWo.js";import{t as yt}from"./page-tabs-CVLqCfQB.js";import{n as bt}from"./agent-avatar-dicebear-CER17NHM.js";import{n as xt,r as St,t as Ct}from"./channel-recipient-api-sV06LCht.js";import{n as wt,r as Tt,t as Et}from"./utils-BiUjIHb4.js";import{a as Dt,i as Ot,n as kt,o as At,t as jt}from"./typed-models-lib-CwFayhxu.js";import{a as Mt,o as Nt,r as Pt,s as Ft}from"./capability-presets-api-B7WWYaEh.js";import{t as It}from"./directory-picker-path-field-D1nxs9PA.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ae,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=o?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(O,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(y=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(b=(0,Q.jsx)(w,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=b):b=t[17];let x=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,S;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(S=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=S):S=t[22];let C=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==S||t[25]!==C||t[26]!==x?(T=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:C}),t[23]=u,t[24]=S,t[25]=C,t[26]=x,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==b?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[b,T]}),t[28]=T,t[29]=b,t[30]=E):E=t[30];let k;t[31]!==E||t[32]!==g||t[33]!==v||t[34]!==y?(k=(0,Q.jsxs)(ce,{children:[p,(0,Q.jsxs)(oe,{className:m,onOpenAutoFocus:Rt,children:[g,v,y,E]})]}),t[31]=E,t[32]=g,t[33]=v,t[34]=y,t[35]=k):k=t[35];let A;return t[36]!==r||t[37]!==n||t[38]!==k?(A=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:k}),t[36]=r,t[37]=n,t[38]=k,t[39]=A):A=t[39],A}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:ot},{id:`behavior`,labelKey:`navBehavior`,icon:Ce},{id:`tools`,labelKey:`navTools`,icon:g},{id:`skills`,labelKey:`navSkills`,icon:R},{id:`memory`,labelKey:`navMemory`,icon:_e},{id:`connections`,labelKey:`navConnections`,icon:ze},{id:`config`,labelKey:`navConfig`,icon:Re},{id:`dangerZone`,labelKey:`navDangerZone`,icon:b}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,he.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Vt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,g=p===void 0?!0:p,[_,y]=(0,$.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=b):b=t[0];let x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,pe,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=x):x=t[1];let S;t[2]===o?S=t[3]:(S=(0,Q.jsx)(N,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=S);let C;t[4]===s?C=t[5]:(C=(0,Q.jsx)(O,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=C);let T;t[6]!==S||t[7]!==C?(T=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[S,C]}),t[6]=S,t[7]=C,t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=E):E=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===a.closeDialogAria?A=t[12]:(A=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E,"aria-label":a.closeDialogAria,children:k})}),t[11]=a.closeDialogAria,t[12]=A);let j;t[13]!==T||t[14]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[T,A]}),t[13]=T,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==a||t[17]!==l||t[18]!==c?(M=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Bt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=M):M=t[19];let P;t[20]===h?P=t[21]:(P=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=P);let F;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(F=g?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(w,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=F):F=t[30];let I;t[31]!==P||t[32]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[P,F]}),t[31]=P,t[32]=F,t[33]=I):I=t[33];let ee;t[34]!==M||t[35]!==I?(ee=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,I]}),t[34]=M,t[35]=I,t[36]=ee):ee=t[36];let L;t[37]!==_||t[38]!==ee||t[39]!==j?(L=(0,Q.jsxs)(ce,{children:[b,(0,Q.jsx)(oe,{ref:y,className:x,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:_,children:[j,ee]})})]}),t[37]=_,t[38]=ee,t[39]=j,t[40]=L):L=t[40];let te;return t[41]!==r||t[42]!==n||t[43]!==L?(te=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:L}),t[41]=r,t[42]=n,t[43]=L,t[44]=te):te=t[44],te}function Ht(e){return e.preventDefault()}var Ut=e=>s(e);function Wt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Gt(e){let t=Wt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Kt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`article`,{className:`px-4 py-3`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{className:`h-3 w-16`}),(0,Q.jsx)(J,{className:`h-3 w-20`}),(0,Q.jsx)(J,{className:`h-3 w-24`})]}),(0,Q.jsx)(J,{className:`mt-3 h-4 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-5/6`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-2/3`})]}),e[0]=t):t=e[0],t}function qt({embedded:e=!1,agentId:t}){let n=a(l(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[o,u]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),[g,_]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:v,isLoading:y}=d(c(`/api/memory/providers`),Ut),{data:b,isLoading:x,mutate:S}=d(c(`/api/memory/records?status=active&limit=80`),Ut),{data:C,isLoading:T,mutate:E}=d(c(`/api/memory/records?status=candidate&limit=80`),Ut),{data:D,isLoading:O}=d(c(`/api/memory/signals?limit=50`),Ut),{data:k,isLoading:A,mutate:j}=d(c(`/api/memory/traces?limit=80`),Ut),{data:M,isLoading:N}=d(c(`/api/memory/feedback-summary?limit=1000`),Ut),{data:P,isLoading:F,mutate:I}=d(c(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:ee,isLoading:L}=d(o?c(`/api/memory/search`):null,e=>s(e,{method:`POST`,body:JSON.stringify({query:o,maxResults:20})})),te=ee?.results.map(e=>({...e.record,score:e.score}))??b?.records??[],R=v?.providers.length??0,z=b?.records.length??0,ne=C?.records.length??0,re=D?.signals.length??0,ie=k?.traces.length??0,B=M?.summaries??[],V=y||x||T||O||A||N||F,H=(0,$.useMemo)(()=>new Map(B.map(e=>[e.recordId,e])),[B]),U=B.reduce((e,t)=>e+t.total,0),W=B.reduce((e,t)=>e+t.helpful,0),ae=U>0?Math.round(W/U*100):null,oe=(0,$.useMemo)(()=>[{label:n.providers,value:R},{label:n.records,value:z},{label:n.inbox,value:ne},{label:n.signals,value:re},{label:n.traceEvents,value:ie},{label:n.recallQuality,value:ae==null?`—`:`${ae}%`}],[ne,ae,R,z,re,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ie]);(0,$.useEffect)(()=>{let e=P?.memory.providerRouting;e&&_({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[P]);async function G(){if(P){p(n.saving);try{await s(c(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:P.agentId,memory:{...P.memory,providerRouting:g}})}),await I(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function K(e){h(t=>({...t,[e]:n.testing}));try{let t=(await s(c(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),j()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function se(e,t){await s(c(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([E(),S()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:oe.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),V?(0,Q.jsx)(J,{className:`mt-2 h-7 w-16`}):(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.searchStrategy,onChange:e=>_(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.writeStrategy,onChange:e=>_(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowExternalWrites,onChange:e=>_(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(J,{className:`h-10 w-28 rounded-md`},t)):(v?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowedProviderIds?.includes(e.id)??!1,onChange:t=>_(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:G,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:ne})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[T?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(C?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:()=>se(e.id,`active`),children:n.approve}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),!T&&ne===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),u(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(w,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:o?`${n.searchResults}${L?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[L||x&&!o?Array.from({length:5}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):te.map(e=>{let t=H.get(e.id),r=Wt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Gt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),!x&&!L&&te.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(v?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>K(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[N?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):B.slice(0,8).map(e=>{let t=(b?.records??[]).find(t=>t.id===e.recordId),r=Wt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Gt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),!N&&B.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:O?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(D?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:A?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(k?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Jt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Yt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,h=d?r||l.unset:a,g=p?i||l.unset:o,_;t[5]!==l.subtitle||t[6]!==l.title?(_=(0,Q.jsx)(_t,{icon:m,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=_):_=t[7];let v=d?`inherit`:`override`,y;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(y=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=y):y=t[11];let b;t[12]!==h||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==v||t[18]!==y?(b=(0,Q.jsx)(Jt,{label:l.modelLabel,mode:v,value:h,inheritedFrom:y,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=h,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=v,t[18]=y,t[19]=b):b=t[19];let x=p?`inherit`:`override`,S;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(S=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=S):S=t[23];let C;t[24]!==g||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==x||t[30]!==S?(C=(0,Q.jsx)(Jt,{label:l.workspaceLabel,mode:x,value:g,inheritedFrom:S,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=g,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=x,t[30]=S,t[31]=C):C=t[31];let w;t[32]!==b||t[33]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[b,C]}),t[32]=b,t[33]=C,t[34]=w):w=t[34];let T;return t[35]!==_||t[36]!==w?(T=(0,Q.jsxs)(vt,{children:[_,w]}),t[35]=_,t[36]=w,t[37]=T):T=t[37],T}function Xt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Zt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function Qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Zt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function $t(e,t){return e&&e.length>0?e.join(`, `):t}function en(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>Ze(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(nn),i=Object.entries(u?.tools?.builtin??{}).sort(tn),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(_t,{icon:V,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(vt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Xt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.model,monoValue:!0,source:Xt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.mode,source:Xt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:a?.mode??`all`,source:Xt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Qt,{name:`allow`,value:$t(a.allow,`—`),source:Xt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Qt,{name:`deny`,value:$t(a.deny,`—`),source:Xt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:o?.mode??`off`,source:Xt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Qt,{name:`sources`,value:$t(o?.sources,`—`),source:Xt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`requiresConfirmation`,value:$t(d?.requiresConfirmation,`—`),source:Xt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`forbidden`,value:$t(d?.forbidden,`—`),source:Xt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`escalation`,value:$t(d?.escalation,`—`),source:Xt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function tn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function nn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function rn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function an(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function on(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(an,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(an,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(an,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(sn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(cn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(dn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function sn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(rn,{children:(0,Q.jsx)(Yt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function cn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(un)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(ln).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=rn,m=vt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let x;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[36]=x):x=t[36];let C;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(C=(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[x,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=C):C=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==C?(_=(0,Q.jsx)(_t,{icon:Ce,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:C}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=C,t[44]=_):_=t[44];let T;t[45]!==p.id||t[46]!==c?(T=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=T):T=t[47];let E=p.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===p.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=A);let j=p.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==T||t[60]!==k||t[61]!==A||t[62]!==M?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:T,children:[k,A,M]})}),t[59]=T,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(st,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(Xe,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(We,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let x;return t[69]!==g||t[70]!==b?(x=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=x):x=t[71],x}function ln(e){return e.id}function un(e){return[e.id,e]}function dn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(rn,{children:(0,Q.jsx)(en,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function fn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(rn,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(vt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(K,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var pn=i(it,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function mn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:h,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,T=!u&&(d||l.length>0),E;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(E=(0,Q.jsx)(_t,{className:`shrink-0`,icon:m,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=E):E=t[2];let D;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s?(D=a?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(hn)}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${Tt(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=D):D=t[9];let O;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==b||t[18]!==v||t[19]!==d?(O=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-24`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Et(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(Xe,{className:i(Et(),`py-2`),value:f,onChange:e=>{p(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(We,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=b,t[18]=v,t[19]=d,t[20]=O):O=t[20];let k;t[21]!==n.channelsCustomPeerHint||t[22]!==n.channelsCustomPeerPlaceholder||t[23]!==n.channelsNoSessionsHint||t[24]!==n.channelsPeerAny||t[25]!==n.channelsPeerFromSessions||t[26]!==n.channelsRefreshSessions||t[27]!==n.channelsRefreshSessionsHint||t[28]!==n.channelsSessionLabel||t[29]!==n.peerIdLabel||t[30]!==h||t[31]!==r||t[32]!==S||t[33]!==f||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==C||t[38]!==g||t[39]!==b||t[40]!==v||t[41]!==T?(k=T&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(fe,{className:i(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&h.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-32`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(Xe,{className:i(Et(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(We,{value:``,children:n.channelsPeerAny}),h.map((e,t)=>(0,Q.jsx)(We,{value:String(t),children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),h.length===0&&f.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Et(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Xe,{className:pn,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(We,{value:``,children:C}),h.map(e=>(0,Q.jsx)(We,{value:e.chatId,children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[21]=n.channelsCustomPeerHint,t[22]=n.channelsCustomPeerPlaceholder,t[23]=n.channelsNoSessionsHint,t[24]=n.channelsPeerAny,t[25]=n.channelsPeerFromSessions,t[26]=n.channelsRefreshSessions,t[27]=n.channelsRefreshSessionsHint,t[28]=n.channelsSessionLabel,t[29]=n.peerIdLabel,t[30]=h,t[31]=r,t[32]=S,t[33]=f,t[34]=y,t[35]=_,t[36]=x,t[37]=C,t[38]=g,t[39]=b,t[40]=v,t[41]=T,t[42]=k):k=t[42];let A;t[43]!==r||t[44]!==u||t[45]!==f?(A=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=A):A=t[46];let j;t[47]!==n.addBinding||t[48]!==A?(j=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(w,{type:`submit`,disabled:A,children:n.addBinding})}),t[47]=n.addBinding,t[48]=A,t[49]=j):j=t[49];let M;t[50]!==c||t[51]!==O||t[52]!==k||t[53]!==j?(M=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[O,k,j]}),t[50]=c,t[51]=O,t[52]=k,t[53]=j,t[54]=M):M=t[54];let N;return t[55]!==E||t[56]!==D||t[57]!==M?(N=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[E,D,M]}),t[55]=E,t[56]=D,t[57]=M,t[58]=N):N=t[58],N}function hn(e,t){return(0,Q.jsx)(J,{className:`h-10 rounded-lg`},t)}function gn(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:s,filesViewMode:c,setFilesViewMode:l,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=u(_n),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let y=v,b;t[3]===n.filesHint?b=t[4]:(b=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=b);let x;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==y||t[18]!==a||t[19]!==r||t[20]!==c||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==s||t[26]!==f||t[27]!==l?(x=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:y,activeTab:o??``,onChange:s,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(Ae,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(k,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),c===`edit`?(0,Q.jsx)(`div`,{className:i(Et(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Et(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(Ke,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=y,t[18]=a,t[19]=r,t[20]=c,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=s,t[26]=f,t[27]=l,t[28]=x):x=t[28];let S;return t[29]!==b||t[30]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function _n(e){return e.resolved===`dark`}function vn(e){let t=(0,Z.c)(68),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:De,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames||t[39]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=y):y=t[41];let b;t[42]!==a||t[43]!==r||t[44]!==o||t[45]!==i.typedModels.defaultRole||t[46]!==s||t[47]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ft,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[42]=a,t[43]=r,t[44]=o,t[45]=i.typedModels.defaultRole,t[46]=s,t[47]=y,t[48]=b):b=t[48];let x;t[49]!==n.modelsSave||t[50]!==a||t[51]!==u||t[52]!==c?(x=u?null:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=u,t[52]=c,t[53]=x):x=t[53];let S;t[54]===l?S=t[55]:(S=()=>void l(),t[54]=l,t[55]=S);let C;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==S?(C=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=S,t[59]=C):C=t[59];let T;t[60]!==x||t[61]!==C?(T=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[60]=x,t[61]=C,t[62]=T):T=t[62];let E;return t[63]!==d||t[64]!==T||t[65]!==v||t[66]!==b?(E=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,T]}),t[63]=d,t[64]=T,t[65]=v,t[66]=b,t[67]=E):E=t[67],E}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=y(n.trim());return e&&ut(e.styleId)?e.styleId:A[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await de(t)}catch{}r(U(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await xe(t,n),G(t),r(P)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),_=(e,t)=>{let r=y(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:A.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,T[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,he.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)($e,{open:f,onOpenChange:p,children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,he.press),children:a.avatarMore})}),(0,Q.jsx)(Pe,{children:(0,Q.jsxs)(ve,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(ee,{agentId:t,avatar:n,size:40}),n.trim()&&!y(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function xn(e){let t=(0,Z.c)(206),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:T,profileMarkdownLoading:A,profileDraft:j,updateIdentity:M,handleSoulTemplateChange:P,handleSoulContentChange:F,setAvatarDialogOpen:I,toggleSoulPreviewMode:te,onTryInChat:R}=e,z=l(wn),re=u(Cn),ie;t[0]===j?.identity?ie=t[1]:(ie=j?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=j?.identity,t[1]=ie);let B=ie,V=j?.soulTemplate??`professional`,U=j?.soulCustomContent??``,W=j?.soulEditorNonce??0,G=j?.soulPreviewMode??!1,K=j?.avatarDialogOpen??!1,se;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(se=Et(),t[2]=se):se=t[2];let le=se,ue;t[3]===z?ue=t[4]:(ue=(e,t)=>z===`zh`?t:e,t[3]=z,t[4]=ue);let q=ue;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let de;t[7]!==B.avatar||t[8]!==a.id?(de=(0,Q.jsx)(ee,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=de):de=t[9];let J;t[10]===I?J=t[11]:(J=()=>I(!0),t[10]=I,t[11]=J);let fe;t[12]!==n.avatarOpenSettingsAria||t[13]!==J?(fe={onClick:J,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=J,t[14]=fe):fe=t[14];let me;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(me=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=me):me=t[21];let ge;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==o||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(ge=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=o,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=ge):ge=t[29];let _e;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==de||t[33]!==fe||t[34]!==me||t[35]!==ge?(_e=(0,Q.jsx)(_t,{icon:Ce,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:de,iconInteractive:fe,titleAccessory:me,trailing:ge}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=de,t[33]=fe,t[34]=me,t[35]=ge,t[36]=_e):_e=t[36];let ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(ae,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,Be)}),t[37]=ve):ve=t[37];let ye;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ye=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,pe),t[38]=ye):ye=t[38];let be;t[39]===n.avatarPickerTitle?be=t[40]:(be=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=xe):xe=t[41];let Y;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[42]=Y):Y=t[42];let Se;t[43]===n.closeDialogAria?Se=t[44]:(Se=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:xe,"aria-label":n.closeDialogAria,children:Y})}),t[43]=n.closeDialogAria,t[44]=Se);let we;t[45]!==be||t[46]!==Se?(we=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[be,Se]}),t[45]=be,t[46]=Se,t[47]=we):we=t[47];let Te;t[48]===n.avatarRowHint?Te=t[49]:(Te=(0,Q.jsx)(O,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Te);let Ee;t[50]===M?Ee=t[51]:(Ee=e=>M({avatar:e}),t[50]=M,t[51]=Ee);let De;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Ee?(De=(0,Q.jsx)(bn,{agentId:a.id,value:B.avatar,onChange:Ee,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Ee,t[56]=De):De=t[56];let Oe;t[57]!==we||t[58]!==Te||t[59]!==De?(Oe=(0,Q.jsxs)(ce,{children:[ve,(0,Q.jsxs)(oe,{className:ye,onOpenAutoFocus:Sn,children:[we,Te,De]})]}),t[57]=we,t[58]=Te,t[59]=De,t[60]=Oe):Oe=t[60];let ke;t[61]!==K||t[62]!==I||t[63]!==Oe?(ke=(0,Q.jsx)(D,{open:K,onOpenChange:I,children:Oe}),t[61]=K,t[62]=I,t[63]=Oe,t[64]=ke):ke=t[64];let je;t[65]===n.displayName?je=t[66]:(je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=je);let Pe;t[67]!==c||t[68]!==M?(Pe=e=>{c(e.target.value),M({name:e.target.value})},t[67]=c,t[68]=M,t[69]=Pe):Pe=t[69];let Fe;t[70]!==n.personaNamePlaceholder||t[71]!==s||t[72]!==Pe?(Fe=(0,Q.jsx)(`input`,{className:le,value:s,onChange:Pe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=s,t[72]=Pe,t[73]=Fe):Fe=t[73];let Ie;t[74]!==je||t[75]!==Fe?(Ie=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[je,Fe]}),t[74]=je,t[75]=Fe,t[76]=Ie):Ie=t[76];let Le;t[77]===n.personaEmoji?Le=t[78]:(Le=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Le);let Re;t[79]===M?Re=t[80]:(Re=e=>M({emoji:e.target.value}),t[79]=M,t[80]=Re);let ze;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Re?(ze=(0,Q.jsx)(`input`,{className:le,value:B.emoji,onChange:Re,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Re,t[84]=ze):ze=t[84];let Ve;t[85]!==Le||t[86]!==ze?(Ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Le,ze]}),t[85]=Le,t[86]=ze,t[87]=Ve):Ve=t[87];let He;t[88]===n.agentDescription?He=t[89]:(He=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=He);let Ue;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=i(le,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Ue):Ue=t[90];let X;t[91]!==f||t[92]!==M?(X=e=>{f(e.target.value),M({description:e.target.value})},t[91]=f,t[92]=M,t[93]=X):X=t[93];let Ge;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==X?(Ge=(0,Q.jsx)(`textarea`,{className:Ue,value:d,onChange:X,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=X,t[97]=Ge):Ge=t[97];let qe;t[98]!==He||t[99]!==Ge?(qe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[He,Ge]}),t[98]=He,t[99]=Ge,t[100]=qe):qe=t[100];let Je;t[101]===n.personaCreature?Je=t[102]:(Je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Je);let Ye;t[103]===B.creature?Ye=t[104]:(Ye=L.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=Ye);let Ze;t[105]===M?Ze=t[106]:(Ze=e=>{if(e.target.value===`__custom__`){M({creature:``});return}M({creature:e.target.value})},t[105]=M,t[106]=Ze);let Qe;t[107]===q?Qe=t[108]:(Qe=L.map(e=>(0,Q.jsx)(We,{value:e.value,children:q(e.labelEn,e.labelZh)},e.value)),t[107]=q,t[108]=Qe);let $e;t[109]===q?$e=t[110]:($e=q(`Custom…`,`自定义…`),t[109]=q,t[110]=$e);let et;t[111]===$e?et=t[112]:(et=(0,Q.jsx)(We,{value:`__custom__`,children:$e}),t[111]=$e,t[112]=et);let tt;t[113]!==Ye||t[114]!==Ze||t[115]!==Qe||t[116]!==et?(tt=(0,Q.jsxs)(Xe,{className:le,value:Ye,onChange:Ze,children:[Qe,et]}),t[113]=Ye,t[114]=Ze,t[115]=Qe,t[116]=et,t[117]=tt):tt=t[117];let nt;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==M?(nt=L.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(le,`mt-1 text-xs`),value:B.creature,onChange:e=>M({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=M,t[121]=nt):nt=t[121];let rt;t[122]!==Je||t[123]!==tt||t[124]!==nt?(rt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Je,tt,nt]}),t[122]=Je,t[123]=tt,t[124]=nt,t[125]=rt):rt=t[125];let it;t[126]!==Ie||t[127]!==Ve||t[128]!==qe||t[129]!==rt?(it=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Ie,Ve,qe,rt]}),t[126]=Ie,t[127]=Ve,t[128]=qe,t[129]=rt,t[130]=it):it=t[130];let at;t[131]!==ke||t[132]!==it||t[133]!==_e?(at=(0,Q.jsxs)(vt,{children:[_e,ke,it]}),t[131]=ke,t[132]=it,t[133]=_e,t[134]=at):at=t[134];let ot;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(ot=(0,Q.jsx)(_t,{icon:H,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=ot):ot=t[137];let st;t[138]===n.modelPrimary?st=t[139]:(st=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=st);let lt;t[140]===g?lt=t[141]:(lt=e=>g(e),t[140]=g,t[141]=lt);let ut;t[142]!==o||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==h||t[147]!==lt?(ut=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:h,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:lt}),t[142]=o,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=h,t[147]=lt,t[148]=ut):ut=t[148];let dt;t[149]!==n.modelClear||t[150]!==o||t[151]!==h||t[152]!==g?(dt=h.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>g(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=o,t[151]=h,t[152]=g,t[153]=dt):dt=t[153];let pt;t[154]!==ut||t[155]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,dt]}),t[154]=ut,t[155]=dt,t[156]=pt):pt=t[156];let mt;t[157]!==st||t[158]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[st,pt]}),t[157]=st,t[158]=pt,t[159]=mt):mt=t[159];let gt;t[160]===n.workspacePath?gt=t[161]:(gt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=gt);let yt=r.workingDirectory,bt=r.workingDirectory.notSet,xt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(xt=i(le,`font-mono text-xs`),t[162]=xt):xt=t[162];let St;t[163]!==o||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==m?(St=(0,Q.jsx)(It,{value:p,onChange:m,disabled:o,wd:yt,placeholder:bt,inputClassName:xt}),t[163]=o,t[164]=r.workingDirectory,t[165]=p,t[166]=m,t[167]=St):St=t[167];let Ct;t[168]!==gt||t[169]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[gt,St]}),t[168]=gt,t[169]=St,t[170]=Ct):Ct=t[170];let wt;t[171]!==mt||t[172]!==Ct?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[mt,Ct]}),t[171]=mt,t[172]=Ct,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==o||t[177]!==T||t[178]!==C||t[179]!==R?(Tt=T?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void C(),children:n.save}),R?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:R,children:[(0,Q.jsx)(k,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=o,t[177]=T,t[178]=C,t[179]=R,t[180]=Tt):Tt=t[180];let Dt;t[181]!==ot||t[182]!==wt||t[183]!==Tt?(Dt=(0,Q.jsxs)(vt,{children:[ot,wt,Tt]}),t[181]=ot,t[182]=wt,t[183]=Tt,t[184]=Dt):Dt=t[184];let Ot;t[185]!==n.personaSectionSoul||t[186]!==n.personaSectionSoulHint||t[187]!==n.personaSoulCustomEdit||t[188]!==n.personaSoulEdit||t[189]!==n.personaSoulPreview||t[190]!==n.personaSoulTemplate||t[191]!==F||t[192]!==P||t[193]!==re||t[194]!==q||t[195]!==A||t[196]!==U||t[197]!==W||t[198]!==G||t[199]!==V||t[200]!==te?(Ot=A?(0,Q.jsx)(ht,{rows:2}):(0,Q.jsxs)(vt,{children:[(0,Q.jsx)(_t,{icon:ne,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:E.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,he.pressCard,V===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>P(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:q(e.labelEn,e.labelZh)})]},e.id))})]}),V===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(ct,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:G?n.personaSoulEdit:n.personaSoulPreview,"aria-label":G?n.personaSoulEdit:n.personaSoulPreview,onClick:te,children:G?(0,Q.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(le,`flex min-h-64 flex-col overflow-hidden p-0`),children:G?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(Ke,{content:U})}):(0,Q.jsx)(ft,{initialContent:U,onChange:F,isDark:re,className:`min-h-0 flex-1`},`soul-${W}`)})]}):null]}),t[185]=n.personaSectionSoul,t[186]=n.personaSectionSoulHint,t[187]=n.personaSoulCustomEdit,t[188]=n.personaSoulEdit,t[189]=n.personaSoulPreview,t[190]=n.personaSoulTemplate,t[191]=F,t[192]=P,t[193]=re,t[194]=q,t[195]=A,t[196]=U,t[197]=W,t[198]=G,t[199]=V,t[200]=te,t[201]=Ot):Ot=t[201];let kt;return t[202]!==at||t[203]!==Dt||t[204]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[at,Dt,Ot]}),t[202]=at,t[203]=Dt,t[204]=Ot,t[205]=kt):kt=t[205],kt}function Sn(e){return e.preventDefault()}function Cn(e){return e.resolved===`dark`}function wn(e){return e.language}function Tn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function En(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Dn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=ue(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=M(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,T=r.skills.effectiveAllowlist?.length,E;t[14]!==r.avatar||t[15]!==r.id?(E=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(ee,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=E):E=t[16];let D;t[17]===p?D=t[18]:(D=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=D);let O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let A;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(A=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=A):A=t[26];let j;t[27]!==D||t[28]!==O||t[29]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[D,O,A]}),t[27]=D,t[28]=O,t[29]=A,t[30]=j):j=t[30];let N;t[31]===r.id?N=t[32]:(N=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=N);let P;t[33]!==N||t[34]!==j?(P=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[j,N]}),t[33]=N,t[34]=j,t[35]=P):P=t[35];let F;t[36]!==P||t[37]!==E?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[E,P]}),t[36]=P,t[37]=E,t[38]=F):F=t[38];let I;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(I=d?(0,Q.jsxs)(w,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(k,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=I):I=t[42];let L;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(L=r.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=L):L=t[47];let te;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(te=o?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=te):te=t[52];let R;t[53]!==I||t[54]!==L||t[55]!==te?(R=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[I,L,te]}),t[53]=I,t[54]=L,t[55]=te,t[56]=R):R=t[56];let z;t[57]!==F||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[F,R]}),t[57]=F,t[58]=R,t[59]=z):z=t[59];let ne;t[60]===h?ne=t[61]:(ne=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=ne);let re;t[62]!==z||t[63]!==ne?(re=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[z,ne]})}),t[62]=z,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ie=(0,Q.jsx)(_t,{icon:Ce,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ie):ie=t[67];let B;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(B=(0,Q.jsx)(Tn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=B):B=t[71];let V;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(V=(0,Q.jsx)(Tn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=V):V=t[75];let H;t[76]!==B||t[77]!==V?(H=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,V]}),t[76]=B,t[77]=V,t[78]=H):H=t[78];let U;t[79]!==ie||t[80]!==H?(U=(0,Q.jsxs)(vt,{children:[ie,H]}),t[79]=ie,t[80]=H,t[81]=U):U=t[81];let W;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(W=(0,Q.jsx)(_t,{icon:Qe,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=W):W=t[84];let ae;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(ae=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=ae):ae=t[88];let oe;t[89]!==n.listToolsLabel||t[90]!==ae?(oe=(0,Q.jsx)(En,{icon:g,label:n.listToolsLabel,value:ae}),t[89]=n.listToolsLabel,t[90]=ae,t[91]=oe):oe=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==T?(G=T?n.listSkillsCount.replace(`{{count}}`,String(T)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=T,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(En,{icon:Ce,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let se;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(se=(0,Q.jsx)(En,{icon:_e,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=se):se=t[101];let ce;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(ce=(0,Q.jsx)(En,{icon:ze,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=ce):ce=t[104];let le;t[105]!==n.listWorkspaceLabel||t[106]!==b?(le=(0,Q.jsx)(En,{icon:at,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=le):le=t[107];let q;t[108]!==oe||t[109]!==K||t[110]!==se||t[111]!==ce||t[112]!==le?(q=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[oe,K,se,ce,le]}),t[108]=oe,t[109]=K,t[110]=se,t[111]=ce,t[112]=le,t[113]=q):q=t[113];let de;t[114]!==W||t[115]!==q?(de=(0,Q.jsxs)(vt,{children:[W,q]}),t[114]=W,t[115]=q,t[116]=de):de=t[116];let J;return t[117]!==re||t[118]!==U||t[119]!==de?(J=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[re,U,de]}),t[117]=re,t[118]=U,t[119]=de,t[120]=J):J=t[120],J}function On(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(kn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(_t,{className:`shrink-0`,icon:we,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=q(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(rt,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==C||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,E]}),t[28]=C,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==a||t[46]!==s||t[47]!==h||t[48]!==d||t[49]!==o||t[50]!==c||t[51]!==u?(M=o?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(gt,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=a,t[46]=s,t[47]=h,t[48]=d,t[49]=o,t[50]=c,t[51]=u,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==a||t[55]!==p||t[56]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=a,t[55]=p,t[56]=f,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==v?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=v,t[64]=P):P=t[64],P}function kn(e){return e.name||e.directoryId}var An=[`write_file`,`apply_patch`,`exec_command`],jn=[`exec_command`,`image_generate`,`extensions`],Mn=[`send_message`,`send_media`];function Nn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let T=C,E;t[14]===s?E=t[15]:(E=()=>{s(new Set)},t[14]=s,t[15]=E);let D=E,O;t[16]!==r||t[17]!==s||t[18]!==h?(O=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=O):O=t[19];let k=O,A;t[20]===r?A=t[21]:(A=Nt(r),t[20]=r,t[21]=A);let j=A,M;if(t[22]!==v||t[23]!==j||t[24]!==n||t[25]!==h){if(M=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(Fn),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),M.push(n)}for(let e of Mt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&M.push({key:e.key,ids:[...t]})}if(j.length>0){let e;t[31]===j?e=t[32]:(e={key:`misc`,ids:j},t[31]=j,t[32]=e),M.push(e)}t[22]=v,t[23]=j,t[24]=n,t[25]=h,t[26]=M}else M=t[26];let N=M,P=N.some(Pn),F=g||a,I;t[33]===f.quickActionsLabel?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=I);let ee=F||r.length===0&&h.length===0,L;t[35]!==D||t[36]!==f.quickEnableAll||t[37]!==ee?(L=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ee,onClick:D,children:f.quickEnableAll}),t[35]=D,t[36]=f.quickEnableAll,t[37]=ee,t[38]=L):L=t[38];let te=F||r.length===0&&h.length===0,R;t[39]!==k||t[40]!==f.quickDisableAll||t[41]!==te?(R=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:te,onClick:k,children:f.quickDisableAll}),t[39]=k,t[40]=f.quickDisableAll,t[41]=te,t[42]=R):R=t[42];let z=F||r.length===0,ne;t[43]===T?ne=t[44]:(ne=()=>T(An),t[43]=T,t[44]=ne);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==z||t[47]!==ne?(re=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:z,onClick:ne,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=z,t[47]=ne,t[48]=re):re=t[48];let ie=F||r.length===0,B;t[49]===T?B=t[50]:(B=()=>T(jn),t[49]=T,t[50]=B);let V;t[51]!==f.quickHighRiskOff||t[52]!==ie||t[53]!==B?(V=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ie,onClick:B,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ie,t[53]=B,t[54]=V):V=t[54];let H=F||r.length===0,U;t[55]===T?U=t[56]:(U=()=>T(Mn),t[55]=T,t[56]=U);let W;t[57]!==f.quickNoOutbound||t[58]!==H||t[59]!==U?(W=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:H,onClick:U,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=H,t[59]=U,t[60]=W):W=t[60];let ae;t[61]!==L||t[62]!==R||t[63]!==re||t[64]!==V||t[65]!==W?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,re,V,W]}),t[61]=L,t[62]=R,t[63]=re,t[64]=V,t[65]=W,t[66]=ae):ae=t[66];let oe;t[67]!==I||t[68]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[I,ae]}),t[67]=I,t[68]=ae,t[69]=oe):oe=t[69];let G;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==N||t[75]!==P||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==a||t[80]!==n||t[81]!==F||t[82]!==S?(G=a?(0,Q.jsx)(gt,{rows:4}):P?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:N.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||F,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=N,t[75]=P,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=a,t[80]=n,t[81]=F,t[82]=S,t[83]=G):G=t[83];let K;return t[84]!==oe||t[85]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[oe,G]}),t[84]=oe,t[85]=G,t[86]=K):K=t[86],K}function Pn(e){return e.ids.length>0}function Fn(e,t){return e.localeCompare(t)}function In(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:o,toolEntryDisable:s,setToolEntryDisable:c,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=l(Rn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,_;t[2]===i.tools.presetDenied?_=t[3]:(_=new Set(i.tools.presetDenied.flatMap(Ln)),t[2]=i.tools.presetDenied,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=e=>{c(e)},t[4]=c,t[5]=y);let b=y,x=n.toolsDisableGroups,S;t[6]===x?S=t[7]:(S=e=>x[e],t[6]=x,t[7]=S);let C=S,T;t[8]===n.toolDescriptions?T=t[9]:(T=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=T);let E=T,D;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(D=(0,Q.jsx)(_t,{className:`shrink-0`,icon:g,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=D):D=t[12];let O;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(O={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=O):O=t[23];let k;t[24]!==o||t[25]!==r.builtinToolIds||t[26]!==C||t[27]!==E||t[28]!==b||t[29]!==v||t[30]!==O||t[31]!==s?(k=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Nn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:s,onDisableSetChange:b,defaultsDisableSet:v,getToolDescription:E,getGroupTitle:C,quickActionsDisabled:o,labels:O})}),t[24]=o,t[25]=r.builtinToolIds,t[26]=C,t[27]=E,t[28]=b,t[29]=v,t[30]=O,t[31]=s,t[32]=k):k=t[32];let A;t[33]!==n.toolsSave||t[34]!==o||t[35]!==f||t[36]!==u?(A=f?null:(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=o,t[35]=f,t[36]=u,t[37]=A):A=t[37];let j;t[38]===d?j=t[39]:(j=()=>void d(),t[38]=d,t[39]=j);let M;t[40]!==n.toolsClearEntry||t[41]!==o||t[42]!==j?(M=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:j,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=o,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==M||t[45]!==A?(N=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[A,M]}),t[44]=M,t[45]=A,t[46]=N):N=t[46];let P;return t[47]!==N||t[48]!==D||t[49]!==k?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[D,k,N]}),t[47]=N,t[48]=D,t[49]=k,t[50]=P):P=t[50],P}function Ln(e){let t=String(e).trim();return t?[t]:[]}function Rn(e){return e.language}function zn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce,bindingsLoading:le,agentBindings:ue,bindChannelStatuses:q,bindChannelsLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Y,onTryInChat:Se}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Se||t[11]!==a?(e=(0,Q.jsx)(Dn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Se}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Se,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Se||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(xn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Se}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Se,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==U||t[44]!==H||t[45]!==a||t[46]!==V?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(vn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=U,t[44]=H,t[45]=a,t[46]=V,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==L||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Se||t[56]!==R||t[57]!==te||t[58]!==N||t[59]!==ee||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(gn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,onTryInChat:Se})}),t[48]=n,t[49]=M,t[50]=I,t[51]=L,t[52]=j,t[53]=A,t[54]=P,t[55]=Se,t[56]=R,t[57]=te,t[58]=N,t[59]=ee,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==ie||t[70]!==re||t[71]!==a||t[72]!==ne||t[73]!==z?(e=(0,Q.jsx)(In,{a:n,data:s,selected:a,busy:c,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie}),t[66]=n,t[67]=c,t[68]=s,t[69]=ie,t[70]=re,t[71]=a,t[72]=ne,t[73]=z,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==ae||t[78]!==ce||t[79]!==a||t[80]!==G||t[81]!==se||t[82]!==W||t[83]!==oe||t[84]!==K?(e=(0,Q.jsx)(On,{a:n,selected:a,busy:c,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce}),t[75]=n,t[76]=c,t[77]=ae,t[78]=ce,t[79]=a,t[80]=G,t[81]=se,t[82]=W,t[83]=oe,t[84]=K,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(qt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==q||t[91]!==de||t[92]!==me||t[93]!==he||t[94]!==le||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==fe||t[99]!==ve||t[100]!==ge||t[101]!==Y||t[102]!==xe||t[103]!==be||t[104]!==pe||t[105]!==ye||t[106]!==_e||t[107]!==J?(e=(0,Q.jsx)(mn,{a:n,busy:c,bindingsLoading:le,agentBindings:ue,channelStatuses:q,channelsStatusLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Y}),t[88]=n,t[89]=ue,t[90]=q,t[91]=de,t[92]=me,t[93]=he,t[94]=le,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=fe,t[99]=ve,t[100]=ge,t[101]=Y,t[102]=xe,t[103]=be,t[104]=pe,t[105]=ye,t[106]=_e,t[107]=J,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(on,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let Ce;return t[126]===n.selectAgentHint?Ce=t[127]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Ce),Ce}function Bn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=ue(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=M(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Vn(e,t){return e.replace(`{{count}}`,String(t))}function Hn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Un(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Wn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,qe),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(B,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Y,{children:(0,Q.jsxs)(p,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Ye,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(Ie,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Gn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Bn(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=ue(e,n),r=e.id,c=M(e,n),f=Hn(e,n),p=Un(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,he.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(ee,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Kn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(k,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function Kn(e){return(0,Q.jsx)(Wn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function qn(e){let t=(0,Z.c)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:h,createWorkspace:g,setCreateWorkspace:y,createModel:b,setCreateModel:x,onCreate:S,onSuggestWorkspace:C,agents:T,duplicateSourceId:E,onSelectDuplicateSource:k}=e,[A,M]=(0,$.useState)(null),P;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=P):P=t[0];let F;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(F=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,pe,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=F):F=t[1];let I;t[2]===a.addAgent?I=t[3]:(I=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=I);let ee;t[4]===a.addAgentHint?ee=t[5]:(ee=(0,Q.jsx)(O,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=ee);let L;t[6]!==I||t[7]!==ee?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[I,ee]}),t[6]=I,t[7]=ee,t[8]=L):L=t[8];let te;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(te=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=te):te=t[9];let R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=R):R=t[10];let z;t[11]===a.closeDialogAria?z=t[12]:(z=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":a.closeDialogAria,children:R})}),t[11]=a.closeDialogAria,t[12]=z);let ne;t[13]!==L||t[14]!==z?(ne=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[L,z]}),t[13]=L,t[14]=z,t[15]=ne):ne=t[15];let re;t[16]!==a||t[17]!==T||t[18]!==E||t[19]!==k?(re=T.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(Xe,{className:i(Et(),`bg-surface-panel`),value:E??``,onChange:e=>k(e.target.value||null),children:[(0,Q.jsx)(We,{value:``,children:a.copyFromExistingAgentNone}),T.map(e=>(0,Q.jsxs)(We,{value:e.id,children:[ue(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=T,t[18]=E,t[19]=k,t[20]=re):re=t[20];let ie;t[21]===c?ie=t[22]:(ie=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ie);let B;t[23]!==a.newAgentLabel||t[24]!==l?(B=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=B):B=t[25];let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=Et(),t[26]=V):V=t[26];let H;t[27]===d?H=t[28]:(H=e=>d(e.target.value),t[27]=d,t[28]=H);let U;t[29]===C?U=t[30]:(U=()=>C(),t[29]=C,t[30]=U);let W;t[31]!==u||t[32]!==H||t[33]!==U?(W=(0,Q.jsx)(`input`,{className:V,value:u,onChange:H,onBlur:U,required:!0,autoComplete:`off`}),t[31]=u,t[32]=H,t[33]=U,t[34]=W):W=t[34];let G;t[35]!==B||t[36]!==W?(G=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[B,W]}),t[35]=B,t[36]=W,t[37]=G):G=t[37];let K;t[38]===a.newAgentIdOptional?K=t[39]:(K=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=K);let se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se=i(Et(),`font-mono text-xs`),t[40]=se):se=t[40];let le;t[41]===p?le=t[42]:(le=e=>p(e.target.value),t[41]=p,t[42]=le);let q;t[43]===C?q=t[44]:(q=()=>C(),t[43]=C,t[44]=q);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==le||t[49]!==q?(de=(0,Q.jsx)(`input`,{className:se,value:f,onChange:le,onBlur:q,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=le,t[49]=q,t[50]=de):de=t[50];let J;t[51]===a.newAgentIdRules?J=t[52]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=J);let fe;t[53]!==K||t[54]!==de||t[55]!==J?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[K,de,J]}),t[53]=K,t[54]=de,t[55]=J,t[56]=fe):fe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let he;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Et(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=he):he=t[60];let ge;t[61]===h?ge=t[62]:(ge=e=>h(e.target.value),t[61]=h,t[62]=ge);let _e;t[63]!==a.agentDescriptionPlaceholder||t[64]!==m||t[65]!==ge?(_e=(0,Q.jsx)(`textarea`,{className:he,value:m,onChange:ge,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=m,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==me||t[68]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[67]=me,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]===a.newWorkspace?ye=t[71]:(ye=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=ye);let be;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(be=i(Et(),`font-mono text-xs`),t[72]=be):be=t[72];let xe;t[73]===y?xe=t[74]:(xe=e=>y(e.target.value),t[73]=y,t[74]=xe);let Y;t[75]!==g||t[76]!==xe?(Y=(0,Q.jsx)(`input`,{className:be,value:g,onChange:xe,required:!0,autoComplete:`off`}),t[75]=g,t[76]=xe,t[77]=Y):Y=t[77];let Se;t[78]!==ye||t[79]!==Y?(Se=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ye,Y]}),t[78]=ye,t[79]=Y,t[80]=Se):Se=t[80];let Ce;t[81]===a.newModelOptional?Ce=t[82]:(Ce=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=Ce);let we;t[83]===x?we=t[84]:(we=e=>x(e),t[83]=x,t[84]=we);let Te;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==b||t[90]!==we?(Te=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:b,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:we}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=b,t[90]=we,t[91]=Te):Te=t[91];let Ee;t[92]!==a.modelClear||t[93]!==s||t[94]!==b||t[95]!==x?(Ee=b.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>x(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=b,t[95]=x,t[96]=Ee):Ee=t[96];let De;t[97]!==Te||t[98]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Te,Ee]}),t[97]=Te,t[98]=Ee,t[99]=De):De=t[99];let Oe;t[100]!==Ce||t[101]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Ce,De]}),t[100]=Ce,t[101]=De,t[102]=Oe):Oe=t[102];let Ae;t[103]!==a.createModalCancel||t[104]!==s?(Ae=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ae):Ae=t[105];let je;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Q.jsx)(j,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=je):je=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(w,{type:`submit`,disabled:s,children:[je,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Pe;t[110]!==Ae||t[111]!==Ne?(Pe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ae,Ne]}),t[110]=Ae,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]!==S||t[114]!==ie||t[115]!==G||t[116]!==fe||t[117]!==ve||t[118]!==Se||t[119]!==Oe||t[120]!==Pe||t[121]!==re?(Fe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:S,children:[re,ie,G,fe,ve,Se,Oe,Pe]}),t[113]=S,t[114]=ie,t[115]=G,t[116]=fe,t[117]=ve,t[118]=Se,t[119]=Oe,t[120]=Pe,t[121]=re,t[122]=Fe):Fe=t[122];let Ie;t[123]!==A||t[124]!==Fe||t[125]!==ne?(Ie=(0,Q.jsxs)(ce,{children:[P,(0,Q.jsx)(oe,{ref:M,className:F,onOpenAutoFocus:Jn,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:A,children:[ne,Fe]})})]}),t[123]=A,t[124]=Fe,t[125]=ne,t[126]=Ie):Ie=t[126];let Le;return t[127]!==r||t[128]!==n||t[129]!==Ie?(Le=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:Ie}),t[127]=r,t[128]=n,t[129]=Ie,t[130]=Le):Le=t[130],Le}function Jn(e){return e.preventDefault()}var Yn=`~/.xopc/workspace`;function Xn(e){let t=e.trim();return t?`${Yn}/${x(t)}`:``}function Zn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(tt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(w,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function $n(e){let{agentId:t,enabled:n,saveRef:r}=e,i=lt(async()=>{if(!t)return null;let[e,n]=await Promise.all([f(t,`IDENTITY.md`).catch(()=>``),f(t,`SOUL.md`).catch(()=>``)]),r=dt(e);return{identity:r,soulTemplate:W(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let p=c??(a?Qn(a):null),m=(0,$.useMemo)(()=>p?JSON.stringify(p.identity)!==p.identityBaseline||p.soulCustomContent!==p.soulBaseline:!1,[p]),h=(0,$.useRef)(t);h.current=t;let g=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Qn(a):null);return n?e(n):null})},[a]),_=(0,$.useCallback)(e=>{g(t=>({...t,identity:{...t.identity,...e}}))},[g]),v=(0,$.useCallback)(e=>{g(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=E.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[g]),y=(0,$.useCallback)(e=>{g(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[g]),b=(0,$.useCallback)(e=>{g(t=>({...t,avatarDialogOpen:e}))},[g]),x=(0,$.useCallback)(()=>{g(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[g]),S=(0,$.useCallback)(async()=>{let e=h.current;!e||!p||(await Promise.all([ye(e,`IDENTITY.md`,se(p.identity)),ye(e,`SOUL.md`,p.soulCustomContent)]),s.current=!1,l(e=>{let t=e??p;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[p]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:p,dirty:m,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:x}}var er={draft:``,editorNonce:0,loadedKey:``};function tr(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function nr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=lt(()=>n?Se(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,p]=(0,$.useState)(null),[m,h]=(0,$.useReducer)(tr,er),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,p(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);p(e?e.name:c.files[0].name)}},[c,d]);let x=m.draft,S=m.editorNonce,C=(0,$.useRef)(x);C.current=x;let w=(0,$.useRef)(n);w.current=n;let T=(0,$.useRef)(d);T.current=d;let E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=lt(()=>d&&n?f(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=Oe(async()=>{let e=w.current,t=T.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=C.current;if(n!==O.current){_(!0),o(null);try{await ye(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{_(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){h({type:`clear`});return}M||(D.current=F,O.current=j.data,h({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),p(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{h({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),N()},[N]),fileSaving:g,filesViewMode:v,setFilesViewMode:y,profileFileLoading:M,profileEditorNonce:S,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function rr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=lt(()=>xt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=lt(()=>St(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),M=(0,$.useRef)(S);M.current!==S&&(M.current=S,k(null));let N=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),P=(0,$.useCallback)(()=>{let e=y.trim();e&&St(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),F=!_&&g.length===0,I=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Ve(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:N,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:I,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=wt(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Ve(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:P,useManualChannel:F}}function ir(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(sr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=lt(or,s,d),m;n[10]===f?m=n[11]:(m=f.filter(ar),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function ar(e){return e.enabled!==!1}function or(){return Ge()}function sr(e){return e+1}function cr(e){return ir(e.panel===`skills`,e.hasToken)}function lr(e){return new Set(e.tools.entryDisable)}function ur(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function dr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(lr(n)),n&&t===`skills`){let e=ur(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Ot(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function fr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function pr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function mr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function hr(){let e=l(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!o(e=>e.token),[v,y]=je(),b=C(),{agentId:x}=te(),S=He(e=>e.setPageHeader),w=He(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,Le,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,Pt,{revalidateOnFocus:!1}),j=Te(_),{data:N}=j,P=(0,$.useMemo)(()=>me(N?.payload?.config??{}),[N]),F=T??null,ee=(0,$.useMemo)(()=>F?F.agents.find(e=>e.id===F.defaultId)??F.agents[0]??null:null,[F]),L=!!(_&&D),[R,z]=(0,$.useState)(null),ne=E instanceof Error?E.message:E?n.loadError:null,ie=R??ne,[B,V]=(0,$.useState)(null),[H,U]=(0,$.useState)(`overview`),[W,ae]=(0,$.useState)(``),[oe,G]=(0,$.useState)(``),[K,se]=(0,$.useState)(``),[ce,q]=(0,$.useState)(``),[de,J]=(0,$.useState)(``),[fe,pe]=(0,$.useState)(null),[he,_e]=(0,$.useState)(!1),ve=(0,$.useRef)(``),[ye,be]=(0,$.useState)(null),[xe,Y]=(0,$.useState)(!1),[Se,Ce]=(0,$.useState)(``),[we,Ee]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Ie]=(0,$.useState)(``),Re=(0,$.useRef)(null),[ze,Be]=(0,$.useState)(!1),Ve=(0,$.useRef)({data:null,routeAgentId:void 0});F&&(F!==Ve.current.data||x!==Ve.current.routeAgentId)&&(Ve.current={data:F,routeAgentId:x},x&&F.agents.some(e=>e.id===x)?V(x):V(e=>e&&F.agents.some(t=>t.id===e)?e:F.defaultId)),(0,$.useEffect)(()=>{!F||!x||F.agents.some(e=>e.id===x)||b(Fe,{replace:!0})},[F,x,b]),(0,$.useEffect)(()=>{x&&U(`overview`)},[x]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&b(x?Ue(x):Fe,{replace:!0,state:{[I]:x?Ue(x):Fe}})},[v,x,b]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!x||(U(`overview`),L||!F?.agents.some(e=>e.id===x)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),y(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,x,L,F,y]);let X=(0,$.useMemo)(()=>F?.agents.find(e=>e.id===B)??null,[F,B]),We=(0,$.useMemo)(()=>{let e=N?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[N]),Ge=(0,$.useMemo)(()=>!F||We&&F.agents.some(e=>e.id===We)?We:F.defaultId||F.agents[0]?.id||We,[F,We]),Ke=!!(F&&We&&!F.agents.some(e=>e.id===We));(0,$.useEffect)(()=>{Ee(Ke?``:We)},[We,Ke]);let qe=(0,$.useRef)(null),Ye=X?X.id:null;X&&qe.current!==Ye?(qe.current=Ye,Oe(X.workspace),Ae(X.model?.primary??``),Ne(ue(X,a(e).agentsSettings)),Ie(M(X,a(e).agentsSettings))):!X&&qe.current!==null&&(qe.current=null,Oe(``),Ae(``),Ne(``),Ie(``));let Xe=$n({agentId:X?.id??null,enabled:H===`behavior`&&!!X,saveRef:Re}),Ze=nr({panel:H,selectedId:B,hasToken:_,dataAgentsLength:F?.agents.length,saveErrorMessage:n.saveError,setError:z}),Qe=dr({panel:H,selected:X}),$e=rr({panel:H,hasToken:_,bindingsFromConfig:P,gatewayCfgLoading:N===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:z}),tt=cr({panel:H,hasToken:_}),rt=(0,$.useCallback)(()=>{let e=Xn(oe.trim()||W);q(t=>t===``||t===ve.current?(ve.current=e,e):t)},[oe,W]),it=(0,$.useCallback)(()=>{ve.current=``,ae(``),G(``),se(``),q(``),J(``),pe(null),be(null),_e(!0)},[]),at=(0,$.useCallback)(e=>{let t=new Set(F?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,F]),ot=(0,$.useCallback)(e=>{if(be(e),!e)return;let t=F?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=at(t.id),o=t.description??``;ve.current=``,ae(i),G(a),se(o),q(t.workspace),J(t.model?.primary??``),pe(null)},[n.duplicateName,F,at]),st=(0,$.useCallback)(e=>{ot(e),_e(!0)},[ot]),ct=(0,$.useMemo)(()=>(0,Q.jsx)(Zn,{a:n,busy:xe,listSearchQuery:Se,onListSearchQueryChange:Ce,onAddAgent:()=>it()}),[n,xe,Se,it]);(0,$.useLayoutEffect)(()=>_?(S({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:ct}),()=>w()):(w(),()=>w()),[n.title,ct,w,_,S]);async function lt(t){t.preventDefault();let r=W.trim();if(!r)return;let i=nt(oe,r);if(i.ok===!1){pe(i.error);return}let a=ce.trim()||Xn(oe.trim()||r);if(a){Y(!0),pe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${K.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
2
2
  `),{createdAgentId:n,...i}=await le({workspace:a,...oe.trim()?{id:oe.trim()}:{},...de.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:de.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ye?{cloneFrom:ye}:{}});O(i,{revalidate:!1}),ae(``),G(``),se(``),q(``),J(``),pe(null),_e(!1),V(n),b(Ue(n))}catch(e){pe(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ut(){if(X){Y(!0),z(null);try{O(await et(X.id,{workspace:De.trim()||void 0,...ke.trim()?{models:fr(X,ke.trim())}:{}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function dt(e){Y(!0),z(null);try{O(await et(e.id,{setDefault:!0}),{revalidate:!1}),V(e.id)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ft(){let e=we.trim().toLowerCase();if(e&&!F?.agents.some(t=>t.id===e)){z(n.tuiDefaultAgentInvalid);return}Y(!0),z(null);try{await Je(e||null),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function pt(e){Y(!0),z(null);try{await Je(e.id),Ee(e.id),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function mt(){Y(!0),z(null);try{await Je(null),Ee(``),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ht(e,t){Y(!0),z(null);try{let n=await re(e.id,t);O(n,{revalidate:!1}),V(n.defaultId),U(`overview`),x===e.id&&b(Fe,{replace:!0}),i(!1),c(null),m(``)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}function gt(e,t){e.id!==`main`&&(c(e),f(t),m(``),i(!0))}async function _t(){if(X){Y(!0),z(null);try{O(await et(X.id,{tools:{builtin:mr(Qe.toolEntryDisable)}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function vt(){if(X){Y(!0),z(null);try{O(await et(X.id,{tools:null}),{revalidate:!1}),Qe.setToolEntryDisable(new Set)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function yt(){if(!X)return;let e=Dt(Qe.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){z(e);return}Y(!0),z(null);try{O(await et(X.id,{models:{roles:jt(Qe.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function bt(){if(!X)return;let e=pr(X),t=jt(e);if(!t?.roles?.[X.typedModels.defaultRole]){z(n.typedModelsInvalidModel);return}Y(!0),z(null);try{O(await et(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Qe.setModelRows(e)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function xt(){if(X){Y(!0),z(null);try{O(await et(X.id,{skills:Qe.skillsInherit?null:[...Qe.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function St(e){if(X){Y(!0),z(null);try{O(await et(X.id,{extends:e}),{revalidate:!1}),A()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}let Ct=H!==`behavior`,wt=(()=>{if(!X||H!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return De.trim()!==e||ke.trim()!==t})(),Tt=(()=>{if(Ct||!X)return!1;switch(H){case`behavior`:return wt||Xe.dirty;default:return!0}})(),Et=Ct||!Tt;function Ot(){Be(!0),setTimeout(()=>Be(!1),2e3)}async function kt(){switch(H){case`behavior`:await Promise.all([ut(),Re.current?.()??Promise.resolve()]),Ot();break;default:break}}function At(e){e||b(Fe)}let Mt=X?Me.trim()||ue(X,n):x??``,Nt=X?.id??x??``,Ft=(0,$.useCallback)(async()=>{if(X){await kt(),Ze.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(ge,X.id)}catch{}b(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,kt,Ze.saveProfileMarkdownDebounced,b]),It={a:n,chat:g,cCron:h,selected:X,panel:H,data:F,busy:xe,editName:Me,setEditName:Ne,editDescription:Pe,setEditDescription:Ie,editWorkspace:De,setEditWorkspace:Oe,editModel:ke,setEditModel:Ae,defaultModel:ee?.model?.primary??``,defaultWorkspace:ee?.workspace??``,onSetDefault:()=>{X&&dt(X)},onSetTuiDefault:()=>{X&&pt(X)},isTuiDefault:!!(X&&X.id===Ge),isTuiDefaultInherited:!!(X&&X.id===Ge&&(!We||Ke)),onSaveAgentEdits:()=>void ut(),onDelete:e=>{X&&gt(X,e)},onTryInChat:()=>void Ft(),capabilityPresets:k?.presets??[],defaultPresetId:k?.defaultPresetId,onUpdateAgentExtends:e=>void St(e),onOpenCapabilityPreset:e=>{b(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Re,overviewProfile:Xe,filesLoading:Ze.filesLoading,files:Ze.files,activeFile:Ze.activeFile,setActiveFile:Ze.setActiveFile,filesViewMode:Ze.filesViewMode,setFilesViewMode:Ze.setFilesViewMode,fileDraft:Ze.fileDraft,setFileDraft:Ze.setFileDraft,fileSaving:Ze.fileSaving,profileFileLoading:Ze.profileFileLoading,profileEditorNonce:Ze.profileEditorNonce,toolEntryDisable:Qe.toolEntryDisable,setToolEntryDisable:Qe.setToolEntryDisable,onSaveTools:()=>void _t(),onClearToolsEntry:()=>void vt(),modelRows:Qe.modelRows,setModelRows:Qe.setModelRows,onSaveModels:()=>void yt(),onClearModelsEntry:()=>void bt(),skillsCatalogLoading:tt.skillsCatalogLoading,catalogForPick:tt.catalogForPick,skillsInherit:Qe.skillsInherit,setSkillsInherit:Qe.setSkillsInherit,skillsPick:Qe.skillsPick,setSkillsPick:Qe.setSkillsPick,onSaveSkills:()=>void xt(),bindingsLoading:$e.bindingsLoading,agentBindings:$e.agentBindings,bindChannelStatuses:$e.bindChannelStatuses,bindChannelsLoading:$e.bindChannelsLoading,useManualChannel:$e.useManualChannel,newBindChannel:$e.newBindChannel,setNewBindChannel:$e.setNewBindChannel,bindSessionChats:$e.bindSessionChats,bindSessionsLoading:$e.bindSessionsLoading,newBindSessionIdx:$e.newBindSessionIdx,setNewBindSessionIdx:$e.setNewBindSessionIdx,newBindCustomPeer:$e.newBindCustomPeer,setNewBindCustomPeer:$e.setNewBindCustomPeer,refreshBindSessions:$e.refreshBindSessions,onRemoveBinding:e=>void $e.onRemoveBinding(e),onAddBinding:$e.onAddBinding};return{hasToken:_,a:n,chat:g,language:e,data:F,savedTuiDefaultAgentId:We,effectiveTuiDefaultAgentId:Ge,tuiDefaultAgentDraft:we,setTuiDefaultAgentDraft:Ee,tuiDefaultAgentUnavailable:Ke,onSaveTuiDefaultAgent:ft,onSetTuiDefaultAgent:pt,onClearTuiDefaultAgent:mt,onSetDefaultAgent:dt,loading:L,displayError:ie,navigate:b,routeAgentId:x,busy:xe,listSearchQuery:Se,openAddAgentModal:it,openDuplicateAgentModal:st,duplicateSourceId:ye,onSelectDuplicateSource:ot,panel:H,setPanel:U,modalTitle:Mt,modalSubtitle:Nt,footerSaveDisabled:Et,savedFlash:ze,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:he,setAddAgentModalOpen:_e,createWorkspaceSuggestedRef:ve,createModalError:fe,setCreateModalError:pe,createDisplayName:W,setCreateDisplayName:ae,createAgentId:oe,setCreateAgentId:G,createDescription:K,setCreateDescription:se,createWorkspace:ce,setCreateWorkspace:q,createModel:de,setCreateModel:J,onCreate:lt,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:rt,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:c,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:ht,editorPanelProps:It}}function gr(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(J,{className:`h-5 w-40`}),(0,Q.jsx)(J,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(J,{className:`h-9 w-28 rounded-lg`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6}).map(_r)})]}),e[1]=n):n=e[1],n}function _r(e,t){return(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(J,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(J,{className:`h-4 w-2/3`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(J,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(J,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(J,{className:`h-6 w-20 rounded-full`})]})]},t)}function vr(){let e=hr();return e.hasToken?(0,Q.jsxs)(mt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,children:e.displayError}):null,e.loading?(0,Q.jsx)(gr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Gn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Ue(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(ge,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Vt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(gr,{}):(0,Q.jsx)(zn,{...e.editorPanelProps})}):null,(0,Q.jsx)(qn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Lt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(mt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{vr as AgentsSettingsPanel};