@seira-bot/seira 0.1.180 → 0.1.181

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 (173) hide show
  1. package/dist/assets/{ActivityPanel-DpipGqnm.js → ActivityPanel-tZLxRHYi.js} +1 -1
  2. package/dist/assets/{AnnouncementsPage-GCXia4xK.js → AnnouncementsPage-BrGYAaS0.js} +1 -1
  3. package/dist/assets/{App-BIllYA_e.js → App-h8WTNY4l.js} +136 -136
  4. package/dist/assets/{AppEventEditor-DYdUkpiM.js → AppEventEditor-CLpZ2lyb.js} +1 -1
  5. package/dist/assets/{BotSettingsDialog-DxRMUwAP.js → BotSettingsDialog-COjDhP9V.js} +1 -1
  6. package/dist/assets/{BrowserPanel-Cu_GqDA1.js → BrowserPanel-D_kPeSZ3.js} +1 -1
  7. package/dist/assets/{BrowserProfilesManager-CL3TIl73.js → BrowserProfilesManager-haN8RgPf.js} +1 -1
  8. package/dist/assets/{CloudAddDialog-DUk6i4df.js → CloudAddDialog-vwGwJIYN.js} +1 -1
  9. package/dist/assets/{ComputerFilesPane-HvpeAXhL.js → ComputerFilesPane-DJu1k1Ap.js} +1 -1
  10. package/dist/assets/{ComputerPanel-CozzFQeF.js → ComputerPanel-D9bTedHq.js} +2 -2
  11. package/dist/assets/{DataPanel-DGqcWB1O.js → DataPanel-CsuS_ybT.js} +1 -1
  12. package/dist/assets/{DesktopViewer-BoBSIDfB.js → DesktopViewer-YvIV04Lf.js} +1 -1
  13. package/dist/assets/{EnginesSettings-D643-yZk.js → EnginesSettings-C27xDaBN.js} +1 -1
  14. package/dist/assets/{FilesView-b5DFlMDt.js → FilesView-Dsxj73nW.js} +1 -1
  15. package/dist/assets/{GrokMoveDialog-gGTLfrGg.js → GrokMoveDialog-DEgRQW9G.js} +1 -1
  16. package/dist/assets/{ImportDialog-Bu5X6qOF.js → ImportDialog-DLVTgN-h.js} +1 -1
  17. package/dist/assets/{InspectorPanel-DU7_iwQR.js → InspectorPanel-gvFj5wfe.js} +1 -1
  18. package/dist/assets/{KeyboardShortcutsModal-Wxnn1d66.js → KeyboardShortcutsModal-aF0vhD29.js} +1 -1
  19. package/dist/assets/{LiveDesktop-D9PC-iAT.js → LiveDesktop-Bca91cEb.js} +1 -1
  20. package/dist/assets/{LocalVmWorkspace-0YxB-I-X.js → LocalVmWorkspace-CVLDY3ws.js} +1 -1
  21. package/dist/assets/{MacLocalControl-DoEGcs3V.js → MacLocalControl-BeNWQ9oY.js} +1 -1
  22. package/dist/assets/{MarkdownFilePreview-CAlARwd0.js → MarkdownFilePreview-CYw3CQ3T.js} +1 -1
  23. package/dist/assets/{MenuMotion-DfjnHTCi.js → MenuMotion-CHp-hB40.js} +1 -1
  24. package/dist/assets/{NewBotDialog-D3i7j_KP.js → NewBotDialog-BxeQktoI.js} +1 -1
  25. package/dist/assets/{PhoneAppDialog-OeXLO0Wb.js → PhoneAppDialog-CIlw_m5U.js} +1 -1
  26. package/dist/assets/{PlacesRail-3RaNlpug.js → PlacesRail-Df-jNTHn.js} +1 -1
  27. package/dist/assets/PluginsPanel-CMqZcDkC.js +8 -0
  28. package/dist/assets/{ProIntroduction-B3phUWnc.js → ProIntroduction-D8hWm9R5.js} +1 -1
  29. package/dist/assets/{PublishedAppsPage-BXWDYkhG.js → PublishedAppsPage-BMn3C64O.js} +1 -1
  30. package/dist/assets/{RemoteAgentSettingsPanel-vgrEf5B7.js → RemoteAgentSettingsPanel-B7QJizjx.js} +1 -1
  31. package/dist/assets/{RoomPanel-BmXypXPv.js → RoomPanel-CyWZ4kkq.js} +1 -1
  32. package/dist/assets/RoutinesPage-B9kKyfFp.js +2 -0
  33. package/dist/assets/{ServerPairingCard-c2fKq1gh.js → ServerPairingCard-D21dP5Bc.js} +1 -1
  34. package/dist/assets/SettingsModal-afRPXeYI.js +2 -0
  35. package/dist/assets/{ShareDepartmentDialog-CJITsmAd.js → ShareDepartmentDialog-CwErWDth.js} +1 -1
  36. package/dist/assets/{SignedInSites-B2pCMdic.js → SignedInSites-CFyvOLSc.js} +1 -1
  37. package/dist/assets/{TeamFilesPage-B10cdbwa.js → TeamFilesPage-BvhXs2O5.js} +1 -1
  38. package/dist/assets/{TeamLibraryPanel-CRmTfBOI.js → TeamLibraryPanel-Dm8wjNB4.js} +1 -1
  39. package/dist/assets/{TeamMapPage-BoTNppEy.js → TeamMapPage-jCSzFPvB.js} +1 -1
  40. package/dist/assets/{ToolPageShell-BPd_nyJ8.js → ToolPageShell-DKZUregg.js} +1 -1
  41. package/dist/assets/{TriggersPage-DDxtJMT4.js → TriggersPage-wSB6z1cp.js} +1 -1
  42. package/dist/assets/{VisibilitySection-Cd3TZvS_.js → VisibilitySection-CFr6fOzq.js} +1 -1
  43. package/dist/assets/{WebhookTrigger-AJduidiC.js → WebhookTrigger-BJN-V-bx.js} +1 -1
  44. package/dist/assets/{WorksOnGrid-DHo10o0j.js → WorksOnGrid-B3wYro9M.js} +1 -1
  45. package/dist/assets/{abnfDiagram-YUKMZFIV-DnIZyeSK.js → abnfDiagram-YUKMZFIV-DRhWKTiz.js} +1 -1
  46. package/dist/assets/{activity-DrX2_Hm9.js → activity-l0oTqbd6.js} +1 -1
  47. package/dist/assets/{architectureDiagram-47P4ROYG-DHdulT2e.js → architectureDiagram-47P4ROYG-C_qnTvJF.js} +1 -1
  48. package/dist/assets/{blockDiagram-E7TT5TSB-BGReDH4k.js → blockDiagram-E7TT5TSB-DzLSloVY.js} +1 -1
  49. package/dist/assets/{c4Diagram-CRA5TL53-BV9zDZsL.js → c4Diagram-CRA5TL53-BzVViHCA.js} +1 -1
  50. package/dist/assets/{calendar-days-Ddhxf1PV.js → calendar-days-DFd3GKf_.js} +1 -1
  51. package/dist/assets/channel-B2D6cAE5.js +1 -0
  52. package/dist/assets/{chunk-2Q5K7J3B-DAj16syq.js → chunk-2Q5K7J3B-hR-bQJHo.js} +1 -1
  53. package/dist/assets/{chunk-5VM5RSS4-CMyoXW_3.js → chunk-5VM5RSS4-BWmBW1XC.js} +1 -1
  54. package/dist/assets/{chunk-7TKQ45FW--z54G8Jv.js → chunk-7TKQ45FW-DuUk7RXl.js} +1 -1
  55. package/dist/assets/{chunk-AW2ZBBNX-CPPbUHIj.js → chunk-AW2ZBBNX-Madgl1uv.js} +1 -1
  56. package/dist/assets/{chunk-FVRAUYC3-pKEz9wbK.js → chunk-FVRAUYC3-WSgsvIGA.js} +2 -2
  57. package/dist/assets/{chunk-HTAEGDNF-DIOqwx2X.js → chunk-HTAEGDNF-CfoPR2yG.js} +1 -1
  58. package/dist/assets/{chunk-JWPE2WC7-BW474-Li.js → chunk-JWPE2WC7-tLRHdBom.js} +1 -1
  59. package/dist/assets/{chunk-KQW6MTUR-DjAEB-Df.js → chunk-KQW6MTUR-BqwuNuVY.js} +1 -1
  60. package/dist/assets/{chunk-XXDRQBXY-CMZz2xNV.js → chunk-XXDRQBXY-BOeb8xE4.js} +1 -1
  61. package/dist/assets/{classDiagram-v2-K4WV4PDN-7GYDWs2n.js → classDiagram-v2-K4WV4PDN-CFeH5trZ.js} +1 -1
  62. package/dist/assets/{core-Dq4LUz6X.js → core-CnInZb-o.js} +1 -1
  63. package/dist/assets/{cose-bilkent-JH36ORCC-Dy2zOVu3.js → cose-bilkent-JH36ORCC-BEg68hhI.js} +1 -1
  64. package/dist/assets/{cynefin-EF2NZ3EQ-C7I3qmqf.js → cynefin-EF2NZ3EQ-B_Xq3hQ3.js} +1 -1
  65. package/dist/assets/{cynefinDiagram-3GCD6N5R-CsPcUXHD.js → cynefinDiagram-3GCD6N5R-DN1o2ihW.js} +1 -1
  66. package/dist/assets/{dagre-W4DXFKR2-DxvGlifm.js → dagre-W4DXFKR2-BFf83-nP.js} +1 -1
  67. package/dist/assets/{de-CrlnmnfQ.js → de-BpsYkrLY.js} +1 -1
  68. package/dist/assets/{desktop-connection-Df-k5QBM.js → desktop-connection-CU6jsy2e.js} +1 -1
  69. package/dist/assets/{diagram-2UJZ2QOL-Qz2-e2_u.js → diagram-2UJZ2QOL-_qwbS5JH.js} +1 -1
  70. package/dist/assets/{diagram-OVF4WLC6-D1u4ioUX.js → diagram-OVF4WLC6-9sq9EfiF.js} +1 -1
  71. package/dist/assets/{diagram-PFPMY2P6-DZiCtcMI.js → diagram-PFPMY2P6-Ow1v5ZhK.js} +1 -1
  72. package/dist/assets/{diagram-UMYRVEAY-DmVn9h1H.js → diagram-UMYRVEAY-DDTBFPls.js} +1 -1
  73. package/dist/assets/{diagram-YEKJPTXX-CJK2ajcB.js → diagram-YEKJPTXX-D1zZ8KqI.js} +1 -1
  74. package/dist/assets/{diagram-ZIFT7M5P-NoYT_JX9.js → diagram-ZIFT7M5P-C_vZWUw8.js} +1 -1
  75. package/dist/assets/{ebnfDiagram-VR2GEFS7-BooF3Pem.js → ebnfDiagram-VR2GEFS7-D_1GvBDx.js} +1 -1
  76. package/dist/assets/{elk-IJKZMXRS-4Ai0igvq.js → elk-IJKZMXRS-CV-PzspH.js} +1 -1
  77. package/dist/assets/{erDiagram-O2IAPWRE-CdhhzqVX.js → erDiagram-O2IAPWRE-CnKVd0av.js} +1 -1
  78. package/dist/assets/{es-BIPy8tP9.js → es-COLCGADa.js} +1 -1
  79. package/dist/assets/{file-up-Bs5NWcjw.js → file-up-Bjx5Vcmk.js} +1 -1
  80. package/dist/assets/{flowDiagram-OXPTDLAJ-SeyZJAiT.js → flowDiagram-OXPTDLAJ-CGJh171P.js} +1 -1
  81. package/dist/assets/{fr-CCbXz1Dc.js → fr-CJ1x1iRl.js} +1 -1
  82. package/dist/assets/{ganttDiagram-R7TSEDQI-rmA_SJlC.js → ganttDiagram-R7TSEDQI-CygoACFs.js} +1 -1
  83. package/dist/assets/{gitGraphDiagram-XJZIOB7I-Coc2oeHo.js → gitGraphDiagram-XJZIOB7I-ByxErzHV.js} +1 -1
  84. package/dist/assets/{hi-DmCL9a_Y.js → hi-BC0iO7jD.js} +1 -1
  85. package/dist/assets/{index-uiyAwyX1.js → index-BRfvYRb5.js} +1 -1
  86. package/dist/assets/{index-D69O3YiA.js → index-DQZxP2c4.js} +2 -2
  87. package/dist/assets/{index-C1PEx1tc.js → index-DtDQrExn.js} +3 -3
  88. package/dist/assets/{infoDiagram-5W2HQ5XZ-DScYPtht.js → infoDiagram-5W2HQ5XZ-BlzjfTwq.js} +1 -1
  89. package/dist/assets/{ishikawaDiagram-K3B6WC7H-Cf7mJB_l.js → ishikawaDiagram-K3B6WC7H-2rf_4lR_.js} +1 -1
  90. package/dist/assets/{it-BWkdcVfm.js → it-BIwsqdpz.js} +2 -2
  91. package/dist/assets/{ja-BaOL6cSA.js → ja-BJYXkO5E.js} +2 -2
  92. package/dist/assets/{journeyDiagram-COXZFDF6-Dtmolw3A.js → journeyDiagram-COXZFDF6-mGgPoETt.js} +1 -1
  93. package/dist/assets/{kanban-definition-P3RFRI5V-CSL1-s5L.js → kanban-definition-P3RFRI5V-j2hU8Bw4.js} +1 -1
  94. package/dist/assets/{kit-Cjq8TV0N.js → kit-qjammJR4.js} +1 -1
  95. package/dist/assets/{ko-ebMBLBXv.js → ko-7QtaPFvf.js} +2 -2
  96. package/dist/assets/{livekit-KT4NEVZO-B3DA1PsD.js → livekit-KT4NEVZO-DbFoU2r9.js} +1 -1
  97. package/dist/assets/{mcp-servers-DoMFsds6.js → mcp-servers-Tb2cnkiM.js} +1 -1
  98. package/dist/assets/{memory-BR-ujoQY.js → memory-BNaMRI5v.js} +1 -1
  99. package/dist/assets/{mermaid.core-BK1qxlD4.js → mermaid.core-B1mlFiOp.js} +4 -4
  100. package/dist/assets/{mindmap-definition-LZFPQGKD-Cb7ESZ0y.js → mindmap-definition-LZFPQGKD-C7XLkIzZ.js} +1 -1
  101. package/dist/assets/{minimize-msM7mbil.js → minimize-Dga3UCb8.js} +1 -1
  102. package/dist/assets/{monitor-DpsqT1_R.js → monitor-DMPjQDZP.js} +1 -1
  103. package/dist/assets/{org-library-alRyzCTE.js → org-library-IKFXm7D6.js} +1 -1
  104. package/dist/assets/{package-format-BFXbXHk8.js → package-format-COujx3jP.js} +1 -1
  105. package/dist/assets/{pegDiagram-BGZESJAR-CqmJQKhe.js → pegDiagram-BGZESJAR-BS2zKH6g.js} +1 -1
  106. package/dist/assets/{phones-J7mYR-fY.js → phones-CINpTjZv.js} +1 -1
  107. package/dist/assets/{pieDiagram-CAPJLFHJ-w_QuumOv.js → pieDiagram-CAPJLFHJ-DVAuLXem.js} +1 -1
  108. package/dist/assets/{pl-CSbinyb5.js → pl-CLa2ta1_.js} +2 -2
  109. package/dist/assets/{pt-br-BkWykL5e.js → pt-br-8RQzCbpg.js} +3 -3
  110. package/dist/assets/{quadrantDiagram-GDMTTRAM-248q9C3h.js → quadrantDiagram-GDMTTRAM-H7QRxmHt.js} +1 -1
  111. package/dist/assets/{rail-DRr_33Fe.js → rail-DNpLzOxa.js} +1 -1
  112. package/dist/assets/{railroadDiagram-SM67HX2B-BLzQ_5t7.js → railroadDiagram-SM67HX2B-dq6Rokc9.js} +1 -1
  113. package/dist/assets/{remote-desktop-panel-BPK6Q0O6.js → remote-desktop-panel-Cxv6Qt3x.js} +1 -1
  114. package/dist/assets/{requirementDiagram-X7JNWC4A-Bgi1TLdN.js → requirementDiagram-X7JNWC4A-BeWeL_-r.js} +1 -1
  115. package/dist/assets/{ru-DD01Hb1S.js → ru-CIdzvRVZ.js} +2 -2
  116. package/dist/assets/{sankeyDiagram-UM26HJRW-CrZgn-Cf.js → sankeyDiagram-UM26HJRW-BmJ-9lt-.js} +1 -1
  117. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-gAwq1ZfG.js → sequenceDiagram-ZO4K6R2Y-Uuh1hEOh.js} +1 -1
  118. package/dist/assets/{sizeCapture-INFHLROL-BlXmG_DJ.js → sizeCapture-INFHLROL-mKDf6lys.js} +1 -1
  119. package/dist/assets/{stateDiagram-v2-TBUQTH76-CEFB1Iaq.js → stateDiagram-v2-TBUQTH76-BaEihzov.js} +1 -1
  120. package/dist/assets/{styles-DOJOOIp4.js → styles-3g-ZPS7M.js} +5 -5
  121. package/dist/assets/styles-CsrDURJH.css +1 -0
  122. package/dist/assets/{swimlanes-N4OXWK64-BtJmWAOz.js → swimlanes-N4OXWK64-CpP-NKGz.js} +1 -1
  123. package/dist/assets/swimlanesDiagram-K3J5GTZL-C50Dm6LQ.js +8 -0
  124. package/dist/assets/{template-add-BcTS64TG.js → template-add-CHwGLPet.js} +1 -1
  125. package/dist/assets/{timeline-definition-YOQAKGHF-BZ270zxf.js → timeline-definition-YOQAKGHF-Ca3rjetv.js} +1 -1
  126. package/dist/assets/{tr-Bw35A32w.js → tr-BhclavHM.js} +1 -1
  127. package/dist/assets/{uk-DsPsCgp4.js → uk-Or5wmf6s.js} +1 -1
  128. package/dist/assets/{usecaseDiagram-VIAY4XPW-D5yZb3KQ.js → usecaseDiagram-VIAY4XPW-BuuYl689.js} +1 -1
  129. package/dist/assets/{vennDiagram-BLWOH2XV-OFx2qTzp.js → vennDiagram-BLWOH2XV-C__pWnnE.js} +1 -1
  130. package/dist/assets/{vi-DhPdzwW-.js → vi-CYbGVqh-.js} +1 -1
  131. package/dist/assets/{wardleyDiagram-YMQ3BMBF-DzSmrVKa.js → wardleyDiagram-YMQ3BMBF-yWcEHD-N.js} +1 -1
  132. package/dist/assets/{xychartDiagram-TAQBALBS-UP1H1u5V.js → xychartDiagram-TAQBALBS-CvcdOA7A.js} +1 -1
  133. package/dist/assets/{zh-CzC3CUQA.js → zh-iptM1e_T.js} +2 -2
  134. package/dist/assets/{zh-tw-DeXHnAvy.js → zh-tw-BaO1c--E.js} +2 -2
  135. package/dist/index.html +3 -3
  136. package/dist/rail.html +5 -5
  137. package/dist-server/container-mcp.js +18 -17
  138. package/dist-server/index.js +1136 -1114
  139. package/dist-server/openmausbot.js +182 -180
  140. package/dist-server/package.json +1 -1
  141. package/dist-server/pair-cli.js +182 -180
  142. package/dist-server/server/ai-pool.js +72 -0
  143. package/dist-server/server/cloud-connected-apps.js +33 -16
  144. package/dist-server/server/composio-broker-access.js +1 -1
  145. package/dist-server/server/composio.js +3 -2
  146. package/dist-server/server/config.js +5 -7
  147. package/dist-server/server/connector-auth-config-hint.js +5 -0
  148. package/dist-server/server/drivers/claude.js +14 -11
  149. package/dist-server/server/flatpak-host.js +5 -2
  150. package/dist-server/server/host/ai-pool.js +109 -0
  151. package/dist-server/server/host/app-suggestions.js +2 -1
  152. package/dist-server/server/host/limit-takeover.js +11 -4
  153. package/dist-server/server/index.js +33 -26
  154. package/dist-server/server/limit-failover.js +3 -0
  155. package/dist-server/server/model-selection-schema.js +9 -0
  156. package/dist-server/server/routes/ai-pool-patch.js +24 -0
  157. package/dist-server/server/routes/config.js +8 -1
  158. package/dist-server/server/routine-dispatch.js +21 -0
  159. package/dist-server/server/routines.js +4 -18
  160. package/dist-server/server/tailscale.js +16 -6
  161. package/dist-server/server/workspace-backup-http.js +2 -2
  162. package/dist-server/shared/limit-backup.js +1 -1
  163. package/dist-server/shared/settings-places.js +1 -0
  164. package/dist-server/shared/toolkit-card.js +1 -0
  165. package/dist-server/vps-container-mcp.js +18 -17
  166. package/dist-server/workspace-backup.worker.js +18 -17
  167. package/package.json +1 -1
  168. package/dist/assets/PluginsPanel-B5Q70eO8.js +0 -8
  169. package/dist/assets/RoutinesPage-CLXohizn.js +0 -2
  170. package/dist/assets/SettingsModal-BlX9XoBu.js +0 -2
  171. package/dist/assets/channel-DZM5KU--.js +0 -1
  172. package/dist/assets/styles-9UFSdSaJ.css +0 -1
  173. package/dist/assets/swimlanesDiagram-K3J5GTZL-pBTtzroP.js +0 -8
@@ -1 +1 @@
1
- import{r as l,t as a,j as e}from"./styles-DOJOOIp4.js";import{J as x,N as h,O as j,Q as f,R as y,U as N,W as T,X as g,Y as k}from"./App-BIllYA_e.js";import{L as d}from"./PlacesRail-3RaNlpug.js";import"./index-C1PEx1tc.js";import"./MenuMotion-DfjnHTCi.js";import"./monitor-DpsqT1_R.js";import"./placement-BKtVnQht.js";function v({card:s}){const t=j(s),r=f(),u=y(),[m,n]=l.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-xl border border-hairline/40 px-3 py-2.5",children:e.jsx(N,{card:t.card})}),!t.card.fallback&&t.card.status!=="published"&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:a("template.publicNote")}),e.jsx(T,{actions:t,primary:a("template.publishToCommunity"),view:{label:a("template.viewPullRequest"),url:t.card.prUrl??t.card.link},extra:t.card.status==="gone"?null:e.jsxs(e.Fragment,{children:[u&&e.jsx("button",{type:"button","data-template-repo":!0,onClick:()=>n(!0),disabled:t.busy!==null,className:"ui-button ui-button-md",children:a("template.publishToRepo")}),r&&e.jsxs("button",{type:"button","data-template-team":!0,onClick:()=>{t.addToTeam(r)},disabled:t.busy!==null,className:"ui-button ui-button-md",children:[t.busy==="team"&&e.jsx(d,{size:14,"aria-hidden":"true",className:"animate-spin motion-reduce:animate-none"}),a("template.addToTeam",{team:r})]}),!t.card.fallback&&e.jsx("button",{type:"button","data-template-save":!0,onClick:()=>{t.save()},disabled:t.busy!==null,className:"ui-button ui-button-md",children:a("template.saveFolder")})]})}),e.jsx(g,{actions:t}),m&&e.jsx(k,{card:t.card,onClose:()=>n(!1)})]})}function A({department:s,onClose:t}){const[r,u]=l.useState(null),[m,n]=l.useState(""),[c,p]=l.useState(0),b=l.useId();return l.useEffect(()=>{let o=!0;return n(""),x(s).then(i=>{o&&u(i)},i=>{o&&n(i instanceof Error&&i.message?i.message:a("template.failed"))}),()=>{o=!1}},[s,c]),e.jsx(h,{title:a("template.shareDepartment",{name:s}),labelledBy:b,onClose:t,footer:e.jsx("button",{type:"button",className:"ui-button ui-button-md",onClick:t,children:a("common.close")}),children:e.jsx("div",{"data-share-department":s,children:r?e.jsx(v,{card:r}):m?e.jsxs("div",{role:"alert",className:"text-[13px] text-danger",children:[e.jsx("p",{dir:"auto",children:m}),e.jsx("button",{type:"button",className:"ui-button ui-button-md mt-2",onClick:()=>p(o=>o+1),children:a("common.tryAgain")})]}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(d,{size:14,"aria-hidden":"true",className:"animate-spin motion-reduce:animate-none"}),a("template.making")]})})})}export{A as ShareDepartmentDialog};
1
+ import{r as l,t as a,j as e}from"./styles-3g-ZPS7M.js";import{J as x,N as h,O as j,Q as f,R as y,U as N,W as T,X as g,Y as k}from"./App-h8WTNY4l.js";import{L as d}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";function v({card:s}){const t=j(s),r=f(),u=y(),[m,n]=l.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-xl border border-hairline/40 px-3 py-2.5",children:e.jsx(N,{card:t.card})}),!t.card.fallback&&t.card.status!=="published"&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:a("template.publicNote")}),e.jsx(T,{actions:t,primary:a("template.publishToCommunity"),view:{label:a("template.viewPullRequest"),url:t.card.prUrl??t.card.link},extra:t.card.status==="gone"?null:e.jsxs(e.Fragment,{children:[u&&e.jsx("button",{type:"button","data-template-repo":!0,onClick:()=>n(!0),disabled:t.busy!==null,className:"ui-button ui-button-md",children:a("template.publishToRepo")}),r&&e.jsxs("button",{type:"button","data-template-team":!0,onClick:()=>{t.addToTeam(r)},disabled:t.busy!==null,className:"ui-button ui-button-md",children:[t.busy==="team"&&e.jsx(d,{size:14,"aria-hidden":"true",className:"animate-spin motion-reduce:animate-none"}),a("template.addToTeam",{team:r})]}),!t.card.fallback&&e.jsx("button",{type:"button","data-template-save":!0,onClick:()=>{t.save()},disabled:t.busy!==null,className:"ui-button ui-button-md",children:a("template.saveFolder")})]})}),e.jsx(g,{actions:t}),m&&e.jsx(k,{card:t.card,onClose:()=>n(!1)})]})}function A({department:s,onClose:t}){const[r,u]=l.useState(null),[m,n]=l.useState(""),[c,p]=l.useState(0),b=l.useId();return l.useEffect(()=>{let o=!0;return n(""),x(s).then(i=>{o&&u(i)},i=>{o&&n(i instanceof Error&&i.message?i.message:a("template.failed"))}),()=>{o=!1}},[s,c]),e.jsx(h,{title:a("template.shareDepartment",{name:s}),labelledBy:b,onClose:t,footer:e.jsx("button",{type:"button",className:"ui-button ui-button-md",onClick:t,children:a("common.close")}),children:e.jsx("div",{"data-share-department":s,children:r?e.jsx(v,{card:r}):m?e.jsxs("div",{role:"alert",className:"text-[13px] text-danger",children:[e.jsx("p",{dir:"auto",children:m}),e.jsx("button",{type:"button",className:"ui-button ui-button-md mt-2",onClick:()=>p(o=>o+1),children:a("common.tryAgain")})]}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(d,{size:14,"aria-hidden":"true",className:"animate-spin motion-reduce:animate-none"}),a("template.making")]})})})}export{A as ShareDepartmentDialog};
@@ -1 +1 @@
1
- import{r as n,t as s,j as e}from"./styles-DOJOOIp4.js";import{g as I,A as ee,a8 as te}from"./App-BIllYA_e.js";import{r as se,e as K}from"./PlacesRail-3RaNlpug.js";import"./index-C1PEx1tc.js";const P="ui-button min-h-9 px-4 text-[14px]",U="ui-button ui-button-primary min-h-9 px-4 text-[14px]",H="button:not([disabled]), input:not([disabled])",B=l=>l instanceof Error&&l.message?l.message:s("settings.sites.import.error");function ie({profiles:l,target:u,scope:j={},sharedBy:v,onImported:k,onClose:p}){const b=[...l].sort((t,o)=>Number(o.lastUsed)-Number(t.lastUsed)),[f,$]=n.useState(b[0].id),[c,y]=n.useState("profile"),[a,L]=n.useState(null),[N,w]=n.useState(new Set),[E,S]=n.useState(""),[x,D]=n.useState(null),[m,h]=n.useState(!1),[C,i]=n.useState(""),d=n.useRef(null),F=n.useRef(p);F.current=p;const T=n.useId();n.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null,o=r=>{if(r.key==="Escape"){r.preventDefault(),r.target instanceof HTMLInputElement&&r.target.type==="search"&&r.target.value?S(""):F.current();return}if(r.key!=="Tab")return;const A=[...d.current?.querySelectorAll(H)??[]];if(!A.length){r.preventDefault(),d.current?.focus();return}const q=A[0],J=A[A.length-1];r.shiftKey&&document.activeElement===q?(r.preventDefault(),J.focus()):!r.shiftKey&&document.activeElement===J&&(r.preventDefault(),q.focus())};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),t?.isConnected&&t!==document.body&&t.focus()}},[]),n.useEffect(()=>{(d.current?.querySelectorAll(c==="profile"?"input:checked":H)?.[0]??d.current)?.focus()},[c]);const Q=b.find(t=>t.id===f)??b[0],Y=async()=>{h(!0),i("");try{const t=await I("/api/browser-sites/import/sites",{method:"POST",body:JSON.stringify({...u,...j,source:f})});L(t),S(""),w(new Set(t.sites.filter(o=>o.suggested&&!o.sensitive).map(o=>o.site))),y("sites")}catch(t){i(B(t))}finally{h(!1)}},G=async()=>{if(a){h(!0),i("");try{const t=await I("/api/browser-sites/import",{method:"POST",body:JSON.stringify({...u,...j,ticket:a.ticket,sites:a.sites.filter(o=>N.has(o.site)).map(o=>o.site)})});D(t),y("done"),k(t.sites)}catch(t){i(B(t)),t instanceof ee&&t.status===409&&y("profile")}finally{h(!1)}}},V=t=>w(o=>{const r=new Set(o);return r.delete(t)||r.add(t),r}),W=E.trim().toLowerCase(),g=a?a.sites.filter(t=>t.site.toLowerCase().includes(W)):[],z=g.filter(t=>N.has(t.site)).length,R=g.length>0&&z===g.length,X=z>0&&!R,Z=()=>w(t=>{const o=new Set(t);for(const r of g)R?o.delete(r.site):o.add(r.site);return o}),O=N.size,_=O===1?s("settings.sites.import.countOne"):s("settings.sites.import.count",{count:O}),M=`${T}-none`;return se.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-6",onMouseDown:t=>t.target===t.currentTarget&&F.current(),children:e.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":T,"aria-busy":m,tabIndex:-1,"data-look":"dialog",className:"flex max-h-[85vh] w-full max-w-[460px] flex-col gap-3 rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[e.jsx("h2",{id:T,className:"text-[15px] font-semibold text-ink",children:s("settings.sites.import.title")}),c==="profile"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:s("settings.sites.import.consent",{browser:Q.browserName})}),v.length>1&&e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:s("settings.sites.shared",{names:v.join(", ")})}),e.jsxs("fieldset",{className:"flex min-w-0 flex-col gap-1",children:[e.jsx("legend",{className:"sr-only",children:s("settings.sites.import.profile")}),b.map(t=>e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-raised/50",children:[e.jsx("input",{type:"radio",name:`${T}-profile`,checked:t.id===f,onChange:()=>$(t.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:t.name}),e.jsxs("span",{className:"shrink-0 text-[11px] text-ink-secondary",children:[t.browserName,t.lastUsed?` · ${s("settings.sites.import.lastUsed")}`:""]})]},t.id))]})]}),c==="sites"&&a&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.sitesFrom",{profile:a.profileName})}),a.sites.length===0&&e.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("settings.sites.import.empty")}),a.sites.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search",value:E,onChange:t=>S(t.target.value),placeholder:s("settings.sites.import.search"),"aria-label":s("settings.sites.import.search"),className:"w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-accent focus:outline-none"}),e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 border-b border-hairline/30 pb-1.5",children:[e.jsx("input",{type:"checkbox",ref:t=>{t&&(t.indeterminate=X)},checked:R,disabled:!g.length,onChange:Z}),e.jsx("span",{className:"text-[13px] font-medium text-ink",children:s("settings.sites.import.selectAll")})]})]}),a.sites.length>0&&!g.length&&e.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("settings.sites.import.noMatch")}),g.length>0&&e.jsx("ul",{className:"flex min-h-0 flex-col divide-y divide-hairline/30 overflow-y-auto",children:g.map(t=>e.jsx("li",{children:e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 py-1.5",children:[e.jsx("input",{type:"checkbox",checked:N.has(t.site),onChange:()=>V(t.site)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:t.site,children:t.site}),t.sensitive&&e.jsx("span",{className:"shrink-0 rounded-md bg-raised px-1.5 py-0.5 text-[11px] text-ink-secondary",children:s(`settings.sites.import.kind.${t.sensitive}`)})]})},t.site))}),a.sites.some(t=>t.sensitive)&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.sensitive")}),O===0&&e.jsx("p",{id:M,className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.none")})]}),c==="done"&&x&&e.jsxs("div",{role:"status",className:"flex flex-col gap-1 text-[13px] text-ink",children:[e.jsx("p",{children:x.imported.sites===1?s("settings.sites.import.doneOne",{cookies:x.imported.cookies}):s("settings.sites.import.done",{sites:x.imported.sites,cookies:x.imported.cookies})}),x.skipped>0&&e.jsx("p",{className:"text-ink-secondary",children:s("settings.sites.import.skipped",{skipped:x.skipped})})]}),C&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:C}),e.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[c==="profile"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:P,onClick:p,children:s("common.cancel")}),e.jsx("button",{type:"button",className:U,disabled:m,onClick:()=>{Y()},children:m?s("settings.sites.import.working"):s("settings.sites.import.continue")})]}),c==="sites"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:P,disabled:m,onClick:()=>{i(""),y("profile")},children:s("settings.sites.import.back")}),e.jsx("button",{type:"button",className:P,onClick:p,children:s("common.cancel")}),e.jsx("button",{type:"button",className:U,disabled:m||O===0,"aria-describedby":O===0?M:void 0,onClick:()=>{G()},children:m?s("settings.sites.import.working"):_})]}),c==="done"&&e.jsx("button",{type:"button",className:U,onClick:p,children:s("common.close")})]})]})}),document.body)}function le({target:l,scope:u={},sharedBy:j,disabled:v=!1,bare:k=!1}){const[p,b]=n.useState(null),[f,$]=n.useState(!1),[c,y]=n.useState(""),[a,L]=n.useState([]),[N,w]=n.useState(!1);n.useEffect(()=>{let i=!0;return I("/api/browser-sites/import/profiles").then(d=>{i&&Array.isArray(d.profiles)&&L(d.profiles)}).catch(()=>{}),()=>{i=!1}},[]);const E=async i=>{$(!0),y("");try{b((await i()).sites)}catch(d){y(d instanceof Error&&d.message?d.message:s("settings.sites.error"))}finally{$(!1)}},S=()=>E(()=>I(`/api/browser-sites?${new URLSearchParams({...l,...u}).toString()}`)),x=i=>E(()=>I("/api/browser-sites/sign-out",{method:"POST",body:JSON.stringify({...l,...u,...i?{site:i}:{}})})),D=`${"bot"in l?`bot:${l.bot}`:`profile:${l.profile}`}${u.threadId?`:${u.threadId}`:""}`;n.useEffect(()=>{k&&S()},[k,D]);const m=v||f,h="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",C=e.jsxs("div",{className:k?"flex min-w-0 flex-col gap-2":"mt-2 flex flex-col gap-2","aria-busy":f,children:[j.length>1&&e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:s("settings.sites.shared",{names:j.join(", ")})}),p===null&&!c&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.loading")}),p?.length===0&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.none")}),!!p?.length&&e.jsx("ul",{className:"divide-y divide-hairline/30",children:p.map(i=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:i.site,children:i.site}),e.jsxs("button",{type:"button",disabled:m,onClick:()=>{x(i.site)},"aria-label":s("settings.sites.signOutOf",{site:i.site}),className:h,children:[e.jsx(K,{size:13}),s("settings.sites.signOut")]})]},i.site))}),!!p?.length&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>{x()},className:`${h} self-start`,children:[e.jsx(K,{size:13}),s("settings.sites.signOutAll")]}),a.length>0&&e.jsxs("button",{type:"button",disabled:m,title:v&&!f?s("settings.sites.import.wait"):void 0,onClick:()=>w(!0),className:`${h} self-start`,children:[e.jsx(te,{size:13}),s("settings.sites.import.open")]}),N&&e.jsx(ie,{profiles:a,target:l,scope:u,sharedBy:j,onImported:b,onClose:()=>w(!1)}),c&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:c})]});return k?C:e.jsxs("details",{className:"min-w-0",onToggle:i=>{i.currentTarget.open&&!f&&S()},children:[e.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:s("settings.sites.title")}),C]})}export{le as S};
1
+ import{r as n,t as s,j as e}from"./styles-3g-ZPS7M.js";import{g as I,A as ee,a8 as te}from"./App-h8WTNY4l.js";import{r as se,e as K}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";const P="ui-button min-h-9 px-4 text-[14px]",U="ui-button ui-button-primary min-h-9 px-4 text-[14px]",H="button:not([disabled]), input:not([disabled])",B=l=>l instanceof Error&&l.message?l.message:s("settings.sites.import.error");function ie({profiles:l,target:u,scope:j={},sharedBy:v,onImported:k,onClose:p}){const b=[...l].sort((t,o)=>Number(o.lastUsed)-Number(t.lastUsed)),[f,$]=n.useState(b[0].id),[c,y]=n.useState("profile"),[a,L]=n.useState(null),[N,w]=n.useState(new Set),[E,S]=n.useState(""),[x,D]=n.useState(null),[m,h]=n.useState(!1),[C,i]=n.useState(""),d=n.useRef(null),F=n.useRef(p);F.current=p;const T=n.useId();n.useEffect(()=>{const t=document.activeElement instanceof HTMLElement?document.activeElement:null,o=r=>{if(r.key==="Escape"){r.preventDefault(),r.target instanceof HTMLInputElement&&r.target.type==="search"&&r.target.value?S(""):F.current();return}if(r.key!=="Tab")return;const A=[...d.current?.querySelectorAll(H)??[]];if(!A.length){r.preventDefault(),d.current?.focus();return}const q=A[0],J=A[A.length-1];r.shiftKey&&document.activeElement===q?(r.preventDefault(),J.focus()):!r.shiftKey&&document.activeElement===J&&(r.preventDefault(),q.focus())};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),t?.isConnected&&t!==document.body&&t.focus()}},[]),n.useEffect(()=>{(d.current?.querySelectorAll(c==="profile"?"input:checked":H)?.[0]??d.current)?.focus()},[c]);const Q=b.find(t=>t.id===f)??b[0],Y=async()=>{h(!0),i("");try{const t=await I("/api/browser-sites/import/sites",{method:"POST",body:JSON.stringify({...u,...j,source:f})});L(t),S(""),w(new Set(t.sites.filter(o=>o.suggested&&!o.sensitive).map(o=>o.site))),y("sites")}catch(t){i(B(t))}finally{h(!1)}},G=async()=>{if(a){h(!0),i("");try{const t=await I("/api/browser-sites/import",{method:"POST",body:JSON.stringify({...u,...j,ticket:a.ticket,sites:a.sites.filter(o=>N.has(o.site)).map(o=>o.site)})});D(t),y("done"),k(t.sites)}catch(t){i(B(t)),t instanceof ee&&t.status===409&&y("profile")}finally{h(!1)}}},V=t=>w(o=>{const r=new Set(o);return r.delete(t)||r.add(t),r}),W=E.trim().toLowerCase(),g=a?a.sites.filter(t=>t.site.toLowerCase().includes(W)):[],z=g.filter(t=>N.has(t.site)).length,R=g.length>0&&z===g.length,X=z>0&&!R,Z=()=>w(t=>{const o=new Set(t);for(const r of g)R?o.delete(r.site):o.add(r.site);return o}),O=N.size,_=O===1?s("settings.sites.import.countOne"):s("settings.sites.import.count",{count:O}),M=`${T}-none`;return se.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-6",onMouseDown:t=>t.target===t.currentTarget&&F.current(),children:e.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":T,"aria-busy":m,tabIndex:-1,"data-look":"dialog",className:"flex max-h-[85vh] w-full max-w-[460px] flex-col gap-3 rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[e.jsx("h2",{id:T,className:"text-[15px] font-semibold text-ink",children:s("settings.sites.import.title")}),c==="profile"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:s("settings.sites.import.consent",{browser:Q.browserName})}),v.length>1&&e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:s("settings.sites.shared",{names:v.join(", ")})}),e.jsxs("fieldset",{className:"flex min-w-0 flex-col gap-1",children:[e.jsx("legend",{className:"sr-only",children:s("settings.sites.import.profile")}),b.map(t=>e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-raised/50",children:[e.jsx("input",{type:"radio",name:`${T}-profile`,checked:t.id===f,onChange:()=>$(t.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:t.name}),e.jsxs("span",{className:"shrink-0 text-[11px] text-ink-secondary",children:[t.browserName,t.lastUsed?` · ${s("settings.sites.import.lastUsed")}`:""]})]},t.id))]})]}),c==="sites"&&a&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.sitesFrom",{profile:a.profileName})}),a.sites.length===0&&e.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("settings.sites.import.empty")}),a.sites.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search",value:E,onChange:t=>S(t.target.value),placeholder:s("settings.sites.import.search"),"aria-label":s("settings.sites.import.search"),className:"w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-accent focus:outline-none"}),e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 border-b border-hairline/30 pb-1.5",children:[e.jsx("input",{type:"checkbox",ref:t=>{t&&(t.indeterminate=X)},checked:R,disabled:!g.length,onChange:Z}),e.jsx("span",{className:"text-[13px] font-medium text-ink",children:s("settings.sites.import.selectAll")})]})]}),a.sites.length>0&&!g.length&&e.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("settings.sites.import.noMatch")}),g.length>0&&e.jsx("ul",{className:"flex min-h-0 flex-col divide-y divide-hairline/30 overflow-y-auto",children:g.map(t=>e.jsx("li",{children:e.jsxs("label",{className:"flex min-w-0 cursor-pointer items-center gap-2 py-1.5",children:[e.jsx("input",{type:"checkbox",checked:N.has(t.site),onChange:()=>V(t.site)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:t.site,children:t.site}),t.sensitive&&e.jsx("span",{className:"shrink-0 rounded-md bg-raised px-1.5 py-0.5 text-[11px] text-ink-secondary",children:s(`settings.sites.import.kind.${t.sensitive}`)})]})},t.site))}),a.sites.some(t=>t.sensitive)&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.sensitive")}),O===0&&e.jsx("p",{id:M,className:"text-[12px] text-ink-secondary",children:s("settings.sites.import.none")})]}),c==="done"&&x&&e.jsxs("div",{role:"status",className:"flex flex-col gap-1 text-[13px] text-ink",children:[e.jsx("p",{children:x.imported.sites===1?s("settings.sites.import.doneOne",{cookies:x.imported.cookies}):s("settings.sites.import.done",{sites:x.imported.sites,cookies:x.imported.cookies})}),x.skipped>0&&e.jsx("p",{className:"text-ink-secondary",children:s("settings.sites.import.skipped",{skipped:x.skipped})})]}),C&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:C}),e.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[c==="profile"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:P,onClick:p,children:s("common.cancel")}),e.jsx("button",{type:"button",className:U,disabled:m,onClick:()=>{Y()},children:m?s("settings.sites.import.working"):s("settings.sites.import.continue")})]}),c==="sites"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:P,disabled:m,onClick:()=>{i(""),y("profile")},children:s("settings.sites.import.back")}),e.jsx("button",{type:"button",className:P,onClick:p,children:s("common.cancel")}),e.jsx("button",{type:"button",className:U,disabled:m||O===0,"aria-describedby":O===0?M:void 0,onClick:()=>{G()},children:m?s("settings.sites.import.working"):_})]}),c==="done"&&e.jsx("button",{type:"button",className:U,onClick:p,children:s("common.close")})]})]})}),document.body)}function le({target:l,scope:u={},sharedBy:j,disabled:v=!1,bare:k=!1}){const[p,b]=n.useState(null),[f,$]=n.useState(!1),[c,y]=n.useState(""),[a,L]=n.useState([]),[N,w]=n.useState(!1);n.useEffect(()=>{let i=!0;return I("/api/browser-sites/import/profiles").then(d=>{i&&Array.isArray(d.profiles)&&L(d.profiles)}).catch(()=>{}),()=>{i=!1}},[]);const E=async i=>{$(!0),y("");try{b((await i()).sites)}catch(d){y(d instanceof Error&&d.message?d.message:s("settings.sites.error"))}finally{$(!1)}},S=()=>E(()=>I(`/api/browser-sites?${new URLSearchParams({...l,...u}).toString()}`)),x=i=>E(()=>I("/api/browser-sites/sign-out",{method:"POST",body:JSON.stringify({...l,...u,...i?{site:i}:{}})})),D=`${"bot"in l?`bot:${l.bot}`:`profile:${l.profile}`}${u.threadId?`:${u.threadId}`:""}`;n.useEffect(()=>{k&&S()},[k,D]);const m=v||f,h="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",C=e.jsxs("div",{className:k?"flex min-w-0 flex-col gap-2":"mt-2 flex flex-col gap-2","aria-busy":f,children:[j.length>1&&e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:s("settings.sites.shared",{names:j.join(", ")})}),p===null&&!c&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.loading")}),p?.length===0&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("settings.sites.none")}),!!p?.length&&e.jsx("ul",{className:"divide-y divide-hairline/30",children:p.map(i=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",title:i.site,children:i.site}),e.jsxs("button",{type:"button",disabled:m,onClick:()=>{x(i.site)},"aria-label":s("settings.sites.signOutOf",{site:i.site}),className:h,children:[e.jsx(K,{size:13}),s("settings.sites.signOut")]})]},i.site))}),!!p?.length&&e.jsxs("button",{type:"button",disabled:m,onClick:()=>{x()},className:`${h} self-start`,children:[e.jsx(K,{size:13}),s("settings.sites.signOutAll")]}),a.length>0&&e.jsxs("button",{type:"button",disabled:m,title:v&&!f?s("settings.sites.import.wait"):void 0,onClick:()=>w(!0),className:`${h} self-start`,children:[e.jsx(te,{size:13}),s("settings.sites.import.open")]}),N&&e.jsx(ie,{profiles:a,target:l,scope:u,sharedBy:j,onImported:b,onClose:()=>w(!1)}),c&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:c})]});return k?C:e.jsxs("details",{className:"min-w-0",onToggle:i=>{i.currentTarget.open&&!f&&S()},children:[e.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:s("settings.sites.title")}),C]})}export{le as S};
@@ -1 +1 @@
1
- import{r as c,j as t,t as a,S as H,X as V,a as Y}from"./styles-DOJOOIp4.js";import{r as q}from"./memory-BR-ujoQY.js";import{u as Q,g as b,A as C,a4 as Z,a5 as ee,d as te,a6 as ae,a7 as se,a8 as A,a9 as ne,T as le}from"./App-BIllYA_e.js";import{T as ie,a as oe,b as re,c as ce}from"./ToolPageShell-BPd_nyJ8.js";import"./PlacesRail-3RaNlpug.js";import"./placement-BKtVnQht.js";import"./monitor-DpsqT1_R.js";import"./index-C1PEx1tc.js";import"./MenuMotion-DfjnHTCi.js";const p="/api/team-files",de=1024*1024,me=new Set(["txt","md","markdown","csv","tsv","json","log"]),ue=new Set(["png","jpg","jpeg","gif","webp"]),pe={exists:"teamFiles.error.exists",forbidden:"teamFiles.error.forbidden",not_found:"teamFiles.error.notFound",bad_path:"teamFiles.error.badName",link:"teamFiles.error.badName"},I=l=>l.includes(".")?l.split(".").at(-1).toLowerCase():"",v=l=>me.has(I(l))?"text":ue.has(I(l))?"picture":null,g=(l,r=!1)=>`${p}/file?path=${encodeURIComponent(l)}${r?"&download=1":""}`,O=(l,r)=>l?`${l}/${r}`:r;function S(l){const r=["B","KB","MB","GB"];let s=l,o=0;for(;s>=1024&&o<r.length-1;)s/=1024,o+=1;return`${o===0?s:s<10?Number(s.toFixed(1)):Math.round(s)} ${r[o]}`}function xe(l,r=Date.now()){const s=l.last;if(!s)return null;const o=s.person||a("teamFiles.someone"),i=q(s.at,r);return s.action==="uploaded"?a("teamFiles.uploaded",{person:o,when:i}):s.action==="folder"?a("teamFiles.made",{person:o,when:i}):s.bot?s.person?a("teamFiles.changedWith",{person:o,bot:s.bot,when:i}):a("teamFiles.changedBy",{person:s.bot,when:i}):a("teamFiles.changedBy",{person:o,when:i})}function fe(l,r){const s=l instanceof C?l.body:l?.body,o=typeof s?.code=="string"?s.code:null;return o==="too_large"?a("teamFiles.error.tooLarge",{mb:Math.round(r.uploadMax/1024**2)}):o==="full"?a("teamFiles.error.full",{gb:Math.round(r.cap/1024**3)}):a(o&&pe[o]||"teamFiles.error.failed")}async function he(l,r){const s=await fetch(`${p}/file?path=${encodeURIComponent(l)}&name=${encodeURIComponent(r.name)}`,{method:"PUT",body:r,headers:{"content-type":"application/octet-stream"}});if(!s.ok)throw new C(`${s.status}`,s.status,await s.json().catch(()=>({})))}function Se(){const{state:l,dispatch:r}=Q(),[s,o]=c.useState(""),[i,M]=c.useState(null),[_,T]=c.useState(!1),[$,P]=c.useState(null),[j,E]=c.useState(null),[z,F]=c.useState(!1),[x,f]=c.useState(null),[L,k]=c.useState(""),[d,u]=c.useState(null),R=c.useRef(null),D=c.useRef(null),N=c.useRef(null),J={uploadMax:i?.uploadMax??100*1024**2,cap:i?.cap??5*1024**3},h=c.useCallback(async e=>{N.current?.abort();const n=new AbortController;N.current=n;try{const m=await b(`${p}?path=${encodeURIComponent(e)}`,{signal:n.signal});if(n.signal.aborted)return;M(m),T(!1)}catch(m){if(n.signal.aborted)return;if(e&&m instanceof C&&m.status===404){o("");return}T(!0)}},[]);c.useEffect(()=>{h(s)},[s,h]),c.useEffect(()=>()=>N.current?.abort(),[]),c.useEffect(()=>{R.current?.focus({preventScroll:!0})},[]);const w=async e=>{P(null);try{await e()}catch(n){P(fe(n,J))}await h(s)},B=e=>w(async()=>{try{for(const n of e)E(n.name),await he(s,n)}finally{E(null)}}),X=()=>{const e=L.trim();if(!e||!x)return;const n=x;f(null),w(()=>n.kind==="folder"?b(`${p}/folder`,{method:"POST",body:JSON.stringify({path:O(s,e)})}):b(`${p}/rename`,{method:"POST",body:JSON.stringify({from:n.entry.path,to:O(s,e)})}))},G=e=>{window.confirm(a("teamFiles.deleteConfirm",{name:e.name}))&&w(()=>b(`${p}/delete`,{method:"POST",body:JSON.stringify({path:e.path})}))},K=async e=>{if(e.kind==="folder"){u(null),o(e.path);return}if(v(e.name)!=="text"){u({entry:e});return}if(e.size>de){u({entry:e,tooLarge:!0});return}try{const m=await fetch(g(e.path));u({entry:e,text:m.ok?await m.text():""})}catch{u({entry:e,text:""})}},W=e=>{e.preventDefault(),F(!1);const n=[...e.dataTransfer?.files??[]];n.length&&B(n)},y=s?s.split("/"):[],U=l.config?.team?.name??"";return t.jsxs(ie,{label:a("teamFiles.title"),children:[t.jsxs(oe,{backLabel:a("automations.back"),onBack:()=>r({type:"showChat"}),backRef:R,children:[t.jsx("h1",{className:re,children:a("teamFiles.title")}),t.jsxs(ce,{children:[t.jsxs("button",{type:"button",className:"ui-button",onClick:()=>{k(""),f({kind:"folder"})},children:[t.jsx(Z,{size:15}),a("teamFiles.newFolder")]}),t.jsxs("button",{type:"button",className:"ui-button ui-button-primary",disabled:j!==null,onClick:()=>D.current?.click(),children:[t.jsx(ee,{size:15}),a("teamFiles.upload")]}),t.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,"data-testid":"team-files-picker",onChange:e=>{const n=[...e.target.files??[]];e.target.value="",n.length&&B(n)}})]})]}),t.jsx("div",{className:Y("relative min-h-0 flex-1 overflow-y-auto",z&&"bg-accent/5"),"data-team-files":i?i.entries.length:"loading",onDragOver:e=>{e.preventDefault(),F(!0)},onDragLeave:()=>F(!1),onDrop:W,children:t.jsxs("div",{className:"mx-auto w-full max-w-4xl p-4 sm:p-6",children:[U&&t.jsx("p",{className:"mb-3 text-[13px] text-ink-secondary",children:a("teamFiles.intro",{team:U})}),t.jsxs("nav",{"aria-label":a("teamFiles.title"),className:"mb-3 flex flex-wrap items-center gap-1 text-[14px]",children:[t.jsx("button",{type:"button",className:"rounded px-1 text-ink-secondary hover:text-ink",onClick:()=>{u(null),o("")},children:a("teamFiles.title")}),y.map((e,n)=>t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-ink-secondary",children:"/"}),t.jsx("button",{type:"button","aria-current":n===y.length-1?"page":void 0,className:"rounded px-1 text-ink hover:underline",onClick:()=>{u(null),o(y.slice(0,n+1).join("/"))},children:e})]},n))]}),i&&t.jsx("p",{"data-team-files-used":`${i.used}/${i.cap}`,className:"mb-3 text-[12px] text-ink-secondary",children:a("teamFiles.used",{used:S(i.used),cap:S(i.cap)})}),j&&t.jsx("p",{role:"status",className:"mb-2 text-[13px] text-ink-secondary",children:a("teamFiles.uploading",{name:j})}),$&&t.jsx("p",{role:"alert",className:"mb-2 text-[13px] text-danger",children:$}),x&&t.jsxs("form",{className:"mb-3 flex items-center gap-2",onSubmit:e=>{e.preventDefault(),X()},children:[t.jsx("input",{autoFocus:!0,"aria-label":a(x.kind==="folder"?"teamFiles.folderName":"teamFiles.newName"),className:"min-w-0 flex-1 rounded-lg bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:ring-1 focus:ring-accent",value:L,onChange:e=>k(e.target.value)}),t.jsx("button",{type:"submit",className:"ui-button ui-button-primary",children:a(x.kind==="folder"?"teamFiles.create":"teamFiles.save")}),t.jsx("button",{type:"button",className:"ui-button",onClick:()=>f(null),children:a("common.cancel")})]}),z&&t.jsx("p",{className:"mb-2 text-center text-[13px] text-accent-text",children:a("teamFiles.drop")}),_&&!i?t.jsxs("section",{role:"alert",className:"px-6 py-16 text-center",children:[t.jsx("p",{className:"text-[14px] text-ink-secondary",children:a("teamFiles.loadFailed")}),t.jsx("button",{type:"button",className:"ui-button mt-4",onClick:()=>{h(s)},children:a("common.tryAgain")})]}):i&&i.entries.length===0?t.jsxs("section",{"aria-label":a("teamFiles.empty.title"),className:"rounded-xl border border-dashed border-hairline px-6 py-12 text-center",children:[t.jsx(H,{state:"sleep",size:96,className:"mx-auto mb-2"}),t.jsx("h2",{className:"text-[16px] font-semibold text-ink",children:a("teamFiles.empty.title")}),t.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[13px] leading-relaxed text-ink-secondary",children:a("teamFiles.empty.body")})]}):i?t.jsx("ul",{"aria-label":a("teamFiles.title"),className:"divide-y divide-hairline/40 overflow-hidden rounded-xl border border-hairline/40 bg-card",children:i.entries.map(e=>{const n=xe(e),m=e.kind==="folder"?te:v(e.name)==="picture"?ae:se;return t.jsxs("li",{"data-team-file":e.path,className:"flex items-center gap-3 px-3 py-2.5",children:[t.jsx(m,{size:18,className:"shrink-0 text-ink-secondary","aria-hidden":!0}),t.jsxs("button",{type:"button",className:"min-w-0 flex-1 text-left","aria-label":a("teamFiles.open",{name:e.name}),onClick:()=>{K(e)},children:[t.jsx("span",{className:"block truncate text-[14px] text-ink",children:e.name}),t.jsx("span",{className:"block truncate text-[12px] text-ink-secondary",children:[e.kind==="file"?S(e.size):"",n].filter(Boolean).join(" · ")})]}),e.kind==="file"&&t.jsx("a",{className:"ui-icon-button",href:g(e.path,!0),download:e.name,"aria-label":a("teamFiles.download"),title:a("teamFiles.download"),children:t.jsx(A,{size:15})}),e.canDelete&&t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.rename"),title:a("teamFiles.rename"),onClick:()=>{k(e.name),f({kind:"rename",entry:e})},children:t.jsx(ne,{size:15})}),e.canDelete&&t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.delete"),title:a("teamFiles.delete"),onClick:()=>G(e),children:t.jsx(le,{size:15})})]},e.path)})}):null,d&&t.jsxs("section",{"aria-label":d.entry.name,className:"mt-4 rounded-xl border border-hairline/40 bg-card",children:[t.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-3 py-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[14px] font-medium text-ink",children:d.entry.name}),t.jsx("a",{className:"ui-icon-button",href:g(d.entry.path,!0),download:d.entry.name,"aria-label":a("teamFiles.download"),children:t.jsx(A,{size:15})}),t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.closePreview"),onClick:()=>u(null),children:t.jsx(V,{size:15})})]}),t.jsx("div",{className:"max-h-[60vh] overflow-auto p-3",children:v(d.entry.name)==="picture"?t.jsx("img",{src:g(d.entry.path),alt:d.entry.name,className:"mx-auto max-h-[56vh] max-w-full"}):d.tooLarge?t.jsx("p",{className:"text-[13px] text-ink-secondary",children:a("teamFiles.previewTooLarge")}):d.text!==void 0?t.jsx("pre",{"data-team-file-preview":"",className:"whitespace-pre-wrap break-words text-[13px] text-ink",children:d.text}):t.jsx("p",{className:"text-[13px] text-ink-secondary",children:a("teamFiles.noPreview")})})]})]})})]})}export{Se as TeamFilesPage,xe as changedLine,g as fileUrl,S as formatSize,v as previewKind,fe as refusalText};
1
+ import{r as c,j as t,t as a,S as H,X as V,a as Y}from"./styles-3g-ZPS7M.js";import{r as q}from"./memory-BNaMRI5v.js";import{u as Q,g as b,A as C,a4 as Z,a5 as ee,d as te,a6 as ae,a7 as se,a8 as A,a9 as ne,T as le}from"./App-h8WTNY4l.js";import{T as ie,a as oe,b as re,c as ce}from"./ToolPageShell-DKZUregg.js";import"./PlacesRail-Df-jNTHn.js";import"./placement-BKtVnQht.js";import"./monitor-DMPjQDZP.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";const p="/api/team-files",de=1024*1024,me=new Set(["txt","md","markdown","csv","tsv","json","log"]),ue=new Set(["png","jpg","jpeg","gif","webp"]),pe={exists:"teamFiles.error.exists",forbidden:"teamFiles.error.forbidden",not_found:"teamFiles.error.notFound",bad_path:"teamFiles.error.badName",link:"teamFiles.error.badName"},I=l=>l.includes(".")?l.split(".").at(-1).toLowerCase():"",v=l=>me.has(I(l))?"text":ue.has(I(l))?"picture":null,g=(l,r=!1)=>`${p}/file?path=${encodeURIComponent(l)}${r?"&download=1":""}`,O=(l,r)=>l?`${l}/${r}`:r;function S(l){const r=["B","KB","MB","GB"];let s=l,o=0;for(;s>=1024&&o<r.length-1;)s/=1024,o+=1;return`${o===0?s:s<10?Number(s.toFixed(1)):Math.round(s)} ${r[o]}`}function xe(l,r=Date.now()){const s=l.last;if(!s)return null;const o=s.person||a("teamFiles.someone"),i=q(s.at,r);return s.action==="uploaded"?a("teamFiles.uploaded",{person:o,when:i}):s.action==="folder"?a("teamFiles.made",{person:o,when:i}):s.bot?s.person?a("teamFiles.changedWith",{person:o,bot:s.bot,when:i}):a("teamFiles.changedBy",{person:s.bot,when:i}):a("teamFiles.changedBy",{person:o,when:i})}function fe(l,r){const s=l instanceof C?l.body:l?.body,o=typeof s?.code=="string"?s.code:null;return o==="too_large"?a("teamFiles.error.tooLarge",{mb:Math.round(r.uploadMax/1024**2)}):o==="full"?a("teamFiles.error.full",{gb:Math.round(r.cap/1024**3)}):a(o&&pe[o]||"teamFiles.error.failed")}async function he(l,r){const s=await fetch(`${p}/file?path=${encodeURIComponent(l)}&name=${encodeURIComponent(r.name)}`,{method:"PUT",body:r,headers:{"content-type":"application/octet-stream"}});if(!s.ok)throw new C(`${s.status}`,s.status,await s.json().catch(()=>({})))}function Se(){const{state:l,dispatch:r}=Q(),[s,o]=c.useState(""),[i,M]=c.useState(null),[_,T]=c.useState(!1),[$,P]=c.useState(null),[j,E]=c.useState(null),[z,F]=c.useState(!1),[x,f]=c.useState(null),[L,k]=c.useState(""),[d,u]=c.useState(null),R=c.useRef(null),D=c.useRef(null),N=c.useRef(null),J={uploadMax:i?.uploadMax??100*1024**2,cap:i?.cap??5*1024**3},h=c.useCallback(async e=>{N.current?.abort();const n=new AbortController;N.current=n;try{const m=await b(`${p}?path=${encodeURIComponent(e)}`,{signal:n.signal});if(n.signal.aborted)return;M(m),T(!1)}catch(m){if(n.signal.aborted)return;if(e&&m instanceof C&&m.status===404){o("");return}T(!0)}},[]);c.useEffect(()=>{h(s)},[s,h]),c.useEffect(()=>()=>N.current?.abort(),[]),c.useEffect(()=>{R.current?.focus({preventScroll:!0})},[]);const w=async e=>{P(null);try{await e()}catch(n){P(fe(n,J))}await h(s)},B=e=>w(async()=>{try{for(const n of e)E(n.name),await he(s,n)}finally{E(null)}}),X=()=>{const e=L.trim();if(!e||!x)return;const n=x;f(null),w(()=>n.kind==="folder"?b(`${p}/folder`,{method:"POST",body:JSON.stringify({path:O(s,e)})}):b(`${p}/rename`,{method:"POST",body:JSON.stringify({from:n.entry.path,to:O(s,e)})}))},G=e=>{window.confirm(a("teamFiles.deleteConfirm",{name:e.name}))&&w(()=>b(`${p}/delete`,{method:"POST",body:JSON.stringify({path:e.path})}))},K=async e=>{if(e.kind==="folder"){u(null),o(e.path);return}if(v(e.name)!=="text"){u({entry:e});return}if(e.size>de){u({entry:e,tooLarge:!0});return}try{const m=await fetch(g(e.path));u({entry:e,text:m.ok?await m.text():""})}catch{u({entry:e,text:""})}},W=e=>{e.preventDefault(),F(!1);const n=[...e.dataTransfer?.files??[]];n.length&&B(n)},y=s?s.split("/"):[],U=l.config?.team?.name??"";return t.jsxs(ie,{label:a("teamFiles.title"),children:[t.jsxs(oe,{backLabel:a("automations.back"),onBack:()=>r({type:"showChat"}),backRef:R,children:[t.jsx("h1",{className:re,children:a("teamFiles.title")}),t.jsxs(ce,{children:[t.jsxs("button",{type:"button",className:"ui-button",onClick:()=>{k(""),f({kind:"folder"})},children:[t.jsx(Z,{size:15}),a("teamFiles.newFolder")]}),t.jsxs("button",{type:"button",className:"ui-button ui-button-primary",disabled:j!==null,onClick:()=>D.current?.click(),children:[t.jsx(ee,{size:15}),a("teamFiles.upload")]}),t.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,"data-testid":"team-files-picker",onChange:e=>{const n=[...e.target.files??[]];e.target.value="",n.length&&B(n)}})]})]}),t.jsx("div",{className:Y("relative min-h-0 flex-1 overflow-y-auto",z&&"bg-accent/5"),"data-team-files":i?i.entries.length:"loading",onDragOver:e=>{e.preventDefault(),F(!0)},onDragLeave:()=>F(!1),onDrop:W,children:t.jsxs("div",{className:"mx-auto w-full max-w-4xl p-4 sm:p-6",children:[U&&t.jsx("p",{className:"mb-3 text-[13px] text-ink-secondary",children:a("teamFiles.intro",{team:U})}),t.jsxs("nav",{"aria-label":a("teamFiles.title"),className:"mb-3 flex flex-wrap items-center gap-1 text-[14px]",children:[t.jsx("button",{type:"button",className:"rounded px-1 text-ink-secondary hover:text-ink",onClick:()=>{u(null),o("")},children:a("teamFiles.title")}),y.map((e,n)=>t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-ink-secondary",children:"/"}),t.jsx("button",{type:"button","aria-current":n===y.length-1?"page":void 0,className:"rounded px-1 text-ink hover:underline",onClick:()=>{u(null),o(y.slice(0,n+1).join("/"))},children:e})]},n))]}),i&&t.jsx("p",{"data-team-files-used":`${i.used}/${i.cap}`,className:"mb-3 text-[12px] text-ink-secondary",children:a("teamFiles.used",{used:S(i.used),cap:S(i.cap)})}),j&&t.jsx("p",{role:"status",className:"mb-2 text-[13px] text-ink-secondary",children:a("teamFiles.uploading",{name:j})}),$&&t.jsx("p",{role:"alert",className:"mb-2 text-[13px] text-danger",children:$}),x&&t.jsxs("form",{className:"mb-3 flex items-center gap-2",onSubmit:e=>{e.preventDefault(),X()},children:[t.jsx("input",{autoFocus:!0,"aria-label":a(x.kind==="folder"?"teamFiles.folderName":"teamFiles.newName"),className:"min-w-0 flex-1 rounded-lg bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:ring-1 focus:ring-accent",value:L,onChange:e=>k(e.target.value)}),t.jsx("button",{type:"submit",className:"ui-button ui-button-primary",children:a(x.kind==="folder"?"teamFiles.create":"teamFiles.save")}),t.jsx("button",{type:"button",className:"ui-button",onClick:()=>f(null),children:a("common.cancel")})]}),z&&t.jsx("p",{className:"mb-2 text-center text-[13px] text-accent-text",children:a("teamFiles.drop")}),_&&!i?t.jsxs("section",{role:"alert",className:"px-6 py-16 text-center",children:[t.jsx("p",{className:"text-[14px] text-ink-secondary",children:a("teamFiles.loadFailed")}),t.jsx("button",{type:"button",className:"ui-button mt-4",onClick:()=>{h(s)},children:a("common.tryAgain")})]}):i&&i.entries.length===0?t.jsxs("section",{"aria-label":a("teamFiles.empty.title"),className:"rounded-xl border border-dashed border-hairline px-6 py-12 text-center",children:[t.jsx(H,{state:"sleep",size:96,className:"mx-auto mb-2"}),t.jsx("h2",{className:"text-[16px] font-semibold text-ink",children:a("teamFiles.empty.title")}),t.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[13px] leading-relaxed text-ink-secondary",children:a("teamFiles.empty.body")})]}):i?t.jsx("ul",{"aria-label":a("teamFiles.title"),className:"divide-y divide-hairline/40 overflow-hidden rounded-xl border border-hairline/40 bg-card",children:i.entries.map(e=>{const n=xe(e),m=e.kind==="folder"?te:v(e.name)==="picture"?ae:se;return t.jsxs("li",{"data-team-file":e.path,className:"flex items-center gap-3 px-3 py-2.5",children:[t.jsx(m,{size:18,className:"shrink-0 text-ink-secondary","aria-hidden":!0}),t.jsxs("button",{type:"button",className:"min-w-0 flex-1 text-left","aria-label":a("teamFiles.open",{name:e.name}),onClick:()=>{K(e)},children:[t.jsx("span",{className:"block truncate text-[14px] text-ink",children:e.name}),t.jsx("span",{className:"block truncate text-[12px] text-ink-secondary",children:[e.kind==="file"?S(e.size):"",n].filter(Boolean).join(" · ")})]}),e.kind==="file"&&t.jsx("a",{className:"ui-icon-button",href:g(e.path,!0),download:e.name,"aria-label":a("teamFiles.download"),title:a("teamFiles.download"),children:t.jsx(A,{size:15})}),e.canDelete&&t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.rename"),title:a("teamFiles.rename"),onClick:()=>{k(e.name),f({kind:"rename",entry:e})},children:t.jsx(ne,{size:15})}),e.canDelete&&t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.delete"),title:a("teamFiles.delete"),onClick:()=>G(e),children:t.jsx(le,{size:15})})]},e.path)})}):null,d&&t.jsxs("section",{"aria-label":d.entry.name,className:"mt-4 rounded-xl border border-hairline/40 bg-card",children:[t.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-3 py-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[14px] font-medium text-ink",children:d.entry.name}),t.jsx("a",{className:"ui-icon-button",href:g(d.entry.path,!0),download:d.entry.name,"aria-label":a("teamFiles.download"),children:t.jsx(A,{size:15})}),t.jsx("button",{type:"button",className:"ui-icon-button","aria-label":a("teamFiles.closePreview"),onClick:()=>u(null),children:t.jsx(V,{size:15})})]}),t.jsx("div",{className:"max-h-[60vh] overflow-auto p-3",children:v(d.entry.name)==="picture"?t.jsx("img",{src:g(d.entry.path),alt:d.entry.name,className:"mx-auto max-h-[56vh] max-w-full"}):d.tooLarge?t.jsx("p",{className:"text-[13px] text-ink-secondary",children:a("teamFiles.previewTooLarge")}):d.text!==void 0?t.jsx("pre",{"data-team-file-preview":"",className:"whitespace-pre-wrap break-words text-[13px] text-ink",children:d.text}):t.jsx("p",{className:"text-[13px] text-ink-secondary",children:a("teamFiles.noPreview")})})]})]})})]})}export{Se as TeamFilesPage,xe as changedLine,g as fileUrl,S as formatSize,v as previewKind,fe as refusalText};
@@ -1 +1 @@
1
- import{t,r as n,j as e,a as U,w as H,o as le,X as oe,d as ce,S as de,ad as q}from"./styles-DOJOOIp4.js";import{a as me}from"./template-add-BcTS64TG.js";import{p as xe}from"./package-format-BFXbXHk8.js";import{p as pe,m as ge,o as W,a as ue,b as he,c as be,d as fe,e as ye}from"./org-library-alRyzCTE.js";import{u as J,b_ as je,b$ as ke,c0 as Ne,c1 as ve,c2 as we,c3 as Le,g as w,z as Se,c4 as Ce,c5 as Ee,Z as Be,bG as ze}from"./App-BIllYA_e.js";import{s as Ae,P as Pe,r as X,t as Oe,L,k as Te}from"./PlacesRail-3RaNlpug.js";import"./index-C1PEx1tc.js";import"./MenuMotion-DfjnHTCi.js";import"./monitor-DpsqT1_R.js";import"./placement-BKtVnQht.js";function De(a){if(typeof a=="string"||a&&typeof a=="object"&&a.format==="openmaus.package")return pe(xe(a));const o=ge(a);if(!o)throw new Error(t("templateImport.notATemplate"));return o}const Re={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function Z(a){const o=Re[a.name.trim().toLowerCase()];return o?{...a,name:t(`templates.catalog.${o}.name`),summary:t(`templates.catalog.${o}.summary`),outcome:a.outcome?t(`templates.catalog.${o}.outcome`):void 0}:a}function $e(a,o){const d=Z(a);return`${d.name} ${d.summary} ${a.name} ${a.summary} ${a.category} ${a.skills.join(" ")} ${a.requires.apps.join(" ")}`.toLowerCase().includes(o)}const Ie={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},F={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 Ge({search:a,onDialog:o,onAdded:d}){const[m,h]=n.useState(null),{state:x,dispatch:b}=J(),[p,f]=n.useState(null),y=i=>{if(!(i!==null&&Le(x))){if(i!==null&&window.ogb?.remoteClient?.active){b({type:"newBot",onCreated:d});return}f(i),o(i!==null)}},N=je.filter(i=>(!m||i.category===m)&&ke(i,a));return a.trim()&&N.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:t("readyBots.title")}),e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:t("readyBots.subtitle")})]}),e.jsx("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":t("readyBots.categories"),children:[null,...Ne].map(i=>e.jsx("button",{type:"button","aria-pressed":m===i,onClick:()=>h(i),className:U("rounded-full px-3 py-1 text-[13px] transition-colors",m===i?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:i?t(F[i]):t("readyBots.all")},i??"all"))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:N.map(i=>{const k=ve(i);return e.jsxs("article",{"data-ready-bot":i.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(Ae,{color:i.look.color,bodyId:i.look.mascotBody,accessories:i.look.mascotAccessories,size:40,animated:!1,label:i.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"truncate text-[14px] font-medium text-ink",children:i.name}),e.jsxs("p",{className:"truncate text-[12px] text-ink-secondary",children:[k.title," · ",t(F[i.category])]})]}),e.jsxs("button",{type:"button",onClick:()=>y(i.id),"aria-label":t("readyBots.addAria",{name:i.name,title:k.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(Pe,{size:14,"aria-hidden":"true"}),t("readyBots.add")]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:k.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:t("readyBots.try",{prompt:k.tryAsking})}),(i.apps.length>0||i.routines?.length)&&e.jsx("p",{className:"mt-auto pt-2 text-[12px] text-ink-tertiary",children:[i.apps.length>0&&t("readyBots.worksWith",{apps:i.apps.map(c=>Ie[c]??c).join(", ")}),i.routines?.length&&t("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},i.id)})}),p&&X.createPortal(e.jsx(we,{readyBotId:p,onClose:()=>y(null),onCreated:i=>{o(!1),d(i)}}),document.body)]})}const K=["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 _e({listing:a,busy:o,notice:d,error:m,onAdd:h,onDetails:x}){const b=a.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:t("orgLibrary.intro",{name:b})}),a.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:t("orgLibrary.empty",{name:b})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.packages.map((p,f)=>e.jsx(Me,{entry:p,index:f,busy:o,onAdd:h,onDetails:x},p.packageId))}),d&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:d}),m&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:m})]})}function Me({entry:a,index:o,busy:d,onAdd:m,onDetails:h}){const x=W(a),b=ue(a),p=he(a),f=d===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:U("flex size-11 shrink-0 items-center justify-center rounded-xl",K[o%K.length]),children:e.jsx(Oe,{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:be(a)}),b&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:b}),a.release&&e.jsx("span",{children:a.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:fe(a.contents)}),p.map(y=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:y},y))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[x==="add"&&e.jsxs("button",{onClick:()=>m(a),disabled:d!==null,"aria-label":t("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:[f&&e.jsx(L,{size:13,className:"animate-spin"}),f?t("orgLibrary.adding"):t("orgLibrary.add")]}),x==="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(H,{size:13,className:"text-success"}),t("orgLibrary.added")]}),x==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:t("orgLibrary.updateApp")}),x==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("orgLibrary.notReady")}),x==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("orgLibrary.noRelease")}),a.blob==="ready"&&e.jsx("button",{onClick:()=>h(a),disabled:d!==null,"aria-label":t("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:t("orgLibrary.details")})]})]})}function Ye(){return e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-ink/[0.06] text-ink-secondary",children:e.jsx(ze,{size:20})})}function Ve({onClose:a,onImported:o,returnFocusRef:d}){const{dispatch:m}=J(),h=n.useRef(null),[x,b]=n.useState(null),[p,f]=n.useState(!0),[y,N]=n.useState(""),[i,k]=n.useState(null),[c,v]=n.useState(null),[g,S]=n.useState(!1),[C,Q]=n.useState(""),[E,j]=n.useState(""),[T,V]=n.useState(!1),[B,D]=n.useState(null),[ee,z]=n.useState(null),[te,R]=n.useState(""),[ae,A]=n.useState(""),O=n.useCallback(async()=>{f(!0),N("");try{b(await w("/api/team-library/catalog"))}catch(s){N(s instanceof Error?s.message:String(s))}finally{f(!1)}},[]);n.useEffect(()=>{O()},[O]);const P=n.useCallback(async()=>{try{D(await w("/api/org-library"))}catch{D({organization:null,packages:[]})}},[]);n.useEffect(()=>{P()},[P]),n.useEffect(()=>(h.current?.focus(),()=>d.current?.focus()),[d]),n.useEffect(()=>{const s=r=>{if(T)return;if(r.key==="Escape"&&!g){r.preventDefault(),r.stopPropagation(),c?v(null):a();return}if(r.key!=="Tab")return;const l=h.current,u=Array.from(l?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]).filter(ne=>!ne.closest("[hidden]"));if(!l||u.length===0)return;const M=u[0],Y=u.at(-1);r.shiftKey&&(document.activeElement===M||!l.contains(document.activeElement))?(r.preventDefault(),Y.focus()):!r.shiftKey&&document.activeElement===Y&&(r.preventDefault(),M.focus())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[g,a,c,T]);const se=async s=>{k(s.slug),j("");try{const r=await w(`/api/team-library/teams/${s.slug}`);v({details:De(r),manifest:r})}catch(r){j(r instanceof Error?r.message:String(r))}finally{k(null)}},re=async(s,r)=>{S(!0),j("");try{const l=await me(s,m);q("team_imported",{members:l.bots.length,source:"library",mode:"add",format:"package"}),o({name:r,members:l.bots.length,...l.connections?.length?{connections:l.connections.length}:{},...l.presets?.length?{presets:l.presets.length}:{}})}catch(l){j(l instanceof Error?l.message:String(l))}finally{S(!1)}},ie=async s=>{z(s.packageId),A("");try{const r=await w(`/api/org-library/packages/${s.packageId}`);v({details:ye(r.document),org:s}),j("")}catch(r){A(r instanceof Error?r.message:String(r))}finally{z(null)}},$=async s=>{z(s.packageId),S(!0),A(""),R(""),j("");try{const r=await w("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:s.packageId})});for(const u of r.bots??[])m({type:"botAdded",bot:u});for(const u of r.groups??[])m({type:"groupPatched",group:u});for(const u of r.routines??[])m({type:"routinePatched",routine:u});const l=r.bots?.find(u=>!u.hidden);if(q("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),l){m({type:"select",id:l.id}),o({name:s.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}v(null),r.alreadyAdded||R(t("orgLibrary.addedSkills",{name:s.name})),await P()}catch(r){const l=r instanceof Error?r.message:String(r);c?.org?j(l):A(l),await P()}finally{z(null),S(!1)}},I=C.trim().toLowerCase(),G=(x?.teams??[]).filter(s=>!I||$e(s,I)),_="flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-accent-ink hover:bg-accent/90 disabled:opacity-60";return X.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!g&&a(),children:e.jsxs("div",{ref:h,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:()=>{v(null),j("")},disabled:g,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":t("templates.back"),children:e.jsx(Se,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"truncate text-[20px] font-semibold tracking-[-0.01em] text-ink",children:c?c.details.name:t("templates.title")})]}),!c&&e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:t("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!c&&e.jsxs("button",{onClick:()=>{le(x?.repositoryUrl||Ee).catch(()=>{})},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:t("templates.openRepository"),children:[e.jsx(Ce,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:t("templates.communityRepo")}),e.jsx(Te,{size:12})]}),e.jsx("button",{onClick:a,disabled:g,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":t("templates.close"),children:e.jsx(oe,{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-4 sm:px-8",children:[e.jsx("div",{className:"max-w-2xl",children:e.jsx(Be,{details:c.details})}),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.jsx("footer",{className:"flex items-center justify-end gap-3 border-t border-hairline/35 px-6 py-4 sm:px-8",children:c.org?W(c.org)==="add"?e.jsxs("button",{onClick:()=>{$(c.org)},disabled:g,"aria-label":t("orgLibrary.addAria",{name:c.org.name}),className:_,children:[g&&e.jsx(L,{size:15,className:"animate-spin"}),g?t("orgLibrary.adding"):t("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(H,{size:14,className:"text-success"}),t("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{re(c.manifest,c.details.name)},disabled:g,className:_,children:[g&&e.jsx(L,{size:15,className:"animate-spin"}),g?t("templates.importing"):t("templates.addTeam")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-6 pb-2 pt-3 sm:px-8",children:e.jsxs("label",{className:"flex h-9 w-full items-center gap-2.5 rounded-lg bg-inset px-3 sm:w-[320px]",children:[e.jsx(ce,{size:16,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:C,onChange:s=>Q(s.target.value),placeholder:t("templates.search"),"aria-label":t("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"})]})}),e.jsxs("div",{"data-template-gallery":!0,className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-4 sm:px-8",children:[B?.organization&&e.jsxs("section",{className:"mb-8","aria-label":t("orgLibrary.tab",{name:B.organization.name}),children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-tertiary",children:t("orgLibrary.tab",{name:B.organization.name})}),e.jsx(_e,{listing:B,busy:ee,notice:te,error:ae,onAdd:s=>{$(s)},onDetails:s=>{ie(s)}})]}),e.jsx(Ge,{search:C,onDialog:V,onAdded:a}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-tertiary",children:C?t("templates.searchResults"):t("templates.communityTemplates")}),E&&e.jsx("div",{role:"alert",className:"mb-3 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E}),p&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(L,{size:16,className:"animate-spin"})," ",t("templates.loading")]}),!p&&y&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:y}),e.jsx("button",{onClick:()=>{O()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:t("common.tryAgain")})]}),!p&&x&&e.jsx("div",{className:"grid grid-cols-1 gap-x-10 md:grid-cols-2",children:G.map(s=>{const r=Z(s);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(Ye,{}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[13px] font-medium text-ink",children:r.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:r.outcome??r.summary}),e.jsxs("p",{className:"mt-1 truncate text-[12px] text-ink-tertiary",children:[t("templates.botCount",{count:s.members})," · ",t("templates.playbookCount",{count:s.skills.length}),s.requires.apps.length>0&&` · ${s.requires.apps.join(", ")}`,s.setupMinutes&&` · ${t("templates.minutes",{count:s.setupMinutes})}`]})]}),e.jsxs("button",{onClick:()=>{se(s)},disabled:i!==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:[i===s.slug&&e.jsx(L,{size:13,className:"animate-spin"}),i===s.slug?t("templates.loadingShort"):t("templates.load")]})]},s.slug)})}),!p&&x&&G.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx(de,{state:"idle",size:64,className:"mb-2"}),e.jsx("div",{className:"text-[13px] font-medium text-ink",children:t("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:t("templates.tryDifferentSearch")})]})]})]})]})}),document.body)}export{Ve as TeamLibraryPanel};
1
+ import{t,r as n,j as e,a as U,w as H,o as le,X as oe,d as ce,S as de,ad as q}from"./styles-3g-ZPS7M.js";import{a as me}from"./template-add-CHwGLPet.js";import{p as xe}from"./package-format-COujx3jP.js";import{p as pe,m as ge,o as W,a as ue,b as he,c as be,d as fe,e as ye}from"./org-library-IKFXm7D6.js";import{u as J,b_ as je,b$ as ke,c0 as Ne,c1 as ve,c2 as we,c3 as Le,g as w,z as Se,c4 as Ce,c5 as Ee,Z as Be,bG as ze}from"./App-h8WTNY4l.js";import{s as Ae,P as Pe,r as X,t as Oe,L,k as Te}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";function De(a){if(typeof a=="string"||a&&typeof a=="object"&&a.format==="openmaus.package")return pe(xe(a));const o=ge(a);if(!o)throw new Error(t("templateImport.notATemplate"));return o}const Re={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function Z(a){const o=Re[a.name.trim().toLowerCase()];return o?{...a,name:t(`templates.catalog.${o}.name`),summary:t(`templates.catalog.${o}.summary`),outcome:a.outcome?t(`templates.catalog.${o}.outcome`):void 0}:a}function $e(a,o){const d=Z(a);return`${d.name} ${d.summary} ${a.name} ${a.summary} ${a.category} ${a.skills.join(" ")} ${a.requires.apps.join(" ")}`.toLowerCase().includes(o)}const Ie={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},F={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 Ge({search:a,onDialog:o,onAdded:d}){const[m,h]=n.useState(null),{state:x,dispatch:b}=J(),[p,f]=n.useState(null),y=i=>{if(!(i!==null&&Le(x))){if(i!==null&&window.ogb?.remoteClient?.active){b({type:"newBot",onCreated:d});return}f(i),o(i!==null)}},N=je.filter(i=>(!m||i.category===m)&&ke(i,a));return a.trim()&&N.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:t("readyBots.title")}),e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:t("readyBots.subtitle")})]}),e.jsx("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":t("readyBots.categories"),children:[null,...Ne].map(i=>e.jsx("button",{type:"button","aria-pressed":m===i,onClick:()=>h(i),className:U("rounded-full px-3 py-1 text-[13px] transition-colors",m===i?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:i?t(F[i]):t("readyBots.all")},i??"all"))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:N.map(i=>{const k=ve(i);return e.jsxs("article",{"data-ready-bot":i.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(Ae,{color:i.look.color,bodyId:i.look.mascotBody,accessories:i.look.mascotAccessories,size:40,animated:!1,label:i.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"truncate text-[14px] font-medium text-ink",children:i.name}),e.jsxs("p",{className:"truncate text-[12px] text-ink-secondary",children:[k.title," · ",t(F[i.category])]})]}),e.jsxs("button",{type:"button",onClick:()=>y(i.id),"aria-label":t("readyBots.addAria",{name:i.name,title:k.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(Pe,{size:14,"aria-hidden":"true"}),t("readyBots.add")]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:k.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:t("readyBots.try",{prompt:k.tryAsking})}),(i.apps.length>0||i.routines?.length)&&e.jsx("p",{className:"mt-auto pt-2 text-[12px] text-ink-tertiary",children:[i.apps.length>0&&t("readyBots.worksWith",{apps:i.apps.map(c=>Ie[c]??c).join(", ")}),i.routines?.length&&t("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},i.id)})}),p&&X.createPortal(e.jsx(we,{readyBotId:p,onClose:()=>y(null),onCreated:i=>{o(!1),d(i)}}),document.body)]})}const K=["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 _e({listing:a,busy:o,notice:d,error:m,onAdd:h,onDetails:x}){const b=a.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:t("orgLibrary.intro",{name:b})}),a.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:t("orgLibrary.empty",{name:b})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.packages.map((p,f)=>e.jsx(Me,{entry:p,index:f,busy:o,onAdd:h,onDetails:x},p.packageId))}),d&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:d}),m&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:m})]})}function Me({entry:a,index:o,busy:d,onAdd:m,onDetails:h}){const x=W(a),b=ue(a),p=he(a),f=d===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:U("flex size-11 shrink-0 items-center justify-center rounded-xl",K[o%K.length]),children:e.jsx(Oe,{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:be(a)}),b&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:b}),a.release&&e.jsx("span",{children:a.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:fe(a.contents)}),p.map(y=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:y},y))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[x==="add"&&e.jsxs("button",{onClick:()=>m(a),disabled:d!==null,"aria-label":t("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:[f&&e.jsx(L,{size:13,className:"animate-spin"}),f?t("orgLibrary.adding"):t("orgLibrary.add")]}),x==="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(H,{size:13,className:"text-success"}),t("orgLibrary.added")]}),x==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:t("orgLibrary.updateApp")}),x==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("orgLibrary.notReady")}),x==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("orgLibrary.noRelease")}),a.blob==="ready"&&e.jsx("button",{onClick:()=>h(a),disabled:d!==null,"aria-label":t("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:t("orgLibrary.details")})]})]})}function Ye(){return e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-ink/[0.06] text-ink-secondary",children:e.jsx(ze,{size:20})})}function Ve({onClose:a,onImported:o,returnFocusRef:d}){const{dispatch:m}=J(),h=n.useRef(null),[x,b]=n.useState(null),[p,f]=n.useState(!0),[y,N]=n.useState(""),[i,k]=n.useState(null),[c,v]=n.useState(null),[g,S]=n.useState(!1),[C,Q]=n.useState(""),[E,j]=n.useState(""),[T,V]=n.useState(!1),[B,D]=n.useState(null),[ee,z]=n.useState(null),[te,R]=n.useState(""),[ae,A]=n.useState(""),O=n.useCallback(async()=>{f(!0),N("");try{b(await w("/api/team-library/catalog"))}catch(s){N(s instanceof Error?s.message:String(s))}finally{f(!1)}},[]);n.useEffect(()=>{O()},[O]);const P=n.useCallback(async()=>{try{D(await w("/api/org-library"))}catch{D({organization:null,packages:[]})}},[]);n.useEffect(()=>{P()},[P]),n.useEffect(()=>(h.current?.focus(),()=>d.current?.focus()),[d]),n.useEffect(()=>{const s=r=>{if(T)return;if(r.key==="Escape"&&!g){r.preventDefault(),r.stopPropagation(),c?v(null):a();return}if(r.key!=="Tab")return;const l=h.current,u=Array.from(l?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]).filter(ne=>!ne.closest("[hidden]"));if(!l||u.length===0)return;const M=u[0],Y=u.at(-1);r.shiftKey&&(document.activeElement===M||!l.contains(document.activeElement))?(r.preventDefault(),Y.focus()):!r.shiftKey&&document.activeElement===Y&&(r.preventDefault(),M.focus())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[g,a,c,T]);const se=async s=>{k(s.slug),j("");try{const r=await w(`/api/team-library/teams/${s.slug}`);v({details:De(r),manifest:r})}catch(r){j(r instanceof Error?r.message:String(r))}finally{k(null)}},re=async(s,r)=>{S(!0),j("");try{const l=await me(s,m);q("team_imported",{members:l.bots.length,source:"library",mode:"add",format:"package"}),o({name:r,members:l.bots.length,...l.connections?.length?{connections:l.connections.length}:{},...l.presets?.length?{presets:l.presets.length}:{}})}catch(l){j(l instanceof Error?l.message:String(l))}finally{S(!1)}},ie=async s=>{z(s.packageId),A("");try{const r=await w(`/api/org-library/packages/${s.packageId}`);v({details:ye(r.document),org:s}),j("")}catch(r){A(r instanceof Error?r.message:String(r))}finally{z(null)}},$=async s=>{z(s.packageId),S(!0),A(""),R(""),j("");try{const r=await w("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:s.packageId})});for(const u of r.bots??[])m({type:"botAdded",bot:u});for(const u of r.groups??[])m({type:"groupPatched",group:u});for(const u of r.routines??[])m({type:"routinePatched",routine:u});const l=r.bots?.find(u=>!u.hidden);if(q("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),l){m({type:"select",id:l.id}),o({name:s.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}v(null),r.alreadyAdded||R(t("orgLibrary.addedSkills",{name:s.name})),await P()}catch(r){const l=r instanceof Error?r.message:String(r);c?.org?j(l):A(l),await P()}finally{z(null),S(!1)}},I=C.trim().toLowerCase(),G=(x?.teams??[]).filter(s=>!I||$e(s,I)),_="flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-accent-ink hover:bg-accent/90 disabled:opacity-60";return X.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!g&&a(),children:e.jsxs("div",{ref:h,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:()=>{v(null),j("")},disabled:g,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":t("templates.back"),children:e.jsx(Se,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"truncate text-[20px] font-semibold tracking-[-0.01em] text-ink",children:c?c.details.name:t("templates.title")})]}),!c&&e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:t("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!c&&e.jsxs("button",{onClick:()=>{le(x?.repositoryUrl||Ee).catch(()=>{})},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:t("templates.openRepository"),children:[e.jsx(Ce,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:t("templates.communityRepo")}),e.jsx(Te,{size:12})]}),e.jsx("button",{onClick:a,disabled:g,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":t("templates.close"),children:e.jsx(oe,{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-4 sm:px-8",children:[e.jsx("div",{className:"max-w-2xl",children:e.jsx(Be,{details:c.details})}),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.jsx("footer",{className:"flex items-center justify-end gap-3 border-t border-hairline/35 px-6 py-4 sm:px-8",children:c.org?W(c.org)==="add"?e.jsxs("button",{onClick:()=>{$(c.org)},disabled:g,"aria-label":t("orgLibrary.addAria",{name:c.org.name}),className:_,children:[g&&e.jsx(L,{size:15,className:"animate-spin"}),g?t("orgLibrary.adding"):t("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(H,{size:14,className:"text-success"}),t("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{re(c.manifest,c.details.name)},disabled:g,className:_,children:[g&&e.jsx(L,{size:15,className:"animate-spin"}),g?t("templates.importing"):t("templates.addTeam")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-6 pb-2 pt-3 sm:px-8",children:e.jsxs("label",{className:"flex h-9 w-full items-center gap-2.5 rounded-lg bg-inset px-3 sm:w-[320px]",children:[e.jsx(ce,{size:16,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:C,onChange:s=>Q(s.target.value),placeholder:t("templates.search"),"aria-label":t("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"})]})}),e.jsxs("div",{"data-template-gallery":!0,className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-4 sm:px-8",children:[B?.organization&&e.jsxs("section",{className:"mb-8","aria-label":t("orgLibrary.tab",{name:B.organization.name}),children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-tertiary",children:t("orgLibrary.tab",{name:B.organization.name})}),e.jsx(_e,{listing:B,busy:ee,notice:te,error:ae,onAdd:s=>{$(s)},onDetails:s=>{ie(s)}})]}),e.jsx(Ge,{search:C,onDialog:V,onAdded:a}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-tertiary",children:C?t("templates.searchResults"):t("templates.communityTemplates")}),E&&e.jsx("div",{role:"alert",className:"mb-3 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:E}),p&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(L,{size:16,className:"animate-spin"})," ",t("templates.loading")]}),!p&&y&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:y}),e.jsx("button",{onClick:()=>{O()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:t("common.tryAgain")})]}),!p&&x&&e.jsx("div",{className:"grid grid-cols-1 gap-x-10 md:grid-cols-2",children:G.map(s=>{const r=Z(s);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(Ye,{}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[13px] font-medium text-ink",children:r.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:r.outcome??r.summary}),e.jsxs("p",{className:"mt-1 truncate text-[12px] text-ink-tertiary",children:[t("templates.botCount",{count:s.members})," · ",t("templates.playbookCount",{count:s.skills.length}),s.requires.apps.length>0&&` · ${s.requires.apps.join(", ")}`,s.setupMinutes&&` · ${t("templates.minutes",{count:s.setupMinutes})}`]})]}),e.jsxs("button",{onClick:()=>{se(s)},disabled:i!==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:[i===s.slug&&e.jsx(L,{size:13,className:"animate-spin"}),i===s.slug?t("templates.loadingShort"):t("templates.load")]})]},s.slug)})}),!p&&x&&G.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx(de,{state:"idle",size:64,className:"mb-2"}),e.jsx("div",{className:"text-[13px] font-medium text-ink",children:t("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:t("templates.tryDifferentSearch")})]})]})]})]})}),document.body)}export{Ve as TeamLibraryPanel};