limixbot 0.2.5 → 0.2.7

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 (120) hide show
  1. package/dist/assets/{ActivityPanel-DC3XVGOc.js → ActivityPanel-CmDCy7eZ.js} +1 -1
  2. package/dist/assets/{App-Dc7eNHIo.js → App-Dbsatjme.js} +112 -112
  3. package/dist/assets/{AppEventEditor-MqHYrUPZ.js → AppEventEditor-B4RQnsS3.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-BrmKiJZJ.js → BotSettingsDialog-DyScwvnb.js} +4 -4
  5. package/dist/assets/{BrowserPanel-CGq-8k9k.js → BrowserPanel-CFFNXZUh.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-N5zHMoeH.js → BrowserProfilesManager-H57RKPMu.js} +1 -1
  7. package/dist/assets/CloudAddDialog-Bj6_HHBS.js +1 -0
  8. package/dist/assets/{ComputerFilesPane-CP_exuaN.js → ComputerFilesPane-CZ3bEdi-.js} +1 -1
  9. package/dist/assets/{ComputerPanel-SaUcSoW6.js → ComputerPanel-BQUsGs4_.js} +2 -2
  10. package/dist/assets/{DataPanel-CBVx04Rh.js → DataPanel-BFafyj9T.js} +1 -1
  11. package/dist/assets/{DesktopViewer-Cya-HlUY.js → DesktopViewer-DuoSRrPG.js} +1 -1
  12. package/dist/assets/{FilesView-BS2JAg48.js → FilesView-D2WrDHpg.js} +1 -1
  13. package/dist/assets/{GrokMoveDialog-kG0ReJlG.js → GrokMoveDialog-Ciq95MT4.js} +3 -3
  14. package/dist/assets/{InspectorPanel-BT3llt3b.js → InspectorPanel-DP9ekeeT.js} +1 -1
  15. package/dist/assets/{KeyboardShortcutsModal-L8FD783r.js → KeyboardShortcutsModal-BMt7r3Va.js} +1 -1
  16. package/dist/assets/{LiveDesktop-n3XPWd5c.js → LiveDesktop-JYitfkP5.js} +1 -1
  17. package/dist/assets/{LocalVmWorkspace-v7UlCW9t.js → LocalVmWorkspace-ZIznHPod.js} +1 -1
  18. package/dist/assets/{MacLocalControl-v51B79TD.js → MacLocalControl-B2mYWfM_.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-B2U1b00V.js → MarkdownFilePreview-C9o8GlmR.js} +1 -1
  20. package/dist/assets/{MenuMotion-BjmjRIR3.js → MenuMotion-BVlWdNZd.js} +1 -1
  21. package/dist/assets/{NewBotDialog-FgTNwkT5.js → NewBotDialog-42cdLuX9.js} +1 -1
  22. package/dist/assets/{PhoneAppDialog-BAqdCsuh.js → PhoneAppDialog-2HsbrbDR.js} +1 -1
  23. package/dist/assets/{PlacesRail-msEDHUXY.js → PlacesRail-XEjyWavr.js} +1 -1
  24. package/dist/assets/{PluginsPanel-BROkmoVw.js → PluginsPanel-gMX9siqC.js} +1 -1
  25. package/dist/assets/ProIntroduction-DLeyaIp4.js +1 -0
  26. package/dist/assets/{RemoteAgentSettingsPanel-BdJpTB-X.js → RemoteAgentSettingsPanel-CI4mV7e4.js} +1 -1
  27. package/dist/assets/{RoomPanel-BltzAc2X.js → RoomPanel-QM7b4JcY.js} +1 -1
  28. package/dist/assets/{RoutinesPage-CRvNKmna.js → RoutinesPage-9oF95jVB.js} +2 -2
  29. package/dist/assets/SettingsModal-D-qQozfZ.js +11 -0
  30. package/dist/assets/{ShareTeamDialog-BrYsQ1YB.js → ShareTeamDialog-BSCDpGsw.js} +1 -1
  31. package/dist/assets/{SignedInSites-BGsMS1IG.js → SignedInSites-CCJy494V.js} +1 -1
  32. package/dist/assets/{TeamLibraryPanel-C3YIy7_M.js → TeamLibraryPanel-VGQUqTlV.js} +1 -1
  33. package/dist/assets/{TeamMapPage-DjqBIDae.js → TeamMapPage-rjPtLGmj.js} +1 -1
  34. package/dist/assets/{TriggersPage-By978rcW.js → TriggersPage-0G0do_3b.js} +1 -1
  35. package/dist/assets/{VisibilitySection-BMxXxacO.js → VisibilitySection-Gh6OTOCE.js} +1 -1
  36. package/dist/assets/{WebhookTrigger-B0TCdhpi.js → WebhookTrigger-DpcmCVTL.js} +1 -1
  37. package/dist/assets/{WorksOnGrid-BYivdc01.js → WorksOnGrid-L6LFTE2_.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-C05fUibh.js → abnfDiagram-YUKMZFIV-CUWh2GsH.js} +1 -1
  39. package/dist/assets/{activity-cUbbx7sx.js → activity-LHXr5xxZ.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-NfpIFKPz.js → architectureDiagram-47P4ROYG-DVX8QyiO.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-8M_Yd-sD.js → blockDiagram-E7TT5TSB-CEURT8Q8.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-V7Ru-p8C.js → c4Diagram-CRA5TL53-Dxo3va1-.js} +1 -1
  43. package/dist/assets/{calendar-days-Cj-W81bu.js → calendar-days-dgtKqWUC.js} +1 -1
  44. package/dist/assets/channel-B_-MyCfi.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-BYHHX_Gv.js → chunk-2Q5K7J3B-Cwoh8ivv.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-C3e0S7UU.js → chunk-5VM5RSS4-D3VEPh-j.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-Do-zCrfY.js → chunk-7TKQ45FW-DkXnciwj.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-BqIHZ9wm.js → chunk-AW2ZBBNX-CNUnktBg.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-DR-XXMxd.js → chunk-FVRAUYC3-DDh_Qx3V.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-Bfo8GCM2.js → chunk-HTAEGDNF-Cl-K7zHu.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-CihnqCYu.js → chunk-JWPE2WC7-BZMB3nUT.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-CaCMq-KE.js → chunk-KQW6MTUR-CK00Y5Mf.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-D9V51Esf.js → chunk-XXDRQBXY-D9bXnXn1.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-CAJUY4h-.js → classDiagram-v2-K4WV4PDN-vMIXHAit.js} +1 -1
  55. package/dist/assets/{coins-CxC_dI0J.js → coins-C6ydDjtx.js} +1 -1
  56. package/dist/assets/{core-CcNJeiz-.js → core-PBrJFfNa.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-9vWz4wK0.js → cose-bilkent-JH36ORCC-CKEtjhno.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-DCUYk2lC.js → cynefin-EF2NZ3EQ-X7332_6L.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-DdjMYI6o.js → cynefinDiagram-3GCD6N5R-C3ehmT22.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-DGIBnF7r.js → dagre-W4DXFKR2-8j_7yTJf.js} +1 -1
  61. package/dist/assets/{diagram-2UJZ2QOL-B3r3D9sZ.js → diagram-2UJZ2QOL-Dpan5gHO.js} +1 -1
  62. package/dist/assets/{diagram-OVF4WLC6-B1u7LfGA.js → diagram-OVF4WLC6-84oGxj_T.js} +1 -1
  63. package/dist/assets/{diagram-PFPMY2P6-vVzEd5hO.js → diagram-PFPMY2P6-CtkBChQX.js} +1 -1
  64. package/dist/assets/{diagram-UMYRVEAY-WinDNDJc.js → diagram-UMYRVEAY-BtLD2TMp.js} +1 -1
  65. package/dist/assets/{diagram-YEKJPTXX-7g_9oznG.js → diagram-YEKJPTXX-BSsG3sMr.js} +1 -1
  66. package/dist/assets/{diagram-ZIFT7M5P-BqrG5z2v.js → diagram-ZIFT7M5P-DzGdrnet.js} +1 -1
  67. package/dist/assets/{ebnfDiagram-VR2GEFS7-BpNGIiLF.js → ebnfDiagram-VR2GEFS7-BCgvwxBO.js} +1 -1
  68. package/dist/assets/{elk-IJKZMXRS-BCv8wGAA.js → elk-IJKZMXRS-MrcuY098.js} +1 -1
  69. package/dist/assets/{erDiagram-O2IAPWRE-Do-qhVwx.js → erDiagram-O2IAPWRE-CkiPC10P.js} +1 -1
  70. package/dist/assets/{file-up-Gm3ZlE_0.js → file-up-YAGDCUmC.js} +1 -1
  71. package/dist/assets/{flowDiagram-OXPTDLAJ-R-Kh5wq9.js → flowDiagram-OXPTDLAJ-Dy30n92Z.js} +1 -1
  72. package/dist/assets/{ganttDiagram-R7TSEDQI-B3l0oJP5.js → ganttDiagram-R7TSEDQI-7aj2jc8X.js} +1 -1
  73. package/dist/assets/{gitGraphDiagram-XJZIOB7I-BYib7PqD.js → gitGraphDiagram-XJZIOB7I-C90-6xd7.js} +1 -1
  74. package/dist/assets/{import-name-1v6bgYwg.js → import-name-DwHxnzLo.js} +1 -1
  75. package/dist/assets/index-CEBe4ppp.js +2 -0
  76. package/dist/assets/{index-tkGe0e3F.js → index-Dh9vBoyU.js} +1 -1
  77. package/dist/assets/{index-DjRLXqpq.js → index-J6AJ8PJY.js} +1 -1
  78. package/dist/assets/{infoDiagram-5W2HQ5XZ-DqcpfbG0.js → infoDiagram-5W2HQ5XZ-JsL4Ulqu.js} +1 -1
  79. package/dist/assets/{ishikawaDiagram-K3B6WC7H-CVNaP0rR.js → ishikawaDiagram-K3B6WC7H-DGvScV7R.js} +1 -1
  80. package/dist/assets/{journeyDiagram-COXZFDF6-BXHOKVEA.js → journeyDiagram-COXZFDF6-DLSEKXoP.js} +1 -1
  81. package/dist/assets/{kanban-definition-P3RFRI5V-Bb8Vpv2-.js → kanban-definition-P3RFRI5V-CoxK_0bl.js} +1 -1
  82. package/dist/assets/{mcp-servers-BdjmXJSB.js → mcp-servers-Dy6saID9.js} +1 -1
  83. package/dist/assets/{mermaid.core-CnUFOtXD.js → mermaid.core-73koJZWB.js} +4 -4
  84. package/dist/assets/{mindmap-definition-LZFPQGKD-DeV-Tw7G.js → mindmap-definition-LZFPQGKD-CbTxcgIF.js} +1 -1
  85. package/dist/assets/{minimize-lhY0HYEB.js → minimize-DNbi21po.js} +1 -1
  86. package/dist/assets/{monitor-DagRnmYm.js → monitor-EYAEQme8.js} +1 -1
  87. package/dist/assets/{new-bot-R2d69ePy.js → new-bot-C2jdhFdl.js} +2 -2
  88. package/dist/assets/{org-library-CTZWRg3z.js → org-library-BayvlLSA.js} +1 -1
  89. package/dist/assets/{package-format-D4k7Rh0H.js → package-format-BvNOAJ-8.js} +1 -1
  90. package/dist/assets/{pegDiagram-BGZESJAR-B9zfytOo.js → pegDiagram-BGZESJAR-vPF7wjW0.js} +1 -1
  91. package/dist/assets/{pieDiagram-CAPJLFHJ-Co2k1c9h.js → pieDiagram-CAPJLFHJ-CcXS-bXc.js} +1 -1
  92. package/dist/assets/{quadrantDiagram-GDMTTRAM-D7jzEAY-.js → quadrantDiagram-GDMTTRAM-ue9nAF1U.js} +1 -1
  93. package/dist/assets/rail-BVFx-Ggi.js +1 -0
  94. package/dist/assets/{railroadDiagram-SM67HX2B-BvPh7fmA.js → railroadDiagram-SM67HX2B-BeQYm6nT.js} +1 -1
  95. package/dist/assets/{remote-desktop-panel-ipZYKPLT.js → remote-desktop-panel-Bgx8ebdG.js} +1 -1
  96. package/dist/assets/{requirementDiagram-X7JNWC4A-yg9WIdG5.js → requirementDiagram-X7JNWC4A-DZouafhW.js} +1 -1
  97. package/dist/assets/{sankeyDiagram-UM26HJRW-BKhYJMCX.js → sankeyDiagram-UM26HJRW-DHon18zu.js} +1 -1
  98. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-B3hAFJ3r.js → sequenceDiagram-ZO4K6R2Y-atekCKa7.js} +1 -1
  99. package/dist/assets/{sizeCapture-INFHLROL-B5ubpsDi.js → sizeCapture-INFHLROL-Dt3J5cN4.js} +1 -1
  100. package/dist/assets/{stateDiagram-v2-TBUQTH76-DDviCg3l.js → stateDiagram-v2-TBUQTH76-Y6UtBULW.js} +1 -1
  101. package/dist/assets/{styles-BYp3glRK.js → styles-CnQhCz_w.js} +3 -3
  102. package/dist/assets/{swimlanes-N4OXWK64-YthTzBgy.js → swimlanes-N4OXWK64-BpUnlH-3.js} +1 -1
  103. package/dist/assets/swimlanesDiagram-K3J5GTZL-CNvy2omc.js +8 -0
  104. package/dist/assets/{team-share-By8wCeng.js → team-share-DkzY22CD.js} +1 -1
  105. package/dist/assets/{timeline-definition-YOQAKGHF-CH_BuHOF.js → timeline-definition-YOQAKGHF-DhG3OlON.js} +1 -1
  106. package/dist/assets/{usecaseDiagram-VIAY4XPW-zmJ_6-S0.js → usecaseDiagram-VIAY4XPW-DFUcbznD.js} +1 -1
  107. package/dist/assets/{vennDiagram-BLWOH2XV-Cdq5FiyY.js → vennDiagram-BLWOH2XV-D49fiyRh.js} +1 -1
  108. package/dist/assets/{wardleyDiagram-YMQ3BMBF-CUm4PvZj.js → wardleyDiagram-YMQ3BMBF-DFVNNZPs.js} +1 -1
  109. package/dist/assets/{xychartDiagram-TAQBALBS-BFRcupRR.js → xychartDiagram-TAQBALBS-DiHMuK-U.js} +1 -1
  110. package/dist/index.html +2 -2
  111. package/dist/rail.html +4 -4
  112. package/dist-server/package.json +1 -1
  113. package/package.json +1 -1
  114. package/dist/assets/CloudAddDialog-DIm-M9CF.js +0 -1
  115. package/dist/assets/ProIntroduction-D8SaBehJ.js +0 -1
  116. package/dist/assets/SettingsModal-B5Fjq814.js +0 -11
  117. package/dist/assets/channel-g_Dn_OGJ.js +0 -1
  118. package/dist/assets/index-BEBI8eA5.js +0 -2
  119. package/dist/assets/rail-B_8Y8FUg.js +0 -1
  120. package/dist/assets/swimlanesDiagram-K3J5GTZL-CywojYgU.js +0 -8
@@ -1 +1 @@
1
- import{r,t as a,d as ne,j as e,X as le,f as ce}from"./styles-BYp3glRK.js";import{r as ie,L as K}from"./PlacesRail-msEDHUXY.js";import{S as B,a as de,p as J,r as oe,s as V,b as me,c as xe,t as pe,n as ue,d as he,e as fe,f as ge}from"./team-share-By8wCeng.js";import{u as Se,n as I,E as be}from"./App-Dc7eNHIo.js";import"./monitor-DagRnmYm.js";import"./index-BEBI8eA5.js";import"./MenuMotion-BjmjRIR3.js";function G({preview:l,includeMemory:o,localSkips:b}){const i=l.document.package,c=l.summary.counts,T=i.team?.leader?i.agents.find(s=>s.key===i.team?.leader)?.name:void 0,j=i.agents.filter(s=>s.appearance.avatar).length,L=i.agents.reduce((s,p)=>s+Object.keys(p.seed?.memory??{}).length,0),k=[[a("teamShare.part.bots"),`${c.bots} · ${l.summary.botNames.join(", ")}`],[a("teamShare.part.skills"),String(c.skills)],[a("teamShare.part.playbooks"),String(c.playbooks)],[a("teamShare.part.rooms"),String(c.rooms)],[a("teamShare.part.routines"),String(c.routines)],[a("teamShare.part.brief"),i.team?.brief?a("teamShare.yes"):a("teamShare.none")],[a("teamShare.part.leader"),T??a("teamShare.none")],[a("teamShare.part.connections"),String(c.connections)],[a("teamShare.part.pictures"),String(j)],[a("teamShare.part.notes"),o?String(L):a("teamShare.none")],...c.presets?[[a("teamShare.part.presets"),`${c.presets} · ${l.summary.presetNames.join(", ")}`]]:[]],C=[...b,...l.skipped.map(s=>he(s,l.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:a("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:k.map(([s,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:s}),e.jsx("dd",{className:"max-w-[260px] truncate text-right text-ink",title:p,children:p})]},s))}),i.connections?.length?e.jsxs("div",{className:"mt-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.addresses")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:i.connections.map(s=>e.jsxs("li",{className:"break-all",children:[e.jsx("span",{className:"text-ink",children:s.label})," · ",s.mcp.url]},s.key))})]}):null,e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(be,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:a("teamShare.never")})]}),l.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:a("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:l.redacted.map(s=>e.jsx("li",{children:fe(s,l.document)},s))})]}),C.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:a("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:C.map((s,p)=>e.jsx("li",{children:s},`${s}-${p}`))})]})]})}function je({available:l,ticked:o,counted:b,onToggle:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a("teamShare.includeSkills")}),b&&l.length===0&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.noSkills")}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1",children:l.map(c=>e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5 accent-accent",checked:o.has(c),onChange:()=>i(c)}),c]},c))})]})}function Pe({team:l,onClose:o}){const{state:b}=Se(),i=r.useRef(null),c=r.useMemo(()=>b.bots.filter(t=>!t.hidden&&(t.section?.trim()??"")===l),[b.bots,l]),T=r.useMemo(()=>new Map(c.map(t=>[t.id,t.name])),[c]),[j,L]=r.useState(l||a("teamLibrary.general")),[k,C]=r.useState(""),[s,p]=r.useState(""),[z,M]=r.useState(""),[R,W]=r.useState(""),[h,X]=r.useState(B.includePictures),[f,Q]=r.useState(B.includeMemory),[u,Y]=r.useState(!1),[g,H]=r.useState(null),[y,Z]=r.useState(null),[S,O]=r.useState(null),[ee,E]=r.useState(de),{preview:$,available:N,included:te,error:D}=ee,U=t=>E(n=>({...n,error:t})),[d,_]=r.useState(!1),[P,ae]=r.useState(null),A=r.useRef(0);r.useEffect(()=>{let t=!1;return J(c).then(n=>{t||O({avatars:n.avatars,skipped:n.skipped.map(m=>`${T.get(m.botId)??m.botId} · ${a("teamShare.field.picture")} — ${ne(`teamShare.skip.${m.reason}`,m.reason)}`)})}).catch(()=>{t||O({avatars:{},skipped:[]})}),()=>{t=!0}},[]),r.useEffect(()=>{if(!u||g)return;let t=!1;return I("/api/bot-defaults").then(({defaults:n})=>J([{id:"defaults",avatarUrl:n.profile.avatarUrl,avatarCrop:n.profile.avatarCrop}])).then(n=>{t||H({dataUrl:n.avatars.defaults})}).catch(()=>{t||H({})}),()=>{t=!0}},[u,g]);const q=r.useCallback(t=>({team:l,name:j,tagline:k,summary:s,release:z,notes:R,skills:oe(y,N),includeMemory:f,...h&&S?{avatars:S.avatars}:{},...u?{includeDefaultsPreset:!0,...h&&g?.dataUrl?{presetAvatar:g.dataUrl}:{}}:{},dryRun:t}),[l,j,k,s,z,R,y,N,f,h,S,u,g]);r.useEffect(()=>{if(!S)return;if(u&&!g){E(x=>({...x,preview:null}));return}const t=++A.current,n=y===null,m=window.setTimeout(()=>{I("/api/teams/export",{method:"POST",body:JSON.stringify(V({...q(!0),release:void 0}))}).then(x=>{t===A.current&&(E(w=>me(w,x,n)),M(w=>w||x.document.package.release))}).catch(x=>{t===A.current&&E(w=>xe(w,x))})},250);return()=>window.clearTimeout(m)},[S,y,f,h,u,g]);const se=async()=>{if(!d){_(!0),U("");try{const t=await I("/api/teams/export",{method:"POST",body:JSON.stringify(V(q(!1)))});ge(t.filename,t.document),ae(t)}catch(t){U(t instanceof Error?t.message:String(t))}finally{_(!1)}}};r.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{t?.isConnected&&t.focus()}},[]);const F=pe(y,te,N),re=t=>{const n=new Set(F);n.has(t)?n.delete(t):n.add(t),Z(n)},v="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return ie.createPortal(e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",onMouseDown:t=>{t.target===t.currentTarget&&!d&&o()},children:e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"share-team-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[620px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:t=>{if(t.key==="Escape"&&!d&&(t.stopPropagation(),o()),t.key==="Tab"){const n=i.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!n?.length)return;const m=n[0],x=n[n.length-1];t.shiftKey&&document.activeElement===m?(t.preventDefault(),x.focus()):!t.shiftKey&&document.activeElement===x&&(t.preventDefault(),m.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-team-title",className:"text-[17px] font-semibold",children:a("teamShare.title",{name:l||a("teamLibrary.general")})}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.intro")})]}),e.jsx("button",{"aria-label":a("teamShare.close"),disabled:d,onClick:o,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(le,{size:18})})]}),P?e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(ce,{size:16,className:"text-success"}),a("teamShare.saved",{filename:P.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{preview:P,includeMemory:f,localSkips:h?S?.skipped??[]:[]})})]}):e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[$?e.jsx(G,{preview:$,includeMemory:f,localSkips:h?S?.skipped??[]:[]}):!D&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(K,{size:15,className:"animate-spin"}),a("teamShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:d,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:h,onChange:t=>X(t.target.checked)}),a("teamShare.includePictures")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:f,onChange:t=>Q(t.target.checked)}),a("teamShare.includeNotes")]}),e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:ue(f)}),e.jsx(je,{available:N??[],ticked:F,counted:N!==null,onToggle:re}),e.jsxs("label",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:u,onChange:t=>Y(t.target.checked)}),a("teamShare.includePreset")]}),u&&e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:a("teamShare.presetHint")})]}),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:[a("teamShare.name"),e.jsx("input",{value:j,maxLength:100,disabled:d,onChange:t=>L(t.target.value),className:v})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.release"),e.jsx("input",{value:z,maxLength:20,disabled:d,placeholder:"1.0.0",onChange:t=>M(t.target.value),className:v})]})]}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.releaseHint")}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.notes"),e.jsx("textarea",{value:R,maxLength:4e3,rows:2,disabled:d,onChange:t=>W(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.tagline"),e.jsx("input",{value:k,maxLength:160,disabled:d,onChange:t=>C(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.summary"),e.jsx("textarea",{value:s,maxLength:2e3,rows:2,disabled:d,onChange:t=>p(t.target.value),className:v})]})]}),D&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:D}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:P?e.jsx("button",{onClick:o,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:a("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:d,onClick:o,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:a("common.cancel")}),e.jsxs("button",{disabled:d||!$||!j.trim(),onClick:()=>{se()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[d&&e.jsx(K,{size:14,className:"animate-spin"}),d?a("teamShare.saving"):a("teamShare.save")]})]})})]})}),document.body)}export{je as ShareSkillChoices,G as ShareTeamContents,Pe as ShareTeamDialog};
1
+ import{r,t as a,d as ne,j as e,X as le,f as ce}from"./styles-CnQhCz_w.js";import{r as ie,L as K}from"./PlacesRail-XEjyWavr.js";import{S as B,a as de,p as J,r as oe,s as V,b as me,c as xe,t as pe,n as ue,d as he,e as fe,f as ge}from"./team-share-DkzY22CD.js";import{u as Se,n as I,E as be}from"./App-Dbsatjme.js";import"./monitor-EYAEQme8.js";import"./index-CEBe4ppp.js";import"./MenuMotion-BVlWdNZd.js";function G({preview:l,includeMemory:o,localSkips:b}){const i=l.document.package,c=l.summary.counts,T=i.team?.leader?i.agents.find(s=>s.key===i.team?.leader)?.name:void 0,j=i.agents.filter(s=>s.appearance.avatar).length,L=i.agents.reduce((s,p)=>s+Object.keys(p.seed?.memory??{}).length,0),k=[[a("teamShare.part.bots"),`${c.bots} · ${l.summary.botNames.join(", ")}`],[a("teamShare.part.skills"),String(c.skills)],[a("teamShare.part.playbooks"),String(c.playbooks)],[a("teamShare.part.rooms"),String(c.rooms)],[a("teamShare.part.routines"),String(c.routines)],[a("teamShare.part.brief"),i.team?.brief?a("teamShare.yes"):a("teamShare.none")],[a("teamShare.part.leader"),T??a("teamShare.none")],[a("teamShare.part.connections"),String(c.connections)],[a("teamShare.part.pictures"),String(j)],[a("teamShare.part.notes"),o?String(L):a("teamShare.none")],...c.presets?[[a("teamShare.part.presets"),`${c.presets} · ${l.summary.presetNames.join(", ")}`]]:[]],C=[...b,...l.skipped.map(s=>he(s,l.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:a("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:k.map(([s,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:s}),e.jsx("dd",{className:"max-w-[260px] truncate text-right text-ink",title:p,children:p})]},s))}),i.connections?.length?e.jsxs("div",{className:"mt-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:a("teamShare.addresses")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:i.connections.map(s=>e.jsxs("li",{className:"break-all",children:[e.jsx("span",{className:"text-ink",children:s.label})," · ",s.mcp.url]},s.key))})]}):null,e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(be,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:a("teamShare.never")})]}),l.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:a("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:l.redacted.map(s=>e.jsx("li",{children:fe(s,l.document)},s))})]}),C.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:a("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:C.map((s,p)=>e.jsx("li",{children:s},`${s}-${p}`))})]})]})}function je({available:l,ticked:o,counted:b,onToggle:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a("teamShare.includeSkills")}),b&&l.length===0&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.noSkills")}),e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1",children:l.map(c=>e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5 accent-accent",checked:o.has(c),onChange:()=>i(c)}),c]},c))})]})}function Pe({team:l,onClose:o}){const{state:b}=Se(),i=r.useRef(null),c=r.useMemo(()=>b.bots.filter(t=>!t.hidden&&(t.section?.trim()??"")===l),[b.bots,l]),T=r.useMemo(()=>new Map(c.map(t=>[t.id,t.name])),[c]),[j,L]=r.useState(l||a("teamLibrary.general")),[k,C]=r.useState(""),[s,p]=r.useState(""),[z,M]=r.useState(""),[R,W]=r.useState(""),[h,X]=r.useState(B.includePictures),[f,Q]=r.useState(B.includeMemory),[u,Y]=r.useState(!1),[g,H]=r.useState(null),[y,Z]=r.useState(null),[S,O]=r.useState(null),[ee,E]=r.useState(de),{preview:$,available:N,included:te,error:D}=ee,U=t=>E(n=>({...n,error:t})),[d,_]=r.useState(!1),[P,ae]=r.useState(null),A=r.useRef(0);r.useEffect(()=>{let t=!1;return J(c).then(n=>{t||O({avatars:n.avatars,skipped:n.skipped.map(m=>`${T.get(m.botId)??m.botId} · ${a("teamShare.field.picture")} — ${ne(`teamShare.skip.${m.reason}`,m.reason)}`)})}).catch(()=>{t||O({avatars:{},skipped:[]})}),()=>{t=!0}},[]),r.useEffect(()=>{if(!u||g)return;let t=!1;return I("/api/bot-defaults").then(({defaults:n})=>J([{id:"defaults",avatarUrl:n.profile.avatarUrl,avatarCrop:n.profile.avatarCrop}])).then(n=>{t||H({dataUrl:n.avatars.defaults})}).catch(()=>{t||H({})}),()=>{t=!0}},[u,g]);const q=r.useCallback(t=>({team:l,name:j,tagline:k,summary:s,release:z,notes:R,skills:oe(y,N),includeMemory:f,...h&&S?{avatars:S.avatars}:{},...u?{includeDefaultsPreset:!0,...h&&g?.dataUrl?{presetAvatar:g.dataUrl}:{}}:{},dryRun:t}),[l,j,k,s,z,R,y,N,f,h,S,u,g]);r.useEffect(()=>{if(!S)return;if(u&&!g){E(x=>({...x,preview:null}));return}const t=++A.current,n=y===null,m=window.setTimeout(()=>{I("/api/teams/export",{method:"POST",body:JSON.stringify(V({...q(!0),release:void 0}))}).then(x=>{t===A.current&&(E(w=>me(w,x,n)),M(w=>w||x.document.package.release))}).catch(x=>{t===A.current&&E(w=>xe(w,x))})},250);return()=>window.clearTimeout(m)},[S,y,f,h,u,g]);const se=async()=>{if(!d){_(!0),U("");try{const t=await I("/api/teams/export",{method:"POST",body:JSON.stringify(V(q(!1)))});ge(t.filename,t.document),ae(t)}catch(t){U(t instanceof Error?t.message:String(t))}finally{_(!1)}}};r.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{t?.isConnected&&t.focus()}},[]);const F=pe(y,te,N),re=t=>{const n=new Set(F);n.has(t)?n.delete(t):n.add(t),Z(n)},v="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return ie.createPortal(e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4",onMouseDown:t=>{t.target===t.currentTarget&&!d&&o()},children:e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"share-team-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[620px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:t=>{if(t.key==="Escape"&&!d&&(t.stopPropagation(),o()),t.key==="Tab"){const n=i.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!n?.length)return;const m=n[0],x=n[n.length-1];t.shiftKey&&document.activeElement===m?(t.preventDefault(),x.focus()):!t.shiftKey&&document.activeElement===x&&(t.preventDefault(),m.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-team-title",className:"text-[17px] font-semibold",children:a("teamShare.title",{name:l||a("teamLibrary.general")})}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.intro")})]}),e.jsx("button",{"aria-label":a("teamShare.close"),disabled:d,onClick:o,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(le,{size:18})})]}),P?e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(ce,{size:16,className:"text-success"}),a("teamShare.saved",{filename:P.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a("teamShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{preview:P,includeMemory:f,localSkips:h?S?.skipped??[]:[]})})]}):e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:[$?e.jsx(G,{preview:$,includeMemory:f,localSkips:h?S?.skipped??[]:[]}):!D&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(K,{size:15,className:"animate-spin"}),a("teamShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:d,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:h,onChange:t=>X(t.target.checked)}),a("teamShare.includePictures")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:f,onChange:t=>Q(t.target.checked)}),a("teamShare.includeNotes")]}),e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:ue(f)}),e.jsx(je,{available:N??[],ticked:F,counted:N!==null,onToggle:re}),e.jsxs("label",{className:"flex items-center gap-2 pt-1",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:u,onChange:t=>Y(t.target.checked)}),a("teamShare.includePreset")]}),u&&e.jsx("p",{className:"pl-6 text-[12px] leading-relaxed text-ink-secondary",children:a("teamShare.presetHint")})]}),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:[a("teamShare.name"),e.jsx("input",{value:j,maxLength:100,disabled:d,onChange:t=>L(t.target.value),className:v})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[a("teamShare.release"),e.jsx("input",{value:z,maxLength:20,disabled:d,placeholder:"1.0.0",onChange:t=>M(t.target.value),className:v})]})]}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a("teamShare.releaseHint")}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.notes"),e.jsx("textarea",{value:R,maxLength:4e3,rows:2,disabled:d,onChange:t=>W(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.tagline"),e.jsx("input",{value:k,maxLength:160,disabled:d,onChange:t=>C(t.target.value),className:v})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[a("teamShare.summary"),e.jsx("textarea",{value:s,maxLength:2e3,rows:2,disabled:d,onChange:t=>p(t.target.value),className:v})]})]}),D&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:D}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:P?e.jsx("button",{onClick:o,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:a("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:d,onClick:o,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:a("common.cancel")}),e.jsxs("button",{disabled:d||!$||!j.trim(),onClick:()=>{se()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[d&&e.jsx(K,{size:14,className:"animate-spin"}),d?a("teamShare.saving"):a("teamShare.save")]})]})})]})}),document.body)}export{je as ShareSkillChoices,G as ShareTeamContents,Pe as ShareTeamDialog};
@@ -1 +1 @@
1
- import{r,j as s,t}from"./styles-BYp3glRK.js";import{n as b}from"./App-Dc7eNHIo.js";import{a as k}from"./PlacesRail-msEDHUXY.js";function E({target:i,scope:a={},sharedBy:x,disabled:N=!1,bare:l=!1}){const[n,S]=r.useState(null),[o,m]=r.useState(!1),[c,u]=r.useState(""),p=async e=>{m(!0),u("");try{S((await e()).sites)}catch(d){u(d instanceof Error&&d.message?d.message:t("settings.sites.error"))}finally{m(!1)}},g=()=>p(()=>b(`/api/browser-sites?${new URLSearchParams({...i,...a}).toString()}`)),f=e=>p(()=>b("/api/browser-sites/sign-out",{method:"POST",body:JSON.stringify({...i,...a,...e?{site:e}:{}})})),v=`${"bot"in i?`bot:${i.bot}`:`profile:${i.profile}`}${a.threadId?`:${a.threadId}`:""}`;r.useEffect(()=>{l&&g()},[l,v]);const h=N||o,j="flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",y=s.jsxs("div",{className:l?"flex min-w-0 flex-col gap-2":"mt-2 flex flex-col gap-2","aria-busy":o,children:[x.length>1&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.sites.shared",{names:x.join(", ")})}),n===null&&!c&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.loading")}),n?.length===0&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.none")}),!!n?.length&&s.jsx("ul",{className:"divide-y divide-hairline/30",children:n.map(e=>s.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:e.site,children:e.site}),s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f(e.site)},"aria-label":t("settings.sites.signOutOf",{site:e.site}),className:j,children:[s.jsx(k,{size:13}),t("settings.sites.signOut")]})]},e.site))}),!!n?.length&&s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f()},className:`${j} self-start`,children:[s.jsx(k,{size:13}),t("settings.sites.signOutAll")]}),c&&s.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:c})]});return l?y:s.jsxs("details",{className:"min-w-0",onToggle:e=>{e.currentTarget.open&&!o&&g()},children:[s.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("settings.sites.title")}),y]})}export{E as S};
1
+ import{r,j as s,t}from"./styles-CnQhCz_w.js";import{n as b}from"./App-Dbsatjme.js";import{a as k}from"./PlacesRail-XEjyWavr.js";function E({target:i,scope:a={},sharedBy:x,disabled:N=!1,bare:l=!1}){const[n,S]=r.useState(null),[o,m]=r.useState(!1),[c,u]=r.useState(""),p=async e=>{m(!0),u("");try{S((await e()).sites)}catch(d){u(d instanceof Error&&d.message?d.message:t("settings.sites.error"))}finally{m(!1)}},g=()=>p(()=>b(`/api/browser-sites?${new URLSearchParams({...i,...a}).toString()}`)),f=e=>p(()=>b("/api/browser-sites/sign-out",{method:"POST",body:JSON.stringify({...i,...a,...e?{site:e}:{}})})),v=`${"bot"in i?`bot:${i.bot}`:`profile:${i.profile}`}${a.threadId?`:${a.threadId}`:""}`;r.useEffect(()=>{l&&g()},[l,v]);const h=N||o,j="flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",y=s.jsxs("div",{className:l?"flex min-w-0 flex-col gap-2":"mt-2 flex flex-col gap-2","aria-busy":o,children:[x.length>1&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.sites.shared",{names:x.join(", ")})}),n===null&&!c&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.loading")}),n?.length===0&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.sites.none")}),!!n?.length&&s.jsx("ul",{className:"divide-y divide-hairline/30",children:n.map(e=>s.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:e.site,children:e.site}),s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f(e.site)},"aria-label":t("settings.sites.signOutOf",{site:e.site}),className:j,children:[s.jsx(k,{size:13}),t("settings.sites.signOut")]})]},e.site))}),!!n?.length&&s.jsxs("button",{type:"button",disabled:h,onClick:()=>{f()},className:`${j} self-start`,children:[s.jsx(k,{size:13}),t("settings.sites.signOutAll")]}),c&&s.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:c})]});return l?y:s.jsxs("details",{className:"min-w-0",onToggle:e=>{e.currentTarget.open&&!o&&g()},children:[s.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("settings.sites.title")}),y]})}export{E as S};
@@ -1 +1 @@
1
- import{t as s,j as e,a as y,f as re,r as n,X as lt,S as ot,K as J}from"./styles-BYp3glRK.js";import{o as Fe,a as ct,b as dt,c as mt,d as xt,t as ae,e as pt,M as ut}from"./org-library-CTZWRg3z.js";import{t as gt,a as ht}from"./import-name-1v6bgYwg.js";import{a2 as bt,bv as ft,bw as yt,w as jt,bx as Te,by as kt,aP as Ge,u as Me,bz as Nt,bA as vt,bB as wt,bC as St,bD as Ct,bE as Lt,n as S,bF as Bt,bG as Ie,bH as Et,F as zt,bI as Tt}from"./App-Dc7eNHIo.js";import{K as It,P as Ot,r as _e,N as At,L as C,y as Oe,O as Pt}from"./PlacesRail-msEDHUXY.js";import{ShareTeamDialog as Dt}from"./ShareTeamDialog-BrYsQ1YB.js";import"./package-format-D4k7Rh0H.js";import"./index-BEBI8eA5.js";import"./monitor-DagRnmYm.js";import"./MenuMotion-BjmjRIR3.js";import"./team-share-By8wCeng.js";const Rt={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function Ue(a){const m=Rt[a.name.trim().toLowerCase()];return m?{...a,name:s(`templates.catalog.${m}.name`),summary:s(`templates.catalog.${m}.summary`),outcome:a.outcome?s(`templates.catalog.${m}.outcome`):void 0}:a}function $t(a,m){const x=Ue(a);return`${x.name} ${x.summary} ${a.name} ${a.summary} ${a.category} ${a.skills.join(" ")} ${a.requires.apps.join(" ")}`.toLowerCase().includes(m)}const I=["bg-purple-500/15 text-purple-300","bg-cyan-500/15 text-cyan-300","bg-orange-500/15 text-orange-300","bg-emerald-500/15 text-emerald-300"];function Ft({pending:a,importedNames:m,org:x=!1}){return e.jsxs(e.Fragment,{children:[a.description&&e.jsx("p",{className:"max-w-2xl text-[14px] leading-relaxed text-ink-secondary",children:a.description}),a.brief&&e.jsxs("div",{className:"mt-4 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("teamImport.brief")}),e.jsx("p",{className:"mt-1 line-clamp-4 whitespace-pre-wrap break-words",children:a.brief})]}),!!a.warnings?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"mb-2 font-medium text-ink",children:s("templates.backupNotes")}),a.warnings?.map((d,o)=>e.jsx("p",{children:d},o))]}),(a.kind==="package"||a.kind==="backup")&&e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2 text-[12px] text-ink-secondary",children:[a.chiefOfStaff&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(bt,{size:13}),s("templates.leads",{name:a.chiefOfStaff})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(ft,{size:13}),s("templates.groupChats",{count:a.rooms})]}),!(a.library&&!a.playbooks)&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(yt,{size:13}),s("templates.playbooks",{count:a.playbooks})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(jt,{size:13}),a.version===2?s("teamImport.routinesPaused",{count:a.routines}):s("templates.pausedRoutines",{count:a.routines})]}),a.kind==="package"&&a.version!==2&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Te,{size:13}),s("templates.connections",{count:a.apps.length})]}),!!a.connections?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Te,{size:13}),s("teamImport.connections",{count:a.connections?.length??0})]}),!!a.notes&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(kt,{size:13}),s("teamImport.notes",{count:a.notes??0})]}),!!a.presets?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Ge,{size:13}),s("teamImport.presets",{count:a.presets?.length??0})]})]}),!!a.skills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:x?s("orgLibrary.skillsOn"):a.version===2?s("teamImport.skillsOff"):s("templates.skillsDisabled")}),e.jsx("p",{className:"mt-1 break-words",children:a.skills?.join(", ")}),!x&&e.jsx("p",{className:"mt-1",children:a.version===2?s("teamImport.skillsReview"):s("templates.skillsReview")})]}),a.library&&!!a.presets?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.presetList")}),e.jsx("p",{className:"mt-1 break-words",children:a.presets?.join(", ")})]}),!!a.offeredSkills?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.offeredSkills")}),e.jsx("p",{className:"mt-1 break-words",children:a.offeredSkills?.join(", ")})]}),!!a.connections?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.connections",{count:a.connections?.length??0})}),e.jsx("ul",{className:"mt-1",children:a.connections?.map((d,o)=>e.jsxs("li",{className:"truncate",children:[d.label," · ",d.url]},`${d.label}-${o}`))})]}),a.members.length>0&&e.jsx("div",{className:"mt-6 text-[12px] font-medium text-ink-secondary",children:s("templates.teamMembers")}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.members.map((d,o)=>e.jsxs("div",{className:"flex min-h-[72px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[a.pictures?.[o]?e.jsx("img",{src:a.pictures[o],alt:"",className:"size-9 shrink-0 rounded-lg object-cover"}):e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",I[o%I.length]),children:d.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-medium text-ink",children:m[o]}),m[o]!==d.name&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:s("templates.newCopyOf",{name:d.name})}),e.jsx("div",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:d.title||s("templates.generalAssistant")})]})]},`${d.name}-${o}`))}),e.jsxs("div",{className:"mt-6 flex items-start gap-2.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(re,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("p",{children:a.kind==="backup"?s("templates.backupSafety",{archived:a.archivedBots?s("templates.archivedBots",{count:a.archivedBots}):""}):x?a.members.length?s("orgLibrary.teamSafety"):s("orgLibrary.librarySafety"):a.library?s("teamImport.librarySafety"):a.version===2?s("teamImport.sharedTeamSafety"):a.kind==="package"?s("templates.packageSafety"):s("templates.legacySafety")})]})]})}const Gt={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},Ae={everyday:"readyBots.category.everyday",work:"readyBots.category.work",writing:"readyBots.category.writing",design:"readyBots.category.design",sales:"readyBots.category.sales",personal:"readyBots.category.personal"};function Mt({search:a,onDialog:m,onAdded:x}){const[d,o]=n.useState(null),{state:h,dispatch:j}=Me(),[v,p]=n.useState(null),b=l=>{if(!(l!==null&&Lt(h))){if(l!==null&&window.ogb?.remoteClient?.active){j({type:"newBot",onCreated:x});return}p(l),m(l!==null)}},L=Nt.filter(l=>(!d||l.category===d)&&vt(l,a));return a.trim()&&L.length===0?null:e.jsxs("section",{className:"mb-8","aria-labelledby":"ready-bots-title",children:[e.jsxs("div",{className:"mb-1 flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h3",{id:"ready-bots-title",className:"text-[12px] font-medium text-ink-secondary",children:s("readyBots.title")}),e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:s("readyBots.subtitle")})]}),e.jsx("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":s("readyBots.categories"),children:[null,...wt].map(l=>e.jsx("button",{type:"button","aria-pressed":d===l,onClick:()=>o(l),className:y("rounded-full px-3 py-1 text-[13px] transition-colors",d===l?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:l?s(Ae[l]):s("readyBots.all")},l??"all"))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:L.map(l=>{const w=St(l);return e.jsxs("article",{"data-ready-bot":l.id,className:"flex flex-col rounded-2xl border border-hairline/40 bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(It,{color:l.look.color,bodyId:l.look.mascotBody,size:40,animated:!1,label:l.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"truncate text-[14px] font-medium text-ink",children:l.name}),e.jsxs("p",{className:"truncate text-[12px] text-ink-secondary",children:[w.title," · ",s(Ae[l.category])]})]}),e.jsxs("button",{type:"button",onClick:()=>b(l.id),"aria-label":s("readyBots.addAria",{name:l.name,title:w.title}),className:"flex h-8 shrink-0 items-center gap-1 rounded-full bg-raised px-3 text-[13px] font-medium text-ink hover:bg-raised-hover focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx(Ot,{size:14,"aria-hidden":"true"}),s("readyBots.add")]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:w.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:s("readyBots.try",{prompt:w.tryAsking})}),(l.apps.length>0||l.routines?.length)&&e.jsx("p",{className:"mt-auto pt-2 text-[12px] text-ink-tertiary",children:[l.apps.length>0&&s("readyBots.worksWith",{apps:l.apps.map(O=>Gt[O]??O).join(", ")}),l.routines?.length&&s("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},l.id)})}),v&&_e.createPortal(e.jsx(Ct,{readyBotId:v,onClose:()=>b(null),onCreated:l=>{m(!1),x(l)}}),document.body)]})}const Pe=["bg-cyan-500/15 text-cyan-300","bg-purple-500/15 text-purple-300","bg-emerald-500/15 text-emerald-300","bg-orange-500/15 text-orange-300"];function _t({listing:a,busy:m,notice:x,error:d,onAdd:o,onDetails:h}){const j=a.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("orgLibrary.intro",{name:j})}),a.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("orgLibrary.empty",{name:j})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.packages.map((v,p)=>e.jsx(Ut,{entry:v,index:p,busy:m,onAdd:o,onDetails:h},v.packageId))}),x&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:x}),d&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:d})]})}function Ut({entry:a,index:m,busy:x,onAdd:d,onDetails:o}){const h=Fe(a),j=ct(a),v=dt(a),p=x===a.packageId;return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",Pe[m%Pe.length]),children:e.jsx(At,{size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:a.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:a.tagline}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:mt(a)}),j&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:j}),a.release&&e.jsx("span",{children:a.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:xt(a.contents)}),v.map(b=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:b},b))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[h==="add"&&e.jsxs("button",{onClick:()=>d(a),disabled:x!==null,"aria-label":s("orgLibrary.addAria",{name:a.name}),className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[p&&e.jsx(C,{size:13,className:"animate-spin"}),p?s("orgLibrary.adding"):s("orgLibrary.add")]}),h==="added"&&e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-raised px-3 py-1.5 text-[12px] text-ink-secondary",children:[e.jsx(re,{size:13,className:"text-success"}),s("orgLibrary.added")]}),h==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:s("orgLibrary.updateApp")}),h==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.notReady")}),h==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.noRelease")}),a.blob==="ready"&&e.jsx("button",{onClick:()=>o(a),disabled:x!==null,"aria-label":s("orgLibrary.detailsAria",{name:a.name}),className:"rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:s("orgLibrary.details")})]})]})}const Yt="https://github.com/milind-soni/openmausbot-teams",De=["cyan","red","purple","green","orange"];async function Re(a){if(window.ogb?.openExternal){await window.ogb.openExternal(a);return}const m=window.open(a,"_blank","noopener,noreferrer");m&&(m.opener=null)}function Kt(a,m){const x=new Map;for(const o of m){if(o.hidden)continue;const h=o.section?.trim()??"";x.set(h,(x.get(h)??0)+1)}return[...[...new Set([...a.map(o=>o.trim()).filter(Boolean),...x.keys()])].filter(o=>o!==""),""].flatMap(o=>x.get(o)?[{name:o,bots:x.get(o)}]:[])}function $e({index:a}){return e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",I[a%I.length]),children:e.jsx(Ge,{size:20})})}function as({onClose:a,onImported:m,returnFocusRef:x,initialUrl:d}){const{state:o,dispatch:h}=Me(),j=n.useRef(null),v=n.useRef(null),[p,b]=n.useState("explore"),[L,l]=n.useState(null),[w,O]=n.useState(!0),[ne,ie]=n.useState(""),[W,le]=n.useState(null),[c,A]=n.useState(null),[Ye,Ke]=n.useState("file"),[X,oe]=n.useState(""),[ce,de]=n.useState(!1),[k,D]=n.useState(!1),[He,Q]=n.useState(!1),[R,qe]=n.useState(""),[E,g]=n.useState(""),[me,xe]=n.useState(""),[$,pe]=n.useState(!1),[f,ue]=n.useState(null),[Je,We]=n.useState(""),[F,V]=n.useState(null),[ge,he]=n.useState(new Set),[be,fe]=n.useState(""),[G,ye]=n.useState(!1),[M,je]=n.useState(null),[ke,Xe]=n.useState(!1),[_,Ne]=n.useState(null),[Qe,U]=n.useState(null),[Ve,ve]=n.useState(""),[Ze,Y]=n.useState(""),[z,K]=n.useState(null),B=n.useRef(!1),T=n.useRef(0),Z=o.bots.filter(t=>!t.hidden).length,we=Kt(o.sections??[],o.bots),et=new Set(o.bots.map(t=>t.name.trim().toLowerCase())),tt=c?.members.map(t=>gt(t.name,et))??[],ee=n.useCallback(async()=>{O(!0),ie("");try{l(await S("/api/team-library/catalog"))}catch(t){ie(t instanceof Error?t.message:String(t))}finally{O(!1)}},[]);n.useEffect(()=>{ee()},[ee]);const H=n.useCallback(async()=>{try{const t=await S("/api/org-library");Ne(t),t.organization&&!B.current&&b("org")}catch{Ne({organization:null,packages:[]})}},[]);n.useEffect(()=>{H()},[H]),n.useEffect(()=>(j.current?.focus(),()=>x.current?.focus()),[x]),n.useEffect(()=>{const t=r=>{if(M!==null||ke)return;if(r.key==="Escape"&&!k){r.preventDefault(),r.stopPropagation(),c?(A(null),K(null)):a();return}if(r.key!=="Tab")return;const i=j.current,u=Array.from(i?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);if(!i||u.length===0)return;const N=u[0],q=u.at(-1);r.shiftKey&&(document.activeElement===N||!i.contains(document.activeElement))?(r.preventDefault(),q.focus()):!r.shiftKey&&document.activeElement===q&&(r.preventDefault(),N.focus())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[k,a,c,M,ke]);const te=(t,r)=>{A(t),Ke(r),g("")},Se=async t=>{if(t.size>ut)throw new Error(s("templates.fileTooLarge"));const r=await t.text();let i=r;if(!t.name.toLowerCase().endsWith(".md"))try{i=JSON.parse(r)}catch(u){throw u instanceof SyntaxError?new Error(s("teamLibrary.invalidJson")):u}te(ae(i),"file")},st=async t=>{le(t.slug),g("");try{te(ae(await S(`/api/team-library/teams/${t.slug}`)),"library")}catch(r){g(r instanceof Error?r.message:String(r))}finally{le(null)}},Ce=async()=>{await Le(X)},Le=async t=>{if(t.trim()){de(!0),g("");try{const r=await S("/api/team-library/github",{method:"POST",body:JSON.stringify({url:t.trim()})});te(ae(r),"github")}catch(r){g(r instanceof Error?r.message:String(r))}finally{de(!1)}}};n.useEffect(()=>{d&&(B.current=!0,b("import"),oe(d),Le(d))},[d]);const at=async()=>{if(c){D(!0),g("");try{const t=await ht(c.manifest,h);J("team_imported",{members:t.bots.length,source:Ye,mode:"add",format:c.kind}),m({name:c.name,members:t.bots.length,...t.connections?.length?{connections:t.connections.length}:{},...t.presets?.length?{presets:t.presets.length}:{}})}catch(t){g(t instanceof Error?t.message:String(t))}finally{D(!1)}}},rt=async t=>{U(t.packageId),Y("");try{const r=await S(`/api/org-library/packages/${t.packageId}`);A(pt(r.document)),K(t),g("")}catch(r){Y(r instanceof Error?r.message:String(r))}finally{U(null)}},Be=async t=>{U(t.packageId),D(!0),Y(""),ve(""),g("");try{const r=await S("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:t.packageId})});for(const u of r.bots??[])h({type:"botAdded",bot:u});for(const u of r.groups??[])h({type:"groupPatched",group:u});for(const u of r.routines??[])h({type:"routinePatched",routine:u});const i=r.bots?.find(u=>!u.hidden);if(J("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),i){h({type:"select",id:i.id}),m({name:t.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}A(null),K(null),r.alreadyAdded||ve(s("orgLibrary.addedSkills",{name:t.name})),await H()}catch(r){const i=r instanceof Error?r.message:String(r);z?g(i):Y(i),await H()}finally{U(null),D(!1)}},P=me.trim(),se=async t=>{const r=++T.current;pe(!0),g(""),ue(null),V(null),he(new Set);try{const i=await S(`/api/teams/scout?cwd=${encodeURIComponent(t)}`);if(r!==T.current)return;ue(i),We(t),fe(i.suggestion.roomName),J("team_scouted",{signals:i.suggestion.manifest.team.members.length-1}),S(`/api/teams/scout/directory?cwd=${encodeURIComponent(t)}`).then(u=>{r===T.current&&V(u.directory)}).catch(()=>{r===T.current&&V([])})}catch(i){if(r!==T.current)return;g(i instanceof Error?i.message:String(i))}finally{r===T.current&&pe(!1)}},nt=async()=>{const t=await window.ogb?.pickFolder?.(P||void 0);t&&(xe(t),await se(t))},it=async()=>{if(!(!f||G)){ye(!0),g("");try{const t=(F??[]).filter(N=>ge.has(N.slug)).map((N,q)=>({key:`dir-${N.slug}`,name:N.name,title:N.category||s("templates.communityBot"),description:N.prompt,appearance:{color:De[q%De.length]}})),r={...f.suggestion.manifest,team:{...f.suggestion.manifest.team,members:[...f.suggestion.manifest.team.members,...t]}},i=be.trim()||f.suggestion.roomName,u=await S(`/api/teams/import?mode=project&cwd=${encodeURIComponent(Je)}&room=${encodeURIComponent(i)}`,{method:"POST",body:JSON.stringify(r)});for(const N of u.bots)h({type:"botAdded",bot:N});u.group&&(h({type:"groupPatched",group:{...u.group,messages:[]}}),h({type:"select",id:u.group.id})),J("team_imported",{members:u.bots.length,source:"scout",mode:"project"}),m({name:i,members:u.bots.length})}catch(t){g(t instanceof Error?t.message:String(t))}finally{ye(!1)}}},Ee=R.trim().toLowerCase(),ze=(L?.teams??[]).filter(t=>!Ee||$t(t,Ee));return _e.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:t=>t.target===t.currentTarget&&!k&&a(),children:[e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"team-library-title",tabIndex:-1,className:"animate-pop-in flex h-[min(780px,calc(100dvh-2rem))] w-full max-w-[1040px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsx("button",{onClick:()=>{A(null),K(null),g("")},disabled:k,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.back"),children:e.jsx(Bt,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"truncate text-[22px] font-semibold tracking-[-0.01em] text-ink",children:c?c.name:s("templates.title")})]}),e.jsx("p",{className:y("mt-1 text-[13px] text-ink-secondary",c&&"ml-9"),children:c?c.kind==="backup"?s("templates.backupSummary",{bots:c.members.length,conversations:c.conversations??0}):c.kind==="package"?c.library?s("teamImport.library"):c.version===2?s("teamImport.sharedTeam",{count:c.members.length}):s("templates.playbookSummary",{count:c.members.length}):s("templates.readyBots",{count:c.members.length}):s("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!c&&e.jsxs("button",{onClick:()=>{Re(L?.repositoryUrl??Yt)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",title:s("templates.openRepository"),children:[e.jsx(Ie,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:s("templates.communityRepo")}),e.jsx(Oe,{size:12})]}),e.jsx("button",{onClick:a,disabled:k,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.close"),children:e.jsx(lt,{size:21})})]})]}),c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-6 sm:px-8",children:[e.jsx(Ft,{pending:c,importedNames:tt,org:z!==null}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]}),e.jsxs("footer",{className:"flex flex-col gap-3 border-t border-hairline/35 px-6 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"text-[13px] text-ink-secondary",children:[s(Z===0?"templates.existingNone":Z===1?"templates.existingOne":"templates.existingMany",{count:Z})," ",c.kind==="backup"?s("teamImport.backupCopies"):c.library?s("teamImport.libraryAdds"):c.members.length===0?"":s("teamImport.newSection",{name:c.teamName??c.name})]}),z?Fe(z)==="add"?e.jsxs("button",{onClick:()=>{Be(z)},disabled:k,"aria-label":s("orgLibrary.addAria",{name:z.name}),className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("orgLibrary.adding"):s("orgLibrary.add")]}):e.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-raised px-4 py-2 text-[13px] text-ink-secondary",children:[e.jsx(re,{size:14,className:"text-success"}),s("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{at()},disabled:k,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("templates.importing"):c.kind==="backup"?s("templates.importBackup"):c.library?s("teamImport.addPresets"):s("templates.addTeam")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-3 px-6 pb-4 pt-5 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"flex w-fit rounded-xl bg-raised/70 p-1",role:"tablist","aria-label":s("templates.source"),children:[_?.organization&&e.jsx("button",{role:"tab","aria-selected":p==="org",onClick:()=>{B.current=!0,b("org"),g("")},className:y("max-w-[220px] truncate rounded-lg px-4 py-2 text-[14px] transition-colors",p==="org"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("orgLibrary.tab",{name:_.organization.name})}),e.jsx("button",{role:"tab","aria-selected":p==="explore",onClick:()=>{B.current=!0,b("explore"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="explore"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.explore")}),e.jsx("button",{role:"tab","aria-selected":p==="import",onClick:()=>{B.current=!0,b("import"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="import"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.import")}),e.jsx("button",{role:"tab","aria-selected":p==="scout",onClick:()=>{B.current=!0,b("scout"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="scout"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.fromFolder")}),e.jsx("button",{role:"tab","aria-selected":p==="share",onClick:()=>{B.current=!0,b("share"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="share"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("teamLibrary.shareTab")})]}),p==="explore"&&e.jsxs("label",{className:"flex h-11 w-full items-center gap-2.5 rounded-xl bg-raised/70 px-3.5 sm:w-[320px]",children:[e.jsx(ot,{size:17,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:R,onChange:t=>qe(t.target.value),placeholder:s("templates.search"),"aria-label":s("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[p==="org"&&_?.organization&&e.jsx(_t,{listing:_,busy:Qe,notice:Ve,error:Ze,onAdd:t=>{Be(t)},onDetails:t=>{rt(t)}}),p==="explore"&&e.jsxs("div",{children:[e.jsx(Mt,{search:R,onDialog:Xe,onAdded:a}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:R?s("templates.searchResults"):s("templates.communityTemplates")}),w&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(C,{size:16,className:"animate-spin"})," ",s("templates.loading")]}),!w&&ne&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:ne}),e.jsx("button",{onClick:()=>{ee()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:s("common.tryAgain")})]}),!w&&L&&e.jsx("div",{className:"grid grid-cols-1 gap-x-10 md:grid-cols-2",children:ze.map((t,r)=>{const i=Ue(t);return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:i.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:i.outcome??i.summary}),e.jsxs("p",{className:"mt-1 truncate text-[12px] text-ink-tertiary",children:[s("templates.botCount",{count:t.members})," · ",s("templates.playbookCount",{count:t.skills.length}),t.requires.apps.length>0&&` · ${t.requires.apps.join(", ")}`,t.setupMinutes&&` · ${s("templates.minutes",{count:t.setupMinutes})}`]})]}),e.jsxs("button",{onClick:()=>{st(t)},disabled:W!==null,className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[W===t.slug&&e.jsx(C,{size:13,className:"animate-spin"}),W===t.slug?s("templates.loadingShort"):s("templates.load")]})]},t.slug)})}),!w&&L&&ze.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.tryDifferentSearch")})]})]}),p==="import"&&e.jsxs("div",{children:[e.jsx("input",{ref:v,type:"file",accept:".md,.json,.mausbackup.json,.mausteam.json,text/markdown,application/json",className:"hidden",onChange:t=>{const r=t.currentTarget.files?.[0];t.currentTarget.value="",r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))}}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.bringYourOwn")}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("button",{onClick:()=>v.current?.click(),onDragEnter:t=>{t.preventDefault(),Q(!0)},onDragOver:t=>t.preventDefault(),onDragLeave:()=>Q(!1),onDrop:t=>{t.preventDefault(),Q(!1);const r=t.dataTransfer.files[0];r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))},className:y("flex min-h-56 flex-col items-center justify-center rounded-2xl border border-dashed px-6 text-center transition-colors",He?"border-accent bg-accent/5":"border-hairline/60 bg-raised/20 hover:bg-raised/35"),children:[e.jsx(Pt,{size:27,className:"text-accent"}),e.jsx("span",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.chooseFile")}),e.jsx("span",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.dropFile")})]}),e.jsxs("div",{className:"flex min-h-56 flex-col justify-center rounded-2xl bg-raised/25 px-6",children:[e.jsx(Ie,{size:25,className:"text-ink-secondary"}),e.jsx("h3",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.loadGithub")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("templates.githubHint")}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("input",{value:X,onChange:t=>oe(t.target.value),onKeyDown:t=>t.key==="Enter"&&void Ce(),placeholder:s("templates.githubPlaceholder"),"aria-label":s("templates.githubUrl"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{Ce()},disabled:!X.trim()||ce,className:"flex items-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[ce&&e.jsx(C,{size:13,className:"animate-spin"}),s("templates.load")]})]})]})]}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]}),p==="share"&&e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("teamLibrary.shareIntro")}),we.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("teamLibrary.shareEmpty")}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:we.map((t,r)=>e.jsxs("article",{className:"flex min-h-[84px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:t.name||s("teamLibrary.general")}),e.jsx("p",{className:"mt-0.5 text-[13px] text-ink-secondary",children:s("teamLibrary.shareBots",{count:t.bots})})]}),e.jsxs("button",{onClick:()=>je(t.name),"aria-label":s("teamLibrary.shareTeamAria",{name:t.name||s("teamLibrary.general")}),className:"flex items-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover",children:[e.jsx(Et,{size:13}),s("teamLibrary.shareTeam")]})]},t.name||"general"))})]}),p==="scout"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.startFolder")}),e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("templates.scoutHint")}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{value:me,onChange:t=>xe(t.target.value),onKeyDown:t=>t.key==="Enter"&&P&&void se(P),placeholder:"/path/to/your/project","aria-label":s("templates.projectFolder"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),!!window.ogb?.pickFolder&&e.jsxs("button",{onClick:()=>{nt()},disabled:$,className:"flex items-center justify-center gap-1.5 rounded-full bg-raised px-4 py-2.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[e.jsx(zt,{size:14}),s("templates.browse")]}),e.jsxs("button",{onClick:()=>{se(P)},disabled:!P||$,className:"flex items-center justify-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[$?e.jsx(C,{size:14,className:"animate-spin"}):e.jsx(Tt,{size:14}),$?s("templates.scouting"):s("templates.scout")]})]}),f&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"rounded-2xl bg-raised/25 px-5 py-4",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:f.profile.name}),f.profile.summary&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:f.profile.summary}),f.profile.stacks.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:f.profile.stacks.map(t=>e.jsx("span",{className:"rounded-full bg-raised px-2.5 py-1 text-[12px] text-ink-secondary",children:t},t))})]}),e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.suggestedTeam")}),e.jsx("div",{className:"mt-1 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:f.suggestion.manifest.team.members.map((t,r)=>e.jsxs("div",{className:"flex min-h-[64px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",I[r%I.length]),children:t.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name," ",e.jsxs("span",{className:"font-normal text-ink-secondary",children:["· ",t.title]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:f.suggestion.reasons[t.key]??""})]})]},t.key))}),F&&F.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.communityDirectory")}),e.jsx("div",{className:"mt-1 flex flex-col",children:F.map(t=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:ge.has(t.slug),onChange:()=>he(r=>{const i=new Set(r);return i.has(t.slug)?i.delete(t.slug):i.add(t.slug),i}),className:"size-4 accent-accent"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name,t.category&&e.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",t.category]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:s("templates.matches",{values:t.matched.join(", ")})})]})]}),e.jsx("button",{onClick:()=>{Re(t.detailUrl)},"aria-label":s("templates.openDirectory",{name:t.name}),title:s("templates.readBeforeAdding"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(Oe,{size:14})})]},t.slug))})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("input",{value:be,onChange:t=>fe(t.target.value),"aria-label":s("templates.groupChatName"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{it()},disabled:G,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[G&&e.jsx(C,{size:15,className:"animate-spin"}),G?s("templates.creating"):s("templates.createGroupChat")]})]}),e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("templates.createGroupHint")})]}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]})]})]})]}),M!==null&&e.jsx(Dt,{team:M,onClose:()=>je(null)})]}),document.body)}export{Ft as TeamImportDetails,as as TeamLibraryPanel,Kt as shareableTeamList};
1
+ import{t as s,j as e,a as y,f as re,r as n,X as lt,S as ot,D as J}from"./styles-CnQhCz_w.js";import{o as Fe,a as ct,b as dt,c as mt,d as xt,t as ae,e as pt,M as ut}from"./org-library-BayvlLSA.js";import{t as gt,a as ht}from"./import-name-DwHxnzLo.js";import{bs as bt,bt as ft,bu as yt,w as jt,bv as Te,bw as kt,aM as Ge,u as Me,bx as Nt,by as vt,bz as wt,bA as St,bB as Ct,bC as Lt,n as S,bD as Bt,bE as Oe,bF as Et,F as zt,bG as Tt}from"./App-Dbsatjme.js";import{K as Ot,P as It,r as _e,N as At,L as C,y as Ie,O as Dt}from"./PlacesRail-XEjyWavr.js";import{ShareTeamDialog as Pt}from"./ShareTeamDialog-BSCDpGsw.js";import"./package-format-BvNOAJ-8.js";import"./index-CEBe4ppp.js";import"./monitor-EYAEQme8.js";import"./MenuMotion-BVlWdNZd.js";import"./team-share-DkzY22CD.js";const Rt={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function Ue(a){const m=Rt[a.name.trim().toLowerCase()];return m?{...a,name:s(`templates.catalog.${m}.name`),summary:s(`templates.catalog.${m}.summary`),outcome:a.outcome?s(`templates.catalog.${m}.outcome`):void 0}:a}function $t(a,m){const x=Ue(a);return`${x.name} ${x.summary} ${a.name} ${a.summary} ${a.category} ${a.skills.join(" ")} ${a.requires.apps.join(" ")}`.toLowerCase().includes(m)}const O=["bg-purple-500/15 text-purple-300","bg-cyan-500/15 text-cyan-300","bg-orange-500/15 text-orange-300","bg-emerald-500/15 text-emerald-300"];function Ft({pending:a,importedNames:m,org:x=!1}){return e.jsxs(e.Fragment,{children:[a.description&&e.jsx("p",{className:"max-w-2xl text-[14px] leading-relaxed text-ink-secondary",children:a.description}),a.brief&&e.jsxs("div",{className:"mt-4 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("teamImport.brief")}),e.jsx("p",{className:"mt-1 line-clamp-4 whitespace-pre-wrap break-words",children:a.brief})]}),!!a.warnings?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"mb-2 font-medium text-ink",children:s("templates.backupNotes")}),a.warnings?.map((d,o)=>e.jsx("p",{children:d},o))]}),(a.kind==="package"||a.kind==="backup")&&e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2 text-[12px] text-ink-secondary",children:[a.chiefOfStaff&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(bt,{size:13}),s("templates.leads",{name:a.chiefOfStaff})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(ft,{size:13}),s("templates.groupChats",{count:a.rooms})]}),!(a.library&&!a.playbooks)&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(yt,{size:13}),s("templates.playbooks",{count:a.playbooks})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(jt,{size:13}),a.version===2?s("teamImport.routinesPaused",{count:a.routines}):s("templates.pausedRoutines",{count:a.routines})]}),a.kind==="package"&&a.version!==2&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Te,{size:13}),s("templates.connections",{count:a.apps.length})]}),!!a.connections?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Te,{size:13}),s("teamImport.connections",{count:a.connections?.length??0})]}),!!a.notes&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(kt,{size:13}),s("teamImport.notes",{count:a.notes??0})]}),!!a.presets?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Ge,{size:13}),s("teamImport.presets",{count:a.presets?.length??0})]})]}),!!a.skills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:x?s("orgLibrary.skillsOn"):a.version===2?s("teamImport.skillsOff"):s("templates.skillsDisabled")}),e.jsx("p",{className:"mt-1 break-words",children:a.skills?.join(", ")}),!x&&e.jsx("p",{className:"mt-1",children:a.version===2?s("teamImport.skillsReview"):s("templates.skillsReview")})]}),a.library&&!!a.presets?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.presetList")}),e.jsx("p",{className:"mt-1 break-words",children:a.presets?.join(", ")})]}),!!a.offeredSkills?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.offeredSkills")}),e.jsx("p",{className:"mt-1 break-words",children:a.offeredSkills?.join(", ")})]}),!!a.connections?.length&&e.jsxs("div",{className:"mt-4 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("teamImport.connections",{count:a.connections?.length??0})}),e.jsx("ul",{className:"mt-1",children:a.connections?.map((d,o)=>e.jsxs("li",{className:"truncate",children:[d.label," · ",d.url]},`${d.label}-${o}`))})]}),a.members.length>0&&e.jsx("div",{className:"mt-6 text-[12px] font-medium text-ink-secondary",children:s("templates.teamMembers")}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.members.map((d,o)=>e.jsxs("div",{className:"flex min-h-[72px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[a.pictures?.[o]?e.jsx("img",{src:a.pictures[o],alt:"",className:"size-9 shrink-0 rounded-lg object-cover"}):e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",O[o%O.length]),children:d.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-medium text-ink",children:m[o]}),m[o]!==d.name&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:s("templates.newCopyOf",{name:d.name})}),e.jsx("div",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:d.title||s("templates.generalAssistant")})]})]},`${d.name}-${o}`))}),e.jsxs("div",{className:"mt-6 flex items-start gap-2.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(re,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("p",{children:a.kind==="backup"?s("templates.backupSafety",{archived:a.archivedBots?s("templates.archivedBots",{count:a.archivedBots}):""}):x?a.members.length?s("orgLibrary.teamSafety"):s("orgLibrary.librarySafety"):a.library?s("teamImport.librarySafety"):a.version===2?s("teamImport.sharedTeamSafety"):a.kind==="package"?s("templates.packageSafety"):s("templates.legacySafety")})]})]})}const Gt={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},Ae={everyday:"readyBots.category.everyday",work:"readyBots.category.work",writing:"readyBots.category.writing",design:"readyBots.category.design",sales:"readyBots.category.sales",personal:"readyBots.category.personal"};function Mt({search:a,onDialog:m,onAdded:x}){const[d,o]=n.useState(null),{state:h,dispatch:j}=Me(),[v,p]=n.useState(null),b=l=>{if(!(l!==null&&Lt(h))){if(l!==null&&window.ogb?.remoteClient?.active){j({type:"newBot",onCreated:x});return}p(l),m(l!==null)}},L=Nt.filter(l=>(!d||l.category===d)&&vt(l,a));return a.trim()&&L.length===0?null:e.jsxs("section",{className:"mb-8","aria-labelledby":"ready-bots-title",children:[e.jsxs("div",{className:"mb-1 flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h3",{id:"ready-bots-title",className:"text-[12px] font-medium text-ink-secondary",children:s("readyBots.title")}),e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:s("readyBots.subtitle")})]}),e.jsx("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":s("readyBots.categories"),children:[null,...wt].map(l=>e.jsx("button",{type:"button","aria-pressed":d===l,onClick:()=>o(l),className:y("rounded-full px-3 py-1 text-[13px] transition-colors",d===l?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:l?s(Ae[l]):s("readyBots.all")},l??"all"))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:L.map(l=>{const w=St(l);return e.jsxs("article",{"data-ready-bot":l.id,className:"flex flex-col rounded-2xl border border-hairline/40 bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ot,{color:l.look.color,bodyId:l.look.mascotBody,size:40,animated:!1,label:l.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"truncate text-[14px] font-medium text-ink",children:l.name}),e.jsxs("p",{className:"truncate text-[12px] text-ink-secondary",children:[w.title," · ",s(Ae[l.category])]})]}),e.jsxs("button",{type:"button",onClick:()=>b(l.id),"aria-label":s("readyBots.addAria",{name:l.name,title:w.title}),className:"flex h-8 shrink-0 items-center gap-1 rounded-full bg-raised px-3 text-[13px] font-medium text-ink hover:bg-raised-hover focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx(It,{size:14,"aria-hidden":"true"}),s("readyBots.add")]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:w.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:s("readyBots.try",{prompt:w.tryAsking})}),(l.apps.length>0||l.routines?.length)&&e.jsx("p",{className:"mt-auto pt-2 text-[12px] text-ink-tertiary",children:[l.apps.length>0&&s("readyBots.worksWith",{apps:l.apps.map(I=>Gt[I]??I).join(", ")}),l.routines?.length&&s("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},l.id)})}),v&&_e.createPortal(e.jsx(Ct,{readyBotId:v,onClose:()=>b(null),onCreated:l=>{m(!1),x(l)}}),document.body)]})}const De=["bg-cyan-500/15 text-cyan-300","bg-purple-500/15 text-purple-300","bg-emerald-500/15 text-emerald-300","bg-orange-500/15 text-orange-300"];function _t({listing:a,busy:m,notice:x,error:d,onAdd:o,onDetails:h}){const j=a.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("orgLibrary.intro",{name:j})}),a.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("orgLibrary.empty",{name:j})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.packages.map((v,p)=>e.jsx(Ut,{entry:v,index:p,busy:m,onAdd:o,onDetails:h},v.packageId))}),x&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:x}),d&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:d})]})}function Ut({entry:a,index:m,busy:x,onAdd:d,onDetails:o}){const h=Fe(a),j=ct(a),v=dt(a),p=x===a.packageId;return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",De[m%De.length]),children:e.jsx(At,{size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:a.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:a.tagline}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:mt(a)}),j&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:j}),a.release&&e.jsx("span",{children:a.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:xt(a.contents)}),v.map(b=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:b},b))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[h==="add"&&e.jsxs("button",{onClick:()=>d(a),disabled:x!==null,"aria-label":s("orgLibrary.addAria",{name:a.name}),className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[p&&e.jsx(C,{size:13,className:"animate-spin"}),p?s("orgLibrary.adding"):s("orgLibrary.add")]}),h==="added"&&e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-raised px-3 py-1.5 text-[12px] text-ink-secondary",children:[e.jsx(re,{size:13,className:"text-success"}),s("orgLibrary.added")]}),h==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:s("orgLibrary.updateApp")}),h==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.notReady")}),h==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.noRelease")}),a.blob==="ready"&&e.jsx("button",{onClick:()=>o(a),disabled:x!==null,"aria-label":s("orgLibrary.detailsAria",{name:a.name}),className:"rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:s("orgLibrary.details")})]})]})}const Yt="https://github.com/milind-soni/openmausbot-teams",Pe=["cyan","red","purple","green","orange"];async function Re(a){if(window.ogb?.openExternal){await window.ogb.openExternal(a);return}const m=window.open(a,"_blank","noopener,noreferrer");m&&(m.opener=null)}function Kt(a,m){const x=new Map;for(const o of m){if(o.hidden)continue;const h=o.section?.trim()??"";x.set(h,(x.get(h)??0)+1)}return[...[...new Set([...a.map(o=>o.trim()).filter(Boolean),...x.keys()])].filter(o=>o!==""),""].flatMap(o=>x.get(o)?[{name:o,bots:x.get(o)}]:[])}function $e({index:a}){return e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",O[a%O.length]),children:e.jsx(Ge,{size:20})})}function as({onClose:a,onImported:m,returnFocusRef:x,initialUrl:d}){const{state:o,dispatch:h}=Me(),j=n.useRef(null),v=n.useRef(null),[p,b]=n.useState("explore"),[L,l]=n.useState(null),[w,I]=n.useState(!0),[ne,ie]=n.useState(""),[W,le]=n.useState(null),[c,A]=n.useState(null),[Ye,Ke]=n.useState("file"),[X,oe]=n.useState(""),[ce,de]=n.useState(!1),[k,P]=n.useState(!1),[He,Q]=n.useState(!1),[R,qe]=n.useState(""),[E,g]=n.useState(""),[me,xe]=n.useState(""),[$,pe]=n.useState(!1),[f,ue]=n.useState(null),[Je,We]=n.useState(""),[F,V]=n.useState(null),[ge,he]=n.useState(new Set),[be,fe]=n.useState(""),[G,ye]=n.useState(!1),[M,je]=n.useState(null),[ke,Xe]=n.useState(!1),[_,Ne]=n.useState(null),[Qe,U]=n.useState(null),[Ve,ve]=n.useState(""),[Ze,Y]=n.useState(""),[z,K]=n.useState(null),B=n.useRef(!1),T=n.useRef(0),Z=o.bots.filter(t=>!t.hidden).length,we=Kt(o.sections??[],o.bots),et=new Set(o.bots.map(t=>t.name.trim().toLowerCase())),tt=c?.members.map(t=>gt(t.name,et))??[],ee=n.useCallback(async()=>{I(!0),ie("");try{l(await S("/api/team-library/catalog"))}catch(t){ie(t instanceof Error?t.message:String(t))}finally{I(!1)}},[]);n.useEffect(()=>{ee()},[ee]);const H=n.useCallback(async()=>{try{const t=await S("/api/org-library");Ne(t),t.organization&&!B.current&&b("org")}catch{Ne({organization:null,packages:[]})}},[]);n.useEffect(()=>{H()},[H]),n.useEffect(()=>(j.current?.focus(),()=>x.current?.focus()),[x]),n.useEffect(()=>{const t=r=>{if(M!==null||ke)return;if(r.key==="Escape"&&!k){r.preventDefault(),r.stopPropagation(),c?(A(null),K(null)):a();return}if(r.key!=="Tab")return;const i=j.current,u=Array.from(i?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);if(!i||u.length===0)return;const N=u[0],q=u.at(-1);r.shiftKey&&(document.activeElement===N||!i.contains(document.activeElement))?(r.preventDefault(),q.focus()):!r.shiftKey&&document.activeElement===q&&(r.preventDefault(),N.focus())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[k,a,c,M,ke]);const te=(t,r)=>{A(t),Ke(r),g("")},Se=async t=>{if(t.size>ut)throw new Error(s("templates.fileTooLarge"));const r=await t.text();let i=r;if(!t.name.toLowerCase().endsWith(".md"))try{i=JSON.parse(r)}catch(u){throw u instanceof SyntaxError?new Error(s("teamLibrary.invalidJson")):u}te(ae(i),"file")},st=async t=>{le(t.slug),g("");try{te(ae(await S(`/api/team-library/teams/${t.slug}`)),"library")}catch(r){g(r instanceof Error?r.message:String(r))}finally{le(null)}},Ce=async()=>{await Le(X)},Le=async t=>{if(t.trim()){de(!0),g("");try{const r=await S("/api/team-library/github",{method:"POST",body:JSON.stringify({url:t.trim()})});te(ae(r),"github")}catch(r){g(r instanceof Error?r.message:String(r))}finally{de(!1)}}};n.useEffect(()=>{d&&(B.current=!0,b("import"),oe(d),Le(d))},[d]);const at=async()=>{if(c){P(!0),g("");try{const t=await ht(c.manifest,h);J("team_imported",{members:t.bots.length,source:Ye,mode:"add",format:c.kind}),m({name:c.name,members:t.bots.length,...t.connections?.length?{connections:t.connections.length}:{},...t.presets?.length?{presets:t.presets.length}:{}})}catch(t){g(t instanceof Error?t.message:String(t))}finally{P(!1)}}},rt=async t=>{U(t.packageId),Y("");try{const r=await S(`/api/org-library/packages/${t.packageId}`);A(pt(r.document)),K(t),g("")}catch(r){Y(r instanceof Error?r.message:String(r))}finally{U(null)}},Be=async t=>{U(t.packageId),P(!0),Y(""),ve(""),g("");try{const r=await S("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:t.packageId})});for(const u of r.bots??[])h({type:"botAdded",bot:u});for(const u of r.groups??[])h({type:"groupPatched",group:u});for(const u of r.routines??[])h({type:"routinePatched",routine:u});const i=r.bots?.find(u=>!u.hidden);if(J("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),i){h({type:"select",id:i.id}),m({name:t.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}A(null),K(null),r.alreadyAdded||ve(s("orgLibrary.addedSkills",{name:t.name})),await H()}catch(r){const i=r instanceof Error?r.message:String(r);z?g(i):Y(i),await H()}finally{U(null),P(!1)}},D=me.trim(),se=async t=>{const r=++T.current;pe(!0),g(""),ue(null),V(null),he(new Set);try{const i=await S(`/api/teams/scout?cwd=${encodeURIComponent(t)}`);if(r!==T.current)return;ue(i),We(t),fe(i.suggestion.roomName),J("team_scouted",{signals:i.suggestion.manifest.team.members.length-1}),S(`/api/teams/scout/directory?cwd=${encodeURIComponent(t)}`).then(u=>{r===T.current&&V(u.directory)}).catch(()=>{r===T.current&&V([])})}catch(i){if(r!==T.current)return;g(i instanceof Error?i.message:String(i))}finally{r===T.current&&pe(!1)}},nt=async()=>{const t=await window.ogb?.pickFolder?.(D||void 0);t&&(xe(t),await se(t))},it=async()=>{if(!(!f||G)){ye(!0),g("");try{const t=(F??[]).filter(N=>ge.has(N.slug)).map((N,q)=>({key:`dir-${N.slug}`,name:N.name,title:N.category||s("templates.communityBot"),description:N.prompt,appearance:{color:Pe[q%Pe.length]}})),r={...f.suggestion.manifest,team:{...f.suggestion.manifest.team,members:[...f.suggestion.manifest.team.members,...t]}},i=be.trim()||f.suggestion.roomName,u=await S(`/api/teams/import?mode=project&cwd=${encodeURIComponent(Je)}&room=${encodeURIComponent(i)}`,{method:"POST",body:JSON.stringify(r)});for(const N of u.bots)h({type:"botAdded",bot:N});u.group&&(h({type:"groupPatched",group:{...u.group,messages:[]}}),h({type:"select",id:u.group.id})),J("team_imported",{members:u.bots.length,source:"scout",mode:"project"}),m({name:i,members:u.bots.length})}catch(t){g(t instanceof Error?t.message:String(t))}finally{ye(!1)}}},Ee=R.trim().toLowerCase(),ze=(L?.teams??[]).filter(t=>!Ee||$t(t,Ee));return _e.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:t=>t.target===t.currentTarget&&!k&&a(),children:[e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"team-library-title",tabIndex:-1,className:"animate-pop-in flex h-[min(780px,calc(100dvh-2rem))] w-full max-w-[1040px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsx("button",{onClick:()=>{A(null),K(null),g("")},disabled:k,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.back"),children:e.jsx(Bt,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"truncate text-[22px] font-semibold tracking-[-0.01em] text-ink",children:c?c.name:s("templates.title")})]}),e.jsx("p",{className:y("mt-1 text-[13px] text-ink-secondary",c&&"ml-9"),children:c?c.kind==="backup"?s("templates.backupSummary",{bots:c.members.length,conversations:c.conversations??0}):c.kind==="package"?c.library?s("teamImport.library"):c.version===2?s("teamImport.sharedTeam",{count:c.members.length}):s("templates.playbookSummary",{count:c.members.length}):s("templates.readyBots",{count:c.members.length}):s("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!c&&e.jsxs("button",{onClick:()=>{Re(L?.repositoryUrl??Yt)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",title:s("templates.openRepository"),children:[e.jsx(Oe,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:s("templates.communityRepo")}),e.jsx(Ie,{size:12})]}),e.jsx("button",{onClick:a,disabled:k,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.close"),children:e.jsx(lt,{size:21})})]})]}),c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-6 sm:px-8",children:[e.jsx(Ft,{pending:c,importedNames:tt,org:z!==null}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]}),e.jsxs("footer",{className:"flex flex-col gap-3 border-t border-hairline/35 px-6 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"text-[13px] text-ink-secondary",children:[s(Z===0?"templates.existingNone":Z===1?"templates.existingOne":"templates.existingMany",{count:Z})," ",c.kind==="backup"?s("teamImport.backupCopies"):c.library?s("teamImport.libraryAdds"):c.members.length===0?"":s("teamImport.newSection",{name:c.teamName??c.name})]}),z?Fe(z)==="add"?e.jsxs("button",{onClick:()=>{Be(z)},disabled:k,"aria-label":s("orgLibrary.addAria",{name:z.name}),className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("orgLibrary.adding"):s("orgLibrary.add")]}):e.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-raised px-4 py-2 text-[13px] text-ink-secondary",children:[e.jsx(re,{size:14,className:"text-success"}),s("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{at()},disabled:k,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("templates.importing"):c.kind==="backup"?s("templates.importBackup"):c.library?s("teamImport.addPresets"):s("templates.addTeam")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-3 px-6 pb-4 pt-5 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"flex w-fit rounded-xl bg-raised/70 p-1",role:"tablist","aria-label":s("templates.source"),children:[_?.organization&&e.jsx("button",{role:"tab","aria-selected":p==="org",onClick:()=>{B.current=!0,b("org"),g("")},className:y("max-w-[220px] truncate rounded-lg px-4 py-2 text-[14px] transition-colors",p==="org"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("orgLibrary.tab",{name:_.organization.name})}),e.jsx("button",{role:"tab","aria-selected":p==="explore",onClick:()=>{B.current=!0,b("explore"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="explore"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.explore")}),e.jsx("button",{role:"tab","aria-selected":p==="import",onClick:()=>{B.current=!0,b("import"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="import"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.import")}),e.jsx("button",{role:"tab","aria-selected":p==="scout",onClick:()=>{B.current=!0,b("scout"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="scout"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.fromFolder")}),e.jsx("button",{role:"tab","aria-selected":p==="share",onClick:()=>{B.current=!0,b("share"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="share"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("teamLibrary.shareTab")})]}),p==="explore"&&e.jsxs("label",{className:"flex h-11 w-full items-center gap-2.5 rounded-xl bg-raised/70 px-3.5 sm:w-[320px]",children:[e.jsx(ot,{size:17,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:R,onChange:t=>qe(t.target.value),placeholder:s("templates.search"),"aria-label":s("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[p==="org"&&_?.organization&&e.jsx(_t,{listing:_,busy:Qe,notice:Ve,error:Ze,onAdd:t=>{Be(t)},onDetails:t=>{rt(t)}}),p==="explore"&&e.jsxs("div",{children:[e.jsx(Mt,{search:R,onDialog:Xe,onAdded:a}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:R?s("templates.searchResults"):s("templates.communityTemplates")}),w&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(C,{size:16,className:"animate-spin"})," ",s("templates.loading")]}),!w&&ne&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:ne}),e.jsx("button",{onClick:()=>{ee()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:s("common.tryAgain")})]}),!w&&L&&e.jsx("div",{className:"grid grid-cols-1 gap-x-10 md:grid-cols-2",children:ze.map((t,r)=>{const i=Ue(t);return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:i.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:i.outcome??i.summary}),e.jsxs("p",{className:"mt-1 truncate text-[12px] text-ink-tertiary",children:[s("templates.botCount",{count:t.members})," · ",s("templates.playbookCount",{count:t.skills.length}),t.requires.apps.length>0&&` · ${t.requires.apps.join(", ")}`,t.setupMinutes&&` · ${s("templates.minutes",{count:t.setupMinutes})}`]})]}),e.jsxs("button",{onClick:()=>{st(t)},disabled:W!==null,className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[W===t.slug&&e.jsx(C,{size:13,className:"animate-spin"}),W===t.slug?s("templates.loadingShort"):s("templates.load")]})]},t.slug)})}),!w&&L&&ze.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.tryDifferentSearch")})]})]}),p==="import"&&e.jsxs("div",{children:[e.jsx("input",{ref:v,type:"file",accept:".md,.json,.mausbackup.json,.mausteam.json,text/markdown,application/json",className:"hidden",onChange:t=>{const r=t.currentTarget.files?.[0];t.currentTarget.value="",r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))}}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.bringYourOwn")}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("button",{onClick:()=>v.current?.click(),onDragEnter:t=>{t.preventDefault(),Q(!0)},onDragOver:t=>t.preventDefault(),onDragLeave:()=>Q(!1),onDrop:t=>{t.preventDefault(),Q(!1);const r=t.dataTransfer.files[0];r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))},className:y("flex min-h-56 flex-col items-center justify-center rounded-2xl border border-dashed px-6 text-center transition-colors",He?"border-accent bg-accent/5":"border-hairline/60 bg-raised/20 hover:bg-raised/35"),children:[e.jsx(Dt,{size:27,className:"text-accent"}),e.jsx("span",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.chooseFile")}),e.jsx("span",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.dropFile")})]}),e.jsxs("div",{className:"flex min-h-56 flex-col justify-center rounded-2xl bg-raised/25 px-6",children:[e.jsx(Oe,{size:25,className:"text-ink-secondary"}),e.jsx("h3",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.loadGithub")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("templates.githubHint")}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("input",{value:X,onChange:t=>oe(t.target.value),onKeyDown:t=>t.key==="Enter"&&void Ce(),placeholder:s("templates.githubPlaceholder"),"aria-label":s("templates.githubUrl"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{Ce()},disabled:!X.trim()||ce,className:"flex items-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[ce&&e.jsx(C,{size:13,className:"animate-spin"}),s("templates.load")]})]})]})]}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]}),p==="share"&&e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("teamLibrary.shareIntro")}),we.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("teamLibrary.shareEmpty")}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:we.map((t,r)=>e.jsxs("article",{className:"flex min-h-[84px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:t.name||s("teamLibrary.general")}),e.jsx("p",{className:"mt-0.5 text-[13px] text-ink-secondary",children:s("teamLibrary.shareBots",{count:t.bots})})]}),e.jsxs("button",{onClick:()=>je(t.name),"aria-label":s("teamLibrary.shareTeamAria",{name:t.name||s("teamLibrary.general")}),className:"flex items-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover",children:[e.jsx(Et,{size:13}),s("teamLibrary.shareTeam")]})]},t.name||"general"))})]}),p==="scout"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.startFolder")}),e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("templates.scoutHint")}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{value:me,onChange:t=>xe(t.target.value),onKeyDown:t=>t.key==="Enter"&&D&&void se(D),placeholder:"/path/to/your/project","aria-label":s("templates.projectFolder"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),!!window.ogb?.pickFolder&&e.jsxs("button",{onClick:()=>{nt()},disabled:$,className:"flex items-center justify-center gap-1.5 rounded-full bg-raised px-4 py-2.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[e.jsx(zt,{size:14}),s("templates.browse")]}),e.jsxs("button",{onClick:()=>{se(D)},disabled:!D||$,className:"flex items-center justify-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[$?e.jsx(C,{size:14,className:"animate-spin"}):e.jsx(Tt,{size:14}),$?s("templates.scouting"):s("templates.scout")]})]}),f&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"rounded-2xl bg-raised/25 px-5 py-4",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:f.profile.name}),f.profile.summary&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:f.profile.summary}),f.profile.stacks.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:f.profile.stacks.map(t=>e.jsx("span",{className:"rounded-full bg-raised px-2.5 py-1 text-[12px] text-ink-secondary",children:t},t))})]}),e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.suggestedTeam")}),e.jsx("div",{className:"mt-1 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:f.suggestion.manifest.team.members.map((t,r)=>e.jsxs("div",{className:"flex min-h-[64px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",O[r%O.length]),children:t.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name," ",e.jsxs("span",{className:"font-normal text-ink-secondary",children:["· ",t.title]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:f.suggestion.reasons[t.key]??""})]})]},t.key))}),F&&F.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.communityDirectory")}),e.jsx("div",{className:"mt-1 flex flex-col",children:F.map(t=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:ge.has(t.slug),onChange:()=>he(r=>{const i=new Set(r);return i.has(t.slug)?i.delete(t.slug):i.add(t.slug),i}),className:"size-4 accent-accent"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name,t.category&&e.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",t.category]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:s("templates.matches",{values:t.matched.join(", ")})})]})]}),e.jsx("button",{onClick:()=>{Re(t.detailUrl)},"aria-label":s("templates.openDirectory",{name:t.name}),title:s("templates.readBeforeAdding"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(Ie,{size:14})})]},t.slug))})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("input",{value:be,onChange:t=>fe(t.target.value),"aria-label":s("templates.groupChatName"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{it()},disabled:G,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[G&&e.jsx(C,{size:15,className:"animate-spin"}),G?s("templates.creating"):s("templates.createGroupChat")]})]}),e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("templates.createGroupHint")})]}),E&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E})]})]})]})]}),M!==null&&e.jsx(Pt,{team:M,onClose:()=>je(null)})]}),document.body)}export{Ft as TeamImportDetails,as as TeamLibraryPanel,Kt as shareableTeamList};