limixbot 0.3.159 → 0.3.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 (139) hide show
  1. package/dist/assets/{ActivityPanel-Cdo1dBIm.js → ActivityPanel-D4K2fyw7.js} +1 -1
  2. package/dist/assets/{App-Cs_sQgN3.js → App-B6W9JFXZ.js} +123 -123
  3. package/dist/assets/{AppEventEditor-LKd22lmx.js → AppEventEditor-OWWzSxPd.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog--5NZgIuz.js → BotSettingsDialog-W_eO05D2.js} +7 -7
  5. package/dist/assets/{BrowserPanel-Eq7Ln2F-.js → BrowserPanel-C0NOYaOK.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-BFS9rfCH.js → BrowserProfilesManager-48HNAHJm.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-B5SV-dNM.js → CloudAddDialog-RDN92Hbu.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-BkqxPiGz.js → ComputerFilesPane-HhCIEUQ4.js} +1 -1
  9. package/dist/assets/{ComputerPanel-BcHGUiuP.js → ComputerPanel-C8ZuT_hf.js} +2 -2
  10. package/dist/assets/{DataPanel-Dx1TirKY.js → DataPanel-CEPYRb_t.js} +1 -1
  11. package/dist/assets/{DesktopViewer-BZBWLKHf.js → DesktopViewer-Rhj5Rg_E.js} +1 -1
  12. package/dist/assets/{GrokMoveDialog-DSCiPkeR.js → GrokMoveDialog-BEkVuGJs.js} +1 -1
  13. package/dist/assets/{InspectorPanel-DvdMSUcV.js → InspectorPanel-CYwO5Hpk.js} +1 -1
  14. package/dist/assets/{KeyboardShortcutsModal-CAE7w-Wr.js → KeyboardShortcutsModal-CvoUyPNv.js} +1 -1
  15. package/dist/assets/{KnowledgePanel-DnrNUt4C.js → KnowledgePanel-Crh_Mb2-.js} +1 -1
  16. package/dist/assets/{LimixResizeHandles-BS339Uq8.js → LimixResizeHandles-ByutmqfH.js} +1 -1
  17. package/dist/assets/{LiveDesktop-BcFA7umB.js → LiveDesktop-DZV6iCg2.js} +1 -1
  18. package/dist/assets/{LocalVmWorkspace-BG20R05j.js → LocalVmWorkspace-C82LcwJQ.js} +1 -1
  19. package/dist/assets/{MacLocalControl-B-MIWO9N.js → MacLocalControl-Bx_fyo-H.js} +1 -1
  20. package/dist/assets/{MarkdownFilePreview-aNqcmjPH.js → MarkdownFilePreview-BXNCSmvg.js} +1 -1
  21. package/dist/assets/{MenuMotion-BanPNWqt.js → MenuMotion-xBTC4eOZ.js} +1 -1
  22. package/dist/assets/{NewBotDialog-CPFz45h8.js → NewBotDialog-D0agPdOC.js} +1 -1
  23. package/dist/assets/{PhoneAppDialog-DFR6MxK9.js → PhoneAppDialog-DQpyRnEJ.js} +1 -1
  24. package/dist/assets/{PlacesRail-cbzNti8k.js → PlacesRail-fw4FbMbq.js} +1 -1
  25. package/dist/assets/{PluginsPanel-SsAQcstw.js → PluginsPanel-C4HY0lnL.js} +1 -1
  26. package/dist/assets/{ProIntroduction-DZXB6xh2.js → ProIntroduction-BO5ABFTi.js} +1 -1
  27. package/dist/assets/{RemoteAgentSettingsPanel-DW7HjrZ-.js → RemoteAgentSettingsPanel-D0vIEaec.js} +1 -1
  28. package/dist/assets/{RoomPanel-BX6oOzAJ.js → RoomPanel-KgR5RAVc.js} +1 -1
  29. package/dist/assets/{RoutinesPage-xZq6f7F7.js → RoutinesPage-CFb9pR_B.js} +1 -1
  30. package/dist/assets/{SettingsModal-D4xDVhBl.js → SettingsModal-CBovr73q.js} +8 -8
  31. package/dist/assets/{ShareTeamDialog-B8dsAay0.js → ShareTeamDialog-E7_x3dOd.js} +1 -1
  32. package/dist/assets/{SignedInSites-CwXZYrPd.js → SignedInSites-tgZ-kFN4.js} +1 -1
  33. package/dist/assets/{TeamLibraryPanel-DHK2epUq.js → TeamLibraryPanel-DA7R6knC.js} +1 -1
  34. package/dist/assets/{TeamMapPage-DlJ87yR6.js → TeamMapPage-CrEl0669.js} +1 -1
  35. package/dist/assets/{TriggersPage-BkfOweI0.js → TriggersPage-DoApzhWG.js} +1 -1
  36. package/dist/assets/VisibilitySection-ChKxjJ5C.js +22 -0
  37. package/dist/assets/{WebhookTrigger-DNNVhUXR.js → WebhookTrigger-B_VHQtPd.js} +1 -1
  38. package/dist/assets/{WorksOnGrid-CXKUHPY-.js → WorksOnGrid-CBZxKyOV.js} +1 -1
  39. package/dist/assets/{abnfDiagram-YUKMZFIV-T1re1jGp.js → abnfDiagram-YUKMZFIV-B9vpInYU.js} +1 -1
  40. package/dist/assets/{activity-ME_qLdss.js → activity-C1tmKAiO.js} +1 -1
  41. package/dist/assets/{architectureDiagram-47P4ROYG-qqDKVS6g.js → architectureDiagram-47P4ROYG-B9ymIDha.js} +1 -1
  42. package/dist/assets/{blockDiagram-E7TT5TSB-BuC572BY.js → blockDiagram-E7TT5TSB-DNFty3Tc.js} +1 -1
  43. package/dist/assets/{c4Diagram-CRA5TL53-nip4Y8hp.js → c4Diagram-CRA5TL53-MMvdoF22.js} +1 -1
  44. package/dist/assets/{calendar-days--KsT6bHs.js → calendar-days-DMbqxmdo.js} +1 -1
  45. package/dist/assets/channel-D6UpO6dv.js +1 -0
  46. package/dist/assets/{chunk-2Q5K7J3B-Bnqnzpvn.js → chunk-2Q5K7J3B-Dbvx3IUy.js} +1 -1
  47. package/dist/assets/{chunk-5VM5RSS4-CXFOIYDF.js → chunk-5VM5RSS4-Bv4tGTc_.js} +1 -1
  48. package/dist/assets/{chunk-7TKQ45FW-CKrdRfeX.js → chunk-7TKQ45FW-CTWHE5Z7.js} +1 -1
  49. package/dist/assets/{chunk-AW2ZBBNX-COP_kkGp.js → chunk-AW2ZBBNX-o4mtkbiH.js} +1 -1
  50. package/dist/assets/{chunk-FVRAUYC3-Bnxu_UJy.js → chunk-FVRAUYC3-bk4P4ylI.js} +2 -2
  51. package/dist/assets/{chunk-HTAEGDNF-Blc4NKLJ.js → chunk-HTAEGDNF-xXImTXlw.js} +1 -1
  52. package/dist/assets/{chunk-JWPE2WC7-0DUEaslJ.js → chunk-JWPE2WC7-fJsfWv1C.js} +1 -1
  53. package/dist/assets/{chunk-KQW6MTUR-nzkuoYgY.js → chunk-KQW6MTUR-BfdY-FQt.js} +1 -1
  54. package/dist/assets/{chunk-XXDRQBXY-CKXQy0NJ.js → chunk-XXDRQBXY-tv73di0t.js} +1 -1
  55. package/dist/assets/{classDiagram-v2-K4WV4PDN-BalScTvc.js → classDiagram-v2-K4WV4PDN-zMRuBGqC.js} +1 -1
  56. package/dist/assets/{coins-CINwwKBz.js → coins-DRetD1sY.js} +1 -1
  57. package/dist/assets/{core-CjJabOYi.js → core-DXs_9m1L.js} +1 -1
  58. package/dist/assets/{cose-bilkent-JH36ORCC-B8gYHVgP.js → cose-bilkent-JH36ORCC-DZuqoYX_.js} +1 -1
  59. package/dist/assets/{cynefin-EF2NZ3EQ-DLIydYUM.js → cynefin-EF2NZ3EQ-DSgkFo85.js} +1 -1
  60. package/dist/assets/{cynefinDiagram-3GCD6N5R-CPW3HX3C.js → cynefinDiagram-3GCD6N5R-CosHssEi.js} +1 -1
  61. package/dist/assets/{dagre-W4DXFKR2-BmO4lMA3.js → dagre-W4DXFKR2-Bdl477yX.js} +1 -1
  62. package/dist/assets/{diagram-2UJZ2QOL-WNbWLgdx.js → diagram-2UJZ2QOL-BxLY64qg.js} +1 -1
  63. package/dist/assets/{diagram-OVF4WLC6-DxouP33f.js → diagram-OVF4WLC6-CQZ9vBZU.js} +1 -1
  64. package/dist/assets/{diagram-PFPMY2P6-BYQSRoRr.js → diagram-PFPMY2P6-DD3ObzdI.js} +1 -1
  65. package/dist/assets/{diagram-UMYRVEAY-MH7Rac62.js → diagram-UMYRVEAY-CtkMUmqw.js} +1 -1
  66. package/dist/assets/{diagram-YEKJPTXX-_sMOi7in.js → diagram-YEKJPTXX-CrVhZFfx.js} +1 -1
  67. package/dist/assets/{diagram-ZIFT7M5P-AXHi3F5b.js → diagram-ZIFT7M5P-D2gNTqtm.js} +1 -1
  68. package/dist/assets/{ebnfDiagram-VR2GEFS7-LVOSbU4Q.js → ebnfDiagram-VR2GEFS7-DbIJRYrm.js} +1 -1
  69. package/dist/assets/{elk-IJKZMXRS-DnUKKiZ4.js → elk-IJKZMXRS-D7Nf3yON.js} +1 -1
  70. package/dist/assets/{erDiagram-O2IAPWRE-C4TtBzjI.js → erDiagram-O2IAPWRE-Bzm5GzY4.js} +1 -1
  71. package/dist/assets/{file-up-CqRrWw_K.js → file-up-DMaJmosg.js} +1 -1
  72. package/dist/assets/{flowDiagram-OXPTDLAJ-D4Ba6z7o.js → flowDiagram-OXPTDLAJ-BKoqAa_q.js} +1 -1
  73. package/dist/assets/{ganttDiagram-R7TSEDQI-BKyQw4h2.js → ganttDiagram-R7TSEDQI-BSKWWYpy.js} +1 -1
  74. package/dist/assets/{gitGraphDiagram-XJZIOB7I-dHlQDpAX.js → gitGraphDiagram-XJZIOB7I-DgpLQY2o.js} +1 -1
  75. package/dist/assets/{import-name-D7fiWRLC.js → import-name-DviM_E6k.js} +1 -1
  76. package/dist/assets/{index-Cx0TrR7Z.js → index-Bh1qTRXw.js} +3 -3
  77. package/dist/assets/{index-DYywZ7Dm.js → index-kl2U4CdS.js} +1 -1
  78. package/dist/assets/{infoDiagram-5W2HQ5XZ-C1_zxT3L.js → infoDiagram-5W2HQ5XZ-DoodC8bc.js} +1 -1
  79. package/dist/assets/{ishikawaDiagram-K3B6WC7H-D49-s4e6.js → ishikawaDiagram-K3B6WC7H-BxXRcPmI.js} +1 -1
  80. package/dist/assets/{journeyDiagram-COXZFDF6-Cw7pDpwe.js → journeyDiagram-COXZFDF6-DtSJ97ol.js} +1 -1
  81. package/dist/assets/{kanban-definition-P3RFRI5V-CiEVfjhJ.js → kanban-definition-P3RFRI5V-DCW9s12w.js} +1 -1
  82. package/dist/assets/{mermaid.core-DXRspYvN.js → mermaid.core-CaG3BHp-.js} +4 -4
  83. package/dist/assets/{mindmap-definition-LZFPQGKD-BE4A5xqi.js → mindmap-definition-LZFPQGKD-CI0l83_i.js} +1 -1
  84. package/dist/assets/{minimize-B06xVF0X.js → minimize-LlGLn-cd.js} +1 -1
  85. package/dist/assets/{monitor-ylRMuFnb.js → monitor-D-rHzZVy.js} +1 -1
  86. package/dist/assets/{new-bot-DylEMxP3.js → new-bot-78Wk4hfY.js} +1 -1
  87. package/dist/assets/{org-library-C2VYVL97.js → org-library-tkloWFxW.js} +1 -1
  88. package/dist/assets/{package-format-DFYqwtTY.js → package-format-nQAkOC1F.js} +1 -1
  89. package/dist/assets/{pegDiagram-BGZESJAR-CFRdko2m.js → pegDiagram-BGZESJAR-Cz5M4kqt.js} +1 -1
  90. package/dist/assets/{pieDiagram-CAPJLFHJ-DSxoFQy1.js → pieDiagram-CAPJLFHJ-C98cn5QM.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-GDMTTRAM-CjsJyYiF.js → quadrantDiagram-GDMTTRAM-C5NU7SoI.js} +1 -1
  92. package/dist/assets/{rail-C19iSV-q.js → rail-Ct_mmLes.js} +1 -1
  93. package/dist/assets/{railroadDiagram-SM67HX2B-CllshBKq.js → railroadDiagram-SM67HX2B-GaVaWWOo.js} +1 -1
  94. package/dist/assets/{remote-desktop-panel-BZTQhq8G.js → remote-desktop-panel-ByE5Ghzy.js} +1 -1
  95. package/dist/assets/{requirementDiagram-X7JNWC4A-DZRv-heI.js → requirementDiagram-X7JNWC4A-C5wckjoU.js} +1 -1
  96. package/dist/assets/{sankeyDiagram-UM26HJRW-CyPjr28L.js → sankeyDiagram-UM26HJRW-DdVehWU6.js} +1 -1
  97. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-D1U7Kq6G.js → sequenceDiagram-ZO4K6R2Y-eBbzhCW8.js} +1 -1
  98. package/dist/assets/{sizeCapture-INFHLROL-B5DQZxxP.js → sizeCapture-INFHLROL-DQyTTXfY.js} +1 -1
  99. package/dist/assets/{stateDiagram-v2-TBUQTH76-BhYzDBGj.js → stateDiagram-v2-TBUQTH76-8vBTNLu_.js} +1 -1
  100. package/dist/assets/styles-Ck7XEMka.css +1 -0
  101. package/dist/assets/{styles-C8d057NY.js → styles-DnkNzLDs.js} +7 -7
  102. package/dist/assets/{swimlanes-N4OXWK64-DRXo5_ln.js → swimlanes-N4OXWK64-B9vus97I.js} +1 -1
  103. package/dist/assets/swimlanesDiagram-K3J5GTZL-D3jmYauw.js +8 -0
  104. package/dist/assets/{team-share-ijObVLAA.js → team-share-DwBBsedz.js} +1 -1
  105. package/dist/assets/{timeline-definition-YOQAKGHF-CTE0vbtk.js → timeline-definition-YOQAKGHF-s3tn3RzT.js} +1 -1
  106. package/dist/assets/{usecaseDiagram-VIAY4XPW-CkN6xroI.js → usecaseDiagram-VIAY4XPW-88H9jUqs.js} +1 -1
  107. package/dist/assets/{vennDiagram-BLWOH2XV-bFXRahK5.js → vennDiagram-BLWOH2XV-CPFZmxPQ.js} +1 -1
  108. package/dist/assets/{vi-YIuoqNub.js → vi-QjCGytsv.js} +1 -1
  109. package/dist/assets/{wardleyDiagram-YMQ3BMBF-CeYkXfd8.js → wardleyDiagram-YMQ3BMBF-Be_1GpZE.js} +1 -1
  110. package/dist/assets/{xychartDiagram-TAQBALBS-j5MQYrHi.js → xychartDiagram-TAQBALBS-C1zZX1ko.js} +1 -1
  111. package/dist/index.html +3 -3
  112. package/dist/rail.html +5 -5
  113. package/dist-server/cloud-home-start.js +4 -4
  114. package/dist-server/container-mcp.js +10 -10
  115. package/dist-server/index.js +5210 -5187
  116. package/dist-server/limixbot.js +83 -81
  117. package/dist-server/package.json +1 -1
  118. package/dist-server/pair-cli.js +83 -81
  119. package/dist-server/server/cloud-home-start.js +1 -0
  120. package/dist-server/server/drivers/acp/core.js +4 -3
  121. package/dist-server/server/drivers/claude.js +6 -1
  122. package/dist-server/server/drivers/codex.js +12 -2
  123. package/dist-server/server/fcc-endpoint.js +77 -0
  124. package/dist-server/server/index.js +22 -4
  125. package/dist-server/server/new-bot-defaults.js +2 -0
  126. package/dist-server/server/routes/bot-patch.js +9 -0
  127. package/dist-server/server/routes/bots-create.js +11 -1
  128. package/dist-server/server/routes/groups.js +12 -0
  129. package/dist-server/server/routes/instances.js +40 -0
  130. package/dist-server/server/working-folders.js +141 -0
  131. package/dist-server/server/workspace.js +2 -0
  132. package/dist-server/shared/working-folders.js +1 -0
  133. package/dist-server/vps-container-mcp.js +10 -10
  134. package/dist-server/workspace-backup.worker.js +10 -10
  135. package/package.json +1 -1
  136. package/dist/assets/VisibilitySection-Du5EURZP.js +0 -22
  137. package/dist/assets/channel-BxasM4SP.js +0 -1
  138. package/dist/assets/styles-Cjm60Wtn.css +0 -1
  139. package/dist/assets/swimlanesDiagram-K3J5GTZL-Cej5tKCL.js +0 -8
@@ -1 +1 @@
1
- import{r as i,j as e,t}from"./styles-C8d057NY.js";import{E as v,F as k,H as N,J as j,K as y,M as E,R as C,N as S}from"./App-Cs_sQgN3.js";import{L as z}from"./PlacesRail-cbzNti8k.js";import"./index-Cx0TrR7Z.js";import"./monitor-ylRMuFnb.js";import"./MenuMotion-BanPNWqt.js";const A=2*1024*1024;function D({path:r,name:n,message:d}){const[x,u]=i.useState(0),[p,h]=i.useState(null),[c,m]=i.useState(null),[l,w]=i.useState(!1),a=v(r,n,d);i.useEffect(()=>{const o=new AbortController;return m(null),h(null),(async()=>{let f=!1;try{const s=await k(r,d,o.signal);f=!0;const g=await N(s,o.signal,A,"windows-1252");o.signal.aborted||h(g)}catch(s){if(o.signal.aborted)return;!f&&s instanceof Error&&!(s instanceof TypeError)?m({reason:s.message}):m(s instanceof Error&&s.message==="size"?"size":"load")}})(),()=>o.abort()},[r,d.threadId,d.messageId,x]);const b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 flex flex-wrap justify-center gap-2",children:[e.jsxs("button",{type:"button",className:"inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-lg border border-hairline px-3 py-2 hover:bg-raised",disabled:a.state==="saving",onClick:()=>{a.save()},children:[e.jsx(j,{size:14,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 break-all",children:t("attach.saveAria",{name:n})})]}),e.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>u(x+1),children:t("chat.retry")})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:a.reason})]});return c?e.jsxs("div",{className:"p-8 text-center text-sm",children:[e.jsx("p",{role:"alert",className:"text-ink-secondary",children:typeof c=="object"?t("markdown.refused",{reason:c.reason}):t(c==="size"?"markdown.tooLarge":"markdown.loadFailed")}),b]}):p===null?e.jsxs("div",{className:"p-12 text-center text-sm text-ink-secondary",children:[e.jsxs("span",{role:"status",className:"inline-flex items-center gap-2",children:[e.jsx(z,{size:16,className:"animate-spin"}),t("markdown.loading")]}),b]}):e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{type:"button",className:"table-action","aria-pressed":l,"aria-label":t(l?"markdown.rendered":"html.source"),title:t(l?"markdown.rendered":"html.source"),onClick:()=>w(!l),children:l?e.jsx(y,{size:14}):e.jsx(E,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("html.reload"),title:t("html.reload"),onClick:()=>u(x+1),children:e.jsx(C,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("attach.saveAria",{name:n}),title:t("attach.saveAria",{name:n}),disabled:a.state==="saving",onClick:()=>{a.save()},children:e.jsx(j,{size:14})})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:a.reason}),e.jsx(F,{source:p,showSource:l})]})}function F({source:r,showSource:n}){return n?e.jsx("pre",{className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-inset p-3 text-[12px] leading-5 whitespace-pre-wrap break-words text-ink",children:r}):e.jsx("div",{"data-markdown-file":!0,className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-panel px-5 py-4 text-[14px] leading-6 text-ink",children:e.jsx(S,{text:r})})}export{A as MARKDOWN_PREVIEW_MAX_BYTES,F as MarkdownFileView,D as default};
1
+ import{r as i,j as e,t}from"./styles-DnkNzLDs.js";import{E as v,F as k,H as N,J as j,K as y,M as E,R as C,N as S}from"./App-B6W9JFXZ.js";import{L as z}from"./PlacesRail-fw4FbMbq.js";import"./index-Bh1qTRXw.js";import"./monitor-D-rHzZVy.js";import"./MenuMotion-xBTC4eOZ.js";const A=2*1024*1024;function D({path:r,name:n,message:d}){const[x,u]=i.useState(0),[p,h]=i.useState(null),[c,m]=i.useState(null),[l,w]=i.useState(!1),a=v(r,n,d);i.useEffect(()=>{const o=new AbortController;return m(null),h(null),(async()=>{let f=!1;try{const s=await k(r,d,o.signal);f=!0;const g=await N(s,o.signal,A,"windows-1252");o.signal.aborted||h(g)}catch(s){if(o.signal.aborted)return;!f&&s instanceof Error&&!(s instanceof TypeError)?m({reason:s.message}):m(s instanceof Error&&s.message==="size"?"size":"load")}})(),()=>o.abort()},[r,d.threadId,d.messageId,x]);const b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 flex flex-wrap justify-center gap-2",children:[e.jsxs("button",{type:"button",className:"inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-lg border border-hairline px-3 py-2 hover:bg-raised",disabled:a.state==="saving",onClick:()=>{a.save()},children:[e.jsx(j,{size:14,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 break-all",children:t("attach.saveAria",{name:n})})]}),e.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>u(x+1),children:t("chat.retry")})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:a.reason})]});return c?e.jsxs("div",{className:"p-8 text-center text-sm",children:[e.jsx("p",{role:"alert",className:"text-ink-secondary",children:typeof c=="object"?t("markdown.refused",{reason:c.reason}):t(c==="size"?"markdown.tooLarge":"markdown.loadFailed")}),b]}):p===null?e.jsxs("div",{className:"p-12 text-center text-sm text-ink-secondary",children:[e.jsxs("span",{role:"status",className:"inline-flex items-center gap-2",children:[e.jsx(z,{size:16,className:"animate-spin"}),t("markdown.loading")]}),b]}):e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{type:"button",className:"table-action","aria-pressed":l,"aria-label":t(l?"markdown.rendered":"html.source"),title:t(l?"markdown.rendered":"html.source"),onClick:()=>w(!l),children:l?e.jsx(y,{size:14}):e.jsx(E,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("html.reload"),title:t("html.reload"),onClick:()=>u(x+1),children:e.jsx(C,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("attach.saveAria",{name:n}),title:t("attach.saveAria",{name:n}),disabled:a.state==="saving",onClick:()=>{a.save()},children:e.jsx(j,{size:14})})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:a.reason}),e.jsx(F,{source:p,showSource:l})]})}function F({source:r,showSource:n}){return n?e.jsx("pre",{className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-inset p-3 text-[12px] leading-5 whitespace-pre-wrap break-words text-ink",children:r}):e.jsx("div",{"data-markdown-file":!0,className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-panel px-5 py-4 text-[14px] leading-6 text-ink",children:e.jsx(S,{text:r})})}export{A as MARKDOWN_PREVIEW_MAX_BYTES,F as MarkdownFileView,D as default};
@@ -1 +1 @@
1
- import{c as o,r as a}from"./styles-C8d057NY.js";const d=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],M=o("chevron-right",d);const i=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],y=o("keyboard",i);const s=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],k=o("refresh-cw",s);const u=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],l=o("send",u),h=200;function p(){return typeof document>"u"?!1:document.documentElement.dataset.reducedMotion==="true"?!0:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f(e){const[t,n]=a.useState(e);a.useLayoutEffect(()=>{if(e){n(!0);return}if(!t)return;if(p()){n(!1);return}const c=window.setTimeout(()=>n(!1),h);return()=>window.clearTimeout(c)},[e,t]);const r=!e&&t;return{shown:e||t,closing:r,className:r?"animate-pop-out pointer-events-none":"animate-pop-in",exitProps:r?{inert:!0,"aria-hidden":!0}:{}}}function w(e){const t=f(e!=null),n=a.useRef(e);return e!=null&&(n.current=e),{...t,value:e??n.current}}export{M as C,y as K,k as R,l as S,f as a,w as u};
1
+ import{c as o,r as a}from"./styles-DnkNzLDs.js";const d=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],M=o("chevron-right",d);const i=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],y=o("keyboard",i);const s=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],k=o("refresh-cw",s);const u=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],l=o("send",u),h=200;function p(){return typeof document>"u"?!1:document.documentElement.dataset.reducedMotion==="true"?!0:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f(e){const[t,n]=a.useState(e);a.useLayoutEffect(()=>{if(e){n(!0);return}if(!t)return;if(p()){n(!1);return}const c=window.setTimeout(()=>n(!1),h);return()=>window.clearTimeout(c)},[e,t]);const r=!e&&t;return{shown:e||t,closing:r,className:r?"animate-pop-out pointer-events-none":"animate-pop-in",exitProps:r?{inert:!0,"aria-hidden":!0}:{}}}function w(e){const t=f(e!=null),n=a.useRef(e);return e!=null&&(n.current=e),{...t,value:e??n.current}}export{M as C,y as K,k as R,l as S,f as a,w as u};
@@ -1 +1 @@
1
- import{t as s,r as l,b as De,j as e,X as we,d as Oe,a as te,ai as je,aj as Me,v as Ue,w as Fe,ak as ze,al as Ie,am as Ke,m as ke,l as H,an as _e,ao as $e,ap as qe,aq as He,ar as Je,p as ce,H as Ye}from"./styles-C8d057NY.js";import{j as C,D as Ve,u as S,bX as se,bY as We,a1 as v,S as R,bZ as Xe,b_ as Se,b$ as ne,c0 as Ge,c1 as Ze,c2 as Qe,c3 as et,c4 as de,c5 as ue,c6 as tt,c7 as st,c8 as nt,c9 as Ne,w as D,ca as at,cb as it,cc as rt,cd as lt,b as Ce,ce as pe,cf as ot,cg as ct,ch as dt,ci as ut,cj as pt,ck as mt,cl as xt,cm as gt,cn as ht,co as ft,cp as bt,cq as vt,cr as me,cs as yt,ct as wt,cu as jt,cv as kt,cw as Ee,bL as ee,cx as St,cy as Nt,cz as Ct,cA as Et,cB as Bt,cC as xe,T as Be,cD as Rt}from"./App-Cs_sQgN3.js";import{B as ge,E as Pt,s as At,r as he,p as Tt,c as Lt,a as Dt}from"./new-bot-DylEMxP3.js";import{o as Ot}from"./index-Cx0TrR7Z.js";import{I as Mt,S as Ut,a as Ft,A as zt,M as It,P as Kt,V as _t,v as $t,i as fe}from"./VisibilitySection-Du5EURZP.js";import{R as qt}from"./RoutinesPage-xZq6f7F7.js";import{r as Ht,L as W,Q as Jt,R as Yt,U as Vt,P as Wt}from"./PlacesRail-cbzNti8k.js";import{p as Xt,d as Gt,e as Zt,f as Qt}from"./team-share-ijObVLAA.js";import{B as es}from"./BrowserProfilesManager-BFS9rfCH.js";function ts(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function ss(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function ns(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function as(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function is(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function be(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function ve({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Gt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ve,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Zt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function rs({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[y,O]=l.useState(!0),[w,x]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,X]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Xt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${De(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:y,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(be({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,y,w]);const G=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(be($(!1)))});Qt(u.filename,u.document),X(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Ht.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(we,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:M?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Oe,{size:16,className:"text-success"}),s("teamShare.saved",{filename:M.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(ve,{preview:M,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(ve,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>x(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:y,onChange:u=>O(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:M?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{G()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(W,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ae(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Ts(){const{state:t}=S(),n=se(t.config),a=We(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ae();return e.jsx(v,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Xe(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ls(){const{state:t}=S(),n=Se(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ae();return a===void 0||n!==!0||!se(t.config)?null:e.jsx(v,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ls(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ae();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function os(){const{state:t,dispatch:n}=S(),a=ne(t.config),i=Ge(t.config),r=Ze(t.config),d=Qe(t.config),c=et(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,y]=l.useState(!1),[O,w]=l.useState(!1),[x,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=tt(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:ue,max:de}));return}await b({skillReviewSteps:f})&&y(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:O||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(cs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:O,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${x?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ue,max:de,step:1,inputMode:"numeric",value:p,disabled:O,"aria-invalid":!!x,onChange:f=>{o(f.target.value),y(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,x?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:x}):null]})}function cs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ds=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!st(t.config))return null;const c=ne(t.config),p=nt(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const y=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:y})}catch(y){d(y instanceof Error?y.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ds.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:te("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ps(){return e.jsxs(e.Fragment,{children:[e.jsx(os,{}),e.jsx(us,{})]})}function Ds({title:t=s("settings.updates.title")}){const n=vt(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:ce(),version:n.version??""}):s("settings.updates.ready",{app:ce(),version:n.version??""}):n.status==="installing"?me(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:me(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(v,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Re(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:kt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Pe({effort:t,className:n}){return e.jsxs(D,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),yt.map(a=>e.jsx("option",{value:a,children:wt(a)},a))]})}function Os(){const t=Re();return e.jsx(v,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Pe,{effort:t,className:"w-full max-w-[240px]"})})}function ms({onEdit:t,onShare:n}){const a=Re();return e.jsx(v,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function xs(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Jt().onboarding,hintsSeen:jt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ms(){const{dispatch:t}=S();return e.jsx(v,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(xs,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Us({simple:t=!1}){const{state:n}=S(),a=Ue(Fe(),n.config?.language);return e.jsx(v,{title:s("settings.language.title"),subtitle:Ke()?s("settings.language.subtitleComplete"):t?ke()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>Ie(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),ze.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Fs(){const t=rt(),n=H("Gợi ý tin nhắn tiếp theo","Next-message suggestions");return e.jsx(v,{title:n,subtitle:H("Chế độ tự động có thể dùng lượt gọi mô hình của bot trên cuộc trò chuyện hiện tại.","Automatic mode can use an extra model call for the current conversation."),children:e.jsxs(D,{size:"sm",value:t,"aria-label":n,onChange:a=>lt(a.target.value),children:[e.jsx("option",{value:"auto",children:H("Tự động","Automatic")}),e.jsx("option",{value:"local",children:H("Chỉ dùng quy tắc cục bộ","Local rules only")}),e.jsx("option",{value:"off",children:H("Tắt","Off")})]})})}function zs({simple:t=!1}){const n=Ce();return e.jsx(v,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:pe("mod-enter")}),children:e.jsx(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>ot(ct(a.target.value)),children:_e.map(a=>e.jsx("option",{value:a,children:pe(a)},a))})})}function Is({simple:t=!1}){const n=dt(),a=ut(Ce());return e.jsx(v,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>pt(mt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Ks({simple:t=!1}){const n=at();return e.jsx(v,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>it(!n)})})}function _s({simple:t=!1}){const n=je();return e.jsx(v,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Me(!n)})})}function $s(){const t=$e();return e.jsx(v,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>qe(!t)})})}function qs(){const t=xt();return e.jsx(v,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>gt(!t)})})}function Hs(){const t=He();return e.jsx(v,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>Je(!t)})})}function Js(){const t=ht();return e.jsx(v,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>ft(!t)})})}function Ys(){const{state:t,dispatch:n}=S(),a=bt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(v,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function Vs(){const{state:t,dispatch:n}=S(),a=ne(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Ne,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(ps,{}),e.jsx(ls,{})]})}function Ws(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!se(t.config)&&n.length===0?null:e.jsx(Ne,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(es,{})})}const ye=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],gs={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Ae(t){return e.jsx(Yt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Vt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(m=>m+1))),[y,O]=l.useState("Identity"),[w,x]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,M]=l.useState(""),[X,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,G]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ye(),Te=je()?ye:ye.filter(m=>m!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let m=!1;return C("/api/bot-defaults").then(B=>{if(m)return;const j=At(B,!t),k=t?void 0:r??(i?ee(i):void 0),U=new ge(k?St(j,k,ke()):j,()=>p(V=>V+1));k&&ee(k.id)&&(U.role=k.id),h(U),x(!0)}).catch(B=>{m||M(String(B))}),()=>{m=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&J.current?.focus()},[b]),l.useEffect(()=>{const m=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!d())return;const k=J.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const U=k.querySelector('[role="dialog"], [role="alertdialog"]');if(U&&U.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),q.current()),j.key!=="Tab"))return;const V=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(oe=>oe.getClientRects().length&&!oe.closest("[hidden],fieldset:disabled")),Z=V[0],Q=V.at(-1);if(!Z||!Q){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===k)?(j.preventDefault(),Q.focus()):!j.shiftKey&&(document.activeElement===Q||document.activeElement===k)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),m?.isConnected&&m.focus()}},[d]);const re=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const m=ie?$t(F,$):null;if(m&&!m.ok){M(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),M(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Tt(o)})});else{const{bot:B,warnings:j,paused:k}=await Lt(o,void 0,void 0,void 0,m?.ok?m.visibility:void 0,z?he(u,o.bot.section,c.state.bots,z)??void 0:void 0);Dt(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(U){c.dispatch({type:"error",message:U instanceof Error?U.message:String(U)})}}A.current=!1,f.current&&q.current()}catch(B){f.current&&M(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},Y=o.bot,Le={...c,state:{...c.state,bots:[Y,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>Y,dispatch:m=>{m.type==="updateBot"&&m.botId===o.id?o.patch(m.patch):m.type==="setModel"&&m.botId===o.id?(o.setModel(m.selection),m.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):m.type==="routinePatched"||m.type==="toggleSettings"||c.dispatch(m)}},le=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":le,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:le}),e.jsx("button",{type:"button",onClick:()=>q.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(we,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(fs,{team:K}),ie&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(D,{size:"sm",value:F,disabled:b,onChange:m=>_(m.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:m=>G(m.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Te.map(m=>e.jsx("button",{type:"button",onClick:()=>O(m),"aria-current":y===m?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===m?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[m])},m))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(Nt,{value:Le,children:e.jsx(Ct.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(bs,{active:y,draft:o,defaultsMode:t,owner:z&&!t?{value:he(u,Y.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>q.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!Y.name.trim(),onClick:()=>{re()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(W,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:X==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),re()}})]})})}function fs({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Ot(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function bs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ee(),p=Bt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(vs,{draft:n,defaultsMode:a}),e.jsx(Mt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(D,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ut,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ft,{bot:r}):t==="Memory"?e.jsx(ys,{draft:n}):t==="Routines"?e.jsx(ws,{draft:n}):t==="Access"?e.jsx(zt,{bot:r,derived:p}):t==="Model"?e.jsx(It,{bot:r}):t==="Permissions"?e.jsx(Kt,{bot:r,derived:p}):e.jsx(_t,{bot:r,derived:p})}function vs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let x=!1;return C("/api/bot-presets").then(g=>{x||i(g.presets)}).catch(()=>{x||i([])}),()=>{x=!0}},[n,r]);const h=t.preset?a.find(x=>x.id===t.preset.id):void 0,y=async x=>{p("");const g=x.startsWith("preset:")?a.find(b=>b.id===x.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=xe.find(f=>f.id===x);t.chooseRole(b?.id);const A=b&&ee(b.id)?.look;b&&t.patch({...Rt(b),...A});return}t.patch(ss(g)),t.choosePreset(is(g));const P=ns(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},O=async x=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(x.id)}`,{method:"DELETE"}),t.preset?.id===x.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=xe.map(x=>e.jsx("option",{value:x.id,children:x.title},x.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:x=>{y(x.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(x=>e.jsx("optgroup",{label:x.label,children:x.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},x.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[as(h).map((x,g)=>e.jsx("p",{className:"break-words",children:x},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{O(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function ys({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:te(fe,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:fe,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Wt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Be,{size:16})})]})]})}function ws({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Be,{size:15})})]},i.id)),n&&e.jsx(qt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function js({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Ae,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(rs,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(ms,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(v,{title:s("newBot.defaults"),children:c})}const Xs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:js,NewBotDialog:Ae},Symbol.toStringTag,{value:"Module"}));export{_s as A,Ts as B,Ks as C,js as D,Vs as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Ys as T,Ds as U,Ws as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Xs as g};
1
+ import{t as s,r as l,b as De,j as e,X as we,d as Oe,a as te,ai as je,aj as Me,v as Ue,w as Fe,ak as ze,al as Ie,am as Ke,m as ke,l as H,an as _e,ao as $e,ap as qe,aq as He,ar as Je,p as ce,H as Ye}from"./styles-DnkNzLDs.js";import{j as C,D as Ve,u as S,bX as se,bY as We,a1 as v,S as R,bZ as Xe,b_ as Se,b$ as ne,c0 as Ge,c1 as Ze,c2 as Qe,c3 as et,c4 as de,c5 as ue,c6 as tt,c7 as st,c8 as nt,c9 as Ne,w as D,ca as at,cb as it,cc as rt,cd as lt,b as Ce,ce as pe,cf as ot,cg as ct,ch as dt,ci as ut,cj as pt,ck as mt,cl as xt,cm as gt,cn as ht,co as ft,cp as bt,cq as vt,cr as me,cs as yt,ct as wt,cu as jt,cv as kt,cw as Ee,bL as ee,cx as St,cy as Nt,cz as Ct,cA as Et,cB as Bt,cC as xe,T as Be,cD as Rt}from"./App-B6W9JFXZ.js";import{B as ge,E as Pt,s as At,r as he,p as Tt,c as Lt,a as Dt}from"./new-bot-78Wk4hfY.js";import{o as Ot}from"./index-Bh1qTRXw.js";import{I as Mt,S as Ut,a as Ft,A as zt,M as It,P as Kt,V as _t,v as $t,i as fe}from"./VisibilitySection-ChKxjJ5C.js";import{R as qt}from"./RoutinesPage-CFb9pR_B.js";import{r as Ht,L as W,Q as Jt,R as Yt,U as Vt,P as Wt}from"./PlacesRail-fw4FbMbq.js";import{p as Xt,d as Gt,e as Zt,f as Qt}from"./team-share-DwBBsedz.js";import{B as es}from"./BrowserProfilesManager-48HNAHJm.js";function ts(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function ss(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function ns(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function as(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function is(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function be(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function ve({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Gt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ve,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Zt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function rs({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[y,O]=l.useState(!0),[w,x]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,X]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Xt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${De(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:y,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(be({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,y,w]);const G=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(be($(!1)))});Qt(u.filename,u.document),X(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Ht.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(we,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:M?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Oe,{size:16,className:"text-success"}),s("teamShare.saved",{filename:M.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(ve,{preview:M,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(ve,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>x(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:y,onChange:u=>O(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:M?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{G()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(W,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ae(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Ts(){const{state:t}=S(),n=se(t.config),a=We(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ae();return e.jsx(v,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Xe(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ls(){const{state:t}=S(),n=Se(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ae();return a===void 0||n!==!0||!se(t.config)?null:e.jsx(v,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ls(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ae();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function os(){const{state:t,dispatch:n}=S(),a=ne(t.config),i=Ge(t.config),r=Ze(t.config),d=Qe(t.config),c=et(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,y]=l.useState(!1),[O,w]=l.useState(!1),[x,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=tt(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:ue,max:de}));return}await b({skillReviewSteps:f})&&y(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:O||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(cs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:O,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${x?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ue,max:de,step:1,inputMode:"numeric",value:p,disabled:O,"aria-invalid":!!x,onChange:f=>{o(f.target.value),y(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,x?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:x}):null]})}function cs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ds=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!st(t.config))return null;const c=ne(t.config),p=nt(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const y=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:y})}catch(y){d(y instanceof Error?y.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ds.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:te("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ps(){return e.jsxs(e.Fragment,{children:[e.jsx(os,{}),e.jsx(us,{})]})}function Ds({title:t=s("settings.updates.title")}){const n=vt(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:ce(),version:n.version??""}):s("settings.updates.ready",{app:ce(),version:n.version??""}):n.status==="installing"?me(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:me(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(v,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Re(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:kt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Pe({effort:t,className:n}){return e.jsxs(D,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),yt.map(a=>e.jsx("option",{value:a,children:wt(a)},a))]})}function Os(){const t=Re();return e.jsx(v,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Pe,{effort:t,className:"w-full max-w-[240px]"})})}function ms({onEdit:t,onShare:n}){const a=Re();return e.jsx(v,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function xs(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Jt().onboarding,hintsSeen:jt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ms(){const{dispatch:t}=S();return e.jsx(v,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(xs,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Us({simple:t=!1}){const{state:n}=S(),a=Ue(Fe(),n.config?.language);return e.jsx(v,{title:s("settings.language.title"),subtitle:Ke()?s("settings.language.subtitleComplete"):t?ke()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>Ie(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),ze.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Fs(){const t=rt(),n=H("Gợi ý tin nhắn tiếp theo","Next-message suggestions");return e.jsx(v,{title:n,subtitle:H("Chế độ tự động có thể dùng lượt gọi mô hình của bot trên cuộc trò chuyện hiện tại.","Automatic mode can use an extra model call for the current conversation."),children:e.jsxs(D,{size:"sm",value:t,"aria-label":n,onChange:a=>lt(a.target.value),children:[e.jsx("option",{value:"auto",children:H("Tự động","Automatic")}),e.jsx("option",{value:"local",children:H("Chỉ dùng quy tắc cục bộ","Local rules only")}),e.jsx("option",{value:"off",children:H("Tắt","Off")})]})})}function zs({simple:t=!1}){const n=Ce();return e.jsx(v,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:pe("mod-enter")}),children:e.jsx(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>ot(ct(a.target.value)),children:_e.map(a=>e.jsx("option",{value:a,children:pe(a)},a))})})}function Is({simple:t=!1}){const n=dt(),a=ut(Ce());return e.jsx(v,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>pt(mt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Ks({simple:t=!1}){const n=at();return e.jsx(v,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>it(!n)})})}function _s({simple:t=!1}){const n=je();return e.jsx(v,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Me(!n)})})}function $s(){const t=$e();return e.jsx(v,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>qe(!t)})})}function qs(){const t=xt();return e.jsx(v,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>gt(!t)})})}function Hs(){const t=He();return e.jsx(v,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>Je(!t)})})}function Js(){const t=ht();return e.jsx(v,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>ft(!t)})})}function Ys(){const{state:t,dispatch:n}=S(),a=bt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(v,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function Vs(){const{state:t,dispatch:n}=S(),a=ne(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Ne,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(ps,{}),e.jsx(ls,{})]})}function Ws(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!se(t.config)&&n.length===0?null:e.jsx(Ne,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(es,{})})}const ye=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],gs={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Ae(t){return e.jsx(Yt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Vt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(m=>m+1))),[y,O]=l.useState("Identity"),[w,x]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,M]=l.useState(""),[X,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,G]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ye(),Te=je()?ye:ye.filter(m=>m!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let m=!1;return C("/api/bot-defaults").then(B=>{if(m)return;const j=At(B,!t),k=t?void 0:r??(i?ee(i):void 0),U=new ge(k?St(j,k,ke()):j,()=>p(V=>V+1));k&&ee(k.id)&&(U.role=k.id),h(U),x(!0)}).catch(B=>{m||M(String(B))}),()=>{m=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&J.current?.focus()},[b]),l.useEffect(()=>{const m=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!d())return;const k=J.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const U=k.querySelector('[role="dialog"], [role="alertdialog"]');if(U&&U.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),q.current()),j.key!=="Tab"))return;const V=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(oe=>oe.getClientRects().length&&!oe.closest("[hidden],fieldset:disabled")),Z=V[0],Q=V.at(-1);if(!Z||!Q){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===k)?(j.preventDefault(),Q.focus()):!j.shiftKey&&(document.activeElement===Q||document.activeElement===k)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),m?.isConnected&&m.focus()}},[d]);const re=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const m=ie?$t(F,$):null;if(m&&!m.ok){M(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),M(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Tt(o)})});else{const{bot:B,warnings:j,paused:k}=await Lt(o,void 0,void 0,void 0,m?.ok?m.visibility:void 0,z?he(u,o.bot.section,c.state.bots,z)??void 0:void 0);Dt(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(U){c.dispatch({type:"error",message:U instanceof Error?U.message:String(U)})}}A.current=!1,f.current&&q.current()}catch(B){f.current&&M(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},Y=o.bot,Le={...c,state:{...c.state,bots:[Y,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>Y,dispatch:m=>{m.type==="updateBot"&&m.botId===o.id?o.patch(m.patch):m.type==="setModel"&&m.botId===o.id?(o.setModel(m.selection),m.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):m.type==="routinePatched"||m.type==="toggleSettings"||c.dispatch(m)}},le=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":le,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:le}),e.jsx("button",{type:"button",onClick:()=>q.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(we,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(fs,{team:K}),ie&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(D,{size:"sm",value:F,disabled:b,onChange:m=>_(m.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:m=>G(m.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Te.map(m=>e.jsx("button",{type:"button",onClick:()=>O(m),"aria-current":y===m?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===m?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[m])},m))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(Nt,{value:Le,children:e.jsx(Ct.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(bs,{active:y,draft:o,defaultsMode:t,owner:z&&!t?{value:he(u,Y.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>q.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!Y.name.trim(),onClick:()=>{re()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(W,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:X==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),re()}})]})})}function fs({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Ot(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function bs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ee(),p=Bt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(vs,{draft:n,defaultsMode:a}),e.jsx(Mt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(D,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ut,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ft,{bot:r}):t==="Memory"?e.jsx(ys,{draft:n}):t==="Routines"?e.jsx(ws,{draft:n}):t==="Access"?e.jsx(zt,{bot:r,derived:p}):t==="Model"?e.jsx(It,{bot:r}):t==="Permissions"?e.jsx(Kt,{bot:r,derived:p}):e.jsx(_t,{bot:r,derived:p})}function vs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let x=!1;return C("/api/bot-presets").then(g=>{x||i(g.presets)}).catch(()=>{x||i([])}),()=>{x=!0}},[n,r]);const h=t.preset?a.find(x=>x.id===t.preset.id):void 0,y=async x=>{p("");const g=x.startsWith("preset:")?a.find(b=>b.id===x.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=xe.find(f=>f.id===x);t.chooseRole(b?.id);const A=b&&ee(b.id)?.look;b&&t.patch({...Rt(b),...A});return}t.patch(ss(g)),t.choosePreset(is(g));const P=ns(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},O=async x=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(x.id)}`,{method:"DELETE"}),t.preset?.id===x.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=xe.map(x=>e.jsx("option",{value:x.id,children:x.title},x.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:x=>{y(x.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(x=>e.jsx("optgroup",{label:x.label,children:x.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},x.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[as(h).map((x,g)=>e.jsx("p",{className:"break-words",children:x},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{O(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function ys({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:te(fe,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:fe,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Wt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Be,{size:16})})]})]})}function ws({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Be,{size:15})})]},i.id)),n&&e.jsx(qt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function js({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Ae,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(rs,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(ms,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(v,{title:s("newBot.defaults"),children:c})}const Xs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:js,NewBotDialog:Ae},Symbol.toStringTag,{value:"Module"}));export{_s as A,Ts as B,Ks as C,js as D,Vs as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Ys as T,Ds as U,Ws as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Xs as g};
@@ -1 +1 @@
1
- import{r as d,j as t,t as n}from"./styles-C8d057NY.js";import{r as c}from"./PlacesRail-cbzNti8k.js";import{x,y as p,Q as m,z as u}from"./App-Cs_sQgN3.js";import"./monitor-ylRMuFnb.js";import"./index-Cx0TrR7Z.js";import"./MenuMotion-BanPNWqt.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};
1
+ import{r as d,j as t,t as n}from"./styles-DnkNzLDs.js";import{r as c}from"./PlacesRail-fw4FbMbq.js";import{x,y as p,Q as m,z as u}from"./App-B6W9JFXZ.js";import"./monitor-D-rHzZVy.js";import"./index-Bh1qTRXw.js";import"./MenuMotion-xBTC4eOZ.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};