limixbot 0.2.4 → 0.2.5

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 (124) hide show
  1. package/dist/app-icon-192.png +0 -0
  2. package/dist/app-icon-512.png +0 -0
  3. package/dist/app-icon.svg +1 -4
  4. package/dist/apple-touch-icon.png +0 -0
  5. package/dist/assets/{ActivityPanel-Yt1JPJtx.js → ActivityPanel-DC3XVGOc.js} +1 -1
  6. package/dist/assets/{App-CVCxQPpR.js → App-Dc7eNHIo.js} +9 -9
  7. package/dist/assets/{AppEventEditor-C0O8Bn2f.js → AppEventEditor-MqHYrUPZ.js} +1 -1
  8. package/dist/assets/{BotSettingsDialog-tUYy15lC.js → BotSettingsDialog-BrmKiJZJ.js} +1 -1
  9. package/dist/assets/{BrowserPanel-C5enR5R1.js → BrowserPanel-CGq-8k9k.js} +1 -1
  10. package/dist/assets/{BrowserProfilesManager-CSo4X7HO.js → BrowserProfilesManager-N5zHMoeH.js} +1 -1
  11. package/dist/assets/{CloudAddDialog-DsTSypGV.js → CloudAddDialog-DIm-M9CF.js} +1 -1
  12. package/dist/assets/{ComputerFilesPane-DyhJMTEu.js → ComputerFilesPane-CP_exuaN.js} +1 -1
  13. package/dist/assets/{ComputerPanel-DQydmwiD.js → ComputerPanel-SaUcSoW6.js} +2 -2
  14. package/dist/assets/{DataPanel-DrjKXaiE.js → DataPanel-CBVx04Rh.js} +1 -1
  15. package/dist/assets/{DesktopViewer-CYiF8QbG.js → DesktopViewer-Cya-HlUY.js} +1 -1
  16. package/dist/assets/{FilesView-DHmDJZVD.js → FilesView-BS2JAg48.js} +1 -1
  17. package/dist/assets/{GrokMoveDialog-BU8ItDTb.js → GrokMoveDialog-kG0ReJlG.js} +1 -1
  18. package/dist/assets/{InspectorPanel-DgSqJslV.js → InspectorPanel-BT3llt3b.js} +1 -1
  19. package/dist/assets/{KeyboardShortcutsModal-D7Y75zbh.js → KeyboardShortcutsModal-L8FD783r.js} +1 -1
  20. package/dist/assets/{LiveDesktop-DIFFdwoj.js → LiveDesktop-n3XPWd5c.js} +1 -1
  21. package/dist/assets/{LocalVmWorkspace-cE5VrI75.js → LocalVmWorkspace-v7UlCW9t.js} +1 -1
  22. package/dist/assets/{MacLocalControl-CR1xsN8C.js → MacLocalControl-v51B79TD.js} +1 -1
  23. package/dist/assets/{MarkdownFilePreview-C9-_VWg5.js → MarkdownFilePreview-B2U1b00V.js} +1 -1
  24. package/dist/assets/{MenuMotion-Dh3Gi4kY.js → MenuMotion-BjmjRIR3.js} +1 -1
  25. package/dist/assets/{NewBotDialog-0aO27qTW.js → NewBotDialog-FgTNwkT5.js} +1 -1
  26. package/dist/assets/{PhoneAppDialog-CJeGAXQD.js → PhoneAppDialog-BAqdCsuh.js} +1 -1
  27. package/dist/assets/PlacesRail-msEDHUXY.js +57 -0
  28. package/dist/assets/{PluginsPanel-CxXhbzxv.js → PluginsPanel-BROkmoVw.js} +1 -1
  29. package/dist/assets/{ProIntroduction-CQDF5fEs.js → ProIntroduction-D8SaBehJ.js} +1 -1
  30. package/dist/assets/{RemoteAgentSettingsPanel-Bmhtewtp.js → RemoteAgentSettingsPanel-BdJpTB-X.js} +1 -1
  31. package/dist/assets/{RoomPanel-8hijlQPG.js → RoomPanel-BltzAc2X.js} +1 -1
  32. package/dist/assets/{RoutinesPage-BmR16t7O.js → RoutinesPage-CRvNKmna.js} +1 -1
  33. package/dist/assets/{SettingsModal-BJCVgscC.js → SettingsModal-B5Fjq814.js} +1 -1
  34. package/dist/assets/{ShareTeamDialog-COcdYImw.js → ShareTeamDialog-BrYsQ1YB.js} +1 -1
  35. package/dist/assets/{SignedInSites--xtkgjnC.js → SignedInSites-BGsMS1IG.js} +1 -1
  36. package/dist/assets/{TeamLibraryPanel-DOVg7avu.js → TeamLibraryPanel-C3YIy7_M.js} +1 -1
  37. package/dist/assets/{TeamMapPage-r1iwHXYM.js → TeamMapPage-DjqBIDae.js} +1 -1
  38. package/dist/assets/{TriggersPage-DkPipM4n.js → TriggersPage-By978rcW.js} +1 -1
  39. package/dist/assets/{VisibilitySection-UlGM_8Ri.js → VisibilitySection-BMxXxacO.js} +1 -1
  40. package/dist/assets/{WebhookTrigger-sfrkU37A.js → WebhookTrigger-B0TCdhpi.js} +1 -1
  41. package/dist/assets/{WorksOnGrid-Cx__gmQD.js → WorksOnGrid-BYivdc01.js} +1 -1
  42. package/dist/assets/{abnfDiagram-YUKMZFIV-zKm62LaA.js → abnfDiagram-YUKMZFIV-C05fUibh.js} +1 -1
  43. package/dist/assets/{activity-CPkAJarW.js → activity-cUbbx7sx.js} +1 -1
  44. package/dist/assets/{architectureDiagram-47P4ROYG-BtuTxvNC.js → architectureDiagram-47P4ROYG-NfpIFKPz.js} +1 -1
  45. package/dist/assets/{blockDiagram-E7TT5TSB-BRCjM53y.js → blockDiagram-E7TT5TSB-8M_Yd-sD.js} +1 -1
  46. package/dist/assets/{c4Diagram-CRA5TL53-C9p73qnX.js → c4Diagram-CRA5TL53-V7Ru-p8C.js} +1 -1
  47. package/dist/assets/{calendar-days-DdkRWrHv.js → calendar-days-Cj-W81bu.js} +1 -1
  48. package/dist/assets/channel-g_Dn_OGJ.js +1 -0
  49. package/dist/assets/{chunk-2Q5K7J3B-BVttC6OI.js → chunk-2Q5K7J3B-BYHHX_Gv.js} +1 -1
  50. package/dist/assets/{chunk-5VM5RSS4-BNqqqnGl.js → chunk-5VM5RSS4-C3e0S7UU.js} +1 -1
  51. package/dist/assets/{chunk-7TKQ45FW-CLkkCMma.js → chunk-7TKQ45FW-Do-zCrfY.js} +1 -1
  52. package/dist/assets/{chunk-AW2ZBBNX-ByE3NFnK.js → chunk-AW2ZBBNX-BqIHZ9wm.js} +1 -1
  53. package/dist/assets/{chunk-FVRAUYC3-D1NFW9zf.js → chunk-FVRAUYC3-DR-XXMxd.js} +2 -2
  54. package/dist/assets/{chunk-HTAEGDNF-y9-VGZh8.js → chunk-HTAEGDNF-Bfo8GCM2.js} +1 -1
  55. package/dist/assets/{chunk-JWPE2WC7-BOYZL91l.js → chunk-JWPE2WC7-CihnqCYu.js} +1 -1
  56. package/dist/assets/{chunk-KQW6MTUR-DRtZ-jux.js → chunk-KQW6MTUR-CaCMq-KE.js} +1 -1
  57. package/dist/assets/{chunk-XXDRQBXY-DCH3w3v6.js → chunk-XXDRQBXY-D9V51Esf.js} +1 -1
  58. package/dist/assets/{classDiagram-v2-K4WV4PDN-BziSQpNK.js → classDiagram-v2-K4WV4PDN-CAJUY4h-.js} +1 -1
  59. package/dist/assets/{coins-BvYP8U4w.js → coins-CxC_dI0J.js} +1 -1
  60. package/dist/assets/{core-DgU9fIH7.js → core-CcNJeiz-.js} +1 -1
  61. package/dist/assets/{cose-bilkent-JH36ORCC-BzC7KDhz.js → cose-bilkent-JH36ORCC-9vWz4wK0.js} +1 -1
  62. package/dist/assets/{cynefin-EF2NZ3EQ-DallfvKE.js → cynefin-EF2NZ3EQ-DCUYk2lC.js} +1 -1
  63. package/dist/assets/{cynefinDiagram-3GCD6N5R-BlzPquFR.js → cynefinDiagram-3GCD6N5R-DdjMYI6o.js} +1 -1
  64. package/dist/assets/{dagre-W4DXFKR2-XlgF2qP1.js → dagre-W4DXFKR2-DGIBnF7r.js} +1 -1
  65. package/dist/assets/{diagram-2UJZ2QOL-D6-7kEyN.js → diagram-2UJZ2QOL-B3r3D9sZ.js} +1 -1
  66. package/dist/assets/{diagram-OVF4WLC6-BuvgW3fs.js → diagram-OVF4WLC6-B1u7LfGA.js} +1 -1
  67. package/dist/assets/{diagram-PFPMY2P6-Cxw7BxsQ.js → diagram-PFPMY2P6-vVzEd5hO.js} +1 -1
  68. package/dist/assets/{diagram-UMYRVEAY-DbaTO7xG.js → diagram-UMYRVEAY-WinDNDJc.js} +1 -1
  69. package/dist/assets/{diagram-YEKJPTXX-ssS2jDd9.js → diagram-YEKJPTXX-7g_9oznG.js} +1 -1
  70. package/dist/assets/{diagram-ZIFT7M5P-MSG2hmJt.js → diagram-ZIFT7M5P-BqrG5z2v.js} +1 -1
  71. package/dist/assets/{ebnfDiagram-VR2GEFS7-D3iLv4Vh.js → ebnfDiagram-VR2GEFS7-BpNGIiLF.js} +1 -1
  72. package/dist/assets/{elk-IJKZMXRS-CN_29WGs.js → elk-IJKZMXRS-BCv8wGAA.js} +1 -1
  73. package/dist/assets/{erDiagram-O2IAPWRE-Bcl7Id7T.js → erDiagram-O2IAPWRE-Do-qhVwx.js} +1 -1
  74. package/dist/assets/{file-up-CCEcdqcW.js → file-up-Gm3ZlE_0.js} +1 -1
  75. package/dist/assets/{flowDiagram-OXPTDLAJ-n2WLJBHk.js → flowDiagram-OXPTDLAJ-R-Kh5wq9.js} +1 -1
  76. package/dist/assets/{ganttDiagram-R7TSEDQI-BXBxYc2Z.js → ganttDiagram-R7TSEDQI-B3l0oJP5.js} +1 -1
  77. package/dist/assets/{gitGraphDiagram-XJZIOB7I-B3rVvw07.js → gitGraphDiagram-XJZIOB7I-BYib7PqD.js} +1 -1
  78. package/dist/assets/{import-name-QCV3NxTT.js → import-name-1v6bgYwg.js} +1 -1
  79. package/dist/assets/{index-DeIGTf2I.js → index-BEBI8eA5.js} +2 -2
  80. package/dist/assets/{index-DxGSNARA.js → index-DjRLXqpq.js} +1 -1
  81. package/dist/assets/{index-DMDRA73w.js → index-tkGe0e3F.js} +1 -1
  82. package/dist/assets/{infoDiagram-5W2HQ5XZ-BxRrhDe0.js → infoDiagram-5W2HQ5XZ-DqcpfbG0.js} +1 -1
  83. package/dist/assets/{ishikawaDiagram-K3B6WC7H-ZOdsAPxi.js → ishikawaDiagram-K3B6WC7H-CVNaP0rR.js} +1 -1
  84. package/dist/assets/{journeyDiagram-COXZFDF6-axLKau4X.js → journeyDiagram-COXZFDF6-BXHOKVEA.js} +1 -1
  85. package/dist/assets/{kanban-definition-P3RFRI5V-DTVUrJqt.js → kanban-definition-P3RFRI5V-Bb8Vpv2-.js} +1 -1
  86. package/dist/assets/{mcp-servers-kshb3G8M.js → mcp-servers-BdjmXJSB.js} +1 -1
  87. package/dist/assets/{mermaid.core-D8G0v7ax.js → mermaid.core-CnUFOtXD.js} +4 -4
  88. package/dist/assets/{mindmap-definition-LZFPQGKD-eR6Dlm_o.js → mindmap-definition-LZFPQGKD-DeV-Tw7G.js} +1 -1
  89. package/dist/assets/{minimize-DsfIgSIh.js → minimize-lhY0HYEB.js} +1 -1
  90. package/dist/assets/{monitor-CJJehAYK.js → monitor-DagRnmYm.js} +1 -1
  91. package/dist/assets/{new-bot-BxtfLvSH.js → new-bot-R2d69ePy.js} +1 -1
  92. package/dist/assets/{org-library-j54w6Ia7.js → org-library-CTZWRg3z.js} +1 -1
  93. package/dist/assets/{package-format-CMWKE_F6.js → package-format-D4k7Rh0H.js} +1 -1
  94. package/dist/assets/{pegDiagram-BGZESJAR-BabDseNJ.js → pegDiagram-BGZESJAR-B9zfytOo.js} +1 -1
  95. package/dist/assets/{pieDiagram-CAPJLFHJ-BKvqDvl1.js → pieDiagram-CAPJLFHJ-Co2k1c9h.js} +1 -1
  96. package/dist/assets/{quadrantDiagram-GDMTTRAM-B04ZbGZP.js → quadrantDiagram-GDMTTRAM-D7jzEAY-.js} +1 -1
  97. package/dist/assets/{rail-COJ1VklA.js → rail-B_8Y8FUg.js} +1 -1
  98. package/dist/assets/{railroadDiagram-SM67HX2B-DcJknZtN.js → railroadDiagram-SM67HX2B-BvPh7fmA.js} +1 -1
  99. package/dist/assets/{remote-desktop-panel-CqR9sYPm.js → remote-desktop-panel-ipZYKPLT.js} +1 -1
  100. package/dist/assets/{requirementDiagram-X7JNWC4A-CkeImvIM.js → requirementDiagram-X7JNWC4A-yg9WIdG5.js} +1 -1
  101. package/dist/assets/{sankeyDiagram-UM26HJRW-DYxARQh9.js → sankeyDiagram-UM26HJRW-BKhYJMCX.js} +1 -1
  102. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-DWd9rdXx.js → sequenceDiagram-ZO4K6R2Y-B3hAFJ3r.js} +1 -1
  103. package/dist/assets/{sizeCapture-INFHLROL-CjzuzZLP.js → sizeCapture-INFHLROL-B5ubpsDi.js} +1 -1
  104. package/dist/assets/{stateDiagram-v2-TBUQTH76-CLmc94Ln.js → stateDiagram-v2-TBUQTH76-DDviCg3l.js} +1 -1
  105. package/dist/assets/{styles-NM37uvmJ.js → styles-BYp3glRK.js} +1 -1
  106. package/dist/assets/{swimlanes-N4OXWK64-Dmc-N6gk.js → swimlanes-N4OXWK64-YthTzBgy.js} +1 -1
  107. package/dist/assets/swimlanesDiagram-K3J5GTZL-CywojYgU.js +8 -0
  108. package/dist/assets/{team-share-CfzFiDJl.js → team-share-By8wCeng.js} +1 -1
  109. package/dist/assets/{timeline-definition-YOQAKGHF-B4YfX3Wn.js → timeline-definition-YOQAKGHF-CH_BuHOF.js} +1 -1
  110. package/dist/assets/{usecaseDiagram-VIAY4XPW-tkKvR-PW.js → usecaseDiagram-VIAY4XPW-zmJ_6-S0.js} +1 -1
  111. package/dist/assets/{vennDiagram-BLWOH2XV-CWEUMDKu.js → vennDiagram-BLWOH2XV-Cdq5FiyY.js} +1 -1
  112. package/dist/assets/{wardleyDiagram-YMQ3BMBF-DRcqmHpZ.js → wardleyDiagram-YMQ3BMBF-CUm4PvZj.js} +1 -1
  113. package/dist/assets/{xychartDiagram-TAQBALBS-B-YwOKwp.js → xychartDiagram-TAQBALBS-BFRcupRR.js} +1 -1
  114. package/dist/index.html +2 -2
  115. package/dist/rail.html +4 -4
  116. package/dist-server/package.json +1 -1
  117. package/dist-server/shared/mascot-bodies.js +4 -4
  118. package/package.json +1 -1
  119. package/dist/assets/PlacesRail-BI7EZKaw.js +0 -57
  120. package/dist/assets/channel-BEZp93ad.js +0 -1
  121. package/dist/assets/cursor-128-D_P4sIyM.webp +0 -0
  122. package/dist/assets/cursor-192-TWSdnzcT.webp +0 -0
  123. package/dist/assets/cursor-256-Mw4jC-Z3.webp +0 -0
  124. package/dist/assets/swimlanesDiagram-K3J5GTZL-DHOLnd-u.js +0 -8
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/new-bot-BxtfLvSH.js","assets/styles-NM37uvmJ.js","assets/styles-D8FmJr6X.css","assets/PlacesRail-BI7EZKaw.js","assets/monitor-CJJehAYK.js","assets/RoutinesPage-BmR16t7O.js","assets/remote-desktop-DDRRx8uY.js","assets/ProIntroduction-CQDF5fEs.js","assets/MenuMotion-Dh3Gi4kY.js","assets/WebhookTrigger-sfrkU37A.js","assets/index-DeIGTf2I.js","assets/AppEventEditor-C0O8Bn2f.js","assets/ActivityPanel-Yt1JPJtx.js","assets/activity-CPkAJarW.js","assets/BotSettingsDialog-tUYy15lC.js","assets/coins-BvYP8U4w.js","assets/VisibilitySection-UlGM_8Ri.js","assets/org-library-j54w6Ia7.js","assets/package-format-CMWKE_F6.js","assets/mcp-servers-kshb3G8M.js","assets/WorksOnGrid-Cx__gmQD.js","assets/ComputerFilesPane-DyhJMTEu.js","assets/SignedInSites--xtkgjnC.js","assets/ComputerPanel-DQydmwiD.js","assets/desktop-viewer-CF-OpSo0.js","assets/MacLocalControl-CR1xsN8C.js","assets/BrowserPanel-C5enR5R1.js","assets/BrowserProfilesManager-CSo4X7HO.js","assets/minimize-DsfIgSIh.js","assets/file-up-CCEcdqcW.js","assets/FilesView-DHmDJZVD.js","assets/InspectorPanel-DgSqJslV.js","assets/KeyboardShortcutsModal-D7Y75zbh.js","assets/LocalVmWorkspace-cE5VrI75.js","assets/NewBotDialog-0aO27qTW.js","assets/team-share-CfzFiDJl.js","assets/PluginsPanel-CxXhbzxv.js","assets/RemoteAgentSettingsPanel-Bmhtewtp.js","assets/RoomPanel-8hijlQPG.js","assets/remote-desktop-panel-CqR9sYPm.js","assets/calendar-days-DdkRWrHv.js","assets/TriggersPage-DkPipM4n.js","assets/SettingsModal-BJCVgscC.js","assets/index-DMDRA73w.js","assets/TeamMapPage-r1iwHXYM.js","assets/CloudAddDialog-DsTSypGV.js","assets/PhoneAppDialog-CJeGAXQD.js","assets/ShareTeamDialog-COcdYImw.js","assets/GrokMoveDialog-BU8ItDTb.js","assets/import-name-QCV3NxTT.js","assets/TeamLibraryPanel-DOVg7avu.js","assets/MarkdownFilePreview-C9-_VWg5.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/scss-D5BDwBP9.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-DddhVWhK.js","assets/c-BIGW1oBm.js","assets/ruby-Ct1eTYOr.js","assets/sql-CRqJ_cUM.js","assets/graphql-ChdNCCLP.js","assets/typescript-BPQ3VLAy.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/bash-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Csjmro_R.js","assets/json-Cp-IABpG.js","assets/core-DgU9fIH7.js","assets/mermaid.core-D8G0v7ax.js","assets/step-CkmJJ7wq.js","assets/index-DxGSNARA.js","assets/katex-HP8lGamR.js","assets/katex-BYZTj3zW.css","assets/embed-DIxSrDga.js","assets/linear-ChbPfC31.js","assets/init-Dmth1JHB.js","assets/defaultLocale-CzDG__Ur.js","assets/time-CZ0C3Dvk.js","assets/range-OtVwhkKS.js","assets/ordinal-BeghXfj9.js","assets/colors-Cc3OSVma.js","assets/arc-UbyzOkqk.js","assets/index-DVBvMn51.js"])))=>i.map(i=>d[i]);
2
- import{c as le,r as f,av as Al,t as l,p as Ot,bp as Tr,K as ot,S as Cn,d as Ru,J as Qe,j as r,_ as _e,a as I,aj as kt,f as Ie,e as br,o as Lt,X as Ae,i as dt,bq as jq,b as rt,br as Nq,bs as _d,am as et,bt as T7,n as hf,bu as qv,ai as ca,bv as Sq,C as da,bw as Lg,bx as Iq,by as Cq,bz as _7,b3 as Gl,g as yr,bA as M7,bB as Eq,bC as Aq,b4 as Tq,W as Ys,u as ni,bn as di,bD as R7,bh as Uv,bE as _q,bF as Mq,bG as O7,bH as Rq,bI as Oq,ax as zq,aw as Lq,aa as z7,N as Pq,L as Hv,bJ as Dq,bK as $q,h as Wv,al as Kv,bL as P5,bM as Bq,bj as L7,bN as Fq,bi as Zb,at as qq,bO as Uq,b6 as xf,V as Hq,bP as Wq,aM as Kq,bQ as Vq,bR as Gq,aO as Yq,$ as Jq,bS as Zq,bT as Xq,an as Qq,ac as eU,ae as tU,U as Pg,T as nU,bU as sU,k as D5,bV as rU,bW as aU,bX as iU,b7 as oU,l as lU,bY as cU,aV as P7,bZ as dU,b_ as uU,b0 as pU,b$ as mU,c0 as fU,v as D7,c1 as hU,w as $7,c2 as xU,c3 as gU,s as bU}from"./styles-NM37uvmJ.js";import{n as Xb,r as oo,i as yU,E as ua,d as si,S as Qb,e as Jh,p as ui,f as kU,g as vU,c as wU,l as jU,h as NU,j as SU,u as IU,k as B7,m as CU,q as EU,s as Vv,P as AU,t as TU,D as $5,v as _U,w as MU,x as Zh,y as F7,z as to,A as RU,B as OU,F as zU}from"./index-DeIGTf2I.js";import{ar as LU,as as PU,$ as Dg,ad as qa,at as Xh,au as Gv,r as Ke,av as q7,aw as U7,ax as DU,K as Js,ay as Qh,B as Ge,L as ye,x as ba,C as fn,y as ms,J as Vs,az as $U,N as BU,aA as FU,aB as qU,aC as H7,aD as gf,aE as W7,aF as Yv,aG as UU,aH as HU,P as An,aI as WU,aJ as KU,aK as VU,Q as GU,aL as YU,aM as JU,aN as B5,aO as ZU,aP as Md,aQ as XU,aR as Sn,aS as QU,aT as Rr,aU as Ti,b as eH,aV as $g,aW as vp,aX as F5,a6 as tH,a7 as q5,a5 as nH,a4 as U5,aY as Wo,aZ as Jv,a_ as lo,a$ as bf,b0 as K7,b1 as V7,M as Jt,b2 as Yl,b3 as Ou,ak as co,b4 as Vt,b5 as e0,b6 as cd,b7 as Im,b8 as yf,b9 as Cm,ba as Rd,bb as Ws,bc as Xo,bd as sH,be as Ua,bf as rH,E as fs,c as G7,k as qc,s as Is,X as pi,O as aH,V as ex,d as qn,bg as iH,bh as oH,bi as lH,bj as Bg,A as cH,Y as uo,bk as Ha,bl as Y7,bm as J7,bn as jn,bo as dH,bp as uH,bq as pH,br as tx,g as mH,j as Jl,bs as fH,u as Zv,f as hH,_ as Bi,w as Xv,bt as kf,o as Z7,bu as xH,bv as gH,v as bH,R as yH,bw as kH,bx as vH,by as X7,W as wH,bz as jH,bA as NH,bB as SH,bC as IH,bD as Od,D as CH,bE as EH,bF as AH,bG as TH,i as _H,bH as MH}from"./PlacesRail-BI7EZKaw.js";import{M as po}from"./monitor-CJJehAYK.js";import{R as zt,a as us,C as at,u as mo,K as RH,S as OH}from"./MenuMotion-Dh3Gi4kY.js";const zH=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Qv=le("activity",zH);const LH=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Zl=le("app-window",LH);const PH=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],DH=le("archive-restore",PH);const $H=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Tl=le("archive",$H);const BH=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Q7=le("arrow-down-to-line",BH);const FH=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_l=le("arrow-down",FH);const qH=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],UH=le("arrow-left-right",qH);const HH=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],WH=le("arrow-left",HH);const KH=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],Xl=le("arrow-right-left",KH);const VH=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],nx=le("arrow-right",VH);const GH=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],zs=le("arrow-up-right",GH);const YH=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],mi=le("arrow-up",YH);const JH=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],eE=le("at-sign",JH);const ZH=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],XH=le("atom",ZH);const QH=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],eW=le("award",QH);const tW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M13.916 2.314A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.74 7.327A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673 9 9 0 0 1-.585-.665",key:"1tip0g"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]],vf=le("bell-dot",tW);const nW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],sW=le("bell-off",nW);const rW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ew=le("bell",rW);const aW=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],tE=le("blocks",aW);const iW=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],tw=le("book-open",iW);const oW=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],lW=le("book",oW);const cW=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]],dW=le("bookmark-plus",cW);const uW=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],nw=le("bot",uW);const pW=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],nE=le("box",pW);const mW=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],fW=le("brain",mW);const hW=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],xW=le("briefcase",hW);const gW=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],sx=le("bug",gW);const bW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],yW=le("calendar-check",bW);const kW=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],wf=le("calendar-clock",kW);const vW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],sE=le("calendar",vW);const wW=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],jW=le("chart-column",wW);const NW=[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]],rE=le("chart-no-axes-combined",NW);const SW=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],jf=le("check-check",SW);const IW=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],fi=le("chevron-up",IW);const CW=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],EW=le("chevrons-up-down",CW);const AW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],wr=le("circle-alert",AW);const TW=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_W=le("circle-check-big",TW);const MW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ea=le("circle-check",MW);const RW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],OW=le("circle-dot",RW);const zW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sw=le("circle-question-mark",zW);const LW=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aE=le("circle-user-round",LW);const PW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rw=le("circle-x",PW);const DW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aw=le("circle",DW);const $W=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],Em=le("clipboard-copy",$W);const BW=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],FW=le("clipboard-list",BW);const qW=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],UW=le("clipboard-paste",qW);const HW=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zu=le("clock-3",HW);const WW=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Lu=le("clock",WW);const KW=[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]],iE=le("cloud-alert",KW);const VW=[["path",{d:"m17 15-5.5 5.5L9 18",key:"15q87x"}],["path",{d:"M5 17.743A7 7 0 1 1 15.71 10h1.79a4.5 4.5 0 0 1 1.5 8.742",key:"9ho6ki"}]],GW=le("cloud-check",VW);const YW=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]],oE=le("cloud-off",YW);const JW=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ZW=le("code-xml",JW);const XW=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lE=le("code",XW);const QW=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],eK=le("compass",QW);const tK=[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]],nK=le("contact",tK);const sK=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],t0=le("corner-down-right",sK);const rK=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],cE=le("corner-up-left",rK);const aK=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],iK=le("cpu",aK);const oK=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],H5=le("credit-card",oK);const lK=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],iw=le("crosshair",lK);const cK=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],pa=le("crown",cK);const dK=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],uK=le("database",dK);const pK=[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]],ow=le("dot",pK);const mK=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ft=le("download",mK);const fK=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],hK=le("ellipsis-vertical",fK);const xK=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],lw=le("eye-off",xK);const gK=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ur=le("eye",gK);const bK=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],yK=le("file-pen",bK);const kK=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],no=le("file-text",kK);const vK=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Nf=le("file",vK);const wK=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],jK=le("film",wK);const NK=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],SK=le("fingerprint",NK);const IK=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],CK=le("flask-conical",IK);const EK=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],dE=le("folder-input",EK);const AK=[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],uE=le("folder-minus",AK);const TK=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Hr=le("folder-open",TK);const _K=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Zr=le("folder-plus",_K);const MK=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Sf=le("folder",MK);const RK=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Pu=le("gauge",RK);const OK=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],pE=le("gift",OK);const zK=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],LK=le("git-branch",zK);const PK=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],DK=le("git-commit-horizontal",PK);const $K=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],mE=le("git-pull-request",$K);const BK=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],FK=le("github",BK);const qK=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ma=le("globe",qK);const UK=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],fE=le("graduation-cap",UK);const HK=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],WK=le("grip-vertical",HK);const KK=[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]],VK=le("hand-helping",KK);const GK=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],cw=le("hand",GK);const YK=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],JK=le("hash",YK);const ZK=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],XK=le("history",ZK);const QK=[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]],eV=le("id-card",QK);const tV=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],zd=le("image-off",tV);const nV=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],sV=le("image-plus",nV);const rV=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ld=le("image",rV);const aV=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]],iV=le("images",aV);const oV=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Pd=le("inbox",oV);const lV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],hi=le("info",lV);const cV=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],es=le("key-round",cV);const dV=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],hE=le("layers",dV);const uV=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],pV=le("layout-grid",uV);const mV=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fV=le("layout-dashboard",mV);const hV=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],xV=le("layout-template",hV);const gV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],xE=le("life-buoy",gV);const bV=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],dw=le("lightbulb",bV);const yV=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],gE=le("link-2",yV);const kV=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],bE=le("link-2-off",kV);const vV=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wV=le("link",vV);const jV=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Du=le("list-checks",jV);const NV=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],Wa=le("lock-keyhole",NV);const SV=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],zr=le("log-in",SV);const IV=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ql=le("mail",IV);const CV=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],EV=le("map-pin",CV);const AV=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],TV=le("map",AV);const _V=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Dd=le("maximize-2",_V);const MV=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],RV=le("megaphone",MV);const OV=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],zV=le("menu",OV);const LV=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],PV=le("merge",LV);const DV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],$V=le("message-square-plus",DV);const BV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],FV=le("message-square-text",BV);const qV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],UV=le("message-square",qV);const HV=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],uw=le("messages-square",HV);const WV=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],rx=le("mic",WV);const KV=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],yE=le("mic-off",KV);const VV=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],GV=le("minimize-2",VV);const YV=[["path",{d:"M5 12h14",key:"1ays0h"}]],ax=le("minus",YV);const JV=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],ZV=le("music",JV);const XV=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],QV=le("network",XV);const eG=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],pw=le("newspaper",eG);const tG=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],nG=le("notebook-pen",tG);const sG=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]],rG=le("notebook",sG);const aG=[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]],kE=le("package-open",aG);const iG=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],vE=le("paperclip",iG);const oG=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],lG=le("party-popper",oG);const cG=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],mw=le("pause",cG);const dG=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],uG=le("pencil-line",dG);const pG=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],mr=le("pencil",pG);const mG=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],Ml=le("phone-off",mG);const fG=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],$r=le("phone",fG);const hG=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],kr=le("pin-off",hG);const xG=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Pn=le("pin",xG);const gG=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ix=le("play",gG);const bG=[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],W5=le("plug-zap",bG);const yG=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],wE=le("plug",yG);const kG=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ox=le("puzzle",kG);const vG=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],jE=le("quote",vG);const wG=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],jG=le("repeat",wG);const NG=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],lx=le("reply",NG);const SG=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],IG=le("rocket",SG);const CG=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],jr=le("rotate-ccw",CG);const EG=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],fw=le("rotate-cw",EG);const AG=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$u=le("settings",AG);const TG=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],NE=le("share-2",TG);const _G=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],hw=le("share",_G);const MG=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],RG=le("shield-alert",MG);const OG=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],cx=le("shield-check",OG);const zG=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],SE=le("sliders-horizontal",zG);const LG=[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]],PG=le("smile-plus",LG);const DG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]],$G=le("sparkle",DG);const BG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ts=le("sparkles",BG);const FG=[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]],qG=le("split",FG);const UG=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],HG=le("square-code",UG);const WG=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],KG=le("square-menu",WG);const VG=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ta=le("square-pen",VG);const GG=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],n0=le("square-terminal",GG);const YG=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ya=le("square",YG);const JG=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$d=le("star",JG);const ZG=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],IE=le("table-2",ZG);const XG=[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],QG=le("tablet-smartphone",XG);const eY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],xw=le("target",eY);const tY=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],nY=le("text-quote",tY);const sY=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],vn=le("trash-2",sY);const rY=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ts=le("triangle-alert",rY);const aY=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],CE=le("undo-2",aY);const iY=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],EE=le("upload",iY);const oY=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],lY=le("user-plus",oY);const cY=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],dY=le("user",cY);const uY=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],gw=le("users-round",uY);const pY=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Tn=le("users",pY);const mY=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],bw=le("volume-2",mY);const fY=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],hY=le("wallet",fY);const xY=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],gY=le("wand-sparkles",xY);const bY=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],yY=le("webhook",bY);const kY=[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],Bd=le("wrap-text",kY);const vY=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],AE=le("wrench",vY);const wY=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],fa=le("zap",wY);const jY=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],NY=le("zoom-in",jY);function K5(e){return LU(PU,e)}const SY="Shared chat",TE=["none","low","medium","high","xhigh","max"];function OLe(e){return typeof e=="string"&&TE.includes(e)}const _E=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral","silver","chrome"],zLe=/^[a-z0-9][a-z0-9_-]{0,80}$/,ME=/^[A-Z][A-Z0-9_]{0,127}$/,IY=e=>e.helperModel===void 0||e.helperModel===!0,CY="Historical excerpts in chronological order; newer corrections override older requests. These excerpts may omit earlier details.",Uc=e=>e.role==="user"?!e.peerAsk:e.kind==="text"&&(e.turnTerminal===!0||!e.turnId);function Br(e){return e.map((t,n)=>({task:t,index:n})).sort((t,n)=>{const s=+(n.task.pinned===!0)-+(t.task.pinned===!0);if(s)return s;const a=(n.task.lastThreadOrderAt??n.task.createdAt??0)-(t.task.lastThreadOrderAt??t.task.createdAt??0);return a||t.index-n.index}).map(t=>t.task)}const dx=(e,t=Date.now())=>e.snoozedUntil!==void 0&&(e.snoozedUntil===0||e.snoozedUntil>t),EY="x-omb-background",AY="x-omb-cloud-power",TY="/api/auth/session",s0=new Set;let Fd=!1,r0=null;function Da(){return Fd}function ux(e){return s0.add(e),()=>{s0.delete(e)}}function RE(e){if(Fd!==e){Fd=e;for(const t of s0)t(e)}}function yw(){Fd&&(fetch(TY).catch(()=>{}),r0?.(),r0=null,RE(!1))}function OE(e=globalThis.window){if(Fd||(RE(!0),!e))return;const t=()=>yw(),n=["pointerdown","keydown","focus","touchstart"];for(const s of n)e.addEventListener(s,t,{capture:!0});r0=()=>{for(const s of n)e.removeEventListener(s,t,{capture:!0})}}function a0(){return typeof document<"u"&&document.visibilityState==="hidden"}function _Y(e){return a0()?new Promise((t,n)=>{const s=()=>{document.removeEventListener("visibilitychange",a),e?.removeEventListener("abort",i)},a=()=>{a0()||(s(),t())},i=()=>{s(),n(e?.reason??new DOMException("The request was aborted.","AbortError"))};if(e?.aborted){i();return}document.addEventListener("visibilitychange",a),e?.addEventListener("abort",i,{once:!0})}):Promise.resolve()}function MY(e){return e.status===503&&e.headers.get(AY)==="asleep"}function RY(e){return e.kind==="power"&&e.state==="sleeping"}const V5=new Set;function zE(e){const t=Object(e);return t.status===403&&typeof t.message=="string"&&t.message.includes("lacks the admin scope")}async function If(e,t,n){if(V5.has(e))return n;try{return await t()}catch(s){if(!zE(s))throw s;return V5.add(e),n}}const OY="bot_limit",zY="bot_paused";function LE(e){return e.filter(t=>!t.defaultBot&&!t.hidden&&!t.movedTo).length}let i0=null,o0=null;const l0=new Set;function kw(e,t=null){if(!(i0===e&&o0===t)){i0=e,o0=t;for(const n of l0)n()}}const LY=()=>i0,PY=()=>o0,qd=(e="bots")=>kw(e),DY=e=>kw("created",e),$Y=()=>kw(null),PE=e=>(l0.add(e),()=>{l0.delete(e)});function BY(){return f.useSyncExternalStore(PE,LY)}function FY(){return f.useSyncExternalStore(PE,PY)}function qY(e,t){const n=t?.refusedAt;return e===null||n===void 0||n===e?{seen:e===null?n:e,show:null}:{seen:n,show:t?.refused??"tasks"}}function UY(e){return e.filter(t=>LE([t])===1&&!t.chiefOfStaff)}function DE(e){const t=e.config?.botLimit;return t===void 0?null:Math.max(0,t-LE(e.bots))}function G5(e){return DE(e)!==0?!1:(qd(),!0)}function $E(e){return e?.body?.code===OY}function HY(e){return e?.body?.code===zY}class hn extends Error{status;body;constructor(t,n,s){super(t),this.name="ApiError",this.status=n,this.body=s}}const wp=new Map;async function K(e,t){const{timeoutMs:n,signal:s,background:a,headers:i,...o}=t??{};if(a&&a0())return WY(e,t);if(Da()){if(a)throw new hn("My Cloud is asleep",503,{error:"asleep"});yw()}const c=new Headers(i??{"content-type":"application/json"});a&&c.set(EY,"1");const d=await fetch(e,{...o,headers:c,signal:n===void 0?s:s?AbortSignal.any([s,AbortSignal.timeout(n)]):AbortSignal.timeout(n)});MY(d)&&OE();const u=await d.json().catch(()=>({}));if(!d.ok){const p=u?.error,m=typeof p=="string"?p:typeof p?.message=="string"?p.message:`${d.status} ${d.statusText}`,h=new hn(Al(u,m),d.status,u);throw(d.status===401||d.status===403&&!zE(h))&&Xb(),d.status===409&&$E(h)&&qd(),d.status===409&&HY(h)&&qd("paused"),h}return u}function WY(e,t){const n=(t.method??"GET").toUpperCase()==="GET"&&!t.signal,s=n?wp.get(e):void 0;if(s)return s;const a=_Y(t.signal??void 0).then(()=>K(e,t));return n&&(wp.set(e,a),a.finally(()=>{wp.get(e)===a&&wp.delete(e)}).catch(()=>{})),a}function jp(e,...t){for(const n of t)if(!Array.isArray(e[n]))throw new Error(`Invalid snapshot: ${String(n)} is not a list`);return e}const Y5=[2e3,5e3,15e3,3e4];function KY(e,t){const n=s=>{t().catch(()=>{e()&&setTimeout(()=>n(s+1),Y5[Math.min(s,Y5.length-1)])})};n(0)}function VY(e,t){const n=new Map(t.map((o,c)=>[o,c])),s=[];e.forEach((o,c)=>{n.has(o.id)&&s.push(c)});const a=s.map(o=>e[o]).sort((o,c)=>n.get(o.id)-n.get(c.id)),i=[...e];return s.forEach((o,c)=>{i[o]=a[c]}),i}const GY=e=>e.trim().toLowerCase();function Lr(e){const t=e.defaultBot?.person?.trim()||e.reportsTo?.trim()||e.createdBy?.trim();return t?GY(t):null}function Rl(e){const t=Lr(e);return t?`owner:${t}`:`section:${e.section?.trim()||""}`}function J5(e,t){const n=Rl(t);return e.map(s=>s.id===t.id||!s.chiefOfStaff||Rl(s)!==n?s:{...s,chiefOfStaff:!1})}function vw(e){const t=e.trim();return t.includes("@")?px(t):t}function px(e){return(e.split("@")[0]?.replace(/[._-]+/g," ").trim()||e).replace(new RegExp("(^|\\s)(\\p{L})","gu"),(n,s,a)=>`${s}${a.toUpperCase()}`)}const Np={pageSize:1024,chartMaxMarks:1e4},BE={sheet:e=>`/api/bots/${encodeURIComponent(e)}/data`,page:e=>`/api/bots/${encodeURIComponent(e)}/data/page`,run:e=>`/api/bots/${encodeURIComponent(e)}/data/run`,cancel:e=>`/api/bots/${encodeURIComponent(e)}/data/cancel`,card:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/cards/${encodeURIComponent(t)}`,stats:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/tables/${encodeURIComponent(t)}/stats`,histogram:(e,t,n)=>`/api/bots/${encodeURIComponent(e)}/data/tables/${encodeURIComponent(t)}/histogram?column=${encodeURIComponent(n)}`,export:e=>`/api/bots/${encodeURIComponent(e)}/data/export`,image:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/cards/${encodeURIComponent(t)}/image`},Z5=500,YY=new Set(["notificationsHydrated","notificationReceived","notificationRead","notificationsRead","notificationsMarkAllRead"]);function JY(e){return YY.has(e.type)}function ZY(e,t){switch(t.type){case"notificationsHydrated":{const n=new Set(t.notifications.map(s=>s.id));return[...e.filter(s=>!n.has(s.id)),...t.notifications].sort((s,a)=>a.at-s.at).slice(0,Z5)}case"notificationReceived":return e.some(n=>n.id===t.entry.id)?e:[t.entry,...e].slice(0,Z5);case"notificationRead":return e.map(n=>n.id===t.id&&!n.read?{...n,read:!0}:n);case"notificationsRead":{const n=new Set(t.ids);return e.map(s=>n.has(s.id)&&!s.read?{...s,read:!0}:s)}case"notificationsMarkAllRead":return e.map(n=>n.read?n:{...n,read:!0})}}function Am(e,t){if(!t)return e;const n=new Map((e??[]).map(s=>[s.threadId,s]));return t.map(s=>{const a=n.get(s.threadId);if(!a)return s;const i=a.updatedAt===void 0?s.updatedAt:Math.max(a.updatedAt,s.updatedAt??0),o=a.lastThreadOrderAt===void 0?s.lastThreadOrderAt:Math.max(a.lastThreadOrderAt,s.lastThreadOrderAt??0);return i===s.updatedAt&&o===s.lastThreadOrderAt?s:{...s,updatedAt:i,lastThreadOrderAt:o}})}function Sa(e,t,n,s=!1,a=n){if(!Number.isFinite(n))return e;const i=o=>o?.some(c=>c.threadId===t)?o.map(c=>c.threadId===t?{...c,updatedAt:Math.max(c.updatedAt??0,n),...s?{lastThreadOrderAt:Math.max(c.lastThreadOrderAt??0,a)}:{}}:c):o;return{...e,bots:e.bots.map(o=>{const c=i(o.tasks);return c===o.tasks?o:{...o,tasks:c}}),groups:e.groups.map(o=>{const c=i(o.tasks);return c===o.tasks?o:{...o,tasks:c}})}}function X5(e,t,n,s,a=s){const i=n.reduce((d,u)=>Math.max(d,u.at||0),s),o=n.reduce((d,u)=>Uc(u)?Math.max(d,u.turnCompletedAt??u.at??0):d,a),c=d=>d?.map(u=>u.threadId===t?{...u,updatedAt:i,lastThreadOrderAt:o}:u);return{...e,bots:e.bots.map(d=>d.tasks?.some(u=>u.threadId===t)?{...d,tasks:c(d.tasks)}:d),groups:e.groups.map(d=>d.tasks?.some(u=>u.threadId===t)?{...d,tasks:c(d.tasks)}:d)}}const Cf="omb-notification-sounds",Ef="omb-notification-feed",Af="omb-finished-notifications",c0="omb-notification-tray-pinned";let Ud,Hd,Wd;const Hc=new Set;function Fr(){try{return globalThis.localStorage}catch{return}}function FE(){if(Ud!==void 0)return Ud;try{return Fr()?.getItem(Cf)!=="0"}catch{return!0}}function mx(){for(const e of Hc)e()}function Q5(e){e.key!==Cf&&e.key!==Ef&&e.key!==Af&&e.key!==null||e.storageArea&&e.storageArea!==Fr()||(Ud=void 0,Hd=void 0,Wd=void 0,mx())}function ww(e){return Hc.add(e),Hc.size===1&&typeof window<"u"&&window.addEventListener("storage",Q5),()=>{Hc.delete(e),Hc.size===0&&typeof window<"u"&&window.removeEventListener("storage",Q5)}}function LLe(e){Ud=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Cf,n),t?.getItem(Cf)===n&&(Ud=void 0)}catch{}mx()}function PLe(){return f.useSyncExternalStore(ww,FE,()=>!0)}function XY(){if(Hd!==void 0)return Hd;try{return Fr()?.getItem(Ef)==="1"}catch{return!1}}function DLe(e){Hd=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Ef,n),t?.getItem(Ef)===n&&(Hd=void 0)}catch{}mx()}function QY(){return f.useSyncExternalStore(ww,XY,()=>!1)}function qE(){if(Wd!==void 0)return Wd;try{return Fr()?.getItem(Af)!=="0"}catch{return!0}}function $Le(e){Wd=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Af,n),t?.getItem(Af)===n&&(Wd=void 0)}catch{}mx()}function BLe(){return f.useSyncExternalStore(ww,qE,()=>!0)}function eJ(){try{return Fr()?.getItem(c0)==="1"}catch{return!1}}function tJ(e){try{e?Fr()?.setItem(c0,"1"):Fr()?.removeItem(c0)}catch{}}let As=null;const Tf=new Set;function nJ(e){Tf.add(e)}function Qo(e){As=e;for(const t of Tf)t()}function xi(){return As}function sJ(e,t){As?.teamId===e&&!As.opened?.includes(t)&&Qo({...As,opened:[...As.opened??[],t]})}const UE=e=>!!(e&&As?.opened?.includes(e)),rJ=e=>e.private===!0&&!e.routineRunId&&!e.openedBy&&!e.archivedAt&&!e.closedBy,aJ=e=>[...e].sort((t,n)=>(n.updatedAt??n.createdAt??0)-(t.updatedAt??t.createdAt??0))[0];function HE(e,t){const n=(e.tasks??[]).filter(rJ),s=new Set(t.opened??[]),a=t.member?n:n.filter(i=>s.has(i.threadId));return(n.find(i=>i.inbox===!0)??aJ(a))?.threadId??null}const Fg=new Set;function WE(e,t,n){const s=As;if(!s)return!1;if(s.opened===void 0){const i=()=>{As&&As.opened===void 0||(Tf.delete(i),As&&WE(e,t,n))};return Tf.add(i),!0}const a=HE(t,s);return a?(n(a),!0):t.yourAccess==="view"?!1:(Fg.has(t.id)||(Fg.add(t.id),K(`/api/bots/${t.id}/tasks`,{method:"POST",body:"{}"}).then(i=>{typeof i?.task?.threadId=="string"&&sJ(s.teamId,i.task.threadId),i?.bot&&(e({type:"taskSwitched",bot:i.bot}),e({type:"select",id:t.id}))}).catch(i=>e({type:"error",message:i instanceof Error?i.message:String(i)})).finally(()=>Fg.delete(t.id))),!0)}function KE(e){const t=e?.team;return typeof t?.id=="string"&&t.id?{id:t.id}:null}const VE=(e,t)=>({teamId:e,member:!t.scopes.includes("admin"),opened:t.openedThreads??[],...t.email?.trim()?{person:t.email.trim().toLowerCase()}:{}});function iJ(){const e=As?.teamId;e&&oo().then(t=>{As?.teamId===e&&t.kind==="session"&&Qo(VE(e,t))}).catch(()=>{})}function oJ(e){const t=KE(e)?.id??null;f.useEffect(()=>{if(!t){Qo(null);return}Qo({teamId:t,member:!1});let n=!0;return oo().then(s=>{n&&Qo(s.kind==="session"?VE(t,s):{teamId:t,member:!1,opened:[]})}).catch(()=>{n&&Qo({teamId:t,member:!1,opened:[]})}),()=>{n=!1}},[t])}function fx(e,t){if(e.defaultBot?.person)return"me";const n=e.tasks?.find(s=>s.threadId===t);return n?.sharedChat!==!0&&(n?.private===!0||UE(t))?"me":"team"}const GE=e=>e.defaultBot?.person?null:e.tasks?.find(t=>t.sharedChat===!0&&t.private!==!0)?.threadId??null,jw=(e,t)=>(e.tasks??[]).filter(n=>fx(e,n.threadId)===t);function lJ(e,t,n){return n==="team"?GE(e)!==null:!!e.defaultBot?.person||e.yourAccess!=="view"||HE(e,t)!==null}function cJ(e,t){const n=fx(e,e.threadId)===t,s=jw(e,t),a=n?{}:{busy:!1,activity:void 0,waitingForTeammates:!1,...e.messages?{messages:[]}:{}};return{...e,tasks:e.tasks&&s,unread:s.some(YE),...a}}const YE=e=>!!e.unread&&!e.routineRunId&&e.archivedAt===void 0;function Nw(e,t,n,s){if(!n)return{switchable:!1,bots:e,groups:t,unread:{me:!1,team:!1}};const a=e.filter(m=>!m.hidden),i=m=>a.filter(h=>lJ(h,n,m)),o=i("me"),c=i("team"),d=o.length>0&&c.length+t.length>0,u=m=>a.some(h=>jw(h,m).some(YE))||m==="team"&&t.some(h=>!!h.unread),p={me:u("me"),team:u("team")};return d?{switchable:d,bots:(s==="me"?o:c).map(m=>cJ(m,s)),groups:s==="team"?t:[],unread:p}:{switchable:d,bots:e,groups:t,unread:p}}const Sw=()=>typeof localStorage>"u"?null:localStorage,JE=e=>e.person?`omb.team-side.${e.teamId}.${e.person}`:null;let Ol=null,d0=0;const u0=new Set,Iw=()=>{d0++;for(const e of u0)e()},hx=e=>`${e.teamId}:${e.person??""}`;nJ(()=>{const e=xi();(!e||hx(e)!==Ol?.page)&&(Ol=null),Iw()});function ZE(e=xi(),t=Sw()){const n=e&&JE(e);try{if(n&&t)return t.getItem(n)==="team"?"team":"me"}catch{}return"me"}function Bu(e=xi(),t=Sw()){return e?Ol?.page===hx(e)?Ol.side:ZE(e,t):"me"}function dJ(e,t=xi()){!t||Bu(t)===e||(Ol={page:hx(t),side:e},Iw())}function XE(e,t=xi(),n=Sw()){if(!t)return;const s=JE(t),a=Bu(t,n)!==e;try{s&&n&&ZE(t,n)!==e&&n.setItem(s,e)}catch{}a&&(Ol={page:hx(t),side:e},Iw())}function xx(){f.useSyncExternalStore(t=>(u0.add(t),()=>{u0.delete(t)}),()=>d0,()=>d0);const e=xi();return{team:e,side:Bu(e)}}function uJ(e,t){return t&&Bu(t)==="team"?GE(e):null}function pJ(e){return e.activeView!=="chat"?null:e.bots.find(t=>t.id===e.selectedId)?.threadId??e.groups.find(t=>t.id===e.selectedId)?.threadId??null}function fo(e,t){return!t&&e.mainThreadId&&e.tasks?.some(n=>n.threadId===e.mainThreadId)?e.mainThreadId:e.threadId}function QE(e,t){return!t&&fo(e,!1)!==e.threadId}function qt(e,t,n){const s=uJ(t,xi());if(s)return Fi(e,t,s,n);if(WE(e,t,i=>Fi(e,t,i,n)))return;const a=fo(t,n);a===t.threadId?e({type:"select",id:t.id}):Fi(e,t,a,n)}const mJ=e=>e.routineRunId?null:e.activity==="waiting-on-you"?0:e.archivedAt!==void 0?null:e.unread?1:e.busy||e.activity==="working"?2:null;function fJ(e,t){const n=fo(e,t),s=i=>i.updatedAt??i.createdAt??0;return(e.tasks??[]).flatMap(i=>{const o=mJ(i);return o===null?[]:[{task:i,rank:o}]}).sort((i,o)=>i.rank-o.rank||+(o.task.threadId===n)-+(i.task.threadId===n)||s(o.task)-s(i.task))[0]?.task.threadId??null}function Kd(e,t,n,s){const a=xi()?null:fJ(t,n);!a||a===fo(t,n)||s&&a===t.threadId?qt(e,t,n):Fi(e,t,a,n)}function Fi(e,t,n,s){(s||n===t.threadId)&&e({type:"select",id:t.id}),e({type:"switchTask",botId:t.id,threadId:n})}function eA(e,t,n){e({type:"select",id:t.groupId});const s=n.find(a=>a.id===t.groupId);t.threadId&&s?.tasks?.some(a=>a.threadId===t.threadId)&&e({type:"switchGroupTask",groupId:t.groupId,threadId:t.threadId})}function xn(e,t,n,s){const a=d=>d.threadId===t.threadId||(d.tasks??[]).some(u=>u.threadId===t.threadId),i=n.groups.find(a),o=i?void 0:n.bots.find(a),c=n.bots.find(d=>d.id===t.botId);return i?(e({type:"select",id:i.id}),i.threadId!==t.threadId&&e({type:"switchGroupTask",groupId:i.id,threadId:t.threadId})):o?Fi(e,o,t.threadId,s):c&&qt(e,c,s),e({type:"revealThread",threadId:t.threadId}),i||o?!0:(e({type:"notice",notice:{kind:"thread-gone",botName:c?.name??null}}),!1)}function Ko(e){return e.notificationsOpen&&!e.notificationsPinned?{...e,notificationsOpen:!1}:e}function e4(e,t,n){const s=[...e.bots,...e.groups].find(o=>o.id===t),a=s&&"switchingTo"in s?s.switchingTo??s.threadId:s?.threadId;return e.activeView==="chat"&&t===e.selectedId&&a===n?e:Ko(e)}function hJ(e){return eJ()?{...e,notificationsPinned:!0}:e}function Sp(e,t,n,s){return{...e,groups:e.groups.map(a=>a.id!==t?a:{...a,tasks:(a.tasks??[]).map(i=>i.threadId===n?{...i,...s}:i)})}}const cl=e=>`optimistic-${e}`;function qg(e,t,n,s,a){return{id:cl(t),role:"user",kind:"text",text:e,at:Date.now(),parentId:s??null,replyToId:n,sendId:t,channelMode:a}}function xJ(e,t){return!!e?.some(n=>n.sendId===t&&n.id!==cl(t))}const gJ=[1e3,3e3];async function bJ(e,t,n=s=>new Promise(a=>setTimeout(a,s))){for(let s=0;;s++)try{return{body:await e()}}catch(a){if(!(!(a instanceof hn)&&a?.name!=="AbortError"))throw a;if(t())return{arrived:!0};const o=gJ[s];if(o===void 0)throw a;if(await n(o),t())return{arrived:!0}}}function yJ({threadId:e,pinnedCwd:t,pinnedMessageId:n,usage:s,memberContext:a,busyBotId:i,turnStartedAt:o,...c}){return{...c,section:c.section}}function kJ(e,t,n){const s=new Set(n.map(d=>d.id)),a=new Set(n.flatMap(d=>d.sendId?[d.sendId]:[])),i=new Map(e.filter(d=>!t.has(d)).map(d=>[d.id,d])),o=e.findIndex(d=>s.has(d.id)),c=e.filter((d,u)=>s.has(d.id)?!1:d.sendId&&d.id===cl(d.sendId)?!a.has(d.sendId):u>=o&&i.has(d.id));return[...n.map(d=>i.get(d.id)??d),...c]}function vJ(e,t){const n=e.find(a=>a.id===t.id),s=n&&!t.messages&&typeof t.threadId=="string"&&t.threadId!==n.threadId?yJ(t):t;return n?e.map(a=>a.id===s.id?{...a,...s,section:typeof s.threadId=="string"||Object.hasOwn(s,"section")?s.section:a.section,description:Object.hasOwn(s,"description")?s.description??void 0:a.description,tasks:s.tasks?Am(a.tasks,s.tasks):a.tasks,turnTimeoutMinutes:Object.hasOwn(s,"turnTimeoutMinutes")?s.turnTimeoutMinutes??void 0:a.turnTimeoutMinutes,messages:s.messages??a.messages,hasMore:s.messages?!!s.hasMore:a.hasMore}:a):[{...s.description===null?{...s,description:void 0}:s,messages:s.messages??[]},...e]}function wJ(e,{group:t,since:n,heldAtStart:s}){if(!t.messages||!t.threadId)return t;if((e.transcriptGeneration[t.threadId]??0)!==(n[t.threadId]??0))return null;const a=e.groups.find(i=>i.id===t.id);return a?.threadId===t.threadId?{...t,messages:kJ(a.messages,new Set(s),t.messages)}:t}function jJ(e,t){const n=new Map;return(s,a)=>{const i=(n.get(s)??0)+(a?1:0);n.set(s,i);const{transcriptGeneration:o,groups:c}=e(),d=c.find(u=>u.id===s)?.messages??[];return u=>{u?.group&&n.get(s)===i&&t({type:"groupSnapshot",group:u.group,since:o,heldAtStart:d})}}}function NJ(e,t){if("botId"in e){const o=t.bots.find(u=>u.id===e.botId);if(!o)return;const{messages:c,...d}=o;return{type:"botPatched",bot:d}}const n=t.groups?.find(o=>o.id===e.groupId);if(!n)return;const{messages:s,hasMore:a,...i}=n;return{type:"groupPatched",group:i}}const t4=new WeakMap;function Es(e){const t=e.activeLeafId;if(!t)return e.messages;const n=t4.get(e.messages);if(n?.leafId===t)return n.path;const s=new Map(e.messages.map(o=>[o.id,o]));if(!s.has(t))return e.messages;const a=[];let i=s.get(t);for(;i;)a.push(i),i=i.parentId?s.get(i.parentId):void 0;return a.reverse(),t4.set(e.messages,{leafId:t,path:a}),a}function n4(e,t,n){return e!==void 0&&(e.switchingTo!==void 0||(n[e.threadId]??0)!==(t?.[e.threadId]??0))}function tA(e,t,n){if(!n)return t;const s=new Set(t?.map(i=>i.threadId)),a=e?.filter(i=>!n.has(i.threadId)&&!s.has(i.threadId))??[];return a.length?[...t??[],...a]:t}function SJ(e,t,n,s){return!n||!e?t:{...t,threadId:e.threadId,tasks:tA(e.tasks,t.tasks,s),switchingTo:e.switchingTo,awaitingThreadSnapshot:e.awaitingThreadSnapshot,messages:e.messages,hasMore:e.hasMore,activeLeafId:e.activeLeafId,pinnedMessageId:e.pinnedMessageId}}function IJ(e,t,n,s){return!n||!e?t:{...t,threadId:e.threadId,tasks:tA(e.tasks,t.tasks,s),messages:e.messages,hasMore:e.hasMore,pinnedCwd:e.pinnedCwd,pinnedMessageId:e.pinnedMessageId,usage:e.usage,memberContext:e.memberContext,busyBotId:e.busyBotId,turnStartedAt:e.turnStartedAt}}const CJ=["ask","edits","auto","full","custom"];function Cw(e,t){return t==="custom"?e==="codex":t==="edits"?["claudeAgent","grokAgent","antigravityAgent","qwenAgent","geminiAgent"].includes(e??""):!0}function s4(e,t,n){return!Cw(n,e)||e==="custom"&&t!==n}function EJ(e){return["codex","claudeAgent","cursorAgent","grokAgent","qwenAgent"].includes(e??"")}function AJ(e){return typeof e=="string"&&CJ.includes(e)}const TJ="full";let _J=TJ;function In(e){const t=e.approvalGrant,n=t&&typeof t=="object"&&"threadOnly"in t&&t.threadOnly===!0&&"threadId"in t&&typeof t.threadId=="string"&&typeof e.threadId=="string"&&t.threadId!==e.threadId;return t&&!n?"ask":AJ(e.approvalMode)?e.approvalMode:e.autoApprove===!0?"auto":e.approvalMode===void 0?_J:"ask"}function nA(e,t){return!e||!t?e===t:e.instanceId===t.instanceId&&e.model===t.model&&e.effort===t.effort&&e.variant===t.variant}function sA(e,t){return t.filter(n=>n.followsBotModel===!1&&!nA(n.modelSelection??e,e))}const gx=f.createContext(null);function rA(e){return e==="enable"||e==="disable"||e==="delete"}function Ew(e){if(!(!e.preview||!e.sha256||!/^[a-f0-9]{64}$/i.test(e.sha256)))return e.sha256}function MJ(e){const t=e.trim().toLowerCase();return["enable","turn on","turn off","delete","update","apply","allow","allow once","confirm","yes"].includes(t)?"allow":"deny"}function RJ(e){const t={...Object.hasOwn(e,"toolScope")?{toolScope:e.toolScope}:{},...IY(e)?{}:{helperModel:!1}};return{...e.visibility&&e.visibility!=="everyone"?{visibility:e.visibility}:{},...Object.keys(t).length?{settings:t}:{}}}function OJ(e){return{name:`${e.name} copy`,title:e.title,description:e.description,soul:e.soul,notifications:e.notifications,modelSelection:e.modelSelection,computer:e.computer,cloudBackend:e.cloudBackend,autoStartVps:e.autoStartVps,vpsAlias:e.vpsAlias,avatarUrl:e.avatarUrl,avatarCrop:e.avatarCrop,avatarZoom:e.avatarZoom,avatarFocusX:e.avatarFocusX,avatarFocusY:e.avatarFocusY}}const zJ=/^\[(?:From @([^·\]]+?) \(bot\) · (message|assignment) · |(Message from|Delegated by|Thread opened by) @([^,\]]+), another bot in this OpenMausBot workspace)[^\]]*\]\s*/,LJ={message:"ask_bot",assignment:"delegate_bot","Message from":"ask_bot","Delegated by":"delegate_bot","Thread opened by":"start_thread"};function Ls(e){if(e.role!=="user")return null;const t=e.text??"",n=zJ.exec(t),s=e.peerAsk?.name??(n?.[1]??n?.[4])?.trim();return s?{botId:e.peerAsk?.botId,name:s,delivery:n&&LJ[n[2]??n[3]??""]||"ask_bot",body:n?t.slice(n[0].length):t,...e.peerAsk?.unattended?{unattended:!0}:{}}:null}function Vd(e,t){if(e.role!=="bot"||e.roomRequest?.phase!=="request")return null;const n=e.from;return!n?.name||n.botId===t?null:{botId:n.botId,name:n.name,delivery:"coordinate_bots",body:e.text??""}}const PJ=e=>e.role==="user"&&!Ls(e);function DJ(e,t){let n=-1;for(let s=e.length-1;s>=0&&n<0;s--)PJ(e[s])&&(n=s);return t&&(n=Math.max(n,e.findIndex(s=>s.id===t))),n<0?null:e[n+1]?.id??null}function aA(e,t,n,s){const a=DJ(t,n);return a?{threadId:e,messageId:a}:s?{threadId:e,messageId:null,lastReadMessageId:n}:null}function Tm(e,t,n,s){return!e||e.threadId!==t||e.messageId?e:aA(t,n,e.lastReadMessageId,s)}function r4(e){return e.tasks?.find(t=>t.threadId===e.threadId)?.lastReadMessageId}function iA(e,t){if(!t)return null;const n=e.findIndex(s=>s.id===t);return n<0?null:new Set(e.slice(n).map(s=>s.id))}function a4(e){const t=e.tasks?.find(n=>n.threadId===e.threadId);return t?.routineRunId?!1:!!(t?.unread??e.unread)}const $J=1200,oA=480,BJ=new Set(["browser","local","vm","cloud"]);function lA(e){const t=e;if(!t||typeof t!="object")return null;const{botId:n,threadId:s,messageId:a,site:i,place:o}=t;return typeof n=="string"&&typeof s=="string"&&typeof a=="string"&&typeof i=="string"&&typeof o=="string"&&BJ.has(o)?{botId:n,threadId:s,messageId:a,site:i,place:o}:null}async function FLe(e){const{action:t,syncNativeBrowser:n,requestControl:s,setNativeBrowserControl:a}=e;if(t==="take"&&n&&!await a(!0))throw new Error(l("computer.err.pauseBrowser",{app:Ot()}));const i=await s(t);if(i.held!==(t==="take"))throw new Error(l(t==="take"?"computer.err.confirmControl":"computer.err.releaseControl",{app:Ot()}));if(t==="release"&&n&&!await a(!1))throw new Error(l("computer.err.browserStillPaused"));return i}const FJ="The user closed this question without answering. Use your best judgment and continue.",i4=120,Aw=2e3;function qJ(e){return!!(e&&(e.requestType==="question"||e.questionRequest||!e.requestType&&!e.tool&&!e.routineRequest&&!e.skillRequest&&!e.profileRequest&&!e.modelRequest&&!e.teamSetupRequest))}function o4(e,t){if(typeof e!="string")return;const n=e.trim();return n?n.slice(0,t).trim():void 0}function UJ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const HJ=5;function WJ(e,t=HJ){if(!Array.isArray(e))return;const n=[],s=new Set;for(const a of e){const i=typeof a=="string"?o4(a,i4):UJ(a)?o4(a.label,i4):void 0;if(!(!i||s.has(i))&&(s.add(i),n.push(i),n.length===t))break}return n.length?n:void 0}function KJ(e){if(e.length!==1)return;const t=e[0];if(!(t.multiSelect||t.options.length<2))return t.options.map(n=>n.label)}const _f="The user answered your questions.",p0=`${_f}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/new-bot-R2d69ePy.js","assets/styles-BYp3glRK.js","assets/styles-D8FmJr6X.css","assets/PlacesRail-msEDHUXY.js","assets/monitor-DagRnmYm.js","assets/RoutinesPage-CRvNKmna.js","assets/remote-desktop-DDRRx8uY.js","assets/ProIntroduction-D8SaBehJ.js","assets/MenuMotion-BjmjRIR3.js","assets/WebhookTrigger-B0TCdhpi.js","assets/index-BEBI8eA5.js","assets/AppEventEditor-MqHYrUPZ.js","assets/ActivityPanel-DC3XVGOc.js","assets/activity-cUbbx7sx.js","assets/BotSettingsDialog-BrmKiJZJ.js","assets/coins-CxC_dI0J.js","assets/VisibilitySection-BMxXxacO.js","assets/org-library-CTZWRg3z.js","assets/package-format-D4k7Rh0H.js","assets/mcp-servers-BdjmXJSB.js","assets/WorksOnGrid-BYivdc01.js","assets/ComputerFilesPane-CP_exuaN.js","assets/SignedInSites-BGsMS1IG.js","assets/ComputerPanel-SaUcSoW6.js","assets/desktop-viewer-CF-OpSo0.js","assets/MacLocalControl-v51B79TD.js","assets/BrowserPanel-CGq-8k9k.js","assets/BrowserProfilesManager-N5zHMoeH.js","assets/minimize-lhY0HYEB.js","assets/file-up-Gm3ZlE_0.js","assets/FilesView-BS2JAg48.js","assets/InspectorPanel-BT3llt3b.js","assets/KeyboardShortcutsModal-L8FD783r.js","assets/LocalVmWorkspace-v7UlCW9t.js","assets/NewBotDialog-FgTNwkT5.js","assets/team-share-By8wCeng.js","assets/PluginsPanel-BROkmoVw.js","assets/RemoteAgentSettingsPanel-BdJpTB-X.js","assets/RoomPanel-BltzAc2X.js","assets/remote-desktop-panel-ipZYKPLT.js","assets/calendar-days-Cj-W81bu.js","assets/TriggersPage-By978rcW.js","assets/SettingsModal-B5Fjq814.js","assets/index-tkGe0e3F.js","assets/TeamMapPage-DjqBIDae.js","assets/CloudAddDialog-DIm-M9CF.js","assets/PhoneAppDialog-BAqdCsuh.js","assets/ShareTeamDialog-BrYsQ1YB.js","assets/GrokMoveDialog-kG0ReJlG.js","assets/import-name-1v6bgYwg.js","assets/TeamLibraryPanel-C3YIy7_M.js","assets/MarkdownFilePreview-B2U1b00V.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/scss-D5BDwBP9.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-DddhVWhK.js","assets/c-BIGW1oBm.js","assets/ruby-Ct1eTYOr.js","assets/sql-CRqJ_cUM.js","assets/graphql-ChdNCCLP.js","assets/typescript-BPQ3VLAy.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/bash-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Csjmro_R.js","assets/json-Cp-IABpG.js","assets/core-CcNJeiz-.js","assets/mermaid.core-CnUFOtXD.js","assets/step-CkmJJ7wq.js","assets/index-DjRLXqpq.js","assets/katex-HP8lGamR.js","assets/katex-BYZTj3zW.css","assets/embed-DIxSrDga.js","assets/linear-ChbPfC31.js","assets/init-Dmth1JHB.js","assets/defaultLocale-CzDG__Ur.js","assets/time-CZ0C3Dvk.js","assets/range-OtVwhkKS.js","assets/ordinal-BeghXfj9.js","assets/colors-Cc3OSVma.js","assets/arc-UbyzOkqk.js","assets/index-DVBvMn51.js"])))=>i.map(i=>d[i]);
2
+ import{c as le,r as f,av as Al,t as l,p as Ot,bp as Tr,K as ot,S as Cn,d as Ru,J as Qe,j as r,_ as _e,a as I,aj as kt,f as Ie,e as br,o as Lt,X as Ae,i as dt,bq as jq,b as rt,br as Nq,bs as _d,am as et,bt as T7,n as hf,bu as qv,ai as ca,bv as Sq,C as da,bw as Lg,bx as Iq,by as Cq,bz as _7,b3 as Gl,g as yr,bA as M7,bB as Eq,bC as Aq,b4 as Tq,W as Ys,u as ni,bn as di,bD as R7,bh as Uv,bE as _q,bF as Mq,bG as O7,bH as Rq,bI as Oq,ax as zq,aw as Lq,aa as z7,N as Pq,L as Hv,bJ as Dq,bK as $q,h as Wv,al as Kv,bL as P5,bM as Bq,bj as L7,bN as Fq,bi as Zb,at as qq,bO as Uq,b6 as xf,V as Hq,bP as Wq,aM as Kq,bQ as Vq,bR as Gq,aO as Yq,$ as Jq,bS as Zq,bT as Xq,an as Qq,ac as eU,ae as tU,U as Pg,T as nU,bU as sU,k as D5,bV as rU,bW as aU,bX as iU,b7 as oU,l as lU,bY as cU,aV as P7,bZ as dU,b_ as uU,b0 as pU,b$ as mU,c0 as fU,v as D7,c1 as hU,w as $7,c2 as xU,c3 as gU,s as bU}from"./styles-BYp3glRK.js";import{n as Xb,r as oo,i as yU,E as ua,d as si,S as Qb,e as Jh,p as ui,f as kU,g as vU,c as wU,l as jU,h as NU,j as SU,u as IU,k as B7,m as CU,q as EU,s as Vv,P as AU,t as TU,D as $5,v as _U,w as MU,x as Zh,y as F7,z as to,A as RU,B as OU,F as zU}from"./index-BEBI8eA5.js";import{ar as LU,as as PU,$ as Dg,ad as qa,at as Xh,au as Gv,r as Ke,av as q7,aw as U7,ax as DU,K as Js,ay as Qh,B as Ge,L as ye,x as ba,C as fn,y as ms,J as Vs,az as $U,N as BU,aA as FU,aB as qU,aC as H7,aD as gf,aE as W7,aF as Yv,aG as UU,aH as HU,P as An,aI as WU,aJ as KU,aK as VU,Q as GU,aL as YU,aM as JU,aN as B5,aO as ZU,aP as Md,aQ as XU,aR as Sn,aS as QU,aT as Rr,aU as Ti,b as eH,aV as $g,aW as vp,aX as F5,a6 as tH,a7 as q5,a5 as nH,a4 as U5,aY as Wo,aZ as Jv,a_ as lo,a$ as bf,b0 as K7,b1 as V7,M as Jt,b2 as Yl,b3 as Ou,ak as co,b4 as Vt,b5 as e0,b6 as cd,b7 as Im,b8 as yf,b9 as Cm,ba as Rd,bb as Ws,bc as Xo,bd as sH,be as Ua,bf as rH,E as fs,c as G7,k as qc,s as Is,X as pi,O as aH,V as ex,d as qn,bg as iH,bh as oH,bi as lH,bj as Bg,A as cH,Y as uo,bk as Ha,bl as Y7,bm as J7,bn as jn,bo as dH,bp as uH,bq as pH,br as tx,g as mH,j as Jl,bs as fH,u as Zv,f as hH,_ as Bi,w as Xv,bt as kf,o as Z7,bu as xH,bv as gH,v as bH,R as yH,bw as kH,bx as vH,by as X7,W as wH,bz as jH,bA as NH,bB as SH,bC as IH,bD as Od,D as CH,bE as EH,bF as AH,bG as TH,i as _H,bH as MH}from"./PlacesRail-msEDHUXY.js";import{M as po}from"./monitor-DagRnmYm.js";import{R as zt,a as us,C as at,u as mo,K as RH,S as OH}from"./MenuMotion-BjmjRIR3.js";const zH=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Qv=le("activity",zH);const LH=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Zl=le("app-window",LH);const PH=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],DH=le("archive-restore",PH);const $H=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Tl=le("archive",$H);const BH=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Q7=le("arrow-down-to-line",BH);const FH=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_l=le("arrow-down",FH);const qH=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],UH=le("arrow-left-right",qH);const HH=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],WH=le("arrow-left",HH);const KH=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],Xl=le("arrow-right-left",KH);const VH=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],nx=le("arrow-right",VH);const GH=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],zs=le("arrow-up-right",GH);const YH=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],mi=le("arrow-up",YH);const JH=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],eE=le("at-sign",JH);const ZH=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],XH=le("atom",ZH);const QH=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],eW=le("award",QH);const tW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M13.916 2.314A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.74 7.327A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673 9 9 0 0 1-.585-.665",key:"1tip0g"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]],vf=le("bell-dot",tW);const nW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],sW=le("bell-off",nW);const rW=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ew=le("bell",rW);const aW=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],tE=le("blocks",aW);const iW=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],tw=le("book-open",iW);const oW=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],lW=le("book",oW);const cW=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]],dW=le("bookmark-plus",cW);const uW=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],nw=le("bot",uW);const pW=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],nE=le("box",pW);const mW=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],fW=le("brain",mW);const hW=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],xW=le("briefcase",hW);const gW=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],sx=le("bug",gW);const bW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],yW=le("calendar-check",bW);const kW=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],wf=le("calendar-clock",kW);const vW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],sE=le("calendar",vW);const wW=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],jW=le("chart-column",wW);const NW=[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]],rE=le("chart-no-axes-combined",NW);const SW=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],jf=le("check-check",SW);const IW=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],fi=le("chevron-up",IW);const CW=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],EW=le("chevrons-up-down",CW);const AW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],wr=le("circle-alert",AW);const TW=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_W=le("circle-check-big",TW);const MW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ea=le("circle-check",MW);const RW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],OW=le("circle-dot",RW);const zW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sw=le("circle-question-mark",zW);const LW=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aE=le("circle-user-round",LW);const PW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rw=le("circle-x",PW);const DW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aw=le("circle",DW);const $W=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],Em=le("clipboard-copy",$W);const BW=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],FW=le("clipboard-list",BW);const qW=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],UW=le("clipboard-paste",qW);const HW=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zu=le("clock-3",HW);const WW=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Lu=le("clock",WW);const KW=[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]],iE=le("cloud-alert",KW);const VW=[["path",{d:"m17 15-5.5 5.5L9 18",key:"15q87x"}],["path",{d:"M5 17.743A7 7 0 1 1 15.71 10h1.79a4.5 4.5 0 0 1 1.5 8.742",key:"9ho6ki"}]],GW=le("cloud-check",VW);const YW=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]],oE=le("cloud-off",YW);const JW=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ZW=le("code-xml",JW);const XW=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lE=le("code",XW);const QW=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],eK=le("compass",QW);const tK=[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]],nK=le("contact",tK);const sK=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],t0=le("corner-down-right",sK);const rK=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],cE=le("corner-up-left",rK);const aK=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],iK=le("cpu",aK);const oK=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],H5=le("credit-card",oK);const lK=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],iw=le("crosshair",lK);const cK=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],pa=le("crown",cK);const dK=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],uK=le("database",dK);const pK=[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]],ow=le("dot",pK);const mK=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ft=le("download",mK);const fK=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],hK=le("ellipsis-vertical",fK);const xK=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],lw=le("eye-off",xK);const gK=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ur=le("eye",gK);const bK=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],yK=le("file-pen",bK);const kK=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],no=le("file-text",kK);const vK=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Nf=le("file",vK);const wK=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],jK=le("film",wK);const NK=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],SK=le("fingerprint",NK);const IK=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],CK=le("flask-conical",IK);const EK=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],dE=le("folder-input",EK);const AK=[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],uE=le("folder-minus",AK);const TK=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Hr=le("folder-open",TK);const _K=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Zr=le("folder-plus",_K);const MK=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Sf=le("folder",MK);const RK=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Pu=le("gauge",RK);const OK=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],pE=le("gift",OK);const zK=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],LK=le("git-branch",zK);const PK=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],DK=le("git-commit-horizontal",PK);const $K=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],mE=le("git-pull-request",$K);const BK=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],FK=le("github",BK);const qK=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ma=le("globe",qK);const UK=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],fE=le("graduation-cap",UK);const HK=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],WK=le("grip-vertical",HK);const KK=[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]],VK=le("hand-helping",KK);const GK=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],cw=le("hand",GK);const YK=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],JK=le("hash",YK);const ZK=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],XK=le("history",ZK);const QK=[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]],eV=le("id-card",QK);const tV=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],zd=le("image-off",tV);const nV=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],sV=le("image-plus",nV);const rV=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ld=le("image",rV);const aV=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]],iV=le("images",aV);const oV=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Pd=le("inbox",oV);const lV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],hi=le("info",lV);const cV=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],es=le("key-round",cV);const dV=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],hE=le("layers",dV);const uV=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],pV=le("layout-grid",uV);const mV=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fV=le("layout-dashboard",mV);const hV=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],xV=le("layout-template",hV);const gV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],xE=le("life-buoy",gV);const bV=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],dw=le("lightbulb",bV);const yV=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],gE=le("link-2",yV);const kV=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],bE=le("link-2-off",kV);const vV=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wV=le("link",vV);const jV=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Du=le("list-checks",jV);const NV=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],Wa=le("lock-keyhole",NV);const SV=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],zr=le("log-in",SV);const IV=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ql=le("mail",IV);const CV=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],EV=le("map-pin",CV);const AV=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],TV=le("map",AV);const _V=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Dd=le("maximize-2",_V);const MV=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],RV=le("megaphone",MV);const OV=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],zV=le("menu",OV);const LV=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],PV=le("merge",LV);const DV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],$V=le("message-square-plus",DV);const BV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],FV=le("message-square-text",BV);const qV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],UV=le("message-square",qV);const HV=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],uw=le("messages-square",HV);const WV=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],rx=le("mic",WV);const KV=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],yE=le("mic-off",KV);const VV=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],GV=le("minimize-2",VV);const YV=[["path",{d:"M5 12h14",key:"1ays0h"}]],ax=le("minus",YV);const JV=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],ZV=le("music",JV);const XV=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],QV=le("network",XV);const eG=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],pw=le("newspaper",eG);const tG=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],nG=le("notebook-pen",tG);const sG=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]],rG=le("notebook",sG);const aG=[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]],kE=le("package-open",aG);const iG=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],vE=le("paperclip",iG);const oG=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],lG=le("party-popper",oG);const cG=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],mw=le("pause",cG);const dG=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],uG=le("pencil-line",dG);const pG=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],mr=le("pencil",pG);const mG=[["path",{d:"M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272",key:"1wngk7"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473",key:"10hv5p"}]],Ml=le("phone-off",mG);const fG=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],$r=le("phone",fG);const hG=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],kr=le("pin-off",hG);const xG=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Pn=le("pin",xG);const gG=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ix=le("play",gG);const bG=[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],W5=le("plug-zap",bG);const yG=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],wE=le("plug",yG);const kG=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ox=le("puzzle",kG);const vG=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],jE=le("quote",vG);const wG=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],jG=le("repeat",wG);const NG=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],lx=le("reply",NG);const SG=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],IG=le("rocket",SG);const CG=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],jr=le("rotate-ccw",CG);const EG=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],fw=le("rotate-cw",EG);const AG=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$u=le("settings",AG);const TG=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],NE=le("share-2",TG);const _G=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],hw=le("share",_G);const MG=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],RG=le("shield-alert",MG);const OG=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],cx=le("shield-check",OG);const zG=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],SE=le("sliders-horizontal",zG);const LG=[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]],PG=le("smile-plus",LG);const DG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]],$G=le("sparkle",DG);const BG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ts=le("sparkles",BG);const FG=[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]],qG=le("split",FG);const UG=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],HG=le("square-code",UG);const WG=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]],KG=le("square-menu",WG);const VG=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ta=le("square-pen",VG);const GG=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],n0=le("square-terminal",GG);const YG=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ya=le("square",YG);const JG=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$d=le("star",JG);const ZG=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],IE=le("table-2",ZG);const XG=[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],QG=le("tablet-smartphone",XG);const eY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],xw=le("target",eY);const tY=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],nY=le("text-quote",tY);const sY=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],vn=le("trash-2",sY);const rY=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ts=le("triangle-alert",rY);const aY=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],CE=le("undo-2",aY);const iY=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],EE=le("upload",iY);const oY=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],lY=le("user-plus",oY);const cY=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],dY=le("user",cY);const uY=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],gw=le("users-round",uY);const pY=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Tn=le("users",pY);const mY=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],bw=le("volume-2",mY);const fY=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],hY=le("wallet",fY);const xY=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],gY=le("wand-sparkles",xY);const bY=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],yY=le("webhook",bY);const kY=[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],Bd=le("wrap-text",kY);const vY=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],AE=le("wrench",vY);const wY=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],fa=le("zap",wY);const jY=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],NY=le("zoom-in",jY);function K5(e){return LU(PU,e)}const SY="Shared chat",TE=["none","low","medium","high","xhigh","max"];function OLe(e){return typeof e=="string"&&TE.includes(e)}const _E=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral","silver","chrome"],zLe=/^[a-z0-9][a-z0-9_-]{0,80}$/,ME=/^[A-Z][A-Z0-9_]{0,127}$/,IY=e=>e.helperModel===void 0||e.helperModel===!0,CY="Historical excerpts in chronological order; newer corrections override older requests. These excerpts may omit earlier details.",Uc=e=>e.role==="user"?!e.peerAsk:e.kind==="text"&&(e.turnTerminal===!0||!e.turnId);function Br(e){return e.map((t,n)=>({task:t,index:n})).sort((t,n)=>{const s=+(n.task.pinned===!0)-+(t.task.pinned===!0);if(s)return s;const a=(n.task.lastThreadOrderAt??n.task.createdAt??0)-(t.task.lastThreadOrderAt??t.task.createdAt??0);return a||t.index-n.index}).map(t=>t.task)}const dx=(e,t=Date.now())=>e.snoozedUntil!==void 0&&(e.snoozedUntil===0||e.snoozedUntil>t),EY="x-omb-background",AY="x-omb-cloud-power",TY="/api/auth/session",s0=new Set;let Fd=!1,r0=null;function Da(){return Fd}function ux(e){return s0.add(e),()=>{s0.delete(e)}}function RE(e){if(Fd!==e){Fd=e;for(const t of s0)t(e)}}function yw(){Fd&&(fetch(TY).catch(()=>{}),r0?.(),r0=null,RE(!1))}function OE(e=globalThis.window){if(Fd||(RE(!0),!e))return;const t=()=>yw(),n=["pointerdown","keydown","focus","touchstart"];for(const s of n)e.addEventListener(s,t,{capture:!0});r0=()=>{for(const s of n)e.removeEventListener(s,t,{capture:!0})}}function a0(){return typeof document<"u"&&document.visibilityState==="hidden"}function _Y(e){return a0()?new Promise((t,n)=>{const s=()=>{document.removeEventListener("visibilitychange",a),e?.removeEventListener("abort",i)},a=()=>{a0()||(s(),t())},i=()=>{s(),n(e?.reason??new DOMException("The request was aborted.","AbortError"))};if(e?.aborted){i();return}document.addEventListener("visibilitychange",a),e?.addEventListener("abort",i,{once:!0})}):Promise.resolve()}function MY(e){return e.status===503&&e.headers.get(AY)==="asleep"}function RY(e){return e.kind==="power"&&e.state==="sleeping"}const V5=new Set;function zE(e){const t=Object(e);return t.status===403&&typeof t.message=="string"&&t.message.includes("lacks the admin scope")}async function If(e,t,n){if(V5.has(e))return n;try{return await t()}catch(s){if(!zE(s))throw s;return V5.add(e),n}}const OY="bot_limit",zY="bot_paused";function LE(e){return e.filter(t=>!t.defaultBot&&!t.hidden&&!t.movedTo).length}let i0=null,o0=null;const l0=new Set;function kw(e,t=null){if(!(i0===e&&o0===t)){i0=e,o0=t;for(const n of l0)n()}}const LY=()=>i0,PY=()=>o0,qd=(e="bots")=>kw(e),DY=e=>kw("created",e),$Y=()=>kw(null),PE=e=>(l0.add(e),()=>{l0.delete(e)});function BY(){return f.useSyncExternalStore(PE,LY)}function FY(){return f.useSyncExternalStore(PE,PY)}function qY(e,t){const n=t?.refusedAt;return e===null||n===void 0||n===e?{seen:e===null?n:e,show:null}:{seen:n,show:t?.refused??"tasks"}}function UY(e){return e.filter(t=>LE([t])===1&&!t.chiefOfStaff)}function DE(e){const t=e.config?.botLimit;return t===void 0?null:Math.max(0,t-LE(e.bots))}function G5(e){return DE(e)!==0?!1:(qd(),!0)}function $E(e){return e?.body?.code===OY}function HY(e){return e?.body?.code===zY}class hn extends Error{status;body;constructor(t,n,s){super(t),this.name="ApiError",this.status=n,this.body=s}}const wp=new Map;async function K(e,t){const{timeoutMs:n,signal:s,background:a,headers:i,...o}=t??{};if(a&&a0())return WY(e,t);if(Da()){if(a)throw new hn("My Cloud is asleep",503,{error:"asleep"});yw()}const c=new Headers(i??{"content-type":"application/json"});a&&c.set(EY,"1");const d=await fetch(e,{...o,headers:c,signal:n===void 0?s:s?AbortSignal.any([s,AbortSignal.timeout(n)]):AbortSignal.timeout(n)});MY(d)&&OE();const u=await d.json().catch(()=>({}));if(!d.ok){const p=u?.error,m=typeof p=="string"?p:typeof p?.message=="string"?p.message:`${d.status} ${d.statusText}`,h=new hn(Al(u,m),d.status,u);throw(d.status===401||d.status===403&&!zE(h))&&Xb(),d.status===409&&$E(h)&&qd(),d.status===409&&HY(h)&&qd("paused"),h}return u}function WY(e,t){const n=(t.method??"GET").toUpperCase()==="GET"&&!t.signal,s=n?wp.get(e):void 0;if(s)return s;const a=_Y(t.signal??void 0).then(()=>K(e,t));return n&&(wp.set(e,a),a.finally(()=>{wp.get(e)===a&&wp.delete(e)}).catch(()=>{})),a}function jp(e,...t){for(const n of t)if(!Array.isArray(e[n]))throw new Error(`Invalid snapshot: ${String(n)} is not a list`);return e}const Y5=[2e3,5e3,15e3,3e4];function KY(e,t){const n=s=>{t().catch(()=>{e()&&setTimeout(()=>n(s+1),Y5[Math.min(s,Y5.length-1)])})};n(0)}function VY(e,t){const n=new Map(t.map((o,c)=>[o,c])),s=[];e.forEach((o,c)=>{n.has(o.id)&&s.push(c)});const a=s.map(o=>e[o]).sort((o,c)=>n.get(o.id)-n.get(c.id)),i=[...e];return s.forEach((o,c)=>{i[o]=a[c]}),i}const GY=e=>e.trim().toLowerCase();function Lr(e){const t=e.defaultBot?.person?.trim()||e.reportsTo?.trim()||e.createdBy?.trim();return t?GY(t):null}function Rl(e){const t=Lr(e);return t?`owner:${t}`:`section:${e.section?.trim()||""}`}function J5(e,t){const n=Rl(t);return e.map(s=>s.id===t.id||!s.chiefOfStaff||Rl(s)!==n?s:{...s,chiefOfStaff:!1})}function vw(e){const t=e.trim();return t.includes("@")?px(t):t}function px(e){return(e.split("@")[0]?.replace(/[._-]+/g," ").trim()||e).replace(new RegExp("(^|\\s)(\\p{L})","gu"),(n,s,a)=>`${s}${a.toUpperCase()}`)}const Np={pageSize:1024,chartMaxMarks:1e4},BE={sheet:e=>`/api/bots/${encodeURIComponent(e)}/data`,page:e=>`/api/bots/${encodeURIComponent(e)}/data/page`,run:e=>`/api/bots/${encodeURIComponent(e)}/data/run`,cancel:e=>`/api/bots/${encodeURIComponent(e)}/data/cancel`,card:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/cards/${encodeURIComponent(t)}`,stats:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/tables/${encodeURIComponent(t)}/stats`,histogram:(e,t,n)=>`/api/bots/${encodeURIComponent(e)}/data/tables/${encodeURIComponent(t)}/histogram?column=${encodeURIComponent(n)}`,export:e=>`/api/bots/${encodeURIComponent(e)}/data/export`,image:(e,t)=>`/api/bots/${encodeURIComponent(e)}/data/cards/${encodeURIComponent(t)}/image`},Z5=500,YY=new Set(["notificationsHydrated","notificationReceived","notificationRead","notificationsRead","notificationsMarkAllRead"]);function JY(e){return YY.has(e.type)}function ZY(e,t){switch(t.type){case"notificationsHydrated":{const n=new Set(t.notifications.map(s=>s.id));return[...e.filter(s=>!n.has(s.id)),...t.notifications].sort((s,a)=>a.at-s.at).slice(0,Z5)}case"notificationReceived":return e.some(n=>n.id===t.entry.id)?e:[t.entry,...e].slice(0,Z5);case"notificationRead":return e.map(n=>n.id===t.id&&!n.read?{...n,read:!0}:n);case"notificationsRead":{const n=new Set(t.ids);return e.map(s=>n.has(s.id)&&!s.read?{...s,read:!0}:s)}case"notificationsMarkAllRead":return e.map(n=>n.read?n:{...n,read:!0})}}function Am(e,t){if(!t)return e;const n=new Map((e??[]).map(s=>[s.threadId,s]));return t.map(s=>{const a=n.get(s.threadId);if(!a)return s;const i=a.updatedAt===void 0?s.updatedAt:Math.max(a.updatedAt,s.updatedAt??0),o=a.lastThreadOrderAt===void 0?s.lastThreadOrderAt:Math.max(a.lastThreadOrderAt,s.lastThreadOrderAt??0);return i===s.updatedAt&&o===s.lastThreadOrderAt?s:{...s,updatedAt:i,lastThreadOrderAt:o}})}function Sa(e,t,n,s=!1,a=n){if(!Number.isFinite(n))return e;const i=o=>o?.some(c=>c.threadId===t)?o.map(c=>c.threadId===t?{...c,updatedAt:Math.max(c.updatedAt??0,n),...s?{lastThreadOrderAt:Math.max(c.lastThreadOrderAt??0,a)}:{}}:c):o;return{...e,bots:e.bots.map(o=>{const c=i(o.tasks);return c===o.tasks?o:{...o,tasks:c}}),groups:e.groups.map(o=>{const c=i(o.tasks);return c===o.tasks?o:{...o,tasks:c}})}}function X5(e,t,n,s,a=s){const i=n.reduce((d,u)=>Math.max(d,u.at||0),s),o=n.reduce((d,u)=>Uc(u)?Math.max(d,u.turnCompletedAt??u.at??0):d,a),c=d=>d?.map(u=>u.threadId===t?{...u,updatedAt:i,lastThreadOrderAt:o}:u);return{...e,bots:e.bots.map(d=>d.tasks?.some(u=>u.threadId===t)?{...d,tasks:c(d.tasks)}:d),groups:e.groups.map(d=>d.tasks?.some(u=>u.threadId===t)?{...d,tasks:c(d.tasks)}:d)}}const Cf="omb-notification-sounds",Ef="omb-notification-feed",Af="omb-finished-notifications",c0="omb-notification-tray-pinned";let Ud,Hd,Wd;const Hc=new Set;function Fr(){try{return globalThis.localStorage}catch{return}}function FE(){if(Ud!==void 0)return Ud;try{return Fr()?.getItem(Cf)!=="0"}catch{return!0}}function mx(){for(const e of Hc)e()}function Q5(e){e.key!==Cf&&e.key!==Ef&&e.key!==Af&&e.key!==null||e.storageArea&&e.storageArea!==Fr()||(Ud=void 0,Hd=void 0,Wd=void 0,mx())}function ww(e){return Hc.add(e),Hc.size===1&&typeof window<"u"&&window.addEventListener("storage",Q5),()=>{Hc.delete(e),Hc.size===0&&typeof window<"u"&&window.removeEventListener("storage",Q5)}}function LLe(e){Ud=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Cf,n),t?.getItem(Cf)===n&&(Ud=void 0)}catch{}mx()}function PLe(){return f.useSyncExternalStore(ww,FE,()=>!0)}function XY(){if(Hd!==void 0)return Hd;try{return Fr()?.getItem(Ef)==="1"}catch{return!1}}function DLe(e){Hd=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Ef,n),t?.getItem(Ef)===n&&(Hd=void 0)}catch{}mx()}function QY(){return f.useSyncExternalStore(ww,XY,()=>!1)}function qE(){if(Wd!==void 0)return Wd;try{return Fr()?.getItem(Af)!=="0"}catch{return!0}}function $Le(e){Wd=e;try{const t=Fr(),n=e?"1":"0";t?.setItem(Af,n),t?.getItem(Af)===n&&(Wd=void 0)}catch{}mx()}function BLe(){return f.useSyncExternalStore(ww,qE,()=>!0)}function eJ(){try{return Fr()?.getItem(c0)==="1"}catch{return!1}}function tJ(e){try{e?Fr()?.setItem(c0,"1"):Fr()?.removeItem(c0)}catch{}}let As=null;const Tf=new Set;function nJ(e){Tf.add(e)}function Qo(e){As=e;for(const t of Tf)t()}function xi(){return As}function sJ(e,t){As?.teamId===e&&!As.opened?.includes(t)&&Qo({...As,opened:[...As.opened??[],t]})}const UE=e=>!!(e&&As?.opened?.includes(e)),rJ=e=>e.private===!0&&!e.routineRunId&&!e.openedBy&&!e.archivedAt&&!e.closedBy,aJ=e=>[...e].sort((t,n)=>(n.updatedAt??n.createdAt??0)-(t.updatedAt??t.createdAt??0))[0];function HE(e,t){const n=(e.tasks??[]).filter(rJ),s=new Set(t.opened??[]),a=t.member?n:n.filter(i=>s.has(i.threadId));return(n.find(i=>i.inbox===!0)??aJ(a))?.threadId??null}const Fg=new Set;function WE(e,t,n){const s=As;if(!s)return!1;if(s.opened===void 0){const i=()=>{As&&As.opened===void 0||(Tf.delete(i),As&&WE(e,t,n))};return Tf.add(i),!0}const a=HE(t,s);return a?(n(a),!0):t.yourAccess==="view"?!1:(Fg.has(t.id)||(Fg.add(t.id),K(`/api/bots/${t.id}/tasks`,{method:"POST",body:"{}"}).then(i=>{typeof i?.task?.threadId=="string"&&sJ(s.teamId,i.task.threadId),i?.bot&&(e({type:"taskSwitched",bot:i.bot}),e({type:"select",id:t.id}))}).catch(i=>e({type:"error",message:i instanceof Error?i.message:String(i)})).finally(()=>Fg.delete(t.id))),!0)}function KE(e){const t=e?.team;return typeof t?.id=="string"&&t.id?{id:t.id}:null}const VE=(e,t)=>({teamId:e,member:!t.scopes.includes("admin"),opened:t.openedThreads??[],...t.email?.trim()?{person:t.email.trim().toLowerCase()}:{}});function iJ(){const e=As?.teamId;e&&oo().then(t=>{As?.teamId===e&&t.kind==="session"&&Qo(VE(e,t))}).catch(()=>{})}function oJ(e){const t=KE(e)?.id??null;f.useEffect(()=>{if(!t){Qo(null);return}Qo({teamId:t,member:!1});let n=!0;return oo().then(s=>{n&&Qo(s.kind==="session"?VE(t,s):{teamId:t,member:!1,opened:[]})}).catch(()=>{n&&Qo({teamId:t,member:!1,opened:[]})}),()=>{n=!1}},[t])}function fx(e,t){if(e.defaultBot?.person)return"me";const n=e.tasks?.find(s=>s.threadId===t);return n?.sharedChat!==!0&&(n?.private===!0||UE(t))?"me":"team"}const GE=e=>e.defaultBot?.person?null:e.tasks?.find(t=>t.sharedChat===!0&&t.private!==!0)?.threadId??null,jw=(e,t)=>(e.tasks??[]).filter(n=>fx(e,n.threadId)===t);function lJ(e,t,n){return n==="team"?GE(e)!==null:!!e.defaultBot?.person||e.yourAccess!=="view"||HE(e,t)!==null}function cJ(e,t){const n=fx(e,e.threadId)===t,s=jw(e,t),a=n?{}:{busy:!1,activity:void 0,waitingForTeammates:!1,...e.messages?{messages:[]}:{}};return{...e,tasks:e.tasks&&s,unread:s.some(YE),...a}}const YE=e=>!!e.unread&&!e.routineRunId&&e.archivedAt===void 0;function Nw(e,t,n,s){if(!n)return{switchable:!1,bots:e,groups:t,unread:{me:!1,team:!1}};const a=e.filter(m=>!m.hidden),i=m=>a.filter(h=>lJ(h,n,m)),o=i("me"),c=i("team"),d=o.length>0&&c.length+t.length>0,u=m=>a.some(h=>jw(h,m).some(YE))||m==="team"&&t.some(h=>!!h.unread),p={me:u("me"),team:u("team")};return d?{switchable:d,bots:(s==="me"?o:c).map(m=>cJ(m,s)),groups:s==="team"?t:[],unread:p}:{switchable:d,bots:e,groups:t,unread:p}}const Sw=()=>typeof localStorage>"u"?null:localStorage,JE=e=>e.person?`omb.team-side.${e.teamId}.${e.person}`:null;let Ol=null,d0=0;const u0=new Set,Iw=()=>{d0++;for(const e of u0)e()},hx=e=>`${e.teamId}:${e.person??""}`;nJ(()=>{const e=xi();(!e||hx(e)!==Ol?.page)&&(Ol=null),Iw()});function ZE(e=xi(),t=Sw()){const n=e&&JE(e);try{if(n&&t)return t.getItem(n)==="team"?"team":"me"}catch{}return"me"}function Bu(e=xi(),t=Sw()){return e?Ol?.page===hx(e)?Ol.side:ZE(e,t):"me"}function dJ(e,t=xi()){!t||Bu(t)===e||(Ol={page:hx(t),side:e},Iw())}function XE(e,t=xi(),n=Sw()){if(!t)return;const s=JE(t),a=Bu(t,n)!==e;try{s&&n&&ZE(t,n)!==e&&n.setItem(s,e)}catch{}a&&(Ol={page:hx(t),side:e},Iw())}function xx(){f.useSyncExternalStore(t=>(u0.add(t),()=>{u0.delete(t)}),()=>d0,()=>d0);const e=xi();return{team:e,side:Bu(e)}}function uJ(e,t){return t&&Bu(t)==="team"?GE(e):null}function pJ(e){return e.activeView!=="chat"?null:e.bots.find(t=>t.id===e.selectedId)?.threadId??e.groups.find(t=>t.id===e.selectedId)?.threadId??null}function fo(e,t){return!t&&e.mainThreadId&&e.tasks?.some(n=>n.threadId===e.mainThreadId)?e.mainThreadId:e.threadId}function QE(e,t){return!t&&fo(e,!1)!==e.threadId}function qt(e,t,n){const s=uJ(t,xi());if(s)return Fi(e,t,s,n);if(WE(e,t,i=>Fi(e,t,i,n)))return;const a=fo(t,n);a===t.threadId?e({type:"select",id:t.id}):Fi(e,t,a,n)}const mJ=e=>e.routineRunId?null:e.activity==="waiting-on-you"?0:e.archivedAt!==void 0?null:e.unread?1:e.busy||e.activity==="working"?2:null;function fJ(e,t){const n=fo(e,t),s=i=>i.updatedAt??i.createdAt??0;return(e.tasks??[]).flatMap(i=>{const o=mJ(i);return o===null?[]:[{task:i,rank:o}]}).sort((i,o)=>i.rank-o.rank||+(o.task.threadId===n)-+(i.task.threadId===n)||s(o.task)-s(i.task))[0]?.task.threadId??null}function Kd(e,t,n,s){const a=xi()?null:fJ(t,n);!a||a===fo(t,n)||s&&a===t.threadId?qt(e,t,n):Fi(e,t,a,n)}function Fi(e,t,n,s){(s||n===t.threadId)&&e({type:"select",id:t.id}),e({type:"switchTask",botId:t.id,threadId:n})}function eA(e,t,n){e({type:"select",id:t.groupId});const s=n.find(a=>a.id===t.groupId);t.threadId&&s?.tasks?.some(a=>a.threadId===t.threadId)&&e({type:"switchGroupTask",groupId:t.groupId,threadId:t.threadId})}function xn(e,t,n,s){const a=d=>d.threadId===t.threadId||(d.tasks??[]).some(u=>u.threadId===t.threadId),i=n.groups.find(a),o=i?void 0:n.bots.find(a),c=n.bots.find(d=>d.id===t.botId);return i?(e({type:"select",id:i.id}),i.threadId!==t.threadId&&e({type:"switchGroupTask",groupId:i.id,threadId:t.threadId})):o?Fi(e,o,t.threadId,s):c&&qt(e,c,s),e({type:"revealThread",threadId:t.threadId}),i||o?!0:(e({type:"notice",notice:{kind:"thread-gone",botName:c?.name??null}}),!1)}function Ko(e){return e.notificationsOpen&&!e.notificationsPinned?{...e,notificationsOpen:!1}:e}function e4(e,t,n){const s=[...e.bots,...e.groups].find(o=>o.id===t),a=s&&"switchingTo"in s?s.switchingTo??s.threadId:s?.threadId;return e.activeView==="chat"&&t===e.selectedId&&a===n?e:Ko(e)}function hJ(e){return eJ()?{...e,notificationsPinned:!0}:e}function Sp(e,t,n,s){return{...e,groups:e.groups.map(a=>a.id!==t?a:{...a,tasks:(a.tasks??[]).map(i=>i.threadId===n?{...i,...s}:i)})}}const cl=e=>`optimistic-${e}`;function qg(e,t,n,s,a){return{id:cl(t),role:"user",kind:"text",text:e,at:Date.now(),parentId:s??null,replyToId:n,sendId:t,channelMode:a}}function xJ(e,t){return!!e?.some(n=>n.sendId===t&&n.id!==cl(t))}const gJ=[1e3,3e3];async function bJ(e,t,n=s=>new Promise(a=>setTimeout(a,s))){for(let s=0;;s++)try{return{body:await e()}}catch(a){if(!(!(a instanceof hn)&&a?.name!=="AbortError"))throw a;if(t())return{arrived:!0};const o=gJ[s];if(o===void 0)throw a;if(await n(o),t())return{arrived:!0}}}function yJ({threadId:e,pinnedCwd:t,pinnedMessageId:n,usage:s,memberContext:a,busyBotId:i,turnStartedAt:o,...c}){return{...c,section:c.section}}function kJ(e,t,n){const s=new Set(n.map(d=>d.id)),a=new Set(n.flatMap(d=>d.sendId?[d.sendId]:[])),i=new Map(e.filter(d=>!t.has(d)).map(d=>[d.id,d])),o=e.findIndex(d=>s.has(d.id)),c=e.filter((d,u)=>s.has(d.id)?!1:d.sendId&&d.id===cl(d.sendId)?!a.has(d.sendId):u>=o&&i.has(d.id));return[...n.map(d=>i.get(d.id)??d),...c]}function vJ(e,t){const n=e.find(a=>a.id===t.id),s=n&&!t.messages&&typeof t.threadId=="string"&&t.threadId!==n.threadId?yJ(t):t;return n?e.map(a=>a.id===s.id?{...a,...s,section:typeof s.threadId=="string"||Object.hasOwn(s,"section")?s.section:a.section,description:Object.hasOwn(s,"description")?s.description??void 0:a.description,tasks:s.tasks?Am(a.tasks,s.tasks):a.tasks,turnTimeoutMinutes:Object.hasOwn(s,"turnTimeoutMinutes")?s.turnTimeoutMinutes??void 0:a.turnTimeoutMinutes,messages:s.messages??a.messages,hasMore:s.messages?!!s.hasMore:a.hasMore}:a):[{...s.description===null?{...s,description:void 0}:s,messages:s.messages??[]},...e]}function wJ(e,{group:t,since:n,heldAtStart:s}){if(!t.messages||!t.threadId)return t;if((e.transcriptGeneration[t.threadId]??0)!==(n[t.threadId]??0))return null;const a=e.groups.find(i=>i.id===t.id);return a?.threadId===t.threadId?{...t,messages:kJ(a.messages,new Set(s),t.messages)}:t}function jJ(e,t){const n=new Map;return(s,a)=>{const i=(n.get(s)??0)+(a?1:0);n.set(s,i);const{transcriptGeneration:o,groups:c}=e(),d=c.find(u=>u.id===s)?.messages??[];return u=>{u?.group&&n.get(s)===i&&t({type:"groupSnapshot",group:u.group,since:o,heldAtStart:d})}}}function NJ(e,t){if("botId"in e){const o=t.bots.find(u=>u.id===e.botId);if(!o)return;const{messages:c,...d}=o;return{type:"botPatched",bot:d}}const n=t.groups?.find(o=>o.id===e.groupId);if(!n)return;const{messages:s,hasMore:a,...i}=n;return{type:"groupPatched",group:i}}const t4=new WeakMap;function Es(e){const t=e.activeLeafId;if(!t)return e.messages;const n=t4.get(e.messages);if(n?.leafId===t)return n.path;const s=new Map(e.messages.map(o=>[o.id,o]));if(!s.has(t))return e.messages;const a=[];let i=s.get(t);for(;i;)a.push(i),i=i.parentId?s.get(i.parentId):void 0;return a.reverse(),t4.set(e.messages,{leafId:t,path:a}),a}function n4(e,t,n){return e!==void 0&&(e.switchingTo!==void 0||(n[e.threadId]??0)!==(t?.[e.threadId]??0))}function tA(e,t,n){if(!n)return t;const s=new Set(t?.map(i=>i.threadId)),a=e?.filter(i=>!n.has(i.threadId)&&!s.has(i.threadId))??[];return a.length?[...t??[],...a]:t}function SJ(e,t,n,s){return!n||!e?t:{...t,threadId:e.threadId,tasks:tA(e.tasks,t.tasks,s),switchingTo:e.switchingTo,awaitingThreadSnapshot:e.awaitingThreadSnapshot,messages:e.messages,hasMore:e.hasMore,activeLeafId:e.activeLeafId,pinnedMessageId:e.pinnedMessageId}}function IJ(e,t,n,s){return!n||!e?t:{...t,threadId:e.threadId,tasks:tA(e.tasks,t.tasks,s),messages:e.messages,hasMore:e.hasMore,pinnedCwd:e.pinnedCwd,pinnedMessageId:e.pinnedMessageId,usage:e.usage,memberContext:e.memberContext,busyBotId:e.busyBotId,turnStartedAt:e.turnStartedAt}}const CJ=["ask","edits","auto","full","custom"];function Cw(e,t){return t==="custom"?e==="codex":t==="edits"?["claudeAgent","grokAgent","antigravityAgent","qwenAgent","geminiAgent"].includes(e??""):!0}function s4(e,t,n){return!Cw(n,e)||e==="custom"&&t!==n}function EJ(e){return["codex","claudeAgent","cursorAgent","grokAgent","qwenAgent"].includes(e??"")}function AJ(e){return typeof e=="string"&&CJ.includes(e)}const TJ="full";let _J=TJ;function In(e){const t=e.approvalGrant,n=t&&typeof t=="object"&&"threadOnly"in t&&t.threadOnly===!0&&"threadId"in t&&typeof t.threadId=="string"&&typeof e.threadId=="string"&&t.threadId!==e.threadId;return t&&!n?"ask":AJ(e.approvalMode)?e.approvalMode:e.autoApprove===!0?"auto":e.approvalMode===void 0?_J:"ask"}function nA(e,t){return!e||!t?e===t:e.instanceId===t.instanceId&&e.model===t.model&&e.effort===t.effort&&e.variant===t.variant}function sA(e,t){return t.filter(n=>n.followsBotModel===!1&&!nA(n.modelSelection??e,e))}const gx=f.createContext(null);function rA(e){return e==="enable"||e==="disable"||e==="delete"}function Ew(e){if(!(!e.preview||!e.sha256||!/^[a-f0-9]{64}$/i.test(e.sha256)))return e.sha256}function MJ(e){const t=e.trim().toLowerCase();return["enable","turn on","turn off","delete","update","apply","allow","allow once","confirm","yes"].includes(t)?"allow":"deny"}function RJ(e){const t={...Object.hasOwn(e,"toolScope")?{toolScope:e.toolScope}:{},...IY(e)?{}:{helperModel:!1}};return{...e.visibility&&e.visibility!=="everyone"?{visibility:e.visibility}:{},...Object.keys(t).length?{settings:t}:{}}}function OJ(e){return{name:`${e.name} copy`,title:e.title,description:e.description,soul:e.soul,notifications:e.notifications,modelSelection:e.modelSelection,computer:e.computer,cloudBackend:e.cloudBackend,autoStartVps:e.autoStartVps,vpsAlias:e.vpsAlias,avatarUrl:e.avatarUrl,avatarCrop:e.avatarCrop,avatarZoom:e.avatarZoom,avatarFocusX:e.avatarFocusX,avatarFocusY:e.avatarFocusY}}const zJ=/^\[(?:From @([^·\]]+?) \(bot\) · (message|assignment) · |(Message from|Delegated by|Thread opened by) @([^,\]]+), another bot in this OpenMausBot workspace)[^\]]*\]\s*/,LJ={message:"ask_bot",assignment:"delegate_bot","Message from":"ask_bot","Delegated by":"delegate_bot","Thread opened by":"start_thread"};function Ls(e){if(e.role!=="user")return null;const t=e.text??"",n=zJ.exec(t),s=e.peerAsk?.name??(n?.[1]??n?.[4])?.trim();return s?{botId:e.peerAsk?.botId,name:s,delivery:n&&LJ[n[2]??n[3]??""]||"ask_bot",body:n?t.slice(n[0].length):t,...e.peerAsk?.unattended?{unattended:!0}:{}}:null}function Vd(e,t){if(e.role!=="bot"||e.roomRequest?.phase!=="request")return null;const n=e.from;return!n?.name||n.botId===t?null:{botId:n.botId,name:n.name,delivery:"coordinate_bots",body:e.text??""}}const PJ=e=>e.role==="user"&&!Ls(e);function DJ(e,t){let n=-1;for(let s=e.length-1;s>=0&&n<0;s--)PJ(e[s])&&(n=s);return t&&(n=Math.max(n,e.findIndex(s=>s.id===t))),n<0?null:e[n+1]?.id??null}function aA(e,t,n,s){const a=DJ(t,n);return a?{threadId:e,messageId:a}:s?{threadId:e,messageId:null,lastReadMessageId:n}:null}function Tm(e,t,n,s){return!e||e.threadId!==t||e.messageId?e:aA(t,n,e.lastReadMessageId,s)}function r4(e){return e.tasks?.find(t=>t.threadId===e.threadId)?.lastReadMessageId}function iA(e,t){if(!t)return null;const n=e.findIndex(s=>s.id===t);return n<0?null:new Set(e.slice(n).map(s=>s.id))}function a4(e){const t=e.tasks?.find(n=>n.threadId===e.threadId);return t?.routineRunId?!1:!!(t?.unread??e.unread)}const $J=1200,oA=480,BJ=new Set(["browser","local","vm","cloud"]);function lA(e){const t=e;if(!t||typeof t!="object")return null;const{botId:n,threadId:s,messageId:a,site:i,place:o}=t;return typeof n=="string"&&typeof s=="string"&&typeof a=="string"&&typeof i=="string"&&typeof o=="string"&&BJ.has(o)?{botId:n,threadId:s,messageId:a,site:i,place:o}:null}async function FLe(e){const{action:t,syncNativeBrowser:n,requestControl:s,setNativeBrowserControl:a}=e;if(t==="take"&&n&&!await a(!0))throw new Error(l("computer.err.pauseBrowser",{app:Ot()}));const i=await s(t);if(i.held!==(t==="take"))throw new Error(l(t==="take"?"computer.err.confirmControl":"computer.err.releaseControl",{app:Ot()}));if(t==="release"&&n&&!await a(!1))throw new Error(l("computer.err.browserStillPaused"));return i}const FJ="The user closed this question without answering. Use your best judgment and continue.",i4=120,Aw=2e3;function qJ(e){return!!(e&&(e.requestType==="question"||e.questionRequest||!e.requestType&&!e.tool&&!e.routineRequest&&!e.skillRequest&&!e.profileRequest&&!e.modelRequest&&!e.teamSetupRequest))}function o4(e,t){if(typeof e!="string")return;const n=e.trim();return n?n.slice(0,t).trim():void 0}function UJ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const HJ=5;function WJ(e,t=HJ){if(!Array.isArray(e))return;const n=[],s=new Set;for(const a of e){const i=typeof a=="string"?o4(a,i4):UJ(a)?o4(a.label,i4):void 0;if(!(!i||s.has(i))&&(s.add(i),n.push(i),n.length===t))break}return n.length?n:void 0}function KJ(e){if(e.length!==1)return;const t=e[0];if(!(t.multiSelect||t.options.length<2))return t.options.map(n=>n.label)}const _f="The user answered your questions.",p0=`${_f}
3
3
 
4
4
  Answers (JSON):
5
5
  `;function Tw(e,t){const n=[];return e.forEach((s,a)=>{const i=(t[a]??[]).map(o=>o.trim()).filter(Boolean);i.length&&n.push([s.question,i.join(", ")])}),n.length?n.some(s=>s.some(a=>/[\r\n]/.test(a)))?p0+JSON.stringify(n):`${_f}
@@ -15,7 +15,7 @@ ${a(d??"")}
15
15
  `),n=n.replace(/(`+)([^`]*?)\1/g,(i,o,c)=>a(c)),n=n.replace(/!\[([^\]]*)\]\((?:[^()]|\([^)]*\))*\)/g,"$1"),n=n.replace(/!\[([^\]]*)\]\[[^\]]*\]/g,"$1"),n=n.replace(/\[([^\]]+)\]\((?:[^()]|\([^)]*\))*\)/g,"$1"),n=n.replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1"),n=n.replace(/^[ \t]{0,3}\[[^\]]+\]:[ \t]+\S+.*$/gm,""),n=n.replace(/<((?:https?|mailto):[^>\s]+)>/gi,"$1"),n=n.replace(/<br\s*\/?>/gi," "),n=n.replace(/<\/?(?:b|strong|i|em|u|s|del|ins|mark|code|kbd|sub|sup|small|span|p|div)\b[^>]*>/gi,""),n=n.replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,""),n=n.replace(/^[ \t]{0,3}#{1,6}[ \t]*$/gm,""),n=n.replace(/^[ \t]*(?:>[ \t]?)+/gm,""),n=n.replace(/^[ \t]*(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/gm,""),n=n.replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)*\|?[ \t]*$/gm,""),n=n.replace(/^[ \t]{0,3}(?:[-*_][ \t]*){3,}$/gm,""),n=n.replace(/^[ \t]*\|(.*)\|[ \t]*$/gm,(i,o)=>o.split("|").map(c=>c.trim()).filter(Boolean).join(" ")),n=n.replace(/(\*{1,3}|_{1,3})(?=\S)([\s\S]*?\S)\1(?![\p{L}\p{N}])/gu,(i,o,c,d,u)=>o[0]==="_"&&d>0&&/[\p{L}\p{N}]/u.test(u[d-1])?i:c),n=n.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),n=n.replace(/\*\*+|`{3,}|~~/g,""),n=n.replace(/\uE002(\d+)\uE003/g,(i,o)=>s[Number(o)]??""),n=n.replace(/\uE000(\d+)\uE001/g,(i,o)=>t[Number(o)]??""),n.replace(/\s+/g," ").trim()}let x0=null;function uZ(e){x0=e}async function qLe(){if(typeof Notification>"u")return null;try{return Notification.permission==="default"?await Notification.requestPermission():Notification.permission}catch{return Notification.permission}}function pZ(e){return{tag:`openmausbot:${e.id}`,icon:e.avatarUrl??void 0}}function mZ(e,t,n,s){if(typeof Notification>"u"||e.kind==="done"&&!qE())return;const a=e.kind==="spend";if(!a&&document.hasFocus()&&s===e.threadId||Notification.permission!=="granted")return;const i=x0?`${x0} · ${e.title}`:e.title,o=Yd(e.body),c={body:o,...pZ({id:e.botId,avatarUrl:n}),...a?{tag:"openmausbot:spend",icon:void 0}:{},...FE()?{}:{silent:!0}},d=()=>{new Notification(i,c).onclick=()=>{window.focus(),t({botId:e.botId,threadId:e.threadId})}},u=window.ogb?.desktopNotifications;if(!u)return d();u.show({title:i,body:o,tag:c.tag,silent:c.silent===!0,picture:c.icon,botId:e.botId,threadId:e.threadId}).then(p=>{p||d()},d)}function dr(){const e=globalThis.crypto;if(typeof e?.randomUUID=="function")return e.randomUUID();const t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let s=0;s<t.length;s+=1)t[s]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const n=Array.from(t,s=>s.toString(16).padStart(2,"0"));return`${n.slice(0,4).join("")}-${n.slice(4,6).join("")}-${n.slice(6,8).join("")}-${n.slice(8,10).join("")}-${n.slice(10).join("")}`}const fZ=/^«redacted \d+ chars»$/,Ia=e=>fZ.test(e)?e:`«redacted ${e.length} chars»`,gA=[/\bom[dg]_[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bsk-(?:ant-|proj-|live-|test-)?[A-Za-z0-9_-]{16,}/g,/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}/g,/\bxai-[A-Za-z0-9_-]{20,}/g,/\bgsk_[A-Za-z0-9]{40,}/g,/\bcsk-[A-Za-z0-9]{32,}/g,/\bLLM\|\d{6,}\|[A-Za-z0-9_-]{16,}/g,/\bhf_[A-Za-z0-9]{30,}/g,/\bpypi-AgE[A-Za-z0-9_-]{82,}/g,/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,/\bgithub_pat_[A-Za-z0-9_]{20,}/g,/\bgl(?:pat|dt|rtr?)-[A-Za-z0-9_-]{20,}(?:\.[A-Za-z0-9_-]+)*/g,/\bxox[abposr]-[A-Za-z0-9-]{20,}/g,/\bxapp-\d-[A-Za-z0-9-]{20,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{30,}/g,/\bnpm_[A-Za-z0-9]{20,}/g,/\bwhsec_[A-Za-z0-9_-]{20,}/g,/\bSG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bbak_[A-Za-z0-9_-]{20,}/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g];gA.map(e=>new RegExp(e.source));const hZ=/(\bBearer\s+)([A-Za-z0-9._~+/=-]{12,})/g,xZ=/(\bAuthorization["']?\s*[:=]\s*["']?Basic\s+)([A-Za-z0-9+/]{4,}={0,2})(?![A-Za-z0-9._~+/=-])/gi,gZ=/(-----BEGIN [A-Z ]*PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z ]*PRIVATE KEY-----)/g,bZ=/\b((?:[A-Za-z0-9_-]*_)?(?:api[_-]?key|apikey|secret|token|password|passwd|authorization|auth[_-]?token|access[_-]?key|private[_-]?key)s?)(["']?\s*[=:]\s*)(["']?)([A-Za-z0-9._~+/=-]{8,})\3/gi,yZ=/\b([A-Za-z][A-Za-z0-9_-]*[_-]key)s?(=)(["']?)([A-Za-z0-9._~+/=-]+)\3/gi,kZ=/(--(?:token|password|passwd|api-key|apikey|secret|access-key|auth-token)(?:=|\s+))(["']?)(?!-)([A-Za-z0-9._~+/=-]+)\2/gi,vZ=/(\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@'"]+:)([^\s/@'"«»]+)(@)/gi,c4=new Set;function wZ(e){if(!e||c4.size===0)return e;let t=e;for(const n of c4)t=n(t);return t}function jZ(e){if(!e)return e;const t=wZ(e);if(t.length<8)return t;let n=t;n=n.replace(gZ,(s,a,i,o)=>`${a}
16
16
  ${Ia(i.trim())}
17
17
  ${o}`);for(const s of gA)n=n.replace(s,a=>Ia(a));return n=n.replace(hZ,(s,a,i)=>`${a}${Ia(i)}`),n=n.replace(xZ,(s,a,i)=>`${a}${Ia(i)}`),n=n.replace(bZ,(s,a,i,o,c)=>`${a}${i}${o}${Ia(c)}${o}`),n=n.replace(yZ,(s,a,i,o,c)=>`${a}${i}${o}${Ia(c)}${o}`),n=n.replace(kZ,(s,a,i,o)=>`${a}${i}${Ia(o)}${i}`),n=n.replace(vZ,(s,a,i,o)=>`${a}${Ia(i)}${o}`),n}function dl(e,t){ot("modelgo_offer",{action:e,place:t})}function bA(e){return Tr().source==="file"?!1:!e||e.team?!0:!e.companyModelsOnly&&(e.allowedEngines==="all"||e.allowedEngines.includes("modelgo"))}const _w="https://modelgo.ai/?utm_source=openmausbot&utm_medium=sponsorship&utm_content=app&campaign_id=openmausbot&ad_group_id=app",NZ=[{id:"ai",titleKey:"keys.section.ai",purposeKey:"keys.section.ai.purpose"},{id:"servers",titleKey:"keys.section.servers",purposeKey:"keys.section.servers.purpose"},{id:"voice",titleKey:"keys.section.voice",purposeKey:"keys.section.voice.purpose"},{id:"computers",titleKey:"keys.section.computers",purposeKey:"keys.section.computers.purpose"},{id:"apps",titleKey:"keys.section.apps",purposeKey:"keys.section.apps.purpose"},{id:"helpers",titleKey:"keys.section.helpers",purposeKey:"keys.section.helpers.purpose"}];function wn(e){return{configured:e?.configured===!0,...e?.configured&&e.last4?{last4:e.last4}:{}}}function sr(e,t){return{patch:n=>({[e]:{key:n}}),saved:n=>wn(n[e]),...t}}const Ug=/^sk-(proj|svcacct|admin)-/,Kn=(e,t)=>({driverKind:e,...t?{preset:t}:{}}),yA=[{id:"openai",section:"ai",labelKey:"keys.openai.label",purposeKey:"keys.purpose.openaiModelsVoice",name:"OpenAI",env:["OMB_OPENAI_API_KEY"],words:["openai","chatgpt","gpt","live calls"],mark:Kn("openai-compat","openai"),kind:"key",target:sr("openai",{slot:"openaiApiKey",placeholder:"sk-…",href:"https://platform.openai.com/api-keys",test:"openai",analytics:"openai",shape:Ug,noteKey:"keys.openai.note"})},{id:"anthropic",section:"ai",labelKey:"keys.anthropic.label",purposeKey:"keys.purpose.anthropic",name:"Anthropic",env:["OMB_ANTHROPIC_API_KEY"],words:["anthropic","claude"],mark:Kn("claudeAgent","anthropic"),kind:"key",target:{patch:(e,t)=>({anthropic:{key:e,...t&&e?{everyClaudeBot:!1}:{}}}),saved:e=>wn(e.anthropic),slot:"anthropicApiKey",storeOptions:(e,t)=>t&&e?{everyClaudeBot:!1}:void 0,placeholder:"sk-ant-…",href:"https://console.anthropic.com/settings/keys",test:"anthropic",analytics:"anthropic",shape:/^sk-ant-/}},{id:"xai",section:"ai",labelKey:"keys.xai.label",purposeKey:"keys.purpose.xai",name:"xAI",env:["XAI_API_KEY"],words:["xai","grok","pictures","images"],mark:Kn("grok","xai"),kind:"key",target:sr("xai",{slot:"xaiApiKey",placeholder:"xai-…",href:"https://console.x.ai",test:"xai",analytics:"xai",shape:/^xai-/})},{id:"openrouter",section:"ai",labelKey:"keys.openrouter.label",purposeKey:"keys.purpose.openrouter",name:"OpenRouter",env:["OMB_OPENROUTER_API_KEY"],words:["openrouter","router","models"],mark:Kn("openai-compat","openrouter"),kind:"key",target:sr("openrouter",{slot:"openrouterApiKey",placeholder:"sk-or-v1-…",href:"https://openrouter.ai/keys",test:"openrouter",analytics:"openrouter",shape:/^sk-or-/})},{id:"mistral",section:"ai",labelKey:"keys.mistral.label",purposeKey:"keys.purpose.mistral",name:"Mistral",env:["MISTRAL_API_KEY"],words:["mistral"],mark:Kn("mistral","mistral"),kind:"key",target:sr("mistral",{slot:"mistralApiKey",placeholder:"…",placeholderKey:"keys.mistral.placeholder",href:"https://console.mistral.ai/api-keys",test:"mistral",analytics:"mistral"})},{id:"cerebras",section:"ai",labelKey:"keys.cerebras.label",purposeKey:"keys.purpose.cerebras",name:"Cerebras",env:["CEREBRAS_API_KEY"],words:["cerebras","fast"],mark:Kn("cerebras"),kind:"key",target:sr("cerebras",{slot:"cerebrasApiKey",placeholder:"csk-…",href:"https://cloud.cerebras.ai/",test:"cerebras",analytics:"cerebras",shape:/^csk-/})},{id:"groq",section:"ai",labelKey:"keys.groq.label",purposeKey:"keys.purpose.groq",name:"Groq",env:["OMB_GROQ_API_KEY"],words:["groq","fast"],mark:Kn("groq"),kind:"key",target:sr("groq",{slot:"groqApiKey",placeholder:"gsk_…",href:"https://console.groq.com/keys",test:"groq",analytics:"groq",shape:/^gsk_/})},{id:"greenference",section:"ai",labelKey:"keys.greenference.label",purposeKey:"keys.purpose.greenference",name:"Greenference",env:["OMB_GREENFERENCE_API_KEY"],words:["greenference","green","open models"],mark:Kn("greenference"),kind:"key",target:sr("greenference",{slot:"greenferenceApiKey",placeholder:"…",placeholderKey:"keys.greenference.placeholder",href:"https://greenference.com/dashboard/tokens",test:"greenference",analytics:"greenference"})},{id:"modelgo",section:"ai",labelKey:"keys.modelgo.label",purposeKey:"keys.purpose.modelgo",name:"ModelGo",env:["OMB_MODELGO_API_KEY"],words:["modelgo","model go","one key","sponsor"],mark:Kn("modelgo"),kind:"key",target:sr("modelgo",{slot:"modelgoApiKey",placeholder:"…",placeholderKey:"keys.modelgo.placeholder",href:_w,test:"modelgo",analytics:"modelgo",noteKey:"keys.modelgo.note",settingsEvent:e=>dl(e,"settings")})},{id:"meta",section:"ai",labelKey:"keys.meta.label",purposeKey:"keys.purpose.meta",name:"Meta",env:["OMB_META_API_KEY"],words:["meta","muse","llama"],mark:Kn("meta","meta"),kind:"key",target:sr("meta",{slot:"metaApiKey",placeholder:"LLM|…",href:"https://dev.meta.ai/docs/authentication",test:"meta",analytics:"meta",shape:/^LLM\|/})},{id:"deepseek",section:"ai",labelKey:"keys.deepseek.label",purposeKey:"keys.purpose.deepseek",name:"DeepSeek",env:["OMB_DEEPSEEK_API_KEY"],words:["deepseek","dsh","harness"],mark:Kn("deepseekAgent","deepseek"),kind:"key",target:sr("deepseek",{slot:"deepseekApiKey",placeholder:"sk-…",href:"https://platform.deepseek.com/api_keys",analytics:"deepseek"})},{id:"opencodeGo",section:"ai",labelKey:"keys.opencode.label",purposeKey:"keys.purpose.opencodeGo",name:"OpenCode",env:["OPENCODE_API_KEY"],words:["opencode","zen","go"],mark:Kn("opencodeGo"),kind:"key",target:{patch:e=>({opencodeGo:{apiKey:e}}),slot:"opencodeGoApiKey",saved:e=>wn(e.opencodeGo),placeholder:"…",placeholderKey:"keys.opencode.placeholder",href:"https://opencode.ai/docs/providers/",analytics:"opencode_go"}},{id:"opencodeProviders",section:"ai",labelKey:"keys.opencode.otherProviders.title",purposeKey:"keys.purpose.opencodeProviders",name:"OpenCode",env:[],words:["opencode","venice","providers","provider keys"],mark:Kn("opencodeGo"),kind:"panel",status:e=>({configured:(e.opencodeGo?.providerKeys?.length??0)>0})},{id:"ollama",section:"servers",labelKey:"ollama.title",purposeKey:"keys.purpose.ollama",name:"Ollama",env:[],words:["ollama","local","llama","ollama pull"],mark:Kn("openai-compat","ollama"),kind:"panel"},{id:"lmStudio",section:"servers",labelKey:"lmStudio.title",purposeKey:"keys.purpose.lmStudio",name:"LM Studio",env:[],words:["lm studio","lmstudio","llm studio","local","bionic"],mark:{icon:Dg},kind:"panel"},{id:"openaiCompat",section:"servers",labelKey:"keys.openaiCompat.label",purposeKey:"keys.purpose.openaiCompat",name:"OpenAI-compatible",env:["OPENAI_COMPAT_API_KEY","OPENAI_COMPAT_URL"],words:["openai-compatible","openai compatible","together","gemini","google ai studio","base url","server","endpoint"],mark:{icon:Dg},kind:"key",target:{patch:e=>({openaiCompat:{key:e}}),slot:"openaiCompatApiKey",saved:e=>wn(e.openaiCompat),placeholder:"…",placeholderKey:"keys.openaiCompat.placeholder",href:"https://platform.openai.com/docs/api-reference",test:"openaiCompat",analytics:"openai_compat"}},{id:"liveCalls",section:"voice",labelKey:"call.live.key",purposeKey:"keys.purpose.liveCalls",name:"OpenAI",env:[],words:["openai","live calls","calls","voice","talk","gpt-live","read aloud","speech","tts"],mark:{icon:$r},kind:"uses",uses:"openai"},{id:"liveKey",section:"voice",labelKey:"keys.label.liveKey",purposeKey:"keys.purpose.liveKey",name:"OpenAI",env:["OMB_OPENAI_LIVE_KEY"],words:["openai","live calls","calls","voice","gpt-live","azure","foundry"],mark:{icon:$r},kind:"key",target:{patch:e=>({live:{key:e}}),slot:"openaiLiveKey",saved:e=>wn(e.savedKeys?.openaiLiveKey??{configured:e.live?.keySource==="live"}),placeholder:"sk-…",href:"https://platform.openai.com/api-keys",analytics:"openai_live",shape:Ug}},{id:"elevenlabs",section:"voice",labelKey:"keys.label.elevenlabs",purposeKey:"keys.purpose.elevenlabs",name:"ElevenLabs",env:["OMB_TTS_KEY"],words:["elevenlabs","eleven labs","voice","voices","speech","tts"],mark:{icon:qa},kind:"key",target:{patch:e=>({tts:{key:e}}),slot:"ttsKey",verifiedOnSave:!0,saved:e=>({...wn(e.savedKeys?.ttsKey??{configured:e.tts?.provider==="elevenlabs"&&e.tts.configured&&!e.tts.included}),...e.tts?.included?{included:!0}:{}}),placeholder:"sk_…",href:"https://elevenlabs.io/app/settings/api-keys",analytics:"elevenlabs",shape:/^sk_/}},{id:"geminiTts",section:"voice",labelKey:"keys.label.geminiTts",purposeKey:"keys.purpose.geminiTts",name:"Gemini",env:["OMB_GEMINI_API_KEY"],words:["google","gemini","speech","voice","tts"],mark:{icon:qa},kind:"key",target:{patch:e=>({tts:{geminiKey:e}}),slot:"geminiTtsKey",saved:e=>wn(e.savedKeys?.geminiTtsKey),placeholderKey:"voice.gemini.keyPlaceholder",placeholder:"...",href:"https://aistudio.google.com/api-keys",analytics:"gemini_tts"}},{id:"fishAudio",section:"voice",labelKey:"keys.label.fishAudio",purposeKey:"keys.purpose.fishAudio",name:"Fish Audio",env:["OMB_FISH_AUDIO_API_KEY"],words:["fish","fish audio","voice","voices","speech","tts"],mark:{icon:qa},kind:"key",target:{patch:e=>({tts:{fishKey:e}}),slot:"fishAudioKey",verifiedOnSave:!0,saved:e=>wn(e.savedKeys?.fishAudioKey??{configured:e.tts?.provider==="fish"&&e.tts.configured}),placeholder:"…",placeholderKey:"voice.fish.keyPlaceholder",href:"https://fish.audio/app/api-keys/",analytics:"fish_audio"}},{id:"box",section:"computers",labelKey:"keys.boat.label",purposeKey:"keys.purpose.box",name:"boat.dev",env:["BOX_TOKEN"],words:["boat","box","cloud desktop","cloud computer","computer","sandbox"],mark:{icon:po},kind:"key",target:{patch:e=>({box:{token:e}}),slot:"boxToken",verifiedOnSave:!0,saved:e=>({...wn(e.box?.included?void 0:e.box),...e.box?.included?{included:!0}:{}}),placeholder:"boat_…",href:"https://docs.boat.dev/api-keys",analytics:"boat",shape:/^(boat|box)_/,warningKey:"keys.boat.warning"}},{id:"vps",section:"computers",labelKey:"keys.vps.label",purposeKey:"keys.purpose.vps",name:"VPS",env:[],words:["vps","ssh","server","self-hosted","computer","docker"],mark:{icon:Dg},kind:"panel",status:e=>({configured:e.vps?.configured===!0})},{id:"onePassword",section:"computers",labelKey:"settings.logins.onePassword.title",purposeKey:"keys.purpose.onePassword",name:"1Password",env:[],words:["1password","one password","logins","passwords","vault","service account"],mark:{icon:Wa},kind:"elsewhere",opens:"logins",whereKey:"keys.where.vault"},{id:"composio",section:"apps",labelKey:"keys.composio.label",purposeKey:"keys.purpose.composio",name:"Composio",env:["COMPOSIO_API_KEY"],words:["composio","connected apps","apps","gmail","slack","github","notion","self-host"],mark:{icon:tE},kind:"key",target:{patch:e=>({composio:{apiKey:e}}),slot:"composioApiKey",verifiedOnSave:!0,saved:e=>({...wn((e.composio?.mode??"self-hosted")==="self-hosted"?e.composio:void 0),...e.composio?.mode==="managed"?{included:!0}:{}}),placeholder:"ak_…",href:"https://dashboard.composio.dev/~/project/settings/api-keys",analytics:"composio",shape:/^ak_/}},{id:"treg",section:"apps",labelKey:"keys.treg.label",purposeKey:"keys.purpose.treg",name:"treg",env:["OMB_TREG_KEY"],words:["treg","research","x","twitter","companies","people","funding","news"],mark:{icon:Cn},kind:"key",target:{...sr("treg",{slot:"tregApiKey",placeholder:"…",placeholderKey:"keys.treg.placeholder",href:"https://treg.to",test:"treg",analytics:"treg"}),saved:e=>({...wn(e.treg),...e.xResearch?.included&&!e.treg?.configured?{included:!0}:{}})}},{id:"postiz",section:"apps",labelKey:"keys.postiz.label",purposeKey:"keys.purpose.postiz",name:"Postiz",env:["OMB_POSTIZ_API_KEY"],words:["postiz","social","social media","posts","schedule","linkedin","instagram","x","twitter"],mark:{icon:wf},kind:"key",target:{patch:e=>({postiz:{key:e}}),slot:"postizApiKey",verifiedOnSave:!0,saved:e=>wn(e.postiz),placeholder:"…",placeholderKey:"keys.postiz.placeholder",href:"https://platform.postiz.com/settings",analytics:"postiz"}},{id:"jev",section:"helpers",labelKey:"decider.key.label",purposeKey:"keys.purpose.jev",name:"Jev",env:["OMB_JEV_API_KEY"],words:["jev","typesafe","decisions","extraction","helper","rooms"],mark:{icon:fa},kind:"key",target:{patch:e=>({decider:{key:e}}),slot:"jevApiKey",verifiedOnSave:!0,saved:e=>({...wn(e.savedKeys?.jevApiKey??{configured:e.helpers?.own.jev===!0}),...e.decider?.included?{included:!0}:{}}),placeholder:"…",placeholderKey:"decider.key.placeholder",href:"https://typesafe.ai",analytics:"jev"}},{id:"openrouterHelper",section:"helpers",labelKey:"keys.label.openrouterHelper",purposeKey:"keys.purpose.openrouterHelper",name:"OpenRouter",env:["OMB_OPENROUTER_DECIDER_KEY"],words:["openrouter","decisions","helper"],mark:Kn("openai-compat","openrouter"),kind:"key",target:{patch:e=>({decider:{openrouterKey:e}}),slot:"openrouterDeciderKey",verifiedOnSave:!0,saved:e=>wn(e.savedKeys?.openrouterDeciderKey??{configured:e.helpers?.own.openrouter===!0}),placeholder:"sk-or-v1-…",href:"https://openrouter.ai/keys",analytics:"openrouter_decider",shape:/^sk-or-/}},{id:"workersAi",section:"helpers",labelKey:"decider.workersAi.title",purposeKey:"keys.purpose.workersAi",name:"Cloudflare",env:["OMB_WORKERS_AI_TOKEN"],words:["cloudflare","workers ai","clef","clairic","decisions","helper"],mark:{icon:fa},kind:"elsewhere",opens:"decisionModel",whereKey:"keys.where.decisions",status:e=>wn(e.savedKeys?.workersAiToken??{configured:e.helpers?.own.workersAi===!0})},{id:"imageOpenai",section:"helpers",labelKey:"keys.label.imageOpenai",purposeKey:"keys.purpose.imageOpenai",name:"OpenAI",env:["OMB_OPENAI_IMAGE_KEY"],words:["openai","image","images","pictures","avatar","gpt image"],mark:{icon:Ld},kind:"key",target:{patch:e=>({imageGen:{key:e}}),slot:"openaiImageApiKey",saved:e=>wn(e.savedKeys?.openaiImageApiKey??{configured:e.imageGen?.openaiConfigured===!0}),placeholder:"sk-…",href:"https://platform.openai.com/api-keys",analytics:"openai_image",shape:Ug}},{id:"imageGemini",section:"helpers",labelKey:"keys.label.imageGemini",purposeKey:"keys.purpose.imageGemini",name:"Gemini",env:["OMB_GEMINI_IMAGE_KEY"],words:["gemini","google","nano banana","image","images","pictures"],mark:{icon:Ld},kind:"elsewhere",opens:"imageGeneration",whereKey:"keys.where.imageGeneration",status:e=>wn(e.savedKeys?.geminiImageApiKey??{configured:e.imageGen?.geminiConfigured===!0})},{id:"imageCustom",section:"helpers",labelKey:"keys.label.imageCustom",purposeKey:"keys.purpose.imageCustom",name:"Custom",env:["OMB_CUSTOM_IMAGE_KEY"],words:["image","images","pictures","avatar","custom"],mark:{icon:SK},kind:"elsewhere",opens:"imageGeneration",whereKey:"keys.where.imageGeneration",status:e=>wn(e.savedKeys?.customImageApiKey??{configured:e.imageGen?.customKeyConfigured===!0})}];function ho(e){const t=yA.find(n=>n.id===e);if(!t)throw new Error(`no key ${e}`);return t}function d4(e,t){const n=ho(e);if(e!=="liveKey"||t?.live?.provider!=="azure"||!n.target)return n;const{shape:s,...a}=n.target;return{...n,name:"Azure OpenAI",labelKey:"call.live.azureKeyField",purposeKey:"keys.purpose.liveKeyAzure",target:{...a,placeholder:"…",href:"https://portal.azure.com"}}}function SZ(e){return NZ.find(t=>t.id===e.section)}function yx(e,t){return t?e.uses?yx(ho(e.uses),t):e.target?.saved(t)??e.status?.(t)??{configured:!1}:{configured:!1}}function ULe(e,t){const n=t.trim().toLowerCase();return n?[l(e.labelKey),l(e.purposeKey),l(SZ(e).titleKey),e.name,...e.words].some(s=>s.toLowerCase().includes(n)):!0}function u4(e,t){const n=t.trim(),s=e.uses?ho(e.uses):e;return!n||s.target?.shape?.test(n)?null:yA.find(a=>a.name!==s.name&&a.target?.shape?.test(n))??null}const IZ={openai:"openai",claudeApi:"anthropic",xaiApi:"xai",grok:"xai",openrouter:"openrouter",mistral:"mistral",cerebras:"cerebras",groq:"groq",greenference:"greenference",modelgo:"modelgo",meta:"meta",deepseek:"deepseek",opencodeGo:"opencodeGo",openaiCompat:"openaiCompat"};function Jd(e){return e?IZ[e]:void 0}const Mw=16e3,kA=1024,vA=kA/Mw*1e3,wA=.015,jA=3,CZ=400,EZ=400,AZ=6e4,TZ=5*6e4,_Z=7e4;function MZ(e){let t=0;for(const n of e)t+=n*n;return Math.sqrt(t/(e.length||1))}function RZ(e,t=vA){const n=e===void 0?TZ:AZ;let s=0,a=0,i=0,o=!1;return c=>(i+=t,c>wA?(s+=1,a=0,s>=jA&&(o=!0)):(s=0,o&&(a+=t)),i>=n||e!==void 0&&o&&a>=e?"done":o?"speaking":"waiting")}function OZ(e=vA){const t=Math.ceil(CZ/e)+jA,n=Math.ceil(EZ/e);let s=[],a=!1,i=-1;return{push(o,c,d){s.push(o),!a&&d==="waiting"&&s.length>t&&(s=s.slice(-t)),d!=="waiting"&&(a=!0),c>wA&&(i=s.length-1)},get spoke(){return a},frames:()=>a?s.slice(0,i+1+n):[]}}function zZ(e,t=Mw){const n=e.reduce((o,c)=>o+c.length,0),s=new DataView(new ArrayBuffer(44+n*2)),a=(o,c)=>[...c].forEach((d,u)=>s.setUint8(o+u,d.charCodeAt(0)));a(0,"RIFF"),s.setUint32(4,36+n*2,!0),a(8,"WAVEfmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,t,!0),s.setUint32(28,t*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),a(36,"data"),s.setUint32(40,n*2,!0);let i=44;for(const o of e)for(const c of o){const d=Math.max(-1,Math.min(1,c));s.setInt16(i,d<0?d*32768:d*32767,!0),i+=2}return new Uint8Array(s.buffer)}const g0=new Set,b0=new Set;let Xr=0,Bn={phase:"idle"};const NA=e=>Array.from(g0).forEach(t=>t(e)),Zd=e=>Array.from(b0).forEach(t=>t(e)),Rw=()=>({code:0,reason:"completed"});function Ow(e){e.processor.onaudioprocess=null,e.source.disconnect(),e.processor.disconnect();for(const t of e.stream.getTracks())t.stop();e.context.close().catch(()=>{})}function Hg(){Xr+=1,Bn.phase==="listening"&&Ow(Bn.mic),Bn.phase==="transcribing"&&Bn.abort.abort(),Bn={phase:"idle"}}function LZ(e){const t=e?.name;return t==="NotAllowedError"?{code:1,reason:"microphone-blocked",message:l("call.live.micBlocked")}:t==="NotFoundError"?{code:1,reason:"microphone-missing",message:l("call.live.micMissing")}:{code:1,reason:"microphone-failed"}}async function PZ(e,t,n){try{const{text:s}=await K("/api/tts/transcribe",{method:"POST",body:zZ(t),headers:{"content-type":"audio/wav"},signal:n.signal,timeoutMs:_Z});if(e!==Xr)return;Bn={phase:"idle"},s?.trim()&&NA({partial:!1,text:s}),Zd(Rw())}catch(s){if(e!==Xr)return;Bn={phase:"idle"},Zd({code:1,reason:"transcribe-failed",...s instanceof hn?{message:s.message}:{}})}}function p4(e){if(e!==Xr||Bn.phase!=="listening")return;const{mic:t,clip:n}=Bn;if(Ow(t),!n.spoke)return Bn={phase:"idle"},Zd(Rw());const s=new AbortController;Bn={phase:"transcribing",abort:s},PZ(e,n.frames(),s)}const y0={async speechStart(e){Hg();const t=Xr;Bn={phase:"opening"};let n,s;try{n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});const d=new AudioContext({sampleRate:Mw});s={stream:n,context:d,source:d.createMediaStreamSource(n),processor:d.createScriptProcessor(kA,1,1)}}catch(d){return n?.getTracks().forEach(u=>u.stop()),t!==Xr?void 0:(Bn={phase:"idle"},Zd(LZ(d)))}if(t!==Xr)return Ow(s);const a=e?.endpointMs!==void 0,i=RZ(e?.endpointMs),o=OZ();let c=!1;s.processor.onaudioprocess=d=>{if(t!==Xr)return;const u=new Float32Array(d.inputBuffer.getChannelData(0)),p=MZ(u),m=i(p);o.push(u,p,m),a&&!c&&m!=="waiting"&&(c=!0,NA({partial:!0,text:"…"})),m==="done"&&p4(t)},s.source.connect(s.processor),s.processor.connect(s.context.destination),s.context.resume().catch(()=>{}),Bn={phase:"listening",mic:s,clip:o}},async speechStop(){Hg()},async speechFinish(){if(Bn.phase==="listening")return p4(Xr);Bn.phase==="opening"&&(Hg(),Zd(Rw()))},onSpeechTranscript(e){return g0.add(e),()=>g0.delete(e)},onSpeechEnd(e){return b0.add(e),()=>b0.delete(e)}};function Zn(){return Xh().dictation.engine==="fish-audio"?y0:globalThis.window?.ogb}function zw(e){return yx(ho("fishAudio"),e).configured}function Lw(e,t){return e.dictation.available&&(e.dictation.engine!=="fish-audio"||zw(t))}const SA="openmausbot.remote-voice.v1";function IA(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function kx(){try{const e=IA()?.getItem(SA);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function CA(e){try{IA()?.setItem(SA,JSON.stringify(e))}catch{}}function vx(){return typeof window<"u"&&window.ogb?.remoteClient?.active===!0&&window.ogb?.platform==="darwin"&&typeof window.speechSynthesis<"u"&&typeof window.SpeechSynthesisUtterance<"u"}function EA(){return kx().provider==="host"?"host":"system"}function DZ(e){CA({...kx(),provider:e})}function k0(e){return e?kx().voices?.[e]??"":""}function $Z(e,t){const n=kx();CA({...n,voices:{...n.voices,[e]:t}})}function Xd(){return vx()&&EA()==="system"}function BZ(){return vx()?window.speechSynthesis.getVoices().map(e=>({id:e.voiceURI,label:e.name,description:e.lang||void 0})):[]}function FZ(e){return!vx()||!e?null:window.speechSynthesis.getVoices().find(t=>t.voiceURI===e||t.name===e)??null}const qZ="__ombVoiceProbe",Fu=()=>{if(typeof window>"u")return null;const e=window[qZ];return Array.isArray(e)?e:null},qu=()=>performance.now(),wx=(e,t)=>{const n=e.find(a=>a.messageId===t);if(n)return n;const s={messageId:t,blocks:[]};return e.push(s),s},dd=new Map;function UZ(e){if(Fu()){if(e.type==="turn.started"){dd.delete(e.threadId);return}e.type!=="content.delta"||e.streamKind!=="assistant_text"||dd.has(e.threadId)||dd.set(e.threadId,qu())}}function HZ(e,t){const n=Fu();if(!n)return;const s=dd.get(t);dd.delete(t);const a=wx(n,e.id);a.messageFrameAt===void 0&&(a.messageFrameAt=qu()),a.firstDeltaAt===void 0&&s!==void 0&&(a.firstDeltaAt=s),a.textChars===void 0&&typeof e.text=="string"&&(a.textChars=[...e.text].length)}function WZ(e){const t=Fu();if(!t||!e)return;const n=wx(t,e);n.speakEnterAt===void 0&&(n.speakEnterAt=qu())}function KZ(e,t){const n=Fu();if(!n||!e)return;const s=wx(n,e);s.preparedAt===void 0&&(s.preparedAt=qu()),s.blockCount=t}function Cp(e,t,n){const s=Fu();if(!s||!e)return;const a=wx(s,e);for(;a.blocks.length<=t;)a.blocks.push({});const i=a.blocks[t],o=qu();n==="renderStart"&&i.renderStartAt===void 0?i.renderStartAt=o:n==="renderDone"&&i.renderDoneAt===void 0?i.renderDoneAt=o:n==="audioStart"&&i.startAt===void 0?i.startAt=o:n==="audioEnd"&&i.endAt===void 0&&(i.endAt=o)}const rr={status:"idle"},VZ=3;class GZ{snapshot=rr;watchers=new Set;token=0;audio=null;objectUrl=null;settlePlayback=null;request=null;localUtterance=null;settleLocalSpeech=null;externalClaim=null;subscribe(t){return this.watchers.add(t),t(this.snapshot),()=>this.watchers.delete(t)}get state(){return this.snapshot}set(t){this.snapshot=t;for(const n of Array.from(this.watchers))n(t)}isSpeaking(t){return this.snapshot.status==="idle"?!1:t?this.snapshot.messageId===t:!0}stop(){this.token+=1;const t=this.externalClaim;this.externalClaim=null,t?.pause(),this.request?.abort(),this.request=null,this.settleLocalSpeech?.(!1),this.settleLocalSpeech=null,this.localUtterance=null,typeof window<"u"&&window.speechSynthesis?.cancel(),this.settlePlayback?this.settlePlayback(!1):this.teardownAudio(),(this.snapshot.status!=="idle"||this.snapshot.error)&&this.set(rr)}claimExternalVoice(t){this.stop();const n={pause:t};this.externalClaim=n;let s=!1;return()=>{s||(s=!0,this.externalClaim===n&&(this.externalClaim=null))}}teardownAudio(){this.audio&&(this.audio.pause(),this.audio.src="",this.audio=null),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}async speak(t,n={}){const s=this.begin(n);let a;try{a=await s.prepare(t)}catch(i){s.fail(i instanceof Error?i.message:String(i));return}for(const i of a)s.push(i);await s.end()}begin(t={}){WZ(t.messageId),this.stop();const n=this.token,s=new AbortController;this.request=s;const a=()=>this.token===n&&!s.signal.aborted;return this.set({status:"preparing",botId:t.botId,messageId:t.messageId}),Xd()?this.localStream(t,a,s):this.networkStream(t,a,s)}adoptMessageId(t,n,s){t.messageId=s,n()&&this.snapshot.status!=="idle"&&this.set({...this.snapshot,messageId:s})}localStream(t,n,s){let a=Promise.resolve(),i=!1,o=!1;return{push:c=>{i||!c||!n()||(o=!0,a=a.then(()=>n()?this.speakWithLocalSystem(c,t,n):void 0))},end:async()=>{i=!0,await a,!o&&n()&&this.set(rr),this.request===s&&(this.request=null)},prepare:async c=>[c],identify:c=>this.adoptMessageId(t,n,c),cancel:()=>{n()&&this.stop()},fail:c=>{i=!0,n()&&(s.abort(),this.set({...rr,error:c})),this.request===s&&(this.request=null)}}}networkStream(t,n,s){const a=[];let i=!1,o=!1,c=!1,d=null,u=()=>{};const p=new Promise(k=>{u=k}),m=()=>{o||(o=!0,i=!0,d?.(),u())},h=(k,v)=>(Cp(t.messageId,v,"renderStart"),this.render(k,t.voiceId,s.signal).then(y=>(Cp(t.messageId,v,"renderDone"),{blob:y}),y=>({error:y}))),x=async()=>{const k=[];let v=0,y=!1;for(;;){for(;k.length<VZ&&v+k.length<a.length;){const E=v+k.length;k.push(h(a[E],E))}if(!k.length){if(i||!n()){y=i;break}await new Promise(E=>{d=E}),d=null;continue}const b=k.shift(),w=v;v+=1;const j=await b;if("error"in j){n()&&this.set({...rr,error:j.error instanceof Error?j.error.message:String(j.error)}),s.abort();return}if(!n()){s.abort();return}if(this.set({status:"speaking",botId:t.botId,messageId:t.messageId,caption:a[w]}),!await this.play(j.blob,n,t.messageId,w)||!n()){n()&&this.set({...rr,error:l("voice.error.clip")}),s.abort();return}}y&&n()&&!o&&this.set(rr),this.request===s&&(this.request=null)},g=()=>{o||(d?.(),!(c||!a.length&&!i)&&(c=!0,Promise.resolve().then(x).finally(()=>{c=!1,m()})))};return{push:k=>{o||!k||(a.push(k),g())},end:()=>(i=!0,g(),p),prepare:async k=>{const v=await this.prepare(k,t.voiceId,s.signal);return KZ(t.messageId,v.length),v},identify:k=>this.adoptMessageId(t,n,k),cancel:()=>{n()&&this.stop()},fail:k=>{if(o)return;const v=n();s.abort(),v&&(this.settlePlayback?this.settlePlayback(!1):this.teardownAudio(),this.set({...rr,error:k})),this.request===s&&(this.request=null),m()}}}speakWithLocalSystem(t,n,s){if(!s())return Promise.resolve();const a=t.trim();if(!a)return this.set(rr),Promise.resolve();const i=window.speechSynthesis,o=new window.SpeechSynthesisUtterance(a),c=FZ(k0(n.botId));return c&&(o.voice=c),this.localUtterance=o,new Promise(d=>{let u=!1;const p=(m,h)=>{u||(u=!0,o.onstart=null,o.onend=null,o.onerror=null,this.localUtterance===o&&(this.localUtterance=null),this.settleLocalSpeech===p&&(this.settleLocalSpeech=null),s()&&this.set(m?rr:{...rr,...h?{error:h}:{}}),d())};this.settleLocalSpeech=p,o.onstart=()=>{s()&&this.set({status:"speaking",botId:n.botId,messageId:n.messageId,caption:a})},o.onend=()=>p(!0),o.onerror=m=>{const h=m.error==="canceled"||m.error==="interrupted";p(!1,h?void 0:l("voice.error.macPlay"))};try{i.speak(o)}catch{p(!1,l("voice.error.macStart"))}})}async prepare(t,n,s){const a=await fetch("/api/tts/prepare",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:t,voiceId:n}),signal:s}),i=await a.json().catch(()=>({}));if(!a.ok)throw new Error(Al(i,i.error??l("voice.error.service",{status:a.status})));if(!i.ready)throw new Error(l("voice.error.notReady"));return i.utterances??[]}async render(t,n,s){const a=await fetch("/api/tts/speak",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:t,voiceId:n}),signal:s});if(!a.ok){const i=await a.json().catch(()=>({})),o=i.errorKey?.startsWith("voice.openai.error.")?i.errorKey:void 0;throw new Error(Al(i,Ru(o,i.error)??l("voice.error.service",{status:a.status})))}return a.blob()}play(t,n,s,a){return new Promise(i=>{if(!n())return i(!1);this.teardownAudio();const o=URL.createObjectURL(t),c=new Audio(o);this.audio=c,this.objectUrl=o;let d=!1;const u=p=>{d||(d=!0,c.onended=null,c.onerror=null,s!==void 0&&a!==void 0&&Cp(s,a,"audioEnd"),this.settlePlayback===u&&(this.settlePlayback=null),this.audio===c&&this.teardownAudio(),i(p))};this.settlePlayback=u,c.onended=()=>u(!0),c.onerror=()=>u(!1),c.play().then(()=>{s!==void 0&&a!==void 0&&Cp(s,a,"audioStart")},()=>u(!1))})}}const Gt=new GZ;let Va=null;const v0=new Set;function AA(){for(const e of Array.from(v0))e()}function On(){return Va}function TA(e){Va!==e&&(Gt.stop(),Zn()?.speechStop?.(),Va=e,AA())}function na(e){return e&&Va!==e||Va===null?!1:(Va=null,Gt.stop(),Zn()?.speechStop?.(),AA(),!0)}function _A(e,t){queueMicrotask(()=>{t()||na(e)})}function ec(){return f.useSyncExternalStore(e=>(v0.add(e),()=>v0.delete(e)),()=>Va,()=>Va)}function m4(e,t){const n=e.bots.find(a=>a.threadId===t||a.tasks?.some(i=>i.threadId===t)),s=e.liveCall;return!n?.speakReplies||On()!==null||s&&s.status!=="ended"&&s.botId===n.id?null:{botId:n.id,voiceId:n.voice}}function f4(e){const t=jZ(e);for(const n of t.matchAll(/-----BEGIN [A-Z ]*PRIVATE KEY-----/g)){const s=t.slice(n.index+n[0].length);if(!/-----END [A-Z ]*PRIVATE KEY-----/.test(s))return t.slice(0,n.index)}return t}const Wg=(e,t)=>e.turnId===void 0||t===void 0||e.turnId===t;class YZ{constructor(t){this.speech=t}speech;turns=new Map;onRuntimeEvent(t,n){if(t.type==="turn.started"){const s=this.turns.get(t.threadId);s&&this.drop(s);return}if(t.type==="turn.completed"){this.finishTurn(t.threadId,t.turnId,t.ok);return}t.type==="content.delta"&&t.streamKind==="assistant_text"&&n&&this.appendDelta(t.threadId,t.turnId,t.delta,n)}onLiveCall(t){if(!(!t||t.status==="ended"))for(const n of this.turns.values())n.botId===t.botId&&(this.turns.delete(n.threadId),n.ended=!0,n.authoritative=null,n.dirty=!1,n.stream.cancel())}completeBotText(t,n,s,a,i){const o=this.turns.get(t);if(o&&Wg(o,n)){if(!a){this.turns.delete(t),o.ended=!0,o.stream.cancel();return}o.stream.identify(i),o.authoritativeCut=o.buffer.length,o.authoritative=s,this.pump(o);return}if(!a||!s.trim())return;const c={threadId:t,botId:a.botId,turnId:n,stream:this.speech.begin({botId:a.botId,voiceId:a.voiceId,messageId:i}),buffer:"",authoritativeCut:0,spoken:[],authoritative:s,pumping:!1,dirty:!1,ended:!1};this.turns.set(t,c),this.pump(c),this.finishTurn(t,n,!0)}appendDelta(t,n,s,a){const i=this.turns.get(t);if(i&&Wg(i,n)){i.buffer+=s,i.dirty=!0,this.pump(i);return}i&&this.drop(i);const o={threadId:t,botId:a.botId,turnId:n,stream:this.speech.begin({botId:a.botId,voiceId:a.voiceId}),buffer:s,authoritativeCut:0,spoken:[],authoritative:null,pumping:!1,dirty:!0,ended:!1};this.turns.set(t,o),this.pump(o)}drop(t){this.turns.get(t.threadId)===t&&(this.turns.delete(t.threadId),t.ended=!0,t.stream.end())}finishTurn(t,n,s){const a=this.turns.get(t);if(!(!a||!Wg(a,n))){if(!s){this.turns.delete(t),a.ended=!0,a.stream.cancel();return}a.ended=!0,this.pump(a)}}pump(t){if(t.pumping){t.dirty=!0;return}t.pumping=!0,(async()=>{try{for(;;){if(t.authoritative!==null){const n=t.authoritative;t.authoritative=null;const s=t.spoken;t.spoken=[],t.buffer=t.buffer.slice(t.authoritativeCut),t.authoritativeCut=0,t.buffer&&(t.dirty=!0);const a=await t.stream.prepare(f4(n));let i=0;for(;i<s.length&&i<a.length&&s[i]===a[i];)i+=1;for(const o of a.slice(i))t.stream.push(o);continue}if(t.dirty&&!t.ended){t.dirty=!1;const s=(await t.stream.prepare(f4(t.buffer))).slice(0,-1);for(const a of s.slice(t.spoken.length))t.stream.push(a);t.spoken=s;continue}break}}catch(n){this.turns.get(t.threadId)===t&&this.turns.delete(t.threadId),t.stream.fail(n instanceof Error?n.message:String(n));return}t.pumping=!1,t.ended&&this.turns.get(t.threadId)===t&&(this.turns.delete(t.threadId),t.stream.end())})()}}const Kg=new YZ(Gt),Ep=e=>Object.keys(e).length>0,Ap=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),JZ=e=>!!(e&&typeof e=="object"&&e.name==="AbortError"),Vg=e=>{const{acknowledgeLocalAuto:t,applyToAllThreads:n,keepThreadModels:s,threadId:a,mainThreadChoice:i,computer:o,connectorTools:c,connectorScopes:d,phoneApps:u,...p}=e,m={...p};return o===null?m.computer=void 0:o!==void 0&&(m.computer=o),c===null?m.connectorTools=void 0:c!==void 0&&(m.connectorTools=c),d===null?m.connectorScopes=void 0:d!==void 0&&(m.connectorScopes=d),u===null?m.phoneApps=void 0:u!==void 0&&(m.phoneApps=u),typeof i=="string"&&(m.mainThreadId=i),m};function ZZ(e){const t=new Map,n=e.delayMs??400;let s=!1;const a=c=>{if(!(c.running||c.timer!==null||Ep(c.pending))){t.delete(c.botId);for(const d of c.idleWaiters.splice(0))d(c.fallback)}},i=async(c,d=!1)=>{if(s||c.running||c.timer!==null||!Ep(c.pending))return;c.running=!0;const u=c.pending;c.pending={},c.inFlight=u;const p=new AbortController;c.controller=p;try{const m=await e.send(c.botId,u,p.signal,c.fallback,d);if(s||c.cancelled)return;c.fallback=m,e.onAuthoritative(m,Vg(c.pending))}catch(m){if(!s&&!c.cancelled){if(p.signal.aborted&&Ap(c.pending,"approvalMode")&&JZ(m))return;c.inFlight={};let x=c.fallback;try{x=await e.reconcile(c.botId,p.signal),x&&(c.fallback=x)}catch{}if(s||c.cancelled)return;x&&e.onAuthoritative(x,Vg(c.pending)),e.onError(m instanceof Error?m:new Error(String(m)))}}finally{c.controller=null,c.inFlight={},c.running=!1,!s&&!c.cancelled&&(Ep(c.pending)&&c.timer===null&&i(c),a(c))}},o=c=>{c.timer!==null&&clearTimeout(c.timer),c.timer=setTimeout(()=>{c.timer=null,i(c)},n)};return{enqueue(c,d,u){if(s||!Ep(d))return;const p=t.get(c)??{botId:c,fallback:u,pending:{},inFlight:{},timer:null,running:!1,controller:null,cancelled:!1,idleWaiters:[]};t.set(c,p),p.pending={...p.pending,...d},Ap(d,"approvalMode")&&!Ap(d,"applyToAllThreads")&&delete p.pending.applyToAllThreads;const m=p.inFlight.approvalMode;p.running&&(m==="full"||m==="custom")&&Ap(d,"approvalMode")&&d.approvalMode!==m&&p.controller?.abort(),Object.prototype.hasOwnProperty.call(d,"approvalMode")||Object.prototype.hasOwnProperty.call(d,"modelSelection")||Object.prototype.hasOwnProperty.call(d,"connectorTools")?(p.timer!==null&&clearTimeout(p.timer),p.timer=null,i(p)):o(p)},flush(c){const d=t.get(c);if(!d)return Promise.resolve(null);d.timer!==null&&(clearTimeout(d.timer),d.timer=null);const u=new Promise(p=>d.idleWaiters.push(p));return i(d),a(d),u},flushAll(){for(const c of t.values())c.timer!==null&&(clearTimeout(c.timer),c.timer=null,i(c,!0))},overlayFor(c){const d=t.get(c);return d?Vg({...d.inFlight,...d.pending}):{}},cancel(c){const d=t.get(c);if(d){d.cancelled=!0,d.timer!==null&&clearTimeout(d.timer),d.controller?.abort(),t.delete(c);for(const u of d.idleWaiters.splice(0))u(null)}},revive(){s=!1},dispose(){s=!0;for(const c of t.values()){c.cancelled=!0,c.timer!==null&&clearTimeout(c.timer),c.controller?.abort();for(const d of c.idleWaiters.splice(0))d(null)}t.clear()}}}const XZ=e=>new TextEncoder().encode(e).length<6e4;function QZ(e,t){const n=()=>e.flushAll();return t.addEventListener("pagehide",n),t.addEventListener("beforeunload",n),()=>{t.removeEventListener("pagehide",n),t.removeEventListener("beforeunload",n)}}function eX(){const e=new Map;return(t,n)=>{const s=e.get(t.botId);if(s&&s.projectId===t.projectId&&s.cwd===t.cwd)return s.outcome.then(o=>o===null?t.onCreated?.():t.onError?.(o)),null;if(s)return s.outcome.then(()=>n()),null;let a=()=>{};const i=new Promise(o=>{a=c=>{e.delete(t.botId),o(c)}});return e.set(t.botId,{projectId:t.projectId,cwd:t.cwd,outcome:i}),a}}function w0(e){if(!e||typeof e!="object"||!Object.prototype.hasOwnProperty.call(e,"call"))return null;const t=Reflect.get(e,"call");if(t===null)return{call:null};if(!t||typeof t!="object")return null;const n=t;return typeof n.callId!="string"||typeof n.botId!="string"||typeof n.threadId!="string"||typeof n.status!="string"?null:{call:t}}let h4=0;function MA(){return h4+=1,h4}const tX=6e3;function nX(e){return e instanceof hn&&e.body?.code==="no_ai"}function sX(e,t){f.useEffect(()=>{if(!e)return;const n=setTimeout(t,tX);return()=>clearTimeout(n)},[e,t])}const j0=1024,x4=1024*j0;function RA(e){return typeof e!="number"||!Number.isFinite(e)||e<j0?null:e<x4?{unit:"kb",count:Math.floor(e/j0)}:{unit:"mb",count:Math.floor(e/x4*10)/10}}function g4(e){const t=RA(e.bytes),n=e.quiet?`${e.quiet.kind}${e.quiet.kind==="output"?`@${e.quiet.at}`:""}`:"";return[e.turnId??"",e.itemId??"",e.activity,e.tool??"",e.file??"",t?`${t.count}${t.unit}`:"",e.target??"",e.detail??"",n,(e.tail??[]).join(`
18
- `)].join("|")}const rX={ended:!1,status:null},aX=500,_a=new Map,_m=new Map;function iX(e,t){return e===t?!0:!e||!t?!1:("bytes"in e?e.bytes:void 0)===("bytes"in t?t.bytes:void 0)&&g4(e)===g4(t)}function Si(e,t){const n=_a.get(e);if(!(n&&n.turnId===t.turnId&&n.ended===t.ended&&iX(n.status,t.status))){_a.delete(e),_a.set(e,t),_a.size>aX&&_a.delete(_a.keys().next().value);for(const s of Array.from(_m.get(e)??[]))s()}}function oX(e){const{threadId:t}=e,n=_a.get(t),s=n&&(!e.turnId||e.turnId===n.turnId),a=e.turnId??n?.turnId,i=s?n:{turnId:a,ended:!1,status:null};switch(e.type){case"turn.started":return Si(t,{turnId:a,ended:!1,status:null});case"turn.completed":case"cap.exhausted":case"session.exited":return Si(t,{turnId:a,ended:!0,status:null});case"turn.progress":{const{activity:o,tool:c,file:d,bytes:u,itemId:p,target:m,detail:h,quiet:x,tail:g}=e;return Si(t,{turnId:a,ended:!1,status:{activity:o,...c?{tool:c}:{},...d?{file:d}:{},...u!==void 0?{bytes:u}:{},...p?{itemId:p}:{},...m?{target:m}:{},...h?{detail:h}:{},...x?{quiet:x}:{},...g?.length?{tail:g}:{}}})}case"content.delta":return Si(t,{turnId:a,ended:!1,status:{activity:e.streamKind==="reasoning_text"?"thinking":"reply"}});case"item.started":return Si(t,{...i,ended:!1,status:i.status?.itemId&&i.status.itemId===e.itemId?i.status:null});case"item.completed":case"request.opened":return Si(t,{...i,status:null});default:i!==n&&Si(t,i)}}function b4(e){return e&&_a.get(e)||rX}function lX(e,t){if(!e)return()=>{};let n=_m.get(e);return n||_m.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size===0&&_m.delete(e)}}function Pw(e){return f.useSyncExternalStore(t=>lX(e,t),()=>b4(e),()=>b4(e))}const y4="/api/events",OA=4e4,cX=500,dX=1e4,N0="omb:retry-live-events";function uX(){window.dispatchEvent(new Event(N0))}function pX(e){const t=new URLSearchParams;e?.since&&t.set("since",e.since),e?.screens===!1&&t.set("screens","off");const n=t.toString();return n?`${y4}?${n}`:y4}const Qd=new Set,Rf=new Set,Mi=()=>[...Qd].some(e=>e.screens);function jx(e){const t=Mi();if(Qd.add(e),Mi()!==t)for(const n of Rf)n();return()=>{const n=Mi();if(Qd.delete(e),Mi()!==n)for(const s of Rf)s()}}function mX(e){if(e.kind!=="screen")return e;const{png:t,...n}=e;return{...n,png:""}}function fX(e){for(const t of Qd)t.onFrame(e)}function hX(){for(const e of Qd)e.onMissedFrames?.()}function xX(e){return e.kind==="ping"}function gX(e,t,n=OA){return t-e>=n}function bX(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||Array.isArray(t)||Object(t)!==t)return null;const n=t;return n.kind!==String(n.kind)||n.cursor!==void 0&&n.cursor!==String(n.cursor)||n.resumed!==void 0&&n.resumed!==!!n.resumed?null:n}function yX(e){e.kind==="runtime"?(oX(e.event),UZ(e.event)):e.kind==="message"&&e.message?.role==="bot"&&e.message?.kind==="text"&&HZ(e.message,e.threadId)}function kX(e){const t=globalThis.EventSource,n=e.createEventSource??(t?i=>{const o=new t(i),c={onopen:null,onerror:null,onmessage:null,close:()=>o.close()};return o.onopen=()=>c.onopen?.(),o.onerror=()=>c.onerror?.(),o.onmessage=d=>c.onmessage?.(d),c}:void 0);if(!n)return null;const s=globalThis.window,a=globalThis.document;return{createEventSource:n,windowTarget:e.windowTarget??(s?{addEventListener:(i,o)=>s.addEventListener(i,o),removeEventListener:(i,o)=>s.removeEventListener(i,o)}:void 0),documentTarget:e.documentTarget??(a?{addEventListener:(i,o)=>a.addEventListener(i,o),removeEventListener:(i,o)=>a.removeEventListener(i,o)}:void 0),isVisible:e.isVisible??(()=>!a||a.visibilityState==="visible"),isOnline:e.isOnline??(()=>globalThis.navigator?.onLine!==!1),now:e.now??Date.now}}function vX(e,t={}){const n=kX(t);if(!n)return e.onError?.(),()=>{};const s=e.staleMs??OA,a=Math.max(1,e.retryMinMs??cX),i=Math.max(a,e.retryMaxMs??dX),o=Math.min(1e4,Math.max(250,s/2));let c=!1,d=null,u=Mi(),p=null,m=0,h=null,x=n.now(),g=0,k=null;const v=()=>{p!==null&&(clearTimeout(p),p=null)},y=()=>{const L=d;d=null,L&&(k?.source===L&&(g+=1,k=null),L.onopen=null,L.onerror=null,L.onmessage=null,L.close())};let b;const w=()=>{if(c||p!==null||!n.isOnline()||!n.isVisible()||Da())return;const L=Math.min(m,20),P=Math.min(i,a*2**L);m+=1,p=setTimeout(()=>{p=null,n.isVisible()&&b()},P)},j=L=>{c||d!==L||(y(),e.onError?.(),w())};b=()=>{if(c||d||!n.isOnline()||Da())return;let L;try{u=Mi(),L=n.createEventSource(pX({since:h,screens:u}))}catch{e.onError?.(),w();return}d=L,x=n.now(),L.onopen=()=>{c||d!==L||(x=n.now(),e.onOpen?.())},L.onerror=()=>j(L),L.onmessage=P=>{if(c||d!==L)return;x=n.now();const $=bX(P.data);if($){if(xX($)){m=0;return}if($.kind==="hello"){if($.resumed===!1){const M=++g;k={generation:M,source:L,boundaryCursor:$.cursor||null,newestFrameCursor:null},(async()=>{let F=!1;try{F=await e.onSnapshotRequired()}catch{F=!1}const W=k;if(!(c||d!==L||!W||W.generation!==M)){if(!F){k=null,j(L);return}h=W.newestFrameCursor??W.boundaryCursor,k=null,R()}})()}}else P.lastEventId&&(k?.source===L?k.newestFrameCursor=P.lastEventId:h=P.lastEventId);if(RY($)){v(),y(),OE();return}$.kind!=="hello"&&(yX($),e.onFrame($))}}};const S=L=>{c||!n.isOnline()||(v(),d&&(y(),L&&e.onError?.()),b())},E=()=>{c||!n.isOnline()||!n.isVisible()||Da()||(!d||gX(x,n.now(),s))&&S(d!==null)},A=()=>E(),_=()=>{n.isVisible()&&E()},N=()=>{n.isVisible()&&E()},C=()=>{n.isVisible()&&!Da()&&S(!0)},R=()=>queueMicrotask(()=>{d&&h&&!k&&Mi()!==u&&S(!1)});Rf.add(R),b();const O=setInterval(E,o),q=ux(L=>{L||S(!1)});return n.windowTarget?.addEventListener("online",A),n.windowTarget?.addEventListener("focus",_),n.windowTarget?.addEventListener(N0,C),n.documentTarget?.addEventListener("visibilitychange",N),()=>{c||(c=!0,Rf.delete(R),q(),clearInterval(O),v(),y(),n.windowTarget?.removeEventListener("online",A),n.windowTarget?.removeEventListener("focus",_),n.windowTarget?.removeEventListener(N0,C),n.documentTarget?.removeEventListener("visibilitychange",N))}}const k4=2e3,v4=new Set(["queued","running","waiting"]);function S0(e){const t=[...e].sort((a,i)=>i.scheduledFor-a.scheduledFor);if(t.length<=k4)return t;const n=t.reduce((a,i)=>a+(v4.has(i.status)?1:0),0);let s=Math.max(0,k4-n);return t.filter(a=>v4.has(a.status)?!0:s===0?!1:(s-=1,!0))}const wX=336*60*6e4;function jX(e,t){const n=new Set(e.map(s=>s.id));return S0([...e,...t.filter(s=>!n.has(s.id))])}function NX(e,t){return e===null||t.from===void 0||t.to===void 0||t.to<e?e:Math.min(e,t.from)}const SX=64;function ul(e,t){const n={...e,[t]:!0},s=Object.keys(n).length-SX;if(s>0)for(const a of Object.keys(n).slice(0,s))delete n[a];return n}function Tp(e,t){const n=[];for(const o of t)for(const c of o.messages??[])c.queueId&&n.push({queueId:c.queueId,at:c.at});if(n.length===0)return e;const s=new Set(n.map(o=>o.queueId)),a={};for(const[o,c]of Object.entries(e.pendingQueued)){const d=c.filter(u=>!s.has(u.queueId));d.length>0&&(a[o]=d)}let i={};n.sort((o,c)=>o.at-c.at);for(const o of n)i=ul(i,o.queueId);for(const o of Object.keys(e.consumedQueueIds))i=ul(i,o);return{...e,pendingQueued:a,consumedQueueIds:i}}function w4(e,t){const n=new Set(e.groups.flatMap(o=>[o.threadId,...(o.tasks??[]).map(c=>c.threadId)])),s=new Set(Object.values(t).flatMap(o=>o.map(c=>c.queueId))),a={...t};let i=e.consumedQueueIds;for(const[o,c]of Object.entries(e.pendingQueued))if(n.has(o))a[o]=c;else for(const d of c)s.has(d.queueId)||(i=ul(i,d.queueId));return{...e,pendingQueued:a,consumedQueueIds:i}}function zA(e){return(e.tasks??[]).map(t=>In({approvalMode:t.approvalMode??(t.autoApprove===void 0?e.approvalMode:void 0),autoApprove:t.autoApprove??e.autoApprove}))}function Qn(e,t=e.threadId){const n=e.tasks?.find(s=>s.threadId===t);return n?{...e,threadId:t,modelSelection:n.modelSelection??e.modelSelection,approvalMode:n.approvalMode??(n.autoApprove===void 0?e.approvalMode:void 0),autoApprove:n.autoApprove??e.autoApprove,alwaysAllow:n.alwaysAllow??e.alwaysAllow,activity:n.activity??e.activity,busy:n.busy??(n.activity?n.activity==="working"||n.activity==="waiting-on-you":e.busy),unread:n.unread??e.unread,pinnedMessageId:n.pinnedMessageId,turnStartedAt:n.turnStartedAt??null,waitingForTeammates:n.waitingForTeammates??!1}:e}function LA(e){const{acknowledgeLocalAuto:t,updateBotDefault:n,resetApprovalToAsk:s,projectId:a,archivedAt:i,snoozedUntil:o,surface:c,pinned:d,link:u,...p}=e;return{...p,...s?{approvalMode:"ask",autoApprove:!1,alwaysAllow:[]}:{},...a===void 0?{}:{projectId:a??void 0},...i===void 0?{}:{archivedAt:i??void 0},...o===void 0?{}:{snoozedUntil:o??void 0},...c===void 0?{}:{surface:c??void 0,surfaceAuto:void 0},...d===void 0?{}:{pinned:d?!0:void 0},...u===void 0?{}:{link:u??void 0}}}function Gg(e,t,n,s,a,i){return n?aA(t,s,a,i):Tm(e.unreadDivider?.threadId===t?e.unreadDivider:null,t,s,!!i)}function IX(e){return{xai:e.xai,mistral:e.mistral,cerebras:e.cerebras,groq:e.groq,greenference:e.greenference,modelgo:e.modelgo,deepseek:e.deepseek,meta:e.meta,xResearch:e.xResearch,treg:e.treg,postiz:e.postiz,anthropic:e.anthropic,openai:e.openai,openrouter:e.openrouter,openaiCompat:e.openaiCompat,fleet:e.fleet,composio:e.composio,box:e.box,vps:e.vps,rooms:e.rooms,mcp:e.mcp,threads:e.threads,automaticRecovery:e.automaticRecovery,cacheKeepWarm:e.cacheKeepWarm,localVm:e.localVm,opencodeGo:e.opencodeGo,tts:e.tts,decider:e.decider,helpers:e.helpers,imageGen:e.imageGen,live:e.live,savedKeys:e.savedKeys,profile:e.profile,everyBotRules:e.everyBotRules,language:e.language,features:e.features,onboarding:e.onboarding,browserEngine:e.browserEngine,browserProfiles:e.browserProfiles,edition:e.edition,budgets:e.budgets,billing:e.billing,managedPolicy:e.managedPolicy,...e.cloudHome?{cloudHome:!0}:{},...e.team?{team:e.team}:{},...e.awakeLimit!==void 0?{awakeLimit:e.awakeLimit}:{},...e.pausedBots?{pausedBots:e.pausedBots}:{},...e.workspaceBanner?{workspaceBanner:e.workspaceBanner}:{}}}function yc(e){const t=Object.entries(e.modelVariantSessions),n=t.filter(([s,a])=>{const i=e.bots.find(c=>c.threadId===s||c.tasks?.some(d=>d.threadId===s));if(!i)return!1;const o=Qn(i,s).modelSelection;return o.instanceId===a.instanceId&&o.model===a.model});return n.length===t.length?e:{...e,modelVariantSessions:Object.fromEntries(n)}}function CX(e,t){if(!("botId"in e)||"threadId"in e&&e.threadId||!["send","interrupt","editMessage","switchBranch","answerCard","dismissCard","cancelQueued","steerQueued"].includes(e.type))return e;const n=e.botId,s=t.find(a=>a.id===n)?.threadId;return{...e,threadId:s}}function _p(e,t){return t?{...e,transcriptGeneration:{...e.transcriptGeneration,[t]:(e.transcriptGeneration[t]??0)+1}}:e}function nn(e,t,n){return{...e,bots:e.bots.map(s=>s.id===t?n(s):s)}}function Bs(e,t,n){return{...e,mascotMotion:{botId:t,nonce:(e.mascotMotion?.nonce??0)+1,kind:n}}}function PA(e,t,n){return e.map(s=>s.id===t&&s.card?{...s,card:{...s.card,...n}}:s)}function Mm(e,t,n,s){return nn(e,t,a=>({...a,messages:PA(a.messages,n,s)}))}function Yg(e,t,n,s){return{...e,groups:e.groups.map(a=>a.id===t?{...a,messages:PA(a.messages,n,s)}:a)}}function DA(e){return e.messages.find(t=>t.kind==="options"&&t.card&&!t.card.requestId&&!t.card.dismissed)}function EX(e,t){const n=e.bots.find(a=>a.id===t),s=n?DA(n):void 0;return s?Mm(e,t,s.id,{dismissed:!0}):e}const j4={type:"toggleAppSettings",open:!0,section:"cloudAccount",cloudLink:!0};function Ar(e,t){if((t.type==="messageAdded"||t.type==="messagePatched"||t.type==="threadActive"||t.type==="optimisticMessageRemoved")&&e.bots.find(s=>(s.threadId!==t.threadId||s.awaitingThreadSnapshot)&&s.tasks?.some(a=>a.threadId===t.threadId))){const s=[...e.backgroundThreadEvents[t.threadId]??[],t].slice(-256),a={...e,backgroundThreadEvents:{...e.backgroundThreadEvents,[t.threadId]:s}};return(t.type==="messageAdded"||t.type==="messagePatched")&&Uc(t.message)?Sa(a,t.threadId,t.message.at,!0,t.message.turnCompletedAt??t.message.at):t.type==="messageAdded"?Sa(a,t.threadId,t.message.at):a}if(JY(t))return{...e,notifications:ZY(e.notifications,t)};switch(t.type){case"hydrate":{const n=d=>t.bots.some(u=>u.id===d)||t.groups.some(u=>u.id===d),s=t.resumeId,a=s&&(t.bots.some(d=>d.id===s&&!d.hidden)||t.groups.some(d=>d.id===s))?s:"",i=e.selectedId&&n(e.selectedId)?e.selectedId:a||(t.bots[0]?.id??""),o={...e,bots:t.bots.map(d=>{const u=d.messages?d:{...d,messages:[]},p=e.bots.find(m=>m.id===u.id);return SJ(p,p?{...u,tasks:Am(p.tasks,u.tasks)}:u,t.preserveNavigation===!0&&n4(p,t.navigationSince,e.transcriptGeneration),t.taskIdsAtStart)}),groups:t.groups.map(d=>{const u=e.groups.find(m=>m.id===d.id),p=u?{...d,tasks:Am(u.tasks,d.tasks)}:d;return p.description===null&&(p.description=void 0),IJ(u,p,t.preserveNavigation===!0&&n4(u,t.navigationSince,e.transcriptGeneration),t.taskIdsAtStart)}),sections:t.sections??[],computerControl:t.computerControl,selectedId:i,hydrated:!0,backgroundThreadEvents:{},loadingOlder:{},transcriptGeneration:{},modelVariantSessions:{}},c=[...o.bots,...o.groups].find(d=>d.threadId===e.unreadDivider?.threadId);return c&&(o.unreadDivider=Tm(e.unreadDivider,c.threadId,Es(c),!!c.hasMore)),Tp(t.botQueuedMessages?w4(o,t.botQueuedMessages):o,[...t.bots,...t.groups])}case"loadOlderMessages":return e.loadingOlder[t.threadId]?e:{...e,loadingOlder:{...e.loadingOlder,[t.threadId]:!0}};case"olderMessages":{const{[t.threadId]:n,...s}=e.loadingOlder;if((e.transcriptGeneration[t.threadId]??0)!==t.generation)return{...e,loadingOlder:s};const a=u=>{const p=new Set(u.messages.map(m=>m.id));return{...u,messages:[...t.messages.filter(m=>!p.has(m.id)),...u.messages],hasMore:t.hasMore}},i=e.bots.map(u=>u.threadId===t.threadId?a(u):u),o=e.groups.map(u=>u.threadId===t.threadId?a(u):u),c=[...i,...o].find(u=>u.threadId===t.threadId),d=Tm(e.unreadDivider,t.threadId,c?Es(c):[],t.hasMore);return{...e,loadingOlder:s,bots:i,groups:o,unreadDivider:d}}case"sectionDeleted":return{...e,sections:t.sections,bots:e.bots.map(n=>n.section===t.section?{...n,section:void 0}:n),groups:e.groups.map(n=>n.section===t.section?{...n,section:void 0}:n)};case"sections":return{...e,sections:t.sections};case"botsOrdered":{const n=VY(e.bots,t.botIds);return n.every((s,a)=>s===e.bots[a])?e:{...e,bots:n}}case"botQueues":return Tp(w4(e,t.queues),[...e.bots,...e.groups]);case"showRoutines":return{...e,activeView:"routines",routinesFocus:{section:t.section,view:t.view,botId:t.botId,routineId:t.routineId,runStatus:t.runStatus,nonce:e.routinesFocus.nonce+1},settingsOpen:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,notificationsOpen:!1,appSettingsOpen:!1,pluginsOpen:!1};case"showChat":return e.activeView==="chat"?e:{...e,activeView:"chat"};case"showTeamMap":case"showFiles":case"showWebPanel":return{...e,activeView:t.type==="showFiles"?"files":t.type==="showWebPanel"?"web-panel":"team-map",filesSuggest:t.type==="showFiles"&&t.suggest?.length?t.suggest:null,webPanelId:t.type==="showWebPanel"?t.id:e.webPanelId,settingsOpen:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,appSettingsOpen:!1,pluginsOpen:!1};case"routinesHydrated":return{...e,routines:t.routines,routineRuns:S0(t.runs),routineRunsSince:t.since??null,routinesLoadState:"ready"};case"routinesLoadFailed":return{...e,routinesLoadState:"error"};case"routinePatched":{const n=e.routines.find(s=>s.id===t.routine.id);return n&&n.updatedAt>t.routine.updatedAt?e:{...e,routines:n?e.routines.map(s=>s.id===t.routine.id?t.routine:s):[t.routine,...e.routines]}}case"routineDeleted":return{...e,routines:e.routines.filter(n=>n.id!==t.routineId)};case"routineRunPatched":{const s=e.routineRuns.some(a=>a.id===t.run.id)?e.routineRuns.map(a=>a.id===t.run.id?t.run:a):[t.run,...e.routineRuns];return{...e,routineRuns:S0(s)}}case"routineRunsLoaded":return{...e,routineRuns:jX(e.routineRuns,t.runs),routineRunsSince:NX(e.routineRunsSince,t)};case"webhooksHydrated":return{...e,webhooks:t.webhooks,webhookAttempts:t.attempts,webhookIngress:t.ingress};case"webhookPatched":{const n=e.webhooks.some(s=>s.id===t.webhook.id);return{...e,webhooks:n?e.webhooks.map(s=>s.id===t.webhook.id?t.webhook:s):[t.webhook,...e.webhooks]}}case"webhookDeleted":return{...e,webhooks:e.webhooks.filter(n=>n.id!==t.webhookId),webhookAttempts:e.webhookAttempts.filter(n=>n.webhookId!==t.webhookId)};case"webhookAttempted":{const n=e.webhookAttempts.some(s=>s.id===t.attempt.id)?e.webhookAttempts.map(s=>s.id===t.attempt.id?t.attempt:s):[...e.webhookAttempts,t.attempt];return{...e,webhookAttempts:n.slice(-2e3)}}case"groupPatched":{const n=t.group.messages?_p(e,t.group.threadId):e,s=vJ(e.groups,t.group),a=t.group.messages&&s.find(i=>i.id===t.group.id&&i.threadId===e.unreadDivider?.threadId);return{...n,groups:s,...a?{unreadDivider:Tm(e.unreadDivider,a.threadId,Es(a),!!a.hasMore)}:{}}}case"groupSnapshot":{const n=wJ(e,t);return n?Ar(e,{type:"groupPatched",group:n}):e}case"groupDeleted":{const n=e.groups.filter(a=>a.id!==t.groupId),s=e.selectedId===t.groupId?e.bots[0]?.id??"":e.selectedId;return{...e,groups:n,selectedId:s}}case"instances":return{...e,instances:t.instances};case"configStatus":return{...e,config:t.config};case"liveCall":return{...e,liveCall:t.call,liveCallVersion:e.liveCallVersion+1};case"liveCallLookup":return t.since===e.liveCallVersion&&t.seq>e.liveCallLookupSeq?{...e,liveCall:t.call,liveCallLookupSeq:t.seq}:e;case"profileSaved":return e.config?{...e,config:{...e.config,profile:{name:"",email:"",...e.config.profile,...t.profile}}}:e;case"select":{const n=e.groups.find(a=>a.id===t.id);if(n)return{...t.id===e.selectedId&&e.activeView==="chat"?e:Ko(e),unreadDivider:Gg(e,n.threadId,n.unread,n.messages,n.lastReadMessageId,n.hasMore),activeView:"chat",selectedId:t.id,groups:e.groups.map(a=>a.id===t.id?{...a,unread:!1}:a)};const s=e.bots.find(a=>a.id===t.id);return nn(Bs({...t.id===e.selectedId&&e.activeView==="chat"?e:Ko(e),unreadDivider:s?Gg(e,s.threadId,a4(s),Es(s),r4(s),s.hasMore):e.unreadDivider,activeView:"chat",selectedId:t.id},t.id,"switch"),t.id,a=>({...a,unread:!!a.tasks?.some(i=>i.threadId!==a.threadId&&i.unread),tasks:a.tasks?.map(i=>i.threadId===a.threadId?{...i,unread:!1}:i)}))}case"answerCard":{if(t.groupId){const a=e.groups.find(i=>i.id===t.groupId)?.messages.find(i=>i.id===t.messageId)?.card;return Yg(e,t.groupId,t.messageId,{answered:t.answer,...a?.requestId?{pendingAnswer:t.answer}:{}})}const s=e.bots.find(a=>a.id===t.botId)?.messages.find(a=>a.id===t.messageId)?.card;return Bs(Mm(e,t.botId,t.messageId,{answered:t.answer,...s?.requestId?{pendingAnswer:t.answer}:{dismissed:!0}}),t.botId,"working")}case"answerCardFailed":{if((t.groupId?e.groups.find(i=>i.id===t.groupId):e.bots.find(i=>i.id===t.botId))?.messages.find(i=>i.id===t.messageId)?.card?.pendingAnswer!==t.answer)return e;const a={answered:void 0,pendingAnswer:void 0};return t.groupId?Yg(e,t.groupId,t.messageId,a):Mm(e,t.botId,t.messageId,a)}case"dismissCard":return t.groupId?Yg(e,t.groupId,t.messageId,{dismissed:!0}):Mm(e,t.botId,t.messageId,{dismissed:!0});case"decideRequest":return e;case"botAdded":return Bs({...t.preserveSelection||t.bot.id===e.selectedId?e:Ko(e),bots:[t.bot.messages?t.bot:{...t.bot,messages:[]},...e.bots.filter(n=>n.id!==t.bot.id)],...t.preserveSelection?{}:{activeView:"chat",selectedId:t.bot.id}},t.bot.id,"arrive");case"deleteBot":{const n=e.bots.filter(o=>o.id!==t.botId),s=e.selectedId===t.botId?n.find(o=>!o.hidden)?.id??n[0]?.id??"":e.selectedId,{[t.botId]:a,...i}=e.deletingBots;return yc({...e,bots:n,selectedId:s,deletingBots:i})}case"botDeletionPending":{if(t.on)return e.deletingBots[t.botId]?e:{...e,deletingBots:{...e.deletingBots,[t.botId]:!0}};if(!e.deletingBots[t.botId])return e;const{[t.botId]:n,...s}=e.deletingBots;return{...e,deletingBots:s}}case"markUnread":return nn(Bs(e,t.botId,"surprise"),t.botId,n=>({...n,unread:!0}));case"botPatched":{const n=e.bots.find(p=>p.id===t.bot.id);if(!n){const p={...e,bots:[{...t.bot,messages:t.bot.messages??[]},...e.bots]};return Tp(p,[t.bot])}const s=t.bot.unread&&!n?.unread?"surprise":t.bot.busy===!0&&!n?.busy?"working":t.bot.busy===!1&&n?.busy?"celebrate":null,a=s?Bs(e,t.bot.id,s):e,i=t.bot.busy===!1&&n?.busy&&a.computerStarts[t.bot.id]?Ar(a,{type:"computerStart",botId:t.bot.id,start:null}):a,o=t.bot.chiefOfStaff?{...i,bots:J5(i.bots,t.bot)}:i,c=typeof t.bot.threadId=="string"&&t.bot.threadId!==n.threadId&&!t.bot.tasks?.some(p=>p.threadId===n.threadId);let d=o;if(c){const{[t.bot.threadId]:p,...m}=o.backgroundThreadEvents;d={...o,backgroundThreadEvents:m}}if((c||n.awaitingThreadSnapshot&&t.bot.threadId===n.threadId)&&Array.isArray(t.bot.messages))return Ar(d,{type:"taskSwitched",bot:{...n,...t.bot,computer:t.bot.computer,section:t.bot.section,toolScope:t.bot.toolScope,managedSections:t.bot.managedSections,messages:t.bot.messages,browserProfile:t.bot.browserProfile,vpsAlias:t.bot.vpsAlias,phoneApps:t.bot.phoneApps,onlyPeopleAdded:t.bot.onlyPeopleAdded}});const u=nn(d,t.bot.id,p=>({...p,...t.bot,threadId:c?t.bot.threadId:p.threadId,activeLeafId:c?null:p.activeLeafId,awaitingThreadSnapshot:c||p.awaitingThreadSnapshot,browserProfile:t.bot.browserProfile,computer:t.bot.computer,toolScope:t.bot.toolScope,section:t.bot.section,managedSections:t.bot.managedSections,vpsAlias:t.bot.vpsAlias,phoneApps:t.bot.phoneApps,onlyPeopleAdded:t.bot.onlyPeopleAdded,tasks:t.bot.tasks?Am(p.tasks,t.bot.tasks):p.tasks,messages:c?[]:p.messages,hasMore:c?void 0:p.hasMore}));return yc(u)}case"messageAdded":{const n=e.bots.find(u=>u.threadId===t.threadId);if(!n){const u=e.groups.find(h=>h.threadId===t.threadId||h.tasks?.some(x=>x.threadId===t.threadId));if(!u||u.threadId===t.threadId&&u.messages.some(h=>h.id===t.message.id))return e;const p=Sa(e,t.threadId,t.message.at,Uc(t.message),t.message.turnCompletedAt??t.message.at);if(u.threadId!==t.threadId)return p;const m=t.message.sendId?u.messages.findIndex(h=>h.id===cl(t.message.sendId)):-1;return{...p,groups:p.groups.map(h=>h.id===u.id?{...h,messages:m>=0?h.messages.map((x,g)=>g===m?t.message:x):[...h.messages,t.message]}:h)}}if(n.messages.some(u=>u.id===t.message.id))return e;const s=Sa(e,t.threadId,t.message.at,Uc(t.message),t.message.turnCompletedAt??t.message.at),a=t.message.sendId?cl(t.message.sendId):null,i=a?n.messages.findIndex(u=>u.id===a):-1;if(i>=0)return nn(s,n.id,u=>({...u,messages:u.messages.map((p,m)=>m===i?t.message:p),activeLeafId:u.activeLeafId===a?t.message.id:u.activeLeafId}));const o=nn(s,n.id,u=>{const p=(t.message.parentId??null)===(u.activeLeafId??null);return{...u,messages:[...u.messages,t.message],activeLeafId:p?t.message.id:u.activeLeafId}}),c=t.message.role==="user"&&t.message.kind==="text"&&t.message.queueId?"working":t.message.kind==="options"?"thinking":t.message.kind==="activity"?t.message.tool?.ok===!1?"failure":t.message.tool?.ok===!0?"success":"working":t.message.role==="bot"&&t.message.kind==="text"?"blink":null;return c?Bs(o,n.id,c):o}case"optimisticMessageRemoved":{const n=cl(t.sendId),s=(p,m)=>p.filter(h=>h.id!==n).map(h=>h.optimisticThreadOrderAt===m.at?{...h,optimisticThreadOrderAt:m.optimisticThreadOrderAt}:h),a=e.bots.find(p=>p.threadId===t.threadId);if(a){const p=a.messages.find(g=>g.id===n);if(!p)return e;const m=nn(e,a.id,g=>({...g,messages:s(g.messages,p),activeLeafId:g.activeLeafId===n?t.restoreLeafId!==void 0?t.restoreLeafId:p.parentId??null:g.activeLeafId})),h=a.tasks?.find(g=>g.threadId===t.threadId),x=m.bots.find(g=>g.id===a.id)?.messages??[];return X5(m,t.threadId,x,h?.createdAt??0,a.hasMore?p.optimisticThreadOrderAt:void 0)}const i=e.groups.find(p=>p.threadId===t.threadId),o=i?.messages.find(p=>p.id===n);if(!i||!o)return e;const c={...e,groups:e.groups.map(p=>p.id===i.id?{...p,messages:s(p.messages,o)}:p)},d=i.tasks?.find(p=>p.threadId===t.threadId),u=c.groups.find(p=>p.id===i.id)?.messages??[];return X5(c,t.threadId,u,d?.createdAt??i.createdAt,i.hasMore?o.optimisticThreadOrderAt:void 0)}case"messagePatched":{const n=Uc(t.message)?Sa(e,t.threadId,t.message.at,!0,t.message.turnCompletedAt??t.message.at):e,s=n.bots.find(o=>o.threadId===t.threadId);if(!s){const o=n.groups.find(c=>c.threadId===t.threadId);return o?{...n,groups:n.groups.map(c=>c.id===o.id?{...c,messages:c.messages.map(d=>d.id===t.message.id?t.message:d)}:c)}:n}const a=t.message.kind==="activity"?t.message.tool?.ok===!1?"failure":t.message.tool?.ok===!0?"success":"working":null,i=a?Bs(n,s.id,a):n;return nn(i,s.id,o=>({...o,messages:o.messages.map(c=>c.id===t.message.id?t.message:c)}))}case"computerStart":{const{[t.botId]:n,...s}=e.computerStarts;return{...t.start?Bs(e,t.botId,"launch"):e,computerStarts:t.start?{...s,[t.botId]:t.start}:s}}case"computerControl":return{...e,computerControl:{...e.computerControl,[t.botId]:{held:t.held,helpReason:t.helpReason,help:t.help??null}}};case"modelVariantRuntime":{const n=t.event;if(!n.turnId)return e;const s=e.bots.find(o=>o.threadId===n.threadId||o.tasks?.some(c=>c.threadId===n.threadId));if(!s)return e;const a=Qn(s,n.threadId).modelSelection;if(a.instanceId!==n.providerInstanceId||!e.instances.find(o=>o.instanceId===a.instanceId)?.capabilities?.modelVariants)return e;const i=e.modelVariantSessions[n.threadId];return n.type==="turn.started"?i&&(i.turnId===n.turnId||Date.parse(i.startedAt)>Date.parse(n.createdAt))?e:{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{instanceId:a.instanceId,model:a.model,turnId:n.turnId,startedAt:n.createdAt,acceptingUpdates:!0}}}:!i?.acceptingUpdates||i.turnId!==n.turnId||i.instanceId!==a.instanceId||i.model!==a.model?e:n.type==="session.model-variants"&&n.model===a.model?{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{...i,variants:n.variants}}}:n.type==="turn.completed"?{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{...i,acceptingUpdates:!1}}}:e}case"setModel":if(t.threadId){const n=Ar(e,{type:"updateTask",botId:t.botId,threadId:t.threadId,patch:{modelSelection:t.selection,resetApprovalToAsk:t.resetApprovalToAsk}});return nn(n,t.botId,s=>({...s,tasks:s.tasks?.map(a=>a.threadId!==t.threadId?a:{...a,followsBotModel:!!t.updateBotDefault||nA(t.selection,s.modelSelection)})}))}return yc(nn(e,t.botId,n=>({...n,modelSelection:t.selection})));case"updateTask":{const n=LA(t.patch);return yc(nn(e,t.botId,s=>({...s,tasks:(s.tasks??[{threadId:s.threadId,title:"New thread",createdAt:Date.now()}]).map(a=>a.threadId===t.threadId?{...a,...n}:a)})))}case"connected":return{...e,connected:t.value};case"error":return{...t.message&&e.selectedId?Bs(e,e.selectedId,"alert"):e,error:t.message};case"toggleSettings":{if(t.botId!==void 0&&!e.bots.some(o=>o.id===t.botId&&!o.hidden))return e;const n=t.botId??e.selectedId,s=t.open??(t.botId!==void 0||!e.settingsOpen),a=s&&!e.settingsOpen,i=t.section!==void 0;return{...e,selectedId:n,settingsOpen:s,activityOpen:s?!1:e.activityOpen,botSettingsSection:t.section??e.botSettingsSection,botSettingsExpandAccordion:s?i||a&&e.botSettingsSectionStored:!1,botSettingsExpandRemembered:s?!i&&a&&e.botSettingsSectionStored:!1,botSettingsSectionStored:i||e.botSettingsSectionStored,appSettingsOpen:s?!1:e.appSettingsOpen}}case"togglePlugins":{const n=t.open??!e.pluginsOpen;return{...e,pluginsOpen:n,pluginsSurface:t.surface??e.pluginsSurface,...n?{settingsOpen:!1,appSettingsOpen:!1,shortcutsOpen:!1}:{}}}case"botCreationPending":return{...e,botCreationPending:t.on};case"notice":return{...e,notice:t.notice};case"revealThread":return{...e,appSettingsOpen:!1,shortcutsOpen:!1,pluginsOpen:!1,revealThread:{threadId:t.threadId,nonce:(e.revealThread?.nonce??0)+1}};case"focusMessage":return{...e,focusMessage:{threadId:t.threadId,messageId:t.messageId,matchText:t.matchText,nonce:(e.focusMessage?.nonce??0)+1,consumed:!1}};case"focusMessageConsumed":return!e.focusMessage||e.focusMessage.nonce!==t.nonce?e:{...e,focusMessage:{...e.focusMessage,consumed:!0}};case"unreadDividerDone":return e.unreadDivider?.threadId===t.threadId?{...e,unreadDivider:null}:e;case"openDataResult":return e.bots.some(s=>s.id===t.botId)?{...Ar(Ar(e,{type:"select",id:t.botId}),{type:"toggleComputer",open:!0}),dataResultFocus:{botId:t.botId,id:t.cardId,requestId:(e.dataResultFocus?.requestId??0)+1,consumed:!1}}:e;case"dataResultFocusConsumed":return e.dataResultFocus?.requestId===t.requestId?{...e,dataResultFocus:{...e.dataResultFocus,consumed:!0}}:e;case"openSignIn":{if(!e.bots.some(i=>i.id===t.botId))return e;const n=Ar(Ar(e,{type:"select",id:t.botId}),{type:"toggleComputer",open:!0}),{type:s,...a}=t;return{...n,signInFocus:{...a,requestId:(e.signInFocus?.requestId??0)+1,consumed:!1}}}case"signInFocusConsumed":return e.signInFocus?.requestId===t.requestId?{...e,signInFocus:{...e.signInFocus,consumed:!0}}:e;case"toggleComputer":{const n=t.open??!e.computerOpen;return{...e,selectedId:t.botId!==void 0&&e.bots.some(s=>s.id===t.botId)?t.botId:e.selectedId,computerOpen:n,settingsOpen:n?!1:e.settingsOpen,inspectorOpen:n?!1:e.inspectorOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleInspector":{const n=t.open??!e.inspectorOpen;return{...e,inspectorOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleActivity":{const n=t.open??!e.activityOpen;return{...e,activityOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleNotifications":{const n=t.open??!e.notificationsOpen;return{...e,notificationsOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen}}case"toggleNotificationsPinned":return{...e,notificationsPinned:t.pinned??!e.notificationsPinned};case"toggleAppSettings":{const n=t.open??!e.appSettingsOpen;return{...e,appSettingsOpen:n,activityOpen:n?!1:e.activityOpen,appSettingsSection:t.section??e.appSettingsSection,appSettingsCloudLink:t.cloudLink&&n?e.appSettingsCloudLink+1:0,appSettingsPhonePairing:t.phonePairing&&n?e.appSettingsPhonePairing+1:0,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,pluginsOpen:n?!1:e.pluginsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleShortcuts":{const n=t.open??!e.shortcutsOpen;return{...e,shortcutsOpen:n}}case"openCloudAdd":return{...e,cloudAdd:e.cloudAdd??{source:t.source,...t.signIn?{signIn:!0}:{}},cloudHowTo:!1};case"closeCloudAdd":return e.cloudAdd?{...e,cloudAdd:null}:e;case"cloudHowTo":return e.cloudHowTo===t.open?e:{...e,cloudHowTo:t.open};case"toggleTour":{const n=t.open??!e.tourOpen;return{...e,tourOpen:n,appSettingsOpen:n?!1:e.appSettingsOpen}}case"toggleWelcome":{const n=t.open??!e.welcomeOpen;return{...e,welcomeOpen:n,appSettingsOpen:n?!1:e.appSettingsOpen,shortcutsOpen:n?!1:e.shortcutsOpen}}case"updateBot":{const s=Object.prototype.hasOwnProperty.call(t.patch,"color")||Object.prototype.hasOwnProperty.call(t.patch,"mascotExpression")?Bs(e,t.botId,"customize"):e,a=s.bots.find(y=>y.id===t.botId),i=t.patch.chiefOfStaff?{...s,bots:J5(s.bots,{...a,...t.patch,id:t.botId})}:s,{acknowledgeLocalAuto:o,applyToAllThreads:c,keepThreadModels:d,threadId:u,mainThreadChoice:p,computer:m,connectorTools:h,connectorScopes:x,phoneApps:g,...k}=t.patch,v={...k,...g!==void 0&&{phoneApps:g??void 0},...typeof p=="string"&&{mainThreadId:p}};return m===null?v.computer=void 0:m!==void 0&&(v.computer=m),h===null?v.connectorTools=void 0:h!==void 0&&(v.connectorTools=h),x===null?v.connectorScopes=void 0:x!==void 0&&(v.connectorScopes=x),nn(i,t.botId,y=>({...y,...v}))}case"threadActive":{const n=e.bots.find(s=>s.threadId===t.threadId);return n?nn(_p(e,t.threadId),n.id,s=>({...s,activeLeafId:t.activeLeafId})):e}case"switchBranch":{const n=e.bots.find(a=>a.id===t.botId);if(!n)return e;let s=t.messageId;for(;;){const a=n.messages.filter(i=>i.parentId===s);if(!a.length)break;s=a.reduce((i,o)=>o.at>=i.at?o:i).id}return nn(_p(e,n.threadId),t.botId,a=>({...a,activeLeafId:s}))}case"patchGroup":return{...e,groups:e.groups.map(n=>n.id===t.groupId?{...n,...t.patch}:n)};case"pendingQueued":{if(e.consumedQueueIds[t.queueId]){const s={...e.consumedQueueIds};return delete s[t.queueId],{...e,consumedQueueIds:s}}const n=e.pendingQueued[t.threadId]??[];return n.some(s=>s.queueId===t.queueId)?e:{...e,pendingQueued:{...e.pendingQueued,[t.threadId]:[...n,{queueId:t.queueId,text:t.text,...t.reason?{reason:t.reason}:{}}]}}}case"consumePendingQueued":{const n=e.pendingQueued[t.threadId]??[],s=n.findIndex(o=>o.queueId===t.queueId);if(s<0)return{...e,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)};const a=n.filter((o,c)=>c!==s),i={...e.pendingQueued};return a.length?i[t.threadId]=a:delete i[t.threadId],{...e,pendingQueued:i,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)}}case"cancelQueued":{const n=e.bots.find(c=>c.id===t.botId);if(!n)return e;const s=t.threadId??n.threadId,i=(e.pendingQueued[s]??[]).filter(c=>c.queueId!==t.queueId),o={...e.pendingQueued};return i.length?o[s]=i:delete o[s],{...e,pendingQueued:o,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)}}case"steerQueued":return e;case"cancelGroupQueued":{const n=e.pendingQueued[t.threadId]??[],s=n.filter(i=>i.queueId!==t.queueId);if(s.length===n.length)return e;const a={...e.pendingQueued};return s.length?a[t.threadId]=s:delete a[t.threadId],{...e,pendingQueued:a}}case"send":{const n=Bs(EX(e,t.botId),t.botId,"working");if(!t.sendId)return n;const s=n.bots.find(o=>o.id===t.botId),a=t.threadId??s?.threadId;if(!s||a!==s.threadId||s.messages.some(o=>o.sendId===t.sendId))return n;const i=qg(t.text,t.sendId,t.replyToId,s.activeLeafId);return i.optimisticThreadOrderAt=s.tasks?.find(o=>o.threadId===a)?.lastThreadOrderAt,Sa(nn(n,s.id,o=>({...o,messages:[...o.messages,i],activeLeafId:i.id})),a,i.at,!0)}case"editMessage":{const n=Bs(e,t.botId,"working");if(!t.sendId)return n;const s=n.bots.find(c=>c.id===t.botId),a=t.threadId??s?.threadId;if(!s||a!==s.threadId||s.messages.some(c=>c.sendId===t.sendId))return n;const i=s.messages.find(c=>c.id===t.messageId);if(!i||i.role!=="user"||i.kind!=="text")return n;const o=qg(t.text.trim(),t.sendId,i.replyToId,i.parentId??null);return o.optimisticThreadOrderAt=s.tasks?.find(c=>c.threadId===a)?.lastThreadOrderAt,Sa(nn(n,s.id,c=>({...c,messages:[...c.messages,o],activeLeafId:o.id})),a,o.at,!0)}case"switchGroupTask":return e.selectedId===t.groupId&&e.activeView==="chat"?e4(e,t.groupId,t.threadId):e;case"newGroupTask":return e.selectedId===t.groupId&&e.activeView==="chat"?Ko(e):e;case"deleteTask":case"deleteGroupTask":case"regenerateTaskTitle":return e;case"newTask":return t.cwd!==void 0?e:{...Ko(e),selectedId:t.botId,activeView:"chat"};case"switchTask":{const{[t.threadId]:n,...s}=e.backgroundThreadEvents;return nn({...e4(e,t.botId,t.threadId),backgroundThreadEvents:s,selectedId:t.botId,activeView:"chat",revealThread:{threadId:t.threadId,nonce:(e.revealThread?.nonce??0)+1}},t.botId,a=>({...a,switchingTo:t.threadId}))}case"switchTaskFailed":return nn(e,t.botId,n=>n.switchingTo===t.threadId?{...n,switchingTo:void 0}:n);case"renameTask":return nn(e,t.botId,n=>({...n,tasks:(n.tasks??[]).map(s=>s.threadId===t.threadId?{...s,title:t.title}:s)}));case"renameGroupTask":return Sp(e,t.groupId,t.threadId,{title:t.title});case"pinGroupTask":return Sp(e,t.groupId,t.threadId,{pinned:t.pinned?!0:void 0});case"archiveGroupTask":return Sp(e,t.groupId,t.threadId,{archivedAt:t.archivedAt??void 0});case"setConversationTurnLimit":return t.dm?{...e,groups:e.groups.map(n=>n.id===t.groupId?{...n,turnTimeoutMinutes:t.minutes??void 0}:n)}:Sp(e,t.groupId,t.threadId,{turnTimeoutMinutes:t.minutes??void 0});case"taskSwitched":{let n=nn(_p(e,t.bot.threadId),t.bot.id,o=>({...o,...t.bot,computer:t.bot.computer,toolScope:t.bot.toolScope,managedSections:t.bot.managedSections,vpsAlias:t.bot.vpsAlias,messages:t.bot.messages??[],hasMore:t.bot.hasMore,awaitingThreadSnapshot:!1,switchingTo:void 0}));for(const o of e.backgroundThreadEvents[t.bot.threadId]??[])n=Ar(n,o);const{[t.bot.threadId]:s,...a}=n.backgroundThreadEvents;n={...n,backgroundThreadEvents:a};const i=n.bots.find(o=>o.id===t.bot.id);return i&&i.id===n.selectedId&&(n={...n,unreadDivider:Gg(n,i.threadId,a4(i),Es(i),r4(i),i.hasMore)},n.activeView==="chat"&&(n=nn(n,i.id,o=>({...o,unread:!!o.tasks?.some(c=>c.threadId!==o.threadId&&c.unread),tasks:o.tasks?.map(c=>c.threadId===o.threadId?{...c,unread:!1}:c)})))),yc(Tp(n,[t.bot]))}case"newBot":return t.preserveSelection?e:{...e,settingsOpen:!1,appSettingsOpen:!1,pluginsOpen:!1,shortcutsOpen:!1};case"duplicateBot":case"createProject":case"updateProject":case"deleteProject":case"reorderProjects":case"interrupt":case"createGroup":case"deleteGroup":case"interruptGroup":case"setGroupHold":case"steerGroupQueued":case"createRoutine":case"updateRoutine":case"deleteRoutine":case"runRoutine":case"cancelRoutineRun":case"markRoutineRunSeen":case"markAllRoutineRunsSeen":case"refreshTaskPermissions":case"followBotModel":case"loadDataSheet":return e;case"dataSheet":return{...e,dataSheets:{...e.dataSheets,[t.sheet.botId]:t.sheet},...t.tables?{dataTables:{...e.dataTables,[t.sheet.botId]:t.tables}}:{}};case"dataView":return{...e,dataView:t.view};case"sendGroup":{if(!t.sendId)return e;const n=e.groups.find(o=>o.id===t.groupId);if(!n)return e;const s=t.threadId??n.threadId;if(s===n.threadId&&n.messages.some(o=>o.sendId===t.sendId))return e;const a=qg(t.text,t.sendId,t.replyToId,null,t.mode??"chat");a.optimisticThreadOrderAt=n.tasks?.find(o=>o.threadId===s)?.lastThreadOrderAt;const i=Sa(e,s,a.at,s===n.threadId);return s!==n.threadId?i:{...i,groups:i.groups.map(o=>o.id===n.id?{...o,messages:[...o.messages,a]}:o)}}}}function AX(e){const t=e&&typeof e=="object"&&"tables"in e?e.tables:void 0;return Array.isArray(t)?t.filter(n=>n&&typeof n.name=="string"):[]}function TX(e,t){const n=e&&typeof e=="object"&&"sheet"in e?e.sheet:e;if(n&&typeof n=="object"&&Array.isArray(n.cards)){const s=n;return{...s,botId:s.botId||t,sources:Array.isArray(s.sources)?s.sources:[]}}return{version:1,botId:t,cards:[],sources:[],updatedAt:new Date(0).toISOString()}}const _X={modelVariantSessions:{},backgroundThreadEvents:{},loadingOlder:{},transcriptGeneration:{},bots:[],groups:[],sections:[],instances:[],config:null,liveCall:null,liveCallVersion:0,liveCallLookupSeq:0,selectedId:"",activeView:"chat",routines:[],routineRuns:[],routineRunsSince:null,routinesLoadState:"loading",routinesFocus:{nonce:0},filesSuggest:null,webhooks:[],webhookAttempts:[],webhookIngress:null,settingsOpen:!1,pluginsOpen:!1,pluginsSurface:"apps",botCreationPending:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,notificationsOpen:!1,notificationsPinned:!1,notifications:[],appSettingsOpen:!1,appSettingsSection:"general",appSettingsCloudLink:0,appSettingsPhonePairing:0,shortcutsOpen:!1,cloudAdd:null,cloudHowTo:!1,welcomeOpen:!1,tourOpen:!1,botSettingsSection:"overview",botSettingsExpandAccordion:!1,botSettingsSectionStored:!1,botSettingsExpandRemembered:!1,computerStarts:{},deletingBots:{},computerControl:{},dataSheets:{},dataTables:{},dataResultFocus:null,signInFocus:null,dataView:null,focusMessage:null,unreadDivider:null,connected:!1,error:null,notice:null,revealThread:null,mascotMotion:null,pendingQueued:{},consumedQueueIds:{}},Wc=200,N4=80;function ud(){if(!(typeof window>"u"||!window.ogb?.approvals))return Xh().host.packaged?window.ogb.approvals:void 0}async function MX(e,t,n,s,a=K){const{approvalMode:i,autoApprove:o,acknowledgeLocalAuto:c,...d}=n,u=i??(o===void 0?void 0:o?"auto":"ask");if(u==="custom"&&!s)throw new Error(l("approvalMode.needsDesktopApp"));return u&&s?(Object.keys(d).length&&await a(`/api/bots/${e}/tasks/${t}`,{method:"PATCH",body:JSON.stringify(d)}),s.setMode(e,u,{threadId:t,threadOnly:!0,acknowledgeLocalAuto:c===!0})):(await a(`/api/bots/${e}/tasks/${t}`,{method:"PATCH",body:JSON.stringify({...d,approvalMode:i,autoApprove:o,acknowledgeLocalAuto:c})})).bot}async function $A(e,t,n,s=K,a=ud(),i,o=!1){const{approvalMode:c,applyToAllThreads:d,...u}=t,p=c!==void 0&&c!=="custom"&&(In(i??{})==="custom"||d===!0&&zA(i??{}).includes("custom"));if(!(c==="custom"||p||c==="full"&&a!==void 0)){const k=JSON.stringify(c===void 0?u:{...u,approvalMode:c,...d?{applyToAllThreads:!0}:{}});return(await s(`/api/bots/${e}`,{method:"PATCH",body:k,signal:n,keepalive:o&&XZ(k)})).bot}if(!a||c===void 0)throw new Error(l("approvalMode.levelNeedsDesktopApp"));const h={acknowledgeLocalAuto:u.acknowledgeLocalAuto===!0,...d?{allThreads:!0}:{}},x=async()=>{if(n.aborted){if(c==="full"||c==="custom")try{await a.setMode(e,"ask",{acknowledgeLocalAuto:!1,...d?{allThreads:!0}:{}})}catch(k){throw new Error(l("approvalMode.revokeFailed",{mode:l(c==="full"?"approvalMode.full.label":"approvalMode.custom.name"),error:k instanceof Error?k.message:String(k)}))}throw new DOMException("The bot update was cancelled","AbortError")}};if(p){const k=await a.setMode(e,c,h);return await x(),Object.keys(u).length===0?k:(await s(`/api/bots/${e}`,{method:"PATCH",body:JSON.stringify(u),signal:n})).bot}if(Object.keys(u).length>0&&await s(`/api/bots/${e}`,{method:"PATCH",body:JSON.stringify(u),signal:n}),n.aborted)throw new DOMException("The bot update was cancelled","AbortError");const g=await a.setMode(e,c,h);return await x(),g}const Mp=new Map;async function RX(e,t,n){const s=Mp.get(e);if(s)return s;const a=(async()=>{n(e,await t(e))})();Mp.set(e,a);try{await a}finally{Mp.get(e)===a&&Mp.delete(e)}}function BA(e){return e instanceof Error?e:new Error(String(e))}async function OX(e,t,n){const[s,...a]=await Promise.allSettled([e(),...t.map(i=>i.load())]);return a.forEach((i,o)=>{i.status==="rejected"&&n(t[o],BA(i.reason))}),s.status==="fulfilled"}function zX(e){return eZ(e),e.type==="turn.started"||e.type==="session.model-variants"||e.type==="turn.completed"?{type:"modelVariantRuntime",event:e}:null}const Uu=f.createContext(null);function LX(e){const t=cZ();return t?{...e,botSettingsSection:t,botSettingsSectionStored:!0}:e}function PX({children:e}){const t=f.useRef(new Map).current,n=j=>({...j,tasks:j.tasks?.map(S=>({...S,...LA(t.get(S.threadId)?.patch??{})}))}),[s,a]=f.useReducer(Ar,_X,j=>hJ(LX(j))),i=f.useRef(s),o=f.useRef(0);i.current=s;const c=Qe(),d=f.useRef(c);d.current=c;const u=f.useCallback(()=>{a({type:"error",message:null})},[]);sX(s.error,u),f.useEffect(()=>{s.selectedId&&oZ(s.selectedId)},[s.selectedId]),f.useEffect(()=>{s.settingsOpen&&s.botSettingsExpandAccordion&&dZ(s.botSettingsSection)},[s.settingsOpen,s.botSettingsExpandAccordion,s.botSettingsSection]);const p=f.useMemo(()=>ZZ({send:(j,S,E,A,_)=>$A(j,S,E,K,ud(),A,_),reconcile:async(j,S)=>(await K(`/api/bots?messages=${Wc}`,{signal:S})).bots.find(A=>A.id===j)??null,onAuthoritative:(j,S)=>{a({type:"botPatched",bot:n({...j,...S})})},onError:j=>{a({type:"error",message:j.message})}}),[]);f.useEffect(()=>{p.revive();const j=QZ(p,window);return()=>{j(),p.dispose()}},[p]);const m=f.useMemo(()=>{const j=new Map,S=jJ(()=>i.current,a),E=new Set,A=eX();let _=!1;const N=M=>{$E(M)||(nX(M)?$({type:"notice",notice:{kind:"note",botName:null,text:M.message}}):a({type:"error",message:M instanceof Error?M.message:String(M)}))},C=M=>F=>{N(F),K("/api/bots?messages=0").then(W=>{const z=NJ(M,W);z?.type==="botPatched"?a({...z,bot:n({...z.bot,...p.overlayFor(z.bot.id)})}):z&&a(z)}).catch(()=>{})},R=M=>{const F=M.groupId?i.current.groups.find(W=>W.id===M.groupId):i.current.bots.find(W=>W.id===M.botId);return{host:F,card:F?.messages.find(W=>W.id===M.messageId)?.card,inRoom:!!M.groupId}},O=(M,F,W)=>{fetch(`/api/bots/${M}/cards/${F}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(W)}).catch(()=>{})},q=async(M,F)=>{const W=F?t.get(F)?.execution:void 0,z=[...t.values()].filter(B=>B.updatesDefault&&M.some(D=>D.id===B.botId));await Promise.all([W,...z.map(B=>B.execution),...M.map(async B=>{const D=await p.flush(B.id);if(!D)return;const T=B.modelSelection;if(In(D)!==In(B)||D.memoryEnabled!==!1!=(B.memoryEnabled!==!1)||D.modelSelection.instanceId!==T.instanceId||D.modelSelection.model!==T.model||D.modelSelection.effort!==T.effort||D.modelSelection.variant!==T.variant)throw new Error(l("approvalMode.settingsNotSaved"))})]),F&&await t.get(F)?.execution},L=(M,F,W)=>{const z=t.get(F),B=W.updateBotDefault||W.approvalMode!==void 0?[...t.values()].filter(U=>U.botId===M):[],D=Promise.all([z?.promise,...B.map(U=>U.promise)].map(U=>U?.catch(()=>{}))).then(async()=>{const U=W.resetApprovalToAsk?Gv():void 0;return U?U.setMode(M,"ask",{threadId:F,modelSelection:W.modelSelection,updateBotDefault:!!W.updateBotDefault}):MX(M,F,W,ud())}),T=Promise.all([z?.execution,D]);T.catch(()=>{});const V={botId:M,updatesDefault:!!(W.updateBotDefault||z?.updatesDefault),patch:{...z?.patch,...W},promise:D,execution:T};t.set(F,V),V.promise.then(U=>{t.get(F)===V&&(t.delete(F),U&&a({type:"botPatched",bot:n(U)}))}).catch(U=>{N(U),t.get(F)===V&&(V.patch={},KY(()=>t.get(F)===V,()=>K(`/api/bots?messages=${Wc}`).then(({bots:H})=>{const G=t.get(F)===V?H.find(Z=>Z.id===M):void 0;G&&(a({type:"botPatched",bot:n(G)}),t.delete(F))})))})},P=M=>{const F=i.current,W=new Set;for(const z of F.bots)(z.threadId===M||z.tasks?.some(B=>B.threadId===M))&&W.add(z.id);for(const z of F.groups)if(z.threadId===M||z.tasks?.some(B=>B.threadId===M))for(const B of z.memberIds)W.add(B);return F.bots.filter(z=>W.has(z.id))},$=M=>{["select","newTask","switchTask","newGroupTask","switchGroupTask","showChat","showRoutines","showTeamMap","showFiles","showWebPanel"].includes(M.type)&&o.current++,M=CX(M,i.current.bots),M.type==="taskSwitched"&&(M={...M,bot:n(M.bot)}),M.type==="botPatched"&&(M={...M,bot:n(M.bot)}),(M.type==="send"||M.type==="sendGroup"||M.type==="editMessage")&&!M.sendId&&(M={...M,sendId:dr()});const F=M.type==="updateBot"||M.type==="setModel"?i.current.bots.find(T=>T.id===M.botId):void 0,W=M.type==="send"?i.current.bots.find(T=>T.id===M.botId):void 0,z=M.type==="editMessage"?i.current.bots.find(T=>T.id===M.botId)?.activeLeafId??null:null,B=(()=>{if(M.type==="editMessage"||M.type==="answerCard"){const T=i.current.bots.find(V=>V.id===M.botId);return T?[T]:[]}if(M.type==="decideRequest"){const T=P(M.threadId);if(!M.alwaysAllow||T.some(U=>U.id===M.alwaysAllow?.botId))return T;const V=i.current.bots.find(U=>U.id===M.alwaysAllow?.botId);return V?[...T,V]:T}if(M.type==="sendGroup"){const T=i.current.groups.find(V=>V.id===M.groupId)?.memberIds??[];return i.current.bots.filter(V=>T.includes(V.id))}if(M.type==="runRoutine"){const T=i.current.routines.find(U=>U.id===M.routineId);if(!T)return[];const V=new Set([T.botId]);if(T.target==="room-goal"&&T.groupId){const U=i.current.groups.find(H=>H.id===T.groupId);for(const H of U?.memberIds??[])V.add(H)}return i.current.bots.filter(U=>V.has(U.id))}return[]})(),D=(()=>{if(M.type==="send")return W?DA(W):void 0})();switch(M.type!=="cancelQueued"&&M.type!=="cancelGroupQueued"&&M.type!=="deleteBot"&&a(M),M.type){case"loadOlderMessages":{if(E.has(M.threadId))break;E.add(M.threadId);const T=i.current,U=[...T.bots,...T.groups].find(G=>G.threadId===M.threadId)?.messages[0]?.id,H=T.transcriptGeneration[M.threadId]??0;if(!U){E.delete(M.threadId),a({type:"olderMessages",threadId:M.threadId,generation:H,messages:[],hasMore:!1});break}K(`/api/threads/${M.threadId}/messages?limit=${Wc}&before=${encodeURIComponent(U)}`).finally(()=>E.delete(M.threadId)).then(G=>a({type:"olderMessages",threadId:M.threadId,generation:H,messages:G.messages??[],hasMore:!!G.hasMore})).catch(G=>{a({type:"olderMessages",threadId:M.threadId,generation:H,messages:[],hasMore:!0}),N(G)});break}case"notice":M.notice&&setTimeout(()=>a({type:"notice",notice:null}),M.notice.kind==="note"?2e4:6e3);break;case"createRoutine":K("/api/routines",{method:"POST",body:JSON.stringify(M.input)}).catch(N);break;case"updateRoutine":K(`/api/routines/${M.routineId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).then(({routine:T})=>a({type:"routinePatched",routine:T}),N);break;case"deleteRoutine":K(`/api/routines/${M.routineId}`,{method:"DELETE"}).catch(N);break;case"runRoutine":q(B).then(()=>K(`/api/routines/${M.routineId}/run`,{method:"POST"})).then(({run:T})=>M.onStarted?.(T)).catch(T=>{M.onError?M.onError(T):N(T)}).finally(()=>M.onSettled?.());break;case"cancelRoutineRun":K(`/api/routine-runs/${M.runId}/cancel`,{method:"POST"}).catch(N);break;case"loadDataSheet":K(BE.sheet(M.botId)).then(T=>a({type:"dataSheet",sheet:TX(T,M.botId),tables:AX(T)})).catch(T=>(M.onError??N)(T instanceof Error?T.message:String(T)));break;case"markRoutineRunSeen":K(`/api/routine-runs/${M.runId}/seen`,{method:"POST"}).catch(N);break;case"markAllRoutineRunsSeen":K("/api/routine-runs/seen-all",{method:"POST"}).catch(N);break;case"cancelQueued":K(`/api/bots/${M.botId}/queue/${M.queueId}`,{method:"DELETE",body:JSON.stringify({threadId:M.threadId})}).then(()=>{a(M),M.onCancelled?.()}).catch(N);break;case"steerQueued":K(`/api/bots/${M.botId}/queue/${M.queueId}/steer`,{method:"POST",body:JSON.stringify({threadId:M.threadId})}).then(T=>{if(T?.steered===!0&&Array.isArray(T.messages)&&typeof T.threadId=="string"){for(const V of T.messages)a({type:"messageAdded",threadId:T.threadId,message:V});for(const V of T.queueIds??[])a({type:"consumePendingQueued",threadId:T.threadId,queueId:V})}else T?.queued===!0&&T.blockedBy==="images"&&$({type:"notice",notice:{kind:"steer-images",botName:null}});M.onSettled?.()}).catch(T=>{N(T),M.onError?.()});break;case"cancelGroupQueued":K(`/api/groups/${M.groupId}/queue/${M.queueId}`,{method:"DELETE"}).then(()=>{a(M),M.onCancelled?.()}).catch(N);break;case"steerGroupQueued":K(`/api/groups/${M.groupId}/queue/${M.queueId}/steer`,{method:"POST",body:JSON.stringify({threadId:M.threadId})}).then(T=>{if(T?.steered===!0&&Array.isArray(T.messages)&&typeof T.threadId=="string"){for(const V of T.messages)a({type:"messageAdded",threadId:T.threadId,message:V});for(const V of T.queueIds??[])a({type:"consumePendingQueued",threadId:T.threadId,queueId:V})}else T?.queued===!0&&T.blockedBy==="images"&&$({type:"notice",notice:{kind:"steer-images",botName:null}});M.onSettled?.()}).catch(T=>{N(T),M.onError?.()});break;case"send":{D&&O(M.botId,D.id,{dismissed:!0});const T=M.threadId??i.current.bots.find(H=>H.id===M.botId)?.threadId,V=M.sendId??dr(),U=()=>xJ(i.current.bots.find(H=>H.id===M.botId&&H.threadId===T)?.messages,V);q(W?[W]:[],T).then(()=>bJ(()=>K(`/api/bots/${M.botId}/messages`,{method:"POST",body:JSON.stringify({text:M.text,replyToId:M.replyToId,threadId:T,sendId:V,...M.dataContext?{dataContext:M.dataContext}:{},...M.pointed?.length?{pointed:M.pointed}:{},...M.openPage?{openPage:M.openPage}:{},...M.mode==="goal"?{mode:"goal"}:{},...M.followUp?{followUp:M.followUp}:{},...M.mentions?.length?{mentions:M.mentions}:{}})}),U)).then(H=>{if(!("body"in H))return;const G=H.body;G?.message&&typeof G.threadId=="string"&&a({type:"messageAdded",threadId:G.threadId,message:G.message}),G?.queued&&typeof G.threadId=="string"&&typeof G.queueId=="string"&&(a({type:"optimisticMessageRemoved",threadId:G.threadId,sendId:V}),a({type:"pendingQueued",threadId:G.threadId,queueId:G.queueId,text:M.text,reason:G.reason==="capacity"||G.reason==="group-turn"?G.reason:void 0}))}).catch(H=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V}),N(H),M.onError?.()});break}case"editMessage":{const T=M.threadId??i.current.bots.find(U=>U.id===M.botId)?.threadId,V=M.sendId??dr();q(B,T).then(()=>K(`/api/bots/${M.botId}/messages/${M.messageId}/edit`,{method:"POST",body:JSON.stringify({text:M.text.trim(),threadId:T,sendId:V})})).then(U=>{U?.message&&T&&a({type:"messageAdded",threadId:T,message:U.message})}).catch(U=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V,restoreLeafId:z}),N(U)});break}case"switchBranch":K(`/api/bots/${M.botId}/active-branch`,{method:"POST",body:JSON.stringify({messageId:M.messageId,threadId:M.threadId})}).catch(N);break;case"decideRequest":{const T=()=>K(`/api/threads/${M.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:M.requestId,behavior:M.behavior,message:M.message,reviewedSha256:M.reviewedSha256,always:M.always,rememberCommand:M.rememberCommand})});q(B,M.threadId).then(async()=>{if(M.alwaysAllow){const U=i.current.bots.find(Z=>Z.id===M.alwaysAllow?.botId),H=U?.tasks?.some(Z=>Z.threadId===M.threadId),G=[...new Set([...U?Qn(U,M.threadId).alwaysAllow??[]:[],M.alwaysAllow.key])];try{await K(H?`/api/bots/${M.alwaysAllow.botId}/always-allow`:`/api/bots/${M.alwaysAllow.botId}`,{method:H?"POST":"PATCH",body:JSON.stringify(H?{threadId:M.threadId,allowKey:M.alwaysAllow.key}:{alwaysAllow:G})})}catch(Z){N(Z)}}const V=await T();V?.settlementPending&&typeof V.message=="string"&&N(new Error(V.message))}).catch(V=>{N(V),M.onError?.(V instanceof Error?V.message:String(V))});break}case"answerCard":{const{host:T,card:V,inRoom:U}=R(M);q(B,M.threadId).then(()=>{if(V?.requestId&&T){const H=V.skillRequest?{behavior:MJ(M.answer)}:YJ(V,M.answer);return K(`/api/threads/${M.threadId??T.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:V.requestId,...H,reviewedSha256:H.behavior==="allow"&&V.skillRequest?Ew(V.skillRequest):void 0})})}if(!U)return O(M.botId,M.messageId,{answered:M.answer,dismissed:!0}),K(`/api/bots/${M.botId}/messages`,{method:"POST",body:JSON.stringify({text:M.answer,threadId:M.threadId})})}).catch(H=>{V?.requestId&&T&&a({type:"answerCardFailed",botId:M.botId,messageId:M.messageId,answer:M.answer,groupId:M.groupId}),N(H)});break}case"dismissCard":{const{host:T,card:V,inRoom:U}=R(M);V?.requestId&&T?K(`/api/threads/${M.threadId??T.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:V.requestId,...cA(V)})}).catch(()=>{}):U||O(M.botId,M.messageId,{dismissed:!0});break}case"newBot":{if(G5(i.current)||_||i.current.botCreationPending)break;_=!0,a({type:"botCreationPending",on:!0}),_e(async()=>{const{makeNewBot:T}=await import("./new-bot-BxtfLvSH.js").then(V=>V.n);return{makeNewBot:T}},__vite__mapDeps([0,1,2,3,4])).then(({makeNewBot:T})=>T(M,i.current.bots,$,d.current)).catch(N).finally(()=>{_=!1,a({type:"botCreationPending",on:!1})});break}case"duplicateBot":{if(G5(i.current))break;const T=i.current.bots.find(U=>U.id===M.botId);if(!T)break;const V=OJ(T);K("/api/bots",{method:"POST",body:JSON.stringify(RJ(T))}).then(({bot:U,paused:H})=>K(`/api/bots/${U.id}`,{method:"PATCH",body:JSON.stringify(V)}).then(({bot:G})=>{a({type:"botAdded",bot:{...U,...G,messages:U.messages}}),H&&DY(U.id)})).catch(N);break}case"deleteBot":a({type:"botDeletionPending",botId:M.botId,on:!0}),RX(M.botId,async T=>(await p.flush(T),K(`/api/bots/${T}`,{method:"DELETE"})),(T,V)=>{p.cancel(T),a({type:"deleteBot",botId:T}),V?.notice&&$({type:"notice",notice:{kind:"note",botName:null,text:V.notice}})}).catch(N).finally(()=>a({type:"botDeletionPending",botId:M.botId,on:!1}));break;case"markUnread":K(`/api/bots/${M.botId}`,{method:"PATCH",body:JSON.stringify({unread:!0})}).catch(()=>{});break;case"openDataResult":case"select":{const T=M.type==="select"?M.id:M.botId,V=i.current.bots.find(H=>H.id===T),U=i.current.groups.find(H=>H.id===T);V?.unread?K(`/api/bots/${T}/read`,{method:"POST",body:JSON.stringify({threadId:V.threadId})}).catch(()=>{}):U?.unread&&K(`/api/groups/${T}/read`,{method:"POST"}).catch(()=>{});break}case"createGroup":K("/api/groups",{method:"POST",body:JSON.stringify({memberIds:M.memberIds,name:M.name,section:M.section,...window.ogb?.remoteClient?.active?{setup:{bulletin:"",defaultResponder:{kind:"mentions"}}}:{}})}).then(({group:T})=>{a({type:"groupPatched",group:T}),a({type:"select",id:T.id})}).catch(N);break;case"sendGroup":{const T=M.threadId??i.current.groups.find(U=>U.id===M.groupId)?.threadId,V=M.sendId??dr();q(B).then(()=>K(`/api/groups/${M.groupId}/messages`,{method:"POST",body:JSON.stringify({text:M.text,replyToId:M.replyToId,threadId:T,sendId:V,mode:M.mode??"chat",...M.mentions?.length?{mentions:M.mentions}:{}})})).then(U=>{U?.message&&typeof U.threadId=="string"&&a({type:"messageAdded",threadId:U.threadId,message:U.message}),U?.queued&&typeof U.threadId=="string"&&typeof U.queueId=="string"&&(a({type:"optimisticMessageRemoved",threadId:U.threadId,sendId:V}),a({type:"pendingQueued",threadId:U.threadId,queueId:U.queueId,text:M.text}))}).catch(U=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V}),N(U),M.onError?.()});break}case"patchGroup":K(`/api/groups/${M.groupId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).catch(C({groupId:M.groupId}));break;case"deleteGroup":K(`/api/groups/${M.groupId}`,{method:"DELETE"}).catch(N);break;case"setModel":if(M.threadId){L(M.botId,M.threadId,{modelSelection:M.selection,...M.updateBotDefault?{updateBotDefault:!0}:{},...M.resetApprovalToAsk?{resetApprovalToAsk:!0}:{}});break}F&&p.enqueue(M.botId,{modelSelection:M.selection,threadId:F.switchingTo??F.threadId},F);break;case"updateTask":L(M.botId,M.threadId,M.patch);break;case"refreshTaskPermissions":{const T=i.current.bots.find(J=>J.id===M.botId),V=T?.tasks?.find(J=>J.threadId===M.threadId);if(!T||!V){N(new Error(l("task.threadGone")));break}const U=In(T),H=In(Qn(T,M.threadId)),G=M.acknowledgeLocalAuto===!0,Z=ud();(U==="custom"||H==="custom"||U==="full"&&Z!==void 0?Z?Z.setMode(M.botId,U,{threadId:M.threadId,threadOnly:!0,refreshPermissions:!0,acknowledgeLocalAuto:G}):Promise.reject(new Error(l("approvalMode.needsDesktopApp"))):K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"PATCH",body:JSON.stringify({refreshPermissions:!0,...G?{acknowledgeLocalAuto:!0}:{}})}).then(J=>J.bot)).then(J=>{J&&a({type:"botPatched",bot:n(J)})}).catch(N);break}case"followBotModel":K(`/api/bots/${M.botId}/threads/follow-model`,{method:"POST",body:"{}"}).then(({bot:T,busy:V})=>{a({type:"botPatched",bot:n(T)}),M.onSettled?.({busy:V??0})}).catch(N);break;case"createProject":K(`/api/bots/${M.botId}/projects`,{method:"POST",body:JSON.stringify({name:M.name,emoji:M.emoji})}).then(({bot:T,project:V})=>{m({type:"botPatched",bot:T}),M.onCreated?.(V)}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"updateProject":K(`/api/bots/${M.botId}/projects/${M.projectId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onSaved?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"deleteProject":K(`/api/bots/${M.botId}/projects/${M.projectId}`,{method:"DELETE"}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onDeleted?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"reorderProjects":K(`/api/bots/${M.botId}/projects/order`,{method:"PATCH",body:JSON.stringify({projectIds:M.projectIds})}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onSaved?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"interrupt":sZ(K,M,N);break;case"newTask":case"switchTask":{const T=M.type==="newTask"?A(M,()=>m(M)):()=>{};if(!T)break;const V=(j.get(M.botId)??0)+1;j.set(M.botId,V);const U=o.current;(M.type==="newTask"?p.flush(M.botId):Promise.resolve()).then(()=>K(M.type==="newTask"?`/api/bots/${M.botId}/tasks`:`/api/bots/${M.botId}/tasks/${M.threadId}${M.whole?"":`?messages=${N4}`}`,{method:"POST",body:JSON.stringify(M.type==="newTask"?{projectId:M.projectId,cwd:M.cwd}:{})})).then(G=>{if(M.type==="newTask"&&(T(null),M.onCreated?.()),j.get(M.botId)!==V)return;if(!G?.bot){M.type==="switchTask"&&a({type:"switchTaskFailed",botId:M.botId,threadId:M.threadId});return}const Z=M.type==="newTask"&&M.cwd!==void 0;Z&&o.current!==U||(m({type:"taskSwitched",bot:G.bot}),Z&&a({type:"select",id:M.botId}))}).catch(G=>{M.type==="switchTask"&&j.get(M.botId)===V&&a({type:"switchTaskFailed",botId:M.botId,threadId:M.threadId});const Z=G instanceof Error?G.message:String(G);T(Z),M.type==="newTask"&&M.onError?M.onError(Z):N(G)});break}case"renameTask":K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"PATCH",body:JSON.stringify({title:M.title})}).catch(C({botId:M.botId}));break;case"regenerateTaskTitle":K(`/api/bots/${M.botId}/tasks/${M.threadId}/title`,{method:"POST"}).then(()=>M.onSettled?.(!0)).catch(T=>{N(T),M.onSettled?.(!1)});break;case"deleteTask":K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"DELETE"}).then(T=>T?.bot&&m({type:"botPatched",bot:T.bot})).catch(N);break;case"newGroupTask":K(`/api/groups/${M.groupId}/tasks`,{method:"POST",body:"{}"}).then(S(M.groupId,!0)).catch(N);break;case"switchGroupTask":K(`/api/groups/${M.groupId}/tasks/${M.threadId}?messages=${N4}`,{method:"POST"}).then(S(M.groupId,!0)).catch(N);break;case"renameGroupTask":case"pinGroupTask":case"archiveGroupTask":case"setConversationTurnLimit":{const T=M.type==="renameGroupTask"?{title:M.title}:M.type==="pinGroupTask"?{pinned:M.pinned,title:M.title}:M.type==="archiveGroupTask"?{archivedAt:M.archivedAt}:{turnTimeoutMinutes:M.minutes},V=M.type==="setConversationTurnLimit"&&M.dm?`/api/groups/${M.groupId}`:`/api/groups/${M.groupId}/tasks/${M.threadId}`;K(V,{method:"PATCH",body:JSON.stringify(T)}).catch(C({groupId:M.groupId}));break}case"deleteGroupTask":K(`/api/groups/${M.groupId}/tasks/${M.threadId}`,{method:"DELETE"}).then(S(M.groupId,!1)).catch(N);break;case"setGroupHold":K(`/api/groups/${M.groupId}/holds`,{method:"POST",body:JSON.stringify({botId:M.botId,held:M.held})}).then(S(M.groupId,!1)).catch(N);break;case"interruptGroup":K(`/api/groups/${M.groupId}/interrupt`,{method:"POST",body:M.threadId?JSON.stringify({threadId:M.threadId}):void 0}).catch(T=>{N(T),M.onError?.()});break;case"updateBot":{F&&p.enqueue(M.botId,M.patch,F);break}}};return $},[p]),h=f.useRef(!1);f.useEffect(()=>{if(!s.hydrated||h.current)return;h.current=!0;const j=s.bots.find(S=>S.id===s.selectedId);j&&s.activeView==="chat"&&fo(j,c)!==j.threadId&&qt(m,j,c)},[s.hydrated,s.bots,s.selectedId,s.activeView,c,m]),f.useEffect(()=>{let j=!0;const S=new Map,E=B=>{let D=S.get(B);return D||(D={attempt:0,generation:0,timer:null,version:0},S.set(B,D)),D},A=[{key:"instances",request:async()=>{const B=await If("/api/instances",async()=>jp(await K("/api/instances"),"instances"),null);return()=>{B&&a({type:"instances",instances:B.instances})}}},{key:"config",request:async()=>{const B=await K("/api/config");return()=>a({type:"configStatus",config:B})}},{key:"routines",request:async()=>{const B=Date.now()-wX,{routines:D,runs:T}=jp(await K(`/api/routines?since=${B}`),"routines","runs");return()=>a({type:"routinesHydrated",routines:D,runs:T,since:B})}},{key:"notifications",request:async()=>{const{notifications:B}=await K("/api/notifications");return()=>a({type:"notificationsHydrated",notifications:Array.isArray(B)?B:[]})}},...window.ogb?.remoteClient?.active?[]:[{key:"webhooks",request:async()=>{const{webhooks:B,attempts:D,ingress:T}=jp(await K("/api/webhooks"),"webhooks");return()=>a({type:"webhooksHydrated",webhooks:B,attempts:D??[],ingress:T})}}]],_=new Map(A.map(B=>[B.key,B])),N=(B,D)=>{if(!j)return;const T=E(B.key);if(T.timer)return;D!==void 0&&(B.key==="routines"&&a({type:"routinesLoadFailed"}),console.warn(`snapshot: ${B.key} refresh failed; retrying`,D));const V=Math.min(3e4,1e3*2**Math.min(T.attempt,5));T.attempt+=1,T.timer=setTimeout(()=>{T.timer=null;const U=()=>{C(B,!0).catch(G=>N(B,G))};if(!Da())return U();const H=ux(G=>{G||(H(),j&&U())})},V)},C=async(B,D)=>{const T=E(B.key);T.timer&&(clearTimeout(T.timer),T.timer=null);const V=++T.generation,U=T.version;try{const H=await B.request();if(!j||T.generation!==V)return;if(D&&T.version!==U){N(B);return}H(),T.attempt=0}catch(H){if(!j||T.generation!==V)return;throw BA(H)}},R=(...B)=>{for(const D of B)E(D).version+=1},O=async()=>{const B=o.current,D=i.current.transcriptGeneration,T=new Set([...i.current.bots,...i.current.groups].flatMap(Y=>Y.tasks?.map(ne=>ne.threadId)??[])),V=i.current.liveCallVersion,U=MA();If("/api/live/call",()=>K("/api/live/call"),null).then(Y=>{const ne=w0(Y);j&&ne&&Ke.flushSync(()=>a({type:"liveCallLookup",call:ne.call,since:V,seq:U}))}).catch(()=>{});const H=()=>K(`/api/bots?messages=${Wc}`).then(Y=>jp(Y,"bots")).then(({bots:Y,groups:ne,sections:J,computerControl:X,botQueuedMessages:me})=>{j&&a({type:"hydrate",bots:Y,groups:ne??[],sections:J??[],computerControl:X??{},botQueuedMessages:me,preserveNavigation:o.current!==B,navigationSince:D,taskIdsAtStart:T,resumeId:iZ()??void 0})}),G=A.map(Y=>({key:Y.key,load:()=>C(Y,!1)})),Z=await OX(H,G,(Y,ne)=>{const J=_.get(Y.key);J&&N(J,ne)});return j&&Z};let q=!1,L=null,P=!1;const $=[];let M;const F=()=>L?(P=!0,L):(q=!1,L=(async()=>{let B=!1;do P=!1,B=await O();while(j&&P);if(!j||!B)return!1;q=!0;for(const D of $.splice(0))M(D);return!0})().finally(()=>{L=null}),L),W=setTimeout(F,1e3);M=B=>{switch(B.kind==="config"?R("config","instances"):B.kind==="routine"||B.kind==="routine.deleted"||B.kind==="routine.run"?R("routines"):(B.kind==="webhook"||B.kind==="webhook.attempt"||B.kind==="webhook.deleted")&&R("webhooks"),B.kind){case"sections":a({type:"sections",sections:B.sections});break;case"bots.order":a({type:"botsOrdered",botIds:B.botIds});break;case"bot.queued":a({type:"botQueues",queues:B.queues});break;case"message":{if(a({type:"messageAdded",threadId:B.threadId,message:B.message}),B.message?.role==="user"&&typeof B.message.queueId=="string"&&a({type:"consumePendingQueued",threadId:B.threadId,queueId:B.message.queueId}),B.message?.role==="bot"&&B.message?.kind==="text"){const D=m4(i.current,B.threadId);Kg.completeBotText(B.threadId,B.message.turnId,B.message.text??"",D,B.message.id)}break}case"message.patch":a({type:"messagePatched",threadId:B.threadId,message:B.message});break;case"thread":a({type:"threadActive",threadId:B.threadId,activeLeafId:B.activeLeafId});break;case"bot":{const D=B.bot,T=i.current.bots.find(H=>H.id===D.id),V=T?.switchingTo??T?.threadId,U=D.tasks?.find(H=>H.threadId===V);D.id===i.current.selectedId&&i.current.activeView==="chat"&&document.hasFocus()&&(U?.unread||!D.tasks&&D.unread)&&(U&&(U.unread=!1),D.unread=q7(D),fetch(`/api/bots/${D.id}/read`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({threadId:V})}).catch(()=>{})),a({type:"botPatched",bot:n({...D,...p.overlayFor(D.id)})});break}case"group":{const D=B.group;D.unread&&D.id===i.current.selectedId&&document.hasFocus()&&(D.unread=!1,fetch(`/api/groups/${D.id}/read`,{method:"POST"}).catch(()=>{})),a({type:"groupPatched",group:D});break}case"notify":mZ(B.notification,D=>xn(m,D,i.current,d.current),i.current.bots.find(D=>D.id===B.notification.botId)?.avatarUrl,pJ(i.current)),a({type:"notificationReceived",entry:B.notification});break;case"notifications.read":R("notifications"),a({type:"notificationsRead",ids:B.ids});break;case"group.deleted":a({type:"groupDeleted",groupId:B.groupId});break;case"routine":a({type:"routinePatched",routine:B.routine});break;case"routine.deleted":a({type:"routineDeleted",routineId:B.routineId});break;case"routine.run":a({type:"routineRunPatched",run:B.run});break;case"webhook":a({type:"webhookPatched",webhook:B.webhook});break;case"webhook.attempt":a({type:"webhookAttempted",attempt:B.attempt});break;case"webhook.deleted":a({type:"webhookDeleted",webhookId:B.webhookId});break;case"runtime":{Kg.onRuntimeEvent(B.event,m4(i.current,B.event.threadId));const D=zX(B.event);D&&a(D);break}case"screen":i.current.computerStarts[B.botId]&&a({type:"computerStart",botId:B.botId,start:null});break;case"computer":a({type:"computerStart",botId:B.botId,start:{state:B.state,...B.place?{place:B.place}:{}}});break;case"computer-control":a({type:"computerControl",botId:B.botId,held:B.held===!0,helpReason:typeof B.helpReason=="string"?B.helpReason:null,help:lA(B.help)});break;case"data":a({type:"dataSheet",sheet:B.sheet});break;case"bot.deleted":p.cancel(B.botId),a({type:"deleteBot",botId:B.botId});break;case"live.call":{const D=w0(B);D&&(Kg.onLiveCall(D.call),Ke.flushSync(()=>a({type:"liveCall",call:D.call})));break}case"config":a({type:"configStatus",config:IX(B)});{const D=_.get("instances");D&&C(D,!0).catch(T=>N(D,T))}break}};const z=vX({onOpen:()=>a({type:"connected",value:!0}),onError:()=>a({type:"connected",value:!1}),onSnapshotRequired:()=>(clearTimeout(W),hX(),$.splice(0),tZ(),F()),onFrame:B=>{fX(B),q?M(B):$.push(mX(B))}});return()=>{j=!1,clearTimeout(W);for(const B of S.values())B.timer&&clearTimeout(B.timer);z()}},[]);const x=f.useRef(new Map),g=f.useCallback(async j=>{const S=j?.cached?"/api/instances":"/api/instances?fresh=1",E=x.current,A=E.get(S)??K(S,{timeoutMs:12e4}).then(({instances:_})=>{if(!Array.isArray(_))throw new Error(l("engineSetup.invalidStatus"));a({type:"instances",instances:_})});E.set(S,A),await A.catch(_=>{if(j?.reportErrors)throw _}).finally(()=>{E.get(S)===A&&E.delete(S)})},[]),k=f.useCallback(async j=>{const{instances:S}=await K(`/api/instances/${encodeURIComponent(j)}/refresh-models`,{method:"POST"});a({type:"instances",instances:S})},[]),v=f.useRef(0);f.useEffect(()=>{const j=()=>{const E=Date.now();E-v.current<3e4||(v.current=E,g({cached:!0}))};window.addEventListener("focus",j);const S=()=>{document.visibilityState==="visible"&&j()};return document.addEventListener("visibilitychange",S),()=>{window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",S)}},[g]);const y=f.useCallback(j=>p.flush(j),[p]),b=f.useMemo(()=>({state:s,dispatch:m,flushBotPatches:y,refreshInstances:g,refreshModels:k}),[s,m,y,g,k]),w=f.useMemo(()=>({dispatch:m,state:()=>i.current}),[m]);return r.jsx(gx,{value:w,children:r.jsx(Uu.Provider,{value:b,children:e})})}function se(){const e=f.useContext(Uu);if(!e)throw new Error("useStore outside provider");return e}function HLe({value:e,children:t}){return r.jsx(gx,{value:null,children:r.jsx(Uu.Provider,{value:e,children:t})})}function DX(e){if(!e)return[];const t=[...e.querySelectorAll("[data-sidebar-bot-row]")].map(n=>n.dataset.sidebarBotRow??"");return[...new Set(t.filter(Boolean))]}function $X(e,t){if(t.length===0)return[...e];const n=new Map(e.map(s=>[s.id,s]));return t.flatMap(s=>n.get(s)??[])}function BX(e,t,n){if(e.length===0)return;const s=e.findIndex(a=>a.id===t);return s===-1?n>0?e[0]:e.at(-1):e[(s+n+e.length)%e.length]}const Dw="omb.onboarding.welcomeDraft";function FX(){try{const e=localStorage.getItem(Dw),t=e?JSON.parse(e):null;return!t||typeof t!="object"||t.version!==U7?null:DU.includes(t.beat)?{beat:t.beat}:null}catch{return null}}function qX(e){try{localStorage.setItem(Dw,JSON.stringify({version:U7,beat:e.beat}))}catch{}}function FA(){try{localStorage.removeItem(Dw)}catch{}}const qA="omb.onboarding.sharedWorkspaceHint";function UX(){try{return localStorage.getItem(qA)==="1"}catch{return!1}}function HX(){try{localStorage.setItem(qA,"1")}catch{}}function WX({replay:e,onClose:t}){const[n,s]=f.useState(UX),a=f.useId();if(n&&!e)return null;const i=()=>{HX(),s(!0),t()};return r.jsxs("aside",{"aria-labelledby":a,className:"fixed left-[calc(var(--rail-beside,0px)_+_0.75rem)] right-3 top-14 z-40 flex items-start gap-3 rounded-2xl border border-hairline/50 bg-panel p-3.5 shadow-[0_24px_60px_-20px_rgba(0,0,0,0.6)] sm:inset-x-auto sm:right-5 sm:top-16 sm:w-[360px]",children:[r.jsx("div",{className:"shrink-0",children:r.jsx(Js,{color:"green",state:"happy",size:36,trackPointer:!1})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{id:a,className:"text-[14px] font-semibold text-ink",children:l("onboarding.shared.title")}),r.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:l("onboarding.shared.body")}),r.jsx("button",{type:"button",onClick:i,className:"mt-2.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white transition-transform duration-150 active:scale-[0.98]",children:l("onboarding.spot.gotIt")})]})]})}const eu="Limix Bot",I0=e=>e.defaultBot?.person?.trim().toLowerCase()??"";function KX(e,t){const n=t?.trim().toLowerCase()??"";return(n?e.find(s=>s.defaultBot&&I0(s)===n):void 0)??e.find(s=>s.defaultBot&&!I0(s))}let C0;const E0=new Set;let S4=!1;function VX(){S4||(S4=!0,K("/api/auth/session",{timeoutMs:1e4,background:!0}).then(e=>{C0=typeof e.email=="string"?e.email.trim().toLowerCase():null}).catch(()=>{C0=null}).finally(()=>{for(const e of E0)e()}))}function xo(){return f.useSyncExternalStore(e=>(E0.add(e),VX(),()=>E0.delete(e)),()=>C0,()=>{})}function UA(e,t){const n=I0(e);return!!(e.defaultBot&&n&&n!==(t??""))}function $w(e,t){return!!e.sidebarHidden||UA(e,t)}function tc(e,t){return t===void 0?void 0:KX(e,t)}function HA(e,t){const n=Rl(t??{});return e.find(s=>s.chiefOfStaff&&!s.hidden&&Rl(s)===n)}function GX(e,t,n){const s=Rl(t??{});return e.filter(a=>!a.defaultBot&&!a.hidden&&!$w(a,n)&&Rl(a)===s)}function YX(e,t){if(!t||t.welcomed||t.hidden)return!1;const n=HA(e,t);return!n||n.id===t.id}let A0=!1;const T0=new Set;function I4(e){if(A0!==e){A0=e;for(const t of T0)t()}}function WA(){return f.useSyncExternalStore(e=>(T0.add(e),()=>T0.delete(e)),()=>A0,()=>!1)}function JX(e,t){return{welcomed:!0,...e.sidebarHidden?{sidebarHidden:!1}:{},...t?{}:{chiefOfStaff:!0}}}function ZX(e){if(e.team)return[];const t=e.ownBots===0;return[...e.aiReady?[]:["ai"],...t?["bots","apps","phone"]:[],...t&&!e.onCloud&&!e.remote?["cloud"]:[]]}const XX=3;function QX(e){if(e.team)return[];const t=e.ownBots===0;return[...e.aiReady?[]:["ai"],...t&&!e.appsConnected?["apps"]:[],...t&&e.importFound?["import"]:[],...t&&!e.phonePaired?["phone"]:[],...t&&!e.onCloud&&!e.remote?["cloud"]:[]]}let _0=null;const M0=new Set;function $a(e){if(_0!==e){_0=e;for(const t of M0)t()}}function KA(){return f.useSyncExternalStore(e=>(M0.add(e),()=>M0.delete(e)),()=>_0,()=>null)}let VA=null;function GA(e){VA=e}function eQ(e){return VA===e}const tQ=640,Rm=700,nQ="cubic-bezier(0.22, 1, 0.36, 1)",sQ="cubic-bezier(0.3, 0.7, 0.4, 1)";function C4(e){const t=new Map;for(const n of e.querySelectorAll("[data-sidebar-bot-row], [data-section]")){const s=n.dataset.sidebarBotRow?`bot:${n.dataset.sidebarBotRow}`:`section:${n.dataset.section}`;let a=s;for(let i=2;t.has(a);i++)a=`${s}#${i}`;t.set(a,n)}return t}const E4=(e,t)=>e.width>0&&e.height>0&&e.bottom>0&&e.top<t;function YA({from:e,botId:t,reduced:n,commit:s,root:a=document}){const i=a.defaultView?.innerHeight??0,o=new Map([...C4(a)].map(([b,w])=>[b,w.getBoundingClientRect().top])),c=e?.getBoundingClientRect();Ke.flushSync(s);const d=C4(a),u=d.get(`bot:${t}`);if(!u||!E4(u.getBoundingClientRect(),i))return;if(n||!e||!c){u.animate([{opacity:0},{opacity:1}],{duration:180,easing:"linear"});return}const p={duration:Rm+100,easing:"linear"};for(const[b,w]of d){if(w===u)continue;const j=w.getBoundingClientRect();if(!E4(j,i))continue;const S=o.get(b);S===void 0?w.animate([{opacity:0},{opacity:0,offset:.5},{opacity:1}],p):Math.abs(S-j.top)>=.5&&w.animate([{transform:`translateY(${S-j.top}px)`},{transform:"translateY(0)"}],{duration:tQ,easing:nQ})}u.animate([{opacity:0},{opacity:0,offset:.72},{opacity:1}],p);const m=(u.querySelector("svg, img")??u).getBoundingClientRect(),h=e.cloneNode(!0);Object.assign(h.style,{position:"fixed",left:`${c.left}px`,top:`${c.top}px`,width:`${c.width}px`,height:`${c.height}px`,margin:"0",zIndex:"60",pointerEvents:"none",transformOrigin:"top left",filter:"none"}),h.setAttribute("aria-hidden","true"),a.body.appendChild(h),e.style.visibility="hidden";const x=m.width/Math.max(c.width,1),[g,k]=[m.left-c.left,m.top-c.top],v=h.animate([{transform:"translate(0, 0) scale(1)"},{transform:`translate(${g*.5}px, ${k*.5-24}px) scale(${(1+x)/2})`,offset:.5},{transform:`translate(${g}px, ${k}px) scale(${x})`}],{duration:Rm,easing:sQ,fill:"forwards"}),y=()=>h.remove();v.onfinish=()=>{const b=h.animate([{opacity:1},{opacity:0}],{duration:120,easing:"linear",fill:"forwards"});b.onfinish=y,b.oncancel=y},v.oncancel=y,a.defaultView?.setTimeout(y,Rm+600)}const rQ=300,Jg=150,A4=64,T4="ui-button ui-button-pill",_4="ui-button ui-button-pill ui-button-primary";function aQ(){return r.jsx("span",{"aria-hidden":"true","data-chief-badge":"",className:"absolute bottom-0 right-0 flex size-4 items-center justify-center rounded-full bg-[#E8993A] text-white ring-2 ring-menu",children:r.jsx(pa,{size:9,strokeWidth:2.5,fill:"currentColor"})})}function M4(e,t){return!!e.chiefOfStaff||t.find(n=>n.instanceId===e.modelSelection.instanceId)?.capabilities?.agentsMcp===!0}function iQ({replay:e,onDone:t,onLeave:n}){const{state:s,dispatch:a}=se(),i=Qh(),o=xo(),c=tc(s.bots,o),d=HA(s.bots,c),u=GX(s.bots,c,o),[p,m]=f.useState(!1),[h,x]=f.useState(null),[g,k]=f.useState(!1),v=f.useRef(null),y=f.useRef(null),b=f.useRef(!1);f.useEffect(()=>{const C=setTimeout(()=>{b.current=!0},rQ);return()=>clearTimeout(C)},[]),f.useEffect(()=>{if(c)return $a(c.id),()=>$a(null)},[c?.id]),f.useEffect(()=>{(v.current?.querySelector(p?"[role=radio][tabindex='0']":"[data-primary]")??v.current)?.focus({preventScroll:!0})},[p]);const w=C=>{b.current||(C.preventDefault(),C.stopPropagation())},j=(C,R)=>{k(!0),n?.(),v.current?.animate([{opacity:1},{opacity:0}],{duration:Jg,fill:"forwards"}),setTimeout(()=>t(C),R)},S=()=>{if(g||!c)return;const C=JX(c,d);e||GA(c.id),YA({from:y.current,botId:c.id,reduced:i,commit:()=>{$a(null),a({type:"updateBot",botId:c.id,patch:C})}}),j(c.id,i?Jg:Rm)},E=C=>{g||($a(null),c&&!c.welcomed&&a({type:"updateBot",botId:c.id,patch:{welcomed:!0}}),C.chiefOfStaff||a({type:"updateBot",botId:C.id,patch:{chiefOfStaff:!0}}),j(C.id,Jg))},A=u.filter(C=>M4(C,s.instances)),_=A.find(C=>C.id===h),N=C=>{if(C.key==="Escape"){C.preventDefault(),p&&m(!1);return}if(!p||!["ArrowDown","ArrowUp"].includes(C.key)||!A.length)return;C.preventDefault();const R=A.findIndex(q=>q.id===h),O=A[(R+(C.key==="ArrowDown"?1:A.length-1))%A.length];x(O.id),v.current?.querySelector(`[data-chief-choice="${O.id}"]`)?.focus()};return r.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":"chief-intro-title",tabIndex:-1,onKeyDown:N,onClickCapture:w,onKeyDownCapture:C=>(C.key==="Enter"||C.key===" ")&&w(C),"data-chief-intro":p?"choose":"intro",className:I("ui-modal animate-pop-in w-[min(440px,calc(100vw-32px))] border-0 outline-none",g&&"pointer-events-none"),children:p?r.jsxs("div",{className:"p-4",children:[r.jsx("h2",{id:"chief-intro-title",className:"text-[14px] font-medium leading-5 text-ink",children:l("onboarding.chief.chooseTitle")}),r.jsx("div",{role:"radiogroup","aria-labelledby":"chief-intro-title",className:"-mx-2 mt-2 max-h-[282px] overflow-y-auto px-2 [scrollbar-width:thin]",children:u.map(C=>{const R=M4(C,s.instances),O=h===C.id;return r.jsxs("div",{role:"radio","aria-checked":O,"aria-disabled":!R||void 0,title:R?void 0:l("sidebar.bot.chiefNeedsEngine"),tabIndex:O||!_&&C.id===A[0]?.id?0:-1,"data-chief-choice":C.id,onClick:()=>R&&x(C.id),onKeyDown:q=>{R&&(q.key===" "||q.key==="Enter")&&(q.preventDefault(),x(C.id))},className:I("flex min-h-10 items-center gap-2 rounded-lg p-2 transition-colors focus-visible:outline-offset-[-2px]",R?"cursor-pointer hover:bg-ink/[0.06]":"opacity-40",O&&"bg-ink/[0.06]"),children:[r.jsx(Ge,{bot:C,size:24}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] leading-[18px] text-ink",children:C.name}),r.jsx("span",{"aria-hidden":"true",className:I("size-4 shrink-0 rounded-full border-[1.5px]",O?"border-ink bg-ink shadow-[inset_0_0_0_3px_var(--color-menu)]":"border-ink/30")})]},C.id)})}),r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:()=>m(!1),className:T4,children:l("onboarding.back")}),r.jsx("button",{type:"button","data-chief-confirm":"",disabled:!_||g,onClick:()=>_&&E(_),className:_4,children:l("onboarding.chief.confirm")})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 pb-4 pt-6 text-center",children:[r.jsxs("span",{ref:y,className:"relative flex",children:[c?r.jsx(Ge,{bot:c,size:A4,motion:"arrive"}):r.jsx(Js,{color:"chrome",size:A4,label:eu}),r.jsx(aQ,{})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("h2",{id:"chief-intro-title",className:"text-[17px] font-medium leading-6 tracking-[-0.008em] text-ink",children:l("onboarding.chief.title")}),r.jsx("p",{className:"text-[14px] leading-5 text-ink-secondary",children:l("onboarding.chief.body")})]})]}),r.jsxs("div",{className:I("p-4",u.length>0&&"grid grid-cols-2 gap-2"),children:[u.length>0&&r.jsx("button",{type:"button","data-chief-choose":"",onClick:()=>{x(null),m(!0)},className:I(T4,"min-w-0"),children:r.jsx("span",{className:"truncate",children:l("onboarding.chief.choose")})}),r.jsx("button",{type:"button","data-primary":"","data-chief-create":"",onClick:S,disabled:!c,className:I(_4,"w-full min-w-0"),children:r.jsx("span",{className:"truncate",children:l("onboarding.chief.create")})})]})]})})}const JA="omb-engine-updated-seen";function R4(){try{const e=JSON.parse(localStorage.getItem(JA)??"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function oQ(e){const t=e.autoUpdated?.version??null,[n,s]=f.useState(null);return f.useEffect(()=>{if(!(t===null||R4()[e.driverKind]===t)){s(t);try{localStorage.setItem(JA,JSON.stringify({...R4(),[e.driverKind]:t}))}catch{}}},[e.driverKind,t]),n}function lQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:I("text-ink",t),"aria-hidden":!0,children:[r.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),r.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),r.jsx("path",{clipRule:"evenodd",d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function cQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.2 20.6 12 12.7 13.9 10.4 21.8z"})})}const dQ="M69.7784 34.9999C69.7784 39.871 68.7523 44.7296 66.7851 49.1832C64.9333 53.3744 62.2559 57.1874 58.9467 60.3483C55.8445 63.3119 52.1983 65.6915 48.2409 67.3356C44.5469 68.8705 40.5934 69.7611 36.6016 69.9583C32.8943 70.1403 29.1612 69.7256 25.5837 68.7326C22.2821 67.8153 19.1179 66.4087 16.2238 64.5701C6.14513 58.167 0 46.9674 0 34.9999C0 30.1288 1.0261 25.2701 2.99334 20.8165C7.82793 9.87552 17.9696 2.13463 29.7702 0.378474C33.1587 -0.126158 36.6197 -0.126158 40.0082 0.378474C43.6802 0.925238 47.2606 2.06281 50.5756 3.73662C54.1464 5.5397 57.4013 7.96136 60.157 10.8656C63.1112 13.9777 65.4831 17.6355 67.122 21.6056C68.8707 25.8408 69.7784 30.416 69.7784 34.9999ZM45.0815 25.5794C45.4136 26.1492 45.6484 26.7544 45.7315 27.4122C46.0379 29.8319 44.3112 32.0065 41.8829 32.2163C41.3665 32.2613 40.8425 32.2134 40.3414 32.0803C39.3229 31.8093 38.4123 31.185 37.7852 30.3366C37.496 29.9449 37.2574 29.5121 36.9996 29.1013C35.8351 27.2465 34.6239 25.4224 33.361 23.6346C32.9707 23.0802 32.5745 22.5296 32.1727 21.9829C31.8825 21.5864 31.5647 21.2024 31.347 20.7581C30.8163 19.679 30.845 18.3997 31.4282 17.3473C32.7244 15.008 36.0136 14.5091 38.1575 15.9273C38.8008 16.3534 39.2408 16.9404 39.6904 17.5532C40.0417 18.031 40.3881 18.5117 40.7308 18.9953C41.7388 20.4163 42.7133 21.8603 43.6583 23.3234C44.1403 24.0694 44.6348 24.8124 45.0815 25.5794ZM60.3288 19.2126C60.6056 19.7766 60.8261 20.3636 60.933 20.9851C61.1697 22.3515 60.786 24.0856 59.1232 24.1718C58.8398 24.1862 58.5553 24.1469 58.2814 24.0732C57.8595 23.9583 57.4624 23.762 57.0968 23.5216C56.2464 22.9634 55.5515 22.1686 55.0418 21.2905C54.8432 20.9468 54.6724 20.5867 54.4853 20.2363C54.1951 19.6905 53.8925 19.1514 53.5795 18.618C52.2536 16.3677 50.7092 14.2956 49.0159 12.3134C48.2838 11.4564 47.2348 9.80561 48.1426 8.71974C48.5234 8.26395 49.1429 8.11553 49.7118 8.11457C50.8963 8.11361 52.0685 8.64601 53.0306 9.30194C54.2037 10.1034 55.0971 11.2448 55.9667 12.3537C57.6323 14.4775 59.1385 16.7843 60.3288 19.2126Z";function uQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 70 70",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:dQ})})}const pQ=new Set(["claudeAgent","mistral","meta","museCode","kimiAgent","qwenAgent","deepseekAgent","greenference","modelgo","kiroAgent"]),mQ=new Set(["openai","xai","ollama"]);function fQ(e){return e.icon?.kind==="custom"?"brand":e.icon?.kind==="preset"?mQ.has(e.icon.preset)?"mono":"brand":pQ.has(e.driverKind)?"brand":"mono"}const hQ={brand:"opacity-60 group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-60",mono:"[--color-ink:var(--color-ink-tertiary)] [--color-ink-secondary:var(--color-ink-tertiary)] group-hover:[--color-ink:inherit] group-hover:[--color-ink-secondary:inherit] group-focus-within:[--color-ink:inherit] group-focus-within:[--color-ink-secondary:inherit]"};function Bw({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),children:[r.jsx("path",{d:"M9.26905 15.284L17.2479 9.36086C17.6391 9.07047 18.1981 9.18374 18.3845 9.63478C19.3655 12.0135 18.9272 14.8721 16.9755 16.8349C15.0238 18.7976 12.3082 19.228 9.8261 18.2477L7.1146 19.5102C11.0037 22.1834 15.7263 21.5223 18.6774 18.5525C21.0182 16.1985 21.7432 12.9897 21.0653 10.0961L21.0714 10.1023C20.0884 5.85143 21.3131 4.15233 23.8218 0.677913C23.8812 0.595532 23.9406 0.513151 24 0.428711L20.6987 3.74866V3.73836L9.267 15.2861"}),r.jsx("path",{d:"M7.62249 16.7237C4.83113 14.0422 5.3124 9.89222 7.69417 7.49905C9.45541 5.72786 12.341 5.00497 14.86 6.06768L17.5653 4.81138C17.0779 4.45714 16.4533 4.07613 15.7365 3.80839C12.4966 2.46764 8.6178 3.13492 5.98413 5.78141C3.45081 8.32904 2.65415 12.2463 4.02219 15.5889C5.04412 18.0871 3.36889 19.8541 1.68137 21.6377C1.08337 22.2699 0.483318 22.9022 0 23.5716L7.62045 16.7257"})]})}function Fw({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 256 257",preserveAspectRatio:"xMidYMid",className:I("fill-[#d97757]",t),children:r.jsx("path",{d:"m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z"})})}function nc({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 256 260",preserveAspectRatio:"xMidYMid",className:I("fill-[var(--color-ink)]",t),children:r.jsx("path",{d:"M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"})})}function qw({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:[r.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),r.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"var(--color-ink)"})]})}function xQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 508 508",className:t,"aria-hidden":!0,children:r.jsx("path",{fill:"var(--color-ink)",d:"M321.997 150.712C321.401 150.568 320.844 150.299 320.363 149.925C319.883 149.551 319.491 149.08 319.215 148.544C318.938 148.008 318.783 147.42 318.76 146.821C318.738 146.22 318.848 145.624 319.084 145.07C327.226 125.716 330.819 110.23 325.021 103.747C309.666 86.5471 248.085 120.749 228.451 132.333C227.925 132.642 227.337 132.837 226.728 132.903C226.118 132.969 225.501 132.906 224.918 132.719C224.336 132.531 223.801 132.223 223.351 131.815C222.902 131.407 222.548 130.909 222.313 130.356C214.06 111.043 205.384 97.6094 196.589 97.0268C173.279 95.4688 154.491 162.187 148.991 183.932C148.844 184.515 148.57 185.06 148.188 185.528C147.805 185.998 147.323 186.381 146.775 186.651C146.227 186.921 145.626 187.072 145.012 187.094C144.399 187.116 143.788 187.009 143.221 186.778C123.406 178.825 107.545 175.316 100.914 180.98C83.305 195.978 118.315 256.126 130.175 275.304C130.492 275.816 130.692 276.391 130.76 276.987C130.829 277.582 130.765 278.186 130.573 278.755C130.381 279.325 130.065 279.847 129.647 280.286C129.228 280.725 128.718 281.07 128.15 281.298C108.384 289.359 94.6306 297.834 94.0272 306.424C92.439 329.192 160.74 347.544 183.01 352.916C183.605 353.061 184.16 353.33 184.64 353.704C185.118 354.077 185.509 354.548 185.785 355.083C186.061 355.618 186.215 356.205 186.237 356.803C186.26 357.402 186.151 357.998 185.916 358.551C177.773 377.905 174.181 393.398 179.979 399.874C195.334 417.074 256.921 382.877 276.556 371.293C277.081 370.984 277.67 370.789 278.28 370.722C278.889 370.655 279.507 370.717 280.09 370.905C280.673 371.093 281.207 371.402 281.657 371.81C282.106 372.219 282.46 372.717 282.694 373.271C290.947 392.578 299.616 406.012 308.417 406.601C331.728 408.153 350.516 341.44 356.009 319.688C356.157 319.106 356.432 318.562 356.816 318.094C357.2 317.625 357.682 317.243 358.231 316.974C358.779 316.705 359.381 316.554 359.995 316.533C360.608 316.511 361.219 316.619 361.786 316.85C381.601 324.803 397.455 328.304 404.093 322.648C421.702 307.65 386.684 247.495 374.825 228.317C374.51 227.804 374.312 227.229 374.245 226.634C374.177 226.039 374.242 225.436 374.434 224.868C374.626 224.299 374.941 223.777 375.358 223.338C375.775 222.899 376.284 222.552 376.85 222.323C396.623 214.261 410.376 205.786 410.973 197.196C412.568 174.428 344.26 156.078 321.997 150.712ZM295.254 128.885C299.734 136.73 276.646 189 259.474 225.561C259.186 226.172 258.715 226.682 258.121 227.024C257.528 227.365 256.842 227.521 256.155 227.47C255.468 227.419 254.814 227.164 254.28 226.739C253.746 226.314 253.358 225.739 253.169 225.093C246.234 201.322 238.306 173.392 229.824 149.683C229.491 148.752 229.508 147.736 229.871 146.817C230.235 145.897 230.921 145.133 231.808 144.662C252.989 133.363 289.234 118.358 295.254 128.885ZM193.746 135.355C202.589 137.807 224.103 190.714 238.424 228.426C238.664 229.056 238.699 229.742 238.527 230.393C238.354 231.044 237.983 231.627 237.461 232.065C236.939 232.503 236.292 232.775 235.608 232.844C234.923 232.913 234.234 232.775 233.632 232.45C211.501 220.453 185.694 206.159 162.529 195.253C161.622 194.823 160.901 194.093 160.493 193.192C160.085 192.292 160.018 191.279 160.303 190.335C167.12 167.736 181.865 132.069 193.746 135.355ZM126.652 210.04C134.676 205.664 188.197 228.216 225.621 244.989C226.248 245.269 226.771 245.73 227.12 246.31C227.47 246.889 227.629 247.56 227.577 248.23C227.524 248.901 227.264 249.54 226.828 250.062C226.393 250.582 225.805 250.962 225.143 251.147C200.813 257.921 172.211 265.664 147.937 273.949C146.985 274.272 145.946 274.255 145.007 273.9C144.067 273.545 143.286 272.876 142.805 272.011C131.257 251.322 115.867 215.92 126.652 210.04ZM133.275 309.188C135.779 300.551 189.952 279.537 228.562 265.548C229.207 265.315 229.91 265.28 230.576 265.448C231.243 265.617 231.84 265.98 232.288 266.49C232.736 266.999 233.015 267.631 233.085 268.299C233.155 268.968 233.015 269.641 232.682 270.23C220.392 291.846 205.758 317.053 194.592 339.672C194.156 340.561 193.409 341.269 192.486 341.668C191.563 342.068 190.525 342.134 189.557 341.853C166.42 335.235 129.905 320.792 133.275 309.188ZM209.739 374.722C205.252 366.884 228.347 314.608 245.519 278.054C245.806 277.442 246.279 276.931 246.872 276.59C247.465 276.249 248.151 276.093 248.838 276.144C249.525 276.194 250.179 276.45 250.713 276.875C251.247 277.3 251.634 277.874 251.824 278.521C258.759 302.285 266.686 330.222 275.169 353.932C275.499 354.862 275.481 355.877 275.117 356.795C274.752 357.713 274.064 358.475 273.178 358.945C252.004 370.223 215.752 385.256 209.76 374.722H209.739ZM311.247 368.252C302.397 365.807 280.883 312.894 266.562 275.182C266.322 274.55 266.285 273.862 266.458 273.21C266.63 272.559 267.003 271.974 267.526 271.536C268.049 271.097 268.697 270.826 269.382 270.758C270.068 270.69 270.759 270.83 271.361 271.157C293.485 283.154 319.299 297.455 342.457 308.362C343.366 308.789 344.089 309.519 344.497 310.42C344.905 311.321 344.971 312.335 344.683 313.28C337.872 335.912 323.128 371.544 311.247 368.252ZM378.341 293.566C370.31 297.949 316.795 275.391 279.365 258.618C278.738 258.338 278.215 257.877 277.866 257.297C277.516 256.718 277.357 256.047 277.409 255.377C277.461 254.706 277.722 254.067 278.158 253.546C278.593 253.025 279.181 252.646 279.843 252.461C304.18 245.687 332.775 237.943 357.049 229.658C358.003 229.335 359.043 229.353 359.984 229.709C360.925 230.065 361.706 230.737 362.188 231.603C373.729 252.285 389.119 287.693 378.341 293.566ZM371.718 194.419C369.207 203.063 315.041 224.077 276.431 238.066C275.784 238.3 275.08 238.335 274.413 238.167C273.746 237.999 273.148 237.635 272.698 237.124C272.249 236.613 271.972 235.98 271.903 235.31C271.833 234.641 271.975 233.966 272.311 233.377C284.594 211.768 299.228 186.554 310.394 163.935C310.833 163.048 311.58 162.343 312.502 161.945C313.425 161.546 314.462 161.481 315.429 161.76C338.566 168.413 375.081 182.815 371.718 194.419Z"})})}function gQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",d:"M21.751 22.607c1.34 1.005 3.35.335 1.508-1.508C17.73 15.74 18.904 1 12.037 1 5.17 1 6.342 15.74.815 21.1c-2.01 2.009.167 2.511 1.507 1.506 5.192-3.517 4.857-9.714 9.715-9.714 4.857 0 4.522 6.197 9.714 9.715z"})})}function bQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function ZA({size:e=16,className:t}){const n="omb-qwen-mark";return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":!0,children:[r.jsx("path",{fill:`url(#${n})`,fillRule:"nonzero",d:"M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z"}),r.jsx("defs",{children:r.jsxs("linearGradient",{id:n,x1:"0%",x2:"100%",y1:"0%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#6336E7",stopOpacity:.92}),r.jsx("stop",{offset:"100%",stopColor:"#6F69F7",stopOpacity:.92})]})})]})}function yQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 800 800",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:[r.jsx("path",{fillRule:"evenodd",d:"M165.29 165.29 H517.36 V400 H400 V517.36 H282.65 V634.72 H165.29 Z M282.65 282.65 V400 H400 V282.65 Z"}),r.jsx("path",{d:"M517.36 400 H634.72 V634.72 H517.36 Z"})]})}function Uw({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:r.jsx("path",{fill:"#5786FE",d:"M23.748 4.651c-.254-.124-.364.113-.512.233-.423.437-.857.794-1.51.763-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.789-.347-1.077-.626-1.26-1.424-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323l-.266.833c-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-1.06-1.024-1.97-2.183-3.286-2.93-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-1.27.006-2.312.621-3.152.821a9.6 9.6 0 0 0-2.883-.101c-3.75.419-5.994 3.589-5.757 7.395.218 3.496 2.247 6.521 5.258 8.037 2.52 1.269 5.649 1.474 8.484-.924.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 2.056-2.431 3.44-5.604 3.392-7.847-.004-.171.035-.238.23-.257 2.371-.246 3.642-1.764 3.838-3.992.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-2.919-1.718-4.443-4.959-4.6-7.788-.02-.385.094-.522.477-.592 2.602-.471 5.025.581 6.997 2.736 1.652 1.807 2.631 4.049 4.682 5.785.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 1 1 .614.001.306.306 0 0 1-.614 0m3.11 1.596c-.494.199-.931.222-1.389-.094-.274-.23-.47-.358-.551-.758-.122-.602.111-.903-.223-1.315-.188-.156-.426-.199-.689-.199-.454 0-.553-.298-.368-.636.356-.422.859-.442 1.338-.29.72.294 1.319 1.129 1.706 1.743.176.264.336.536.446.848.066.194-.02.353-.25.45"})})}function XA({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:r.jsx("path",{fill:"var(--color-ink)",d:"M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"})})}function kQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:[r.jsx("rect",{width:"24",height:"24",rx:"6",fill:"var(--color-ink)"}),r.jsx("path",{stroke:"var(--color-panel)",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none",transform:"translate(4.8 4.8) scale(0.6)",d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"})]})}function QA({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:[r.jsx("path",{fill:"#7B3FE4",d:"M12 2a7.5 7.5 0 0 0-7.5 7.5V22l2.5-1.8 2.5 1.8 2.5-1.8 2.5 1.8 2.5-1.8 2.5 1.8V9.5A7.5 7.5 0 0 0 12 2Z"}),r.jsx("circle",{cx:"9.3",cy:"10",r:"1.5",fill:"var(--color-panel)"}),r.jsx("circle",{cx:"14.7",cy:"10",r:"1.5",fill:"var(--color-panel)"})]})}function eT({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"4 2 24 24",className:t,"aria-hidden":"true",children:[r.jsx("path",{stroke:"#407A84",strokeWidth:1.7,d:"M16 16V7M16 16l-8 5M16 16l8 5"}),r.jsxs("g",{fill:"#407A84",children:[r.jsx("circle",{cx:"16",cy:"7",r:"2.4"}),r.jsx("circle",{cx:"8",cy:"21",r:"2.4"}),r.jsx("circle",{cx:"24",cy:"21",r:"2.4"}),r.jsx("circle",{cx:"16",cy:"16",r:"3.8"})]})]})}function Nx({size:e=16,className:t}){const n=f.useId().replace(/\W/gu,"");return r.jsxs("svg",{width:e,height:e,viewBox:"0 18.09 31 31",fill:"none",className:t,"aria-hidden":"true",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:`${n}a`,x1:"10.5179",y1:"25.8892",x2:"2.29751",y2:"41.3335",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#5071FF"}),r.jsx("stop",{offset:"1",stopColor:"#0410FF"})]}),r.jsxs("linearGradient",{id:`${n}b`,x1:"14",y1:"29.5894",x2:"17",y2:"32.5894",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#2563EB"}),r.jsx("stop",{offset:"1",stopColor:"#16C784"})]}),r.jsxs("linearGradient",{id:`${n}c`,x1:"24.9101",y1:"35.7894",x2:"12.7635",y2:"41.9022",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#13DA74"}),r.jsx("stop",{offset:"1",stopColor:"#1F83CD"})]})]}),r.jsx("path",{fill:`url(#${n}a)`,d:"M6.31271 27.713C7.94898 25.3277 11.1777 24.7425 13.5241 26.4059C15.8703 28.0693 16.446 31.3509 14.8099 33.7361L9.42862 41.5814C7.79234 43.9665 4.56361 44.5517 2.21725 42.8885C-0.129169 41.2252 -0.704765 37.9429 0.931485 35.5577L6.31271 27.713ZM13.0071 29.9972C12.0826 28.0346 9.41394 27.8263 8.2057 29.6228L2.7953 37.6672C2.1197 38.6719 2.36677 40.0427 3.34879 40.7389L3.51215 40.8544C4.49397 41.5504 5.84429 41.3127 6.53837 40.3214L13.2065 30.7957C13.2716 30.7027 13.2818 30.581 13.2334 30.478L13.0071 29.9972Z"}),r.jsx("path",{fill:"#16C784",d:"M23.7889 27.7173C22.1526 25.3321 18.924 24.7469 16.5775 26.4103C14.2313 28.0737 13.6556 31.3559 15.2917 33.7411L21.1882 42.336C22.8245 44.7212 26.0526 45.3064 28.399 43.6431C30.7454 41.9798 31.3214 38.6981 29.6853 36.3128L23.7889 27.7173ZM17.2344 30.2879C18.159 28.3251 20.8276 28.1169 22.0359 29.9134L27.4463 37.9578C28.1218 38.9625 27.8752 40.3328 26.8934 41.0289L26.73 41.1451C25.7482 41.8411 24.3979 41.6029 23.7038 40.6115L17.0351 31.0858C16.9701 30.9928 16.9597 30.871 17.0082 30.7681L17.2344 30.2879Z"}),r.jsx("path",{fill:`url(#${n}b)`,d:"M15.6385 34.2402L15.1611 33.5552L16.944 30.958L17.3932 31.6002L15.6385 34.2402Z"}),r.jsx("path",{fill:"#16C784",d:"M19.9475 40.5176L19.5264 39.8753L21.3513 37.1641L21.7724 37.7348L19.9475 40.5176Z"}),r.jsx("path",{fill:`url(#${n}c)`,d:"M18.0466 25.5876C20.1674 24.8708 22.585 25.6165 23.9285 27.5749L29.824 36.1696C31.2186 38.2028 31.0051 40.8864 29.4587 42.6647C29.1679 43.0226 28.827 43.3488 28.4353 43.6286C26.0801 45.3106 22.8295 44.7337 21.1746 42.3395L19.8152 40.3727C19.7017 40.2086 19.5993 40.0397 19.5066 39.8678L17.9372 42.2028C16.2924 44.5816 13.0617 45.1548 10.7214 43.4831C8.38107 41.8111 7.81697 38.5263 9.46166 36.1471L15.3884 27.5739C16.064 26.5967 17.0076 25.925 18.0466 25.5876ZM26.0671 36.6413C25.269 35.4872 23.7017 35.2084 22.5662 36.0192L21.6599 36.6667L21.3845 37.0749C21.382 37.1637 21.4066 37.2543 21.4607 37.3327L23.7488 40.6422C24.4093 41.5977 25.7063 41.8282 26.6462 41.1569C27.5862 40.4854 27.8125 39.1661 27.1521 38.2106L26.0671 36.6413ZM19.7917 28.9792C18.9257 28.944 18.0396 29.3246 17.4734 30.1579L12.0144 38.196C11.3768 39.1348 11.603 40.4208 12.5212 41.0768C13.4392 41.7324 14.706 41.5139 15.3591 40.5866L19.5124 34.7692C19.8833 34.0834 20.4104 33.4711 21.0828 32.9909C21.7305 32.5282 22.446 32.2362 23.1775 32.1061L21.8943 30.1989C21.3772 29.4303 20.5925 29.0301 19.7917 28.9762V28.9792Z"})]})}function Hw({driverKind:e,size:t,className:n}){switch(e){case"grok":case"grokAgent":return r.jsx(Bw,{size:t,className:n});case"claudeAgent":return r.jsx(Fw,{size:t,className:n});case"mistral":return r.jsx(R0,{preset:"mistral",size:t,className:n});case"meta":case"museCode":return r.jsx(R0,{preset:"meta",size:t,className:n});case"codex":return r.jsx(nc,{size:t,className:n});case"kimiAgent":return r.jsx(qw,{size:t,className:n});case"droidAgent":return r.jsx(xQ,{size:t,className:n});case"cursorAgent":return r.jsx(cQ,{size:t,className:n});case"antigravityAgent":return r.jsx(gQ,{size:t,className:n});case"opencodeGo":return r.jsx(bQ,{size:t,className:n});case"qwenAgent":return r.jsx(ZA,{size:t,className:n});case"hermesAgent":return r.jsx(lQ,{size:t,className:n});case"deepseekAgent":return r.jsx(Uw,{size:t,className:n});case"piAgent":return r.jsx(yQ,{size:t,className:n});case"copilotAgent":return r.jsx(XA,{size:t,className:n});case"commandCodeAgent":return r.jsx(kQ,{size:t,className:n});case"kiroAgent":return r.jsx(QA,{size:t,className:n});case"greenference":return r.jsx(eT,{size:t,className:n});case"modelgo":return r.jsx(Nx,{size:t,className:n});default:return r.jsx("span",{className:I("flex size-full items-center justify-center text-[10px] font-semibold tracking-tight text-ink-secondary",n),children:(e.replace(/Agent$/i,"").slice(0,1)||"?").toUpperCase()})}}function R0({preset:e,size:t=16,className:n}){switch(e){case"openai":return r.jsx(nc,{size:t,className:n});case"anthropic":return r.jsx(Fw,{size:t,className:n});case"xai":return r.jsx(Bw,{size:t,className:n});case"qwen":return r.jsx(ZA,{size:t,className:n});case"moonshot":return r.jsx(qw,{size:t,className:n});case"google":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})});case"azure":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#0089D6",d:"M22.379 23.343a1.62 1.62 0 0 0 1.536-2.14v.002L17.35 1.76A1.62 1.62 0 0 0 15.816.657H8.184A1.62 1.62 0 0 0 6.65 1.76L.086 21.204a1.62 1.62 0 0 0 1.536 2.139h4.741a1.62 1.62 0 0 0 1.535-1.103l.977-2.892 4.947 3.675c.28.208.618.32.966.32m-3.084-12.531 3.624 10.739a.54.54 0 0 1-.51.713v-.001h-.03a.54.54 0 0 1-.322-.106l-9.287-6.9h4.853m6.313 7.006c.116-.326.13-.694.007-1.058L9.79 1.76a1.722 1.722 0 0 0-.007-.02h6.034a.54.54 0 0 1 .512.366l6.562 19.445a.54.54 0 0 1-.338.684"})});case"aws":return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:[r.jsx("path",{fill:"var(--color-ink)",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272-.184.08-.32.12-.407.12-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28.04-.056.112-.112.224-.167.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z"}),r.jsx("path",{fill:"#FF9900",d:"M21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zm1.094-1.246c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"})]});case"meta":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#0467DF",d:"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973.14.605.228.654.636 1.621.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.942-1.664.183.3 2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843 1.175-.99 1.671-2.573 1.671-5.018 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c1.19-1.85 2.25-2.929 3.569-2.929zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-1.17 0-1.847-1.04-1.847-2.84 0-2.221.63-4.535 1.66-6.088.824-1.245 1.697-1.818 2.621-1.818z"})});case"mistral":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#FA520F",d:"M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z"})});case"cohere":return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:[r.jsx("path",{fill:"#39594D",fillRule:"evenodd",d:"M8.128 14.099c.592 0 1.77-.033 3.398-.703 1.897-.781 5.672-2.2 8.395-3.656 1.905-1.018 2.74-2.366 2.74-4.18A4.56 4.56 0 0018.1 1H7.549A6.55 6.55 0 001 7.55c0 3.617 2.745 6.549 7.128 6.549z"}),r.jsx("path",{fill:"#D18EE2",fillRule:"evenodd",d:"M9.912 18.61a4.387 4.387 0 012.705-4.052l3.323-1.38c3.361-1.394 7.06 1.076 7.06 4.715a5.104 5.104 0 01-5.105 5.104l-3.597-.001a4.386 4.386 0 01-4.386-4.387z"}),r.jsx("path",{fill:"#FF7759",d:"M4.776 14.962A3.775 3.775 0 001 18.738v.489a3.776 3.776 0 007.551 0v-.49a3.775 3.775 0 00-3.775-3.775z"})]});case"openrouter":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#94A3B8",d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.792.447-2.497.904-3.936 1.131v4.229c1.31.184 2.908.627 3.795 1.132 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918L24 15.038l-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})});case"deepseek":return r.jsx(Uw,{size:t,className:n});case"ollama":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"var(--color-ink)",d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"})})}}function _s({instance:e,size:t=16,className:n,subtle:s=!1}){if(s){const a=fQ(e);return r.jsx("span",{"data-provider-mark":a,className:I("inline-flex shrink-0 transition-opacity",hQ[a],n),style:{width:t,height:t},children:r.jsx(_s,{instance:e,size:t})})}return e.icon?.kind==="custom"?r.jsx(vQ,{dataUrl:e.icon.dataUrl,driverKind:e.driverKind,size:t,className:n},e.icon.dataUrl):e.icon?.kind==="preset"?r.jsx(R0,{preset:e.icon.preset,size:t,className:n}):r.jsx(Hw,{driverKind:e.driverKind,size:t,className:n})}function vQ({dataUrl:e,driverKind:t,size:n=16,className:s}){const[a,i]=f.useState(!1);return a?r.jsx(Hw,{driverKind:t,size:n,className:s}):r.jsx("img",{src:e,alt:"",width:n,height:n,onError:()=>i(!0),className:I("rounded-[22%] object-cover",s)})}function Zt(e){return e.driverKind==="clineAgent"?e.snapshot.state==="available"&&e.snapshot.authenticated===!0:e.snapshot.state==="available"&&(e.access==="custom"||e.snapshot.authenticated!==!1)}const wQ={claudeAgent:"Anthropic",codex:"OpenAI",grok:"xAI",grokAgent:"xAI",kimiAgent:"Moonshot AI",droidAgent:"Factory",cursorAgent:"Cursor",antigravityAgent:"Google",opencodeGo:"OpenCode",qwenAgent:"Qwen",hermesAgent:"Nous Research",clineAgent:"Cline",copilotAgent:"GitHub",commandCodeAgent:"Command Code",kiroAgent:"Amazon Web Services",piAgent:"pi.dev",mistral:"Mistral AI",cerebras:"Cerebras",groq:"Groq",greenference:"Greenference",modelgo:"ModelGo",meta:"Meta",museCode:"Meta",deepseekAgent:"DeepSeek"};function jQ(e){return wQ[e.driverKind]??e.driverKind}function WLe({instance:e,children:t,summary:n,bare:s=!1}){if(s)return r.jsx("div",{"data-engine-card":e.instanceId,className:"min-w-0",children:t});const a=n?.ready??Zt(e),i=e.snapshot.authenticated===!0?e.snapshot.account?.email:void 0,o=n?.title??e.displayName,c=n?.subtitle??i??(e.access==="custom"?l("engines.library.custom"):jQ(e)),d=e.snapshot.version?.match(/\d+\.\d+(?:\.\d+)?(?:[-+][\w.-]+)?/)?.[0],u=oQ(e);return r.jsxs("details",{"data-engine-card":e.instanceId,className:"group/engine min-w-0 rounded-2xl border border-hairline/40 bg-card transition-colors open:col-span-full open:border-hairline/70 hover:border-hairline/70",children:[r.jsxs("summary",{className:"cursor-pointer list-none rounded-2xl p-4 outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{"aria-hidden":"true",className:"flex size-12 shrink-0 items-center justify-center rounded-xl border border-hairline/30 bg-panel",children:r.jsx(_s,{instance:e,size:28})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-[15px] font-semibold tracking-[-0.015em] text-ink",title:o,children:o}),r.jsx("div",{className:"mt-1 truncate text-[12px] text-ink-secondary",title:c,children:c})]}),r.jsx(kt,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary transition-transform group-open/engine:rotate-180 motion-reduce:transition-none"})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:I("inline-flex items-center gap-1.5 rounded-full px-2 py-1 text-[11px] font-medium",a?"bg-success/10 text-success":"bg-control text-ink-secondary"),children:[a?r.jsx(Ie,{size:12,"aria-hidden":"true"}):r.jsx("span",{className:"size-1.5 rounded-full bg-warning","aria-hidden":"true"}),n?.status??(a?l("onboarding.engines.ready"):e.snapshot.state==="available"&&e.snapshot.authenticated===!1?l("model.signInRequired"):l("onboarding.engines.needsSetup"))]}),n?r.jsx("span",{className:I("text-[11px] font-medium",a?"text-ink-secondary":"text-accent-text"),children:n.action}):a?r.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:u?l("engines.updatedTo",{version:u}):d?`v${d}`:l("engines.library.manage")}):r.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-semibold text-accent-text",children:[l("engines.library.setup"),r.jsx(zs,{size:13,"aria-hidden":"true"})]})]})]}),r.jsx("div",{className:"min-w-0 border-t border-hairline/40 p-4",children:t})]})}function KLe({instances:e,renderEngine:t,isReady:n=Zt}){return r.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,280px),1fr))] items-start gap-3",children:[[!0,!1].flatMap(s=>{const a=e.filter(o=>n(o)===s);if(!a.length)return[];const i=l(s?"onboarding.engines.ready":"onboarding.engines.needsSetup");return[r.jsxs("div",{className:I("col-span-full flex items-center justify-between gap-3 px-4",!s&&e.some(n)&&"mt-4"),children:[r.jsx("h2",{className:"text-[12px] font-semibold text-ink-secondary",children:i}),r.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:l(a.length===1?"engines.library.countOne":"engines.library.count",{count:a.length})})]},`heading-${s}`),...a.map(o=>r.jsx("div",{className:"contents",children:t(o)},o.instanceId))]}),e.length===0&&r.jsx("p",{className:"col-span-full py-4 text-[13px] text-ink-secondary",children:l("engines.none")})]})}function tT(){const{refreshInstances:e}=se(),[t,n]=f.useState(!1),[s,a]=f.useState(null),[i,o]=f.useState(!1);return r.jsxs("div",{children:[r.jsxs("button",{type:"button",disabled:t,onClick:async()=>{n(!0),a(null),o(!1);try{await e({reportErrors:!0}),o(!0)}catch(c){a(c instanceof Error?c.message:String(c))}finally{n(!1)}},className:"inline-flex shrink-0 items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] font-medium text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50",children:[r.jsx(zt,{size:13,"aria-hidden":"true",className:I(t&&"animate-spin")}),t?l("common.checking"):l("engines.library.refresh")]}),s&&r.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:l("engineSetup.checkFailed",{reason:s})}),i&&r.jsx("p",{role:"status",className:"mt-1 text-[11px] text-ink-secondary",children:l("engineSetup.checked")})]})}const O4={claudeApi:"engines.defaultName.claudeApi",chatgpt:"engines.defaultName.chatgpt",openaiCompat:"engines.defaultName.openaiCompat"};function ht(e){const t=Object.hasOwn(O4,e.instanceId)?O4[e.instanceId]:void 0;return t&&e.displayName===br[t]?l(t):e.displayName}const VLe=["everyday","work","writing","design","sales","personal"],Zg=[1,2,3,4,5],kc=(e,t,n,s)=>({name:e,prompt:t,schedule:{type:"daily",time:n,weekdays:s},enabled:!1,overlap:"skip"}),NQ=[{id:"assistant",category:"everyday",name:"Assistant",title:"General assistant",description:"Answers questions, drafts text, and takes on whatever you hand it.",soul:["You are a capable, plain-spoken assistant.","Ask one clarifying question when a request is ambiguous; otherwise do the work and show the result.","Lead with the answer, then the detail. Keep replies short and concrete, and use lists only when they help.","Say plainly when you are unsure or could not check something, and never present a guess as a fact.","When a task will take several steps, say what you are about to do in one line before doing it."].join(`
18
+ `)].join("|")}const rX={ended:!1,status:null},aX=500,_a=new Map,_m=new Map;function iX(e,t){return e===t?!0:!e||!t?!1:("bytes"in e?e.bytes:void 0)===("bytes"in t?t.bytes:void 0)&&g4(e)===g4(t)}function Si(e,t){const n=_a.get(e);if(!(n&&n.turnId===t.turnId&&n.ended===t.ended&&iX(n.status,t.status))){_a.delete(e),_a.set(e,t),_a.size>aX&&_a.delete(_a.keys().next().value);for(const s of Array.from(_m.get(e)??[]))s()}}function oX(e){const{threadId:t}=e,n=_a.get(t),s=n&&(!e.turnId||e.turnId===n.turnId),a=e.turnId??n?.turnId,i=s?n:{turnId:a,ended:!1,status:null};switch(e.type){case"turn.started":return Si(t,{turnId:a,ended:!1,status:null});case"turn.completed":case"cap.exhausted":case"session.exited":return Si(t,{turnId:a,ended:!0,status:null});case"turn.progress":{const{activity:o,tool:c,file:d,bytes:u,itemId:p,target:m,detail:h,quiet:x,tail:g}=e;return Si(t,{turnId:a,ended:!1,status:{activity:o,...c?{tool:c}:{},...d?{file:d}:{},...u!==void 0?{bytes:u}:{},...p?{itemId:p}:{},...m?{target:m}:{},...h?{detail:h}:{},...x?{quiet:x}:{},...g?.length?{tail:g}:{}}})}case"content.delta":return Si(t,{turnId:a,ended:!1,status:{activity:e.streamKind==="reasoning_text"?"thinking":"reply"}});case"item.started":return Si(t,{...i,ended:!1,status:i.status?.itemId&&i.status.itemId===e.itemId?i.status:null});case"item.completed":case"request.opened":return Si(t,{...i,status:null});default:i!==n&&Si(t,i)}}function b4(e){return e&&_a.get(e)||rX}function lX(e,t){if(!e)return()=>{};let n=_m.get(e);return n||_m.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size===0&&_m.delete(e)}}function Pw(e){return f.useSyncExternalStore(t=>lX(e,t),()=>b4(e),()=>b4(e))}const y4="/api/events",OA=4e4,cX=500,dX=1e4,N0="omb:retry-live-events";function uX(){window.dispatchEvent(new Event(N0))}function pX(e){const t=new URLSearchParams;e?.since&&t.set("since",e.since),e?.screens===!1&&t.set("screens","off");const n=t.toString();return n?`${y4}?${n}`:y4}const Qd=new Set,Rf=new Set,Mi=()=>[...Qd].some(e=>e.screens);function jx(e){const t=Mi();if(Qd.add(e),Mi()!==t)for(const n of Rf)n();return()=>{const n=Mi();if(Qd.delete(e),Mi()!==n)for(const s of Rf)s()}}function mX(e){if(e.kind!=="screen")return e;const{png:t,...n}=e;return{...n,png:""}}function fX(e){for(const t of Qd)t.onFrame(e)}function hX(){for(const e of Qd)e.onMissedFrames?.()}function xX(e){return e.kind==="ping"}function gX(e,t,n=OA){return t-e>=n}function bX(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||Array.isArray(t)||Object(t)!==t)return null;const n=t;return n.kind!==String(n.kind)||n.cursor!==void 0&&n.cursor!==String(n.cursor)||n.resumed!==void 0&&n.resumed!==!!n.resumed?null:n}function yX(e){e.kind==="runtime"?(oX(e.event),UZ(e.event)):e.kind==="message"&&e.message?.role==="bot"&&e.message?.kind==="text"&&HZ(e.message,e.threadId)}function kX(e){const t=globalThis.EventSource,n=e.createEventSource??(t?i=>{const o=new t(i),c={onopen:null,onerror:null,onmessage:null,close:()=>o.close()};return o.onopen=()=>c.onopen?.(),o.onerror=()=>c.onerror?.(),o.onmessage=d=>c.onmessage?.(d),c}:void 0);if(!n)return null;const s=globalThis.window,a=globalThis.document;return{createEventSource:n,windowTarget:e.windowTarget??(s?{addEventListener:(i,o)=>s.addEventListener(i,o),removeEventListener:(i,o)=>s.removeEventListener(i,o)}:void 0),documentTarget:e.documentTarget??(a?{addEventListener:(i,o)=>a.addEventListener(i,o),removeEventListener:(i,o)=>a.removeEventListener(i,o)}:void 0),isVisible:e.isVisible??(()=>!a||a.visibilityState==="visible"),isOnline:e.isOnline??(()=>globalThis.navigator?.onLine!==!1),now:e.now??Date.now}}function vX(e,t={}){const n=kX(t);if(!n)return e.onError?.(),()=>{};const s=e.staleMs??OA,a=Math.max(1,e.retryMinMs??cX),i=Math.max(a,e.retryMaxMs??dX),o=Math.min(1e4,Math.max(250,s/2));let c=!1,d=null,u=Mi(),p=null,m=0,h=null,x=n.now(),g=0,k=null;const v=()=>{p!==null&&(clearTimeout(p),p=null)},y=()=>{const L=d;d=null,L&&(k?.source===L&&(g+=1,k=null),L.onopen=null,L.onerror=null,L.onmessage=null,L.close())};let b;const w=()=>{if(c||p!==null||!n.isOnline()||!n.isVisible()||Da())return;const L=Math.min(m,20),P=Math.min(i,a*2**L);m+=1,p=setTimeout(()=>{p=null,n.isVisible()&&b()},P)},j=L=>{c||d!==L||(y(),e.onError?.(),w())};b=()=>{if(c||d||!n.isOnline()||Da())return;let L;try{u=Mi(),L=n.createEventSource(pX({since:h,screens:u}))}catch{e.onError?.(),w();return}d=L,x=n.now(),L.onopen=()=>{c||d!==L||(x=n.now(),e.onOpen?.())},L.onerror=()=>j(L),L.onmessage=P=>{if(c||d!==L)return;x=n.now();const $=bX(P.data);if($){if(xX($)){m=0;return}if($.kind==="hello"){if($.resumed===!1){const M=++g;k={generation:M,source:L,boundaryCursor:$.cursor||null,newestFrameCursor:null},(async()=>{let F=!1;try{F=await e.onSnapshotRequired()}catch{F=!1}const W=k;if(!(c||d!==L||!W||W.generation!==M)){if(!F){k=null,j(L);return}h=W.newestFrameCursor??W.boundaryCursor,k=null,R()}})()}}else P.lastEventId&&(k?.source===L?k.newestFrameCursor=P.lastEventId:h=P.lastEventId);if(RY($)){v(),y(),OE();return}$.kind!=="hello"&&(yX($),e.onFrame($))}}};const S=L=>{c||!n.isOnline()||(v(),d&&(y(),L&&e.onError?.()),b())},E=()=>{c||!n.isOnline()||!n.isVisible()||Da()||(!d||gX(x,n.now(),s))&&S(d!==null)},A=()=>E(),_=()=>{n.isVisible()&&E()},N=()=>{n.isVisible()&&E()},C=()=>{n.isVisible()&&!Da()&&S(!0)},R=()=>queueMicrotask(()=>{d&&h&&!k&&Mi()!==u&&S(!1)});Rf.add(R),b();const O=setInterval(E,o),q=ux(L=>{L||S(!1)});return n.windowTarget?.addEventListener("online",A),n.windowTarget?.addEventListener("focus",_),n.windowTarget?.addEventListener(N0,C),n.documentTarget?.addEventListener("visibilitychange",N),()=>{c||(c=!0,Rf.delete(R),q(),clearInterval(O),v(),y(),n.windowTarget?.removeEventListener("online",A),n.windowTarget?.removeEventListener("focus",_),n.windowTarget?.removeEventListener(N0,C),n.documentTarget?.removeEventListener("visibilitychange",N))}}const k4=2e3,v4=new Set(["queued","running","waiting"]);function S0(e){const t=[...e].sort((a,i)=>i.scheduledFor-a.scheduledFor);if(t.length<=k4)return t;const n=t.reduce((a,i)=>a+(v4.has(i.status)?1:0),0);let s=Math.max(0,k4-n);return t.filter(a=>v4.has(a.status)?!0:s===0?!1:(s-=1,!0))}const wX=336*60*6e4;function jX(e,t){const n=new Set(e.map(s=>s.id));return S0([...e,...t.filter(s=>!n.has(s.id))])}function NX(e,t){return e===null||t.from===void 0||t.to===void 0||t.to<e?e:Math.min(e,t.from)}const SX=64;function ul(e,t){const n={...e,[t]:!0},s=Object.keys(n).length-SX;if(s>0)for(const a of Object.keys(n).slice(0,s))delete n[a];return n}function Tp(e,t){const n=[];for(const o of t)for(const c of o.messages??[])c.queueId&&n.push({queueId:c.queueId,at:c.at});if(n.length===0)return e;const s=new Set(n.map(o=>o.queueId)),a={};for(const[o,c]of Object.entries(e.pendingQueued)){const d=c.filter(u=>!s.has(u.queueId));d.length>0&&(a[o]=d)}let i={};n.sort((o,c)=>o.at-c.at);for(const o of n)i=ul(i,o.queueId);for(const o of Object.keys(e.consumedQueueIds))i=ul(i,o);return{...e,pendingQueued:a,consumedQueueIds:i}}function w4(e,t){const n=new Set(e.groups.flatMap(o=>[o.threadId,...(o.tasks??[]).map(c=>c.threadId)])),s=new Set(Object.values(t).flatMap(o=>o.map(c=>c.queueId))),a={...t};let i=e.consumedQueueIds;for(const[o,c]of Object.entries(e.pendingQueued))if(n.has(o))a[o]=c;else for(const d of c)s.has(d.queueId)||(i=ul(i,d.queueId));return{...e,pendingQueued:a,consumedQueueIds:i}}function zA(e){return(e.tasks??[]).map(t=>In({approvalMode:t.approvalMode??(t.autoApprove===void 0?e.approvalMode:void 0),autoApprove:t.autoApprove??e.autoApprove}))}function Qn(e,t=e.threadId){const n=e.tasks?.find(s=>s.threadId===t);return n?{...e,threadId:t,modelSelection:n.modelSelection??e.modelSelection,approvalMode:n.approvalMode??(n.autoApprove===void 0?e.approvalMode:void 0),autoApprove:n.autoApprove??e.autoApprove,alwaysAllow:n.alwaysAllow??e.alwaysAllow,activity:n.activity??e.activity,busy:n.busy??(n.activity?n.activity==="working"||n.activity==="waiting-on-you":e.busy),unread:n.unread??e.unread,pinnedMessageId:n.pinnedMessageId,turnStartedAt:n.turnStartedAt??null,waitingForTeammates:n.waitingForTeammates??!1}:e}function LA(e){const{acknowledgeLocalAuto:t,updateBotDefault:n,resetApprovalToAsk:s,projectId:a,archivedAt:i,snoozedUntil:o,surface:c,pinned:d,link:u,...p}=e;return{...p,...s?{approvalMode:"ask",autoApprove:!1,alwaysAllow:[]}:{},...a===void 0?{}:{projectId:a??void 0},...i===void 0?{}:{archivedAt:i??void 0},...o===void 0?{}:{snoozedUntil:o??void 0},...c===void 0?{}:{surface:c??void 0,surfaceAuto:void 0},...d===void 0?{}:{pinned:d?!0:void 0},...u===void 0?{}:{link:u??void 0}}}function Gg(e,t,n,s,a,i){return n?aA(t,s,a,i):Tm(e.unreadDivider?.threadId===t?e.unreadDivider:null,t,s,!!i)}function IX(e){return{xai:e.xai,mistral:e.mistral,cerebras:e.cerebras,groq:e.groq,greenference:e.greenference,modelgo:e.modelgo,deepseek:e.deepseek,meta:e.meta,xResearch:e.xResearch,treg:e.treg,postiz:e.postiz,anthropic:e.anthropic,openai:e.openai,openrouter:e.openrouter,openaiCompat:e.openaiCompat,fleet:e.fleet,composio:e.composio,box:e.box,vps:e.vps,rooms:e.rooms,mcp:e.mcp,threads:e.threads,automaticRecovery:e.automaticRecovery,cacheKeepWarm:e.cacheKeepWarm,localVm:e.localVm,opencodeGo:e.opencodeGo,tts:e.tts,decider:e.decider,helpers:e.helpers,imageGen:e.imageGen,live:e.live,savedKeys:e.savedKeys,profile:e.profile,everyBotRules:e.everyBotRules,language:e.language,features:e.features,onboarding:e.onboarding,browserEngine:e.browserEngine,browserProfiles:e.browserProfiles,edition:e.edition,budgets:e.budgets,billing:e.billing,managedPolicy:e.managedPolicy,...e.cloudHome?{cloudHome:!0}:{},...e.team?{team:e.team}:{},...e.awakeLimit!==void 0?{awakeLimit:e.awakeLimit}:{},...e.pausedBots?{pausedBots:e.pausedBots}:{},...e.workspaceBanner?{workspaceBanner:e.workspaceBanner}:{}}}function yc(e){const t=Object.entries(e.modelVariantSessions),n=t.filter(([s,a])=>{const i=e.bots.find(c=>c.threadId===s||c.tasks?.some(d=>d.threadId===s));if(!i)return!1;const o=Qn(i,s).modelSelection;return o.instanceId===a.instanceId&&o.model===a.model});return n.length===t.length?e:{...e,modelVariantSessions:Object.fromEntries(n)}}function CX(e,t){if(!("botId"in e)||"threadId"in e&&e.threadId||!["send","interrupt","editMessage","switchBranch","answerCard","dismissCard","cancelQueued","steerQueued"].includes(e.type))return e;const n=e.botId,s=t.find(a=>a.id===n)?.threadId;return{...e,threadId:s}}function _p(e,t){return t?{...e,transcriptGeneration:{...e.transcriptGeneration,[t]:(e.transcriptGeneration[t]??0)+1}}:e}function nn(e,t,n){return{...e,bots:e.bots.map(s=>s.id===t?n(s):s)}}function Bs(e,t,n){return{...e,mascotMotion:{botId:t,nonce:(e.mascotMotion?.nonce??0)+1,kind:n}}}function PA(e,t,n){return e.map(s=>s.id===t&&s.card?{...s,card:{...s.card,...n}}:s)}function Mm(e,t,n,s){return nn(e,t,a=>({...a,messages:PA(a.messages,n,s)}))}function Yg(e,t,n,s){return{...e,groups:e.groups.map(a=>a.id===t?{...a,messages:PA(a.messages,n,s)}:a)}}function DA(e){return e.messages.find(t=>t.kind==="options"&&t.card&&!t.card.requestId&&!t.card.dismissed)}function EX(e,t){const n=e.bots.find(a=>a.id===t),s=n?DA(n):void 0;return s?Mm(e,t,s.id,{dismissed:!0}):e}const j4={type:"toggleAppSettings",open:!0,section:"cloudAccount",cloudLink:!0};function Ar(e,t){if((t.type==="messageAdded"||t.type==="messagePatched"||t.type==="threadActive"||t.type==="optimisticMessageRemoved")&&e.bots.find(s=>(s.threadId!==t.threadId||s.awaitingThreadSnapshot)&&s.tasks?.some(a=>a.threadId===t.threadId))){const s=[...e.backgroundThreadEvents[t.threadId]??[],t].slice(-256),a={...e,backgroundThreadEvents:{...e.backgroundThreadEvents,[t.threadId]:s}};return(t.type==="messageAdded"||t.type==="messagePatched")&&Uc(t.message)?Sa(a,t.threadId,t.message.at,!0,t.message.turnCompletedAt??t.message.at):t.type==="messageAdded"?Sa(a,t.threadId,t.message.at):a}if(JY(t))return{...e,notifications:ZY(e.notifications,t)};switch(t.type){case"hydrate":{const n=d=>t.bots.some(u=>u.id===d)||t.groups.some(u=>u.id===d),s=t.resumeId,a=s&&(t.bots.some(d=>d.id===s&&!d.hidden)||t.groups.some(d=>d.id===s))?s:"",i=e.selectedId&&n(e.selectedId)?e.selectedId:a||(t.bots[0]?.id??""),o={...e,bots:t.bots.map(d=>{const u=d.messages?d:{...d,messages:[]},p=e.bots.find(m=>m.id===u.id);return SJ(p,p?{...u,tasks:Am(p.tasks,u.tasks)}:u,t.preserveNavigation===!0&&n4(p,t.navigationSince,e.transcriptGeneration),t.taskIdsAtStart)}),groups:t.groups.map(d=>{const u=e.groups.find(m=>m.id===d.id),p=u?{...d,tasks:Am(u.tasks,d.tasks)}:d;return p.description===null&&(p.description=void 0),IJ(u,p,t.preserveNavigation===!0&&n4(u,t.navigationSince,e.transcriptGeneration),t.taskIdsAtStart)}),sections:t.sections??[],computerControl:t.computerControl,selectedId:i,hydrated:!0,backgroundThreadEvents:{},loadingOlder:{},transcriptGeneration:{},modelVariantSessions:{}},c=[...o.bots,...o.groups].find(d=>d.threadId===e.unreadDivider?.threadId);return c&&(o.unreadDivider=Tm(e.unreadDivider,c.threadId,Es(c),!!c.hasMore)),Tp(t.botQueuedMessages?w4(o,t.botQueuedMessages):o,[...t.bots,...t.groups])}case"loadOlderMessages":return e.loadingOlder[t.threadId]?e:{...e,loadingOlder:{...e.loadingOlder,[t.threadId]:!0}};case"olderMessages":{const{[t.threadId]:n,...s}=e.loadingOlder;if((e.transcriptGeneration[t.threadId]??0)!==t.generation)return{...e,loadingOlder:s};const a=u=>{const p=new Set(u.messages.map(m=>m.id));return{...u,messages:[...t.messages.filter(m=>!p.has(m.id)),...u.messages],hasMore:t.hasMore}},i=e.bots.map(u=>u.threadId===t.threadId?a(u):u),o=e.groups.map(u=>u.threadId===t.threadId?a(u):u),c=[...i,...o].find(u=>u.threadId===t.threadId),d=Tm(e.unreadDivider,t.threadId,c?Es(c):[],t.hasMore);return{...e,loadingOlder:s,bots:i,groups:o,unreadDivider:d}}case"sectionDeleted":return{...e,sections:t.sections,bots:e.bots.map(n=>n.section===t.section?{...n,section:void 0}:n),groups:e.groups.map(n=>n.section===t.section?{...n,section:void 0}:n)};case"sections":return{...e,sections:t.sections};case"botsOrdered":{const n=VY(e.bots,t.botIds);return n.every((s,a)=>s===e.bots[a])?e:{...e,bots:n}}case"botQueues":return Tp(w4(e,t.queues),[...e.bots,...e.groups]);case"showRoutines":return{...e,activeView:"routines",routinesFocus:{section:t.section,view:t.view,botId:t.botId,routineId:t.routineId,runStatus:t.runStatus,nonce:e.routinesFocus.nonce+1},settingsOpen:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,notificationsOpen:!1,appSettingsOpen:!1,pluginsOpen:!1};case"showChat":return e.activeView==="chat"?e:{...e,activeView:"chat"};case"showTeamMap":case"showFiles":case"showWebPanel":return{...e,activeView:t.type==="showFiles"?"files":t.type==="showWebPanel"?"web-panel":"team-map",filesSuggest:t.type==="showFiles"&&t.suggest?.length?t.suggest:null,webPanelId:t.type==="showWebPanel"?t.id:e.webPanelId,settingsOpen:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,appSettingsOpen:!1,pluginsOpen:!1};case"routinesHydrated":return{...e,routines:t.routines,routineRuns:S0(t.runs),routineRunsSince:t.since??null,routinesLoadState:"ready"};case"routinesLoadFailed":return{...e,routinesLoadState:"error"};case"routinePatched":{const n=e.routines.find(s=>s.id===t.routine.id);return n&&n.updatedAt>t.routine.updatedAt?e:{...e,routines:n?e.routines.map(s=>s.id===t.routine.id?t.routine:s):[t.routine,...e.routines]}}case"routineDeleted":return{...e,routines:e.routines.filter(n=>n.id!==t.routineId)};case"routineRunPatched":{const s=e.routineRuns.some(a=>a.id===t.run.id)?e.routineRuns.map(a=>a.id===t.run.id?t.run:a):[t.run,...e.routineRuns];return{...e,routineRuns:S0(s)}}case"routineRunsLoaded":return{...e,routineRuns:jX(e.routineRuns,t.runs),routineRunsSince:NX(e.routineRunsSince,t)};case"webhooksHydrated":return{...e,webhooks:t.webhooks,webhookAttempts:t.attempts,webhookIngress:t.ingress};case"webhookPatched":{const n=e.webhooks.some(s=>s.id===t.webhook.id);return{...e,webhooks:n?e.webhooks.map(s=>s.id===t.webhook.id?t.webhook:s):[t.webhook,...e.webhooks]}}case"webhookDeleted":return{...e,webhooks:e.webhooks.filter(n=>n.id!==t.webhookId),webhookAttempts:e.webhookAttempts.filter(n=>n.webhookId!==t.webhookId)};case"webhookAttempted":{const n=e.webhookAttempts.some(s=>s.id===t.attempt.id)?e.webhookAttempts.map(s=>s.id===t.attempt.id?t.attempt:s):[...e.webhookAttempts,t.attempt];return{...e,webhookAttempts:n.slice(-2e3)}}case"groupPatched":{const n=t.group.messages?_p(e,t.group.threadId):e,s=vJ(e.groups,t.group),a=t.group.messages&&s.find(i=>i.id===t.group.id&&i.threadId===e.unreadDivider?.threadId);return{...n,groups:s,...a?{unreadDivider:Tm(e.unreadDivider,a.threadId,Es(a),!!a.hasMore)}:{}}}case"groupSnapshot":{const n=wJ(e,t);return n?Ar(e,{type:"groupPatched",group:n}):e}case"groupDeleted":{const n=e.groups.filter(a=>a.id!==t.groupId),s=e.selectedId===t.groupId?e.bots[0]?.id??"":e.selectedId;return{...e,groups:n,selectedId:s}}case"instances":return{...e,instances:t.instances};case"configStatus":return{...e,config:t.config};case"liveCall":return{...e,liveCall:t.call,liveCallVersion:e.liveCallVersion+1};case"liveCallLookup":return t.since===e.liveCallVersion&&t.seq>e.liveCallLookupSeq?{...e,liveCall:t.call,liveCallLookupSeq:t.seq}:e;case"profileSaved":return e.config?{...e,config:{...e.config,profile:{name:"",email:"",...e.config.profile,...t.profile}}}:e;case"select":{const n=e.groups.find(a=>a.id===t.id);if(n)return{...t.id===e.selectedId&&e.activeView==="chat"?e:Ko(e),unreadDivider:Gg(e,n.threadId,n.unread,n.messages,n.lastReadMessageId,n.hasMore),activeView:"chat",selectedId:t.id,groups:e.groups.map(a=>a.id===t.id?{...a,unread:!1}:a)};const s=e.bots.find(a=>a.id===t.id);return nn(Bs({...t.id===e.selectedId&&e.activeView==="chat"?e:Ko(e),unreadDivider:s?Gg(e,s.threadId,a4(s),Es(s),r4(s),s.hasMore):e.unreadDivider,activeView:"chat",selectedId:t.id},t.id,"switch"),t.id,a=>({...a,unread:!!a.tasks?.some(i=>i.threadId!==a.threadId&&i.unread),tasks:a.tasks?.map(i=>i.threadId===a.threadId?{...i,unread:!1}:i)}))}case"answerCard":{if(t.groupId){const a=e.groups.find(i=>i.id===t.groupId)?.messages.find(i=>i.id===t.messageId)?.card;return Yg(e,t.groupId,t.messageId,{answered:t.answer,...a?.requestId?{pendingAnswer:t.answer}:{}})}const s=e.bots.find(a=>a.id===t.botId)?.messages.find(a=>a.id===t.messageId)?.card;return Bs(Mm(e,t.botId,t.messageId,{answered:t.answer,...s?.requestId?{pendingAnswer:t.answer}:{dismissed:!0}}),t.botId,"working")}case"answerCardFailed":{if((t.groupId?e.groups.find(i=>i.id===t.groupId):e.bots.find(i=>i.id===t.botId))?.messages.find(i=>i.id===t.messageId)?.card?.pendingAnswer!==t.answer)return e;const a={answered:void 0,pendingAnswer:void 0};return t.groupId?Yg(e,t.groupId,t.messageId,a):Mm(e,t.botId,t.messageId,a)}case"dismissCard":return t.groupId?Yg(e,t.groupId,t.messageId,{dismissed:!0}):Mm(e,t.botId,t.messageId,{dismissed:!0});case"decideRequest":return e;case"botAdded":return Bs({...t.preserveSelection||t.bot.id===e.selectedId?e:Ko(e),bots:[t.bot.messages?t.bot:{...t.bot,messages:[]},...e.bots.filter(n=>n.id!==t.bot.id)],...t.preserveSelection?{}:{activeView:"chat",selectedId:t.bot.id}},t.bot.id,"arrive");case"deleteBot":{const n=e.bots.filter(o=>o.id!==t.botId),s=e.selectedId===t.botId?n.find(o=>!o.hidden)?.id??n[0]?.id??"":e.selectedId,{[t.botId]:a,...i}=e.deletingBots;return yc({...e,bots:n,selectedId:s,deletingBots:i})}case"botDeletionPending":{if(t.on)return e.deletingBots[t.botId]?e:{...e,deletingBots:{...e.deletingBots,[t.botId]:!0}};if(!e.deletingBots[t.botId])return e;const{[t.botId]:n,...s}=e.deletingBots;return{...e,deletingBots:s}}case"markUnread":return nn(Bs(e,t.botId,"surprise"),t.botId,n=>({...n,unread:!0}));case"botPatched":{const n=e.bots.find(p=>p.id===t.bot.id);if(!n){const p={...e,bots:[{...t.bot,messages:t.bot.messages??[]},...e.bots]};return Tp(p,[t.bot])}const s=t.bot.unread&&!n?.unread?"surprise":t.bot.busy===!0&&!n?.busy?"working":t.bot.busy===!1&&n?.busy?"celebrate":null,a=s?Bs(e,t.bot.id,s):e,i=t.bot.busy===!1&&n?.busy&&a.computerStarts[t.bot.id]?Ar(a,{type:"computerStart",botId:t.bot.id,start:null}):a,o=t.bot.chiefOfStaff?{...i,bots:J5(i.bots,t.bot)}:i,c=typeof t.bot.threadId=="string"&&t.bot.threadId!==n.threadId&&!t.bot.tasks?.some(p=>p.threadId===n.threadId);let d=o;if(c){const{[t.bot.threadId]:p,...m}=o.backgroundThreadEvents;d={...o,backgroundThreadEvents:m}}if((c||n.awaitingThreadSnapshot&&t.bot.threadId===n.threadId)&&Array.isArray(t.bot.messages))return Ar(d,{type:"taskSwitched",bot:{...n,...t.bot,computer:t.bot.computer,section:t.bot.section,toolScope:t.bot.toolScope,managedSections:t.bot.managedSections,messages:t.bot.messages,browserProfile:t.bot.browserProfile,vpsAlias:t.bot.vpsAlias,phoneApps:t.bot.phoneApps,onlyPeopleAdded:t.bot.onlyPeopleAdded}});const u=nn(d,t.bot.id,p=>({...p,...t.bot,threadId:c?t.bot.threadId:p.threadId,activeLeafId:c?null:p.activeLeafId,awaitingThreadSnapshot:c||p.awaitingThreadSnapshot,browserProfile:t.bot.browserProfile,computer:t.bot.computer,toolScope:t.bot.toolScope,section:t.bot.section,managedSections:t.bot.managedSections,vpsAlias:t.bot.vpsAlias,phoneApps:t.bot.phoneApps,onlyPeopleAdded:t.bot.onlyPeopleAdded,tasks:t.bot.tasks?Am(p.tasks,t.bot.tasks):p.tasks,messages:c?[]:p.messages,hasMore:c?void 0:p.hasMore}));return yc(u)}case"messageAdded":{const n=e.bots.find(u=>u.threadId===t.threadId);if(!n){const u=e.groups.find(h=>h.threadId===t.threadId||h.tasks?.some(x=>x.threadId===t.threadId));if(!u||u.threadId===t.threadId&&u.messages.some(h=>h.id===t.message.id))return e;const p=Sa(e,t.threadId,t.message.at,Uc(t.message),t.message.turnCompletedAt??t.message.at);if(u.threadId!==t.threadId)return p;const m=t.message.sendId?u.messages.findIndex(h=>h.id===cl(t.message.sendId)):-1;return{...p,groups:p.groups.map(h=>h.id===u.id?{...h,messages:m>=0?h.messages.map((x,g)=>g===m?t.message:x):[...h.messages,t.message]}:h)}}if(n.messages.some(u=>u.id===t.message.id))return e;const s=Sa(e,t.threadId,t.message.at,Uc(t.message),t.message.turnCompletedAt??t.message.at),a=t.message.sendId?cl(t.message.sendId):null,i=a?n.messages.findIndex(u=>u.id===a):-1;if(i>=0)return nn(s,n.id,u=>({...u,messages:u.messages.map((p,m)=>m===i?t.message:p),activeLeafId:u.activeLeafId===a?t.message.id:u.activeLeafId}));const o=nn(s,n.id,u=>{const p=(t.message.parentId??null)===(u.activeLeafId??null);return{...u,messages:[...u.messages,t.message],activeLeafId:p?t.message.id:u.activeLeafId}}),c=t.message.role==="user"&&t.message.kind==="text"&&t.message.queueId?"working":t.message.kind==="options"?"thinking":t.message.kind==="activity"?t.message.tool?.ok===!1?"failure":t.message.tool?.ok===!0?"success":"working":t.message.role==="bot"&&t.message.kind==="text"?"blink":null;return c?Bs(o,n.id,c):o}case"optimisticMessageRemoved":{const n=cl(t.sendId),s=(p,m)=>p.filter(h=>h.id!==n).map(h=>h.optimisticThreadOrderAt===m.at?{...h,optimisticThreadOrderAt:m.optimisticThreadOrderAt}:h),a=e.bots.find(p=>p.threadId===t.threadId);if(a){const p=a.messages.find(g=>g.id===n);if(!p)return e;const m=nn(e,a.id,g=>({...g,messages:s(g.messages,p),activeLeafId:g.activeLeafId===n?t.restoreLeafId!==void 0?t.restoreLeafId:p.parentId??null:g.activeLeafId})),h=a.tasks?.find(g=>g.threadId===t.threadId),x=m.bots.find(g=>g.id===a.id)?.messages??[];return X5(m,t.threadId,x,h?.createdAt??0,a.hasMore?p.optimisticThreadOrderAt:void 0)}const i=e.groups.find(p=>p.threadId===t.threadId),o=i?.messages.find(p=>p.id===n);if(!i||!o)return e;const c={...e,groups:e.groups.map(p=>p.id===i.id?{...p,messages:s(p.messages,o)}:p)},d=i.tasks?.find(p=>p.threadId===t.threadId),u=c.groups.find(p=>p.id===i.id)?.messages??[];return X5(c,t.threadId,u,d?.createdAt??i.createdAt,i.hasMore?o.optimisticThreadOrderAt:void 0)}case"messagePatched":{const n=Uc(t.message)?Sa(e,t.threadId,t.message.at,!0,t.message.turnCompletedAt??t.message.at):e,s=n.bots.find(o=>o.threadId===t.threadId);if(!s){const o=n.groups.find(c=>c.threadId===t.threadId);return o?{...n,groups:n.groups.map(c=>c.id===o.id?{...c,messages:c.messages.map(d=>d.id===t.message.id?t.message:d)}:c)}:n}const a=t.message.kind==="activity"?t.message.tool?.ok===!1?"failure":t.message.tool?.ok===!0?"success":"working":null,i=a?Bs(n,s.id,a):n;return nn(i,s.id,o=>({...o,messages:o.messages.map(c=>c.id===t.message.id?t.message:c)}))}case"computerStart":{const{[t.botId]:n,...s}=e.computerStarts;return{...t.start?Bs(e,t.botId,"launch"):e,computerStarts:t.start?{...s,[t.botId]:t.start}:s}}case"computerControl":return{...e,computerControl:{...e.computerControl,[t.botId]:{held:t.held,helpReason:t.helpReason,help:t.help??null}}};case"modelVariantRuntime":{const n=t.event;if(!n.turnId)return e;const s=e.bots.find(o=>o.threadId===n.threadId||o.tasks?.some(c=>c.threadId===n.threadId));if(!s)return e;const a=Qn(s,n.threadId).modelSelection;if(a.instanceId!==n.providerInstanceId||!e.instances.find(o=>o.instanceId===a.instanceId)?.capabilities?.modelVariants)return e;const i=e.modelVariantSessions[n.threadId];return n.type==="turn.started"?i&&(i.turnId===n.turnId||Date.parse(i.startedAt)>Date.parse(n.createdAt))?e:{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{instanceId:a.instanceId,model:a.model,turnId:n.turnId,startedAt:n.createdAt,acceptingUpdates:!0}}}:!i?.acceptingUpdates||i.turnId!==n.turnId||i.instanceId!==a.instanceId||i.model!==a.model?e:n.type==="session.model-variants"&&n.model===a.model?{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{...i,variants:n.variants}}}:n.type==="turn.completed"?{...e,modelVariantSessions:{...e.modelVariantSessions,[n.threadId]:{...i,acceptingUpdates:!1}}}:e}case"setModel":if(t.threadId){const n=Ar(e,{type:"updateTask",botId:t.botId,threadId:t.threadId,patch:{modelSelection:t.selection,resetApprovalToAsk:t.resetApprovalToAsk}});return nn(n,t.botId,s=>({...s,tasks:s.tasks?.map(a=>a.threadId!==t.threadId?a:{...a,followsBotModel:!!t.updateBotDefault||nA(t.selection,s.modelSelection)})}))}return yc(nn(e,t.botId,n=>({...n,modelSelection:t.selection})));case"updateTask":{const n=LA(t.patch);return yc(nn(e,t.botId,s=>({...s,tasks:(s.tasks??[{threadId:s.threadId,title:"New thread",createdAt:Date.now()}]).map(a=>a.threadId===t.threadId?{...a,...n}:a)})))}case"connected":return{...e,connected:t.value};case"error":return{...t.message&&e.selectedId?Bs(e,e.selectedId,"alert"):e,error:t.message};case"toggleSettings":{if(t.botId!==void 0&&!e.bots.some(o=>o.id===t.botId&&!o.hidden))return e;const n=t.botId??e.selectedId,s=t.open??(t.botId!==void 0||!e.settingsOpen),a=s&&!e.settingsOpen,i=t.section!==void 0;return{...e,selectedId:n,settingsOpen:s,activityOpen:s?!1:e.activityOpen,botSettingsSection:t.section??e.botSettingsSection,botSettingsExpandAccordion:s?i||a&&e.botSettingsSectionStored:!1,botSettingsExpandRemembered:s?!i&&a&&e.botSettingsSectionStored:!1,botSettingsSectionStored:i||e.botSettingsSectionStored,appSettingsOpen:s?!1:e.appSettingsOpen}}case"togglePlugins":{const n=t.open??!e.pluginsOpen;return{...e,pluginsOpen:n,pluginsSurface:t.surface??e.pluginsSurface,...n?{settingsOpen:!1,appSettingsOpen:!1,shortcutsOpen:!1}:{}}}case"botCreationPending":return{...e,botCreationPending:t.on};case"notice":return{...e,notice:t.notice};case"revealThread":return{...e,appSettingsOpen:!1,shortcutsOpen:!1,pluginsOpen:!1,revealThread:{threadId:t.threadId,nonce:(e.revealThread?.nonce??0)+1}};case"focusMessage":return{...e,focusMessage:{threadId:t.threadId,messageId:t.messageId,matchText:t.matchText,nonce:(e.focusMessage?.nonce??0)+1,consumed:!1}};case"focusMessageConsumed":return!e.focusMessage||e.focusMessage.nonce!==t.nonce?e:{...e,focusMessage:{...e.focusMessage,consumed:!0}};case"unreadDividerDone":return e.unreadDivider?.threadId===t.threadId?{...e,unreadDivider:null}:e;case"openDataResult":return e.bots.some(s=>s.id===t.botId)?{...Ar(Ar(e,{type:"select",id:t.botId}),{type:"toggleComputer",open:!0}),dataResultFocus:{botId:t.botId,id:t.cardId,requestId:(e.dataResultFocus?.requestId??0)+1,consumed:!1}}:e;case"dataResultFocusConsumed":return e.dataResultFocus?.requestId===t.requestId?{...e,dataResultFocus:{...e.dataResultFocus,consumed:!0}}:e;case"openSignIn":{if(!e.bots.some(i=>i.id===t.botId))return e;const n=Ar(Ar(e,{type:"select",id:t.botId}),{type:"toggleComputer",open:!0}),{type:s,...a}=t;return{...n,signInFocus:{...a,requestId:(e.signInFocus?.requestId??0)+1,consumed:!1}}}case"signInFocusConsumed":return e.signInFocus?.requestId===t.requestId?{...e,signInFocus:{...e.signInFocus,consumed:!0}}:e;case"toggleComputer":{const n=t.open??!e.computerOpen;return{...e,selectedId:t.botId!==void 0&&e.bots.some(s=>s.id===t.botId)?t.botId:e.selectedId,computerOpen:n,settingsOpen:n?!1:e.settingsOpen,inspectorOpen:n?!1:e.inspectorOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleInspector":{const n=t.open??!e.inspectorOpen;return{...e,inspectorOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleActivity":{const n=t.open??!e.activityOpen;return{...e,activityOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,appSettingsOpen:n?!1:e.appSettingsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleNotifications":{const n=t.open??!e.notificationsOpen;return{...e,notificationsOpen:n,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,activityOpen:n?!1:e.activityOpen,appSettingsOpen:n?!1:e.appSettingsOpen}}case"toggleNotificationsPinned":return{...e,notificationsPinned:t.pinned??!e.notificationsPinned};case"toggleAppSettings":{const n=t.open??!e.appSettingsOpen;return{...e,appSettingsOpen:n,activityOpen:n?!1:e.activityOpen,appSettingsSection:t.section??e.appSettingsSection,appSettingsCloudLink:t.cloudLink&&n?e.appSettingsCloudLink+1:0,appSettingsPhonePairing:t.phonePairing&&n?e.appSettingsPhonePairing+1:0,settingsOpen:n?!1:e.settingsOpen,computerOpen:n?!1:e.computerOpen,inspectorOpen:n?!1:e.inspectorOpen,pluginsOpen:n?!1:e.pluginsOpen,notificationsOpen:n&&!e.notificationsPinned?!1:e.notificationsOpen}}case"toggleShortcuts":{const n=t.open??!e.shortcutsOpen;return{...e,shortcutsOpen:n}}case"openCloudAdd":return{...e,cloudAdd:e.cloudAdd??{source:t.source,...t.signIn?{signIn:!0}:{}},cloudHowTo:!1};case"closeCloudAdd":return e.cloudAdd?{...e,cloudAdd:null}:e;case"cloudHowTo":return e.cloudHowTo===t.open?e:{...e,cloudHowTo:t.open};case"toggleTour":{const n=t.open??!e.tourOpen;return{...e,tourOpen:n,appSettingsOpen:n?!1:e.appSettingsOpen}}case"toggleWelcome":{const n=t.open??!e.welcomeOpen;return{...e,welcomeOpen:n,appSettingsOpen:n?!1:e.appSettingsOpen,shortcutsOpen:n?!1:e.shortcutsOpen}}case"updateBot":{const s=Object.prototype.hasOwnProperty.call(t.patch,"color")||Object.prototype.hasOwnProperty.call(t.patch,"mascotExpression")?Bs(e,t.botId,"customize"):e,a=s.bots.find(y=>y.id===t.botId),i=t.patch.chiefOfStaff?{...s,bots:J5(s.bots,{...a,...t.patch,id:t.botId})}:s,{acknowledgeLocalAuto:o,applyToAllThreads:c,keepThreadModels:d,threadId:u,mainThreadChoice:p,computer:m,connectorTools:h,connectorScopes:x,phoneApps:g,...k}=t.patch,v={...k,...g!==void 0&&{phoneApps:g??void 0},...typeof p=="string"&&{mainThreadId:p}};return m===null?v.computer=void 0:m!==void 0&&(v.computer=m),h===null?v.connectorTools=void 0:h!==void 0&&(v.connectorTools=h),x===null?v.connectorScopes=void 0:x!==void 0&&(v.connectorScopes=x),nn(i,t.botId,y=>({...y,...v}))}case"threadActive":{const n=e.bots.find(s=>s.threadId===t.threadId);return n?nn(_p(e,t.threadId),n.id,s=>({...s,activeLeafId:t.activeLeafId})):e}case"switchBranch":{const n=e.bots.find(a=>a.id===t.botId);if(!n)return e;let s=t.messageId;for(;;){const a=n.messages.filter(i=>i.parentId===s);if(!a.length)break;s=a.reduce((i,o)=>o.at>=i.at?o:i).id}return nn(_p(e,n.threadId),t.botId,a=>({...a,activeLeafId:s}))}case"patchGroup":return{...e,groups:e.groups.map(n=>n.id===t.groupId?{...n,...t.patch}:n)};case"pendingQueued":{if(e.consumedQueueIds[t.queueId]){const s={...e.consumedQueueIds};return delete s[t.queueId],{...e,consumedQueueIds:s}}const n=e.pendingQueued[t.threadId]??[];return n.some(s=>s.queueId===t.queueId)?e:{...e,pendingQueued:{...e.pendingQueued,[t.threadId]:[...n,{queueId:t.queueId,text:t.text,...t.reason?{reason:t.reason}:{}}]}}}case"consumePendingQueued":{const n=e.pendingQueued[t.threadId]??[],s=n.findIndex(o=>o.queueId===t.queueId);if(s<0)return{...e,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)};const a=n.filter((o,c)=>c!==s),i={...e.pendingQueued};return a.length?i[t.threadId]=a:delete i[t.threadId],{...e,pendingQueued:i,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)}}case"cancelQueued":{const n=e.bots.find(c=>c.id===t.botId);if(!n)return e;const s=t.threadId??n.threadId,i=(e.pendingQueued[s]??[]).filter(c=>c.queueId!==t.queueId),o={...e.pendingQueued};return i.length?o[s]=i:delete o[s],{...e,pendingQueued:o,consumedQueueIds:ul(e.consumedQueueIds,t.queueId)}}case"steerQueued":return e;case"cancelGroupQueued":{const n=e.pendingQueued[t.threadId]??[],s=n.filter(i=>i.queueId!==t.queueId);if(s.length===n.length)return e;const a={...e.pendingQueued};return s.length?a[t.threadId]=s:delete a[t.threadId],{...e,pendingQueued:a}}case"send":{const n=Bs(EX(e,t.botId),t.botId,"working");if(!t.sendId)return n;const s=n.bots.find(o=>o.id===t.botId),a=t.threadId??s?.threadId;if(!s||a!==s.threadId||s.messages.some(o=>o.sendId===t.sendId))return n;const i=qg(t.text,t.sendId,t.replyToId,s.activeLeafId);return i.optimisticThreadOrderAt=s.tasks?.find(o=>o.threadId===a)?.lastThreadOrderAt,Sa(nn(n,s.id,o=>({...o,messages:[...o.messages,i],activeLeafId:i.id})),a,i.at,!0)}case"editMessage":{const n=Bs(e,t.botId,"working");if(!t.sendId)return n;const s=n.bots.find(c=>c.id===t.botId),a=t.threadId??s?.threadId;if(!s||a!==s.threadId||s.messages.some(c=>c.sendId===t.sendId))return n;const i=s.messages.find(c=>c.id===t.messageId);if(!i||i.role!=="user"||i.kind!=="text")return n;const o=qg(t.text.trim(),t.sendId,i.replyToId,i.parentId??null);return o.optimisticThreadOrderAt=s.tasks?.find(c=>c.threadId===a)?.lastThreadOrderAt,Sa(nn(n,s.id,c=>({...c,messages:[...c.messages,o],activeLeafId:o.id})),a,o.at,!0)}case"switchGroupTask":return e.selectedId===t.groupId&&e.activeView==="chat"?e4(e,t.groupId,t.threadId):e;case"newGroupTask":return e.selectedId===t.groupId&&e.activeView==="chat"?Ko(e):e;case"deleteTask":case"deleteGroupTask":case"regenerateTaskTitle":return e;case"newTask":return t.cwd!==void 0?e:{...Ko(e),selectedId:t.botId,activeView:"chat"};case"switchTask":{const{[t.threadId]:n,...s}=e.backgroundThreadEvents;return nn({...e4(e,t.botId,t.threadId),backgroundThreadEvents:s,selectedId:t.botId,activeView:"chat",revealThread:{threadId:t.threadId,nonce:(e.revealThread?.nonce??0)+1}},t.botId,a=>({...a,switchingTo:t.threadId}))}case"switchTaskFailed":return nn(e,t.botId,n=>n.switchingTo===t.threadId?{...n,switchingTo:void 0}:n);case"renameTask":return nn(e,t.botId,n=>({...n,tasks:(n.tasks??[]).map(s=>s.threadId===t.threadId?{...s,title:t.title}:s)}));case"renameGroupTask":return Sp(e,t.groupId,t.threadId,{title:t.title});case"pinGroupTask":return Sp(e,t.groupId,t.threadId,{pinned:t.pinned?!0:void 0});case"archiveGroupTask":return Sp(e,t.groupId,t.threadId,{archivedAt:t.archivedAt??void 0});case"setConversationTurnLimit":return t.dm?{...e,groups:e.groups.map(n=>n.id===t.groupId?{...n,turnTimeoutMinutes:t.minutes??void 0}:n)}:Sp(e,t.groupId,t.threadId,{turnTimeoutMinutes:t.minutes??void 0});case"taskSwitched":{let n=nn(_p(e,t.bot.threadId),t.bot.id,o=>({...o,...t.bot,computer:t.bot.computer,toolScope:t.bot.toolScope,managedSections:t.bot.managedSections,vpsAlias:t.bot.vpsAlias,messages:t.bot.messages??[],hasMore:t.bot.hasMore,awaitingThreadSnapshot:!1,switchingTo:void 0}));for(const o of e.backgroundThreadEvents[t.bot.threadId]??[])n=Ar(n,o);const{[t.bot.threadId]:s,...a}=n.backgroundThreadEvents;n={...n,backgroundThreadEvents:a};const i=n.bots.find(o=>o.id===t.bot.id);return i&&i.id===n.selectedId&&(n={...n,unreadDivider:Gg(n,i.threadId,a4(i),Es(i),r4(i),i.hasMore)},n.activeView==="chat"&&(n=nn(n,i.id,o=>({...o,unread:!!o.tasks?.some(c=>c.threadId!==o.threadId&&c.unread),tasks:o.tasks?.map(c=>c.threadId===o.threadId?{...c,unread:!1}:c)})))),yc(Tp(n,[t.bot]))}case"newBot":return t.preserveSelection?e:{...e,settingsOpen:!1,appSettingsOpen:!1,pluginsOpen:!1,shortcutsOpen:!1};case"duplicateBot":case"createProject":case"updateProject":case"deleteProject":case"reorderProjects":case"interrupt":case"createGroup":case"deleteGroup":case"interruptGroup":case"setGroupHold":case"steerGroupQueued":case"createRoutine":case"updateRoutine":case"deleteRoutine":case"runRoutine":case"cancelRoutineRun":case"markRoutineRunSeen":case"markAllRoutineRunsSeen":case"refreshTaskPermissions":case"followBotModel":case"loadDataSheet":return e;case"dataSheet":return{...e,dataSheets:{...e.dataSheets,[t.sheet.botId]:t.sheet},...t.tables?{dataTables:{...e.dataTables,[t.sheet.botId]:t.tables}}:{}};case"dataView":return{...e,dataView:t.view};case"sendGroup":{if(!t.sendId)return e;const n=e.groups.find(o=>o.id===t.groupId);if(!n)return e;const s=t.threadId??n.threadId;if(s===n.threadId&&n.messages.some(o=>o.sendId===t.sendId))return e;const a=qg(t.text,t.sendId,t.replyToId,null,t.mode??"chat");a.optimisticThreadOrderAt=n.tasks?.find(o=>o.threadId===s)?.lastThreadOrderAt;const i=Sa(e,s,a.at,s===n.threadId);return s!==n.threadId?i:{...i,groups:i.groups.map(o=>o.id===n.id?{...o,messages:[...o.messages,a]}:o)}}}}function AX(e){const t=e&&typeof e=="object"&&"tables"in e?e.tables:void 0;return Array.isArray(t)?t.filter(n=>n&&typeof n.name=="string"):[]}function TX(e,t){const n=e&&typeof e=="object"&&"sheet"in e?e.sheet:e;if(n&&typeof n=="object"&&Array.isArray(n.cards)){const s=n;return{...s,botId:s.botId||t,sources:Array.isArray(s.sources)?s.sources:[]}}return{version:1,botId:t,cards:[],sources:[],updatedAt:new Date(0).toISOString()}}const _X={modelVariantSessions:{},backgroundThreadEvents:{},loadingOlder:{},transcriptGeneration:{},bots:[],groups:[],sections:[],instances:[],config:null,liveCall:null,liveCallVersion:0,liveCallLookupSeq:0,selectedId:"",activeView:"chat",routines:[],routineRuns:[],routineRunsSince:null,routinesLoadState:"loading",routinesFocus:{nonce:0},filesSuggest:null,webhooks:[],webhookAttempts:[],webhookIngress:null,settingsOpen:!1,pluginsOpen:!1,pluginsSurface:"apps",botCreationPending:!1,computerOpen:!1,inspectorOpen:!1,activityOpen:!1,notificationsOpen:!1,notificationsPinned:!1,notifications:[],appSettingsOpen:!1,appSettingsSection:"general",appSettingsCloudLink:0,appSettingsPhonePairing:0,shortcutsOpen:!1,cloudAdd:null,cloudHowTo:!1,welcomeOpen:!1,tourOpen:!1,botSettingsSection:"overview",botSettingsExpandAccordion:!1,botSettingsSectionStored:!1,botSettingsExpandRemembered:!1,computerStarts:{},deletingBots:{},computerControl:{},dataSheets:{},dataTables:{},dataResultFocus:null,signInFocus:null,dataView:null,focusMessage:null,unreadDivider:null,connected:!1,error:null,notice:null,revealThread:null,mascotMotion:null,pendingQueued:{},consumedQueueIds:{}},Wc=200,N4=80;function ud(){if(!(typeof window>"u"||!window.ogb?.approvals))return Xh().host.packaged?window.ogb.approvals:void 0}async function MX(e,t,n,s,a=K){const{approvalMode:i,autoApprove:o,acknowledgeLocalAuto:c,...d}=n,u=i??(o===void 0?void 0:o?"auto":"ask");if(u==="custom"&&!s)throw new Error(l("approvalMode.needsDesktopApp"));return u&&s?(Object.keys(d).length&&await a(`/api/bots/${e}/tasks/${t}`,{method:"PATCH",body:JSON.stringify(d)}),s.setMode(e,u,{threadId:t,threadOnly:!0,acknowledgeLocalAuto:c===!0})):(await a(`/api/bots/${e}/tasks/${t}`,{method:"PATCH",body:JSON.stringify({...d,approvalMode:i,autoApprove:o,acknowledgeLocalAuto:c})})).bot}async function $A(e,t,n,s=K,a=ud(),i,o=!1){const{approvalMode:c,applyToAllThreads:d,...u}=t,p=c!==void 0&&c!=="custom"&&(In(i??{})==="custom"||d===!0&&zA(i??{}).includes("custom"));if(!(c==="custom"||p||c==="full"&&a!==void 0)){const k=JSON.stringify(c===void 0?u:{...u,approvalMode:c,...d?{applyToAllThreads:!0}:{}});return(await s(`/api/bots/${e}`,{method:"PATCH",body:k,signal:n,keepalive:o&&XZ(k)})).bot}if(!a||c===void 0)throw new Error(l("approvalMode.levelNeedsDesktopApp"));const h={acknowledgeLocalAuto:u.acknowledgeLocalAuto===!0,...d?{allThreads:!0}:{}},x=async()=>{if(n.aborted){if(c==="full"||c==="custom")try{await a.setMode(e,"ask",{acknowledgeLocalAuto:!1,...d?{allThreads:!0}:{}})}catch(k){throw new Error(l("approvalMode.revokeFailed",{mode:l(c==="full"?"approvalMode.full.label":"approvalMode.custom.name"),error:k instanceof Error?k.message:String(k)}))}throw new DOMException("The bot update was cancelled","AbortError")}};if(p){const k=await a.setMode(e,c,h);return await x(),Object.keys(u).length===0?k:(await s(`/api/bots/${e}`,{method:"PATCH",body:JSON.stringify(u),signal:n})).bot}if(Object.keys(u).length>0&&await s(`/api/bots/${e}`,{method:"PATCH",body:JSON.stringify(u),signal:n}),n.aborted)throw new DOMException("The bot update was cancelled","AbortError");const g=await a.setMode(e,c,h);return await x(),g}const Mp=new Map;async function RX(e,t,n){const s=Mp.get(e);if(s)return s;const a=(async()=>{n(e,await t(e))})();Mp.set(e,a);try{await a}finally{Mp.get(e)===a&&Mp.delete(e)}}function BA(e){return e instanceof Error?e:new Error(String(e))}async function OX(e,t,n){const[s,...a]=await Promise.allSettled([e(),...t.map(i=>i.load())]);return a.forEach((i,o)=>{i.status==="rejected"&&n(t[o],BA(i.reason))}),s.status==="fulfilled"}function zX(e){return eZ(e),e.type==="turn.started"||e.type==="session.model-variants"||e.type==="turn.completed"?{type:"modelVariantRuntime",event:e}:null}const Uu=f.createContext(null);function LX(e){const t=cZ();return t?{...e,botSettingsSection:t,botSettingsSectionStored:!0}:e}function PX({children:e}){const t=f.useRef(new Map).current,n=j=>({...j,tasks:j.tasks?.map(S=>({...S,...LA(t.get(S.threadId)?.patch??{})}))}),[s,a]=f.useReducer(Ar,_X,j=>hJ(LX(j))),i=f.useRef(s),o=f.useRef(0);i.current=s;const c=Qe(),d=f.useRef(c);d.current=c;const u=f.useCallback(()=>{a({type:"error",message:null})},[]);sX(s.error,u),f.useEffect(()=>{s.selectedId&&oZ(s.selectedId)},[s.selectedId]),f.useEffect(()=>{s.settingsOpen&&s.botSettingsExpandAccordion&&dZ(s.botSettingsSection)},[s.settingsOpen,s.botSettingsExpandAccordion,s.botSettingsSection]);const p=f.useMemo(()=>ZZ({send:(j,S,E,A,_)=>$A(j,S,E,K,ud(),A,_),reconcile:async(j,S)=>(await K(`/api/bots?messages=${Wc}`,{signal:S})).bots.find(A=>A.id===j)??null,onAuthoritative:(j,S)=>{a({type:"botPatched",bot:n({...j,...S})})},onError:j=>{a({type:"error",message:j.message})}}),[]);f.useEffect(()=>{p.revive();const j=QZ(p,window);return()=>{j(),p.dispose()}},[p]);const m=f.useMemo(()=>{const j=new Map,S=jJ(()=>i.current,a),E=new Set,A=eX();let _=!1;const N=M=>{$E(M)||(nX(M)?$({type:"notice",notice:{kind:"note",botName:null,text:M.message}}):a({type:"error",message:M instanceof Error?M.message:String(M)}))},C=M=>F=>{N(F),K("/api/bots?messages=0").then(W=>{const z=NJ(M,W);z?.type==="botPatched"?a({...z,bot:n({...z.bot,...p.overlayFor(z.bot.id)})}):z&&a(z)}).catch(()=>{})},R=M=>{const F=M.groupId?i.current.groups.find(W=>W.id===M.groupId):i.current.bots.find(W=>W.id===M.botId);return{host:F,card:F?.messages.find(W=>W.id===M.messageId)?.card,inRoom:!!M.groupId}},O=(M,F,W)=>{fetch(`/api/bots/${M}/cards/${F}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(W)}).catch(()=>{})},q=async(M,F)=>{const W=F?t.get(F)?.execution:void 0,z=[...t.values()].filter(B=>B.updatesDefault&&M.some(D=>D.id===B.botId));await Promise.all([W,...z.map(B=>B.execution),...M.map(async B=>{const D=await p.flush(B.id);if(!D)return;const T=B.modelSelection;if(In(D)!==In(B)||D.memoryEnabled!==!1!=(B.memoryEnabled!==!1)||D.modelSelection.instanceId!==T.instanceId||D.modelSelection.model!==T.model||D.modelSelection.effort!==T.effort||D.modelSelection.variant!==T.variant)throw new Error(l("approvalMode.settingsNotSaved"))})]),F&&await t.get(F)?.execution},L=(M,F,W)=>{const z=t.get(F),B=W.updateBotDefault||W.approvalMode!==void 0?[...t.values()].filter(U=>U.botId===M):[],D=Promise.all([z?.promise,...B.map(U=>U.promise)].map(U=>U?.catch(()=>{}))).then(async()=>{const U=W.resetApprovalToAsk?Gv():void 0;return U?U.setMode(M,"ask",{threadId:F,modelSelection:W.modelSelection,updateBotDefault:!!W.updateBotDefault}):MX(M,F,W,ud())}),T=Promise.all([z?.execution,D]);T.catch(()=>{});const V={botId:M,updatesDefault:!!(W.updateBotDefault||z?.updatesDefault),patch:{...z?.patch,...W},promise:D,execution:T};t.set(F,V),V.promise.then(U=>{t.get(F)===V&&(t.delete(F),U&&a({type:"botPatched",bot:n(U)}))}).catch(U=>{N(U),t.get(F)===V&&(V.patch={},KY(()=>t.get(F)===V,()=>K(`/api/bots?messages=${Wc}`).then(({bots:H})=>{const G=t.get(F)===V?H.find(Z=>Z.id===M):void 0;G&&(a({type:"botPatched",bot:n(G)}),t.delete(F))})))})},P=M=>{const F=i.current,W=new Set;for(const z of F.bots)(z.threadId===M||z.tasks?.some(B=>B.threadId===M))&&W.add(z.id);for(const z of F.groups)if(z.threadId===M||z.tasks?.some(B=>B.threadId===M))for(const B of z.memberIds)W.add(B);return F.bots.filter(z=>W.has(z.id))},$=M=>{["select","newTask","switchTask","newGroupTask","switchGroupTask","showChat","showRoutines","showTeamMap","showFiles","showWebPanel"].includes(M.type)&&o.current++,M=CX(M,i.current.bots),M.type==="taskSwitched"&&(M={...M,bot:n(M.bot)}),M.type==="botPatched"&&(M={...M,bot:n(M.bot)}),(M.type==="send"||M.type==="sendGroup"||M.type==="editMessage")&&!M.sendId&&(M={...M,sendId:dr()});const F=M.type==="updateBot"||M.type==="setModel"?i.current.bots.find(T=>T.id===M.botId):void 0,W=M.type==="send"?i.current.bots.find(T=>T.id===M.botId):void 0,z=M.type==="editMessage"?i.current.bots.find(T=>T.id===M.botId)?.activeLeafId??null:null,B=(()=>{if(M.type==="editMessage"||M.type==="answerCard"){const T=i.current.bots.find(V=>V.id===M.botId);return T?[T]:[]}if(M.type==="decideRequest"){const T=P(M.threadId);if(!M.alwaysAllow||T.some(U=>U.id===M.alwaysAllow?.botId))return T;const V=i.current.bots.find(U=>U.id===M.alwaysAllow?.botId);return V?[...T,V]:T}if(M.type==="sendGroup"){const T=i.current.groups.find(V=>V.id===M.groupId)?.memberIds??[];return i.current.bots.filter(V=>T.includes(V.id))}if(M.type==="runRoutine"){const T=i.current.routines.find(U=>U.id===M.routineId);if(!T)return[];const V=new Set([T.botId]);if(T.target==="room-goal"&&T.groupId){const U=i.current.groups.find(H=>H.id===T.groupId);for(const H of U?.memberIds??[])V.add(H)}return i.current.bots.filter(U=>V.has(U.id))}return[]})(),D=(()=>{if(M.type==="send")return W?DA(W):void 0})();switch(M.type!=="cancelQueued"&&M.type!=="cancelGroupQueued"&&M.type!=="deleteBot"&&a(M),M.type){case"loadOlderMessages":{if(E.has(M.threadId))break;E.add(M.threadId);const T=i.current,U=[...T.bots,...T.groups].find(G=>G.threadId===M.threadId)?.messages[0]?.id,H=T.transcriptGeneration[M.threadId]??0;if(!U){E.delete(M.threadId),a({type:"olderMessages",threadId:M.threadId,generation:H,messages:[],hasMore:!1});break}K(`/api/threads/${M.threadId}/messages?limit=${Wc}&before=${encodeURIComponent(U)}`).finally(()=>E.delete(M.threadId)).then(G=>a({type:"olderMessages",threadId:M.threadId,generation:H,messages:G.messages??[],hasMore:!!G.hasMore})).catch(G=>{a({type:"olderMessages",threadId:M.threadId,generation:H,messages:[],hasMore:!0}),N(G)});break}case"notice":M.notice&&setTimeout(()=>a({type:"notice",notice:null}),M.notice.kind==="note"?2e4:6e3);break;case"createRoutine":K("/api/routines",{method:"POST",body:JSON.stringify(M.input)}).catch(N);break;case"updateRoutine":K(`/api/routines/${M.routineId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).then(({routine:T})=>a({type:"routinePatched",routine:T}),N);break;case"deleteRoutine":K(`/api/routines/${M.routineId}`,{method:"DELETE"}).catch(N);break;case"runRoutine":q(B).then(()=>K(`/api/routines/${M.routineId}/run`,{method:"POST"})).then(({run:T})=>M.onStarted?.(T)).catch(T=>{M.onError?M.onError(T):N(T)}).finally(()=>M.onSettled?.());break;case"cancelRoutineRun":K(`/api/routine-runs/${M.runId}/cancel`,{method:"POST"}).catch(N);break;case"loadDataSheet":K(BE.sheet(M.botId)).then(T=>a({type:"dataSheet",sheet:TX(T,M.botId),tables:AX(T)})).catch(T=>(M.onError??N)(T instanceof Error?T.message:String(T)));break;case"markRoutineRunSeen":K(`/api/routine-runs/${M.runId}/seen`,{method:"POST"}).catch(N);break;case"markAllRoutineRunsSeen":K("/api/routine-runs/seen-all",{method:"POST"}).catch(N);break;case"cancelQueued":K(`/api/bots/${M.botId}/queue/${M.queueId}`,{method:"DELETE",body:JSON.stringify({threadId:M.threadId})}).then(()=>{a(M),M.onCancelled?.()}).catch(N);break;case"steerQueued":K(`/api/bots/${M.botId}/queue/${M.queueId}/steer`,{method:"POST",body:JSON.stringify({threadId:M.threadId})}).then(T=>{if(T?.steered===!0&&Array.isArray(T.messages)&&typeof T.threadId=="string"){for(const V of T.messages)a({type:"messageAdded",threadId:T.threadId,message:V});for(const V of T.queueIds??[])a({type:"consumePendingQueued",threadId:T.threadId,queueId:V})}else T?.queued===!0&&T.blockedBy==="images"&&$({type:"notice",notice:{kind:"steer-images",botName:null}});M.onSettled?.()}).catch(T=>{N(T),M.onError?.()});break;case"cancelGroupQueued":K(`/api/groups/${M.groupId}/queue/${M.queueId}`,{method:"DELETE"}).then(()=>{a(M),M.onCancelled?.()}).catch(N);break;case"steerGroupQueued":K(`/api/groups/${M.groupId}/queue/${M.queueId}/steer`,{method:"POST",body:JSON.stringify({threadId:M.threadId})}).then(T=>{if(T?.steered===!0&&Array.isArray(T.messages)&&typeof T.threadId=="string"){for(const V of T.messages)a({type:"messageAdded",threadId:T.threadId,message:V});for(const V of T.queueIds??[])a({type:"consumePendingQueued",threadId:T.threadId,queueId:V})}else T?.queued===!0&&T.blockedBy==="images"&&$({type:"notice",notice:{kind:"steer-images",botName:null}});M.onSettled?.()}).catch(T=>{N(T),M.onError?.()});break;case"send":{D&&O(M.botId,D.id,{dismissed:!0});const T=M.threadId??i.current.bots.find(H=>H.id===M.botId)?.threadId,V=M.sendId??dr(),U=()=>xJ(i.current.bots.find(H=>H.id===M.botId&&H.threadId===T)?.messages,V);q(W?[W]:[],T).then(()=>bJ(()=>K(`/api/bots/${M.botId}/messages`,{method:"POST",body:JSON.stringify({text:M.text,replyToId:M.replyToId,threadId:T,sendId:V,...M.dataContext?{dataContext:M.dataContext}:{},...M.pointed?.length?{pointed:M.pointed}:{},...M.openPage?{openPage:M.openPage}:{},...M.mode==="goal"?{mode:"goal"}:{},...M.followUp?{followUp:M.followUp}:{},...M.mentions?.length?{mentions:M.mentions}:{}})}),U)).then(H=>{if(!("body"in H))return;const G=H.body;G?.message&&typeof G.threadId=="string"&&a({type:"messageAdded",threadId:G.threadId,message:G.message}),G?.queued&&typeof G.threadId=="string"&&typeof G.queueId=="string"&&(a({type:"optimisticMessageRemoved",threadId:G.threadId,sendId:V}),a({type:"pendingQueued",threadId:G.threadId,queueId:G.queueId,text:M.text,reason:G.reason==="capacity"||G.reason==="group-turn"?G.reason:void 0}))}).catch(H=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V}),N(H),M.onError?.()});break}case"editMessage":{const T=M.threadId??i.current.bots.find(U=>U.id===M.botId)?.threadId,V=M.sendId??dr();q(B,T).then(()=>K(`/api/bots/${M.botId}/messages/${M.messageId}/edit`,{method:"POST",body:JSON.stringify({text:M.text.trim(),threadId:T,sendId:V})})).then(U=>{U?.message&&T&&a({type:"messageAdded",threadId:T,message:U.message})}).catch(U=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V,restoreLeafId:z}),N(U)});break}case"switchBranch":K(`/api/bots/${M.botId}/active-branch`,{method:"POST",body:JSON.stringify({messageId:M.messageId,threadId:M.threadId})}).catch(N);break;case"decideRequest":{const T=()=>K(`/api/threads/${M.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:M.requestId,behavior:M.behavior,message:M.message,reviewedSha256:M.reviewedSha256,always:M.always,rememberCommand:M.rememberCommand})});q(B,M.threadId).then(async()=>{if(M.alwaysAllow){const U=i.current.bots.find(Z=>Z.id===M.alwaysAllow?.botId),H=U?.tasks?.some(Z=>Z.threadId===M.threadId),G=[...new Set([...U?Qn(U,M.threadId).alwaysAllow??[]:[],M.alwaysAllow.key])];try{await K(H?`/api/bots/${M.alwaysAllow.botId}/always-allow`:`/api/bots/${M.alwaysAllow.botId}`,{method:H?"POST":"PATCH",body:JSON.stringify(H?{threadId:M.threadId,allowKey:M.alwaysAllow.key}:{alwaysAllow:G})})}catch(Z){N(Z)}}const V=await T();V?.settlementPending&&typeof V.message=="string"&&N(new Error(V.message))}).catch(V=>{N(V),M.onError?.(V instanceof Error?V.message:String(V))});break}case"answerCard":{const{host:T,card:V,inRoom:U}=R(M);q(B,M.threadId).then(()=>{if(V?.requestId&&T){const H=V.skillRequest?{behavior:MJ(M.answer)}:YJ(V,M.answer);return K(`/api/threads/${M.threadId??T.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:V.requestId,...H,reviewedSha256:H.behavior==="allow"&&V.skillRequest?Ew(V.skillRequest):void 0})})}if(!U)return O(M.botId,M.messageId,{answered:M.answer,dismissed:!0}),K(`/api/bots/${M.botId}/messages`,{method:"POST",body:JSON.stringify({text:M.answer,threadId:M.threadId})})}).catch(H=>{V?.requestId&&T&&a({type:"answerCardFailed",botId:M.botId,messageId:M.messageId,answer:M.answer,groupId:M.groupId}),N(H)});break}case"dismissCard":{const{host:T,card:V,inRoom:U}=R(M);V?.requestId&&T?K(`/api/threads/${M.threadId??T.threadId}/respond`,{method:"POST",body:JSON.stringify({requestId:V.requestId,...cA(V)})}).catch(()=>{}):U||O(M.botId,M.messageId,{dismissed:!0});break}case"newBot":{if(G5(i.current)||_||i.current.botCreationPending)break;_=!0,a({type:"botCreationPending",on:!0}),_e(async()=>{const{makeNewBot:T}=await import("./new-bot-R2d69ePy.js").then(V=>V.n);return{makeNewBot:T}},__vite__mapDeps([0,1,2,3,4])).then(({makeNewBot:T})=>T(M,i.current.bots,$,d.current)).catch(N).finally(()=>{_=!1,a({type:"botCreationPending",on:!1})});break}case"duplicateBot":{if(G5(i.current))break;const T=i.current.bots.find(U=>U.id===M.botId);if(!T)break;const V=OJ(T);K("/api/bots",{method:"POST",body:JSON.stringify(RJ(T))}).then(({bot:U,paused:H})=>K(`/api/bots/${U.id}`,{method:"PATCH",body:JSON.stringify(V)}).then(({bot:G})=>{a({type:"botAdded",bot:{...U,...G,messages:U.messages}}),H&&DY(U.id)})).catch(N);break}case"deleteBot":a({type:"botDeletionPending",botId:M.botId,on:!0}),RX(M.botId,async T=>(await p.flush(T),K(`/api/bots/${T}`,{method:"DELETE"})),(T,V)=>{p.cancel(T),a({type:"deleteBot",botId:T}),V?.notice&&$({type:"notice",notice:{kind:"note",botName:null,text:V.notice}})}).catch(N).finally(()=>a({type:"botDeletionPending",botId:M.botId,on:!1}));break;case"markUnread":K(`/api/bots/${M.botId}`,{method:"PATCH",body:JSON.stringify({unread:!0})}).catch(()=>{});break;case"openDataResult":case"select":{const T=M.type==="select"?M.id:M.botId,V=i.current.bots.find(H=>H.id===T),U=i.current.groups.find(H=>H.id===T);V?.unread?K(`/api/bots/${T}/read`,{method:"POST",body:JSON.stringify({threadId:V.threadId})}).catch(()=>{}):U?.unread&&K(`/api/groups/${T}/read`,{method:"POST"}).catch(()=>{});break}case"createGroup":K("/api/groups",{method:"POST",body:JSON.stringify({memberIds:M.memberIds,name:M.name,section:M.section,...window.ogb?.remoteClient?.active?{setup:{bulletin:"",defaultResponder:{kind:"mentions"}}}:{}})}).then(({group:T})=>{a({type:"groupPatched",group:T}),a({type:"select",id:T.id})}).catch(N);break;case"sendGroup":{const T=M.threadId??i.current.groups.find(U=>U.id===M.groupId)?.threadId,V=M.sendId??dr();q(B).then(()=>K(`/api/groups/${M.groupId}/messages`,{method:"POST",body:JSON.stringify({text:M.text,replyToId:M.replyToId,threadId:T,sendId:V,mode:M.mode??"chat",...M.mentions?.length?{mentions:M.mentions}:{}})})).then(U=>{U?.message&&typeof U.threadId=="string"&&a({type:"messageAdded",threadId:U.threadId,message:U.message}),U?.queued&&typeof U.threadId=="string"&&typeof U.queueId=="string"&&(a({type:"optimisticMessageRemoved",threadId:U.threadId,sendId:V}),a({type:"pendingQueued",threadId:U.threadId,queueId:U.queueId,text:M.text}))}).catch(U=>{T&&a({type:"optimisticMessageRemoved",threadId:T,sendId:V}),N(U),M.onError?.()});break}case"patchGroup":K(`/api/groups/${M.groupId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).catch(C({groupId:M.groupId}));break;case"deleteGroup":K(`/api/groups/${M.groupId}`,{method:"DELETE"}).catch(N);break;case"setModel":if(M.threadId){L(M.botId,M.threadId,{modelSelection:M.selection,...M.updateBotDefault?{updateBotDefault:!0}:{},...M.resetApprovalToAsk?{resetApprovalToAsk:!0}:{}});break}F&&p.enqueue(M.botId,{modelSelection:M.selection,threadId:F.switchingTo??F.threadId},F);break;case"updateTask":L(M.botId,M.threadId,M.patch);break;case"refreshTaskPermissions":{const T=i.current.bots.find(J=>J.id===M.botId),V=T?.tasks?.find(J=>J.threadId===M.threadId);if(!T||!V){N(new Error(l("task.threadGone")));break}const U=In(T),H=In(Qn(T,M.threadId)),G=M.acknowledgeLocalAuto===!0,Z=ud();(U==="custom"||H==="custom"||U==="full"&&Z!==void 0?Z?Z.setMode(M.botId,U,{threadId:M.threadId,threadOnly:!0,refreshPermissions:!0,acknowledgeLocalAuto:G}):Promise.reject(new Error(l("approvalMode.needsDesktopApp"))):K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"PATCH",body:JSON.stringify({refreshPermissions:!0,...G?{acknowledgeLocalAuto:!0}:{}})}).then(J=>J.bot)).then(J=>{J&&a({type:"botPatched",bot:n(J)})}).catch(N);break}case"followBotModel":K(`/api/bots/${M.botId}/threads/follow-model`,{method:"POST",body:"{}"}).then(({bot:T,busy:V})=>{a({type:"botPatched",bot:n(T)}),M.onSettled?.({busy:V??0})}).catch(N);break;case"createProject":K(`/api/bots/${M.botId}/projects`,{method:"POST",body:JSON.stringify({name:M.name,emoji:M.emoji})}).then(({bot:T,project:V})=>{m({type:"botPatched",bot:T}),M.onCreated?.(V)}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"updateProject":K(`/api/bots/${M.botId}/projects/${M.projectId}`,{method:"PATCH",body:JSON.stringify(M.patch)}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onSaved?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"deleteProject":K(`/api/bots/${M.botId}/projects/${M.projectId}`,{method:"DELETE"}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onDeleted?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"reorderProjects":K(`/api/bots/${M.botId}/projects/order`,{method:"PATCH",body:JSON.stringify({projectIds:M.projectIds})}).then(({bot:T})=>{m({type:"botPatched",bot:T}),M.onSaved?.()}).catch(T=>{N(T),M.onError?.(T instanceof Error?T.message:String(T))});break;case"interrupt":sZ(K,M,N);break;case"newTask":case"switchTask":{const T=M.type==="newTask"?A(M,()=>m(M)):()=>{};if(!T)break;const V=(j.get(M.botId)??0)+1;j.set(M.botId,V);const U=o.current;(M.type==="newTask"?p.flush(M.botId):Promise.resolve()).then(()=>K(M.type==="newTask"?`/api/bots/${M.botId}/tasks`:`/api/bots/${M.botId}/tasks/${M.threadId}${M.whole?"":`?messages=${N4}`}`,{method:"POST",body:JSON.stringify(M.type==="newTask"?{projectId:M.projectId,cwd:M.cwd}:{})})).then(G=>{if(M.type==="newTask"&&(T(null),M.onCreated?.()),j.get(M.botId)!==V)return;if(!G?.bot){M.type==="switchTask"&&a({type:"switchTaskFailed",botId:M.botId,threadId:M.threadId});return}const Z=M.type==="newTask"&&M.cwd!==void 0;Z&&o.current!==U||(m({type:"taskSwitched",bot:G.bot}),Z&&a({type:"select",id:M.botId}))}).catch(G=>{M.type==="switchTask"&&j.get(M.botId)===V&&a({type:"switchTaskFailed",botId:M.botId,threadId:M.threadId});const Z=G instanceof Error?G.message:String(G);T(Z),M.type==="newTask"&&M.onError?M.onError(Z):N(G)});break}case"renameTask":K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"PATCH",body:JSON.stringify({title:M.title})}).catch(C({botId:M.botId}));break;case"regenerateTaskTitle":K(`/api/bots/${M.botId}/tasks/${M.threadId}/title`,{method:"POST"}).then(()=>M.onSettled?.(!0)).catch(T=>{N(T),M.onSettled?.(!1)});break;case"deleteTask":K(`/api/bots/${M.botId}/tasks/${M.threadId}`,{method:"DELETE"}).then(T=>T?.bot&&m({type:"botPatched",bot:T.bot})).catch(N);break;case"newGroupTask":K(`/api/groups/${M.groupId}/tasks`,{method:"POST",body:"{}"}).then(S(M.groupId,!0)).catch(N);break;case"switchGroupTask":K(`/api/groups/${M.groupId}/tasks/${M.threadId}?messages=${N4}`,{method:"POST"}).then(S(M.groupId,!0)).catch(N);break;case"renameGroupTask":case"pinGroupTask":case"archiveGroupTask":case"setConversationTurnLimit":{const T=M.type==="renameGroupTask"?{title:M.title}:M.type==="pinGroupTask"?{pinned:M.pinned,title:M.title}:M.type==="archiveGroupTask"?{archivedAt:M.archivedAt}:{turnTimeoutMinutes:M.minutes},V=M.type==="setConversationTurnLimit"&&M.dm?`/api/groups/${M.groupId}`:`/api/groups/${M.groupId}/tasks/${M.threadId}`;K(V,{method:"PATCH",body:JSON.stringify(T)}).catch(C({groupId:M.groupId}));break}case"deleteGroupTask":K(`/api/groups/${M.groupId}/tasks/${M.threadId}`,{method:"DELETE"}).then(S(M.groupId,!1)).catch(N);break;case"setGroupHold":K(`/api/groups/${M.groupId}/holds`,{method:"POST",body:JSON.stringify({botId:M.botId,held:M.held})}).then(S(M.groupId,!1)).catch(N);break;case"interruptGroup":K(`/api/groups/${M.groupId}/interrupt`,{method:"POST",body:M.threadId?JSON.stringify({threadId:M.threadId}):void 0}).catch(T=>{N(T),M.onError?.()});break;case"updateBot":{F&&p.enqueue(M.botId,M.patch,F);break}}};return $},[p]),h=f.useRef(!1);f.useEffect(()=>{if(!s.hydrated||h.current)return;h.current=!0;const j=s.bots.find(S=>S.id===s.selectedId);j&&s.activeView==="chat"&&fo(j,c)!==j.threadId&&qt(m,j,c)},[s.hydrated,s.bots,s.selectedId,s.activeView,c,m]),f.useEffect(()=>{let j=!0;const S=new Map,E=B=>{let D=S.get(B);return D||(D={attempt:0,generation:0,timer:null,version:0},S.set(B,D)),D},A=[{key:"instances",request:async()=>{const B=await If("/api/instances",async()=>jp(await K("/api/instances"),"instances"),null);return()=>{B&&a({type:"instances",instances:B.instances})}}},{key:"config",request:async()=>{const B=await K("/api/config");return()=>a({type:"configStatus",config:B})}},{key:"routines",request:async()=>{const B=Date.now()-wX,{routines:D,runs:T}=jp(await K(`/api/routines?since=${B}`),"routines","runs");return()=>a({type:"routinesHydrated",routines:D,runs:T,since:B})}},{key:"notifications",request:async()=>{const{notifications:B}=await K("/api/notifications");return()=>a({type:"notificationsHydrated",notifications:Array.isArray(B)?B:[]})}},...window.ogb?.remoteClient?.active?[]:[{key:"webhooks",request:async()=>{const{webhooks:B,attempts:D,ingress:T}=jp(await K("/api/webhooks"),"webhooks");return()=>a({type:"webhooksHydrated",webhooks:B,attempts:D??[],ingress:T})}}]],_=new Map(A.map(B=>[B.key,B])),N=(B,D)=>{if(!j)return;const T=E(B.key);if(T.timer)return;D!==void 0&&(B.key==="routines"&&a({type:"routinesLoadFailed"}),console.warn(`snapshot: ${B.key} refresh failed; retrying`,D));const V=Math.min(3e4,1e3*2**Math.min(T.attempt,5));T.attempt+=1,T.timer=setTimeout(()=>{T.timer=null;const U=()=>{C(B,!0).catch(G=>N(B,G))};if(!Da())return U();const H=ux(G=>{G||(H(),j&&U())})},V)},C=async(B,D)=>{const T=E(B.key);T.timer&&(clearTimeout(T.timer),T.timer=null);const V=++T.generation,U=T.version;try{const H=await B.request();if(!j||T.generation!==V)return;if(D&&T.version!==U){N(B);return}H(),T.attempt=0}catch(H){if(!j||T.generation!==V)return;throw BA(H)}},R=(...B)=>{for(const D of B)E(D).version+=1},O=async()=>{const B=o.current,D=i.current.transcriptGeneration,T=new Set([...i.current.bots,...i.current.groups].flatMap(Y=>Y.tasks?.map(ne=>ne.threadId)??[])),V=i.current.liveCallVersion,U=MA();If("/api/live/call",()=>K("/api/live/call"),null).then(Y=>{const ne=w0(Y);j&&ne&&Ke.flushSync(()=>a({type:"liveCallLookup",call:ne.call,since:V,seq:U}))}).catch(()=>{});const H=()=>K(`/api/bots?messages=${Wc}`).then(Y=>jp(Y,"bots")).then(({bots:Y,groups:ne,sections:J,computerControl:X,botQueuedMessages:me})=>{j&&a({type:"hydrate",bots:Y,groups:ne??[],sections:J??[],computerControl:X??{},botQueuedMessages:me,preserveNavigation:o.current!==B,navigationSince:D,taskIdsAtStart:T,resumeId:iZ()??void 0})}),G=A.map(Y=>({key:Y.key,load:()=>C(Y,!1)})),Z=await OX(H,G,(Y,ne)=>{const J=_.get(Y.key);J&&N(J,ne)});return j&&Z};let q=!1,L=null,P=!1;const $=[];let M;const F=()=>L?(P=!0,L):(q=!1,L=(async()=>{let B=!1;do P=!1,B=await O();while(j&&P);if(!j||!B)return!1;q=!0;for(const D of $.splice(0))M(D);return!0})().finally(()=>{L=null}),L),W=setTimeout(F,1e3);M=B=>{switch(B.kind==="config"?R("config","instances"):B.kind==="routine"||B.kind==="routine.deleted"||B.kind==="routine.run"?R("routines"):(B.kind==="webhook"||B.kind==="webhook.attempt"||B.kind==="webhook.deleted")&&R("webhooks"),B.kind){case"sections":a({type:"sections",sections:B.sections});break;case"bots.order":a({type:"botsOrdered",botIds:B.botIds});break;case"bot.queued":a({type:"botQueues",queues:B.queues});break;case"message":{if(a({type:"messageAdded",threadId:B.threadId,message:B.message}),B.message?.role==="user"&&typeof B.message.queueId=="string"&&a({type:"consumePendingQueued",threadId:B.threadId,queueId:B.message.queueId}),B.message?.role==="bot"&&B.message?.kind==="text"){const D=m4(i.current,B.threadId);Kg.completeBotText(B.threadId,B.message.turnId,B.message.text??"",D,B.message.id)}break}case"message.patch":a({type:"messagePatched",threadId:B.threadId,message:B.message});break;case"thread":a({type:"threadActive",threadId:B.threadId,activeLeafId:B.activeLeafId});break;case"bot":{const D=B.bot,T=i.current.bots.find(H=>H.id===D.id),V=T?.switchingTo??T?.threadId,U=D.tasks?.find(H=>H.threadId===V);D.id===i.current.selectedId&&i.current.activeView==="chat"&&document.hasFocus()&&(U?.unread||!D.tasks&&D.unread)&&(U&&(U.unread=!1),D.unread=q7(D),fetch(`/api/bots/${D.id}/read`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({threadId:V})}).catch(()=>{})),a({type:"botPatched",bot:n({...D,...p.overlayFor(D.id)})});break}case"group":{const D=B.group;D.unread&&D.id===i.current.selectedId&&document.hasFocus()&&(D.unread=!1,fetch(`/api/groups/${D.id}/read`,{method:"POST"}).catch(()=>{})),a({type:"groupPatched",group:D});break}case"notify":mZ(B.notification,D=>xn(m,D,i.current,d.current),i.current.bots.find(D=>D.id===B.notification.botId)?.avatarUrl,pJ(i.current)),a({type:"notificationReceived",entry:B.notification});break;case"notifications.read":R("notifications"),a({type:"notificationsRead",ids:B.ids});break;case"group.deleted":a({type:"groupDeleted",groupId:B.groupId});break;case"routine":a({type:"routinePatched",routine:B.routine});break;case"routine.deleted":a({type:"routineDeleted",routineId:B.routineId});break;case"routine.run":a({type:"routineRunPatched",run:B.run});break;case"webhook":a({type:"webhookPatched",webhook:B.webhook});break;case"webhook.attempt":a({type:"webhookAttempted",attempt:B.attempt});break;case"webhook.deleted":a({type:"webhookDeleted",webhookId:B.webhookId});break;case"runtime":{Kg.onRuntimeEvent(B.event,m4(i.current,B.event.threadId));const D=zX(B.event);D&&a(D);break}case"screen":i.current.computerStarts[B.botId]&&a({type:"computerStart",botId:B.botId,start:null});break;case"computer":a({type:"computerStart",botId:B.botId,start:{state:B.state,...B.place?{place:B.place}:{}}});break;case"computer-control":a({type:"computerControl",botId:B.botId,held:B.held===!0,helpReason:typeof B.helpReason=="string"?B.helpReason:null,help:lA(B.help)});break;case"data":a({type:"dataSheet",sheet:B.sheet});break;case"bot.deleted":p.cancel(B.botId),a({type:"deleteBot",botId:B.botId});break;case"live.call":{const D=w0(B);D&&(Kg.onLiveCall(D.call),Ke.flushSync(()=>a({type:"liveCall",call:D.call})));break}case"config":a({type:"configStatus",config:IX(B)});{const D=_.get("instances");D&&C(D,!0).catch(T=>N(D,T))}break}};const z=vX({onOpen:()=>a({type:"connected",value:!0}),onError:()=>a({type:"connected",value:!1}),onSnapshotRequired:()=>(clearTimeout(W),hX(),$.splice(0),tZ(),F()),onFrame:B=>{fX(B),q?M(B):$.push(mX(B))}});return()=>{j=!1,clearTimeout(W);for(const B of S.values())B.timer&&clearTimeout(B.timer);z()}},[]);const x=f.useRef(new Map),g=f.useCallback(async j=>{const S=j?.cached?"/api/instances":"/api/instances?fresh=1",E=x.current,A=E.get(S)??K(S,{timeoutMs:12e4}).then(({instances:_})=>{if(!Array.isArray(_))throw new Error(l("engineSetup.invalidStatus"));a({type:"instances",instances:_})});E.set(S,A),await A.catch(_=>{if(j?.reportErrors)throw _}).finally(()=>{E.get(S)===A&&E.delete(S)})},[]),k=f.useCallback(async j=>{const{instances:S}=await K(`/api/instances/${encodeURIComponent(j)}/refresh-models`,{method:"POST"});a({type:"instances",instances:S})},[]),v=f.useRef(0);f.useEffect(()=>{const j=()=>{const E=Date.now();E-v.current<3e4||(v.current=E,g({cached:!0}))};window.addEventListener("focus",j);const S=()=>{document.visibilityState==="visible"&&j()};return document.addEventListener("visibilitychange",S),()=>{window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",S)}},[g]);const y=f.useCallback(j=>p.flush(j),[p]),b=f.useMemo(()=>({state:s,dispatch:m,flushBotPatches:y,refreshInstances:g,refreshModels:k}),[s,m,y,g,k]),w=f.useMemo(()=>({dispatch:m,state:()=>i.current}),[m]);return r.jsx(gx,{value:w,children:r.jsx(Uu.Provider,{value:b,children:e})})}function se(){const e=f.useContext(Uu);if(!e)throw new Error("useStore outside provider");return e}function HLe({value:e,children:t}){return r.jsx(gx,{value:null,children:r.jsx(Uu.Provider,{value:e,children:t})})}function DX(e){if(!e)return[];const t=[...e.querySelectorAll("[data-sidebar-bot-row]")].map(n=>n.dataset.sidebarBotRow??"");return[...new Set(t.filter(Boolean))]}function $X(e,t){if(t.length===0)return[...e];const n=new Map(e.map(s=>[s.id,s]));return t.flatMap(s=>n.get(s)??[])}function BX(e,t,n){if(e.length===0)return;const s=e.findIndex(a=>a.id===t);return s===-1?n>0?e[0]:e.at(-1):e[(s+n+e.length)%e.length]}const Dw="omb.onboarding.welcomeDraft";function FX(){try{const e=localStorage.getItem(Dw),t=e?JSON.parse(e):null;return!t||typeof t!="object"||t.version!==U7?null:DU.includes(t.beat)?{beat:t.beat}:null}catch{return null}}function qX(e){try{localStorage.setItem(Dw,JSON.stringify({version:U7,beat:e.beat}))}catch{}}function FA(){try{localStorage.removeItem(Dw)}catch{}}const qA="omb.onboarding.sharedWorkspaceHint";function UX(){try{return localStorage.getItem(qA)==="1"}catch{return!1}}function HX(){try{localStorage.setItem(qA,"1")}catch{}}function WX({replay:e,onClose:t}){const[n,s]=f.useState(UX),a=f.useId();if(n&&!e)return null;const i=()=>{HX(),s(!0),t()};return r.jsxs("aside",{"aria-labelledby":a,className:"fixed left-[calc(var(--rail-beside,0px)_+_0.75rem)] right-3 top-14 z-40 flex items-start gap-3 rounded-2xl border border-hairline/50 bg-panel p-3.5 shadow-[0_24px_60px_-20px_rgba(0,0,0,0.6)] sm:inset-x-auto sm:right-5 sm:top-16 sm:w-[360px]",children:[r.jsx("div",{className:"shrink-0",children:r.jsx(Js,{color:"green",state:"happy",size:36,trackPointer:!1})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{id:a,className:"text-[14px] font-semibold text-ink",children:l("onboarding.shared.title")}),r.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:l("onboarding.shared.body")}),r.jsx("button",{type:"button",onClick:i,className:"mt-2.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white transition-transform duration-150 active:scale-[0.98]",children:l("onboarding.spot.gotIt")})]})]})}const eu="Limix Bot",I0=e=>e.defaultBot?.person?.trim().toLowerCase()??"";function KX(e,t){const n=t?.trim().toLowerCase()??"";return(n?e.find(s=>s.defaultBot&&I0(s)===n):void 0)??e.find(s=>s.defaultBot&&!I0(s))}let C0;const E0=new Set;let S4=!1;function VX(){S4||(S4=!0,K("/api/auth/session",{timeoutMs:1e4,background:!0}).then(e=>{C0=typeof e.email=="string"?e.email.trim().toLowerCase():null}).catch(()=>{C0=null}).finally(()=>{for(const e of E0)e()}))}function xo(){return f.useSyncExternalStore(e=>(E0.add(e),VX(),()=>E0.delete(e)),()=>C0,()=>{})}function UA(e,t){const n=I0(e);return!!(e.defaultBot&&n&&n!==(t??""))}function $w(e,t){return!!e.sidebarHidden||UA(e,t)}function tc(e,t){return t===void 0?void 0:KX(e,t)}function HA(e,t){const n=Rl(t??{});return e.find(s=>s.chiefOfStaff&&!s.hidden&&Rl(s)===n)}function GX(e,t,n){const s=Rl(t??{});return e.filter(a=>!a.defaultBot&&!a.hidden&&!$w(a,n)&&Rl(a)===s)}function YX(e,t){if(!t||t.welcomed||t.hidden)return!1;const n=HA(e,t);return!n||n.id===t.id}let A0=!1;const T0=new Set;function I4(e){if(A0!==e){A0=e;for(const t of T0)t()}}function WA(){return f.useSyncExternalStore(e=>(T0.add(e),()=>T0.delete(e)),()=>A0,()=>!1)}function JX(e,t){return{welcomed:!0,...e.sidebarHidden?{sidebarHidden:!1}:{},...t?{}:{chiefOfStaff:!0}}}function ZX(e){if(e.team)return[];const t=e.ownBots===0;return[...e.aiReady?[]:["ai"],...t?["bots","apps","phone"]:[],...t&&!e.onCloud&&!e.remote?["cloud"]:[]]}const XX=3;function QX(e){if(e.team)return[];const t=e.ownBots===0;return[...e.aiReady?[]:["ai"],...t&&!e.appsConnected?["apps"]:[],...t&&e.importFound?["import"]:[],...t&&!e.phonePaired?["phone"]:[],...t&&!e.onCloud&&!e.remote?["cloud"]:[]]}let _0=null;const M0=new Set;function $a(e){if(_0!==e){_0=e;for(const t of M0)t()}}function KA(){return f.useSyncExternalStore(e=>(M0.add(e),()=>M0.delete(e)),()=>_0,()=>null)}let VA=null;function GA(e){VA=e}function eQ(e){return VA===e}const tQ=640,Rm=700,nQ="cubic-bezier(0.22, 1, 0.36, 1)",sQ="cubic-bezier(0.3, 0.7, 0.4, 1)";function C4(e){const t=new Map;for(const n of e.querySelectorAll("[data-sidebar-bot-row], [data-section]")){const s=n.dataset.sidebarBotRow?`bot:${n.dataset.sidebarBotRow}`:`section:${n.dataset.section}`;let a=s;for(let i=2;t.has(a);i++)a=`${s}#${i}`;t.set(a,n)}return t}const E4=(e,t)=>e.width>0&&e.height>0&&e.bottom>0&&e.top<t;function YA({from:e,botId:t,reduced:n,commit:s,root:a=document}){const i=a.defaultView?.innerHeight??0,o=new Map([...C4(a)].map(([b,w])=>[b,w.getBoundingClientRect().top])),c=e?.getBoundingClientRect();Ke.flushSync(s);const d=C4(a),u=d.get(`bot:${t}`);if(!u||!E4(u.getBoundingClientRect(),i))return;if(n||!e||!c){u.animate([{opacity:0},{opacity:1}],{duration:180,easing:"linear"});return}const p={duration:Rm+100,easing:"linear"};for(const[b,w]of d){if(w===u)continue;const j=w.getBoundingClientRect();if(!E4(j,i))continue;const S=o.get(b);S===void 0?w.animate([{opacity:0},{opacity:0,offset:.5},{opacity:1}],p):Math.abs(S-j.top)>=.5&&w.animate([{transform:`translateY(${S-j.top}px)`},{transform:"translateY(0)"}],{duration:tQ,easing:nQ})}u.animate([{opacity:0},{opacity:0,offset:.72},{opacity:1}],p);const m=(u.querySelector("svg, img")??u).getBoundingClientRect(),h=e.cloneNode(!0);Object.assign(h.style,{position:"fixed",left:`${c.left}px`,top:`${c.top}px`,width:`${c.width}px`,height:`${c.height}px`,margin:"0",zIndex:"60",pointerEvents:"none",transformOrigin:"top left",filter:"none"}),h.setAttribute("aria-hidden","true"),a.body.appendChild(h),e.style.visibility="hidden";const x=m.width/Math.max(c.width,1),[g,k]=[m.left-c.left,m.top-c.top],v=h.animate([{transform:"translate(0, 0) scale(1)"},{transform:`translate(${g*.5}px, ${k*.5-24}px) scale(${(1+x)/2})`,offset:.5},{transform:`translate(${g}px, ${k}px) scale(${x})`}],{duration:Rm,easing:sQ,fill:"forwards"}),y=()=>h.remove();v.onfinish=()=>{const b=h.animate([{opacity:1},{opacity:0}],{duration:120,easing:"linear",fill:"forwards"});b.onfinish=y,b.oncancel=y},v.oncancel=y,a.defaultView?.setTimeout(y,Rm+600)}const rQ=300,Jg=150,A4=64,T4="ui-button ui-button-pill",_4="ui-button ui-button-pill ui-button-primary";function aQ(){return r.jsx("span",{"aria-hidden":"true","data-chief-badge":"",className:"absolute bottom-0 right-0 flex size-4 items-center justify-center rounded-full bg-[#E8993A] text-white ring-2 ring-menu",children:r.jsx(pa,{size:9,strokeWidth:2.5,fill:"currentColor"})})}function M4(e,t){return!!e.chiefOfStaff||t.find(n=>n.instanceId===e.modelSelection.instanceId)?.capabilities?.agentsMcp===!0}function iQ({replay:e,onDone:t,onLeave:n}){const{state:s,dispatch:a}=se(),i=Qh(),o=xo(),c=tc(s.bots,o),d=HA(s.bots,c),u=GX(s.bots,c,o),[p,m]=f.useState(!1),[h,x]=f.useState(null),[g,k]=f.useState(!1),v=f.useRef(null),y=f.useRef(null),b=f.useRef(!1);f.useEffect(()=>{const C=setTimeout(()=>{b.current=!0},rQ);return()=>clearTimeout(C)},[]),f.useEffect(()=>{if(c)return $a(c.id),()=>$a(null)},[c?.id]),f.useEffect(()=>{(v.current?.querySelector(p?"[role=radio][tabindex='0']":"[data-primary]")??v.current)?.focus({preventScroll:!0})},[p]);const w=C=>{b.current||(C.preventDefault(),C.stopPropagation())},j=(C,R)=>{k(!0),n?.(),v.current?.animate([{opacity:1},{opacity:0}],{duration:Jg,fill:"forwards"}),setTimeout(()=>t(C),R)},S=()=>{if(g||!c)return;const C=JX(c,d);e||GA(c.id),YA({from:y.current,botId:c.id,reduced:i,commit:()=>{$a(null),a({type:"updateBot",botId:c.id,patch:C})}}),j(c.id,i?Jg:Rm)},E=C=>{g||($a(null),c&&!c.welcomed&&a({type:"updateBot",botId:c.id,patch:{welcomed:!0}}),C.chiefOfStaff||a({type:"updateBot",botId:C.id,patch:{chiefOfStaff:!0}}),j(C.id,Jg))},A=u.filter(C=>M4(C,s.instances)),_=A.find(C=>C.id===h),N=C=>{if(C.key==="Escape"){C.preventDefault(),p&&m(!1);return}if(!p||!["ArrowDown","ArrowUp"].includes(C.key)||!A.length)return;C.preventDefault();const R=A.findIndex(q=>q.id===h),O=A[(R+(C.key==="ArrowDown"?1:A.length-1))%A.length];x(O.id),v.current?.querySelector(`[data-chief-choice="${O.id}"]`)?.focus()};return r.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":"chief-intro-title",tabIndex:-1,onKeyDown:N,onClickCapture:w,onKeyDownCapture:C=>(C.key==="Enter"||C.key===" ")&&w(C),"data-chief-intro":p?"choose":"intro",className:I("ui-modal animate-pop-in w-[min(440px,calc(100vw-32px))] border-0 outline-none",g&&"pointer-events-none"),children:p?r.jsxs("div",{className:"p-4",children:[r.jsx("h2",{id:"chief-intro-title",className:"text-[14px] font-medium leading-5 text-ink",children:l("onboarding.chief.chooseTitle")}),r.jsx("div",{role:"radiogroup","aria-labelledby":"chief-intro-title",className:"-mx-2 mt-2 max-h-[282px] overflow-y-auto px-2 [scrollbar-width:thin]",children:u.map(C=>{const R=M4(C,s.instances),O=h===C.id;return r.jsxs("div",{role:"radio","aria-checked":O,"aria-disabled":!R||void 0,title:R?void 0:l("sidebar.bot.chiefNeedsEngine"),tabIndex:O||!_&&C.id===A[0]?.id?0:-1,"data-chief-choice":C.id,onClick:()=>R&&x(C.id),onKeyDown:q=>{R&&(q.key===" "||q.key==="Enter")&&(q.preventDefault(),x(C.id))},className:I("flex min-h-10 items-center gap-2 rounded-lg p-2 transition-colors focus-visible:outline-offset-[-2px]",R?"cursor-pointer hover:bg-ink/[0.06]":"opacity-40",O&&"bg-ink/[0.06]"),children:[r.jsx(Ge,{bot:C,size:24}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] leading-[18px] text-ink",children:C.name}),r.jsx("span",{"aria-hidden":"true",className:I("size-4 shrink-0 rounded-full border-[1.5px]",O?"border-ink bg-ink shadow-[inset_0_0_0_3px_var(--color-menu)]":"border-ink/30")})]},C.id)})}),r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:()=>m(!1),className:T4,children:l("onboarding.back")}),r.jsx("button",{type:"button","data-chief-confirm":"",disabled:!_||g,onClick:()=>_&&E(_),className:_4,children:l("onboarding.chief.confirm")})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 pb-4 pt-6 text-center",children:[r.jsxs("span",{ref:y,className:"relative flex",children:[c?r.jsx(Ge,{bot:c,size:A4,motion:"arrive"}):r.jsx(Js,{color:"chrome",size:A4,label:eu}),r.jsx(aQ,{})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("h2",{id:"chief-intro-title",className:"text-[17px] font-medium leading-6 tracking-[-0.008em] text-ink",children:l("onboarding.chief.title")}),r.jsx("p",{className:"text-[14px] leading-5 text-ink-secondary",children:l("onboarding.chief.body")})]})]}),r.jsxs("div",{className:I("p-4",u.length>0&&"grid grid-cols-2 gap-2"),children:[u.length>0&&r.jsx("button",{type:"button","data-chief-choose":"",onClick:()=>{x(null),m(!0)},className:I(T4,"min-w-0"),children:r.jsx("span",{className:"truncate",children:l("onboarding.chief.choose")})}),r.jsx("button",{type:"button","data-primary":"","data-chief-create":"",onClick:S,disabled:!c,className:I(_4,"w-full min-w-0"),children:r.jsx("span",{className:"truncate",children:l("onboarding.chief.create")})})]})]})})}const JA="omb-engine-updated-seen";function R4(){try{const e=JSON.parse(localStorage.getItem(JA)??"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function oQ(e){const t=e.autoUpdated?.version??null,[n,s]=f.useState(null);return f.useEffect(()=>{if(!(t===null||R4()[e.driverKind]===t)){s(t);try{localStorage.setItem(JA,JSON.stringify({...R4(),[e.driverKind]:t}))}catch{}}},[e.driverKind,t]),n}function lQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:I("text-ink",t),"aria-hidden":!0,children:[r.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),r.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),r.jsx("path",{clipRule:"evenodd",d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function cQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.2 20.6 12 12.7 13.9 10.4 21.8z"})})}const dQ="M69.7784 34.9999C69.7784 39.871 68.7523 44.7296 66.7851 49.1832C64.9333 53.3744 62.2559 57.1874 58.9467 60.3483C55.8445 63.3119 52.1983 65.6915 48.2409 67.3356C44.5469 68.8705 40.5934 69.7611 36.6016 69.9583C32.8943 70.1403 29.1612 69.7256 25.5837 68.7326C22.2821 67.8153 19.1179 66.4087 16.2238 64.5701C6.14513 58.167 0 46.9674 0 34.9999C0 30.1288 1.0261 25.2701 2.99334 20.8165C7.82793 9.87552 17.9696 2.13463 29.7702 0.378474C33.1587 -0.126158 36.6197 -0.126158 40.0082 0.378474C43.6802 0.925238 47.2606 2.06281 50.5756 3.73662C54.1464 5.5397 57.4013 7.96136 60.157 10.8656C63.1112 13.9777 65.4831 17.6355 67.122 21.6056C68.8707 25.8408 69.7784 30.416 69.7784 34.9999ZM45.0815 25.5794C45.4136 26.1492 45.6484 26.7544 45.7315 27.4122C46.0379 29.8319 44.3112 32.0065 41.8829 32.2163C41.3665 32.2613 40.8425 32.2134 40.3414 32.0803C39.3229 31.8093 38.4123 31.185 37.7852 30.3366C37.496 29.9449 37.2574 29.5121 36.9996 29.1013C35.8351 27.2465 34.6239 25.4224 33.361 23.6346C32.9707 23.0802 32.5745 22.5296 32.1727 21.9829C31.8825 21.5864 31.5647 21.2024 31.347 20.7581C30.8163 19.679 30.845 18.3997 31.4282 17.3473C32.7244 15.008 36.0136 14.5091 38.1575 15.9273C38.8008 16.3534 39.2408 16.9404 39.6904 17.5532C40.0417 18.031 40.3881 18.5117 40.7308 18.9953C41.7388 20.4163 42.7133 21.8603 43.6583 23.3234C44.1403 24.0694 44.6348 24.8124 45.0815 25.5794ZM60.3288 19.2126C60.6056 19.7766 60.8261 20.3636 60.933 20.9851C61.1697 22.3515 60.786 24.0856 59.1232 24.1718C58.8398 24.1862 58.5553 24.1469 58.2814 24.0732C57.8595 23.9583 57.4624 23.762 57.0968 23.5216C56.2464 22.9634 55.5515 22.1686 55.0418 21.2905C54.8432 20.9468 54.6724 20.5867 54.4853 20.2363C54.1951 19.6905 53.8925 19.1514 53.5795 18.618C52.2536 16.3677 50.7092 14.2956 49.0159 12.3134C48.2838 11.4564 47.2348 9.80561 48.1426 8.71974C48.5234 8.26395 49.1429 8.11553 49.7118 8.11457C50.8963 8.11361 52.0685 8.64601 53.0306 9.30194C54.2037 10.1034 55.0971 11.2448 55.9667 12.3537C57.6323 14.4775 59.1385 16.7843 60.3288 19.2126Z";function uQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 70 70",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:dQ})})}const pQ=new Set(["claudeAgent","mistral","meta","museCode","kimiAgent","qwenAgent","deepseekAgent","greenference","modelgo","kiroAgent"]),mQ=new Set(["openai","xai","ollama"]);function fQ(e){return e.icon?.kind==="custom"?"brand":e.icon?.kind==="preset"?mQ.has(e.icon.preset)?"mono":"brand":pQ.has(e.driverKind)?"brand":"mono"}const hQ={brand:"opacity-60 group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-60",mono:"[--color-ink:var(--color-ink-tertiary)] [--color-ink-secondary:var(--color-ink-tertiary)] group-hover:[--color-ink:inherit] group-hover:[--color-ink-secondary:inherit] group-focus-within:[--color-ink:inherit] group-focus-within:[--color-ink-secondary:inherit]"};function Bw({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),children:[r.jsx("path",{d:"M9.26905 15.284L17.2479 9.36086C17.6391 9.07047 18.1981 9.18374 18.3845 9.63478C19.3655 12.0135 18.9272 14.8721 16.9755 16.8349C15.0238 18.7976 12.3082 19.228 9.8261 18.2477L7.1146 19.5102C11.0037 22.1834 15.7263 21.5223 18.6774 18.5525C21.0182 16.1985 21.7432 12.9897 21.0653 10.0961L21.0714 10.1023C20.0884 5.85143 21.3131 4.15233 23.8218 0.677913C23.8812 0.595532 23.9406 0.513151 24 0.428711L20.6987 3.74866V3.73836L9.267 15.2861"}),r.jsx("path",{d:"M7.62249 16.7237C4.83113 14.0422 5.3124 9.89222 7.69417 7.49905C9.45541 5.72786 12.341 5.00497 14.86 6.06768L17.5653 4.81138C17.0779 4.45714 16.4533 4.07613 15.7365 3.80839C12.4966 2.46764 8.6178 3.13492 5.98413 5.78141C3.45081 8.32904 2.65415 12.2463 4.02219 15.5889C5.04412 18.0871 3.36889 19.8541 1.68137 21.6377C1.08337 22.2699 0.483318 22.9022 0 23.5716L7.62045 16.7257"})]})}function Fw({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 256 257",preserveAspectRatio:"xMidYMid",className:I("fill-[#d97757]",t),children:r.jsx("path",{d:"m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z"})})}function nc({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 256 260",preserveAspectRatio:"xMidYMid",className:I("fill-[var(--color-ink)]",t),children:r.jsx("path",{d:"M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"})})}function qw({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:[r.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),r.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"var(--color-ink)"})]})}function xQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 508 508",className:t,"aria-hidden":!0,children:r.jsx("path",{fill:"var(--color-ink)",d:"M321.997 150.712C321.401 150.568 320.844 150.299 320.363 149.925C319.883 149.551 319.491 149.08 319.215 148.544C318.938 148.008 318.783 147.42 318.76 146.821C318.738 146.22 318.848 145.624 319.084 145.07C327.226 125.716 330.819 110.23 325.021 103.747C309.666 86.5471 248.085 120.749 228.451 132.333C227.925 132.642 227.337 132.837 226.728 132.903C226.118 132.969 225.501 132.906 224.918 132.719C224.336 132.531 223.801 132.223 223.351 131.815C222.902 131.407 222.548 130.909 222.313 130.356C214.06 111.043 205.384 97.6094 196.589 97.0268C173.279 95.4688 154.491 162.187 148.991 183.932C148.844 184.515 148.57 185.06 148.188 185.528C147.805 185.998 147.323 186.381 146.775 186.651C146.227 186.921 145.626 187.072 145.012 187.094C144.399 187.116 143.788 187.009 143.221 186.778C123.406 178.825 107.545 175.316 100.914 180.98C83.305 195.978 118.315 256.126 130.175 275.304C130.492 275.816 130.692 276.391 130.76 276.987C130.829 277.582 130.765 278.186 130.573 278.755C130.381 279.325 130.065 279.847 129.647 280.286C129.228 280.725 128.718 281.07 128.15 281.298C108.384 289.359 94.6306 297.834 94.0272 306.424C92.439 329.192 160.74 347.544 183.01 352.916C183.605 353.061 184.16 353.33 184.64 353.704C185.118 354.077 185.509 354.548 185.785 355.083C186.061 355.618 186.215 356.205 186.237 356.803C186.26 357.402 186.151 357.998 185.916 358.551C177.773 377.905 174.181 393.398 179.979 399.874C195.334 417.074 256.921 382.877 276.556 371.293C277.081 370.984 277.67 370.789 278.28 370.722C278.889 370.655 279.507 370.717 280.09 370.905C280.673 371.093 281.207 371.402 281.657 371.81C282.106 372.219 282.46 372.717 282.694 373.271C290.947 392.578 299.616 406.012 308.417 406.601C331.728 408.153 350.516 341.44 356.009 319.688C356.157 319.106 356.432 318.562 356.816 318.094C357.2 317.625 357.682 317.243 358.231 316.974C358.779 316.705 359.381 316.554 359.995 316.533C360.608 316.511 361.219 316.619 361.786 316.85C381.601 324.803 397.455 328.304 404.093 322.648C421.702 307.65 386.684 247.495 374.825 228.317C374.51 227.804 374.312 227.229 374.245 226.634C374.177 226.039 374.242 225.436 374.434 224.868C374.626 224.299 374.941 223.777 375.358 223.338C375.775 222.899 376.284 222.552 376.85 222.323C396.623 214.261 410.376 205.786 410.973 197.196C412.568 174.428 344.26 156.078 321.997 150.712ZM295.254 128.885C299.734 136.73 276.646 189 259.474 225.561C259.186 226.172 258.715 226.682 258.121 227.024C257.528 227.365 256.842 227.521 256.155 227.47C255.468 227.419 254.814 227.164 254.28 226.739C253.746 226.314 253.358 225.739 253.169 225.093C246.234 201.322 238.306 173.392 229.824 149.683C229.491 148.752 229.508 147.736 229.871 146.817C230.235 145.897 230.921 145.133 231.808 144.662C252.989 133.363 289.234 118.358 295.254 128.885ZM193.746 135.355C202.589 137.807 224.103 190.714 238.424 228.426C238.664 229.056 238.699 229.742 238.527 230.393C238.354 231.044 237.983 231.627 237.461 232.065C236.939 232.503 236.292 232.775 235.608 232.844C234.923 232.913 234.234 232.775 233.632 232.45C211.501 220.453 185.694 206.159 162.529 195.253C161.622 194.823 160.901 194.093 160.493 193.192C160.085 192.292 160.018 191.279 160.303 190.335C167.12 167.736 181.865 132.069 193.746 135.355ZM126.652 210.04C134.676 205.664 188.197 228.216 225.621 244.989C226.248 245.269 226.771 245.73 227.12 246.31C227.47 246.889 227.629 247.56 227.577 248.23C227.524 248.901 227.264 249.54 226.828 250.062C226.393 250.582 225.805 250.962 225.143 251.147C200.813 257.921 172.211 265.664 147.937 273.949C146.985 274.272 145.946 274.255 145.007 273.9C144.067 273.545 143.286 272.876 142.805 272.011C131.257 251.322 115.867 215.92 126.652 210.04ZM133.275 309.188C135.779 300.551 189.952 279.537 228.562 265.548C229.207 265.315 229.91 265.28 230.576 265.448C231.243 265.617 231.84 265.98 232.288 266.49C232.736 266.999 233.015 267.631 233.085 268.299C233.155 268.968 233.015 269.641 232.682 270.23C220.392 291.846 205.758 317.053 194.592 339.672C194.156 340.561 193.409 341.269 192.486 341.668C191.563 342.068 190.525 342.134 189.557 341.853C166.42 335.235 129.905 320.792 133.275 309.188ZM209.739 374.722C205.252 366.884 228.347 314.608 245.519 278.054C245.806 277.442 246.279 276.931 246.872 276.59C247.465 276.249 248.151 276.093 248.838 276.144C249.525 276.194 250.179 276.45 250.713 276.875C251.247 277.3 251.634 277.874 251.824 278.521C258.759 302.285 266.686 330.222 275.169 353.932C275.499 354.862 275.481 355.877 275.117 356.795C274.752 357.713 274.064 358.475 273.178 358.945C252.004 370.223 215.752 385.256 209.76 374.722H209.739ZM311.247 368.252C302.397 365.807 280.883 312.894 266.562 275.182C266.322 274.55 266.285 273.862 266.458 273.21C266.63 272.559 267.003 271.974 267.526 271.536C268.049 271.097 268.697 270.826 269.382 270.758C270.068 270.69 270.759 270.83 271.361 271.157C293.485 283.154 319.299 297.455 342.457 308.362C343.366 308.789 344.089 309.519 344.497 310.42C344.905 311.321 344.971 312.335 344.683 313.28C337.872 335.912 323.128 371.544 311.247 368.252ZM378.341 293.566C370.31 297.949 316.795 275.391 279.365 258.618C278.738 258.338 278.215 257.877 277.866 257.297C277.516 256.718 277.357 256.047 277.409 255.377C277.461 254.706 277.722 254.067 278.158 253.546C278.593 253.025 279.181 252.646 279.843 252.461C304.18 245.687 332.775 237.943 357.049 229.658C358.003 229.335 359.043 229.353 359.984 229.709C360.925 230.065 361.706 230.737 362.188 231.603C373.729 252.285 389.119 287.693 378.341 293.566ZM371.718 194.419C369.207 203.063 315.041 224.077 276.431 238.066C275.784 238.3 275.08 238.335 274.413 238.167C273.746 237.999 273.148 237.635 272.698 237.124C272.249 236.613 271.972 235.98 271.903 235.31C271.833 234.641 271.975 233.966 272.311 233.377C284.594 211.768 299.228 186.554 310.394 163.935C310.833 163.048 311.58 162.343 312.502 161.945C313.425 161.546 314.462 161.481 315.429 161.76C338.566 168.413 375.081 182.815 371.718 194.419Z"})})}function gQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",d:"M21.751 22.607c1.34 1.005 3.35.335 1.508-1.508C17.73 15.74 18.904 1 12.037 1 5.17 1 6.342 15.74.815 21.1c-2.01 2.009.167 2.511 1.507 1.506 5.192-3.517 4.857-9.714 9.715-9.714 4.857 0 4.522 6.197 9.714 9.715z"})})}function bQ({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:r.jsx("path",{fillRule:"evenodd",d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function ZA({size:e=16,className:t}){const n="omb-qwen-mark";return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":!0,children:[r.jsx("path",{fill:`url(#${n})`,fillRule:"nonzero",d:"M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z"}),r.jsx("defs",{children:r.jsxs("linearGradient",{id:n,x1:"0%",x2:"100%",y1:"0%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#6336E7",stopOpacity:.92}),r.jsx("stop",{offset:"100%",stopColor:"#6F69F7",stopOpacity:.92})]})})]})}function yQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 800 800",className:I("fill-[var(--color-ink)]",t),"aria-hidden":!0,children:[r.jsx("path",{fillRule:"evenodd",d:"M165.29 165.29 H517.36 V400 H400 V517.36 H282.65 V634.72 H165.29 Z M282.65 282.65 V400 H400 V282.65 Z"}),r.jsx("path",{d:"M517.36 400 H634.72 V634.72 H517.36 Z"})]})}function Uw({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:r.jsx("path",{fill:"#5786FE",d:"M23.748 4.651c-.254-.124-.364.113-.512.233-.423.437-.857.794-1.51.763-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.789-.347-1.077-.626-1.26-1.424-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323l-.266.833c-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-1.06-1.024-1.97-2.183-3.286-2.93-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-1.27.006-2.312.621-3.152.821a9.6 9.6 0 0 0-2.883-.101c-3.75.419-5.994 3.589-5.757 7.395.218 3.496 2.247 6.521 5.258 8.037 2.52 1.269 5.649 1.474 8.484-.924.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 2.056-2.431 3.44-5.604 3.392-7.847-.004-.171.035-.238.23-.257 2.371-.246 3.642-1.764 3.838-3.992.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-2.919-1.718-4.443-4.959-4.6-7.788-.02-.385.094-.522.477-.592 2.602-.471 5.025.581 6.997 2.736 1.652 1.807 2.631 4.049 4.682 5.785.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 1 1 .614.001.306.306 0 0 1-.614 0m3.11 1.596c-.494.199-.931.222-1.389-.094-.274-.23-.47-.358-.551-.758-.122-.602.111-.903-.223-1.315-.188-.156-.426-.199-.689-.199-.454 0-.553-.298-.368-.636.356-.422.859-.442 1.338-.29.72.294 1.319 1.129 1.706 1.743.176.264.336.536.446.848.066.194-.02.353-.25.45"})})}function XA({size:e=16,className:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:r.jsx("path",{fill:"var(--color-ink)",d:"M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"})})}function kQ({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:[r.jsx("rect",{width:"24",height:"24",rx:"6",fill:"var(--color-ink)"}),r.jsx("path",{stroke:"var(--color-panel)",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none",transform:"translate(4.8 4.8) scale(0.6)",d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"})]})}function QA({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",className:t,"aria-hidden":"true",children:[r.jsx("path",{fill:"#7B3FE4",d:"M12 2a7.5 7.5 0 0 0-7.5 7.5V22l2.5-1.8 2.5 1.8 2.5-1.8 2.5 1.8 2.5-1.8 2.5 1.8V9.5A7.5 7.5 0 0 0 12 2Z"}),r.jsx("circle",{cx:"9.3",cy:"10",r:"1.5",fill:"var(--color-panel)"}),r.jsx("circle",{cx:"14.7",cy:"10",r:"1.5",fill:"var(--color-panel)"})]})}function eT({size:e=16,className:t}){return r.jsxs("svg",{width:e,height:e,viewBox:"4 2 24 24",className:t,"aria-hidden":"true",children:[r.jsx("path",{stroke:"#407A84",strokeWidth:1.7,d:"M16 16V7M16 16l-8 5M16 16l8 5"}),r.jsxs("g",{fill:"#407A84",children:[r.jsx("circle",{cx:"16",cy:"7",r:"2.4"}),r.jsx("circle",{cx:"8",cy:"21",r:"2.4"}),r.jsx("circle",{cx:"24",cy:"21",r:"2.4"}),r.jsx("circle",{cx:"16",cy:"16",r:"3.8"})]})]})}function Nx({size:e=16,className:t}){const n=f.useId().replace(/\W/gu,"");return r.jsxs("svg",{width:e,height:e,viewBox:"0 18.09 31 31",fill:"none",className:t,"aria-hidden":"true",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:`${n}a`,x1:"10.5179",y1:"25.8892",x2:"2.29751",y2:"41.3335",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#5071FF"}),r.jsx("stop",{offset:"1",stopColor:"#0410FF"})]}),r.jsxs("linearGradient",{id:`${n}b`,x1:"14",y1:"29.5894",x2:"17",y2:"32.5894",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#2563EB"}),r.jsx("stop",{offset:"1",stopColor:"#16C784"})]}),r.jsxs("linearGradient",{id:`${n}c`,x1:"24.9101",y1:"35.7894",x2:"12.7635",y2:"41.9022",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#13DA74"}),r.jsx("stop",{offset:"1",stopColor:"#1F83CD"})]})]}),r.jsx("path",{fill:`url(#${n}a)`,d:"M6.31271 27.713C7.94898 25.3277 11.1777 24.7425 13.5241 26.4059C15.8703 28.0693 16.446 31.3509 14.8099 33.7361L9.42862 41.5814C7.79234 43.9665 4.56361 44.5517 2.21725 42.8885C-0.129169 41.2252 -0.704765 37.9429 0.931485 35.5577L6.31271 27.713ZM13.0071 29.9972C12.0826 28.0346 9.41394 27.8263 8.2057 29.6228L2.7953 37.6672C2.1197 38.6719 2.36677 40.0427 3.34879 40.7389L3.51215 40.8544C4.49397 41.5504 5.84429 41.3127 6.53837 40.3214L13.2065 30.7957C13.2716 30.7027 13.2818 30.581 13.2334 30.478L13.0071 29.9972Z"}),r.jsx("path",{fill:"#16C784",d:"M23.7889 27.7173C22.1526 25.3321 18.924 24.7469 16.5775 26.4103C14.2313 28.0737 13.6556 31.3559 15.2917 33.7411L21.1882 42.336C22.8245 44.7212 26.0526 45.3064 28.399 43.6431C30.7454 41.9798 31.3214 38.6981 29.6853 36.3128L23.7889 27.7173ZM17.2344 30.2879C18.159 28.3251 20.8276 28.1169 22.0359 29.9134L27.4463 37.9578C28.1218 38.9625 27.8752 40.3328 26.8934 41.0289L26.73 41.1451C25.7482 41.8411 24.3979 41.6029 23.7038 40.6115L17.0351 31.0858C16.9701 30.9928 16.9597 30.871 17.0082 30.7681L17.2344 30.2879Z"}),r.jsx("path",{fill:`url(#${n}b)`,d:"M15.6385 34.2402L15.1611 33.5552L16.944 30.958L17.3932 31.6002L15.6385 34.2402Z"}),r.jsx("path",{fill:"#16C784",d:"M19.9475 40.5176L19.5264 39.8753L21.3513 37.1641L21.7724 37.7348L19.9475 40.5176Z"}),r.jsx("path",{fill:`url(#${n}c)`,d:"M18.0466 25.5876C20.1674 24.8708 22.585 25.6165 23.9285 27.5749L29.824 36.1696C31.2186 38.2028 31.0051 40.8864 29.4587 42.6647C29.1679 43.0226 28.827 43.3488 28.4353 43.6286C26.0801 45.3106 22.8295 44.7337 21.1746 42.3395L19.8152 40.3727C19.7017 40.2086 19.5993 40.0397 19.5066 39.8678L17.9372 42.2028C16.2924 44.5816 13.0617 45.1548 10.7214 43.4831C8.38107 41.8111 7.81697 38.5263 9.46166 36.1471L15.3884 27.5739C16.064 26.5967 17.0076 25.925 18.0466 25.5876ZM26.0671 36.6413C25.269 35.4872 23.7017 35.2084 22.5662 36.0192L21.6599 36.6667L21.3845 37.0749C21.382 37.1637 21.4066 37.2543 21.4607 37.3327L23.7488 40.6422C24.4093 41.5977 25.7063 41.8282 26.6462 41.1569C27.5862 40.4854 27.8125 39.1661 27.1521 38.2106L26.0671 36.6413ZM19.7917 28.9792C18.9257 28.944 18.0396 29.3246 17.4734 30.1579L12.0144 38.196C11.3768 39.1348 11.603 40.4208 12.5212 41.0768C13.4392 41.7324 14.706 41.5139 15.3591 40.5866L19.5124 34.7692C19.8833 34.0834 20.4104 33.4711 21.0828 32.9909C21.7305 32.5282 22.446 32.2362 23.1775 32.1061L21.8943 30.1989C21.3772 29.4303 20.5925 29.0301 19.7917 28.9762V28.9792Z"})]})}function Hw({driverKind:e,size:t,className:n}){switch(e){case"grok":case"grokAgent":return r.jsx(Bw,{size:t,className:n});case"claudeAgent":return r.jsx(Fw,{size:t,className:n});case"mistral":return r.jsx(R0,{preset:"mistral",size:t,className:n});case"meta":case"museCode":return r.jsx(R0,{preset:"meta",size:t,className:n});case"codex":return r.jsx(nc,{size:t,className:n});case"kimiAgent":return r.jsx(qw,{size:t,className:n});case"droidAgent":return r.jsx(xQ,{size:t,className:n});case"cursorAgent":return r.jsx(cQ,{size:t,className:n});case"antigravityAgent":return r.jsx(gQ,{size:t,className:n});case"opencodeGo":return r.jsx(bQ,{size:t,className:n});case"qwenAgent":return r.jsx(ZA,{size:t,className:n});case"hermesAgent":return r.jsx(lQ,{size:t,className:n});case"deepseekAgent":return r.jsx(Uw,{size:t,className:n});case"piAgent":return r.jsx(yQ,{size:t,className:n});case"copilotAgent":return r.jsx(XA,{size:t,className:n});case"commandCodeAgent":return r.jsx(kQ,{size:t,className:n});case"kiroAgent":return r.jsx(QA,{size:t,className:n});case"greenference":return r.jsx(eT,{size:t,className:n});case"modelgo":return r.jsx(Nx,{size:t,className:n});default:return r.jsx("span",{className:I("flex size-full items-center justify-center text-[10px] font-semibold tracking-tight text-ink-secondary",n),children:(e.replace(/Agent$/i,"").slice(0,1)||"?").toUpperCase()})}}function R0({preset:e,size:t=16,className:n}){switch(e){case"openai":return r.jsx(nc,{size:t,className:n});case"anthropic":return r.jsx(Fw,{size:t,className:n});case"xai":return r.jsx(Bw,{size:t,className:n});case"qwen":return r.jsx(ZA,{size:t,className:n});case"moonshot":return r.jsx(qw,{size:t,className:n});case"google":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})});case"azure":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#0089D6",d:"M22.379 23.343a1.62 1.62 0 0 0 1.536-2.14v.002L17.35 1.76A1.62 1.62 0 0 0 15.816.657H8.184A1.62 1.62 0 0 0 6.65 1.76L.086 21.204a1.62 1.62 0 0 0 1.536 2.139h4.741a1.62 1.62 0 0 0 1.535-1.103l.977-2.892 4.947 3.675c.28.208.618.32.966.32m-3.084-12.531 3.624 10.739a.54.54 0 0 1-.51.713v-.001h-.03a.54.54 0 0 1-.322-.106l-9.287-6.9h4.853m6.313 7.006c.116-.326.13-.694.007-1.058L9.79 1.76a1.722 1.722 0 0 0-.007-.02h6.034a.54.54 0 0 1 .512.366l6.562 19.445a.54.54 0 0 1-.338.684"})});case"aws":return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:[r.jsx("path",{fill:"var(--color-ink)",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272-.184.08-.32.12-.407.12-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28.04-.056.112-.112.224-.167.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z"}),r.jsx("path",{fill:"#FF9900",d:"M21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zm1.094-1.246c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"})]});case"meta":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#0467DF",d:"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973.14.605.228.654.636 1.621.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.942-1.664.183.3 2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843 1.175-.99 1.671-2.573 1.671-5.018 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c1.19-1.85 2.25-2.929 3.569-2.929zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-1.17 0-1.847-1.04-1.847-2.84 0-2.221.63-4.535 1.66-6.088.824-1.245 1.697-1.818 2.621-1.818z"})});case"mistral":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#FA520F",d:"M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z"})});case"cohere":return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:[r.jsx("path",{fill:"#39594D",fillRule:"evenodd",d:"M8.128 14.099c.592 0 1.77-.033 3.398-.703 1.897-.781 5.672-2.2 8.395-3.656 1.905-1.018 2.74-2.366 2.74-4.18A4.56 4.56 0 0018.1 1H7.549A6.55 6.55 0 001 7.55c0 3.617 2.745 6.549 7.128 6.549z"}),r.jsx("path",{fill:"#D18EE2",fillRule:"evenodd",d:"M9.912 18.61a4.387 4.387 0 012.705-4.052l3.323-1.38c3.361-1.394 7.06 1.076 7.06 4.715a5.104 5.104 0 01-5.105 5.104l-3.597-.001a4.386 4.386 0 01-4.386-4.387z"}),r.jsx("path",{fill:"#FF7759",d:"M4.776 14.962A3.775 3.775 0 001 18.738v.489a3.776 3.776 0 007.551 0v-.49a3.775 3.775 0 00-3.775-3.775z"})]});case"openrouter":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"#94A3B8",d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.792.447-2.497.904-3.936 1.131v4.229c1.31.184 2.908.627 3.795 1.132 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918L24 15.038l-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})});case"deepseek":return r.jsx(Uw,{size:t,className:n});case"ollama":return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",className:n,"aria-hidden":"true",children:r.jsx("path",{fill:"var(--color-ink)",d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"})})}}function _s({instance:e,size:t=16,className:n,subtle:s=!1}){if(s){const a=fQ(e);return r.jsx("span",{"data-provider-mark":a,className:I("inline-flex shrink-0 transition-opacity",hQ[a],n),style:{width:t,height:t},children:r.jsx(_s,{instance:e,size:t})})}return e.icon?.kind==="custom"?r.jsx(vQ,{dataUrl:e.icon.dataUrl,driverKind:e.driverKind,size:t,className:n},e.icon.dataUrl):e.icon?.kind==="preset"?r.jsx(R0,{preset:e.icon.preset,size:t,className:n}):r.jsx(Hw,{driverKind:e.driverKind,size:t,className:n})}function vQ({dataUrl:e,driverKind:t,size:n=16,className:s}){const[a,i]=f.useState(!1);return a?r.jsx(Hw,{driverKind:t,size:n,className:s}):r.jsx("img",{src:e,alt:"",width:n,height:n,onError:()=>i(!0),className:I("rounded-[22%] object-cover",s)})}function Zt(e){return e.driverKind==="clineAgent"?e.snapshot.state==="available"&&e.snapshot.authenticated===!0:e.snapshot.state==="available"&&(e.access==="custom"||e.snapshot.authenticated!==!1)}const wQ={claudeAgent:"Anthropic",codex:"OpenAI",grok:"xAI",grokAgent:"xAI",kimiAgent:"Moonshot AI",droidAgent:"Factory",cursorAgent:"Cursor",antigravityAgent:"Google",opencodeGo:"OpenCode",qwenAgent:"Qwen",hermesAgent:"Nous Research",clineAgent:"Cline",copilotAgent:"GitHub",commandCodeAgent:"Command Code",kiroAgent:"Amazon Web Services",piAgent:"pi.dev",mistral:"Mistral AI",cerebras:"Cerebras",groq:"Groq",greenference:"Greenference",modelgo:"ModelGo",meta:"Meta",museCode:"Meta",deepseekAgent:"DeepSeek"};function jQ(e){return wQ[e.driverKind]??e.driverKind}function WLe({instance:e,children:t,summary:n,bare:s=!1}){if(s)return r.jsx("div",{"data-engine-card":e.instanceId,className:"min-w-0",children:t});const a=n?.ready??Zt(e),i=e.snapshot.authenticated===!0?e.snapshot.account?.email:void 0,o=n?.title??e.displayName,c=n?.subtitle??i??(e.access==="custom"?l("engines.library.custom"):jQ(e)),d=e.snapshot.version?.match(/\d+\.\d+(?:\.\d+)?(?:[-+][\w.-]+)?/)?.[0],u=oQ(e);return r.jsxs("details",{"data-engine-card":e.instanceId,className:"group/engine min-w-0 rounded-2xl border border-hairline/40 bg-card transition-colors open:col-span-full open:border-hairline/70 hover:border-hairline/70",children:[r.jsxs("summary",{className:"cursor-pointer list-none rounded-2xl p-4 outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{"aria-hidden":"true",className:"flex size-12 shrink-0 items-center justify-center rounded-xl border border-hairline/30 bg-panel",children:r.jsx(_s,{instance:e,size:28})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-[15px] font-semibold tracking-[-0.015em] text-ink",title:o,children:o}),r.jsx("div",{className:"mt-1 truncate text-[12px] text-ink-secondary",title:c,children:c})]}),r.jsx(kt,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary transition-transform group-open/engine:rotate-180 motion-reduce:transition-none"})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:I("inline-flex items-center gap-1.5 rounded-full px-2 py-1 text-[11px] font-medium",a?"bg-success/10 text-success":"bg-control text-ink-secondary"),children:[a?r.jsx(Ie,{size:12,"aria-hidden":"true"}):r.jsx("span",{className:"size-1.5 rounded-full bg-warning","aria-hidden":"true"}),n?.status??(a?l("onboarding.engines.ready"):e.snapshot.state==="available"&&e.snapshot.authenticated===!1?l("model.signInRequired"):l("onboarding.engines.needsSetup"))]}),n?r.jsx("span",{className:I("text-[11px] font-medium",a?"text-ink-secondary":"text-accent-text"),children:n.action}):a?r.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:u?l("engines.updatedTo",{version:u}):d?`v${d}`:l("engines.library.manage")}):r.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-semibold text-accent-text",children:[l("engines.library.setup"),r.jsx(zs,{size:13,"aria-hidden":"true"})]})]})]}),r.jsx("div",{className:"min-w-0 border-t border-hairline/40 p-4",children:t})]})}function KLe({instances:e,renderEngine:t,isReady:n=Zt}){return r.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,280px),1fr))] items-start gap-3",children:[[!0,!1].flatMap(s=>{const a=e.filter(o=>n(o)===s);if(!a.length)return[];const i=l(s?"onboarding.engines.ready":"onboarding.engines.needsSetup");return[r.jsxs("div",{className:I("col-span-full flex items-center justify-between gap-3 px-4",!s&&e.some(n)&&"mt-4"),children:[r.jsx("h2",{className:"text-[12px] font-semibold text-ink-secondary",children:i}),r.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:l(a.length===1?"engines.library.countOne":"engines.library.count",{count:a.length})})]},`heading-${s}`),...a.map(o=>r.jsx("div",{className:"contents",children:t(o)},o.instanceId))]}),e.length===0&&r.jsx("p",{className:"col-span-full py-4 text-[13px] text-ink-secondary",children:l("engines.none")})]})}function tT(){const{refreshInstances:e}=se(),[t,n]=f.useState(!1),[s,a]=f.useState(null),[i,o]=f.useState(!1);return r.jsxs("div",{children:[r.jsxs("button",{type:"button",disabled:t,onClick:async()=>{n(!0),a(null),o(!1);try{await e({reportErrors:!0}),o(!0)}catch(c){a(c instanceof Error?c.message:String(c))}finally{n(!1)}},className:"inline-flex shrink-0 items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] font-medium text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50",children:[r.jsx(zt,{size:13,"aria-hidden":"true",className:I(t&&"animate-spin")}),t?l("common.checking"):l("engines.library.refresh")]}),s&&r.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:l("engineSetup.checkFailed",{reason:s})}),i&&r.jsx("p",{role:"status",className:"mt-1 text-[11px] text-ink-secondary",children:l("engineSetup.checked")})]})}const O4={claudeApi:"engines.defaultName.claudeApi",chatgpt:"engines.defaultName.chatgpt",openaiCompat:"engines.defaultName.openaiCompat"};function ht(e){const t=Object.hasOwn(O4,e.instanceId)?O4[e.instanceId]:void 0;return t&&e.displayName===br[t]?l(t):e.displayName}const VLe=["everyday","work","writing","design","sales","personal"],Zg=[1,2,3,4,5],kc=(e,t,n,s)=>({name:e,prompt:t,schedule:{type:"daily",time:n,weekdays:s},enabled:!1,overlap:"skip"}),NQ=[{id:"assistant",category:"everyday",name:"Assistant",title:"General assistant",description:"Answers questions, drafts text, and takes on whatever you hand it.",soul:["You are a capable, plain-spoken assistant.","Ask one clarifying question when a request is ambiguous; otherwise do the work and show the result.","Lead with the answer, then the detail. Keep replies short and concrete, and use lists only when they help.","Say plainly when you are unsure or could not check something, and never present a guess as a fact.","When a task will take several steps, say what you are about to do in one line before doing it."].join(`
19
19
  `),look:{color:"green",mascotBody:"cursor"},tryAsking:["Plan my week from this list of to-dos","Explain this contract clause in plain English","Draft a polite reply declining this meeting"],apps:[]},{id:"inbox",category:"work",name:"Inbox",title:"Email triage",description:"Reads your inbox, flags what needs you, and drafts replies for approval.",soul:["You manage the user's email.","Each run: list unread mail and group it into Needs a reply, FYI, and Noise, in that order, with one line per message (sender, subject, why it is in that group).","Draft replies for anything that needs one, in the user's tone, and show them for approval. Never send without approval.","Never unsubscribe, delete, archive, or forward mail on your own.","Note recurring senders and the user's preferences in memory so each triage gets sharper."].join(`
20
20
  `),look:{color:"blue",mascotBody:"squircle"},tryAsking:["What in my inbox needs me today?","Draft replies to the three most urgent emails","Who have I not answered in over a week?"],apps:["gmail"],routines:[kc("Morning inbox triage","Triage my unread email and draft replies for anything that needs one.","08:30",Zg)]},{id:"research",category:"everyday",name:"Scout",title:"Researcher",description:"Digs through the web and your files, and comes back with a sourced brief.",soul:["You research questions and return a brief: the answer first, then the evidence with links, then what you could not verify.","Prefer primary sources and date every claim that can change. Say clearly when sources disagree, and show both sides.","Never present a guess as a finding. If the evidence is thin, say so and suggest what would settle it.","Keep briefs scannable: a three-line summary, then sections, then sources."].join(`
21
21
  `),look:{color:"purple",mascotBody:"diamond"},tryAsking:["What changed in EU AI rules this year? Sources please","Compare the top three note-taking apps for a small team","Fact-check the claims in this paragraph"],apps:[]},{id:"coder",category:"work",name:"Dev",title:"Coding partner",description:"Works inside a project folder: reads, edits, runs tests, explains changes.",soul:["You are a careful engineer working in the user's project folder.","Read before you edit, and follow the project's existing style. Keep diffs small and focused on what was asked.","Run the project's tests after changes and report the real output, including failures.","Explain what changed and why in a few lines. Never push, publish, or delete branches unless told to."].join(`
@@ -109,9 +109,9 @@ ${s.text}
109
109
 
110
110
  `)){const s=(n.split(`
111
111
  `)[0]??"").trim();if(!s)return[];const a=s.indexOf(" · ");if(a<0){t.push({app:null,label:s});continue}const i=s.slice(0,a).trim(),o=s.slice(a+3).trim();if(!i||!o)return[];t.push({app:i,label:o})}return t}function uae(e){if(!e.outboundRequest)return[];const t=e.outboundRequest.calls;return t&&t.length>0?t:dae(e.subtitle)}function pae(e){return e.length===0||e.some(n=>!n.app)?null:new Set(e.map(n=>n.app)).size===1?e[0].app:null}function mae(e,t){const n=[],s=new Map;for(const c of e){const d=JSON.stringify([c.app,c.label]);s.has(d)||n.push(c),s.set(d,(s.get(d)??0)+1)}const a=n.slice(0,cae).map(c=>{const d=t&&c.app?`${c.app} · ${c.label}`:c.label,u=s.get(JSON.stringify([c.app,c.label]))??1;return u>1?`${d} ×${u}`:d}),i=a.join(", "),o=n.length-a.length;return o>0?`${i}, ${l("approval.outbound.more",{count:o})}`:i}const fae="COMPOSIO_PROXY_EXECUTE";function C2(e){if(!e.outboundRequest)return;const t=uae(e),n=pae(t);return e.outboundRequest.tool===fae?{headline:l("approval.outbound.runCode",{app:n??e.outboundRequest.app??"Composio"}),summary:"",opaque:!0}:{headline:n?l("approval.outbound.sendTo",{app:n}):l("approval.outbound.sendOnBehalf"),summary:mae(t,n===null)}}const hae=/^[A-Z][A-Z0-9]+_([A-Z0-9_]+)$/;function q9(e){const t=hae.exec(e);if(t)return t[1].replace(/_+/g," ").trim().toLowerCase()||void 0}function wc(e){return Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)}function o1(e,t){return e.y===t.y&&e.m===t.m&&e.d===t.d&&e.h===t.h&&e.i===t.i&&e.s===t.s}function xae(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw new Error("Invalid ISO8601 passed to timezone parser.");let s=e.substring(9);return s.includes("Z")||s.includes("+")||s.includes("-")?ny(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),"Etc/UTC"):ny(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}function pN(e,t,n){return U9(xae(e,t),n)}function U9(e,t){let n=new Date(wc(e)),s=Vc(n,e.tz),a=wc(e),i=wc(s),o=a-i,c=new Date(n.getTime()+o),d=Vc(c,e.tz);if(o1(d,e)){let m=new Date(c.getTime()-36e5),h=Vc(m,e.tz);return o1(h,e)?m:c}let u=new Date(c.getTime()+wc(e)-wc(d)),p=Vc(u,e.tz);if(o1(p,e))return u;if(t)throw new Error("Invalid date passed to fromTZ()");return c.getTime()>u.getTime()?c:u}function Vc(e,t){let n,s;try{n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),s=n.formatToParts(e)}catch(i){let o=i instanceof Error?i.message:String(i);throw new RangeError(`toTZ: Invalid timezone '${t}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${o}`)}let a={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let i of s)(i.type==="year"||i.type==="month"||i.type==="day"||i.type==="hour"||i.type==="minute"||i.type==="second")&&(a[i.type]=parseInt(i.value,10));if(isNaN(a.year)||isNaN(a.month)||isNaN(a.day)||isNaN(a.hour)||isNaN(a.minute)||isNaN(a.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${t}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(a)}`);return a.hour===24&&(a.hour=0),{y:a.year,m:a.month,d:a.day,h:a.hour,i:a.minute,s:a.second,tz:t}}function ny(e,t,n,s,a,i,o){return{y:e,m:t,d:n,h:s,i:a,s:i,tz:o}}var H9=[1,2,4,8,16],mN=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(e,t,n){this.pattern=e,this.timezone=t,this.mode=n?.mode??"auto",this.alternativeWeekdays=n?.alternativeWeekdays??!1,this.sloppyRanges=n?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.match(/\S+/g)||[""],t=e.length;if(e.length<5||e.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let s;switch(this.mode){case"5-part":s=5;break;case"6-part":s=6;break;case"7-part":s=7;break;case"5-or-6-parts":s=[5,6];break;case"6-or-7-parts":s=[6,7];break;default:s=0}if(!(Array.isArray(s)?s.includes(t):t===s)){let a=Array.isArray(s)?s.join(" or "):s.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`)}}if(e.length===5&&e.unshift("0"),e.length===6&&e.push("*"),e[3].toUpperCase()==="LW"?(this.lastWeekday=!0,e[3]=""):e[3].toUpperCase().indexOf("L")>=0&&(e[3]=e[3].replace(/L/gi,""),this.lastDayOfMonth=!0),e[3]=="*"&&(this.starDOM=!0),e[6]=="*"&&(this.starYear=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(e[5]):this.replaceAlphaDays(e[5])),e[5].startsWith("+")&&(this.useAndLogic=!0,e[5]=e[5].substring(1),e[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(e[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(e[0]=e[0].replace(/\?/g,"*"),e[1]=e[1].replace(/\?/g,"*"),e[2]=e[2].replace(/\?/g,"*"),e[3]=e[3].replace(/\?/g,"*"),e[4]=e[4].replace(/\?/g,"*"),e[5]=e[5].replace(/\?/g,"*"),e[6]&&(e[6]=e[6].replace(/\?/g,"*"))),this.mode){case"5-part":e[0]="0",e[6]="*";break;case"6-part":e[6]="*";break;case"5-or-6-parts":e[6]="*";break}this.throwAtIllegalCharacters(e),this.partToArray("second",e[0],0,1),this.partToArray("minute",e[1],0,1),this.partToArray("hour",e[2],0,1),this.partToArray("day",e[3],-1,1),this.partToArray("month",e[4],-1,1);let n=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",e[5],n,63),this.partToArray("year",e[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,s){let a=this[e],i=e==="day"&&this.lastDayOfMonth,o=e==="day"&&this.lastWeekday;if(t===""&&!i&&!o)throw new TypeError("CronPattern: configuration entry "+e+" ("+t+") is empty, check for trailing spaces.");if(t==="*")return a.fill(s);let c=t.split(",");if(c.length>1)for(let d=0;d<c.length;d++)this.partToArray(e,c[d],n,s);else t.indexOf("-")!==-1&&t.indexOf("/")!==-1?this.handleRangeWithStepping(t,e,n,s):t.indexOf("-")!==-1?this.handleRange(t,e,n,s):t.indexOf("/")!==-1?this.handleStepping(t,e,n,s):t!==""&&this.handleNumber(t,e,n,s)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===3?/[^/*0-9,\-WwLl]+/:t===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(e[t]))throw new TypeError("CronPattern: configuration entry "+t+" ("+e[t]+") contains illegal characters.")}handleNumber(e,t,n,s){let a=this.extractNth(e,t),i=e.toUpperCase().includes("W");if(t!=="day"&&i)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");i&&(t="nearestWeekdays");let o=parseInt(a[0],10)+n;if(isNaN(o))throw new TypeError("CronPattern: "+t+" is not a number: '"+e+"'");this.setPart(t,o,a[1]||s)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw new TypeError("CronPattern: Invalid part specified: "+e);if(e==="dayOfWeek"){if(t===7&&(t=0),t<0||t>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+t);this.setNthWeekdayOfMonth(t,n);return}if(e==="second"||e==="minute"){if(t<0||t>=60)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="hour"){if(t<0||t>=24)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="day"||e==="nearestWeekdays"){if(t<0||t>=31)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="month"){if(t<0||t>=12)throw new RangeError("CronPattern: Invalid value for "+e+": "+t)}else if(e==="year"&&(t<1||t>=1e4))throw new RangeError("CronPattern: Invalid value for "+e+": "+t+" (supported range: 1-9999)");this[e][t]=n}validateNotNaN(e,t){if(isNaN(e))throw new TypeError(t)}validateRange(e,t,n,s,a){if(e>t)throw new TypeError("CronPattern: From value is larger than to value: '"+a+"'");if(n!==void 0){if(n===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(n>this[s].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[s].length+")")}}handleRangeWithStepping(e,t,n,s){if(e.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let a=this.extractNth(e,t),i=a[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(i===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+e+"'");let[,o,c,d]=i,u=parseInt(o,10)+n,p=parseInt(c,10)+n,m=parseInt(d,10);this.validateNotNaN(u,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(p,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(m,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(u,p,m,t,e);for(let h=u;h<=p;h+=m)this.setPart(t,h,a[1]||s)}extractNth(e,t){let n=e,s;if(n.includes("#")){if(t!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");s=n.split("#")[1],n=n.split("#")[0]}else if(n.toUpperCase().endsWith("L")){if(t!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");s="L",n=n.slice(0,-1)}return[n,s]}handleRange(e,t,n,s){if(e.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let a=this.extractNth(e,t),i=a[0].split("-");if(i.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+e+"'");let o=parseInt(i[0],10)+n,c=parseInt(i[1],10)+n;this.validateNotNaN(o,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(c,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(o,c,void 0,t,e);for(let d=o;d<=c;d++)this.setPart(t,d,a[1]||s)}handleStepping(e,t,n,s){if(e.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let a=this.extractNth(e,t),i=a[0].split("/");if(i.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+e+"'");if(this.sloppyRanges)i[0]===""&&(i[0]="*");else{if(i[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+e+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(i[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+e+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let o=0;i[0]!=="*"&&(o=parseInt(i[0],10)+n);let c=parseInt(i[1],10);this.validateNotNaN(c,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[t].length-1,c,t,e);for(let d=o;d<this[t].length;d+=c)this.setPart(t,d,a[1]||s)}replaceAlphaDays(e){return e.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(e){return e.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(e){return e.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(e){let t=e.trim().toLowerCase();if(t==="@yearly"||t==="@annually")return"0 0 1 1 *";if(t==="@monthly")return"0 0 1 * *";if(t==="@weekly")return"0 0 * * 0";if(t==="@daily"||t==="@midnight")return"0 0 * * *";if(t==="@hourly")return"0 * * * *";if(t==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return e}setNthWeekdayOfMonth(e,t){if(typeof t!="number"&&t.toUpperCase()==="L")this.dayOfWeek[e]=this.dayOfWeek[e]|32;else if(t===63)this.dayOfWeek[e]=63;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|H9[t-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},l1=[31,28,31,30,31,30,31,31,30,31,30,31],Rt=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Rn=class W9{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(t==null)this.fromDate(new Date);else if(t&&typeof t=="string")this.fromString(t);else if(t instanceof W9)this.fromCronDate(t);else throw new TypeError("CronDate: Invalid type ("+typeof t+") passed to CronDate constructor")}getLastDayOfMonth(t,n){return n!==1?l1[n]:new Date(Date.UTC(t,n+1,0)).getUTCDate()}getLastWeekday(t,n){let s=this.getLastDayOfMonth(t,n),a=new Date(Date.UTC(t,n,s)).getUTCDay();return a===0?s-2:a===6?s-1:s}getNearestWeekday(t,n,s){let a=this.getLastDayOfMonth(t,n);if(s>a)return-1;let i=new Date(Date.UTC(t,n,s)).getUTCDay();return i===0?s===a?s-2:s+1:i===6?s===1?s+2:s-1:s}isNthWeekdayOfMonth(t,n,s,a){let i=new Date(Date.UTC(t,n,s)).getUTCDay(),o=0;for(let c=1;c<=s;c++)new Date(Date.UTC(t,n,c)).getUTCDay()===i&&o++;if(a&63&&H9[o-1]&a)return!0;if(a&32){let c=this.getLastDayOfMonth(t,n);for(let d=s+1;d<=c;d++)if(new Date(Date.UTC(t,n,d)).getUTCDay()===i)return!1;return!0}return!1}fromDate(t){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes()+this.tz,this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply();else try{let n=Vc(t,this.tz);this.ms=t.getMilliseconds(),this.second=n.s,this.minute=n.i,this.hour=n.h,this.day=n.d,this.month=n.m-1,this.year=n.y}catch(n){let s=n instanceof Error?n.message:String(n);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${s}`)}else this.ms=t.getMilliseconds(),this.second=t.getSeconds(),this.minute=t.getMinutes(),this.hour=t.getHours(),this.day=t.getDate(),this.month=t.getMonth(),this.year=t.getFullYear()}fromCronDate(t){this.tz=t.tz,this.year=t.year,this.month=t.month,this.day=t.day,this.hour=t.hour,this.minute=t.minute,this.second=t.second,this.ms=t.ms}apply(){if(this.month>11||this.month<0||this.day>l1[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let t=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),!0}else return!1}fromString(t){if(typeof this.tz=="number"){let n=pN(t);this.ms=n.getUTCMilliseconds(),this.second=n.getUTCSeconds(),this.minute=n.getUTCMinutes(),this.hour=n.getUTCHours(),this.day=n.getUTCDate(),this.month=n.getUTCMonth(),this.year=n.getUTCFullYear(),this.apply()}else return this.fromDate(pN(t,this.tz))}findNext(t,n,s,a){return this._findMatch(t,n,s,a,1)}_findMatch(t,n,s,a,i){let o=this[n],c;s.lastDayOfMonth&&(c=this.getLastDayOfMonth(this.year,this.month));let d=!s.starDOW&&n=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,u=this[n]+a,p=i===1?m=>m<s[n].length:m=>m>=0;for(let m=u;p(m);m+=i){let h=s[n][m];if(n==="day"&&!h){for(let x=0;x<s.nearestWeekdays.length;x++)if(s.nearestWeekdays[x]){let g=this.getNearestWeekday(this.year,this.month,x-a);if(g===-1)continue;if(g===m-a){h=1;break}}}if(n==="day"&&s.lastWeekday){let x=this.getLastWeekday(this.year,this.month);m-a===x&&(h=1)}if(n==="day"&&s.lastDayOfMonth&&m-a==c&&(h=1),n==="day"&&!s.starDOW){let x=s.dayOfWeek[(d+(m-a-1))%7];if(x&&x&63)x=this.isNthWeekdayOfMonth(this.year,this.month,m-a,x)?1:0;else if(x)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${x}`);s.useAndLogic?h=h&&x:!t.domAndDow&&!s.starDOM?h=h||x:h=h&&x}if(h)return this[n]=m-a,o!==this[n]?2:1}return 3}recurse(t,n,s){if(s===0&&!t.starYear){if(this.year>=0&&this.year<t.year.length&&t.year[this.year]===0){let i=-1;for(let o=this.year+1;o<t.year.length&&o<1e4;o++)if(t.year[o]===1){i=o;break}if(i===-1)return null;this.year=i,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let a=this.findNext(n,Rt[s][0],t,Rt[s][2]);if(a>1){let i=s+1;for(;i<Rt.length;)this[Rt[i][0]]=-Rt[i][2],i++;if(a===3){if(this[Rt[s][1]]++,this[Rt[s][0]]=-Rt[s][2],this.apply(),s===0&&!t.starYear){for(;this.year>=0&&this.year<t.year.length&&t.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=t.year.length)return null}return this.recurse(t,n,0)}else if(this.apply())return this.recurse(t,n,s-1)}return s+=1,s>=Rt.length?this:(t.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(t,n,s)}increment(t,n,s){return this.second+=n.interval!==void 0&&n.interval>1&&s?n.interval:1,this.ms=0,this.apply(),this.recurse(t,n,0)}decrement(t,n){return this.second-=n.interval!==void 0&&n.interval>1?n.interval:1,this.ms=0,this.apply(),this.recurseBackward(t,n,0,0)}recurseBackward(t,n,s,a=0){if(a>1e4)return null;if(s===0&&!t.starYear){if(this.year>=0&&this.year<t.year.length&&t.year[this.year]===0){let o=-1;for(let c=this.year-1;c>=0;c--)if(t.year[c]===1){o=c;break}if(o===-1)return null;this.year=o,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let i=this.findPrevious(n,Rt[s][0],t,Rt[s][2]);if(i>1){let o=s+1;for(;o<Rt.length;){let c=Rt[o][0],d=Rt[o][2],u=this.getMaxPatternValue(c,t,d);this[c]=u,o++}if(i===3){if(this[Rt[s][1]]--,s===0){let p=this.getLastDayOfMonth(this.year,this.month);this.day>p&&(this.day=p)}if(s===1)if(this.day<=0)this.day=1;else{let p=this.year,m=this.month;for(;m<0;)m+=12,p--;for(;m>11;)m-=12,p++;let h=m!==1?l1[m]:new Date(Date.UTC(p,m+1,0)).getUTCDate();this.day>h&&(this.day=h)}this.apply();let c=Rt[s][0],d=Rt[s][2],u=this.getMaxPatternValue(c,t,d);if(c==="day"){let p=this.getLastDayOfMonth(this.year,this.month);this[c]=Math.min(u,p)}else this[c]=u;if(this.apply(),s===0){let p=Rt[1][2],m=this.getMaxPatternValue("day",t,p),h=this.getLastDayOfMonth(this.year,this.month),x=Math.min(m,h);x!==this.day&&(this.day=x,this.hour=this.getMaxPatternValue("hour",t,Rt[2][2]),this.minute=this.getMaxPatternValue("minute",t,Rt[3][2]),this.second=this.getMaxPatternValue("second",t,Rt[4][2]))}if(s===0&&!t.starYear){for(;this.year>=0&&this.year<t.year.length&&t.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(t,n,0,a+1)}else if(this.apply())return this.recurseBackward(t,n,s-1,a+1)}return s+=1,s>=Rt.length?this:this.year<0?null:this.recurseBackward(t,n,s,a+1)}getMaxPatternValue(t,n,s){if(t==="day"&&n.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(t==="day"&&!n.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let a=n[t].length-1;a>=0;a--)if(n[t][a])return a-s;return n[t].length-1-s}findPrevious(t,n,s,a){return this._findMatch(t,n,s,a,-1)}getDate(t){return t||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):U9(ny(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(t,n){if(!t.starYear&&(this.year<0||this.year>=t.year.length||t.year[this.year]===0))return!1;for(let s=0;s<Rt.length;s++){let a=Rt[s][0],i=Rt[s][2],o=this[a];if(o+i<0||o+i>=t[a].length)return!1;let c=t[a][o+i];if(a==="day"){if(!c){for(let d=0;d<t.nearestWeekdays.length;d++)if(t.nearestWeekdays[d]){let u=this.getNearestWeekday(this.year,this.month,d-i);if(u!==-1&&u===o){c=1;break}}}if(t.lastWeekday){let d=this.getLastWeekday(this.year,this.month);o===d&&(c=1)}if(t.lastDayOfMonth){let d=this.getLastDayOfMonth(this.year,this.month);o===d&&(c=1)}if(!t.starDOW){let d=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),u=t.dayOfWeek[(d+(o-1))%7];u&&u&63&&(u=this.isNthWeekdayOfMonth(this.year,this.month,o,u)?1:0),t.useAndLogic?c=c&&u:!n.domAndDow&&!t.starDOM?c=c||u:c=c&&u}}if(!c)return!1}return!0}};function gae(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode!==void 0&&e.domAndDow===void 0?e.domAndDow=!e.legacyMode:e.domAndDow===void 0&&(e.domAndDow=!1),e.legacyMode=!e.domAndDow,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.dayOffset=e.dayOffset===void 0?0:parseInt(e.dayOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.mode=e.mode===void 0?"auto":e.mode,e.alternativeWeekdays=e.alternativeWeekdays===void 0?!1:e.alternativeWeekdays,e.sloppyRanges=e.sloppyRanges===void 0?!1:e.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(e.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(e.startAt&&(e.startAt=new Rn(e.startAt,e.timezone)),e.stopAt&&(e.stopAt=new Rn(e.stopAt,e.timezone)),e.interval!==null){if(isNaN(e.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(e.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(e.utcOffset<-870||e.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(e.utcOffset!==void 0&&e.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(e.unref!==!0&&e.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(e.dayOffset!==void 0&&e.dayOffset!==0&&isNaN(e.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return e}function Gc(e){return Object.prototype.toString.call(e)==="[object Function]"||typeof e=="function"||e instanceof Function}function bae(e){return Gc(e)}function yae(e){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(e):e&&typeof e.unref<"u"&&e.unref()}var fN=30*1e3,Dp=[],kae=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(e){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let t=this.options.dayOffset*24*60*60*1e3;return new Date(e.getTime()+t)}return e}constructor(e,t,n){let s,a;if(Gc(t))a=t;else if(typeof t=="object")s=t;else if(t!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(Gc(n))a=n;else if(typeof n=="object")s=n;else if(n!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=s?.name,this.options=gae(s),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:s?s.maxRuns:void 0,paused:s?s.paused:!1,pattern:new mN("* * * * *",void 0,{mode:"auto"})},e&&(e instanceof Date||typeof e=="string"&&e.indexOf(":")>0)?this._states.once=new Rn(e,this.getTz()):this._states.pattern=new mN(e,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(Dp.find(i=>i.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");Dp.push(this)}return a!==void 0&&bae(a)&&(this.fn=a,this.schedule()),this}nextRun(e){let t=this._next(e);return t?this.applyDayOffset(t.getDate(!1)):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=t||this._states.currentRun||void 0;return this._enumerateRuns(e,n,"next")}previousRuns(e,t){return this._enumerateRuns(e,t||void 0,"previous")}_enumerateRuns(e,t,n){let s=[],a=t?new Rn(t,this.getTz()):null,i=n==="next"?this._next:this._previous;for(;e--;){let o=i.call(this,a);if(!o)break;let c=o.getDate(!1);s.push(this.applyDayOffset(c)),a=o}return s}match(e){if(this._states.once){let n=new Rn(e,this.getTz());n.ms=0;let s=new Rn(this._states.once,this.getTz());return s.ms=0,n.getTime()===s.getTime()}let t=new Rn(e,this.getTz());return t.ms=0,t.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,s=!this._states.kill;return t&&n&&s&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof Rn||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new Rn(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=Dp.indexOf(this);e>=0&&Dp.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>fN&&(t=fN),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&yae(this._states.currentTimeout),this)}async _trigger(e){this._states.blocking=!0,this._states.currentRun=new Rn(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(t){if(Gc(this.options.catch))try{this.options.catch(t,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new Rn(e,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),s=this._states.blocking&&this.options.protect;n&&!s?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&s&&Gc(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new Rn(e,this.getTz()),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let s=this._states.once||new Rn(e,this.getTz());return!n&&s!==this._states.once&&(s=s.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||s===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&s.getTime()>=this.options.stopAt.getTime()?null:s}_previous(e){let t=new Rn(e,this.getTz());this.options.stopAt&&t.getTime()>this.options.stopAt.getTime()&&(t=this.options.stopAt);let n=new Rn(t,this.getTz());return this._states.once?this._states.once.getTime()<t.getTime()?this._states.once:null:(n=n.decrement(this._states.pattern,this.options),n===null||this.options.startAt&&n.getTime()<this.options.startAt.getTime()?null:n)}_calculatePreviousRun(e,t){let n=new Rn(void 0,this.getTz()),s=e;if(this.options.startAt.getTime()<=n.getTime()){s=this.options.startAt;let a=s.getTime()+this.options.interval*1e3;for(;a<=n.getTime();)s=new Rn(s,this.getTz()).increment(this._states.pattern,this.options,!0),a=s.getTime()+this.options.interval*1e3;t=!0}return s===null&&(s=void 0),[s,t]}};const vae=256,wae=1e3;function K9(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Choose a valid cron schedule");const t=e;if(t.type!=="cron"||typeof t.expression!="string")throw new Error("Choose a valid cron schedule");if(Object.keys(t).some(a=>!["type","expression","timeZone"].includes(a)))throw new Error("Cron schedules accept only type, expression and timeZone; start/end dates and other restrictions are not supported");const n=t.expression.trim().replace(/\s+/g," ");if(n.length>vae||n.split(" ").length!==5||n.includes("@"))throw new Error("Cron must have five fields: minute hour day-of-month month weekday (no seconds, year, or macros)");const s=typeof t.timeZone=="string"?t.timeZone.trim():"";if(s.length>128||!(s==="UTC"||/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+)+$/.test(s)))throw new Error("Choose an IANA timezone such as America/New_York, Asia/Kolkata, or UTC");try{new Intl.DateTimeFormat("en-US",{timeZone:s}).format(0)}catch{throw new Error("Choose a valid IANA timezone such as America/New_York, Asia/Kolkata, or UTC")}try{const a=new kae(n,{timezone:s,mode:"5-part",paused:!0});return{schedule:{type:"cron",expression:n,timeZone:s},cron:a}}catch(a){throw new Error(`Invalid cron expression: ${a.message}`)}}function jae(e){const t=new Date(e);if(!Number.isFinite(e)||!Number.isFinite(t.getTime()))throw new Error("Choose a valid cron preview date");return t}function V9(e,t,n){const s=jae(t),a=n+1440;let i=n;for(;;){const o=e.nextRuns(i,s),c=[];for(const d of o){const u=d.getTime();if(!Number.isFinite(u))throw new Error("The cron schedule produced an invalid date");if(u>(c.at(-1)??t)&&c.push(u),c.length===n)return c}if(o.length<i||i===a)return c;i=Math.min(a,i*2)}}function TPe(e,t=Date.now()){const{schedule:n,cron:s}=K9(e);if(!V9(s,t,1).length)throw new Error("This cron expression has no future runs. Choose dates that exist.");return n}function Nae(e,t,n){if(!Number.isInteger(n)||n<1||n>wae)throw new Error("Choose between 1 and 1000 cron preview runs");const{cron:s}=K9(e);return V9(s,t,n)}const Sae=5,jc=30,Iae=12,Cae=12;function qi(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function fd(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n.getTime()}function _Pe(e){const t=new Date(qi(e));return t.setDate(t.getDate()-(t.getDay()+6)%7),t.getTime()}function E2(e,t){const[n,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(n,s,0,0),a.getTime()}function Eae(e){return new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,10)}function G9(e){return new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(11,16)}function MPe(e,t,n){return n!=null&&e===Eae(n)&&t===G9(n)?n:new Date(`${e}T${t}`).getTime()}function Aae(e,t){return Math.ceil((e+t*6e4)/6e4)*6e4}function Tae(e,t,n){return n?.everyMinutes===t?n.anchorAt:Aae(e,t)}function RPe(e,t,n){const s=Tae(e,t,n);if(s>e)return s;const a=t*6e4;return s+(Math.floor((e-s)/a)+1)*a}function _ae(e,t=Sae){return Math.max(0,Math.min(1440-t,Math.round(e/t)*t))}function OPe(e){const t=a=>a.at+Math.max(15,a.durationMinutes)*6e4,n=[...e].sort((a,i)=>a.at-i.at||t(a)-t(i)||a.id.localeCompare(i.id)),s=new Map;for(let a=0;a<n.length;){const i=[];let o=n[a].at;for(;a<n.length;){const p=n[a];if(i.length>0&&p.at>=o)break;i.push(p),o=Math.max(o,t(p)),a+=1}const c=[],d=i.map(p=>{const m=c.findIndex(x=>x<=p.at),h=m===-1?c.length:m;return c[h]=t(p),{id:p.id,column:h}}),u=Math.max(1,c.length);for(const p of d)s.set(p.id,{column:p.column,columns:u})}return s}function zPe(e){if(e===0)return"GMT+0";const t=e>0?"+":"-",n=Math.abs(e),s=Math.floor(n/60),a=n%60;return`GMT${t}${s}${a?`:${String(a).padStart(2,"0")}`:""}`}function LPe(e,t,n,s){const a=_ae((t-n)/s*60),i=new Date(e);return i.setHours(Math.floor(a/60),a%60,0,0),i.getTime()}function PPe(e,t,n){if(e.type==="cron")throw new Error(l("routines.cron.editToMove"));if(e.type==="once"||e.type==="limit_reset")return{type:"once",at:n};if(e.type==="interval")return{...e,anchorAt:e.anchorAt+(n-t)};const s=Math.round((qi(n)-qi(t))/864e5);return{type:"daily",time:G9(n),weekdays:e.weekdays.map(a=>((a+s)%7+7)%7).sort()}}function DPe(e,t,n,s){const a=new Map(e.map(u=>[u.id,u])),i=new Map,c=t.filter(u=>u.scheduledFor>=n&&u.scheduledFor<s).sort((u,p)=>p.scheduledFor-u.scheduledFor).filter(u=>{if(u.status==="queued"||u.status==="running"||u.status==="waiting")return!0;const p=i.get(u.routineId)??0;return p>=Iae?!1:(i.set(u.routineId,p+1),!0)}).map(u=>({id:`run-${u.id}`,at:u.scheduledFor,durationMinutes:jc,routine:a.get(u.routineId)??null,run:u})),d=(u,p)=>t.some(m=>m.routineId===u&&Math.abs(m.scheduledFor-p)<6e4);for(const u of e)if(u.enabled){if(u.schedule.type==="cron"){if(u.nextRunAt==null)continue;for(let p=qi(Math.max(n,u.nextRunAt));p<s;p=fd(p,1)){const m=Math.max(p,n,u.createdAt,u.nextRunAt)-1,h=Nae(u.schedule,m,Cae);if(!h.length||h[0]>=s)break;p=qi(h[0]);const x=Math.min(s,fd(p,1));for(const g of h){if(g>=x)break;d(u.id,g)||c.push({id:`next-${u.id}-${g}`,at:g,durationMinutes:jc,routine:u,run:null})}}continue}if(u.schedule.type==="once"){const p=u.schedule.at;p>=n&&p<s&&!d(u.id,p)&&c.push({id:`next-${u.id}-${p}`,at:p,durationMinutes:jc,routine:u,run:null});continue}if(u.schedule.type==="interval"||u.schedule.type==="limit_reset"){const p=u.nextRunAt;p!=null&&p>=n&&p<s&&!d(u.id,p)&&c.push({id:`next-${u.id}-${p}`,at:p,durationMinutes:jc,routine:u,run:null});continue}for(let p=qi(n);p<s;p=fd(p,1)){if(!u.schedule.weekdays.includes(new Date(p).getDay()))continue;const m=E2(p,u.schedule.time);m>=n&&m<s&&m>=u.createdAt&&!d(u.id,m)&&c.push({id:`next-${u.id}-${m}`,at:m,durationMinutes:jc,routine:u,run:null})}}return c.sort((u,p)=>u.at-p.at)}function $Pe(e,t){const n=fd(e,t-1),s=new Date(e),a=new Date(n);if(t===1)return s.toLocaleDateString(dt(),{month:"long",day:"numeric",year:"numeric"});const i=s.getMonth()===a.getMonth()?"long":"short";return new Intl.DateTimeFormat(dt(),{month:i,day:"numeric",year:"numeric"}).formatRange(s,a)}function BPe(e,t,n){const s=[];for(const a of e){if(a.schedule.type==="once"){a.schedule.at>=t&&a.schedule.at<n&&s.push({id:`call-${a.id}-${a.schedule.at}`,at:a.schedule.at,durationMinutes:a.durationMinutes,call:a});continue}for(let i=qi(t);i<n;i=fd(i,1)){if(!a.schedule.weekdays.includes(new Date(i).getDay()))continue;const o=E2(i,a.schedule.time);o>=t&&o<n&&o>=a.createdAt&&s.push({id:`call-${a.id}-${o}`,at:o,durationMinutes:a.durationMinutes,call:a})}}return s.sort((a,i)=>a.at-i.at)}const hN={"Europe/London":"UK time","Europe/Belfast":"UK time","America/Phoenix":"Arizona time","Asia/Dubai":"UAE time"},Mae=/^(?:Etc\/)?(?:UTC|UCT|GMT|Universal|Zulu|Greenwich)(?:[+-]0)?$/i,Rae=/^(?:[A-Z]{1,5}|GMT.*|UTC.*)$/;function xN(e,t,n){try{const s=new Intl.DateTimeFormat(t,{timeZone:e,timeZoneName:n}).formatToParts(new Date).find(a=>a.type==="timeZoneName")?.value;return s&&!Rae.test(s)?s:null}catch{return null}}function Oae(e,t="en"){const n=t.toLowerCase().startsWith("en");if(Mae.test(e.trim()))return"UTC";if(n&&hN[e])return hN[e];const s=xN(e,t,"shortGeneric")??xN(e,t,"longGeneric");if(s)return n?s.replace(/ Time$/," time"):s;const a=e.split("/").at(-1)?.replaceAll("_"," ").trim();return a?`${a} time`:e}const gN=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Y9=["January","February","March","April","May","June","July","August","September","October","November","December"],zae={1:"first",2:"second",3:"third",4:"fourth",5:"fifth",last:"last"};function J9(e){const[t,n,s,a,i]=e.trim().split(/\s+/);if(!/^\d+$/.test(t??"")||!/^\d+$/.test(n??""))return null;const o=`${n.padStart(2,"0")}:${t.padStart(2,"0")}`,c=/^\d+$/.test(s??"")?Number(s):null;if(i==="*"&&a==="*")return s==="*"?{kind:"everyDay",time:o}:s==="L"?{kind:"monthlyLastDay",time:o}:c===null?null:{kind:"monthlyDay",day:c,time:o};if(i==="*"&&/^\d+$/.test(a??"")&&c!==null)return Y9[Number(a)-1]?{kind:"yearly",month:Number(a)-1,day:c,time:o}:null;if(s!=="*"||a!=="*")return null;if(i==="1-5"||i?.toUpperCase()==="MON-FRI")return{kind:"weekdays",time:o};if(/^[0-7]$/.test(i??""))return{kind:"weekly",weekday:Number(i)%7,time:o};const d=/^([0-7])#([1-5]|L)$/i.exec(i??"");return d?{kind:"monthlyNth",nth:d[2].toUpperCase()==="L"?"last":Number(d[2]),weekday:Number(d[1])%7,time:o}:null}function Lae(e){const t=e.time.replace(/^0(?=\d:)/,"");switch(e.kind){case"everyDay":return`Every day at ${t}`;case"monthlyLastDay":return`Monthly on the last day at ${t}`;case"monthlyDay":return`Monthly on day ${e.day} at ${t}`;case"yearly":return`Yearly on ${Y9[e.month]} ${e.day} at ${t}`;case"weekdays":return`Every weekday at ${t}`;case"weekly":return`Weekly on ${gN[e.weekday]} at ${t}`;case"monthlyNth":return`Monthly on the ${zae[e.nth]} ${gN[e.weekday]} at ${t}`}}function Pae(e){const t=J9(e.expression);return`${t?Lae(t):`Cron ${e.expression}`} ${Oae(e.timeZone)}`}const Dae={1:"routines.cron.nth.first",2:"routines.cron.nth.second",3:"routines.cron.nth.third",4:"routines.cron.nth.fourth",5:"routines.cron.nth.fifth",last:"routines.cron.nth.last"},$ae={1:"routines.cron.nthWeekend.first",2:"routines.cron.nthWeekend.second",3:"routines.cron.nthWeekend.third",4:"routines.cron.nthWeekend.fourth",5:"routines.cron.nthWeekend.fifth",last:"routines.cron.nthWeekend.last"},bN=e=>e===0||e===6,yN=e=>new Intl.DateTimeFormat(hf(),{weekday:"long",timeZone:"UTC"}).format(Date.UTC(2023,0,1+e)),Bae=e=>new Intl.DateTimeFormat(hf(),{month:"long",timeZone:"UTC"}).format(Date.UTC(2023,e,1));function Fae(e){const t=rt()==="en"?e.time.replace(/^0(?=\d:)/,""):e.time;switch(e.kind){case"everyDay":return l("routines.cron.everyDay",{time:t});case"monthlyLastDay":return l("routines.cron.monthlyLastDay",{time:t});case"monthlyDay":return l("routines.cron.monthlyDay",{day:e.day,time:t});case"yearly":return l("routines.cron.yearly",{month:Bae(e.month),day:e.day,time:t});case"weekdays":return l("routines.cron.weekdays",{time:t});case"weekly":return l(bN(e.weekday)?"routines.cron.weeklySaturdaySunday":"routines.cron.weekly",{weekday:yN(e.weekday),time:t});case"monthlyNth":{const n=bN(e.weekday)?$ae:Dae;return l(n[e.nth],{weekday:yN(e.weekday),time:t})}}}function A2(e){const t=J9(e.expression);return t?Fae(t):null}function T2(e){return rt()==="en"?Pae(e):`${A2(e)??l("routines.cron.raw",{expression:e.expression})} · ${e.timeZone}`}const qae=6e4,Z9=90;function X9(e){return e.blocked||(e.usedPercent??0)>=Z9}const Uae=6e4,Q9=new Map;let Ui=null,c1=null,$p=null;const $m=new Set;function Hae(e){return Q9.get(e)??e.charAt(0).toUpperCase()+e.slice(1)}function e_(e){Ui={checkedAt:e?.checkedAt??0,engines:Array.isArray(e?.engines)?e.engines:[]};for(const t of Ui.engines)Q9.set(t.engine,t.name);for(const t of $m)t(Ui)}function kN(e){return If("/api/limit-resets",e,null).then(t=>{t&&e_(t)},()=>{})}function sy(e=!1){return e?kN(()=>K("/api/limit-resets?refresh=1")):(c1??=kN(()=>K("/api/limit-resets",{background:!0})).finally(()=>{c1=null}),c1)}async function Wae(e){e_(await K("/api/limit-resets/release",{method:"POST",body:JSON.stringify({engine:e})}))}const Kae=()=>Ui?.checkedAt??0;function Vae(){const[e,t]=f.useState(()=>Ui?.engines??[]);return f.useEffect(()=>{const n=s=>t(s.engines);return $m.add(n),Ui&&t(Ui.engines),sy(),$p??=setInterval(()=>{sy()},Uae),()=>{$m.delete(n),!$m.size&&$p&&(clearInterval($p),$p=null)}},[]),e}function _2(e,t=Date.now()){const n=new Date(e),s=n.toDateString()===new Date(t).toDateString();return n.toLocaleString(dt(),s?{hour:"numeric",minute:"2-digit"}:{weekday:"short",hour:"numeric",minute:"2-digit"})}function t_(e,t=Date.now(),n=" · "){const s=e.blocked?l("limits.atLimit",{engine:e.name}):l("limits.used",{engine:e.name,percent:Math.round(e.usedPercent??0)});return e.resetsAt!==null&&e.resetsAt>t?`${s}${n}${l("limits.resets",{time:_2(e.resetsAt,t)})}`:s}const FPe=e=>e.filter(X9),Bm=4,n_=e=>!!(e&&(e.blocked||e.usedPercent!==null));function Ju(e){return e.blocked||(e.usedPercent??0)>=100?"out":X9(e)?"near":"fine"}function Gae(e){const t=Ju(e);if(t!=="fine")return t==="near"?1:0;const n=100-Z9,s=(100-n)/3,a=100-(e.usedPercent??0);return a>n+2*s?4:a>n+s?3:2}function Yae(e){const t=e.windows?.length?e.windows:n_(e)?[{window:e.window??"other",usedPercent:e.usedPercent??100,resetsAt:e.resetsAt}]:[],n=t.some(s=>s.window===e.window)?e.window:t[0]?.window;return t.map(s=>{const a=e.blocked&&s.window===n,i=a?"out":Ju({usedPercent:s.usedPercent,blocked:!1});return{window:s.window,left:i==="out"?0:Math.max(0,100-Math.round(s.usedPercent)),resetsAt:a?e.resetsAt:s.resetsAt,tone:i}})}function Jae(e){return e==="5-hour"?l("planUsage.fiveHour"):e==="weekly"?l("planUsage.weekly"):l("usage.title")}function qPe(e,t,n,s=Date.now()){return e.flatMap(a=>a.resetsAt!==null&&a.resetsAt>=Math.max(t,s)&&a.resetsAt<n?[{engine:a.engine,name:a.name,at:a.resetsAt}]:[])}function UPe(e,t,n,s=Date.now()){return n.resetsAt===null||n.resetsAt<=s?[]:e.filter(a=>a.enabled&&a.schedule.type!=="limit_reset"&&a.nextRunAt!==null&&a.nextRunAt<n.resetsAt+qae&&t(a.botId)===n.engine)}function s_(e){return l(e.repeat==="every_reset"?"automations.when.everyLimitReset":"automations.when.limitReset",{engine:Hae(e.engine)})}const HPe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ry(e){return new Date(2026,0,4+e).toLocaleDateString(dt(),{weekday:"short"})}function Bl(e){return new Date(e).toLocaleTimeString(dt(),qv(dt()))}function r_(e){return new Date(e).toLocaleDateString(dt(),{weekday:"long",month:"long",day:"numeric"})}function WPe(e){const t=new Date(e);return new Date().toDateString()===t.toDateString()?Bl(e):t.toLocaleDateString(dt(),{month:"short",day:"numeric"})}function KPe(e){return e<60?l("routines.duration.minutes",{minutes:e}):e%60===0?l("routines.duration.hours",{hours:e/60}):l("routines.duration.hoursMinutes",{hours:Math.floor(e/60),minutes:e%60})}function Zae(e){return e<60?l("routines.interval.minutes",{minutes:e}):e===60?l("routines.interval.hour"):e%60===0?l("routines.interval.hours",{hours:e/60}):l("routines.interval.hoursMinutes",{hours:Math.floor(e/60),minutes:e%60})}function Xae(e){const t=[];if(e.weekdays&&e.weekdays.length<7&&t.push(e.weekdays.join(",")==="1,2,3,4,5"?l("routines.schedule.weekdays"):e.weekdays.map(ry).join(", ")),e.window){const n=s=>{const[a,i]=s.split(":").map(Number);return Bl(new Date(2e3,0,1,a,i).getTime())};t.push(`${n(e.window.start)}–${n(e.window.end)}`)}return e.endsAt!=null&&t.push(l("routines.schedule.until",{date:new Date(e.endsAt).toLocaleDateString(dt(),{month:"short",day:"numeric",year:"numeric"})})),t}function d1(e){if(e.type==="cron")return T2(e);if(e.type==="limit_reset")return s_(e);if(e.type==="once")return`${r_(e.at)}, ${Bl(e.at)}`;if(e.type==="interval")return[Zae(e.everyMinutes),...Xae(e)].join(" · ");const t=e.weekdays,n=t.length===7?l("routines.repeat.daily"):t.join(",")==="1,2,3,4,5"?l("routines.schedule.everyWeekday"):t.length===1?l("routines.schedule.weeklyOn",{day:ry(t[0])}):t.map(ry).join(", ");return l("routines.schedule.at",{label:n,time:Bl(E2(Date.now(),e.time))})}const Qae=["name","title","description","soul","cwd","notifications","speakReplies"],a_=new Set(["ogb","computer","agents","composio","data","browser","email","device","phone","dweb","openmausbot_connectors","openmausbot_phone"]);function eie(e){const t=e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/,"");return/^[a-z]/.test(t)?t:t?`mcp-${t}`.slice(0,32).replace(/-+$/,""):""}function VPe(e){const t=eie(e);return a_.has(t)?`mcp-${t}`.slice(0,32):t}const tie=["failed","missed"],nie="Waiting for work it handed on to finish";function sie(e){return tie.includes(e.status)}const GPe="just-me",i_="GMAIL_NEW_GMAIL_MESSAGE";function rie(e){const t=Object.entries(e).find(([n,s])=>/channel/i.test(n)&&typeof s=="string"&&s.trim())?.[1];if(t)return t.startsWith("#")||/^[CGD][A-Z0-9]{6,}$/.test(t)?t:`#${t}`}function aie(e){const t=e.filter??{},n=e.app==="slack"?rie(e.config):void 0,s=[n&&l("automations.app.in",{value:n}),t.from&&l("automations.app.from",{value:t.from}),t.subject&&l("automations.app.about",{value:t.subject}),t.label&&l("automations.app.labeled",{value:t.label}),t.text&&l("automations.app.mentioning",{value:t.text})].filter(Boolean),a=s.length?` ${s.join(" ")}`:"";return e.event===i_?l("automations.app.when.email",{details:a}):e.app==="slack"&&/MESSAGE/.test(e.event)?l("automations.app.when.slack",{details:a}):l("automations.app.when.event",{event:e.eventName,app:e.appName,details:a})}function iie(e){return e.problem?.kind==="reconnect"?{reason:l("automations.reason.reconnect",{app:e.appName}),fix:"reconnect"}:e.problem?.kind==="error"?{reason:l("automations.reason.appError",{app:e.appName,error:e.problem.text}),fix:"edit"}:null}function o_(e,t){const n=[];return e.delivery==="poll"&&n.push(l("automations.app.checks")),!t&&!e.lastEventAt&&n.push(l(e.event===i_?"automations.app.waitingEmail":"automations.app.waiting")),n}function oie(e){const t=o_(e,!1).join(" · ");return t.charAt(0).toLocaleUpperCase()+t.slice(1)}function lie(e,t=Date.now()){const n=e.skipped;if(!n||n.day!==new Date(t).toISOString().slice(0,10))return null;const s=[["dailyLimit",n.dailyLimit,"automations.skip.dailyLimit"],["queueFull",n.queueFull,"automations.skip.queueFull"],["expired",n.expired,"automations.skip.expired"],["tooMany",n.tooMany,"automations.skip.tooMany"]],a=s.reduce((o,[,c])=>o+c,0);if(!a)return null;const i=[...s].sort((o,c)=>c[1]-o[1])[0];return l("automations.panel.skippedToday",{count:a,reason:l(i[2])})}const cie={started:"automations.event.started",joined:"automations.event.joined",filtered:"automations.event.filtered",duplicate:"automations.event.duplicate",skipped:"automations.event.skipped",rejected:"automations.event.rejected"};function YPe(e){return{mark:e.outcome==="started"||e.outcome==="joined"?"✓":e.outcome==="rejected"?"✗":"·",text:[l(cie[e.outcome]),e.preview].filter(Boolean).join(" · ")}}function vN(e){return e.createdAt||e.startedAt||e.scheduledFor}function JPe(e,t){return t.filter(n=>n.routineId===e).reduce((n,s)=>!n||vN(s)>vN(n)?s:n,void 0)}function Rx(e){return e.status==="failed"&&e.partial===!0&&!e.goalStatus}function ZPe(e){if(e.goalStatus)return l(`routines.goal.${e.goalStatus}`);const t=l(Rx(e)?"routines.status.partial":`routines.status.${e.status}`);return e.retried&&e.status!=="queued"?l(`routines.retried.${e.retried}`,{status:t}):t}function XPe(e){return e.status==="waiting"||Rx(e)||["needs-input","limit-reached","paused"].includes(e.goalStatus??"")?"text-warning":["failed","missed"].includes(e.status)||["failed","blocked"].includes(e.goalStatus??"")?"text-danger":e.status==="running"?"text-accent":e.status==="completed"&&(!e.goalStatus||e.goalStatus==="completed")?"text-success":"text-ink-secondary"}function l_(e){return new Date(e).toLocaleString(rt(),{month:"short",day:"numeric",...qv(rt())})}function die(e){return e.schedule.type==="once"&&e.nextRunAt==null&&e.schedule.at<=Date.now()}function uie(e){return die(e)?l("routines.finishedSchedule"):e.enabled?l("routines.activeSchedule"):l("routines.pausedSchedule")}function QPe(e){return e.heldFor?l(`routines.heldFor.${e.heldFor}`):null}function eDe(e){return e.enabled?e.nextRunAt==null?l("routines.noNextRun"):l("routines.nextRun",{time:l_(e.nextRunAt)}):uie(e)}function tDe({roomGoal:e,runOn:t,computer:n,cloudHome:s}){const a=l(s?"routines.runsOn.cloudHomeHint":"routines.runsOn.localHint");return e?{label:l(s?"routines.runsOn.teamCloudHome":"routines.runsOn.team"),hint:a}:t==="cloud"?{label:l("routines.runsOn.boat"),hint:l(s?"routines.runsOn.boatHintCloudHome":"routines.runsOn.boatHint")}:n==="cloud"?{label:l("routines.runsOn.botCloud"),hint:a}:n==="vm"&&!s?{label:l("routines.runsOn.botVm"),hint:a}:{label:l(s?"routines.runsOn.cloudHome":"routines.runsOn.local"),hint:a}}function nDe(e,t){const n=e[t]??"";return t==="output"?Ga(e.outputCode,n):t==="error"?Ga(e.errorCode,n,e.errorParams):Ga(e.attentionCode,n,e.attentionParams)}const cu=e=>e.startedAt??e.scheduledFor??e.createdAt,pie=(e,t)=>cu(t)-cu(e);function c_(e){const t=s=>e.runs.filter(a=>a.routineId===s).sort(pie),n=e.bots&&new Set(e.bots.map(s=>s.id));return[...e.routines.map(s=>({kind:"schedule",id:s.id,name:s.name,botId:s.botId,instructions:s.prompt,enabled:s.enabled,schedule:s.schedule,nextRunAt:s.enabled?s.nextRunAt:null,runs:t(s.id),...s.checkedAt!==void 0?{checkedAt:s.checkedAt}:{},...s.checkTrouble?{checkTrouble:s.checkTrouble,...s.checkTroubleCode?{checkTroubleCode:s.checkTroubleCode}:{}}:{},...s.access==="read-and-draft"?{readsAndDrafts:!0}:{}})),...e.webhooks.map(s=>({kind:"webhook",id:s.id,name:s.name,botId:s.botId,instructions:s.prompt,enabled:s.enabled,eventTypes:s.eventTypes,nextRunAt:null,runs:t(s.id)})),...(e.appTriggers??[]).map(s=>({kind:"app",id:s.id,name:s.name,botId:s.botId,instructions:s.prompt,enabled:s.enabled,appTrigger:s,nextRunAt:null,runs:t(s.id)}))].filter(s=>!n||n.has(s.botId))}function mie(e){return e.some(t=>t.runs.some(n=>sie(n)&&!n.seenAt))}function fie(e,t){return c_({routines:e.kind==="schedule"?t.routines.filter(n=>n.id===e.id):[],webhooks:e.kind==="webhook"?t.webhooks.filter(n=>n.id===e.id):[],appTriggers:e.kind==="app"?(t.appTriggers??[]).filter(n=>n.id===e.id):[],runs:t.runs,bots:t.bots})[0]??null}function d_(e){if(!e.autoApplied||e.answered!=="allow"||e.held)return null;const t=e.routineRequest;if(t?.operation.action==="create"&&t.resultId)return{kind:"schedule",id:t.resultId};const n=e.webhookRequest;if(n?.operation.action==="create"&&n.resultId)return{kind:"webhook",id:n.resultId};const s=e.appTriggerRequest;return s?.operation.action==="create"&&s.resultId?{kind:"app",id:s.resultId}:null}const u_=1440*6e4,Hf=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()},vr=()=>rt();function Hi(e,t=!1){const n=new Date(e);return n.toLocaleTimeString(vr(),qv(vr(),t&&n.getMinutes()===0))}function Wf(e,t=Date.now()){const n=Math.round((Hf(t)-Hf(e))/u_);return n<=0?l("automations.time.today",{time:Hi(e)}):n===1?l("automations.time.yesterday"):n<7?l("automations.time.dayAt",{day:new Date(e).toLocaleDateString(vr(),{weekday:"short"}),time:Hi(e)}):new Date(e).toLocaleDateString(vr(),{month:"short",day:"numeric"})}function M2(e,t=Date.now()){const n=Math.round((Hf(e)-Hf(t))/u_);return n<=0?l("automations.time.today",{time:Hi(e)}):n===1?l("automations.time.tomorrow",{time:Hi(e)}):n<7?l("automations.time.dayAt",{day:new Date(e).toLocaleDateString(vr(),{weekday:"long"}),time:Hi(e)}):new Date(e).toLocaleDateString(vr(),{month:"short",day:"numeric"})}const p_=e=>e.charAt(0).toLocaleUpperCase(vr())+e.slice(1),u1=e=>{const[t,n]=e.split(":").map(Number),s=new Date;return s.setHours(t??0,n??0,0,0),Hi(s.getTime(),!0)},hie=(e,t)=>new Date(2026,0,4+e).toLocaleDateString(vr(),{weekday:t});function m_(e){if(e.type==="limit_reset")return s_(e);if(e.type==="once")return l("automations.when.once",{date:new Date(e.at).toLocaleDateString(vr(),{weekday:"long",month:"long",day:"numeric"}),time:Hi(e.at,!0)});if(e.type==="cron"){const a=/^\*\/([1-5]?\d) \* \* \* \*$/.exec(e.expression.trim())?.[1];return a&&Number(a)>=2?l("automations.when.everyMinutes",{count:Number(a)}):A2(e)?T2(e):l("automations.when.custom")}if(e.type==="interval"){const a=e.everyMinutes;let i=a===60?l("automations.when.everyHour"):a%60===0?l("automations.when.everyHours",{count:a/60}):l("automations.when.everyMinutes",{count:a});return e.weekdays?.join(",")==="1,2,3,4,5"&&(i=l("automations.when.onWeekdays",{when:i})),e.window&&(i=l("automations.when.between",{when:i,start:u1(e.window.start),end:u1(e.window.end)})),i}const t=u1(e.time),n=e.weekdays;if(n.length===7)return l("automations.when.everyDay",{time:t});if(n.join(",")==="1,2,3,4,5")return l("automations.when.everyWeekday",{time:t});const s=n.map(a=>hie(a,n.length===1?"long":"short"));return l("automations.when.everyDays",{days:new Intl.ListFormat(vr(),{type:"conjunction"}).format(s),time:t})}const wN={have:"has",do:"does",go:"goes",be:"is"},xie=new Set(["if","when","whenever","every","each","please","the","a","an","you","i","we","my","our","your","this","that","on","at","for","after","before"]),p1=60,gie="add|archive|book|check|create|draft|email|file|flag|forward|label|list|message|move|notify|open|ping|post|reply|report|review|save|schedule|send|share|summarize|tell|update|write";function jN(e){const t=e.toLowerCase();return wN[t]?wN[t]:/(s|sh|ch|x|z|o)$/.test(t)?`${t}es`:/[^aeiou]y$/.test(t)?`${t.slice(0,-1)}ies`:`${t}s`}const NN=e=>new RegExp("\\p{Lu}","u").test(e.slice(1)),bie=/\s+(?:in|from|of|inside)\s+(?:the\s+)?(?:(?:incoming|webhook|trigger|app)\s+)?(?:event(?:'s)?(?:\s+(?:data|payload|body))?|payload|webhook(?:\s+(?:data|body|payload|call))?|trigger(?:\s+(?:data|payload))?)$/i;function yie(e,t=rt().startsWith("en")){let n=e.replace(/^\s*please\s+/i,"").split(/[.:;!?\n]|\s[—–-]\s/)[0]?.trim().replace(bie,"")??"";if(!n)return l("automations.does.default");if(t){n=n.replace(/\bme\b/gi,"you").replace(/\bmy\b/gi,"your").replace(/\bmine\b/gi,"yours").replace(/\bI\b/g,"you");const[a="",...i]=n.split(/\s+/);n=NN(a)?n:/^[A-Za-z]+$/.test(a)&&!xie.has(a.toLowerCase())?[jN(a),...i].join(" ").replace(new RegExp(`\\b(and|then) (${gie})\\b`,"g"),(o,c,d)=>`${c} ${jN(d)}`):n.charAt(0).toLowerCase()+n.slice(1)}else NN(n.split(/\s/)[0]??"")||(n=n.charAt(0).toLocaleLowerCase(vr())+n.slice(1));if(n.length<=p1)return n;const s=n.slice(0,p1);return`${s.slice(0,s.lastIndexOf(" ")>20?s.lastIndexOf(" "):p1).trimEnd()}…`}const SN=new Set(["lead","leads","trigger","triggers","webhook","webhooks","hook","hooks","event","events","call","calls","request","requests","message","messages","notification","notifications","update","updates"]),kie=/\b(form|forms|app|site|website|store|shop|crm|inbox|sheet|zapier|typeform|tally|jotform|stripe|github|gitlab|shopify|hubspot|salesforce|slack|gmail|calendar|notion|airtable|webflow|wordpress|n8n|ifttt|make)\b/i;function vie(e){const t=e.trim().split(/\s+/).filter(Boolean);for(;t.length&&SN.has(t.at(-1).toLowerCase());)t.pop();for(;t.length&&SN.has(t[0].toLowerCase());)t.shift();return!t.length||t.length>4||t.some(n=>/\d/.test(n))||!kie.test(t.join(" "))?l("automations.source.other"):(t.length>1&&/^[A-Z][a-z]+$/.test(t[0])&&(t[0]=t[0].toLowerCase()),l("automations.source.named",{name:t.join(" ")}))}function f_(e,t){const n=yie(e.instructions);return e.kind==="app"&&e.appTrigger?l("automations.sentence.appEvent",{when:aie(e.appTrigger),bot:t,does:n}):e.kind==="schedule"&&e.schedule?l("automations.sentence.schedule",{when:m_(e.schedule),bot:t,does:n}):l("automations.sentence.app",{source:vie(e.name),bot:t,does:n})}const ay=e=>e.status==="failed"||e.status==="missed",h_=/sign(ed)?[ -]?(in|out)\b|log(ged)?[ -]?(in|out)\b|unauthori[sz]ed|\b401\b|not authenticated|authentication (failed|required)|(token|session|credential)s? (has |have )?expired|expired (token|session|credential)|invalid api key|reconnect/i,wie=/credit|quota|billing|payment|insufficient|out of tokens|usage limit|rate.?limit|\b429\b|limit (reached|exceeded)|plan limit/i,jie=/run limit|time limit|timed out|minute limit/i;function x_(e){const t=`${e.error??""} ${e.goalStatus==="limit-reached"?"run limit":""}`;return h_.test(t)?{reason:l("automations.reason.signIn"),fix:"sign-in"}:jie.test(t)?{reason:l("automations.reason.timeLimit"),fix:"edit"}:wie.test(t)?{reason:l("automations.reason.usage"),fix:"usage"}:null}const g_=e=>e.target==="bot"&&e.attention===nie;function Nie(e){const t=e.find(n=>n.status!=="cancelled"&&n.status!=="queued"&&!(n.status==="waiting"&&g_(n)));return t?.status==="waiting"?t:void 0}function Ox(e,t=Date.now()){if(!e.enabled)return Sie(e,t)?{state:"done"}:{state:"paused"};const n=e.appTrigger&&iie(e.appTrigger);if(n)return{state:"needs-you",...n};if(e.checkTrouble)return{state:"needs-you",reason:Ga(e.checkTroubleCode,e.checkTrouble),fix:h_.test(e.checkTrouble)?"reconnect":"run"};const s=e.runs.filter(i=>i.status!=="cancelled"&&i.status!=="queued"),a=s[0];if(Nie(s))return{state:"needs-you",reason:l("automations.reason.answer"),fix:"answer"};if(a&&ay(a)){const i=x_(a);if(i)return{state:"needs-you",...i};let o=0;for(const c of s){if(!ay(c))break;o+=1}if(o>=2)return{state:"needs-you",reason:l("automations.reason.repeated",{count:o}),fix:"run"}}return{state:"working"}}const Sie=(e,t=Date.now())=>e.schedule?.type==="once"&&e.schedule.at<=t||e.schedule?.type==="limit_reset"&&e.schedule.repeat==="once"&&e.schedule.at!==null&&e.schedule.at<=t,Iie={working:"automations.status.working",paused:"automations.status.paused","needs-you":"automations.status.needsYou",done:"automations.status.done"},Cie={"needs-you":0,working:1,paused:2,done:3};function sDe(e){return e.map(t=>({automation:t,rank:Cie[Ox(t).state]})).sort((t,n)=>t.rank-n.rank||(t.automation.nextRunAt??1/0)-(n.automation.nextRunAt??1/0)||t.automation.name.localeCompare(n.automation.name)).map(({automation:t})=>t)}function b_(e,t=Date.now()){return e.nextRunAt==null||e.appTrigger||e.checkedAt!==void 0||Ox(e,t).state!=="working"||e.runs.some(n=>n.status!=="queued")?null:l("automations.firstRun",{when:M2(e.nextRunAt,t)})}function rDe(e,t=Date.now()){const n=b_(e,t);if(n)return e.readsAndDrafts?`${n} · ${l("automations.readsAndDrafts")}`:n;const s=Ox(e,t),a=e.runs.find(o=>o.status!=="queued"),i=[l(Iie[s.state])];return a?.status==="running"?i.push(l("automations.runningNow")):e.checkedAt!==void 0&&(!a||e.checkedAt>=(a.finishedAt??cu(a)))?i.push(l("automations.checkedNothingNew",{when:Wf(e.checkedAt,t)})):a?i.push(`${l("automations.lastRan",{when:Wf(cu(a),t)})}${Rx(a)?" !":ay(a)?" ✗":""}`):e.appTrigger||i.push(l("automations.notRunYet")),e.appTrigger&&i.push(...o_(e.appTrigger,!!a),...[lie(e.appTrigger,t)??[]].flat()),e.nextRunAt!=null&&i.push(l("automations.next",{when:M2(e.nextRunAt,t)})),e.readsAndDrafts?i.push(l("automations.readsAndDrafts")):e.enabled&&e.schedule?.type==="limit_reset"&&i.push(l("automations.limit.timeUnknown")),i.join(" · ")}function IN(e,t=Date.now()){const n=o=>(o??"").split(`
112
- `).map(c=>c.trim()).find(Boolean)??"",s=o=>o.length>110?`${o.slice(0,109).trimEnd()}…`:o,a=p_(Wf(cu(e),t));if(e.status==="completed")return{when:a,mark:"✓",text:e.report?.state==="quiet"?l("automations.run.nothingNew"):s(n(e.output))||l("automations.run.done")};if(e.status==="waiting")return g_(e)?{when:a,mark:"…",text:l("automations.run.waitingOnTeam")}:{when:a,mark:"!",text:l("automations.reason.answer")};if(e.status==="running"||e.status==="queued")return{when:a,mark:"…",text:l("automations.runningNow")};if(e.status==="cancelled"){const o=s(n(e.error&&Ga(e.errorCode,e.error,e.errorParams)));return{when:a,mark:"✗",text:o?l("automations.run.stoppedBecause",{reason:o}):l("automations.run.stopped")}}const i=s(n(e.error&&Ga(e.errorCode,e.error,e.errorParams)));return Rx(e)?{when:a,mark:"!",text:l("automations.run.partial",{reason:i})}:{when:a,mark:"✗",text:x_(e)?.reason??(i||l("automations.run.failed"))}}const aDe={answer:"automations.fix.answer","sign-in":"automations.fix.signIn",usage:"automations.fix.usage",edit:"automations.fix.edit",run:"automations.fix.run",reconnect:"automations.fix.reconnect"},Eie=30,Aie=240;function Tie(e){if(e.outcome==="accepted")return{ok:!0,reason:l("automations.calls.received")};if(e.outcome==="captured")return{ok:!0,reason:l("automations.calls.test")};if(e.outcome==="duplicate")return{ok:!1,reason:l("automations.calls.duplicate")};if(e.outcome==="ignored")return{ok:!1,reason:e.eventName?l("automations.calls.skipped",{kind:e.eventName}):l("automations.calls.noKind")};const t=Number(/\((\d+) requests\)/.exec(e.reason??"")?.[1]??1);return e.statusCode===401?{ok:!1,reason:t>1?l("automations.calls.wrongSecretTimes",{count:t}):l("automations.calls.wrongSecret")}:e.statusCode===409?{ok:!1,reason:l("automations.calls.paused")}:e.statusCode===410?{ok:!1,reason:l("automations.calls.botGone")}:e.statusCode===429?{ok:!1,reason:/rate limit/i.test(e.reason??"")?l("automations.calls.tooFast"):l("automations.calls.tooMany")}:e.statusCode===413?{ok:!1,reason:l("automations.calls.tooLarge")}:e.statusCode===400?{ok:!1,reason:l("automations.calls.unreadable")}:{ok:!1,reason:l("automations.calls.refused")}}function iDe(e,t){return t.filter(n=>n.webhookId===e).sort((n,s)=>s.receivedAt-n.receivedAt).slice(0,Eie).map(n=>({id:n.id,at:n.receivedAt,...Tie(n),preview:(n.preview??"").slice(0,Aie)}))}function oDe(e,t){const n=t.filter(s=>s.webhookId===e.id&&s.outcome!=="rejected"&&s.preview).reduce((s,a)=>!s||a.receivedAt>s.receivedAt?a:s,null);return n?{at:n.receivedAt,preview:n.preview}:e.verificationSample?.preview?{at:e.verificationSample.receivedAt,preview:e.verificationSample.preview}:null}function lDe(e,t){return e.kind==="schedule"&&e.schedule?`${m_(e.schedule)} · ${t}`:f_(e,t)}const _ie=1e4;let fl=null,m1=!1,Kf=null;const sl=new Set;function y_(){if(Kf=null,!(fl!==null||m1||!sl.size)){if(typeof window<"u"&&window.ogb?.remoteClient?.active===!0){fl=!0;for(const e of sl)e(!0);return}m1=!0,oo().then(e=>e.kind==="unreachable"?null:yU(e),()=>null).then(e=>{m1=!1,e!==null&&(fl=e);for(const t of sl)t(e??!1);e===null&&sl.size&&(Kf=setTimeout(y_,_ie))})}}function Zs(){const[e,t]=f.useState(fl??(Kf?!1:null));return f.useEffect(()=>(sl.add(t),fl!==null?t(fl):Kf?t(!1):y_(),()=>{sl.delete(t)}),[]),e}const Mie="Limix Bot can't use this computer yet — ",k_={chrome:"Chrome","google chrome":"Chrome",chromium:"Chromium",safari:"Safari",firefox:"Firefox","mozilla firefox":"Firefox",edge:"Edge","microsoft edge":"Edge",msedge:"Edge",brave:"Brave","brave browser":"Brave",arc:"Arc",opera:"Opera",vivaldi:"Vivaldi"};function Rie(e){if(typeof e!="string")return;const t=e.trim().replace(/\.(?:app|exe)$/i,"");if(!(!t||t.length>28||t.split(" ").length>3||!/^[\p{L}\p{N}](?:[\p{L}\p{N}&'+-]| (?! ))*$/u.test(t)))return k_[t.toLowerCase()]??t}function Oie(e){if(typeof e!="string"||e.length>253)return;const t=e.trim().toLowerCase().replace(/^www\./,"");return/^(?=.{1,100}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/.test(t)?t:void 0}function zie(e={}){const t=Rie(e.app),n=Oie(e.site),s=t&&Object.values(k_).includes(t)?t:void 0;return s&&n?{key:"approval.yourComputer.browserSite",params:{app:s,site:n}}:s?{key:"approval.yourComputer.browser",params:{app:s}}:n?{key:"approval.yourComputer.site",params:{site:n}}:t?{key:"approval.yourComputer.app",params:{app:t}}:{key:"approval.yourComputer.screen",params:{}}}function R2(e,t){if(!e?.yourComputer)return;const{key:n,params:s}=zie(e.yourComputer);return{line:l(n,s),detail:l("approval.yourComputer.detail",{name:t})}}function Lie(e){return e==="computer"?l("vm.host.computer"):e}const Pie="https://www.openmausbot.com/download";function Die(e){return e==="paused"||e==="permissions"||e==="blocked"||e==="off"||e==="not-running"||e==="terminal-off"}function $ie(e){return e==="closed"||e==="never"||e==="update"}const Bie={screen:"computerAsk.want.screen",folders:"computerAsk.want.folders",terminal:"computerAsk.want.terminal"};function Fie(e){return{key:Bie[e.need],params:{device:e.device}}}function qie(e,t){const n={device:e.device,name:t};switch(e.reason){case"paused":return{key:"computerAsk.reason.paused",params:n};case"starting":return{key:"computerAsk.reason.starting",params:n};case"permissions":return{key:"computerAsk.reason.permissions",params:n};case"blocked":return{key:e.device==="PC"?"computerAsk.reason.blockedPc":"computerAsk.reason.blocked",params:n};case"off":return{key:"computerAsk.reason.off",params:n};case"unsupported":return{key:"computerAsk.reason.unsupported",params:n};case"terminal-off":return{key:"computerAsk.reason.terminalOff",params:n};case"closed":return{key:"computerAsk.reason.closed",params:n};case"never":return{key:"computerAsk.reason.never",params:n};case"update":return{key:"computerAsk.reason.update",params:n};default:return{key:"computerAsk.reason.notRunning",params:n}}}const Uie={"turning-on":"computerAsk.state.turningOn",on:"computerAsk.state.on",declined:"computerAsk.state.declined",ended:"computerAsk.state.ended"};function zx(e,t){const n=e?.computerAsk;if(!n)return;const s=Fie(n),a=qie(n,t),i=n.state==="failed",o=Uie[n.state],c=Lie(n.device);return{line:l(s.key,{...s.params,device:c,name:t}),...n.why?{why:n.why}:{},reason:`${i?`${l("computerAsk.state.failed")} `:""}${l(a.key,{...a.params,device:c})}`,...Die(n.reason)?{turnOn:l(i?"computerAsk.action.tryAgain":"computerAsk.action.turnOn")}:{},...$ie(n.reason)?{getApp:l("computerAsk.action.getApp")}:{},...o?{outcome:l(o,{name:t})}:{}}}const Hie={enable:"mcp.turnOn",update:"mcp.request.change",remove:"mcp.request.remove"};function v_(e){return l(Hie[e])}const O2="omb-webhook-credentials";function Wie(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return[t.endpointUrl,t.secret,t.url].every(n=>typeof n=="string"&&n.length>0)}function z2(e){try{const t=e?.getItem(O2),n=t?JSON.parse(t):null;return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(s=>Wie(s[1])))}catch{return{}}}function iy(e,t,n){const s=z2(e);s[t]=n;try{e?.setItem(O2,JSON.stringify(s))}catch{}}function Kie(e,t){const n=z2(e);delete n[t];try{e?.setItem(O2,JSON.stringify(n))}catch{}}function Yc(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}const w_={loaded:!1,triggers:[],attempts:[],service:null};let qs=w_;const oy=new Set;let CN=!1,f1=null;function Jc(e){qs=e;for(const t of oy)t()}function j_(e){Jc({loaded:!0,triggers:e.triggers,attempts:e.attempts.slice(-2e3),service:e.service})}function L2(e){if(e.kind==="app-trigger"){const t=qs.triggers.some(n=>n.id===e.trigger.id);Jc({...qs,triggers:t?qs.triggers.map(n=>n.id===e.trigger.id?e.trigger:n):[e.trigger,...qs.triggers]})}else e.kind==="app-trigger.deleted"?Jc({...qs,triggers:qs.triggers.filter(t=>t.id!==e.triggerId),attempts:qs.attempts.filter(t=>t.triggerId!==e.triggerId)}):e.kind==="app-trigger.attempt"?Jc({...qs,attempts:[...qs.attempts.filter(t=>t.id!==e.attempt.id),e.attempt].slice(-2e3)}):e.kind==="app-trigger.service"&&Jc({...qs,service:e.service})}function EN(){return f1??=K("/api/app-triggers").then(j_).catch(()=>{}).finally(()=>{f1=null}),f1}function Vie(){CN||typeof window<"u"&&window.ogb?.remoteClient?.active||(CN=!0,jx({onFrame:L2,onMissedFrames:()=>{EN()}}),EN())}function N_(){return f.useEffect(Vie,[]),f.useSyncExternalStore(e=>(oy.add(e),()=>oy.delete(e)),()=>qs,()=>w_)}const AN=e=>L2({kind:"app-trigger",botId:e.botId,trigger:e}),h1={events:e=>K(`/api/app-triggers/events?${new URLSearchParams({botId:e})}`),async create(e){const{trigger:t}=await K("/api/app-triggers",{method:"POST",body:JSON.stringify(e)});return AN(t),t},async update(e,t){const{trigger:n}=await K(`/api/app-triggers/${e}`,{method:"PATCH",body:JSON.stringify(t)});return AN(n),n},async remove(e){await K(`/api/app-triggers/${e}`,{method:"DELETE"}),L2({kind:"app-trigger.deleted",triggerId:e})},test:e=>K(`/api/app-triggers/${e}/test`,{method:"POST"}),async sync(){j_(await K("/api/app-triggers/sync",{method:"POST"}))}};function Gie(){const{state:e,dispatch:t}=se(),n=Qe(),[s,a]=f.useState(null),[i,o]=f.useState(""),[c,d]=f.useState(null),[u,p]=f.useState(null),m=async(b,w)=>{if(!s){a(b),o(""),d(null);try{await w()}catch(j){o(j instanceof Error?j.message:String(j)),d(b)}finally{a(null)}}};return{busy:s,error:i,errorFor:c,setError:o,copied:u,toggle:b=>m(`toggle:${b.id}`,async()=>{if(b.kind==="schedule"){const j=await K(`/api/routines/${b.id}`,{method:"PATCH",body:JSON.stringify({enabled:!b.enabled})});t({type:"routinePatched",routine:j.routine});return}const w=await K(`/api/webhooks/${b.id}`,{method:"PATCH",body:JSON.stringify({enabled:!b.enabled,verificationPending:!1})});t({type:"webhookPatched",webhook:w.webhook})}),runNow:b=>m(`run:${b.id}`,()=>b.kind==="schedule"?new Promise((w,j)=>t({type:"runRoutine",routineId:b.id,onStarted:()=>w(),onError:j})):K(`/api/webhooks/${b.id}/test`,{method:"POST",body:JSON.stringify({event:"openmaus.test",message:"A test run from Automations"})})),remove:async(b,w)=>window.confirm(w)?b.kind==="schedule"?(t({type:"deleteRoutine",routineId:b.id}),!0):(await m(`delete:${b.id}`,async()=>{await K(`/api/webhooks/${b.id}`,{method:"DELETE"}),t({type:"webhookDeleted",webhookId:b.id}),Kie(Yc(),b.id)}),!0):!1,copyAddress:(b,w=!1)=>m(`copy:${b}`,async()=>{let j;if(w||(j=await K(`/api/webhooks/${b}/address`).then(S=>S.credential,()=>{})??z2(Yc())[b],j&&iy(Yc(),b,j)),!j){const S=await K(`/api/webhooks/${b}/rotate`,{method:"POST"});j=S.credential,t({type:"webhookPatched",webhook:S.webhook}),iy(Yc(),b,j)}if(await Vs(j.url)!=="copied")throw new Error(l("automations.address.copyAddressFailed"));p(b),setTimeout(()=>p(S=>S===b?null:S),1800)}),openRun:(b,w)=>{const j=e.bots.find(S=>S.id===b.botId);j&&w?.threadId&&Fi(t,j,w.threadId,n)},cancelRun:(b,w)=>m(`cancel:${b.id}`,async()=>{const j=await K(`/api/routine-runs/${w.id}/cancel`,{method:"POST"});j.run&&t({type:"routineRunPatched",run:j.run})})}}function Yie(){const e=Gie(),[t,n]=f.useState(null),[s,a]=f.useState(""),i=async(o,c)=>{if(!(t||e.busy)){n(o),a("");try{await c()}catch(d){a(d instanceof Error?d.message:String(d))}finally{n(null)}}};return{...e,busy:t??e.busy,error:s||e.error,setError:o=>{a(o),e.setError(o)},toggle:o=>o.kind==="app"?void i(`toggle:${o.id}`,()=>h1.update(o.id,{enabled:!o.enabled})):e.toggle(o),runNow:o=>o.kind==="app"?i(`run:${o.id}`,()=>h1.test(o.id)):e.runNow(o),remove:async(o,c)=>o.kind!=="app"?e.remove(o,c):window.confirm(c)?(await i(`delete:${o.id}`,()=>h1.remove(o.id)),!0):!1}}const Jie=f.lazy(async()=>({default:(await _e(async()=>{const{RoutineEditor:e}=await import("./RoutinesPage-BmR16t7O.js").then(t=>t.c);return{RoutineEditor:e}},__vite__mapDeps([5,1,2,6,3,4,7,8]))).RoutineEditor})),Zie=f.lazy(async()=>({default:(await _e(async()=>{const{WebhookEditor:e}=await import("./WebhookTrigger-sfrkU37A.js");return{WebhookEditor:e}},__vite__mapDeps([9,1,2,3,4,6,10,8]))).WebhookEditor})),Xie=f.lazy(async()=>({default:(await _e(async()=>{const{AppEventEditor:e}=await import("./AppEventEditor-C0O8Bn2f.js");return{AppEventEditor:e}},__vite__mapDeps([11,1,2,3,4,9,6,10,8]))).AppEventEditor})),Bp="rounded-md px-1.5 py-0.5 font-medium hover:bg-inset focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:opacity-50";function Qie({card:e,threadId:t}){const{state:n,dispatch:s}=se(),a=Yie(),i=N_(),[o,c]=f.useState(!1),[d,u]=f.useState(!1),[p,m]=f.useState(),h=d_(e);if(!h)return null;const x=fie(h,{routines:n.routines,webhooks:n.webhooks,appTriggers:i.triggers,runs:n.routineRuns,bots:n.bots}),g=e.routineRequest?.undo?.name??e.webhookRequest?.undo?.name??e.appTriggerRequest?.undo?.name??e.title;if(e.undone||!x)return!e.undone&&h.kind==="schedule"&&n.routinesLoadState==="loading"||!e.undone&&h.kind==="app"&&!i.loaded?null:r.jsxs("div",{"data-trigger-card":h.id,className:"flex w-full max-w-[840px] items-center gap-2 text-[13px] text-ink-tertiary",children:[e.undone?r.jsx(CE,{size:13}):r.jsx(fa,{size:13}),r.jsx("span",{children:e.undone?l("automations.card.removed"):`${l("automations.card.gone")} · ${g}`})]});const k=n.bots.find(_=>_.id===x.botId)?.name??l("routines.unavailableBot"),v=f_(x,k),y=Ox(x),b=x.runs.find(_=>_.status!=="queued"),w=x.nextRunAt!=null?M2(x.nextRunAt):null,j=b&&`${l("automations.card.lastRan",{when:Wf(b.startedAt??b.scheduledFor)})} ${IN(b).mark} ${IN(b).text}`;let S;y.state==="paused"?S=l("automations.status.paused"):y.state==="done"?S=[l("automations.status.done"),j].filter(Boolean).join(" · "):y.state==="needs-you"?S=l("automations.needsYou",{reason:y.reason??""}):j?S=[j,w&&l("automations.next",{when:w})].filter(Boolean).join(" · "):S=b_(x)??(w?l("automations.card.next",{when:w}):x.appTrigger?oie(x.appTrigger):p_(l("automations.notRunYet")));const E=()=>{!t||!e.requestId||d||(u(!0),m(void 0),K(`/api/threads/${t}/undo`,{method:"POST",body:JSON.stringify({requestId:e.requestId})}).catch(_=>m(_ instanceof hn&&_.body?.code==="changed-since"?l("automations.card.changedSince"):_ instanceof Error?_.message:String(_))).finally(()=>u(!1)))},A=n.bots.filter(_=>!_.hidden);return r.jsxs("section",{"data-trigger-card":x.id,"data-automation-status":y.state,"aria-label":v,className:"w-full max-w-[640px] rounded-xl border border-hairline/45 bg-card px-3.5 py-2.5 text-[13px]",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fa,{size:14,className:I("mt-0.5 shrink-0",y.state==="needs-you"?"text-warning":x.enabled?"text-accent":"text-ink-tertiary")}),r.jsx("button",{type:"button",onClick:()=>s({type:"showRoutines",view:"list",routineId:x.id}),className:"min-w-0 text-left font-medium leading-snug text-ink hover:text-accent-text",children:l("automations.card.setUp",{sentence:v})})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 pl-[22px] text-[12px]",children:[r.jsx("span",{className:I("min-w-0 flex-1 basis-48 truncate",y.state==="needs-you"?"text-warning":"text-ink-secondary"),title:S,children:S}),r.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-ink-secondary",children:[y.state!=="done"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",disabled:!!a.busy,onClick:()=>{a.toggle(x)},className:Bp,children:x.enabled?l("automations.pause"):l("automations.resume")}),r.jsx("span",{"aria-hidden":"true",children:"·"})]}),r.jsx("button",{type:"button",onClick:()=>c(!0),className:Bp,children:l("automations.edit")}),x.kind==="webhook"&&r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("button",{type:"button",disabled:!!a.busy,onClick:()=>{a.copyAddress(x.id)},className:Bp,children:a.copied===x.id?l("automations.address.copied"):l("automations.address.copy")})]}),t&&e.requestId&&r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("button",{type:"button",onClick:E,disabled:d,className:I(Bp,"text-accent"),children:d?l("automations.card.undoing"):l("automations.card.undo")})]})]})]}),(p||a.error)&&r.jsx("div",{role:"alert",className:"mt-1 pl-[22px] text-[12px] text-warning",children:p??a.error}),o&&Ke.createPortal(r.jsx(f.Suspense,{fallback:null,children:x.kind==="app"?r.jsx(Xie,{trigger:x.appTrigger,bots:A,onClose:()=>c(!1)}):x.kind==="schedule"?r.jsx(Jie,{routine:n.routines.find(_=>_.id===x.id),bots:A,plain:!0,onClose:()=>c(!1)}):r.jsx(Zie,{webhook:n.webhooks.find(_=>_.id===x.id),bots:A,onClose:()=>c(!1),onCredential:(_,N)=>iy(Yc(),N,_)})}),document.body)]})}const eoe={"spot.approval":"onboarding.hint.approval","spot.connector":"onboarding.hint.connector"},TN=new Set;function toe(){try{return se()}catch{return null}}function S_({id:e}){const t=toe(),n=t?.dispatch,s=et(),a=t?.state.config?.onboarding,[i]=f.useState(()=>!!n&&!s&&!!a?.completedAt&&!Sn(a,e)&&!TN.has(e));return f.useEffect(()=>{if(!i)return;TN.add(e);const o=lo(a,e);o&&K("/api/config",{method:"PUT",body:JSON.stringify(o)}).then(c=>n?.({type:"configStatus",config:c})).catch(()=>{})},[i]),i?r.jsx("p",{"data-card-hint":e,className:"text-[12px] leading-4 text-ink-secondary",children:l(eoe[e])}):null}const noe={create:"approval.status.routineScheduled",update:"approval.status.routineUpdated",pause:"approval.status.routinePaused",resume:"approval.status.routineResumed",run_now:"approval.status.routineRunQueued",delete:"approval.status.routineDeleted"},soe={create:"approval.status.skillEnabled",update:"approval.status.skillUpdated",enable:"approval.status.skillTurnedOn",disable:"approval.status.skillTurnedOff",delete:"approval.status.skillDeleted"},_N={create:"approval.applied.automation.create",update:"approval.applied.automation.update",pause:"approval.applied.automation.pause",resume:"approval.applied.automation.resume",run_now:"approval.applied.automation.runNow",delete:"approval.applied.automation.delete"},roe={waiting:"approval.applied.wait",fired:"approval.applied.waitFired",expired:"approval.applied.waitExpired",cancelled:"approval.applied.waitCancelled"},aoe={create:"approval.applied.skill.create",update:"approval.applied.skill.update",enable:"approval.applied.skill.enable",disable:"approval.applied.skill.disable",delete:"approval.applied.skill.delete"},ioe={name:"approval.applied.field.name",title:"approval.applied.field.title",description:"approval.applied.field.description",soul:"approval.applied.field.soul",cwd:"approval.applied.field.cwd",notifications:"approval.applied.field.notifications",speakReplies:"approval.applied.field.speakReplies"},I_=e=>!!(e.routineRequest&&!e.answered),bi=e=>!!(e?.teamSetupRequest||e?.mcpRequest||e?.lendingLift||rA(e?.skillRequest?.action));function C_(e){return e.mcpRequest?v_(e.mcpRequest.action):e.teamSetupRequest?l(e.teamSetupRequest.deletion?"approval.action.deleteBot":"approval.action.applySetup"):e.options[0]??l("approval.action.confirm")}function P2(e){const t=!!(e.routineRequest||e.skillRequest||e.profileRequest||e.modelRequest||bi(e));if(e.expired===!0||I_(e))return l(t||!e.tool?"approval.status.expired":"approval.status.timedOut");if(!e.answered)return;if(e.undone===!0)return l("approval.status.undone");if(e.answered!=="allow")return t?l("approval.status.cancelled"):l("approval.status.denied");if(e.teamSetupRequest)return l(e.teamSetupRequest.deletion?"approval.status.botDeleted":"approval.status.teamApplied");const n=e.routineRequest?.operation.action;if(n)return l(noe[n]);const s=e.skillRequest?.action;return s?l(soe[s]):e.profileRequest?l("approval.status.profileUpdated"):e.modelRequest?l("approval.status.modelChanged"):e.routineRequest?l("approval.status.routineConfirmed"):e.skillRequest?l("approval.status.skillConfirmed"):l("approval.status.allowed")}function zi(e){if(!e)return l("approval.tool.takeAction");const t=e.startsWith("mcp__")?e.split("__"):void 0,n=t?.[1],s=(t?t.slice(2).join("__"):e).replace(/_/g," "),i={Bash:"approval.tool.runCommand",Read:"approval.tool.readFile",Write:"approval.tool.writeFile",Edit:"approval.tool.editFile",WebFetch:"approval.tool.fetchWebPage",WebSearch:"approval.tool.searchWeb",schedule_routine:"approval.tool.scheduleRoutine",manage_routine:"approval.tool.changeRoutine",stage_skill:"approval.tool.enableSkill",update_skill:"approval.tool.updateSkill",update_profile:"approval.tool.updateProfile",shell:"approval.tool.runCommand",edit:"approval.tool.editFile",read:"approval.tool.readFile",fetch:"approval.tool.fetchWebPage",delete:"approval.tool.deleteFile",think:"approval.tool.think",other:"approval.tool.takeAction",tool:"approval.tool.useTool"}[e];if(i)return l(i);const o=t?q9(t.slice(2).join("__"))??s:s;return n&&!a_.has(n)?`${n} · ${o}`:o}function ooe(e){return e.type==="once"?new Date(e.at).toDateString()===new Date().toDateString()?l("approval.applied.today",{time:Bl(e.at)}):`${r_(e.at)}, ${Bl(e.at)}`:e.type==="cron"?A2(e)?T2(e):"":e.type==="interval"?d1({...e,anchorAt:e.anchorAt??0}):e.type==="limit_reset"?d1({...e,at:null}):d1(e)}function loe(e,t){const n=e.routineRequest;if(n){const u=n.operation,p=n.undo,m=p?.schedule&&u.action!=="pause"&&u.action!=="delete"&&u.action!=="run_now"?ooe(p.schedule):"",h=[p?.name??(u.action==="create"?u.routine.name:""),u.forBot?l("approval.applied.forBot",{target:`@${u.forBot.name}`}):""].filter(Boolean).join(" · ")+(m?`, ${m}`:""),x=u.action==="create"?!!n.resultId:u.action==="update"?!!(p?.before&&p.appliedUpdatedAt!==void 0):u.action==="pause"||u.action==="resume"?p?.appliedUpdatedAt!==void 0:u.action==="delete"?!!p?.before:!1;return{line:l(_N[u.action],{name:t,title:h}),canUndo:x}}const s=e.waitRequest;if(s)return{line:l(roe[s.settled??"waiting"],{name:t,title:s.label}),canUndo:!s.settled,cancels:!0};const a=e.webhookRequest;if(a){const u=a.operation.forBot?` · ${l("approval.applied.forBot",{target:`@${a.operation.forBot.name}`})}`:"";return{line:l(_N[a.operation.action],{name:t,title:`${a.undo?.name??""}${u}`}),canUndo:a.operation.action!=="run_now"}}const i=e.skillRequest;if(i)return{line:l(aoe[i.action],{name:t,title:i.name}),canUndo:i.action==="create"||i.action==="enable"||i.action==="disable"||!!i.previous};const o=e.profileRequest;if(o){const u=Qae.filter(m=>o.changes[m]!==void 0).map(m=>l(ioe[m])).join(", ");return{line:o.targetBotId===o.botId?l("approval.applied.profileOwn",{name:t,title:u}):l("approval.applied.profileOther",{name:t,target:`@${o.targetName}`,title:u}),canUndo:!!o.undo}}const c=e.modelRequest;if(c){const u=c.selection.model;return{line:c.targetBotId===c.botId?l("approval.applied.modelOwn",{name:t,title:u}):l("approval.applied.modelOther",{name:t,target:`@${c.targetName}`,title:u}),canUndo:!0}}const d=e.teamSetupRequest;if(d?.deletion)return{line:l("approval.applied.botDeleted",{name:t,target:`@${d.deletion.name}`}),canUndo:!1};if(d?.result){const u=m=>d.result.bots.filter(h=>h.action===m).map(h=>`@${h.name}`).join(", "),p=[u("created")&&l("approval.applied.teamAdded",{names:u("created")}),u("updated")&&l("approval.applied.teamUpdated",{names:u("updated")})].filter(Boolean).join("; ");return{line:l("approval.applied.teamSetup",{name:t,title:p}),canUndo:!!d.undo}}if(e.teamMemoryRequest)return{line:l("approval.applied.teamMemory",{name:t,title:e.subtitle.split(" — ")[0]??""}),canUndo:!!e.teamMemoryRequest.revision}}function coe({card:e,name:t,originalName:n,threadId:s,summary:a}){const[i,o]=f.useState(!1),[c,d]=f.useState(!1),[u,p]=f.useState(),[m,h]=f.useState(!1),[x,g]=f.useState(),k=f.useContext(Uu)?.state.config??null,v=Zs()!==!1,y=a.canUndo&&(!e.teamMemoryRequest||v),b=e.undone===!0,w=a.cancels===!0,j=e.skillRequest,S=j?.shared??(x&&x.requestId===e.requestId?x.shared:void 0),E=!!(j&&!rA(j.action)&&!S&&!b&&s&&e.requestId)&&Yre(k)==="ask",A=()=>{const R=e.requestId;!s||!R||m||(h(!0),p(void 0),K(`/api/threads/${s}/share-skill`,{method:"POST",body:JSON.stringify({requestId:R})}).then(O=>g({requestId:R,shared:O.shared})).catch(O=>{p(l("approval.applied.shareFailed",{error:O instanceof Error?O.message:String(O)}))}).finally(()=>h(!1)))},_=S?.assigned.filter(R=>R.botId!==j?.botId).map(R=>R.name)??[],N=S?.skipped.map(R=>R.name)??[],C=()=>{!s||!e.requestId||c||(d(!0),p(void 0),K(`/api/threads/${s}/undo`,{method:"POST",body:JSON.stringify({requestId:e.requestId})}).catch(R=>{w&&R instanceof hn&&R.status===409||p(R instanceof hn&&R.body?.code==="changed-since"?l("approval.applied.changedSince"):w?l("approval.applied.cancelFailed",{name:t}):l("approval.applied.undoFailed",{error:R instanceof Error?R.message:String(R)}))}).finally(()=>d(!1)))};return r.jsxs("div",{className:"w-full max-w-[840px] text-[13px] text-ink-tertiary","data-applied-change":t,children:[r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 leading-5",children:[b?r.jsx(CE,{size:13,className:"shrink-0 self-center"}):r.jsx(Ie,{size:13,className:"shrink-0 self-center text-success/80"}),r.jsxs("span",{className:"min-w-0 break-words",children:[a.line,S&&!b&&r.jsxs("span",{children:[" · ",_.length?l("approval.applied.sharedSkill",{names:_.join(", ")}):l("approval.applied.sharedSkillNobody")]}),b&&!w&&r.jsxs("span",{children:[" · ",l("approval.applied.undone")]})]}),!b&&y&&s&&r.jsx("button",{type:"button",onClick:C,disabled:c,className:I(ly,"text-accent disabled:opacity-60"),children:w?l(c?"approval.applied.cancelling":"common.cancel"):l(c?"approval.applied.undoing":"approval.applied.undo")}),E&&r.jsx("button",{type:"button",onClick:A,disabled:m,className:"rounded-md px-1.5 py-0.5 font-medium text-accent hover:bg-inset disabled:opacity-60",children:m?l("approval.applied.sharingSkill"):l("approval.applied.shareSkill")}),r.jsx("button",{type:"button","aria-expanded":i,onClick:()=>o(R=>!R),className:I(ly,"text-ink-tertiary hover:text-ink-secondary"),children:i?l("approval.applied.hideDetails"):l("approval.applied.details")})]}),S&&!b&&N.length>0&&r.jsx("div",{className:"mt-1 text-[13px] text-ink-tertiary",children:l("approval.applied.shareSkipped",{names:N.join(", ")})}),!u&&!S&&!b&&j?.shareError&&r.jsx("div",{className:"mt-1 text-[13px] text-warning",children:l("approval.applied.shareFailed",{error:j.shareError})}),u&&r.jsx("div",{role:"alert",className:"mt-1 text-[13px] text-warning",children:u}),i&&r.jsx("pre",{tabIndex:0,"aria-label":l("approval.aria.appliedDetails"),className:"mt-1.5 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-2xl bg-inset px-4 py-3 font-mono text-[13px] leading-relaxed text-ink",children:rt()!=="en"&&e.waitRequest?l("approval.applied.waitFollowUp",{name:n??t,followUp:e.waitRequest.followUp??""}):e.subtitle})]})}const doe="inline-flex min-w-0 max-w-full items-baseline rounded-full bg-inset px-2 pb-px pt-[3px] font-mono text-[13px] leading-5 text-ink",ly="inline-flex h-6 items-center rounded-full px-2 hover:bg-inset focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus";function uoe(e){const t=e.split(`
112
+ `).map(c=>c.trim()).find(Boolean)??"",s=o=>o.length>110?`${o.slice(0,109).trimEnd()}…`:o,a=p_(Wf(cu(e),t));if(e.status==="completed")return{when:a,mark:"✓",text:e.report?.state==="quiet"?l("automations.run.nothingNew"):s(n(e.output))||l("automations.run.done")};if(e.status==="waiting")return g_(e)?{when:a,mark:"…",text:l("automations.run.waitingOnTeam")}:{when:a,mark:"!",text:l("automations.reason.answer")};if(e.status==="running"||e.status==="queued")return{when:a,mark:"…",text:l("automations.runningNow")};if(e.status==="cancelled"){const o=s(n(e.error&&Ga(e.errorCode,e.error,e.errorParams)));return{when:a,mark:"✗",text:o?l("automations.run.stoppedBecause",{reason:o}):l("automations.run.stopped")}}const i=s(n(e.error&&Ga(e.errorCode,e.error,e.errorParams)));return Rx(e)?{when:a,mark:"!",text:l("automations.run.partial",{reason:i})}:{when:a,mark:"✗",text:x_(e)?.reason??(i||l("automations.run.failed"))}}const aDe={answer:"automations.fix.answer","sign-in":"automations.fix.signIn",usage:"automations.fix.usage",edit:"automations.fix.edit",run:"automations.fix.run",reconnect:"automations.fix.reconnect"},Eie=30,Aie=240;function Tie(e){if(e.outcome==="accepted")return{ok:!0,reason:l("automations.calls.received")};if(e.outcome==="captured")return{ok:!0,reason:l("automations.calls.test")};if(e.outcome==="duplicate")return{ok:!1,reason:l("automations.calls.duplicate")};if(e.outcome==="ignored")return{ok:!1,reason:e.eventName?l("automations.calls.skipped",{kind:e.eventName}):l("automations.calls.noKind")};const t=Number(/\((\d+) requests\)/.exec(e.reason??"")?.[1]??1);return e.statusCode===401?{ok:!1,reason:t>1?l("automations.calls.wrongSecretTimes",{count:t}):l("automations.calls.wrongSecret")}:e.statusCode===409?{ok:!1,reason:l("automations.calls.paused")}:e.statusCode===410?{ok:!1,reason:l("automations.calls.botGone")}:e.statusCode===429?{ok:!1,reason:/rate limit/i.test(e.reason??"")?l("automations.calls.tooFast"):l("automations.calls.tooMany")}:e.statusCode===413?{ok:!1,reason:l("automations.calls.tooLarge")}:e.statusCode===400?{ok:!1,reason:l("automations.calls.unreadable")}:{ok:!1,reason:l("automations.calls.refused")}}function iDe(e,t){return t.filter(n=>n.webhookId===e).sort((n,s)=>s.receivedAt-n.receivedAt).slice(0,Eie).map(n=>({id:n.id,at:n.receivedAt,...Tie(n),preview:(n.preview??"").slice(0,Aie)}))}function oDe(e,t){const n=t.filter(s=>s.webhookId===e.id&&s.outcome!=="rejected"&&s.preview).reduce((s,a)=>!s||a.receivedAt>s.receivedAt?a:s,null);return n?{at:n.receivedAt,preview:n.preview}:e.verificationSample?.preview?{at:e.verificationSample.receivedAt,preview:e.verificationSample.preview}:null}function lDe(e,t){return e.kind==="schedule"&&e.schedule?`${m_(e.schedule)} · ${t}`:f_(e,t)}const _ie=1e4;let fl=null,m1=!1,Kf=null;const sl=new Set;function y_(){if(Kf=null,!(fl!==null||m1||!sl.size)){if(typeof window<"u"&&window.ogb?.remoteClient?.active===!0){fl=!0;for(const e of sl)e(!0);return}m1=!0,oo().then(e=>e.kind==="unreachable"?null:yU(e),()=>null).then(e=>{m1=!1,e!==null&&(fl=e);for(const t of sl)t(e??!1);e===null&&sl.size&&(Kf=setTimeout(y_,_ie))})}}function Zs(){const[e,t]=f.useState(fl??(Kf?!1:null));return f.useEffect(()=>(sl.add(t),fl!==null?t(fl):Kf?t(!1):y_(),()=>{sl.delete(t)}),[]),e}const Mie="Limix Bot can't use this computer yet — ",k_={chrome:"Chrome","google chrome":"Chrome",chromium:"Chromium",safari:"Safari",firefox:"Firefox","mozilla firefox":"Firefox",edge:"Edge","microsoft edge":"Edge",msedge:"Edge",brave:"Brave","brave browser":"Brave",arc:"Arc",opera:"Opera",vivaldi:"Vivaldi"};function Rie(e){if(typeof e!="string")return;const t=e.trim().replace(/\.(?:app|exe)$/i,"");if(!(!t||t.length>28||t.split(" ").length>3||!/^[\p{L}\p{N}](?:[\p{L}\p{N}&'+-]| (?! ))*$/u.test(t)))return k_[t.toLowerCase()]??t}function Oie(e){if(typeof e!="string"||e.length>253)return;const t=e.trim().toLowerCase().replace(/^www\./,"");return/^(?=.{1,100}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/.test(t)?t:void 0}function zie(e={}){const t=Rie(e.app),n=Oie(e.site),s=t&&Object.values(k_).includes(t)?t:void 0;return s&&n?{key:"approval.yourComputer.browserSite",params:{app:s,site:n}}:s?{key:"approval.yourComputer.browser",params:{app:s}}:n?{key:"approval.yourComputer.site",params:{site:n}}:t?{key:"approval.yourComputer.app",params:{app:t}}:{key:"approval.yourComputer.screen",params:{}}}function R2(e,t){if(!e?.yourComputer)return;const{key:n,params:s}=zie(e.yourComputer);return{line:l(n,s),detail:l("approval.yourComputer.detail",{name:t})}}function Lie(e){return e==="computer"?l("vm.host.computer"):e}const Pie="https://www.openmausbot.com/download";function Die(e){return e==="paused"||e==="permissions"||e==="blocked"||e==="off"||e==="not-running"||e==="terminal-off"}function $ie(e){return e==="closed"||e==="never"||e==="update"}const Bie={screen:"computerAsk.want.screen",folders:"computerAsk.want.folders",terminal:"computerAsk.want.terminal"};function Fie(e){return{key:Bie[e.need],params:{device:e.device}}}function qie(e,t){const n={device:e.device,name:t};switch(e.reason){case"paused":return{key:"computerAsk.reason.paused",params:n};case"starting":return{key:"computerAsk.reason.starting",params:n};case"permissions":return{key:"computerAsk.reason.permissions",params:n};case"blocked":return{key:e.device==="PC"?"computerAsk.reason.blockedPc":"computerAsk.reason.blocked",params:n};case"off":return{key:"computerAsk.reason.off",params:n};case"unsupported":return{key:"computerAsk.reason.unsupported",params:n};case"terminal-off":return{key:"computerAsk.reason.terminalOff",params:n};case"closed":return{key:"computerAsk.reason.closed",params:n};case"never":return{key:"computerAsk.reason.never",params:n};case"update":return{key:"computerAsk.reason.update",params:n};default:return{key:"computerAsk.reason.notRunning",params:n}}}const Uie={"turning-on":"computerAsk.state.turningOn",on:"computerAsk.state.on",declined:"computerAsk.state.declined",ended:"computerAsk.state.ended"};function zx(e,t){const n=e?.computerAsk;if(!n)return;const s=Fie(n),a=qie(n,t),i=n.state==="failed",o=Uie[n.state],c=Lie(n.device);return{line:l(s.key,{...s.params,device:c,name:t}),...n.why?{why:n.why}:{},reason:`${i?`${l("computerAsk.state.failed")} `:""}${l(a.key,{...a.params,device:c})}`,...Die(n.reason)?{turnOn:l(i?"computerAsk.action.tryAgain":"computerAsk.action.turnOn")}:{},...$ie(n.reason)?{getApp:l("computerAsk.action.getApp")}:{},...o?{outcome:l(o,{name:t})}:{}}}const Hie={enable:"mcp.turnOn",update:"mcp.request.change",remove:"mcp.request.remove"};function v_(e){return l(Hie[e])}const O2="omb-webhook-credentials";function Wie(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return[t.endpointUrl,t.secret,t.url].every(n=>typeof n=="string"&&n.length>0)}function z2(e){try{const t=e?.getItem(O2),n=t?JSON.parse(t):null;return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(s=>Wie(s[1])))}catch{return{}}}function iy(e,t,n){const s=z2(e);s[t]=n;try{e?.setItem(O2,JSON.stringify(s))}catch{}}function Kie(e,t){const n=z2(e);delete n[t];try{e?.setItem(O2,JSON.stringify(n))}catch{}}function Yc(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}const w_={loaded:!1,triggers:[],attempts:[],service:null};let qs=w_;const oy=new Set;let CN=!1,f1=null;function Jc(e){qs=e;for(const t of oy)t()}function j_(e){Jc({loaded:!0,triggers:e.triggers,attempts:e.attempts.slice(-2e3),service:e.service})}function L2(e){if(e.kind==="app-trigger"){const t=qs.triggers.some(n=>n.id===e.trigger.id);Jc({...qs,triggers:t?qs.triggers.map(n=>n.id===e.trigger.id?e.trigger:n):[e.trigger,...qs.triggers]})}else e.kind==="app-trigger.deleted"?Jc({...qs,triggers:qs.triggers.filter(t=>t.id!==e.triggerId),attempts:qs.attempts.filter(t=>t.triggerId!==e.triggerId)}):e.kind==="app-trigger.attempt"?Jc({...qs,attempts:[...qs.attempts.filter(t=>t.id!==e.attempt.id),e.attempt].slice(-2e3)}):e.kind==="app-trigger.service"&&Jc({...qs,service:e.service})}function EN(){return f1??=K("/api/app-triggers").then(j_).catch(()=>{}).finally(()=>{f1=null}),f1}function Vie(){CN||typeof window<"u"&&window.ogb?.remoteClient?.active||(CN=!0,jx({onFrame:L2,onMissedFrames:()=>{EN()}}),EN())}function N_(){return f.useEffect(Vie,[]),f.useSyncExternalStore(e=>(oy.add(e),()=>oy.delete(e)),()=>qs,()=>w_)}const AN=e=>L2({kind:"app-trigger",botId:e.botId,trigger:e}),h1={events:e=>K(`/api/app-triggers/events?${new URLSearchParams({botId:e})}`),async create(e){const{trigger:t}=await K("/api/app-triggers",{method:"POST",body:JSON.stringify(e)});return AN(t),t},async update(e,t){const{trigger:n}=await K(`/api/app-triggers/${e}`,{method:"PATCH",body:JSON.stringify(t)});return AN(n),n},async remove(e){await K(`/api/app-triggers/${e}`,{method:"DELETE"}),L2({kind:"app-trigger.deleted",triggerId:e})},test:e=>K(`/api/app-triggers/${e}/test`,{method:"POST"}),async sync(){j_(await K("/api/app-triggers/sync",{method:"POST"}))}};function Gie(){const{state:e,dispatch:t}=se(),n=Qe(),[s,a]=f.useState(null),[i,o]=f.useState(""),[c,d]=f.useState(null),[u,p]=f.useState(null),m=async(b,w)=>{if(!s){a(b),o(""),d(null);try{await w()}catch(j){o(j instanceof Error?j.message:String(j)),d(b)}finally{a(null)}}};return{busy:s,error:i,errorFor:c,setError:o,copied:u,toggle:b=>m(`toggle:${b.id}`,async()=>{if(b.kind==="schedule"){const j=await K(`/api/routines/${b.id}`,{method:"PATCH",body:JSON.stringify({enabled:!b.enabled})});t({type:"routinePatched",routine:j.routine});return}const w=await K(`/api/webhooks/${b.id}`,{method:"PATCH",body:JSON.stringify({enabled:!b.enabled,verificationPending:!1})});t({type:"webhookPatched",webhook:w.webhook})}),runNow:b=>m(`run:${b.id}`,()=>b.kind==="schedule"?new Promise((w,j)=>t({type:"runRoutine",routineId:b.id,onStarted:()=>w(),onError:j})):K(`/api/webhooks/${b.id}/test`,{method:"POST",body:JSON.stringify({event:"openmaus.test",message:"A test run from Automations"})})),remove:async(b,w)=>window.confirm(w)?b.kind==="schedule"?(t({type:"deleteRoutine",routineId:b.id}),!0):(await m(`delete:${b.id}`,async()=>{await K(`/api/webhooks/${b.id}`,{method:"DELETE"}),t({type:"webhookDeleted",webhookId:b.id}),Kie(Yc(),b.id)}),!0):!1,copyAddress:(b,w=!1)=>m(`copy:${b}`,async()=>{let j;if(w||(j=await K(`/api/webhooks/${b}/address`).then(S=>S.credential,()=>{})??z2(Yc())[b],j&&iy(Yc(),b,j)),!j){const S=await K(`/api/webhooks/${b}/rotate`,{method:"POST"});j=S.credential,t({type:"webhookPatched",webhook:S.webhook}),iy(Yc(),b,j)}if(await Vs(j.url)!=="copied")throw new Error(l("automations.address.copyAddressFailed"));p(b),setTimeout(()=>p(S=>S===b?null:S),1800)}),openRun:(b,w)=>{const j=e.bots.find(S=>S.id===b.botId);j&&w?.threadId&&Fi(t,j,w.threadId,n)},cancelRun:(b,w)=>m(`cancel:${b.id}`,async()=>{const j=await K(`/api/routine-runs/${w.id}/cancel`,{method:"POST"});j.run&&t({type:"routineRunPatched",run:j.run})})}}function Yie(){const e=Gie(),[t,n]=f.useState(null),[s,a]=f.useState(""),i=async(o,c)=>{if(!(t||e.busy)){n(o),a("");try{await c()}catch(d){a(d instanceof Error?d.message:String(d))}finally{n(null)}}};return{...e,busy:t??e.busy,error:s||e.error,setError:o=>{a(o),e.setError(o)},toggle:o=>o.kind==="app"?void i(`toggle:${o.id}`,()=>h1.update(o.id,{enabled:!o.enabled})):e.toggle(o),runNow:o=>o.kind==="app"?i(`run:${o.id}`,()=>h1.test(o.id)):e.runNow(o),remove:async(o,c)=>o.kind!=="app"?e.remove(o,c):window.confirm(c)?(await i(`delete:${o.id}`,()=>h1.remove(o.id)),!0):!1}}const Jie=f.lazy(async()=>({default:(await _e(async()=>{const{RoutineEditor:e}=await import("./RoutinesPage-CRvNKmna.js").then(t=>t.c);return{RoutineEditor:e}},__vite__mapDeps([5,1,2,6,3,4,7,8]))).RoutineEditor})),Zie=f.lazy(async()=>({default:(await _e(async()=>{const{WebhookEditor:e}=await import("./WebhookTrigger-B0TCdhpi.js");return{WebhookEditor:e}},__vite__mapDeps([9,1,2,3,4,6,10,8]))).WebhookEditor})),Xie=f.lazy(async()=>({default:(await _e(async()=>{const{AppEventEditor:e}=await import("./AppEventEditor-MqHYrUPZ.js");return{AppEventEditor:e}},__vite__mapDeps([11,1,2,3,4,9,6,10,8]))).AppEventEditor})),Bp="rounded-md px-1.5 py-0.5 font-medium hover:bg-inset focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:opacity-50";function Qie({card:e,threadId:t}){const{state:n,dispatch:s}=se(),a=Yie(),i=N_(),[o,c]=f.useState(!1),[d,u]=f.useState(!1),[p,m]=f.useState(),h=d_(e);if(!h)return null;const x=fie(h,{routines:n.routines,webhooks:n.webhooks,appTriggers:i.triggers,runs:n.routineRuns,bots:n.bots}),g=e.routineRequest?.undo?.name??e.webhookRequest?.undo?.name??e.appTriggerRequest?.undo?.name??e.title;if(e.undone||!x)return!e.undone&&h.kind==="schedule"&&n.routinesLoadState==="loading"||!e.undone&&h.kind==="app"&&!i.loaded?null:r.jsxs("div",{"data-trigger-card":h.id,className:"flex w-full max-w-[840px] items-center gap-2 text-[13px] text-ink-tertiary",children:[e.undone?r.jsx(CE,{size:13}):r.jsx(fa,{size:13}),r.jsx("span",{children:e.undone?l("automations.card.removed"):`${l("automations.card.gone")} · ${g}`})]});const k=n.bots.find(_=>_.id===x.botId)?.name??l("routines.unavailableBot"),v=f_(x,k),y=Ox(x),b=x.runs.find(_=>_.status!=="queued"),w=x.nextRunAt!=null?M2(x.nextRunAt):null,j=b&&`${l("automations.card.lastRan",{when:Wf(b.startedAt??b.scheduledFor)})} ${IN(b).mark} ${IN(b).text}`;let S;y.state==="paused"?S=l("automations.status.paused"):y.state==="done"?S=[l("automations.status.done"),j].filter(Boolean).join(" · "):y.state==="needs-you"?S=l("automations.needsYou",{reason:y.reason??""}):j?S=[j,w&&l("automations.next",{when:w})].filter(Boolean).join(" · "):S=b_(x)??(w?l("automations.card.next",{when:w}):x.appTrigger?oie(x.appTrigger):p_(l("automations.notRunYet")));const E=()=>{!t||!e.requestId||d||(u(!0),m(void 0),K(`/api/threads/${t}/undo`,{method:"POST",body:JSON.stringify({requestId:e.requestId})}).catch(_=>m(_ instanceof hn&&_.body?.code==="changed-since"?l("automations.card.changedSince"):_ instanceof Error?_.message:String(_))).finally(()=>u(!1)))},A=n.bots.filter(_=>!_.hidden);return r.jsxs("section",{"data-trigger-card":x.id,"data-automation-status":y.state,"aria-label":v,className:"w-full max-w-[640px] rounded-xl border border-hairline/45 bg-card px-3.5 py-2.5 text-[13px]",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fa,{size:14,className:I("mt-0.5 shrink-0",y.state==="needs-you"?"text-warning":x.enabled?"text-accent":"text-ink-tertiary")}),r.jsx("button",{type:"button",onClick:()=>s({type:"showRoutines",view:"list",routineId:x.id}),className:"min-w-0 text-left font-medium leading-snug text-ink hover:text-accent-text",children:l("automations.card.setUp",{sentence:v})})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 pl-[22px] text-[12px]",children:[r.jsx("span",{className:I("min-w-0 flex-1 basis-48 truncate",y.state==="needs-you"?"text-warning":"text-ink-secondary"),title:S,children:S}),r.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-ink-secondary",children:[y.state!=="done"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",disabled:!!a.busy,onClick:()=>{a.toggle(x)},className:Bp,children:x.enabled?l("automations.pause"):l("automations.resume")}),r.jsx("span",{"aria-hidden":"true",children:"·"})]}),r.jsx("button",{type:"button",onClick:()=>c(!0),className:Bp,children:l("automations.edit")}),x.kind==="webhook"&&r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("button",{type:"button",disabled:!!a.busy,onClick:()=>{a.copyAddress(x.id)},className:Bp,children:a.copied===x.id?l("automations.address.copied"):l("automations.address.copy")})]}),t&&e.requestId&&r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("button",{type:"button",onClick:E,disabled:d,className:I(Bp,"text-accent"),children:d?l("automations.card.undoing"):l("automations.card.undo")})]})]})]}),(p||a.error)&&r.jsx("div",{role:"alert",className:"mt-1 pl-[22px] text-[12px] text-warning",children:p??a.error}),o&&Ke.createPortal(r.jsx(f.Suspense,{fallback:null,children:x.kind==="app"?r.jsx(Xie,{trigger:x.appTrigger,bots:A,onClose:()=>c(!1)}):x.kind==="schedule"?r.jsx(Jie,{routine:n.routines.find(_=>_.id===x.id),bots:A,plain:!0,onClose:()=>c(!1)}):r.jsx(Zie,{webhook:n.webhooks.find(_=>_.id===x.id),bots:A,onClose:()=>c(!1),onCredential:(_,N)=>iy(Yc(),N,_)})}),document.body)]})}const eoe={"spot.approval":"onboarding.hint.approval","spot.connector":"onboarding.hint.connector"},TN=new Set;function toe(){try{return se()}catch{return null}}function S_({id:e}){const t=toe(),n=t?.dispatch,s=et(),a=t?.state.config?.onboarding,[i]=f.useState(()=>!!n&&!s&&!!a?.completedAt&&!Sn(a,e)&&!TN.has(e));return f.useEffect(()=>{if(!i)return;TN.add(e);const o=lo(a,e);o&&K("/api/config",{method:"PUT",body:JSON.stringify(o)}).then(c=>n?.({type:"configStatus",config:c})).catch(()=>{})},[i]),i?r.jsx("p",{"data-card-hint":e,className:"text-[12px] leading-4 text-ink-secondary",children:l(eoe[e])}):null}const noe={create:"approval.status.routineScheduled",update:"approval.status.routineUpdated",pause:"approval.status.routinePaused",resume:"approval.status.routineResumed",run_now:"approval.status.routineRunQueued",delete:"approval.status.routineDeleted"},soe={create:"approval.status.skillEnabled",update:"approval.status.skillUpdated",enable:"approval.status.skillTurnedOn",disable:"approval.status.skillTurnedOff",delete:"approval.status.skillDeleted"},_N={create:"approval.applied.automation.create",update:"approval.applied.automation.update",pause:"approval.applied.automation.pause",resume:"approval.applied.automation.resume",run_now:"approval.applied.automation.runNow",delete:"approval.applied.automation.delete"},roe={waiting:"approval.applied.wait",fired:"approval.applied.waitFired",expired:"approval.applied.waitExpired",cancelled:"approval.applied.waitCancelled"},aoe={create:"approval.applied.skill.create",update:"approval.applied.skill.update",enable:"approval.applied.skill.enable",disable:"approval.applied.skill.disable",delete:"approval.applied.skill.delete"},ioe={name:"approval.applied.field.name",title:"approval.applied.field.title",description:"approval.applied.field.description",soul:"approval.applied.field.soul",cwd:"approval.applied.field.cwd",notifications:"approval.applied.field.notifications",speakReplies:"approval.applied.field.speakReplies"},I_=e=>!!(e.routineRequest&&!e.answered),bi=e=>!!(e?.teamSetupRequest||e?.mcpRequest||e?.lendingLift||rA(e?.skillRequest?.action));function C_(e){return e.mcpRequest?v_(e.mcpRequest.action):e.teamSetupRequest?l(e.teamSetupRequest.deletion?"approval.action.deleteBot":"approval.action.applySetup"):e.options[0]??l("approval.action.confirm")}function P2(e){const t=!!(e.routineRequest||e.skillRequest||e.profileRequest||e.modelRequest||bi(e));if(e.expired===!0||I_(e))return l(t||!e.tool?"approval.status.expired":"approval.status.timedOut");if(!e.answered)return;if(e.undone===!0)return l("approval.status.undone");if(e.answered!=="allow")return t?l("approval.status.cancelled"):l("approval.status.denied");if(e.teamSetupRequest)return l(e.teamSetupRequest.deletion?"approval.status.botDeleted":"approval.status.teamApplied");const n=e.routineRequest?.operation.action;if(n)return l(noe[n]);const s=e.skillRequest?.action;return s?l(soe[s]):e.profileRequest?l("approval.status.profileUpdated"):e.modelRequest?l("approval.status.modelChanged"):e.routineRequest?l("approval.status.routineConfirmed"):e.skillRequest?l("approval.status.skillConfirmed"):l("approval.status.allowed")}function zi(e){if(!e)return l("approval.tool.takeAction");const t=e.startsWith("mcp__")?e.split("__"):void 0,n=t?.[1],s=(t?t.slice(2).join("__"):e).replace(/_/g," "),i={Bash:"approval.tool.runCommand",Read:"approval.tool.readFile",Write:"approval.tool.writeFile",Edit:"approval.tool.editFile",WebFetch:"approval.tool.fetchWebPage",WebSearch:"approval.tool.searchWeb",schedule_routine:"approval.tool.scheduleRoutine",manage_routine:"approval.tool.changeRoutine",stage_skill:"approval.tool.enableSkill",update_skill:"approval.tool.updateSkill",update_profile:"approval.tool.updateProfile",shell:"approval.tool.runCommand",edit:"approval.tool.editFile",read:"approval.tool.readFile",fetch:"approval.tool.fetchWebPage",delete:"approval.tool.deleteFile",think:"approval.tool.think",other:"approval.tool.takeAction",tool:"approval.tool.useTool"}[e];if(i)return l(i);const o=t?q9(t.slice(2).join("__"))??s:s;return n&&!a_.has(n)?`${n} · ${o}`:o}function ooe(e){return e.type==="once"?new Date(e.at).toDateString()===new Date().toDateString()?l("approval.applied.today",{time:Bl(e.at)}):`${r_(e.at)}, ${Bl(e.at)}`:e.type==="cron"?A2(e)?T2(e):"":e.type==="interval"?d1({...e,anchorAt:e.anchorAt??0}):e.type==="limit_reset"?d1({...e,at:null}):d1(e)}function loe(e,t){const n=e.routineRequest;if(n){const u=n.operation,p=n.undo,m=p?.schedule&&u.action!=="pause"&&u.action!=="delete"&&u.action!=="run_now"?ooe(p.schedule):"",h=[p?.name??(u.action==="create"?u.routine.name:""),u.forBot?l("approval.applied.forBot",{target:`@${u.forBot.name}`}):""].filter(Boolean).join(" · ")+(m?`, ${m}`:""),x=u.action==="create"?!!n.resultId:u.action==="update"?!!(p?.before&&p.appliedUpdatedAt!==void 0):u.action==="pause"||u.action==="resume"?p?.appliedUpdatedAt!==void 0:u.action==="delete"?!!p?.before:!1;return{line:l(_N[u.action],{name:t,title:h}),canUndo:x}}const s=e.waitRequest;if(s)return{line:l(roe[s.settled??"waiting"],{name:t,title:s.label}),canUndo:!s.settled,cancels:!0};const a=e.webhookRequest;if(a){const u=a.operation.forBot?` · ${l("approval.applied.forBot",{target:`@${a.operation.forBot.name}`})}`:"";return{line:l(_N[a.operation.action],{name:t,title:`${a.undo?.name??""}${u}`}),canUndo:a.operation.action!=="run_now"}}const i=e.skillRequest;if(i)return{line:l(aoe[i.action],{name:t,title:i.name}),canUndo:i.action==="create"||i.action==="enable"||i.action==="disable"||!!i.previous};const o=e.profileRequest;if(o){const u=Qae.filter(m=>o.changes[m]!==void 0).map(m=>l(ioe[m])).join(", ");return{line:o.targetBotId===o.botId?l("approval.applied.profileOwn",{name:t,title:u}):l("approval.applied.profileOther",{name:t,target:`@${o.targetName}`,title:u}),canUndo:!!o.undo}}const c=e.modelRequest;if(c){const u=c.selection.model;return{line:c.targetBotId===c.botId?l("approval.applied.modelOwn",{name:t,title:u}):l("approval.applied.modelOther",{name:t,target:`@${c.targetName}`,title:u}),canUndo:!0}}const d=e.teamSetupRequest;if(d?.deletion)return{line:l("approval.applied.botDeleted",{name:t,target:`@${d.deletion.name}`}),canUndo:!1};if(d?.result){const u=m=>d.result.bots.filter(h=>h.action===m).map(h=>`@${h.name}`).join(", "),p=[u("created")&&l("approval.applied.teamAdded",{names:u("created")}),u("updated")&&l("approval.applied.teamUpdated",{names:u("updated")})].filter(Boolean).join("; ");return{line:l("approval.applied.teamSetup",{name:t,title:p}),canUndo:!!d.undo}}if(e.teamMemoryRequest)return{line:l("approval.applied.teamMemory",{name:t,title:e.subtitle.split(" — ")[0]??""}),canUndo:!!e.teamMemoryRequest.revision}}function coe({card:e,name:t,originalName:n,threadId:s,summary:a}){const[i,o]=f.useState(!1),[c,d]=f.useState(!1),[u,p]=f.useState(),[m,h]=f.useState(!1),[x,g]=f.useState(),k=f.useContext(Uu)?.state.config??null,v=Zs()!==!1,y=a.canUndo&&(!e.teamMemoryRequest||v),b=e.undone===!0,w=a.cancels===!0,j=e.skillRequest,S=j?.shared??(x&&x.requestId===e.requestId?x.shared:void 0),E=!!(j&&!rA(j.action)&&!S&&!b&&s&&e.requestId)&&Yre(k)==="ask",A=()=>{const R=e.requestId;!s||!R||m||(h(!0),p(void 0),K(`/api/threads/${s}/share-skill`,{method:"POST",body:JSON.stringify({requestId:R})}).then(O=>g({requestId:R,shared:O.shared})).catch(O=>{p(l("approval.applied.shareFailed",{error:O instanceof Error?O.message:String(O)}))}).finally(()=>h(!1)))},_=S?.assigned.filter(R=>R.botId!==j?.botId).map(R=>R.name)??[],N=S?.skipped.map(R=>R.name)??[],C=()=>{!s||!e.requestId||c||(d(!0),p(void 0),K(`/api/threads/${s}/undo`,{method:"POST",body:JSON.stringify({requestId:e.requestId})}).catch(R=>{w&&R instanceof hn&&R.status===409||p(R instanceof hn&&R.body?.code==="changed-since"?l("approval.applied.changedSince"):w?l("approval.applied.cancelFailed",{name:t}):l("approval.applied.undoFailed",{error:R instanceof Error?R.message:String(R)}))}).finally(()=>d(!1)))};return r.jsxs("div",{className:"w-full max-w-[840px] text-[13px] text-ink-tertiary","data-applied-change":t,children:[r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 leading-5",children:[b?r.jsx(CE,{size:13,className:"shrink-0 self-center"}):r.jsx(Ie,{size:13,className:"shrink-0 self-center text-success/80"}),r.jsxs("span",{className:"min-w-0 break-words",children:[a.line,S&&!b&&r.jsxs("span",{children:[" · ",_.length?l("approval.applied.sharedSkill",{names:_.join(", ")}):l("approval.applied.sharedSkillNobody")]}),b&&!w&&r.jsxs("span",{children:[" · ",l("approval.applied.undone")]})]}),!b&&y&&s&&r.jsx("button",{type:"button",onClick:C,disabled:c,className:I(ly,"text-accent disabled:opacity-60"),children:w?l(c?"approval.applied.cancelling":"common.cancel"):l(c?"approval.applied.undoing":"approval.applied.undo")}),E&&r.jsx("button",{type:"button",onClick:A,disabled:m,className:"rounded-md px-1.5 py-0.5 font-medium text-accent hover:bg-inset disabled:opacity-60",children:m?l("approval.applied.sharingSkill"):l("approval.applied.shareSkill")}),r.jsx("button",{type:"button","aria-expanded":i,onClick:()=>o(R=>!R),className:I(ly,"text-ink-tertiary hover:text-ink-secondary"),children:i?l("approval.applied.hideDetails"):l("approval.applied.details")})]}),S&&!b&&N.length>0&&r.jsx("div",{className:"mt-1 text-[13px] text-ink-tertiary",children:l("approval.applied.shareSkipped",{names:N.join(", ")})}),!u&&!S&&!b&&j?.shareError&&r.jsx("div",{className:"mt-1 text-[13px] text-warning",children:l("approval.applied.shareFailed",{error:j.shareError})}),u&&r.jsx("div",{role:"alert",className:"mt-1 text-[13px] text-warning",children:u}),i&&r.jsx("pre",{tabIndex:0,"aria-label":l("approval.aria.appliedDetails"),className:"mt-1.5 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-2xl bg-inset px-4 py-3 font-mono text-[13px] leading-relaxed text-ink",children:rt()!=="en"&&e.waitRequest?l("approval.applied.waitFollowUp",{name:n??t,followUp:e.waitRequest.followUp??""}):e.subtitle})]})}const doe="inline-flex min-w-0 max-w-full items-baseline rounded-full bg-inset px-2 pb-px pt-[3px] font-mono text-[13px] leading-5 text-ink",ly="inline-flex h-6 items-center rounded-full px-2 hover:bg-inset focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus";function uoe(e){const t=e.split(`
113
113
  `,1)[0]??"";return t.length>80?`${t.slice(0,79)}…`:t}function MN({header:e,summary:t,detail:n,showDetailInline:s,outcome:a,allowed:i,expired:o=!1,byVoice:c,waiting:d,answeredBelow:u}){const[p,m]=f.useState(!1),h=()=>m(x=>!x);return d&&u?r.jsxs("div",{"data-approval-row":"pending",className:"sr-only",children:[e,t?` ${t}`:"",n&&s?` ${uoe(n)}`:"",". ",l("approval.status.waitingAnswer")]}):r.jsxs("div",{"data-tour":d?"approval":void 0,"data-approval-row":d?"pending":"settled",className:I("w-full max-w-[840px] text-[13px]",d?"text-ink-secondary":"text-ink-tertiary"),children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1 leading-5",children:[d?r.jsx(cx,{size:14,className:"shrink-0 self-center text-accent","aria-hidden":"true"}):i?r.jsx(Ie,{size:14,className:"shrink-0 self-center text-success","aria-hidden":"true"}):o?r.jsx(zu,{size:14,className:"shrink-0 self-center","aria-hidden":"true"}):r.jsx(Ae,{size:14,className:"shrink-0 self-center","aria-hidden":"true"}),r.jsx("span",{className:I("min-w-0 break-words",d&&"text-ink"),children:e}),t&&r.jsx("span",{className:"min-w-0 break-words",children:d?t:`· ${t}`}),n&&s&&r.jsx("span",{role:"group","aria-label":l("approval.aria.details"),className:"min-w-0 max-w-full",children:r.jsx("button",{type:"button","aria-expanded":p,title:n,onClick:h,className:I(doe,"text-left hover:bg-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"),children:r.jsx("span",{className:"truncate",children:n})})}),r.jsxs("span",{className:"shrink-0","aria-live":"polite",children:["· ",a??l("approval.status.waitingAnswer")]}),c,n&&!s&&r.jsx("button",{type:"button","aria-expanded":p,onClick:h,className:I(ly,"text-ink-tertiary hover:text-ink-secondary"),children:p?l("approval.applied.hideDetails"):l("approval.applied.details")})]}),p&&r.jsx("pre",{tabIndex:0,"aria-label":l("approval.aria.details"),className:"mt-1.5 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-2xl bg-inset px-4 py-3 font-mono text-[12px] leading-relaxed text-ink",children:n})]})}function E_({bot:e,message:t,threadId:n}){const s=t.card;if(!s)return null;if(d_(s))return r.jsx(Qie,{card:s,threadId:n});const a=s.autoApplied===!0&&s.answered==="allow"&&!s.held?loe(s,e?.name??l("approval.someone")):void 0;if(a)return r.jsx(coe,{card:s,name:e?.name??l("approval.someone"),originalName:t.from?.name,threadId:n,summary:a});const i=s.answered,o=s.expired===!0||I_(s),c=s.answeredBy?.via,d=c?r.jsxs("span",{className:"text-ink-tertiary",children:["· ",l(c==="call"?"approval.status.byVoice":"approval.status.byReaction")]}):null,u=!!s.routineRequest,p=!!s.skillRequest,m=!!s.profileRequest,h=bi(s),x=s.routineRequest?.operation.action,g=s.skillRequest?.action,k=Ru(s.heldCode,s.held),v=P2(s),y=C2(s),b=u?x==="create"?"schedule_routine":"manage_routine":p?g==="update"?"update_skill":"stage_skill":m?"update_profile":(!s.tool||s.tool==="tool")&&(s.title??"").startsWith("mcp__")?s.title:s.tool,w=m&&s.profileRequest?s.profileRequest.targetBotId===s.profileRequest.botId?l("approval.card.profileWantsToOwn",{name:e?.name??l("approval.someone")}):l("approval.card.profileWantsToOther",{name:e?.name??l("approval.someone"),target:s.profileRequest.targetName}):void 0,j=zx(s,e?.name??l("approval.someone"));if(j){const S=s.computerAsk?.state,E=S==="asking"||S==="failed";return r.jsx("div",{"data-computer-ask":S,className:"w-full",children:r.jsx(MN,{header:j.line,summary:E?j.reason:void 0,detail:"",showDetailInline:!1,outcome:j.outcome,allowed:S==="on"||S==="turning-on",byVoice:d,waiting:E,answeredBelow:E&&!s.dismissed})})}if(!u&&!p&&!m&&!h&&!s.modelRequest){const S=!i&&!o,E=R2(s,e?.name??l("approval.someone")),A=E?E.line:y?S?y.headline:y.headline.replace(/\s*[??]$/,""):e?l("approval.card.namedWantsTo",{name:e.name,action:zi(b)}):l("approval.card.wantsTo",{action:zi(b)}),_=r.jsx(MN,{header:A,summary:y?.summary||void 0,detail:E?.detail??lu(s),showDetailInline:!y,outcome:v,allowed:i==="allow"&&!o,expired:o,byVoice:d,waiting:S,answeredBelow:!!(s.requestId&&s.tool&&!s.dismissed)});return S&&s.requestId&&s.tool?r.jsxs("div",{className:"flex w-full flex-col gap-1",children:[_,r.jsx(S_,{id:"spot.approval"})]}):_}return r.jsxs("div",{"data-tour":i||o?void 0:"approval",className:I("w-full max-w-[840px] rounded-2xl border bg-card p-4",i||o?"border-hairline/30 opacity-70":"border-accent/40"),children:[r.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[r.jsx("div",{className:"text-[15px] font-semibold text-ink",children:h?s.title:y?y.headline:w??r.jsx(r.Fragment,{children:e?l("approval.card.namedWantsTo",{name:e.name,action:zi(b)}):l("approval.card.wantsTo",{action:zi(b)})})}),b&&!h&&!y&&r.jsx("span",{className:"shrink-0 font-mono text-[11px] text-ink-secondary",children:b})]}),y?.summary&&r.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:y.summary}),r.jsx("pre",{tabIndex:0,"aria-label":u?l("approval.aria.routineDetails"):p?l("approval.aria.skillDetails"):m?l("approval.aria.profileChange"):l("approval.aria.details"),className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-inset px-3 py-2 font-mono text-[13px] leading-relaxed text-ink",children:lu(s)}),s.skillRequest&&r.jsx(D9,{request:s.skillRequest}),k&&r.jsx("div",{className:"mt-2 rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:k}),r.jsx("div",{className:"mt-3 flex items-center gap-1.5 text-[13px] text-ink-secondary",children:v?r.jsxs(r.Fragment,{children:[i==="allow"&&!o?r.jsx(Ie,{size:14,className:"text-success"}):r.jsx(Ae,{size:14})," ",v,d]}):r.jsxs(r.Fragment,{children:[r.jsx(cx,{size:14,className:"text-accent"}),u||p||m||h?l("approval.status.waitingConfirmation"):l("approval.status.waitingAnswer")]})})]})}const poe=/^This message is too large for (.+)\. Start a new chat or pick a model that accepts more\.$/;function moe(e){return poe.exec(e.trim())?.[1]??null}const A_=/^(?:TypeError:\s*)?(?:Failed to fetch|NetworkError when attempting to fetch resource\.?|Load failed|fetch failed)$/i,foe=/^(?:TimeoutError:\s*)?(?:The operation was aborted due to timeout|signal timed out|The operation timed out\.?)$/i,hoe=[A_,foe,/^\d{3}(?: [A-Za-z][\w '-]*)?$/,/[{[]\s*"[\w$-]+"\s*:/,/\n\s+at \S/,/^[A-Z][a-z]+Error: /,/\b(?:E(?:CONNRESET|CONNREFUSED|CONNABORTED|NOTFOUND|AI_AGAIN|TIMEDOUT|PIPE|ACCES|PERM|NOENT|ADDRINUSE|HOSTUNREACH|NETUNREACH)|ERR_[A-Z_]{3,})\b/,/^(?:[\w-]+ ){0,2}(?:API Error|HTTP|status(?: code)?)[:\s]+\d{3}\b/i,/Unexpected token .* in JSON|is not valid JSON|Unexpected end of JSON input/,/^\S+(?: \S+){0,2} exited (?:with code )?(?:-?\d+|null|SIG[A-Z0-9]+)\b/,/^[a-z]+(?:_[a-z0-9]+)+$/],xoe=[[A_,"error.plain.unreachable"],[/\b429\b|rate.?limit|too many requests/i,"error.plain.rateLimited"],[/overloaded|\b529\b|\b503\b|capacity|service unavailable/i,"error.plain.busy"],[/ECONNRESET|ECONNREFUSED|ECONNABORTED|EPIPE|ENOTFOUND|EAI_AGAIN|EHOSTUNREACH|ENETUNREACH|socket hang up|connection (?:reset|refused)/i,"error.plain.connection"],[/timeout|timed out|ETIMEDOUT/i,"error.plain.timeout"],[/\b(?:EACCES|EPERM)\b/,"error.plain.permission"],[/\b40[13]\b|unauthori[sz]ed|forbidden/i,"error.plain.access"],[/\b404\b|not found|ENOENT/i,"error.plain.notFound"],[/\b413\b|too large/i,"error.plain.tooLarge"],[/\b5\d\d\b|internal server error|bad gateway/i,"error.plain.server"]];function RN(e){const t=e.trim();return!!t&&hoe.some(n=>n.test(t))}const goe=/^(?:[\w-]+ ){0,2}(?:API Error|HTTP|status(?: code)?)[:\s]+\d{3}\b[\s:.-]*/i,boe=/^(?:[A-Z][a-z]+ ?){1,4}\.?$/;function D2(e){const t=moe(e);if(t)return l("chat.error.requestTooLarge",{model:t});if(!RN(e))return;const n=e.trim(),s=n.replace(goe,"").trim();if(s!==n&&/[A-Za-z]+\s+[A-Za-z]+/.test(s)&&!boe.test(s)&&!RN(s))return s;const a=xoe.find(([i])=>i.test(n))?.[1]??"error.plain.generic";return l(a)}const yoe={bash:"toolStep.runCommand",shell:"toolStep.runCommand",terminal:"toolStep.runCommand",run_command:"toolStep.runCommand",execute:"toolStep.runCommand",computer_exec:"toolStep.runCommand",read:"toolStep.readFile",read_file:"toolStep.readFile",view:"toolStep.readFile",write:"toolStep.writeFile",create_file:"toolStep.writeFile",edit:"toolStep.editFile",multiedit:"toolStep.editFile",str_replace:"toolStep.editFile",apply_patch:"toolStep.editFile",notebookedit:"toolStep.editFile",delete:"toolStep.deleteFile",grep:"toolStep.searchFiles",glob:"toolStep.searchFiles",find:"toolStep.searchFiles",search:"toolStep.searchFiles",ls:"toolStep.searchFiles",websearch:"toolStep.searchWeb",web_search:"toolStep.searchWeb",webfetch:"toolStep.openWebPage",web_fetch:"toolStep.openWebPage",fetch:"toolStep.openWebPage",open_url:"toolStep.openWebPage",screenshot:"toolStep.lookAtScreen",computer_screenshot:"toolStep.lookAtScreen",click:"toolStep.useComputer",type_text:"toolStep.useComputer",press_key:"toolStep.useComputer",scroll:"toolStep.useComputer",computer_batch:"toolStep.useComputer",todowrite:"toolStep.updatePlan",update_plan:"toolStep.updatePlan",task:"toolStep.askHelper",agent:"toolStep.askHelper",think:"toolStep.think",list_bots:"toolStep.checkTeam",trigger:"toolStep.manageAutomations",trigger_info:"toolStep.checkAutomations",tool:"toolStep.useTool",other:"toolStep.useTool",mcp:"toolStep.useTool"};function ON(e){const t=e.replace(/\s+/g," ").trim();return t&&t[0].toLocaleUpperCase()+t.slice(1)}function T_(e,t){return t.whose?`${e} · ${l("toolStep.usingWhose",{person:t.whose.person,app:t.whose.app})}`:e}function Fl(e){return T_(koe(e),e)}function koe(e){const{name:t}=e;if(e.label)return e.label;if(e.summary)return l("toolStep.runCommand");if(go(e.nameCode))return ai(e,t);if(/\s/.test(t))return t;const n=t.replace(/^mcp__.+?__(?=.)/,"");if(/(?:^|_)browser_/i.test(n))return l("toolStep.useBrowser");const s=yoe[n.toLowerCase()];if(s)return l(s);const a=q9(n);if(a)return ON(a);const i=n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_\-.:]+/g," ").toLowerCase();return ON(i)||l("toolStep.useTool")}const Fm=/^(?:recovery|notice):\s*/;function __(e){return!!e?.snapshot&&Mee(e)}function M_(e,t){return e.setup&&!e.claudeUpdate&&__(t)?t:void 0}function voe(e){return e?.driverKind==="claudeAgent"&&!e.readOnly?e:void 0}function $2(e,t){return e&&t.find(n=>n.instanceId===e.modelSelection.instanceId)}function R_(e){const t=Nr(e.name)??e.name;return{cause:t,notice:go(e.nameCode)?ai(e,t):null}}function woe(e,t){return go(e.nameCode)?ai(e,t):D2(t)??t}function O_(e,t,n,s=!1){if(n)return n.title;if(bx(e.name))return l("chat.turnStopped");const a=Nr(e.name);if(a!==null&&Gd(a))return l("chat.turnStopped");if(a!==null&&e.partial)return l("chat.error.partialPreview");if(a===null&&go(e.nameCode))return ai(e,e.name.replace(Fm,""));if(a===null)return s?e.name:Fm.test(e.name)?e.name.replace(Fm,""):Fl(e);const i=M_(e,t);return i?l("sidebar.preview.signedOut",{name:i.displayName}):woe(e,a)}const hl="builtin:pinned",du="builtin:channels",uu="builtin:bot-chats",Ba="builtin:bots",zN="builtin:attention",LN="builtin:pinned-threads",PN="builtin:tools",cy="section:",joe={working:"routines.goal.working",completed:"routines.goal.completed","needs-input":"routines.goal.needs-input",blocked:"routines.goal.blocked","limit-reached":"routines.goal.limit-reached",paused:"routines.goal.paused",stopped:"routines.goal.stopped",failed:"routines.goal.failed"};function Vf(e){return[...new Set(e.filter(Boolean))]}function dy(e){return`${cy}${e}`}function B2(e){return e.startsWith(cy)?e.slice(cy.length):null}function Noe(e){return e===hl?"Pinned":e===du?"Group chats":e===uu?"Bot threads":e===Ba?"Bots":B2(e)??e}function Soe(e){const t=e.detail?.replace(/\s+/g," ").trim(),n=e.goal.replace(/\s+/g," ").trim(),s=t||n,a=l(joe[e.status]);return s?`${a}: ${s}`:a}function z_(e,t){if(e.dismissed)return e.label;const n=e.status==="connected"?"connectors.card.connected":e.status==="authorizing"?"connectors.card.waiting":"connectors.card.connectSecurely";return`${e.label} · ${t(n)}`}function L_(e,t){return e!=="icons"&&t.trim().length===0}function Ioe(e,t,n,s){return L_(n,s)&&t.includes(e)}function Coe(e,t,n){return e&&t!=="icons"&&n>0}function Eoe(e,t){const n=t?.universalPins===!0,s=m=>!$w(m,t?.viewerEmail)||t?.searching===!0&&!!m.defaultBot&&!UA(m,t.viewerEmail),a=e.filter(m=>!m.hidden&&s(m)&&m.id!==t?.welcoming),i=a.filter(m=>!!m.pinned&&(n||!m.chiefOfStaff||!!m.section)),o=new Set(i.map(m=>m.id)),c=a.find(m=>m.chiefOfStaff&&!m.section&&!o.has(m.id))??null,d=a.filter(m=>m.chiefOfStaff&&!!m.section&&!o.has(m.id)),u=a.filter(m=>!m.chiefOfStaff&&!!m.section&&!o.has(m.id)),p=a.filter(m=>(!m.chiefOfStaff||t?.searching===!0&&m!==c)&&!m.section&&!o.has(m.id));return{unsectionedChief:c,pinnedBots:i,sectionChiefs:d,sectionedBots:u,unsectionedBots:p}}function Aoe(e,t){const n=e.unsectionedChief??e.pinnedBots.find(a=>a.chiefOfStaff&&!a.section)??[...e.pinnedBots,...e.unsectionedBots].find(a=>a.id===t)??null;if(!n)return{...e,primary:n};const s=a=>a.filter(i=>i.id!==n.id);return{...e,primary:n,unsectionedChief:null,pinnedBots:s(e.pinnedBots),unsectionedBots:s(e.unsectionedBots)}}function Toe(e,t){const n=s=>{const a=s.map(t);return[...s.filter((i,o)=>a[o]),...s.filter((i,o)=>!a[o])]};return{pinnedBots:n(e.pinnedBots),sectionedBots:n(e.sectionedBots),unsectionedBots:n(e.unsectionedBots)}}function _oe(e){const t=e.filter(i=>!!i.dm),n=e.filter(i=>!i.dm),s=n.filter(i=>!!i.section),a=n.filter(i=>!i.section);return{botChats:t,sectionedRooms:s,unsectionedRooms:a}}function P_(e,t){const n=Vf(e),s=new Set(n),a=Vf(t).filter(i=>s.has(i));if(a.length===0)return n;for(const i of n){if(a.includes(i))continue;const o=n.indexOf(i),c=n.slice(0,o).reverse(),d=n.slice(o+1),u=c.find(x=>a.includes(x)),p=d.find(x=>a.includes(x)),m=u?a.indexOf(u):-1,h=p?a.indexOf(p):-1;m>=0&&(h<0||m<h)?a.splice(m+1,0,i):h>=0?a.splice(h,0,i):a.push(i)}return a}const DN=[hl,Ba,du,uu];function Moe(e){return[...DN.filter(t=>e.includes(t)),...e.filter(t=>!DN.includes(t))]}function Roe(e,t){return P_(Moe(e),t)}function Ooe(e,t,n){const s=e.indexOf(t),a=s+n;if(s<0||a<0||a>=e.length)return e;const i=[...e],[o]=i.splice(s,1);return i.splice(a,0,o),i}function zoe(e,t,n,s){if(t===n||!e.includes(t)||!e.includes(n))return e;const a=e.filter(o=>o!==t);let i=a.indexOf(n);return s==="after"&&(i+=1),a.splice(i,0,t),a}function Loe(e,t){const n=Vf(e),s=Vf(t),a=new Set(s);for(let i=0;i<n.length;i+=1){const o=n[i];if(a.has(o))continue;let c=s.length,d=!1;for(let u=i-1;u>=0;u-=1){const p=s.indexOf(n[u]);if(p>=0){c=p+1,d=!0;break}}if(!d)for(let u=i+1;u<n.length;u+=1){const p=s.indexOf(n[u]);if(p>=0){c=p;break}}s.splice(c,0,o),a.add(o)}return s}function $N(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function D_(e){return!!e&&(typeof e.working=="boolean"||e.busyBotId!==void 0)}function $_(e,t){return e.tasks?.find(n=>n.threadId===t)}function Zu(e,t){const n=$_(e,t);return D_(n)?!!(n.working||n.busyBotId):t===e.threadId&&!!(e.working||e.busyBotId)}function F2(e,t){const n=$_(e,t);return D_(n)?n.busyBotId??null:t===e.threadId?e.busyBotId??null:null}function B_(e){const t=[e.busyBotId,...(e.tasks??[]).map(n=>n.busyBotId)].filter(n=>typeof n=="string"&&n.length>0);return[...new Set(t)]}function Poe(e){return(e.tasks??[]).filter(t=>t.threadId!==e.threadId&&Zu(e,t.threadId)).length}function F_(e,t){return(e.queue??[]).filter(n=>n.threadId===t&&n.state==="queued")}function q2(e,t){const n=e.waitingForBotId?t(e.waitingForBotId):void 0;return n?l("room.queue.waitingFor",{name:n,position:e.position,of:e.of}):l("room.queue.waiting",{position:e.position,of:e.of})}function Doe(e,t){const n=e.busyBotId??B_(e)[0],s=(e.queue??[]).filter(a=>a.state==="queued");if(n){const a=t(n)??l("sidebar.preview.aBot");return s.length?l("sidebar.preview.botWorkingQueued",{name:a,count:s.length}):l("sidebar.preview.botWorking",{name:a})}if(s[0])return l("room.queue.member",{name:t(s[0].botId)??l("sidebar.preview.aBot"),status:q2(s[0],t)})}const $oe=["value","label","title","caption"],Boe=/^(?:brief|chat\.notice|server\.meetings)\.[\w.]{1,80}$/,Foe=new Set(["clock","bareClock","longDate","shortDate"]),qoe=8,Uoe=3,Hoe=400,Gf=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Woe(e,t){if(typeof e=="string")return e.slice(0,Hoe);if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(Gf(e))return typeof e.at=="number"&&Number.isFinite(e.at)&&Foe.has(e.style)?{at:e.at,style:e.style,...typeof e.zone=="string"&&e.zone.length<=64?{zone:e.zone}:{}}:q_(e,t+1)}function q_(e,t){if(!Gf(e)||typeof e.key!="string"||!Boe.test(e.key)||t>Uoe)return;if(e.params===void 0)return{key:e.key};if(!Gf(e.params))return;const n=Object.entries(e.params).slice(0,qoe).map(([s,a])=>[s,Woe(a,t)]);if(!n.some(([s,a])=>a===void 0||!/^\w{1,32}$/.test(s)))return{key:e.key,params:Object.fromEntries(n)}}function Koe(e){if(!Gf(e))return;const t={};for(const n of $oe){const s=q_(e[n],0);s&&(t[n]=s)}return Object.keys(t).length?t:void 0}const Voe={clock:{hour:"2-digit",minute:"2-digit"},bareClock:{hour:"2-digit",minute:"2-digit"},longDate:{weekday:"long",month:"long",day:"numeric"},shortDate:{weekday:"short",month:"short",day:"numeric"}};function Goe(e){const t=new Intl.DateTimeFormat(dt(),{...Voe[e.style],timeZone:e.zone??"UTC"}).format(e.at);return e.style==="clock"&&!e.zone?`${t} UTC`:t}function Yoe(e){return typeof e!="object"?e:"at"in e?Goe(e):U_(e)}function U_(e){if(e.key.startsWith("chat.notice.")){if(Object.values(e.params??{}).some(a=>typeof a=="object"))throw new Error(`notice ${e.key} takes flat params`);return F9(e.key,e.params)}if(!e.key.startsWith("brief.")||!Object.hasOwn(br,e.key))throw new Error(`unknown card text ${e.key}`);const t=Object.fromEntries(Object.entries(e.params??{}).map(([a,i])=>[a,Yoe(i)]));if(e.key.startsWith("brief.inbox.")&&typeof t.amountValue=="string"&&Number.isFinite(Number(t.amountValue))&&(t.amount=new Intl.NumberFormat(dt()).format(Number(t.amountValue))),e.key.startsWith("brief.inbox.")&&typeof t.deadline=="string"&&/^\d{4}-\d{2}-\d{2}(?:T.*)?$/.test(t.deadline)){const a=new Date(t.deadline),i=new Date(t.deadline.slice(0,10));Number.isFinite(a.getTime())&&Number.isFinite(i.getTime())&&i.toISOString().slice(0,10)===t.deadline.slice(0,10)&&(t.deadline=new Intl.DateTimeFormat(dt(),{dateStyle:"medium",...t.deadline.length===10?{timeZone:"UTC"}:{}}).format(a))}if([...l(e.key).matchAll(/\{(\w+)\}/g)].some(([,a])=>!Object.hasOwn(t,a)))throw new Error(`card text ${e.key} lacks a param`);return l(e.key,t)}function H_(e){const t=Koe(e.i18n),n={...e};for(const[s,a]of Object.entries(t??{}))try{n[s]=U_(a)}catch{continue}return e.children&&(n.children=e.children.map(H_)),n}function W_(e,t,n=rt()){return!t||n==="en"?e:{...e,root:H_(e.root)}}const ro={label:80,fieldValue:2e3,fallback:1500},x1=/^[\w-]{1,128}$/;function Joe(e){if(e.type!=="open_thread"||!Ya(e.payload))return;const{botId:t,groupId:n,threadId:s}=e.payload;if(!(typeof s!="string"||!x1.test(s))){if(typeof t=="string"&&x1.test(t)&&n===void 0)return{botId:t,threadId:s};if(typeof n=="string"&&x1.test(n)&&t===void 0)return{groupId:n,threadId:s}}}const K_="open_phone_pairing",Zoe=e=>e.type==="open_url"||e.type==="open_thread"||e.type===K_,Xoe=new Set(["Select","DatePicker","TimePicker","DayPicker","Checkbox","RadioGroup","Input","Textarea"]),Oa=["mon","tue","wed","thu","fri","sat","sun"];function Ya(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function V_(e){return e.allowOther===!0&&(e.type==="Select"||e.type==="RadioGroup"||e.type==="ListView"&&typeof e.name=="string")}const Me=(e,t)=>typeof e[t]=="string"?e[t]:void 0,Bt=(e,t)=>typeof e[t]=="number"?e[t]:void 0;function G_(e,t){const n=e[t];return Ya(n)&&typeof n.label=="string"&&Ya(n.action)?n:void 0}function ql(e,t,n=[]){t(e,n);const s=[...n,e];for(const a of Array.isArray(e.children)?e.children:[])Ya(a)&&ql(a,t,s)}function uy(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return e[n]}function BN(e){let t="";return ql(e,n=>{t||n.type!=="Title"&&n.type!=="Text"||typeof n.value!="string"||typeof n.width=="number"||(t=n.value.replace(/\s+/g," ").trim().slice(0,ro.label))}),t}function Qoe(e,t){const n=[];ql(e,(a,i)=>{if(a.type==="Button"){if(a.disabled===!0)return;const o=uy(i,m=>m.type==="Form"),c=Ya(a.onClickAction)?a.onClickAction:void 0,d=a.submit===!0&&Ya(o?.onSubmitAction)?o.onSubmitAction:void 0,u=c??d;if(!u)return;const p=uy(i,m=>m.type==="ListViewItem"||m.type==="Table.Row"||m.type==="Row");n.push({ref:a.id,label:Me(a,"label")??"",action:u,kind:"button",...a.submit===!0?{tone:"submit"}:{},...p?{row:BN(p)}:{}})}else a.type==="ListViewItem"&&Ya(a.onClickAction)&&n.push({ref:a.id,label:BN(a),action:a.onClickAction,kind:"item"})});for(const a of["confirm","cancel"]){const i=G_(e,a);i&&n.push({ref:a,label:i.label,action:i.action,tone:a,kind:a})}const s=new Map;for(const a of n)s.set(a.label,(s.get(a.label)??0)+1);return n.map(({row:a,...i})=>({...i,...Zoe(i.action)?{client:!0}:{},label:a&&i.label&&(s.get(i.label)??0)>1?`${i.label}: ${a}`.slice(0,ro.label*2):i.label}))}function ele(e){return Qoe(e)}function tle(e,t){let n=e;return ql(e,(s,a)=>{s.id===t&&(n=uy(a,i=>i.type==="Form")??e)}),n}function py(e,t=e){const n=new Map;ql(t,a=>{a.type==="Label"&&typeof a.fieldName=="string"&&typeof a.value=="string"&&n.set(a.fieldName,a.value)});const s=[];return ql(e,a=>{if(typeof a.name!="string"||!(Xoe.has(a.type)||a.type==="ListView"))return;const i=a.type==="ListView"?Me(a,"title"):Me(a,"label");s.push({name:a.name,type:a.type,node:a,label:n.get(a.name)??i??a.name})}),s}function nle(e){const t={};for(const n of py(e))t[n.name]=n.type==="Checkbox"?n.node.defaultChecked===!0:Me(n.node,"defaultValue")??"";return t}function sle(e){const t=e.split(",").filter(Boolean);if(t.length===7)return"Every day";if(t.join(",")==="mon,tue,wed,thu,fri")return"Weekdays";if(t.join(",")==="sat,sun")return"Weekends";const n={mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat",sun:"Sun"};return t.map(s=>n[s]??s).join(", ")}function qm(e){switch(e.type){case"Text":case"Title":case"Caption":case"Label":return Me(e,"value")??"";case"Markdown":return(Me(e,"value")??"").replace(/\s+/g," ");case"Badge":return Me(e,"label")??"";case"Button":return e.label?`[${String(e.label)}]`:"";case"Image":return e.alt?`[image: ${String(e.alt)}]`:"[image]";case"Progress":return[Me(e,"label"),`${Math.round((Bt(e,"value")??0)*100)}%`].filter(Boolean).join(" ");case"Chart":return`[chart: ${(Array.isArray(e.series)?e.series:[]).map(t=>t.label??t.dataKey).join(", ")}]`;case"Checkbox":return`[ ] ${Me(e,"label")??String(e.name)}`;case"Select":case"RadioGroup":return`(${(Array.isArray(e.options)?e.options:[]).slice(0,6).map(t=>t.label).join(" / ")})`;case"DayPicker":return`[${typeof e.defaultValue=="string"?sle(e.defaultValue):"days"}]`;case"Input":case"Textarea":case"DatePicker":case"TimePicker":return`[${Me(e,"placeholder")??String(e.name)}]`;default:return(Array.isArray(e.children)?e.children:[]).map(qm).filter(Boolean).join(" · ")}}function Y_(e){const t=Array.isArray(e.children)?e.children:[];return e.type==="ListViewItem"?[`- ${qm(e)}`]:e.type==="Table"?t.map(s=>(Array.isArray(s.children)?s.children:[]).map(qm).join(" | ")):e.type==="Markdown"?[Me(e,"value")??""]:e.type==="Col"||e.type==="Form"||e.type==="Transition"||e.type==="Box"&&e.direction!=="row"?t.flatMap(Y_):[qm(e)]}function rle(e){const t=[],n=Ya(e.status)&&typeof e.status.text=="string"?e.status.text:"";n&&t.push(n);const s=Me(e,"title"),a=[s?`**${s}**`:"",Me(e,"caption"),Me(e,"meta")].filter(Boolean).join(" · ");a&&t.push(a);for(const c of Array.isArray(e.children)?e.children:[])t.push(...Y_(c));const i=["confirm","cancel"].map(c=>G_(e,c)?.label).filter(Boolean).map(c=>`[${c}]`).join(" ");i&&t.push(i);const o=t.map(c=>c.trimEnd()).filter(Boolean).join(`
114
- `);return o.length<=ro.fallback?o:`${o.slice(0,ro.fallback-1).trimEnd()}…`}function J_(e){return e?.findLast(t=>!K7(t)&&t.kind!=="screen")}function Z_(e,t,n,s){return e.activity==="waiting-on-you"?l("sidebar.preview.waiting"):e.waitingForTeammates?l("sidebar.preview.waitingOnTeammate"):e.busy?l("sidebar.preview.working"):ile(e,t,n,s)}function ale(e){const t=e.kind==="activity"?e.tool:void 0;return!!t&&!e.dataResult&&Nr(t.name)===null&&!bx(t.name)&&!Fm.test(t.name)}function X_(e,t,n){if(n||!ale(t))return t;for(let s=e.length-1;s>=0;s--){const a=e[s];if(a.role==="user")break;if(a.kind!=="activity"&&!K7(a)&&a.kind!=="screen")return a}return t}function ile(e,t,n,s){const a=J_(t);if(!a)return"";const i=X_(t,a,s);if(i.kind==="options"&&i.card)return i.helperIntro?l(s?"helperIntro.title":e.chiefOfStaff?"helperIntro.hello":"helperIntro.hi.helper",{name:e.name}):i.card.requestId&&i.card.tool&&!i.card.questionRequest&&P2(i.card)||i.card.title;if(i.kind==="activity"&&i.tool)return O_(i.tool,$2(e,n),i.dataResult,s);if(i.kind==="connector"&&i.connector)return z_(i.connector,l);if(i.kind==="routine.run"&&i.routineRun)return cle(i.routineRun);const o=Ls(i);return o?`${o.name}: ${Yd(o.body)}`:i.role!=="user"&&Gd(i.text??"")?l("chat.turnStopped"):Yd(Wu(ole(i)??i.text??""))}function ole(e){if(e.kind!=="widget"||!e.widget?.root||e.serverCard!==!0)return;const t=W_(e.widget,!0);return t===e.widget?void 0:rle(t.root)}const lle={completed:"automations.preview.finished",failed:"automations.preview.failed",waiting:"automations.preview.needsYou",cancelled:"automations.preview.stopped",missed:"automations.preview.missed",running:"automations.preview.running",queued:"automations.preview.running"};function cle(e){return l(lle[e.status],{name:e.routineName})}function dle(e,t,n,s){const a=Doe(e,u=>t.find(p=>p.id===u)?.name);if(a)return a;if(e.working)return l("sidebar.preview.teamWorking");const i=J_(e.messages);if(!i)return l("sidebar.preview.noMessages");const o=X_(e.messages,i,s);if(o.kind==="text"&&o.role!=="user"&&Gd(o.text??"")){const u=l("chat.turnStopped");return o.from?`${o.from.name}: ${u}`:u}const c=o.kind==="activity"&&o.tool?O_(o.tool,$2(t.find(u=>u.id===o.from?.botId),n),o.dataResult,s):o.kind==="goal.run"&&o.goalRun?Soe(o.goalRun):o.kind==="connector"&&o.connector?z_(o.connector,l):o.text??"",d=Yd(Wu(c));return o.role==="user"?l("sidebar.preview.you",{text:d}):o.from?`${o.from.name}: ${d}`:d}function fr(e){const{open:t,onCancel:n,returnFocusRef:s}=e,a=f.useRef(null),i=f.useRef(null),o=f.useRef(n);return o.current=n,f.useEffect(()=>{if(!t)return;const c=document.activeElement instanceof HTMLElement?document.activeElement:null;i.current?.focus();const d=u=>{if(u.key==="Escape"){u.preventDefault(),o.current();return}if(u.key==="Tab"){const p=a.current?.querySelectorAll("button:not([disabled])");if(!p?.length){u.preventDefault(),a.current?.focus();return}const m=p[0],h=p[p.length-1];u.shiftKey&&document.activeElement===m?(u.preventDefault(),h.focus()):!u.shiftKey&&document.activeElement===h&&(u.preventDefault(),m.focus())}};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d),(c?.isConnected&&c!==document.body?c:s?.current)?.focus()}},[t,s]),f.useEffect(()=>{t&&(e.pending?a.current?.focus():i.current?.focus())},[t,e.pending]),t?Ke.createPortal(r.jsx("div",{className:`fixed inset-0 ${e.layer??"z-50"} flex items-center justify-center bg-black/55 p-6`,onMouseDown:c=>c.target===c.currentTarget&&n(),children:r.jsx(ule,{ref:a,cancelRef:i,...e})}),document.body):null}function ule({ref:e,cancelRef:t,title:n,body:s,confirmLabel:a,cancelLabel:i=l("common.cancel"),tone:o="danger",icon:c,onCancel:d,onConfirm:u,alternative:p,pending:m=!1}){const h=o==="danger";return r.jsxs("div",{ref:e,role:"alertdialog",tabIndex:-1,"aria-modal":"true","aria-busy":m,"aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-body",className:I("w-full max-w-[420px] rounded-2xl border bg-panel p-5 shadow-2xl",h?"border-danger/30":"border-hairline/50"),children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:I("mt-0.5 shrink-0",h?"text-danger":"text-warning"),children:c??r.jsx(Ts,{size:18})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{id:"confirm-dialog-title",className:"text-[15px] font-semibold text-ink",children:n}),r.jsx("p",{id:"confirm-dialog-body",className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:s})]})]}),r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx("button",{ref:t,type:"button",onClick:d,disabled:m,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:i}),p&&r.jsx("button",{type:"button","data-confirm-alternative":!0,onClick:p.onClick,disabled:m,className:"rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110",children:p.label}),r.jsx("button",{type:"button",onClick:u,disabled:m,className:I("rounded-xl px-4 py-2 text-[13px] font-medium",h?"bg-danger text-white hover:brightness-110":"bg-accent text-white hover:brightness-110"),children:a})]})]})}const ple=200,mle=864e5,bo=e=>e.activity!=="working"&&!e.busy;function fle(e,t){const n=new Set(e);return n.delete(t)||n.add(t),n}function hle(e,t,n,s,a){const i=new Set(e),o=t.findIndex(p=>p.threadId===s);if(o<0)return i;const c=n===null?-1:t.findIndex(p=>p.threadId===n),[d,u]=c<0?[o,o]:[Math.min(c,o),Math.max(c,o)];for(const p of t.slice(d,u+1))bo(p)&&(a?i.add(p.threadId):i.delete(p.threadId));return i}function xle(e,t,n,s,a){return a&&n!==null?hle(e,t,n,s,!e.has(s)):fle(e,s)}const gle=e=>{if(typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)&&e.updatedAt>0)return e.updatedAt;if(typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&e.createdAt>0)return e.createdAt};function ble(e,t,n){const s=n-t*mle;return e.filter(a=>{const i=gle(a);return i!==void 0&&i<s&&a.pinned!==!0&&bo(a)}).map(a=>a.threadId)}const yle=e=>e.filter(t=>t.archivedAt!==void 0&&t.pinned!==!0&&bo(t)).map(t=>t.threadId),kle=e=>new Set(e.filter(bo).map(t=>t.threadId)),Q_=()=>new Set;function vle(e,t=ple){const n=[];for(let s=0;s<e.length;s+=t)n.push(e.slice(s,s+t));return n}function wle(e){const t={deleted:0,busy:0,missing:0};for(const n of e){t.deleted+=n.deleted.length;for(const s of n.refused)s.reason==="busy"?t.busy++:t.missing++}return t}const jle=(e,t,n)=>!n&&(e==="ContextMenu"||t&&e==="F10");async function U2(e,t,n){const s="botId"in e?`/api/bots/${e.botId}/tasks/delete`:`/api/groups/${e.groupId}/tasks/delete`,a=[];try{for(const i of vle(t)){const o=await K(s,{method:"POST",body:JSON.stringify({threadIds:i})});a.push(o),o.bot&&n({type:"botPatched",bot:o.bot}),o.group&&n({type:"groupPatched",group:o.group})}return{responses:a}}catch(i){const o=i instanceof Error?i.message:String(i);return n({type:"error",message:o}),{responses:a,error:o}}}function eM(e,t,n){const s=e.filter(i=>t.has(i.threadId)&&i.pinned===!0).length,a=e.length>0&&e.every(i=>t.has(i.threadId));return[l("task.bulk.confirmBody"),s>0?l("task.bulk.pinnedNote",{count:s}):null,n&&a?l("task.bulk.freshNote"):null].filter(Boolean).join(" ")}function tM(e){const t=wle(e.responses);return[l("task.bulk.result",{count:t.deleted}),t.busy>0?l("task.bulk.resultBusy",{count:t.busy}):null,t.missing>0?l("task.bulk.resultMissing",{count:t.missing}):null,e.error?l("task.bulk.resultError",{message:e.error}):null].filter(Boolean).join(" ")}const FN=30,Fp="rounded-full border border-hairline/50 px-2.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40";function nM(){const[e,t]=f.useState(!1),[n,s]=f.useState(new Set),a=f.useRef(null),i=f.useRef([]),o=f.useCallback((p,m)=>{const h=a.current;a.current=p.threadId,s(x=>xle(x,i.current,h,p.threadId,m))},[]),c=f.useCallback(()=>t(!0),[]),d=f.useCallback(()=>{t(!1),s(new Set),a.current=null},[]);return{active:e,start:c,finish:d,forRows:p=>(i.current=p,new Set(p.filter(m=>n.has(m.threadId)&&bo(m)).map(m=>m.threadId))),setSelected:s,toggle:o}}function sM({rows:e,selected:t,now:n,onChange:s,onDone:a}){const i=o=>s(new Set([...t,...o]));return r.jsxs("div",{className:"flex flex-wrap items-center gap-1 px-2 pb-1.5 pt-1",role:"group","aria-label":l("task.bulk.select"),children:[r.jsx("button",{type:"button",className:Fp,onClick:()=>s(kle(e)),children:l("task.bulk.selectAll")}),r.jsx("button",{type:"button",className:Fp,onClick:()=>i(ble(e,FN,n)),children:l("task.bulk.older",{days:FN})}),r.jsx("button",{type:"button",className:Fp,onClick:()=>i(yle(e)),children:l("task.bulk.archived")}),r.jsx("button",{type:"button",className:Fp,disabled:t.size===0,onClick:()=>s(Q_()),children:l("task.bulk.clear")}),r.jsx("button",{type:"button",onClick:a,className:"ml-auto rounded px-1.5 py-0.5 text-[11px] font-medium text-accent hover:underline",children:l("task.bulk.done")})]})}function Nle({rows:e,selected:t,maxDeletable:n,freshConversation:s,onChange:a,onDelete:i}){const[o,c]=f.useState(!1),[d,u]=f.useState(!1),[p,m]=f.useState(null),h=t.size,x=n!==void 0&&h>n,g=eM(e,t,s),k=()=>{const v=[...t];u(!0),m(null),i(v).then(y=>{const b=new Set(y.responses.flatMap(w=>w.deleted));a(w=>new Set([...w].filter(j=>!b.has(j)))),m(tM(y)),u(!1),c(!1)})};return r.jsxs("div",{className:"sticky bottom-0 z-10 -mx-1 border-t border-hairline/40 bg-panel px-2 py-1.5",children:[r.jsx("span",{role:"status",className:"block text-[11px] text-ink-secondary",children:p??(x?l("task.bulk.channelLimit"):"")}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-ink",children:l("task.bulk.selected",{count:h})}),r.jsx("button",{type:"button",disabled:h===0||d,onClick:()=>a(Q_()),className:"rounded-md px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:l("task.bulk.cancel")}),r.jsx("button",{type:"button",disabled:h===0||x||d,"aria-busy":d||void 0,onClick:()=>c(!0),className:"rounded-md bg-danger px-2.5 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:d?l("task.bulk.deleting"):l("task.bulk.delete",{count:h})})]}),r.jsx(fr,{open:o,title:l("task.bulk.confirmTitle",{count:h}),body:g,confirmLabel:l("task.bulk.delete",{count:h}),pending:d,onCancel:()=>{d||c(!1)},onConfirm:k})]})}function rM({bulk:e,rows:t,selected:n,total:s,canShowAll:a,canSelect:i,onShowAll:o,maxDeletable:c,freshConversation:d,onDelete:u}){if(e.active)return r.jsx(Nle,{rows:t,selected:n,maxDeletable:c,freshConversation:d,onChange:e.setSelected,onDelete:u});if(!a&&!i)return null;const p="inline-flex h-7 items-center text-[13px] font-medium leading-4 text-ink-secondary hover:text-ink";return r.jsxs("div",{className:"flex items-center justify-between pl-6 pr-2",children:[a?r.jsx("button",{type:"button",onClick:o,className:p,children:l("task.showAll",{count:s})}):r.jsx("span",{}),i&&r.jsx("button",{type:"button",onClick:e.start,className:p,children:l("task.bulk.select")})]})}function Sle({members:e,density:t,large:n=!1}){const s=t==="icons",a=s?"size-12":n?"size-9":"size-8",i=s?44:n?36:32;if(e.length<=1){const d=e[0];return r.jsx("div",{className:I("flex shrink-0 items-center justify-center",a),children:d?r.jsx(Ge,{bot:d,state:"happy",size:i,animated:!1}):r.jsx(Tn,{size:24,className:"text-ink-secondary"})})}const o=e.slice(0,2),c=e.length-o.length;return r.jsx("div",{className:I("flex shrink-0 items-center justify-center",a),children:r.jsxs("div",{className:"flex items-center -space-x-2.5",children:[o.map(d=>r.jsx(Ge,{bot:d,state:"happy",size:s?30:n?26:20,animated:!1},d.id)),c>0&&r.jsxs("span",{className:"z-10 flex size-4 items-center justify-center rounded-full border border-hairline/40 bg-raised text-[9px] font-medium text-ink-secondary",children:["+",c]})]})})}function H2({open:e,onCancel:t,onConfirm:n}){const s=f.useRef(null);return f.useEffect(()=>{if(!e)return;s.current?.focus();const a=i=>{i.key==="Escape"&&(i.preventDefault(),t())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t]),e?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:a=>a.target===a.currentTarget&&t(),children:r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-auto-warning-title","aria-describedby":"local-auto-warning-body",className:"w-full max-w-[420px] rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ts,{size:18,className:"mt-0.5 shrink-0 text-warning"}),r.jsxs("div",{children:[r.jsx("h2",{id:"local-auto-warning-title",className:"text-[15px] font-semibold text-ink",children:l("permissions.localAuto.title")}),r.jsx("p",{id:"local-auto-warning-body",className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:l("permissions.localAuto.body")})]})]}),r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:t,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:l("common.cancel")}),r.jsx("button",{ref:s,type:"button",onClick:n,className:"rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110",children:l("common.ok")})]})]})}):null}function Xu(e,t){const n=t.trim();return!n||n===e?null:n}const g1=["ring-2","ring-accent/70","rounded-2xl","transition-shadow"];async function Ile(e,t,n,s){if(!e.hasMore||e.messages.some(d=>d.id===t))return;const a=[];let i=e.messages[0]?.id,o=!0,c=!1;for(;i&&o&&!c;){const d=await K(`/api/threads/${e.threadId}/messages?limit=${Wc}&before=${encodeURIComponent(i)}`),u=d.messages??[];a.unshift(...u),c=u.some(p=>p.id===t),o=!!d.hasMore&&u.length>0,i=u[0]?.id}a.length&&s({type:"olderMessages",threadId:e.threadId,generation:n,messages:a,hasMore:o})}async function W2(e,t,n,s){const a=e.botId??e.groupId,i=e.botId?t.bots.find(u=>u.id===e.botId):void 0,o=e.groupId?t.groups.find(u=>u.id===e.groupId):void 0;if(!a||!i&&!o)throw new Error(l("chat.conversationGone"));const c=i&&i.threadId!==e.threadId&&!s?i:void 0;if(c||n({type:"select",id:a}),i&&i.threadId!==e.threadId&&!c){const u=await K(`/api/bots/${i.id}/tasks/${e.threadId}`,{method:"POST"});u?.bot&&n({type:"taskSwitched",bot:u.bot})}if(o&&o.threadId!==e.threadId){const u=await K(`/api/groups/${o.id}/tasks/${e.threadId}`,{method:"POST"});u?.group&&n({type:"groupPatched",group:u.group})}const d=i?.threadId===e.threadId?i:o?.threadId===e.threadId?o:void 0;if(d&&await Ile(d,e.messageId,t.transcriptGeneration[e.threadId]??0,n),i&&!e.onActivePath){const u=await K(`/api/bots/${i.id}/active-branch`,{method:"POST",body:JSON.stringify({messageId:e.messageId,threadId:e.threadId})});u?.activeLeafId&&n({type:"threadActive",threadId:e.threadId,activeLeafId:u.activeLeafId})}c&&n({type:"switchTask",botId:c.id,threadId:e.threadId,whole:!0}),n({type:"focusMessage",threadId:e.threadId,messageId:e.messageId,matchText:e.snippet.slice(e.matchStart,e.matchStart+e.matchLength)})}function Cle(e,t){const n=t.trim();if(!n)return null;const s=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i="";for(;a.nextNode();){const p=a.currentNode;s.push(p),i+=p.data}const o=n.split(/\s+/).map(p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("\\s+"),c=new RegExp(o,"iu").exec(i);if(!c)return null;const d=document.createRange();let u=0;for(const p of s){const m=u+p.length;if(c.index>=u&&c.index<m&&d.setStart(p,c.index-u),c.index+c[0].length<=m)return d.setEnd(p,c.index+c[0].length-u),d;u=m}return null}function Ele(e,t){const{state:n,dispatch:s}=se(),a=n.focusMessage;f.useEffect(()=>{if(!a||a.consumed||a.threadId!==e||!t)return;let i=0,o=!1,c=null,d=null,u=null,p=null,m=null;const h=()=>{if(o)return;const g=document.querySelector(`[data-mid="${CSS.escape(a.messageId)}"]`)?.lastElementChild;if(p=a.matchText?g?.querySelector("[data-chat-bubble]")??g:g,!p){i++<20&&(c=setTimeout(h,100));return}const k=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;p.scrollIntoView({block:"center",behavior:k?"auto":"smooth"}),p.classList.add(...g1);const v=p.querySelectorAll(".chat-md, .chat-text"),y=[];for(let w=0;w<v.length;w++){const j=v.item(w);j&&!j.closest?.("[data-reply-quote]")&&y.push(j)}let b=null;for(const w of y.length?y:[p])if(b=Cle(w,a.matchText??""))break;b&&CSS.highlights&&(m=new Highlight(b),CSS.highlights.set("search-result-text",m),u=requestAnimationFrame(()=>{const w=p?.closest(".overflow-y-auto");if(!w)return;const j=b.getBoundingClientRect(),S=w.getBoundingClientRect();w.scrollTop+=j.top+j.height/2-S.top-S.height/2})),s({type:"focusMessageConsumed",nonce:a.nonce}),d=setTimeout(()=>p?.classList.remove(...g1),1800)};return h(),()=>{o=!0,c&&clearTimeout(c),d&&clearTimeout(d),u!==null&&cancelAnimationFrame(u),p?.classList.remove(...g1),m&&CSS.highlights.get("search-result-text")===m&&CSS.highlights.delete("search-result-text")}},[s,a?.nonce,a?.threadId,a?.messageId,e,t])}const my=2,Ale=250;function Tle({query:e,onLanded:t}){const{state:n,dispatch:s}=se(),a=Qe(),[i,o]=f.useState(null),[c,d]=f.useState(null),u=e.trim();if(f.useEffect(()=>{if(u.length<my){o(null),d(null);return}o(null),d(null);let m=!0;const h=setTimeout(()=>{K(`/api/search?q=${encodeURIComponent(u)}&limit=40`).then(x=>m&&(o(x.hits),d(null))).catch(x=>m&&d(x instanceof Error?x.message:String(x)))},Ale);return()=>{m=!1,clearTimeout(h)}},[u]),u.length<my)return null;const p=async m=>{try{await W2(m,n,s,a),t()}catch(h){s({type:"error",message:h instanceof Error?h.message:String(h)})}};return r.jsxs("div",{className:"mt-2 border-t border-hairline/40 pt-2",children:[r.jsx("div",{className:"px-3 pb-1 text-[11px] font-medium uppercase tracking-wide text-ink-secondary",children:i?l("search.messagesCount",{count:`${i.length}${i.length===40?"+":""}`}):l("search.messages")}),c&&r.jsx("div",{className:"px-3 py-2 text-[13px] text-danger",children:l("search.failed",{error:c})}),i&&i.length===0&&!c&&r.jsx("div",{className:"px-3 py-3 text-[13px] text-ink-secondary",children:l("search.noMatch",{query:u})}),i?.map(m=>{const h=m.botId?n.bots.find(v=>v.id===m.botId):void 0,x=m.snippet.slice(0,m.matchStart),g=m.snippet.slice(m.matchStart,m.matchStart+m.matchLength),k=m.snippet.slice(m.matchStart+m.matchLength);return r.jsxs("button",{onClick:()=>{p(m)},className:"flex w-full items-start gap-2.5 rounded-lg px-3 py-2 text-left hover:bg-raised/60",children:[h?r.jsx(Ge,{bot:h,state:"idle",size:26,animated:!1}):r.jsx("span",{className:"flex size-[26px] shrink-0 items-center justify-center rounded-full bg-raised text-[11px] text-ink-secondary",children:"#"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-baseline gap-1.5 text-[12px] text-ink-secondary",children:[r.jsx("span",{className:"truncate font-medium text-ink",children:m.from??m.name}),m.task?r.jsxs("span",{className:"truncate",children:["· ",m.task]}):null,r.jsx("span",{className:"ml-auto shrink-0 tabular-nums",children:ca(m.at)})]}),r.jsxs("span",{dir:"auto",className:I("mt-0.5 line-clamp-2 text-[13px] leading-snug",m.role==="user"?"text-ink":"text-ink-secondary"),children:[m.kind==="activity"&&r.jsx(AE,{size:11,className:"mr-1 inline text-ink-secondary"}),x,r.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:g}),k]}),!m.onActivePath&&r.jsxs("span",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-ink-secondary",children:[r.jsx(LK,{size:10})," ",l("search.otherVersion")]})]})]},`${m.threadId}:${m.messageId}`)})]})}function gn(e,t){let n,s;const a=()=>s??=t().then(o=>n=o,o=>{throw s=void 0,console.warn(`[lazy-screens] ${e} could not be loaded; reloading the window fetches it again.`,o),o});function i(o){const[c,d]=f.useState(()=>n),[u,p]=f.useState(!1);return f.useEffect(()=>{if(c)return;let m=!0;return a().then(h=>{m&&d(()=>h)},()=>{m&&p(!0)}),()=>{m=!1}},[c]),c?r.jsx(c,{...o}):u?r.jsx(_le,{}):null}return Object.assign(i,{preload:a})}function _le(){return Ke.createPortal(r.jsxs("div",{role:"alert","data-screen-unavailable":!0,className:"fixed bottom-4 left-1/2 z-[100] flex max-w-[calc(100vw-2rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-danger/30 bg-card px-3.5 py-2.5 text-[13px] text-danger shadow-xl",children:[r.jsx("span",{children:l("screenLoad.failed")}),r.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"shrink-0 rounded-md px-1.5 py-0.5 font-medium text-accent hover:bg-raised",children:l("screenLoad.reload")})]}),document.body)}const aM=gn("ActivityPanel",async()=>(await _e(async()=>{const{ActivityPanel:e}=await import("./ActivityPanel-Yt1JPJtx.js");return{ActivityPanel:e}},__vite__mapDeps([12,1,2,3,4,13,8,10]))).ActivityPanel),iM=gn("BotSettingsDialog",async()=>(await _e(async()=>{const{BotSettingsDialog:e}=await import("./BotSettingsDialog-tUYy15lC.js");return{BotSettingsDialog:e}},__vite__mapDeps([14,1,2,3,4,15,8,16,17,18,19,20,7,21,5,6,22,10]))).BotSettingsDialog),oM=gn("ComputerPanel",async()=>(await _e(async()=>{const{ComputerPanel:e}=await import("./ComputerPanel-DQydmwiD.js");return{ComputerPanel:e}},__vite__mapDeps([23,1,2,6,24,25,3,4,21,5,7,8,26,27,10,22,28,29,20]))).ComputerPanel),lM=gn("FilesView",async()=>(await _e(async()=>{const{FilesView:e}=await import("./FilesView-DHmDJZVD.js");return{FilesView:e}},__vite__mapDeps([30,1,2,3,4,10,8]))).FilesView),cM=gn("InspectorPanel",async()=>(await _e(async()=>{const{InspectorPanel:e}=await import("./InspectorPanel-DgSqJslV.js");return{InspectorPanel:e}},__vite__mapDeps([31,1,2,3,4,8,10]))).InspectorPanel),dM=gn("KeyboardShortcutsModal",async()=>(await _e(async()=>{const{KeyboardShortcutsModal:e}=await import("./KeyboardShortcutsModal-D7Y75zbh.js");return{KeyboardShortcutsModal:e}},__vite__mapDeps([32,1,2,8,10,3,4]))).KeyboardShortcutsModal),uM=gn("LocalVmWorkspace",async()=>(await _e(async()=>{const{LocalVmWorkspace:e}=await import("./LocalVmWorkspace-cE5VrI75.js");return{LocalVmWorkspace:e}},__vite__mapDeps([33,1,2,3,4,8,10]))).LocalVmWorkspace),Mle=gn("NewBotDialog",async()=>(await _e(async()=>{const{NewBotDialog:e}=await import("./NewBotDialog-0aO27qTW.js").then(t=>t.f);return{NewBotDialog:e}},__vite__mapDeps([34,1,2,0,3,4,10,16,17,18,19,20,7,8,5,6,35,27,22]))).NewBotDialog),pM=gn("PluginsPanel",async()=>(await _e(async()=>{const{PluginsPanel:e}=await import("./PluginsPanel-CxXhbzxv.js");return{PluginsPanel:e}},__vite__mapDeps([36,1,2,3,4,19,8,7,10]))).PluginsPanel),mM=gn("RemoteAgentSettingsPanel",async()=>(await _e(async()=>{const{RemoteAgentSettingsPanel:e}=await import("./RemoteAgentSettingsPanel-Bmhtewtp.js");return{RemoteAgentSettingsPanel:e}},__vite__mapDeps([37,1,2,3,4,10,8]))).RemoteAgentSettingsPanel),fM=gn("RoomPanel",async()=>(await _e(async()=>{const{RoomPanel:e}=await import("./RoomPanel-8hijlQPG.js");return{RoomPanel:e}},__vite__mapDeps([38,1,2,3,4,8,10]))).RoomPanel),hM=gn("RemoteDesktopPanel",async()=>(await _e(async()=>{const{RemoteDesktopPanel:e}=await import("./remote-desktop-panel-CqR9sYPm.js");return{RemoteDesktopPanel:e}},__vite__mapDeps([39,1,2,6,3,4,26,27,10,22,28,29,5,7,8,40]))).RemoteDesktopPanel),xM=gn("TriggersPage",async()=>(await _e(async()=>{const{TriggersPage:e}=await import("./TriggersPage-DkPipM4n.js");return{TriggersPage:e}},__vite__mapDeps([41,1,2,3,4,11,9,6,10,8,5,7]))).TriggersPage),K2=gn("SettingsModal",async()=>(await _e(async()=>{const{SettingsModal:e}=await import("./SettingsModal-BJCVgscC.js");return{SettingsModal:e}},__vite__mapDeps([42,1,2,3,4,8,25,43,10,16,17,18,19,20,7,13,34,0,5,6,35,27,22,15]))).SettingsModal),gM=gn("TeamMapPage",async()=>(await _e(async()=>{const{TeamMapPage:e}=await import("./TeamMapPage-r1iwHXYM.js");return{TeamMapPage:e}},__vite__mapDeps([44,1,2,3,4,8,10]))).TeamMapPage),Rle=gn("CloudAddDialog",async()=>(await _e(async()=>{const{CloudAddDialog:e}=await import("./CloudAddDialog-DsTSypGV.js");return{CloudAddDialog:e}},__vite__mapDeps([45,1,2,3,4,10,8]))).CloudAddDialog),Ole=gn("PhoneAppDialog",async()=>(await _e(async()=>{const{PhoneAppDialog:e}=await import("./PhoneAppDialog-CJeGAXQD.js");return{PhoneAppDialog:e}},__vite__mapDeps([46,1,2,3,4,43]))).PhoneAppDialog),zle=gn("ShareTeamDialog",async()=>(await _e(async()=>{const{ShareTeamDialog:e}=await import("./ShareTeamDialog-COcdYImw.js");return{ShareTeamDialog:e}},__vite__mapDeps([47,1,2,3,4,35,10,8]))).ShareTeamDialog),Lle=gn("GrokMoveDialog",async()=>(await _e(async()=>{const{GrokMoveDialog:e}=await import("./GrokMoveDialog-BU8ItDTb.js");return{GrokMoveDialog:e}},__vite__mapDeps([48,1,2,3,4,49,18,29,10,8]))).GrokMoveDialog),bM=gn("TeamLibraryPanel",async()=>(await _e(async()=>{const{TeamLibraryPanel:e}=await import("./TeamLibraryPanel-DOVg7avu.js");return{TeamLibraryPanel:e}},__vite__mapDeps([50,1,2,17,18,3,4,49,47,35,10,8]))).TeamLibraryPanel),Ple=[K2,iM,pM,oM,xM,aM,lM,cM,dM,uM,Mle,mM,hM,fM,gM];typeof location<"u"&&new URLSearchParams(location.search).has("desktop-settings")&&K2.preload().catch(()=>{});const Dle=new Set(["127.0.0.1","localhost","[::1]"]),$le=5e3;function Ble(e=location.hostname){if(Dle.has(e))return()=>{};let t=!1,n=()=>{};const s=o=>{if(typeof requestIdleCallback=="function"){const c=requestIdleCallback(o,{timeout:2e3});n=()=>cancelIdleCallback(c)}else{const c=setTimeout(o,1e3);n=()=>clearTimeout(c)}},a=o=>{const c=Ple[o];c&&s(()=>{c.preload().catch(()=>{}).then(()=>{t||a(o+1)})})},i=setTimeout(()=>a(0),$le);return n=()=>clearTimeout(i),()=>{t=!0,n()}}function fy(e,t){const n=t.trim().toLowerCase();if(!n)return[...e];const s=[],a=[];for(const i of e){const o=i.name.toLowerCase();o.startsWith(n)?s.push(i):o.includes(n)&&a.push(i)}return[...s,...a]}function V2(e){return e.key==="Escape"&&!e.defaultPrevented&&!e.isComposing}function Fle(e,t){if(!e||!t)return!1;const n=e.closest;return typeof n=="function"&&n.call(e,"[data-tour-card]")?!1:!t.contains(e)}function ha(e,t,n){const s=f.useRef(n);s.current=n,f.useEffect(()=>{if(!e)return;const a=o=>{V2(o)&&(o.preventDefault(),s.current())},i=o=>{Fle(o.target,t.current)&&s.current()};return window.addEventListener("keydown",a),window.addEventListener("pointerdown",i),()=>{window.removeEventListener("keydown",a),window.removeEventListener("pointerdown",i)}},[e,t])}const qle=320,Ule=360,Um=8,Hle=56,Wle=480;function qN(e,t,n=!1){const s={left:0,width:t,floating:!1};if(!e)return s;const a=n?e.left:t-e.right;if(a<qle)return s;const i=Math.min(Ule,a-2*Um);return{left:n?e.left-Um-i:e.right+Um,width:i,floating:!0}}function UN(e){return Math.max(160,Math.min(Wle,e-Hle-2*Um))}function Kle(e){return e.title?.trim()||e.description?.trim().split(`
114
+ `);return o.length<=ro.fallback?o:`${o.slice(0,ro.fallback-1).trimEnd()}…`}function J_(e){return e?.findLast(t=>!K7(t)&&t.kind!=="screen")}function Z_(e,t,n,s){return e.activity==="waiting-on-you"?l("sidebar.preview.waiting"):e.waitingForTeammates?l("sidebar.preview.waitingOnTeammate"):e.busy?l("sidebar.preview.working"):ile(e,t,n,s)}function ale(e){const t=e.kind==="activity"?e.tool:void 0;return!!t&&!e.dataResult&&Nr(t.name)===null&&!bx(t.name)&&!Fm.test(t.name)}function X_(e,t,n){if(n||!ale(t))return t;for(let s=e.length-1;s>=0;s--){const a=e[s];if(a.role==="user")break;if(a.kind!=="activity"&&!K7(a)&&a.kind!=="screen")return a}return t}function ile(e,t,n,s){const a=J_(t);if(!a)return"";const i=X_(t,a,s);if(i.kind==="options"&&i.card)return i.helperIntro?l(s?"helperIntro.title":e.chiefOfStaff?"helperIntro.hello":"helperIntro.hi.helper",{name:e.name}):i.card.requestId&&i.card.tool&&!i.card.questionRequest&&P2(i.card)||i.card.title;if(i.kind==="activity"&&i.tool)return O_(i.tool,$2(e,n),i.dataResult,s);if(i.kind==="connector"&&i.connector)return z_(i.connector,l);if(i.kind==="routine.run"&&i.routineRun)return cle(i.routineRun);const o=Ls(i);return o?`${o.name}: ${Yd(o.body)}`:i.role!=="user"&&Gd(i.text??"")?l("chat.turnStopped"):Yd(Wu(ole(i)??i.text??""))}function ole(e){if(e.kind!=="widget"||!e.widget?.root||e.serverCard!==!0)return;const t=W_(e.widget,!0);return t===e.widget?void 0:rle(t.root)}const lle={completed:"automations.preview.finished",failed:"automations.preview.failed",waiting:"automations.preview.needsYou",cancelled:"automations.preview.stopped",missed:"automations.preview.missed",running:"automations.preview.running",queued:"automations.preview.running"};function cle(e){return l(lle[e.status],{name:e.routineName})}function dle(e,t,n,s){const a=Doe(e,u=>t.find(p=>p.id===u)?.name);if(a)return a;if(e.working)return l("sidebar.preview.teamWorking");const i=J_(e.messages);if(!i)return l("sidebar.preview.noMessages");const o=X_(e.messages,i,s);if(o.kind==="text"&&o.role!=="user"&&Gd(o.text??"")){const u=l("chat.turnStopped");return o.from?`${o.from.name}: ${u}`:u}const c=o.kind==="activity"&&o.tool?O_(o.tool,$2(t.find(u=>u.id===o.from?.botId),n),o.dataResult,s):o.kind==="goal.run"&&o.goalRun?Soe(o.goalRun):o.kind==="connector"&&o.connector?z_(o.connector,l):o.text??"",d=Yd(Wu(c));return o.role==="user"?l("sidebar.preview.you",{text:d}):o.from?`${o.from.name}: ${d}`:d}function fr(e){const{open:t,onCancel:n,returnFocusRef:s}=e,a=f.useRef(null),i=f.useRef(null),o=f.useRef(n);return o.current=n,f.useEffect(()=>{if(!t)return;const c=document.activeElement instanceof HTMLElement?document.activeElement:null;i.current?.focus();const d=u=>{if(u.key==="Escape"){u.preventDefault(),o.current();return}if(u.key==="Tab"){const p=a.current?.querySelectorAll("button:not([disabled])");if(!p?.length){u.preventDefault(),a.current?.focus();return}const m=p[0],h=p[p.length-1];u.shiftKey&&document.activeElement===m?(u.preventDefault(),h.focus()):!u.shiftKey&&document.activeElement===h&&(u.preventDefault(),m.focus())}};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d),(c?.isConnected&&c!==document.body?c:s?.current)?.focus()}},[t,s]),f.useEffect(()=>{t&&(e.pending?a.current?.focus():i.current?.focus())},[t,e.pending]),t?Ke.createPortal(r.jsx("div",{className:`fixed inset-0 ${e.layer??"z-50"} flex items-center justify-center bg-black/55 p-6`,onMouseDown:c=>c.target===c.currentTarget&&n(),children:r.jsx(ule,{ref:a,cancelRef:i,...e})}),document.body):null}function ule({ref:e,cancelRef:t,title:n,body:s,confirmLabel:a,cancelLabel:i=l("common.cancel"),tone:o="danger",icon:c,onCancel:d,onConfirm:u,alternative:p,pending:m=!1}){const h=o==="danger";return r.jsxs("div",{ref:e,role:"alertdialog",tabIndex:-1,"aria-modal":"true","aria-busy":m,"aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-body",className:I("w-full max-w-[420px] rounded-2xl border bg-panel p-5 shadow-2xl",h?"border-danger/30":"border-hairline/50"),children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:I("mt-0.5 shrink-0",h?"text-danger":"text-warning"),children:c??r.jsx(Ts,{size:18})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{id:"confirm-dialog-title",className:"text-[15px] font-semibold text-ink",children:n}),r.jsx("p",{id:"confirm-dialog-body",className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:s})]})]}),r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx("button",{ref:t,type:"button",onClick:d,disabled:m,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:i}),p&&r.jsx("button",{type:"button","data-confirm-alternative":!0,onClick:p.onClick,disabled:m,className:"rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110",children:p.label}),r.jsx("button",{type:"button",onClick:u,disabled:m,className:I("rounded-xl px-4 py-2 text-[13px] font-medium",h?"bg-danger text-white hover:brightness-110":"bg-accent text-white hover:brightness-110"),children:a})]})]})}const ple=200,mle=864e5,bo=e=>e.activity!=="working"&&!e.busy;function fle(e,t){const n=new Set(e);return n.delete(t)||n.add(t),n}function hle(e,t,n,s,a){const i=new Set(e),o=t.findIndex(p=>p.threadId===s);if(o<0)return i;const c=n===null?-1:t.findIndex(p=>p.threadId===n),[d,u]=c<0?[o,o]:[Math.min(c,o),Math.max(c,o)];for(const p of t.slice(d,u+1))bo(p)&&(a?i.add(p.threadId):i.delete(p.threadId));return i}function xle(e,t,n,s,a){return a&&n!==null?hle(e,t,n,s,!e.has(s)):fle(e,s)}const gle=e=>{if(typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)&&e.updatedAt>0)return e.updatedAt;if(typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&e.createdAt>0)return e.createdAt};function ble(e,t,n){const s=n-t*mle;return e.filter(a=>{const i=gle(a);return i!==void 0&&i<s&&a.pinned!==!0&&bo(a)}).map(a=>a.threadId)}const yle=e=>e.filter(t=>t.archivedAt!==void 0&&t.pinned!==!0&&bo(t)).map(t=>t.threadId),kle=e=>new Set(e.filter(bo).map(t=>t.threadId)),Q_=()=>new Set;function vle(e,t=ple){const n=[];for(let s=0;s<e.length;s+=t)n.push(e.slice(s,s+t));return n}function wle(e){const t={deleted:0,busy:0,missing:0};for(const n of e){t.deleted+=n.deleted.length;for(const s of n.refused)s.reason==="busy"?t.busy++:t.missing++}return t}const jle=(e,t,n)=>!n&&(e==="ContextMenu"||t&&e==="F10");async function U2(e,t,n){const s="botId"in e?`/api/bots/${e.botId}/tasks/delete`:`/api/groups/${e.groupId}/tasks/delete`,a=[];try{for(const i of vle(t)){const o=await K(s,{method:"POST",body:JSON.stringify({threadIds:i})});a.push(o),o.bot&&n({type:"botPatched",bot:o.bot}),o.group&&n({type:"groupPatched",group:o.group})}return{responses:a}}catch(i){const o=i instanceof Error?i.message:String(i);return n({type:"error",message:o}),{responses:a,error:o}}}function eM(e,t,n){const s=e.filter(i=>t.has(i.threadId)&&i.pinned===!0).length,a=e.length>0&&e.every(i=>t.has(i.threadId));return[l("task.bulk.confirmBody"),s>0?l("task.bulk.pinnedNote",{count:s}):null,n&&a?l("task.bulk.freshNote"):null].filter(Boolean).join(" ")}function tM(e){const t=wle(e.responses);return[l("task.bulk.result",{count:t.deleted}),t.busy>0?l("task.bulk.resultBusy",{count:t.busy}):null,t.missing>0?l("task.bulk.resultMissing",{count:t.missing}):null,e.error?l("task.bulk.resultError",{message:e.error}):null].filter(Boolean).join(" ")}const FN=30,Fp="rounded-full border border-hairline/50 px-2.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40";function nM(){const[e,t]=f.useState(!1),[n,s]=f.useState(new Set),a=f.useRef(null),i=f.useRef([]),o=f.useCallback((p,m)=>{const h=a.current;a.current=p.threadId,s(x=>xle(x,i.current,h,p.threadId,m))},[]),c=f.useCallback(()=>t(!0),[]),d=f.useCallback(()=>{t(!1),s(new Set),a.current=null},[]);return{active:e,start:c,finish:d,forRows:p=>(i.current=p,new Set(p.filter(m=>n.has(m.threadId)&&bo(m)).map(m=>m.threadId))),setSelected:s,toggle:o}}function sM({rows:e,selected:t,now:n,onChange:s,onDone:a}){const i=o=>s(new Set([...t,...o]));return r.jsxs("div",{className:"flex flex-wrap items-center gap-1 px-2 pb-1.5 pt-1",role:"group","aria-label":l("task.bulk.select"),children:[r.jsx("button",{type:"button",className:Fp,onClick:()=>s(kle(e)),children:l("task.bulk.selectAll")}),r.jsx("button",{type:"button",className:Fp,onClick:()=>i(ble(e,FN,n)),children:l("task.bulk.older",{days:FN})}),r.jsx("button",{type:"button",className:Fp,onClick:()=>i(yle(e)),children:l("task.bulk.archived")}),r.jsx("button",{type:"button",className:Fp,disabled:t.size===0,onClick:()=>s(Q_()),children:l("task.bulk.clear")}),r.jsx("button",{type:"button",onClick:a,className:"ml-auto rounded px-1.5 py-0.5 text-[11px] font-medium text-accent hover:underline",children:l("task.bulk.done")})]})}function Nle({rows:e,selected:t,maxDeletable:n,freshConversation:s,onChange:a,onDelete:i}){const[o,c]=f.useState(!1),[d,u]=f.useState(!1),[p,m]=f.useState(null),h=t.size,x=n!==void 0&&h>n,g=eM(e,t,s),k=()=>{const v=[...t];u(!0),m(null),i(v).then(y=>{const b=new Set(y.responses.flatMap(w=>w.deleted));a(w=>new Set([...w].filter(j=>!b.has(j)))),m(tM(y)),u(!1),c(!1)})};return r.jsxs("div",{className:"sticky bottom-0 z-10 -mx-1 border-t border-hairline/40 bg-panel px-2 py-1.5",children:[r.jsx("span",{role:"status",className:"block text-[11px] text-ink-secondary",children:p??(x?l("task.bulk.channelLimit"):"")}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-ink",children:l("task.bulk.selected",{count:h})}),r.jsx("button",{type:"button",disabled:h===0||d,onClick:()=>a(Q_()),className:"rounded-md px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:l("task.bulk.cancel")}),r.jsx("button",{type:"button",disabled:h===0||x||d,"aria-busy":d||void 0,onClick:()=>c(!0),className:"rounded-md bg-danger px-2.5 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:d?l("task.bulk.deleting"):l("task.bulk.delete",{count:h})})]}),r.jsx(fr,{open:o,title:l("task.bulk.confirmTitle",{count:h}),body:g,confirmLabel:l("task.bulk.delete",{count:h}),pending:d,onCancel:()=>{d||c(!1)},onConfirm:k})]})}function rM({bulk:e,rows:t,selected:n,total:s,canShowAll:a,canSelect:i,onShowAll:o,maxDeletable:c,freshConversation:d,onDelete:u}){if(e.active)return r.jsx(Nle,{rows:t,selected:n,maxDeletable:c,freshConversation:d,onChange:e.setSelected,onDelete:u});if(!a&&!i)return null;const p="inline-flex h-7 items-center text-[13px] font-medium leading-4 text-ink-secondary hover:text-ink";return r.jsxs("div",{className:"flex items-center justify-between pl-6 pr-2",children:[a?r.jsx("button",{type:"button",onClick:o,className:p,children:l("task.showAll",{count:s})}):r.jsx("span",{}),i&&r.jsx("button",{type:"button",onClick:e.start,className:p,children:l("task.bulk.select")})]})}function Sle({members:e,density:t,large:n=!1}){const s=t==="icons",a=s?"size-12":n?"size-9":"size-8",i=s?44:n?36:32;if(e.length<=1){const d=e[0];return r.jsx("div",{className:I("flex shrink-0 items-center justify-center",a),children:d?r.jsx(Ge,{bot:d,state:"happy",size:i,animated:!1}):r.jsx(Tn,{size:24,className:"text-ink-secondary"})})}const o=e.slice(0,2),c=e.length-o.length;return r.jsx("div",{className:I("flex shrink-0 items-center justify-center",a),children:r.jsxs("div",{className:"flex items-center -space-x-2.5",children:[o.map(d=>r.jsx(Ge,{bot:d,state:"happy",size:s?30:n?26:20,animated:!1},d.id)),c>0&&r.jsxs("span",{className:"z-10 flex size-4 items-center justify-center rounded-full border border-hairline/40 bg-raised text-[9px] font-medium text-ink-secondary",children:["+",c]})]})})}function H2({open:e,onCancel:t,onConfirm:n}){const s=f.useRef(null);return f.useEffect(()=>{if(!e)return;s.current?.focus();const a=i=>{i.key==="Escape"&&(i.preventDefault(),t())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t]),e?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:a=>a.target===a.currentTarget&&t(),children:r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-auto-warning-title","aria-describedby":"local-auto-warning-body",className:"w-full max-w-[420px] rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ts,{size:18,className:"mt-0.5 shrink-0 text-warning"}),r.jsxs("div",{children:[r.jsx("h2",{id:"local-auto-warning-title",className:"text-[15px] font-semibold text-ink",children:l("permissions.localAuto.title")}),r.jsx("p",{id:"local-auto-warning-body",className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:l("permissions.localAuto.body")})]})]}),r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:t,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:l("common.cancel")}),r.jsx("button",{ref:s,type:"button",onClick:n,className:"rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-110",children:l("common.ok")})]})]})}):null}function Xu(e,t){const n=t.trim();return!n||n===e?null:n}const g1=["ring-2","ring-accent/70","rounded-2xl","transition-shadow"];async function Ile(e,t,n,s){if(!e.hasMore||e.messages.some(d=>d.id===t))return;const a=[];let i=e.messages[0]?.id,o=!0,c=!1;for(;i&&o&&!c;){const d=await K(`/api/threads/${e.threadId}/messages?limit=${Wc}&before=${encodeURIComponent(i)}`),u=d.messages??[];a.unshift(...u),c=u.some(p=>p.id===t),o=!!d.hasMore&&u.length>0,i=u[0]?.id}a.length&&s({type:"olderMessages",threadId:e.threadId,generation:n,messages:a,hasMore:o})}async function W2(e,t,n,s){const a=e.botId??e.groupId,i=e.botId?t.bots.find(u=>u.id===e.botId):void 0,o=e.groupId?t.groups.find(u=>u.id===e.groupId):void 0;if(!a||!i&&!o)throw new Error(l("chat.conversationGone"));const c=i&&i.threadId!==e.threadId&&!s?i:void 0;if(c||n({type:"select",id:a}),i&&i.threadId!==e.threadId&&!c){const u=await K(`/api/bots/${i.id}/tasks/${e.threadId}`,{method:"POST"});u?.bot&&n({type:"taskSwitched",bot:u.bot})}if(o&&o.threadId!==e.threadId){const u=await K(`/api/groups/${o.id}/tasks/${e.threadId}`,{method:"POST"});u?.group&&n({type:"groupPatched",group:u.group})}const d=i?.threadId===e.threadId?i:o?.threadId===e.threadId?o:void 0;if(d&&await Ile(d,e.messageId,t.transcriptGeneration[e.threadId]??0,n),i&&!e.onActivePath){const u=await K(`/api/bots/${i.id}/active-branch`,{method:"POST",body:JSON.stringify({messageId:e.messageId,threadId:e.threadId})});u?.activeLeafId&&n({type:"threadActive",threadId:e.threadId,activeLeafId:u.activeLeafId})}c&&n({type:"switchTask",botId:c.id,threadId:e.threadId,whole:!0}),n({type:"focusMessage",threadId:e.threadId,messageId:e.messageId,matchText:e.snippet.slice(e.matchStart,e.matchStart+e.matchLength)})}function Cle(e,t){const n=t.trim();if(!n)return null;const s=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i="";for(;a.nextNode();){const p=a.currentNode;s.push(p),i+=p.data}const o=n.split(/\s+/).map(p=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("\\s+"),c=new RegExp(o,"iu").exec(i);if(!c)return null;const d=document.createRange();let u=0;for(const p of s){const m=u+p.length;if(c.index>=u&&c.index<m&&d.setStart(p,c.index-u),c.index+c[0].length<=m)return d.setEnd(p,c.index+c[0].length-u),d;u=m}return null}function Ele(e,t){const{state:n,dispatch:s}=se(),a=n.focusMessage;f.useEffect(()=>{if(!a||a.consumed||a.threadId!==e||!t)return;let i=0,o=!1,c=null,d=null,u=null,p=null,m=null;const h=()=>{if(o)return;const g=document.querySelector(`[data-mid="${CSS.escape(a.messageId)}"]`)?.lastElementChild;if(p=a.matchText?g?.querySelector("[data-chat-bubble]")??g:g,!p){i++<20&&(c=setTimeout(h,100));return}const k=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;p.scrollIntoView({block:"center",behavior:k?"auto":"smooth"}),p.classList.add(...g1);const v=p.querySelectorAll(".chat-md, .chat-text"),y=[];for(let w=0;w<v.length;w++){const j=v.item(w);j&&!j.closest?.("[data-reply-quote]")&&y.push(j)}let b=null;for(const w of y.length?y:[p])if(b=Cle(w,a.matchText??""))break;b&&CSS.highlights&&(m=new Highlight(b),CSS.highlights.set("search-result-text",m),u=requestAnimationFrame(()=>{const w=p?.closest(".overflow-y-auto");if(!w)return;const j=b.getBoundingClientRect(),S=w.getBoundingClientRect();w.scrollTop+=j.top+j.height/2-S.top-S.height/2})),s({type:"focusMessageConsumed",nonce:a.nonce}),d=setTimeout(()=>p?.classList.remove(...g1),1800)};return h(),()=>{o=!0,c&&clearTimeout(c),d&&clearTimeout(d),u!==null&&cancelAnimationFrame(u),p?.classList.remove(...g1),m&&CSS.highlights.get("search-result-text")===m&&CSS.highlights.delete("search-result-text")}},[s,a?.nonce,a?.threadId,a?.messageId,e,t])}const my=2,Ale=250;function Tle({query:e,onLanded:t}){const{state:n,dispatch:s}=se(),a=Qe(),[i,o]=f.useState(null),[c,d]=f.useState(null),u=e.trim();if(f.useEffect(()=>{if(u.length<my){o(null),d(null);return}o(null),d(null);let m=!0;const h=setTimeout(()=>{K(`/api/search?q=${encodeURIComponent(u)}&limit=40`).then(x=>m&&(o(x.hits),d(null))).catch(x=>m&&d(x instanceof Error?x.message:String(x)))},Ale);return()=>{m=!1,clearTimeout(h)}},[u]),u.length<my)return null;const p=async m=>{try{await W2(m,n,s,a),t()}catch(h){s({type:"error",message:h instanceof Error?h.message:String(h)})}};return r.jsxs("div",{className:"mt-2 border-t border-hairline/40 pt-2",children:[r.jsx("div",{className:"px-3 pb-1 text-[11px] font-medium uppercase tracking-wide text-ink-secondary",children:i?l("search.messagesCount",{count:`${i.length}${i.length===40?"+":""}`}):l("search.messages")}),c&&r.jsx("div",{className:"px-3 py-2 text-[13px] text-danger",children:l("search.failed",{error:c})}),i&&i.length===0&&!c&&r.jsx("div",{className:"px-3 py-3 text-[13px] text-ink-secondary",children:l("search.noMatch",{query:u})}),i?.map(m=>{const h=m.botId?n.bots.find(v=>v.id===m.botId):void 0,x=m.snippet.slice(0,m.matchStart),g=m.snippet.slice(m.matchStart,m.matchStart+m.matchLength),k=m.snippet.slice(m.matchStart+m.matchLength);return r.jsxs("button",{onClick:()=>{p(m)},className:"flex w-full items-start gap-2.5 rounded-lg px-3 py-2 text-left hover:bg-raised/60",children:[h?r.jsx(Ge,{bot:h,state:"idle",size:26,animated:!1}):r.jsx("span",{className:"flex size-[26px] shrink-0 items-center justify-center rounded-full bg-raised text-[11px] text-ink-secondary",children:"#"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-baseline gap-1.5 text-[12px] text-ink-secondary",children:[r.jsx("span",{className:"truncate font-medium text-ink",children:m.from??m.name}),m.task?r.jsxs("span",{className:"truncate",children:["· ",m.task]}):null,r.jsx("span",{className:"ml-auto shrink-0 tabular-nums",children:ca(m.at)})]}),r.jsxs("span",{dir:"auto",className:I("mt-0.5 line-clamp-2 text-[13px] leading-snug",m.role==="user"?"text-ink":"text-ink-secondary"),children:[m.kind==="activity"&&r.jsx(AE,{size:11,className:"mr-1 inline text-ink-secondary"}),x,r.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:g}),k]}),!m.onActivePath&&r.jsxs("span",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-ink-secondary",children:[r.jsx(LK,{size:10})," ",l("search.otherVersion")]})]})]},`${m.threadId}:${m.messageId}`)})]})}function gn(e,t){let n,s;const a=()=>s??=t().then(o=>n=o,o=>{throw s=void 0,console.warn(`[lazy-screens] ${e} could not be loaded; reloading the window fetches it again.`,o),o});function i(o){const[c,d]=f.useState(()=>n),[u,p]=f.useState(!1);return f.useEffect(()=>{if(c)return;let m=!0;return a().then(h=>{m&&d(()=>h)},()=>{m&&p(!0)}),()=>{m=!1}},[c]),c?r.jsx(c,{...o}):u?r.jsx(_le,{}):null}return Object.assign(i,{preload:a})}function _le(){return Ke.createPortal(r.jsxs("div",{role:"alert","data-screen-unavailable":!0,className:"fixed bottom-4 left-1/2 z-[100] flex max-w-[calc(100vw-2rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-danger/30 bg-card px-3.5 py-2.5 text-[13px] text-danger shadow-xl",children:[r.jsx("span",{children:l("screenLoad.failed")}),r.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"shrink-0 rounded-md px-1.5 py-0.5 font-medium text-accent hover:bg-raised",children:l("screenLoad.reload")})]}),document.body)}const aM=gn("ActivityPanel",async()=>(await _e(async()=>{const{ActivityPanel:e}=await import("./ActivityPanel-DC3XVGOc.js");return{ActivityPanel:e}},__vite__mapDeps([12,1,2,3,4,13,8,10]))).ActivityPanel),iM=gn("BotSettingsDialog",async()=>(await _e(async()=>{const{BotSettingsDialog:e}=await import("./BotSettingsDialog-BrmKiJZJ.js");return{BotSettingsDialog:e}},__vite__mapDeps([14,1,2,3,4,15,8,16,17,18,19,20,7,21,5,6,22,10]))).BotSettingsDialog),oM=gn("ComputerPanel",async()=>(await _e(async()=>{const{ComputerPanel:e}=await import("./ComputerPanel-SaUcSoW6.js");return{ComputerPanel:e}},__vite__mapDeps([23,1,2,6,24,25,3,4,21,5,7,8,26,27,10,22,28,29,20]))).ComputerPanel),lM=gn("FilesView",async()=>(await _e(async()=>{const{FilesView:e}=await import("./FilesView-BS2JAg48.js");return{FilesView:e}},__vite__mapDeps([30,1,2,3,4,10,8]))).FilesView),cM=gn("InspectorPanel",async()=>(await _e(async()=>{const{InspectorPanel:e}=await import("./InspectorPanel-BT3llt3b.js");return{InspectorPanel:e}},__vite__mapDeps([31,1,2,3,4,8,10]))).InspectorPanel),dM=gn("KeyboardShortcutsModal",async()=>(await _e(async()=>{const{KeyboardShortcutsModal:e}=await import("./KeyboardShortcutsModal-L8FD783r.js");return{KeyboardShortcutsModal:e}},__vite__mapDeps([32,1,2,8,10,3,4]))).KeyboardShortcutsModal),uM=gn("LocalVmWorkspace",async()=>(await _e(async()=>{const{LocalVmWorkspace:e}=await import("./LocalVmWorkspace-v7UlCW9t.js");return{LocalVmWorkspace:e}},__vite__mapDeps([33,1,2,3,4,8,10]))).LocalVmWorkspace),Mle=gn("NewBotDialog",async()=>(await _e(async()=>{const{NewBotDialog:e}=await import("./NewBotDialog-FgTNwkT5.js").then(t=>t.f);return{NewBotDialog:e}},__vite__mapDeps([34,1,2,0,3,4,10,16,17,18,19,20,7,8,5,6,35,27,22]))).NewBotDialog),pM=gn("PluginsPanel",async()=>(await _e(async()=>{const{PluginsPanel:e}=await import("./PluginsPanel-BROkmoVw.js");return{PluginsPanel:e}},__vite__mapDeps([36,1,2,3,4,19,8,7,10]))).PluginsPanel),mM=gn("RemoteAgentSettingsPanel",async()=>(await _e(async()=>{const{RemoteAgentSettingsPanel:e}=await import("./RemoteAgentSettingsPanel-BdJpTB-X.js");return{RemoteAgentSettingsPanel:e}},__vite__mapDeps([37,1,2,3,4,10,8]))).RemoteAgentSettingsPanel),fM=gn("RoomPanel",async()=>(await _e(async()=>{const{RoomPanel:e}=await import("./RoomPanel-BltzAc2X.js");return{RoomPanel:e}},__vite__mapDeps([38,1,2,3,4,8,10]))).RoomPanel),hM=gn("RemoteDesktopPanel",async()=>(await _e(async()=>{const{RemoteDesktopPanel:e}=await import("./remote-desktop-panel-ipZYKPLT.js");return{RemoteDesktopPanel:e}},__vite__mapDeps([39,1,2,6,3,4,26,27,10,22,28,29,5,7,8,40]))).RemoteDesktopPanel),xM=gn("TriggersPage",async()=>(await _e(async()=>{const{TriggersPage:e}=await import("./TriggersPage-By978rcW.js");return{TriggersPage:e}},__vite__mapDeps([41,1,2,3,4,11,9,6,10,8,5,7]))).TriggersPage),K2=gn("SettingsModal",async()=>(await _e(async()=>{const{SettingsModal:e}=await import("./SettingsModal-B5Fjq814.js");return{SettingsModal:e}},__vite__mapDeps([42,1,2,3,4,8,25,43,10,16,17,18,19,20,7,13,34,0,5,6,35,27,22,15]))).SettingsModal),gM=gn("TeamMapPage",async()=>(await _e(async()=>{const{TeamMapPage:e}=await import("./TeamMapPage-DjqBIDae.js");return{TeamMapPage:e}},__vite__mapDeps([44,1,2,3,4,8,10]))).TeamMapPage),Rle=gn("CloudAddDialog",async()=>(await _e(async()=>{const{CloudAddDialog:e}=await import("./CloudAddDialog-DIm-M9CF.js");return{CloudAddDialog:e}},__vite__mapDeps([45,1,2,3,4,10,8]))).CloudAddDialog),Ole=gn("PhoneAppDialog",async()=>(await _e(async()=>{const{PhoneAppDialog:e}=await import("./PhoneAppDialog-BAqdCsuh.js");return{PhoneAppDialog:e}},__vite__mapDeps([46,1,2,3,4,43]))).PhoneAppDialog),zle=gn("ShareTeamDialog",async()=>(await _e(async()=>{const{ShareTeamDialog:e}=await import("./ShareTeamDialog-BrYsQ1YB.js");return{ShareTeamDialog:e}},__vite__mapDeps([47,1,2,3,4,35,10,8]))).ShareTeamDialog),Lle=gn("GrokMoveDialog",async()=>(await _e(async()=>{const{GrokMoveDialog:e}=await import("./GrokMoveDialog-kG0ReJlG.js");return{GrokMoveDialog:e}},__vite__mapDeps([48,1,2,3,4,49,18,29,10,8]))).GrokMoveDialog),bM=gn("TeamLibraryPanel",async()=>(await _e(async()=>{const{TeamLibraryPanel:e}=await import("./TeamLibraryPanel-C3YIy7_M.js");return{TeamLibraryPanel:e}},__vite__mapDeps([50,1,2,17,18,3,4,49,47,35,10,8]))).TeamLibraryPanel),Ple=[K2,iM,pM,oM,xM,aM,lM,cM,dM,uM,Mle,mM,hM,fM,gM];typeof location<"u"&&new URLSearchParams(location.search).has("desktop-settings")&&K2.preload().catch(()=>{});const Dle=new Set(["127.0.0.1","localhost","[::1]"]),$le=5e3;function Ble(e=location.hostname){if(Dle.has(e))return()=>{};let t=!1,n=()=>{};const s=o=>{if(typeof requestIdleCallback=="function"){const c=requestIdleCallback(o,{timeout:2e3});n=()=>cancelIdleCallback(c)}else{const c=setTimeout(o,1e3);n=()=>clearTimeout(c)}},a=o=>{const c=Ple[o];c&&s(()=>{c.preload().catch(()=>{}).then(()=>{t||a(o+1)})})},i=setTimeout(()=>a(0),$le);return n=()=>clearTimeout(i),()=>{t=!0,n()}}function fy(e,t){const n=t.trim().toLowerCase();if(!n)return[...e];const s=[],a=[];for(const i of e){const o=i.name.toLowerCase();o.startsWith(n)?s.push(i):o.includes(n)&&a.push(i)}return[...s,...a]}function V2(e){return e.key==="Escape"&&!e.defaultPrevented&&!e.isComposing}function Fle(e,t){if(!e||!t)return!1;const n=e.closest;return typeof n=="function"&&n.call(e,"[data-tour-card]")?!1:!t.contains(e)}function ha(e,t,n){const s=f.useRef(n);s.current=n,f.useEffect(()=>{if(!e)return;const a=o=>{V2(o)&&(o.preventDefault(),s.current())},i=o=>{Fle(o.target,t.current)&&s.current()};return window.addEventListener("keydown",a),window.addEventListener("pointerdown",i),()=>{window.removeEventListener("keydown",a),window.removeEventListener("pointerdown",i)}},[e,t])}const qle=320,Ule=360,Um=8,Hle=56,Wle=480;function qN(e,t,n=!1){const s={left:0,width:t,floating:!1};if(!e)return s;const a=n?e.left:t-e.right;if(a<qle)return s;const i=Math.min(Ule,a-2*Um);return{left:n?e.left-Um-i:e.right+Um,width:i,floating:!0}}function UN(e){return Math.max(160,Math.min(Wle,e-Hle-2*Um))}function Kle(e){return e.title?.trim()||e.description?.trim().split(`
115
115
  `)[0]?.trim()||""}function Vle({anchor:e,onClose:t,onNewBot:n,onNewGroup:s,style:a}){const{state:i,dispatch:o}=se(),c=Qe(),[d,u]=f.useState(""),[p,m]=f.useState(n?2:1),[h,x]=f.useState(()=>qN(null,typeof window>"u"?0:window.innerWidth)),[g,k]=f.useState(()=>UN(typeof window>"u"?0:window.innerHeight)),v=f.useRef(null),y=f.useRef(null);ha(!0,v,t),f.useLayoutEffect(()=>{const R=()=>x(qN(e?e.getBoundingClientRect():null,window.innerWidth,e?getComputedStyle(e).direction==="rtl":!1)),O=()=>{R(),k(UN(window.innerHeight))};O(),window.addEventListener("resize",O);const q=e&&typeof ResizeObserver<"u"?new ResizeObserver(R):null;return e&&q?.observe(e),()=>{window.removeEventListener("resize",O),q?.disconnect()}},[e]),f.useLayoutEffect(()=>{y.current?.scrollIntoView({block:"nearest"})},[p]);const b=fy(i.bots.filter(R=>!R.hidden),d),w=[...n?[{key:"bot",icon:r.jsx(An,{size:16}),label:l("sidebar.newChat.createBot"),run:n}]:[],{key:"group",icon:r.jsx(Tn,{size:16}),label:l("sidebar.newChat.createGroup"),run:s}],j=w.length+b.length,S=p<w.length?p:b.length?Math.min(p,j-1):-1,E=c?l("sidebar.newChat.start"):l("sidebar.newChat.open"),A=R=>{c?o({type:"newTask",botId:R.id}):qt(o,R,!1),t()},_=R=>{if(R<w.length)w[R]?.run();else{const O=b[R-w.length];O&&A(O)}},N=R=>{R.nativeEvent.isComposing||(R.key==="ArrowDown"?(R.preventDefault(),m(S<0?0:(S+1)%j)):R.key==="ArrowUp"?(R.preventDefault(),m(S<0?w.length-1:(S-1+j)%j)):R.key==="Enter"&&R.target instanceof HTMLInputElement&&(R.preventDefault(),S>=0&&_(S)))},C=R=>I("flex h-12 w-full items-center gap-3 rounded-2xl px-3 text-start text-[14px] text-ink outline-none focus-visible:bg-raised-hover",R===S&&"bg-raised-hover");return r.jsxs("div",{ref:v,role:"dialog","aria-modal":"false","aria-label":l("sidebar.newChat.title"),"data-new-chat-panel":"","data-native-view-overlay":"","data-floating":h.floating?"":void 0,onKeyDown:N,style:{...a,left:h.left,width:h.width},className:I("fixed top-0 z-40 flex animate-panel-in flex-col",!h.floating&&"bottom-0 border-e border-hairline/40 bg-app shadow-2xl shadow-black/40"),children:[r.jsxs("div",{className:I("flex h-12 shrink-0 items-center gap-2 px-4",h.floating&&"rounded-b-2xl bg-app"),children:[r.jsx("label",{htmlFor:"new-chat-to",className:"shrink-0 text-[14px] text-ink-secondary",children:l("sidebar.newChat.to")}),r.jsx("input",{id:"new-chat-to",autoFocus:!0,dir:"auto",value:d,onChange:R=>{u(R.target.value),m(w.length)},placeholder:l("sidebar.newChat.placeholder"),"aria-label":l("sidebar.newChat.placeholder"),"aria-controls":"new-chat-bots",autoComplete:"off",spellCheck:!1,className:"h-7 min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),r.jsx("button",{type:"button",onClick:t,"aria-label":l("common.close"),title:l("common.close"),className:"-me-2 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-secondary outline-none hover:bg-raised hover:text-ink focus-visible:bg-raised",children:r.jsx(Ae,{size:16})})]}),r.jsxs("div",{id:"new-chat-bots",role:"list",style:{maxHeight:g},className:"mx-3 mt-2 min-h-0 overflow-y-auto rounded-2xl border border-hairline/60 bg-composer p-1.5 shadow-xl shadow-black/25 [scrollbar-width:thin]",children:[w.map((R,O)=>r.jsx("div",{role:"listitem",children:r.jsxs("button",{type:"button",ref:O===S?y:void 0,onClick:R.run,onMouseMove:()=>m(O),className:C(O),children:[r.jsx("span",{"aria-hidden":"true",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-raised-hover text-ink-secondary",children:R.icon}),r.jsx("span",{className:"truncate",children:R.label})]})},R.key)),i.bots.every(R=>R.hidden)?r.jsx("div",{className:"px-3 py-4 text-center text-[13px] text-ink-secondary",children:l("sidebar.newChannel.emptyHint")}):b.length===0?r.jsx("div",{className:"px-3 py-4 text-center text-[13px] text-ink-secondary",children:l("sidebar.newChat.noMatch",{query:d.trim()})}):b.map((R,O)=>{const q=w.length+O,L=Kle(R);return r.jsx("div",{role:"listitem",children:r.jsxs("button",{type:"button",ref:q===S?y:void 0,onClick:()=>A(R),onMouseMove:()=>m(q),"aria-label":`${R.name}${L?`, ${L}`:""}. ${E}`,title:L||void 0,className:C(q),children:[r.jsx(Ge,{bot:R,state:"happy",size:32,animated:!1}),r.jsx("span",{dir:"auto",className:"min-w-0 flex-1 truncate",children:R.name})]})},R.id)})]})]})}const hy="omb:open-command-palette";function HN(){window.dispatchEvent(new Event(hy))}function Gle({onOpenChange:e}){const{state:t,dispatch:n}=se(),s=Qe(),[a,i]=f.useState(!1),[o,c]=f.useState(""),[d,u]=f.useState([]),[p,m]=f.useState(0),h=f.useRef(null);f.useEffect(()=>{const A=N=>{(N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"&&!N.shiftKey&&!N.altKey&&(N.preventDefault(),i(C=>!C))},_=()=>i(!0);return window.addEventListener("keydown",A),window.addEventListener(hy,_),()=>{window.removeEventListener("keydown",A),window.removeEventListener(hy,_)}},[]),f.useEffect(()=>{a&&(c(""),u([]),m(0))},[a]),f.useEffect(()=>{e?.(a)},[e,a]);const x=o.trim().toLowerCase();if(f.useEffect(()=>{if(!a||!x){u([]);return}u([]);let A=!0;const _=setTimeout(()=>{K(`/api/search?q=${encodeURIComponent(x)}&limit=12`).then(N=>A&&u(N.hits??[])).catch(()=>A&&u([]))},150);return()=>{A=!1,clearTimeout(_)}},[a,x]),f.useEffect(()=>m(0),[x]),f.useEffect(()=>{h.current?.scrollIntoView({block:"nearest"})},[p,d]),!a)return null;const g=fy(t.bots.filter(A=>!A.hidden),x),k=fy(t.groups,x),v=[...g.map(A=>({kind:"bot",bot:A})),...k.map(A=>({kind:"room",group:A})),...x?d.map(A=>({kind:"message",hit:A})):[]],y=v.length?Math.min(p,v.length-1):0,b=async A=>{if(A.kind==="message"){const _=A.hit;try{await W2(_,t,n,s)}catch(N){n({type:"error",message:N instanceof Error?N.message:String(N)})}}else A.kind==="bot"?qt(n,A.bot,s):n({type:"select",id:A.group.id});i(!1)},w=A=>{if(Os(A.nativeEvent)){A.stopPropagation();return}if(A.key==="Escape")A.preventDefault(),A.stopPropagation(),i(!1);else if(A.key==="ArrowDown")A.preventDefault(),m(v.length?(y+1)%v.length:0);else if(A.key==="ArrowUp")A.preventDefault(),m(v.length?(y-1+v.length)%v.length:0);else if(A.key==="Enter"){A.preventDefault();const _=v[y];_&&b(_)}},j=g.length,S=g.length+k.length,E=(A,_,N,C,R=!1)=>r.jsx("button",{ref:_===y?h:void 0,onClick:N,onMouseMove:()=>m(_),className:I("flex min-h-10 w-full items-center gap-3 rounded-lg px-3 py-2 text-left",R&&"flex-col items-stretch gap-0.5",_===y?"bg-menu-active":"hover:bg-menu-hover"),children:C},A);return r.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-6 pt-[14vh] [:root[data-skin=daylight]_&]:bg-black/[0.18]",onMouseDown:A=>A.target===A.currentTarget&&i(!1),onKeyDown:w,children:r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":l("palette.label"),className:"popover-surface flex max-h-[min(480px,70vh)] w-full max-w-[560px] flex-col overflow-hidden rounded-[var(--radius-menu)] border border-hairline/50 bg-menu shadow-2xl shadow-black/60",children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-4 py-3",children:[r.jsx(Cn,{size:16,className:"shrink-0 text-ink-secondary"}),r.jsx("input",{autoFocus:!0,value:o,onChange:A=>c(A.target.value),"aria-label":l("commandPalette.searchLabel"),placeholder:l("commandPalette.searchPlaceholder"),className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),r.jsx("kbd",{className:"shrink-0 rounded-md border border-hairline/40 px-1.5 py-0.5 text-[11px] text-ink-secondary",children:"esc"})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[v.length===0&&r.jsx("div",{className:"px-3 py-6 text-center text-[13px] text-ink-secondary",children:x?l("sidebar.noMatch",{query:o}):l("palette.empty")}),g.length>0&&r.jsx("div",{className:"px-3 pb-1 pt-1.5 text-[12px] font-medium text-ink-tertiary",children:l("palette.bots")}),g.map((A,_)=>E(`bot:${A.id}`,_,()=>{b({kind:"bot",bot:A})},r.jsxs(r.Fragment,{children:[r.jsx(Ge,{bot:A,state:"happy",size:22,animated:!1}),r.jsx("span",{className:"truncate text-[14px] text-ink",children:A.name}),A.title&&r.jsx("span",{className:"min-w-0 truncate text-[13px] text-ink-secondary",children:A.title})]}))),k.length>0&&r.jsx("div",{className:"px-3 pb-1 pt-2 text-[12px] font-medium text-ink-tertiary",children:l("palette.groups")}),k.map((A,_)=>E(`room:${A.id}`,j+_,()=>{b({kind:"room",group:A})},r.jsxs(r.Fragment,{children:[r.jsx(Tn,{size:16,strokeWidth:1.75,className:"mx-[3px] shrink-0 text-ink-secondary"}),r.jsx("span",{className:"truncate text-[14px] text-ink",children:A.name})]}))),x&&d.length>0&&r.jsx("div",{className:"px-3 pb-1 pt-2 text-[12px] font-medium text-ink-tertiary",children:l("palette.messages")}),x&&d.map((A,_)=>{const N=A.snippet.slice(0,A.matchStart),C=A.snippet.slice(A.matchStart,A.matchStart+A.matchLength),R=A.snippet.slice(A.matchStart+A.matchLength);return E(`msg:${A.threadId}:${A.messageId}`,S+_,()=>{b({kind:"message",hit:A})},r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"flex items-center gap-2 truncate text-[13px] font-medium text-ink",children:[r.jsx(UV,{size:13,className:"shrink-0 text-ink-secondary"}),A.name,A.task?r.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",A.task]}):null]}),r.jsxs("span",{className:"line-clamp-2 text-[13px] text-ink-secondary",children:[N,r.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:C}),R]})]}),!0)})]})]})})}const Yle=["none","view","chat","edit"],WN=e=>Yle.indexOf(e??"none"),yM=(e,t)=>WN(e)>=WN(t),Jle=(e,t)=>yM(e,t)?e:t;function Zle(e){return e===void 0||e==="everyone"?{everyone:"chat",people:{}}:e==="admins"?{everyone:"none",people:{}}:{everyone:"none",people:Object.fromEntries(e.people.map(t=>[t.trim().toLowerCase(),"chat"]))}}function Xle(e,t){return e.startsWith("@")?t.endsWith(e)&&t.length>e.length:e===t}function cDe(e,t){const n=t.trim().toLowerCase();let s=e.everyone;if(!n)return s;for(const[a,i]of Object.entries(e.people))Xle(a,n)&&(s=Jle(s,i));return s}function Qle(e,t){const n=Object.entries(e.people),s=t.people;return e.everyone===t.everyone&&n.length===Object.keys(s).length&&n.every(([a,i])=>s[a]===i)}function kM(e){return e.access??Zle(e.visibility)}const ece=e=>e.yourAccess==="edit",tce=e=>e==="edit"?null:"chat";function nce(e,t,n,s){const a=s.trim().toLowerCase();return e.people.filter(i=>i.role==="member"&&i.email!==n&&!Object.hasOwn(t.people,i.email)).filter(i=>!a||i.name.toLowerCase().includes(a)||i.email.includes(a)).sort((i,o)=>i.name.localeCompare(o.name))}function xy(e,t,n){const s={...e.people};return n?s[t]=n:delete s[t],{everyone:e.everyone,people:s}}const vM=(e,t)=>t?.people.find(n=>n.email===e)??null,qp=(e,t)=>vM(e,t)?.name??e;async function sce(e,t){return(await K(`/api/bots/${e}/reports-to`,{method:"PUT",body:JSON.stringify({email:t})})).bot}async function G2(e,t){return(await K(`/api/bots/${e}/access`,{method:"PUT",body:JSON.stringify(t)})).bot}const rce=["ask","edits","auto","full"];function ace(e,t){const n=t.trim();return e.filter(s=>!s.hidden&&(s.section?.trim()||"")===n)}const Y2=(e,t)=>t.find(n=>n.instanceId===e.modelSelection.instanceId);function ice(e,t){return Cw(e,t)&&!(e==="antigravityAgent"&&t==="auto")}function oce(e,t){const n=new Map,s=new Set;for(const a of e){const i=Y2(a,t);if(!i||s.has(i.instanceId))continue;s.add(i.instanceId);const o=[i.models.default,...i.models.options.filter(c=>!c.orgBlocked&&!c.needsCliUpdate).map(c=>c.id)].filter(c=>c.trim());for(const c of new Set(o)){const d=i.models.options.find(p=>p.id===c)?.label??c,u=n.get(c)??{id:c,label:d,engines:[]};u.engines.includes(i.displayName)||u.engines.push(i.displayName),n.set(c,u)}}return[...n.values()].sort((a,i)=>a.label.localeCompare(i.label))}function lce(e,t,n){const s=new Set;for(const a of e){const i=Y2(a,t);if(!i?.capabilities?.modelVariants)for(const o of i?.capabilities?.effortLevels??[])s.add(o)}return n.filter(a=>s.has(a))}function wM(e,t){if(e.defaultBot?.person)return{bot:e,status:"skip",reason:l("teamSettings.skip.ownMausBot")};if(e.yourAccess!=="edit")return{bot:e,status:"skip",reason:l("teamSettings.skip.cantShare")};const n=kM(e);let s=t.everyone?{...n,everyone:t.everyone}:n;const a=t.person,i=!a||a.email===Lr(e)||a.level&&yM(n.people[a.email],a.level);return a&&!i&&(s={...s,...xy(s,a.email,a.level)}),Qle(n,s)?{bot:e,status:"unchanged"}:{bot:e,status:"apply",access:s}}function cce(e,t,n){return e.map(s=>{if(n.kind==="access")return wM(s,n);const a=Y2(s,t),i=a?.displayName??s.modelSelection.instanceId;if(n.kind==="approval")return[In(s),...zA(s)].every(p=>p===n.mode)?{bot:s,status:"unchanged"}:ice(a?.driverKind,n.mode)?{bot:s,status:"apply",patch:{approvalMode:n.mode,applyToAllThreads:!0}}:{bot:s,status:"skip",reason:l("teamSettings.skip.modeUnsupported",{engine:i})};const o=s.modelSelection;if(!a)return{bot:s,status:"skip",reason:l("teamSettings.skip.engineMissing")};const c=n.model??o.model;if(!(c===a.models.default||a.models.options.some(p=>p.id===c&&!p.orgBlocked&&!p.needsCliUpdate)))return{bot:s,status:"skip",reason:l("teamSettings.skip.modelUnsupported",{engine:i,model:c})};const u={instanceId:o.instanceId,model:c};if(o.variant&&c===o.model&&(u.variant=o.variant),n.effort===void 0)o.effort&&(u.effort=o.effort);else if(n.effort!==null){if(a.capabilities?.modelVariants)return{bot:s,status:"skip",reason:l("teamSettings.skip.variantsOnly",{engine:i})};if(!(a.capabilities?.effortLevels??[]).includes(n.effort))return{bot:s,status:"skip",reason:l("teamSettings.skip.effortUnsupported",{engine:i})};u.effort=n.effort,delete u.variant}return u.model===o.model&&u.effort===o.effort&&u.variant===o.variant?{bot:s,status:"unchanged"}:s.busy?{bot:s,status:"skip",reason:l("teamSettings.skip.busy")}:{bot:s,status:"apply",patch:{modelSelection:u,keepThreadModels:!0}}})}function dce(e){return e.some(t=>t.status==="apply"&&"patch"in t&&t.patch.approvalMode==="auto"&&t.bot.computer==="local")}async function uce(e,t,n={}){const s=[];for(const a of e){if(a.status==="unchanged")s.push({bot:a.bot,status:"unchanged"});else if(a.status==="skip")s.push({bot:a.bot,status:"skipped",reason:a.reason});else{const i="access"in a?null:n.acknowledgeLocalAuto&&a.patch.approvalMode==="auto"&&a.bot.computer==="local"?{...a.patch,acknowledgeLocalAuto:!0}:a.patch;try{let o;if(i)await t(a.bot,i);else if("access"in a&&n.share)o=await n.share(a.bot,a.access);else throw new Error(l("teamSettings.skip.cantShare"));s.push({bot:a.bot,status:o==="unchanged"?"unchanged":"applied"})}catch(o){s.push({bot:a.bot,status:"skipped",reason:o instanceof Error?o.message:String(o)})}}n.onProgress?.(s.length)}return s}function pce(e){return{applied:e.filter(t=>t.status==="applied").length,unchanged:e.filter(t=>t.status==="unchanged").length,skipped:e.filter(t=>t.status==="skipped").length}}let Ms=null;const gy=new Set;function jM(e){Ms=e;for(const t of gy)t()}const Qu=jM;function mce(){return Ms}function bn(){return f.useSyncExternalStore(e=>(gy.add(e),()=>gy.delete(e)),()=>Ms,()=>Ms)}function J2(){const e=bn();return f.useMemo(()=>{const t=e?.people??[],n=Gse(t.map(s=>({key:s.email,name:s.name}))).flatMap(s=>s.names.map(a=>({name:a,person:!0})));return{people:t.filter(s=>!s.you),peers:n}},[e?.people])}function fce(e,t){return e.pictureUrl??t?.people.find(n=>n.email===e.email)?.pictureUrl}function yo(e,t){const n=Lr(e);return n?t?.people.find(s=>s.email===n)??{email:n,name:px(n),role:"member"}:null}function hce(e,t){if(!t||e.length===0)return null;const n=e.map(a=>yo(a,t)),s=n[0];return s&&n.every(a=>a?.email===s.email)?s:null}function KN(e,t){const n=e.defaultBot?.person?.trim().toLowerCase();if(!n||!t||t.me?.email.toLowerCase()===n)return e.name;const s=t.people.find(a=>a.email.toLowerCase()===n);return`${e.name} · ${s?.name||px(n)}`}function dDe(e,t,n){const s=t?.me?.email.toLowerCase();return e.filter(a=>a.id===n||!a.hidden&&(!t||(a.yourAccess===void 0||a.yourAccess==="chat"||a.yourAccess==="edit")&&(!a.defaultBot?.person||a.defaultBot.person.trim().toLowerCase()===s)))}function Yf(e,t){return!!(t&&!e.defaultBot?.person&&(t.admin||t.me&&Lr(e)===t.me.email))}function xce(e,t,n){return!n||t?.private?null:yo(e,n)}async function Z2(){const e=await K("/api/team/people",{background:!0}),t=Array.isArray(e?.people)?e.people:[];return{people:t,me:t.find(n=>n.you)??null,presence:t.some(n=>typeof n.here=="boolean")}}const NM=e=>e.kind==="session"?e.scopes.includes("admin"):e.kind==="loopback";async function SM(){const e=await K("/api/needs-you",{background:!0});return Array.isArray(e?.items)?e.items:[]}let b1=null;function X2(){!Ms||b1||(b1=setTimeout(()=>{b1=null,SM().then(e=>{Ms&&Qu({...Ms,needsYou:e})}).catch(()=>{})},800))}function gce(e,t,n){const s=a=>`${a.id}:${a.reportsTo??""}:${a.activity??""}:${(a.tasks??[]).filter(i=>i.activity==="waiting-on-you").length}:${(a.tasks??[]).filter(i=>i.unread).length}:${V7(a)}`;return`${e.map(s).join("|")}|${t.filter(a=>a.unread).length}|${n.length}:${n.filter(a=>!a.read).length}`}let y1=null;function bce(){!Ms||y1||(y1=setTimeout(()=>{y1=null,Z2().then(e=>{Ms&&Qu({...Ms,...e})}).catch(()=>{})},800))}function by(){Ms&&Promise.all([Z2(),oo()]).then(([e,t])=>{Ms&&Qu({...Ms,...e,admin:NM(t)})}).catch(()=>{})}let yy="ready";const ky=new Set;function Hm(e){yy=e;for(const t of ky)t()}function yce(){return f.useSyncExternalStore(e=>(ky.add(e),()=>ky.delete(e)),()=>yy,()=>yy)}let hd=0;function IM(){const e=++hd;Hm("loading"),Promise.all([Z2(),oo(),SM()]).then(([t,n,s])=>{e===hd&&(Qu({...t,admin:NM(n),needsYou:s}),Hm("ready"))}).catch(()=>{e===hd&&Hm("failed")})}const kce=IM;function vce(e,t){const n=KE(e)?.id??null;f.useEffect(()=>{if(!n){hd+=1,Qu(null),Hm("ready");return}return IM(),()=>{hd+=1}},[n]),f.useEffect(()=>{n&&X2()},[n,t]),f.useEffect(()=>{n&&bce()},[n,e])}function Q2(){X2()}const wce=250,VN=300;function k1(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function jce(e,t,n){const s=e.x<=n.left?n.left:n.right,a={x:s,y:n.top},i={x:s,y:n.bottom},o=k1(t,e,a),c=k1(t,a,i),d=k1(t,i,e),u=o<0||c<0||d<0,p=o>0||c>0||d>0;return!(u&&p)}const Nce={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)};function CM({open:e,close:t,submenuBox:n,timers:s=Nce}){let a=null,i=null,o=null,c=null;const d=()=>{i&&s.clear(i.handle),i=null},u=()=>{o&&s.clear(o),o=null},p=()=>{u(),a!==null&&(a=null,c=null,t())},m=x=>{d(),u(),a!==x&&(a=x,e(x))},h=x=>{const g=n();return!!(c&&g&&jce(c,x,g))};return{enterRow(x,g,k){if(d(),a!==null&&x===a){u(),c=k;return}a!==null&&(h(k)?o??=s.set(p,VN):p()),g&&(i={key:x,handle:s.set(()=>m(x),wce)})},leaveRow(x){i?.key===x&&d()},move(x,g){if(g){c=x;return}o&&!h(x)&&p()},leaveMenu(){d(),a!==null&&(o??=s.set(p,VN))},enterSubmenu(){u()},openNow:m,closeNow:p,reset(){d(),u(),a=null,c=null},get openKey(){return a}}}const Sce=80,Ice=250,Cce=237,GN=320,sn=8,YN=6;function Ece(e,t,n,s=!1,a="start"){const i=Math.max(sn,n.width-t.width-sn),c=Math.min(Math.max((a==="end"?!s:s)?e.right-t.width:e.left,sn),i),d=e.top-YN-t.height,u=e.bottom+YN,p=u+t.height<=n.height-sn,m=a==="end"?p||d<sn?u:d:d>=sn?d:u,h=Math.max(sn,n.height-t.height-sn);return{left:c,top:Math.min(Math.max(m,sn),h)}}function EM(e,t,n,s,a=!1){const o=a?e.left-4-n.width:e.right+4,c=a?e.right+4:e.left-4-n.width,d=h=>h>=sn&&h+n.width<=s.width-sn,u=d(o)?o:d(c)?c:o,p=Math.max(sn,s.width-n.width-sn),m=Math.max(sn,s.height-n.height-sn);return{left:Math.min(Math.max(u,sn),p),top:Math.min(Math.max(t.top-6,sn),m)}}const v1=e=>typeof getComputedStyle=="function"&&e?getComputedStyle(e).direction==="rtl":!1,w1=e=>e?[...e.querySelectorAll(':scope > div > [role^="menuitem"]:not(:disabled)')]:[];function Jf(e,t,n){if(n===0)return null;switch(e){case"ArrowDown":return t<0?0:(t+1)%n;case"ArrowUp":return t<0?n-1:(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}function JN({items:e,openSubmenu:t,engaged:n=!1,onItem:s,onRowEnter:a,onRowLeave:i}){return r.jsx(r.Fragment,{children:e.map(o=>r.jsxs("div",{className:"flex flex-col gap-1",children:[o.separatorBefore&&r.jsx("div",{role:"separator",className:Yl}),o.heading&&r.jsx("div",{className:Ou,children:o.heading}),r.jsxs("button",{type:"button",role:o.checked===void 0?"menuitem":"menuitemradio","aria-checked":o.checked,"data-tour":o.tourId,"data-menu-key":o.key,title:o.title,disabled:o.disabled,"aria-haspopup":o.submenu?"menu":void 0,"aria-expanded":o.submenu?t===o.key:void 0,onClick:c=>s(o,c.currentTarget,c.detail===0),onPointerEnter:c=>a?.(o,c.currentTarget,{x:c.clientX,y:c.clientY}),onPointerLeave:()=>i?.(o),className:I("flex min-h-[30px] w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[14px] leading-[18px] disabled:opacity-60 focus-visible:bg-menu-hover focus-visible:outline-none",o.active||o.submenu&&t===o.key&&n?"bg-menu-active text-ink":"text-ink hover:bg-menu-hover"),children:[o.icon&&r.jsx("span",{className:I("flex size-4 shrink-0 items-center justify-center [&>svg]:size-4",o.wrap&&"h-[18px] self-start",o.active?"text-accent":"text-ink-secondary"),children:o.icon}),o.subtitle||o.note?r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:o.wrap?"break-words":"truncate",children:o.label}),o.subtitle&&r.jsx("span",{className:"truncate text-[12px] font-normal leading-4 text-ink-secondary",children:o.subtitle}),o.note&&r.jsx("span",{className:"text-[12px] font-normal leading-snug text-ink-tertiary",children:o.note})]}):r.jsx("span",{className:I("flex-1",o.wrap?"min-w-0 break-words":"truncate"),children:o.label}),o.value&&r.jsx("span",{className:"shrink-0 text-[13px] font-normal leading-[18px] tabular-nums text-ink-secondary",children:o.value}),o.trailing,o.attention&&r.jsx("span",{className:I("size-2 shrink-0 rounded-full",o.attentionTone==="accent"?"bg-accent":"bg-danger")}),(o.submenu||o.chevron)&&r.jsx(at,{size:14,"aria-hidden":!0,className:"-me-0.5 shrink-0 text-ink-secondary rtl:-scale-x-100"})]})]},o.key))})}const ZN=e=>V2({key:e.key,defaultPrevented:e.defaultPrevented,isComposing:e.nativeEvent.isComposing});function Ps({items:e,ariaLabel:t,openOnHover:n=!1,placement:s="above",align:a="start",triggerClassName:i="w-full",triggerTitle:o,triggerLabel:c,triggerTour:d,onOpenChange:u,renderTrigger:p}){const[m,h]=f.useState(!1),[x,g]=f.useState(!1),[k,v]=f.useState(null),[y,b]=f.useState(null),[w,j]=f.useState(null),S=f.useRef(null),E=f.useRef(null),A=f.useRef(null),_=f.useRef(null),N=f.useRef(null),C=f.useRef(new Map),[R,O]=f.useState(!1),q=f.useRef(null);q.current??=CM({open:ee=>{N.current=C.current.get(ee)??null,j(null),v(ee)},close:()=>{v(null),O(!1)},submenuBox:()=>_.current?.getBoundingClientRect()??null});const L=q.current,P=f.useRef(!1),$=f.useRef(null),M=f.useRef(null),F=f.useId(),W=us(m),z=s==="above",B=f.useRef(u);B.current=u,f.useEffect(()=>{B.current?.(m)},[m]);const D=()=>{$.current&&clearTimeout($.current),M.current&&clearTimeout(M.current),$.current=null,M.current=null};f.useEffect(()=>()=>{D(),q.current?.reset()},[]);const T=()=>{!n||x||(D(),$.current=setTimeout(()=>h(!0),Sce))},V=()=>{!n||x||(D(),M.current=setTimeout(()=>h(!1),Ice))},U=f.useCallback((ee=!1)=>{D(),q.current?.reset(),g(!1),h(!1),v(null),O(!1),ee&&E.current?.focus()},[]),H=f.useRef({contains:ee=>[S.current,A.current,_.current].some(oe=>oe?.contains(ee))});ha(m,H,()=>U(z)),f.useLayoutEffect(()=>{if(!W.shown)return;const ee=()=>{const oe=E.current,ae=A.current;if(!oe||!ae)return;const te={width:window.innerWidth,height:window.innerHeight};z&&b(Ece(oe.getBoundingClientRect(),{width:ae.offsetWidth,height:ae.offsetHeight},te,v1(oe),a));const ce=_.current,ue=N.current;ce&&ue&&j(EM(ae.getBoundingClientRect(),ue.getBoundingClientRect(),{width:ce.offsetWidth,height:ce.offsetHeight},te,v1(oe)))};return ee(),window.addEventListener("resize",ee),window.addEventListener("scroll",ee,!0),()=>{window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0)}},[z,a,W.shown,k,e.length]),f.useEffect(()=>{!m||!P.current||z&&!y||(P.current=!1,w1(A.current)[0]?.focus())},[m,z,y]);const G=(ee,oe,ae=!1)=>{C.current.set(ee.key,oe),L.openNow(ee.key),ae&&requestAnimationFrame(()=>w1(_.current)[0]?.focus())},Z=(ee=!1)=>{L.closeNow(),ee&&N.current?.focus()},Y=(ee,oe,ae)=>{if(ee.submenu){k===ee.key?Z():G(ee,oe,ae);return}ee.onSelect(),ee.keepOpen||U(z)},ne=(ee,oe)=>{const ae=ee.currentTarget,te=w1(ae),ce=te.indexOf(document.activeElement),ue=Jf(ee.key,ce,te.length);if(ue!=null){ee.preventDefault(),te[ue]?.focus();return}const Se=v1(ae),ie=Se?"ArrowLeft":"ArrowRight",ke=Se?"ArrowRight":"ArrowLeft",xe=te[ce],Ne=xe?e.find(re=>re.key===xe.dataset.menuKey):void 0;!oe&&ee.key===ie&&Ne?.submenu&&xe?(ee.preventDefault(),G(Ne,xe,!0)):oe&&(ee.key===ke||ee.key==="Escape")?(ee.preventDefault(),ee.stopPropagation(),Z(!0)):!oe&&ZN(ee)?(ee.preventDefault(),ee.stopPropagation(),U(!0)):ee.key==="Tab"&&z&&(ee.preventDefault(),U(!0))},J=k?e.find(ee=>ee.key===k):void 0,X=I(Jt,"overflow-hidden"),me=W.shown&&r.jsx("div",{ref:A,id:F,role:"menu","aria-label":t,"data-sidebar-popover-menu":z?"anchored":void 0,...W.exitProps,onKeyDown:ee=>ne(ee,!1),onPointerMove:ee=>L.move({x:ee.clientX,y:ee.clientY},!!(k&&N.current?.contains(ee.target))),onPointerLeave:()=>L.leaveMenu(),style:z?{position:"fixed",left:y?.left??0,top:y?.top??0,minWidth:Cce,width:"max-content",maxWidth:`min(${GN}px, calc(100vw - ${sn*2}px))`,maxHeight:`calc(100vh - ${sn*2}px)`,visibility:y?void 0:"hidden"}:void 0,className:I(X,z?"z-[60] overflow-y-auto":"absolute z-40",s==="below"&&"top-full right-0 mt-1 w-72 max-w-[calc(100vw-2rem)]",W.className),children:r.jsx(JN,{items:e,openSubmenu:k,engaged:R,onItem:Y,onRowEnter:(ee,oe,ae)=>{ee.submenu&&C.current.set(ee.key,oe),L.enterRow(ee.key,!!ee.submenu,ae)},onRowLeave:ee=>L.leaveRow(ee.key)})}),ge=W.shown&&J?.submenu&&r.jsx("div",{ref:_,role:"menu","aria-label":J.label,"data-sidebar-popover-submenu":!0,onKeyDown:ee=>ne(ee,!0),onPointerEnter:()=>{L.enterSubmenu(),O(!0)},onPointerLeave:()=>O(!1),onFocus:()=>O(!0),onBlur:ee=>{ee.relatedTarget instanceof Node&&ee.currentTarget.contains(ee.relatedTarget)||O(!1)},style:{position:"fixed",left:w?.left??0,top:w?.top??0,minWidth:200,width:"max-content",maxWidth:`min(${GN}px, calc(100vw - ${sn*2}px))`,maxHeight:`calc(100vh - ${sn*2}px)`,visibility:w?void 0:"hidden"},className:I(X,"z-[61] animate-pop-in overflow-y-auto"),children:r.jsx(JN,{items:J.submenu,onItem:ee=>{ee.onSelect(),ee.keepOpen||U(!0)}})});return r.jsxs("div",{ref:S,className:"relative",onPointerEnter:T,onPointerLeave:V,onFocus:()=>n&&h(!0),onBlur:ee=>{x||(!ee.relatedTarget||!H.current.contains(ee.relatedTarget))&&h(!1)},children:[r.jsx("button",{ref:E,type:"button","aria-haspopup":"menu","aria-expanded":m,"aria-controls":m?F:void 0,"aria-label":c??t,title:o,"data-tour":d,onClick:ee=>{D(),m&&(x||!n)?U():(P.current=z&&ee.detail===0,g(!0),h(!0))},onKeyDown:ee=>{if(m&&ZN(ee)){ee.preventDefault(),ee.stopPropagation(),U(!0);return}!z||m||ee.key!=="ArrowUp"&&ee.key!=="ArrowDown"||(ee.preventDefault(),P.current=!0,g(!0),h(!0))},className:i,children:p({open:m})}),z?typeof document<"u"&&me?Ke.createPortal(r.jsxs(r.Fragment,{children:[me,ge]}),document.body):null:r.jsxs(r.Fragment,{children:[me,typeof document<"u"&&ge?Ke.createPortal(ge,document.body):null]})]})}function Ace(e){for(const t of e){const n=t.tasks?.find(s=>s.inbox);if(n)return`${t.id}:${n.threadId}:${n.inboxChangedAt??0}:${n.openAsks??0}`}return null}function e3(e){let t=e;const n=new Set;return{get:()=>t,set(s){t=s;for(const a of n)a()},subscribe(s){return n.add(s),()=>{n.delete(s)}}}}const Pr=e3(null),t3=()=>f.useSyncExternalStore(Pr.subscribe,Pr.get,Pr.get),XN=()=>Pr.get()!==null,Tce=()=>f.useSyncExternalStore(Pr.subscribe,XN,XN),Wi=e3("unknown"),n3=()=>f.useSyncExternalStore(Wi.subscribe,Wi.get,Wi.get);let s3=0,vy=0;const AM=(e,t)=>{e<vy||(vy=e,Pr.set(t),Wi.set("yes"))};let Nc=null,j1=!1;function Ul(){return Nc?(j1=!0,Nc):(Nc=(async()=>{try{do{j1=!1;const e=++s3,t=await K("/api/inbox",{background:!0}).catch(n=>(n.status===404&&(Pr.set(null),Wi.set("no")),null));t&&Array.isArray(t.rows)&&AM(e,t)}while(j1)}finally{Nc=null}})(),Nc)}function _ce(e){f.useEffect(()=>{Wi.get()!=="no"&&Ul()},[e]),f.useEffect(()=>{const t=()=>{Wi.get()!=="no"&&Ul()};return window.addEventListener("focus",t),()=>window.removeEventListener("focus",t)},[])}const Lx=(e,t)=>{vy=++s3;const n=Pr.get();n&&Pr.set({...n,rows:n.rows.map(s=>s.id===e?{...s,...t}:s)})};async function TM(e,t,n){const s=++s3,a=await K(`/api/inbox/${e}/${t}`,{method:"POST",background:!0}).catch(()=>null);if(a&&Array.isArray(a.rows))return AM(s,a);Lx(e,n),Ul()}function Ki(e){e.unread&&(Lx(e.id,{unread:!1}),TM(e.id,"read",{unread:!0}))}const Mce=e=>Lx(e.id,{tab:"done",unread:!1});function Rce(e){const t=Pr.get()?.rows.find(n=>n.id===e.id);Lx(e.id,{tab:"done",unread:!1}),TM(e.id,"done",t?{tab:t.tab,unread:t.unread}:{})}async function Oce(e,t,n){const s=e.threadId?null:t.origin,a=s?.groupId?`/api/groups/${s.groupId}/messages`:`/api/bots/${s?.botId??e.botId}/messages`;await K(a,{method:"POST",body:JSON.stringify({text:n,threadId:s?.threadId??e.threadId,replyToId:t.id,sendId:dr()})}),Ul()}const hr=e3({open:!1,reading:null}),r3=()=>f.useSyncExternalStore(hr.subscribe,hr.get,hr.get);function Hl(e={}){hr.set({...hr.get(),open:!0,reading:e.reading??null}),Ul()}const xd=()=>hr.set({...hr.get(),open:!1,reading:null}),Wm=e=>hr.set({...hr.get(),reading:e}),zce=e=>hr.set({...hr.get(),wide:e}),Km=[];function _M(e){Km.at(-1)?.(e)}function Lce(){const[e,t]=f.useState(null);f.useEffect(()=>(Km.push(t),()=>{Km.splice(Km.lastIndexOf(t),1)}),[]);const n=f.useCallback(()=>t(null),[]);return r.jsx($ce,{target:e,onClose:n})}const Pce=e=>e.name.trim().charAt(0).toUpperCase()||"?",QN=["bg-[#5B8DEF]","bg-[#E0745B]","bg-[#4FAF7F]","bg-[#B26BD9]","bg-[#D9A23B]","bg-[#3BA7B8]"],Dce=e=>QN[[...e].reduce((t,n)=>t+n.charCodeAt(0),0)%QN.length];function Xs({person:e,size:t=18}){const n=fce(e,bn()),[s,a]=f.useState(null);return n&&s!==n?r.jsx("img",{src:n,alt:"","aria-hidden":"true",draggable:!1,"data-person-picture":e.email,onError:()=>a(n),style:{width:t,height:t},className:"inline-block shrink-0 rounded-full bg-raised object-cover"}):r.jsx("span",{"aria-hidden":"true",style:{width:t,height:t,fontSize:Math.round(t*.55)},className:I("inline-flex shrink-0 items-center justify-center rounded-full font-semibold leading-none text-white",Dce(e.email)),children:Pce(e)})}function $ce({target:e,onClose:t}){const{dispatch:n}=se(),s=bn(),a=mo(e),i=a.value,[o,c]=f.useState(!1);if(f.useEffect(()=>{if(!e)return;const m=x=>{(!(x.target instanceof Element)||!x.target.closest("[data-owner-picker]"))&&t()},h=x=>{x.key==="Escape"&&t()};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[e,t]),!a.shown||!i||!s)return null;const d=async m=>{c(!0);try{if(i.botIds.length===1){const h=await K(`/api/bots/${i.botIds[0]}/reports-to`,{method:"PUT",body:JSON.stringify({email:m.email})});h?.bot&&n({type:"botPatched",bot:h.bot})}else{const h=await K("/api/team/reports-to",{method:"PUT",body:JSON.stringify({botIds:i.botIds,email:m.email})});for(const x of h?.bots??[])n({type:"botPatched",bot:x})}Q2(),t()}catch(h){n({type:"error",message:h instanceof Error?h.message:String(h)})}finally{c(!1)}},u=Math.max(8,Math.min(i.y,window.innerHeight-320)),p=Math.max(8,Math.min(i.x,window.innerWidth-260));return Ke.createPortal(r.jsxs("div",{"data-owner-picker":!0,role:"menu","aria-label":i.title,style:{top:u,left:p},className:I("fixed z-50 w-[248px] overflow-hidden",Jt,a.className),...a.exitProps,children:[r.jsx("div",{className:Ou,children:i.title}),r.jsx("div",{className:"flex max-h-[260px] flex-col gap-1 overflow-y-auto",children:s.people.map(m=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m.email===i.current,disabled:o,onClick:()=>{d(m)},className:I("flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[14px] leading-[18px] text-ink",m.email===i.current?"bg-menu-active":"hover:bg-menu-hover"),children:[r.jsx(Xs,{person:m,size:20}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate",children:m.you?l("owner.you",{name:m.name}):m.name}),r.jsx("span",{className:"block truncate text-[11px] text-ink-secondary",children:m.email})]}),m.email===i.current&&r.jsx(Ie,{size:14,className:"shrink-0 text-accent"})]},m.email))}),r.jsx("div",{className:"px-2 pb-1 text-[12px] leading-4 text-ink-tertiary",children:l("lookedAfter.pickHint")})]}),document.body)}function eS(e,t){const n=yo(e,t);return n?l("lookedAfter.menu",{name:n.name}):l("lookedAfter.menuNone")}function wy(e,t,n){if(!e.length)return;const s=e.length===1&&n.name===void 0?l("lookedAfter.pickTitle"):l("lookedAfter.setForAllTitle",{name:n.name??""}),a=e.length===1?yo(e[0],t)?.email??null:hce(e,t)?.email??null;_M({botIds:e.map(i=>i.id),title:s,current:a,x:n.x,y:n.y})}function Bce(e,t,n){const s=e.find(a=>a.threadId===n||a.tasks?.some(i=>i.threadId===n));(s?K(`/api/groups/${s.id}/read`,{method:"POST"}):K(`/api/bots/${t}/read`,{method:"POST",body:JSON.stringify({threadId:n})})).then(()=>X2()).catch(()=>{})}function Fce({item:e,title:t}){const n=e.kind==="message"&&e.fromEmail?{email:e.fromEmail,name:e.from,role:"member"}:null;return n?r.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5 text-[13px] text-ink",children:[r.jsx(Xs,{person:n,size:16}),r.jsx("span",{className:"min-w-0 truncate",children:t})]}):r.jsx("span",{className:"w-full truncate text-[13px] text-ink",children:t})}function MM({item:e,onOpened:t}){const{state:n,dispatch:s}=se(),a=Qe(),i=u=>n.bots.find(p=>p.id===u)?.name??l("needsYou.aBot"),o="botId"in e?e.botId:e.botIds[0],c=e.kind==="message"?l("needsYou.message",{name:e.from}):e.kind==="question"?l("needsYou.asking",{bot:i(o)}):l("needsYou.fix",{bot:i(o)}),d="text"in e?e.text:"";return r.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{t?.(),e.threadId&&(xn(s,{botId:o,threadId:e.threadId},n,a),e.kind==="message"&&Bce(n.groups,o,e.threadId))},className:"flex w-full flex-col items-start rounded-md px-2 py-1.5 text-left hover:bg-menu-hover",children:[r.jsx(Fce,{item:e,title:c}),d&&r.jsx("span",{className:"w-full truncate text-[12px] text-ink-secondary",children:d})]})}function qce({compact:e=!1}){const t=bn(),n=n3(),[s,a]=f.useState(!1);f.useEffect(()=>{if(!s)return;const c=d=>{(!(d.target instanceof Element)||!d.target.closest("[data-needs-you]"))&&a(!1)};return window.addEventListener("mousedown",c),()=>window.removeEventListener("mousedown",c)},[s]);const i=t?.needsYou??[];if(n!=="no"||!t||i.length===0)return null;const o=l("needsYou.count",{count:i.length});return r.jsxs("div",{"data-needs-you":!0,className:I("relative",e?"px-1":"px-2 pb-1"),children:[r.jsxs("button",{type:"button","aria-expanded":s,"aria-haspopup":"menu","aria-label":o,title:o,onClick:()=>a(c=>!c),className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-[13px] font-medium text-warning hover:bg-raised/60",children:[r.jsx(ew,{size:15,"aria-hidden":"true",className:"shrink-0"}),!e&&r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("needsYou.title")}),r.jsx("span",{className:"rounded-full bg-warning px-1.5 text-[11px] font-semibold tabular-nums text-panel",children:i.length})]}),s&&r.jsx("div",{role:"menu","aria-label":l("needsYou.title"),className:I("absolute left-2 right-2 top-full z-40 mt-1 max-h-[340px] overflow-y-auto",Jt),children:i.map(c=>r.jsx(MM,{item:c,onOpened:()=>a(!1)},`${c.kind}:${c.id}`))})]})}function Uce({botId:e,threadId:t}){const n=bn(),{state:s}=se(),a=s.bots.find(o=>o.id===e);if(!n||!a)return null;const i=xce(a,a.tasks?.find(o=>o.threadId===t),n);return i?r.jsxs("div",{"data-asking":i.email,className:"mb-1.5 flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[r.jsx(Xs,{person:i,size:14}),i.you?l("owner.askingYou"):l("owner.asking",{name:i.name})]}):null}const jy=e=>e?r.jsx(Ie,{size:14,"aria-hidden":"true"}):r.jsx("span",{"aria-hidden":"true"});function RM({label:e,shown:t,items:n,align:s="end",className:a}){return r.jsx(Ps,{items:n,ariaLabel:e,align:s,triggerClassName:I("flex max-w-full items-center gap-1 rounded-md px-2 py-1 text-[13px] leading-[18px] hover:bg-ink/[0.06] aria-expanded:bg-ink/[0.06]",a??"text-ink-secondary hover:text-ink"),renderTrigger:()=>r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"truncate",children:t}),r.jsx(kt,{size:14,"aria-hidden":"true",className:"shrink-0 opacity-70"})]})})}const tS=(e,t,n,s,a={})=>({key:e,label:t,checked:n,icon:jy(n),onSelect:s,...a});function Hce({disabled:e=!1,label:t,onRemove:n,onMakeOwner:s,makeOwnerLabel:a}){const i=[];return s&&i.push({key:"owner",label:a??"",icon:jy(!1),disabled:e,onSelect:s}),i.push({key:"remove",label:l("botAccess.remove"),icon:jy(!1),separatorBefore:!!s,disabled:e,onSelect:n}),r.jsx(RM,{label:t,shown:l("botAccess.added"),items:i})}function OM({person:e,size:t}){return e?r.jsx(Xs,{person:e,size:t}):r.jsx("span",{"aria-hidden":"true",style:{width:t,height:t},className:"inline-flex shrink-0 items-center justify-center rounded-full bg-ink/[0.08] text-ink-secondary",children:r.jsx(eE,{size:Math.round(t/2)})})}function Wce({bot:e,teamName:t,onClose:n,onChanged:s,headerMenu:a}){const i=bn(),{dispatch:o}=se(),c=f.useRef(null),[d,u]=f.useState(""),[p,m]=f.useState(!1),[h,x]=f.useState(null),g=kM(e),k=i?yo(e,i):null,v=ece(e),y=Yf(e,i);f.useEffect(()=>{const A=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),()=>{A?.isConnected&&A.focus()}},[]),f.useEffect(()=>{document.activeElement===document.body&&c.current?.focus()},[e.access,e.reportsTo,h]);const b=async A=>{if(!p){m(!0),u("");try{await A()}catch(_){u(_ instanceof Error?_.message:String(_))}finally{m(!1)}}},w=(A,_)=>b(async()=>{await G2(e.id,A),s({before:g,after:A,text:_})}),j=A=>b(async()=>{o({type:"botPatched",bot:await sce(e.id,A.email)}),Q2(),x(null)}),S=()=>{u(""),x(null)},E=!v&&i?.me&&e.yourAccess&&e.yourAccess!=="none"?r.jsx(N1,{person:i.me,you:!0,"data-share-yours":!0,trailing:null}):null;return Ke.createPortal(r.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4",onMouseDown:A=>{A.target===A.currentTarget&&n()},children:r.jsx("div",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"share-bot-title",tabIndex:-1,"data-share-bot":e.id,className:"ui-modal flex max-h-full w-full max-w-[480px] flex-col text-ink shadow-2xl outline-none",onKeyDown:A=>{A.stopPropagation(),A.key==="Escape"&&!A.defaultPrevented&&(h?S():n()),A.key==="Tab"&&Kce(A,c.current)},children:h?r.jsx(Vce,{person:h,bot:e,busy:p,error:d,onCancel:S,onConfirm:()=>{j(h)}}):r.jsxs(r.Fragment,{children:[r.jsxs("header",{className:"flex items-center justify-between gap-3 px-5 pb-3 pt-4",children:[r.jsx("h2",{id:"share-bot-title",className:"min-w-0 truncate text-[17px] font-semibold",children:l("botAccess.title",{bot:e.name})}),a]}),v&&i&&r.jsx("div",{className:"relative z-10 shrink-0 px-5 pb-1",children:r.jsx(Yce,{team:i,access:g,owner:Lr(e),disabled:p,onAdd:(A,_)=>{w(xy(g,A.email,_),l("botAccess.toast.addedPlain",{name:A.name}))}})}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 pb-2 pt-3",children:[r.jsx("h3",{className:"mb-1 text-[13px] font-semibold",children:l("botAccess.people")}),r.jsxs("ul",{"data-share-people":!0,className:"flex max-h-[min(264px,40vh)] flex-col overflow-y-auto",children:[k&&r.jsx(N1,{person:k,you:k.you===!0,trailing:r.jsx("span",{className:"px-2 text-[13px] text-ink-secondary",children:l("lookedAfter.badge")})}),E,v&&Object.keys(g.people).sort((A,_)=>qp(A,i).localeCompare(qp(_,i))).map(A=>{const _=vM(A,i);return r.jsx(N1,{entry:A,person:_,you:i?.me?.email===A,trailing:r.jsx(Hce,{disabled:p,label:l("botAccess.personMenu",{name:qp(A,i)}),onMakeOwner:y&&_?()=>{u(""),x(_)}:void 0,makeOwnerLabel:_?l("lookedAfter.make",{name:_.name}):void 0,onRemove:()=>{w(xy(g,A,null),l("botAccess.toast.removed",{name:qp(A,i)}))}})},A)})]}),r.jsx("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:l("botAccess.admins")}),v&&r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"mb-1.5 mt-4 text-[13px] font-semibold",children:l("botAccess.general")}),r.jsx(Gce,{access:g,teamName:t,disabled:p,onChange:A=>{w({everyone:A,people:g.people},A==="none"?l("botAccess.toast.onlyAdded"):l("botAccess.toast.everyoneUse",{team:t}))}})]}),d&&r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:d})]}),r.jsx("footer",{className:"flex shrink-0 justify-end px-5 pb-4 pt-3",children:r.jsx("button",{type:"button",onClick:n,className:"ui-button ui-button-primary rounded-full px-4",children:l("common.done")})})]})})}),document.body)}function Kce(e,t){const n=t?.querySelectorAll("input:enabled, button:enabled");if(!n?.length)return;const s=n[0],a=n[n.length-1];e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus())}function Vce({person:e,bot:t,busy:n,error:s,onCancel:a,onConfirm:i}){return r.jsxs("div",{"data-share-make-owner":e.email,className:"px-5 pb-4 pt-4",children:[r.jsx("h2",{id:"share-bot-title",className:"text-[17px] font-semibold",children:l("lookedAfter.makeTitle",{name:e.name,bot:t.name})}),r.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink-secondary",children:l("lookedAfter.makeBody",{name:e.name,bot:t.name})}),s&&r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:s}),r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx("button",{type:"button",autoFocus:!0,disabled:n,onClick:a,className:"ui-button rounded-full px-4",children:l("common.cancel")}),r.jsx("button",{type:"button",disabled:n,onClick:i,className:"ui-button ui-button-primary rounded-full px-4",children:l("lookedAfter.make",{name:e.name})})]})]})}function N1({person:e,entry:t,you:n,trailing:s,...a}){const i=e?.name??t??"";return r.jsxs("li",{className:"flex min-h-[40px] shrink-0 items-center gap-3 py-1","data-share-person":e?.email??t,...a,children:[r.jsx(OM,{person:e,size:32}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[14px] leading-[18px] text-ink",children:n?l("botAccess.you",{name:i}):i}),e&&r.jsx("span",{className:"block truncate text-[12px] leading-4 text-ink-secondary",children:e.email})]}),r.jsx("span",{className:"min-w-0 shrink-0",children:s})]})}function Gce({access:e,teamName:t,disabled:n,onChange:s}){const a=e.everyone!=="none",i=e.everyone==="view"?l("botAccess.everyoneHint.view",{team:t}):e.everyone==="chat"?l("botAccess.everyoneHint.chat",{team:t}):e.everyone==="edit"?l("botAccess.everyoneHint.edit",{team:t}):l("botAccess.onlyAddedHint"),o=l("botAccess.onlyAdded"),c=l("botAccess.everyoneUse",{team:t});return r.jsxs("div",{className:"flex items-center gap-3","data-share-general":e.everyone,children:[r.jsx("span",{"aria-hidden":"true",className:I("inline-flex size-8 shrink-0 items-center justify-center rounded-full",a?"bg-accent/15 text-accent":"bg-ink/[0.08] text-ink-secondary"),children:a?r.jsx(Tn,{size:16}):r.jsx(co,{size:16})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"-ms-2 flex",children:r.jsx(RM,{label:l("botAccess.general"),shown:a?c:o,align:"start",className:"font-medium text-ink",items:[tS("none",o,!a,()=>{a&&s("none")},{disabled:n}),tS("everyone",c,a,()=>{a||s("chat")},{disabled:n})]})}),r.jsx("p",{className:"text-[12px] leading-4 text-ink-secondary",children:i})]})]})}function Yce({team:e,access:t,owner:n,disabled:s,onAdd:a}){const[i,o]=f.useState(""),[c,d]=f.useState(!1),[u,p]=f.useState(0),m=f.useId(),h=f.useRef(null),x=tce(t.everyone),g=f.useMemo(()=>nce(e,t,n,i),[e,t,n,i]),k=Math.min(u,g.length-1),v=c&&g.length>0;if(f.useEffect(()=>{v&&h.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})},[v,k]),!x)return r.jsx("p",{className:"py-1 text-[13px] text-ink-secondary",children:l("botAccess.everyoneEdits")});const y=w=>{s||(a(w,x),o(""),p(0),d(!1))},b=w=>{if(!c){d(!0);return}g.length&&p((k+w+g.length)%g.length)};return r.jsxs(r.Fragment,{children:[r.jsx("input",{value:i,placeholder:l("botAccess.addPlaceholder"),"aria-label":l("botAccess.addPlaceholder"),role:"combobox","aria-expanded":v,"aria-controls":m,"aria-autocomplete":"list","aria-activedescendant":v?`${m}-${k}`:void 0,onChange:w=>{o(w.target.value),p(0),d(!0)},onClick:()=>d(!0),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:w=>{w.key==="ArrowDown"&&(w.preventDefault(),b(1)),w.key==="ArrowUp"&&(w.preventDefault(),b(-1)),w.key==="Enter"&&v&&(w.preventDefault(),y(g[k])),w.key==="Escape"&&c&&(w.preventDefault(),d(!1))},className:"w-full rounded-lg border border-hairline/50 bg-transparent px-3 py-2 text-[14px] text-ink placeholder:text-ink-secondary focus:border-focus focus:outline-none"}),c&&r.jsx("ul",{ref:h,id:m,role:"listbox",onMouseDown:w=>w.preventDefault(),className:I(Jt,"absolute inset-x-5 top-full max-h-[min(240px,40vh)] overflow-y-auto"),children:g.length===0?r.jsx("li",{className:"px-2 py-1.5 text-[13px] text-ink-secondary",children:i.trim()?l("botAccess.noMatch"):l("botAccess.nobodyLeft")}):g.map((w,j)=>r.jsxs("li",{id:`${m}-${j}`,role:"option","aria-selected":j===k,"data-share-suggestion":w.email,onMouseEnter:()=>p(j),onMouseDown:()=>y(w),className:I("flex shrink-0 cursor-pointer items-center gap-3 rounded-md px-2 py-1",j===k&&"bg-menu-hover"),children:[r.jsx(OM,{person:w,size:32}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[14px] leading-[18px] text-ink",children:w.name}),r.jsx("span",{className:"block truncate text-[12px] leading-4 text-ink-secondary",children:w.email})]})]},w.email))})]})}const Jce=6e3;function a3(){const{state:e}=se(),t=e.config?.team;return typeof t?.name=="string"&&t.name?t.name:null}function Zce({bot:e,className:t,headerMenu:n,iconSize:s=16}){const a=a3(),[i,o]=f.useState(!1),[c,d]=f.useState(null),u=f.useCallback(()=>d(null),[]);return a?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","data-panel-share":!0,"data-share-bot-button":!0,"aria-label":l("botAccess.share"),title:l("botAccess.share"),"aria-haspopup":"dialog",onClick:()=>o(!0),className:t,children:r.jsx(hw,{size:s,"aria-hidden":"true",className:"pointer-events-none"})}),i&&r.jsx(Wce,{bot:e,teamName:a,onClose:()=>o(!1),onChanged:d,headerMenu:n}),c&&r.jsx(zM,{text:c.text,onUndo:()=>G2(e.id,c.before),onDone:u},`${c.text}:${JSON.stringify(c.after)}`)]}):null}function zM({text:e,onUndo:t,onDone:n,actionLabel:s=l("common.undo")}){const[a,i]=f.useState(!1);return f.useEffect(()=>{const o=window.setTimeout(n,Jce);return()=>window.clearTimeout(o)},[n]),Ke.createPortal(r.jsxs("div",{role:"status","data-access-toast":!0,className:"fixed bottom-5 left-1/2 z-[70] flex max-w-[min(420px,calc(100vw-32px))] -translate-x-1/2 items-center gap-3 rounded-xl border border-hairline/50 bg-card px-3.5 py-2.5 text-[13px] text-ink shadow-xl",children:[r.jsx("span",{className:"min-w-0 flex-1",children:a?l("botAccess.undoFailed"):e}),!a&&r.jsx("button",{type:"button",onClick:()=>{t().then(n,()=>i(!0))},className:"shrink-0 rounded-md px-1.5 py-0.5 font-medium text-accent hover:bg-raised",children:s})]}),document.body)}const Xce=[{mode:"ask",labelKey:"approvalMode.ask.label",chipKey:"approvalMode.ask.chip",descriptionKey:"approvalMode.ask.desc",Icon:cw},{mode:"edits",labelKey:"approvalMode.edits.label",chipKey:"approvalMode.edits.chip",descriptionKey:"approvalMode.edits.desc",Icon:yK},{mode:"auto",labelKey:"approvalMode.auto.label",chipKey:"approvalMode.auto.chip",descriptionKey:"approvalMode.auto.desc",Icon:cx},{mode:"full",labelKey:"approvalMode.full.label",chipKey:"approvalMode.full.chip",descriptionKey:"approvalMode.full.desc",Icon:RG},{mode:"custom",labelKey:"approvalMode.custom.label",chipKey:"approvalMode.custom.chip",descriptionKey:"approvalMode.custom.desc",Icon:$u}],Qce={ask:"botSettings.simple.ask",edits:"approvalMode.edits.label",auto:"botSettings.simple.decide",full:"botSettings.simple.justDoIt",custom:"botSettings.simple.custom"};function ede(e,t){return l(Qce[t==="antigravityAgent"&&e==="full"?"auto":e])}function Px(){return Xce.map(({mode:e,labelKey:t,chipKey:n,descriptionKey:s,Icon:a})=>({mode:e,label:l(t),chip:l(n),description:l(s),Icon:a}))}function Zf(e,t=!0){return Px().filter(n=>Cw(e,n.mode)&&(e!=="antigravityAgent"||n.mode!=="auto")&&(t||n.mode!=="custom")).map(n=>e==="antigravityAgent"&&n.mode==="full"?{...n,label:l("approvalMode.antigravity.label"),chip:l("approvalMode.auto.chip"),description:l("approvalMode.antigravity.desc")}:n.mode==="auto"&&!EJ(e)?{...n,description:l("approvalMode.noNativeReview")}:n)}function LM(e,t){return e==="custom"&&!t}function PM(e,t){return e==="antigravityAgent"&&t==="auto"?"ask":t}function tde({approvalMode:e,autoApprove:t,providerName:n,driverKind:s,onSelect:a,align:i="left",menuDirection:o="up",wide:c=!1,busy:d=!1,trustedModesAvailable:u=!0,trustedModesNotice:p,onManageCommandAllowlist:m}){const[h,x]=f.useState(!1),g=us(h),k=f.useRef(null),v=f.useRef(null),y=PM(s,In({approvalMode:e,autoApprove:t})),b=Px(),w=Zf(s).find(N=>N.mode===y)??b.find(N=>N.mode===y)??b[0],j=Zf(s,u),S=LM(y,u);f.useEffect(()=>{function N(C){k.current&&!k.current.contains(C.target)&&x(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]),f.useEffect(()=>{if(!h)return;const N=C=>{C.key==="Escape"&&x(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[h]);const E=w.Icon,A=S,_=m&&r.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{x(!1),v.current?.focus(),m()},className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-[14px] text-ink hover:bg-menu-hover",children:[r.jsx(Du,{size:16,className:"shrink-0 text-ink-secondary"}),l("commandAllowlist.title")]});return r.jsxs("div",{className:I("relative flex items-center",c&&"w-full"),ref:k,children:[r.jsxs("button",{ref:v,type:"button","aria-haspopup":"menu","aria-expanded":h,"aria-label":l("approvalMode.triggerAria",{mode:w.label,provider:n}),title:c?void 0:w.chip,onClick:()=>x(N=>!N),className:I(c?"flex h-10 w-full items-center justify-between rounded-lg border border-hairline/40 bg-inset px-3.5 text-[13px] text-ink hover:bg-raised":"flex size-8 shrink-0 items-center justify-center rounded-full text-ink-secondary hover:bg-control hover:text-ink"),children:[c?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(E,{size:14,className:"shrink-0 opacity-70"}),r.jsx("span",{className:"truncate",children:w.label})]}):r.jsx(E,{size:16,className:"shrink-0 opacity-80"}),c&&r.jsx(kt,{size:14,"aria-hidden":!0,className:"shrink-0 text-ink-secondary"})]}),g.shown&&r.jsxs("div",{role:"menu","aria-label":l("approvalMode.menuAria",{provider:n}),...g.exitProps,className:I("absolute z-40 w-[340px] overflow-hidden",Jt,o==="up"?"bottom-full mb-2":"top-full mt-2",i==="right"?"right-0":"left-0",c&&"w-full min-w-[340px]",g.className),children:[r.jsxs("div",{className:"px-2 pb-1 pt-1.5",children:[r.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("approvalMode.question",{provider:n})}),d&&r.jsx("p",{role:"status",className:"mt-1 text-[12px] leading-snug text-ink-secondary",children:l("approvalMode.whileWorking")}),r.jsx("button",{type:"button",onClick:()=>{Lt(Sq)},className:"mt-1 text-[12px] text-ink-secondary underline underline-offset-2 hover:text-ink",children:l("approvalMode.learnMore")})]}),r.jsx("div",{role:"separator",className:Yl}),r.jsxs("div",{className:"flex flex-col gap-1",children:[j.map(N=>{const C=N.mode===y,R=N.Icon;return r.jsxs(f.Fragment,{children:[r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":C,disabled:A,title:S?l("approvalMode.customLocalOnly"):void 0,onClick:()=>{A||(a(N.mode),x(!1))},className:I("flex items-start gap-2 rounded-md px-2 py-1.5 text-left hover:bg-menu-hover",A&&"cursor-not-allowed opacity-45 hover:bg-transparent"),children:[r.jsx(R,{size:16,className:"mt-px shrink-0 text-ink-secondary"}),r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsxs("span",{className:"flex items-center justify-between gap-3 text-[14px] text-ink",children:[N.label,C&&r.jsx(Ie,{size:14,className:"shrink-0"})]}),r.jsx("span",{className:"text-[13px] leading-snug text-ink-secondary",children:N.description})]})]}),N.mode==="full"&&_]},N.mode)}),!j.some(N=>N.mode==="full")&&_,!u&&(p||s==="codex"||S)&&r.jsx("div",{className:"px-2 py-1.5 text-[12px] leading-snug text-ink-tertiary",children:p??l("approvalMode.customLocalOnlyDot")})]})]})]})}function nde(e,t){return e.filter(n=>n.instanceId===t||n.snapshot.state==="available"&&(n.models.options.length>0||n.snapshot.chatgptPlan===!0))}function za(e){return e?.access==="custom"}function sde(e){return e?.modelsUnconfirmed===!0&&e.snapshot.state==="available"&&e.snapshot.authenticated!==!1}function Dn(e){if(!(!e||e.access==="api")){if(e.driverKind==="claudeAgent")return"claude";if(e.driverKind==="codex")return"openai"}}const i3={claude:"Claude",openai:"OpenAI"};function Ma(e){return Dn(e)==="claude"}function o3(e){const t=[],n=[],s=[];for(const a of e){const i=a.access;i==="custom"?s.push(a):i==="api"?n.push(a):t.push(a)}return{subscription:t,api:n,custom:s}}function Ja(e){return e.id==="agent-default"&&e.label==="Agent default"?l("model.agentDefault"):e.label}function Up(e,t){const n=e?.models.options.find(s=>s.id===t);return n?Ja(n):t}function Hp(e,t){return e?.models.options.find(n=>n.id===t)?.provider}function Ny(e,t){const n=t.trim().toLowerCase();return n?e.filter(s=>s.label.toLowerCase().includes(n)||s.id.toLowerCase().includes(n)||(s.provider?.toLowerCase().includes(n)??!1)):[...e]}function DM(e){const t=[],n=[];for(const s of e)s.loaded?t.push(s):n.push(s);return{pinned:t,rest:n}}function $M(e,t,n,s=5){const a=[],i=new Set,o=c=>{!c||i.has(c.id)||a.length>=s||(i.add(c.id),a.push(c))};o(n?e.find(c=>c.id===n):void 0),o(e.find(c=>c.id===t));for(const c of e)o(c);return a}const BM="omb-favorite-models",Sy=new Set,Iy=new Set;let Vo=null;const l3=(e,t)=>`${e}
116
116
  ${t}`;function c3(){if(Vo)return Vo;try{const e=JSON.parse(localStorage.getItem(BM)??"[]");Vo=Array.isArray(e)?new Set(e.filter(t=>typeof t=="string")):Sy}catch{Vo=Sy}return Vo}const rde=c3;function ade(e,t){const n=l3(e,t),s=new Set(c3());s.delete(n)||s.add(n),Vo=s;try{localStorage.setItem(BM,JSON.stringify([...s]))}catch{}for(const a of Iy)a()}function ide(){return f.useSyncExternalStore(e=>(Iy.add(e),()=>{Iy.delete(e)}),c3,()=>Sy)}function ode(e,t,n=!1){return n||!t||/\d/.test(e)||e.toLowerCase().startsWith(t.toLowerCase())?e:`${t} ${e}`}function lde(e,t){const n=`${t} `;if(!t||e.slice(0,n.length).toLowerCase()!==n.toLowerCase())return e;const s=e.slice(n.length).trimStart();return new RegExp("^\\p{L}{2}","u").test(s)?s:e}const Cy="typed::",cde=/^[A-Za-z0-9][\w.-]{0,63}\/[A-Za-z0-9][\w.:@+/-]{0,199}$/u;function FM(e){const t=e.trim();return cde.test(t)&&!t.endsWith("/")?t:null}function dde(e){const t=FM(e);return t?`${Cy}${t}`:null}function S1(e){if(!e?.startsWith(Cy))return null;const t=e.slice(Cy.length);return FM(t)===t?t:null}function d3(e,t){return e.driverKind!=="antigravityAgent"?[...t]:t.flatMap(n=>n.variants?.length?n.variants.map(s=>({...n,id:JSON.stringify([n.id,s.id]),label:`${n.label} · ${s.label}`,nativeModel:n.id,variant:s.id})):[n])}function Vi(e,t){return(e.nativeModel??e.id)===t.model&&e.variant===t.variant}function ude(e,t,n){const s={instanceId:t.instanceId,model:n};return t.instanceId===e.instanceId&&(t.capabilities?.modelVariants&&n===e.model&&e.variant!==void 0?s.variant=e.variant:!t.capabilities?.modelVariants&&e.effort&&(s.effort=e.effort)),s}function u3(e){return e?.driverKind==="opencodeGo"}function pde(e,t,n){return e.map(s=>{if(!u3(s))return s;const a=d=>s.models.options.some(u=>u.id===d),i=s.instanceId===t.instanceId&&S1(t.model)?t.model:null,o=dde(n),c=[i,o&&!a(S1(o))?o:null].filter((d,u,p)=>d!==null&&!a(d)&&p.indexOf(d)===u);return c.length?{...s,models:{...s.models,options:[...s.models.options,...c.map(d=>({id:d,label:l("model.typedByHand",{id:S1(d)})}))]}}:s})}const mde=12,fde=4,hde=3;function qM(e){const t=Dn(e);return t?i3[t]:e.access!=="api"?ht(e):ht(e).replace(/\s*\((?:API key|API|chave de API)\)$/i,"")||ht(e)}function Xf(e,t,n){const s=e?.models.options.find(o=>o.id===t);if(!e||!s||n===void 0)return"";const i=d3(e,[s]).some(o=>Vi(o,{instanceId:e.instanceId,model:t,variant:n}))?s.variants?.find(o=>o.id===n)?.label:void 0;return i?` · ${i}`:""}function Ey(e,t,n){const s=e?.models.options.find(a=>a.id===t);return!e||!s?t:ode(Ja(s),qM(e),s.custom)+Xf(e,t,n)}function xde(e){const t=new Set,n=new Set;for(const s of e)(t.has(s.label)?n:t).add(s.label);return n}function gde(e){const t=!za(e)&&Gs(e),n=za(e)||t?[]:d3(e,e.models.options.filter(a=>!a.custom)),s=DM(e.models.options.filter(a=>a.custom));return{signedOut:t,own:n,all:[...n,...s.pinned,...s.rest]}}function nS(e,t){if(!t)return null;const n=e.findIndex(s=>s.option.custom);return n>=0&&e.slice(n).every(s=>s.option.custom)?n:null}function bde(e,t){const n=qM(e),s=Dn(e);if(e.serverKind==="ollama")return{label:n,provider:n};if(e.access==="api")return{label:`${n} · ${l("model.simple.apiKey")}`,provider:n};const i=s!==void 0&&t.filter(o=>Dn(o)===s).length>1&&ht(e)!==n?ht(e):void 0;return{label:i?`${n} · ${i}`:n,provider:n,account:i}}function yde(e){const{instances:t,selection:n,bot:s,loading:a}=e,i=t.find(h=>h.instanceId===n.instanceId),o=i?.models.options.find(h=>h.id===n.model),c=o?Ja(o):n.model,d=Zw(o?.local),u={instance:i,label:Ey(i,n.model,n.variant),title:`${i?`${ht(i)} · ${c}${Xf(i,n.model,n.variant)}`:c}${d?` · ${d}`:""}`,warning:!1,pending:!1};if(!i)return a?{...u,pending:!0}:{...u,meta:l("model.simple.unavailable"),warning:!0};if(!o&&e.refreshing===i.instanceId)return{...u,pending:!0};if(o?.orgBlocked)return{...u,meta:l("model.orgBlocked"),warning:!0,blocked:!0};if(o?.needsCliUpdate)return{...u,meta:l("engines.updateClaude"),warning:!0,blocked:!0};if(i.policy)return{...u,meta:l("policy.managedBy",{organization:i.policy.organizationName}),warning:!0};if(Yn(i))return{...u,meta:l("model.setupRequired"),warning:!0};if(Gs(i)&&!za(i)&&!o?.custom)return{...u,meta:l("model.signInRequired"),warning:!0};if(s.follows===!0)return{...u,meta:l(e.updatesBotDefault?"model.simple.botsModelScope":"model.simple.botsModel",{name:s.name})};const p=Dn(i);return(p?t.filter(h=>Dn(h)===p).length:0)>1||i.snapshot.chatgptPlan?{...u,meta:ht(i)}:o?.provider||d?{...u,meta:o?.provider??d}:u}function kde(e){const{listed:t,selection:n,bot:s,expanded:a,probing:i}=e,o=new Map(t.map(y=>[y.instanceId,gde(y)])),d=t.filter(y=>!y.policy&&!Yn(y)).reduce((y,b)=>y+o.get(b.instanceId).all.length,0)>mde||t.some(y=>u3(y)&&!y.policy&&!Yn(y)),u=d?e.query.trim():"",{subscription:p,api:m,custom:h}=o3(t),x=[...p,...m,...h],g=x.find(y=>y.instanceId===n.instanceId);function k(y,b){if(y.policy)return u?null:{kind:"policy",organization:y.policy.organizationName,...y.policy.team?{team:!0}:{}};if(Yn(y))return u?null:{kind:"setUp"};const{signedOut:w,own:j,all:S}=o.get(y.instanceId);if(S.length===0)return u?null:w?{kind:"signIn"}:{kind:"empty",loading:e.refreshing===y.instanceId};const E=y.instanceId===n.instanceId?n:void 0,A=xde(S),_=s.follows===!1&&s.selection.instanceId===y.instanceId?s.selection:void 0,N=z=>{const B=Zw(z.local);return{option:z,...z.nativeModel?{model:z.nativeModel}:{},...z.variant?{variant:z.variant}:{},label:lde(Ja(z),b),...A.has(z.label)&&z.provider?{route:z.provider}:{},...B?{detail:B}:{},current:E?Vi(z,E):!1,blocked:z.orgBlocked===!0||z.needsCliUpdate!==void 0}},C=j.length>0&&j.length<S.length;if(u){const z=Ny(S,u).map(N);return z.length===0?null:{kind:"models",rows:z,total:S.length,toggle:null,localFrom:nS(z,C),signInForOwn:!1,probing:!1}}const R=S.filter(z=>(!E||!Vi(z,E))&&(!_||!Vi(z,_))),O=rde(),q=R.filter(z=>O.has(l3(y.instanceId,z.id))),L=E===void 0?hde:fde,P=[...q,...$M(R.filter(z=>!q.includes(z)),y.models.default,void 0,Math.max(0,L-q.length))],$=R.filter(z=>!P.includes(z)),F=(a.has(y.instanceId)||$.length===1?[...P,...$]:P).map(N),W=i.has(y.instanceId)&&j.length===S.length;return F.length===0&&!w&&!W?null:{kind:"models",rows:F,total:S.length,toggle:$.length>1?a.has(y.instanceId)?"less":"more":null,localFrom:nS(F,C),signInForOwn:w,probing:W}}const v=(g?[g,...x.filter(y=>y!==g)]:x).flatMap(y=>{const b=bde(y,t),w=k(y,b.provider);return w?[{instance:y,...b,body:w}]:[]});return{current:u?null:yde(e),follow:!u&&s.follows===!1,groups:v,search:d,query:u,results:u?v.reduce((y,b)=>y+(b.body.kind==="models"?b.body.rows.length:0),0):null,empty:t.length>0?null:e.loading?"loading":"none",busy:e.loading||e.refreshing!=null}}const Wp=6,zo=8,vde=480;function wde(e,t,n,s,a=vde){const i=s?.edge??((e.left+e.right)/2>n.width/2?"right":"left"),o=Math.max(0,Math.min(t.width,n.width-zo*2)),c=i==="right"?e.right-o:e.left,d=Math.min(Math.max(c,zo),Math.max(zo,n.width-o-zo)),u=n.height-e.bottom-Wp-zo,p=e.top-Wp-zo,m=s?.vertical??(t.height<=u||u>=p?"below":"above"),h=Math.max(0,Math.min(a,m==="below"?u:p)),x=`${m==="below"?"top":"bottom"} ${i}`;return m==="below"?{vertical:m,edge:i,left:d,width:o,top:e.bottom+Wp,maxHeight:h,origin:x}:{vertical:m,edge:i,left:d,width:o,bottom:n.height-e.top+Wp,maxHeight:h,origin:x}}const jde=5e3;function Nde(e,t,n=jde){return new Promise(s=>{const a=setTimeout(s,n);t(e).catch(()=>{}).finally(()=>{clearTimeout(a),s()})})}function sS(e,t){return e?t>0||e.driverKind==="claudeAgent"&&!Yn(e)&&!e.policy:!1}const UM="https://chatgpt.com/settings/usage";function HM({href:e,className:t,children:n}){return r.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:t,onClick:s=>{window.ogb?.openExternal&&(s.preventDefault(),Lt(e))},children:[l("engineSetup.chatgpt.manageUsage"),n]})}function Sde({instanceId:e,welcome:t=!0}){const n=`omb:chatgpt-plan-welcome:${e}`,[s,a]=f.useState(()=>{if(!t)return!0;try{return localStorage.getItem(n)==="1"}catch{return!1}}),i=f.useRef(null),o=f.useId();f.useEffect(()=>{!s&&!document.querySelector("dialog[data-chatgpt-plan-welcome][open]")&&i.current?.showModal()},[s]);const c=()=>{try{localStorage.setItem(n,"1")}catch{}i.current?.close(),a(!0)};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{"data-chatgpt-plan-status":!0,className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-ink-secondary",children:[r.jsx("span",{children:l("engineSetup.chatgpt.using")}),r.jsx(HM,{href:UM,className:"inline-flex items-center gap-1 text-accent hover:underline",children:r.jsx(ms,{size:11})})]}),!s&&r.jsxs("dialog",{ref:i,"data-chatgpt-plan-welcome":!0,"aria-labelledby":o,className:"m-auto w-[min(420px,calc(100vw-32px))] rounded-2xl border border-hairline bg-panel p-6 text-ink shadow-2xl backdrop:bg-black/50",onKeyDown:d=>{d.key==="Escape"&&d.stopPropagation()},onCancel:d=>{d.preventDefault(),c()},children:[r.jsx(nc,{size:28}),r.jsx("h2",{id:o,className:"mt-4 text-lg font-semibold",children:l("engineSetup.chatgpt.welcome")}),r.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink-secondary",children:l("engineSetup.chatgpt.welcomeBody")}),r.jsx("form",{method:"dialog",onSubmit:d=>{d.preventDefault(),c()},children:r.jsx("button",{type:"submit",className:"mt-5 w-full rounded-lg bg-ink px-4 py-2 text-[13px] font-semibold text-app",children:l("onboarding.spot.gotIt")})})]})]})}const os=({children:e})=>r.jsx("span",{className:sH,children:e}),Ay=()=>r.jsx(at,{size:16,strokeWidth:Vt,className:Ua,"aria-hidden":"true"});function Ty({label:e,children:t}){return r.jsxs("span",{"data-simple-model-text":!0,className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate",children:e}),t]})}function Ide({instanceId:e,model:t,name:n}){const s=ide().has(l3(e,t));return r.jsx("button",{type:"button","data-model-favorite":!0,tabIndex:-1,"aria-pressed":s,"aria-label":l(s?"model.favorite.remove":"model.favorite.add",{name:n}),title:l(s?"model.favorite.remove":"model.favorite.add",{name:n}),onClick:()=>ade(e,t),className:I("absolute end-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-ink-tertiary hover:text-ink",s?"opacity-100":"opacity-0 group-hover/model:opacity-100 touch:opacity-100 focus-visible:opacity-100 peer-focus-visible/row:opacity-100"),children:r.jsx($d,{size:13,"aria-hidden":"true",className:I(s&&"fill-current")})})}function Cde({instance:e,row:t,onPick:n}){const{option:s}=t,a=t.blocked?l(s.needsCliUpdate?"chat.claudeUpdate.offer":"model.orgBlocked"):void 0;return r.jsxs("div",{className:"group/model relative",children:[r.jsxs("button",{type:"button","data-menu-row":!0,"data-org-blocked":t.blocked||void 0,disabled:t.blocked,"aria-pressed":t.current,"aria-label":[Ja(s),s.provider,t.detail,a].filter(Boolean).join(" · "),title:[Ja(s),s.provider,t.detail,a].filter(Boolean).join(" · "),tabIndex:-1,onClick:()=>n(e,t.model??s.id,t.variant),className:I(e0,"peer/row pe-8"),children:[r.jsx(os,{}),r.jsxs(Ty,{label:t.label,children:[t.route&&r.jsx("span",{"data-simple-route":!0,className:cd,children:t.route}),t.detail&&r.jsx("span",{"data-simple-model-detail":!0,className:cd,children:t.detail}),a&&r.jsx("span",{"data-simple-org-blocked":!0,className:cd,children:a})]}),t.current&&r.jsx(Ie,{size:14,className:"shrink-0 text-ink","aria-hidden":"true"})]}),!t.blocked&&r.jsx(Ide,{instanceId:e.instanceId,model:s.id,name:Ja(s)})]})}function Ede({group:e,props:t}){const{instance:n,body:s}=e;switch(s.kind){case"policy":return r.jsxs("div",{"data-simple-policy":!0,className:"flex flex-col gap-0.5 py-1 pl-8 pr-2",children:[r.jsx("p",{className:"text-[13px] leading-[18px] text-ink-secondary",children:l("policy.managedBy",{organization:s.organization})}),r.jsx("p",{className:"text-[12px] leading-4 text-ink-tertiary",children:l(s.team?"policy.teamModelBlocked":"policy.modelBlocked",{organization:s.organization})})]});case"setUp":case"signIn":return r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-set-up":!0,tabIndex:-1,onClick:a=>t.onSetUp(n,a.detail===0),title:l("model.simple.needsSetup",{name:e.account??e.provider}),className:Ws,children:[r.jsx(os,{children:s.kind==="setUp"?r.jsx(Ft,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"}):r.jsx(zr,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.kind==="setUp"?l("model.simple.setUp"):l("model.simple.signIn")}),r.jsx(Ay,{})]});case"empty":return s.loading?r.jsxs("div",{role:"status",className:I(Rd,"text-ink-tertiary"),children:[r.jsx(os,{children:r.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.loadingModels",{name:e.provider})})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:I(Cm,"pl-8"),children:l("model.simple.noModels")}),r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-refresh":!0,tabIndex:-1,disabled:t.menu.busy,onClick:()=>t.onCheckAgain(n),className:Ws,children:[r.jsx(os,{children:t.menu.busy?r.jsx(ye,{size:14,className:"animate-spin text-ink-secondary","aria-hidden":"true"}):r.jsx(zt,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("common.checkAgain")})]})]});case"models":return r.jsxs(r.Fragment,{children:[s.rows.map((a,i)=>r.jsxs("div",{className:"contents",children:[i===s.localFrom&&r.jsx("div",{className:I(yf,"pl-8 font-normal"),children:l("model.localModels")}),r.jsx(Cde,{instance:n,row:a,onPick:t.onPick})]},a.option.id)),s.probing&&r.jsxs("div",{role:"status",className:I(Rd,"text-ink-tertiary"),children:[r.jsx(os,{children:r.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.lookingLocal")})]}),s.signInForOwn&&r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-sign-in":!0,tabIndex:-1,onClick:a=>t.onSetUp(n,a.detail===0),className:Ws,children:[r.jsx(os,{children:r.jsx(zr,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.simple.signInForOwn",{name:e.provider})}),r.jsx(Ay,{})]}),s.toggle&&r.jsx("div",{className:I(s.toggle==="less"&&"sticky bottom-0 z-[1] -mx-1.5 bg-linear-to-b from-transparent to-menu to-[12px] px-1.5 pt-3"),children:r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-show-all":!0,tabIndex:-1,"aria-expanded":s.toggle==="less",onClick:()=>t.onToggle(n),className:I(Ws,"text-ink-secondary hover:text-ink focus:text-ink"),children:[r.jsx(os,{}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.toggle==="less"?l("model.showSuggested"):l("model.showAll",{count:s.total})}),s.toggle==="less"?r.jsx(fi,{size:16,strokeWidth:Vt,className:Ua,"aria-hidden":"true"}):r.jsx(kt,{size:16,strokeWidth:Vt,className:Ua,"aria-hidden":"true"})]})})]})}}function Ade({thinking:e,labelId:t}){const[n,s]=f.useState(!1);if("variants"in e)return r.jsx("div",{"data-simple-thinking":!0,children:e.variants});const a=e,i=a.current===void 0,o=c=>I("h-8 min-w-0 truncate rounded-full px-1.5 text-[13px] leading-4 transition-colors",c?"bg-ink/[0.1] font-medium text-ink":"text-ink-secondary hover:text-ink");return r.jsxs("div",{"data-simple-thinking":!0,className:"flex flex-col",children:[r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-thinking-toggle":!0,tabIndex:-1,"aria-expanded":n,"aria-controls":`${t}-steps`,onClick:()=>s(!n),className:I(Ws,n&&"hover:bg-transparent focus:bg-transparent"),children:[r.jsx(os,{children:r.jsx(dw,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"})}),r.jsx("span",{id:t,className:"min-w-0 flex-1 truncate",children:l("botSettings.simple.thinking")}),!n&&r.jsx("span",{className:"shrink-0 text-ink-secondary",children:i?l("model.simple.auto"):sa(a.current)}),n?r.jsx(fi,{size:16,strokeWidth:Vt,className:Ua,"aria-hidden":"true"}):r.jsx(kt,{size:16,strokeWidth:Vt,className:Ua,"aria-hidden":"true"})]}),r.jsxs("div",{id:`${t}-steps`,hidden:!n,children:[r.jsxs("div",{"data-simple-effort":!0,role:"group","aria-labelledby":t,className:"m-1 grid rounded-full bg-ink/[0.05] p-[3px]",style:{gridTemplateColumns:`repeat(${a.levels.length+1}, auto)`},children:[r.jsx("button",{type:"button","data-effort-pill":!0,"data-effort-auto":!0,"aria-pressed":i,tabIndex:i?0:-1,title:l("model.simple.thinkingDefault"),onClick:a.onReset,className:o(i),children:l("model.simple.auto")}),a.levels.map(c=>r.jsx("button",{type:"button","data-effort-pill":!0,"aria-pressed":a.current===c,tabIndex:a.current===c?0:-1,title:l("model.simple.thinkingLevel",{level:sa(c)}),onClick:()=>a.onPick(c),className:o(a.current===c),children:sa(c)},c))]}),r.jsx("p",{"data-simple-effort-auto":i||void 0,className:"px-2 pb-1 text-[12px] leading-4 text-ink-tertiary",children:i?l("model.simple.thinkingAuto"):l(`model.simple.effortHint.${a.current}`)})]})]})}function Tde(e){const{menu:t,query:n,idPrefix:s}=e,a=t.current,i=!!(a||t.follow);return r.jsxs("div",{"data-simple-model-menu":!0,className:"flex min-h-0 flex-1 flex-col",children:[t.search&&r.jsxs("div",{"data-simple-model-search":!0,className:"group/search flex h-9 shrink-0 items-center gap-2 border-b-[0.5px] border-ink/10 pl-3.5 pr-2",children:[r.jsx(Cn,{size:16,strokeWidth:Vt,className:"shrink-0 text-ink-tertiary group-focus-within/search:text-ink-secondary","aria-hidden":"true"}),r.jsx("input",{"data-menu-search":!0,value:n,onChange:o=>e.onQuery(o.target.value),placeholder:l("model.search"),"aria-label":t.groups.every(o=>o.instance.access==="custom")?l("model.searchLocal"):l("model.search"),className:"min-w-0 flex-1 bg-transparent text-[13px] leading-[18px] text-ink outline-none placeholder:text-ink-tertiary"}),n&&r.jsx("button",{type:"button","aria-label":l("model.simple.clearSearch"),onClick:()=>e.onQuery(""),className:"flex size-5 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-ink/[0.06] hover:text-ink",children:r.jsx(Ae,{size:14,strokeWidth:Vt,"aria-hidden":"true"})}),t.results!==null&&r.jsx("span",{role:"status",className:"sr-only",children:l("model.results",{count:t.results})})]}),r.jsx("div",{"data-simple-models":!0,className:I("min-h-0 flex-1 overflow-y-auto overscroll-contain",t.groups.some(o=>o.body.kind==="models"&&o.body.toggle==="less")&&"scroll-pt-8 scroll-pb-12"),children:r.jsxs("div",{className:"flex flex-col gap-0.5 p-1.5",children:[a&&r.jsxs("button",{type:"button","data-menu-row":!0,"data-current-model":!0,"aria-pressed":"true",title:a.title,onClick:o=>{const c=a.warning&&a.instance&&!a.instance.policy&&!a.blocked?a.instance:void 0;c?e.onSetUp(c,o.detail===0):e.onPickCurrent()},className:e0,children:[r.jsx(os,{children:a.instance?r.jsx(_s,{instance:a.instance,size:14,subtle:!0}):r.jsx("span",{className:"size-3.5 rounded-full bg-ink/[0.08]","aria-hidden":"true"})}),r.jsx(Ty,{label:a.label,children:a.meta&&r.jsx("span",{className:I(cd,a.warning&&"text-warning"),children:a.meta})}),a.pending&&r.jsx(ye,{size:14,className:"shrink-0 animate-spin text-ink-tertiary","aria-hidden":"true"}),r.jsx(Ie,{size:14,className:"shrink-0 text-ink","aria-hidden":"true"})]}),t.follow&&r.jsxs("button",{type:"button","data-menu-row":!0,"data-follow-bot-model":!0,"aria-pressed":"false",tabIndex:-1,title:e.botModel.title,onClick:e.onFollowBot,className:e0,children:[r.jsx(os,{children:r.jsx(Ge,{bot:e.bot,size:16,state:"happy",animated:!1,label:""})}),r.jsx(Ty,{label:l("model.useBotModel",{name:e.bot.name}),children:r.jsx("span",{className:cd,children:e.botModel.label})})]}),i&&t.groups.length>0&&r.jsx("div",{role:"separator",className:Im}),t.groups.map((o,c)=>{const d=`${s}-group-${c}`,u=o.body.kind==="models"&&o.body.toggle==="less";return r.jsxs("div",{role:"group","aria-labelledby":d,"data-simple-provider":o.instance.instanceId,className:I("flex flex-col gap-0.5",c>0&&"mt-1"),children:[r.jsxs("div",{id:d,className:I(yf,u&&"sticky top-0 z-[1] -mx-1.5 bg-menu px-3.5"),children:[r.jsx(os,{children:r.jsx(_s,{instance:o.instance,size:14,subtle:!0})}),r.jsx("span",{className:"min-w-0 truncate",children:o.label})]}),o.note&&r.jsx("p",{className:I(Cm,"pl-8 pt-0"),children:o.note}),r.jsx(Ede,{group:o,props:e})]},o.instance.instanceId)}),t.empty==="loading"&&r.jsxs("div",{role:"status",className:I(Rd,"text-ink-tertiary"),children:[r.jsx(os,{children:r.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.simple.lookingModels")})]}),t.empty==="none"&&r.jsx("p",{className:I(Cm,!i&&"pt-2"),children:l("model.noProviders")}),t.results===0&&r.jsx("p",{className:I(Cm,"py-2"),children:l("model.noMatch",{query:t.query})})]})}),(e.thinking||e.onResetVariant||e.onManage)&&r.jsxs("div",{"data-simple-effort-band":!0,className:"flex shrink-0 flex-col gap-0.5 p-1.5 pt-0",children:[r.jsx("div",{role:"separator",className:Im}),e.thinking&&r.jsxs(r.Fragment,{children:[r.jsx(Ade,{thinking:e.thinking,labelId:`${s}-thinking`}),(e.onResetVariant||e.onManage)&&r.jsx("div",{role:"separator",className:Im})]}),e.onResetVariant&&r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-variant-default":!0,onClick:e.onResetVariant,className:Ws,children:[r.jsx(os,{}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.variant.session")})]}),e.onManage&&r.jsxs("button",{type:"button","data-menu-row":!0,"data-simple-manage":!0,onClick:e.onManage,className:Ws,children:[r.jsx(os,{children:r.jsx($u,{size:16,strokeWidth:Vt,className:Xo,"aria-hidden":"true"})}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l("model.simple.manage")}),r.jsx(Ay,{})]})]})]})}const _de={field:"rounded-lg border border-hairline/40 bg-inset text-ink",pill:"h-8 rounded-full border border-hairline/40 bg-raised/60 font-medium text-ink hover:bg-raised",ghost:"h-7 rounded-lg border-[0.5px] [border-color:var(--settings-edge,color-mix(in_srgb,var(--color-ink)_8%,transparent))] bg-transparent text-ink hover:bg-ink/[0.06] [field-sizing:content]",quiet:"rounded-md bg-ink/[0.05] text-ink outline-none hover:bg-ink/[0.08] focus-visible:ring-[1.5px] focus-visible:ring-focus"},rS={select:"pl-2.5 pr-[18px] text-[13px]",chevron:"right-1"},aS={lg:{select:"py-2.5 pl-3 pr-9 text-[15px]",chevron:"right-2"},md:{select:"py-2 pl-3 pr-9 text-[13px]",chevron:"right-2"},sm:{select:"py-1.5 pl-2.5 pr-8 text-[13px]",chevron:"right-1.5"}};function mn({className:e,variant:t="field",size:n="md",...s}){return r.jsxs("div",{className:I("relative inline-flex min-w-0",e),children:[r.jsx("select",{...s,className:I("peer w-full min-w-0 cursor-pointer appearance-none truncate [color-scheme:var(--code-color-scheme)] [&_option]:bg-menu [&_option]:text-ink disabled:cursor-default disabled:opacity-50",_de[t],t==="ghost"?rS.select:aS[n].select)}),r.jsx(kt,{size:t==="ghost"?12:14,"aria-hidden":!0,className:I("pointer-events-none absolute top-1/2 -translate-y-1/2 text-ink-secondary peer-disabled:opacity-50",t==="ghost"?rS.chevron:aS[n].chevron)})]})}function WM(e){return Yn(e)?l("model.setupRequired"):Gs(e)?l("model.signInRequired"):e.snapshot.version??l("model.ready")}function _y(e){return l(e.some(jT)?"model.addOrChangeApiKeys":"model.addApiKeys")}function Mde({option:e,current:t,defaultId:n,botModel:s=!1,onPick:a}){const i=e.needsCliUpdate!==void 0,o=e.orgBlocked===!0||i,c=i?l("chat.claudeUpdate.offer"):l("model.orgBlocked"),d=i?l("engines.updateClaude"):o?c:[e.provider,e.id===n?l("model.effort.default"):void 0].filter(Boolean).join(" · ");return r.jsxs("button",{type:"button","data-menu-row":!0,"data-current-model":t||void 0,"data-org-blocked":o||void 0,disabled:o,"aria-pressed":t,"aria-label":o?`${e.label} · ${c}`:void 0,title:o?c:e.provider?l("model.provider",{name:e.provider}):void 0,onClick:a,className:Ws,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:Ja(e)}),s&&r.jsx("span",{"data-bot-model":!0,className:"shrink-0 text-[12px] leading-4 text-ink-tertiary",children:l("model.botModelTag")}),d&&r.jsx("span",{className:rH,children:d}),e.loaded&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[12px] leading-4 text-ink-tertiary",children:[r.jsx("span",{className:"size-1.5 rounded-full bg-success","aria-hidden":"true"}),l("model.loadedNow")]}),t&&r.jsx(Ie,{size:14,className:"shrink-0 text-ink","aria-hidden":"true"})]})}function Rde({name:e,model:t,follows:n,onPick:s}){return r.jsxs("button",{type:"button","data-follow-bot-model":!0,"data-menu-row":!0,"aria-pressed":n,onClick:s,className:"flex h-9 w-full shrink-0 items-center justify-between gap-2 border-b-[0.5px] border-ink/10 px-3.5 text-left text-[13px] leading-[18px] text-ink hover:bg-ink/[0.06] focus:bg-ink/[0.06]",children:[r.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[r.jsx("span",{className:"shrink-0 font-medium",children:l("model.useBotModel",{name:e})}),r.jsx("span",{className:"truncate text-[12px] leading-4 text-ink-tertiary",children:t})]}),n&&r.jsx(Ie,{size:14,className:"shrink-0 text-ink","aria-hidden":"true"})]})}function Ode({value:e,onChange:t,local:n}){return r.jsxs("div",{className:"group/search flex h-9 shrink-0 items-center gap-2 border-b-[0.5px] border-ink/10 px-3.5",children:[r.jsx(Cn,{size:16,strokeWidth:Vt,className:"shrink-0 text-ink-tertiary group-focus-within/search:text-ink-secondary","aria-hidden":"true"}),r.jsx("input",{"data-menu-search":!0,value:e,onChange:s=>t(s.target.value),placeholder:l("model.search"),"aria-label":n?l("model.searchLocal"):l("model.search"),className:"min-w-0 flex-1 bg-transparent text-[13px] leading-[18px] text-ink outline-none placeholder:text-ink-tertiary"})]})}function zde(e,t,n,s){const a={claude:e.find(m=>Ma(m)&&m.claudeAccount?.isDefault)??e.find(Ma),openai:e.find(m=>Dn(m)==="openai")},i={claude:n,openai:s},o=e.filter(m=>{const h=Dn(m);return!h||m===a[h]}),c=m=>{const h=Dn(m);return{instance:m,target:h?i[h]??m:m,label:h?i3[h]:ht(m),selected:h?Dn(t)===h:m.instanceId===t?.instanceId}},{subscription:d,api:u,custom:p}=o3(o);return{subscription:d.map(c),api:u.map(c),custom:p.map(c)}}const I1="pb-0.5 text-center text-[11px] leading-[14px] text-ink-tertiary";function Lde({instances:e,selectedInstance:t,claudeInstance:n,openaiInstance:s,onSelect:a,onAddApiKeys:i}){const{subscription:o,api:c,custom:d}=zde(e,t,n,s),u=({instance:p,target:m,selected:h,label:x})=>{const g=Yn(m)||Gs(m)||!!m.snapshot.update,k=m.policy?l("policy.managedBy",{organization:m.policy.organizationName}):void 0;return r.jsxs("button",{type:"button",onClick:()=>a(m),"aria-label":k?`${x} · ${k}`:x,"aria-pressed":h,title:`${x} · ${k??WM(m)}`,className:I("group relative flex size-9 shrink-0 items-center justify-center rounded-[8px]",h?"bg-ink/[0.08]":"hover:bg-ink/[0.06]",k&&"opacity-40"),children:[r.jsx(_s,{instance:m,size:18,subtle:!h}),m.access==="api"&&r.jsx("span",{"data-rail-key-badge":!0,className:"absolute bottom-0 left-0 flex size-3.5 items-center justify-center rounded-full bg-menu text-ink-secondary",children:r.jsx(es,{size:9,"aria-hidden":"true"})}),g&&r.jsx("span",{className:"absolute bottom-0.5 right-0.5 size-1.5 rounded-full bg-warning ring-2 ring-menu"})]},p.instanceId)};return r.jsxs("div",{className:"flex w-14 shrink-0 flex-col gap-1 overflow-y-auto border-r-[0.5px] border-ink/10 p-2",children:[o.length>0&&r.jsx("div",{className:I(I1,"pt-0.5"),children:l("model.rail.cloud")}),o.map(u),(c.length>0||i)&&r.jsx("div",{className:I(I1,o.length>0?"pt-2":"pt-0.5"),children:l("model.rail.apiKeys")}),c.map(u),i&&r.jsx("button",{type:"button","data-rail-add-api-key":!0,onClick:i,"aria-label":_y(e),title:_y(e),className:"flex size-9 shrink-0 items-center justify-center rounded-[8px] border border-dashed border-ink/20 text-ink-tertiary hover:bg-ink/[0.06] hover:text-ink",children:r.jsx(An,{size:16,strokeWidth:Vt,"aria-hidden":"true"})}),d.length>0&&r.jsx("div",{className:I(I1,"pt-2"),children:l("model.rail.local")}),d.map(u)]})}function iS({accounts:e,selectedId:t,onSelect:n}){return r.jsxs("label",{className:"mt-2 flex min-w-0 items-center gap-2 text-[12px] leading-4 text-ink-secondary",children:[r.jsxs("span",{children:[l("model.account"),":"]}),r.jsx(mn,{size:"sm",variant:"quiet",className:"flex-1","aria-label":l("model.account"),value:t,onChange:s=>{const a=e.find(i=>i.instanceId===s.target.value);a&&n(a)},children:e.map(s=>r.jsx("option",{value:s.instanceId,children:ht(s)},s.instanceId))})]})}const KM=500;function Pde(e,t,n){return{text:e&&n-e.at<KM?e.text+t:t,at:n}}function Dde(e,t,n){const s=n.toLowerCase(),a=[...s].every(c=>c===s[0]),i=a?s.slice(0,1):s,o=a?t+1:Math.max(t,0);for(let c=0;c<e.length;c++){const d=(o+c)%e.length;if(e[d].trim().toLowerCase().startsWith(i))return d}return null}function $de(e){return e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey}const Bde="button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex]",Fde="[data-simple-set-up], [data-simple-sign-in], [data-simple-manage], [data-model-local-entry]";function qde(e,{query:t,typed:n,close:s}){if(!(e.target instanceof HTMLElement))return;const a=e.currentTarget,i=e.target,o=()=>{e.preventDefault(),e.stopPropagation()};if(e.key==="Tab"){const E=[...a.querySelectorAll(Bde)].filter(_=>_!==i&&_.tabIndex>=0&&!_.closest("[hidden]")),A=(_,N)=>!!(_.compareDocumentPosition(N)&Node.DOCUMENT_POSITION_FOLLOWING);E.some(_=>e.shiftKey?A(_,i):A(i,_))||(o(),s());return}if(i instanceof HTMLSelectElement)return;const c=getComputedStyle(a).direction==="rtl",d=i.closest("[data-simple-effort]");if(d){const E=[...d.querySelectorAll("button:not(:disabled)")],A={ArrowRight:c?"ArrowUp":"ArrowDown",ArrowLeft:c?"ArrowDown":"ArrowUp",Home:"Home",End:"End"}[e.key],_=A?Jf(A,E.indexOf(i),E.length):null;_!==null&&(o(),E[_]?.focus());return}const u=c?"ArrowLeft":"ArrowRight",p=i.matches("[data-model-favorite]")?i:null,m=p?.parentElement?.querySelector("[data-menu-row]")??null;if(p){if(!m||e.key==="Enter"||e.key===" ")return;if(e.key===(c?"ArrowRight":"ArrowLeft")){o(),m.focus({preventScroll:!0});return}}else if(e.key===u&&i.matches("[data-menu-row]")){const E=i.parentElement?.querySelector(":scope > [data-model-favorite]");if(E){o(),E.focus({preventScroll:!0});return}}const h=m??i,x=a.querySelector("[data-menu-search]");if(i instanceof HTMLInputElement&&i!==x)return;const g=[...a.querySelectorAll("[data-menu-row]:not(:disabled)")],k=x?g.filter(E=>x.compareDocumentPosition(E)&Node.DOCUMENT_POSITION_FOLLOWING):[],v=x?g.filter(E=>!k.includes(E)):[],y=E=>{o(),E?.focus({preventScroll:!0}),E?.scrollIntoView?.({block:"nearest"})};if(i===x){e.key==="ArrowDown"?y(k[0]):e.key==="ArrowUp"&&v.length>0?y(v.at(-1)):e.key==="Enter"&&(o(),t.trim()&&g.find(E=>E.hasAttribute("aria-pressed")&&!E.hasAttribute("data-follow-bot-model"))?.click());return}const b=g.indexOf(h);if(b<0&&h!==a)return;if(e.key==="Enter"&&b>=0){o(),h.click();return}if(x&&(e.key==="ArrowUp"&&h===k[0]||e.key==="ArrowDown"&&h===v.at(-1)))return y(x);const w=Jf(e.key,b,g.length);if(w!==null)return y(g[w]);if(e.key===(c?"ArrowLeft":"ArrowRight")&&b>=0&&g[b].matches(Fde)){o(),g[b].click();return}const j=e.key===" "&&n.current!==null&&e.timeStamp-n.current.at<KM;if(!$de(e)&&!j)return;if(x){x.focus();return}j&&o(),n.current=Pde(n.current,e.key,e.timeStamp);const S=Dde(g.map(E=>E.textContent??""),b,n.current.text);S!==null&&y(g[S])}function Ude(e){if(e.pointerType!=="mouse"||!(e.target instanceof Element))return;const t=e.target.closest("[data-menu-row]"),n=document.activeElement;!t||t===n||t.matches(":disabled")||!(n instanceof HTMLElement)||n.matches("[data-menu-row]")&&e.currentTarget.contains(n)&&t.focus({preventScroll:!0})}const oS={off:"model.effort.off",on:"model.variant.on",none:"model.effort.none",low:"model.effort.low",medium:"model.effort.medium",high:"model.effort.high",xhigh:"model.effort.xhigh",max:"model.effort.max"},Zc=(e,t)=>e.id==="default"&&t==="opencodeGo"?l("model.variant.openCodeDefault"):t==="openai-compat"&&Object.hasOwn(oS,e.id)?l(oS[e.id]):e.label;function p3(e,t,n){const s=e.instances.find(c=>c.instanceId===t.instanceId);if(!s?.capabilities?.modelVariants)return null;const a=n===void 0?void 0:e.modelVariantSessions[n],i=a?.instanceId===t.instanceId&&a.model===t.model?a.variants:void 0,o=i?.options??s.models.options.find(c=>c.id===t.model)?.variants??[];return!o.length&&t.variant===void 0?null:{instance:s,reported:i,options:o}}function VM(e,t,n,s){return t.capabilities?.modelVariants?!!p3(e,n,s):!!t.capabilities?.effortLevels?.length}function Hde(e,t,n,s){if(!t.busy)return!1;const a=n?void 0:e.instances.find(i=>i.instanceId===t.modelSelection.instanceId);return!(a&&VM(e,a,t.modelSelection,s??t.threadId))}function Wde(e,t,n,s){const a=f.useRef(!1);return f.useEffect(()=>{if(!a.current)return;a.current=!1;const i=e.current;!t||!i||i.contains(document.activeElement)||(i.querySelector(':not([hidden]) > [data-simple-effort] [tabindex="0"]')??i).focus({preventScroll:!0})},[n,s,t,e]),()=>{a.current=!0}}function Kde({bot:e,threadId:t,updateBotDefault:n,variants:s}){return r.jsxs("div",{"data-model-busy":!0,className:"flex flex-col py-1",children:[r.jsx(aR,{compact:!0,bot:e,threadId:t,updateBotDefault:n,className:"px-3.5 py-[5px]",label:r.jsx("span",{className:"text-[13px] leading-[18px] text-ink",children:s?l("model.simple.reasoning"):l("model.section.effort")})}),t&&r.jsx("p",{"data-model-busy-scope":!0,className:"px-3.5 py-1 text-[12px] leading-4 text-ink-tertiary",children:l(n?"model.scope.botHelp":"model.scope.threadHelp")}),r.jsx("p",{className:"px-3.5 py-1 text-[12px] leading-4 text-ink-tertiary",children:l("model.reasoningNextTurn")}),r.jsx("p",{className:"px-3.5 py-1 text-[12px] leading-4 text-ink-tertiary",children:l(t?"model.threadBusy":"model.busy")})]})}const m3="@max-4xl/chathead:size-[30px] @max-4xl/chathead:justify-center @max-4xl/chathead:gap-0 @max-4xl/chathead:p-0",Vde="@max-4xl/chathead:size-[30px] @max-4xl/chathead:justify-center @max-4xl/chathead:gap-0 @max-4xl/chathead:rounded-md @max-4xl/chathead:p-0",Gde=500,Yde=8;let Li=null,La=new Map,Jde=0;const Zde=e=>`${e.botId}
117
117
  ${e.threadId}`,xl=(e,t)=>{const n=new Map(La);t?n.set(e,{...t,version:++Jde}):n.delete(e),La=n,f3()};let Xde=0;const My=new Set,Ry=new Set,f3=()=>{for(const e of Array.from(Ry))e()},GM=e=>(Ry.add(e),()=>{Ry.delete(e)}),YM=e=>`${e.threadId}
@@ -180,14 +180,14 @@ ${i}`:t.push(i)};for(const i of e.split(`
180
180
  `);var W=0,z=!1;this.parse=function(B,D,T){if(typeof B!="string")throw new Error("Input must be a string");var V=B.length,U=N.length,H=C.length,G=R.length,Z=A(O),Y=[],ne=[],J=[],X=W=0;if(!B)return xe();if(L||L!==!1&&B.indexOf(M)===-1){for(var me=B.split(C),ge=0;ge<me.length;ge++){if(J=me[ge],W+=J.length,ge!==me.length-1)W+=C.length;else if(T)return xe();if(!R||J.substring(0,G)!==R){if(Z){if(Y=[],ue(J.split(N)),Ne(),z)return xe()}else ue(J.split(N));if(q&&q<=ge)return Y=Y.slice(0,q),xe(!0)}}return xe()}for(var ee=B.indexOf(N,W),oe=B.indexOf(C,W),ae=new RegExp(v(F)+v(M),"g"),te=B.indexOf(M,W);;)if(B[W]===M)for(te=W,W++;;){if((te=B.indexOf(M,te+1))===-1)return T||ne.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Y.length,index:W}),ie();if(te===V-1)return ie(B.substring(W,te).replace(ae,M));if(M===F&&B[te+1]===F)te++;else if(M===F||te===0||B[te-1]!==F){ee!==-1&&ee<te+1&&(ee=B.indexOf(N,te+1));var ce=Se((oe=oe!==-1&&oe<te+1?B.indexOf(C,te+1):oe)===-1?ee:Math.min(ee,oe));if(B.substr(te+1+ce,U)===N){J.push(B.substring(W,te).replace(ae,M)),B[W=te+1+ce+U]!==M&&(te=B.indexOf(M,W)),ee=B.indexOf(N,W),oe=B.indexOf(C,W);break}if(ce=Se(oe),B.substring(te+1+ce,te+1+ce+H)===C){if(J.push(B.substring(W,te).replace(ae,M)),ke(te+1+ce+H),ee=B.indexOf(N,W),te=B.indexOf(M,W),Z&&(Ne(),z))return xe();if(q&&Y.length>=q)return xe(!0);break}ne.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Y.length,index:W}),te++}}else if(R&&J.length===0&&B.substring(W,W+G)===R){if(oe===-1)return xe();W=oe+H,oe=B.indexOf(C,W),ee=B.indexOf(N,W)}else if(ee!==-1&&(ee<oe||oe===-1))J.push(B.substring(W,ee)),W=ee+U,ee=B.indexOf(N,W);else{if(oe===-1)break;if(J.push(B.substring(W,oe)),ke(oe+H),Z&&(Ne(),z))return xe();if(q&&Y.length>=q)return xe(!0)}return ie();function ue(re){Y.push(re),X=W}function Se(re){var he=0;return he=re!==-1&&(re=B.substring(te+1,re))&&re.trim()===""?re.length:he}function ie(re){return T||(re===void 0&&(re=B.substring(W)),J.push(re),W=V,ue(J),Z&&Ne()),xe()}function ke(re){W=re,ue(J),J=[],oe=B.indexOf(C,W)}function xe(re){if(_.header&&!D&&Y.length&&!$){var he=Y[0],je=Object.create(null),ve=new Set(he);let we=!1;for(let Ee=0;Ee<he.length;Ee++){let be=u(he[Ee]);if(je[be=A(_.transformHeader)?_.transformHeader(be,Ee):be]){let fe,Te=je[be];for(;fe=be+"_"+Te,Te++,ve.has(fe););ve.add(fe),he[Ee]=fe,je[be]++,we=!0,(P=P===null?{}:P)[fe]=be}else je[be]=1,he[Ee]=be;ve.add(be)}we&&console.warn("Duplicate headers found and renamed."),$=!0}return{data:Y,errors:ne,meta:{delimiter:N,linebreak:C,aborted:z,truncated:!!re,cursor:X+(D||0),renamedHeaders:P}}}function Ne(){O(xe()),Y=[],ne=[]}},this.abort=function(){z=!0},this.getCharIndex=function(){return W}}function b(_){var N=_.data,C=o[N.workerId],R=!1;if(N.error)C.userError(N.error,N.file);else if(N.results&&N.results.data){var O={abort:function(){R=!0,w(N.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:j,resume:j};if(A(C.userStep)){for(var q=0;q<N.results.data.length&&(C.userStep({data:N.results.data[q],errors:N.results.errors,meta:N.results.meta},O),!R);q++);delete N.results}else A(C.userChunk)&&(C.userChunk(N.results,O,N.file),delete N.results)}N.finished&&!R&&w(N.workerId,N.results)}function w(_,N){var C=o[_];A(C.userComplete)&&C.userComplete(N),C.terminate(),delete o[_]}function j(){throw new Error("Not implemented.")}function S(_){if(typeof _!="object"||_===null)return _;var N,C=Array.isArray(_)?[]:{};for(N in _)C[N]=S(_[N]);return C}function E(_,N){return function(){_.apply(N,arguments)}}function A(_){return typeof _=="function"}return d.parse=function(_,N){var C=(N=N||{}).dynamicTyping||!1;if(A(C)&&(N.dynamicTypingFunction=C,C={}),N.dynamicTyping=C,N.transform=!!A(N.transform)&&N.transform,N.downloadTimeout!==void 0){var C=parseInt(N.downloadTimeout);if(isNaN(C))throw new Error("Config downloadTimeout value ("+N.downloadTimeout+") not parsable by parseInt(val).");N.downloadTimeout=C}if(!N.worker||!d.WORKERS_SUPPORTED)return C=null,d.NODE_STREAM_INPUT,typeof _=="string"?(_=u(_),C=new(N.download?m:x)(N)):_.readable===!0&&A(_.read)&&A(_.on)?C=new g(N):(s.File&&_ instanceof File||_ instanceof Object)&&(C=new h(N)),C.stream(_);(C=(()=>{var R;return!!d.WORKERS_SUPPORTED&&(R=(()=>{var O=s.URL||s.webkitURL||null,q=n.toString();return d.BLOB_URL||(d.BLOB_URL=O.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",q,")();"],{type:"text/javascript"})))})(),(R=new s.Worker(R)).onmessage=b,R.id=c++,o[R.id]=R)})()).userStep=N.step,C.userChunk=N.chunk,C.userComplete=N.complete,C.userError=N.error,N.step=A(N.step),N.chunk=A(N.chunk),N.complete=A(N.complete),N.error=A(N.error),delete N.worker,C.postMessage({input:_,config:N,workerId:C.id})},d.unparse=function(_,N){var C=!1,R=!0,O=",",q=`\r
181
181
  `,L='"',P=L+L,$=!1,M=null,F=!1,W=((()=>{if(typeof N=="object"){if(typeof N.delimiter!="string"||d.BAD_DELIMITERS.filter(function(D){return N.delimiter.indexOf(D)!==-1}).length||(O=N.delimiter),typeof N.quotes!="boolean"&&typeof N.quotes!="function"&&!Array.isArray(N.quotes)||(C=N.quotes),typeof N.skipEmptyLines!="boolean"&&typeof N.skipEmptyLines!="string"||($=N.skipEmptyLines),typeof N.newline=="string"&&(q=N.newline),typeof N.quoteChar=="string"&&(L=N.quoteChar,P=L+L),typeof N.header=="boolean"&&(R=N.header),Array.isArray(N.columns)){if(N.columns.length===0)throw new Error("Option columns is empty");M=N.columns}N.escapeChar!==void 0&&(P=N.escapeChar+L),N.escapeFormulae instanceof RegExp?F=N.escapeFormulae:typeof N.escapeFormulae=="boolean"&&N.escapeFormulae&&(F=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(L),"g"));if(typeof _=="string"&&(_=JSON.parse(_)),Array.isArray(_)){if(!_.length||Array.isArray(_[0]))return z(null,_,$);if(typeof _[0]=="object")return z(M||Object.keys(_[0]),_,$)}else if(typeof _=="object")return typeof _.data=="string"&&(_.data=JSON.parse(_.data)),Array.isArray(_.data)&&(_.fields||(_.fields=_.meta&&_.meta.fields||M),_.fields||(_.fields=Array.isArray(_.data[0])?_.fields:typeof _.data[0]=="object"?Object.keys(_.data[0]):[]),Array.isArray(_.data[0])||typeof _.data[0]=="object"||(_.data=[_.data])),z(_.fields||[],_.data||[],$);throw new Error("Unable to serialize unrecognized input");function z(D,T,V){var U="",H=(typeof D=="string"&&(D=JSON.parse(D)),typeof T=="string"&&(T=JSON.parse(T)),Array.isArray(D)&&0<D.length),G=!Array.isArray(T[0]);if(H&&R){for(var Z=0;Z<D.length;Z++)0<Z&&(U+=O),U+=B(D[Z],Z);0<T.length&&(U+=q)}for(var Y=0;Y<T.length;Y++){var ne=(H?D:T[Y]).length,J=!1,X=H?Object.keys(T[Y]).length===0:T[Y].length===0;if(V&&!H&&(J=V==="greedy"?T[Y].join("").trim()==="":T[Y].length===1&&T[Y][0].length===0),V==="greedy"&&H){for(var me=[],ge=0;ge<ne;ge++){var ee=G?D[ge]:ge;me.push(T[Y][ee])}J=me.join("").trim()===""}if(!J){for(var oe=0;oe<ne;oe++){0<oe&&!X&&(U+=O);var ae=H&&G?D[oe]:oe;U+=B(T[Y][ae],oe)}Y<T.length-1&&(!V||0<ne&&!X)&&(U+=q)}}return U}function B(D,T){var V,U,H;return D==null?"":D.constructor===Date?isNaN(D.getTime())?"":D.toISOString():(H=!1,F&&typeof D=="string"&&F.test(D)&&(D="'"+D,H=!0),U=(V=D.toString()).replace(W,P),(H=H||C===!0||typeof C=="function"&&C(D,T)||Array.isArray(C)&&C[T]||((G,Z)=>{for(var Y=0;Y<Z.length;Y++)if(-1<G.indexOf(Z[Y]))return!0;return!1})(U,d.BAD_DELIMITERS)||-1<U.indexOf(O)||-1<V.indexOf(L)||U.charAt(0)===" "||U.charAt(U.length-1)===" ")?L+U+L:U)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
182
182
  `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!a&&!!s.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=y,d.ParserHandle=k,d.NetworkStreamer=m,d.FileStreamer=h,d.StringStreamer=x,d.ReadableStreamStreamer=g,i&&(s.onmessage=function(_){_=_.data,d.WORKER_ID===void 0&&_&&(d.WORKER_ID=_.workerId),typeof _.input=="string"?s.postMessage({workerId:d.WORKER_ID,results:d.parse(_.input,_.config),finished:!0}):(s.File&&_.input instanceof File||_.input instanceof Object)&&(_=d.parse(_.input,_.config))&&s.postMessage({workerId:d.WORKER_ID,results:_,finished:!0})}),(m.prototype=Object.create(p.prototype)).constructor=m,(h.prototype=Object.create(p.prototype)).constructor=h,(x.prototype=Object.create(x.prototype)).constructor=x,(g.prototype=Object.create(p.prototype)).constructor=g,d})})(rf)),rf.exports}var qje=Fje();const Uje=Kv(qje),Hje=10*1024*1024;function CI(e){return/\.csv$/i.test(e)?",":/\.tsv$/i.test(e)?" ":null}const EI=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),Wje=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;function Ok(e){return Wje.test(e.trim())}const Kje=/^[+-]?[$€£¥₹]?\d{1,3}(?:,?\d{3})*(?:\.\d+)?%?$/;function Vje(e){return Ok(e)||Kje.test(e.trim())}function Gje(e,t,n){const s=t.trim().toLocaleLowerCase(),a=e.flatMap((i,o)=>!s||i.some(c=>c.toLocaleLowerCase().includes(s))?[o]:[]);return n&&a.sort((i,o)=>{const c=e[i][n.column]??"",d=e[o][n.column]??"";if(!c.trim()||!d.trim())return+!c.trim()-+!d.trim()||i-o;const u=Ok(c)&&Ok(d);let p;if(u&&/^[+-]?\d+$/.test(c.trim())&&/^[+-]?\d+$/.test(d.trim())){const m=BigInt(c.trim()),h=BigInt(d.trim());p=m<h?-1:m>h?1:0}else p=u?Number(c)-Number(d):EI.compare(c,d);return(Number.isFinite(p)?p:EI.compare(c,d))*(n.descending?-1:1)||i-o}),a}const Yje=/^(?![+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$)[=+\-@\t\r]/i;function Jje(e,t){return Uje.unparse([e,...t],{newline:`\r
183
- `,escapeFormulae:Yje})}const Zje=4,Xje=12,Qje=7.5,e5e=100;function t5e(e,t){return e.map((n,s)=>{let a=0;for(const i of[n,...t.slice(0,e5e).map(o=>o[s]??"")])for(const o of i.split(/\s+/))a=Math.max(a,[...o].length);return Math.round(Math.min(Xje,Math.max(Zje,a))*Qje)})}const n5e=24;function s5e({wrap:e,virtual:t,minimums:n=[],available:s=null}){return!e||t?!1:s===null||n.reduce((a,i)=>a+i+n5e,0)<=s}function Dj({title:e,onClose:t,children:n,returnFocus:s}){const a=f.useRef(null),i=f.useId();return f.useEffect(()=>{const o=a.current;return o.showModal(),()=>{o.close(),s?.isConnected&&s.focus()}},[s]),Ke.createPortal(r.jsxs("dialog",{ref:a,"aria-labelledby":i,onCancel:t,onClose:t,onKeyDown:o=>{o.key==="Escape"&&o.stopPropagation()},className:"m-auto flex max-h-[94dvh] w-[min(96vw,1400px)] max-w-none flex-col overflow-hidden rounded-2xl border border-hairline bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/55",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-hairline/40 px-4 py-3",children:[r.jsx("h2",{id:i,className:"min-w-0 truncate text-sm font-medium",children:e}),r.jsx("button",{type:"button",autoFocus:!0,onClick:t,className:"table-action","aria-label":l("table.close"),children:r.jsx(Ae,{size:16})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-3 sm:p-5",children:n})]}),document.body)}const AI=8,r5e="group/table relative w-fit min-w-[min(100%,20rem)] max-w-full overflow-hidden rounded-[18px] bg-card text-ink touch:pt-11";function $j({columns:e,rows:t,name:n=l("table.title"),expanded:s=!1,direction:a="ltr",headless:i=!1,card:o=!0}){const c=!et(),[d,u]=f.useState(""),p=f.useDeferredValue(d),[m,h]=f.useState(null),[x,g]=f.useState(!0),[k,v]=f.useState(!1),y=f.useRef(null),[b,w]=f.useState("idle"),j=f.useMemo(()=>t.map(L=>L.map(P=>P.text)),[t]),S=f.useMemo(()=>Gje(j,p,m),[j,p,m]);f.useEffect(()=>{if(b==="idle")return;const L=setTimeout(()=>w("idle"),2500);return()=>clearTimeout(L)},[b]);const E=()=>Jje(e.map(L=>L.text),S.map(L=>j[L])),A=async()=>{const L=await Vs(E());L!=="empty"&&w(L)},_=()=>{const L=URL.createObjectURL(new Blob(["\uFEFF",E()],{type:"text/csv;charset=utf-8"})),P=document.createElement("a");P.href=L,P.download=`${n.replace(/\.(csv|tsv)$/i,"").replace(/[\\/:*?"<>|]/g,"_").slice(0,150)||"table"}.csv`,P.click(),setTimeout(()=>URL.revokeObjectURL(L),1e3)},N=b!=="idle"&&r.jsx("span",{role:b==="failed"?"alert":"status",className:"sr-only",children:l(b==="failed"?"table.copyFailed":"table.copied")}),C=L=>r.jsxs("label",{className:L,children:[r.jsx(Cn,{size:13,"aria-hidden":"true"}),r.jsx("input",{value:d,onChange:P=>u(P.target.value),"aria-label":l("table.search"),placeholder:l("table.search"),className:"w-full min-w-0 bg-transparent py-1 text-xs text-ink outline-none placeholder:text-ink-tertiary focus-visible:ring-1 focus-visible:ring-accent"})]}),R=L=>h(m?.column!==L?{column:L,descending:!1}:m.descending?null:{column:L,descending:!0}),O=()=>r.jsxs("div",{"data-table-card":!0,className:r5e,dir:"ltr",children:[r.jsxs("div",{className:"table-plate absolute end-1.5 top-1.5 z-20 flex items-center gap-0.5 rounded-full bg-composer p-0.5 opacity-0 ring-[0.5px] ring-ink/10 transition-opacity focus-within:opacity-100 group-hover/table:opacity-100 touch:end-1 touch:top-0 touch:bg-transparent touch:p-0 touch:opacity-100 touch:ring-0",children:[r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.copyPlain"),title:l("table.copyPlain"),onClick:()=>{A()},children:b==="copied"?r.jsx(Ie,{size:14}):r.jsx(fn,{size:14})}),r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.download"),title:l("table.download"),onClick:_,children:r.jsx(Ft,{size:14})}),r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.expand"),title:l("table.expand"),onClick:L=>{y.current=L.currentTarget,v(!0)},children:r.jsx(Dd,{size:14})})]}),t.length>AI&&r.jsxs("div",{className:"flex items-center gap-2 px-4 pb-1.5 text-ink-tertiary",children:[C("flex min-w-24 flex-1 items-center gap-2"),r.jsx("span",{role:"status",className:"shrink-0 text-[12px] tabular-nums",children:l("table.count",{shown:S.length.toLocaleString(),total:t.length.toLocaleString(),columns:e.length})})]}),r.jsx(TI,{columns:e,rows:t,order:S,name:n,wrap:x,large:!1,sort:m,direction:a,headless:i,look:"card",onSort:R}),N]}),q=L=>{if(c&&o&&!L)return O();const P=!L&&t.length<=AI,$=r.jsxs(r.Fragment,{children:[!P&&r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.wrap"),title:l("table.wrap"),"aria-pressed":x,onClick:()=>g(!x),children:r.jsx(Bd,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.copy"),title:l("table.copy"),onClick:()=>{A()},children:b==="copied"?r.jsx(Ie,{size:14}):r.jsx(fn,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.download"),title:l("table.download"),onClick:_,children:r.jsx(Ft,{size:14})}),!L&&r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.expand"),title:l("table.expand"),onClick:M=>{y.current=M.currentTarget,v(!0)},children:r.jsx(Dd,{size:14})})]});return r.jsxs("div",{className:I("rich-table w-fit min-w-[min(100%,var(--chat-prose-max))] max-w-full overflow-hidden rounded-xl border border-hairline/50 text-ink",c?"bg-composer":"bg-panel"),dir:"ltr",children:[!P&&r.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-hairline/40 px-2 py-1.5",children:[C("flex min-w-24 flex-1 items-center gap-2 px-1 text-ink-secondary"),$]}),r.jsx(TI,{columns:e,rows:t,order:S,name:n,wrap:x,large:L,sort:m,direction:a,headless:i,look:c?"quiet":"panel",onSort:R}),r.jsxs("footer",{className:P?"flex items-center justify-end gap-0.5 border-t border-hairline/30 px-1.5 py-1 text-[11px] text-ink-tertiary":"flex flex-wrap items-center justify-between gap-2 border-t border-hairline/40 px-3 py-2 text-[11px] text-ink-secondary",children:[!P&&r.jsx("span",{role:"status",children:l("table.count",{shown:S.length.toLocaleString(dt()),total:t.length.toLocaleString(dt()),columns:e.length})}),b!=="idle"&&r.jsx("span",{role:b==="failed"?"alert":"status",className:P?"me-auto ps-1.5":void 0,children:l(b==="failed"?"table.copyFailed":"table.copied")}),P&&$]})]})};return r.jsxs(r.Fragment,{children:[r.jsx("div",{hidden:k,className:"chat-table",children:q(s)}),k&&r.jsx(Dj,{title:n,returnFocus:y.current,onClose:()=>v(!1),children:q(!0)})]})}function TI({columns:e,rows:t,order:n,name:s,wrap:a,large:i,sort:o,onSort:c,direction:d,headless:u=!1,look:p="panel"}){const m=p==="card",h=f.useRef(null),x=f.useRef(null),[g,k]=f.useState(40);f.useEffect(()=>{if(!x.current)return;const $=new ResizeObserver(([M])=>{M&&k(M.target.getBoundingClientRect().height)});return $.observe(x.current),()=>$.disconnect()},[]);const v=n.length>80,y=f.useMemo(()=>t5e(e.map($=>$.text),t.map($=>$.map(M=>M.text))),[e,t]),[b,w]=f.useState(null);f.useEffect(()=>{const $=h.current;if(!$||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>w($.clientWidth||null));return M.observe($),()=>M.disconnect()},[]);const j=s5e({wrap:a,virtual:v,minimums:y,available:b}),S=f.useMemo(()=>e.map(($,M)=>$.width??Math.min(320,Math.max(140,Math.max($.text.length,...t.slice(0,100).map(F=>Math.min(40,F[M]?.text.length??0)))*7+40))),[e,t]),E=f.useMemo(()=>e.map(($,M)=>{const F=t.slice(0,200).map(W=>W[M]?.text.trim()??"").filter(Boolean);return F.length>0&&F.every(Vje)}),[e,t]),A=$je({count:n.length,getScrollElement:()=>h.current,estimateSize:()=>42,getItemKey:$=>n[$],overscan:6,enabled:v,initialRect:{width:800,height:400},scrollMargin:g});f.useEffect(()=>{h.current&&(h.current.scrollTop=0)},[n]),f.useEffect(()=>{A.measure()},[a,S,A]);const _=v?A.getVirtualItems():n.map(($,M)=>({key:$,index:M,start:0,end:0})),N=v&&_.length?Math.max(0,_[0].start-g):0,C=v&&_.length?Math.max(0,A.getTotalSize()-_.at(-1).end+g):0,R=($,M)=>$.align??(E[M]||d==="rtl"?"right":"left"),O=($,M)=>l("table.sort",{column:$.text||M+1}),q=($,M)=>$.content??($.text||l("table.column",{number:M+1})),L=($,M)=>o?.column===$&&o.descending?r.jsx(_l,{size:12,className:M}):r.jsx(mi,{size:12,className:I(M,o?.column!==$&&!m&&"opacity-35")}),P=$=>L($,I("shrink-0 text-ink-tertiary transition-opacity",o?.column===$?"opacity-100":"opacity-0 group-hover/th:opacity-100 group-focus-within/th:opacity-100 touch:opacity-100"));return r.jsxs("div",{ref:h,tabIndex:0,role:"region","aria-label":s,className:I("overflow-auto overscroll-x-contain focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",m&&!j&&"[mask-image:linear-gradient(90deg,#000_calc(100%-40px),transparent)]"),style:{maxHeight:i?"65dvh":v||!a?400:void 0},"data-fit":j||void 0,children:[r.jsxs("table",{dir:d,"aria-label":s,"aria-rowcount":n.length+1,className:I("w-full border-separate border-spacing-0 text-[14px]",j?"table-auto":"table-fixed",m&&"leading-5"),style:j?void 0:{minWidth:S.reduce(($,M)=>$+M,0)},children:[!j&&r.jsx("colgroup",{children:S.map(($,M)=>r.jsx("col",{style:{width:$}},M))}),r.jsx("thead",{ref:x,hidden:u,className:I("sticky top-0 z-10",p==="panel"?"bg-raised":p==="card"?"bg-card":"bg-composer"),children:r.jsx("tr",{"aria-rowindex":1,children:e.map(($,M)=>r.jsx("th",{scope:"col","aria-sort":o?.column===M?o.descending?"descending":"ascending":"none",className:m?"px-4 py-2.5 align-bottom font-semibold":"h-10 border-b border-hairline/60 px-3 py-2 font-medium",style:{textAlign:R($,M)},children:r.jsx("div",{className:"break-words [overflow-wrap:anywhere]",style:j?{minWidth:y[M]}:void 0,children:m?r.jsxs("button",{type:"button",className:"group/th inline-flex max-w-full items-center gap-1 align-top text-start font-semibold [text-align:inherit] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60","aria-label":O($,M),title:O($,M),onClick:()=>c(M),children:[R($,M)==="right"&&P(M),r.jsx("span",{dir:"auto",children:q($,M)}),R($,M)!=="right"&&P(M)]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{dir:"auto",children:q($,M)}),r.jsx("button",{type:"button",className:"table-action ms-1 inline-flex align-middle","aria-label":O($,M),title:O($,M),onClick:()=>c(M),children:L(M)})]})})},M))})}),r.jsxs("tbody",{children:[N>0&&r.jsx("tr",{"aria-hidden":"true",children:r.jsx("td",{colSpan:e.length,style:{height:N,padding:0}})}),_.map($=>r.jsx("tr",{"data-index":$.index,ref:v?A.measureElement:void 0,"aria-rowindex":$.index+2,className:m?void 0:$.index%2?I(p==="quiet"?"bg-ink/[0.03]":"bg-inset/35","hover:bg-raised/70"):"hover:bg-raised/70",children:e.map((M,F)=>{const W=t[n[$.index]][F];return r.jsx("td",{className:m?"border-t-[0.5px] border-ink/[0.07] px-4 py-2.5 align-top tabular-nums":"border-b border-hairline/20 px-3 py-2.5 align-top tabular-nums",style:{textAlign:W?.align??R(M,F),verticalAlign:W?.vAlign},children:r.jsx("div",{dir:"auto",title:a?void 0:W?.text,className:a?"whitespace-pre-wrap break-words [overflow-wrap:anywhere]":"truncate",children:W?.content??W?.text})},F)})},$.key)),C>0&&r.jsx("tr",{"aria-hidden":"true",children:r.jsx("td",{colSpan:e.length,style:{height:C,padding:0}})})]})]}),n.length===0&&r.jsx("p",{className:"p-8 text-center text-sm text-ink-secondary",children:l(t.length?"table.noResults":"table.empty")})]})}async function uP(e,t,n=Hje){if(Number(e.headers.get("content-length"))>n)throw await e.body?.cancel().catch(()=>{}),new Error("size");const s=e.body?.getReader();if(!s)return"";const a=new TextDecoder("utf-8",{fatal:!0});let i=0,o="";try{for(;;){t.throwIfAborted();const c=await s.read();if(c.done)break;if(i+=c.value.byteLength,i>n)throw new Error("size");o+=a.decode(c.value,{stream:!0})}return o+a.decode()}finally{await s.cancel().catch(()=>{}),s.releaseLock()}}function a5e({path:e,name:t,message:n}){const[s,a]=f.useState(!1),i=f.useRef(null),o=CI(t)??CI(e);return o?r.jsxs(r.Fragment,{children:[r.jsx("button",{ref:i,type:"button",className:"table-action",title:l("table.preview",{name:t}),"aria-label":l("table.preview",{name:t}),onClick:()=>a(!0),children:r.jsx(IE,{size:14})}),s&&r.jsx(Dj,{title:t,returnFocus:i.current,onClose:()=>a(!1),children:r.jsx(i5e,{path:e,name:t,message:n,delimiter:o},`${n.threadId}:${n.messageId}:${e}`)})]}):null}function i5e({path:e,name:t,message:n,delimiter:s}){const[a,i]=f.useState(0),[o,c]=f.useState(null),[d,u]=f.useState(null);f.useEffect(()=>{const m=new AbortController;let h;u(null),c(null);const x=g=>{m.signal.aborted||u(g),h?.terminate()};return(async()=>{try{const g=await dp(e,n,m.signal),k=await uP(g,m.signal);m.signal.throwIfAborted(),h=new Worker(new URL("/assets/table-file.worker-KkMx-SNx.js",import.meta.url),{type:"module"}),h.onmessage=v=>{v.data.error?x(v.data.error):!m.signal.aborted&&v.data.table&&c(v.data.table),h?.terminate()},h.onerror=()=>x("format"),h.postMessage({text:k,delimiter:s})}catch(g){x(g instanceof Error&&g.message==="size"?"size":"load")}})(),()=>{m.abort(),h?.terminate()}},[e,n.threadId,n.messageId,s,a]);const p=f.useMemo(()=>o&&{columns:o.headers.map(m=>({text:m})),rows:o.rows.map(m=>m.map(h=>({text:h})))},[o]);return d?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l(d==="size"?"table.tooLarge":d==="columns"||d==="format"?"table.invalid":"table.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>i(a+1),children:l("chat.retry")})]}):p?r.jsx($j,{...p,name:t,expanded:!0}):r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("table.loading")]})}const o5e=2*1024*1024,l5e="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; media-src data:";function Ih(e){return/\.html?$/i.test(e)}function _I(e){return/\.(md|markdown)$/i.test(e)}const c5e=f.lazy(()=>_e(()=>import("./MarkdownFilePreview-C9-_VWg5.js"),__vite__mapDeps([51,1,2,3,4,10,8])));class d5e extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l("markdown.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>location.reload(),children:l("page.broken.reload")})]}):this.props.children}}function u5e(e){return`<meta http-equiv="Content-Security-Policy" content="${l5e}"><base target="_blank">${e}`}function p5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.openHtmlInBrowser}function Bj(e,t,n){const[s,a]=f.useState(!1),i=f.useRef(null),o=n===void 0?null:Ih(t)||Ih(e)?"html":_I(t)||_I(e)?"markdown":null,c=n?`${n.threadId}:${n.messageId}:${e}`:"";return{opens:o!==null,label:l(o==="markdown"?"markdown.preview":"html.preview",{name:t}),show:d=>{i.current=d.currentTarget,a(!0)},dialog:o&&s&&n?r.jsx(Dj,{title:t,returnFocus:i.current,onClose:()=>a(!1),children:o==="html"?r.jsx(h5e,{path:e,name:t,message:n},c):r.jsx(d5e,{children:r.jsx(f.Suspense,{fallback:r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("markdown.loading")]}),children:r.jsx(c5e,{path:e,name:t,message:n},c)})})}):null}}function m5e({path:e,name:t,message:n}){const s=Bj(e,t,n);return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"table-action",title:s.label,"aria-label":s.label,onClick:s.show,children:r.jsx(Ur,{size:14})}),s.dialog]})}function pP(e,t,n,s){return e.opens?{onClick:e.show,disabled:!1,"aria-label":e.label}:{onClick:()=>{t.save()},disabled:t.state==="saving","aria-label":s?l("attach.retrySaveAria",{name:n}):l("attach.saveAria",{name:n})}}function Fj({name:e,save:t,retryable:n}){const s=n?l("attach.retrySaveAria",{name:e}):l("attach.saveAria",{name:e});return r.jsx("button",{type:"button",className:"table-action","aria-label":s,title:s,disabled:t.state==="saving",onClick:()=>{t.save()},children:t.state==="saving"?r.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"}):t.state==="saved"?r.jsx(Ie,{size:14,className:"text-success","aria-hidden":"true"}):n?r.jsx(jr,{size:14,className:"text-danger","aria-hidden":"true"}):r.jsx(Ft,{size:14,"aria-hidden":"true"})})}function f5e({source:e,name:t,onError:n}){const s=p5e();if(!s)return null;const a=l("html.openInBrowser",{name:t});return r.jsx("button",{type:"button",className:"table-action","aria-label":a,title:a,onClick:()=>{n(""),s(e,t).catch(i=>n(i instanceof Error&&i.message?i.message:l("html.openFailed")))},children:r.jsx(ms,{size:14})})}function h5e({path:e,name:t,message:n}){const[s,a]=f.useState(0),[i,o]=f.useState(null),[c,d]=f.useState(null),[u,p]=f.useState(!1),[m,h]=f.useState(""),x=mg(e,t,n);return f.useEffect(()=>{const g=new AbortController;return d(null),o(null),(async()=>{try{const k=await dp(e,n,g.signal),v=await uP(k,g.signal,o5e);g.signal.aborted||o(v)}catch(k){g.signal.aborted||d(k instanceof Error&&k.message==="size"?"size":"load")}})(),()=>g.abort()},[e,n.threadId,n.messageId,s]),c?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l(c==="size"?"html.tooLarge":"html.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>a(s+1),children:l("chat.retry")})]}):i===null?r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("html.loading")]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx("button",{type:"button",className:"table-action","aria-pressed":u,"aria-label":l(u?"html.rendered":"html.source"),title:l(u?"html.rendered":"html.source"),onClick:()=>p(!u),children:u?r.jsx(Ur,{size:14}):r.jsx(ZW,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("html.reload"),title:l("html.reload"),onClick:()=>a(s+1),children:r.jsx(jr,{size:14})}),r.jsx(f5e,{source:i,name:t,onError:h}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("attach.saveAria",{name:t}),title:l("attach.saveAria",{name:t}),disabled:x.state==="saving",onClick:()=>{x.save()},children:r.jsx(Ft,{size:14})})]}),x.state==="failed"&&r.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:x.reason}),m&&r.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:m}),u?r.jsx("pre",{className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-inset p-3 text-[12px] leading-5 whitespace-pre-wrap break-words text-ink",children:i}):r.jsx(x5e,{source:i,name:t})]})}function x5e({source:e,name:t}){return r.jsx("iframe",{sandbox:"",referrerPolicy:"no-referrer",srcDoc:u5e(e),title:l("html.frameTitle",{name:t}),className:"h-[72dvh] w-full rounded-lg border border-hairline/40 bg-white"})}function qj({path:e,name:t,message:n}){return Ih(t)||Ih(e)?r.jsx(m5e,{path:e,name:t,message:n}):r.jsx(a5e,{path:e,name:t,message:n})}const MI=new Map;function mP(e,t,n=0){let s=MI.get(n);if(!s){const o=new Map;s={observer:new IntersectionObserver(d=>{for(const u of d)o.get(u.target)?.(u.isIntersecting)},n?{rootMargin:`${n}px 0px`,scrollMargin:`${n}px 0px`}:void 0),watchers:o},MI.set(n,s)}const{observer:a,watchers:i}=s;return i.set(e,t),a.observe(e),()=>{i.delete(e),a.unobserve(e)}}function g5e(e){const[t,n]=f.useState(!1);return f.useEffect(()=>{const s=e.current;if(s)return typeof IntersectionObserver>"u"?n(!0):mP(s,n)},[e]),t}const b5e=800;function y5e(e){const[t,n]=f.useState(()=>typeof IntersectionObserver>"u");return f.useEffect(()=>{const s=e.current;if(!(t||!s))return mP(s,a=>a&&n(!0),b5e)},[e,t]),t}function fP({name:e,className:t}){const n=f.useRef(null),s=g5e(n);return r.jsxs("span",{ref:n,className:I("flex items-center justify-center",s&&"animate-pulse",t),role:"status",children:[r.jsx(ye,{size:17,className:I("text-ink-tertiary",s&&"animate-spin")}),r.jsx("span",{className:"sr-only",children:l("attach.loadingName",{name:e})})]})}const hP=/^(?:\/(?!\/)|[a-zA-Z]:[\\/])/,k5e=`${jn} text-ink hover:bg-menu-hover [&>svg]:text-ink-secondary`;function xP(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.revealInFolder}async function v5e(e,t=w5e()){if(!t||!hP.test(e))return!1;try{return await t(e)==="opened"}catch{return!1}}function w5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.openFolder}function j5e(e,t=xP()){return!!t&&typeof e=="string"&&hP.test(e)}function N5e(e){return l(e==="darwin"?"attach.showInFinder":"attach.showInFolder")}async function S5e(e,t){try{const n=await t(e);return n==="shown"?"":l(n==="missing"?"attach.originalMissing":"attach.revealFailed")}catch{return l("attach.revealFailed")}}function gP(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useRef(null),a=()=>{t(null);const d=s.current;s.current=null,d?.isConnected&&d.focus()};f.useEffect(()=>{if(!e)return;n.current?.querySelector("button")?.focus();const d=u=>{u.target instanceof Node&&n.current?.contains(u.target)||t(null)};return window.addEventListener("mousedown",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("mousedown",d),window.removeEventListener("scroll",d,!0)}},[e]);const i=xP(),o=N5e(typeof window>"u"?void 0:window.ogb?.platform),c=async d=>{const u=i?await S5e(d,i):l("attach.revealFailed");if(!u&&n.current?.contains(document.activeElement))return a();t(p=>p?.source!==d?p:u?{...p,problem:u}:null)};return{targetProps:d=>j5e(d,i)?{onContextMenu:u=>{u.preventDefault(),u.stopPropagation();const p=document.activeElement;s.current=p instanceof HTMLElement&&p!==document.body?p:u.currentTarget,t({left:Math.max(8,Math.min(u.clientX,window.innerWidth-268)),top:Math.max(8,Math.min(u.clientY,window.innerHeight-110)),source:d})}}:{},menu:e&&Ke.createPortal(r.jsxs("div",{ref:n,role:"group","aria-label":o,style:{left:e.left,top:e.top},className:I("fixed z-50 w-[260px]",Jt),onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a())},children:[r.jsxs("button",{type:"button",onClick:()=>{c(e.source)},title:e.source,className:k5e,children:[r.jsx(Hr,{size:16}),o]}),e.problem&&r.jsx("p",{role:"alert",className:"px-2 pb-1 text-[13px] leading-[18px] text-danger",children:e.problem})]}),document.body)}}function bP(e,t=ls(e)){const n=V0(e);return n?{src:n,name:t,downloadUrl:n,downloadName:cp({fallback:t,source:e})}:null}function I5e(e,t,n){return n<=0?0:(e+t+n)%n}function C5e(e,t){return e==="Escape"?"close":t>1&&e==="ArrowLeft"?"previous":t>1&&e==="ArrowRight"?"next":null}const E5e={"image/avif":"avif","image/bmp":"bmp","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/tiff":"tiff","image/webp":"webp"},A5e=new Set(["avif","bmp","gif","heic","heif","jpeg","jpg","png","tif","tiff","webp"]);function jd(e){const n=((e??"").split(/[\\/]/).at(-1)??"").normalize("NFC").replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g,"").replace(/[<>:"|?*]/g,"_").trim().replace(/[. ]+$/g,""),s=Array.from(n).filter(i=>{const o=i.charCodeAt(0);return i.length>1||o<55296||o>57343}).slice(0,180).join("");if(!s)return"download";const a=s.split(".",1)[0].toUpperCase();return/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/.test(a)?`_${s}`:s}function T5e(e){if(!e)return null;const t=/(?:^|;)\s*filename\*\s*=\s*(?:UTF-8'[^']*')?([^;]*)/i.exec(e)?.[1]?.trim();if(t){const a=t.replace(/^"|"$/g,"");try{return jd(decodeURIComponent(a))}catch{}}const n=/(?:^|;)\s*filename\s*=\s*"((?:\\.|[^"\\])*)"/i.exec(e)?.[1];if(n!==void 0)return jd(n.replace(/\\(.)/g,"$1"));const s=/(?:^|;)\s*filename\s*=\s*([^;]*)/i.exec(e)?.[1]?.trim();return s?jd(s):null}function _5e(e){if(!e)return null;let t=e;try{t=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname)}catch{t=e.split(/[?#]/,1)[0]??e}const n=/\.([a-z0-9]+)$/i.exec(t)?.[1]?.toLowerCase();return n&&A5e.has(n)?n:null}function M5e(e,t){const n=`.${t}`,s=e.replace(/\.[^.]*$/,"")||"image",a=Math.max(1,180-Array.from(n).length);return`${Array.from(s).slice(0,a).join("")}${n}`}function cp({contentDisposition:e,fallback:t,source:n,mime:s}){const a=T5e(e??null)??jd(t),i=s?.split(";",1)[0]?.trim().toLowerCase()??"",o=E5e[i]??_5e(n);return o?M5e(a,o):a}function R5e(e){const n=e.trim().replace(/[\t\n\r]/g,"").replace(/\\/g,"/");return n.startsWith("//")||/^https?:/i.test(n)}function O5e(e,t){return`/api/threads/${encodeURIComponent(e.threadId)}/messages/${encodeURIComponent(e.messageId)}/file?preview=1&ref=${t}`}async function z5e(e){try{const t=await fetch(e,{cache:"no-store"});return t.ok?(await t.body?.cancel(),!1):(await t.json().catch(()=>null))?.code==="outside_workspace"}catch{return!1}}function L5e(e){setTimeout(()=>URL.revokeObjectURL(e),0)}async function dp(e,t,n,s){const a=await fetch(`/api/threads/${encodeURIComponent(t.threadId)}/messages/${encodeURIComponent(t.messageId)}/file`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,...s?.entry!==void 0?{entry:s.entry}:s?.list?{listFolder:!0}:{}}),signal:n});if(!a.ok){const i=await a.json().catch(()=>null);throw Object.assign(new Error(Al(i,i?.error??l("attach.downloadFailed"))),{code:i?.code})}return a}function mg(e,t,n,s){const[a,i]=f.useState("idle"),[o,c]=f.useState(null),[d,u]=f.useState(""),[p,m]=f.useState(""),[h,x]=f.useState(void 0),g=f.useRef(null),k=f.useRef(null),v=f.useRef(!1),y=f.useRef(!0);f.useEffect(()=>(y.current=!0,()=>{y.current=!1,k.current?.abort(),g.current&&clearTimeout(g.current)}),[]),f.useEffect(()=>{k.current?.abort(),k.current=null,v.current=!1,u(""),m(""),x(void 0),c(null),i("idle")},[e,s,n?.messageId,n?.threadId]);const b=f.useCallback(async()=>{if(v.current)return;if(!n){u(l("attach.unavailableOld")),i("failed");return}v.current=!0,g.current&&(clearTimeout(g.current),g.current=null),u(""),x(void 0),i("saving"),k.current?.abort();const j=new AbortController;k.current=j;try{const S=await dp(e,n,j.signal,s===void 0?{list:!0}:{entry:s});if(S.headers.get("x-openmausbot-folder")==="1"){const N=await S.json();if(!y.current||j.signal.aborted)return;i("idle"),!await v5e(e)&&!j.signal.aborted&&c(N);return}const E=await S.blob();if(!y.current||j.signal.aborted)return;const A=URL.createObjectURL(E),_=cp({contentDisposition:S.headers.get("content-disposition"),fallback:t||s||ls(e),source:e,mime:E.type||S.headers.get("content-type")});try{const N=document.createElement("a");N.href=A,N.download=_,N.style.display="none",document.body.append(N);try{N.click()}finally{N.remove()}}finally{L5e(A)}if(!y.current||j.signal.aborted)return;m(_),i("saved"),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{y.current&&i("idle")},4e3)}catch(S){if(!y.current||j.signal.aborted)return;u(S instanceof Error?S.message:l("attach.saveFailed")),x(S?.code),i("failed")}finally{k.current===j&&(k.current=null,v.current=!1)}},[e,s,n?.messageId,n?.threadId,t]),w=h==="outside_workspace";return{state:a,reason:d,savedTo:p,outsideWorkspace:w,retryable:a==="failed"&&!w&&h!=="file_too_large",folder:o,save:b}}function Uj(e){return e.outsideWorkspace?l("attach.outsideWorkspace"):e.reason}function P5e(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/(1024*102.4))/10} MB`}function D5e({folderPath:e,name:t,bytes:n,message:s}){const a=mg(e,t,s,t);return r.jsxs("li",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5",children:[r.jsxs("button",{type:"button",onClick:()=>{a.save()},disabled:a.state==="saving","aria-label":l("attach.saveAria",{name:t}),className:"inline-flex min-h-8 min-w-0 items-center gap-1 break-all text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[a.state==="saving"?r.jsx(ye,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):a.state==="saved"?r.jsx(Ie,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):r.jsx(no,{size:12,className:"shrink-0","aria-hidden":"true"}),t]}),r.jsx("span",{className:"text-ink-secondary",children:P5e(n)}),a.state==="failed"&&r.jsx("span",{role:"alert",className:"text-danger",children:a.reason})]})}function $5e({folderPath:e,listing:t,message:n}){return r.jsxs("span",{dir:"ltr",className:"block w-full text-[12px] [unicode-bidi:isolate]",children:[t.entries.length===0?r.jsx("span",{className:"text-ink-secondary",children:l("attach.folderEmpty")}):r.jsx("ul",{"aria-label":l("attach.folderFilesAria",{name:t.name}),className:"flex flex-col gap-0.5 ps-1",children:t.entries.map(s=>r.jsx(D5e,{folderPath:e,name:s.name,bytes:s.bytes,message:n},s.name))}),t.truncated&&r.jsx("span",{className:"text-ink-secondary",children:l("attach.folderTruncated")})]})}const B5e=/^(?:\/(?!\/)|[a-zA-Z]:[\\/])/;function F5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.revealInFolder}function Hj({filePath:e}){const[t,n]=f.useState(""),s=F5e();if(!s||!B5e.test(e))return r.jsx("code",{title:l("attach.outsideWorkspacePath"),className:"select-all break-all text-ink",children:e});const a=async()=>{n("");try{const i=await s(e);i==="missing"?n(l("attach.revealMissing")):i!=="shown"&&n(l("attach.revealFailed"))}catch{n(l("attach.revealFailed"))}};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>{a()},title:e,className:"inline-flex items-center gap-1 text-accent underline decoration-accent/40 hover:decoration-accent",children:[r.jsx(Hr,{size:12,className:"shrink-0","aria-hidden":"true"}),l("attach.showInFolder")]}),t&&r.jsx("span",{role:"alert",className:"text-danger",children:t})]})}function fg({image:e,images:t,initialIndex:n=0,onClose:s}){const a=t?.length?t:[e],[i,o]=f.useState(()=>Math.min(Math.max(n,0),a.length-1)),c=a[i]??e,d=f.useRef(null),u=f.useRef(s),[p,m]=f.useState(()=>new Set),[h,x]=f.useState(null),[g,k]=f.useState(0);f.useLayoutEffect(()=>{u.current=s},[s]);const v=f.useCallback(j=>{o(S=>I5e(S,j,a.length)),x(null)},[a.length]);f.useEffect(()=>{const j=document.activeElement instanceof HTMLElement?document.activeElement:null;d.current?.focus();const S=E=>{const A=C5e(E.key,a.length);if(A){E.preventDefault(),E.stopPropagation(),A==="close"?u.current():v(A==="previous"?-1:1);return}if(E.key!=="Tab")return;const _=d.current;if(!_)return;const N=[..._.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(N.length===0){E.preventDefault(),_.focus();return}const C=N[0],R=N[N.length-1];E.shiftKey&&(document.activeElement===_||document.activeElement===C)?(E.preventDefault(),R.focus()):!E.shiftKey&&document.activeElement===R&&(E.preventDefault(),C.focus())};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),j?.focus()}},[a.length,v]);const y=p.has(c.src),b=h===c.src,w=()=>{x(null),m(j=>{const S=new Set(j);return S.delete(c.src),S}),k(j=>j+1)};return Ke.createPortal(r.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/80 p-3 backdrop-blur-sm sm:p-6",onMouseDown:j=>j.target===j.currentTarget&&s(),children:r.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-label":l("attach.previewAria",{name:c.name}),tabIndex:-1,className:"animate-pop-in flex h-full max-h-[900px] w-full max-w-[1200px] flex-col overflow-hidden rounded-2xl border border-white/15 bg-black/70 shadow-2xl outline-none",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-white/10 bg-black/45 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:c.name}),r.jsx("div",{className:"text-[11px] text-white/50",children:a.length>1?l("attach.position",{index:i+1,count:a.length}):l("attach.imagePreview")})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c.downloadUrl&&r.jsx("a",{href:c.downloadUrl,download:c.downloadName??cp({fallback:c.name,source:c.downloadUrl}),className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.downloadAria",{name:c.name}),title:l("attach.download"),children:r.jsx(Ft,{size:17})}),c.openUrl&&r.jsx("a",{href:c.openUrl,target:"_blank",rel:"noreferrer",className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.openOriginalAria",{name:c.name}),title:l("attach.openOriginal"),children:r.jsx(ms,{size:17})}),r.jsx("button",{onClick:s,className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.close"),children:r.jsx(Ae,{size:19})})]})]}),r.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4 sm:p-8",children:[!y&&!b&&r.jsx("div",{className:"absolute inset-4 flex animate-pulse items-center justify-center rounded-xl bg-white/[0.055] sm:inset-8",role:"status",children:r.jsxs("span",{className:"flex items-center gap-2 text-[13px] text-white/55",children:[r.jsx(ye,{size:17,className:"animate-spin"})," ",l("attach.imageLoading")]})}),b?r.jsxs("div",{className:"flex flex-col items-center gap-3 text-white/60",role:"alert",children:[r.jsx(zd,{size:34}),r.jsx("span",{className:"text-[13px]",children:l("attach.imageFailed")}),r.jsxs("button",{type:"button",onClick:w,className:"flex items-center gap-1.5 rounded-lg border border-white/15 bg-white/10 px-3 py-1.5 text-[12px] text-white hover:bg-white/15",children:[r.jsx(jr,{size:13})," ",l("chat.retry")]})]}):r.jsx("img",{src:c.src,alt:c.name,onLoad:()=>m(j=>new Set(j).add(c.src)),onError:()=>x(c.src),className:I("block max-h-full max-w-full rounded-lg object-contain shadow-2xl transition-opacity duration-150",y?"opacity-100":"opacity-0")},`${c.src}:${g}`),a.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>v(-1),"aria-label":l("attach.previous"),className:"absolute left-2 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/80 backdrop-blur-sm hover:bg-black/75 hover:text-white sm:left-4",children:r.jsx(da,{size:21})}),r.jsx("button",{type:"button",onClick:()=>v(1),"aria-label":l("attach.next"),className:"absolute right-2 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/80 backdrop-blur-sm hover:bg-black/75 hover:text-white sm:right-4",children:r.jsx(at,{size:21})})]})]})]})}),document.body)}function zk({image:e,onPreview:t,className:n,eager:s=!1,explainRefusal:a=!1}){const[i,o]=f.useState("loading"),[c,d]=f.useState(0),[u,p]=f.useState(!1),[m,h]=f.useState(null);return r.jsxs("span",{style:m?{aspectRatio:String(m)}:void 0,className:I("group/image relative block aspect-[4/3] min-w-0 overflow-hidden rounded-xl border border-hairline/40 bg-inset",n),children:[i==="loading"&&r.jsx(fP,{name:e.name,className:"absolute inset-0 bg-raised/65"}),i==="failed"?r.jsxs("span",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-3 text-center text-ink-secondary",role:"alert",children:[r.jsx(zd,{size:22}),u?r.jsx("span",{className:"max-w-full text-[12px]",children:l("attach.imageOutsideWorkspace")}):r.jsx("span",{className:"max-w-full truncate text-[12px]",children:l("attach.imageUnavailable")}),!u&&r.jsxs("span",{role:"button",tabIndex:0,onClick:x=>{x.preventDefault(),x.stopPropagation(),o("loading"),d(g=>g+1)},onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),x.stopPropagation(),o("loading"),d(g=>g+1))},className:"flex items-center gap-1 rounded-md border border-hairline/50 bg-panel px-2 py-1 text-[11px] text-ink hover:bg-raised","aria-label":l("attach.retryAria",{name:e.name}),children:[r.jsx(jr,{size:11})," ",l("chat.retry")]})]}):r.jsxs("span",{role:"button",tabIndex:i==="ready"?0:-1,"aria-disabled":i!=="ready",onClick:x=>{x.preventDefault(),x.stopPropagation(),i==="ready"&&t()},onKeyDown:x=>{i==="ready"&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),t())},className:"absolute inset-0 block size-full cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60 aria-disabled:cursor-default","aria-label":l("attach.previewImageAria",{name:e.name}),title:l("attach.previewAria",{name:e.name}),children:[r.jsx("img",{src:e.src,alt:e.name,loading:s?"eager":"lazy",fetchPriority:s?"high":void 0,onLoad:x=>{const{naturalWidth:g,naturalHeight:k}=x.currentTarget;g>0&&k>0&&h(Math.min(Math.max(g/k,.6),2.4)),o("ready")},onError:()=>{o("failed"),a&&z5e(e.src).then(p)},className:I("block size-full object-cover transition duration-200 group-hover/image:scale-[1.015]",i==="ready"?"opacity-100":"opacity-0")},`${e.src}:${c}`),r.jsx("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-black/55 text-white opacity-0 backdrop-blur-sm transition-opacity group-hover/image:opacity-100 group-focus-within/image:opacity-100",children:r.jsx(Dd,{size:13})})]})]})}function q5e({src:e,name:t,openUrl:n,message:s,filePath:a,sourceOffset:i}){const[o,c]=f.useState(!1),d=f.useRef(null),u=s?.threadId,p=s?.messageId,m=typeof i=="number"&&Number.isSafeInteger(i)&&i>=0?i:null,h=!!(a&&u&&p&&m!==null),x=h?`${u}\0${p}\0${m}`:null,[g,k]=f.useState(null),v=!a&&R5e(e),[y,b]=f.useState(null);f.useEffect(()=>{if(!x)return;const A=d.current;if(!A||typeof IntersectionObserver>"u"){k(x);return}k(null);const _=new IntersectionObserver(([N])=>{N?.isIntersecting&&(k(x),_.disconnect())},{rootMargin:"320px 0px"});return _.observe(A),()=>_.disconnect()},[x]);const w=h&&(g===x||o),j=!v||y===e,S=j?h?w&&a&&u&&p&&m!==null?O5e({threadId:u,messageId:p},m):null:e:null,E={src:S??"",name:t,openUrl:n,downloadUrl:h?S??void 0:void 0,downloadName:h?cp({fallback:t,source:a}):void 0};return r.jsxs(r.Fragment,{children:[r.jsxs("span",{ref:d,className:"my-2 block w-[min(36rem,70vw)] max-w-full",children:[v&&!j?r.jsxs("span",{className:"flex aspect-[4/3] max-h-96 flex-col items-center justify-center gap-2 rounded-xl border border-hairline/40 bg-inset px-4 text-center text-[12px] text-ink-secondary",children:[r.jsx(zd,{size:20}),r.jsx("span",{children:l("attach.externalHidden")}),r.jsx("button",{type:"button",className:"rounded-md border border-hairline/50 bg-panel px-2.5 py-1 text-ink hover:bg-raised",onClick:A=>{A.preventDefault(),A.stopPropagation(),b(e)},children:l("attach.loadImage")})]}):a&&(!u||!p||m===null)?r.jsxs("span",{className:"flex aspect-[4/3] max-h-96 items-center justify-center gap-2 rounded-xl border border-hairline/40 bg-inset text-[12px] text-ink-secondary",role:"alert",children:[r.jsx(zd,{size:17})," ",l("attach.oldImage")]}):S?r.jsx(zk,{image:E,onPreview:()=>c(!0),className:"max-h-96",eager:!0,explainRefusal:h},E.src):r.jsx(fP,{name:t,className:"aspect-[4/3] max-h-96 rounded-xl border border-hairline/40 bg-inset"}),n&&r.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex text-[11px] text-accent hover:underline",children:l("attach.openOriginal")})]}),o&&S&&r.jsx(fg,{image:E,onClose:()=>c(!1)})]})}function Lk({file:e,message:t,linked:n=!1,compact:s=!1,className:a}){const i=mg(e.path,e.name,t),o=Bj(e.path,e.name,t),c=i.state==="failed";return s?r.jsx(U5e,{file:e,message:t,linked:n,save:i,preview:o,className:a}):!t||!e.private&&!n?r.jsxs("div",{title:l("attach.legacyFile",{name:e.name}),className:I("flex max-w-[280px] items-center gap-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 px-2.5 py-2 text-[12px] text-ink-secondary",a),children:[r.jsx(no,{size:14,className:"shrink-0","aria-hidden":"true"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:e.name}),r.jsx("span",{className:"text-[11px]",children:l("attach.unavailable")})]}):r.jsxs("div",{title:i.state==="saved"&&i.savedTo?l("attach.savedTo",{path:i.savedTo}):e.name,className:I("max-w-[280px] overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 text-[12px] text-ink-secondary",a),children:[r.jsxs("div",{className:"flex items-center pe-1",children:[r.jsxs("button",{type:"button",...pP(o,i,e.name,i.retryable),className:"flex min-h-10 min-w-0 flex-1 items-center gap-2 px-2.5 py-2 text-left transition-colors hover:bg-raised/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60 disabled:cursor-wait disabled:hover:bg-transparent",children:[r.jsx(no,{size:14,className:"shrink-0","aria-hidden":"true"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:e.name}),o.opens?r.jsx(Ur,{size:13,className:"shrink-0"}):i.state==="saving"?r.jsx(ye,{size:13,className:"shrink-0 animate-spin"}):i.state==="saved"?r.jsx(Ie,{size:13,className:"shrink-0 text-success"}):c?i.retryable&&r.jsx(jr,{size:13,className:"shrink-0 text-danger"}):r.jsx(Ft,{size:13,className:"shrink-0"})]}),o.opens?r.jsx(Fj,{name:e.name,save:i,retryable:i.retryable}):r.jsx(qj,{path:e.path,name:e.name,message:t}),o.dialog]}),i.state!=="idle"&&r.jsxs("div",{role:c?"alert":"status",className:I("border-t border-hairline/30 px-2.5 py-1.5 text-[11px]",c?"text-danger":i.state==="saved"?"text-success":"text-ink-secondary"),children:[i.state==="saving"?l("attach.downloading"):i.state==="saved"?l("attach.downloaded"):Uj(i),c&&i.outsideWorkspace&&r.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5",children:r.jsx(Hj,{filePath:e.path})})]})]})}const RI="inline-flex h-7 max-w-[16rem] items-center rounded-full bg-ink/[0.06] text-[13px] leading-none text-ink-secondary";function U5e({file:e,message:t,linked:n,save:s,preview:a,className:i}){const o=s.state==="failed",c=r.jsx("span",{dir:"auto",className:"min-w-0 truncate text-ink [unicode-bidi:isolate]",children:e.name});return!t||!e.private&&!n?r.jsxs("span",{title:l("attach.legacyFile",{name:e.name}),className:I(RI,"gap-1.5 px-2.5",i),children:[r.jsx(no,{size:14,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}),c,r.jsx("span",{className:"shrink-0 text-[12px]",children:l("attach.unavailable")})]}):r.jsxs("span",{className:"inline-flex max-w-full flex-col items-start gap-1",children:[r.jsxs("span",{title:s.state==="saved"&&s.savedTo?l("attach.savedTo",{path:s.savedTo}):e.name,className:I(RI,"file-chip pe-0.5",i),children:[r.jsxs("button",{type:"button",...pP(a,s,e.name,s.retryable),className:"inline-flex h-7 min-w-0 items-center gap-1.5 rounded-full ps-2.5 pe-2 transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:cursor-wait",children:[r.jsx(no,{size:14,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}),c,a.opens?r.jsx(Ur,{size:13,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}):s.state==="saving"?r.jsx(ye,{size:13,className:"shrink-0 animate-spin","aria-hidden":"true"}):s.state==="saved"?r.jsx(Ie,{size:13,className:"shrink-0 text-success","aria-hidden":"true"}):o?s.retryable&&r.jsx(jr,{size:13,className:"shrink-0 text-danger","aria-hidden":"true"}):r.jsx(Ft,{size:13,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"})]}),a.opens?r.jsx(Fj,{name:e.name,save:s,retryable:s.retryable}):r.jsx(qj,{path:e.path,name:e.name,message:t}),a.dialog]}),s.state!=="idle"&&s.state!=="saved"&&r.jsxs("span",{role:o?"alert":"status",className:I("px-2.5 text-[12px]",o?"text-danger":"text-ink-secondary"),children:[s.state==="saving"?l("attach.downloading"):Uj(s),o&&s.outsideWorkspace&&r.jsx("span",{className:"ms-1.5 inline-flex flex-wrap items-center gap-x-1.5",children:r.jsx(Hj,{filePath:e.path})})]}),s.state==="saved"&&r.jsx("span",{role:"status",className:"sr-only",children:l("attach.downloaded")})]})}const zc=e=>f.Children.toArray(e).filter(f.isValidElement);function Pk(e){if(typeof e=="string"||typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Pk).join("");if(!f.isValidElement(e))return"";const t=e;return t.type==="br"?`
184
- `:Pk(t.props.children)||t.props.alt||""}function H5e({children:e,direction:t}){const n=f.useMemo(()=>{const s=zc(e),a=s.find(u=>u.type==="thead"),i=s.find(u=>u.type==="tbody"),o=u=>({text:Pk(u.props.children),content:u.props.children}),c=zc(zc(a?.props.children)[0]?.props.children).map(u=>({...o(u),align:u.props.align==="left"||u.props.align==="right"||u.props.align==="center"?u.props.align:void 0})),d=zc(i?.props.children).map(u=>zc(u.props.children).map(o));return{columns:c,rows:d}},[e]);return r.jsx($j,{...n,direction:t})}const _i=new Map,W5e=200,OI=4*1024*1024;function K5e(e,t){if(t.length>OI)return;_i.set(e,t);let n=0;for(const s of _i.values())n+=s.length;for(const[s,a]of _i){if(_i.size<=W5e&&n<=OI)break;_i.delete(s),n-=a.length}}const yP=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},V5e="github-light-default",G5e="github-dark-default",kP={javascript:()=>_e(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>_e(()=>import("./jsx-g9-lgVsj.js"),[]),typescript:()=>_e(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>_e(()=>import("./tsx-COt5Ahok.js"),[]),json:()=>_e(()=>import("./json-Cp-IABpG.js"),[]),jsonc:()=>_e(()=>import("./jsonc-Des-eS-w.js"),[]),json5:()=>_e(()=>import("./json5-C9tS-k6U.js"),[]),bash:()=>_e(()=>import("./bash-Yzrsuije.js"),[]),powershell:()=>_e(()=>import("./powershell-BmBUJMz7.js"),[]),fish:()=>_e(()=>import("./fish-BvzEVeQv.js"),[]),python:()=>_e(()=>import("./python-B6aJPvgy.js"),[]),html:()=>_e(()=>import("./html-pp8916En.js"),__vite__mapDeps([52,53,54])),css:()=>_e(()=>import("./css-CLj8gQPS.js"),[]),scss:()=>_e(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([55,54])),sass:()=>_e(()=>import("./sass-Cj5Yp3dK.js"),[]),less:()=>_e(()=>import("./less-B1dDrJ26.js"),[]),markdown:()=>_e(()=>import("./markdown-Cvjx9yec.js"),[]),mdx:()=>_e(()=>import("./mdx-Cmh6b_Ma.js"),[]),yaml:()=>_e(()=>import("./yaml-Buea-lGh.js"),[]),toml:()=>_e(()=>import("./toml-vGWfd6FD.js"),[]),xml:()=>_e(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([56,57])),c:()=>_e(()=>import("./c-BIGW1oBm.js"),[]),cpp:()=>_e(()=>import("./cpp-DddhVWhK.js"),__vite__mapDeps([58,59])),csharp:()=>_e(()=>import("./csharp-DSvCPggb.js"),[]),rust:()=>_e(()=>import("./rust-B1yitclQ.js"),[]),go:()=>_e(()=>import("./go-C27-OAKa.js"),[]),ruby:()=>_e(()=>import("./ruby-Ct1eTYOr.js"),__vite__mapDeps([60,52,53,54,56,57,61,62,63,64,65,58,59,66,67,68])),php:()=>_e(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([69,52,53,54,56,57,61,70])),java:()=>_e(()=>import("./java-CylS5w8V.js"),[]),kotlin:()=>_e(()=>import("./kotlin-BdnUsdx6.js"),[]),swift:()=>_e(()=>import("./swift-C2oV4EkX.js"),[]),dart:()=>_e(()=>import("./dart-bE4Kk8sk.js"),[]),r:()=>_e(()=>import("./r-Cf5RLm7j.js"),[]),lua:()=>_e(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([67,59])),sql:()=>_e(()=>import("./sql-CRqJ_cUM.js"),[]),graphql:()=>_e(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([62,53,63,64,65])),proto:()=>_e(()=>import("./proto-C7zT0LnQ.js"),[]),dockerfile:()=>_e(()=>import("./dockerfile-BcOcwvcX.js"),[]),makefile:()=>_e(()=>import("./makefile-CHLpvVh8.js"),[]),diff:()=>_e(()=>import("./diff-D97Zzqfu.js"),[]),wasm:()=>_e(()=>import("./wasm-MzD3tlZU.js"),[])},Y5e={js:"javascript",node:"javascript",ts:"typescript",sh:"bash",zsh:"bash",shell:"bash",ps1:"powershell",py:"python",htm:"html",yml:"yaml",md:"markdown",svg:"xml","c++":"cpp",cc:"cpp",cxx:"cpp",cs:"csharp","c#":"csharp",rs:"rust",golang:"go",rb:"ruby",kt:"kotlin",gql:"graphql",protobuf:"proto",docker:"dockerfile",make:"makefile"},J5e=new Set(["","text","txt","plaintext","plain"]);let lm;const yb=new Map;function Z5e(e){const t=Y5e[e];return t||(Object.prototype.hasOwnProperty.call(kP,e)?e:void 0)}function X5e(){if(lm)return lm;const e=(async()=>{const{createHighlighterCore:t}=await _e(async()=>{const{createHighlighterCore:s}=await import("./core-DgU9fIH7.js");return{createHighlighterCore:s}},__vite__mapDeps([71,1,2,10,3,4,8])),{createJavaScriptRegexEngine:n}=await _e(async()=>{const{createJavaScriptRegexEngine:s}=await import("./engine-javascript-D5Xfc425.js");return{createJavaScriptRegexEngine:s}},[]);return t({themes:[_e(()=>import("./github-light-default-D7oLnXFd.js"),[]).then(s=>s.default),_e(()=>import("./github-dark-default-Cuk6v7N8.js"),[]).then(s=>s.default)],langs:[],engine:n()})})().catch(t=>{throw lm=void 0,t});return lm=e,e}function Q5e(e,t){const n=yb.get(t);if(n)return n;const s=kP[t]().then(a=>e.loadLanguage(a.default)).catch(a=>{throw yb.delete(t),a});return yb.set(t,s),s}async function e4e(e,t){const n=await X5e(),s=t.trim().toLowerCase(),a=J5e.has(s),i=a?void 0:Z5e(s);if(!a&&!i)throw new Error(`No bundled grammar for ${s}`);return i&&await Q5e(n,i),n.codeToHtml(e,{lang:i??"text",themes:{light:V5e,dark:G5e},defaultColor:"light-dark()"})}const zI=(e,t)=>`${e}:${yP(t)}`,t4e=1e5,LI="inline-flex size-7 touch:size-11 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60";function vP({copied:e,onCopy:t,copyLabel:n,items:s}){return r.jsxs("div",{"data-code-plate":!0,className:"absolute end-1 top-1 z-[1] flex gap-0.5 rounded-full bg-composer p-0.5 opacity-0 ring-[0.5px] ring-ink/10 transition-opacity focus-within:opacity-100 group-hover/code:opacity-100 touch:opacity-100 has-[[aria-expanded=true]]:opacity-100",children:[r.jsx("button",{type:"button",onClick:t,className:LI,title:e==="copied"?l("code.copiedTitle"):e==="failed"?l("common.copyFailed"):n,"aria-label":e==="copied"?l("code.copiedTitle"):e==="failed"?l("common.copyFailed"):n,children:e==="failed"?r.jsx(Ae,{size:14,className:"text-danger","aria-hidden":"true"}):e==="copied"?r.jsx(Ie,{size:14,className:"text-success","aria-hidden":"true"}):r.jsx(fn,{size:14,"aria-hidden":"true"})}),e!=="idle"&&r.jsx("span",{role:"status",className:"sr-only",children:e==="failed"?l("common.copyFailed"):l("code.copiedTitle")}),r.jsx(Ps,{items:s,ariaLabel:l("chat.more"),placement:"above",align:"end",triggerTitle:l("chat.more"),triggerClassName:"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60",renderTrigger:()=>r.jsx("span",{className:LI,children:r.jsx(fs,{size:14,"aria-hidden":"true"})})})]})}function n4e({code:e,lang:t,initialWrap:n=!1}){const s=!et(),a=f.useRef(null),i=y5e(a),o=e.length<=t4e,[c,d]=f.useState(()=>o&&i?_i.get(zI(t,e))??null:null),u=f.useMemo(()=>c?{__html:c}:null,[c]),{state:p,copy:m}=ba(e),[h,x]=f.useState(n);f.useEffect(()=>{x(n)},[n]),f.useEffect(()=>{if(!o)return d(null);if(!i)return;const b=zI(t,e),w=_i.get(b);if(w)return d(w);let j=!0;return e4e(e,t||"text").then(S=>{j&&(K5e(b,S),d(S))}).catch(()=>{}),()=>{j=!1}},[e,t,o,i]);const g=()=>{const b=C3e(t);E3e(b,e)},k=N3e(t),v=S3e(e),y=(b,w)=>u?r.jsx("div",{className:I(`text-[13px] [&_pre]:!bg-transparent [&_pre]:m-0 ${b}`,h?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"),dangerouslySetInnerHTML:u}):r.jsx("pre",{className:I(`text-[13px] ${b.replaceAll("[&_pre]:","")}`,w,h?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"),children:e});return s?r.jsxs("div",{ref:a,dir:"ltr",className:"chat-code-block group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]",children:[r.jsx(vP,{copied:p,onCopy:m,copyLabel:l("code.copyTitle"),items:[{key:"wrap",label:l("code.wrapLines"),icon:r.jsx(Bd,{size:14,"aria-hidden":"true"}),active:h,onSelect:()=>x(b=>!b)},{key:"save",label:l("code.saveAsFile"),icon:r.jsx(Ft,{size:14,"aria-hidden":"true"}),onSelect:g},{key:"about",label:l("code.caption",{language:k,lines:hI(v)}),disabled:!0,separatorBefore:!0,onSelect:()=>{}}]}),y("leading-5 [&_pre]:px-3 [&_pre]:py-2","text-ink-secondary")]}):r.jsxs("div",{ref:a,dir:"ltr",className:"chat-code-block my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r.jsx("span",{title:k,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:k}),v>0&&r.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:hI(v)})]}),r.jsxs("div",{className:"chat-code-actions flex shrink-0 items-center gap-1 whitespace-nowrap",children:[r.jsxs("button",{type:"button",onClick:()=>x(b=>!b),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${h?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:h?l("code.unwrapLong"):l("code.wrapLong"),"aria-label":h?l("code.unwrapLong"):l("code.wrapLong"),"aria-pressed":h,children:[r.jsx(Bd,{size:12,"aria-hidden":"true"}),r.jsx("span",{children:h?l("code.unwrap"):l("code.wrap")})]}),r.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:l("code.saveTitle"),"aria-label":l("code.saveTitle"),children:[r.jsx(Ft,{size:12,"aria-hidden":"true"}),r.jsx("span",{children:l("code.save")})]}),r.jsxs("button",{type:"button",onClick:m,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:p==="copied"?l("code.copiedTitle"):p==="failed"?l("common.copyFailed"):l("code.copyTitle"),"aria-label":p==="copied"?l("code.copiedAria"):p==="failed"?l("common.copyFailed"):l("code.copyAria"),children:[p==="failed"?r.jsx(Ae,{size:12,className:"text-danger","aria-hidden":"true"}):p==="copied"?r.jsx(Ie,{size:12,className:"text-success","aria-hidden":"true"}):r.jsx(fn,{size:12,"aria-hidden":"true"}),r.jsx("span",{"aria-hidden":"true",className:"hidden max-sm:inline touch:inline",children:l("code.copy")}),r.jsx("span",{role:"status",className:`max-sm:sr-only touch:sr-only ${p==="failed"?"text-danger font-medium":p==="copied"?"text-success font-medium":""}`,children:p==="failed"?l("common.copyFailed"):p==="copied"?l("code.copied"):l("code.copy")})]})]})]}),y("leading-relaxed [&_pre]:p-3","text-ink")]})}const $o=new Map,s4e=50;let PI=0;const DI=(e,t)=>`${e}:${yP(t)}`,wP=/^[a-zA-Z]:[\\/]/,$I=e=>e.startsWith("/")||wP.test(e)?e:null,up=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const n=new URL(e);if(n.username||n.password||n.port||n.search||n.hash)return null;const s=decodeURIComponent(n.pathname);return n.hostname&&n.hostname!=="localhost"?`//${n.hostname}${s}`:/^\/[a-z]:[\\/]/i.test(s)?s.slice(1):$I(s)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=$I(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function r4e(e,t="href"){if(j9(e)||rP(e))return e;const n=/^(?:[a-zA-Z]:%5C|%5C%5C)/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(n)||wP.test(n)||n.startsWith("\\\\")?up(n)?n:"":t==="href"&&/^obsidian:\/\//i.test(e)?e:AL(e)}function a4e(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(Lj)}function i4e(){return(e,t)=>{typeof t.value=="string"&&G3e(e,t.value)}}const Dk={},jP={singleTilde:!1};eP.call({data:()=>Dk},jP);const o4e={extensions:Dk.micromarkExtensions,mdastExtensions:[...Dk.fromMarkdownExtensions??[],Lj]};function l4e(){return e=>{const t=n=>{n.children&&(n.children=n.children.flatMap(s=>s?.type!=="text"||!s.value.includes(`
183
+ `,escapeFormulae:Yje})}const Zje=4,Xje=12,Qje=7.5,e5e=100;function t5e(e,t){return e.map((n,s)=>{let a=0;for(const i of[n,...t.slice(0,e5e).map(o=>o[s]??"")])for(const o of i.split(/\s+/))a=Math.max(a,[...o].length);return Math.round(Math.min(Xje,Math.max(Zje,a))*Qje)})}const n5e=24;function s5e({wrap:e,virtual:t,minimums:n=[],available:s=null}){return!e||t?!1:s===null||n.reduce((a,i)=>a+i+n5e,0)<=s}function Dj({title:e,onClose:t,children:n,returnFocus:s}){const a=f.useRef(null),i=f.useId();return f.useEffect(()=>{const o=a.current;return o.showModal(),()=>{o.close(),s?.isConnected&&s.focus()}},[s]),Ke.createPortal(r.jsxs("dialog",{ref:a,"aria-labelledby":i,onCancel:t,onClose:t,onKeyDown:o=>{o.key==="Escape"&&o.stopPropagation()},className:"m-auto flex max-h-[94dvh] w-[min(96vw,1400px)] max-w-none flex-col overflow-hidden rounded-2xl border border-hairline bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/55",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-hairline/40 px-4 py-3",children:[r.jsx("h2",{id:i,className:"min-w-0 truncate text-sm font-medium",children:e}),r.jsx("button",{type:"button",autoFocus:!0,onClick:t,className:"table-action","aria-label":l("table.close"),children:r.jsx(Ae,{size:16})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-3 sm:p-5",children:n})]}),document.body)}const AI=8,r5e="group/table relative w-fit min-w-[min(100%,20rem)] max-w-full overflow-hidden rounded-[18px] bg-card text-ink touch:pt-11";function $j({columns:e,rows:t,name:n=l("table.title"),expanded:s=!1,direction:a="ltr",headless:i=!1,card:o=!0}){const c=!et(),[d,u]=f.useState(""),p=f.useDeferredValue(d),[m,h]=f.useState(null),[x,g]=f.useState(!0),[k,v]=f.useState(!1),y=f.useRef(null),[b,w]=f.useState("idle"),j=f.useMemo(()=>t.map(L=>L.map(P=>P.text)),[t]),S=f.useMemo(()=>Gje(j,p,m),[j,p,m]);f.useEffect(()=>{if(b==="idle")return;const L=setTimeout(()=>w("idle"),2500);return()=>clearTimeout(L)},[b]);const E=()=>Jje(e.map(L=>L.text),S.map(L=>j[L])),A=async()=>{const L=await Vs(E());L!=="empty"&&w(L)},_=()=>{const L=URL.createObjectURL(new Blob(["\uFEFF",E()],{type:"text/csv;charset=utf-8"})),P=document.createElement("a");P.href=L,P.download=`${n.replace(/\.(csv|tsv)$/i,"").replace(/[\\/:*?"<>|]/g,"_").slice(0,150)||"table"}.csv`,P.click(),setTimeout(()=>URL.revokeObjectURL(L),1e3)},N=b!=="idle"&&r.jsx("span",{role:b==="failed"?"alert":"status",className:"sr-only",children:l(b==="failed"?"table.copyFailed":"table.copied")}),C=L=>r.jsxs("label",{className:L,children:[r.jsx(Cn,{size:13,"aria-hidden":"true"}),r.jsx("input",{value:d,onChange:P=>u(P.target.value),"aria-label":l("table.search"),placeholder:l("table.search"),className:"w-full min-w-0 bg-transparent py-1 text-xs text-ink outline-none placeholder:text-ink-tertiary focus-visible:ring-1 focus-visible:ring-accent"})]}),R=L=>h(m?.column!==L?{column:L,descending:!1}:m.descending?null:{column:L,descending:!0}),O=()=>r.jsxs("div",{"data-table-card":!0,className:r5e,dir:"ltr",children:[r.jsxs("div",{className:"table-plate absolute end-1.5 top-1.5 z-20 flex items-center gap-0.5 rounded-full bg-composer p-0.5 opacity-0 ring-[0.5px] ring-ink/10 transition-opacity focus-within:opacity-100 group-hover/table:opacity-100 touch:end-1 touch:top-0 touch:bg-transparent touch:p-0 touch:opacity-100 touch:ring-0",children:[r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.copyPlain"),title:l("table.copyPlain"),onClick:()=>{A()},children:b==="copied"?r.jsx(Ie,{size:14}):r.jsx(fn,{size:14})}),r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.download"),title:l("table.download"),onClick:_,children:r.jsx(Ft,{size:14})}),r.jsx("button",{type:"button",className:"table-action !rounded-full","aria-label":l("table.expand"),title:l("table.expand"),onClick:L=>{y.current=L.currentTarget,v(!0)},children:r.jsx(Dd,{size:14})})]}),t.length>AI&&r.jsxs("div",{className:"flex items-center gap-2 px-4 pb-1.5 text-ink-tertiary",children:[C("flex min-w-24 flex-1 items-center gap-2"),r.jsx("span",{role:"status",className:"shrink-0 text-[12px] tabular-nums",children:l("table.count",{shown:S.length.toLocaleString(),total:t.length.toLocaleString(),columns:e.length})})]}),r.jsx(TI,{columns:e,rows:t,order:S,name:n,wrap:x,large:!1,sort:m,direction:a,headless:i,look:"card",onSort:R}),N]}),q=L=>{if(c&&o&&!L)return O();const P=!L&&t.length<=AI,$=r.jsxs(r.Fragment,{children:[!P&&r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.wrap"),title:l("table.wrap"),"aria-pressed":x,onClick:()=>g(!x),children:r.jsx(Bd,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.copy"),title:l("table.copy"),onClick:()=>{A()},children:b==="copied"?r.jsx(Ie,{size:14}):r.jsx(fn,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.download"),title:l("table.download"),onClick:_,children:r.jsx(Ft,{size:14})}),!L&&r.jsx("button",{type:"button",className:"table-action","aria-label":l("table.expand"),title:l("table.expand"),onClick:M=>{y.current=M.currentTarget,v(!0)},children:r.jsx(Dd,{size:14})})]});return r.jsxs("div",{className:I("rich-table w-fit min-w-[min(100%,var(--chat-prose-max))] max-w-full overflow-hidden rounded-xl border border-hairline/50 text-ink",c?"bg-composer":"bg-panel"),dir:"ltr",children:[!P&&r.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-hairline/40 px-2 py-1.5",children:[C("flex min-w-24 flex-1 items-center gap-2 px-1 text-ink-secondary"),$]}),r.jsx(TI,{columns:e,rows:t,order:S,name:n,wrap:x,large:L,sort:m,direction:a,headless:i,look:c?"quiet":"panel",onSort:R}),r.jsxs("footer",{className:P?"flex items-center justify-end gap-0.5 border-t border-hairline/30 px-1.5 py-1 text-[11px] text-ink-tertiary":"flex flex-wrap items-center justify-between gap-2 border-t border-hairline/40 px-3 py-2 text-[11px] text-ink-secondary",children:[!P&&r.jsx("span",{role:"status",children:l("table.count",{shown:S.length.toLocaleString(dt()),total:t.length.toLocaleString(dt()),columns:e.length})}),b!=="idle"&&r.jsx("span",{role:b==="failed"?"alert":"status",className:P?"me-auto ps-1.5":void 0,children:l(b==="failed"?"table.copyFailed":"table.copied")}),P&&$]})]})};return r.jsxs(r.Fragment,{children:[r.jsx("div",{hidden:k,className:"chat-table",children:q(s)}),k&&r.jsx(Dj,{title:n,returnFocus:y.current,onClose:()=>v(!1),children:q(!0)})]})}function TI({columns:e,rows:t,order:n,name:s,wrap:a,large:i,sort:o,onSort:c,direction:d,headless:u=!1,look:p="panel"}){const m=p==="card",h=f.useRef(null),x=f.useRef(null),[g,k]=f.useState(40);f.useEffect(()=>{if(!x.current)return;const $=new ResizeObserver(([M])=>{M&&k(M.target.getBoundingClientRect().height)});return $.observe(x.current),()=>$.disconnect()},[]);const v=n.length>80,y=f.useMemo(()=>t5e(e.map($=>$.text),t.map($=>$.map(M=>M.text))),[e,t]),[b,w]=f.useState(null);f.useEffect(()=>{const $=h.current;if(!$||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>w($.clientWidth||null));return M.observe($),()=>M.disconnect()},[]);const j=s5e({wrap:a,virtual:v,minimums:y,available:b}),S=f.useMemo(()=>e.map(($,M)=>$.width??Math.min(320,Math.max(140,Math.max($.text.length,...t.slice(0,100).map(F=>Math.min(40,F[M]?.text.length??0)))*7+40))),[e,t]),E=f.useMemo(()=>e.map(($,M)=>{const F=t.slice(0,200).map(W=>W[M]?.text.trim()??"").filter(Boolean);return F.length>0&&F.every(Vje)}),[e,t]),A=$je({count:n.length,getScrollElement:()=>h.current,estimateSize:()=>42,getItemKey:$=>n[$],overscan:6,enabled:v,initialRect:{width:800,height:400},scrollMargin:g});f.useEffect(()=>{h.current&&(h.current.scrollTop=0)},[n]),f.useEffect(()=>{A.measure()},[a,S,A]);const _=v?A.getVirtualItems():n.map(($,M)=>({key:$,index:M,start:0,end:0})),N=v&&_.length?Math.max(0,_[0].start-g):0,C=v&&_.length?Math.max(0,A.getTotalSize()-_.at(-1).end+g):0,R=($,M)=>$.align??(E[M]||d==="rtl"?"right":"left"),O=($,M)=>l("table.sort",{column:$.text||M+1}),q=($,M)=>$.content??($.text||l("table.column",{number:M+1})),L=($,M)=>o?.column===$&&o.descending?r.jsx(_l,{size:12,className:M}):r.jsx(mi,{size:12,className:I(M,o?.column!==$&&!m&&"opacity-35")}),P=$=>L($,I("shrink-0 text-ink-tertiary transition-opacity",o?.column===$?"opacity-100":"opacity-0 group-hover/th:opacity-100 group-focus-within/th:opacity-100 touch:opacity-100"));return r.jsxs("div",{ref:h,tabIndex:0,role:"region","aria-label":s,className:I("overflow-auto overscroll-x-contain focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",m&&!j&&"[mask-image:linear-gradient(90deg,#000_calc(100%-40px),transparent)]"),style:{maxHeight:i?"65dvh":v||!a?400:void 0},"data-fit":j||void 0,children:[r.jsxs("table",{dir:d,"aria-label":s,"aria-rowcount":n.length+1,className:I("w-full border-separate border-spacing-0 text-[14px]",j?"table-auto":"table-fixed",m&&"leading-5"),style:j?void 0:{minWidth:S.reduce(($,M)=>$+M,0)},children:[!j&&r.jsx("colgroup",{children:S.map(($,M)=>r.jsx("col",{style:{width:$}},M))}),r.jsx("thead",{ref:x,hidden:u,className:I("sticky top-0 z-10",p==="panel"?"bg-raised":p==="card"?"bg-card":"bg-composer"),children:r.jsx("tr",{"aria-rowindex":1,children:e.map(($,M)=>r.jsx("th",{scope:"col","aria-sort":o?.column===M?o.descending?"descending":"ascending":"none",className:m?"px-4 py-2.5 align-bottom font-semibold":"h-10 border-b border-hairline/60 px-3 py-2 font-medium",style:{textAlign:R($,M)},children:r.jsx("div",{className:"break-words [overflow-wrap:anywhere]",style:j?{minWidth:y[M]}:void 0,children:m?r.jsxs("button",{type:"button",className:"group/th inline-flex max-w-full items-center gap-1 align-top text-start font-semibold [text-align:inherit] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60","aria-label":O($,M),title:O($,M),onClick:()=>c(M),children:[R($,M)==="right"&&P(M),r.jsx("span",{dir:"auto",children:q($,M)}),R($,M)!=="right"&&P(M)]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{dir:"auto",children:q($,M)}),r.jsx("button",{type:"button",className:"table-action ms-1 inline-flex align-middle","aria-label":O($,M),title:O($,M),onClick:()=>c(M),children:L(M)})]})})},M))})}),r.jsxs("tbody",{children:[N>0&&r.jsx("tr",{"aria-hidden":"true",children:r.jsx("td",{colSpan:e.length,style:{height:N,padding:0}})}),_.map($=>r.jsx("tr",{"data-index":$.index,ref:v?A.measureElement:void 0,"aria-rowindex":$.index+2,className:m?void 0:$.index%2?I(p==="quiet"?"bg-ink/[0.03]":"bg-inset/35","hover:bg-raised/70"):"hover:bg-raised/70",children:e.map((M,F)=>{const W=t[n[$.index]][F];return r.jsx("td",{className:m?"border-t-[0.5px] border-ink/[0.07] px-4 py-2.5 align-top tabular-nums":"border-b border-hairline/20 px-3 py-2.5 align-top tabular-nums",style:{textAlign:W?.align??R(M,F),verticalAlign:W?.vAlign},children:r.jsx("div",{dir:"auto",title:a?void 0:W?.text,className:a?"whitespace-pre-wrap break-words [overflow-wrap:anywhere]":"truncate",children:W?.content??W?.text})},F)})},$.key)),C>0&&r.jsx("tr",{"aria-hidden":"true",children:r.jsx("td",{colSpan:e.length,style:{height:C,padding:0}})})]})]}),n.length===0&&r.jsx("p",{className:"p-8 text-center text-sm text-ink-secondary",children:l(t.length?"table.noResults":"table.empty")})]})}async function uP(e,t,n=Hje){if(Number(e.headers.get("content-length"))>n)throw await e.body?.cancel().catch(()=>{}),new Error("size");const s=e.body?.getReader();if(!s)return"";const a=new TextDecoder("utf-8",{fatal:!0});let i=0,o="";try{for(;;){t.throwIfAborted();const c=await s.read();if(c.done)break;if(i+=c.value.byteLength,i>n)throw new Error("size");o+=a.decode(c.value,{stream:!0})}return o+a.decode()}finally{await s.cancel().catch(()=>{}),s.releaseLock()}}function a5e({path:e,name:t,message:n}){const[s,a]=f.useState(!1),i=f.useRef(null),o=CI(t)??CI(e);return o?r.jsxs(r.Fragment,{children:[r.jsx("button",{ref:i,type:"button",className:"table-action",title:l("table.preview",{name:t}),"aria-label":l("table.preview",{name:t}),onClick:()=>a(!0),children:r.jsx(IE,{size:14})}),s&&r.jsx(Dj,{title:t,returnFocus:i.current,onClose:()=>a(!1),children:r.jsx(i5e,{path:e,name:t,message:n,delimiter:o},`${n.threadId}:${n.messageId}:${e}`)})]}):null}function i5e({path:e,name:t,message:n,delimiter:s}){const[a,i]=f.useState(0),[o,c]=f.useState(null),[d,u]=f.useState(null);f.useEffect(()=>{const m=new AbortController;let h;u(null),c(null);const x=g=>{m.signal.aborted||u(g),h?.terminate()};return(async()=>{try{const g=await dp(e,n,m.signal),k=await uP(g,m.signal);m.signal.throwIfAborted(),h=new Worker(new URL("/assets/table-file.worker-KkMx-SNx.js",import.meta.url),{type:"module"}),h.onmessage=v=>{v.data.error?x(v.data.error):!m.signal.aborted&&v.data.table&&c(v.data.table),h?.terminate()},h.onerror=()=>x("format"),h.postMessage({text:k,delimiter:s})}catch(g){x(g instanceof Error&&g.message==="size"?"size":"load")}})(),()=>{m.abort(),h?.terminate()}},[e,n.threadId,n.messageId,s,a]);const p=f.useMemo(()=>o&&{columns:o.headers.map(m=>({text:m})),rows:o.rows.map(m=>m.map(h=>({text:h})))},[o]);return d?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l(d==="size"?"table.tooLarge":d==="columns"||d==="format"?"table.invalid":"table.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>i(a+1),children:l("chat.retry")})]}):p?r.jsx($j,{...p,name:t,expanded:!0}):r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("table.loading")]})}const o5e=2*1024*1024,l5e="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; media-src data:";function Ih(e){return/\.html?$/i.test(e)}function _I(e){return/\.(md|markdown)$/i.test(e)}const c5e=f.lazy(()=>_e(()=>import("./MarkdownFilePreview-B2U1b00V.js"),__vite__mapDeps([51,1,2,3,4,10,8])));class d5e extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l("markdown.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>location.reload(),children:l("page.broken.reload")})]}):this.props.children}}function u5e(e){return`<meta http-equiv="Content-Security-Policy" content="${l5e}"><base target="_blank">${e}`}function p5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.openHtmlInBrowser}function Bj(e,t,n){const[s,a]=f.useState(!1),i=f.useRef(null),o=n===void 0?null:Ih(t)||Ih(e)?"html":_I(t)||_I(e)?"markdown":null,c=n?`${n.threadId}:${n.messageId}:${e}`:"";return{opens:o!==null,label:l(o==="markdown"?"markdown.preview":"html.preview",{name:t}),show:d=>{i.current=d.currentTarget,a(!0)},dialog:o&&s&&n?r.jsx(Dj,{title:t,returnFocus:i.current,onClose:()=>a(!1),children:o==="html"?r.jsx(h5e,{path:e,name:t,message:n},c):r.jsx(d5e,{children:r.jsx(f.Suspense,{fallback:r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("markdown.loading")]}),children:r.jsx(c5e,{path:e,name:t,message:n},c)})})}):null}}function m5e({path:e,name:t,message:n}){const s=Bj(e,t,n);return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"table-action",title:s.label,"aria-label":s.label,onClick:s.show,children:r.jsx(Ur,{size:14})}),s.dialog]})}function pP(e,t,n,s){return e.opens?{onClick:e.show,disabled:!1,"aria-label":e.label}:{onClick:()=>{t.save()},disabled:t.state==="saving","aria-label":s?l("attach.retrySaveAria",{name:n}):l("attach.saveAria",{name:n})}}function Fj({name:e,save:t,retryable:n}){const s=n?l("attach.retrySaveAria",{name:e}):l("attach.saveAria",{name:e});return r.jsx("button",{type:"button",className:"table-action","aria-label":s,title:s,disabled:t.state==="saving",onClick:()=>{t.save()},children:t.state==="saving"?r.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"}):t.state==="saved"?r.jsx(Ie,{size:14,className:"text-success","aria-hidden":"true"}):n?r.jsx(jr,{size:14,className:"text-danger","aria-hidden":"true"}):r.jsx(Ft,{size:14,"aria-hidden":"true"})})}function f5e({source:e,name:t,onError:n}){const s=p5e();if(!s)return null;const a=l("html.openInBrowser",{name:t});return r.jsx("button",{type:"button",className:"table-action","aria-label":a,title:a,onClick:()=>{n(""),s(e,t).catch(i=>n(i instanceof Error&&i.message?i.message:l("html.openFailed")))},children:r.jsx(ms,{size:14})})}function h5e({path:e,name:t,message:n}){const[s,a]=f.useState(0),[i,o]=f.useState(null),[c,d]=f.useState(null),[u,p]=f.useState(!1),[m,h]=f.useState(""),x=mg(e,t,n);return f.useEffect(()=>{const g=new AbortController;return d(null),o(null),(async()=>{try{const k=await dp(e,n,g.signal),v=await uP(k,g.signal,o5e);g.signal.aborted||o(v)}catch(k){g.signal.aborted||d(k instanceof Error&&k.message==="size"?"size":"load")}})(),()=>g.abort()},[e,n.threadId,n.messageId,s]),c?r.jsxs("div",{className:"p-8 text-center text-sm",children:[r.jsx("p",{role:"alert",className:"mb-3 text-ink-secondary",children:l(c==="size"?"html.tooLarge":"html.loadFailed")}),r.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>a(s+1),children:l("chat.retry")})]}):i===null?r.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary",children:[r.jsx(ye,{size:16,className:"animate-spin"}),l("html.loading")]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx("button",{type:"button",className:"table-action","aria-pressed":u,"aria-label":l(u?"html.rendered":"html.source"),title:l(u?"html.rendered":"html.source"),onClick:()=>p(!u),children:u?r.jsx(Ur,{size:14}):r.jsx(ZW,{size:14})}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("html.reload"),title:l("html.reload"),onClick:()=>a(s+1),children:r.jsx(jr,{size:14})}),r.jsx(f5e,{source:i,name:t,onError:h}),r.jsx("button",{type:"button",className:"table-action","aria-label":l("attach.saveAria",{name:t}),title:l("attach.saveAria",{name:t}),disabled:x.state==="saving",onClick:()=>{x.save()},children:r.jsx(Ft,{size:14})})]}),x.state==="failed"&&r.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:x.reason}),m&&r.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:m}),u?r.jsx("pre",{className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-inset p-3 text-[12px] leading-5 whitespace-pre-wrap break-words text-ink",children:i}):r.jsx(x5e,{source:i,name:t})]})}function x5e({source:e,name:t}){return r.jsx("iframe",{sandbox:"",referrerPolicy:"no-referrer",srcDoc:u5e(e),title:l("html.frameTitle",{name:t}),className:"h-[72dvh] w-full rounded-lg border border-hairline/40 bg-white"})}function qj({path:e,name:t,message:n}){return Ih(t)||Ih(e)?r.jsx(m5e,{path:e,name:t,message:n}):r.jsx(a5e,{path:e,name:t,message:n})}const MI=new Map;function mP(e,t,n=0){let s=MI.get(n);if(!s){const o=new Map;s={observer:new IntersectionObserver(d=>{for(const u of d)o.get(u.target)?.(u.isIntersecting)},n?{rootMargin:`${n}px 0px`,scrollMargin:`${n}px 0px`}:void 0),watchers:o},MI.set(n,s)}const{observer:a,watchers:i}=s;return i.set(e,t),a.observe(e),()=>{i.delete(e),a.unobserve(e)}}function g5e(e){const[t,n]=f.useState(!1);return f.useEffect(()=>{const s=e.current;if(s)return typeof IntersectionObserver>"u"?n(!0):mP(s,n)},[e]),t}const b5e=800;function y5e(e){const[t,n]=f.useState(()=>typeof IntersectionObserver>"u");return f.useEffect(()=>{const s=e.current;if(!(t||!s))return mP(s,a=>a&&n(!0),b5e)},[e,t]),t}function fP({name:e,className:t}){const n=f.useRef(null),s=g5e(n);return r.jsxs("span",{ref:n,className:I("flex items-center justify-center",s&&"animate-pulse",t),role:"status",children:[r.jsx(ye,{size:17,className:I("text-ink-tertiary",s&&"animate-spin")}),r.jsx("span",{className:"sr-only",children:l("attach.loadingName",{name:e})})]})}const hP=/^(?:\/(?!\/)|[a-zA-Z]:[\\/])/,k5e=`${jn} text-ink hover:bg-menu-hover [&>svg]:text-ink-secondary`;function xP(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.revealInFolder}async function v5e(e,t=w5e()){if(!t||!hP.test(e))return!1;try{return await t(e)==="opened"}catch{return!1}}function w5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.openFolder}function j5e(e,t=xP()){return!!t&&typeof e=="string"&&hP.test(e)}function N5e(e){return l(e==="darwin"?"attach.showInFinder":"attach.showInFolder")}async function S5e(e,t){try{const n=await t(e);return n==="shown"?"":l(n==="missing"?"attach.originalMissing":"attach.revealFailed")}catch{return l("attach.revealFailed")}}function gP(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useRef(null),a=()=>{t(null);const d=s.current;s.current=null,d?.isConnected&&d.focus()};f.useEffect(()=>{if(!e)return;n.current?.querySelector("button")?.focus();const d=u=>{u.target instanceof Node&&n.current?.contains(u.target)||t(null)};return window.addEventListener("mousedown",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("mousedown",d),window.removeEventListener("scroll",d,!0)}},[e]);const i=xP(),o=N5e(typeof window>"u"?void 0:window.ogb?.platform),c=async d=>{const u=i?await S5e(d,i):l("attach.revealFailed");if(!u&&n.current?.contains(document.activeElement))return a();t(p=>p?.source!==d?p:u?{...p,problem:u}:null)};return{targetProps:d=>j5e(d,i)?{onContextMenu:u=>{u.preventDefault(),u.stopPropagation();const p=document.activeElement;s.current=p instanceof HTMLElement&&p!==document.body?p:u.currentTarget,t({left:Math.max(8,Math.min(u.clientX,window.innerWidth-268)),top:Math.max(8,Math.min(u.clientY,window.innerHeight-110)),source:d})}}:{},menu:e&&Ke.createPortal(r.jsxs("div",{ref:n,role:"group","aria-label":o,style:{left:e.left,top:e.top},className:I("fixed z-50 w-[260px]",Jt),onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a())},children:[r.jsxs("button",{type:"button",onClick:()=>{c(e.source)},title:e.source,className:k5e,children:[r.jsx(Hr,{size:16}),o]}),e.problem&&r.jsx("p",{role:"alert",className:"px-2 pb-1 text-[13px] leading-[18px] text-danger",children:e.problem})]}),document.body)}}function bP(e,t=ls(e)){const n=V0(e);return n?{src:n,name:t,downloadUrl:n,downloadName:cp({fallback:t,source:e})}:null}function I5e(e,t,n){return n<=0?0:(e+t+n)%n}function C5e(e,t){return e==="Escape"?"close":t>1&&e==="ArrowLeft"?"previous":t>1&&e==="ArrowRight"?"next":null}const E5e={"image/avif":"avif","image/bmp":"bmp","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/tiff":"tiff","image/webp":"webp"},A5e=new Set(["avif","bmp","gif","heic","heif","jpeg","jpg","png","tif","tiff","webp"]);function jd(e){const n=((e??"").split(/[\\/]/).at(-1)??"").normalize("NFC").replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g,"").replace(/[<>:"|?*]/g,"_").trim().replace(/[. ]+$/g,""),s=Array.from(n).filter(i=>{const o=i.charCodeAt(0);return i.length>1||o<55296||o>57343}).slice(0,180).join("");if(!s)return"download";const a=s.split(".",1)[0].toUpperCase();return/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/.test(a)?`_${s}`:s}function T5e(e){if(!e)return null;const t=/(?:^|;)\s*filename\*\s*=\s*(?:UTF-8'[^']*')?([^;]*)/i.exec(e)?.[1]?.trim();if(t){const a=t.replace(/^"|"$/g,"");try{return jd(decodeURIComponent(a))}catch{}}const n=/(?:^|;)\s*filename\s*=\s*"((?:\\.|[^"\\])*)"/i.exec(e)?.[1];if(n!==void 0)return jd(n.replace(/\\(.)/g,"$1"));const s=/(?:^|;)\s*filename\s*=\s*([^;]*)/i.exec(e)?.[1]?.trim();return s?jd(s):null}function _5e(e){if(!e)return null;let t=e;try{t=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname)}catch{t=e.split(/[?#]/,1)[0]??e}const n=/\.([a-z0-9]+)$/i.exec(t)?.[1]?.toLowerCase();return n&&A5e.has(n)?n:null}function M5e(e,t){const n=`.${t}`,s=e.replace(/\.[^.]*$/,"")||"image",a=Math.max(1,180-Array.from(n).length);return`${Array.from(s).slice(0,a).join("")}${n}`}function cp({contentDisposition:e,fallback:t,source:n,mime:s}){const a=T5e(e??null)??jd(t),i=s?.split(";",1)[0]?.trim().toLowerCase()??"",o=E5e[i]??_5e(n);return o?M5e(a,o):a}function R5e(e){const n=e.trim().replace(/[\t\n\r]/g,"").replace(/\\/g,"/");return n.startsWith("//")||/^https?:/i.test(n)}function O5e(e,t){return`/api/threads/${encodeURIComponent(e.threadId)}/messages/${encodeURIComponent(e.messageId)}/file?preview=1&ref=${t}`}async function z5e(e){try{const t=await fetch(e,{cache:"no-store"});return t.ok?(await t.body?.cancel(),!1):(await t.json().catch(()=>null))?.code==="outside_workspace"}catch{return!1}}function L5e(e){setTimeout(()=>URL.revokeObjectURL(e),0)}async function dp(e,t,n,s){const a=await fetch(`/api/threads/${encodeURIComponent(t.threadId)}/messages/${encodeURIComponent(t.messageId)}/file`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,...s?.entry!==void 0?{entry:s.entry}:s?.list?{listFolder:!0}:{}}),signal:n});if(!a.ok){const i=await a.json().catch(()=>null);throw Object.assign(new Error(Al(i,i?.error??l("attach.downloadFailed"))),{code:i?.code})}return a}function mg(e,t,n,s){const[a,i]=f.useState("idle"),[o,c]=f.useState(null),[d,u]=f.useState(""),[p,m]=f.useState(""),[h,x]=f.useState(void 0),g=f.useRef(null),k=f.useRef(null),v=f.useRef(!1),y=f.useRef(!0);f.useEffect(()=>(y.current=!0,()=>{y.current=!1,k.current?.abort(),g.current&&clearTimeout(g.current)}),[]),f.useEffect(()=>{k.current?.abort(),k.current=null,v.current=!1,u(""),m(""),x(void 0),c(null),i("idle")},[e,s,n?.messageId,n?.threadId]);const b=f.useCallback(async()=>{if(v.current)return;if(!n){u(l("attach.unavailableOld")),i("failed");return}v.current=!0,g.current&&(clearTimeout(g.current),g.current=null),u(""),x(void 0),i("saving"),k.current?.abort();const j=new AbortController;k.current=j;try{const S=await dp(e,n,j.signal,s===void 0?{list:!0}:{entry:s});if(S.headers.get("x-openmausbot-folder")==="1"){const N=await S.json();if(!y.current||j.signal.aborted)return;i("idle"),!await v5e(e)&&!j.signal.aborted&&c(N);return}const E=await S.blob();if(!y.current||j.signal.aborted)return;const A=URL.createObjectURL(E),_=cp({contentDisposition:S.headers.get("content-disposition"),fallback:t||s||ls(e),source:e,mime:E.type||S.headers.get("content-type")});try{const N=document.createElement("a");N.href=A,N.download=_,N.style.display="none",document.body.append(N);try{N.click()}finally{N.remove()}}finally{L5e(A)}if(!y.current||j.signal.aborted)return;m(_),i("saved"),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{y.current&&i("idle")},4e3)}catch(S){if(!y.current||j.signal.aborted)return;u(S instanceof Error?S.message:l("attach.saveFailed")),x(S?.code),i("failed")}finally{k.current===j&&(k.current=null,v.current=!1)}},[e,s,n?.messageId,n?.threadId,t]),w=h==="outside_workspace";return{state:a,reason:d,savedTo:p,outsideWorkspace:w,retryable:a==="failed"&&!w&&h!=="file_too_large",folder:o,save:b}}function Uj(e){return e.outsideWorkspace?l("attach.outsideWorkspace"):e.reason}function P5e(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/(1024*102.4))/10} MB`}function D5e({folderPath:e,name:t,bytes:n,message:s}){const a=mg(e,t,s,t);return r.jsxs("li",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5",children:[r.jsxs("button",{type:"button",onClick:()=>{a.save()},disabled:a.state==="saving","aria-label":l("attach.saveAria",{name:t}),className:"inline-flex min-h-8 min-w-0 items-center gap-1 break-all text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[a.state==="saving"?r.jsx(ye,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):a.state==="saved"?r.jsx(Ie,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):r.jsx(no,{size:12,className:"shrink-0","aria-hidden":"true"}),t]}),r.jsx("span",{className:"text-ink-secondary",children:P5e(n)}),a.state==="failed"&&r.jsx("span",{role:"alert",className:"text-danger",children:a.reason})]})}function $5e({folderPath:e,listing:t,message:n}){return r.jsxs("span",{dir:"ltr",className:"block w-full text-[12px] [unicode-bidi:isolate]",children:[t.entries.length===0?r.jsx("span",{className:"text-ink-secondary",children:l("attach.folderEmpty")}):r.jsx("ul",{"aria-label":l("attach.folderFilesAria",{name:t.name}),className:"flex flex-col gap-0.5 ps-1",children:t.entries.map(s=>r.jsx(D5e,{folderPath:e,name:s.name,bytes:s.bytes,message:n},s.name))}),t.truncated&&r.jsx("span",{className:"text-ink-secondary",children:l("attach.folderTruncated")})]})}const B5e=/^(?:\/(?!\/)|[a-zA-Z]:[\\/])/;function F5e(){const e=typeof window>"u"?void 0:window.ogb;return e?.remoteClient?.active?void 0:e?.revealInFolder}function Hj({filePath:e}){const[t,n]=f.useState(""),s=F5e();if(!s||!B5e.test(e))return r.jsx("code",{title:l("attach.outsideWorkspacePath"),className:"select-all break-all text-ink",children:e});const a=async()=>{n("");try{const i=await s(e);i==="missing"?n(l("attach.revealMissing")):i!=="shown"&&n(l("attach.revealFailed"))}catch{n(l("attach.revealFailed"))}};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>{a()},title:e,className:"inline-flex items-center gap-1 text-accent underline decoration-accent/40 hover:decoration-accent",children:[r.jsx(Hr,{size:12,className:"shrink-0","aria-hidden":"true"}),l("attach.showInFolder")]}),t&&r.jsx("span",{role:"alert",className:"text-danger",children:t})]})}function fg({image:e,images:t,initialIndex:n=0,onClose:s}){const a=t?.length?t:[e],[i,o]=f.useState(()=>Math.min(Math.max(n,0),a.length-1)),c=a[i]??e,d=f.useRef(null),u=f.useRef(s),[p,m]=f.useState(()=>new Set),[h,x]=f.useState(null),[g,k]=f.useState(0);f.useLayoutEffect(()=>{u.current=s},[s]);const v=f.useCallback(j=>{o(S=>I5e(S,j,a.length)),x(null)},[a.length]);f.useEffect(()=>{const j=document.activeElement instanceof HTMLElement?document.activeElement:null;d.current?.focus();const S=E=>{const A=C5e(E.key,a.length);if(A){E.preventDefault(),E.stopPropagation(),A==="close"?u.current():v(A==="previous"?-1:1);return}if(E.key!=="Tab")return;const _=d.current;if(!_)return;const N=[..._.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(N.length===0){E.preventDefault(),_.focus();return}const C=N[0],R=N[N.length-1];E.shiftKey&&(document.activeElement===_||document.activeElement===C)?(E.preventDefault(),R.focus()):!E.shiftKey&&document.activeElement===R&&(E.preventDefault(),C.focus())};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),j?.focus()}},[a.length,v]);const y=p.has(c.src),b=h===c.src,w=()=>{x(null),m(j=>{const S=new Set(j);return S.delete(c.src),S}),k(j=>j+1)};return Ke.createPortal(r.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/80 p-3 backdrop-blur-sm sm:p-6",onMouseDown:j=>j.target===j.currentTarget&&s(),children:r.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-label":l("attach.previewAria",{name:c.name}),tabIndex:-1,className:"animate-pop-in flex h-full max-h-[900px] w-full max-w-[1200px] flex-col overflow-hidden rounded-2xl border border-white/15 bg-black/70 shadow-2xl outline-none",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-white/10 bg-black/45 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:c.name}),r.jsx("div",{className:"text-[11px] text-white/50",children:a.length>1?l("attach.position",{index:i+1,count:a.length}):l("attach.imagePreview")})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c.downloadUrl&&r.jsx("a",{href:c.downloadUrl,download:c.downloadName??cp({fallback:c.name,source:c.downloadUrl}),className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.downloadAria",{name:c.name}),title:l("attach.download"),children:r.jsx(Ft,{size:17})}),c.openUrl&&r.jsx("a",{href:c.openUrl,target:"_blank",rel:"noreferrer",className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.openOriginalAria",{name:c.name}),title:l("attach.openOriginal"),children:r.jsx(ms,{size:17})}),r.jsx("button",{onClick:s,className:"flex size-9 items-center justify-center rounded-lg text-white/65 hover:bg-white/10 hover:text-white","aria-label":l("attach.close"),children:r.jsx(Ae,{size:19})})]})]}),r.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4 sm:p-8",children:[!y&&!b&&r.jsx("div",{className:"absolute inset-4 flex animate-pulse items-center justify-center rounded-xl bg-white/[0.055] sm:inset-8",role:"status",children:r.jsxs("span",{className:"flex items-center gap-2 text-[13px] text-white/55",children:[r.jsx(ye,{size:17,className:"animate-spin"})," ",l("attach.imageLoading")]})}),b?r.jsxs("div",{className:"flex flex-col items-center gap-3 text-white/60",role:"alert",children:[r.jsx(zd,{size:34}),r.jsx("span",{className:"text-[13px]",children:l("attach.imageFailed")}),r.jsxs("button",{type:"button",onClick:w,className:"flex items-center gap-1.5 rounded-lg border border-white/15 bg-white/10 px-3 py-1.5 text-[12px] text-white hover:bg-white/15",children:[r.jsx(jr,{size:13})," ",l("chat.retry")]})]}):r.jsx("img",{src:c.src,alt:c.name,onLoad:()=>m(j=>new Set(j).add(c.src)),onError:()=>x(c.src),className:I("block max-h-full max-w-full rounded-lg object-contain shadow-2xl transition-opacity duration-150",y?"opacity-100":"opacity-0")},`${c.src}:${g}`),a.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>v(-1),"aria-label":l("attach.previous"),className:"absolute left-2 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/80 backdrop-blur-sm hover:bg-black/75 hover:text-white sm:left-4",children:r.jsx(da,{size:21})}),r.jsx("button",{type:"button",onClick:()=>v(1),"aria-label":l("attach.next"),className:"absolute right-2 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/80 backdrop-blur-sm hover:bg-black/75 hover:text-white sm:right-4",children:r.jsx(at,{size:21})})]})]})]})}),document.body)}function zk({image:e,onPreview:t,className:n,eager:s=!1,explainRefusal:a=!1}){const[i,o]=f.useState("loading"),[c,d]=f.useState(0),[u,p]=f.useState(!1),[m,h]=f.useState(null);return r.jsxs("span",{style:m?{aspectRatio:String(m)}:void 0,className:I("group/image relative block aspect-[4/3] min-w-0 overflow-hidden rounded-xl border border-hairline/40 bg-inset",n),children:[i==="loading"&&r.jsx(fP,{name:e.name,className:"absolute inset-0 bg-raised/65"}),i==="failed"?r.jsxs("span",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-3 text-center text-ink-secondary",role:"alert",children:[r.jsx(zd,{size:22}),u?r.jsx("span",{className:"max-w-full text-[12px]",children:l("attach.imageOutsideWorkspace")}):r.jsx("span",{className:"max-w-full truncate text-[12px]",children:l("attach.imageUnavailable")}),!u&&r.jsxs("span",{role:"button",tabIndex:0,onClick:x=>{x.preventDefault(),x.stopPropagation(),o("loading"),d(g=>g+1)},onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),x.stopPropagation(),o("loading"),d(g=>g+1))},className:"flex items-center gap-1 rounded-md border border-hairline/50 bg-panel px-2 py-1 text-[11px] text-ink hover:bg-raised","aria-label":l("attach.retryAria",{name:e.name}),children:[r.jsx(jr,{size:11})," ",l("chat.retry")]})]}):r.jsxs("span",{role:"button",tabIndex:i==="ready"?0:-1,"aria-disabled":i!=="ready",onClick:x=>{x.preventDefault(),x.stopPropagation(),i==="ready"&&t()},onKeyDown:x=>{i==="ready"&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),t())},className:"absolute inset-0 block size-full cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60 aria-disabled:cursor-default","aria-label":l("attach.previewImageAria",{name:e.name}),title:l("attach.previewAria",{name:e.name}),children:[r.jsx("img",{src:e.src,alt:e.name,loading:s?"eager":"lazy",fetchPriority:s?"high":void 0,onLoad:x=>{const{naturalWidth:g,naturalHeight:k}=x.currentTarget;g>0&&k>0&&h(Math.min(Math.max(g/k,.6),2.4)),o("ready")},onError:()=>{o("failed"),a&&z5e(e.src).then(p)},className:I("block size-full object-cover transition duration-200 group-hover/image:scale-[1.015]",i==="ready"?"opacity-100":"opacity-0")},`${e.src}:${c}`),r.jsx("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-black/55 text-white opacity-0 backdrop-blur-sm transition-opacity group-hover/image:opacity-100 group-focus-within/image:opacity-100",children:r.jsx(Dd,{size:13})})]})]})}function q5e({src:e,name:t,openUrl:n,message:s,filePath:a,sourceOffset:i}){const[o,c]=f.useState(!1),d=f.useRef(null),u=s?.threadId,p=s?.messageId,m=typeof i=="number"&&Number.isSafeInteger(i)&&i>=0?i:null,h=!!(a&&u&&p&&m!==null),x=h?`${u}\0${p}\0${m}`:null,[g,k]=f.useState(null),v=!a&&R5e(e),[y,b]=f.useState(null);f.useEffect(()=>{if(!x)return;const A=d.current;if(!A||typeof IntersectionObserver>"u"){k(x);return}k(null);const _=new IntersectionObserver(([N])=>{N?.isIntersecting&&(k(x),_.disconnect())},{rootMargin:"320px 0px"});return _.observe(A),()=>_.disconnect()},[x]);const w=h&&(g===x||o),j=!v||y===e,S=j?h?w&&a&&u&&p&&m!==null?O5e({threadId:u,messageId:p},m):null:e:null,E={src:S??"",name:t,openUrl:n,downloadUrl:h?S??void 0:void 0,downloadName:h?cp({fallback:t,source:a}):void 0};return r.jsxs(r.Fragment,{children:[r.jsxs("span",{ref:d,className:"my-2 block w-[min(36rem,70vw)] max-w-full",children:[v&&!j?r.jsxs("span",{className:"flex aspect-[4/3] max-h-96 flex-col items-center justify-center gap-2 rounded-xl border border-hairline/40 bg-inset px-4 text-center text-[12px] text-ink-secondary",children:[r.jsx(zd,{size:20}),r.jsx("span",{children:l("attach.externalHidden")}),r.jsx("button",{type:"button",className:"rounded-md border border-hairline/50 bg-panel px-2.5 py-1 text-ink hover:bg-raised",onClick:A=>{A.preventDefault(),A.stopPropagation(),b(e)},children:l("attach.loadImage")})]}):a&&(!u||!p||m===null)?r.jsxs("span",{className:"flex aspect-[4/3] max-h-96 items-center justify-center gap-2 rounded-xl border border-hairline/40 bg-inset text-[12px] text-ink-secondary",role:"alert",children:[r.jsx(zd,{size:17})," ",l("attach.oldImage")]}):S?r.jsx(zk,{image:E,onPreview:()=>c(!0),className:"max-h-96",eager:!0,explainRefusal:h},E.src):r.jsx(fP,{name:t,className:"aspect-[4/3] max-h-96 rounded-xl border border-hairline/40 bg-inset"}),n&&r.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex text-[11px] text-accent hover:underline",children:l("attach.openOriginal")})]}),o&&S&&r.jsx(fg,{image:E,onClose:()=>c(!1)})]})}function Lk({file:e,message:t,linked:n=!1,compact:s=!1,className:a}){const i=mg(e.path,e.name,t),o=Bj(e.path,e.name,t),c=i.state==="failed";return s?r.jsx(U5e,{file:e,message:t,linked:n,save:i,preview:o,className:a}):!t||!e.private&&!n?r.jsxs("div",{title:l("attach.legacyFile",{name:e.name}),className:I("flex max-w-[280px] items-center gap-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 px-2.5 py-2 text-[12px] text-ink-secondary",a),children:[r.jsx(no,{size:14,className:"shrink-0","aria-hidden":"true"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:e.name}),r.jsx("span",{className:"text-[11px]",children:l("attach.unavailable")})]}):r.jsxs("div",{title:i.state==="saved"&&i.savedTo?l("attach.savedTo",{path:i.savedTo}):e.name,className:I("max-w-[280px] overflow-hidden rounded-lg border border-hairline/40 bg-inset/70 text-[12px] text-ink-secondary",a),children:[r.jsxs("div",{className:"flex items-center pe-1",children:[r.jsxs("button",{type:"button",...pP(o,i,e.name,i.retryable),className:"flex min-h-10 min-w-0 flex-1 items-center gap-2 px-2.5 py-2 text-left transition-colors hover:bg-raised/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60 disabled:cursor-wait disabled:hover:bg-transparent",children:[r.jsx(no,{size:14,className:"shrink-0","aria-hidden":"true"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:e.name}),o.opens?r.jsx(Ur,{size:13,className:"shrink-0"}):i.state==="saving"?r.jsx(ye,{size:13,className:"shrink-0 animate-spin"}):i.state==="saved"?r.jsx(Ie,{size:13,className:"shrink-0 text-success"}):c?i.retryable&&r.jsx(jr,{size:13,className:"shrink-0 text-danger"}):r.jsx(Ft,{size:13,className:"shrink-0"})]}),o.opens?r.jsx(Fj,{name:e.name,save:i,retryable:i.retryable}):r.jsx(qj,{path:e.path,name:e.name,message:t}),o.dialog]}),i.state!=="idle"&&r.jsxs("div",{role:c?"alert":"status",className:I("border-t border-hairline/30 px-2.5 py-1.5 text-[11px]",c?"text-danger":i.state==="saved"?"text-success":"text-ink-secondary"),children:[i.state==="saving"?l("attach.downloading"):i.state==="saved"?l("attach.downloaded"):Uj(i),c&&i.outsideWorkspace&&r.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5",children:r.jsx(Hj,{filePath:e.path})})]})]})}const RI="inline-flex h-7 max-w-[16rem] items-center rounded-full bg-ink/[0.06] text-[13px] leading-none text-ink-secondary";function U5e({file:e,message:t,linked:n,save:s,preview:a,className:i}){const o=s.state==="failed",c=r.jsx("span",{dir:"auto",className:"min-w-0 truncate text-ink [unicode-bidi:isolate]",children:e.name});return!t||!e.private&&!n?r.jsxs("span",{title:l("attach.legacyFile",{name:e.name}),className:I(RI,"gap-1.5 px-2.5",i),children:[r.jsx(no,{size:14,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}),c,r.jsx("span",{className:"shrink-0 text-[12px]",children:l("attach.unavailable")})]}):r.jsxs("span",{className:"inline-flex max-w-full flex-col items-start gap-1",children:[r.jsxs("span",{title:s.state==="saved"&&s.savedTo?l("attach.savedTo",{path:s.savedTo}):e.name,className:I(RI,"file-chip pe-0.5",i),children:[r.jsxs("button",{type:"button",...pP(a,s,e.name,s.retryable),className:"inline-flex h-7 min-w-0 items-center gap-1.5 rounded-full ps-2.5 pe-2 transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:cursor-wait",children:[r.jsx(no,{size:14,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}),c,a.opens?r.jsx(Ur,{size:13,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"}):s.state==="saving"?r.jsx(ye,{size:13,className:"shrink-0 animate-spin","aria-hidden":"true"}):s.state==="saved"?r.jsx(Ie,{size:13,className:"shrink-0 text-success","aria-hidden":"true"}):o?s.retryable&&r.jsx(jr,{size:13,className:"shrink-0 text-danger","aria-hidden":"true"}):r.jsx(Ft,{size:13,strokeWidth:1.75,className:"shrink-0","aria-hidden":"true"})]}),a.opens?r.jsx(Fj,{name:e.name,save:s,retryable:s.retryable}):r.jsx(qj,{path:e.path,name:e.name,message:t}),a.dialog]}),s.state!=="idle"&&s.state!=="saved"&&r.jsxs("span",{role:o?"alert":"status",className:I("px-2.5 text-[12px]",o?"text-danger":"text-ink-secondary"),children:[s.state==="saving"?l("attach.downloading"):Uj(s),o&&s.outsideWorkspace&&r.jsx("span",{className:"ms-1.5 inline-flex flex-wrap items-center gap-x-1.5",children:r.jsx(Hj,{filePath:e.path})})]}),s.state==="saved"&&r.jsx("span",{role:"status",className:"sr-only",children:l("attach.downloaded")})]})}const zc=e=>f.Children.toArray(e).filter(f.isValidElement);function Pk(e){if(typeof e=="string"||typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Pk).join("");if(!f.isValidElement(e))return"";const t=e;return t.type==="br"?`
184
+ `:Pk(t.props.children)||t.props.alt||""}function H5e({children:e,direction:t}){const n=f.useMemo(()=>{const s=zc(e),a=s.find(u=>u.type==="thead"),i=s.find(u=>u.type==="tbody"),o=u=>({text:Pk(u.props.children),content:u.props.children}),c=zc(zc(a?.props.children)[0]?.props.children).map(u=>({...o(u),align:u.props.align==="left"||u.props.align==="right"||u.props.align==="center"?u.props.align:void 0})),d=zc(i?.props.children).map(u=>zc(u.props.children).map(o));return{columns:c,rows:d}},[e]);return r.jsx($j,{...n,direction:t})}const _i=new Map,W5e=200,OI=4*1024*1024;function K5e(e,t){if(t.length>OI)return;_i.set(e,t);let n=0;for(const s of _i.values())n+=s.length;for(const[s,a]of _i){if(_i.size<=W5e&&n<=OI)break;_i.delete(s),n-=a.length}}const yP=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},V5e="github-light-default",G5e="github-dark-default",kP={javascript:()=>_e(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>_e(()=>import("./jsx-g9-lgVsj.js"),[]),typescript:()=>_e(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>_e(()=>import("./tsx-COt5Ahok.js"),[]),json:()=>_e(()=>import("./json-Cp-IABpG.js"),[]),jsonc:()=>_e(()=>import("./jsonc-Des-eS-w.js"),[]),json5:()=>_e(()=>import("./json5-C9tS-k6U.js"),[]),bash:()=>_e(()=>import("./bash-Yzrsuije.js"),[]),powershell:()=>_e(()=>import("./powershell-BmBUJMz7.js"),[]),fish:()=>_e(()=>import("./fish-BvzEVeQv.js"),[]),python:()=>_e(()=>import("./python-B6aJPvgy.js"),[]),html:()=>_e(()=>import("./html-pp8916En.js"),__vite__mapDeps([52,53,54])),css:()=>_e(()=>import("./css-CLj8gQPS.js"),[]),scss:()=>_e(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([55,54])),sass:()=>_e(()=>import("./sass-Cj5Yp3dK.js"),[]),less:()=>_e(()=>import("./less-B1dDrJ26.js"),[]),markdown:()=>_e(()=>import("./markdown-Cvjx9yec.js"),[]),mdx:()=>_e(()=>import("./mdx-Cmh6b_Ma.js"),[]),yaml:()=>_e(()=>import("./yaml-Buea-lGh.js"),[]),toml:()=>_e(()=>import("./toml-vGWfd6FD.js"),[]),xml:()=>_e(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([56,57])),c:()=>_e(()=>import("./c-BIGW1oBm.js"),[]),cpp:()=>_e(()=>import("./cpp-DddhVWhK.js"),__vite__mapDeps([58,59])),csharp:()=>_e(()=>import("./csharp-DSvCPggb.js"),[]),rust:()=>_e(()=>import("./rust-B1yitclQ.js"),[]),go:()=>_e(()=>import("./go-C27-OAKa.js"),[]),ruby:()=>_e(()=>import("./ruby-Ct1eTYOr.js"),__vite__mapDeps([60,52,53,54,56,57,61,62,63,64,65,58,59,66,67,68])),php:()=>_e(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([69,52,53,54,56,57,61,70])),java:()=>_e(()=>import("./java-CylS5w8V.js"),[]),kotlin:()=>_e(()=>import("./kotlin-BdnUsdx6.js"),[]),swift:()=>_e(()=>import("./swift-C2oV4EkX.js"),[]),dart:()=>_e(()=>import("./dart-bE4Kk8sk.js"),[]),r:()=>_e(()=>import("./r-Cf5RLm7j.js"),[]),lua:()=>_e(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([67,59])),sql:()=>_e(()=>import("./sql-CRqJ_cUM.js"),[]),graphql:()=>_e(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([62,53,63,64,65])),proto:()=>_e(()=>import("./proto-C7zT0LnQ.js"),[]),dockerfile:()=>_e(()=>import("./dockerfile-BcOcwvcX.js"),[]),makefile:()=>_e(()=>import("./makefile-CHLpvVh8.js"),[]),diff:()=>_e(()=>import("./diff-D97Zzqfu.js"),[]),wasm:()=>_e(()=>import("./wasm-MzD3tlZU.js"),[])},Y5e={js:"javascript",node:"javascript",ts:"typescript",sh:"bash",zsh:"bash",shell:"bash",ps1:"powershell",py:"python",htm:"html",yml:"yaml",md:"markdown",svg:"xml","c++":"cpp",cc:"cpp",cxx:"cpp",cs:"csharp","c#":"csharp",rs:"rust",golang:"go",rb:"ruby",kt:"kotlin",gql:"graphql",protobuf:"proto",docker:"dockerfile",make:"makefile"},J5e=new Set(["","text","txt","plaintext","plain"]);let lm;const yb=new Map;function Z5e(e){const t=Y5e[e];return t||(Object.prototype.hasOwnProperty.call(kP,e)?e:void 0)}function X5e(){if(lm)return lm;const e=(async()=>{const{createHighlighterCore:t}=await _e(async()=>{const{createHighlighterCore:s}=await import("./core-CcNJeiz-.js");return{createHighlighterCore:s}},__vite__mapDeps([71,1,2,10,3,4,8])),{createJavaScriptRegexEngine:n}=await _e(async()=>{const{createJavaScriptRegexEngine:s}=await import("./engine-javascript-D5Xfc425.js");return{createJavaScriptRegexEngine:s}},[]);return t({themes:[_e(()=>import("./github-light-default-D7oLnXFd.js"),[]).then(s=>s.default),_e(()=>import("./github-dark-default-Cuk6v7N8.js"),[]).then(s=>s.default)],langs:[],engine:n()})})().catch(t=>{throw lm=void 0,t});return lm=e,e}function Q5e(e,t){const n=yb.get(t);if(n)return n;const s=kP[t]().then(a=>e.loadLanguage(a.default)).catch(a=>{throw yb.delete(t),a});return yb.set(t,s),s}async function e4e(e,t){const n=await X5e(),s=t.trim().toLowerCase(),a=J5e.has(s),i=a?void 0:Z5e(s);if(!a&&!i)throw new Error(`No bundled grammar for ${s}`);return i&&await Q5e(n,i),n.codeToHtml(e,{lang:i??"text",themes:{light:V5e,dark:G5e},defaultColor:"light-dark()"})}const zI=(e,t)=>`${e}:${yP(t)}`,t4e=1e5,LI="inline-flex size-7 touch:size-11 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60";function vP({copied:e,onCopy:t,copyLabel:n,items:s}){return r.jsxs("div",{"data-code-plate":!0,className:"absolute end-1 top-1 z-[1] flex gap-0.5 rounded-full bg-composer p-0.5 opacity-0 ring-[0.5px] ring-ink/10 transition-opacity focus-within:opacity-100 group-hover/code:opacity-100 touch:opacity-100 has-[[aria-expanded=true]]:opacity-100",children:[r.jsx("button",{type:"button",onClick:t,className:LI,title:e==="copied"?l("code.copiedTitle"):e==="failed"?l("common.copyFailed"):n,"aria-label":e==="copied"?l("code.copiedTitle"):e==="failed"?l("common.copyFailed"):n,children:e==="failed"?r.jsx(Ae,{size:14,className:"text-danger","aria-hidden":"true"}):e==="copied"?r.jsx(Ie,{size:14,className:"text-success","aria-hidden":"true"}):r.jsx(fn,{size:14,"aria-hidden":"true"})}),e!=="idle"&&r.jsx("span",{role:"status",className:"sr-only",children:e==="failed"?l("common.copyFailed"):l("code.copiedTitle")}),r.jsx(Ps,{items:s,ariaLabel:l("chat.more"),placement:"above",align:"end",triggerTitle:l("chat.more"),triggerClassName:"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60",renderTrigger:()=>r.jsx("span",{className:LI,children:r.jsx(fs,{size:14,"aria-hidden":"true"})})})]})}function n4e({code:e,lang:t,initialWrap:n=!1}){const s=!et(),a=f.useRef(null),i=y5e(a),o=e.length<=t4e,[c,d]=f.useState(()=>o&&i?_i.get(zI(t,e))??null:null),u=f.useMemo(()=>c?{__html:c}:null,[c]),{state:p,copy:m}=ba(e),[h,x]=f.useState(n);f.useEffect(()=>{x(n)},[n]),f.useEffect(()=>{if(!o)return d(null);if(!i)return;const b=zI(t,e),w=_i.get(b);if(w)return d(w);let j=!0;return e4e(e,t||"text").then(S=>{j&&(K5e(b,S),d(S))}).catch(()=>{}),()=>{j=!1}},[e,t,o,i]);const g=()=>{const b=C3e(t);E3e(b,e)},k=N3e(t),v=S3e(e),y=(b,w)=>u?r.jsx("div",{className:I(`text-[13px] [&_pre]:!bg-transparent [&_pre]:m-0 ${b}`,h?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"),dangerouslySetInnerHTML:u}):r.jsx("pre",{className:I(`text-[13px] ${b.replaceAll("[&_pre]:","")}`,w,h?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"),children:e});return s?r.jsxs("div",{ref:a,dir:"ltr",className:"chat-code-block group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]",children:[r.jsx(vP,{copied:p,onCopy:m,copyLabel:l("code.copyTitle"),items:[{key:"wrap",label:l("code.wrapLines"),icon:r.jsx(Bd,{size:14,"aria-hidden":"true"}),active:h,onSelect:()=>x(b=>!b)},{key:"save",label:l("code.saveAsFile"),icon:r.jsx(Ft,{size:14,"aria-hidden":"true"}),onSelect:g},{key:"about",label:l("code.caption",{language:k,lines:hI(v)}),disabled:!0,separatorBefore:!0,onSelect:()=>{}}]}),y("leading-5 [&_pre]:px-3 [&_pre]:py-2","text-ink-secondary")]}):r.jsxs("div",{ref:a,dir:"ltr",className:"chat-code-block my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r.jsx("span",{title:k,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:k}),v>0&&r.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:hI(v)})]}),r.jsxs("div",{className:"chat-code-actions flex shrink-0 items-center gap-1 whitespace-nowrap",children:[r.jsxs("button",{type:"button",onClick:()=>x(b=>!b),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${h?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:h?l("code.unwrapLong"):l("code.wrapLong"),"aria-label":h?l("code.unwrapLong"):l("code.wrapLong"),"aria-pressed":h,children:[r.jsx(Bd,{size:12,"aria-hidden":"true"}),r.jsx("span",{children:h?l("code.unwrap"):l("code.wrap")})]}),r.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:l("code.saveTitle"),"aria-label":l("code.saveTitle"),children:[r.jsx(Ft,{size:12,"aria-hidden":"true"}),r.jsx("span",{children:l("code.save")})]}),r.jsxs("button",{type:"button",onClick:m,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:p==="copied"?l("code.copiedTitle"):p==="failed"?l("common.copyFailed"):l("code.copyTitle"),"aria-label":p==="copied"?l("code.copiedAria"):p==="failed"?l("common.copyFailed"):l("code.copyAria"),children:[p==="failed"?r.jsx(Ae,{size:12,className:"text-danger","aria-hidden":"true"}):p==="copied"?r.jsx(Ie,{size:12,className:"text-success","aria-hidden":"true"}):r.jsx(fn,{size:12,"aria-hidden":"true"}),r.jsx("span",{"aria-hidden":"true",className:"hidden max-sm:inline touch:inline",children:l("code.copy")}),r.jsx("span",{role:"status",className:`max-sm:sr-only touch:sr-only ${p==="failed"?"text-danger font-medium":p==="copied"?"text-success font-medium":""}`,children:p==="failed"?l("common.copyFailed"):p==="copied"?l("code.copied"):l("code.copy")})]})]})]}),y("leading-relaxed [&_pre]:p-3","text-ink")]})}const $o=new Map,s4e=50;let PI=0;const DI=(e,t)=>`${e}:${yP(t)}`,wP=/^[a-zA-Z]:[\\/]/,$I=e=>e.startsWith("/")||wP.test(e)?e:null,up=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const n=new URL(e);if(n.username||n.password||n.port||n.search||n.hash)return null;const s=decodeURIComponent(n.pathname);return n.hostname&&n.hostname!=="localhost"?`//${n.hostname}${s}`:/^\/[a-z]:[\\/]/i.test(s)?s.slice(1):$I(s)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=$I(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function r4e(e,t="href"){if(j9(e)||rP(e))return e;const n=/^(?:[a-zA-Z]:%5C|%5C%5C)/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(n)||wP.test(n)||n.startsWith("\\\\")?up(n)?n:"":t==="href"&&/^obsidian:\/\//i.test(e)?e:AL(e)}function a4e(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(Lj)}function i4e(){return(e,t)=>{typeof t.value=="string"&&G3e(e,t.value)}}const Dk={},jP={singleTilde:!1};eP.call({data:()=>Dk},jP);const o4e={extensions:Dk.micromarkExtensions,mdastExtensions:[...Dk.fromMarkdownExtensions??[],Lj]};function l4e(){return e=>{const t=n=>{n.children&&(n.children=n.children.flatMap(s=>s?.type!=="text"||!s.value.includes(`
185
185
  `)?(t(s),[s]):s.value.split(`
186
- `).flatMap((a,i)=>[...i?[{type:"break"}]:[],...a?[{type:"text",value:a}]:[]])))};t(e)}}function c4e(){return e=>{const t=n=>{n.children&&(n.children=n.children.map(s=>{if(s?.type==="link"&&s.children?.length===1&&s.children[0]?.type==="image"){const a=s.children[0];return{...a,data:{...a.data,hProperties:{...a.data?.hProperties,"data-open-url":s.url}}}}return t(s),s}))};t(e)}}const d4e=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function u4e(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&d4e.test(t[0])?"rtl":"ltr"}function NP(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(NP).join(""):""}function ar(e){return u4e(NP(e))}function BI(e){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}const p4e='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function m4e({code:e}){const t=f.useRef(null),[n,s]=f.useState(0),[a,i]=f.useState(()=>$o.get(DI(BI(typeof document>"u"?null:document.documentElement),e))??null),o=f.useMemo(()=>a?{__html:a}:null,[a]),[c,d]=f.useState(null),[u,p]=f.useState(!1),{state:m,copy:h}=ba(e),x=!et();f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>s(v=>v+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=BI(t.current),v=DI(k,e),y=$o.get(v);if(y){i(y),d(null);return}let b=!0;return _e(()=>import("./mermaid.core-D8G0v7ax.js").then(w=>w.b6),__vite__mapDeps([72,1,2,73])).then(w=>(PI+=1,w.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:p4e}),w.default.render(`omb-mermaid-${PI}`,e))).then(w=>{if(b){if($o.size>=s4e){const j=$o.keys().next().value;j&&$o.delete(j)}$o.set(v,w.svg),i(w.svg),d(null)}}).catch(w=>{if(!b)return;const j=w instanceof Error?w.message:String(w);d(j.length>300?`${j.slice(0,300)}…`:j)}),()=>{b=!1}},[e,n]);const g=r.jsxs(r.Fragment,{children:[c&&r.jsx("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:l("chat.mermaid.failed",{error:c})}),o&&r.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:o}),(u||!a||c)&&r.jsx("pre",{className:I("overflow-x-auto text-[13px]",x?"px-3 py-2 leading-5 text-ink-secondary":"p-3 leading-relaxed text-ink"),children:e})]});return x?r.jsxs("div",{ref:t,dir:"ltr",className:"group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]",children:[r.jsx(vP,{copied:m,onCopy:h,copyLabel:l("code.copySource"),items:[{key:"source",label:l(u?"code.hideSource":"code.showSource"),icon:r.jsx(Bd,{size:14,"aria-hidden":"true"}),active:u,onSelect:()=>p(k=>!k)},{key:"about",label:l("code.mermaid"),disabled:!0,separatorBefore:!0,onSelect:()=>{}}]}),g]}):r.jsxs("div",{ref:t,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[r.jsx("span",{title:l("chat.mermaid.title"),className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:l("chat.mermaid.title")}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[r.jsxs("button",{type:"button",onClick:()=>p(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${u?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:l(u?"chat.mermaid.hideSourceTitle":"chat.mermaid.showSourceTitle"),"aria-label":l(u?"chat.mermaid.hideSourceTitle":"chat.mermaid.showSourceTitle"),"aria-pressed":u,children:[r.jsx(Bd,{size:12,"aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:l(u?"chat.mermaid.hideSource":"chat.mermaid.showSource")})]}),r.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:m==="copied"?l("chat.code.copied"):m==="failed"?l("common.copyFailed"):l("chat.mermaid.copy"),"aria-label":m==="copied"?l("chat.mermaid.copiedLabel"):m==="failed"?l("common.copyFailed"):l("chat.mermaid.copyLabel"),children:m==="failed"?r.jsxs(r.Fragment,{children:[r.jsx(Ae,{size:12,className:"text-danger","aria-hidden":"true"}),r.jsx("span",{className:"text-danger font-medium hidden sm:inline",children:l("common.copyFailed")})]}):m==="copied"?r.jsxs(r.Fragment,{children:[r.jsx(Ie,{size:12,className:"text-success","aria-hidden":"true"}),r.jsx("span",{className:"text-success font-medium hidden sm:inline",children:l("chat.code.copiedShort")})]}):r.jsxs(r.Fragment,{children:[r.jsx(fn,{size:12,"aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:l("common.copy")})]})})]})]}),g]})}function f4e({filePath:e,name:t,source:n,children:s,message:a}){const i=mg(e,t,a),o=Bj(e,t??yl(e),a),c=gP();if(!a)return r.jsx("span",{title:l("chat.file.legacy"),className:"break-words text-ink-secondary",children:s});const d=i.state==="saving"?l("common.saving"):i.state==="saved"?l("common.saved"):i.state==="failed"?l("chat.retry"):null;return r.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",...c.targetProps(n),children:[c.menu,o.opens?r.jsx(Fj,{name:t??yl(e),save:i,retryable:i.retryable}):r.jsx(qj,{path:e,name:t??yl(e),message:a}),r.jsxs("button",{type:"button",onClick:o.opens?o.show:()=>{i.save()},disabled:!o.opens&&i.state==="saving",title:o.opens?o.label:l("chat.file.saveCopy"),className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[s,o.opens?r.jsx(Ur,{size:12,className:"shrink-0","aria-hidden":"true"}):i.state==="saving"?r.jsx(ye,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):i.state==="saved"?r.jsx(Ie,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):i.state==="failed"?i.retryable&&r.jsx(jr,{size:12,className:"shrink-0","aria-hidden":"true"}):r.jsx(Ft,{size:12,className:"shrink-0","aria-hidden":"true"})]}),d&&r.jsx("span",{role:i.state==="failed"?"alert":"status",title:i.state==="saved"?i.savedTo:void 0,className:`text-[12px] ${i.state==="saved"?"text-success":i.state==="failed"?"text-danger":"text-ink-secondary"}`,children:i.state==="failed"?Uj(i):d}),i.state==="failed"&&i.outsideWorkspace&&r.jsx("span",{className:"inline-flex flex-wrap items-center gap-x-1.5 text-[12px]",children:r.jsx(Hj,{filePath:e})}),i.folder&&r.jsx($5e,{folderPath:e,listing:i.folder,message:a}),o.dialog]})}function h4e({children:e}){const[t,n]=f.useState(!1);return t?r.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,r.jsx("button",{type:"button","aria-label":l("chat.spoiler.hide"),title:l("chat.spoiler.hide"),onClick:()=>n(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:l("chat.spoiler.hideShort")})]}):r.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[r.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),r.jsx("button",{type:"button","aria-label":l("chat.spoiler.reveal"),title:l("chat.spoiler.reveal"),onClick:()=>n(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const $k=[],x4e="![",g4e=new RegExp("(?<![$\\p{L}\\p{N}])(?:R|US|AU|A|CA|C|NZ|HK|SG|S|MX|NT|BZ|Z)\\$(?=[ \\t\\u00a0]?\\d)","gu");function b4e(e){const t=[],n=e.replace(/\$\$[\s\S]*?\$\$/g,c=>`\0OMB_MATH_${t.push(c)-1}\0`).replace(g4e,c=>`${c.slice(0,-1)}\\$`),s=new Set,a=[];for(let c=0;c<n.length;c++)n[c]==="\\"?c++:n[c]==="$"&&a.push(c);let i=null;for(const c of a){if(i!==null){if(!/\s/.test(n[c-1])&&!/\d/.test(n[c+1]??"")&&!/\n[ \t]*\n/.test(n.slice(i,c))){i=null;continue}s.add(i)}i=/\S/.test(n[c+1]??"")?c:null,i===null&&s.add(c)}i!==null&&s.add(i);let o="";for(let c=0;c<n.length;c++)o+=s.has(c)?"\\$":n[c];return t.forEach((c,d)=>{o=o.split(`\0OMB_MATH_${d}\0`).join(c)}),o}function y4e(e,t){const n=[],s=(u,p)=>{const m=`\0OMB_CODE_${n.length}\0`;return n.push({value:u,sourceOffset:p}),m},a=[],i=[],o=(u,p=!1)=>{const m=u.position?.start.offset,h=u.position?.end.offset,x=u.type==="image"||u.type==="imageReference";x&&m!==void 0&&i.push(m);const g=u.type==="link"&&m!==void 0&&e[m]==="["?u.children?.at(-1)?.position?.end.offset:void 0,k=u.type==="code"||u.type==="inlineCode"||u.type==="definition"||u.type==="linkReference"||u.type==="link"||t!==void 0&&x;!p&&k&&m!==void 0&&h!==void 0&&a.push({start:g??m,end:h}),u.children?.forEach(v=>o(v,p||k&&g===void 0))};o(cg(e,o4e));for(const{start:u,end:p}of a.sort((m,h)=>h.start-m.start))e=e.slice(0,u)+s(e.slice(u,p),u)+e.slice(p);let c=e.replace(/\\\[([\s\S]*?)\\\]/g,(u,p)=>`$$
186
+ `).flatMap((a,i)=>[...i?[{type:"break"}]:[],...a?[{type:"text",value:a}]:[]])))};t(e)}}function c4e(){return e=>{const t=n=>{n.children&&(n.children=n.children.map(s=>{if(s?.type==="link"&&s.children?.length===1&&s.children[0]?.type==="image"){const a=s.children[0];return{...a,data:{...a.data,hProperties:{...a.data?.hProperties,"data-open-url":s.url}}}}return t(s),s}))};t(e)}}const d4e=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function u4e(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&d4e.test(t[0])?"rtl":"ltr"}function NP(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(NP).join(""):""}function ar(e){return u4e(NP(e))}function BI(e){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}const p4e='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function m4e({code:e}){const t=f.useRef(null),[n,s]=f.useState(0),[a,i]=f.useState(()=>$o.get(DI(BI(typeof document>"u"?null:document.documentElement),e))??null),o=f.useMemo(()=>a?{__html:a}:null,[a]),[c,d]=f.useState(null),[u,p]=f.useState(!1),{state:m,copy:h}=ba(e),x=!et();f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>s(v=>v+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=BI(t.current),v=DI(k,e),y=$o.get(v);if(y){i(y),d(null);return}let b=!0;return _e(()=>import("./mermaid.core-CnUFOtXD.js").then(w=>w.b6),__vite__mapDeps([72,1,2,73])).then(w=>(PI+=1,w.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:p4e}),w.default.render(`omb-mermaid-${PI}`,e))).then(w=>{if(b){if($o.size>=s4e){const j=$o.keys().next().value;j&&$o.delete(j)}$o.set(v,w.svg),i(w.svg),d(null)}}).catch(w=>{if(!b)return;const j=w instanceof Error?w.message:String(w);d(j.length>300?`${j.slice(0,300)}…`:j)}),()=>{b=!1}},[e,n]);const g=r.jsxs(r.Fragment,{children:[c&&r.jsx("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:l("chat.mermaid.failed",{error:c})}),o&&r.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:o}),(u||!a||c)&&r.jsx("pre",{className:I("overflow-x-auto text-[13px]",x?"px-3 py-2 leading-5 text-ink-secondary":"p-3 leading-relaxed text-ink"),children:e})]});return x?r.jsxs("div",{ref:t,dir:"ltr",className:"group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]",children:[r.jsx(vP,{copied:m,onCopy:h,copyLabel:l("code.copySource"),items:[{key:"source",label:l(u?"code.hideSource":"code.showSource"),icon:r.jsx(Bd,{size:14,"aria-hidden":"true"}),active:u,onSelect:()=>p(k=>!k)},{key:"about",label:l("code.mermaid"),disabled:!0,separatorBefore:!0,onSelect:()=>{}}]}),g]}):r.jsxs("div",{ref:t,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[r.jsx("span",{title:l("chat.mermaid.title"),className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:l("chat.mermaid.title")}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[r.jsxs("button",{type:"button",onClick:()=>p(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${u?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:l(u?"chat.mermaid.hideSourceTitle":"chat.mermaid.showSourceTitle"),"aria-label":l(u?"chat.mermaid.hideSourceTitle":"chat.mermaid.showSourceTitle"),"aria-pressed":u,children:[r.jsx(Bd,{size:12,"aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:l(u?"chat.mermaid.hideSource":"chat.mermaid.showSource")})]}),r.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:m==="copied"?l("chat.code.copied"):m==="failed"?l("common.copyFailed"):l("chat.mermaid.copy"),"aria-label":m==="copied"?l("chat.mermaid.copiedLabel"):m==="failed"?l("common.copyFailed"):l("chat.mermaid.copyLabel"),children:m==="failed"?r.jsxs(r.Fragment,{children:[r.jsx(Ae,{size:12,className:"text-danger","aria-hidden":"true"}),r.jsx("span",{className:"text-danger font-medium hidden sm:inline",children:l("common.copyFailed")})]}):m==="copied"?r.jsxs(r.Fragment,{children:[r.jsx(Ie,{size:12,className:"text-success","aria-hidden":"true"}),r.jsx("span",{className:"text-success font-medium hidden sm:inline",children:l("chat.code.copiedShort")})]}):r.jsxs(r.Fragment,{children:[r.jsx(fn,{size:12,"aria-hidden":"true"}),r.jsx("span",{className:"hidden sm:inline",children:l("common.copy")})]})})]})]}),g]})}function f4e({filePath:e,name:t,source:n,children:s,message:a}){const i=mg(e,t,a),o=Bj(e,t??yl(e),a),c=gP();if(!a)return r.jsx("span",{title:l("chat.file.legacy"),className:"break-words text-ink-secondary",children:s});const d=i.state==="saving"?l("common.saving"):i.state==="saved"?l("common.saved"):i.state==="failed"?l("chat.retry"):null;return r.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",...c.targetProps(n),children:[c.menu,o.opens?r.jsx(Fj,{name:t??yl(e),save:i,retryable:i.retryable}):r.jsx(qj,{path:e,name:t??yl(e),message:a}),r.jsxs("button",{type:"button",onClick:o.opens?o.show:()=>{i.save()},disabled:!o.opens&&i.state==="saving",title:o.opens?o.label:l("chat.file.saveCopy"),className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[s,o.opens?r.jsx(Ur,{size:12,className:"shrink-0","aria-hidden":"true"}):i.state==="saving"?r.jsx(ye,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):i.state==="saved"?r.jsx(Ie,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):i.state==="failed"?i.retryable&&r.jsx(jr,{size:12,className:"shrink-0","aria-hidden":"true"}):r.jsx(Ft,{size:12,className:"shrink-0","aria-hidden":"true"})]}),d&&r.jsx("span",{role:i.state==="failed"?"alert":"status",title:i.state==="saved"?i.savedTo:void 0,className:`text-[12px] ${i.state==="saved"?"text-success":i.state==="failed"?"text-danger":"text-ink-secondary"}`,children:i.state==="failed"?Uj(i):d}),i.state==="failed"&&i.outsideWorkspace&&r.jsx("span",{className:"inline-flex flex-wrap items-center gap-x-1.5 text-[12px]",children:r.jsx(Hj,{filePath:e})}),i.folder&&r.jsx($5e,{folderPath:e,listing:i.folder,message:a}),o.dialog]})}function h4e({children:e}){const[t,n]=f.useState(!1);return t?r.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,r.jsx("button",{type:"button","aria-label":l("chat.spoiler.hide"),title:l("chat.spoiler.hide"),onClick:()=>n(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:l("chat.spoiler.hideShort")})]}):r.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[r.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),r.jsx("button",{type:"button","aria-label":l("chat.spoiler.reveal"),title:l("chat.spoiler.reveal"),onClick:()=>n(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const $k=[],x4e="![",g4e=new RegExp("(?<![$\\p{L}\\p{N}])(?:R|US|AU|A|CA|C|NZ|HK|SG|S|MX|NT|BZ|Z)\\$(?=[ \\t\\u00a0]?\\d)","gu");function b4e(e){const t=[],n=e.replace(/\$\$[\s\S]*?\$\$/g,c=>`\0OMB_MATH_${t.push(c)-1}\0`).replace(g4e,c=>`${c.slice(0,-1)}\\$`),s=new Set,a=[];for(let c=0;c<n.length;c++)n[c]==="\\"?c++:n[c]==="$"&&a.push(c);let i=null;for(const c of a){if(i!==null){if(!/\s/.test(n[c-1])&&!/\d/.test(n[c+1]??"")&&!/\n[ \t]*\n/.test(n.slice(i,c))){i=null;continue}s.add(i)}i=/\S/.test(n[c+1]??"")?c:null,i===null&&s.add(c)}i!==null&&s.add(i);let o="";for(let c=0;c<n.length;c++)o+=s.has(c)?"\\$":n[c];return t.forEach((c,d)=>{o=o.split(`\0OMB_MATH_${d}\0`).join(c)}),o}function y4e(e,t){const n=[],s=(u,p)=>{const m=`\0OMB_CODE_${n.length}\0`;return n.push({value:u,sourceOffset:p}),m},a=[],i=[],o=(u,p=!1)=>{const m=u.position?.start.offset,h=u.position?.end.offset,x=u.type==="image"||u.type==="imageReference";x&&m!==void 0&&i.push(m);const g=u.type==="link"&&m!==void 0&&e[m]==="["?u.children?.at(-1)?.position?.end.offset:void 0,k=u.type==="code"||u.type==="inlineCode"||u.type==="definition"||u.type==="linkReference"||u.type==="link"||t!==void 0&&x;!p&&k&&m!==void 0&&h!==void 0&&a.push({start:g??m,end:h}),u.children?.forEach(v=>o(v,p||k&&g===void 0))};o(cg(e,o4e));for(const{start:u,end:p}of a.sort((m,h)=>h.start-m.start))e=e.slice(0,u)+s(e.slice(u,p),u)+e.slice(p);let c=e.replace(/\\\[([\s\S]*?)\\\]/g,(u,p)=>`$$
187
187
  ${p}
188
188
  $$`).replace(/\\\(([\s\S]*?)\\\)/g,(u,p)=>`$${p.trim()}$`).replace(/\$\$[ \t]*([^\n][\s\S]*?)[ \t]*\$\$/g,(u,p)=>`$$
189
189
  ${p}
190
- $$`);c=b4e(c);let d=0;return c=c.replace(/\u0000OMB_CODE_(\d+)\u0000/g,(u,p,m)=>{const h=n[Number(p)];if(!h)return u;const{value:x,sourceOffset:g}=h;for(const k of i)k>=g&&k<g+x.length&&t?.set(m+d+k-g,k);return d+=x.length-u.length,x}),c}const Lc=new Map,k4e=li*2;function v4e(e){const t=Lc.get(e);if(t)return t;const n=e.includes(x4e)?new Map:void 0,s=y4e(n?e:z3e(e),n);if(Lc.size>=k4e){const i=Lc.keys().next().value;i!==void 0&&Lc.delete(i)}const a={source:s,imageOffsets:n};return Lc.set(e,a),a}let Nd=null,kb=null;function w4e(){return Nd?Promise.resolve():(kb??=_e(()=>import("./index-DxGSNARA.js"),__vite__mapDeps([74,75,1,2,10,3,4,8])).then(async e=>{typeof document<"u"&&await _e(()=>Promise.resolve({}),__vite__mapDeps([76])),Nd=e.default}).catch(e=>{throw kb=null,e}),kb)}function j4e(e){for(let t=0;t<e.length;t++){if(e.charCodeAt(t)===92){t+=1;continue}if(e[t]!=="$")continue;const n=e[t+1];if(n===void 0)return!1;if(n==="$"){if(e.indexOf("$$",t+2)!==-1)return!0;t+=1;continue}return e.indexOf("$",t+1)!==-1}return!1}const yl=e=>e.split(/[\\/]/).at(-1)??e,Wj=f.createContext({threads:[]});function N4e({node:e,children:t}){const n=Array.isArray(t)?t[0]:t,s=n?.props?.className??"",{lang:a,wrap:i}=A3e(/language-([^\s]+)/.exec(s)?.[1]??"",e?.children?.[0]?.data?.meta),o=d=>typeof d=="string"?d:Array.isArray(d)?d.map(o).join(""):d?.props?.children?o(d.props.children):"",c=o(n?.props?.children).replace(/\n$/,"");return a.trim().toLowerCase()==="mermaid"?r.jsx(m4e,{code:c}):r.jsx(n4e,{code:c,lang:a,initialWrap:i})}function S4e(e){const{message:t,imageOffsets:n}=f.useContext(Wj),{src:s,alt:a}=e;if(!s)return r.jsx("span",{className:"text-[12px] text-danger",role:"alert",children:l("attach.imageUnavailable")});const i=up(s)??void 0,o=e.node?.position?.start.offset;return r.jsx(q5e,{src:s,name:T3e(s,a),openUrl:_3e(typeof e["data-open-url"]=="string"?String(e["data-open-url"]):s),filePath:i,message:i?t:void 0,sourceOffset:o===void 0?void 0:n?.get(o)??o})}function I4e({href:e,children:t,...n}){const s=n,{threads:a,currentBotId:i,message:o,delivered:c,originals:d}=f.useContext(Wj),u=$ge(e),p=Pj();if(!e)return r.jsx("span",{className:"break-words",children:t});if(rP(e))return r.jsx(aje,{children:t});const m=ou(e),h=m?Mx(a,m,i):null;if(h)return r.jsx(b2,{target:h,ambiguous:h.ambiguous,children:t});if(m||j9(e))return r.jsx("span",{className:"break-words",children:t});const x=up(e);if(x){const v=c&&Object.hasOwn(c,yl(x))?c[yl(x)]:void 0,y=v&&d&&Object.hasOwn(d,v)?d[v]:void 0;return r.jsx(f4e,{filePath:v??x,name:v?yl(x):void 0,source:y,message:o,children:t})}if(!/^https?:\/\//i.test(e))return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",dir:"auto",className:kI,children:t});const g=fje(s,e),k=g?cP[g.kind]:null;return r.jsx(vje,{href:e,github:g,children:v=>{const y=sje(e,p,u.onContextMenu?{...v,onContextMenu:u.onContextMenu}:v);return r.jsxs(r.Fragment,{children:[u.menu,k?r.jsxs("a",{...y,href:e,target:"_blank",rel:"noreferrer",dir:"ltr",title:e,"data-github-ref":g.kind,className:rje,children:[r.jsx(k,{size:13,"aria-hidden":"true",className:"shrink-0 self-center text-ink-tertiary"}),r.jsx("span",{children:t})]}):r.jsx("a",{...y,href:e,target:"_blank",rel:"noreferrer",dir:"auto",className:kI,children:t})]})}})}const C4e={pre:N4e,img:S4e,code({children:e}){return r.jsx("code",{dir:"ltr",className:"ui-code-chip break-words [unicode-bidi:isolate]",children:e})},span(e){const t=_re(e);if(t)return r.jsx(b2,{target:t.target,ambiguous:t.ambiguous,children:e.children});const{node:n,children:s,...a}=e;return r.jsx("span",{...a,children:s})},a:I4e,table({node:e,children:t}){return r.jsx(H5e,{direction:ar(e),children:t})},th({children:e}){return r.jsx("th",{className:"border-b border-hairline/40 px-2 py-1.5 text-start font-semibold",children:e})},td({children:e}){return r.jsx("td",{className:"border-b border-hairline/20 px-2 py-1.5 align-top",children:e})},p({node:e,children:t}){return r.jsx("p",{dir:ar(e),children:t})},ul({node:e,children:t}){return r.jsx("ul",{dir:ar(e),className:"list-disc space-y-1 ps-5",children:t})},ol({node:e,children:t}){return r.jsx("ol",{dir:ar(e),className:"list-decimal space-y-1 ps-5",children:t})},h1({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"md-heading mt-3 text-[20px] font-semibold leading-[26px] tracking-[-0.01em]",children:t})},h2({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"md-heading mt-2 text-[17px] font-semibold leading-6 tracking-[-0.005em]",children:t})},h3({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 font-semibold",children:t})},h4({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 font-semibold",children:t})},h5({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 text-[14px] font-semibold",children:t})},h6({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 text-[14px] font-semibold text-ink-secondary",children:t})},blockquote({node:e,children:t}){return r.jsx("blockquote",{dir:ar(e),className:"border-s-2 border-hairline ps-3 text-ink-secondary",children:t})},del({children:e}){return r.jsx(h4e,{children:e})},hr(){return r.jsx("hr",{className:"border-hairline/40"})}},E4e=/#[^\s#]|openmausbot/i,A4e={threads:[]},T4e=[[eP,jP],y3e,a4e,i4e,c4e,l4e,mje],_4e=[];let vb=null;const M4e=e=>e?(vb?.plugin!==e&&(vb={plugin:e,list:[e]}),vb.list):_4e,R4e=j3e(),FI=new WeakMap,O4e=e=>{let t=FI.get(e);return t===void 0&&(t=e.map(n=>`${n.name}${n.hidden?1:0}${n.person?1:0}${n.color??""}`).join(""),FI.set(e,t)),t},qI=new WeakMap;let z4e=0;const L4e=e=>{let t=qI.get(e);return t===void 0&&qI.set(e,t=++z4e),t};function P4e({text:e,message:t,mentionPeers:n=$k,everyone:s=!1,mentionPerson:a,delivered:i,originals:o}){const{threads:c,currentBotId:d}=E4e.test(e)?f.use(g2):A4e,{source:u,imageOffsets:p}=v4e(e),m=j4e(u),[h,x]=f.useState(()=>Nd!==null);f.useEffect(()=>{if(!m)return;if(Nd){x(!0);return}let w=!0;return w4e().then(()=>{w&&x(!0)},()=>{}),()=>{w=!1}},[m]);const g=m&&h?Nd:null,k=u.includes("@"),v=c.length>0,y=`${g?"math":""}${k?`${O4e(n)}${s?1:0}${a?.profileName??""}`:""}${v?`${L4e(c)}${d??""}`:""}`,b=R4e.render(e,y,()=>{const w=[...T4e];return k&&w.push([dre,{peers:n,everyone:s,person:a}]),v&&w.push(Cre(c,d)),Xve({children:u,remarkPlugins:w,rehypePlugins:M4e(g),urlTransform:r4e,components:C4e})});return r.jsx(Wj.Provider,{value:{message:t,imageOffsets:p,threads:c,currentBotId:d,delivered:i,originals:o},children:r.jsx("div",{className:"chat-md min-w-0 [&>*+*]:mt-2",children:b})})}function D4e(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,s)=>{const a=t[s];return n.name===a.name&&n.hidden===a.hidden&&n.color===a.color&&n.person===a.person})}const aa=f.memo(P4e,(e,t)=>e.text===t.text&&D4e(e.mentionPeers??$k,t.mentionPeers??$k)&&e.everyone===t.everyone&&ire(e.mentionPerson,t.mentionPerson)&&e.message?.threadId===t.message?.threadId&&e.message?.messageId===t.message?.messageId&&UI(e.delivered,t.delivered)&&UI(e.originals,t.originals));function UI(e,t){if(e===t)return!0;const n=Object.entries(e??{}),s=t??{};return n.length===Object.keys(s).length&&n.every(([a,i])=>s[a]===i)}const HI=new Set;function $4e(e,t){if(!t?.busy||!Number.isFinite(t.turnStartedAt)||t.turnStartedAt==null)return HI;const n=new Set(e.filter(a=>a.turnId&&(a.turnTerminal||a.turnCompletedAt!=null)).map(a=>a.turnId)),s=new Set;for(const a of e)a.kind==="activity"&&a.at>=t.turnStartedAt&&!a.turnTerminal&&a.turnCompletedAt==null&&(!a.turnId||!n.has(a.turnId))&&s.add(a.id);return s.size===0?HI:s}const SP=f.createContext(new Set),B4e=(e,t)=>e.size===t.size&&[...e].every(n=>t.has(n));function IP(e,t){const n=f.useRef(null),{busy:s,turnStartedAt:a}=t;return f.useMemo(()=>{const i=$4e(e,{busy:s,turnStartedAt:a});return n.current&&B4e(n.current,i)?n.current:n.current=i},[e,s,a])}function WI(e){if(!Number.isFinite(e)||e<=0)return"0:00";const t=Math.floor(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function CP({attachment:e,className:t}){const n=wne(e.path),s=f.useRef(null),a=f.useRef(null),[i,o]=f.useState(!1),[c,d]=f.useState(typeof e.durationMs=="number"&&e.durationMs>0?e.durationMs/1e3:null),[u,p]=f.useState(0),[m,h]=f.useState(!1),x=e.text?.trim()??"",g=xs(Kr().phase);if(f.useEffect(()=>()=>a.current?.(),[]),!n)return null;const k=b=>{b&&a.current!==b||(a.current?.(),a.current=null)},v=()=>{const b=s.current;if(!b)return;if(!b.paused){b.pause();return}if(g)return;a.current?.();const w=Gt.claimExternalVoice(()=>b.pause());a.current=w,b.play().catch(()=>k(w))},y=b=>{const w=s.current;w&&Number.isFinite(b)&&(w.currentTime=b),p(b)};return r.jsxs("div",{className:I("flex w-full flex-col rounded-xl bg-inset/60 px-3 py-2",t),"data-test-voice-note":"",children:[r.jsxs("div",{className:"flex w-full items-center gap-3",children:[r.jsx("audio",{ref:s,src:n,preload:"metadata",onLoadedMetadata:b=>{const w=b.currentTarget.duration;Number.isFinite(w)&&w>0&&d(w)},onTimeUpdate:b=>p(b.currentTarget.currentTime),onPlay:()=>o(!0),onPause:b=>{b.currentTarget.paused&&(o(!1),k())},onEnded:()=>{o(!1),k()}}),r.jsx("button",{type:"button",onClick:v,disabled:g&&!i,"aria-label":i?l("chat.voiceNote.pause"):g?l("chat.voiceNote.onLiveCall"):l("chat.voiceNote.play"),title:i?l("chat.voiceNote.pause"):g?l("chat.voiceNote.onLiveCall"):l("chat.voiceNote.play"),className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-accent text-white transition-opacity hover:opacity-90 disabled:opacity-40",children:i?r.jsx(mw,{size:13,className:"fill-current"}):r.jsx(ix,{size:13,className:"translate-x-px fill-current"})}),r.jsx("input",{type:"range","aria-label":l("chat.voiceNote.seek"),min:0,max:c??0,step:.1,value:Math.min(u,c??u),onChange:b=>y(Number(b.currentTarget.value)),disabled:!c,className:"h-1 flex-1 accent-accent"}),r.jsxs("span",{className:"shrink-0 text-[11px] tabular-nums text-ink-secondary",children:[WI(u)," / ",c===null?"--:--":WI(c)]})]}),x&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>h(b=>!b),"data-test-voice-note-transcript":"","aria-expanded":m,className:"mt-1 flex items-center gap-0.5 self-start text-[12px] text-ink-secondary transition-colors hover:text-ink",children:[r.jsx(at,{size:12,"aria-hidden":"true",className:I("transition-transform duration-150",m&&"rotate-90")}),l("chat.voiceNote.transcript")]}),m&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[13px] leading-snug text-ink",children:x})]})]})}function EP({active:e,onToggle:t,className:n}){const s=l(e?"chat.showRenderedMarkdown":"chat.showRawMarkdown");return r.jsx("button",{type:"button",onClick:t,"aria-label":s,"aria-pressed":e,title:s,className:I("rounded-md p-1.5 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-100",e?"bg-raised text-accent opacity-100":"text-ink-secondary opacity-0 hover:bg-raised hover:text-ink",n),children:e?r.jsx(Ur,{...Yt,"aria-hidden":"true"}):r.jsx(lE,{...Yt,"aria-hidden":"true"})})}function AP({text:e,className:t}){return r.jsx("pre",{dir:"auto","data-testid":"raw-markdown-view",tabIndex:0,className:I("max-h-[36rem] overflow-auto whitespace-pre-wrap break-words rounded-lg border border-hairline/30 bg-inset/50 p-3 font-mono text-[13px] leading-relaxed text-ink select-text",t),children:e})}const KI=140;function F4e(e){if(e.roomRequest?.phase!=="result")return null;const t=e.tool?.output?.trim();if(!t)return null;const[n="",...s]=t.split(`
190
+ $$`);c=b4e(c);let d=0;return c=c.replace(/\u0000OMB_CODE_(\d+)\u0000/g,(u,p,m)=>{const h=n[Number(p)];if(!h)return u;const{value:x,sourceOffset:g}=h;for(const k of i)k>=g&&k<g+x.length&&t?.set(m+d+k-g,k);return d+=x.length-u.length,x}),c}const Lc=new Map,k4e=li*2;function v4e(e){const t=Lc.get(e);if(t)return t;const n=e.includes(x4e)?new Map:void 0,s=y4e(n?e:z3e(e),n);if(Lc.size>=k4e){const i=Lc.keys().next().value;i!==void 0&&Lc.delete(i)}const a={source:s,imageOffsets:n};return Lc.set(e,a),a}let Nd=null,kb=null;function w4e(){return Nd?Promise.resolve():(kb??=_e(()=>import("./index-DjRLXqpq.js"),__vite__mapDeps([74,75,1,2,10,3,4,8])).then(async e=>{typeof document<"u"&&await _e(()=>Promise.resolve({}),__vite__mapDeps([76])),Nd=e.default}).catch(e=>{throw kb=null,e}),kb)}function j4e(e){for(let t=0;t<e.length;t++){if(e.charCodeAt(t)===92){t+=1;continue}if(e[t]!=="$")continue;const n=e[t+1];if(n===void 0)return!1;if(n==="$"){if(e.indexOf("$$",t+2)!==-1)return!0;t+=1;continue}return e.indexOf("$",t+1)!==-1}return!1}const yl=e=>e.split(/[\\/]/).at(-1)??e,Wj=f.createContext({threads:[]});function N4e({node:e,children:t}){const n=Array.isArray(t)?t[0]:t,s=n?.props?.className??"",{lang:a,wrap:i}=A3e(/language-([^\s]+)/.exec(s)?.[1]??"",e?.children?.[0]?.data?.meta),o=d=>typeof d=="string"?d:Array.isArray(d)?d.map(o).join(""):d?.props?.children?o(d.props.children):"",c=o(n?.props?.children).replace(/\n$/,"");return a.trim().toLowerCase()==="mermaid"?r.jsx(m4e,{code:c}):r.jsx(n4e,{code:c,lang:a,initialWrap:i})}function S4e(e){const{message:t,imageOffsets:n}=f.useContext(Wj),{src:s,alt:a}=e;if(!s)return r.jsx("span",{className:"text-[12px] text-danger",role:"alert",children:l("attach.imageUnavailable")});const i=up(s)??void 0,o=e.node?.position?.start.offset;return r.jsx(q5e,{src:s,name:T3e(s,a),openUrl:_3e(typeof e["data-open-url"]=="string"?String(e["data-open-url"]):s),filePath:i,message:i?t:void 0,sourceOffset:o===void 0?void 0:n?.get(o)??o})}function I4e({href:e,children:t,...n}){const s=n,{threads:a,currentBotId:i,message:o,delivered:c,originals:d}=f.useContext(Wj),u=$ge(e),p=Pj();if(!e)return r.jsx("span",{className:"break-words",children:t});if(rP(e))return r.jsx(aje,{children:t});const m=ou(e),h=m?Mx(a,m,i):null;if(h)return r.jsx(b2,{target:h,ambiguous:h.ambiguous,children:t});if(m||j9(e))return r.jsx("span",{className:"break-words",children:t});const x=up(e);if(x){const v=c&&Object.hasOwn(c,yl(x))?c[yl(x)]:void 0,y=v&&d&&Object.hasOwn(d,v)?d[v]:void 0;return r.jsx(f4e,{filePath:v??x,name:v?yl(x):void 0,source:y,message:o,children:t})}if(!/^https?:\/\//i.test(e))return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",dir:"auto",className:kI,children:t});const g=fje(s,e),k=g?cP[g.kind]:null;return r.jsx(vje,{href:e,github:g,children:v=>{const y=sje(e,p,u.onContextMenu?{...v,onContextMenu:u.onContextMenu}:v);return r.jsxs(r.Fragment,{children:[u.menu,k?r.jsxs("a",{...y,href:e,target:"_blank",rel:"noreferrer",dir:"ltr",title:e,"data-github-ref":g.kind,className:rje,children:[r.jsx(k,{size:13,"aria-hidden":"true",className:"shrink-0 self-center text-ink-tertiary"}),r.jsx("span",{children:t})]}):r.jsx("a",{...y,href:e,target:"_blank",rel:"noreferrer",dir:"auto",className:kI,children:t})]})}})}const C4e={pre:N4e,img:S4e,code({children:e}){return r.jsx("code",{dir:"ltr",className:"ui-code-chip break-words [unicode-bidi:isolate]",children:e})},span(e){const t=_re(e);if(t)return r.jsx(b2,{target:t.target,ambiguous:t.ambiguous,children:e.children});const{node:n,children:s,...a}=e;return r.jsx("span",{...a,children:s})},a:I4e,table({node:e,children:t}){return r.jsx(H5e,{direction:ar(e),children:t})},th({children:e}){return r.jsx("th",{className:"border-b border-hairline/40 px-2 py-1.5 text-start font-semibold",children:e})},td({children:e}){return r.jsx("td",{className:"border-b border-hairline/20 px-2 py-1.5 align-top",children:e})},p({node:e,children:t}){return r.jsx("p",{dir:ar(e),children:t})},ul({node:e,children:t}){return r.jsx("ul",{dir:ar(e),className:"list-disc space-y-1 ps-5",children:t})},ol({node:e,children:t}){return r.jsx("ol",{dir:ar(e),className:"list-decimal space-y-1 ps-5",children:t})},h1({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"md-heading mt-3 text-[20px] font-semibold leading-[26px] tracking-[-0.01em]",children:t})},h2({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"md-heading mt-2 text-[17px] font-semibold leading-6 tracking-[-0.005em]",children:t})},h3({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 font-semibold",children:t})},h4({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 font-semibold",children:t})},h5({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 text-[14px] font-semibold",children:t})},h6({node:e,children:t}){return r.jsx("div",{dir:ar(e),className:"mt-1.5 text-[14px] font-semibold text-ink-secondary",children:t})},blockquote({node:e,children:t}){return r.jsx("blockquote",{dir:ar(e),className:"border-s-2 border-hairline ps-3 text-ink-secondary",children:t})},del({children:e}){return r.jsx(h4e,{children:e})},hr(){return r.jsx("hr",{className:"border-hairline/40"})}},E4e=/#[^\s#]|openmausbot/i,A4e={threads:[]},T4e=[[eP,jP],y3e,a4e,i4e,c4e,l4e,mje],_4e=[];let vb=null;const M4e=e=>e?(vb?.plugin!==e&&(vb={plugin:e,list:[e]}),vb.list):_4e,R4e=j3e(),FI=new WeakMap,O4e=e=>{let t=FI.get(e);return t===void 0&&(t=e.map(n=>`${n.name}${n.hidden?1:0}${n.person?1:0}${n.color??""}`).join(""),FI.set(e,t)),t},qI=new WeakMap;let z4e=0;const L4e=e=>{let t=qI.get(e);return t===void 0&&qI.set(e,t=++z4e),t};function P4e({text:e,message:t,mentionPeers:n=$k,everyone:s=!1,mentionPerson:a,delivered:i,originals:o}){const{threads:c,currentBotId:d}=E4e.test(e)?f.use(g2):A4e,{source:u,imageOffsets:p}=v4e(e),m=j4e(u),[h,x]=f.useState(()=>Nd!==null);f.useEffect(()=>{if(!m)return;if(Nd){x(!0);return}let w=!0;return w4e().then(()=>{w&&x(!0)},()=>{}),()=>{w=!1}},[m]);const g=m&&h?Nd:null,k=u.includes("@"),v=c.length>0,y=`${g?"math":""}${k?`${O4e(n)}${s?1:0}${a?.profileName??""}`:""}${v?`${L4e(c)}${d??""}`:""}`,b=R4e.render(e,y,()=>{const w=[...T4e];return k&&w.push([dre,{peers:n,everyone:s,person:a}]),v&&w.push(Cre(c,d)),Xve({children:u,remarkPlugins:w,rehypePlugins:M4e(g),urlTransform:r4e,components:C4e})});return r.jsx(Wj.Provider,{value:{message:t,imageOffsets:p,threads:c,currentBotId:d,delivered:i,originals:o},children:r.jsx("div",{className:"chat-md min-w-0 [&>*+*]:mt-2",children:b})})}function D4e(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,s)=>{const a=t[s];return n.name===a.name&&n.hidden===a.hidden&&n.color===a.color&&n.person===a.person})}const aa=f.memo(P4e,(e,t)=>e.text===t.text&&D4e(e.mentionPeers??$k,t.mentionPeers??$k)&&e.everyone===t.everyone&&ire(e.mentionPerson,t.mentionPerson)&&e.message?.threadId===t.message?.threadId&&e.message?.messageId===t.message?.messageId&&UI(e.delivered,t.delivered)&&UI(e.originals,t.originals));function UI(e,t){if(e===t)return!0;const n=Object.entries(e??{}),s=t??{};return n.length===Object.keys(s).length&&n.every(([a,i])=>s[a]===i)}const HI=new Set;function $4e(e,t){if(!t?.busy||!Number.isFinite(t.turnStartedAt)||t.turnStartedAt==null)return HI;const n=new Set(e.filter(a=>a.turnId&&(a.turnTerminal||a.turnCompletedAt!=null)).map(a=>a.turnId)),s=new Set;for(const a of e)a.kind==="activity"&&a.at>=t.turnStartedAt&&!a.turnTerminal&&a.turnCompletedAt==null&&(!a.turnId||!n.has(a.turnId))&&s.add(a.id);return s.size===0?HI:s}const SP=f.createContext(new Set),B4e=(e,t)=>e.size===t.size&&[...e].every(n=>t.has(n));function IP(e,t){const n=f.useRef(null),{busy:s,turnStartedAt:a}=t;return f.useMemo(()=>{const i=$4e(e,{busy:s,turnStartedAt:a});return n.current&&B4e(n.current,i)?n.current:n.current=i},[e,s,a])}function WI(e){if(!Number.isFinite(e)||e<=0)return"0:00";const t=Math.floor(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function CP({attachment:e,className:t}){const n=wne(e.path),s=f.useRef(null),a=f.useRef(null),[i,o]=f.useState(!1),[c,d]=f.useState(typeof e.durationMs=="number"&&e.durationMs>0?e.durationMs/1e3:null),[u,p]=f.useState(0),[m,h]=f.useState(!1),x=e.text?.trim()??"",g=xs(Kr().phase);if(f.useEffect(()=>()=>a.current?.(),[]),!n)return null;const k=b=>{b&&a.current!==b||(a.current?.(),a.current=null)},v=()=>{const b=s.current;if(!b)return;if(!b.paused){b.pause();return}if(g)return;a.current?.();const w=Gt.claimExternalVoice(()=>b.pause());a.current=w,b.play().catch(()=>k(w))},y=b=>{const w=s.current;w&&Number.isFinite(b)&&(w.currentTime=b),p(b)};return r.jsxs("div",{className:I("flex w-full flex-col rounded-xl bg-inset/60 px-3 py-2",t),"data-test-voice-note":"",children:[r.jsxs("div",{className:"flex w-full items-center gap-3",children:[r.jsx("audio",{ref:s,src:n,preload:"metadata",onLoadedMetadata:b=>{const w=b.currentTarget.duration;Number.isFinite(w)&&w>0&&d(w)},onTimeUpdate:b=>p(b.currentTarget.currentTime),onPlay:()=>o(!0),onPause:b=>{b.currentTarget.paused&&(o(!1),k())},onEnded:()=>{o(!1),k()}}),r.jsx("button",{type:"button",onClick:v,disabled:g&&!i,"aria-label":i?l("chat.voiceNote.pause"):g?l("chat.voiceNote.onLiveCall"):l("chat.voiceNote.play"),title:i?l("chat.voiceNote.pause"):g?l("chat.voiceNote.onLiveCall"):l("chat.voiceNote.play"),className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-accent text-white transition-opacity hover:opacity-90 disabled:opacity-40",children:i?r.jsx(mw,{size:13,className:"fill-current"}):r.jsx(ix,{size:13,className:"translate-x-px fill-current"})}),r.jsx("input",{type:"range","aria-label":l("chat.voiceNote.seek"),min:0,max:c??0,step:.1,value:Math.min(u,c??u),onChange:b=>y(Number(b.currentTarget.value)),disabled:!c,className:"h-1 flex-1 accent-accent"}),r.jsxs("span",{className:"shrink-0 text-[11px] tabular-nums text-ink-secondary",children:[WI(u)," / ",c===null?"--:--":WI(c)]})]}),x&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>h(b=>!b),"data-test-voice-note-transcript":"","aria-expanded":m,className:"mt-1 flex items-center gap-0.5 self-start text-[12px] text-ink-secondary transition-colors hover:text-ink",children:[r.jsx(at,{size:12,"aria-hidden":"true",className:I("transition-transform duration-150",m&&"rotate-90")}),l("chat.voiceNote.transcript")]}),m&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[13px] leading-snug text-ink",children:x})]})]})}function EP({active:e,onToggle:t,className:n}){const s=l(e?"chat.showRenderedMarkdown":"chat.showRawMarkdown");return r.jsx("button",{type:"button",onClick:t,"aria-label":s,"aria-pressed":e,title:s,className:I("rounded-md p-1.5 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-100",e?"bg-raised text-accent opacity-100":"text-ink-secondary opacity-0 hover:bg-raised hover:text-ink",n),children:e?r.jsx(Ur,{...Yt,"aria-hidden":"true"}):r.jsx(lE,{...Yt,"aria-hidden":"true"})})}function AP({text:e,className:t}){return r.jsx("pre",{dir:"auto","data-testid":"raw-markdown-view",tabIndex:0,className:I("max-h-[36rem] overflow-auto whitespace-pre-wrap break-words rounded-lg border border-hairline/30 bg-inset/50 p-3 font-mono text-[13px] leading-relaxed text-ink select-text",t),children:e})}const KI=140;function F4e(e){if(e.roomRequest?.phase!=="result")return null;const t=e.tool?.output?.trim();if(!t)return null;const[n="",...s]=t.split(`
191
191
  `),a=n.trim();if(a.length>KI)return{preview:`${a.slice(0,KI-1).trimEnd()}…`,more:t};const i=s.join(`
192
192
  `).trim();return{preview:a,more:i||null}}function TP({message:e,children:t}){const n=F4e(e),s=e.doneWhen?.trim();return s?r.jsxs("div",{className:"flex flex-col items-start gap-1",children:[t,r.jsx("p",{"data-handoff-done-when":!0,className:"max-w-[min(38rem,100%)] truncate px-3 text-[12px] text-ink-secondary",title:s,children:l("chat.handoffDoneWhen",{criteria:s})})]}):n?r.jsxs("div",{className:"flex flex-col items-start gap-1","data-handoff-reply":e.roomRequest?.id,children:[t,n.more===null?r.jsx("p",{className:"max-w-[min(38rem,100%)] rounded-xl border border-hairline/40 bg-panel px-3 py-1.5 text-[13px] break-words text-ink-secondary",children:n.preview}):r.jsxs("details",{className:"group/reply w-fit max-w-full rounded-xl border border-hairline/40 bg-panel text-[13px] open:w-[min(38rem,100%)]",children:[r.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-xl px-3 py-1.5 text-ink-secondary hover:bg-raised focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent [&::-webkit-details-marker]:hidden",children:[r.jsx("span",{className:"min-w-0 max-w-[34rem] truncate",children:n.preview}),r.jsx(at,{size:13,className:"ml-auto shrink-0 group-open/reply:rotate-90","aria-hidden":"true"})]}),r.jsx("p",{className:"max-h-80 overflow-auto border-t border-hairline/40 px-3 py-2 whitespace-pre-wrap break-words text-ink",children:n.more})]})]}):r.jsx("div",{className:"flex justify-start",children:t})}function _P({message:e,bots:t,title:n,onClick:s}){const a=e.comm;if(!a||!e.tool)return null;const i=t.find(o=>o.id===a.withBotId);return r.jsx(TP,{message:e,children:r.jsxs("button",{type:"button",onClick:s,title:n,className:I("ui-pill",e.tool.ok===!1&&"text-danger"),children:[r.jsx(Ge,{bot:i??{name:a.withName,color:a.withColor},state:"happy",size:16,animated:!1}),r.jsx("span",{className:"max-w-[480px] truncate",children:e.tool.name}),r.jsx(at,{size:13})]})})}function MP({message:e}){const{state:t,dispatch:n}=se(),s=Qe(),a=e.threadRef,i=e.tool;if(!a||!i)return null;const o=t.bots.find(u=>u.id===a.botId),c=e.sentDirectly,d=c?c.room?l("chat.sentDirectlyNotInRoom",{name:c.name,room:c.room}):l("chat.sentDirectly",{name:c.name}):ai(i,i.name);return r.jsx(TP,{message:e,children:r.jsxs("button",{type:"button","data-thread-chip":a.threadId,onClick:()=>xn(n,a,t,s),title:l("chat.openThread",{title:a.title}),className:I("ui-pill",i.ok===!1&&"text-danger"),children:[o?r.jsx(Ge,{bot:o,state:"happy",size:16,animated:!1}):r.jsx(uw,{size:13,"aria-hidden":"true"}),r.jsx("span",{className:"max-w-[480px] truncate",children:d}),r.jsx(at,{size:13})]})})}function RP({message:e}){const t=e.relay;if(!t||t.kind!=="told")return null;const n=e.tool?.output?.trim();return r.jsxs("div",{className:"flex flex-col items-start gap-1","data-relay":"told",children:[r.jsxs("span",{className:"ui-pill",title:l("relay.toldHint",{name:t.name}),children:[r.jsx(Xs,{person:{email:t.email,name:t.name,role:"member"},size:16}),r.jsx("span",{className:"max-w-[480px] truncate",children:l("relay.told",{name:t.name})})]}),n&&r.jsx("p",{className:"max-w-[min(38rem,100%)] rounded-xl border border-hairline/40 bg-panel px-3 py-1.5 text-[13px] whitespace-pre-wrap break-words text-ink-secondary",children:n})]})}function q4e({bot:e}){const t=bn(),[n,s]=f.useState(null),[a,i]=f.useState(!1),[o,c]=f.useState("");if(!t)return null;const d=Lr(e),u=t.people.find(h=>h.email===d),p=h=>h.length===1?h[0].name:l("botAccess.theAdmins");if(n)return r.jsx("span",{role:"status","data-ask-to-chat":"asked",className:"shrink-0 text-[13px] text-ink-secondary",children:l("botAccess.asked",{name:p(n)})});const m=async()=>{i(!0),c("");try{const h=await K(`/api/bots/${e.id}/access-request`,{method:"POST",body:"{}"});s(h.asked??[])}catch(h){c(h instanceof Error?h.message:String(h))}finally{i(!1)}};return r.jsxs(r.Fragment,{children:[o&&r.jsx("span",{role:"alert",className:"min-w-0 text-[12px] text-danger",children:o}),r.jsx("button",{type:"button","data-ask-to-chat":!0,disabled:a,onClick:()=>{m()},className:"shrink-0 rounded-full bg-accent px-3 py-1 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-60",children:u?l("botAccess.ask",{name:u.name}):l("botAccess.askAdmins")})]})}function OP({bot:e,room:t=!1,onNew:n}){return e?.yourAccess==="view"?r.jsxs("div",{className:"pointer-events-auto mx-5 mb-4 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/60 bg-raised px-4 py-3","data-testid":"view-only-composer",children:[r.jsx(Ur,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),r.jsx("p",{className:"min-w-0 flex-1 text-[13px] text-ink-secondary",children:l(t?"botAccess.viewOnlyRoom":"botAccess.viewOnly",{bot:e.name})}),r.jsx(q4e,{bot:e})]}):r.jsxs("div",{className:"pointer-events-auto mx-5 mb-4 flex items-center justify-between gap-3 rounded-2xl border border-hairline/60 bg-raised px-4 py-3","data-testid":"cloud-guest-composer",children:[r.jsx("p",{className:"text-[13px] text-ink-secondary",children:l("chat.cloudGuest.notYours")}),r.jsx("button",{type:"button",onClick:n,className:"shrink-0 rounded-full bg-accent px-3 py-1 text-[13px] font-medium text-white",children:l("chat.cloudGuest.newConversation")})]})}function U4e(e){return/[\s/]/.test(e)}function H4e(e){return e.kind==="activity"&&e.tool?.summary||void 0}const zP=/\s*(?:&&|\|\||;|\||\r?\n)\s*/,W4e=/^[A-Za-z_][A-Za-z0-9_]*=/,K4e=new Set(["env","sudo"]),V4e=new Set(["-u","-g","-C"]),LP=new Set(["pnpm","npm","yarn","bun"]),PP=new Set(["run","exec","-s","--silent","-r","--"]),G4e=new Set(["node","npx","tsx"]),Y4e=/^control:[\w-]+$/,J4e=/^control-[\w-]+\.(?:mjs|ts|js|cjs)$/,DP=/^\d*[<>]/,$P=/^[a-z][a-z0-9+.-]*:\/\//i,Z4e=/^--[^=]+$/,BP=/(?:^|\s)--dry-run(?:=|\s|$)/,ia=e=>e.replace(/^['"`]+|['"`]+$/g,""),Kj=e=>{const t=ia(e);return t.split(/[\\/]/).pop()||t};function Bk(e,t){let n=0;for(;n<e.length;){const s=e[n];if(W4e.test(s))n+=1;else if(s==="timeout"||s==="cd")n+=2;else if(K4e.has(s))for(n+=1;n<e.length&&e[n].startsWith("-");)n+=V4e.has(e[n])?2:1;else if(t)if(s==="deno")n+=e[n+1]==="run"?2:1;else if(LP.has(s))for(n+=1;n<e.length&&PP.has(e[n]);)n+=1;else if(G4e.has(s))for(n+=1;n<e.length&&e[n].startsWith("-");)n+=1;else break;else break}return e.slice(n)}function X4e(e){const t=ia(e);if(Y4e.test(t))return t;const n=Kj(t);return J4e.test(n)?n:void 0}function Q4e(e,t){let n=!1;for(const s of e){const a=ia(s);if(a.startsWith("-"))n=Z4e.test(a)&&a!=="--dry-run";else if(n)n=!1;else if(a&&!DP.test(a)&&!$P.test(a))return a}return t}function eNe(e){for(const t of e.split(zP)){const n=Bk(t.split(/\s+/).filter(Boolean),!0),s=n.length>0?X4e(n[0]):void 0;if(s)return{subcommand:Q4e(n.slice(1),s),dryRun:BP.test(t)}}}const tNe=new Set(["cat","less","more","head","tail","wc","stat","file","du","df","ls","tree","find","which","type","where","whereis","pwd","echo","printf","printenv","env","ps","pgrep","top","grep","rg","ag","ack","fgrep","egrep","awk","cut","sort","uniq","tr","diff","cmp","md5","shasum","sha256sum","jq","yq","column","export","unset","alias","true","false",":","sleep","exit"]),nNe=new Set(["status","log","diff","show","blame","branch","tag","ls-files","rev-parse","remote","describe","shortlog","reflog"]),FP=new Set(["-C","-c"]),sNe=new Set(["pr view","pr list","pr checks","pr diff","issue view","issue list","run view","run list"]),qP=new Set(["-R","--repo"]),rNe=new Set,aNe=/^(?:-[a-zA-Z]*i|--in-place)/,VI=/^(?:POST|PUT|PATCH|DELETE)$/i,iNe=/^(?:-X|--request|--method)(?:=(.*))?$/,oNe=/^-X(\w+)$/,lNe=/^(?:-d|--data(?:-\w+)?|-F|--form|-T|--upload-file|-o|--output|-O|--remote-name|--output-document|--post-data|--post-file)(?:=|$)/,cNe=/^(?:-f|-F|--field|--raw-field)(?:=|$)/;function Fk(e,t){const n=[];for(let s=0;s<e.length;s+=1){const a=ia(e[s]);if(t.has(a))s+=1;else{if(a.startsWith("-")||DP.test(a)||$P.test(a)||!a)continue;n.push(a)}}return n}function GI(e){for(let t=0;t<e.length;t+=1){const n=ia(e[t]),s=oNe.exec(n);if(s){if(VI.test(s[1]))return!0;continue}const a=iNe.exec(n);if(!a)continue;const i=a[1]??ia(e[t+1]??"");if(VI.test(i))return!0}return!1}function dNe(e){if(e.length===0)return!0;const t=Kj(e[0]);if(tNe.has(t))return!0;const n=e.slice(1);switch(t){case"sed":return!n.some(s=>aNe.test(ia(s)));case"git":{const[s]=Fk(n,FP);return s===void 0||nNe.has(s)}case"gh":{const[s,a]=Fk(n,qP);return s==="api"?!GI(n)&&!n.some(i=>cNe.test(ia(i))):s===void 0||sNe.has(`${s} ${a}`)}case"curl":case"wget":return!GI(n)&&!n.some(s=>lNe.test(ia(s)));default:return!1}}const uNe=new Set(["git","gh","npm","pnpm","docker","kubectl"]);function pNe(e){const t=Kj(e[0]);if(!uNe.has(t))return t;const n=LP.has(t)?e.slice(1).filter(a=>!PP.has(a)):e.slice(1),[s]=Fk(n,t==="git"?FP:t==="gh"?qP:rNe);return s?`${t} ${s}`:t}function mNe(e){const t=eNe(e);if(t)return{label:t.subcommand,verified:!0,dryRun:t.dryRun};for(const n of e.split(zP)){const s=Bk(n.split(/\s+/).filter(Boolean),!1);if(!dNe(Bk(s,!0)))return{label:pNe(s),verified:!1,dryRun:BP.test(n)}}}function UP(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.role==="user"&&n.kind==="text"&&n.text?.trim())return t}return-1}function fNe(e){const t=UP(e);if(t<0)return;const n=e[t].text.trim().split(/\r?\n/,1)[0].trim();return n?n.slice(0,300):void 0}function hNe(e,t=new Set){const n=[];for(const s of e.slice(UP(e)+1)){const a=H4e(s),i=a?mNe(a):void 0;if(!a||!i)continue;const o=s.tool?.ok;n.push({id:s.id,command:a,...i,status:o===void 0?t.has(s.id)?"running":"unverified":o?"passed":"failed"})}return n}function xNe(e){return e.some(t=>t.verified)||e.length>=2}function HP(e){const t={total:e.length,verified:0,passed:0,failed:0,running:0,unverified:0,dryRuns:0};for(const s of e)s.verified&&(t.verified+=1),s.dryRun&&["passed","failed"].includes(s.status)?t.dryRuns+=1:t[s.status]+=1;const n=[t.total===1?l("chat.verify.stepsOne"):l("chat.verify.stepsMany",{count:t.total}),t.verified>0&&l("chat.verify.verifiedCount",{count:t.verified}),t.failed>0&&l("chat.verify.failed",{count:t.failed}),t.running>0&&l("chat.verify.running",{count:t.running}),t.unverified>0&&l("chat.verify.unverified",{count:t.unverified}),t.dryRuns===1?l("chat.verify.dryRunOne"):t.dryRuns>1&&l("chat.verify.dryRunMany",{count:t.dryRuns})].filter(Boolean).join(" · ");return{...t,label:n}}function gNe(e,t){const n=t[0];if(!n)return null;const s=e.findIndex(i=>i.id===n.id);if(s<0)return null;const a=e.slice(s+1).findLast(i=>i.kind==="options"&&i.card?.skillRequest!==void 0)?.card;return!a||a.undone?null:a.answered==="allow"?"saved":a.answered||a.dismissed||a.expired?null:"pending"}const bNe={passed:"✓",failed:"✗",running:"…",unverified:"?"},yNe=e=>`${e.dryRun?"[dry run]":bNe[e.status]} ${e.label} — ${e.command}${e.verified?" (verified)":""}`;function kNe(e,t){return[...e.some(s=>s.verified)?["Create a verification skill from the run below.",...t?[`Goal: ${t}`]:[],"Do not re-run these steps; their results are in this thread. Use the passing ones as the recipe with their exact commands and note the failed ones as gotchas."]:[LT,`Goal: ${t??"the run below"}`,"Keep the exact commands and note the failed ones as gotchas. Do not re-run anything."],"",...e.map(yNe),"",""].join(`
193
193
  `)}function vNe({status:e}){const t="size-4 shrink-0";switch(e){case"running":return r.jsx(ye,{"aria-hidden":"true",className:I(t,"animate-spin text-accent")});case"passed":return r.jsx(ea,{"aria-hidden":"true",className:I(t,"text-success")});case"failed":return r.jsx(rw,{"aria-hidden":"true",className:I(t,"text-danger")});case"unverified":return r.jsx(aw,{"aria-hidden":"true",className:I(t,"text-ink-secondary")})}}const YI="flex size-7 shrink-0 items-center justify-center rounded-lg text-ink-secondary outline-none hover:bg-raised-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent/60";function wNe({steps:e,canSave:t,skill:n,onDismiss:s,onSave:a}){const i=e.length>6,[o,c]=f.useState(i);if(e.length===0)return null;const d=o?l("chat.verify.expand"):l("chat.verify.collapse");return r.jsxs("section",{"aria-label":l("chat.verify.aria"),className:"pointer-events-auto w-[22rem] max-w-full rounded-2xl border border-hairline/40 bg-raised/95 text-ink shadow-lg backdrop-blur-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx(Du,{size:14,className:"shrink-0 text-accent","aria-hidden":"true"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-[13px] font-medium",children:l("chat.verify.title")}),r.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-[12px] text-ink-secondary",children:HP(e).label})]}),r.jsx("button",{type:"button",onClick:()=>c(u=>!u),"aria-expanded":!o,"aria-label":d,title:d,className:YI,children:o?r.jsx(fi,{size:14,"aria-hidden":"true"}):r.jsx(kt,{size:14,"aria-hidden":"true"})}),r.jsx("button",{type:"button",onClick:s,"aria-label":l("chat.verify.dismiss"),title:l("chat.verify.dismiss"),className:YI,children:r.jsx(Ae,{size:14,"aria-hidden":"true"})})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("ol",{tabIndex:0,"aria-label":l("chat.verify.steps"),className:"max-h-56 overflow-y-auto border-t border-hairline/25 px-3 py-1.5 outline-none focus-visible:ring-2 focus-visible:ring-accent/60",children:e.map(u=>r.jsxs("li",{className:"flex min-w-0 items-center gap-2 py-1",children:[r.jsx(vNe,{status:u.status}),r.jsx("span",{className:"shrink-0 text-[13px] font-medium",children:u.label}),u.verified&&r.jsx("span",{className:"shrink-0 text-[11px] uppercase tracking-wide text-success",children:l("chat.verify.verifiedTag")}),r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-secondary",title:u.command,children:u.command})]},u.id))}),n?r.jsx("div",{className:"border-t border-hairline/25 px-3 py-2 text-[12px] text-ink-secondary",children:l(n==="saved"?"chat.verify.saved":"chat.verify.staged")}):t&&r.jsxs("div",{className:"flex flex-col items-end gap-1 border-t border-hairline/25 px-3 py-2",children:[r.jsxs("button",{type:"button",onClick:a,className:"flex h-7 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-[13px] font-medium text-ink-secondary outline-none hover:bg-raised-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent/60",children:[r.jsx(dW,{size:13,"aria-hidden":"true"}),l("chat.verify.save")]}),r.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("chat.verify.saveHint")})]})]})]})}const Vj="omb-color-user-bubbles";let Ch;const nd=new Set;function Gj(){try{return globalThis.localStorage}catch{return}}function JI(){if(Ch!==void 0)return Ch;try{return Gj()?.getItem(Vj)!=="0"}catch{return!0}}function WP(){for(const e of nd)e()}function ZI(e){e.key!==Vj&&e.key!==null||e.storageArea&&e.storageArea!==Gj()||(Ch=void 0,WP())}function jNe(e){return nd.add(e),nd.size===1&&typeof window<"u"&&window.addEventListener("storage",ZI),()=>{nd.delete(e),nd.size===0&&typeof window<"u"&&window.removeEventListener("storage",ZI)}}function y$e(e){Ch=e;try{Gj()?.setItem(Vj,e?"1":"0")}catch{}WP()}function NNe(){return f.useSyncExternalStore(jNe,JI,JI)}const SNe=/^#([0-9a-f]{6})$/i;function Eh(e){const t=SNe.exec(e.trim())?.[1];if(!t)throw new Error(`not a 6-digit hex colour: ${e}`);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function KP({r:e,g:t,b:n}){const s=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(n)}`}function kl(e){const t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function XI(e){const{r:t,g:n,b:s}=Eh(e);return .2126*kl(t)+.7152*kl(n)+.0722*kl(s)}function pn(e,t){const n=XI(e),s=XI(t),a=Math.max(n,s),i=Math.min(n,s);return(a+.05)/(i+.05)}function Ah(e){const{r:t,g:n,b:s}=Eh(e),[a,i,o]=[kl(t),kl(n),kl(s)],c=Math.cbrt(.4122214708*a+.5363325363*i+.0514459929*o),d=Math.cbrt(.2119034982*a+.6806995451*i+.1073969566*o),u=Math.cbrt(.0883024619*a+.2817188376*i+.6299787005*o),p=1.9779984951*c-2.428592205*d+.4505937099*u,m=.0259040371*c+.7827717662*d-.808675766*u;return{l:.2104542553*c+.793617785*d-.0040720468*u,c:Math.hypot(p,m),h:(Math.atan2(m,p)*180/Math.PI+360)%360}}function QI(e,t,n){const s=t*Math.cos(n*Math.PI/180),a=t*Math.sin(n*Math.PI/180),i=(e+.3963377774*s+.2158037573*a)**3,o=(e-.1055613458*s-.0638541728*a)**3,c=(e-.0894841775*s-1.291485548*a)**3;return[4.0767416621*i-3.3077115913*o+.2309699292*c,-1.2684380046*i+2.6097574011*o-.3413193965*c,-.0041960863*i-.7034186147*o+1.707614701*c]}function ku({l:e,c:t,h:n}){const s=u=>QI(e,u,n).every(p=>p>=-1e-4&&p<=1.0001);let a=t;if(!s(t)){let u=0,p=t;for(let m=0;m<30;m+=1){const h=(u+p)/2;s(h)?u=h:p=h}a=u}const i=u=>{const p=Math.min(1,Math.max(0,u));return 255*(p<=.0031308?12.92*p:1.055*p**(1/2.4)-.055)},[o,c,d]=QI(e,a,n).map(i);return KP({r:o,g:c,b:d})}function $n(e,t,n){const s=Eh(e),a=Eh(t),i=(o,c)=>o*n+c*(1-n);return KP({r:i(s.r,a.r),g:i(s.g,a.g),b:i(s.b,a.b)})}const yn="#ffffff",or="#101410",un=4.5,VP=3,INe=4.6,CNe=.35,ENe=.55,eC={from:65,to:115};function GP(e,t,n,s){if(pn(t,n)>=s)return t;let a=0,i=1,o=e;for(let c=0;c<22;c+=1){const d=(a+i)/2,u=$n(e,t,d);pn(u,n)>=s?(o=u,i=d):a=d}return pn(o,n)>=s?o:e}const Bo=(e,t,n)=>GP(yn,e,t,n),cm=(e,t,n)=>GP(or,e,t,n);function Th(e,t,n){let s=0,a=1,i=e;for(let o=0;o<22;o+=1){const c=(s+a)/2,d=$n(e,t,c);pn(d,t)>=n?(i=d,a=c):s=c}return pn(i,t)>=n?i:e}function vl(e){return pn(or,e)>=un?or:yn}function ANe(e,t,n){let s=.2,a=.95,i=ku({l:s,c:t,h:n});for(let o=0;o<24;o+=1){const c=(s+a)/2,d=ku({l:c,c:t,h:n});pn(d,e)>=INe?(i=d,s=c):a=c}return i}function YP(e,t){return`linear-gradient(to bottom left, ${e}, ${t})`}function TNe(e){const{c:t,h:n}=Ah(e),s=n<90?-8:n>=270?-12:12,a=pn(yn,e)>=un?e:ANe(yn,t*1.05,n-s/2),i=ku({l:Ah(a).l-.09,c:t*(n<90?1.1:1.25),h:n+s}),o=Th(yn,a,Math.min(6.2,Math.max(un,pn(yn,a)-.6)));let c=Th(yn,a,un);pn(c,a)>pn(o,a)&&(c=o);let d=$n("#000000",a,.2);pn(yn,d)<un&&(d=a),pn(o,d)<un&&(d=a);const u=$n(d,a,.45);let p=$n(yn,a,.1);pn(yn,p)<un&&(p=a);let m=$n(yn,a,.16);pn(yn,m)<un&&(m=p);const h=Bo($n(yn,a,.45),a,VP);let x=Bo(e,a,un);pn(x,p)<un&&(x=Bo(x,p,un)),pn(or,x)<un&&(x=Bo(x,or,un));const g=Bo("#ff6d80",a,un),k=Bo("#7ddead",a,un);return{background:a,deep:i,gradient:YP(a,i),ink:yn,secondary:o,tertiary:c,panel:u,inset:d,raised:p,raisedHover:m,control:p,hairline:h,accent:x,accentText:x,accentInk:vl(x),focus:x,danger:g,dangerInk:vl(g),success:k,successInk:vl(k),selection:MNe(a),selectionInk:yn}}function _Ne(e){const{c:t,h:n}=Ah(e),s=ku({l:.8,c:t*1.1,h:n+2}),a=ku({l:.72,c:t*1.25,h:n-16}),i=Th(or,a,Math.min(6.2,Math.max(un,pn(or,a)-.6)));let o=Th(or,a,un);pn(o,a)>pn(i,a)&&(o=i);const c=$n(yn,a,.35),d=$n(yn,a,.18),u=cm(e,a,un),p=cm("#c02b3a",a,un),m=cm("#1f7a4d",a,un);return{background:s,deep:a,gradient:YP(s,a),ink:or,secondary:i,tertiary:o,panel:$n(c,a,.45),inset:c,raised:d,raisedHover:$n(yn,a,.28),control:d,hairline:cm($n(or,a,.35),a,VP),accent:u,accentText:u,accentInk:vl(u),focus:u,danger:p,dangerInk:vl(p),success:m,successInk:vl(m),selection:$n(yn,s,ENe),selectionInk:or}}function JP(e){const t=bf[e],{h:n}=Ah(t);return n>=eC.from&&n<=eC.to?_Ne(t):TNe(t)}function MNe(e){return $n("#000000",e,CNe)}function RNe(e,{flat:t=!1}={}){const n=JP(e);return{backgroundColor:n.background,backgroundImage:t?"none":n.gradient,"--color-bubble-user":n.background,"--color-bubble-user-ink":n.ink,"--color-ink":n.ink,"--color-ink-secondary":n.secondary,"--color-ink-tertiary":n.tertiary,"--color-panel":n.panel,"--color-inset":n.inset,"--color-raised":n.raised,"--color-raised-hover":n.raisedHover,"--color-control":n.control,"--color-hairline":n.hairline,"--color-accent":n.accent,"--color-accent-text":n.accentText,"--color-accent-ink":n.accentInk,"--color-focus":n.focus,"--color-danger":n.danger,"--color-danger-ink":n.dangerInk,"--color-success":n.success,"--color-success-ink":n.successInk,"--bubble-selection":n.selection,"--bubble-selection-ink":n.selectionInk}}function ONe(e){return e!=="local"&&e!=="vm"}const zNe=new Set(["screenshot","click","type_text","press_key","key_press","scroll","computer_batch","open_url","browser_click","browser_fill","browser_navigate","browser_type","browser_press","browser_scroll","browser_hover","browser_drag","browser_select_option","browser_back","browser_forward","browser_screenshot","agent_browser_open","agent_browser_click","agent_browser_fill","agent_browser_type","agent_browser_press","agent_browser_select","agent_browser_check","agent_browser_screenshot","agent_browser_hover","agent_browser_upload","agent_browser_navigate","agent_browser_drag","agent_browser_scroll","agent_browser_tabs","agent_browser_dialog","agent_browser_eval","double_click","right_click","drag","hotkey","move_cursor","launch_app","bring_to_front","zoom"]),LNe=/^(?:mcp__.+?|[a-z][a-z0-9_-]{0,31})__/;function PNe(e){const t=e.toLowerCase();if(t.startsWith("mcp__browser__")||t.startsWith("browser__"))return"browser";if(t.startsWith("mcp__computer__")||t.startsWith("computer__")||t.startsWith("computer_"))return"computer";const n=t.replace(LNe,"");return n==="browser_click"||n==="browser_fill"?"computer":n.startsWith("agent_browser_")||n.startsWith("browser_")?"browser":zNe.has(n)?"computer":null}const ZP=["cloud","vm","local","browser"];function tC(e,t){return!t?.cloudHome||ONe(e)}function hg(e,t){return e.computer==="off"?"off":t?.surface??e.computer??"auto"}function XP(e){return e?.surfaceAuto?void 0:e?.surface}function DNe(e){return e==="cloud"||e==="vm"||e==="local"}function Qa(e){return`place.${e}`}function QP(e,t){const n=PNe(e);return n==="browser"?"browser":n==="computer"&&DNe(t)?t:null}function $Ne(e,t,n){let s=t.size;for(let a=e.length-1;a>=0&&s>0;a--){const i=e[a];if(!t.has(i.id))continue;s--;const o=i.tool&&i.tool.ok===void 0?QP(i.tool.name,n):null;if(o)return o}return null}const BNe={cloud:yr,vm:nE,local:po,browser:ma,auto:ts,off:mH};function ei({place:e,...t}){const n=BNe[e];return r.jsx(n,{...t})}function eD({tool:e,place:t=null,live:n=!1,source:s}){const[a,i]=f.useState(!1),o=FNe(a&&e.clipped?s:void 0,e.output),c=o.output??e.output,d=e.ok===!1,u=et(),p=go(e.nameCode),m=Ga(e.summaryCode,e.summary??"",e.summaryParams),h=d?e.problem:void 0,x=h??(u&&!p?e.label??e.name:Fl(e)),g=e.ok===void 0?n?l("toolDetail.running"):l("toolDetail.unverified"):d?l("toolDetail.failed"):l("toolDetail.completed");return r.jsxs("details",{onToggle:k=>i(k.currentTarget.open),className:"group/tool w-fit max-w-full rounded-xl border border-hairline/40 bg-panel text-[13px] open:w-[min(38rem,100%)]","data-testid":"tool-activity",children:[r.jsxs("summary",{role:"button","aria-expanded":a,"aria-label":l("toolDetail.label",{name:x,status:g}),className:I("flex min-h-8 cursor-pointer list-none items-center gap-2 rounded-xl px-3 py-1.5 hover:bg-raised focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent [&::-webkit-details-marker]:hidden",d?"text-danger":"text-ink-secondary"),children:[r.jsx("span",{className:"shrink-0","aria-hidden":"true",children:e.ok===void 0?n?r.jsx(x3,{size:3.5}):r.jsx(aw,{size:13}):d?r.jsx(Ae,{size:13}):r.jsx(Ie,{size:13,className:"text-success"})}),t&&r.jsx(ei,{place:t,size:13,className:"shrink-0 opacity-70",role:"img","aria-label":l(Qa(t)),"data-testid":"tool-place"}),r.jsx("span",{className:I("min-w-0 max-w-[30rem]",!h&&"truncate","leading-5",u&&!p&&!h?"font-mono":"font-medium"),children:x}),u&&e.summary&&e.summary!==e.name&&!U4e(e.name)&&r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",title:m,children:m}),r.jsx(at,{size:13,className:"ml-auto shrink-0 group-open/tool:rotate-90","aria-hidden":"true"})]}),r.jsxs("div",{className:"space-y-3 border-t border-hairline/40 p-3 text-ink-secondary",children:[r.jsx("div",{className:I("text-[11px] font-medium",d&&"text-danger"),children:g}),x!==e.name&&!p&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-medium",children:l("toolDetail.tool")}),r.jsx("p",{dir:"ltr",className:"break-words font-mono text-xs text-ink","data-testid":"tool-name",children:e.name})]}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-medium",children:l("toolDetail.input")}),r.jsx("pre",{dir:"ltr",className:"max-h-52 overflow-auto rounded-lg bg-inset p-2.5 font-mono text-xs whitespace-pre-wrap break-words text-ink",children:e.input??(e.summary?m:p?x:e.name)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-medium",children:l("toolDetail.output")}),c?r.jsx("pre",{dir:"ltr",className:"max-h-64 overflow-auto rounded-lg bg-inset p-2.5 font-mono text-xs whitespace-pre-wrap break-words text-ink",children:c}):r.jsx("p",{className:"text-xs",children:e.ok===void 0?n?l("toolDetail.waiting"):l("toolDetail.unverified"):l("toolDetail.noOutput")})]}),(o.state==="loading"||o.state==="failed")&&r.jsx("p",{className:"text-[11px] text-ink-secondary",role:"status",children:l(o.state==="loading"?"toolDetail.loadingFull":"toolDetail.partial")}),r.jsx("p",{className:"text-[11px] text-ink-secondary",children:l("toolDetail.previewHint")})]})]})}function FNe(e,t){const n=e&&`/api/threads/${encodeURIComponent(e.threadId)}/messages/${encodeURIComponent(e.messageId)}/tool`,s=n&&`${n}#${t?.length??0}`,[a,i]=f.useState({state:"idle"}),o=a.key===s&&a.state==="done";return f.useEffect(()=>{if(!n||o)return;let c=!0;const d=new AbortController;return i({state:"loading",key:s}),K(n,{signal:d.signal}).then(u=>{c&&i({state:"done",key:s,output:u.output})}).catch(()=>{c&&i({state:"failed",key:s})}),()=>{c=!1,d.abort()}},[n,s,o]),a.key===s?a:{state:"idle"}}function qk(e=typeof document>"u"?null:document.documentElement){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}function Yj(){const[e,t]=f.useState(()=>qk());return f.useEffect(()=>{const n=()=>t(qk());if(n(),typeof MutationObserver>"u")return;const s=new MutationObserver(n);return s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-skin"]}),()=>s.disconnect()},[]),e}const Fo='"Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif',nC=["#3b82f6","#ea580c","#059669","#c026d3","#a16207","#8b5cf6","#0d9488","#e11d48","#4d7c0f","#6b7280"],qNe={dark:{text:"#fcfcfc",muted:"#a3a3a3",hairline:"#333333",surface:"#111111"},light:{text:"#1a1a18",muted:"#6b6559",hairline:"#c8bda8",surface:"#fbf8f2"}};function tD(e){const t=qNe[e],n={font:Fo,labelFont:Fo,titleFont:Fo,labelFontSize:11,titleFontSize:11,titleFontWeight:500};return{background:"transparent",font:Fo,padding:8,view:{stroke:null},title:{color:t.text,subtitleColor:t.muted,font:Fo,fontSize:13,fontWeight:600,anchor:"start",offset:12},axis:{...n,labelColor:t.muted,titleColor:t.muted,titlePadding:8,labelPadding:6,domainColor:t.hairline,domainWidth:1,tickColor:t.hairline,tickSize:4,gridColor:t.hairline,gridWidth:1,gridOpacity:.6},axisX:{grid:!1},axisY:{grid:!0,domain:!1,ticks:!1},legend:{...n,labelColor:t.muted,titleColor:t.muted,symbolSize:60,symbolType:"circle",labelLimit:140,padding:0,rowPadding:2,columnPadding:8,offset:12},range:{category:[...nC],heatmap:{scheme:e==="dark"?"viridis":"blues"},ramp:{scheme:e==="dark"?"viridis":"blues"}},mark:{color:nC[0]},line:{strokeWidth:2,strokeJoin:"round",strokeCap:"round"},area:{opacity:.75,line:!1},point:{filled:!0,size:36,opacity:.8},circle:{size:36,opacity:.8},arc:{stroke:t.surface,strokeWidth:1},rect:{stroke:t.surface,strokeWidth:1},text:{color:t.text,font:Fo},scale:{bandPaddingInner:.25}}}function nD(e){return/^(?:U?(?:TINY|SMALL|BIG|HUGE)?INT(?:EGER)?|DECIMAL|NUMERIC|DOUBLE|FLOAT|REAL)\b/i.test(e.trim())}function UNe(e){return/^(?:DATE|TIME|TIMESTAMP|INTERVAL)/i.test(e.trim())}function sD(e){return e==null?"":typeof e=="boolean"?e?"true":"false":String(e)}function HNe(e){if(e==null||e==="")return null;if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;const t=Number(e);return Number.isFinite(t)?t:null}function WNe(e,t){const n=e.map(s=>nD(s.type));return t.map(s=>{const a={};return e.forEach((i,o)=>{const c=s[o]??null;a[i.name]=n[o]?HNe(c):c}),a})}function k$e(e,t){const n=s=>s.replace(/[\t\r\n]+/g," ");return[e.map(n).join(" "),...t.map(s=>s.map(a=>n(sD(a))).join(" "))].join(`