@celljs/ta-web 4.15.2 → 4.17.0

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 (601) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-ask-book.d.ts +35 -0
  4. package/esm/browser/assistant/assistant-ask-book.js +96 -0
  5. package/esm/browser/assistant/assistant-conversation.d.ts +110 -0
  6. package/esm/browser/assistant/assistant-conversation.js +351 -0
  7. package/esm/browser/assistant/assistant-export.js +6 -7
  8. package/esm/browser/assistant/assistant-extension.d.ts +3 -2
  9. package/esm/browser/assistant/assistant-extension.js +57 -4
  10. package/esm/browser/assistant/assistant-protocol.d.ts +17 -2
  11. package/esm/browser/assistant/assistant-role.d.ts +22 -4
  12. package/esm/browser/assistant/assistant-role.js +29 -7
  13. package/esm/browser/assistant/assistant-state.d.ts +5 -1
  14. package/esm/browser/assistant/assistant-state.js +11 -0
  15. package/esm/browser/assistant/assistant-task-source.js +7 -1
  16. package/esm/browser/assistant/assistant-task-util.d.ts +19 -7
  17. package/esm/browser/assistant/assistant-task-util.js +73 -20
  18. package/esm/browser/assistant/assistant-tasks.d.ts +0 -7
  19. package/esm/browser/assistant/assistant-tasks.js +0 -2
  20. package/esm/browser/assistant/assistant-thread.d.ts +22 -0
  21. package/esm/browser/assistant/assistant-thread.js +108 -0
  22. package/esm/browser/assistant/assistant-view.js +77 -126
  23. package/esm/browser/assistant/assistant.d.ts +33 -105
  24. package/esm/browser/assistant/assistant.js +103 -356
  25. package/esm/browser/assistant/chat-task-source.d.ts +58 -0
  26. package/esm/browser/assistant/chat-task-source.js +107 -0
  27. package/esm/browser/assistant/read-aloud.d.ts +34 -0
  28. package/esm/browser/assistant/read-aloud.js +98 -0
  29. package/esm/browser/assistant/realtime-voice.d.ts +77 -0
  30. package/esm/browser/assistant/realtime-voice.js +320 -0
  31. package/esm/browser/assistant/task-views.d.ts +2 -3
  32. package/esm/browser/assistant/task-views.js +20 -16
  33. package/esm/browser/assistant/voice-call-bar.d.ts +60 -0
  34. package/esm/browser/assistant/voice-call-bar.js +260 -0
  35. package/esm/browser/assistant/voice-call.d.ts +175 -0
  36. package/esm/browser/assistant/voice-call.js +366 -0
  37. package/esm/browser/chat/chat-shown.d.ts +78 -0
  38. package/esm/browser/chat/chat-shown.js +262 -0
  39. package/esm/browser/chat/chat-view.js +2 -1
  40. package/esm/browser/chat/chat.d.ts +4 -68
  41. package/esm/browser/chat/chat.js +5 -253
  42. package/esm/browser/chat/draft-model.d.ts +1 -1
  43. package/esm/browser/components/access-view.js +1 -1
  44. package/esm/browser/components/account-menu.js +1 -1
  45. package/esm/browser/components/app-nav.d.ts +3 -1
  46. package/esm/browser/components/app-nav.js +7 -7
  47. package/esm/browser/components/app-shell-hooks.d.ts +11 -2
  48. package/esm/browser/components/app-shell-hooks.js +25 -4
  49. package/esm/browser/components/app-shell-state.d.ts +80 -0
  50. package/esm/browser/components/app-shell-state.js +466 -0
  51. package/esm/browser/components/app-view.js +128 -334
  52. package/esm/browser/components/asks-badge.d.ts +6 -2
  53. package/esm/browser/components/asks-badge.js +7 -3
  54. package/esm/browser/components/auth-pictures.d.ts +2 -2
  55. package/esm/browser/components/auth-pictures.js +13 -1
  56. package/esm/browser/components/auth-view.d.ts +4 -3
  57. package/esm/browser/components/auth-view.js +54 -5
  58. package/esm/browser/components/chat-asks.d.ts +2 -0
  59. package/esm/browser/components/chat-asks.js +8 -0
  60. package/esm/browser/components/chat-busy.d.ts +32 -0
  61. package/esm/browser/components/chat-busy.js +49 -0
  62. package/esm/browser/components/chat-icon.d.ts +6 -0
  63. package/esm/browser/components/chat-icon.js +17 -1
  64. package/esm/browser/components/chat-list-row.d.ts +84 -0
  65. package/esm/browser/components/chat-list-row.js +198 -0
  66. package/esm/browser/components/chat-list-util.d.ts +166 -0
  67. package/esm/browser/components/chat-list-util.js +335 -0
  68. package/esm/browser/components/chat-list.d.ts +11 -148
  69. package/esm/browser/components/chat-list.js +280 -511
  70. package/esm/browser/components/chat-seen.d.ts +7 -0
  71. package/esm/browser/components/chat-seen.js +58 -10
  72. package/esm/browser/components/composer-addon-util.d.ts +1 -1
  73. package/esm/browser/components/composer-addons.d.ts +1 -1
  74. package/esm/browser/components/composer-attachments.d.ts +11 -0
  75. package/esm/browser/components/composer-attachments.js +27 -0
  76. package/esm/browser/components/composer-box-hooks.d.ts +9 -0
  77. package/esm/browser/components/composer-box-hooks.js +138 -0
  78. package/esm/browser/components/composer-box-protocol.d.ts +108 -0
  79. package/esm/browser/components/composer-box-protocol.js +2 -0
  80. package/esm/browser/components/composer-box.d.ts +1 -95
  81. package/esm/browser/components/composer-box.js +49 -156
  82. package/esm/browser/components/composer-target.d.ts +21 -0
  83. package/esm/browser/components/composer-target.js +43 -0
  84. package/esm/browser/components/composer.d.ts +7 -1
  85. package/esm/browser/components/composer.js +13 -9
  86. package/esm/browser/components/context-menu.js +4 -0
  87. package/esm/browser/components/conversation-find.d.ts +27 -0
  88. package/esm/browser/components/conversation-find.js +151 -0
  89. package/esm/browser/components/conversation-scroll-hooks.js +2 -1
  90. package/esm/browser/components/conversation-scroll-util.d.ts +73 -0
  91. package/esm/browser/components/conversation-scroll-util.js +80 -0
  92. package/esm/browser/components/conversation-scroll.d.ts +1 -35
  93. package/esm/browser/components/conversation-scroll.js +2 -81
  94. package/esm/browser/components/conversation-view.d.ts +8 -0
  95. package/esm/browser/components/conversation-view.js +41 -0
  96. package/esm/browser/components/discover-view.d.ts +3 -2
  97. package/esm/browser/components/discover-view.js +31 -26
  98. package/esm/browser/components/dismiss.js +2 -0
  99. package/esm/browser/components/earlier-messages.d.ts +2 -0
  100. package/esm/browser/components/earlier-messages.js +2 -1
  101. package/esm/browser/components/environment-view.js +50 -1
  102. package/esm/browser/components/folder-picker.d.ts +7 -0
  103. package/esm/browser/components/folder-picker.js +90 -20
  104. package/esm/browser/components/gallery.d.ts +1 -1
  105. package/esm/browser/components/gallery.js +57 -14
  106. package/esm/browser/components/host-tag.js +2 -2
  107. package/esm/browser/components/host-view.d.ts +1 -1
  108. package/esm/browser/components/host-view.js +3 -1
  109. package/esm/browser/components/image-menu.d.ts +11 -0
  110. package/esm/browser/components/image-menu.js +29 -0
  111. package/esm/browser/components/image-viewer.d.ts +3 -2
  112. package/esm/browser/components/image-viewer.js +29 -4
  113. package/esm/browser/components/lightbox.js +2 -0
  114. package/esm/browser/components/link-dialog.js +2 -0
  115. package/esm/browser/components/list-rows.d.ts +3 -1
  116. package/esm/browser/components/list-rows.js +2 -1
  117. package/esm/browser/components/markdown.js +5 -0
  118. package/esm/browser/components/media.d.ts +2 -0
  119. package/esm/browser/components/media.js +16 -1
  120. package/esm/browser/components/message-actions.d.ts +1 -1
  121. package/esm/browser/components/message-actions.js +9 -0
  122. package/esm/browser/components/message-footer.d.ts +3 -1
  123. package/esm/browser/components/message-footer.js +3 -2
  124. package/esm/browser/components/message-images.d.ts +41 -0
  125. package/esm/browser/components/message-images.js +120 -0
  126. package/esm/browser/components/message-list.d.ts +4 -100
  127. package/esm/browser/components/message-list.js +10 -447
  128. package/esm/browser/components/message-menu.js +4 -0
  129. package/esm/browser/components/message-steps.d.ts +21 -0
  130. package/esm/browser/components/message-steps.js +182 -0
  131. package/esm/browser/components/message-user.d.ts +54 -0
  132. package/esm/browser/components/message-user.js +169 -0
  133. package/esm/browser/components/model-picker.d.ts +1 -1
  134. package/esm/browser/components/model-picker.js +2 -0
  135. package/esm/browser/components/moved-notice.d.ts +14 -0
  136. package/esm/browser/components/moved-notice.js +60 -0
  137. package/esm/browser/components/nav-places.d.ts +12 -1
  138. package/esm/browser/components/nav-places.js +10 -2
  139. package/esm/browser/components/notice-center.js +36 -1
  140. package/esm/browser/components/notice-face.js +2 -1
  141. package/esm/browser/components/phone-shell.d.ts +4 -3
  142. package/esm/browser/components/phone-shell.js +60 -68
  143. package/esm/browser/components/plus-menu.d.ts +1 -1
  144. package/esm/browser/components/relay-services.d.ts +6 -1
  145. package/esm/browser/components/relay-services.js +109 -2
  146. package/esm/browser/components/relay-view.js +2 -0
  147. package/esm/browser/components/remote-hosts.d.ts +10 -0
  148. package/esm/browser/components/remote-hosts.js +67 -5
  149. package/esm/browser/components/remote-prompts.js +2 -0
  150. package/esm/browser/components/scan-screen.js +7 -0
  151. package/esm/browser/components/screen-navigator-util.d.ts +28 -0
  152. package/esm/browser/components/screen-navigator-util.js +33 -0
  153. package/esm/browser/components/screen-navigator.d.ts +30 -0
  154. package/esm/browser/components/screen-navigator.js +47 -0
  155. package/esm/browser/components/session-settings.d.ts +1 -1
  156. package/esm/browser/components/session-view.js +157 -7
  157. package/esm/browser/components/settings-choices.d.ts +6 -0
  158. package/esm/browser/components/settings-choices.js +8 -0
  159. package/esm/browser/components/settings-more.d.ts +7 -0
  160. package/esm/browser/components/settings-more.js +263 -0
  161. package/esm/browser/components/settings-parts.d.ts +8 -3
  162. package/esm/browser/components/settings-parts.js +31 -249
  163. package/esm/browser/components/settings-view.js +43 -15
  164. package/esm/browser/components/stop-times.js +1 -0
  165. package/esm/browser/components/surface-flyout.js +2 -0
  166. package/esm/browser/components/unseen-drop.d.ts +10 -4
  167. package/esm/browser/components/unseen-drop.js +9 -8
  168. package/esm/browser/components/use-seen-chats.js +1 -1
  169. package/esm/browser/components/voice-services.d.ts +6 -0
  170. package/esm/browser/components/voice-services.js +137 -0
  171. package/esm/browser/components/voice-talk.d.ts +23 -6
  172. package/esm/browser/components/voice-talk.js +46 -11
  173. package/esm/browser/components/web-composer.d.ts +1 -1
  174. package/esm/browser/components/web-composer.js +2 -2
  175. package/esm/browser/components/web-dialog.js +2 -0
  176. package/esm/browser/device/back-stack.d.ts +89 -11
  177. package/esm/browser/device/back-stack.js +200 -29
  178. package/esm/browser/device/device-protocol.d.ts +1 -1
  179. package/esm/browser/device/device-protocol.js +1 -1
  180. package/esm/browser/device/own-gestures.d.ts +1 -1
  181. package/esm/browser/device/pull-down.js +3 -1
  182. package/esm/browser/device/row-swipe.js +3 -1
  183. package/esm/browser/device/sheet-swipe.d.ts +1 -179
  184. package/esm/browser/device/sheet-swipe.js +3 -433
  185. package/esm/browser/device/swipe-finger.d.ts +31 -0
  186. package/esm/browser/device/swipe-finger.js +83 -0
  187. package/esm/browser/device/swipe-settle.d.ts +52 -0
  188. package/esm/browser/device/swipe-settle.js +170 -0
  189. package/esm/browser/device/swipe-util.d.ts +97 -0
  190. package/esm/browser/device/swipe-util.js +183 -0
  191. package/esm/browser/drafts/drafts-protocol.d.ts +58 -0
  192. package/esm/browser/drafts/drafts-protocol.js +75 -0
  193. package/esm/browser/drafts/drafts.d.ts +21 -0
  194. package/esm/browser/drafts/drafts.js +91 -0
  195. package/esm/browser/drafts/use-composer-draft.d.ts +20 -0
  196. package/esm/browser/drafts/use-composer-draft.js +108 -0
  197. package/esm/browser/extension/icons.js +25 -4
  198. package/esm/browser/extension/web-api-components.d.ts +13 -0
  199. package/esm/browser/extension/web-api-contributions.d.ts +125 -0
  200. package/esm/browser/extension/web-extension-api.d.ts +88 -5
  201. package/esm/browser/extension/web-extension-context.d.ts +5 -0
  202. package/esm/browser/extension/web-extension-context.js +60 -7
  203. package/esm/browser/extension/web-extension-protocol.d.ts +19 -1
  204. package/esm/browser/extension/web-extension-protocol.js +3 -0
  205. package/esm/browser/extension/web-extension-run.d.ts +5 -2
  206. package/esm/browser/extension/web-extension-run.js +13 -1
  207. package/esm/browser/extension/web-extensions-running.d.ts +93 -0
  208. package/esm/browser/extension/web-extensions-running.js +339 -0
  209. package/esm/browser/extension/web-extensions.d.ts +6 -82
  210. package/esm/browser/extension/web-extensions.js +10 -319
  211. package/esm/browser/extension/web-pages.js +1 -0
  212. package/esm/browser/extension/web-session-notices.js +6 -1
  213. package/esm/browser/extension/web-tasks.d.ts +2 -0
  214. package/esm/browser/extension/web-tasks.js +6 -0
  215. package/esm/browser/extension/web-view-util.d.ts +2 -1
  216. package/esm/browser/extension/web-view-util.js +4 -1
  217. package/esm/browser/gateway/console-parts.d.ts +4 -12
  218. package/esm/browser/gateway/console-parts.js +42 -125
  219. package/esm/browser/gateway/console-tenant.js +3 -2
  220. package/esm/browser/gateway/console-trend.d.ts +11 -0
  221. package/esm/browser/gateway/console-trend.js +115 -0
  222. package/esm/browser/gateway/console-util.js +2 -2
  223. package/esm/browser/gateway/console-view.js +49 -3
  224. package/esm/browser/i18n/locales.d.ts +170 -6
  225. package/esm/browser/i18n/messages-ja.js +171 -7
  226. package/esm/browser/i18n/messages-zh-tw.js +171 -7
  227. package/esm/browser/i18n/messages.d.ts +167 -3
  228. package/esm/browser/i18n/messages.js +342 -14
  229. package/esm/browser/index.d.ts +17 -0
  230. package/esm/browser/index.js +17 -0
  231. package/esm/browser/notices/notices-protocol.d.ts +12 -0
  232. package/esm/browser/notices/notices.js +7 -4
  233. package/esm/browser/offline/device-values.d.ts +2 -0
  234. package/esm/browser/offline/device-values.js +6 -1
  235. package/esm/browser/screen/page-answers.d.ts +42 -0
  236. package/esm/browser/screen/page-answers.js +89 -0
  237. package/esm/browser/screen/screen-protocol.d.ts +112 -0
  238. package/esm/browser/screen/screen-protocol.js +45 -0
  239. package/esm/browser/screen/screen.d.ts +20 -0
  240. package/esm/browser/screen/screen.js +122 -0
  241. package/esm/browser/screen/use-screen-part.d.ts +6 -0
  242. package/esm/browser/screen/use-screen-part.js +14 -0
  243. package/esm/browser/settings/settings-protocol.d.ts +5 -1
  244. package/esm/browser/settings/settings-protocol.js +6 -2
  245. package/esm/browser/share/shared-extensions.d.ts +29 -0
  246. package/esm/browser/share/shared-extensions.js +145 -0
  247. package/esm/browser/share/shared-link.d.ts +11 -0
  248. package/esm/browser/share/shared-link.js +38 -0
  249. package/esm/browser/share/shared-page.d.ts +5 -0
  250. package/esm/browser/share/shared-page.js +137 -0
  251. package/esm/browser/state/state-protocol.d.ts +14 -0
  252. package/esm/browser/state/state-protocol.js +18 -0
  253. package/esm/browser/state/state.d.ts +10 -2
  254. package/esm/browser/state/state.js +19 -3
  255. package/esm/browser/style/base.d.ts +1 -1
  256. package/esm/browser/style/base.js +4 -0
  257. package/esm/browser/style/chat-list.d.ts +2 -0
  258. package/esm/browser/style/chat-list.js +153 -0
  259. package/esm/browser/style/conversation-column.d.ts +2 -0
  260. package/esm/browser/style/conversation-column.js +250 -0
  261. package/esm/browser/style/conversation.d.ts +1 -1
  262. package/esm/browser/style/conversation.js +24 -8
  263. package/esm/browser/style/dialogs.d.ts +2 -0
  264. package/esm/browser/style/dialogs.js +163 -0
  265. package/esm/browser/style/layout.d.ts +2 -2
  266. package/esm/browser/style/layout.js +1 -525
  267. package/esm/browser/style/pages.d.ts +1 -1
  268. package/esm/browser/style/pages.js +10 -3
  269. package/esm/browser/style/phone.d.ts +1 -1
  270. package/esm/browser/style/phone.js +6 -2
  271. package/esm/browser/style/shared.d.ts +2 -0
  272. package/esm/browser/style/shared.js +23 -0
  273. package/esm/browser/style/shell.d.ts +1 -1
  274. package/esm/browser/style/shell.js +47 -0
  275. package/esm/browser/style/tasks.d.ts +1 -1
  276. package/esm/browser/style/tasks.js +13 -8
  277. package/esm/browser/style.js +8 -0
  278. package/esm/browser/util/gallery.d.ts +24 -2
  279. package/esm/browser/util/gallery.js +82 -2
  280. package/esm/browser/util/image-copy.d.ts +16 -0
  281. package/esm/browser/util/image-copy.js +57 -0
  282. package/esm/browser/util/message.d.ts +5 -0
  283. package/esm/browser/util/message.js +14 -0
  284. package/esm/browser/util/process.d.ts +6 -2
  285. package/esm/browser/util/process.js +6 -2
  286. package/esm/browser/util/spoken.d.ts +24 -0
  287. package/esm/browser/util/spoken.js +83 -0
  288. package/esm/browser/util/transcript.d.ts +22 -0
  289. package/esm/browser/util/transcript.js +46 -0
  290. package/esm/browser/util/voice.d.ts +5 -1
  291. package/esm/browser/util/voice.js +6 -1
  292. package/esm/browser/workbench-hosts.d.ts +36 -0
  293. package/esm/browser/workbench-hosts.js +120 -0
  294. package/esm/browser/workbench-lists.d.ts +33 -0
  295. package/esm/browser/workbench-lists.js +128 -0
  296. package/esm/browser/workbench-protocol.d.ts +14 -1
  297. package/esm/browser/workbench-services.d.ts +49 -0
  298. package/esm/browser/workbench-services.js +120 -0
  299. package/esm/browser/workbench-util.d.ts +1 -1
  300. package/esm/browser/workbench.d.ts +6 -89
  301. package/esm/browser/workbench.js +26 -336
  302. package/lib/browser/assistant/assistant-ask-book.d.ts +36 -0
  303. package/lib/browser/assistant/assistant-ask-book.js +100 -0
  304. package/lib/browser/assistant/assistant-conversation.d.ts +111 -0
  305. package/lib/browser/assistant/assistant-conversation.js +355 -0
  306. package/lib/browser/assistant/assistant-export.js +6 -7
  307. package/lib/browser/assistant/assistant-extension.d.ts +3 -2
  308. package/lib/browser/assistant/assistant-extension.js +55 -2
  309. package/lib/browser/assistant/assistant-protocol.d.ts +17 -2
  310. package/lib/browser/assistant/assistant-role.d.ts +22 -4
  311. package/lib/browser/assistant/assistant-role.js +30 -8
  312. package/lib/browser/assistant/assistant-state.d.ts +5 -1
  313. package/lib/browser/assistant/assistant-state.js +11 -0
  314. package/lib/browser/assistant/assistant-task-source.js +7 -1
  315. package/lib/browser/assistant/assistant-task-util.d.ts +19 -7
  316. package/lib/browser/assistant/assistant-task-util.js +73 -20
  317. package/lib/browser/assistant/assistant-tasks.d.ts +0 -7
  318. package/lib/browser/assistant/assistant-tasks.js +1 -3
  319. package/lib/browser/assistant/assistant-thread.d.ts +23 -0
  320. package/lib/browser/assistant/assistant-thread.js +144 -0
  321. package/lib/browser/assistant/assistant-view.js +74 -123
  322. package/lib/browser/assistant/assistant.d.ts +33 -105
  323. package/lib/browser/assistant/assistant.js +100 -353
  324. package/lib/browser/assistant/chat-task-source.d.ts +59 -0
  325. package/lib/browser/assistant/chat-task-source.js +111 -0
  326. package/lib/browser/assistant/read-aloud.d.ts +35 -0
  327. package/lib/browser/assistant/read-aloud.js +102 -0
  328. package/lib/browser/assistant/realtime-voice.d.ts +78 -0
  329. package/lib/browser/assistant/realtime-voice.js +324 -0
  330. package/lib/browser/assistant/task-views.d.ts +2 -3
  331. package/lib/browser/assistant/task-views.js +19 -15
  332. package/lib/browser/assistant/voice-call-bar.d.ts +61 -0
  333. package/lib/browser/assistant/voice-call-bar.js +306 -0
  334. package/lib/browser/assistant/voice-call.d.ts +176 -0
  335. package/lib/browser/assistant/voice-call.js +370 -0
  336. package/lib/browser/chat/chat-shown.d.ts +79 -0
  337. package/lib/browser/chat/chat-shown.js +266 -0
  338. package/lib/browser/chat/chat-view.js +2 -1
  339. package/lib/browser/chat/chat.d.ts +4 -68
  340. package/lib/browser/chat/chat.js +3 -251
  341. package/lib/browser/chat/draft-model.d.ts +1 -1
  342. package/lib/browser/components/access-view.js +2 -2
  343. package/lib/browser/components/account-menu.js +1 -1
  344. package/lib/browser/components/app-nav.d.ts +3 -1
  345. package/lib/browser/components/app-nav.js +7 -7
  346. package/lib/browser/components/app-shell-hooks.d.ts +11 -2
  347. package/lib/browser/components/app-shell-hooks.js +26 -5
  348. package/lib/browser/components/app-shell-state.d.ts +81 -0
  349. package/lib/browser/components/app-shell-state.js +502 -0
  350. package/lib/browser/components/app-view.js +120 -326
  351. package/lib/browser/components/asks-badge.d.ts +6 -2
  352. package/lib/browser/components/asks-badge.js +7 -3
  353. package/lib/browser/components/auth-pictures.d.ts +2 -2
  354. package/lib/browser/components/auth-pictures.js +13 -1
  355. package/lib/browser/components/auth-view.d.ts +4 -3
  356. package/lib/browser/components/auth-view.js +53 -4
  357. package/lib/browser/components/chat-asks.d.ts +2 -0
  358. package/lib/browser/components/chat-asks.js +8 -0
  359. package/lib/browser/components/chat-busy.d.ts +33 -0
  360. package/lib/browser/components/chat-busy.js +52 -0
  361. package/lib/browser/components/chat-icon.d.ts +6 -0
  362. package/lib/browser/components/chat-icon.js +17 -1
  363. package/lib/browser/components/chat-list-row.d.ts +85 -0
  364. package/lib/browser/components/chat-list-row.js +236 -0
  365. package/lib/browser/components/chat-list-util.d.ts +167 -0
  366. package/lib/browser/components/chat-list-util.js +338 -0
  367. package/lib/browser/components/chat-list.d.ts +11 -148
  368. package/lib/browser/components/chat-list.js +297 -530
  369. package/lib/browser/components/chat-seen.d.ts +7 -0
  370. package/lib/browser/components/chat-seen.js +58 -10
  371. package/lib/browser/components/composer-addon-util.d.ts +1 -1
  372. package/lib/browser/components/composer-addons.d.ts +1 -1
  373. package/lib/browser/components/composer-attachments.d.ts +12 -0
  374. package/lib/browser/components/composer-attachments.js +64 -0
  375. package/lib/browser/components/composer-box-hooks.d.ts +10 -0
  376. package/lib/browser/components/composer-box-hooks.js +178 -0
  377. package/lib/browser/components/composer-box-protocol.d.ts +109 -0
  378. package/lib/browser/components/composer-box-protocol.js +3 -0
  379. package/lib/browser/components/composer-box.d.ts +1 -95
  380. package/lib/browser/components/composer-box.js +51 -159
  381. package/lib/browser/components/composer-target.d.ts +22 -0
  382. package/lib/browser/components/composer-target.js +46 -0
  383. package/lib/browser/components/composer.d.ts +7 -1
  384. package/lib/browser/components/composer.js +15 -11
  385. package/lib/browser/components/context-menu.js +4 -0
  386. package/lib/browser/components/conversation-find.d.ts +28 -0
  387. package/lib/browser/components/conversation-find.js +188 -0
  388. package/lib/browser/components/conversation-scroll-hooks.js +3 -2
  389. package/lib/browser/components/conversation-scroll-util.d.ts +73 -0
  390. package/lib/browser/components/conversation-scroll-util.js +85 -1
  391. package/lib/browser/components/conversation-scroll.d.ts +1 -35
  392. package/lib/browser/components/conversation-scroll.js +20 -100
  393. package/lib/browser/components/conversation-view.d.ts +9 -0
  394. package/lib/browser/components/conversation-view.js +77 -0
  395. package/lib/browser/components/discover-view.d.ts +3 -2
  396. package/lib/browser/components/discover-view.js +30 -25
  397. package/lib/browser/components/dismiss.js +2 -0
  398. package/lib/browser/components/earlier-messages.d.ts +2 -0
  399. package/lib/browser/components/earlier-messages.js +2 -1
  400. package/lib/browser/components/environment-view.js +49 -0
  401. package/lib/browser/components/folder-picker.d.ts +7 -0
  402. package/lib/browser/components/folder-picker.js +89 -19
  403. package/lib/browser/components/gallery.d.ts +1 -1
  404. package/lib/browser/components/gallery.js +56 -13
  405. package/lib/browser/components/host-tag.js +1 -1
  406. package/lib/browser/components/host-view.d.ts +1 -1
  407. package/lib/browser/components/host-view.js +4 -2
  408. package/lib/browser/components/image-menu.d.ts +12 -0
  409. package/lib/browser/components/image-menu.js +65 -0
  410. package/lib/browser/components/image-viewer.d.ts +3 -2
  411. package/lib/browser/components/image-viewer.js +28 -3
  412. package/lib/browser/components/lightbox.js +2 -0
  413. package/lib/browser/components/link-dialog.js +2 -0
  414. package/lib/browser/components/list-rows.d.ts +3 -1
  415. package/lib/browser/components/list-rows.js +2 -1
  416. package/lib/browser/components/markdown.js +5 -0
  417. package/lib/browser/components/media.d.ts +2 -0
  418. package/lib/browser/components/media.js +17 -1
  419. package/lib/browser/components/message-actions.d.ts +1 -1
  420. package/lib/browser/components/message-actions.js +9 -0
  421. package/lib/browser/components/message-footer.d.ts +3 -1
  422. package/lib/browser/components/message-footer.js +2 -1
  423. package/lib/browser/components/message-images.d.ts +42 -0
  424. package/lib/browser/components/message-images.js +157 -0
  425. package/lib/browser/components/message-list.d.ts +4 -100
  426. package/lib/browser/components/message-list.js +11 -455
  427. package/lib/browser/components/message-menu.js +4 -0
  428. package/lib/browser/components/message-steps.d.ts +22 -0
  429. package/lib/browser/components/message-steps.js +218 -0
  430. package/lib/browser/components/message-user.d.ts +55 -0
  431. package/lib/browser/components/message-user.js +211 -0
  432. package/lib/browser/components/model-picker.d.ts +1 -1
  433. package/lib/browser/components/model-picker.js +2 -0
  434. package/lib/browser/components/moved-notice.d.ts +15 -0
  435. package/lib/browser/components/moved-notice.js +96 -0
  436. package/lib/browser/components/nav-places.d.ts +12 -1
  437. package/lib/browser/components/nav-places.js +12 -3
  438. package/lib/browser/components/notice-center.js +35 -0
  439. package/lib/browser/components/notice-face.js +7 -6
  440. package/lib/browser/components/phone-shell.d.ts +4 -3
  441. package/lib/browser/components/phone-shell.js +59 -67
  442. package/lib/browser/components/plus-menu.d.ts +1 -1
  443. package/lib/browser/components/relay-services.d.ts +6 -1
  444. package/lib/browser/components/relay-services.js +107 -0
  445. package/lib/browser/components/relay-view.js +2 -0
  446. package/lib/browser/components/remote-hosts.d.ts +10 -0
  447. package/lib/browser/components/remote-hosts.js +67 -4
  448. package/lib/browser/components/remote-prompts.js +2 -0
  449. package/lib/browser/components/scan-screen.js +7 -0
  450. package/lib/browser/components/screen-navigator-util.d.ts +29 -0
  451. package/lib/browser/components/screen-navigator-util.js +36 -0
  452. package/lib/browser/components/screen-navigator.d.ts +31 -0
  453. package/lib/browser/components/screen-navigator.js +83 -0
  454. package/lib/browser/components/session-settings.d.ts +1 -1
  455. package/lib/browser/components/session-view.js +157 -7
  456. package/lib/browser/components/settings-choices.d.ts +7 -1
  457. package/lib/browser/components/settings-choices.js +9 -1
  458. package/lib/browser/components/settings-more.d.ts +8 -0
  459. package/lib/browser/components/settings-more.js +299 -0
  460. package/lib/browser/components/settings-parts.d.ts +8 -3
  461. package/lib/browser/components/settings-parts.js +27 -245
  462. package/lib/browser/components/settings-view.js +43 -15
  463. package/lib/browser/components/stop-times.js +1 -0
  464. package/lib/browser/components/surface-flyout.js +2 -0
  465. package/lib/browser/components/unseen-drop.d.ts +10 -4
  466. package/lib/browser/components/unseen-drop.js +9 -8
  467. package/lib/browser/components/use-seen-chats.js +2 -2
  468. package/lib/browser/components/voice-services.d.ts +7 -0
  469. package/lib/browser/components/voice-services.js +173 -0
  470. package/lib/browser/components/voice-talk.d.ts +23 -6
  471. package/lib/browser/components/voice-talk.js +45 -10
  472. package/lib/browser/components/web-composer.d.ts +1 -1
  473. package/lib/browser/components/web-composer.js +2 -2
  474. package/lib/browser/components/web-dialog.js +2 -0
  475. package/lib/browser/device/back-stack.d.ts +89 -11
  476. package/lib/browser/device/back-stack.js +205 -31
  477. package/lib/browser/device/device-protocol.d.ts +1 -1
  478. package/lib/browser/device/device-protocol.js +1 -1
  479. package/lib/browser/device/own-gestures.d.ts +1 -1
  480. package/lib/browser/device/pull-down.js +8 -6
  481. package/lib/browser/device/row-swipe.js +11 -9
  482. package/lib/browser/device/sheet-swipe.d.ts +1 -179
  483. package/lib/browser/device/sheet-swipe.js +16 -452
  484. package/lib/browser/device/swipe-finger.d.ts +32 -0
  485. package/lib/browser/device/swipe-finger.js +87 -0
  486. package/lib/browser/device/swipe-settle.d.ts +53 -0
  487. package/lib/browser/device/swipe-settle.js +176 -0
  488. package/lib/browser/device/swipe-util.d.ts +98 -0
  489. package/lib/browser/device/swipe-util.js +187 -0
  490. package/lib/browser/drafts/drafts-protocol.d.ts +59 -0
  491. package/lib/browser/drafts/drafts-protocol.js +78 -0
  492. package/lib/browser/drafts/drafts.d.ts +22 -0
  493. package/lib/browser/drafts/drafts.js +94 -0
  494. package/lib/browser/drafts/use-composer-draft.d.ts +21 -0
  495. package/lib/browser/drafts/use-composer-draft.js +146 -0
  496. package/lib/browser/extension/icons.js +24 -3
  497. package/lib/browser/extension/web-api-components.d.ts +13 -0
  498. package/lib/browser/extension/web-api-contributions.d.ts +125 -0
  499. package/lib/browser/extension/web-extension-api.d.ts +88 -5
  500. package/lib/browser/extension/web-extension-context.d.ts +5 -0
  501. package/lib/browser/extension/web-extension-context.js +62 -9
  502. package/lib/browser/extension/web-extension-protocol.d.ts +19 -1
  503. package/lib/browser/extension/web-extension-protocol.js +3 -0
  504. package/lib/browser/extension/web-extension-run.d.ts +5 -2
  505. package/lib/browser/extension/web-extension-run.js +13 -1
  506. package/lib/browser/extension/web-extensions-running.d.ts +94 -0
  507. package/lib/browser/extension/web-extensions-running.js +343 -0
  508. package/lib/browser/extension/web-extensions.d.ts +6 -82
  509. package/lib/browser/extension/web-extensions.js +7 -316
  510. package/lib/browser/extension/web-pages.js +1 -0
  511. package/lib/browser/extension/web-session-notices.js +8 -3
  512. package/lib/browser/extension/web-tasks.d.ts +2 -0
  513. package/lib/browser/extension/web-tasks.js +6 -0
  514. package/lib/browser/extension/web-view-util.d.ts +2 -1
  515. package/lib/browser/extension/web-view-util.js +4 -1
  516. package/lib/browser/gateway/console-parts.d.ts +4 -12
  517. package/lib/browser/gateway/console-parts.js +42 -126
  518. package/lib/browser/gateway/console-tenant.js +3 -2
  519. package/lib/browser/gateway/console-trend.d.ts +12 -0
  520. package/lib/browser/gateway/console-trend.js +151 -0
  521. package/lib/browser/gateway/console-util.js +2 -2
  522. package/lib/browser/gateway/console-view.js +48 -2
  523. package/lib/browser/i18n/locales.d.ts +170 -6
  524. package/lib/browser/i18n/messages-ja.js +171 -7
  525. package/lib/browser/i18n/messages-zh-tw.js +171 -7
  526. package/lib/browser/i18n/messages.d.ts +167 -3
  527. package/lib/browser/i18n/messages.js +342 -14
  528. package/lib/browser/index.d.ts +17 -0
  529. package/lib/browser/index.js +17 -0
  530. package/lib/browser/notices/notices-protocol.d.ts +12 -0
  531. package/lib/browser/notices/notices.js +7 -4
  532. package/lib/browser/offline/device-values.d.ts +2 -0
  533. package/lib/browser/offline/device-values.js +6 -1
  534. package/lib/browser/screen/page-answers.d.ts +43 -0
  535. package/lib/browser/screen/page-answers.js +93 -0
  536. package/lib/browser/screen/screen-protocol.d.ts +113 -0
  537. package/lib/browser/screen/screen-protocol.js +48 -0
  538. package/lib/browser/screen/screen.d.ts +21 -0
  539. package/lib/browser/screen/screen.js +125 -0
  540. package/lib/browser/screen/use-screen-part.d.ts +7 -0
  541. package/lib/browser/screen/use-screen-part.js +50 -0
  542. package/lib/browser/settings/settings-protocol.d.ts +5 -1
  543. package/lib/browser/settings/settings-protocol.js +5 -1
  544. package/lib/browser/share/shared-extensions.d.ts +30 -0
  545. package/lib/browser/share/shared-extensions.js +181 -0
  546. package/lib/browser/share/shared-link.d.ts +12 -0
  547. package/lib/browser/share/shared-link.js +41 -0
  548. package/lib/browser/share/shared-page.d.ts +6 -0
  549. package/lib/browser/share/shared-page.js +173 -0
  550. package/lib/browser/state/state-protocol.d.ts +14 -0
  551. package/lib/browser/state/state-protocol.js +20 -1
  552. package/lib/browser/state/state.d.ts +10 -2
  553. package/lib/browser/state/state.js +18 -2
  554. package/lib/browser/style/base.d.ts +1 -1
  555. package/lib/browser/style/base.js +4 -0
  556. package/lib/browser/style/chat-list.d.ts +3 -0
  557. package/lib/browser/style/chat-list.js +156 -0
  558. package/lib/browser/style/conversation-column.d.ts +3 -0
  559. package/lib/browser/style/conversation-column.js +253 -0
  560. package/lib/browser/style/conversation.d.ts +1 -1
  561. package/lib/browser/style/conversation.js +24 -8
  562. package/lib/browser/style/dialogs.d.ts +3 -0
  563. package/lib/browser/style/dialogs.js +166 -0
  564. package/lib/browser/style/layout.d.ts +2 -2
  565. package/lib/browser/style/layout.js +1 -525
  566. package/lib/browser/style/pages.d.ts +1 -1
  567. package/lib/browser/style/pages.js +10 -3
  568. package/lib/browser/style/phone.d.ts +1 -1
  569. package/lib/browser/style/phone.js +7 -3
  570. package/lib/browser/style/shared.d.ts +3 -0
  571. package/lib/browser/style/shared.js +26 -0
  572. package/lib/browser/style/shell.d.ts +1 -1
  573. package/lib/browser/style/shell.js +47 -0
  574. package/lib/browser/style/tasks.d.ts +1 -1
  575. package/lib/browser/style/tasks.js +13 -8
  576. package/lib/browser/style.js +8 -0
  577. package/lib/browser/util/gallery.d.ts +24 -2
  578. package/lib/browser/util/gallery.js +82 -2
  579. package/lib/browser/util/image-copy.d.ts +17 -0
  580. package/lib/browser/util/image-copy.js +60 -0
  581. package/lib/browser/util/message.d.ts +5 -0
  582. package/lib/browser/util/message.js +14 -0
  583. package/lib/browser/util/process.d.ts +6 -2
  584. package/lib/browser/util/process.js +6 -2
  585. package/lib/browser/util/spoken.d.ts +25 -0
  586. package/lib/browser/util/spoken.js +86 -0
  587. package/lib/browser/util/transcript.d.ts +23 -0
  588. package/lib/browser/util/transcript.js +49 -0
  589. package/lib/browser/util/voice.d.ts +5 -1
  590. package/lib/browser/util/voice.js +6 -1
  591. package/lib/browser/workbench-hosts.d.ts +37 -0
  592. package/lib/browser/workbench-hosts.js +124 -0
  593. package/lib/browser/workbench-lists.d.ts +34 -0
  594. package/lib/browser/workbench-lists.js +132 -0
  595. package/lib/browser/workbench-protocol.d.ts +14 -1
  596. package/lib/browser/workbench-services.d.ts +50 -0
  597. package/lib/browser/workbench-services.js +124 -0
  598. package/lib/browser/workbench-util.d.ts +1 -1
  599. package/lib/browser/workbench.d.ts +6 -89
  600. package/lib/browser/workbench.js +23 -333
  601. package/package.json +7 -7
@@ -0,0 +1,167 @@
1
+ import { type TaSavedSessionInfo, type TaSessionInfo } from '@celljs/ta-protocol';
2
+ import type { MessageId } from '../i18n/messages';
3
+ import type { Translate } from '../i18n/use-t';
4
+ import { type StateSpec } from '../state/state-protocol';
5
+ import { type LetGoAsks } from './chat-asks';
6
+ import type { ChatFolderIcon } from './chat-icon';
7
+ /** Where a conversation belongs: the directory of the user's own, or the package that opened it. */
8
+ export interface ChatSource {
9
+ /** `dir:<cwd>` or `pkg:<package>`. */
10
+ key: string;
11
+ label: string;
12
+ /** The whole directory or package name. */
13
+ title: string;
14
+ /** The directory a new chat of this source opens in; none for a package. */
15
+ cwd?: string;
16
+ /** The host of a directory of another machine (TaLocation). */
17
+ host?: string;
18
+ count: number;
19
+ /** The letter of its avatar. */
20
+ initial: string;
21
+ /** One of the colors of the avatars: by its name, else the next one no other source of the list has. */
22
+ tone: number;
23
+ }
24
+ /** A conversation of the list: an open session, or a saved one, which opens again from its file. */
25
+ export type ChatEntry = TaSessionInfo | TaSavedSessionInfo;
26
+ export interface ChatSection<T extends {
27
+ updatedAt: number;
28
+ } = ChatEntry> {
29
+ id: MessageId;
30
+ sessions: T[];
31
+ }
32
+ /**
33
+ * One row of the list for the conversations of a folder (WebChatIcon.folder), the runs of scheduled tasks: it opens
34
+ * them, the latest first, and says the latest.
35
+ */
36
+ export interface ChatFolder {
37
+ /** `folder:<title>`. */
38
+ key: string;
39
+ title: string;
40
+ icon: ChatFolderIcon;
41
+ /** The latest first. */
42
+ sessions: ChatEntry[];
43
+ /** That of the latest. */
44
+ updatedAt: number;
45
+ }
46
+ /** A row of the list by day: a conversation, or a folder of them. */
47
+ export type ChatRow = ChatEntry | ChatFolder;
48
+ /** The conversations of one directory or package. */
49
+ export interface ChatGroup {
50
+ source: ChatSource;
51
+ sessions: ChatEntry[];
52
+ }
53
+ /** The list by directory or package, else by day; in any browser. */
54
+ /** By day unless the user groups them: directories nest a list, and the remote ones are marked anyway (HostTag). */
55
+ export declare const BY_DIRECTORY: StateSpec<boolean>;
56
+ /** The groups folded: the keys of their sources (ChatListUtil.sourceKey). */
57
+ export declare const FOLDED: StateSpec<string[]>;
58
+ /** The conversations and folders pinned to the top of the list, in any browser: their files and keys (ChatListUtil.pinKey). */
59
+ export declare const PINNED: StateSpec<string[]>;
60
+ /**
61
+ * The rows drawn at first, and more each time the end of those comes near: a list of thousands of
62
+ * conversations opens and scrolls as one of a few dozen.
63
+ */
64
+ export declare const CHAT_PAGE = 60;
65
+ /** The rows a list draws, in its order (ChatListUtil.budget). */
66
+ export interface RowBudget<T = ChatEntry> {
67
+ /** What of `entries`, next in the list, is drawn: as many as are left, and the conversation shown wherever it is. */
68
+ take<E extends T>(entries: E[]): E[];
69
+ /** Some were left out: the list draws more as its end comes near. */
70
+ readonly more: boolean;
71
+ }
72
+ export declare namespace ChatListUtil {
73
+ function isOpen(entry: ChatEntry): entry is TaSessionInfo;
74
+ function isFolder(row: ChatRow): row is ChatFolder;
75
+ /**
76
+ * Those of a folder (WebChatIcon.folder), each folder one row where its latest is, and the rest; the folders the
77
+ * latest first.
78
+ */
79
+ function folders(sessions: ChatEntry[], folderOf?: (session: ChatEntry) => ChatFolderIcon | undefined): {
80
+ folders: ChatFolder[];
81
+ rest: ChatEntry[];
82
+ };
83
+ /** The conversations and the folders as one list, the latest first. */
84
+ function withFolders(rest: ChatEntry[], folders: ChatFolder[]): ChatRow[];
85
+ /** Whether it is the double's own conversation: its session, or before that is open its file. */
86
+ function isDouble(entry: ChatEntry, double: Pick<ChatListDouble, 'session' | 'sessionFile'>): boolean;
87
+ /** The id of an open session, the file of a saved one. */
88
+ function key(entry: ChatEntry): string;
89
+ /** What stays the same as it closes and opens again: its file, else (before it has one) the id of its session. */
90
+ function file(entry: ChatEntry): string;
91
+ /** The files the list keeps however old (ChatListUtil.entries): those pinned, and the saved ones that still ask the user. */
92
+ function keptFiles(saved: readonly TaSavedSessionInfo[], pinned: readonly string[], letGo: LetGoAsks): readonly string[];
93
+ /** What PINNED holds of a row: the file of a conversation, the key of a folder (`folder:<title>`). */
94
+ function pinKey(row: ChatRow): string;
95
+ /** Whether a key of PINNED is a folder's (pinKey), not a conversation's file. */
96
+ function isFolderKey(key: string): boolean;
97
+ /** Those pinned, and the rest, each in the order it had: conversations, or folders. */
98
+ function pinnedApart<T extends ChatRow>(rows: T[], pinned: readonly string[]): {
99
+ pinned: T[];
100
+ rest: T[];
101
+ };
102
+ /**
103
+ * The open sessions and the saved ones, those archived and those taken out apart. A saved conversation of a
104
+ * package's group is not listed: its package opens it again, with its role; unless it folds into a folder of the
105
+ * list (`folderOf`, WebChatIcon.folder), which opens it as the package does. An open one is always listed,
106
+ * however old, and so is one pinned; a saved one not updated `since` is archived (a ta serve of before lists
107
+ * them with the others), or not updated since what `sooner` says of it (ChatIconUtil.archiveSince).
108
+ */
109
+ function entries(sessions: TaSessionInfo[], saved: TaSavedSessionInfo[], removed: string[], archived?: TaSavedSessionInfo[], since?: number, pinned?: readonly string[], sooner?: (session: TaSavedSessionInfo) => number | undefined, folderOf?: (session: TaSavedSessionInfo) => unknown): {
110
+ listed: ChatEntry[];
111
+ archived: ChatEntry[];
112
+ removed: ChatEntry[];
113
+ };
114
+ /** Those updated since `before`, and the older, which the list folds; all are recent without it. */
115
+ function split<T extends {
116
+ updatedAt: number;
117
+ }>(sessions: T[], before: number | undefined): [T[], T[]];
118
+ /**
119
+ * Draws `count` rows of a list, and those it `keeps` however far down they are: the conversation shown, and
120
+ * those unseen, which the tab of the chats scrolls to (PhoneUtil.locate).
121
+ */
122
+ function budget<T = ChatEntry>(count: number, keeps?: (entry: T) => boolean): RowBudget<T>;
123
+ function sourceKey(session: ChatEntry): string;
124
+ /** `@celljs/ta-channels` → `ta-channels`. */
125
+ function label(group: string): string;
126
+ function tone(key: string): number;
127
+ /** The directories and packages of the conversations, the one with the latest first. */
128
+ function sources(sessions: ChatEntry[]): ChatSource[];
129
+ /** The conversations whose title or place holds the query, the latest first. */
130
+ function filter(sessions: ChatEntry[], query: string, t: Translate): ChatEntry[];
131
+ /** The conversations by their directory or package, in the order of the sources; a source without one has no group. */
132
+ function groups(sessions: ChatEntry[], sources: ChatSource[]): ChatGroup[];
133
+ /** Today, yesterday, the week before, earlier: by the local day. */
134
+ function sections<T extends {
135
+ updatedAt: number;
136
+ }>(sessions: T[], now: number): ChatSection<T>[];
137
+ /** `19:59` today, `11/8` before. */
138
+ function clock(time: number, now: number): string;
139
+ function title(session: ChatEntry, t: Translate): string;
140
+ /**
141
+ * Whether a row shows the same: what of its conversation and its place it shows, and the rest as is. The list
142
+ * reads the conversations again every few seconds into new objects: one that answers draws its row again, not every row.
143
+ */
144
+ function sameRow<T extends {
145
+ session: ChatEntry;
146
+ source: ChatSource;
147
+ }>(before: T, after: T): boolean;
148
+ /** What a row says under its title: the last thing said, unless it is the title again. */
149
+ function preview(session: ChatEntry, title: string): string | undefined;
150
+ /** The first letter of a name, for its avatar. */
151
+ function initial(name: string): string;
152
+ }
153
+ /** What a task of the double came to, as the list says it beside the conversation. */
154
+ export type ChatTaskStatus = 'running' | 'done' | 'failed' | 'stopped';
155
+ /** The double, for the list: which conversations are its tasks, and how to hand it one. */
156
+ export interface ChatListDouble {
157
+ /** The sessions of its tasks, and where each is. */
158
+ tasks: ReadonlyMap<string, ChatTaskStatus>;
159
+ /** Its own conversation. */
160
+ session?: string;
161
+ /** The file of its own conversation: it is known before the conversation opens (and without the computer). */
162
+ sessionFile?: string;
163
+ /** What the user calls it. */
164
+ name: string;
165
+ hand(session: TaSessionInfo, title: string): void;
166
+ }
167
+ //# sourceMappingURL=chat-list-util.d.ts.map
@@ -0,0 +1,338 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatListUtil = exports.CHAT_PAGE = exports.PINNED = exports.FOLDED = exports.BY_DIRECTORY = void 0;
4
+ const ta_protocol_1 = require("@celljs/ta-protocol");
5
+ const state_protocol_1 = require("../state/state-protocol");
6
+ const message_1 = require("../util/message");
7
+ const chat_asks_1 = require("./chat-asks");
8
+ const people_1 = require("./people");
9
+ /** The list by directory or package, else by day; in any browser. */
10
+ /** By day unless the user groups them: directories nest a list, and the remote ones are marked anyway (HostTag). */
11
+ exports.BY_DIRECTORY = { key: 'chat.byDirectory', tier: 'user', initial: false, parse: state_protocol_1.StateUtil.boolean };
12
+ /** The groups folded: the keys of their sources (ChatListUtil.sourceKey). */
13
+ exports.FOLDED = {
14
+ key: 'chat.folded',
15
+ tier: 'user',
16
+ initial: [],
17
+ parse: value => (Array.isArray(value) ? value.filter((key) => typeof key === 'string') : undefined),
18
+ };
19
+ /** The conversations and folders pinned to the top of the list, in any browser: their files and keys (ChatListUtil.pinKey). */
20
+ exports.PINNED = {
21
+ key: ta_protocol_1.TA_CHAT_PINNED.key,
22
+ tier: 'user',
23
+ initial: [],
24
+ parse: value => (Array.isArray(value) ? value.filter((file) => typeof file === 'string') : undefined),
25
+ };
26
+ const TONES = 6;
27
+ const DAY = 24 * 60 * 60000;
28
+ /**
29
+ * The rows drawn at first, and more each time the end of those comes near: a list of thousands of
30
+ * conversations opens and scrolls as one of a few dozen.
31
+ */
32
+ exports.CHAT_PAGE = 60;
33
+ var ChatListUtil;
34
+ (function (ChatListUtil) {
35
+ function isOpen(entry) {
36
+ return 'sessionId' in entry;
37
+ }
38
+ ChatListUtil.isOpen = isOpen;
39
+ function isFolder(row) {
40
+ return 'icon' in row && 'title' in row && Array.isArray(row.sessions);
41
+ }
42
+ ChatListUtil.isFolder = isFolder;
43
+ /**
44
+ * Those of a folder (WebChatIcon.folder), each folder one row where its latest is, and the rest; the folders the
45
+ * latest first.
46
+ */
47
+ function folders(sessions, folderOf) {
48
+ if (!folderOf) {
49
+ return { folders: [], rest: sessions };
50
+ }
51
+ const byTitle = new Map();
52
+ const rest = [];
53
+ for (const session of sessions) {
54
+ const icon = folderOf(session);
55
+ if (!icon) {
56
+ rest.push(session);
57
+ continue;
58
+ }
59
+ const known = byTitle.get(icon.folder);
60
+ if (known) {
61
+ known.sessions.push(session);
62
+ known.updatedAt = Math.max(known.updatedAt, session.updatedAt);
63
+ }
64
+ else {
65
+ byTitle.set(icon.folder, { key: `folder:${icon.folder}`, title: icon.folder, icon, sessions: [session], updatedAt: session.updatedAt });
66
+ }
67
+ }
68
+ const folders = [...byTitle.values()];
69
+ for (const folder of folders) {
70
+ folder.sessions.sort((a, b) => b.updatedAt - a.updatedAt);
71
+ }
72
+ return { folders: folders.sort((a, b) => b.updatedAt - a.updatedAt), rest };
73
+ }
74
+ ChatListUtil.folders = folders;
75
+ /** The conversations and the folders as one list, the latest first. */
76
+ function withFolders(rest, folders) {
77
+ if (folders.length === 0) {
78
+ return rest;
79
+ }
80
+ return [...rest, ...folders].sort((a, b) => b.updatedAt - a.updatedAt);
81
+ }
82
+ ChatListUtil.withFolders = withFolders;
83
+ /** Whether it is the double's own conversation: its session, or before that is open its file. */
84
+ function isDouble(entry, double) {
85
+ return isOpen(entry) && (entry.sessionId === double.session || (!!double.sessionFile && entry.sessionFile === double.sessionFile));
86
+ }
87
+ ChatListUtil.isDouble = isDouble;
88
+ /** The id of an open session, the file of a saved one. */
89
+ function key(entry) {
90
+ return isOpen(entry) ? entry.sessionId : entry.sessionFile;
91
+ }
92
+ ChatListUtil.key = key;
93
+ /** What stays the same as it closes and opens again: its file, else (before it has one) the id of its session. */
94
+ function file(entry) {
95
+ var _a;
96
+ return (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId;
97
+ }
98
+ ChatListUtil.file = file;
99
+ /** The files the list keeps however old (ChatListUtil.entries): those pinned, and the saved ones that still ask the user. */
100
+ function keptFiles(saved, pinned, letGo) {
101
+ const asking = saved.filter(session => chat_asks_1.ChatAskUtil.asking(session, letGo)).map(session => session.sessionFile);
102
+ return asking.length ? [...pinned, ...asking] : pinned;
103
+ }
104
+ ChatListUtil.keptFiles = keptFiles;
105
+ /** What PINNED holds of a row: the file of a conversation, the key of a folder (`folder:<title>`). */
106
+ function pinKey(row) {
107
+ return isFolder(row) ? row.key : file(row);
108
+ }
109
+ ChatListUtil.pinKey = pinKey;
110
+ /** Whether a key of PINNED is a folder's (pinKey), not a conversation's file. */
111
+ function isFolderKey(key) {
112
+ return key.startsWith('folder:');
113
+ }
114
+ ChatListUtil.isFolderKey = isFolderKey;
115
+ /** Those pinned, and the rest, each in the order it had: conversations, or folders. */
116
+ function pinnedApart(rows, pinned) {
117
+ const keys = new Set(pinned);
118
+ return { pinned: rows.filter(row => keys.has(pinKey(row))), rest: rows.filter(row => !keys.has(pinKey(row))) };
119
+ }
120
+ ChatListUtil.pinnedApart = pinnedApart;
121
+ /**
122
+ * The open sessions and the saved ones, those archived and those taken out apart. A saved conversation of a
123
+ * package's group is not listed: its package opens it again, with its role; unless it folds into a folder of the
124
+ * list (`folderOf`, WebChatIcon.folder), which opens it as the package does. An open one is always listed,
125
+ * however old, and so is one pinned; a saved one not updated `since` is archived (a ta serve of before lists
126
+ * them with the others), or not updated since what `sooner` says of it (ChatIconUtil.archiveSince).
127
+ */
128
+ function entries(sessions, saved, removed, archived = [], since, pinned = [], sooner, folderOf) {
129
+ const open = new Set(sessions.map(session => session.sessionFile));
130
+ const out = new Set(removed);
131
+ const seen = new Set();
132
+ const closed = [...saved, ...archived].filter(session => {
133
+ if ((session.group && !(folderOf === null || folderOf === void 0 ? void 0 : folderOf(session))) || open.has(session.sessionFile) || seen.has(session.sessionFile)) {
134
+ return false;
135
+ }
136
+ seen.add(session.sessionFile);
137
+ return true;
138
+ });
139
+ const kept = new Set(pinned);
140
+ const recent = (session) => { var _a; return since === undefined || kept.has(session.sessionFile) || session.updatedAt >= Math.max(since, (_a = sooner === null || sooner === void 0 ? void 0 : sooner(session)) !== null && _a !== void 0 ? _a : since); };
141
+ return {
142
+ listed: [...sessions, ...closed.filter(session => recent(session) && !out.has(session.sessionFile))],
143
+ archived: closed.filter(session => !recent(session) && !out.has(session.sessionFile)),
144
+ removed: closed.filter(session => out.has(session.sessionFile)),
145
+ };
146
+ }
147
+ ChatListUtil.entries = entries;
148
+ /** Those updated since `before`, and the older, which the list folds; all are recent without it. */
149
+ function split(sessions, before) {
150
+ if (before === undefined) {
151
+ return [sessions, []];
152
+ }
153
+ const recent = [];
154
+ const older = [];
155
+ for (const session of sessions) {
156
+ (session.updatedAt >= before ? recent : older).push(session);
157
+ }
158
+ return [recent, older];
159
+ }
160
+ ChatListUtil.split = split;
161
+ /**
162
+ * Draws `count` rows of a list, and those it `keeps` however far down they are: the conversation shown, and
163
+ * those unseen, which the tab of the chats scrolls to (PhoneUtil.locate).
164
+ */
165
+ function budget(count, keeps) {
166
+ let left = count;
167
+ let more = false;
168
+ return {
169
+ take(entries) {
170
+ let end = Math.max(0, Math.min(entries.length, left));
171
+ for (let at = entries.length - 1; keeps && at >= end; at--) {
172
+ if (keeps(entries[at])) {
173
+ end = at + 1;
174
+ }
175
+ }
176
+ left -= end;
177
+ more || (more = end < entries.length);
178
+ return end === entries.length ? entries : entries.slice(0, end);
179
+ },
180
+ get more() {
181
+ return more;
182
+ },
183
+ };
184
+ }
185
+ ChatListUtil.budget = budget;
186
+ function sourceKey(session) {
187
+ return session.group ? `pkg:${session.group}` : `dir:${session.cwd}`;
188
+ }
189
+ ChatListUtil.sourceKey = sourceKey;
190
+ /** `@celljs/ta-channels` → `ta-channels`. */
191
+ function label(group) {
192
+ return group.slice(group.lastIndexOf('/') + 1);
193
+ }
194
+ ChatListUtil.label = label;
195
+ function tone(key) {
196
+ let hash = 0;
197
+ for (let i = 0; i < key.length; i++) {
198
+ hash = (hash * 31 + key.charCodeAt(i)) | 0;
199
+ }
200
+ return Math.abs(hash) % TONES;
201
+ }
202
+ ChatListUtil.tone = tone;
203
+ /** The directories and packages of the conversations, the one with the latest first. */
204
+ function sources(sessions) {
205
+ var _a;
206
+ const sources = new Map();
207
+ for (const session of sessions) {
208
+ const key = sourceKey(session);
209
+ const known = sources.get(key);
210
+ if (known) {
211
+ known.count++;
212
+ known.latest = Math.max(known.latest, session.updatedAt);
213
+ continue;
214
+ }
215
+ const name = session.group ? label(session.group) : message_1.MessageUtil.basename(session.cwd);
216
+ sources.set(key, {
217
+ key,
218
+ label: name,
219
+ title: (_a = session.group) !== null && _a !== void 0 ? _a : session.cwd,
220
+ cwd: session.group ? undefined : session.cwd,
221
+ host: session.group ? undefined : ta_protocol_1.TaLocation.host(session.cwd),
222
+ count: 1,
223
+ initial: initial(session.group ? name.replace(/^ta-/, '') : name),
224
+ tone: 0,
225
+ latest: session.updatedAt,
226
+ });
227
+ }
228
+ const taken = new Set();
229
+ for (const source of [...sources.values()].sort((a, b) => a.key.localeCompare(b.key))) {
230
+ const first = tone(source.key);
231
+ const free = Array.from({ length: TONES }, (_, i) => (first + i) % TONES).find(candidate => !taken.has(candidate));
232
+ source.tone = free !== null && free !== void 0 ? free : first;
233
+ taken.add(source.tone);
234
+ }
235
+ return [...sources.values()].sort((a, b) => b.latest - a.latest).map(({ latest, ...source }) => source);
236
+ }
237
+ ChatListUtil.sources = sources;
238
+ /** The conversations whose title or place holds the query, the latest first. */
239
+ function filter(sessions, query, t) {
240
+ const words = query.trim().toLowerCase();
241
+ return sessions
242
+ .filter(session => { var _a, _b; return !words || `${title(session, t)} ${(_a = session.group) !== null && _a !== void 0 ? _a : session.cwd} ${(_b = session.lastMessage) !== null && _b !== void 0 ? _b : ''}`.toLowerCase().includes(words); })
243
+ .sort((a, b) => b.updatedAt - a.updatedAt);
244
+ }
245
+ ChatListUtil.filter = filter;
246
+ /** The conversations by their directory or package, in the order of the sources; a source without one has no group. */
247
+ function groups(sessions, sources) {
248
+ var _a;
249
+ const bySource = new Map(sources.map(source => [source.key, []]));
250
+ for (const session of sessions) {
251
+ (_a = bySource.get(sourceKey(session))) === null || _a === void 0 ? void 0 : _a.push(session);
252
+ }
253
+ return sources.map(source => { var _a; return ({ source, sessions: (_a = bySource.get(source.key)) !== null && _a !== void 0 ? _a : [] }); }).filter(group => group.sessions.length > 0);
254
+ }
255
+ ChatListUtil.groups = groups;
256
+ /** Today, yesterday, the week before, earlier: by the local day. */
257
+ function sections(sessions, now) {
258
+ var _a;
259
+ const today = new Date(now).setHours(0, 0, 0, 0);
260
+ const bounds = [
261
+ [today, 'ta.time.today'],
262
+ [today - DAY, 'ta.time.yesterday'],
263
+ [today - 7 * DAY, 'ta.time.week'],
264
+ [-Infinity, 'ta.time.earlier'],
265
+ ];
266
+ const sections = [];
267
+ for (const session of sessions) {
268
+ const [, id] = (_a = bounds.find(([from]) => session.updatedAt >= from)) !== null && _a !== void 0 ? _a : bounds[bounds.length - 1];
269
+ const last = sections[sections.length - 1];
270
+ if ((last === null || last === void 0 ? void 0 : last.id) === id) {
271
+ last.sessions.push(session);
272
+ }
273
+ else {
274
+ sections.push({ id, sessions: [session] });
275
+ }
276
+ }
277
+ return sections;
278
+ }
279
+ ChatListUtil.sections = sections;
280
+ /** `19:59` today, `11/8` before. */
281
+ function clock(time, now) {
282
+ const date = new Date(time);
283
+ if (date.toDateString() === new Date(now).toDateString()) {
284
+ return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
285
+ }
286
+ return `${date.getMonth() + 1}/${date.getDate()}`;
287
+ }
288
+ ChatListUtil.clock = clock;
289
+ function title(session, t) {
290
+ return session.sessionName || session.firstMessage || t('ta.chat.new');
291
+ }
292
+ ChatListUtil.title = title;
293
+ /**
294
+ * Whether a row shows the same: what of its conversation and its place it shows, and the rest as is. The list
295
+ * reads the conversations again every few seconds into new objects: one that answers draws its row again, not every row.
296
+ */
297
+ function sameRow(before, after) {
298
+ const a = before.session;
299
+ const b = after.session;
300
+ const sameSession = a === b ||
301
+ (key(a) === key(b) &&
302
+ a.sessionName === b.sessionName &&
303
+ a.firstMessage === b.firstMessage &&
304
+ a.lastMessage === b.lastMessage &&
305
+ a.updatedAt === b.updatedAt &&
306
+ a.cwd === b.cwd &&
307
+ a.group === b.group &&
308
+ (isOpen(a) && a.isStreaming) === (isOpen(b) && b.isStreaming) &&
309
+ (isOpen(a) && !!a.waiting) === (isOpen(b) && !!b.waiting) &&
310
+ people_1.PresenceUtil.same(isOpen(a) ? a.people : undefined, isOpen(b) ? b.people : undefined));
311
+ const x = before.source;
312
+ const y = after.source;
313
+ const sameSource = x === y || (x.key === y.key && x.label === y.label && x.title === y.title && x.host === y.host && x.initial === y.initial && x.tone === y.tone);
314
+ if (!sameSession || !sameSource) {
315
+ return false;
316
+ }
317
+ for (const name of Object.keys(after)) {
318
+ if (name !== 'session' && name !== 'source' && before[name] !== after[name]) {
319
+ return false;
320
+ }
321
+ }
322
+ return Object.keys(before).length === Object.keys(after).length;
323
+ }
324
+ ChatListUtil.sameRow = sameRow;
325
+ /** What a row says under its title: the last thing said, unless it is the title again. */
326
+ function preview(session, title) {
327
+ const last = session.lastMessage;
328
+ return last && last !== title ? last : undefined;
329
+ }
330
+ ChatListUtil.preview = preview;
331
+ /** The first letter of a name, for its avatar. */
332
+ function initial(name) {
333
+ const letter = [...name].find(char => /[\p{L}\p{N}]/u.test(char));
334
+ return (letter !== null && letter !== void 0 ? letter : '?').toUpperCase();
335
+ }
336
+ ChatListUtil.initial = initial;
337
+ })(ChatListUtil || (exports.ChatListUtil = ChatListUtil = {}));
338
+ //# sourceMappingURL=chat-list-util.js.map