@xopcai/xopc 0.0.160 → 0.0.161

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 (117) 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/{action-boundary-settings-panel-CY3sizqC.js → action-boundary-settings-panel-BIVBUiNT.js} +1 -1
  4. package/dist/gateway/static/root/assets/activity-store-o7GRljfD.js +1 -0
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B_27aaZQ.js → agent-avatar-dicebear-9R3szLMc.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-B1l3iii6.js → agents-_qbUaYbs.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-BbzB57CJ.js → api-jSTqFMq9.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-DfmyWcyh.js → app-management-settings-panel-D81cyE76.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-B2v0c-K-.js → appearance-settings-Ct6bZQCV.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-DaNFLsp0.js → apps-page-0sPqD0FK.js} +1 -1
  11. package/dist/gateway/static/root/assets/{archive-plugin-DL5Lnx0C.js → archive-plugin-CfD7AZKn.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-InuP-ZjQ.js → attachment-load-CP_Gaxt3.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-CahGuh7B.js → automation-suggestion-card-BGKM_NDZ.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-Cd0gMx6p.js → automations-page-BxWBuBsE.js} +3 -3
  15. package/dist/gateway/static/root/assets/{binary-plugins-CdOTGYVu.js → binary-plugins-IPr2EVnS.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-D6ShK1S-.js → block-editor-B6aHEGA6.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-settings-page-BmUYDL2Z.js → browser-settings-page-C499b9AH.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-api-BzoLm52Z.js → capability-presets-api-CCX9-LjU.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CE7mrWtS.js → capability-presets-settings-panel-Dva9SiPK.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channel-recipient-api-DbgydMjl.js → channel-recipient-api-MmLMLDWf.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-settings-D1_gcAHK.js → channels-settings-DNAU7u9o.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +1 -0
  23. package/dist/gateway/static/root/assets/check-DUBLcKHA.js +1 -0
  24. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +1 -0
  25. package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-C3bJC9nt.js → connector-logo-BbjzIs87.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +2 -0
  28. package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +1 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-wacrnJJ1.js → desktop-pet-CYH5ZSXy.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-BrHVvbBw.js → desktop-pet-settings-DQLqGLc0.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-sprite-CFd1jGLJ.js → desktop-pet-sprite-DTqXSpqf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BPI969w-.js → directory-picker-path-field-ClsiXhmz.js} +1 -1
  33. package/dist/gateway/static/root/assets/{dreaming-settings-iw6QXD45.js → dreaming-settings-CjMPPdzg.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-rCHyhEr6.js → extension-debug-page-57eizjhB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-C4gQsAPt.js → extension-page-CsbSb3u1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-DB_3eik7.js → extension-settings-page-DKA9-lyP.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-Cdt38iF2.js → gateway-config-api-DIPJuzBZ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-DM4BgyGw.js → gateway-settings-CDLqAQY7.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-ChRFNjj_.js → gateway-startup-retry-DrfSJtvT.js} +1 -1
  40. package/dist/gateway/static/root/assets/{goal-create-dialog-BQamcEmF.js → goal-create-dialog-Q3B0E-0s.js} +1 -1
  41. package/dist/gateway/static/root/assets/{goal-detail-page-DZUQ0Lf1.js → goal-detail-page-C5VAK04G.js} +1 -1
  42. package/dist/gateway/static/root/assets/{goals-config-api-RvljeEm6.js → goals-config-api-lGC10UkU.js} +1 -1
  43. package/dist/gateway/static/root/assets/{goals-page-BtxVD27C.js → goals-page-BJb-5IYw.js} +2 -2
  44. package/dist/gateway/static/root/assets/{goals-settings-DMGV4S4L.js → goals-settings-BWq0pdrA.js} +1 -1
  45. package/dist/gateway/static/root/assets/{heartbeat-settings-B8r5EXc5.js → heartbeat-settings-D4o8BJVv.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-CkUHH170.css +1 -0
  47. package/dist/gateway/static/root/assets/index-vq_cJZJC.js +199 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-1-LYibQ4.js → keyboard-shortcuts-settings-6T2QYehS.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-CC4vtUUI.js → local-apps-page-DCjg2K9f.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-CPbGB_6l.js → locale-store-Dar-xqQr.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-Bn_taxBV.js → logs-page-CyYCBqym.js} +1 -1
  53. package/dist/gateway/static/root/assets/{markdown-split-CprEIf8A.js → markdown-split-rt1XO43g.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-BXt_Sj2O.js → media-plugins-Bwo8CJuh.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-CxySDn9d.js +5 -0
  56. package/dist/gateway/static/root/assets/{models-hub-panel-DJReXRP9.js → models-hub-panel-DObxxjc9.js} +1 -1
  57. package/dist/gateway/static/root/assets/{notes-page-Wf5-eyyM.js → notes-page-Dp-pkX7d.js} +1 -1
  58. package/dist/gateway/static/root/assets/{notes-workbench-BbdjzYzs.js → notes-workbench-CCb4RXcZ.js} +2 -2
  59. package/dist/gateway/static/root/assets/{page-tabs-dtpK_4Fs.js → page-tabs-CzZ4iKOb.js} +1 -1
  60. package/dist/gateway/static/root/assets/{preview-open-alternatives-DijtEVxG.js → preview-open-alternatives-3E_Qa-58.js} +1 -1
  61. package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +1 -0
  62. package/dist/gateway/static/root/assets/product-open-page-B2T48Sbt.js +1 -0
  63. package/dist/gateway/static/root/assets/{project-detail-page-BwG8SOzI.js → project-detail-page-BvEcriRC.js} +1 -1
  64. package/dist/gateway/static/root/assets/{projects-page-nUlyUtxh.js → projects-page-B_e79MRJ.js} +1 -1
  65. package/dist/gateway/static/root/assets/{remote-access-hub-rf7bjije.js → remote-access-hub-DGcqnYfR.js} +1 -1
  66. package/dist/gateway/static/root/assets/{save-bar-controls-qhDisdqY.js → save-bar-controls-CkeKasGm.js} +1 -1
  67. package/dist/gateway/static/root/assets/{schedule-field-AhJ50NoT.js → schedule-field-TkqUL3wm.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-AuJg2CXU.js → schema-form-DC-iU5IG.js} +1 -1
  69. package/dist/gateway/static/root/assets/{sessions-page-CSoHUe38.js → sessions-page-DQZhrDJ8.js} +1 -1
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-collapsible-section-D5ganr_X.js → settings-collapsible-section-Dpqth3oA.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-form-section-Db3cKRsg.js → settings-form-section-CNqF6IwY.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-loading-skeleton-D05YKT2x.js → settings-loading-skeleton-DkvwitK_.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-page-layout-Cv_Cu4I5.js → settings-page-layout-DWvNgISx.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-DYfXmfTx.js → settings-page-qPG7I2zd.js} +1 -1
  76. package/dist/gateway/static/root/assets/{setup-status-panel-wBWOFpvw.js → setup-status-panel-lwRAh9aw.js} +1 -1
  77. package/dist/gateway/static/root/assets/{share-preview-page-CYkZVuse.js → share-preview-page-DGpSPW-n.js} +1 -1
  78. package/dist/gateway/static/root/assets/{shares-settings-BAMma1-P.js → shares-settings-BGj9IVUr.js} +1 -1
  79. package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +1 -0
  80. package/dist/gateway/static/root/assets/{skills-page-Ca2RA29R.js → skills-page-DdjzFZ8I.js} +1 -1
  81. package/dist/gateway/static/root/assets/{system-settings-panel-C1Ng5bXh.js → system-settings-panel-8TxxSbUw.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-LMHIDR9n.js → theme-store-B5FzMWOx.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-Ch2Bdm_5.js → typed-models-lib-DEGtSA5h.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-channel-catalog-CZnaMOeL.js → use-channel-catalog-BDU6FneG.js} +1 -1
  85. package/dist/gateway/static/root/assets/{user-context-page-CTumZa0y.js → user-context-page-BTTZpAGV.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-DdlMxeqO.js → voice-api-key-field-DuDQd-WU.js} +1 -1
  87. package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +1 -0
  88. package/dist/gateway/static/root/assets/{work-item-detail-page--wxLw1p_.js → work-item-detail-page-DeEPPu4n.js} +1 -1
  89. package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +1 -0
  90. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BFk8TvTw.js → workflow-run-setup-panel-Cwi8Pz7n.js} +1 -1
  91. package/dist/gateway/static/root/assets/{workflows-page-CVVJd4gy.js → workflows-page-BIy4wrzO.js} +3 -3
  92. package/dist/gateway/static/root/index.html +12 -10
  93. package/dist/package.js +1 -1
  94. package/dist/src/config/agent-profile.js +1 -1
  95. package/dist/src/gateway/agents-admin.js +1 -1
  96. package/dist/src/gateway/hono/sse.d.ts +2 -0
  97. package/dist/src/gateway/hono/sse.js +10 -3
  98. package/dist/src/gateway/run-loop.js +17 -7
  99. package/dist/src/gateway/server.d.ts +1 -0
  100. package/dist/src/gateway/server.js +9 -0
  101. package/dist/src/local-apps/preview-runtime-bridge.d.ts +1 -1
  102. package/dist/src/local-apps/preview-runtime-bridge.js +14 -11
  103. package/package.json +1 -1
  104. package/dist/gateway/static/root/assets/activity-store-3Cso_2qm.js +0 -1
  105. package/dist/gateway/static/root/assets/channels-status-swr-Cqfqv59m.js +0 -1
  106. package/dist/gateway/static/root/assets/check-BODqo66o.js +0 -1
  107. package/dist/gateway/static/root/assets/circle-alert-RzVebuX2.js +0 -1
  108. package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +0 -1
  109. package/dist/gateway/static/root/assets/connectors-page-CaLBi6Na.js +0 -2
  110. package/dist/gateway/static/root/assets/index-CHKe7nwC.js +0 -197
  111. package/dist/gateway/static/root/assets/index-CXhfUIjh.css +0 -1
  112. package/dist/gateway/static/root/assets/local-app-workbench-page-CTTfyFe3.js +0 -2
  113. package/dist/gateway/static/root/assets/messages-DDsiqdJS.js +0 -5
  114. package/dist/gateway/static/root/assets/settings-advanced-gate-Db976IEa.js +0 -1
  115. package/dist/gateway/static/root/assets/skill-reload-api-TWxFFWxM.js +0 -1
  116. package/dist/gateway/static/root/assets/work-discovery-page-CcfZhdBi.js +0 -1
  117. package/dist/gateway/static/root/assets/work-page-DyS0XBpV.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{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-DDsiqdJS.js";import{l as s,n as c}from"./locale-store-CPbGB_6l.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{$o as u,Bo as d,Es as f,Ho as p,Pl as m,Ro as h,Rr as g,Rs as _,Sc as v,Ss as y,Ts as b,Uo as x,Vl as S,Vo as C,Wo as w,dc as T,ec as E,gu as D,hs as O,is as k,ns as A,ol as j,rs as M,ts as N,yc as P,zo as ee}from"./index-CHKe7nwC.js";import{n as te,r as ne}from"./settings-page-layout-Cv_Cu4I5.js";import{n as re,r as F}from"./settings-loading-skeleton-D05YKT2x.js";import{n as I,t as L}from"./settings-form-section-Db3cKRsg.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./capability-presets-api-BzoLm52Z.js";import{a as de,i as fe,o as R,t as z}from"./typed-models-lib-Ch2Bdm_5.js";var B=e(t(),1),V=n(),H=r();function pe(e){let t=(0,V.c)(34),{extendsIds:n,onExtendsChange:r,presetOptions:i,jsonFields:a,onJsonFieldsChange:o,disabled:s,labels:c}=e,l;t[0]===a?l=t[1]:(l=Object.keys(a),t[0]=a,t[1]=l);let u=l,d;t[2]===c.inheritanceTitle?d=t[3]:(d=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.inheritanceTitle}),t[2]=c.inheritanceTitle,t[3]=d);let f;t[4]===c.inheritanceHint?f=t[5]:(f=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.inheritanceHint}),t[4]=c.inheritanceHint,t[5]=f);let p;t[6]!==s||t[7]!==n||t[8]!==c.inheritanceEmpty||t[9]!==r||t[10]!==i?(p=i.length>0?(0,H.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=n.includes(e.id);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:s,onChange:()=>r(t?n.filter(t=>t!==e.id):[...n,e.id])}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-fg-subtle`,children:e.id})]})]},e.id)})}):(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c.inheritanceEmpty}),t[6]=s,t[7]=n,t[8]=c.inheritanceEmpty,t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`section`,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c.jsonTitle?h=t[17]:(h=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.jsonTitle}),t[16]=c.jsonTitle,t[17]=h);let g;t[18]===c.jsonHint?g=t[19]:(g=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.jsonHint}),t[18]=c.jsonHint,t[19]=g);let _;t[20]!==s||t[21]!==u||t[22]!==a||t[23]!==c.fieldHints||t[24]!==c.fieldLabels||t[25]!==o?(_=(0,H.jsx)(`div`,{className:`mt-3 grid gap-4 lg:grid-cols-2`,children:u.map(e=>(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:c.fieldLabels[e]}),(0,H.jsx)(`span`,{className:`min-h-8 text-xs leading-relaxed text-fg-muted`,children:c.fieldHints[e]}),(0,H.jsx)(`textarea`,{className:`min-h-36 resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 font-mono text-xs leading-relaxed text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:a[e],disabled:s,spellCheck:!1,placeholder:`{}`,onChange:t=>o({...a,[e]:t.target.value})})]},e))}),t[20]=s,t[21]=u,t[22]=a,t[23]=c.fieldHints,t[24]=c.fieldLabels,t[25]=o,t[26]=_):_=t[26];let v;t[27]!==h||t[28]!==g||t[29]!==_?(v=(0,H.jsxs)(`section`,{children:[h,g,_]}),t[27]=h,t[28]=g,t[29]=_,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==v?(y=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,v]}),t[31]=m,t[32]=v,t[33]=y):y=t[33],y}function U(e){return e.name||e.directoryId}function me(e){let t=(0,V.c)(56),{mode:n,selected:r,catalog:i,loading:o,disabled:s,onModeChange:c,onSelectedChange:l,labels:u}=e,d=n===`allowlist`||n===`denylist`,f;t[0]===i?f=t[1]:(f=i.map(U).filter(Boolean),t[0]=i,t[1]=f);let p=f,m;bb0:{if(n===`inherit`){m=u.inheritSummary;break bb0}if(n===`all`){m=u.allSummary;break bb0}if(n===`off`){m=u.offSummary;break bb0}let e=n===`allowlist`?u.allowSummary:u.denySummary,i;t[2]!==r.size||t[3]!==e?(i=e.replace(`{{count}}`,String(r.size)),t[2]=r.size,t[3]=e,t[4]=i):i=t[4],m=i}let h=m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,H.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t[5]=g):g=t[5];let _;t[6]===u.overrideSummaryTitle?_=t[7]:(_=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[g,u.overrideSummaryTitle]}),t[6]=u.overrideSummaryTitle,t[7]=_);let v;t[8]===h?v=t[9]:(v=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:h}),t[8]=h,t[9]=v);let b;t[10]!==_||t[11]!==v?(b=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[_,v]}),t[10]=_,t[11]=v,t[12]=b):b=t[12];let x;t[13]===u.modeLabel?x=t[14]:(x=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.modeLabel}),t[13]=u.modeLabel,t[14]=x);let S;t[15]===u.modeInherit?S=t[16]:(S=[`inherit`,u.modeInherit],t[15]=u.modeInherit,t[16]=S);let C;t[17]===u.modeAll?C=t[18]:(C=[`all`,u.modeAll],t[17]=u.modeAll,t[18]=C);let w;t[19]===u.modeAllowlist?w=t[20]:(w=[`allowlist`,u.modeAllowlist],t[19]=u.modeAllowlist,t[20]=w);let T;t[21]===u.modeDenylist?T=t[22]:(T=[`denylist`,u.modeDenylist],t[21]=u.modeDenylist,t[22]=T);let E;t[23]===u.modeOff?E=t[24]:(E=[`off`,u.modeOff],t[23]=u.modeOff,t[24]=E);let O;t[25]!==T||t[26]!==E||t[27]!==S||t[28]!==C||t[29]!==w?(O=[S,C,w,T,E],t[25]=T,t[26]=E,t[27]=S,t[28]=C,t[29]=w,t[30]=O):O=t[30];let k=O,A;t[31]!==s||t[32]!==n||t[33]!==c||t[34]!==k?(A=(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.map(e=>{let[t,r]=e;return(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,n===t?`bg-accent-soft text-accent-fg`:`bg-surface-panel text-fg hover:bg-surface-hover/55`),disabled:s,onClick:()=>c(t),children:r},t)})}),t[31]=s,t[32]=n,t[33]=c,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==A||t[37]!==x?(j=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[x,A]}),t[36]=A,t[37]=x,t[38]=j):j=t[38];let M;t[39]!==i||t[40]!==p||t[41]!==s||t[42]!==u.emptyCatalog||t[43]!==u.noDescription||t[44]!==u.quickActionsLabel||t[45]!==u.quickClear||t[46]!==u.quickSelectAll||t[47]!==o||t[48]!==l||t[49]!==d||t[50]!==r?(M=d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.quickActionsLabel}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:s||o||p.length===0,onClick:()=>l(new Set(p)),children:u.quickSelectAll}),(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:s||o||r.size===0,onClick:()=>l(new Set),children:u.quickClear})]})]}),o?(0,H.jsx)(F,{rows:3}):i.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.emptyCatalog}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:i.map(e=>{let t=U(e),n=r.has(t),i=typeof e.description==`string`?e.description.trim():``,o=i||u.noDescription;return(0,H.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,H.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:s,onChange:()=>{let e=new Set(r);n?e.delete(t):e.add(t),l(e)},"aria-label":t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,H.jsx)(`p`,{className:a(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!i&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})]}):null,t[39]=i,t[40]=p,t[41]=s,t[42]=u.emptyCatalog,t[43]=u.noDescription,t[44]=u.quickActionsLabel,t[45]=u.quickClear,t[46]=u.quickSelectAll,t[47]=o,t[48]=l,t[49]=d,t[50]=r,t[51]=M):M=t[51];let N;return t[52]!==j||t[53]!==M||t[54]!==b?(N=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b,j,M]}),t[52]=j,t[53]=M,t[54]=b,t[55]=N):N=t[55],N}var W=[`write_file`,`apply_patch`,`exec_command`,`execute_code`],G=[`exec_command`,`execute_code`,`automation`,`extensions`,`bundle-mcp`,`skill_manage`],K=[`send_message`,`send_media`,`text_to_speech`,`create_share`],he=[`read_file`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`,`web_extract`],ge=[...W,...K],q=[`read_file`,`write_file`,`apply_patch`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`],_e=[`send_message`,`send_media`];function ve(e,t){let n={};for(let[r,i]of t)for(let t of r)e.has(t)&&(n[t]={mode:i});return n}function ye(e){let t=(0,V.c)(105),{builtinToolIds:n,toolPolicies:r,onChange:i,disabled:o,getToolDescription:s,getGroupTitle:c,labels:l}=e,d;t[0]===n?d=t[1]:(d=new Set(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==f||t[3]!==r?(p=Object.entries(r).filter(e=>{let[t]=e;return f.has(t)}).toSorted(be),t[2]=f,t[3]=r,t[4]=p):p=t[4];let m=p,h;if(t[5]!==f||t[6]!==n){h=[];for(let e of se){let t=e.toolIds.filter(e=>f.has(e));t.length>0&&h.push({key:e.key,ids:[...t]})}let e;t[8]===n?e=t[9]:(e=le(n),t[8]=n,t[9]=e);let r=e;if(r.length>0){let e;t[10]===r?e=t[11]:(e={key:`misc`,ids:r},t[10]=r,t[11]=e),h.push(e)}t[5]=f,t[6]=n,t[7]=h}else h=t[7];let g=h,_;t[12]!==i||t[13]!==r?(_=(e,t)=>{let n={...r};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},i(n)},t[12]=i,t[13]=r,t[14]=_):_=t[14];let v=_,b;t[15]!==i||t[16]!==r?(b=(e,t)=>{let n=r[e];n&&i({...r,[e]:t(n)})},t[15]=i,t[16]=r,t[17]=b):b=t[17];let x=b,S;t[18]!==f||t[19]!==i?(S=e=>{i(ve(f,e))},t[18]=f,t[19]=i,t[20]=S):S=t[20];let C=S;if(n.length===0){let e;return t[21]===l.emptyBuiltin?e=t[22]:(e=(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.emptyBuiltin}),t[21]=l.emptyBuiltin,t[22]=e),e}let w;t[23]===l.quickActionsLabel?w=t[24]:(w=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:l.quickActionsLabel}),t[23]=l.quickActionsLabel,t[24]=w);let T;t[25]===i?T=t[26]:(T=()=>i({}),t[25]=i,t[26]=T);let E;t[27]!==o||t[28]!==l.quickClearOverrides||t[29]!==T?(E=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:T,children:l.quickClearOverrides}),t[27]=o,t[28]=l.quickClearOverrides,t[29]=T,t[30]=E):E=t[30];let D;t[31]===C?D=t[32]:(D=()=>C([[W,`deny`]]),t[31]=C,t[32]=D);let O;t[33]!==o||t[34]!==l.quickReadOnlyWorkspace||t[35]!==D?(O=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:D,children:l.quickReadOnlyWorkspace}),t[33]=o,t[34]=l.quickReadOnlyWorkspace,t[35]=D,t[36]=O):O=t[36];let k;t[37]===C?k=t[38]:(k=()=>C([[G,`deny`]]),t[37]=C,t[38]=k);let A;t[39]!==o||t[40]!==l.quickHighRiskOff||t[41]!==k?(A=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:k,children:l.quickHighRiskOff}),t[39]=o,t[40]=l.quickHighRiskOff,t[41]=k,t[42]=A):A=t[42];let j;t[43]===C?j=t[44]:(j=()=>C([[K,`deny`]]),t[43]=C,t[44]=j);let M;t[45]!==o||t[46]!==l.quickNoOutbound||t[47]!==j?(M=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:j,children:l.quickNoOutbound}),t[45]=o,t[46]=l.quickNoOutbound,t[47]=j,t[48]=M):M=t[48];let P;t[49]===C?P=t[50]:(P=()=>C([[he,`allow`],[ge,`deny`]]),t[49]=C,t[50]=P);let ee;t[51]!==o||t[52]!==l.quickResearchMode||t[53]!==P?(ee=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:P,children:l.quickResearchMode}),t[51]=o,t[52]=l.quickResearchMode,t[53]=P,t[54]=ee):ee=t[54];let te;t[55]===C?te=t[56]:(te=()=>C([[q,`allow`],[_e,`deny`]]),t[55]=C,t[56]=te);let ne;t[57]!==o||t[58]!==l.quickCodingMode||t[59]!==te?(ne=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:te,children:l.quickCodingMode}),t[57]=o,t[58]=l.quickCodingMode,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==A||t[62]!==M||t[63]!==ee||t[64]!==ne||t[65]!==E||t[66]!==O?(re=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E,O,A,M,ee,ne]}),t[61]=A,t[62]=M,t[63]=ee,t[64]=ne,t[65]=E,t[66]=O,t[67]=re):re=t[67];let F;t[68]!==re||t[69]!==w?(F=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[w,re]}),t[68]=re,t[69]=w,t[70]=F):F=t[70];let I;t[71]===l.overrideSummaryTitle?I=t[72]:(I=(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.overrideSummaryTitle}),t[71]=l.overrideSummaryTitle,t[72]=I);let L;t[73]!==l.modeAllow||t[74]!==l.modeConfirm||t[75]!==l.modeDeny||t[76]!==l.noOverrides||t[77]!==m?(L=m.length>0?(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:m.map(e=>{let[t,n]=e;return(0,H.jsxs)(`span`,{className:a(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[11px]`,n.mode===`deny`&&`border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300`,n.mode===`confirm`&&`border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300`,n.mode===`allow`&&`border-accent/25 bg-accent/10 text-accent`),children:[t,(0,H.jsx)(`span`,{className:`font-sans opacity-80`,children:n.mode===`allow`?l.modeAllow:n.mode===`confirm`?l.modeConfirm:l.modeDeny})]},t)})}):(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.noOverrides}),t[73]=l.modeAllow,t[74]=l.modeConfirm,t[75]=l.modeDeny,t[76]=l.noOverrides,t[77]=m,t[78]=L):L=t[78];let ie;t[79]!==I||t[80]!==L?(ie=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[I,L]}),t[79]=I,t[80]=L,t[81]=ie):ie=t[81];let ae;t[82]!==o||t[83]!==c||t[84]!==s||t[85]!==g||t[86]!==l.inheritedMode||t[87]!==l.maxCallsLabel||t[88]!==l.modeAllow||t[89]!==l.modeConfirm||t[90]!==l.modeDeny||t[91]!==l.scopeInherit||t[92]!==l.scopeLabel||t[93]!==l.scopeReadonly||t[94]!==l.scopeUnrestricted||t[95]!==l.scopeWorkspace||t[96]!==l.timeoutLabel||t[97]!==v||t[98]!==r||t[99]!==x?(ae=(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:g.map(e=>{let{key:t,ids:n}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:c(t)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:n.map(e=>{let t=s(e),n=r[e],i=n?n.mode:`inherit`;return(0,H.jsxs)(`li`,{className:a(`rounded-xl px-3 py-2.5 shadow-surface transition-colors`,i===`inherit`?`bg-surface-panel/50`:`bg-surface-panel`),children:[(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium text-fg`,children:e}),t?(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:t}):null]}),(0,H.jsx)(`div`,{className:`inline-flex w-fit rounded-lg border border-edge-subtle bg-surface-base p-0.5`,children:[`inherit`,`allow`,`confirm`,`deny`].map(t=>(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,i===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),disabled:o,onClick:()=>v(e,t),children:t===`inherit`?l.inheritedMode:t===`allow`?l.modeAllow:t===`confirm`?l.modeConfirm:l.modeDeny},t))})]}),n?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 sm:grid-cols-3 dark:border-edge`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l.scopeLabel,(0,H.jsxs)(u,{value:n.scope??``,disabled:o,onChange:t=>x(e,e=>{let n=t.target.value;if(!n){let{scope:t,...n}=e;return n}return{...e,scope:n}}),children:[(0,H.jsx)(N,{value:``,children:l.scopeInherit}),(0,H.jsx)(N,{value:`readonly`,children:l.scopeReadonly}),(0,H.jsx)(N,{value:`workspace`,children:l.scopeWorkspace}),(0,H.jsx)(N,{value:`unrestricted`,children:l.scopeUnrestricted})]})]}),(0,H.jsx)(J,{label:l.maxCallsLabel,value:n.limits?.maxCallsPerTurn,disabled:o,onChange:t=>x(e,e=>xe(e,`maxCallsPerTurn`,t))}),(0,H.jsx)(J,{label:l.timeoutLabel,value:n.limits?.timeoutMs,disabled:o,onChange:t=>x(e,e=>xe(e,`timeoutMs`,t))})]}):null]},e)})})]},t)})}),t[82]=o,t[83]=c,t[84]=s,t[85]=g,t[86]=l.inheritedMode,t[87]=l.maxCallsLabel,t[88]=l.modeAllow,t[89]=l.modeConfirm,t[90]=l.modeDeny,t[91]=l.scopeInherit,t[92]=l.scopeLabel,t[93]=l.scopeReadonly,t[94]=l.scopeUnrestricted,t[95]=l.scopeWorkspace,t[96]=l.timeoutLabel,t[97]=v,t[98]=r,t[99]=x,t[100]=ae):ae=t[100];let oe;return t[101]!==F||t[102]!==ie||t[103]!==ae?(oe=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,ie,ae]}),t[101]=F,t[102]=ie,t[103]=ae,t[104]=oe):oe=t[104],oe}function be(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function xe(e,t,n){let r={...e.limits};if(n===void 0?delete r[t]:r[t]=n,Object.keys(r).length===0){let{limits:t,...n}=e;return n}return{...e,limits:r}}function J(e){let t=(0,V.c)(9),n=e.value??``,r;t[0]===e?r=t[1]:(r=t=>{let n=t.target.value.trim();e.onChange(n?Number(n):void 0)},t[0]=e,t[1]=r);let i;t[2]!==e.disabled||t[3]!==n||t[4]!==r?(i=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,value:n,disabled:e.disabled,onChange:r}),t[2]=e.disabled,t[3]=n,t[4]=r,t[5]=i):i=t[5];let a;return t[6]!==e.label||t[7]!==i?(a=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[e.label,i]}),t[6]=e.label,t[7]=i,t[8]=a):a=t[8],a}var Se=[{id:`overview`,icon:S},{id:`models`,icon:j},{id:`tools`,icon:f},{id:`skills`,icon:P},{id:`advanced`,icon:E},{id:`impact`,icon:m}];function Ce(e){return fe(Object.entries(e?.models?.roles??{}).map(([e,t])=>({id:e,model:t.model,fallbacks:t.fallbacks??[],description:t.description})))}function Y(e){return structuredClone(e?.tools?.builtin??{})}function we(e){let t=e?.skills;if(!t)return new Set;let n=t.mode===`denylist`?t.deny:t.allow;return new Set(n??[])}function Te(){return{primary:``,fallbacks:``,timeoutMs:``,autoProviderFallback:``}}function Ee(e){return{primary:e?.primary??``,fallbacks:e?.fallbacks?.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{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-CxySDn9d.js";import{l as s,n as c}from"./locale-store-Dar-xqQr.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{$o as u,Bo as d,Es as f,Ho as p,Pl as m,Ro as h,Rr as g,Rs as _,Sc as v,Ss as y,Ts as b,Uo as x,Vl as S,Vo as C,Wo as w,dc as T,ec as E,gu as D,hs as O,is as k,ns as A,ol as j,rs as M,ts as N,yc as P,zo as ee}from"./index-vq_cJZJC.js";import{n as te,r as ne}from"./settings-page-layout-DWvNgISx.js";import{n as re,r as F}from"./settings-loading-skeleton-DkvwitK_.js";import{n as I,t as L}from"./settings-form-section-CNqF6IwY.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./capability-presets-api-CCX9-LjU.js";import{a as de,i as fe,o as R,t as z}from"./typed-models-lib-DEGtSA5h.js";var B=e(t(),1),V=n(),H=r();function pe(e){let t=(0,V.c)(34),{extendsIds:n,onExtendsChange:r,presetOptions:i,jsonFields:a,onJsonFieldsChange:o,disabled:s,labels:c}=e,l;t[0]===a?l=t[1]:(l=Object.keys(a),t[0]=a,t[1]=l);let u=l,d;t[2]===c.inheritanceTitle?d=t[3]:(d=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.inheritanceTitle}),t[2]=c.inheritanceTitle,t[3]=d);let f;t[4]===c.inheritanceHint?f=t[5]:(f=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.inheritanceHint}),t[4]=c.inheritanceHint,t[5]=f);let p;t[6]!==s||t[7]!==n||t[8]!==c.inheritanceEmpty||t[9]!==r||t[10]!==i?(p=i.length>0?(0,H.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=n.includes(e.id);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:s,onChange:()=>r(t?n.filter(t=>t!==e.id):[...n,e.id])}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-fg-subtle`,children:e.id})]})]},e.id)})}):(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c.inheritanceEmpty}),t[6]=s,t[7]=n,t[8]=c.inheritanceEmpty,t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`section`,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c.jsonTitle?h=t[17]:(h=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.jsonTitle}),t[16]=c.jsonTitle,t[17]=h);let g;t[18]===c.jsonHint?g=t[19]:(g=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.jsonHint}),t[18]=c.jsonHint,t[19]=g);let _;t[20]!==s||t[21]!==u||t[22]!==a||t[23]!==c.fieldHints||t[24]!==c.fieldLabels||t[25]!==o?(_=(0,H.jsx)(`div`,{className:`mt-3 grid gap-4 lg:grid-cols-2`,children:u.map(e=>(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:c.fieldLabels[e]}),(0,H.jsx)(`span`,{className:`min-h-8 text-xs leading-relaxed text-fg-muted`,children:c.fieldHints[e]}),(0,H.jsx)(`textarea`,{className:`min-h-36 resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 font-mono text-xs leading-relaxed text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:a[e],disabled:s,spellCheck:!1,placeholder:`{}`,onChange:t=>o({...a,[e]:t.target.value})})]},e))}),t[20]=s,t[21]=u,t[22]=a,t[23]=c.fieldHints,t[24]=c.fieldLabels,t[25]=o,t[26]=_):_=t[26];let v;t[27]!==h||t[28]!==g||t[29]!==_?(v=(0,H.jsxs)(`section`,{children:[h,g,_]}),t[27]=h,t[28]=g,t[29]=_,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==v?(y=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,v]}),t[31]=m,t[32]=v,t[33]=y):y=t[33],y}function U(e){return e.name||e.directoryId}function me(e){let t=(0,V.c)(56),{mode:n,selected:r,catalog:i,loading:o,disabled:s,onModeChange:c,onSelectedChange:l,labels:u}=e,d=n===`allowlist`||n===`denylist`,f;t[0]===i?f=t[1]:(f=i.map(U).filter(Boolean),t[0]=i,t[1]=f);let p=f,m;bb0:{if(n===`inherit`){m=u.inheritSummary;break bb0}if(n===`all`){m=u.allSummary;break bb0}if(n===`off`){m=u.offSummary;break bb0}let e=n===`allowlist`?u.allowSummary:u.denySummary,i;t[2]!==r.size||t[3]!==e?(i=e.replace(`{{count}}`,String(r.size)),t[2]=r.size,t[3]=e,t[4]=i):i=t[4],m=i}let h=m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,H.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t[5]=g):g=t[5];let _;t[6]===u.overrideSummaryTitle?_=t[7]:(_=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[g,u.overrideSummaryTitle]}),t[6]=u.overrideSummaryTitle,t[7]=_);let v;t[8]===h?v=t[9]:(v=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:h}),t[8]=h,t[9]=v);let b;t[10]!==_||t[11]!==v?(b=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[_,v]}),t[10]=_,t[11]=v,t[12]=b):b=t[12];let x;t[13]===u.modeLabel?x=t[14]:(x=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.modeLabel}),t[13]=u.modeLabel,t[14]=x);let S;t[15]===u.modeInherit?S=t[16]:(S=[`inherit`,u.modeInherit],t[15]=u.modeInherit,t[16]=S);let C;t[17]===u.modeAll?C=t[18]:(C=[`all`,u.modeAll],t[17]=u.modeAll,t[18]=C);let w;t[19]===u.modeAllowlist?w=t[20]:(w=[`allowlist`,u.modeAllowlist],t[19]=u.modeAllowlist,t[20]=w);let T;t[21]===u.modeDenylist?T=t[22]:(T=[`denylist`,u.modeDenylist],t[21]=u.modeDenylist,t[22]=T);let E;t[23]===u.modeOff?E=t[24]:(E=[`off`,u.modeOff],t[23]=u.modeOff,t[24]=E);let O;t[25]!==T||t[26]!==E||t[27]!==S||t[28]!==C||t[29]!==w?(O=[S,C,w,T,E],t[25]=T,t[26]=E,t[27]=S,t[28]=C,t[29]=w,t[30]=O):O=t[30];let k=O,A;t[31]!==s||t[32]!==n||t[33]!==c||t[34]!==k?(A=(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.map(e=>{let[t,r]=e;return(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,n===t?`bg-accent-soft text-accent-fg`:`bg-surface-panel text-fg hover:bg-surface-hover/55`),disabled:s,onClick:()=>c(t),children:r},t)})}),t[31]=s,t[32]=n,t[33]=c,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==A||t[37]!==x?(j=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[x,A]}),t[36]=A,t[37]=x,t[38]=j):j=t[38];let M;t[39]!==i||t[40]!==p||t[41]!==s||t[42]!==u.emptyCatalog||t[43]!==u.noDescription||t[44]!==u.quickActionsLabel||t[45]!==u.quickClear||t[46]!==u.quickSelectAll||t[47]!==o||t[48]!==l||t[49]!==d||t[50]!==r?(M=d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.quickActionsLabel}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:s||o||p.length===0,onClick:()=>l(new Set(p)),children:u.quickSelectAll}),(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:s||o||r.size===0,onClick:()=>l(new Set),children:u.quickClear})]})]}),o?(0,H.jsx)(F,{rows:3}):i.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.emptyCatalog}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:i.map(e=>{let t=U(e),n=r.has(t),i=typeof e.description==`string`?e.description.trim():``,o=i||u.noDescription;return(0,H.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,H.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:s,onChange:()=>{let e=new Set(r);n?e.delete(t):e.add(t),l(e)},"aria-label":t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,H.jsx)(`p`,{className:a(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!i&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})]}):null,t[39]=i,t[40]=p,t[41]=s,t[42]=u.emptyCatalog,t[43]=u.noDescription,t[44]=u.quickActionsLabel,t[45]=u.quickClear,t[46]=u.quickSelectAll,t[47]=o,t[48]=l,t[49]=d,t[50]=r,t[51]=M):M=t[51];let N;return t[52]!==j||t[53]!==M||t[54]!==b?(N=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b,j,M]}),t[52]=j,t[53]=M,t[54]=b,t[55]=N):N=t[55],N}var W=[`write_file`,`apply_patch`,`exec_command`,`execute_code`],G=[`exec_command`,`execute_code`,`automation`,`extensions`,`bundle-mcp`,`skill_manage`],K=[`send_message`,`send_media`,`text_to_speech`,`create_share`],he=[`read_file`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`,`web_extract`],ge=[...W,...K],q=[`read_file`,`write_file`,`apply_patch`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`],_e=[`send_message`,`send_media`];function ve(e,t){let n={};for(let[r,i]of t)for(let t of r)e.has(t)&&(n[t]={mode:i});return n}function ye(e){let t=(0,V.c)(105),{builtinToolIds:n,toolPolicies:r,onChange:i,disabled:o,getToolDescription:s,getGroupTitle:c,labels:l}=e,d;t[0]===n?d=t[1]:(d=new Set(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==f||t[3]!==r?(p=Object.entries(r).filter(e=>{let[t]=e;return f.has(t)}).toSorted(be),t[2]=f,t[3]=r,t[4]=p):p=t[4];let m=p,h;if(t[5]!==f||t[6]!==n){h=[];for(let e of se){let t=e.toolIds.filter(e=>f.has(e));t.length>0&&h.push({key:e.key,ids:[...t]})}let e;t[8]===n?e=t[9]:(e=le(n),t[8]=n,t[9]=e);let r=e;if(r.length>0){let e;t[10]===r?e=t[11]:(e={key:`misc`,ids:r},t[10]=r,t[11]=e),h.push(e)}t[5]=f,t[6]=n,t[7]=h}else h=t[7];let g=h,_;t[12]!==i||t[13]!==r?(_=(e,t)=>{let n={...r};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},i(n)},t[12]=i,t[13]=r,t[14]=_):_=t[14];let v=_,b;t[15]!==i||t[16]!==r?(b=(e,t)=>{let n=r[e];n&&i({...r,[e]:t(n)})},t[15]=i,t[16]=r,t[17]=b):b=t[17];let x=b,S;t[18]!==f||t[19]!==i?(S=e=>{i(ve(f,e))},t[18]=f,t[19]=i,t[20]=S):S=t[20];let C=S;if(n.length===0){let e;return t[21]===l.emptyBuiltin?e=t[22]:(e=(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.emptyBuiltin}),t[21]=l.emptyBuiltin,t[22]=e),e}let w;t[23]===l.quickActionsLabel?w=t[24]:(w=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:l.quickActionsLabel}),t[23]=l.quickActionsLabel,t[24]=w);let T;t[25]===i?T=t[26]:(T=()=>i({}),t[25]=i,t[26]=T);let E;t[27]!==o||t[28]!==l.quickClearOverrides||t[29]!==T?(E=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:T,children:l.quickClearOverrides}),t[27]=o,t[28]=l.quickClearOverrides,t[29]=T,t[30]=E):E=t[30];let D;t[31]===C?D=t[32]:(D=()=>C([[W,`deny`]]),t[31]=C,t[32]=D);let O;t[33]!==o||t[34]!==l.quickReadOnlyWorkspace||t[35]!==D?(O=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:D,children:l.quickReadOnlyWorkspace}),t[33]=o,t[34]=l.quickReadOnlyWorkspace,t[35]=D,t[36]=O):O=t[36];let k;t[37]===C?k=t[38]:(k=()=>C([[G,`deny`]]),t[37]=C,t[38]=k);let A;t[39]!==o||t[40]!==l.quickHighRiskOff||t[41]!==k?(A=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:k,children:l.quickHighRiskOff}),t[39]=o,t[40]=l.quickHighRiskOff,t[41]=k,t[42]=A):A=t[42];let j;t[43]===C?j=t[44]:(j=()=>C([[K,`deny`]]),t[43]=C,t[44]=j);let M;t[45]!==o||t[46]!==l.quickNoOutbound||t[47]!==j?(M=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:j,children:l.quickNoOutbound}),t[45]=o,t[46]=l.quickNoOutbound,t[47]=j,t[48]=M):M=t[48];let P;t[49]===C?P=t[50]:(P=()=>C([[he,`allow`],[ge,`deny`]]),t[49]=C,t[50]=P);let ee;t[51]!==o||t[52]!==l.quickResearchMode||t[53]!==P?(ee=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:P,children:l.quickResearchMode}),t[51]=o,t[52]=l.quickResearchMode,t[53]=P,t[54]=ee):ee=t[54];let te;t[55]===C?te=t[56]:(te=()=>C([[q,`allow`],[_e,`deny`]]),t[55]=C,t[56]=te);let ne;t[57]!==o||t[58]!==l.quickCodingMode||t[59]!==te?(ne=(0,H.jsx)(y,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:te,children:l.quickCodingMode}),t[57]=o,t[58]=l.quickCodingMode,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==A||t[62]!==M||t[63]!==ee||t[64]!==ne||t[65]!==E||t[66]!==O?(re=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E,O,A,M,ee,ne]}),t[61]=A,t[62]=M,t[63]=ee,t[64]=ne,t[65]=E,t[66]=O,t[67]=re):re=t[67];let F;t[68]!==re||t[69]!==w?(F=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[w,re]}),t[68]=re,t[69]=w,t[70]=F):F=t[70];let I;t[71]===l.overrideSummaryTitle?I=t[72]:(I=(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.overrideSummaryTitle}),t[71]=l.overrideSummaryTitle,t[72]=I);let L;t[73]!==l.modeAllow||t[74]!==l.modeConfirm||t[75]!==l.modeDeny||t[76]!==l.noOverrides||t[77]!==m?(L=m.length>0?(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:m.map(e=>{let[t,n]=e;return(0,H.jsxs)(`span`,{className:a(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[11px]`,n.mode===`deny`&&`border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300`,n.mode===`confirm`&&`border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300`,n.mode===`allow`&&`border-accent/25 bg-accent/10 text-accent`),children:[t,(0,H.jsx)(`span`,{className:`font-sans opacity-80`,children:n.mode===`allow`?l.modeAllow:n.mode===`confirm`?l.modeConfirm:l.modeDeny})]},t)})}):(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.noOverrides}),t[73]=l.modeAllow,t[74]=l.modeConfirm,t[75]=l.modeDeny,t[76]=l.noOverrides,t[77]=m,t[78]=L):L=t[78];let ie;t[79]!==I||t[80]!==L?(ie=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[I,L]}),t[79]=I,t[80]=L,t[81]=ie):ie=t[81];let ae;t[82]!==o||t[83]!==c||t[84]!==s||t[85]!==g||t[86]!==l.inheritedMode||t[87]!==l.maxCallsLabel||t[88]!==l.modeAllow||t[89]!==l.modeConfirm||t[90]!==l.modeDeny||t[91]!==l.scopeInherit||t[92]!==l.scopeLabel||t[93]!==l.scopeReadonly||t[94]!==l.scopeUnrestricted||t[95]!==l.scopeWorkspace||t[96]!==l.timeoutLabel||t[97]!==v||t[98]!==r||t[99]!==x?(ae=(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:g.map(e=>{let{key:t,ids:n}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:c(t)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:n.map(e=>{let t=s(e),n=r[e],i=n?n.mode:`inherit`;return(0,H.jsxs)(`li`,{className:a(`rounded-xl px-3 py-2.5 shadow-surface transition-colors`,i===`inherit`?`bg-surface-panel/50`:`bg-surface-panel`),children:[(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium text-fg`,children:e}),t?(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:t}):null]}),(0,H.jsx)(`div`,{className:`inline-flex w-fit rounded-lg border border-edge-subtle bg-surface-base p-0.5`,children:[`inherit`,`allow`,`confirm`,`deny`].map(t=>(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,i===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),disabled:o,onClick:()=>v(e,t),children:t===`inherit`?l.inheritedMode:t===`allow`?l.modeAllow:t===`confirm`?l.modeConfirm:l.modeDeny},t))})]}),n?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 sm:grid-cols-3 dark:border-edge`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l.scopeLabel,(0,H.jsxs)(u,{value:n.scope??``,disabled:o,onChange:t=>x(e,e=>{let n=t.target.value;if(!n){let{scope:t,...n}=e;return n}return{...e,scope:n}}),children:[(0,H.jsx)(N,{value:``,children:l.scopeInherit}),(0,H.jsx)(N,{value:`readonly`,children:l.scopeReadonly}),(0,H.jsx)(N,{value:`workspace`,children:l.scopeWorkspace}),(0,H.jsx)(N,{value:`unrestricted`,children:l.scopeUnrestricted})]})]}),(0,H.jsx)(J,{label:l.maxCallsLabel,value:n.limits?.maxCallsPerTurn,disabled:o,onChange:t=>x(e,e=>xe(e,`maxCallsPerTurn`,t))}),(0,H.jsx)(J,{label:l.timeoutLabel,value:n.limits?.timeoutMs,disabled:o,onChange:t=>x(e,e=>xe(e,`timeoutMs`,t))})]}):null]},e)})})]},t)})}),t[82]=o,t[83]=c,t[84]=s,t[85]=g,t[86]=l.inheritedMode,t[87]=l.maxCallsLabel,t[88]=l.modeAllow,t[89]=l.modeConfirm,t[90]=l.modeDeny,t[91]=l.scopeInherit,t[92]=l.scopeLabel,t[93]=l.scopeReadonly,t[94]=l.scopeUnrestricted,t[95]=l.scopeWorkspace,t[96]=l.timeoutLabel,t[97]=v,t[98]=r,t[99]=x,t[100]=ae):ae=t[100];let oe;return t[101]!==F||t[102]!==ie||t[103]!==ae?(oe=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,ie,ae]}),t[101]=F,t[102]=ie,t[103]=ae,t[104]=oe):oe=t[104],oe}function be(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function xe(e,t,n){let r={...e.limits};if(n===void 0?delete r[t]:r[t]=n,Object.keys(r).length===0){let{limits:t,...n}=e;return n}return{...e,limits:r}}function J(e){let t=(0,V.c)(9),n=e.value??``,r;t[0]===e?r=t[1]:(r=t=>{let n=t.target.value.trim();e.onChange(n?Number(n):void 0)},t[0]=e,t[1]=r);let i;t[2]!==e.disabled||t[3]!==n||t[4]!==r?(i=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,value:n,disabled:e.disabled,onChange:r}),t[2]=e.disabled,t[3]=n,t[4]=r,t[5]=i):i=t[5];let a;return t[6]!==e.label||t[7]!==i?(a=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[e.label,i]}),t[6]=e.label,t[7]=i,t[8]=a):a=t[8],a}var Se=[{id:`overview`,icon:S},{id:`models`,icon:j},{id:`tools`,icon:f},{id:`skills`,icon:P},{id:`advanced`,icon:E},{id:`impact`,icon:m}];function Ce(e){return fe(Object.entries(e?.models?.roles??{}).map(([e,t])=>({id:e,model:t.model,fallbacks:t.fallbacks??[],description:t.description})))}function Y(e){return structuredClone(e?.tools?.builtin??{})}function we(e){let t=e?.skills;if(!t)return new Set;let n=t.mode===`denylist`?t.deny:t.allow;return new Set(n??[])}function Te(){return{primary:``,fallbacks:``,timeoutMs:``,autoProviderFallback:``}}function Ee(e){return{primary:e?.primary??``,fallbacks:e?.fallbacks?.join(`
2
2
  `)??``,timeoutMs:e?.timeoutMs?String(e.timeoutMs):``,autoProviderFallback:e?.autoProviderFallback===void 0?``:e.autoProviderFallback?`true`:`false`}}function X(){return{imageModel:Te(),imageGenerationModel:Te(),allowFallbacks:``,maxCostTier:``}}function Z(e){return{imageModel:Ee(e?.models?.imageModel),imageGenerationModel:Ee(e?.models?.imageGenerationModel),allowFallbacks:e?.models?.policy?.allowFallbacks===void 0?``:e.models.policy.allowFallbacks?`true`:`false`,maxCostTier:e?.models?.policy?.maxCostTier??``}}function Q(e){return e===void 0?``:JSON.stringify(e,null,2)}function De(){return{mcp:``,workflows:``,boundaries:``,runtime:``,locks:``}}function Oe(e){return{mcp:Q(e?.tools?.mcp),workflows:Q(e?.workflows),boundaries:Q(e?.boundaries),runtime:Q(e?.runtime),locks:Q(e?.locks)}}function ke(e){return{id:e?.id??``,name:e?.name??``,description:e?.description??``,modelRows:Ce(e),modelAdvanced:Z(e),toolPolicies:Y(e),skillMode:e?.skills?.mode??`inherit`,skillPick:we(e),extendsIds:[...e?.extends??[]],jsonFields:Oe(e)}}function Ae(e){let t=e.primary.trim();if(!t)return;let n=e.fallbacks.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean),r=e.timeoutMs.trim()?Number(e.timeoutMs):void 0,i=e.autoProviderFallback===``?void 0:e.autoProviderFallback===`true`;return{primary:t,...n.length>0?{fallbacks:n}:{},...r?{timeoutMs:r}:{},...i===void 0?{}:{autoProviderFallback:i}}}function je(e,t){let n=z(e.modelRows),r=Ae(e.modelAdvanced.imageModel),i=Ae(e.modelAdvanced.imageGenerationModel),a=e.modelAdvanced.allowFallbacks||e.modelAdvanced.maxCostTier?{...e.modelAdvanced.allowFallbacks?{allowFallbacks:e.modelAdvanced.allowFallbacks===`true`}:{},...e.modelAdvanced.maxCostTier?{maxCostTier:e.modelAdvanced.maxCostTier}:{}}:void 0,o={...t?.models?.defaultRole?{defaultRole:t.models.defaultRole}:{},...n?.roles?{roles:n.roles}:{},...r?{imageModel:r}:{},...i?{imageGenerationModel:i}:{},...a?{policy:a}:{}};return Object.keys(o).length>0?o:null}function Me(e){return e.trim()?JSON.parse(e):void 0}function $(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e))}catch{return`!invalid:${e}`}}function Ne(e){let t=Object.fromEntries(Object.entries(e.toolPolicies).toSorted(([e],[t])=>e.localeCompare(t))),n=Me(e.jsonFields.mcp);return Object.keys(t).length>0||n?{builtin:t,...n?{mcp:n}:{}}:null}function Pe(e){return Object.fromEntries(Object.entries(e??{}).toSorted(([e],[t])=>e.localeCompare(t)))}function Fe(e){if(e.skillMode===`inherit`)return null;let t=[...e.skillPick].toSorted((e,t)=>e.localeCompare(t));return e.skillMode===`allowlist`?{mode:`allowlist`,allow:t}:e.skillMode===`denylist`?{mode:`denylist`,deny:t}:{mode:e.skillMode}}function Ie(e,t){return{id:e.id.trim(),name:e.name.trim(),description:e.description.trim(),models:je(e,t),tools:{builtin:Pe(e.toolPolicies),mcp:$(e.jsonFields.mcp)},skills:Fe(e),extends:[...e.extendsIds].toSorted(),workflows:$(e.jsonFields.workflows),boundaries:$(e.jsonFields.boundaries),runtime:$(e.jsonFields.runtime),locks:$(e.jsonFields.locks)}}function Le(e){return e?{id:e.id,name:e.name,description:e.description??``,models:e.models??null,tools:{builtin:Pe(e.tools?.builtin),mcp:$(Q(e.tools?.mcp))},skills:e.skills??null,extends:[...e.extends??[]].toSorted(),workflows:$(Q(e.workflows)),boundaries:$(Q(e.boundaries)),runtime:$(Q(e.runtime)),locks:$(Q(e.locks))}:null}function Re(e,t){return[e.models?.roles?t.summaryModels.replace(`{{count}}`,String(Object.keys(e.models.roles).length)):``,e.tools?.builtin?t.summaryTools.replace(`{{count}}`,String(Object.keys(e.tools.builtin).length)):``,e.skills?t.summarySkills.replace(`{{mode}}`,t.skillModeLabels[e.skills.mode]):``].filter(Boolean).join(` · `)||t.summaryEmpty}function ze(){return{modelAdvanced:X(),extendsIds:[],jsonFields:De()}}function Be(e,t){return{extends:[...e.extendsIds],models:je(e,t)??void 0,tools:Ne(e)??void 0,skills:Fe(e)??void 0,workflows:Me(e.jsonFields.workflows),boundaries:Me(e.jsonFields.boundaries),runtime:Me(e.jsonFields.runtime),locks:Me(e.jsonFields.locks)}}function Ve(e,t){return e===`safe-coder`?{id:`safe-coder`,name:t.starters[`safe-coder`].title,description:t.starters[`safe-coder`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`code`,model:``,fallbacks:[],description:t.modelRoleDescriptions.code},{id:`review`,model:``,fallbacks:[],description:t.modelRoleDescriptions.review}],toolPolicies:{exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`allowlist`,skillPick:new Set([`diagnose`,`tdd`]),...ze()}:e===`read-only`?{id:`read-only-research`,name:t.starters[`read-only`].title,description:t.starters[`read-only`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast}],toolPolicies:{write_file:{mode:`deny`},apply_patch:{mode:`deny`},exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`all`,skillPick:new Set,...ze()}:e===`low-cost`?{id:`low-cost-assistant`,name:t.starters[`low-cost`].title,description:t.starters[`low-cost`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast},{id:`cheap`,model:``,fallbacks:[],description:t.modelRoleDescriptions.cheap}],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}:{id:``,name:``,description:``,modelRows:[],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}}function He(){let e=o(c(e=>e.language)),t=e.capabilityPresetsSettings,n=!!s(e=>e.token),{data:r,error:u,isLoading:D,mutate:N}=l(n?`settings-capability-presets`:null,ce,{revalidateOnFocus:!1}),{data:F=[],isLoading:se}=l(n?`settings-capability-presets-skills-catalog`:null,g,{revalidateOnFocus:!1}),[le,fe]=i(),[R,z]=(0,B.useState)(``),[V,U]=(0,B.useState)(`overview`),[W,G]=(0,B.useState)(()=>Ve(`blank`,t)),[K,he]=(0,B.useState)(!1),[ge,q]=(0,B.useState)(null),[_e,ve]=(0,B.useState)(null),be=r?.presets??[],xe=r?.defaultPresetId??`default`,J=be.find(e=>e.id===xe)??null,Ce=be.filter(e=>e.id!==xe),Y=(0,B.useMemo)(()=>be.find(e=>e.id===R)??be[0]??null,[be,R]),we=!Y||W.id.trim()!==Y.id,Te=!!(Y&&Y.id===xe),Ee=JSON.stringify(Ie(W,Y))!==JSON.stringify(Le(Y)),X=Ie(W,Y),Z=Le(Y),Q=[X.id!==Z?.id||X.name!==Z?.name||X.description!==Z?.description?t.tabs.overview:``,JSON.stringify(X.models)===JSON.stringify(Z?.models)?``:t.tabs.models,JSON.stringify(X.tools)===JSON.stringify(Z?.tools)?``:t.tabs.tools,JSON.stringify(X.skills)===JSON.stringify(Z?.skills)?``:t.tabs.skills,JSON.stringify({extends:X.extends,workflows:X.workflows,boundaries:X.boundaries,runtime:X.runtime,locks:X.locks})===JSON.stringify({extends:Z?.extends,workflows:Z?.workflows,boundaries:Z?.boundaries,runtime:Z?.runtime,locks:Z?.locks})?``:t.tabs.advanced].filter(Boolean),De=ge??(u instanceof Error?u.message:null),Oe=le.get(`action`)===`new`||!!le.get(`preset`),Ae=we?t.newPreset:Y?.name??t.editorTitle,je=t=>e.agentsSettings.toolsDisableGroups[t],$=t=>t in e.agentsSettings.toolDescriptions?e.agentsSettings.toolDescriptions[t]:``;(0,B.useEffect)(()=>{if(!r||K)return;if(le.get(`action`)===`new`){let e=le.get(`starter`);z(``),G(Ve(e===`safe-coder`||e===`read-only`||e===`low-cost`?e:`blank`,t)),U(`overview`);return}let e=le.get(`preset`)?.trim(),n=e?r.presets.find(t=>t.id===e):null;if(n){z(n.id),G(ke(n)),U(le.get(`tab`)??`overview`);return}Y&&(z(Y.id),G(e=>e.id===Y.id?e:ke(Y)))},[K,r,le,Y]);function Ne(e){z(e.id),G(ke(e)),fe({preset:e.id},{replace:!0}),U(`overview`)}function Pe(e){let n=Ve(e,t);z(``),G(n),q(null),fe(e===`blank`?{action:`new`}:{action:`new`,starter:e},{replace:!0}),U(`overview`)}function Fe(){Ee&&!window.confirm(t.discardConfirm)||(fe({},{replace:!0}),q(null),G(ke(Y)),U(`overview`))}async function ze(){let e=de(W.modelRows,{invalidId:t.invalidModelRoleId,duplicateId:t.duplicateModelRoleId,invalidModel:t.invalidModelRef});if(e){q(e),U(`models`);return}for(let e of[W.modelAdvanced.imageModel,W.modelAdvanced.imageGenerationModel]){if([e.primary,...e.fallbacks.split(/\r?\n|,/)].map(e=>e.trim()).filter(Boolean).some(e=>!/^[^/\s]+\/.+/.test(e))){q(t.invalidModelRef),U(`models`);return}if(e.timeoutMs.trim()&&(!Number.isInteger(Number(e.timeoutMs))||Number(e.timeoutMs)<=0)){q(t.advancedPositiveIntegerError),U(`models`);return}}for(let e of Object.values(W.toolPolicies))if([e.limits?.maxCallsPerTurn,e.limits?.timeoutMs].filter(e=>e!==void 0).some(e=>!Number.isInteger(e)||e<=0)){q(t.advancedPositiveIntegerError),U(`tools`);return}for(let e of Object.keys(W.jsonFields))try{Me(W.jsonFields[e])}catch{q(t.advancedJsonError.replace(`{{field}}`,t.advancedFieldLabels[e])),U(`advanced`);return}he(!0),q(null);try{let e=Be(W,Y);if(we){let t=await ue({id:W.id.trim(),name:W.name.trim(),...W.description.trim()?{description:W.description.trim()}:{},...e});await N(t.presets,{revalidate:!1}),z(t.presetId),fe({preset:t.presetId},{replace:!0})}else Y&&await N(await ae(Y.id,{name:W.name.trim(),description:W.description.trim()||null,extends:e.extends??null,models:e.models??null,tools:e.tools??null,skills:e.skills??null,workflows:e.workflows??null,boundaries:e.boundaries??null,runtime:e.runtime??null,locks:e.locks??null}),{revalidate:!1})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}async function He(){if(Y&&window.confirm(t.deleteConfirm.replace(`{{name}}`,Y.name))){he(!0),q(null);try{let e=await oe(Y.id);await N(e,{revalidate:!1});let t=e.presets[0]??null;z(t?.id??``),G(ke(t)),fe(t?{preset:t.id}:{},{replace:!0})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}}return n?(0,H.jsxs)(ne,{gap:`gap-5`,className:`pb-24`,children:[(0,H.jsx)(te,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(y,{type:`button`,onClick:()=>Pe(`blank`),disabled:K,children:[(0,H.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t.newPreset]})}),De?(0,H.jsx)(`div`,{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:De}):null,D?(0,H.jsx)(re,{sections:2}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:v,title:t.newPreset,subtitle:t.editorHint}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[`blank`,`safe-coder`,`read-only`,`low-cost`].map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`min-h-28 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-sm text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Pe(e),children:[(0,H.jsx)(`span`,{className:`font-medium`,children:t.starters[e].title}),(0,H.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-fg-muted`,children:t.starters[e].description})]},e))})]}),J?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:j,title:t.globalDefaultsTitle,subtitle:t.globalDefaultsHint}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(J),className:`group rounded-lg bg-accent/5 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:J.name}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-accent`,children:t.globalDefaultsBadge})]}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-subtle`,children:J.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.globalDefaultsInherited})]}),J.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:J.description}):null,(0,H.jsx)(`div`,{className:`mt-3 text-xs text-fg-subtle`,children:Re(J,t)})]})]}):null,(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:j,title:t.listTitle,subtitle:t.listHint}),Ce.length===0?(0,H.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-4 text-sm text-fg-muted shadow-surface`,children:t.empty}):(0,H.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Ce.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(e),className:`group min-h-36 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-fg-subtle`,children:e.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.usage.length})]}),e.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:e.description}):null,(0,H.jsx)(`div`,{className:`mt-3 truncate text-xs text-fg-subtle`,children:Re(e,t)})]},e.id))})]})]}),(0,H.jsx)(h,{open:Oe,onOpenChange:e=>{e||Fe()},children:(0,H.jsxs)(x,{children:[(0,H.jsx)(p,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,k)}),(0,H.jsx)(d,{ref:ve,className:a(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,760px)] w-[min(100%-2rem,64rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,M),onOpenAutoFocus:e=>e.preventDefault(),children:(0,H.jsxs)(A,{layer:`modal`,portalContainer:_e,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(w,{className:`truncate text-base font-semibold text-fg`,children:Ae}),(0,H.jsx)(C,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:we?t.editorHint:W.id})]}),(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:a(O,`shrink-0 p-1.5 hover:bg-surface-base`),"aria-label":t.closeDialog,children:(0,H.jsx)(b,{className:`size-4`,"aria-hidden":!0})})})]}),De?(0,H.jsx)(`div`,{className:`mx-4 mt-3 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:De}):null,(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 border-b border-edge-subtle bg-surface-base px-4 py-2 dark:border-edge`,children:Se.map(({id:e,icon:n})=>(0,H.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>U(e),children:[(0,H.jsx)(n,{className:`size-4`,"aria-hidden":!0}),t.tabs[e]]},e))}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[V===`overview`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:S,title:t.overviewTitle,subtitle:t.overviewHint}),(0,H.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.idLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.id,disabled:K||!we,onChange:e=>G(t=>({...t,id:e.target.value.toLowerCase()})),placeholder:`safe-coder`})]}),!we&&Y?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.versionLabel}),(0,H.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg-muted`,children:t.versionAutomatic.replace(`{{version}}`,String(Y.version))})]}):null,(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.nameLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.name,disabled:K,onChange:e=>G(t=>({...t,name:e.target.value})),placeholder:t.namePlaceholder})]}),(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.descriptionLabel}),(0,H.jsx)(`textarea`,{className:`min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.description,disabled:K,onChange:e=>G(t=>({...t,description:e.target.value})),placeholder:t.descriptionPlaceholder})]})]}),(0,H.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,H.jsx)(Ue,{icon:j,label:t.modelsTitle,value:String(W.modelRows.length)}),(0,H.jsx)(Ue,{icon:f,label:t.toolsTitle,value:String(Object.keys(W.toolPolicies).length)}),(0,H.jsx)(Ue,{icon:P,label:t.skillsTitle,value:t.skillModeLabels[W.skillMode]})]})]}):null,V===`models`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:j,title:t.modelsTitle,subtitle:t.modelsHint}),(0,H.jsx)(ie,{rows:W.modelRows,onChange:e=>G(t=>({...t,modelRows:e})),disabled:K,defaultRole:Y?.models?.defaultRole,chat:e.chat,labels:{id:t.modelRoleIdLabel,description:t.modelRoleDescriptionLabel,primaryModel:t.modelPrimaryModelLabel,fallbackModels:t.modelFallbackModelsLabel,addFallback:t.modelAddFallback,removeFallback:t.modelRemoveFallback,fallbackPlaceholder:t.modelFallbackPlaceholder,fallbackEmptyHint:t.modelFallbackEmptyHint,add:t.addModelRole,remove:t.removeModelRole,recommendedTitle:t.modelRecommendedTitle,customTitle:t.modelCustomTitle,defaultBadge:t.modelDefaultBadge,visionBadge:t.modelVisionBadge,visionAutoHint:t.modelVisionAutoHint,addPurpose:t.addModelPurpose,noCustomRoles:t.noCustomModelRoles,idPlaceholder:`deep`,descriptionPlaceholder:t.modelRoleDescriptionPlaceholder,roleNames:t.modelRoleNames,roleDescriptions:t.modelRoleDescriptions}}),(0,H.jsx)(We,{value:W.modelAdvanced,onChange:e=>G(t=>({...t,modelAdvanced:e})),disabled:K,cp:t})]}):null,V===`tools`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:f,title:t.toolsTitle,subtitle:t.toolsHint}),(0,H.jsx)(ye,{builtinToolIds:r?.builtinToolIds??[],toolPolicies:W.toolPolicies,onChange:e=>G(t=>({...t,toolPolicies:e})),disabled:K,getToolDescription:$,getGroupTitle:je,labels:{quickActionsLabel:t.toolsQuickActionsLabel,quickClearOverrides:t.toolsQuickClearOverrides,quickReadOnlyWorkspace:t.toolsQuickReadOnlyWorkspace,quickHighRiskOff:t.toolsQuickHighRiskOff,quickNoOutbound:t.toolsQuickNoOutbound,quickResearchMode:t.toolsQuickResearchMode,quickCodingMode:t.toolsQuickCodingMode,emptyBuiltin:t.toolsEmptyBuiltin,overrideSummaryTitle:t.toolsOverrideSummaryTitle,noOverrides:t.toolsNoOverrides,inheritedMode:t.toolModes.inherit,modeAllow:t.toolModes.allow,modeConfirm:t.toolModes.confirm,modeDeny:t.toolModes.deny,scopeLabel:t.toolScopeLabel,scopeInherit:t.toolScopeInherit,scopeReadonly:t.toolScopeReadonly,scopeWorkspace:t.toolScopeWorkspace,scopeUnrestricted:t.toolScopeUnrestricted,maxCallsLabel:t.toolMaxCallsLabel,timeoutLabel:t.toolTimeoutLabel}})]}):null,V===`skills`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:P,title:t.skillsTitle,subtitle:t.skillsHint}),(0,H.jsx)(me,{mode:W.skillMode,selected:W.skillPick,catalog:F,loading:se,disabled:K,onModeChange:e=>G(t=>({...t,skillMode:e})),onSelectedChange:e=>G(t=>({...t,skillPick:e})),labels:{modeLabel:t.skillsModeLabel,modeInherit:t.skillsModeInherit,modeAll:t.skillsModeAll,modeAllowlist:t.skillsModeAllowlist,modeDenylist:t.skillsModeDenylist,modeOff:t.skillsModeOff,quickActionsLabel:t.skillsQuickActionsLabel,quickSelectAll:t.skillsQuickSelectAll,quickClear:t.skillsQuickClear,catalogLoading:t.skillsCatalogLoading,emptyCatalog:t.skillsEmptyCatalog,noDescription:t.skillsNoDescription,overrideSummaryTitle:t.skillsOverrideSummaryTitle,inheritSummary:t.skillsInheritSummary,allSummary:t.skillsAllSummary,offSummary:t.skillsOffSummary,allowSummary:t.skillsAllowSummary,denySummary:t.skillsDenySummary}})]}):null,V===`advanced`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:E,title:t.advancedTitle,subtitle:t.advancedHint}),(0,H.jsx)(pe,{extendsIds:W.extendsIds,onExtendsChange:e=>G(t=>({...t,extendsIds:e})),presetOptions:be.filter(e=>e.id!==Y?.id&&e.id!==xe),jsonFields:W.jsonFields,onJsonFieldsChange:e=>G(t=>({...t,jsonFields:e})),disabled:K,labels:{inheritanceTitle:t.advancedInheritanceTitle,inheritanceHint:t.advancedInheritanceHint,inheritanceEmpty:t.advancedInheritanceEmpty,jsonTitle:t.advancedJsonTitle,jsonHint:t.advancedJsonHint,fieldLabels:t.advancedFieldLabels,fieldHints:t.advancedFieldHints}})]}):null,V===`impact`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:m,title:t.usageTitle,subtitle:t.usageHint}),(0,H.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.changePreviewTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Q.length>0?t.changePreviewSections.replace(`{{sections}}`,Q.join(`、`)):t.changePreviewEmpty})]}),Y?.usage.length?(0,H.jsx)(`div`,{className:`grid gap-2`,children:Y.usage.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.agentName||e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-muted`,children:e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,children:e.direct?t.usageDirect:t.usageIndirect})]},e.agentId))}):(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUsage})]}):null]})}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-medium text-fg`,children:Ee?t.unsavedTitle:t.noUnsavedTitle}),(0,H.jsx)(`div`,{className:`text-xs text-fg-muted`,children:Ee?(Y?.usage.length??0)>0?t.unsavedImpact.replace(`{{count}}`,String(Y?.usage.length??0)):t.unsavedNoImpact:t.noUnsavedHint})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ee?(0,H.jsx)(y,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>G(ke(Y)),children:t.discard}):null,Y&&!Te?(0,H.jsxs)(y,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void He(),children:[(0,H.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.delete]}):null,(0,H.jsxs)(y,{type:`button`,disabled:K||!W.id.trim()||!W.name.trim()||!Ee,onClick:()=>void ze(),children:[(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t.savePreset]})]})]})]})})]})})]}):(0,H.jsxs)(ne,{gap:`gap-3`,children:[(0,H.jsx)(te,{title:t.title}),(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]})}function Ue(e){let t=(0,V.c)(10),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,H.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==a?(o=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[a,r]}),t[2]=r,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,H.jsx)(`div`,{className:`mt-1 text-sm font-medium text-fg`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function We(e){let t=(0,V.c)(77),{value:n,onChange:r,disabled:i,cp:a}=e,o;t[0]!==r||t[1]!==n?(o=(e,t)=>{r({...n,[e]:t})},t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]===a.modelAdvancedTitle?c=t[4]:(c=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:a.modelAdvancedTitle}),t[3]=a.modelAdvancedTitle,t[4]=c);let l;t[5]===a.modelAdvancedHint?l=t[6]:(l=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:a.modelAdvancedHint}),t[5]=a.modelAdvancedHint,t[6]=l);let d;t[7]===s?d=t[8]:(d=e=>s(`imageModel`,e),t[7]=s,t[8]=d);let f;t[9]!==a||t[10]!==i||t[11]!==d||t[12]!==n.imageModel?(f=(0,H.jsx)(Ge,{title:a.imageUnderstandingTitle,value:n.imageModel,onChange:d,disabled:i,cp:a}),t[9]=a,t[10]=i,t[11]=d,t[12]=n.imageModel,t[13]=f):f=t[13];let p;t[14]===s?p=t[15]:(p=e=>s(`imageGenerationModel`,e),t[14]=s,t[15]=p);let m;t[16]!==a||t[17]!==i||t[18]!==p||t[19]!==n.imageGenerationModel?(m=(0,H.jsx)(Ge,{title:a.imageGenerationTitle,value:n.imageGenerationModel,onChange:p,disabled:i,cp:a}),t[16]=a,t[17]=i,t[18]=p,t[19]=n.imageGenerationModel,t[20]=m):m=t[20];let h;t[21]!==f||t[22]!==m?(h=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[f,m]}),t[21]=f,t[22]=m,t[23]=h):h=t[23];let g;t[24]===a.modelAllowFallbacksLabel?g=t[25]:(g=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelAllowFallbacksLabel}),t[24]=a.modelAllowFallbacksLabel,t[25]=g);let _;t[26]!==r||t[27]!==n?(_=e=>r({...n,allowFallbacks:e.target.value}),t[26]=r,t[27]=n,t[28]=_):_=t[28];let v;t[29]===a.policyInherit?v=t[30]:(v=(0,H.jsx)(N,{value:``,children:a.policyInherit}),t[29]=a.policyInherit,t[30]=v);let y;t[31]===a.policyEnabled?y=t[32]:(y=(0,H.jsx)(N,{value:`true`,children:a.policyEnabled}),t[31]=a.policyEnabled,t[32]=y);let b;t[33]===a.policyDisabled?b=t[34]:(b=(0,H.jsx)(N,{value:`false`,children:a.policyDisabled}),t[33]=a.policyDisabled,t[34]=b);let x;t[35]!==i||t[36]!==v||t[37]!==y||t[38]!==b||t[39]!==_||t[40]!==n.allowFallbacks?(x=(0,H.jsxs)(u,{value:n.allowFallbacks,disabled:i,onChange:_,children:[v,y,b]}),t[35]=i,t[36]=v,t[37]=y,t[38]=b,t[39]=_,t[40]=n.allowFallbacks,t[41]=x):x=t[41];let S;t[42]!==x||t[43]!==g?(S=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[g,x]}),t[42]=x,t[43]=g,t[44]=S):S=t[44];let C;t[45]===a.modelMaxCostTierLabel?C=t[46]:(C=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelMaxCostTierLabel}),t[45]=a.modelMaxCostTierLabel,t[46]=C);let w;t[47]!==r||t[48]!==n?(w=e=>r({...n,maxCostTier:e.target.value}),t[47]=r,t[48]=n,t[49]=w):w=t[49];let T;t[50]===a.policyInherit?T=t[51]:(T=(0,H.jsx)(N,{value:``,children:a.policyInherit}),t[50]=a.policyInherit,t[51]=T);let E;t[52]===a.costTierLow?E=t[53]:(E=(0,H.jsx)(N,{value:`low`,children:a.costTierLow}),t[52]=a.costTierLow,t[53]=E);let D;t[54]===a.costTierMedium?D=t[55]:(D=(0,H.jsx)(N,{value:`medium`,children:a.costTierMedium}),t[54]=a.costTierMedium,t[55]=D);let O;t[56]===a.costTierHigh?O=t[57]:(O=(0,H.jsx)(N,{value:`high`,children:a.costTierHigh}),t[56]=a.costTierHigh,t[57]=O);let k;t[58]!==i||t[59]!==w||t[60]!==T||t[61]!==E||t[62]!==D||t[63]!==O||t[64]!==n.maxCostTier?(k=(0,H.jsxs)(u,{value:n.maxCostTier,disabled:i,onChange:w,children:[T,E,D,O]}),t[58]=i,t[59]=w,t[60]=T,t[61]=E,t[62]=D,t[63]=O,t[64]=n.maxCostTier,t[65]=k):k=t[65];let A;t[66]!==C||t[67]!==k?(A=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,k]}),t[66]=C,t[67]=k,t[68]=A):A=t[68];let j;t[69]!==S||t[70]!==A?(j=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-panel/70 p-3 shadow-surface sm:grid-cols-2`,children:[S,A]}),t[69]=S,t[70]=A,t[71]=j):j=t[71];let M;return t[72]!==c||t[73]!==l||t[74]!==j||t[75]!==h?(M=(0,H.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-5 dark:border-edge`,children:[c,l,h,j]}),t[72]=c,t[73]=l,t[74]=j,t[75]=h,t[76]=M):M=t[76],M}function Ge(e){let t=(0,V.c)(64),{title:n,value:r,onChange:i,disabled:o,cp:s}=e,c;t[0]===n?c=t[1]:(c=(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=c);let l=s.modelToolPrimaryLabel,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`font-mono text-xs`),t[2]=d):d=t[2];let f;t[3]!==i||t[4]!==r?(f=e=>i({...r,primary:e.target.value}),t[3]=i,t[4]=r,t[5]=f):f=t[5];let p;t[6]!==o||t[7]!==f||t[8]!==r.primary?(p=(0,H.jsx)(`input`,{className:d,value:r.primary,disabled:o,placeholder:`provider/model`,onChange:f}),t[6]=o,t[7]=f,t[8]=r.primary,t[9]=p):p=t[9];let m;t[10]!==s.modelToolPrimaryLabel||t[11]!==p?(m=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l,p]}),t[10]=s.modelToolPrimaryLabel,t[11]=p,t[12]=m):m=t[12];let h=s.modelToolFallbacksLabel,g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`min-h-20 resize-y font-mono text-xs`),t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==r?(_=e=>i({...r,fallbacks:e.target.value}),t[14]=i,t[15]=r,t[16]=_):_=t[16];let v;t[17]!==s.modelToolFallbacksPlaceholder||t[18]!==o||t[19]!==_||t[20]!==r.fallbacks?(v=(0,H.jsx)(`textarea`,{className:g,value:r.fallbacks,disabled:o,placeholder:s.modelToolFallbacksPlaceholder,onChange:_}),t[17]=s.modelToolFallbacksPlaceholder,t[18]=o,t[19]=_,t[20]=r.fallbacks,t[21]=v):v=t[21];let y;t[22]!==s.modelToolFallbacksLabel||t[23]!==v?(y=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[h,v]}),t[22]=s.modelToolFallbacksLabel,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==i||t[26]!==r?(b=e=>i({...r,timeoutMs:e.target.value}),t[25]=i,t[26]=r,t[27]=b):b=t[27];let x;t[28]!==o||t[29]!==b||t[30]!==r.timeoutMs?(x=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:r.timeoutMs,disabled:o,onChange:b}),t[28]=o,t[29]=b,t[30]=r.timeoutMs,t[31]=x):x=t[31];let S;t[32]!==s.toolTimeoutLabel||t[33]!==x?(S=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.toolTimeoutLabel,x]}),t[32]=s.toolTimeoutLabel,t[33]=x,t[34]=S):S=t[34];let C;t[35]!==i||t[36]!==r?(C=e=>i({...r,autoProviderFallback:e.target.value}),t[35]=i,t[36]=r,t[37]=C):C=t[37];let w;t[38]===s.policyInherit?w=t[39]:(w=(0,H.jsx)(N,{value:``,children:s.policyInherit}),t[38]=s.policyInherit,t[39]=w);let T;t[40]===s.policyEnabled?T=t[41]:(T=(0,H.jsx)(N,{value:`true`,children:s.policyEnabled}),t[40]=s.policyEnabled,t[41]=T);let E;t[42]===s.policyDisabled?E=t[43]:(E=(0,H.jsx)(N,{value:`false`,children:s.policyDisabled}),t[42]=s.policyDisabled,t[43]=E);let D;t[44]!==o||t[45]!==C||t[46]!==w||t[47]!==T||t[48]!==E||t[49]!==r.autoProviderFallback?(D=(0,H.jsxs)(u,{value:r.autoProviderFallback,disabled:o,onChange:C,children:[w,T,E]}),t[44]=o,t[45]=C,t[46]=w,t[47]=T,t[48]=E,t[49]=r.autoProviderFallback,t[50]=D):D=t[50];let O;t[51]!==s.modelAutoProviderFallbackLabel||t[52]!==D?(O=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.modelAutoProviderFallbackLabel,D]}),t[51]=s.modelAutoProviderFallbackLabel,t[52]=D,t[53]=O):O=t[53];let k;t[54]!==S||t[55]!==O?(k=(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[S,O]}),t[54]=S,t[55]=O,t[56]=k):k=t[56];let A;t[57]!==y||t[58]!==k||t[59]!==m?(A=(0,H.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[m,y,k]}),t[57]=y,t[58]=k,t[59]=m,t[60]=A):A=t[60];let j;return t[61]!==c||t[62]!==A?(j=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 p-3 shadow-surface`,children:[c,A]}),t[61]=c,t[62]=A,t[63]=j):j=t[63],j}export{He as CapabilityPresetsSettingsPanel};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./locale-store-CPbGB_6l.js";function n(e,t){let n=Date.now()-new Date(e).getTime();return n<6e4?t.justNow:n<36e5?t.minutesAgo.replace(`{{count}}`,String(Math.floor(n/6e4))):n<864e5?t.hoursAgo.replace(`{{count}}`,String(Math.floor(n/36e5))):n<6048e5?t.daysAgo.replace(`{{count}}`,String(Math.floor(n/864e5))):new Date(e).toLocaleDateString()}function r(e,t){let r=n(e.lastActive,t);return e.channel===`telegram`&&e.peerId?`${e.accountId??`default`} · ${e.peerKind??``} · ${e.peerId} · ${r}`:`${e.channel}: ${e.chatId} · ${r}`}async function i(){return(await t(e(`/api/channels/status`))).payload?.channels||[]}async function a(n){return(await t(e(`/api/sessions/chat-ids${n?`?channel=${encodeURIComponent(n)}`:``}`))).payload?.chatIds||[]}export{i as n,a as r,r as t};
1
+ import{r as e,s as t}from"./locale-store-Dar-xqQr.js";function n(e,t){let n=Date.now()-new Date(e).getTime();return n<6e4?t.justNow:n<36e5?t.minutesAgo.replace(`{{count}}`,String(Math.floor(n/6e4))):n<864e5?t.hoursAgo.replace(`{{count}}`,String(Math.floor(n/36e5))):n<6048e5?t.daysAgo.replace(`{{count}}`,String(Math.floor(n/864e5))):new Date(e).toLocaleDateString()}function r(e,t){let r=n(e.lastActive,t);return e.channel===`telegram`&&e.peerId?`${e.accountId??`default`} · ${e.peerKind??``} · ${e.peerId} · ${r}`:`${e.channel}: ${e.chatId} · ${r}`}async function i(){return(await t(e(`/api/channels/status`))).payload?.channels||[]}async function a(n){return(await t(e(`/api/sessions/chat-ids${n?`?channel=${encodeURIComponent(n)}`:``}`))).payload?.chatIds||[]}export{i as n,a as r,r as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./circle-alert-RzVebuX2.js";import{t as c}from"./messages-DDsiqdJS.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-CPbGB_6l.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ar as h,Bo as g,Fl as _,Ho as v,Ka as y,Kc as b,Ls as x,Qi as S,Qo as C,Ro as w,Ss as T,Ts as E,Uo as D,Vo as O,Wo as k,Xa as A,Xr as j,Yr as M,Za as N,Zr as P,ac as F,bo as I,ct as L,hs as ee,is as te,ns as R,pc as z,qs as B,rs as V,ru as ne,vc as re,zo as ie}from"./index-CHKe7nwC.js";import{n as ae,r as oe}from"./settings-page-layout-Cv_Cu4I5.js";import{n as se}from"./settings-loading-skeleton-D05YKT2x.js";import{t as ce}from"./schema-form-AuJg2CXU.js";import{t as le}from"./browser-BLJWD7WI.js";import{n as ue,t as de}from"./channels-status-swr-Cqfqv59m.js";import{t as fe}from"./use-channel-catalog-CZnaMOeL.js";var H=e(t(),1),U=n();function pe(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}var me=e(le(),1),W=r();async function he(e){let t=await d(f(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function G(e){return e?.type===`poll`&&e.phase===`done`}function K(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function q(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function J(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function ge({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,H.useMemo)(()=>pe(e),[e]),s=(0,H.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,H.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,H.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,H.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await he({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,H.useEffect)(()=>{let t=q(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),me.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,H.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||he({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:G(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),G(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=K(c.payload),m=q(c.payload,e.id),h=m?c.generatedQr:J(c.payload),g=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),v=c.payload?.type===`form`?c.payload:null,y=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,W.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:o(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,W.jsxs)(T,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,W.jsx)(b,{className:`size-4 animate-spin`}):(0,W.jsx)(re,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,W.jsxs)(T,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,W.jsx)(B,{className:`size-4`}),f]}):null]})]}),p?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,g?(0,W.jsxs)(`div`,{className:o(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base p-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,W.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,W.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,W.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,W.jsx)(A,{className:`size-48 rounded-md`})})}),(0,W.jsxs)(`div`,{className:o(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,W.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,W.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,W.jsx)(A,{className:`h-4 w-48 max-w-full`}),(0,W.jsx)(A,{className:`h-4 w-36 max-w-full`})]}),m?(0,W.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,W.jsx)(_,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,W.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,W.jsx)(ne,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,W.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,v?(0,W.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,W.jsx)(ce,{schema:v.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:s}),(0,W.jsx)(T,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(v.submitAction,c.formDraft),children:n.saveSetup})]}):null,y?(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var _e=40;function Y(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ve(e,t){return e.find(e=>e.id===Y(t))?.agentId?.trim().toLowerCase()??``}function ye(e,t,n){let r=Y(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:_e,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function be(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function xe(e,t,n){let r=be(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Se(e,t=!1){return e===`drawer`?o(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,V):o(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,V,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function Ce(e){let t=(0,U.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,h=p===void 0?!1:p,_=n===`drawer`,[y,b]=(0,H.useState)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,W.jsx)(v,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,te)}),t[0]=x):x=t[0];let S;t[1]!==n||t[2]!==h?(S=Se(n,h),t[1]=n,t[2]=h,t[3]=S):S=t[3];let C;t[4]===c?C=t[5]:(C=c?(0,W.jsx)(k,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=C);let A;t[6]===l?A=t[7]:(A=l?(0,W.jsx)(O,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=A);let j;t[8]!==u||t[9]!==s||t[10]!==m||t[11]!==_||t[12]!==a?(j=_?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,W.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,s?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,W.jsx)(E,{className:`size-5`,strokeWidth:1.75})})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:o(ee,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,W.jsx)(E,{className:`size-4`})})}),m]}),t[8]=u,t[9]=s,t[10]=m,t[11]=_,t[12]=a,t[13]=j):j=t[13];let M=_?`p-4`:`p-6`,N;t[14]===M?N=t[15]:(N=o(`min-h-0 flex-1 overflow-y-auto`,M),t[14]=M,t[15]=N);let P;t[16]!==d||t[17]!==N?(P=(0,W.jsx)(`div`,{className:N,children:d}),t[16]=d,t[17]=N,t[18]=P):P=t[18];let F;t[19]!==f||t[20]!==y||t[21]!==C||t[22]!==A||t[23]!==j||t[24]!==P?(F=(0,W.jsxs)(R,{layer:`modal`,portalContainer:y,children:[C,A,j,P,f]}),t[19]=f,t[20]=y,t[21]=C,t[22]=A,t[23]=j,t[24]=P,t[25]=F):F=t[25];let I;t[26]!==F||t[27]!==S?(I=(0,W.jsxs)(D,{children:[x,(0,W.jsx)(g,{ref:b,className:S,onOpenAutoFocus:we,children:F})]}),t[26]=F,t[27]=S,t[28]=I):I=t[28];let L;return t[29]!==i||t[30]!==r||t[31]!==I?(L=(0,W.jsx)(w,{open:r,onOpenChange:i,children:I}),t[29]=i,t[30]=r,t[31]=I,t[32]=L):L=t[32],L}function we(e){return e.preventDefault()}var Te=(0,H.memo)(function(e){let t=(0,U.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,W.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,W.jsx)(S,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,W.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function Ee(e){let t=(0,U.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,W.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,W.jsx)(T,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,W.jsx)(T,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,W.jsx)(T,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,W.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,W.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var De=`channels-status`;function Oe(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function ke(e){let t=t=>e(t.detail);return window.addEventListener(De,t),()=>window.removeEventListener(De,t)}function Ae(e,t){let n=(0,U.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return ke(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,H.useEffect)(i,a)}function je(e){return e?f(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Me(e){return(await p(f(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Ne=[`enabled`];async function Pe(){let e=await p(f(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Fe(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Ie(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function X(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Le(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function Re(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function ze(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Be(e){if(!e)return[];let t=e.uiHints??{},n=Z(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=X(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!Z(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Ne.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Ne.includes(e))}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ve(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Ve(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!Z(r)||!Z(r[n]))break;let o=Z(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Ve(r[n]),properties:{}}),e===t.length-1){o[n]=Ve(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!Z(t))return!1;for(let[e,n]of Object.entries(t))Z(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Ve(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!Z(i))break;if(e===t.length-1){delete i[n];break}if(!Z(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&Z(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!Z(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return Z(t)?Object.values(t).filter(e=>Z(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=X(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=X(e),r=pe(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=pe(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=l(e=>e.token),[n,r]=(0,H.useState)(!1),i=(0,H.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(f(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Fe(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,W.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,W.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,W.jsx)(N,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,U.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,s;t[0]===i?s=t[1]:(s=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=s);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=o(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=o(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,W.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==u||t[14]!==p?(m=(0,W.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:s,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=s,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,U.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:s,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=X(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,x;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),s=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,W.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let b;t[21]===n.label?b=t[22]:(b=(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=b);let S;t[23]===i?S=t[24]:(S=o(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,ze(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Le(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,W.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==b?(T=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[b,w]}),t[31]=w,t[32]=b,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,W.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(x=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=x):x=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,W.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),s.length>0?(0,W.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:s.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=x}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],x=t[18];let S;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(S=(0,W.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=S):S=t[52];let C=a||s,w;t[53]!==a||t[54]!==s?(w=a||s?(0,W.jsx)(b,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=s,t[55]=w):w=t[55];let E;t[56]!==c||t[57]!==n||t[58]!==s||t[59]!==i?(E=s?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=s,t[59]=i,t[60]=E):E=t[60];let D;t[61]!==m||t[62]!==w||t[63]!==E||t[64]!==C?(D=(0,W.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,W.jsxs)(T,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:C,children:[w,E]})}),t[61]=m,t[62]=w,t[63]=E,t[64]=C,t[65]=D):D=t[65];let O;return t[66]!==D||t[67]!==y||t[68]!==x||t[69]!==S?(O=(0,W.jsxs)(`article`,{className:y,children:[x,S,D]}),t[66]=D,t[67]=y,t[68]=x,t[69]=S,t[70]=O):O=t[70],O}function nt(e){return(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,W.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,U.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?ne:n===`stopped`||n===`needs_setup`?s:b,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=o(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let x;t[6]!==p||t[7]!==y?(x=(0,W.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=x):x=t[8];let S;t[9]===l.connectionStatus?S=t[10]:(S=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=S);let C;t[11]!==l||t[12]!==n?(C=Re(n,l),t[11]=l,t[12]=n,t[13]=C):C=t[13];let w;t[14]===C?w=t[15]:(w=(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[14]=C,t[15]=w);let E;t[16]!==w||t[17]!==S?(E=(0,W.jsxs)(`div`,{children:[S,w]}),t[16]=w,t[17]=S,t[18]=E):E=t[18];let D;t[19]!==E||t[20]!==x?(D=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[x,E]}),t[19]=E,t[20]=x,t[21]=D):D=t[21];let O=i||r,k;t[22]===i?k=t[23]:(k=i?(0,W.jsx)(b,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=k);let A=i?l.checkingConnection:l.checkConnection,j;t[24]!==d||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,W.jsxs)(T,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:O,onClick:d,children:[k,A]}),t[24]=d,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(M=n===`stopped`?(0,W.jsxs)(T,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,W.jsx)(b,{className:`size-4 animate-spin`}):(0,W.jsx)(z,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=M):M=t[35];let N;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(N=c?(0,W.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=N):N=t[43];let P;t[44]!==j||t[45]!==M||t[46]!==N?(P=(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[j,M,N]}),t[44]=j,t[45]=M,t[46]=N,t[47]=P):P=t[47];let F;return t[48]!==D||t[49]!==P?(F=(0,W.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[D,P]})}),t[48]=D,t[49]=P,t[50]=F):F=t[50],F}function at(e){let t=(0,U.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=X(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(x,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,W.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,W.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,W.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,W.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,W.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,W.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,W.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ot(){let e=u(e=>e.language),t=c(e),n=l(e=>!!e.token),r=i(),{channelId:s}=a(),p=P(s),g=fe(n,e),v=g.entries,{data:b,mutate:x,isValidating:S}=m(n?de():null,ue,{revalidateOnFocus:!0}),{data:w,mutate:T}=m(n?`channels-config-map`:null,Pe,{revalidateOnFocus:!1}),E=w?.channels??{},D=w?.bindings??[],{data:O}=m(n?`channel-routing-agents`:null,y,{revalidateOnFocus:!1}),k=I(e=>e.setPageHeader),A=I(e=>e.clearPageHeader),N=(0,H.useMemo)(()=>v.find(e=>e.id===p),[p,v]),ee=N?Ie(N):null,{data:te,mutate:R}=m(n&&ee?je(ee):null,()=>Me(ee)),[z,B]=(0,H.useState)(null),[V,ne]=(0,H.useState)(!1),[re,ie]=(0,H.useState)(null),[le,U]=(0,H.useState)(null),[me,he]=(0,H.useState)(!1),[G,K]=(0,H.useState)(null),[q,J]=(0,H.useState)(null),_e=z??te??{},Y=t.channelsSettings,be=(0,H.useMemo)(()=>N?.configSchema??{type:`object`,properties:{}},[N?.configSchema]),Se=(0,H.useMemo)(()=>We(be,Ne),[be]),we=(0,H.useMemo)(()=>Be(N),[N]),De=(0,H.useMemo)(()=>He(Se,we),[we,Se]),ke=(0,H.useMemo)(()=>We(Se,we),[we,Se]),Fe=(0,H.useMemo)(()=>Ge(De),[De]),Re=N?q??ve(D,N.id):``,Z=(0,H.useMemo)(()=>(O?.items??[]).map(e=>{let n=h(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[O?.items,t.agentsSettings]),Ve=O?.items.find(e=>e.id===O.defaultId),Ue=Ve?h(Ve,t.agentsSettings):O?.defaultId??``,Ke=(0,H.useMemo)(()=>({defaultBooleanLabel:Y.schemaBooleanDefault,unsupportedArrayType:Y.schemaUnsupportedArrayType,arrayAddPlaceholder:Y.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>Y.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[Y]),qe=(0,H.useMemo)(()=>new Map((b??[]).map(e=>[e.name,e])),[b]),Je=b!==void 0,Ye=(0,H.useCallback)(e=>xe(e,qe.get(e.id),Je),[qe,Je]),Q=(0,H.useCallback)(async()=>{await Promise.all([g.mutate(),x()])},[g,x]);Ae((0,H.useCallback)(e=>{let t=Oe(e);t&&x(t,!1)},[x]),n);let Xe=(0,H.useMemo)(()=>n?(0,W.jsx)(Te,{ch:Y,refreshing:g.isValidating||S,saveOk:!1,onRefresh:()=>void Q()}):null,[g.isValidating,Y,n,S,Q]);(0,H.useLayoutEffect)(()=>(k({startExtra:null,main:(0,W.jsx)(`div`,{className:`min-w-0`,children:(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>A()),[A,Xe,t.settingsSections.channels,k]);let Ze=(0,H.useCallback)(e=>{r(j(e)),B(null),J(null),K(null)},[r]),Qe=(0,H.useCallback)(()=>{r(M),B(null),J(null),K(null)},[r]),nt=(0,H.useCallback)(async e=>{U(e.id),K(null);try{let t=await d(f(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){K(e instanceof Error?e.message:String(e))}finally{U(null)}},[Q]);(0,H.useEffect)(()=>{J(null),he(!1)},[N?.id]);let rt=(0,H.useCallback)(async()=>{if(!N||!z&&q===null)return!1;let e=Ie(N);ne(!0),K(null);try{let t=await d(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({...z?{channels:{[e]:z}}:{},...q===null?{}:{bindings:ye(D,N.id,q)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return z&&await R(z,!1),await T(),await g.mutate(),B(null),J(null),!0}catch(e){return K(e instanceof Error?e.message:String(e)),!1}finally{ne(!1)}},[N,q,D,g,z,T,R]),ot=(0,H.useCallback)(async e=>{let t=X(e),n=Ie(e),r=N?.id===e.id?z:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}ie(e.id),K(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await d(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await g.mutate(),await T(),await x(),N?.id===e.id&&(await R(),B(null))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ie(null)}},[N?.id,g,z,T,R,x,Ze]),$=N?.ui?.modal,st=$?.placement!==`replace-config`,ct=N?Ye(N):`checking`,lt=N?!X(N).ready||me:!1;return n?(0,W.jsxs)(oe,{gap:`gap-4`,children:[g.isLoading?(0,W.jsx)(se,{sections:2}):g.error?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(g.error)}):(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:v.map(e=>(0,W.jsx)(tt,{entry:e,config:E[Ie(e)]?.config,runtime:Ye(e),busy:re===e.id,restarting:le===e.id,ch:Y,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),G?(0,W.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:G}):null,(0,W.jsx)(Ce,{presentation:`modal`,open:!!N,onOpenChange:e=>{e||Qe()},closeAriaLabel:Y.close,srTitle:N?.label??Y.selectChannel,srDescription:N?.description,wide:!0,footer:N?(0,W.jsx)(Ee,{ch:Y,dirty:!!z||q!==null,saving:V,onCancel:Qe,onDiscard:()=>{B(null),J(null)},onSave:rt}):null,children:N?(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,W.jsx)($e,{entry:N}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:N.label}),(0,W.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ze(ct)),children:Le(ct,Y)})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:!X(N).ready&&pe(N)?.[1].result===`qr`?Y.scanLoginHint.replace(`{{channel}}`,N.label):N.description}),N.docsPath?(0,W.jsxs)(`a`,{href:N.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[Y.docs,(0,W.jsx)(_,{className:`size-3.5`})]}):null]})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,W.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:X(N).enabled?Y.enabledLabel:Y.disabledLabel}),(0,W.jsx)(et,{checked:X(N).enabled,disabled:re===N.id,label:Y.toggleChannel.replace(`{{channel}}`,N.label),onToggle:()=>void ot(N)})]})]})}),(0,W.jsx)(it,{runtime:ct,restarting:le===N.id,checking:S,showConnectionOptions:me,canManageConnection:X(N).ready&&$?.placement!==`replace-config`,ch:Y,onRestart:()=>void nt(N),onCheck:()=>void Q(),onManageConnection:()=>he(e=>!e)}),(0,W.jsx)(at,{entry:N,ch:Y}),lt&&$?.placement!==`replace-config`?(0,W.jsx)(ge,{entry:N,locale:e,messages:Y,compact:!0,onChanged:async()=>{await R(),await Q(),await T()}},N.id):null,$?.entrypoint&&$.placement===`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:_e}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:_e}}):null,st&&Fe?(0,W.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:Y.basicConfiguration}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y.basicConfigurationHint})]}),(0,W.jsx)(ce,{schema:De,values:_e,onChange:e=>B(e),disabled:V,labels:Ke})]}):null,(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(F,{className:`size-4 text-fg-muted`}),Y.messageHandling]}),(0,W.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,W.jsxs)(`div`,{className:`mb-3`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:Y.agentRouting}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y.messageHandlingHint})]}),(0,W.jsx)(C,{value:Re,options:Z,placeholder:Y.agentRoutingSelect,emptyLabel:Y.agentRoutingDefault.replace(`{{agent}}`,Ue||Y.agentRoutingSelect),ariaLabel:Y.agentRouting,disabled:V||!O,onChange:e=>J(e)})]})]}),st&&Ge(ke)?(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(F,{className:`size-4 text-fg-muted`}),Y.advancedConfiguration]}),(0,W.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,W.jsx)(ce,{schema:ke,values:_e,onChange:e=>B(e),disabled:V,labels:Ke})})]}):null,G?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:G}):null]}):null})]}):(0,W.jsxs)(oe,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,W.jsx)(ae,{title:t.settingsSections.channels}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Y.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CxySDn9d.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-Dar-xqQr.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ar as h,Bo as g,Fl as _,Ho as v,Ka as y,Kc as b,Ls as x,Qi as S,Qo as C,Ro as w,Ss as T,Ts as E,Uo as D,Vo as O,Wo as k,Xa as A,Xr as j,Yr as M,Za as N,Zr as P,ac as F,bo as I,ct as L,hs as ee,is as te,ns as R,pc as z,qs as B,rs as V,ru as ne,vc as re,zo as ie}from"./index-vq_cJZJC.js";import{n as ae,r as oe}from"./settings-page-layout-DWvNgISx.js";import{n as se}from"./settings-loading-skeleton-DkvwitK_.js";import{t as ce}from"./schema-form-DC-iU5IG.js";import{t as le}from"./browser-BLJWD7WI.js";import{n as ue,t as de}from"./channels-status-swr-CIOH7tgn.js";import{t as fe}from"./use-channel-catalog-BDU6FneG.js";var H=e(t(),1),U=n();function pe(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}var me=e(le(),1),W=r();async function he(e){let t=await d(f(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function G(e){return e?.type===`poll`&&e.phase===`done`}function K(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function q(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function J(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function ge({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,H.useMemo)(()=>pe(e),[e]),o=(0,H.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,H.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,H.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,H.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await he({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,H.useEffect)(()=>{let t=q(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),me.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,H.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||he({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:G(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),G(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=K(c.payload),m=q(c.payload,e.id),h=m?c.generatedQr:J(c.payload),g=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),v=c.payload?.type===`form`?c.payload:null,y=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,W.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:s(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,W.jsxs)(T,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,W.jsx)(b,{className:`size-4 animate-spin`}):(0,W.jsx)(re,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,W.jsxs)(T,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,W.jsx)(B,{className:`size-4`}),f]}):null]})]}),p?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,g?(0,W.jsxs)(`div`,{className:s(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base p-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,W.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,W.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,W.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,W.jsx)(A,{className:`size-48 rounded-md`})})}),(0,W.jsxs)(`div`,{className:s(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,W.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,W.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,W.jsx)(A,{className:`h-4 w-48 max-w-full`}),(0,W.jsx)(A,{className:`h-4 w-36 max-w-full`})]}),m?(0,W.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,W.jsx)(_,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,W.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,W.jsx)(ne,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,W.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,v?(0,W.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,W.jsx)(ce,{schema:v.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:o}),(0,W.jsx)(T,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(v.submitAction,c.formDraft),children:n.saveSetup})]}):null,y?(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var _e=40;function Y(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ve(e,t){return e.find(e=>e.id===Y(t))?.agentId?.trim().toLowerCase()??``}function ye(e,t,n){let r=Y(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:_e,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function be(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function xe(e,t,n){let r=be(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Se(e,t=!1){return e===`drawer`?s(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,V):s(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,V,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function Ce(e){let t=(0,U.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:o,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,h=p===void 0?!1:p,_=n===`drawer`,[y,b]=(0,H.useState)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,W.jsx)(v,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,te)}),t[0]=x):x=t[0];let S;t[1]!==n||t[2]!==h?(S=Se(n,h),t[1]=n,t[2]=h,t[3]=S):S=t[3];let C;t[4]===c?C=t[5]:(C=c?(0,W.jsx)(k,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=C);let A;t[6]===l?A=t[7]:(A=l?(0,W.jsx)(O,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=A);let j;t[8]!==u||t[9]!==o||t[10]!==m||t[11]!==_||t[12]!==a?(j=_?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,W.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,o?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:o}):null]}),(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,W.jsx)(E,{className:`size-5`,strokeWidth:1.75})})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:s(ee,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,W.jsx)(E,{className:`size-4`})})}),m]}),t[8]=u,t[9]=o,t[10]=m,t[11]=_,t[12]=a,t[13]=j):j=t[13];let M=_?`p-4`:`p-6`,N;t[14]===M?N=t[15]:(N=s(`min-h-0 flex-1 overflow-y-auto`,M),t[14]=M,t[15]=N);let P;t[16]!==d||t[17]!==N?(P=(0,W.jsx)(`div`,{className:N,children:d}),t[16]=d,t[17]=N,t[18]=P):P=t[18];let F;t[19]!==f||t[20]!==y||t[21]!==C||t[22]!==A||t[23]!==j||t[24]!==P?(F=(0,W.jsxs)(R,{layer:`modal`,portalContainer:y,children:[C,A,j,P,f]}),t[19]=f,t[20]=y,t[21]=C,t[22]=A,t[23]=j,t[24]=P,t[25]=F):F=t[25];let I;t[26]!==F||t[27]!==S?(I=(0,W.jsxs)(D,{children:[x,(0,W.jsx)(g,{ref:b,className:S,onOpenAutoFocus:we,children:F})]}),t[26]=F,t[27]=S,t[28]=I):I=t[28];let L;return t[29]!==i||t[30]!==r||t[31]!==I?(L=(0,W.jsx)(w,{open:r,onOpenChange:i,children:I}),t[29]=i,t[30]=r,t[31]=I,t[32]=L):L=t[32],L}function we(e){return e.preventDefault()}var Te=(0,H.memo)(function(e){let t=(0,U.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,W.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,W.jsx)(S,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,W.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function Ee(e){let t=(0,U.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,W.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,W.jsx)(T,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,W.jsx)(T,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,W.jsx)(T,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,W.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,W.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var De=`channels-status`;function Oe(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function ke(e){let t=t=>e(t.detail);return window.addEventListener(De,t),()=>window.removeEventListener(De,t)}function Ae(e,t){let n=(0,U.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return ke(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,H.useEffect)(i,a)}function je(e){return e?f(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Me(e){return(await p(f(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Ne=[`enabled`];async function Pe(){let e=await p(f(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Fe(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Ie(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function X(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Le(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function Re(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function ze(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Be(e){if(!e)return[];let t=e.uiHints??{},n=Z(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=X(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!Z(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Ne.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Ne.includes(e))}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ve(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Ve(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!Z(r)||!Z(r[n]))break;let o=Z(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Ve(r[n]),properties:{}}),e===t.length-1){o[n]=Ve(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!Z(t))return!1;for(let[e,n]of Object.entries(t))Z(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Ve(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!Z(i))break;if(e===t.length-1){delete i[n];break}if(!Z(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&Z(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!Z(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return Z(t)?Object.values(t).filter(e=>Z(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=X(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=X(e),r=pe(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=pe(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=l(e=>e.token),[n,r]=(0,H.useState)(!1),i=(0,H.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(f(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Fe(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,W.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,W.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,W.jsx)(N,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,U.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,o;t[0]===i?o=t[1]:(o=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=o);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=s(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=s(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,W.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==u||t[14]!==p?(m=(0,W.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:o,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,U.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:o,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=X(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,x;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),o=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,W.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let b;t[21]===n.label?b=t[22]:(b=(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=b);let S;t[23]===i?S=t[24]:(S=s(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,ze(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Le(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,W.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==b?(T=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[b,w]}),t[31]=w,t[32]=b,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,W.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(x=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=x):x=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,W.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),o.length>0?(0,W.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:o.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=x}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],x=t[18];let S;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(S=(0,W.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=S):S=t[52];let C=a||o,w;t[53]!==a||t[54]!==o?(w=a||o?(0,W.jsx)(b,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=o,t[55]=w):w=t[55];let E;t[56]!==c||t[57]!==n||t[58]!==o||t[59]!==i?(E=o?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=o,t[59]=i,t[60]=E):E=t[60];let D;t[61]!==m||t[62]!==w||t[63]!==E||t[64]!==C?(D=(0,W.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,W.jsxs)(T,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:C,children:[w,E]})}),t[61]=m,t[62]=w,t[63]=E,t[64]=C,t[65]=D):D=t[65];let O;return t[66]!==D||t[67]!==y||t[68]!==x||t[69]!==S?(O=(0,W.jsxs)(`article`,{className:y,children:[x,S,D]}),t[66]=D,t[67]=y,t[68]=x,t[69]=S,t[70]=O):O=t[70],O}function nt(e){return(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,W.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,U.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?ne:n===`stopped`||n===`needs_setup`?o:b,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=s(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let x;t[6]!==p||t[7]!==y?(x=(0,W.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=x):x=t[8];let S;t[9]===l.connectionStatus?S=t[10]:(S=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=S);let C;t[11]!==l||t[12]!==n?(C=Re(n,l),t[11]=l,t[12]=n,t[13]=C):C=t[13];let w;t[14]===C?w=t[15]:(w=(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[14]=C,t[15]=w);let E;t[16]!==w||t[17]!==S?(E=(0,W.jsxs)(`div`,{children:[S,w]}),t[16]=w,t[17]=S,t[18]=E):E=t[18];let D;t[19]!==E||t[20]!==x?(D=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[x,E]}),t[19]=E,t[20]=x,t[21]=D):D=t[21];let O=i||r,k;t[22]===i?k=t[23]:(k=i?(0,W.jsx)(b,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=k);let A=i?l.checkingConnection:l.checkConnection,j;t[24]!==d||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,W.jsxs)(T,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:O,onClick:d,children:[k,A]}),t[24]=d,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(M=n===`stopped`?(0,W.jsxs)(T,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,W.jsx)(b,{className:`size-4 animate-spin`}):(0,W.jsx)(z,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=M):M=t[35];let N;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(N=c?(0,W.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=N):N=t[43];let P;t[44]!==j||t[45]!==M||t[46]!==N?(P=(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[j,M,N]}),t[44]=j,t[45]=M,t[46]=N,t[47]=P):P=t[47];let F;return t[48]!==D||t[49]!==P?(F=(0,W.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[D,P]})}),t[48]=D,t[49]=P,t[50]=F):F=t[50],F}function at(e){let t=(0,U.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=X(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(x,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,W.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,W.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,W.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,W.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,W.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,W.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,W.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ot(){let e=u(e=>e.language),t=c(e),n=l(e=>!!e.token),r=i(),{channelId:o}=a(),p=P(o),g=fe(n,e),v=g.entries,{data:b,mutate:x,isValidating:S}=m(n?de():null,ue,{revalidateOnFocus:!0}),{data:w,mutate:T}=m(n?`channels-config-map`:null,Pe,{revalidateOnFocus:!1}),E=w?.channels??{},D=w?.bindings??[],{data:O}=m(n?`channel-routing-agents`:null,y,{revalidateOnFocus:!1}),k=I(e=>e.setPageHeader),A=I(e=>e.clearPageHeader),N=(0,H.useMemo)(()=>v.find(e=>e.id===p),[p,v]),ee=N?Ie(N):null,{data:te,mutate:R}=m(n&&ee?je(ee):null,()=>Me(ee)),[z,B]=(0,H.useState)(null),[V,ne]=(0,H.useState)(!1),[re,ie]=(0,H.useState)(null),[le,U]=(0,H.useState)(null),[me,he]=(0,H.useState)(!1),[G,K]=(0,H.useState)(null),[q,J]=(0,H.useState)(null),_e=z??te??{},Y=t.channelsSettings,be=(0,H.useMemo)(()=>N?.configSchema??{type:`object`,properties:{}},[N?.configSchema]),Se=(0,H.useMemo)(()=>We(be,Ne),[be]),we=(0,H.useMemo)(()=>Be(N),[N]),De=(0,H.useMemo)(()=>He(Se,we),[we,Se]),ke=(0,H.useMemo)(()=>We(Se,we),[we,Se]),Fe=(0,H.useMemo)(()=>Ge(De),[De]),Re=N?q??ve(D,N.id):``,Z=(0,H.useMemo)(()=>(O?.items??[]).map(e=>{let n=h(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[O?.items,t.agentsSettings]),Ve=O?.items.find(e=>e.id===O.defaultId),Ue=Ve?h(Ve,t.agentsSettings):O?.defaultId??``,Ke=(0,H.useMemo)(()=>({defaultBooleanLabel:Y.schemaBooleanDefault,unsupportedArrayType:Y.schemaUnsupportedArrayType,arrayAddPlaceholder:Y.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>Y.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[Y]),qe=(0,H.useMemo)(()=>new Map((b??[]).map(e=>[e.name,e])),[b]),Je=b!==void 0,Ye=(0,H.useCallback)(e=>xe(e,qe.get(e.id),Je),[qe,Je]),Q=(0,H.useCallback)(async()=>{await Promise.all([g.mutate(),x()])},[g,x]);Ae((0,H.useCallback)(e=>{let t=Oe(e);t&&x(t,!1)},[x]),n);let Xe=(0,H.useMemo)(()=>n?(0,W.jsx)(Te,{ch:Y,refreshing:g.isValidating||S,saveOk:!1,onRefresh:()=>void Q()}):null,[g.isValidating,Y,n,S,Q]);(0,H.useLayoutEffect)(()=>(k({startExtra:null,main:(0,W.jsx)(`div`,{className:`min-w-0`,children:(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>A()),[A,Xe,t.settingsSections.channels,k]);let Ze=(0,H.useCallback)(e=>{r(j(e)),B(null),J(null),K(null)},[r]),Qe=(0,H.useCallback)(()=>{r(M),B(null),J(null),K(null)},[r]),nt=(0,H.useCallback)(async e=>{U(e.id),K(null);try{let t=await d(f(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){K(e instanceof Error?e.message:String(e))}finally{U(null)}},[Q]);(0,H.useEffect)(()=>{J(null),he(!1)},[N?.id]);let rt=(0,H.useCallback)(async()=>{if(!N||!z&&q===null)return!1;let e=Ie(N);ne(!0),K(null);try{let t=await d(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({...z?{channels:{[e]:z}}:{},...q===null?{}:{bindings:ye(D,N.id,q)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return z&&await R(z,!1),await T(),await g.mutate(),B(null),J(null),!0}catch(e){return K(e instanceof Error?e.message:String(e)),!1}finally{ne(!1)}},[N,q,D,g,z,T,R]),ot=(0,H.useCallback)(async e=>{let t=X(e),n=Ie(e),r=N?.id===e.id?z:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}ie(e.id),K(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await d(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await g.mutate(),await T(),await x(),N?.id===e.id&&(await R(),B(null))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ie(null)}},[N?.id,g,z,T,R,x,Ze]),$=N?.ui?.modal,st=$?.placement!==`replace-config`,ct=N?Ye(N):`checking`,lt=N?!X(N).ready||me:!1;return n?(0,W.jsxs)(oe,{gap:`gap-4`,children:[g.isLoading?(0,W.jsx)(se,{sections:2}):g.error?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(g.error)}):(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:v.map(e=>(0,W.jsx)(tt,{entry:e,config:E[Ie(e)]?.config,runtime:Ye(e),busy:re===e.id,restarting:le===e.id,ch:Y,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),G?(0,W.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:G}):null,(0,W.jsx)(Ce,{presentation:`modal`,open:!!N,onOpenChange:e=>{e||Qe()},closeAriaLabel:Y.close,srTitle:N?.label??Y.selectChannel,srDescription:N?.description,wide:!0,footer:N?(0,W.jsx)(Ee,{ch:Y,dirty:!!z||q!==null,saving:V,onCancel:Qe,onDiscard:()=>{B(null),J(null)},onSave:rt}):null,children:N?(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,W.jsx)($e,{entry:N}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:N.label}),(0,W.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,ze(ct)),children:Le(ct,Y)})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:!X(N).ready&&pe(N)?.[1].result===`qr`?Y.scanLoginHint.replace(`{{channel}}`,N.label):N.description}),N.docsPath?(0,W.jsxs)(`a`,{href:N.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[Y.docs,(0,W.jsx)(_,{className:`size-3.5`})]}):null]})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,W.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:X(N).enabled?Y.enabledLabel:Y.disabledLabel}),(0,W.jsx)(et,{checked:X(N).enabled,disabled:re===N.id,label:Y.toggleChannel.replace(`{{channel}}`,N.label),onToggle:()=>void ot(N)})]})]})}),(0,W.jsx)(it,{runtime:ct,restarting:le===N.id,checking:S,showConnectionOptions:me,canManageConnection:X(N).ready&&$?.placement!==`replace-config`,ch:Y,onRestart:()=>void nt(N),onCheck:()=>void Q(),onManageConnection:()=>he(e=>!e)}),(0,W.jsx)(at,{entry:N,ch:Y}),lt&&$?.placement!==`replace-config`?(0,W.jsx)(ge,{entry:N,locale:e,messages:Y,compact:!0,onChanged:async()=>{await R(),await Q(),await T()}},N.id):null,$?.entrypoint&&$.placement===`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:_e}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:_e}}):null,st&&Fe?(0,W.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:Y.basicConfiguration}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y.basicConfigurationHint})]}),(0,W.jsx)(ce,{schema:De,values:_e,onChange:e=>B(e),disabled:V,labels:Ke})]}):null,(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(F,{className:`size-4 text-fg-muted`}),Y.messageHandling]}),(0,W.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,W.jsxs)(`div`,{className:`mb-3`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:Y.agentRouting}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y.messageHandlingHint})]}),(0,W.jsx)(C,{value:Re,options:Z,placeholder:Y.agentRoutingSelect,emptyLabel:Y.agentRoutingDefault.replace(`{{agent}}`,Ue||Y.agentRoutingSelect),ariaLabel:Y.agentRouting,disabled:V||!O,onChange:e=>J(e)})]})]}),st&&Ge(ke)?(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(F,{className:`size-4 text-fg-muted`}),Y.advancedConfiguration]}),(0,W.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,W.jsx)(ce,{schema:ke,values:_e,onChange:e=>B(e),disabled:V,labels:Ke})})]}):null,G?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:G}):null]}):null})]}):(0,W.jsxs)(oe,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,W.jsx)(ae,{title:t.settingsSections.channels}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Y.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
@@ -0,0 +1 @@
1
+ import{r as e}from"./locale-store-Dar-xqQr.js";import{n as t}from"./channel-recipient-api-MmLMLDWf.js";function n(){return e(`/api/channels/status`)}var r=t;export{r as n,n as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
@@ -0,0 +1 @@
1
+ function e(t){var n,r,i=``;if(typeof t==`string`||typeof t==`number`)i+=t;else if(typeof t==`object`)if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=` `),i+=r)}else for(r in t)t[r]&&(i&&(i+=` `),i+=r);return i}function t(){for(var t,n,r=0,i=``,a=arguments.length;r<a;r++)(t=arguments[r])&&(n=e(t))&&(i&&(i+=` `),i+=n);return i}var n=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},r=(e,t)=>({classGroupId:e,validator:t}),i=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),a=`-`,o=[],s=`arbitrary..`,c=e=>{let t=d(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return u(e);let n=e.split(a);return l(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=i[e],a=r[e];return t?a?n(a,t):t:a||o}return r[e]||o}}},l=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=l(e,t+1,i);if(n)return n}let o=n.validators;if(o===null)return;let s=t===0?e.join(a):e.slice(t).join(a),c=o.length;for(let e=0;e<c;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},u=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?s+r:void 0})(),d=e=>{let{theme:t,classGroups:n}=e;return ee(n,t)},ee=(e,t)=>{let n=i();for(let r in e){let i=e[r];f(i,n,r,t)}return n},f=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];p(i,t,n,r)}},p=(e,t,n,r)=>{if(typeof e==`string`){m(e,t,n);return}if(typeof e==`function`){h(e,t,n,r);return}g(e,t,n,r)},m=(e,t,n)=>{let r=e===``?t:_(t,e);r.classGroupId=n},h=(e,t,n,i)=>{if(v(e)){f(e(i),t,n,i);return}t.validators===null&&(t.validators=[]),t.validators.push(r(n,e))},g=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];f(o,_(t,a),n,r)}},_=(e,t)=>{let n=e,r=t.split(a),o=r.length;for(let e=0;e<o;e++){let t=r[e],a=n.nextPart.get(t);a||(a=i(),n.nextPart.set(t,a)),n=a}return n},v=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,y=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},b=`!`,x=`:`,S=[],C=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),w=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===x){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(b)?(c=s.slice(0,-1),l=!0):s.startsWith(b)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return C(t,l,c,u)};if(t){let e=t+x,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):C(S,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},te=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ne=e=>({cache:y(e.cacheSize),parseClassName:w(e),sortModifiers:te(e),postfixLookupClassGroupIds:T(e),...c(e)}),T=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},re=/\s+/,E=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(re),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:ee,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let m=!!p,h;if(m){h=r(f.substring(0,p));let e=h&&o[h]?r(f):void 0;e&&e!==h&&(h=e,m=!1)}else h=r(f);if(!h){if(!m){l=t+(l.length>0?` `+l:l);continue}if(h=r(f),!h){l=t+(l.length>0?` `+l:l);continue}m=!1}let g=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),_=ee?g+b:g,v=_+h;if(s.indexOf(v)>-1)continue;s.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];s.push(_+t)}l=t+(l.length>0?` `+l:l)}return l},D=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=O(n))&&(i&&(i+=` `),i+=r);return i},O=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=O(e[r]))&&(n&&(n+=` `),n+=t);return n},k=(e,...t)=>{let n,r,i,a,o=o=>(n=ne(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=E(e,n);return i(e,a),a};return a=o,(...e)=>a(D(...e))},A=[],j=e=>{let t=t=>t[e]||A;return t.isThemeGetter=!0,t},M=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,N=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ie=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ae=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,P=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,F=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,L=e=>ie.test(e),R=e=>!!e&&!Number.isNaN(Number(e)),z=e=>!!e&&Number.isInteger(Number(e)),se=e=>e.endsWith(`%`)&&R(e.slice(0,-1)),B=e=>ae.test(e),ce=()=>!0,V=e=>oe.test(e)&&!P.test(e),H=()=>!1,U=e=>F.test(e),le=e=>I.test(e),ue=e=>!W(e)&&!q(e),de=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),fe=e=>Y(e,we,H),W=e=>M.test(e),G=e=>Y(e,Te,V),pe=e=>Y(e,Ee,R),me=e=>Y(e,Oe,ce),he=e=>Y(e,De,H),ge=e=>Y(e,Z,H),_e=e=>Y(e,Q,le),K=e=>Y(e,ke,U),q=e=>N.test(e),J=e=>X(e,Te),ve=e=>X(e,De),ye=e=>X(e,Z),be=e=>X(e,we),xe=e=>X(e,Q),Se=e=>X(e,ke,!0),Ce=e=>X(e,Oe,!0),Y=(e,t,n)=>{let r=M.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},X=(e,t,n=!1)=>{let r=N.exec(e);return r?r[1]?t(r[1]):n:!1},Z=e=>e===`position`||e===`percentage`,Q=e=>e===`image`||e===`url`,we=e=>e===`length`||e===`size`||e===`bg-size`,Te=e=>e===`length`,Ee=e=>e===`number`,De=e=>e===`family-name`,Oe=e=>e===`number`||e===`weight`,ke=e=>e===`shadow`,Ae=()=>{let e=j(`color`),t=j(`font`),n=j(`text`),r=j(`font-weight`),i=j(`tracking`),a=j(`leading`),o=j(`breakpoint`),s=j(`container`),c=j(`spacing`),l=j(`radius`),u=j(`shadow`),d=j(`inset-shadow`),ee=j(`text-shadow`),f=j(`drop-shadow`),p=j(`blur`),m=j(`perspective`),h=j(`aspect`),g=j(`ease`),_=j(`animate`),v=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],y=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],b=()=>[...y(),q,W],x=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],S=()=>[`auto`,`contain`,`none`],C=()=>[q,W,c],w=()=>[L,`full`,`auto`,...C()],te=()=>[z,`none`,`subgrid`,q,W],ne=()=>[`auto`,{span:[`full`,z,q,W]},z,q,W],T=()=>[z,`auto`,q,W],re=()=>[`auto`,`min`,`max`,`fr`,q,W],E=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],D=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...C()],k=()=>[L,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...C()],A=()=>[L,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...C()],M=()=>[L,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...C()],N=()=>[e,q,W],ie=()=>[...y(),ye,ge,{position:[q,W]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,be,fe,{size:[q,W]}],P=()=>[se,J,G],F=()=>[``,`none`,`full`,l,q,W],I=()=>[``,R,J,G],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[R,se,ye,ge],le=()=>[``,`none`,p,q,W],Y=()=>[`none`,R,q,W],X=()=>[`none`,R,q,W],Z=()=>[R,q,W],Q=()=>[L,`full`,...C()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[B],breakpoint:[B],color:[ce],container:[B],"drop-shadow":[B],ease:[`in`,`out`,`in-out`],font:[ue],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[B],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[B],shadow:[B],spacing:[`px`,R],text:[B],"text-shadow":[B],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,L,W,q,h]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,q,W]}],"container-named":[de],columns:[{columns:[R,W,q,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[z,`auto`,q,W]}],basis:[{basis:[L,`full`,`auto`,s,...C()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[R,L,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,R,q,W]}],shrink:[{shrink:[``,R,q,W]}],order:[{order:[z,`first`,`last`,`none`,q,W]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:ne()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:ne()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...E(),`normal`]}],"justify-items":[{"justify-items":[...D(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...D()]}],"align-content":[{content:[`normal`,...E()]}],"align-items":[{items:[...D(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...D(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...D(),`baseline`]}],"place-self":[{"place-self":[`auto`,...D()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":C()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":C()}],"space-y-reverse":[`space-y-reverse`],size:[{size:k()}],"inline-size":[{inline:[`auto`,...A()]}],"min-inline-size":[{"min-inline":[`auto`,...A()]}],"max-inline-size":[{"max-inline":[`none`,...A()]}],"block-size":[{block:[`auto`,...M()]}],"min-block-size":[{"min-block":[`auto`,...M()]}],"max-block-size":[{"max-block":[`none`,...M()]}],w:[{w:[s,`screen`,...k()]}],"min-w":[{"min-w":[s,`screen`,`none`,...k()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...k()]}],h:[{h:[`screen`,`lh`,...k()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...k()]}],"max-h":[{"max-h":[`screen`,`lh`,...k()]}],"font-size":[{text:[`base`,n,J,G]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ce,me]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,se,W]}],"font-family":[{font:[ve,he,t]}],"font-features":[{"font-features":[W]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,q,W]}],"line-clamp":[{"line-clamp":[R,`none`,q,pe]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":[`none`,q,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,q,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[R,`from-font`,`auto`,q,G]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[R,`auto`,q,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:C()}],"tab-size":[{tab:[z,q,W]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,q,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,q,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},z,q,W],radial:[``,q,W],conic:[z,q,W]},xe,_e]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[R,q,W]}],"outline-w":[{outline:[``,R,J,G]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,Se,K]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,Se,K]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[R,G]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,ee,Se,K]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[R,q,W]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[R]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[q,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[R]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,q,W]}],filter:[{filter:[``,`none`,q,W]}],blur:[{blur:le()}],brightness:[{brightness:[R,q,W]}],contrast:[{contrast:[R,q,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,f,Se,K]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,R,q,W]}],"hue-rotate":[{"hue-rotate":[R,q,W]}],invert:[{invert:[``,R,q,W]}],saturate:[{saturate:[R,q,W]}],sepia:[{sepia:[``,R,q,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,q,W]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[R,q,W]}],"backdrop-contrast":[{"backdrop-contrast":[R,q,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,R,q,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[R,q,W]}],"backdrop-invert":[{"backdrop-invert":[``,R,q,W]}],"backdrop-opacity":[{"backdrop-opacity":[R,q,W]}],"backdrop-saturate":[{"backdrop-saturate":[R,q,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,R,q,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,q,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[R,`initial`,q,W]}],ease:[{ease:[`linear`,`initial`,g,q,W]}],delay:[{delay:[R,q,W]}],animate:[{animate:[`none`,_,q,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[m,q,W]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":[`scale-3d`],skew:[{skew:Z()}],"skew-x":[{"skew-x":Z()}],"skew-y":[{"skew-y":Z()}],transform:[{transform:[q,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":[`translate-none`],zoom:[{zoom:[z,q,W]}],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,q,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,q,W]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[R,J,G,pe]}],stroke:[{stroke:[`none`,...N()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},je=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>($(e,`cacheSize`,t),$(e,`prefix`,n),$(e,`experimentalParseClassName`,r),Me(e.theme,a.theme),Me(e.classGroups,a.classGroups),Me(e.conflictingClassGroups,a.conflictingClassGroups),Me(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),$(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),$(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),Ne(e.theme,i.theme),Ne(e.classGroups,i.classGroups),Ne(e.conflictingClassGroups,i.conflictingClassGroups),Ne(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),Pe(e,i,`postfixLookupClassGroups`),Pe(e,i,`orderSensitiveModifiers`),e),$=(e,t,n)=>{n!==void 0&&(e[t]=n)},Me=(e,t)=>{if(t)for(let n in t)$(e,n,t[n])},Ne=(e,t)=>{if(t)for(let n in t)Pe(e,t,n)},Pe=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Fe=((e,...t)=>typeof e==`function`?k(Ae,e,...t):k(()=>je(Ae(),e),...t))({extend:{classGroups:{rounded:[`rounded-pill`]}}});function Ie(...e){return Fe(t(e))}export{Ie as t};
@@ -1 +1 @@
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{Pc as a}from"./index-CHKe7nwC.js";var o=n(),s=e(t(),1),c=r(),l={sm:{frame:`size-9 rounded-lg`,image:`size-6`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-7`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-8`,fallback:`size-5`}};function u(e){let t=(0,o.c)(18),{connector:n,size:r,className:u}=e,d=r===void 0?`md`:r,f=n?.branding?.logoUrl,[p,m]=(0,s.useState)(!1),h=l[d],g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{m(!1)},t[0]=g):g=t[0];let _;t[1]===f?_=t[2]:(_=[f],t[1]=f,t[2]=_),(0,s.useEffect)(g,_);let v;t[3]!==u||t[4]!==h.frame?(v=i(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-surface-base`,h.frame,u),t[3]=u,t[4]=h.frame,t[5]=v):v=t[5];let y;t[6]===n?y=t[7]:(y=n?.branding?.backgroundColor?{backgroundColor:n.branding.backgroundColor}:void 0,t[6]=n,t[7]=y);let b=n?.displayName,x;t[8]!==h.fallback||t[9]!==h.image||t[10]!==p||t[11]!==f?(x=f&&!p?(0,c.jsx)(`img`,{src:f,alt:``,loading:`lazy`,draggable:!1,className:i(`object-contain`,h.image),onError:()=>m(!0)}):(0,c.jsx)(a,{className:i(`text-fg-muted`,h.fallback),"aria-hidden":!0}),t[8]=h.fallback,t[9]=h.image,t[10]=p,t[11]=f,t[12]=x):x=t[12];let S;return t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==x?(S=(0,c.jsx)(`span`,{className:v,style:y,title:b,children:x}),t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S):S=t[17],S}export{u as t};
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-JdwAhgNB.js";import{Pc as a}from"./index-vq_cJZJC.js";var o=n(),s=e(t(),1),c=r(),l={sm:{frame:`size-9 rounded-lg`,image:`size-6`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-7`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-8`,fallback:`size-5`}};function u(e){let t=(0,o.c)(18),{connector:n,size:r,className:u}=e,d=r===void 0?`md`:r,f=n?.branding?.logoUrl,[p,m]=(0,s.useState)(!1),h=l[d],g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{m(!1)},t[0]=g):g=t[0];let _;t[1]===f?_=t[2]:(_=[f],t[1]=f,t[2]=_),(0,s.useEffect)(g,_);let v;t[3]!==u||t[4]!==h.frame?(v=i(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-surface-base`,h.frame,u),t[3]=u,t[4]=h.frame,t[5]=v):v=t[5];let y;t[6]===n?y=t[7]:(y=n?.branding?.backgroundColor?{backgroundColor:n.branding.backgroundColor}:void 0,t[6]=n,t[7]=y);let b=n?.displayName,x;t[8]!==h.fallback||t[9]!==h.image||t[10]!==p||t[11]!==f?(x=f&&!p?(0,c.jsx)(`img`,{src:f,alt:``,loading:`lazy`,draggable:!1,className:i(`object-contain`,h.image),onError:()=>m(!0)}):(0,c.jsx)(a,{className:i(`text-fg-muted`,h.fallback),"aria-hidden":!0}),t[8]=h.fallback,t[9]=h.image,t[10]=p,t[11]=f,t[12]=x):x=t[12];let S;return t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==x?(S=(0,c.jsx)(`span`,{className:v,style:y,title:b,children:x}),t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S):S=t[17],S}export{u as t};