@openchambery/web 2.1.6-beta.1 → 2.1.6-beta.11

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 (121) hide show
  1. package/dist/assets/AgentAvatar-Ah1nMt7y.js +1 -0
  2. package/dist/assets/AssistantView-Dpa4vy55.js +3 -0
  3. package/dist/assets/{DiagramView-BudqVoj4.js → DiagramView-BxnLZPyY.js} +1 -1
  4. package/dist/assets/{FadeInOnReveal-C8mIXT_x.js → FadeInOnReveal-BssISEuf.js} +1 -1
  5. package/dist/assets/{Icon-De3bTfBD.js → Icon-DewMAW7N.js} +1 -1
  6. package/dist/assets/{ImageLoadingPlaceholder-DVxKuVwD.js → ImageLoadingPlaceholder-D7q71Qgl.js} +1 -1
  7. package/dist/assets/LoadingImage-BBGT-9VQ.js +1 -0
  8. package/dist/assets/MarkdownRenderer-DZT-ObQc.js +2 -0
  9. package/dist/assets/MarkdownRendererImpl-DcSDNoV2.js +10 -0
  10. package/dist/assets/{MarkstreamRendererImpl-CIylCsD3.js → MarkstreamRendererImpl-AE60MlbM.js} +2 -2
  11. package/dist/assets/{MobileDetailNavigation-CzOQIbvs.js → MobileDetailNavigation-Bgzkkjqa.js} +1 -1
  12. package/dist/assets/{MobileShareBridge-B0leJCQr.js → MobileShareBridge-BFgFuhnW.js} +2 -2
  13. package/dist/assets/MobileTabPageHeader-C8QJsijY.js +2 -0
  14. package/dist/assets/{MultiRunWindow-CHfg6SYj.js → MultiRunWindow-DRw2Q5qW.js} +1 -1
  15. package/dist/assets/{OnboardingScreen-WDXH6GyO.js → OnboardingScreen-BjikXNcy.js} +1 -1
  16. package/dist/assets/{OverlayScrollbar-_xcqpVSN.js → OverlayScrollbar-C24-p2ns.js} +1 -1
  17. package/dist/assets/{SettingsView-BQ_jhvcz.js → SettingsView-DEC27hDQ.js} +4 -4
  18. package/dist/assets/{SettingsWindow-DCMtWvxd.js → SettingsWindow-BCRYo0Ry.js} +1 -1
  19. package/dist/assets/{TerminalView--7RrFsTH.js → TerminalView-lTVWnwxv.js} +1 -1
  20. package/dist/assets/{ToolOutputDialog-C9bqkmLi.js → ToolOutputDialog-CPLfCLfs.js} +1 -1
  21. package/dist/assets/{appThemeRegistry-DxQ0uJse.js → appThemeRegistry-D2PNvjdo.js} +1 -1
  22. package/dist/assets/{assistant-attachment-cache-CPBGM8H7.js → assistant-attachment-cache-Bzewqov4.js} +1 -1
  23. package/dist/assets/{button-BnPjweDW.js → button-kJNzMb1G.js} +1 -1
  24. package/dist/assets/{collapsible-C9mIVYPa.js → collapsible-MInYZ7dA.js} +1 -1
  25. package/dist/assets/{context-menu-C_ImdU3v.js → context-menu-BYq0LM7H.js} +1 -1
  26. package/dist/assets/{desktopHosts-BfMzjRVt.js → desktopHosts-BKeEWmL5.js} +1 -1
  27. package/dist/assets/{desktopRelayRestore-ML6japys.js → desktopRelayRestore-FWm2fXr6.js} +1 -1
  28. package/dist/assets/{diagram-DVV7MmUA.js → diagram-BDSPghN-.js} +1 -1
  29. package/dist/assets/dropdown-menu.styles-BXvVFEkh.js +1 -0
  30. package/dist/assets/es-CLTWsqOO.js +15 -0
  31. package/dist/assets/{fileMentionTouchSelection-CC7g7YFk.js → fileMentionTouchSelection-DYN36NEt.js} +1 -1
  32. package/dist/assets/{fileQueries-DfHYU8Iq.js → fileQueries-Dhgypzyl.js} +1 -1
  33. package/dist/assets/fr-BNyfwida.js +13 -0
  34. package/dist/assets/{gitApi-C4lwqR8Q.js → gitApi-BvFBlh91.js} +1 -1
  35. package/dist/assets/{image-loading-BzqNA0Jz.css → image-loading-DDV3Ixi1.css} +1 -1
  36. package/dist/assets/{image-loading-4Touxv4x.js → image-loading-OgMEw4Jq.js} +1 -1
  37. package/dist/assets/{input-CporeP3S.js → input-02eTmC8w.js} +1 -1
  38. package/dist/assets/insertionBoundaries-Bh99pFdp.js +1 -0
  39. package/dist/assets/ja-D7MYkMo9.js +15 -0
  40. package/dist/assets/ko-CFNLrmLm.js +15 -0
  41. package/dist/assets/{main-BtR6Gsq0.js → main-CtZ7bXuB.js} +2 -2
  42. package/dist/assets/{main-6iMM4Nlz.js → main-DrhFSQWG.js} +5 -5
  43. package/dist/assets/{markdownHeightCache-BMfTZ02N.js → markdownHeightCache-CAVQhVdd.js} +1 -1
  44. package/dist/assets/{mcpQueries-VE6ohhCb.js → mcpQueries-vmVVwTpL.js} +1 -1
  45. package/dist/assets/miniChat-BRBfrnmk.js +2 -0
  46. package/dist/assets/mobile-BUIfaNsP.js +2 -0
  47. package/dist/assets/{multirun-Ba_1t89r.js → multirun-1GSoWB-H.js} +1 -1
  48. package/dist/assets/{persistence-CoWdsn8M.js → persistence-DUPZl7Oy.js} +1 -1
  49. package/dist/assets/pl-aKpW58gt.js +15 -0
  50. package/dist/assets/{platform-Cl17ZOYo.js → platform-z2erC6Bs.js} +2 -2
  51. package/dist/assets/{projectMeta-DF-wxcjW.js → projectMeta-D3IGNNQh.js} +1 -1
  52. package/dist/assets/pt-BR-MliQk6-s.js +15 -0
  53. package/dist/assets/{rasterizePng-DZNznN7Z.js → rasterizePng-DCmIQQsI.js} +1 -1
  54. package/dist/assets/{relay-image-stream-BsB_ApBk.js → relay-image-stream-qI2NTXbG.js} +1 -1
  55. package/dist/assets/renderElectronMiniChatApp-DMUg8tvi.js +2 -0
  56. package/dist/assets/{renderMobileApp-C2YixTLg.js → renderMobileApp-DZaLZ-b9.js} +4 -4
  57. package/dist/assets/{runtime-fetch-DJVW43Cw.js → runtime-fetch-QCWYlAx0.js} +1 -1
  58. package/dist/assets/{runtime-switch-Ck0YPsR7.js → runtime-switch-3ad3yzM7.js} +1 -1
  59. package/dist/assets/runtimeConfig-BJepD3Y0.js +2 -0
  60. package/dist/assets/{runtimeEndpointReset-Bb0BK0JR.js → runtimeEndpointReset-BGGITu9Y.js} +1 -1
  61. package/dist/assets/sessionChangeSummary-CR90SDjh.js +2 -0
  62. package/dist/assets/sessionChangeSummary-vC84qM3v.css +1 -0
  63. package/dist/assets/{sessionLookup-BP3heiWj.js → sessionLookup-B8rBkNoR.js} +1 -1
  64. package/dist/assets/{sortable-tabs-strip-CgLj1fIA.js → sortable-tabs-strip-DSGwZHAT.js} +1 -1
  65. package/dist/assets/{speechSettingsQueries-DgCdTbV5.js → speechSettingsQueries-CVAWg738.js} +2 -2
  66. package/dist/assets/src-BAWBlgDt.css +2 -0
  67. package/dist/assets/store-D5OeM4wB.js +15 -0
  68. package/dist/assets/{terminalApi-B8MBtYf4.js → terminalApi-BnjU_lmF.js} +1 -1
  69. package/dist/assets/{textarea-DgVlBlA9.js → textarea-yLPH5NYp.js} +1 -1
  70. package/dist/assets/{tooltip-Cgzp7Xco.js → tooltip-B3eYZnNS.js} +1 -1
  71. package/dist/assets/uk-8Ovv1FvC.js +15 -0
  72. package/dist/assets/{url-BmJM1D3o.js → url-DAyfGWPH.js} +1 -1
  73. package/dist/assets/{useAppFontEffects-C4FL5nAN.js → useAppFontEffects-DJdHyEAP.js} +53 -53
  74. package/dist/assets/{useAssistantUIStore-Dej-0i1V.js → useAssistantUIStore-Dt0l5AKe.js} +1 -1
  75. package/dist/assets/{useDesktopWindowControlsLayout-CncoTsE8.js → useDesktopWindowControlsLayout-COV-TWix.js} +1 -1
  76. package/dist/assets/{useEffectiveDirectory-BwQn0I5k.js → useEffectiveDirectory-Dzsx_s3D.js} +1 -1
  77. package/dist/assets/{useFontPreferences-CGnJ_sK3.js → useFontPreferences-B4Cgu3bS.js} +1 -1
  78. package/dist/assets/{useMobileNavigationStore-2dQHPP2A.js → useMobileNavigationStore-B24J82Xs.js} +8 -8
  79. package/dist/assets/{useUIStore-CdCyJRb0.js → useUIStore-pl39iO82.js} +1 -1
  80. package/dist/assets/{useWorkerHighlightedLines-CO8kP8tW.js → useWorkerHighlightedLines-BrDkvxQW.js} +1 -1
  81. package/dist/assets/zh-CN-DYC-d6-i.js +15 -0
  82. package/dist/assets/zh-TW-OPu9_qbz.js +15 -0
  83. package/dist/index.html +11 -11
  84. package/dist/mini-chat.html +11 -11
  85. package/dist/mobile.html +11 -11
  86. package/dist/sw.js +1 -1
  87. package/package.json +1 -1
  88. package/server/lib/dictation/DOCUMENTATION.md +3 -1
  89. package/server/lib/dictation/service.js +1 -0
  90. package/server/lib/dictation/volcengine-session.js +5 -2
  91. package/server/lib/dictation/volcengine-session.test.js +8 -2
  92. package/server/lib/tts/DOCUMENTATION.md +11 -0
  93. package/server/lib/tts/direct-session.js +1 -1
  94. package/server/lib/tts/direct-session.test.js +21 -0
  95. package/server/lib/tts/direct-speech.test.js +20 -0
  96. package/server/lib/tts/settings.js +2 -1
  97. package/dist/assets/AgentAvatar-BRPyrjhY.js +0 -1
  98. package/dist/assets/AssistantView-aSdlY38u.js +0 -3
  99. package/dist/assets/LoadingImage-DZsBpRYx.js +0 -1
  100. package/dist/assets/MarkdownRenderer-BSrQCSxr.js +0 -2
  101. package/dist/assets/MarkdownRendererImpl-BmgsCLj8.js +0 -10
  102. package/dist/assets/MobileTabPageHeader-DcKOtnwN.js +0 -2
  103. package/dist/assets/dropdown-menu.styles-Dw94PXY7.js +0 -1
  104. package/dist/assets/es-B7Pk7Sm2.js +0 -15
  105. package/dist/assets/fr-BcJSt2Bt.js +0 -13
  106. package/dist/assets/insertionBoundaries-BL9G3wjG.js +0 -1
  107. package/dist/assets/ja-ex36lpwC.js +0 -15
  108. package/dist/assets/ko-CgIIQFMh.js +0 -15
  109. package/dist/assets/miniChat-CamREdRa.js +0 -2
  110. package/dist/assets/mobile-D9TkJI3N.js +0 -2
  111. package/dist/assets/pl-CbT2Ag4y.js +0 -15
  112. package/dist/assets/pt-BR-BqXoXmx6.js +0 -15
  113. package/dist/assets/renderElectronMiniChatApp-TjqgdRXK.js +0 -2
  114. package/dist/assets/runtimeConfig-DfKDrWh3.js +0 -2
  115. package/dist/assets/sessionChangeSummary-B15lUBlz.js +0 -2
  116. package/dist/assets/sessionChangeSummary-DpXRx1hd.css +0 -1
  117. package/dist/assets/src-bvi8KvVB.css +0 -2
  118. package/dist/assets/store-CYW4nz6C.js +0 -15
  119. package/dist/assets/uk-18wal33L.js +0 -15
  120. package/dist/assets/zh-CN-LO8acNQg.js +0 -15
  121. package/dist/assets/zh-TW-yk05f02-.js +0 -15
package/dist/index.html CHANGED
@@ -552,28 +552,28 @@
552
552
  opacity: 0.72;
553
553
  }
554
554
  </style>
555
- <script type="module" crossorigin src="/assets/main-BtR6Gsq0.js"></script>
555
+ <script type="module" crossorigin src="/assets/main-CtZ7bXuB.js"></script>
556
556
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
557
557
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-C8w0nlKy.js">
558
- <link rel="modulepreload" crossorigin href="/assets/runtime-switch-Ck0YPsR7.js">
559
- <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DJVW43Cw.js">
558
+ <link rel="modulepreload" crossorigin href="/assets/runtime-switch-3ad3yzM7.js">
559
+ <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-QCWYlAx0.js">
560
560
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
561
561
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
562
- <link rel="modulepreload" crossorigin href="/assets/useUIStore-CdCyJRb0.js">
562
+ <link rel="modulepreload" crossorigin href="/assets/useUIStore-pl39iO82.js">
563
563
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BP2cRVqX.js">
564
564
  <link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
565
565
  <link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
566
- <link rel="modulepreload" crossorigin href="/assets/persistence-CoWdsn8M.js">
567
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BfMzjRVt.js">
568
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-ML6japys.js">
566
+ <link rel="modulepreload" crossorigin href="/assets/persistence-DUPZl7Oy.js">
567
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BKeEWmL5.js">
568
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-FWm2fXr6.js">
569
569
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-MF2GBrFx.js">
570
570
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
571
- <link rel="modulepreload" crossorigin href="/assets/platform-Cl17ZOYo.js">
572
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B8MBtYf4.js">
571
+ <link rel="modulepreload" crossorigin href="/assets/platform-z2erC6Bs.js">
572
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BnjU_lmF.js">
573
573
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
574
574
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
575
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfKDrWh3.js">
576
- <link rel="stylesheet" crossorigin href="/assets/src-bvi8KvVB.css">
575
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BJepD3Y0.js">
576
+ <link rel="stylesheet" crossorigin href="/assets/src-BAWBlgDt.css">
577
577
  </head>
578
578
  <body class="h-full bg-background text-foreground">
579
579
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -74,28 +74,28 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-CamREdRa.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-BRBfrnmk.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-C8w0nlKy.js">
80
- <link rel="modulepreload" crossorigin href="/assets/runtime-switch-Ck0YPsR7.js">
81
- <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DJVW43Cw.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/runtime-switch-3ad3yzM7.js">
81
+ <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-QCWYlAx0.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
84
- <link rel="modulepreload" crossorigin href="/assets/useUIStore-CdCyJRb0.js">
84
+ <link rel="modulepreload" crossorigin href="/assets/useUIStore-pl39iO82.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BP2cRVqX.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
87
87
  <link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
88
- <link rel="modulepreload" crossorigin href="/assets/persistence-CoWdsn8M.js">
89
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BfMzjRVt.js">
90
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-ML6japys.js">
88
+ <link rel="modulepreload" crossorigin href="/assets/persistence-DUPZl7Oy.js">
89
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BKeEWmL5.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-FWm2fXr6.js">
91
91
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-MF2GBrFx.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
93
- <link rel="modulepreload" crossorigin href="/assets/platform-Cl17ZOYo.js">
94
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B8MBtYf4.js">
93
+ <link rel="modulepreload" crossorigin href="/assets/platform-z2erC6Bs.js">
94
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BnjU_lmF.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
97
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfKDrWh3.js">
98
- <link rel="stylesheet" crossorigin href="/assets/src-bvi8KvVB.css">
97
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BJepD3Y0.js">
98
+ <link rel="stylesheet" crossorigin href="/assets/src-BAWBlgDt.css">
99
99
  </head>
100
100
  <body class="h-full bg-background text-foreground">
101
101
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,28 +63,28 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-D9TkJI3N.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-BUIfaNsP.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-C8w0nlKy.js">
69
- <link rel="modulepreload" crossorigin href="/assets/runtime-switch-Ck0YPsR7.js">
70
- <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-DJVW43Cw.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/runtime-switch-3ad3yzM7.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/runtime-fetch-QCWYlAx0.js">
71
71
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CdzJ6My_.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-o69pgTEK.js">
73
- <link rel="modulepreload" crossorigin href="/assets/useUIStore-CdCyJRb0.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/useUIStore-pl39iO82.js">
74
74
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BP2cRVqX.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
76
76
  <link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-BWz0ose6.js">
77
- <link rel="modulepreload" crossorigin href="/assets/persistence-CoWdsn8M.js">
78
- <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BfMzjRVt.js">
79
- <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-ML6japys.js">
77
+ <link rel="modulepreload" crossorigin href="/assets/persistence-DUPZl7Oy.js">
78
+ <link rel="modulepreload" crossorigin href="/assets/desktopHosts-BKeEWmL5.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-FWm2fXr6.js">
80
80
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-MF2GBrFx.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
82
- <link rel="modulepreload" crossorigin href="/assets/platform-Cl17ZOYo.js">
83
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B8MBtYf4.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/platform-z2erC6Bs.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BnjU_lmF.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
86
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-DfKDrWh3.js">
87
- <link rel="stylesheet" crossorigin href="/assets/src-bvi8KvVB.css">
86
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BJepD3Y0.js">
87
+ <link rel="stylesheet" crossorigin href="/assets/src-BAWBlgDt.css">
88
88
  </head>
89
89
  <body class="h-full bg-background text-foreground">
90
90
  <div id="root" class="h-full"></div>
package/dist/sw.js CHANGED
@@ -1 +1 @@
1
- (function(){self.__WB_MANIFEST,self.addEventListener(`install`,e=>{e.waitUntil(self.skipWaiting())}),self.addEventListener(`activate`,e=>{e.waitUntil(self.clients.claim())}),self.addEventListener(`push`,e=>{e.waitUntil((async()=>{let t=e.data?.json()??null;if(!t||(await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).some(e=>e.visibilityState===`visible`||e.focused))return;let n=t.title||`OpenChamber`,r=t.body??``,i=t.icon??`/apple-touch-icon-180x180.png`,a=t.badge??`/favicon-32.png`;await self.registration.showNotification(n,{body:r,icon:i,badge:a,tag:t.tag,data:t.data})})())}),self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=(e.notification.data??null)?.url??`/`;e.waitUntil(self.clients.openWindow(t))})})();
1
+ (function(){self.__WB_MANIFEST,self.addEventListener(`install`,e=>{e.waitUntil(self.skipWaiting())}),self.addEventListener(`activate`,e=>{e.waitUntil(self.clients.claim())}),self.addEventListener(`push`,e=>{e.waitUntil((async()=>{let t=e.data?.json()??null;if(!t||(await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).some(e=>e.visibilityState===`visible`||e.focused))return;let n=t.title||`OpenChamberY`,r=t.body??``,i=t.icon??`/apple-touch-icon-180x180.png`,a=t.badge??`/favicon-32.png`;await self.registration.showNotification(n,{body:r,icon:i,badge:a,tag:t.tag,data:t.data})})())}),self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=(e.notification.data??null)?.url??`/`;e.waitUntil(self.clients.openWindow(t))})})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchambery/web",
3
- "version": "2.1.6-beta.1",
3
+ "version": "2.1.6-beta.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -74,7 +74,9 @@ provider, credentials, resource, language and local model from Host speech setti
74
74
  at session start (`../tts/settings.js`). Legacy `options` are ignored, including
75
75
  provider overrides. Saving during a session affects the next session; it cannot
76
76
  change an active upstream connection. Volcengine uses automatic language recognition
77
- and does not receive the Whisper language hint. Session copies are released on
77
+ and snapshots the optional Host `asrContext` description into `request.corpus.context`
78
+ as a serialized `dialog_ctx` object; empty text omits the corpus entirely. It
79
+ does not receive the Whisper language hint. Session copies are released on
78
80
  close, and credentials are never logged.
79
81
 
80
82
  ## Invariants
@@ -89,6 +89,7 @@ export function createDictationService({ modelsDir }) {
89
89
  const session = new VolcengineTranscriptionSession({
90
90
  apiKey: saved.apiKey,
91
91
  resourceId: saved.asrResourceId,
92
+ asrContext: saved.asrContext,
92
93
  });
93
94
  try {
94
95
  await session.connect();
@@ -44,10 +44,11 @@ function decodeFrame(input) {
44
44
  }
45
45
 
46
46
  export class VolcengineTranscriptionSession extends EventEmitter {
47
- constructor({ apiKey, resourceId = 'volc.seedasr.sauc.duration' }, { createSocket = (url, options) => new WebSocket(url, options) } = {}) {
47
+ constructor({ apiKey, resourceId = 'volc.seedasr.sauc.duration', asrContext = '' }, { createSocket = (url, options) => new WebSocket(url, options) } = {}) {
48
48
  super();
49
49
  this.apiKey = apiKey;
50
50
  this.resourceId = resourceId;
51
+ this.asrContext = asrContext;
51
52
  this.createSocket = createSocket;
52
53
  this.requiredSampleRate = 16000;
53
54
  this.autoCommitSeconds = 0;
@@ -91,7 +92,9 @@ export class VolcengineTranscriptionSession extends EventEmitter {
91
92
  socket.send(encodeFrame(1, Buffer.from(JSON.stringify({
92
93
  user: { uid: 'openchamber' },
93
94
  audio: { format: 'pcm', codec: 'raw', rate: 16000, bits: 16, channel: 1 },
94
- request: { model_name: 'bigmodel', result_type: 'full', enable_itn: true, enable_punc: true, enable_nonstream: true, show_utterances: true },
95
+ request: { model_name: 'bigmodel', result_type: 'full', enable_itn: true, enable_punc: true, enable_nonstream: true, show_utterances: true,
96
+ ...(this.asrContext.trim() ? { corpus: { context: JSON.stringify({ context_type: 'dialog_ctx', context_data: [{ text: this.asrContext.trim() }] }) } } : {}),
97
+ },
95
98
  }))), (error) => { if (error) fail(new Error('Volcengine ASR request could not be sent')); });
96
99
  });
97
100
  socket.on('message', (data) => {
@@ -17,7 +17,7 @@ const response = (text, last = false) => {
17
17
  return Buffer.concat([header, fields, payload]);
18
18
  };
19
19
 
20
- async function fixture({ fail = false, terminalWithoutText = false, disconnectOnFinish = false } = {}) {
20
+ async function fixture({ fail = false, terminalWithoutText = false, disconnectOnFinish = false, asrContext = '' } = {}) {
21
21
  const server = createServer();
22
22
  const wss = new WebSocketServer({ server });
23
23
  const frames = [];
@@ -39,7 +39,7 @@ async function fixture({ fail = false, terminalWithoutText = false, disconnectOn
39
39
  await new Promise((resolve) => wss.close(resolve));
40
40
  await new Promise((resolve) => server.close(resolve));
41
41
  });
42
- const session = new VolcengineTranscriptionSession({ apiKey: 'test-key' }, {
42
+ const session = new VolcengineTranscriptionSession({ apiKey: 'test-key', asrContext }, {
43
43
  createSocket: (url, options) => {
44
44
  expect(url).toBe('wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async');
45
45
  return new WebSocket(`ws://127.0.0.1:${server.address().port}`, options);
@@ -51,6 +51,12 @@ async function fixture({ fail = false, terminalWithoutText = false, disconnectOn
51
51
  }
52
52
 
53
53
  describe('Volcengine streaming dictation', () => {
54
+ it.each(['', 'Mixed Mandarin and English.\nReact and "OpenCode".'])('sends configured context and omits empty context: %s', async (asrContext) => {
55
+ const { frames } = await fixture({ asrContext });
56
+ const { request } = JSON.parse(frames[0].payload);
57
+ if (asrContext) expect(JSON.parse(request.corpus.context)).toEqual({ context_type: 'dialog_ctx', context_data: [{ text: asrContext }] });
58
+ else expect(request).not.toHaveProperty('corpus');
59
+ });
54
60
  it('retains the last full transcript when the successful terminal frame omits text', async () => {
55
61
  const { session } = await fixture({ terminalWithoutText: true });
56
62
  const partial = new Promise((resolve) => session.once('transcript', resolve));
@@ -129,6 +129,17 @@ unified file is first saved. Each section saves its own memory-only draft. A
129
129
  successful write emits `openchamber:speech-settings-changed`; startup and reconnect
130
130
  also fetch the authoritative snapshot without requiring Settings to be opened.
131
131
  Select Volcengine separately for read-aloud and dictation.
132
+ The Volcengine recognition context (`asrContext`) is a Host-owned editable English
133
+ scene description, defaulting to Mandarin/English software-development dictation.
134
+ It accepts multiline text up to 2,000 UTF-16 code units; empty text disables it.
135
+ Missing fields in existing Host files receive the default. New UI clients reading
136
+ older Hosts that omit the field treat it as disabled. Saves affect the next recording.
137
+ Direct ASR tickets snapshot this text; direct and legacy Host streaming requests
138
+ send it as `request.corpus.context`, a JSON string containing `context_type: dialog_ctx`
139
+ and one `context_data` text entry. No conversation history is collected automatically.
140
+ The provider additionally applies its 800-token context limit (not equivalent to
141
+ the local character bound). This setting does not affect TTS or the file ASR API.
142
+ Search terms lead to the stable recognition section without switching providers.
132
143
  Missing keys return HTTP 400, not a server failure.
133
144
  Enable `seed-tts-2.0`, `volc.seedasr.sauc.duration` (live dictation),
134
145
  and optionally `volc.bigasr.auc_turbo` (file API) in the
@@ -31,7 +31,7 @@ export async function createSpeechTicket(settings, kind, signal) {
31
31
  transport: 'volcengine-direct', token, appId: aud[0], expiresAt: exp * 1000, resourceId,
32
32
  ...(kind === 'tts' ? {
33
33
  voice: settings.voice, speed: settings.speechRate, pitch: settings.speechPitch, volume: settings.speechVolume,
34
- } : {}),
34
+ } : { asrContext: settings.asrContext ?? '' }),
35
35
  };
36
36
  }
37
37
 
@@ -5,6 +5,7 @@ import fs from 'node:fs';
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import { registerTtsRoutes } from './routes.js';
8
+ import { parseSpeechSettings, speechDefaults } from '../../../../ui/src/lib/voice/speechSettings.ts';
8
9
 
9
10
  let directory;
10
11
  let app;
@@ -43,6 +44,26 @@ it('does not mint tickets for other providers, missing keys or malformed session
43
44
  expect(fetch).not.toHaveBeenCalled();
44
45
  });
45
46
 
47
+ it('round-trips context, preserves it across unrelated saves and failed validation, and snapshots only saved ASR context', async () => {
48
+ vi.stubGlobal('fetch', vi.fn(async () => Response.json({ jwt_token: jwt() })));
49
+ const initial = (await request(app).get('/api/voice/settings').expect(200)).body;
50
+ expect(initial.asrContext).toBe(speechDefaults.asrContext);
51
+ const { asrContext: _context, ...legacy } = initial;
52
+ expect(parseSpeechSettings(legacy).asrContext).toBe('');
53
+ const context = 'Mixed Mandarin and English.\nReact, "OpenCode", and APIs.';
54
+ await request(app).put('/api/voice/settings').send({ asrContext: context }).expect(200);
55
+ await request(app).put('/api/voice/settings').send({ speechRate: 1.2 }).expect(200);
56
+ for (const asrContext of [42, null, 'x'.repeat(2001), 'bad\0text']) {
57
+ await request(app).put('/api/voice/settings').send({ asrContext }).expect(400);
58
+ }
59
+ expect((await request(app).get('/api/voice/settings')).body.asrContext).toBe(context);
60
+ expect(JSON.parse(fs.readFileSync(path.join(directory, 'speech/settings.json'), 'utf8')).asrContext).toBe(context);
61
+ expect((await request(app).post('/api/voice/session').send({ kind: 'asr', asrContext: 'ignored' })).body.asrContext).toBe(context);
62
+ expect((await request(app).post('/api/voice/session').send({ kind: 'tts' })).body).not.toHaveProperty('asrContext');
63
+ await request(app).put('/api/voice/settings').send({ asrContext: ' ' }).expect(200);
64
+ expect((await request(app).post('/api/voice/session').send({ kind: 'asr' })).body.asrContext).toBe('');
65
+ });
66
+
46
67
  it('rejects failed, oversized, malformed, expired and overlong tickets without leaking upstream details', async () => {
47
68
  for (const response of [
48
69
  new Response('fixture-key upstream-private', { status: 401 }),
@@ -18,6 +18,7 @@ let sockets;
18
18
  let mode;
19
19
  let audioChunks;
20
20
  let clients;
21
+ let asrRequests;
21
22
  const ticket = () => ({ transport: 'volcengine-direct', token: 'header.payload.signature', appId: 'fixture-app', expiresAt: Date.now() + 300000,
22
23
  resourceId: 'seed-tts-2.0', voice: 'zh_female_vv_uranus_bigtts', speed: 1, pitch: 1.1, volume: 0.8 });
23
24
  const waitFor = async (fn) => { for (let n = 0; n < 200; n++) { if (fn()) return; await new Promise((r) => setTimeout(r, 5)); } throw new Error('Fixture timed out'); };
@@ -40,6 +41,7 @@ function asrResponse(text, final = false) {
40
41
 
41
42
  beforeEach(async () => {
42
43
  urls = []; sockets = []; audioChunks = []; clients = []; mode = 'success'; mocks.identity = 'host-a';
44
+ asrRequests = [];
43
45
  mocks.openRuntimeWebSocket.mockReset();
44
46
  mocks.runtimeFetch.mockReset().mockImplementation(async () => Response.json(ticket()));
45
47
  server = new WebSocketServer({ port: 0, host: '127.0.0.1' }); await once(server, 'listening');
@@ -63,6 +65,8 @@ beforeEach(async () => {
63
65
  if (event === 102 && mode === 'success-close') socket.close();
64
66
  if (event === 102 && mode === 'failure') socket.send(ttsResponse(153, id, { message: 'private details' }));
65
67
  if (event === 102 && mode === 'truncated') socket.close();
68
+ } else if ((bytes[1] >> 4) === 1) {
69
+ asrRequests.push(JSON.parse(bytes.subarray(8).toString()));
66
70
  } else if ((bytes[1] >> 4) === 2) {
67
71
  if (bytes[1] & 2) { if (mode === 'success') socket.send(asrResponse(undefined, true)); else socket.close(); }
68
72
  else { audioChunks.push(bytes.subarray(8)); socket.send(asrResponse(`partial-${audioChunks.length}`)); }
@@ -102,6 +106,15 @@ it('streams 100 ASR chunks in order, publishes live partials, and accepts a term
102
106
  expect(mocks.openRuntimeWebSocket).not.toHaveBeenCalled();
103
107
  });
104
108
 
109
+ it.each([undefined, '', 'Mixed Mandarin and English.\nReact and "OpenCode".'])('sends the ticket context as serialized corpus or omits it: %s', async (asrContext) => {
110
+ mocks.runtimeFetch.mockResolvedValueOnce(Response.json({ ...ticket(), asrContext }));
111
+ const client = new DictationClient(); clients.push(client);
112
+ await client.startDictationStream('context', 'audio/pcm;rate=16000;bits=16');
113
+ await waitFor(() => asrRequests.length === 1);
114
+ if (asrContext) expect(JSON.parse(asrRequests[0].request.corpus.context)).toEqual({ context_type: 'dialog_ctx', context_data: [{ text: asrContext }] });
115
+ else expect(asrRequests[0].request).not.toHaveProperty('corpus');
116
+ });
117
+
105
118
  it.each(['cancel', 'runtime'])('fences a late ticket after %s without opening any socket', async (reason) => {
106
119
  let resolve;
107
120
  mocks.runtimeFetch.mockImplementationOnce(() => new Promise((r) => { resolve = r; }));
@@ -173,3 +186,10 @@ it('rejects stale or expired tickets rather than exposing them to an external so
173
186
  await expect(requestSpeechAudio('测试', new AbortController().signal)).rejects.toThrow('runtime changed');
174
187
  expect(urls).toHaveLength(0);
175
188
  });
189
+
190
+ it.each([123, 'x'.repeat(2001), 'bad\0context'])('rejects malformed ASR context before opening a provider socket', async (asrContext) => {
191
+ mocks.runtimeFetch.mockResolvedValueOnce(Response.json({ ...ticket(), asrContext }));
192
+ const client = new DictationClient(); clients.push(client);
193
+ await expect(client.startDictationStream('invalid', 'audio/pcm;rate=16000;bits=16')).rejects.toThrow('Invalid speech session');
194
+ expect(urls).toHaveLength(0);
195
+ });
@@ -8,6 +8,7 @@ const defaults = {
8
8
  voice: 'zh_female_vv_uranus_bigtts',
9
9
  resourceId: 'seed-tts-2.0',
10
10
  asrResourceId: 'volc.seedasr.sauc.duration',
11
+ asrContext: 'The speaker is discussing software development and technical tasks with an AI assistant. Speech may mix Mandarin Chinese and English within the same sentence. The conversation may cover requirements, system design, implementation, debugging, testing, deployment, and maintenance. Common software engineering terms include alpha, beta, release, stable, version, build, branch, commit, merge, pull request, code review, bug, fix, hotfix, patch, refactor, rollback, deploy, CI/CD, API, SDK, and CLI. Technical terms, product names, acronyms, and code identifiers may be spoken in English within otherwise Chinese sentences.',
11
12
  showMessageTTSButtons: false,
12
13
  voiceProvider: 'browser',
13
14
  speechRate: 1,
@@ -55,7 +56,7 @@ function normalizePatch(value) {
55
56
  if (!Object.hasOwn(value, field)) continue;
56
57
  const input = value[field];
57
58
  if (typeof input !== typeof defaults[field]
58
- || (typeof input === 'string' && (input.length > 4096 || /[\r\n\0]/.test(input) || (requiredStrings.has(field) && !input.trim())))
59
+ || (typeof input === 'string' && (input.length > (field === 'asrContext' ? 2000 : 4096) || (field === 'asrContext' ? /\0/ : /[\r\n\0]/).test(input) || (requiredStrings.has(field) && !input.trim())))
59
60
  || (enums[field] && !enums[field].includes(input))
60
61
  || (typeof input === 'number' && (!Number.isFinite(input) || input < ranges[field][0] || input > ranges[field][1]))) {
61
62
  throw new TypeError('Invalid speech settings');
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{r as i}from"./button-BnPjweDW.js";import{l as a}from"./rasterizePng-DZNznN7Z.js";import{n as o,t as s}from"./vendor-dicebear-core-CV95S5Pg.js";import{n as c,t as l}from"./vendor-dicebear-styles-7lEG-JsF.js";import{t as u}from"./useThemeSystem-8jhE4Zyk.js";var d=e(t(),1),f=r(),p={background:`#c1f2c4`},m={assistant:new o(c),agent:new o(l)};function h(e,t,n=!1,r){let i=e===`agent`?t?.trim().toLowerCase()||`default`:t||`default`;if(e===`agent`){let e=r??p;return new s(m.agent,{seed:i,size:128,idRandomization:!1,borderRadius:0,backgroundColor:[e.background.replace(`#`,``)]}).toDataUri()}return new s(m.assistant,{seed:i,size:128,scale:1.2,backgroundColor:[`00000000`],idRandomization:!1,animationVariant:n?`fastest`:`none`}).toDataUri()}var g=(e,t)=>({background:t(e)||p.background}),_=e=>{let t=(0,f.c)(5),n;t[0]===e?n=t[1]:(n=a(e),t[0]=e,t[1]=n);let r=n.var,i=u()?.currentTheme.colors,o;if(t[2]!==r||t[3]!==i){let e=i?{"--status-success":i.status.success,"--status-info":i.status.info,"--status-warning":i.status.warning,"--syntax-keyword":i.syntax.base.keyword,"--syntax-type":i.syntax.base.type,"--syntax-function":i.syntax.base.function,"--syntax-number":i.syntax.base.number,"--syntax-variable":i.syntax.base.variable}:{};o=g(r,t=>e[t]??``),t[2]=r,t[3]=i,t[4]=o}else o=t[4];return o},v=n(),y=d.memo(e=>{let t=(0,f.c)(33),{name:n,kind:r,animated:o,emoji:s,size:c,shape:l,className:u,label:d}=e,p=r===void 0?`agent`:r,m=o!==void 0&&o,g=c===void 0?16:c,y=l===void 0?`rounded`:l,b=a(n),x=_(n),S;bb0:{if(s){S=void 0;break bb0}if(p!==`agent`){let e;t[0]!==m||t[1]!==p||t[2]!==n?(e=h(p,n,m),t[0]=m,t[1]=p,t[2]=n,t[3]=e):e=t[3],S=e;break bb0}let e;t[4]!==m||t[5]!==p||t[6]!==n||t[7]!==x?(e=h(p,n,m,x),t[4]=m,t[5]=p,t[6]=n,t[7]=x,t[8]=e):e=t[8],S=e}let C=S,w=i(`inline-flex aspect-square shrink-0 overflow-clip`,y===`square`?`rounded-none`:y===`circle`?`rounded-full`:`rounded-sm`,s&&`items-center justify-center select-none`,b.class,u),T=`calc(${g}px * var(--dpt-n, 1))`,E=`calc(${g}px * var(--dpt-n, 1))`,D=`calc(${g}px * var(--dpt-n, 1))`,O=`calc(${g}px * var(--dpt-n, 1))`,k=`calc(${g}px * var(--dpt-n, 1))`,A=`calc(${g}px * var(--dpt-n, 1))`,j=`var(${b.var})`,M;t[9]===s?M=t[10]:(M=s?{display:`inline-flex`,alignItems:`center`,justifyContent:`center`}:null,t[9]=s,t[10]=M);let N;t[11]!==O||t[12]!==k||t[13]!==A||t[14]!==j||t[15]!==M||t[16]!==T||t[17]!==E||t[18]!==D?(N={width:T,minWidth:E,maxWidth:D,height:O,minHeight:k,maxHeight:A,color:j,...M},t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=T,t[17]=E,t[18]=D,t[19]=N):N=t[19];let P=d?`img`:void 0,F=!d||void 0,I;t[20]!==C||t[21]!==s||t[22]!==g?(I=s?(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-full w-full items-center justify-center leading-none`,style:{fontSize:`calc(${g*.75}px * var(--dpt-n, 1))`,lineHeight:1,transform:`translateY(0.06em)`},children:s}):(0,v.jsx)(`img`,{src:C,alt:``,draggable:!1,className:`block h-full w-full max-h-full max-w-full object-contain`,"aria-hidden":`true`}),t[20]=C,t[21]=s,t[22]=g,t[23]=I):I=t[23];let L;return t[24]!==p||t[25]!==d||t[26]!==y||t[27]!==N||t[28]!==P||t[29]!==F||t[30]!==I||t[31]!==w?(L=(0,v.jsx)(`span`,{className:w,style:N,"data-agent-avatar":``,"data-avatar-kind":p,"data-agent-avatar-shape":y,role:P,"aria-label":d,"aria-hidden":F,children:I}),t[24]=p,t[25]=d,t[26]=y,t[27]=N,t[28]=P,t[29]=F,t[30]=I,t[31]=w,t[32]=L):L=t[32],L});export{_ as n,h as r,y as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-C9bqkmLi.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-fetch-DJVW43Cw.js","assets/runtime-auth-C8w0nlKy.js","assets/runtime-switch-Ck0YPsR7.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-CdCyJRb0.js","assets/vendor-zustand-o69pgTEK.js","assets/vendor-react-BP2cRVqX.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-BnPjweDW.js","assets/persistence-CoWdsn8M.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/store-CYW4nz6C.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/rasterizePng-DZNznN7Z.js","assets/Icon-De3bTfBD.js","assets/useThemeSystem-8jhE4Zyk.js","assets/image-loading-4Touxv4x.js","assets/fileQueries-DfHYU8Iq.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/useRuntimeAPIs-Cx8S1HLz.js","assets/relay-image-stream-BsB_ApBk.js","assets/image-loading-BzqNA0Jz.css","assets/appThemeRegistry-DxQ0uJse.js","assets/platform-Cl17ZOYo.js","assets/vendor-opencode-client-MF2GBrFx.js","assets/useMobileNavigationStore-2dQHPP2A.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-Dej-0i1V.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/MarkdownRenderer-BSrQCSxr.js","assets/markdownHeightCache-BMfTZ02N.js","assets/dualLimitLru-D8Sphgua.js","assets/markdown-worker-DFNZ3KJ_.js","assets/useEffectiveDirectory-BwQn0I5k.js","assets/markdownTheme-CV7_0QAL.js","assets/ImageLoadingPlaceholder-DVxKuVwD.js","assets/useWorkerHighlightedLines-CO8kP8tW.js","assets/tooltip-Cgzp7Xco.js","assets/vendor-tanstack-react-virtual-B_EO--9t.js","assets/ToolOutputDialog-DesCcdFD.css"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{c as n,i as r,n as i}from"./runtime-switch-Ck0YPsR7.js";import{$ as a,G as o,K as s,Q as c,Y as l,et as u,ht as d,nt as f,st as p}from"./persistence-CoWdsn8M.js";import{a as m}from"./vendor-zustand-o69pgTEK.js";import{it as h,rt as g}from"./vendor-base-ui-CdzJ6My_.js";import{n as _,r as v}from"./platform-Cl17ZOYo.js";import{n as y}from"./useUIStore-CdCyJRb0.js";import{n as b}from"./vendor-react-BP2cRVqX.js";import{o as x}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{s as S}from"./vendor-tanstack-react-query-CdqCAt40.js";import{r as C}from"./vendor-sonner-ZS8XIOVl.js";import{a as w,d as T,f as E,i as D,n as O,r as k}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as A,r as j,t as M}from"./button-BnPjweDW.js";import{a as N,n as P}from"./MobileShareBridge-B0leJCQr.js";import{D as F,E as I,F as L,N as R,_ as z,b as B,c as V,d as H,i as U,n as W,o as G,p as ee,r as te,t as ne,u as K,v as re}from"./MobileDetailNavigation-CzOQIbvs.js";import{Ar as ie,Cn as q,Jt as ae,bo as oe,ct as J,jr as se,o as ce}from"./useMobileNavigationStore-2dQHPP2A.js";import{i as le,n as Y,r as ue}from"./useAssistantUIStore-Dej-0i1V.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge}from"./rasterizePng-DZNznN7Z.js";import{t as _e}from"./AgentAvatar-BRPyrjhY.js";import{n as ve}from"./Icon-De3bTfBD.js";import{i as ye}from"./OverlayScrollbar-_xcqpVSN.js";import{c as be,l as xe}from"./image-loading-4Touxv4x.js";import{n as X}from"./textarea-DgVlBlA9.js";import{A as Z,C as Se,E as Ce,O as we,a as Te,d as Ee,f as De,h as Oe,i as ke,k as Ae,l as je,m as Me,n as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re}from"./sessionChangeSummary-B15lUBlz.js";import{o as ze,t as Be}from"./vendor-framer-motion-D-oiwsxL.js";import{a as Ve,n as He,r as Ue,t as We}from"./fileMentionTouchSelection-CC7g7YFk.js";import{o as Ge,t as Ke}from"./MarkdownRenderer-BSrQCSxr.js";import{t as qe}from"./ImageLoadingPlaceholder-DVxKuVwD.js";import{t as Je}from"./LoadingImage-DZsBpRYx.js";import{t as Ye}from"./vendor-motion-88WXBOBf.js";import{a as Xe,t as Ze}from"./sessionLookup-BP3heiWj.js";import{a as Qe,i as $e,n as et,r as tt,t as nt}from"./context-menu-C_ImdU3v.js";import{i as rt,n as it,r as at}from"./assistant-attachment-cache-CPBGM8H7.js";var ot=b();function st(e){return[...e].sort((e,t)=>{let n=e.latestMessagePreview?.createdAt??-1/0,r=t.latestMessagePreview?.createdAt??-1/0;return n===r?0:r-n})}var Q=t(h(),1),$=g();function ct({snapshot:e,rowClassName:t}){let{t:n}=A(),[r,i]=Q.useState(!1),a=Q.useRef(!1),o=O(async()=>{if(!a.current){a.current=!0,i(!0);try{(await K(e)).failed&&C.error(n(`assistants.unread.markAllFailed`))}catch{C.error(n(`assistants.unread.markAllFailed`))}finally{a.current=!1,i(!1)}}});return e.assistants.some(e=>(e.unreadCount??0)>0)?(0,$.jsx)(`div`,{className:t,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,size:`xs`,onClick:o,className:`max-w-full whitespace-normal text-right`,disabled:r||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":r,children:n(`assistants.unread.markAll`)})}):null}var lt=m(e=>({workingByID:{},setWorking:(t,n)=>e(e=>({workingByID:{...e.workingByID,[t]:n}}))})),ut=({sending:e=!1,processing:t=!1,serverWorking:n=!1})=>e||t||n,dt=(e,t)=>{let n=(0,ot.c)(5),r=t!==void 0&&t,i;n[0]===e?i=n[1]:(i=t=>!!t.workingByID[e],n[0]=e,n[1]=i);let a=lt(i),o;return n[2]!==a||n[3]!==r?(o=ut({processing:a,serverWorking:r}),n[2]=a,n[3]=r,n[4]=o):o=n[4],o},ft=e=>{let t=(0,ot.c)(21),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c}=e,l=i===void 0?24:i,u=s===void 0||s,{t:d}=A(),f;t[0]!==n||t[1]!==o?(f=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=f):f=t[2];let p=lt(f),m=!!(o||p),h=`calc(${l}px * var(--dpt-n, 1))`,g;t[3]===c?g=t[4]:(g=j(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=g);let _;t[5]===h?_=t[6]:(_={width:h,minWidth:h,maxWidth:h,height:h,minHeight:h,maxHeight:h},t[5]=h,t[6]=_);let v=r??n,y;t[7]!==m||t[8]!==a||t[9]!==l||t[10]!==v?(y=(0,$.jsx)(_e,{kind:`assistant`,animated:m,name:v,size:l,label:a,shape:`rounded`,className:`rounded-[0.5rem]`}),t[7]=m,t[8]=a,t[9]=l,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==d||t[14]!==o?(b=o&&u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-background`,"data-assistant-working-dot":``,"aria-label":d(`assistants.contact.working`)}):null,t[12]=u,t[13]=d,t[14]=o,t[15]=b):b=t[15];let x;return t[16]!==g||t[17]!==_||t[18]!==y||t[19]!==b?(x=(0,$.jsxs)(`span`,{className:g,style:_,"data-assistant-working-avatar":``,children:[y,b]}),t[16]=g,t[17]=_,t[18]=y,t[19]=b,t[20]=x):x=t[20],x},pt=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(F)&&Number.isFinite(new Date(n.createdAt).getTime()))return{timestamp:n.createdAt,empty:!1}}return{timestamp:void 0,empty:e.generation>=0&&e.olderComplete&&!e.hasMessageGap}},mt=(e,t)=>{let n=(0,ot.c)(5),r;n[0]!==e||n[1]!==t?(r=te(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;return n[3]===r?i=n[4]:(i={...r,enabled:!1,select:pt},n[3]=r,n[4]=i),S(i)},ht=3e5,gt=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function _t(e){let t=new Map,n=null;for(let r of e){if(!(r.status===`error`||r.status===`failed`||r.parts.some(e=>e.type!==`text`||e.text.trim()&&!e.text.trim().startsWith(`oc.settle.`))))continue;let e=new Date(r.createdAt);Number.isFinite(e.getTime())&&((!n||!gt(n,e)||e.getTime()-n.getTime()>ht)&&t.set(r.messageID,r.createdAt),n=e)}return t}function vt(e,t,n){let r=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),i=new Intl.DateTimeFormat(e,{month:`long`,day:`numeric`}),a=new Intl.DateTimeFormat(e,{year:`numeric`,month:`long`,day:`numeric`});return e=>{let o=new Date(e);return`${gt(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var yt=Q.memo(e=>{let t=(0,ot.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=A(),s=dt(n,r),c=mt(n,xe()),l;t[0]!==c||t[1]!==i?(l=i!==void 0&&Number.isFinite(new Date(i).getTime())?i:c.data?.timestamp,t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=new Date().toDateString(),t[3]=d):d=t[3];let f=d,p;t[4]===a?p=t[5]:(p=a(`common.date.today`),t[4]=a,t[5]=p);let m=p,h;bb0:{if(u===void 0){h=null;break bb0}let e;t[6]!==o||t[7]!==u||t[8]!==m?(e=vt(o,m,new Date(f))(u),t[6]=o,t[7]=u,t[8]=m,t[9]=e):e=t[9],h=e}let g=h,_;t[10]!==c||t[11]!==g||t[12]!==a||t[13]!==s?(_=s?a(`assistants.conversation.typing`):g?a(`assistants.conversation.lastContact`,{time:g}):c.data?.empty?a(`assistants.conversation.neverContacted`):c.isError?a(`assistants.contact.loadFailed`):a(`common.loading`),t[10]=c,t[11]=g,t[12]=a,t[13]=s,t[14]=_):_=t[14];let v=_,y;return t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`mt-1 block truncate typography-micro font-normal leading-4 text-muted-foreground/70`,"aria-live":`polite`,title:v,children:v}),t[15]=v,t[16]=y),y});function bt(e){let t=(0,ot.c)(12),{assistantID:n,position:a}=e,o=Q.useRef(null),s=Q.useRef(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={busy:!1,done:!1,retryAt:0},t[0]=c):c=t[0];let l=Q.useRef(c),[u]=Q.useState(Et),d;t[1]!==n||t[2]!==a||t[3]!==u?(d=()=>{let e=o.current;if(!e||!s.current||l.current.busy||l.current.done||Date.now()<l.current.retryAt||u.transport!==r()||u.generation!==i()||document.visibilityState!==`visible`||(_()?!document.documentElement.classList.contains(`oc-native-app-active`):!document.hasFocus())||e.parentElement?.closest(`[inert], [aria-hidden="true"]`))return;let t=e.closest(`[data-assistant-contact-transcript]`);if(!t||t.scrollHeight-t.scrollTop-t.clientHeight>2)return;let c=e.getBoundingClientRect(),d=t.getBoundingClientRect(),f=window.visualViewport,p=f?.offsetTop??0,m=p+(f?.height??window.innerHeight);c.height<=0||c.width<=0||c.bottom>Math.min(d.bottom,m)||c.top<Math.max(d.top,p)||c.right<=Math.max(d.left,0)||c.left>=Math.min(d.right,window.innerWidth)||(l.current.busy=!0,H(n,a).then(()=>{l.current.done=!0}).catch(()=>{l.current.retryAt=Date.now()+15e3}).finally(()=>{l.current.busy=!1}))},t[1]=n,t[2]=a,t[3]=u,t[4]=d):d=t[4];let f=O(d),p;t[5]===f?p=t[6]:(p=e=>{s.current=e.some(Tt),f()},t[5]=f,t[6]=p);let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m={threshold:1},t[7]=m):m=t[7],D(o,O(p),m),k(`visibilitychange`,f,wt),k(`focus`,f,Ct),k(`resize`,f,St);let h,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>o.current?.closest(`[data-assistant-contact-transcript]`),g={passive:!0},t[8]=h,t[9]=g):(h=t[8],g=t[9]),k(`scroll`,f,h,g);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={attributes:!0,attributeFilter:[`class`]},t[10]=v):v=t[10],T(f,xt,v),w(f,15e3);let y;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`span`,{ref:o,"aria-hidden":`true`,className:`absolute bottom-0 left-0 block h-px w-px`,"data-assistant-read-marker":``}),t[11]=y):y=t[11],y}function xt(){return document.documentElement}function St(){return window.visualViewport}function Ct(){return window}function wt(){return document}function Tt(e){return e.isIntersecting&&e.intersectionRatio===1}function Et(){return{transport:r(),generation:i()}}var Dt=()=>{},Ot=Q.memo(Z),kt=e=>e?.directories.flatMap(({directory:e,sessions:t})=>e?t.filter(e=>!e.time.archived).map(t=>({...t,directory:e||t.location?.directory||t.directory||``})).filter(e=>e.directory.length>0):[])??null,At=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=A(),c=xe(),l=S({...se(c),select:kt}),u=Q.useMemo(()=>J({sessions:l.data??[],currentSessionId:null,searchQuery:e}),[l.data,e]),[d,f]=Q.useState({query:e,index:0}),p=Math.min(d.query===e?d.index:0,Math.max(0,u.length-1)),m=Q.useRef(null),h=Q.useRef([]),g=Q.useMemo(We,[]);k(`pointerdown`,e=>{e.target instanceof Node&&!m.current?.contains(e.target)&&a()},void 0,{capture:!0}),Q.useLayoutEffect(()=>{h.current[p]?.scrollIntoView?.({block:`nearest`})},[p]),Q.useLayoutEffect(()=>{r(u.length?`${n}-${p}`:void 0)},[p,n,u.length,r]);let _=O(t=>{if(t===`Escape`){a();return}u.length&&(t===`ArrowDown`&&f({query:e,index:(p+1)%u.length}),t===`ArrowUp`&&f({query:e,index:(p-1+u.length)%u.length}),(t===`Enter`||t===`Tab`)&&i(u[p]))});return Q.useImperativeHandle(o,()=>({keyDown:_}),[_]),(0,$.jsxs)(He,{ref:m,isMobile:t,className:`max-w-[640px] max-h-64`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-3 py-1`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`assistants.contact.sessionMention.scope`)}),(0,$.jsx)(M,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(ve,{name:`close`,className:`size-4`})})]}),l.isPending?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(`common.loading`)}):null,l.isError?(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 typography-meta text-[var(--status-error)]`,children:[s(`assistants.contact.sessionMention.loadFailed`),(0,$.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void l.refetch(),children:s(`chat.history.retry`)})]}):null,l.isSuccess&&!u.length?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(l.data===null?`common.unavailable`:`sessions.sidebar.empty.noMatches.title`)}):null,(0,$.jsx)(X,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,$.jsx)(`div`,{id:n,role:`listbox`,"aria-label":s(`chat.fileMentionAutocomplete.groups.sessions`),className:`p-1.5`,children:u.map((r,a)=>(0,$.jsxs)(`div`,{id:`${n}-${a}`,role:`option`,"aria-selected":a===p,ref:e=>{h.current[a]=e},className:j(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,Ue(t,a===p)),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>f({query:e,index:a}),onPointerDown:e=>{e.pointerType===`touch`&&g.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&g.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&g.pointerUp(()=>i(r))&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>g.pointerCancel(),onClick:()=>g.click(()=>i(r)),children:[(0,$.jsx)(ve,{name:`chat-thread`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium leading-5`,title:r.title,children:r.title||s(`chat.fileMentionAutocomplete.untitledSession`)}),(0,$.jsx)(`div`,{className:`truncate text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,title:r.directory,children:r.directory})]})]},`${r.directory}:${r.id}`))})}),t?null:(0,$.jsx)(`div`,{className:`mx-1.5 shrink-0 border-t px-1.5 py-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`chat.autocomplete.keyboardHint`)})]})}),jt=e=>{let t=(0,ot.c)(120),n,r,i,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],f=t[4],p=t[5]):({active:n,working:p,onChange:r,onVoiceSend:i,...f}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=f,t[5]=p);let m=p!==void 0&&p,{t:h}=A(),g=Q.useRef(null),_=n&&!!f.isMobile&&!!i,v;t[6]===_?v=t[7]:(v={available:_},t[6]=_,t[7]=v);let{enabled:y,hint:b,onHintChange:x}=Ae(v),S;t[8]!==b||t[9]!==f.placeholder||t[10]!==h?(S=b===null?f.placeholder:h(b===`recording`?`chat.dictation.releaseSend`:b===`cancelling`?`chat.dictation.releaseCancel`:b===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[8]=b,t[9]=f.placeholder,t[10]=h,t[11]=S):S=t[11];let C=S,w;t[12]===f.value?w=t[13]:(w=()=>({canonical:f.value,document:l(f.value,new Map)}),t[12]=f.value,t[13]=w);let[T,E]=Q.useState(w),D;t[14]!==T.canonical||t[15]!==T.document||t[16]!==f.value?(D=T.canonical===f.value?T.document:l(f.value,new Map),t[14]=T.canonical,t[15]=T.document,t[16]=f.value,t[17]=D):D=t[17];let k=D,[M,N]=Q.useState(0),[P,F]=Q.useState(!0),[I,L]=Q.useState(!1),[R,z]=Q.useState(),B=Q.useRef(null),V=Q.useRef(null),H=Q.useRef(null),U=Q.useRef(null),W;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(W=Re(),t[18]=W):W=t[18];let G=Q.useRef(W),ee=Q.useId(),te;t[19]!==n||t[20]!==I||t[21]!==M||t[22]!==P||t[23]!==k.text||t[24]!==f.disabled||t[25]!==f.pending?(te=n&&!f.pending&&!f.disabled&&!P&&!I?Ve({text:k.text,cursor:M}):null,t[19]=n,t[20]=I,t[21]=M,t[22]=P,t[23]=k.text,t[24]=f.disabled,t[25]=f.pending,t[26]=te):te=t[26];let ne=te,K=ne?.kind===`mention`?ne:null,re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{U.current!==null&&(B.current?.focus({preventScroll:!0}),B.current?.setSelectionRange(U.current,U.current),U.current=null)},t[27]=re):re=t[27];let ie;t[28]===k?ie=t[29]:(ie=[k],t[28]=k,t[29]=ie),Q.useLayoutEffect(re,ie);let q;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>F(!0),t[30]=q):q=t[30];let ae=O(q),oe;t[31]!==I||t[32]!==M||t[33]!==k||t[34]!==r?(oe=(e,t,n)=>{let i=n===void 0||n,a=u(e);a.ok&&(i&&(G.current=Ee(G.current,{before:je(k,[],{start:B.current?.selectionStart??M,end:B.current?.selectionEnd??M}),after:je(e,[],{start:t,end:t})})),I||(U.current=t),N(t),E({canonical:a.text,document:e}),r(a.text))},t[31]=I,t[32]=M,t[33]=k,t[34]=r,t[35]=oe):oe=t[35];let J=O(oe),se;t[36]!==J||t[37]!==k||t[38]!==K||t[39]!==h?(se=e=>{if(!K)return;let t=e.title||h(`chat.fileMentionAutocomplete.untitledSession`),n=s(k,K.tokenStart,K.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:d({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);F(!0),J(n.document,r)},t[36]=J,t[37]=k,t[38]=K,t[39]=h,t[40]=se):se=t[40];let ce=O(se),le;t[41]!==n||t[42]!==J||t[43]!==k||t[44]!==f.disabled||t[45]!==f.pending?(le=e=>{if(!n||f.pending||f.disabled||!e.trim())return;let t=k.text?`${k.text} ${e}`:e,r=c(k,t,t.length,t.length);J(r.document,r.caret),F(!0)},t[41]=n,t[42]=J,t[43]=k,t[44]=f.disabled,t[45]=f.pending,t[46]=le):le=t[46];let Y=O(le),ue;t[47]!==n||t[48]!==k.text||t[49]!==Y||t[50]!==r||t[51]!==i||t[52]!==f.disabled||t[53]!==f.pending?(ue=e=>{if(!(!n||f.pending||f.disabled||!e.trim())){if(k.text){Y(e);return}r(e),i?.(e)}},t[47]=n,t[48]=k.text,t[49]=Y,t[50]=r,t[51]=i,t[52]=f.disabled,t[53]=f.pending,t[54]=ue):ue=t[54];let de=O(ue),fe;t[55]!==J||t[56]!==k?(fe=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!k.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=o(n.selectionStart,n.selectionEnd,k.references)??{start:n.selectionStart,end:n.selectionEnd},i=u({text:k.text.slice(r.start,r.end),references:k.references.filter(e=>e.start>=r.start&&e.end<=r.end).map(e=>({...e,start:e.start-r.start,end:e.end-r.start}))});if(i.ok&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,i.text),t)){let e=c(k,k.text.slice(0,r.start)+k.text.slice(r.end),r.start,r.start);J(e.document,e.caret)}},t[55]=J,t[56]=k,t[57]=fe):fe=t[57];let pe=O(fe),me;t[58]!==k.references||t[59]!==k.text?(me=Oe(k.text,k.references.map(Mt))?.map(Nt),t[58]=k.references,t[59]=k.text,t[60]=me):me=t[60];let he=me,ge=y&&k.text.length===0?`true`:void 0,_e;t[61]!==y||t[62]!==Y||t[63]!==f.disabled||t[64]!==f.pending||t[65]!==de||t[66]!==x?(_e=y&&(0,$.jsx)(Ot,{containerRef:g,disabled:!!(f.pending||f.disabled),onInsert:Y,onSend:de,onRelease:Dt,onHintChange:x}),t[61]=y,t[62]=Y,t[63]=f.disabled,t[64]=f.pending,t[65]=de,t[66]=x,t[67]=_e):_e=t[67];let ve=k.text,ye=f.pending||m,be=f.pending===!0,xe=f.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,X;t[68]!==f.textLayoutClassName||t[69]!==xe?(X=j(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,xe,f.textLayoutClassName),t[68]=f.textLayoutClassName,t[69]=xe,t[70]=X):X=t[70];let Z;t[71]!==J||t[72]!==k?(Z=(e,t)=>{let n=c(k,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);J(n.document,n.caret),F(t?.nativeEvent?.inputType===`insertFromPaste`)},t[71]=J,t[72]=k,t[73]=Z):Z=t[73];let we=K?ee:void 0,Te=K?R:void 0,ke;t[74]===f.textareaProps?ke=t[75]:(ke=e=>{f.textareaProps?.onScroll?.(e),V.current&&(V.current.scrollTop=e.currentTarget.scrollTop,V.current.scrollLeft=e.currentTarget.scrollLeft)},t[74]=f.textareaProps,t[75]=ke);let Me,Ne;t[76]!==pe||t[77]!==f.textareaProps?(Me=e=>{f.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},Ne=e=>{f.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[76]=pe,t[77]=f.textareaProps,t[78]=Me,t[79]=Ne):(Me=t[78],Ne=t[79]);let Fe;t[80]===f.textareaProps?Fe=t[81]:(Fe=e=>{N(e.currentTarget.selectionStart),f.textareaProps?.onSelect?.(e)},t[80]=f.textareaProps,t[81]=Fe);let Ie,Le;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=()=>{L(!0)},Le=e=>{L(!1),N(e.currentTarget.selectionStart)},t[82]=Ie,t[83]=Le):(Ie=t[82],Le=t[83]);let ze;t[84]!==J||t[85]!==I||t[86]!==k||t[87]!==K||t[88]!==f.textareaProps?(ze=e=>{if(f.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||Ce(e))){if(I){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?De(G.current,k):Pe(G.current,k);t&&(e.preventDefault(),G.current=t.history,J(t.snapshot.document,t.snapshot.selection.end,!1),F(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=a(k,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),J(t.document,t.caret),F(!0);return}}K&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),H.current?.keyDown(e.key))}},t[84]=J,t[85]=I,t[86]=k,t[87]=K,t[88]=f.textareaProps,t[89]=ze):ze=t[89];let Be;t[90]!==f.textareaProps||t[91]!==we||t[92]!==Te||t[93]!==ke||t[94]!==Me||t[95]!==Ne||t[96]!==Fe||t[97]!==ze?(Be={...f.textareaProps,"aria-controls":we,"aria-activedescendant":Te,"aria-autocomplete":`list`,onScroll:ke,onCopy:Me,onCut:Ne,onSelect:Fe,onCompositionStart:Ie,onCompositionEnd:Le,onKeyDown:ze},t[90]=f.textareaProps,t[91]=we,t[92]=Te,t[93]=ke,t[94]=Me,t[95]=Ne,t[96]=Fe,t[97]=ze,t[98]=Be):Be=t[98];let He;t[99]!==ae||t[100]!==ee||t[101]!==K||t[102]!==f.isMobile||t[103]!==ce?(He=K?(0,$.jsx)(At,{ref:H,query:K.query,isMobile:f.isMobile??!1,listId:ee,onHighlightChange:z,onSelect:ce,onClose:ae}):null,t[99]=ae,t[100]=ee,t[101]=K,t[102]=f.isMobile,t[103]=ce,t[104]=He):He=t[104];let Ue;t[105]!==k.text||t[106]!==he||t[107]!==C||t[108]!==f||t[109]!==ye||t[110]!==be||t[111]!==X||t[112]!==Z||t[113]!==Be||t[114]!==He?(Ue=(0,$.jsx)(Se,{...f,value:ve,pending:ye,placeholder:C,disableInputWhilePending:be,inputRef:B,highlightedContent:he,highlightRef:V,textLayoutClassName:X,onChange:Z,textareaProps:Be,children:He}),t[105]=k.text,t[106]=he,t[107]=C,t[108]=f,t[109]=ye,t[110]=be,t[111]=X,t[112]=Z,t[113]=Be,t[114]=He,t[115]=Ue):Ue=t[115];let We;return t[116]!==ge||t[117]!==_e||t[118]!==Ue?(We=(0,$.jsxs)(`div`,{ref:g,className:`oc-hold-to-talk-container`,"data-hold-to-talk-empty":ge,children:[_e,Ue]}),t[116]=ge,t[117]=_e,t[118]=Ue,t[119]=We):We=t[119],We};function Mt(e){return{start:e.start,end:e.end,priority:103,...f(e)}}function Nt(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(Me,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var Pt=`max-h-72 max-w-full rounded-[1.35rem] border border-border/40 object-contain cursor-zoom-in`;function Ft({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=A(),i=xe(),{attachmentID:a,sha256:o,size:s,mime:c,filename:l}=t,u=Q.useMemo(()=>({type:`file`,attachmentID:a,sha256:o,size:s,mime:c,filename:l}),[a,o,s,c,l]),d=c.startsWith(`image/`),[f,p]=Q.useState(0),[m,h]=Q.useState(``),[g,_]=Q.useState(!1),[v,y]=Q.useState(!1),b=Q.useRef(null),x=Q.useRef([]);Q.useEffect(()=>{h(``),_(!1);let t=new AbortController,n;return d&&at(e,u,{signal:t.signal}).then(e=>{if(t.signal.aborted){e.release();return}n=e.release,h(e.url)}).catch(()=>{t.signal.aborted||_(!0)}),()=>{t.abort(),n?.()}},[e,u,i,d,f]),Q.useEffect(()=>()=>{b.current?.abort(),x.current.forEach(e=>URL.revokeObjectURL(e)),x.current=[]},[e,u,i]);let S=O(async()=>{if(b.current)return;let t=new AbortController;b.current=t,y(!0),_(!1);try{let n=await it(e,u,{signal:t.signal});if(t.signal.aborted)return;x.current.forEach(e=>URL.revokeObjectURL(e));let i=URL.createObjectURL(n);x.current=[i];let a=document.createElement(`a`);a.href=i,a.download=l||r(`assistants.contact.attachment.file`),document.body.appendChild(a),a.click(),a.remove()}catch{t.signal.aborted||_(!0)}finally{b.current===t&&(b.current=null),t.signal.aborted||y(!1)}}),C=l||r(d?`assistants.contact.attachment.image`:`assistants.contact.attachment.file`),w=O(e=>{!n||!m||n({open:!0,title:C,content:``,metadata:{tool:`image-preview`,filename:C,mime:c},previewSource:e.currentTarget,image:{url:m,mimeType:c,filename:C,size:s,gallery:[{url:m,mimeType:c,filename:C,size:s}],index:0}})});return d&&m&&!g?(0,$.jsx)(Je,{src:m,alt:C,className:Pt,onError:()=>_(!0),onClick:w,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),w(e))},role:`button`,tabIndex:0,"data-assistant-contact-image":``}):d&&!g?(0,$.jsx)(qe,{className:`size-48 max-w-full rounded-[1.35rem]`}):(0,$.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5 ring-1 ring-inset ring-[var(--surface-subtle)]`,"data-assistant-contact-file":``,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(ve,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:C})]}),g?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:r(`assistants.contact.attachment.loadFailed`)}):null,d&&!g||v?(0,$.jsx)(`span`,{role:`status`,className:`typography-micro text-muted-foreground`,children:r(`common.loading`)}):(0,$.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,onClick:d?()=>p(e=>e+1):()=>void S(),children:r(g?`chat.history.retry`:`assistants.contact.attachment.download`)})]})}function It(e){let t=(0,ot.c)(27),{part:n,onShowPopup:r}=e,{t:i}=A(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=be(a,``),[s,c]=Q.useState(!1),l;t[0]!==n.filename||t[1]!==i?(l=n.filename||i(`assistants.contact.attachment.image`),t[0]=n.filename,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]!==u||t[4]!==r||t[5]!==o?(d=e=>{!r||!o||r({open:!0,title:u,content:``,metadata:{tool:`image-preview`,filename:u},previewSource:e.currentTarget,image:{url:o,filename:u,gallery:[{url:o,filename:u}],index:0}})},t[3]=u,t[4]=r,t[5]=o,t[6]=d):d=t[6];let f=O(d);if(n.mime.startsWith(`image/`)&&o&&!s){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>c(!0),t[7]=e):e=t[7];let n;t[8]===f?n=t[9]:(n=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},t[8]=f,t[9]=n);let r;return t[10]!==u||t[11]!==f||t[12]!==o||t[13]!==n?(r=(0,$.jsx)(Je,{src:o,alt:u,className:Pt,onError:e,onClick:f,onKeyDown:n,role:`button`,tabIndex:0,"data-assistant-contact-image":``}),t[10]=u,t[11]=f,t[12]=o,t[13]=n,t[14]=r):r=t[14],r}let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ve,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),t[15]=p):p=t[15];let m;t[16]!==n.filename||t[17]!==i?(m=n.filename||i(`assistants.contact.attachment.file`),t[16]=n.filename,t[17]=i,t[18]=m):m=t[18];let h;t[19]===m?h=t[20]:(h=(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:m}),t[19]=m,t[20]=h);let g;t[21]!==s||t[22]!==i?(g=s?(0,$.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>c(!1),children:i(`chat.history.retry`)}):null,t[21]=s,t[22]=i,t[23]=g):g=t[23];let _;return t[24]!==h||t[25]!==g?(_=(0,$.jsxs)(`div`,{className:`flex max-w-full items-center gap-2.5 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5`,"data-assistant-contact-file":``,children:[p,h,g]}),t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function Lt(e){let t=(0,ot.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=xe(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(Ft,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(It,{part:r,onShowPopup:i},`${a}:${r.url}`),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o):o=t[4],o}var Rt=[],zt=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
3
- `),Bt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),Vt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Ht=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Ut=(e,t,n,r)=>({messageID:t?`${e.turnID}:preview:${t.bubbleIndex}`:`${e.turnID}:preview:${r}`,assistantID:e.assistantID,role:`assistant`,turnID:e.turnID,bubbleIndex:t?.bubbleIndex??0,createdAt:t?.occurredAt??e.occurredAt,ordinal:n,status:r,fromAssistantID:null,fromAssistantName:null,parts:t?[{type:`text`,text:t.text}]:[],text:t?.text??``,cards:[]}),Wt=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>Ut(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,Ut(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,Ut(e,null,n+r.length,`admitted`)]:r},Gt=(e,t,n,r=[])=>{let i=new Set(e.map(e=>e.messageID)),a=t.flatMap((t,r)=>t.assistantID!==n||i.has(t.messageID)?[]:[{messageID:t.messageID,assistantID:n,role:`user`,turnID:t.messageID,bubbleIndex:0,createdAt:t.createdAt,ordinal:e.length+r,status:t.status,fromAssistantID:null,fromAssistantName:null,parts:[...t.parts],text:zt(t.parts),cards:[]}]),o=a.length===0?e:[...e,...a],s=r.filter(e=>e.assistantID===n);if(s.length===0)return o;let c=new Map,l=new Map;o.forEach((e,t)=>{if(c.set(e.turnID,t),e.role!==`assistant`||e.messageID.includes(`:preview:`))return;let n=l.get(e.turnID)??new Set;n.add(e.bubbleIndex),l.set(e.turnID,n)});let u=new Map,d=[];for(let e of s){let t=Wt(e,l.get(e.turnID)??new Set,o.length+d.length);if(t.length===0)continue;let n=c.get(e.turnID);if(n===void 0){if(e.status===`failed`&&o.some(t=>t.turnID!==e.turnID))continue;d.push(...t);continue}let r=u.get(n)??[];r.push(...t),u.set(n,r)}return u.size===0&&d.length===0?o:o.flatMap((e,t)=>[e,...u.get(t)??[]]).concat(d)},Kt=(e,t)=>{let n=new Set(t.map(e=>e.messageID)),r=e.filter(e=>!n.has(e.messageID));return r.length===e.length?e:r},qt=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),Jt=(e,t,n,r=Date.now())=>{let i=e.filter(e=>e.assistantID!==t||e.status!==`failed`||e.turnID===n);return i.some(e=>e.assistantID===t&&e.turnID===n)?i.length===e.length?e:i:[...i,{assistantID:t,turnID:n,status:`admitted`,bubbles:[],occurredAt:r}]},Yt=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:Jt(e,t.assistantID,t.turnID,t.admittedAt),Xt=(e,t)=>{let n=t.assistantID,r=t.pendingSendTurnIDs??new Set,i=t.settledTurnIDs??new Set,a=typeof t.snapshotRevision==`number`&&Number.isFinite(t.snapshotRevision)?t.snapshotRevision:null,o=t.admissionRevisionByTurnID instanceof Map?t.admissionRevisionByTurnID:new Map(Object.entries(t.admissionRevisionByTurnID??{}).map(([e,t])=>[e,Number(t)])),s=t.occurredAt??Date.now(),c=t.activeContactTurn&&t.activeContactTurn.turnID?t.activeContactTurn:null,l=!!(t.serverWorking||c),u=Yt(e,c?{assistantID:n,turnID:c.turnID,admittedAt:c.admittedAt}:null,i),d=Array.isArray(t.messages)?t.messages:[];for(let e of d)e.role===`assistant`&&e.status===`error`&&(r.has(e.turnID)||i.has(e.turnID)||(u=Qt(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=$t(u,d),l){let t=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID)||c&&e.turnID===c.turnID)return!0;let t=o.get(e.turnID);return typeof t==`number`&&a!=null&&a<t?!0:typeof t==`number`&&a!=null&&a>=t&&e.turnID!==c?.turnID?!1:!c||e.turnID===c.turnID});return t.length===e.length&&t.every((t,n)=>t===e[n])?e:t}if(a==null)return u.length===e.length&&u.every((t,n)=>t===e[n])?e:u;let f=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID))return!0;if(i.has(e.turnID))return!1;let t=o.get(e.turnID);return typeof t==`number`&&a<t});return f.length===e.length&&f.every((t,n)=>t===e[n])?e:f.length===u.length?u:f},Zt=(e,t)=>Jt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>{if(e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`failed`||e.status===`complete`)return e;let n=e.bubbles.find(e=>e.bubbleIndex===t.bubbleIndex);if(n?.done)return e;let r=n?{...n,text:`${n.text}${t.delta}`,done:t.done,occurredAt:t.occurredAt}:{bubbleIndex:t.bubbleIndex,text:t.delta,done:t.done,occurredAt:t.occurredAt},i=n?e.bubbles.map(e=>e.bubbleIndex===t.bubbleIndex?r:e):[...e.bubbles,r].sort((e,t)=>e.bubbleIndex-t.bubbleIndex);return{...e,status:`streaming`,bubbles:i}}),Qt=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:Jt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`complete`||e.status===`failed`?e:{...e,status:t.status===`error`?`failed`:`complete`,...t.error?{error:t.error}:{}}),$t=(e,t)=>{let n=new Set(t.map(e=>e.turnID).filter(Boolean)),r=t.length>0?t[t.length-1]?.turnID??null:null,i=[...e].reverse().find(e=>e.status===`admitted`||e.status===`streaming`)?.turnID??r,a=new Set(t.flatMap(e=>e.role===`assistant`?[e.turnID]:[])),o=e.filter(e=>e.status===`admitted`||e.status===`streaming`||!(e.status===`complete`&&a.has(e.turnID)||!n.has(e.turnID)||e.status===`failed`&&(i&&i!==e.turnID||r&&r!==e.turnID)));return o.length===e.length?e:o},en=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),tn=(e,t)=>{if(e instanceof R){if(e.code===`no_provider`)return t.noProvider;if(e.code===`admission_timeout`||e.code===`generate_timeout`)return t.timedOut;if(e.message&&e.message!==e.code)return e.message}return L(e)?t.timedOut:t.sendFailed},nn=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},rn=e=>{let t=e.text.trim();if(e.sending||!t&&e.attachments.length===0||!e.gate.tryAcquire())return{ok:!1};let n=[...t?[{type:`text`,text:t}]:[],...e.attachments.map(e=>({type:`file`,mime:e.mime,url:e.url,filename:e.name}))],r=e.createMessageID();return{ok:!0,messageID:r,parts:n,turn:Bt(e.assistantID,r,n,e.createdAt)}},an=e=>e.some(e=>e.status===`sending`),on=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`),sn=[`cursor-pointer rounded-[1.35rem] bg-[var(--surface-elevated)] ring-1 ring-inset ring-[var(--surface-subtle)]`,`px-3.5 py-3 text-left transition-[background-color,box-shadow,transform] duration-200 ease-out motion-reduce:transition-none`,`hover:-translate-y-px hover:bg-interactive-hover/45 hover:shadow-sm active:translate-y-0 motion-reduce:hover:translate-y-0`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),cn=`${sn} w-fit min-w-0 max-w-[min(100%,15rem)]`,ln=`${sn} w-fit min-w-0 max-w-[min(100%,20rem)]`;function un(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var dn=e=>{let t=(0,ot.c)(23),{card:n}=e,{t:r}=A(),i=we(),a;t[0]===i?a=t[1]:(a=i&&!v(),t[0]=i,t[1]=a);let o=!!a,s=n.name,c=`${n.providerID}/${n.modelID}`,l;t[2]!==n.assistantID||t[3]!==o?(l=()=>{if(o){ce.getState().openAssistant(n.assistantID);return}Y(n.assistantID)},t[2]=n.assistantID,t[3]=o,t[4]=l):l=t[4];let u=O(l),d;t[5]===u?d=t[6]:(d=e=>{un(e,u)},t[5]=u,t[6]=d);let f=O(d),p;t[7]!==r||t[8]!==s?(p=r(`assistants.contact.card.assistant.aria`,{name:s}),t[7]=r,t[8]=s,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(ve,{name:`robot-2`,className:`size-5`})})}),t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]===c?g=t[14]:(g=(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:c}),t[13]=c,t[14]=g);let _;t[15]!==h||t[16]!==g?(_=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[h,g]})]}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let y;return t[18]!==f||t[19]!==u||t[20]!==p||t[21]!==_?(y=(0,$.jsx)(`article`,{className:cn,role:`button`,tabIndex:0,"aria-label":p,"data-assistant-contact-card":`assistant`,onClick:u,onKeyDown:f,children:_}),t[18]=f,t[19]=u,t[20]=p,t[21]=_,t[22]=y):y=t[22],y},fn=e=>{let t=(0,ot.c)(27),{card:n}=e,{t:r}=A(),i=n.name,a;t[0]!==n.kind||t[1]!==r?(a=n.kind===`daily`||n.kind===`weekly`||n.kind===`once`||n.kind===`cron`?r(`sessions.scheduledTasks.editor.scheduleType.${n.kind}`):n.kind,t[0]=n.kind,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==n.time||t[4]!==o?(s=[o,n.time].filter(Boolean),t[3]=n.time,t[4]=o,t[5]=s):s=t[5];let c=s.join(` · `),l;t[6]!==n.prompt||t[7]!==c?(l=c.trim()||(typeof n.prompt==`string`?n.prompt.trim():``),t[6]=n.prompt,t[7]=c,t[8]=l):l=t[8];let u=l,d=O(pn),f;t[9]===d?f=t[10]:(f=e=>{un(e,d)},t[9]=d,t[10]=f);let p=O(f),m;t[11]!==r||t[12]!==i?(m=r(`assistants.contact.card.schedule.aria`,{name:i}),t[11]=r,t[12]=i,t[13]=m):m=t[13];let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(ve,{name:`calendar`,className:`size-5`})})}),t[14]=h):h=t[14];let g;t[15]===i?g=t[16]:(g=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:i}),t[15]=i,t[16]=g);let _;t[17]===u?_=t[18]:(_=u?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:u}):null,t[17]=u,t[18]=_);let v;t[19]!==g||t[20]!==_?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[g,_]})]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;return t[22]!==p||t[23]!==d||t[24]!==m||t[25]!==v?(y=(0,$.jsx)(`article`,{className:cn,role:`button`,tabIndex:0,"aria-label":m,"data-assistant-contact-card":`schedule`,onClick:d,onKeyDown:p,children:v}),t[22]=p,t[23]=d,t[24]=m,t[25]=v,t[26]=y):y=t[26],y};function pn(){y.getState().setActiveMainTab(`schedule`),y.getState().setScheduledTasksDialogOpen(!0)}var mn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`?t:e===`idle`?`complete`:t===`busy`||t===`retry`||t===`idle`?t:t||`busy`,hn=e=>e===`cancelled`?`assistants.contact.card.session.status.cancelled`:e===`busy`?`assistants.contact.card.session.status.busy`:e===`retry`?`assistants.contact.card.session.status.retry`:e===`idle`?`assistants.contact.card.session.status.idle`:e===`complete`?`assistants.contact.card.session.status.complete`:e===`error`?`assistants.contact.card.session.status.error`:e===`question`?`assistants.contact.card.session.status.question`:null,gn=e=>e===`busy`?`bg-[var(--status-info)]/10 text-[var(--status-info)]`:e===`retry`||e===`question`?`bg-[var(--status-warning)]/10 text-[var(--status-warning)]`:e===`error`?`bg-[var(--status-error)]/10 text-[var(--status-error)]`:e===`idle`||e===`complete`?`bg-[var(--status-success)]/10 text-[var(--status-success)]`:`bg-[var(--surface-muted)] text-muted-foreground`,_n=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,vn=e=>{let t=(0,ot.c)(35),{card:n}=e,{t:r}=A(),i=we(),a;t[0]===i?a=t[1]:(a=i&&!v(),t[0]=i,t[1]=a);let o=!!a,s;t[2]===n.sessionID?s=t[3]:(s=e=>e.activeSessions.find(e=>e.id===n.sessionID)??e.archivedSessions.find(e=>e.id===n.sessionID)??null,t[2]=n.sessionID,t[3]=s);let c=ie(s),l=ae(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=mn(l?.type,n.status),f=hn(d),p=d===`busy`||d===`retry`,m=_n(typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory),h=Ne(c)||n.branch,g=ke(c),_=Fe(c),b=Le(_),x=[m,g,h].filter(yn),S;t[4]!==n.directory||t[5]!==n.sessionID||t[6]!==o?(S=()=>{let e=Ze(n.sessionID)?.directory||n.directory;q(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||y.getState().setActiveMainTab(`chat`)},t[4]=n.directory,t[5]=n.sessionID,t[6]=o,t[7]=S):S=t[7];let C=O(S),w;t[8]===C?w=t[9]:(w=e=>{un(e,C)},t[8]=C,t[9]=w);let T=O(w),E=ln,D=r(`assistants.contact.card.session.aria`,{title:u}),k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(ve,{name:`chat-3`,className:`size-5`})}),t[10]=k):k=t[10];let M;t[11]===p?M=t[12]:(M=p?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-[var(--surface-elevated)]`,"data-assistant-working-dot":``,"aria-hidden":!0}):null,t[11]=p,t[12]=M);let N;t[13]===M?N=t[14]:(N=(0,$.jsxs)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:[k,M]}),t[13]=M,t[14]=N);let P;t[15]===u?P=t[16]:(P=(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:u}),t[15]=u,t[16]=P);let F=f?(0,$.jsx)(`span`,{className:j(`shrink-0 rounded-full px-1.5 py-0.5 typography-micro leading-none`,gn(d)),children:r(f)}):null,I;t[17]!==P||t[18]!==F?(I=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[P,F]}),t[17]=P,t[18]=F,t[19]=I):I=t[19];let L;t[20]===x?L=t[21]:(L=x.length>0?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:x.join(` · `)}):null,t[20]=x,t[21]=L);let R=b||_?.files!==void 0&&_.files>0?(0,$.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-1.5 typography-micro tabular-nums`,children:[_?.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,_.additions]}),_?.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,_.deletions]}),_?.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:_.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:_.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:_.files})})]}):null,z;t[22]!==I||t[23]!==L||t[24]!==R?(z=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[I,L,R]}),t[22]=I,t[23]=L,t[24]=R,t[25]=z):z=t[25];let B;t[26]!==N||t[27]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[N,z]}),t[26]=N,t[27]=z,t[28]=B):B=t[28];let V;return t[29]!==T||t[30]!==C||t[31]!==B||t[32]!==E||t[33]!==D?(V=(0,$.jsx)(`article`,{className:E,role:`button`,tabIndex:0,"aria-label":D,"data-assistant-contact-card":`session`,onClick:C,onKeyDown:T,children:B}),t[29]=T,t[30]=C,t[31]=B,t[32]=E,t[33]=D,t[34]=V):V=t[34],V};function yn(e){return!!(e&&e.trim())}var bn=2,xn=1500,Sn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),Cn=e=>e.scrollHeight-e.scrollTop-e.clientHeight,wn=e=>Cn(e)<=bn,Tn=(e,t)=>{let n=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;n&&n!==e;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0;n=n.parentElement}return!1},En=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,Dn=({active:e,assistantID:t,contentRevision:n,onLoadEarlier:r})=>{let i=Q.useRef(null),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(!0),u=Q.useRef(null),d=Q.useRef(null),f=Q.useRef(null),p=Q.useRef(0),m=Q.useRef(null),h=Q.useRef(null),g=Q.useRef(e);g.current=e;let _=Be(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=O(()=>{y.current?.stop(),y.current=null,b.current=null}),S=Q.useMemo(()=>e=>{i.current=e,o(t=>t===e?t:e)},[]),C=Q.useMemo(()=>e=>{c(t=>t===e?t:e)},[]),w=O(()=>{let e=i.current;if(!e||!g.current||l.current)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.getBoundingClientRect().bottom>t);u.current=n?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:null}),T=O(()=>{let e=i.current,t=u.current;if(!e||!t||!g.current||l.current)return;if(Math.abs(e.scrollTop-p.current)>.5){p.current=e.scrollTop,w();return}let n=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.dataset.messageId===t.id);if(!n){w();return}let r=n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.offset;Math.abs(r)>.5&&(e.scrollTop+=r),p.current=e.scrollTop}),D=O(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),A=O(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=Sn(e),n=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(t.scrollTop<n-.5)return x(),l.current=!1,p.current=t.scrollTop,w(),!1;let r=!v.current;if(r&&e.querySelector(`[data-message-id]`)&&(v.current=!0),wn(t))return x(),p.current=t.scrollTop,!1;let a=Math.max(0,t.scrollHeight-t.clientHeight);return!r&&!_?b.current!==a&&(x(),b.current=a,y.current=ze(e.scrollTop,a,{duration:.22,ease:`easeOut`,onUpdate:t=>{if(!g.current||!l.current||i.current!==e)return;let n=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop<Math.min(p.current,n)-.5){l.current=!1,x(),p.current=e.scrollTop,w();return}e.scrollTop=Math.min(Math.max(e.scrollTop,t),n),p.current=e.scrollTop},onComplete:()=>{y.current=null,b.current=null}}),!0):(x(),e.scrollTop=a,p.current=e.scrollTop,!0)}),j=O(e=>{h.current={direction:e,expiresAt:performance.now()+xn}}),M=O(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),N=O(()=>{x(),l.current=!1,w()}),P=O(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=Sn(e),n=t.scrollTop>p.current,a=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(p.current=t.scrollTop,l.current){t.scrollTop<a-.5&&N();return}let o=M();w(),t.scrollTop<=80&&o===`up`&&r?.(),n&&wn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),F=O(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(Ie(t,e.target))return;j(`up`),N(),t.scrollTop<=80&&r?.();return}Tn(t,e.target)||j(`down`)}}),I=O(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),L=O(e=>{let t=i.current,n=e.touches.item(0);if(!t||!n){m.current=null;return}let a=m.current;if(!a)return;let o=n.clientY-a.y,s=o*a.deltaY<0,c=(s?0:a.deltaX)+n.clientX-a.x,l=(s?0:a.deltaY)+o;if(m.current={x:n.clientX,y:n.clientY,deltaX:c,deltaY:l},!(Math.abs(c)>=Math.abs(l))){if(l>0&&Ie(t,e.target)||l<0&&Tn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}j(l>0?`up`:`down`),l>2&&(N(),t.scrollTop<=80&&r?.())}}),R=O(()=>{m.current=null}),z=O(e=>{if(Te(e)){j(`up`),N(),(i.current?.scrollTop??1/0)<=80&&r?.();return}En(e)&&j(`down`)}),B=O(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&j(`scrollbar`)});Q.useLayoutEffect(()=>{let n=e?t:null,r=i.current;(d.current!==n||f.current!==r)&&(x(),v.current=!1,d.current=n,f.current=r,l.current=!0,u.current=null,h.current=null,m.current=null,p.current=r?.scrollTop??0),e&&(A(),T())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let V=Q.useMemo(()=>()=>void 0,[]),H=e&&a?a:V,U=Q.useMemo(()=>({passive:!0}),[]);k(`scroll`,P,H,U),k(`wheel`,F,H,U),k(`touchstart`,I,H,U),k(`touchmove`,L,H,U),k(`touchend`,R,H,U),k(`touchcancel`,R,H,U),k(`keydown`,z,H),k(`pointerdown`,B,H,U);let W=O(()=>{A(),T()});return E(typeof ResizeObserver<`u`&&e?s:null,W),{scrollRef:S,contentRef:C,preparePrepend:D}},On=64,kn=e=>{if(!e)return[];let t=Array.from(e.files||[]);return t.length>0?t:Array.from(e.items||[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e instanceof File)},An=e=>Array.from(e?.files||[]),jn=async(e,t=p)=>{let n=[],r=0;for(let i of Array.from(e||[])){if(!i||i.size<=0)continue;if(i.size>26214400){r+=1;continue}let e=URL.createObjectURL(i);n.push({id:t(),url:e,name:i.name.trim()||`attachment`,mime:i.type.trim()||`application/octet-stream`,file:i})}return{attachments:n,skippedTooLarge:r}},Mn=(e,t)=>{let n=[...e,...t];for(let e of n.slice(On))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,On)},Nn=Ge(()=>x(()=>import(`./ToolOutputDialog-C9bqkmLi.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),Pn=e=>e.trim().startsWith(`oc.settle.`),Fn=e=>e.role===`assistant`&&e.parts.length>0&&e.status!==`error`?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,In=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=A(),o=xe(),s=y(e=>e.isMobile),c=z(),l=B(),u=re(e.id,n),d=y(e=>e.isSettingsDialogOpen),f=n&&!d&&!u.hasMessageGap?I(e,u.data):null,m=N(e.name).displayName||e.name,h=(e,t)=>{let n=e?l.data?.assistants.find(t=>t.id===e):void 0;return n?N(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[g,_]=Q.useState(``),[v,b]=Q.useState([]),x=Q.useRef(null),S=Q.useRef(new Map),C=Q.useRef(new AbortController);Q.useEffect(()=>{let e=new AbortController;return C.current=e,()=>e.abort()},[e.id,o]);let w=Q.useRef(new Set);Q.useEffect(()=>{let e=new Set(v.map(e=>e.url));for(let t of w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[v]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[T,E]=Q.useState([]),[D,k]=Q.useState([]),[F,L]=Q.useState(null),[V,H]=Q.useState({open:!1,title:``,content:``}),G=y(e=>e.setImagePreviewOpen),te=O(e=>{(e.image||e.mermaid)&&(H(e),G(!0))}),ne=O(e=>{H(t=>({...t,open:e})),G(e)});Q.useEffect(()=>()=>{G(!1)},[G]);let K=Q.useRef(!1);Q.useEffect(()=>{S.current.clear(),x.current=null,E([]),k([]),L(null)},[o]);let ie=Q.useMemo(()=>nn(),[]),q=Q.useRef(new Set),ae=Q.useRef(new Map),J=lt(e=>e.setWorking),se=u.data?.messages??Rt,ce=Vt(T,e.id),le=Ht(D,e.id),Y=Gt(se,ce,e.id,le).filter(e=>{if(e.status===`admitted`&&e.messageID.endsWith(`:preview:admitted`))return!1;let t=Array.isArray(e.parts)?e.parts:[];return t.length===0||t.some(e=>!(e.type===`text`&&Pn(e.text)))}),ue=_t(Y),de=Be(),fe=`${o}:${e.id}`,pe=Q.useRef(null),me=pe.current,he=me?.lastID?Y.findIndex(e=>Fn(e)===me.lastID):-1,ge=n&&!de&&me?.scope===fe&&me.ready&&(me.lastID===null||he>=0);Q.useLayoutEffect(()=>{let e=Y.at(-1);pe.current={scope:fe,ready:n&&u.isSuccess,lastID:e?Fn(e):null}});let _e=new Date().toDateString(),ye=i(`common.date.today`),be=Q.useMemo(()=>vt(a,ye,new Date(_e)),[a,ye,_e]),X=an(ce),Z=on(le),Se=!!(e.working||e.activeContactTurn),Ce=l.data?.revision??null,we=le.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),Te=new Map(le.map(e=>[e.turnID,e])),Ee=Q.useRef(!1),De=O(async(e=!1)=>{if(!(!n||Ee.current||u.isFetchingPreviousPage||u.isFillingMessageGap)&&!(e&&u.previousPageError)&&!(!u.hasPreviousPage&&!u.hasMessageGap)){Ee.current=!0,Ae();try{u.hasMessageGap?await u.retryMessageGap():await u.fetchPreviousPage()}catch{}finally{Ee.current=!1}}}),{scrollRef:Oe,contentRef:ke,preparePrepend:Ae}=Dn({active:n,assistantID:e.id,contentRevision:`${Y[0]?.messageID}:${Y.length}:${we}:${u.isFetchingPreviousPage}:${u.hasPreviousPage}:${u.isFillingMessageGap}`,onLoadEarlier:()=>{De(!0)}});Q.useEffect(()=>{L(null),q.current.clear(),ae.current=new Map,E(t=>Vt(t,e.id)),k(t=>Ht(t,e.id)),H({open:!1,title:``,content:``}),G(!1)},[e.id,G]),Q.useEffect(()=>{E(e=>Kt(e,se))},[se]),Q.useEffect(()=>{let t=new Set(ce.filter(e=>e.status===`sending`).map(e=>e.messageID));k(n=>Xt(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:Se,snapshotRevision:Ce,admissionRevisionByTurnID:ae.current,pendingSendTurnIDs:t,messages:se,settledTurnIDs:q.current}))},[e.activeContactTurn,e.id,se,ce,Se,Ce]),Q.useEffect(()=>{J(e.id,X||Z||Se)},[e.id,Z,X,Se,J]),Q.useEffect(()=>{let t=e.id;return()=>{J(t,!1)}},[e.id,J]);let je=O(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){q.current.delete(t.turnID),k(e=>Jt(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(q.current.has(t.turnID))return;k(e=>Zt(e,t));return}t.type===`contact-turn-end`&&(q.current.add(t.turnID),k(e=>$t(Qt(e,t,{requireExisting:!0}),se)))}});Q.useEffect(()=>{if(n)return oe(je)},[n,e.id]);let Me=O(async e=>{if(X)return;let t=C.current,n=await jn(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&L(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>Mn(e,n.attachments))}),Ne=O(e=>{let t=kn(e.clipboardData);t.length!==0&&(e.preventDefault(),Me(t))}),Pe=O(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),Fe=O(e=>{let t=An(e.dataTransfer);t.length!==0&&(e.preventDefault(),Me(t))}),Ie=O(async t=>{let n=C.current,r=t??g,a=v,o=e.id,s=x.current,l=s?.assistantID===o&&s.text===r&&s.attachments===a?s.messageID:null,u=rn({gate:ie,sending:an(ce),text:r,attachments:a,assistantID:o,createMessageID:()=>l||`oc_contact_${p()}`});if(!u.ok)return;J(o,!0),x.current={assistantID:o,text:r,attachments:a,messageID:u.messageID},E(e=>[...e.filter(e=>e.messageID!==u.messageID),u.turn]),L(null);let d=()=>{_(e=>e===r?``:e),b(e=>e.filter(e=>!a.includes(e))),a.forEach(e=>S.current.delete(`${o}:${e.id}`)),x.current=null};try{let t=[];for(let e of a){let r=`${o}:${e.id}`,i=S.current.get(r);if(!i){if(i=await rt(o,e.file,e.id,n.signal),n.signal.aborted)return;S.current.set(r,i)}t.push(i)}if(n.signal.aborted)return;let r=[...u.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===u.messageID?{...e,parts:r}:e));let i=await ee(o,u.messageID,{parts:r});if(n.signal.aborted)return;d(),typeof i.revision==`number`&&ae.current.set(u.messageID,i.revision),E(e=>qt(e,u.messageID)),q.current.has(u.messageID)||k(e=>Jt(e,o,u.messageID)),c.data?.serverInstanceID&&P({serverInstanceID:c.data.serverInstanceID,assistantID:o,name:m,avatarSeed:e.avatarSeed??o}).catch(()=>void 0)}catch(e){if(n.signal.aborted)return;if(e instanceof R&&e.code===`admission_timeout`)try{let e=await U(o,u.messageID);if(n.signal.aborted)return;if(e){d(),typeof e.revision==`number`&&ae.current.set(u.messageID,e.revision),E(e=>qt(e,u.messageID)),q.current.has(u.messageID)||k(e=>Jt(e,o,u.messageID));return}}catch{}let t=tn(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>en(e,u.messageID,t)),L(t)}finally{ie.release()}}),Le=O(async()=>{if(K.current)return;K.current=!0;let t=C.current;L(null);try{await W(e.id,e)}catch(e){t.signal.aborted||L(e instanceof Error?e.message:i(`settings.mcp.page.toast.unexpectedError`))}finally{K.current=!1}}),Re=u.isError&&Y.length===0,ze=u.isSuccess&&Y.length===0,Ve=new Map(ce.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Oe,className:j(`min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 sm:px-8`,r?`pt-[calc(max(0.625rem,var(--oc-safe-area-top,0px))+var(--oc-mobile-detail-navigation-height)+1.25rem)]`:`pt-5 sm:pt-7`),style:{overflowAnchor:`none`,overscrollBehavior:`contain`,overscrollBehaviorY:`contain`},"data-assistant-contact-transcript":``,children:[t?(0,$.jsx)(`p`,{className:`mb-3 typography-micro text-[var(--status-warning)]`,children:t}):null,Re?(0,$.jsxs)(`div`,{ref:ke,className:`mx-auto flex h-full min-h-56 max-w-xs flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-error":``,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ft,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:m}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -right-1 -bottom-1 flex size-5 items-center justify-center rounded-full bg-[var(--surface-elevated)] text-[var(--status-error)] ring-2 ring-background`,children:(0,$.jsx)(ve,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:m}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void u.refetch(),children:i(`chat.history.retry`)})]}):ze?(0,$.jsxs)(`div`,{ref:ke,className:`mx-auto flex h-full min-h-56 max-w-sm flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-empty":``,children:[(0,$.jsx)(ft,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:m,className:`opacity-90`}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:m})}),(0,$.jsx)(`p`,{className:`mt-2 max-w-xs typography-ui leading-6 text-muted-foreground/80`,children:i(`assistants.contact.empty`)})]}):(0,$.jsxs)(`div`,{ref:ke,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[u.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,u.hasPreviousPage||u.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":u.isFetchingPreviousPage||u.isFillingMessageGap,children:[u.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,u.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,disabled:u.isFetchingPreviousPage||u.isFillingMessageGap,onClick:()=>void De(),children:i(u.isFetchingPreviousPage||u.isFillingMessageGap?`chat.history.loadingMore`:u.previousPageError||u.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,Y.map((t,n)=>{let r=`${fe}:${Fn(t)}`,a=n>0?Y[n-1]:null,s=ue.get(t.messageID),c=s!==void 0,u=c?(0,$.jsx)(`div`,{className:`flex w-full justify-center px-4 pt-7 pb-4 first:pt-1`,"data-assistant-contact-time":``,children:(0,$.jsx)(`time`,{dateTime:new Date(s).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:be(s)})}):null,d=t.role===`user`,p=t.role===`peer`,g=t.role===`assistant`&&!c&&a?.role===`assistant`&&a.turnID===t.turnID,_=a?.turnID!==t.turnID,v=!d&&(p||!g),y=p?h(t.fromAssistantID,t.fromAssistantName):m,b=p&&t.fromAssistantID?l.data?.assistants.find(e=>e.id===t.fromAssistantID):e,x=Ve.get(t.messageID),S=Te.get(t.turnID),C=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`);return t.status===`error`||C?(0,$.jsxs)(Q.Fragment,{children:[u,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:j(`relative px-1`,!c&&`mt-3`),children:[(0,$.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap typography-micro text-[var(--status-error)] [overflow-wrap:anywhere]`,children:t.text||S?.error||i(`assistants.contact.sendFailed`)}),f?.messageID===t.messageID?(0,$.jsx)(bt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]},r):(0,$.jsxs)(Q.Fragment,{children:[u,(0,$.jsxs)(Ye.div,{"data-message-id":t.messageID,initial:ge&&n>he?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:de?0:.18,ease:`easeOut`},className:j(`flex w-full`,d?`justify-end`:`justify-start`,c?`mt-0`:_?`mt-6 first:mt-0`:g?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":x?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!g?``:void 0,children:[d?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-8 shrink-0 justify-center pt-0.5`,children:v?(0,$.jsx)(ft,{name:b?.id||t.fromAssistantID||e.id,avatarSeed:b?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:28,label:y,working:t.status===`streaming`||void 0,showWorkingDot:!1}):(0,$.jsx)(`span`,{className:`size-7`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:j(`relative flex min-w-0 flex-col gap-1.5`,d?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[p?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:y})}):null,t.parts.map((n,a)=>{if(n.type===`card`&&n.cardType===`session`)return(0,$.jsx)(vn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`assistant`)return(0,$.jsx)(dn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`schedule`)return(0,$.jsx)(fn,{card:n},`${r}:card:${a}`);if(n.type===`file`)return(0,$.jsx)(Lt,{assistantID:e.id,part:n,onShowPopup:te},`${r}:file:${a}`);if(n.type===`text`&&Pn(n.text))return null;if(n.type===`text`&&(n.text.trim()||t.status===`streaming`)){let e=!d;return(0,$.jsx)(`div`,{"aria-label":p?i(`assistants.contact.peer.aria`,{name:y}):void 0,"data-assistant-contact-text":``,className:j(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] px-4 py-2.5 typography-markdown leading-6`,e?null:`whitespace-pre-wrap`,d?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:p?`rounded-[1.25rem] border border-dashed border-border/50 bg-[var(--surface-muted)]/70 text-foreground`:j(`bg-[var(--surface-muted)] text-foreground`,g&&`rounded-tl-lg`)),children:e?(0,$.jsx)(Ke,{content:n.text,messageId:r,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:te,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):n.text},`${r}:text:${a}`)}return null}),x?.status===`sending`?(0,$.jsx)(`p`,{className:`absolute right-1 top-full mt-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.sending`)}):null,x?.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 typography-micro text-[var(--status-error)]`,children:x.error||i(`assistants.contact.sendFailed`)}):null,f?.messageID===t.messageID?(0,$.jsx)(bt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]})]},r)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-[2.625rem] flex h-8 items-center`,"data-assistant-contact-status-slot":``,children:X||Z||Se?(0,$.jsxs)(`div`,{role:`status`,"aria-label":i(`assistants.contact.processing`),className:`inline-flex items-center gap-1 px-4 text-muted-foreground/70`,"data-assistant-contact-processing":``,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.45s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.22s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-duration:1.4s] motion-reduce:animate-none`})]}):null})]})]}),(0,$.jsxs)(`footer`,{className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[F?(0,$.jsxs)(`div`,{className:`chat-input-column mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:F}),x.current?(0,$.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,disabled:X,onClick:()=>void Ie(),children:i(`chat.history.retry`)}):null]}):null,(0,$.jsx)(`form`,{className:j(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area oc-mobile-composer`),onSubmit:e=>{e.preventDefault(),Ie()},onDragOver:Pe,onDrop:Fe,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(jt,{active:n,layout:`inline`,value:g,attachments:v,pending:X,working:Z||Se,onStop:Z||Se?()=>{Le()}:void 0,stopLabel:i(`chat.chatInput.actions.stopGeneratingAria`),isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:m}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>_(e),onVoiceSend:e=>{Ie(e)},onSubmit:()=>{Ie()},onAddFiles:e=>{Me(e)},onRemoveAttachment:t=>{X||(S.current.delete(`${e.id}:${t}`),x.current=null,b(e=>e.filter(e=>e.id!==t)))},onPaste:Ne,onDragOver:Pe,onDrop:Fe,className:j(`relative z-10`,s&&`oc-mobile-composer-surface`),style:{borderRadius:`1.5rem`},"data-assistant-contact-composer-surface":``,textareaProps:{"aria-label":i(`assistants.contact.placeholder`,{name:m})}},`${o}:${e.id}`)})})]}),V.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Nn,{popup:V,onOpenChange:ne,isMobile:s})}):null]})};async function Ln(e){await G(e);let t=le.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await V();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&le.getState().setDefaultShareAssistant(null)}function Rn({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=A(),[a,o]=Q.useState(!1),s=e?N(e.name).displayName||e.name:``,c=O(e=>{a&&!e||n(e)}),l=O(()=>{a||n(!1)}),u=O(async()=>{if(!(!e||a)){o(!0);try{await Ln(e),r?.(e.id),n(!1),C.success(i(`assistants.settings.toast.deleted`))}catch{C.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,$.jsx)(pe,{open:t&&e!==null,onOpenChange:c,children:(0,$.jsxs)(he,{className:`max-w-md`,children:[(0,$.jsxs)(me,{children:[(0,$.jsx)(ge,{children:i(`assistants.settings.delete`)}),(0,$.jsx)(fe,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,$.jsxs)(de,{children:[(0,$.jsx)(M,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,$.jsx)(M,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var zn=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,Bn={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function Vn(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?Bn[e.fallbackKind]:`assistants.contact.empty`)}var Hn=e=>e.capabilityPending?`loading`:e.capabilityError||e.supported!==!0||e.capabilityEnabled!==!0?`unavailable`:e.snapshotPending?`loading`:e.snapshotEnabled===!0?e.assistantCount===0?`onboarding`:e.hasAssistant?`ready`:e.snapshotSettled?`unavailable`:`loading`:`unavailable`,Un=e({AssistantView:()=>Kn}),Wn=e=>{let t=(0,ot.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=A(),o=we(),s;t[0]===n?s=t[1]:(s=n?N(n.name):null,t[0]=n,t[1]=s);let c=s,l=n&&c?c.displayName||n.name:``,u;t[2]!==n||t[3]!==o||t[4]!==i?(u=()=>{if(n){if(i){i(n.id);return}ue(n.id,o?{openMobileSettings:o.openSettings}:void 0)}},t[2]=n,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=O(u),f;t[6]!==n||t[7]!==l||t[8]!==a?(f=n?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(ft,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,$.jsx)(yt,{assistantID:n.id,serverWorking:!!(n.working||n.activeContactTurn),lastContactAt:n.latestMessagePreview?.createdAt})]})]}):l||a(`assistants.title`),t[6]=n,t[7]=l,t[8]=a,t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=a(`assistants.actions.backToChat`),t[10]=a,t[11]=p);let m;t[12]!==n||t[13]!==d||t[14]!==a?(m=n?[{icon:`settings-3`,ariaLabel:a(`assistants.conversation.openSettings`),onClick:d}]:[],t[12]=n,t[13]=d,t[14]=a,t[15]=m):m=t[15];let h;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsx)(ne,{title:f,backAriaLabel:p,onBack:r,actions:m,overlay:!0}),t[16]=r,t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h},Gn=e=>{let t=(0,ot.c)(53),{avatarSeed:n,unreadCount:r,summary:i,assistantID:a,displayName:o,selected:s,enabled:c,editLabel:l,deleteLabel:u,onSelect:d,onEdit:f,onDelete:p,serverWorking:m}=e,h=dt(a,m!==void 0&&m),[g,_]=Q.useState(!1),v;t[0]===d?v=t[1]:(v=()=>d(),t[0]=d,t[1]=v);let y=O(v),b;t[2]===f?b=t[3]:(b=()=>{_(!1),f()},t[2]=f,t[3]=b);let x=O(b),S;t[4]===p?S=t[5]:(S=()=>{_(!1),p()},t[4]=p,t[5]=S);let C=O(S),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),_(!0)},t[6]=w):w=t[6];let T=s?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,E=!c&&`opacity-65`,D;t[7]!==T||t[8]!==E?(D=j(`flex w-full min-h-11 items-center gap-3 rounded-xl border px-3 py-3 text-left outline-none transition-[background-color,border-color,opacity] duration-150 ease-out active:bg-interactive-active focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,T,E),t[7]=T,t[8]=E,t[9]=D):D=t[9];let k;t[10]!==y||t[11]!==s||t[12]!==D?(k=(0,$.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":s,onClick:y,onContextMenu:w,className:D}),t[10]=y,t[11]=s,t[12]=D,t[13]=k):k=t[13];let A;t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==h?(A=(0,$.jsx)(ft,{name:a,avatarSeed:n,size:44,label:o,working:h}),t[14]=a,t[15]=n,t[16]=o,t[17]=h,t[18]=A):A=t[18];let M=s?`font-semibold`:`font-medium`,N;t[19]===M?N=t[20]:(N=j(`block truncate typography-ui-label leading-5`,M),t[19]=M,t[20]=N);let P;t[21]!==o||t[22]!==N?(P=(0,$.jsx)(`span`,{className:N,children:o}),t[21]=o,t[22]=N,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=j(zn,`mt-1 leading-5`),t[24]=F):F=t[24];let I;t[25]===i?I=t[26]:(I=(0,$.jsx)(`span`,{className:F,children:i}),t[25]=i,t[26]=I);let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]===r?R=t[31]:(R=(0,$.jsx)(Xe,{count:r}),t[30]=r,t[31]=R);let z;t[32]!==A||t[33]!==L||t[34]!==R||t[35]!==k?(z=(0,$.jsxs)(Qe,{render:k,children:[A,L,R]}),t[32]=A,t[33]=L,t[34]=R,t[35]=k,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ve,{name:`edit`,className:`size-4`}),t[37]=B):B=t[37];let V;t[38]!==l||t[39]!==x?(V=(0,$.jsxs)(tt,{onClick:x,children:[B,l]}),t[38]=l,t[39]=x,t[40]=V):V=t[40];let H;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)($e,{}),t[41]=H):H=t[41];let U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(ve,{name:`delete-bin`,className:`size-4`}),t[42]=U):U=t[42];let W;t[43]!==u||t[44]!==C?(W=(0,$.jsxs)(tt,{onClick:C,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[U,u]}),t[43]=u,t[44]=C,t[45]=W):W=t[45];let G;t[46]!==V||t[47]!==W?(G=(0,$.jsxs)(et,{className:`min-w-[10rem]`,children:[V,H,W]}),t[46]=V,t[47]=W,t[48]=G):G=t[48];let ee;return t[49]!==g||t[50]!==z||t[51]!==G?(ee=(0,$.jsxs)(nt,{open:g,onOpenChange:_,children:[z,G]}),t[49]=g,t[50]=z,t[51]=G,t[52]=ee):ee=t[52],ee},Kn=e=>{let t=(0,ot.c)(118),{activeOverride:i,onMobileBack:a,onMobileOpenSettings:o}=e,{t:s}=A(),{isMobile:c}=ye(),l=we(),u=Q.useSyncExternalStore(n,r,r),d=y(qn),f=i??d,p=y(Jn),m=c||p,h=z(),g=B(),_=g.data;_?.assistants;let v;t[0]===_?.assistants?v=t[1]:(v=_?.assistants??[],t[0]=_?.assistants,t[1]=v);let b;t[2]===v?b=t[3]:(b=st(v),t[2]=v,t[3]=b);let x=b,S;t[4]===u?S=t[5]:(S=e=>e.assistantByTransport[u]??null,t[4]=u,t[5]=S);let C=le(S),w=le(Yn),T=le(Xn),E;t[6]!==C||t[7]!==_?.assistants?(E=_?.assistants.find(e=>e.id===C)??null,t[6]=C,t[7]=_?.assistants,t[8]=E):E=t[8];let D=E,k;t[9]!==w||t[10]!==C||t[11]!==_?(k=()=>{!C&&_?.assistants[0]&&w(_.assistants[0].id)},t[9]=w,t[10]=C,t[11]=_,t[12]=k):k=t[12];let P=_?.assistants,F;t[13]!==w||t[14]!==C||t[15]!==P?(F=[w,C,P],t[13]=w,t[14]=C,t[15]=P,t[16]=F):F=t[16],Q.useEffect(k,F);let I;t[17]!==D||t[18]!==w||t[19]!==C||t[20]!==_?.assistants||t[21]!==g.isSuccess?(I=()=>{g.isSuccess&&C&&!D&&w(_?.assistants[0]?.id??null)},t[17]=D,t[18]=w,t[19]=C,t[20]=_?.assistants,t[21]=g.isSuccess,t[22]=I):I=t[22];let L=_?.assistants,R;t[23]!==D||t[24]!==w||t[25]!==C||t[26]!==g.isSuccess||t[27]!==L?(R=[D,w,C,L,g.isSuccess],t[23]=D,t[24]=w,t[25]=C,t[26]=g.isSuccess,t[27]=L,t[28]=R):R=t[28],Q.useEffect(I,R);let V;t[29]!==l||t[30]!==T?(V=()=>{if(T(),l){l.openSettings();return}let e=y.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=T,t[31]=V):V=t[31];let H=O(V),U;t[32]===l?U=t[33]:(U=e=>{ue(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=U);let W=O(U),G;t[34]!==D||t[35]!==l?(G=()=>{D&&ue(D.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=D,t[35]=l,t[36]=G):G=t[36];let ee=O(G),[te,ne]=Q.useState(null),K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{ne(e)},t[37]=K):K=t[37];let re=O(K),ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{e||ne(null)},t[38]=ie):ie=t[38];let q=O(ie),ae=O(Zn),oe;t[39]!==a||t[40]!==ae?(oe=()=>{if(a){a();return}ae()},t[39]=a,t[40]=ae,t[41]=oe):oe=t[41];let J=O(oe),se=Hn({capabilityPending:h.isPending,snapshotPending:g.isPending,capabilityError:h.isError,supported:h.data?.supported,capabilityEnabled:h.data?.enabled,snapshotEnabled:_?.enabled,snapshotSettled:g.isSuccess,assistantCount:_?.assistants.length??0,hasAssistant:!!D}),ce;t[42]!==D||t[43]!==J||t[44]!==m||t[45]!==o?(ce=(e,t,n,r)=>(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[m?(0,$.jsx)(Wn,{assistant:D,onBack:J,onOpenSettings:o}):null,(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--oc-safe-area-top,0px))+var(--oc-mobile-detail-navigation-height,3.5rem))] text-center`,children:[(0,$.jsx)(ve,{name:e,className:`size-6 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,$.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,$.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=D,t[43]=J,t[44]=m,t[45]=o,t[46]=ce):ce=t[46];let Y=ce;if(se===`loading`){let e;t[47]!==D||t[48]!==J||t[49]!==m||t[50]!==o?(e=m?(0,$.jsx)(Wn,{assistant:D,onBack:J,onOpenSettings:o}):null,t[47]=D,t[48]=J,t[49]=m,t[50]=o,t[51]=e):e=t[51];let n;t[52]===s?n=t[53]:(n=s(`common.loading`),t[52]=s,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(ve,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`}),t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--oc-safe-area-top,0px))+var(--oc-mobile-detail-navigation-height,3.5rem))] text-center`,"aria-busy":`true`,"aria-label":n,"data-assistant-workspace-loading":``,children:r}),t[55]=n,t[56]=i);let a;return t[57]!==e||t[58]!==i?(a=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[e,i]}),t[57]=e,t[58]=i,t[59]=a):a=t[59],a}if(se===`unavailable`){let e;return t[60]!==Y||t[61]!==s?(e=Y(`cloud-off`,s(`assistants.state.unavailable`)),t[60]=Y,t[61]=s,t[62]=e):e=t[62],e}if(se===`onboarding`){let e;if(t[63]!==H||t[64]!==Y||t[65]!==s){let n=s(`assistants.onboarding.title`),r=s(`assistants.onboarding.description`),i;t[67]===s?i=t[68]:(i=s(`assistants.onboarding.action`),t[67]=s,t[68]=i);let a;t[69]!==H||t[70]!==i?(a=(0,$.jsx)(M,{onClick:H,children:i}),t[69]=H,t[70]=i,t[71]=a):a=t[71],e=Y(`ai-agent`,n,r,a),t[63]=H,t[64]=Y,t[65]=s,t[66]=e}else e=t[66];return e}if(!_||!D){let e;return t[72]!==Y||t[73]!==s?(e=Y(`cloud-off`,s(`assistants.state.unavailable`)),t[72]=Y,t[73]=s,t[74]=e):e=t[74],e}let de;t[75]===D.name?de=t[76]:(de=N(D.name),t[75]=D.name,t[76]=de);let fe=de,pe;t[77]!==D.enabled||t[78]!==g.isError||t[79]!==s?(pe=D.enabled?g.isError?s(`assistants.state.staleSnapshot`):null:s(`assistants.state.assistantDisabled`),t[77]=D.enabled,t[78]=g.isError,t[79]=s,t[80]=pe):pe=t[80];let me=pe,he;t[81]!==x||t[82]!==m||t[83]!==H||t[84]!==W||t[85]!==re||t[86]!==w||t[87]!==C||t[88]!==_||t[89]!==s?(he=m?null:(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-3 pt-4 sm:px-5`,children:[(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`assistants.settings.create`),onClick:H,children:(0,$.jsx)(ve,{name:`add`,className:`size-4`})})]}),(0,$.jsx)(ct,{snapshot:_,rowClassName:`flex justify-end px-4 pb-2 sm:px-5`}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 sm:px-4`,role:`listbox`,"aria-label":s(`assistants.listAria`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-1 border-t border-border/40 pt-3`,children:x.map(e=>{let t=e.id===C,n=N(e.name);return(0,$.jsx)(Gn,{assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:Vn(e.latestMessagePreview,s),displayName:n.displayName,selected:t,enabled:e.enabled,editLabel:s(`assistants.menu.edit`),deleteLabel:s(`assistants.settings.delete`),assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>w(e.id),onEdit:()=>W(e.id),onDelete:()=>re(e)},e.id)})})})]}),t[81]=x,t[82]=m,t[83]=H,t[84]=W,t[85]=re,t[86]=w,t[87]=C,t[88]=_,t[89]=s,t[90]=he):he=t[90];let ge=te!==null,_e;t[91]!==te||t[92]!==q||t[93]!==ge?(_e=(0,$.jsx)(Rn,{assistant:te,open:ge,onOpenChange:q}),t[91]=te,t[92]=q,t[93]=ge,t[94]=_e):_e=t[94];let be=!m&&`border-l border-[var(--surface-subtle)]`,xe;t[95]===be?xe=t[96]:(xe=j(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,be),t[95]=be,t[96]=xe);let X;t[97]!==D||t[98]!==J||t[99]!==m||t[100]!==o||t[101]!==ee||t[102]!==fe||t[103]!==s?(X=m?(0,$.jsx)(Wn,{assistant:D,onBack:J,onOpenSettings:o}):(0,$.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3.5 border-b border-[var(--surface-subtle)]/70 px-5 sm:px-7`,children:[(0,$.jsx)(ft,{name:D.id,avatarSeed:D.avatarSeed,size:40,label:fe.displayName||D.name,working:!!(D.working||D.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:fe.displayName}),(0,$.jsx)(yt,{assistantID:D.id,serverWorking:!!(D.working||D.activeContactTurn),lastContactAt:D.latestMessagePreview?.createdAt})]}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 rounded-full text-muted-foreground/65 transition-colors hover:text-foreground`,onClick:ee,"aria-label":s(`assistants.conversation.openSettings`),children:(0,$.jsx)(ve,{name:`settings-3`,className:`size-4`})})]}),t[97]=D,t[98]=J,t[99]=m,t[100]=o,t[101]=ee,t[102]=fe,t[103]=s,t[104]=X):X=t[104];let Z;t[105]!==f||t[106]!==D||t[107]!==m||t[108]!==me?(Z=(0,$.jsx)(In,{assistant:D,warning:me,active:f,overlayHeader:m}),t[105]=f,t[106]=D,t[107]=m,t[108]=me,t[109]=Z):Z=t[109];let Se;t[110]!==xe||t[111]!==X||t[112]!==Z?(Se=(0,$.jsxs)(`div`,{className:xe,children:[X,Z]}),t[110]=xe,t[111]=X,t[112]=Z,t[113]=Se):Se=t[113];let Ce;return t[114]!==he||t[115]!==_e||t[116]!==Se?(Ce=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-hidden bg-background`,"data-presentation":`workspace`,children:[he,_e,Se]}),t[114]=he,t[115]=_e,t[116]=Se,t[117]=Ce):Ce=t[117],Ce};function qn(e){return e.activeMainTab===`assistant`}function Jn(e){return e.isMobile}function Yn(e){return e.selectAssistant}function Xn(e){return e.requestCreate}function Zn(){y.getState().setActiveMainTab(`chat`)}export{Rn as a,ct as c,Vn as i,st as l,Un as n,ft as o,zn as r,dt as s,Kn as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./useUIStore-CdCyJRb0.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a}from"./button-BnPjweDW.js";import{t as o}from"./ImageLoadingPlaceholder-DVxKuVwD.js";var s=i(),c=e(t(),1),l=n();function u(e){let t=(0,s.c)(43),n,i,u,f,p,m,h;t[0]===e?(n=t[1],i=t[2],u=t[3],f=t[4],p=t[5],m=t[6],h=t[7]):({resourceError:m,fill:n,placeholderAspectRatio:f,onLoad:u,onError:i,style:h,...p}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=u,t[4]=f,t[5]=p,t[6]=m,t[7]=h);let g=r(d),{t:_}=a(),v=c.useRef(null),[y,b]=c.useState(`loading`),x=m?`error`:y,S,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{let e=v.current;e?.complete&&e.naturalWidth>0&&b(`loaded`)},C=[],t[8]=S,t[9]=C):(S=t[8],C=t[9]),c.useLayoutEffect(S,C);let w=n||void 0,T=f?g?`mobile`:`desktop`:void 0,E;t[10]!==x||t[11]!==f?(E=f&&x!==`loaded`?{aspectRatio:f}:void 0,t[10]=x,t[11]=f,t[12]=E):E=t[12];let D=x===`loading`,O=p.src||void 0,k;t[13]===x?k=t[14]:(k=x===`loaded`?{}:{opacity:0},t[13]=x,t[14]=k);let A;t[15]!==h||t[16]!==k?(A={...h,...k},t[15]=h,t[16]=k,t[17]=A):A=t[17];let j;t[18]===u?j=t[19]:(j=e=>{b(`loaded`),u?.(e)},t[18]=u,t[19]=j);let M;t[20]!==i||t[21]!==p.src?(M=e=>{p.src&&(b(`error`),i?.(e))},t[20]=i,t[21]=p.src,t[22]=M):M=t[22];let N;t[23]!==p||t[24]!==j||t[25]!==M||t[26]!==O||t[27]!==A?(N=(0,l.jsx)(`img`,{...p,ref:v,src:O,style:A,onLoad:j,onError:M}),t[23]=p,t[24]=j,t[25]=M,t[26]=O,t[27]=A,t[28]=N):N=t[28];let P;t[29]===x?P=t[30]:(P=x===`loading`&&(0,l.jsx)(o,{}),t[29]=x,t[30]=P);let F;t[31]!==x||t[32]!==_?(F=x===`error`&&(0,l.jsx)(`span`,{className:`oc-image-error`,role:`status`,children:_(`chat.fileAttachment.image.loadFailed`)}),t[31]=x,t[32]=_,t[33]=F):F=t[33];let I;return t[34]!==x||t[35]!==N||t[36]!==P||t[37]!==F||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==D?(I=(0,l.jsxs)(`span`,{className:`oc-image-frame`,"data-image-state":x,"data-image-fill":w,"data-image-content":T,style:E,"aria-busy":D,children:[N,P,F]}),t[34]=x,t[35]=N,t[36]=P,t[37]=F,t[38]=w,t[39]=T,t[40]=E,t[41]=D,t[42]=I):I=t[42],I}function d(e){return e.isMobile}var f=c.memo(function(e){let t=(0,s.c)(11),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({resourceError:a,fill:n,placeholderAspectRatio:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=`${i.src??``}\n${i.srcSet??``}`,c;return t[5]!==n||t[6]!==r||t[7]!==i||t[8]!==a||t[9]!==o?(c=(0,l.jsx)(u,{...i,resourceError:a,fill:n,placeholderAspectRatio:r},o),t[5]=n,t[6]=r,t[7]=i,t[8]=a,t[9]=o,t[10]=c):c=t[10],c});export{f as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-CIylCsD3.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-CdCyJRb0.js","assets/runtime-switch-Ck0YPsR7.js","assets/runtime-auth-C8w0nlKy.js","assets/vendor-zustand-o69pgTEK.js","assets/vendor-react-BP2cRVqX.js","assets/vendor-markstream-react-Bm0cO70Z.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-BnPjweDW.js","assets/persistence-CoWdsn8M.js","assets/runtime-fetch-DJVW43Cw.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/store-CYW4nz6C.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-2dQHPP2A.js","assets/platform-Cl17ZOYo.js","assets/vendor-opencode-client-MF2GBrFx.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-Dej-0i1V.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/useThemeSystem-8jhE4Zyk.js","assets/tooltip-Cgzp7Xco.js","assets/image-loading-4Touxv4x.js","assets/fileQueries-DfHYU8Iq.js","assets/useRuntimeAPIs-Cx8S1HLz.js","assets/relay-image-stream-BsB_ApBk.js","assets/image-loading-BzqNA0Jz.css","assets/url-BmJM1D3o.js","assets/useEffectiveDirectory-BwQn0I5k.js","assets/LoadingImage-DZsBpRYx.js","assets/ImageLoadingPlaceholder-DVxKuVwD.js","assets/markdownHeightCache-BMfTZ02N.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-BmgsCLj8.js","assets/vendor-katex-DNVSTX6g.js","assets/markdown-worker-DFNZ3KJ_.js","assets/FadeInOnReveal-C8mIXT_x.js","assets/markdownTheme-CV7_0QAL.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/MarkstreamRendererImpl-DKhVy3nF.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-o69pgTEK.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-BnPjweDW.js";import{i as s,n as c,t as l}from"./markdownHeightCache-BMfTZ02N.js";var u=i(),d=e(n(),1),f=`openchamber:chunk-import-reload`,p=250,m=3e4,h=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function g(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function _(e){let t=g(e);return h.some(e=>e.test(t))}function v(e){return`2.1.6-beta.1:${g(e).slice(0,500)}`}function y(e){if(typeof window>`u`)return;let t=Date.now(),n=v(e),r=null;try{let e=window.sessionStorage.getItem(f);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<m)){try{window.sessionStorage.setItem(f,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:g(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function b(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!_(e)||t>=n)break;await new Promise(e=>setTimeout(e,p*(t+1)))}throw _(r)&&y(r),r}var x=e=>(0,d.lazy)(()=>b(e)),S=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return n?n.getItem(e)===`1`:!1}catch{return!1}},C=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},w=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},T=`oc:legend-timeline`,E=e=>S(T,e),D=`oc:markstream-react`,O=e=>C(D,e),k=t(e=>({legendTimelineEnabled:E(),setLegendTimelineEnabled:t=>{w(T,t),e({legendTimelineEnabled:t})},markstreamReactEnabled:O(),setMarkstreamReactEnabled:t=>{w(D,t),e({markstreamReactEnabled:t})}})),A=null,j=()=>(A??=a(()=>import(`./MarkstreamRendererImpl-CIylCsD3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])).catch(e=>{throw A=null,e}),A),M=()=>{j().catch(()=>void 0)},N=null,P=()=>(N??=a(()=>import(`./MarkdownRendererImpl-BmgsCLj8.js`).then(e=>e.n),__vite__mapDeps([45,1,4,5,18,17,6,2,3,7,19,20,25,26,9,46,13,14,15,16,21,22,23,24,27,28,29,30,31,32,34,35,36,37,38,39,47,44,40,48,49,50,51,52,53,54,55,56,57,58,59,43,60,61,62,63,64])).catch(e=>{throw N=null,e}),N),F=()=>{P().catch(()=>void 0),O()&&M()},I=class extends d.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},L=d.createContext(!0),R=()=>d.useContext(L),z=r(),B=x(()=>P().then(e=>({default:e.MarkdownRenderer}))),V=x(()=>j().then(e=>({default:e.MarkstreamRenderer}))),H=x(()=>P().then(e=>({default:e.SimpleMarkdownRenderer}))),U=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,W=e=>{let t=(0,u.c)(15),n=k(q),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?c(l(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let d=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,U(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==d?(p=(0,z.jsx)(s,{animated:e.animated,content:r,reservedHeight:d}),t[8]=r,t[9]=e.animated,t[10]=d,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,z.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},G=e=>{let t=(0,u.c)(9),n=R(),r=k(J);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(W,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e,reserveMeasuredHeight:!0}),children:(0,z.jsx)(B,{...e})}),t[2]=e,t[3]=i);let a=i;if(!r)return a;let o;t[4]===e?o=t[5]:(o=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e,reserveMeasuredHeight:!0}),children:(0,z.jsx)(V,{...e})}),t[4]=e,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,z.jsx)(I,{fallback:a,children:o}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s},K=e=>{let t=(0,u.c)(4);if(!R()){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(W,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e}),children:(0,z.jsx)(H,{...e})}),t[2]=e,t[3]=n),n};function q(e){return e.markstreamReactEnabled}function J(e){return e.markstreamReactEnabled}export{k as a,F as i,K as n,x as o,L as r,G as t};