limixbot 0.3.143 → 0.3.145

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 (148) hide show
  1. package/dist/assets/{ActivityPanel-D5VsAHpV.js → ActivityPanel-CqObZQbN.js} +1 -1
  2. package/dist/assets/{App-BFnQK962.js → App-DcG1JmK6.js} +126 -126
  3. package/dist/assets/{AppEventEditor-npoRs7Gv.js → AppEventEditor-DR01sHAK.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-DyQB_KER.js → BotSettingsDialog-BHgSIU9E.js} +1 -1
  5. package/dist/assets/{BrowserPanel-B-Gb4Ryo.js → BrowserPanel-g96rlnqQ.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-C4_r4TCi.js → BrowserProfilesManager-UJJC6OPf.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-BiZwg41q.js → CloudAddDialog-BjPYPhnk.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-DfJRiNEq.js → ComputerFilesPane-DA7MBSD0.js} +1 -1
  9. package/dist/assets/{ComputerPanel-WDw0cKiS.js → ComputerPanel--rY7_KCN.js} +2 -2
  10. package/dist/assets/{DataPanel-CA6Q5vTA.js → DataPanel-CEhe1WKo.js} +1 -1
  11. package/dist/assets/{DesktopViewer-CiOyDjp2.js → DesktopViewer-RNuariIo.js} +1 -1
  12. package/dist/assets/{GrokMoveDialog-CdQMwpiq.js → GrokMoveDialog-DoUN6m5b.js} +1 -1
  13. package/dist/assets/{InspectorPanel-6owsh6AF.js → InspectorPanel-CdCXUouJ.js} +1 -1
  14. package/dist/assets/{KeyboardShortcutsModal-BmmNyVQ1.js → KeyboardShortcutsModal-CZ-BQqzV.js} +1 -1
  15. package/dist/assets/{LimixResizeHandles-B9fy1QSR.js → LimixResizeHandles-BUe_6hSJ.js} +1 -1
  16. package/dist/assets/{LiveDesktop-BjD6CYlm.js → LiveDesktop-BnaxuTzU.js} +1 -1
  17. package/dist/assets/{LocalVmWorkspace-CKA42noW.js → LocalVmWorkspace-X1ev9Wov.js} +1 -1
  18. package/dist/assets/{MacLocalControl-CR4SkBMx.js → MacLocalControl-RXW-1ET9.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-DpSyTelP.js → MarkdownFilePreview-CIYTKbNj.js} +1 -1
  20. package/dist/assets/{MenuMotion-CJ3EL6xi.js → MenuMotion-C-qcisoG.js} +1 -1
  21. package/dist/assets/{NewBotDialog-CTj8zOTI.js → NewBotDialog-D_22AmDd.js} +1 -1
  22. package/dist/assets/{PhoneAppDialog-DUOfnoVL.js → PhoneAppDialog-WOhzSF82.js} +1 -1
  23. package/dist/assets/{PlacesRail-owo7-LYs.js → PlacesRail-DoUGQSpd.js} +1 -1
  24. package/dist/assets/{PluginsPanel-BaDKsIiF.js → PluginsPanel-DxM_qWtC.js} +1 -1
  25. package/dist/assets/{ProIntroduction-ygc-IDwt.js → ProIntroduction-CQFDxYxi.js} +1 -1
  26. package/dist/assets/{RemoteAgentSettingsPanel-Bsk-uLU6.js → RemoteAgentSettingsPanel-CdQmz7Qu.js} +1 -1
  27. package/dist/assets/{RoomPanel-Beak5cFq.js → RoomPanel-DVsYTCX7.js} +1 -1
  28. package/dist/assets/{RoutinesPage-E0_zyR6z.js → RoutinesPage-DG30sQw7.js} +1 -1
  29. package/dist/assets/SettingsModal-BFeWJ1OS.js +20 -0
  30. package/dist/assets/{ShareTeamDialog-0eIGkV95.js → ShareTeamDialog-BLddRjax.js} +1 -1
  31. package/dist/assets/{SignedInSites-DJDN1MMs.js → SignedInSites-BREmZ6gH.js} +1 -1
  32. package/dist/assets/{TeamLibraryPanel-T_B92anY.js → TeamLibraryPanel-Sg1D_gYP.js} +1 -1
  33. package/dist/assets/{TeamMapPage-BRnNgoL4.js → TeamMapPage-CP7ug7dF.js} +1 -1
  34. package/dist/assets/{TriggersPage-B9x6InCY.js → TriggersPage-DmY-ibGg.js} +1 -1
  35. package/dist/assets/{VisibilitySection-CM3W0MSu.js → VisibilitySection-BqQTMT_O.js} +1 -1
  36. package/dist/assets/{WebhookTrigger-CBbyorl9.js → WebhookTrigger-Bk2khhKt.js} +1 -1
  37. package/dist/assets/{WorksOnGrid-D_dPyzr3.js → WorksOnGrid-BhZTjLmG.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-BShIKw4N.js → abnfDiagram-YUKMZFIV-4h66COg4.js} +1 -1
  39. package/dist/assets/{activity-Dg86AW-Y.js → activity-JVyqvn--.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-CmJg21RW.js → architectureDiagram-47P4ROYG-XVFtgz_w.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-Aj1hwdGc.js → blockDiagram-E7TT5TSB-Bzpnrunu.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-DW8z1IzA.js → c4Diagram-CRA5TL53-Baf7lWcX.js} +1 -1
  43. package/dist/assets/{calendar-days-uny4AeNj.js → calendar-days-DJ8Sk4Wo.js} +1 -1
  44. package/dist/assets/channel-DJthUr0W.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-Td582DAI.js → chunk-2Q5K7J3B-C01NJDuW.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-DcogMbBa.js → chunk-5VM5RSS4-zCxCK82Z.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-C3iGtJOF.js → chunk-7TKQ45FW-Dn3xzwzp.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-CrMPDJa8.js → chunk-AW2ZBBNX-D5v1LEvi.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-o1j5js-h.js → chunk-FVRAUYC3-B_j2BQfP.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-11Po0gGl.js → chunk-HTAEGDNF-CYEfb4lj.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-DNNG2IRB.js → chunk-JWPE2WC7-DYxCqsdI.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-8bqxTMty.js → chunk-KQW6MTUR-BVs1owNv.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-nBGQqm9O.js → chunk-XXDRQBXY-oNREPc9w.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-tyTV-26Y.js → classDiagram-v2-K4WV4PDN-B8JOWdQM.js} +1 -1
  55. package/dist/assets/{coins-9fYbHf4u.js → coins-D-zVxeJ6.js} +1 -1
  56. package/dist/assets/{core-C06bWOSD.js → core-DGyt94O8.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-B3N4BJ97.js → cose-bilkent-JH36ORCC-Cvvvdg2x.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-CkGBluyX.js → cynefin-EF2NZ3EQ-BlyJPVpP.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-Cw7BUT2F.js → cynefinDiagram-3GCD6N5R-aXWhkS0N.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-D0Adi0WD.js → dagre-W4DXFKR2-CK9mZlxS.js} +1 -1
  61. package/dist/assets/{diagram-2UJZ2QOL-DglYBdi-.js → diagram-2UJZ2QOL-ciDDPAUW.js} +1 -1
  62. package/dist/assets/{diagram-OVF4WLC6-BCESoOTI.js → diagram-OVF4WLC6-ZC2XGXAQ.js} +1 -1
  63. package/dist/assets/{diagram-PFPMY2P6-CJPe3Aln.js → diagram-PFPMY2P6-B_UNW8Y1.js} +1 -1
  64. package/dist/assets/{diagram-UMYRVEAY-dihXhKwO.js → diagram-UMYRVEAY-BzqwG15l.js} +1 -1
  65. package/dist/assets/{diagram-YEKJPTXX-fMI2BfDq.js → diagram-YEKJPTXX-f7zBrJwE.js} +1 -1
  66. package/dist/assets/{diagram-ZIFT7M5P-BsyTuxHx.js → diagram-ZIFT7M5P-QClomp2E.js} +1 -1
  67. package/dist/assets/{ebnfDiagram-VR2GEFS7-DqUUqK6O.js → ebnfDiagram-VR2GEFS7-BwcmIXBL.js} +1 -1
  68. package/dist/assets/{elk-IJKZMXRS-CInxAtfn.js → elk-IJKZMXRS-DPv8qzg-.js} +1 -1
  69. package/dist/assets/{erDiagram-O2IAPWRE-CtLhNkB3.js → erDiagram-O2IAPWRE-BHknllso.js} +1 -1
  70. package/dist/assets/{file-up-0W3zPN3C.js → file-up-B5lQ3tIu.js} +1 -1
  71. package/dist/assets/{flowDiagram-OXPTDLAJ-CSJXQyPz.js → flowDiagram-OXPTDLAJ-LwDo9oFR.js} +1 -1
  72. package/dist/assets/{ganttDiagram-R7TSEDQI-BxPwhRE_.js → ganttDiagram-R7TSEDQI-DDXQuF2p.js} +1 -1
  73. package/dist/assets/{gitGraphDiagram-XJZIOB7I-B7_5GQWX.js → gitGraphDiagram-XJZIOB7I-DxAL8MxK.js} +1 -1
  74. package/dist/assets/{import-name-DSkjrWGm.js → import-name-fUZKEQiu.js} +1 -1
  75. package/dist/assets/{index-x-tLeVCm.js → index-Bb6OwohQ.js} +1 -1
  76. package/dist/assets/{index-DZeZApXw.js → index-C_1rKgRm.js} +3 -3
  77. package/dist/assets/{infoDiagram-5W2HQ5XZ-DTe4tqre.js → infoDiagram-5W2HQ5XZ-BxZNIlp6.js} +1 -1
  78. package/dist/assets/{ishikawaDiagram-K3B6WC7H-D_lFS_pL.js → ishikawaDiagram-K3B6WC7H-C6c1u1w2.js} +1 -1
  79. package/dist/assets/{journeyDiagram-COXZFDF6-BWwkG9Wu.js → journeyDiagram-COXZFDF6-BrngL-3X.js} +1 -1
  80. package/dist/assets/{kanban-definition-P3RFRI5V-yY-GGfzv.js → kanban-definition-P3RFRI5V-BhTOtF-B.js} +1 -1
  81. package/dist/assets/{mermaid.core-DH28Cv2M.js → mermaid.core-Cy9_uq1T.js} +4 -4
  82. package/dist/assets/{mindmap-definition-LZFPQGKD--BlKMUpH.js → mindmap-definition-LZFPQGKD-Dr3QB9wA.js} +1 -1
  83. package/dist/assets/{minimize-Cub3T_xk.js → minimize-Ct6C2khA.js} +1 -1
  84. package/dist/assets/{monitor-Bt-Nw5iC.js → monitor-BZrhga_j.js} +1 -1
  85. package/dist/assets/{new-bot-RHcTiQhX.js → new-bot-DCA0S24E.js} +1 -1
  86. package/dist/assets/{org-library-CWZn7Pto.js → org-library-DgVAGwBY.js} +1 -1
  87. package/dist/assets/{package-format-pwodjdBX.js → package-format-BvWgfqGs.js} +1 -1
  88. package/dist/assets/{pegDiagram-BGZESJAR-xNMFigxg.js → pegDiagram-BGZESJAR-D0bSaHqd.js} +1 -1
  89. package/dist/assets/{pieDiagram-CAPJLFHJ-BeqCVqVc.js → pieDiagram-CAPJLFHJ-B8i7ox8l.js} +1 -1
  90. package/dist/assets/{quadrantDiagram-GDMTTRAM-BcXtvC07.js → quadrantDiagram-GDMTTRAM-BcJTpsdR.js} +1 -1
  91. package/dist/assets/{rail-Bh9Kz5ar.js → rail-Bzq4BbCt.js} +1 -1
  92. package/dist/assets/{railroadDiagram-SM67HX2B-BBvW1QlX.js → railroadDiagram-SM67HX2B-DSO-XOKW.js} +1 -1
  93. package/dist/assets/{remote-desktop-panel-ClKGLfg-.js → remote-desktop-panel-BVRS7AXc.js} +1 -1
  94. package/dist/assets/{requirementDiagram-X7JNWC4A-CJW-jnaM.js → requirementDiagram-X7JNWC4A-B5gEynme.js} +1 -1
  95. package/dist/assets/{sankeyDiagram-UM26HJRW-DM75AxXv.js → sankeyDiagram-UM26HJRW-CK2T6Pgm.js} +1 -1
  96. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-C89f2OJQ.js → sequenceDiagram-ZO4K6R2Y-Dx9DVGEG.js} +1 -1
  97. package/dist/assets/{sizeCapture-INFHLROL-FvDzKQKk.js → sizeCapture-INFHLROL-BbirmlCW.js} +1 -1
  98. package/dist/assets/{stateDiagram-v2-TBUQTH76-CBLS4xm0.js → stateDiagram-v2-TBUQTH76-CuJOlmiS.js} +1 -1
  99. package/dist/assets/{styles-Pta9BaPs.css → styles-CE5PtWhb.css} +1 -1
  100. package/dist/assets/{swimlanes-N4OXWK64-0bIYZbSm.js → swimlanes-N4OXWK64-BWFqBYF_.js} +1 -1
  101. package/dist/assets/swimlanesDiagram-K3J5GTZL-BjpCZGc-.js +8 -0
  102. package/dist/assets/{team-share-DLeRlsAM.js → team-share-1e1FK9fo.js} +1 -1
  103. package/dist/assets/{timeline-definition-YOQAKGHF-D90qmKgS.js → timeline-definition-YOQAKGHF-CzxPBKDi.js} +1 -1
  104. package/dist/assets/{usecaseDiagram-VIAY4XPW-ZU4U3uEB.js → usecaseDiagram-VIAY4XPW-B5-pXbU3.js} +1 -1
  105. package/dist/assets/{vennDiagram-BLWOH2XV-DaL2hish.js → vennDiagram-BLWOH2XV-BccL1p-U.js} +1 -1
  106. package/dist/assets/{wardleyDiagram-YMQ3BMBF-idgSzgFw.js → wardleyDiagram-YMQ3BMBF-DdJ9Pves.js} +1 -1
  107. package/dist/assets/{xychartDiagram-TAQBALBS-Dux_Zrd0.js → xychartDiagram-TAQBALBS-BAg7I3YQ.js} +1 -1
  108. package/dist/index.html +3 -3
  109. package/dist/rail.html +5 -5
  110. package/dist-server/index.js +1872 -1851
  111. package/dist-server/package.json +1 -1
  112. package/dist-server/server/cloud-codex-session.js +135 -0
  113. package/dist-server/server/cloud-connections.js +1 -0
  114. package/dist-server/server/index.js +9 -0
  115. package/dist-server/server/limix-skill-store.js +7 -0
  116. package/dist-server/server/routes/cloud-codex-session.js +47 -0
  117. package/dist-server/server/routes/config.js +50 -1
  118. package/package.json +1 -1
  119. package/skills/defuddle/LICENSE +21 -0
  120. package/skills/defuddle/SKILL.md +58 -0
  121. package/skills/defuddle/manifest.json +21 -0
  122. package/skills/json-canvas/LICENSE +21 -0
  123. package/skills/json-canvas/SKILL.md +265 -0
  124. package/skills/json-canvas/manifest.json +22 -0
  125. package/skills/json-canvas/references/EXAMPLES.md +329 -0
  126. package/skills/knap/LICENSE +21 -0
  127. package/skills/knap/SKILL.md +120 -0
  128. package/skills/knap/manifest.json +22 -0
  129. package/skills/obsidian-bases/LICENSE +21 -0
  130. package/skills/obsidian-bases/SKILL.md +619 -0
  131. package/skills/obsidian-bases/manifest.json +22 -0
  132. package/skills/obsidian-bases/references/FUNCTIONS_REFERENCE.md +173 -0
  133. package/skills/obsidian-cli/LICENSE +21 -0
  134. package/skills/obsidian-cli/SKILL.md +158 -0
  135. package/skills/obsidian-cli/manifest.json +21 -0
  136. package/skills/obsidian-headless/LICENSE +21 -0
  137. package/skills/obsidian-headless/SKILL.md +92 -0
  138. package/skills/obsidian-headless/manifest.json +23 -0
  139. package/skills/obsidian-markdown/LICENSE +21 -0
  140. package/skills/obsidian-markdown/SKILL.md +210 -0
  141. package/skills/obsidian-markdown/manifest.json +22 -0
  142. package/skills/obsidian-markdown/references/CALLOUTS.md +58 -0
  143. package/skills/obsidian-markdown/references/EMBEDS.md +70 -0
  144. package/skills/obsidian-markdown/references/PROPERTIES.md +63 -0
  145. package/dist/assets/SettingsModal-B7L3QwQY.js +0 -20
  146. package/dist/assets/channel-DI3JBS-g.js +0 -1
  147. package/dist/assets/swimlanesDiagram-K3J5GTZL-BDfw8Tlz.js +0 -8
  148. /package/dist/assets/{styles-B38kYzzJ.js → styles-CLQR3ehf.js} +0 -0
@@ -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,ah as je,ai as Me,q as Ue,v as Fe,aj as ze,ak as Ie,al as Ke,l as ke,am as _e,an as $e,ao as qe,ap as He,aq as Je,p as ce,G as Ve}from"./styles-B38kYzzJ.js";import{j as C,E as We,u as S,bV as se,bW as Ye,a2 as v,S as R,bX as Ge,bY as Se,bZ as ne,b_ as Xe,b$ as Ze,c0 as Qe,c1 as et,c2 as de,c3 as ue,c4 as tt,c5 as st,c6 as nt,c7 as Ne,w as D,c8 as at,c9 as it,ca as rt,x as H,cb as lt,b as Ce,cc as pe,cd as ot,ce as ct,cf as dt,cg as ut,ch as pt,ci as xt,cj as mt,ck as gt,cl as ht,cm as ft,cn as bt,co as vt,cp as xe,cq as yt,cr as wt,cs as jt,ct as kt,cu as Ee,bM as ee,cv as St,cw as Nt,cx as Ct,cy as Et,cz as Bt,cA as me,T as Be,cB as Rt}from"./App-BFnQK962.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-RHcTiQhX.js";import{o as Ot}from"./index-DZeZApXw.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-CM3W0MSu.js";import{R as qt}from"./RoutinesPage-E0_zyR6z.js";import{r as Ht,L as Y,Q as Jt,R as Vt,U as Wt,P as Yt}from"./PlacesRail-owo7-LYs.js";import{p as Gt,d as Xt,e as Zt,f as Qt}from"./team-share-DLeRlsAM.js";import{B as es}from"./BrowserProfilesManager-C4_r4TCi.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=>Xt(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(We,{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,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,G]=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 Gt([{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 X=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),G(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(Y,{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=>m(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:()=>{X()},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(Y,{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=Ye(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"):Ge(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=Xe(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),[m,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 ${m?"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":!!m,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,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):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"?xe(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:xe(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 xs({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 ms(){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(ms,{}),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(xt(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=mt();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 Vs(){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 Ws(){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 Ys(){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(Vt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Wt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(x=>x+1))),[y,O]=l.useState("Identity"),[w,m]=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(""),[G,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,X]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ve(),Te=je()?ye:ye.filter(x=>x!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)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(W=>W+1));k&&ee(k.id)&&(U.role=k.id),h(U),m(!0)}).catch(B=>{x||M(String(B))}),()=>{x=!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 x=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 W=[...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=W[0],Q=W.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),x?.isConnected&&x.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 x=ie?$t(F,$):null;if(x&&!x.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,x?.ok?x.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)}},V=o.bot,Le={...c,state:{...c.state,bots:[V,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>V,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},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:x=>_(x.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:x=>X(x.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(x=>e.jsx("button",{type:"button",onClick:()=>O(x),"aria-current":y===x?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[x])},x))}),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(Y,{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,V.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&&!V.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(Y,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:G==="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 m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,y=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=me.find(f=>f.id===m);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 m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=me.map(m=>e.jsx("option",{value:m.id,children:m.title},m.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:m=>{y(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.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((m,g)=>e.jsx("p",{className:"break-words",children:m},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(Yt,{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(xs,{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 Gs=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,Ws as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Vs as T,Ds as U,Ys as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Gs 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,ah as je,ai as Me,q as Ue,v as Fe,aj as ze,ak as Ie,al as Ke,l as ke,am as _e,an as $e,ao as qe,ap as He,aq as Je,p as ce,G as Ve}from"./styles-CLQR3ehf.js";import{j as C,E as We,u as S,bV as se,bW as Ye,a2 as v,S as R,bX as Ge,bY as Se,bZ as ne,b_ as Xe,b$ as Ze,c0 as Qe,c1 as et,c2 as de,c3 as ue,c4 as tt,c5 as st,c6 as nt,c7 as Ne,w as D,c8 as at,c9 as it,ca as rt,x as H,cb as lt,b as Ce,cc as pe,cd as ot,ce as ct,cf as dt,cg as ut,ch as pt,ci as xt,cj as mt,ck as gt,cl as ht,cm as ft,cn as bt,co as vt,cp as xe,cq as yt,cr as wt,cs as jt,ct as kt,cu as Ee,bM as ee,cv as St,cw as Nt,cx as Ct,cy as Et,cz as Bt,cA as me,T as Be,cB as Rt}from"./App-DcG1JmK6.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-DCA0S24E.js";import{o as Ot}from"./index-C_1rKgRm.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-BqQTMT_O.js";import{R as qt}from"./RoutinesPage-DG30sQw7.js";import{r as Ht,L as Y,Q as Jt,R as Vt,U as Wt,P as Yt}from"./PlacesRail-DoUGQSpd.js";import{p as Gt,d as Xt,e as Zt,f as Qt}from"./team-share-1e1FK9fo.js";import{B as es}from"./BrowserProfilesManager-UJJC6OPf.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=>Xt(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(We,{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,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,G]=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 Gt([{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 X=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),G(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(Y,{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=>m(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:()=>{X()},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(Y,{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=Ye(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"):Ge(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=Xe(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),[m,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 ${m?"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":!!m,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,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):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"?xe(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:xe(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 xs({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 ms(){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(ms,{}),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(xt(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=mt();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 Vs(){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 Ws(){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 Ys(){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(Vt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Wt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(x=>x+1))),[y,O]=l.useState("Identity"),[w,m]=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(""),[G,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,X]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ve(),Te=je()?ye:ye.filter(x=>x!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)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(W=>W+1));k&&ee(k.id)&&(U.role=k.id),h(U),m(!0)}).catch(B=>{x||M(String(B))}),()=>{x=!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 x=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 W=[...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=W[0],Q=W.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),x?.isConnected&&x.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 x=ie?$t(F,$):null;if(x&&!x.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,x?.ok?x.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)}},V=o.bot,Le={...c,state:{...c.state,bots:[V,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>V,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},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:x=>_(x.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:x=>X(x.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(x=>e.jsx("button",{type:"button",onClick:()=>O(x),"aria-current":y===x?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[x])},x))}),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(Y,{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,V.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&&!V.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(Y,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:G==="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 m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,y=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=me.find(f=>f.id===m);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 m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=me.map(m=>e.jsx("option",{value:m.id,children:m.title},m.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:m=>{y(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.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((m,g)=>e.jsx("p",{className:"break-words",children:m},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(Yt,{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(xs,{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 Gs=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,Ws as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Vs as T,Ds as U,Ys as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Gs as g};
@@ -1 +1 @@
1
- import{r as d,j as t,t as n}from"./styles-B38kYzzJ.js";import{r as c}from"./PlacesRail-owo7-LYs.js";import{y as x,z as p,Q as m,D as u}from"./App-BFnQK962.js";import"./monitor-Bt-Nw5iC.js";import"./index-DZeZApXw.js";import"./MenuMotion-CJ3EL6xi.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-CLQR3ehf.js";import{r as c}from"./PlacesRail-DoUGQSpd.js";import{y as x,z as p,Q as m,D as u}from"./App-DcG1JmK6.js";import"./monitor-BZrhga_j.js";import"./index-C_1rKgRm.js";import"./MenuMotion-C-qcisoG.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};