@celljs/ta-web 4.28.0 → 4.30.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 (437) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-thread.js +15 -2
  4. package/esm/browser/assistant/call-scenes.d.ts +5 -4
  5. package/esm/browser/assistant/call-scenes.js +10 -7
  6. package/esm/browser/chat/chat-protocol.d.ts +2 -0
  7. package/esm/browser/chat/chat-shown.d.ts +3 -1
  8. package/esm/browser/chat/chat-shown.js +25 -3
  9. package/esm/browser/chat/chat-view.js +1 -1
  10. package/esm/browser/chat/chat.d.ts +5 -1
  11. package/esm/browser/chat/chat.js +32 -16
  12. package/esm/browser/components/account-menu.d.ts +6 -16
  13. package/esm/browser/components/account-menu.js +47 -101
  14. package/esm/browser/components/app-contexts.js +7 -4
  15. package/esm/browser/components/app-nav.js +4 -4
  16. package/esm/browser/components/chat-list-row.js +7 -2
  17. package/esm/browser/components/chat-tag.d.ts +20 -0
  18. package/esm/browser/components/chat-tag.js +103 -0
  19. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  20. package/esm/browser/components/composer-box-protocol.d.ts +2 -0
  21. package/esm/browser/components/composer-box.js +20 -1
  22. package/esm/browser/components/composer-emoji.d.ts +22 -0
  23. package/esm/browser/components/composer-emoji.js +50 -0
  24. package/esm/browser/components/custom-host.js +1 -1
  25. package/esm/browser/components/discover-view.d.ts +4 -3
  26. package/esm/browser/components/discover-view.js +5 -4
  27. package/esm/browser/components/editor-area.js +1 -1
  28. package/esm/browser/components/emoji-panel.d.ts +22 -0
  29. package/esm/browser/components/emoji-panel.js +54 -0
  30. package/esm/browser/components/host-view.d.ts +1 -1
  31. package/esm/browser/components/launcher-surface.js +1 -1
  32. package/esm/browser/components/markdown.d.ts +6 -1
  33. package/esm/browser/components/markdown.js +6 -2
  34. package/esm/browser/components/me-rows.d.ts +24 -0
  35. package/esm/browser/components/me-rows.js +19 -0
  36. package/esm/browser/components/me-view.d.ts +2 -1
  37. package/esm/browser/components/me-view.js +3 -2
  38. package/esm/browser/components/message-list.js +47 -7
  39. package/esm/browser/components/message-steps.js +13 -0
  40. package/esm/browser/components/nav-places.js +1 -1
  41. package/esm/browser/components/session-view.js +6 -1
  42. package/esm/browser/components/settings-choices.js +3 -0
  43. package/esm/browser/components/settings-controls.d.ts +13 -0
  44. package/esm/browser/components/settings-controls.js +19 -0
  45. package/esm/browser/components/settings-more.d.ts +1 -1
  46. package/esm/browser/components/settings-more.js +28 -39
  47. package/esm/browser/components/settings-parts.d.ts +4 -2
  48. package/esm/browser/components/settings-parts.js +14 -9
  49. package/esm/browser/components/settings-view.js +2 -6
  50. package/esm/browser/components/web-composer.d.ts +1 -1
  51. package/esm/browser/components/web-composer.js +2 -2
  52. package/esm/browser/device/file-save.d.ts +31 -0
  53. package/esm/browser/device/file-save.js +80 -0
  54. package/esm/browser/extension/extension-view.d.ts +9 -0
  55. package/esm/browser/extension/extension-view.js +7 -0
  56. package/esm/browser/extension/icons.js +2 -1
  57. package/esm/browser/extension/web-api-call.d.ts +45 -0
  58. package/esm/browser/extension/web-api-chats.d.ts +29 -0
  59. package/esm/browser/extension/web-api-components.d.ts +4 -0
  60. package/esm/browser/extension/web-api-contributions.d.ts +13 -14
  61. package/esm/browser/extension/web-api-desktop.d.ts +16 -1
  62. package/esm/browser/extension/web-api-desktop.js +1 -0
  63. package/esm/browser/extension/web-extension-api.d.ts +9 -12
  64. package/esm/browser/extension/web-extension-code.d.ts +15 -8
  65. package/esm/browser/extension/web-extension-code.js +25 -27
  66. package/esm/browser/extension/web-extension-context.js +4 -0
  67. package/esm/browser/extension/web-extension-protocol.d.ts +15 -1
  68. package/esm/browser/extension/web-extension-protocol.js +2 -0
  69. package/esm/browser/extension/web-extension-run.d.ts +4 -2
  70. package/esm/browser/extension/web-extension-run.js +10 -4
  71. package/esm/browser/extension/web-extensions-running.d.ts +3 -0
  72. package/esm/browser/extension/web-extensions-running.js +20 -7
  73. package/esm/browser/extension/web-extensions.js +5 -1
  74. package/esm/browser/extension/web-metrics.d.ts +32 -0
  75. package/esm/browser/extension/web-metrics.js +98 -0
  76. package/esm/browser/extension/web-pages.d.ts +2 -0
  77. package/esm/browser/extension/web-pages.js +2 -0
  78. package/esm/browser/i18n/en/account.d.ts +202 -0
  79. package/esm/browser/i18n/en/account.js +205 -0
  80. package/esm/browser/i18n/en/assistant.d.ts +129 -0
  81. package/esm/browser/i18n/en/assistant.js +130 -0
  82. package/esm/browser/i18n/en/call.d.ts +86 -0
  83. package/esm/browser/i18n/en/call.js +87 -0
  84. package/esm/browser/i18n/en/chat.d.ts +213 -0
  85. package/esm/browser/i18n/en/chat.js +214 -0
  86. package/esm/browser/i18n/en/common.d.ts +99 -0
  87. package/esm/browser/i18n/en/common.js +101 -0
  88. package/esm/browser/i18n/en/console.d.ts +230 -0
  89. package/esm/browser/i18n/en/console.js +232 -0
  90. package/esm/browser/i18n/en/discover.d.ts +117 -0
  91. package/esm/browser/i18n/en/discover.js +119 -0
  92. package/esm/browser/i18n/en/service.d.ts +242 -0
  93. package/esm/browser/i18n/en/service.js +245 -0
  94. package/esm/browser/i18n/en/settings.d.ts +213 -0
  95. package/esm/browser/i18n/en/settings.js +214 -0
  96. package/esm/browser/i18n/en/tools.d.ts +85 -0
  97. package/esm/browser/i18n/en/tools.js +87 -0
  98. package/esm/browser/i18n/ja/account.d.ts +2 -0
  99. package/esm/browser/i18n/ja/account.js +202 -0
  100. package/esm/browser/i18n/ja/assistant.d.ts +2 -0
  101. package/esm/browser/i18n/ja/assistant.js +129 -0
  102. package/esm/browser/i18n/ja/call.d.ts +2 -0
  103. package/esm/browser/i18n/ja/call.js +86 -0
  104. package/esm/browser/i18n/ja/chat.d.ts +2 -0
  105. package/esm/browser/i18n/ja/chat.js +213 -0
  106. package/esm/browser/i18n/ja/common.d.ts +2 -0
  107. package/esm/browser/i18n/ja/common.js +99 -0
  108. package/esm/browser/i18n/ja/console.d.ts +2 -0
  109. package/esm/browser/i18n/ja/console.js +230 -0
  110. package/esm/browser/i18n/ja/discover.d.ts +2 -0
  111. package/esm/browser/i18n/ja/discover.js +117 -0
  112. package/esm/browser/i18n/ja/service.d.ts +2 -0
  113. package/esm/browser/i18n/ja/service.js +242 -0
  114. package/esm/browser/i18n/ja/settings.d.ts +2 -0
  115. package/esm/browser/i18n/ja/settings.js +213 -0
  116. package/esm/browser/i18n/ja/tools.d.ts +2 -0
  117. package/esm/browser/i18n/ja/tools.js +85 -0
  118. package/esm/browser/i18n/locales.d.ts +1136 -1136
  119. package/esm/browser/i18n/messages-ja.js +20 -1586
  120. package/esm/browser/i18n/messages-zh-tw.d.ts +0 -1
  121. package/esm/browser/i18n/messages-zh-tw.js +20 -1587
  122. package/esm/browser/i18n/messages.d.ts +1139 -1136
  123. package/esm/browser/i18n/messages.js +44 -3183
  124. package/esm/browser/i18n/zh/account.d.ts +2 -0
  125. package/esm/browser/i18n/zh/account.js +203 -0
  126. package/esm/browser/i18n/zh/assistant.d.ts +2 -0
  127. package/esm/browser/i18n/zh/assistant.js +129 -0
  128. package/esm/browser/i18n/zh/call.d.ts +2 -0
  129. package/esm/browser/i18n/zh/call.js +86 -0
  130. package/esm/browser/i18n/zh/chat.d.ts +2 -0
  131. package/esm/browser/i18n/zh/chat.js +213 -0
  132. package/esm/browser/i18n/zh/common.d.ts +2 -0
  133. package/esm/browser/i18n/zh/common.js +99 -0
  134. package/esm/browser/i18n/zh/console.d.ts +2 -0
  135. package/esm/browser/i18n/zh/console.js +230 -0
  136. package/esm/browser/i18n/zh/discover.d.ts +2 -0
  137. package/esm/browser/i18n/zh/discover.js +117 -0
  138. package/esm/browser/i18n/zh/service.d.ts +2 -0
  139. package/esm/browser/i18n/zh/service.js +242 -0
  140. package/esm/browser/i18n/zh/settings.d.ts +2 -0
  141. package/esm/browser/i18n/zh/settings.js +213 -0
  142. package/esm/browser/i18n/zh/tools.d.ts +2 -0
  143. package/esm/browser/i18n/zh/tools.js +86 -0
  144. package/esm/browser/i18n/zh-tw/account.d.ts +2 -0
  145. package/esm/browser/i18n/zh-tw/account.js +202 -0
  146. package/esm/browser/i18n/zh-tw/assistant.d.ts +2 -0
  147. package/esm/browser/i18n/zh-tw/assistant.js +129 -0
  148. package/esm/browser/i18n/zh-tw/call.d.ts +2 -0
  149. package/esm/browser/i18n/zh-tw/call.js +86 -0
  150. package/esm/browser/i18n/zh-tw/chat.d.ts +2 -0
  151. package/esm/browser/i18n/zh-tw/chat.js +213 -0
  152. package/esm/browser/i18n/zh-tw/common.d.ts +2 -0
  153. package/esm/browser/i18n/zh-tw/common.js +99 -0
  154. package/esm/browser/i18n/zh-tw/console.d.ts +2 -0
  155. package/esm/browser/i18n/zh-tw/console.js +230 -0
  156. package/esm/browser/i18n/zh-tw/discover.d.ts +2 -0
  157. package/esm/browser/i18n/zh-tw/discover.js +117 -0
  158. package/esm/browser/i18n/zh-tw/service.d.ts +2 -0
  159. package/esm/browser/i18n/zh-tw/service.js +242 -0
  160. package/esm/browser/i18n/zh-tw/settings.d.ts +2 -0
  161. package/esm/browser/i18n/zh-tw/settings.js +213 -0
  162. package/esm/browser/i18n/zh-tw/tools.d.ts +2 -0
  163. package/esm/browser/i18n/zh-tw/tools.js +85 -0
  164. package/esm/browser/offline/device-values.d.ts +4 -0
  165. package/esm/browser/offline/device-values.js +10 -0
  166. package/esm/browser/pwa/page-build.d.ts +15 -0
  167. package/esm/browser/pwa/page-build.js +45 -0
  168. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  169. package/esm/browser/settings/settings-protocol.js +2 -0
  170. package/esm/browser/style/base.d.ts +1 -1
  171. package/esm/browser/style/base.js +3 -0
  172. package/esm/browser/style/chat-list.d.ts +1 -1
  173. package/esm/browser/style/chat-list.js +6 -0
  174. package/esm/browser/style/conversation-column.d.ts +1 -1
  175. package/esm/browser/style/conversation-column.js +17 -0
  176. package/esm/browser/style/conversation.d.ts +1 -1
  177. package/esm/browser/style/conversation.js +5 -0
  178. package/esm/browser/style/pages.d.ts +1 -1
  179. package/esm/browser/style/pages.js +0 -7
  180. package/esm/browser/style/video-call.d.ts +1 -1
  181. package/esm/browser/style/video-call.js +15 -4
  182. package/esm/browser/util/call-transcript.d.ts +16 -0
  183. package/esm/browser/util/call-transcript.js +110 -0
  184. package/esm/browser/util/process.d.ts +6 -0
  185. package/esm/browser/util/process.js +18 -5
  186. package/esm/browser/video-call/call-people.d.ts +21 -0
  187. package/esm/browser/video-call/call-people.js +29 -0
  188. package/esm/browser/video-call/clip-plan.d.ts +11 -2
  189. package/esm/browser/video-call/clip-plan.js +19 -3
  190. package/esm/browser/video-call/face-camera.d.ts +93 -0
  191. package/esm/browser/video-call/face-camera.js +192 -0
  192. package/esm/browser/video-call/face-files.d.ts +43 -5
  193. package/esm/browser/video-call/face-files.js +73 -18
  194. package/esm/browser/video-call/face-moves.d.ts +68 -0
  195. package/esm/browser/video-call/face-moves.js +180 -0
  196. package/esm/browser/video-call/face-stage.d.ts +139 -0
  197. package/esm/browser/video-call/face-stage.js +219 -0
  198. package/esm/browser/video-call/mouth-layer.d.ts +81 -0
  199. package/esm/browser/video-call/mouth-layer.js +241 -0
  200. package/esm/browser/video-call/video-call-view.js +44 -4
  201. package/esm/browser/video-call/video-face.d.ts +11 -5
  202. package/esm/browser/video-call/video-face.js +302 -328
  203. package/esm/browser/workbench.d.ts +8 -0
  204. package/esm/browser/workbench.js +37 -1
  205. package/lib/browser/assistant/assistant-thread.js +15 -2
  206. package/lib/browser/assistant/call-scenes.d.ts +5 -4
  207. package/lib/browser/assistant/call-scenes.js +10 -7
  208. package/lib/browser/chat/chat-protocol.d.ts +2 -0
  209. package/lib/browser/chat/chat-shown.d.ts +3 -1
  210. package/lib/browser/chat/chat-shown.js +25 -3
  211. package/lib/browser/chat/chat-view.js +1 -1
  212. package/lib/browser/chat/chat.d.ts +5 -1
  213. package/lib/browser/chat/chat.js +32 -16
  214. package/lib/browser/components/account-menu.d.ts +6 -16
  215. package/lib/browser/components/account-menu.js +45 -99
  216. package/lib/browser/components/app-contexts.js +6 -3
  217. package/lib/browser/components/app-nav.js +4 -4
  218. package/lib/browser/components/chat-list-row.js +7 -2
  219. package/lib/browser/components/chat-tag.d.ts +21 -0
  220. package/lib/browser/components/chat-tag.js +142 -0
  221. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  222. package/lib/browser/components/composer-box-protocol.d.ts +2 -0
  223. package/lib/browser/components/composer-box.js +20 -1
  224. package/lib/browser/components/composer-emoji.d.ts +23 -0
  225. package/lib/browser/components/composer-emoji.js +87 -0
  226. package/lib/browser/components/custom-host.js +1 -1
  227. package/lib/browser/components/discover-view.d.ts +4 -3
  228. package/lib/browser/components/discover-view.js +5 -4
  229. package/lib/browser/components/editor-area.js +1 -1
  230. package/lib/browser/components/emoji-panel.d.ts +23 -0
  231. package/lib/browser/components/emoji-panel.js +90 -0
  232. package/lib/browser/components/host-view.d.ts +1 -1
  233. package/lib/browser/components/launcher-surface.js +1 -1
  234. package/lib/browser/components/markdown.d.ts +6 -1
  235. package/lib/browser/components/markdown.js +6 -2
  236. package/lib/browser/components/me-rows.d.ts +25 -0
  237. package/lib/browser/components/me-rows.js +22 -0
  238. package/lib/browser/components/me-view.d.ts +2 -1
  239. package/lib/browser/components/me-view.js +3 -2
  240. package/lib/browser/components/message-list.js +46 -6
  241. package/lib/browser/components/message-steps.js +13 -0
  242. package/lib/browser/components/nav-places.js +1 -1
  243. package/lib/browser/components/session-view.js +6 -1
  244. package/lib/browser/components/settings-choices.js +3 -0
  245. package/lib/browser/components/settings-controls.d.ts +13 -0
  246. package/lib/browser/components/settings-controls.js +19 -0
  247. package/lib/browser/components/settings-more.d.ts +1 -1
  248. package/lib/browser/components/settings-more.js +27 -38
  249. package/lib/browser/components/settings-parts.d.ts +4 -2
  250. package/lib/browser/components/settings-parts.js +13 -8
  251. package/lib/browser/components/settings-view.js +2 -6
  252. package/lib/browser/components/web-composer.d.ts +1 -1
  253. package/lib/browser/components/web-composer.js +2 -2
  254. package/lib/browser/device/file-save.d.ts +32 -0
  255. package/lib/browser/device/file-save.js +83 -0
  256. package/lib/browser/extension/extension-view.d.ts +9 -0
  257. package/lib/browser/extension/extension-view.js +8 -1
  258. package/lib/browser/extension/icons.js +1 -0
  259. package/lib/browser/extension/web-api-call.d.ts +45 -0
  260. package/lib/browser/extension/web-api-chats.d.ts +29 -0
  261. package/lib/browser/extension/web-api-components.d.ts +4 -0
  262. package/lib/browser/extension/web-api-contributions.d.ts +13 -14
  263. package/lib/browser/extension/web-api-desktop.d.ts +16 -1
  264. package/lib/browser/extension/web-api-desktop.js +1 -0
  265. package/lib/browser/extension/web-extension-api.d.ts +9 -12
  266. package/lib/browser/extension/web-extension-code.d.ts +15 -8
  267. package/lib/browser/extension/web-extension-code.js +25 -27
  268. package/lib/browser/extension/web-extension-context.js +4 -0
  269. package/lib/browser/extension/web-extension-protocol.d.ts +15 -1
  270. package/lib/browser/extension/web-extension-protocol.js +2 -0
  271. package/lib/browser/extension/web-extension-run.d.ts +4 -2
  272. package/lib/browser/extension/web-extension-run.js +10 -4
  273. package/lib/browser/extension/web-extensions-running.d.ts +3 -0
  274. package/lib/browser/extension/web-extensions-running.js +20 -7
  275. package/lib/browser/extension/web-extensions.js +5 -1
  276. package/lib/browser/extension/web-metrics.d.ts +33 -0
  277. package/lib/browser/extension/web-metrics.js +102 -0
  278. package/lib/browser/extension/web-pages.d.ts +2 -0
  279. package/lib/browser/extension/web-pages.js +2 -0
  280. package/lib/browser/i18n/en/account.d.ts +203 -0
  281. package/lib/browser/i18n/en/account.js +208 -0
  282. package/lib/browser/i18n/en/assistant.d.ts +130 -0
  283. package/lib/browser/i18n/en/assistant.js +133 -0
  284. package/lib/browser/i18n/en/call.d.ts +87 -0
  285. package/lib/browser/i18n/en/call.js +90 -0
  286. package/lib/browser/i18n/en/chat.d.ts +214 -0
  287. package/lib/browser/i18n/en/chat.js +217 -0
  288. package/lib/browser/i18n/en/common.d.ts +100 -0
  289. package/lib/browser/i18n/en/common.js +104 -0
  290. package/lib/browser/i18n/en/console.d.ts +231 -0
  291. package/lib/browser/i18n/en/console.js +235 -0
  292. package/lib/browser/i18n/en/discover.d.ts +118 -0
  293. package/lib/browser/i18n/en/discover.js +122 -0
  294. package/lib/browser/i18n/en/service.d.ts +243 -0
  295. package/lib/browser/i18n/en/service.js +248 -0
  296. package/lib/browser/i18n/en/settings.d.ts +214 -0
  297. package/lib/browser/i18n/en/settings.js +217 -0
  298. package/lib/browser/i18n/en/tools.d.ts +86 -0
  299. package/lib/browser/i18n/en/tools.js +90 -0
  300. package/lib/browser/i18n/ja/account.d.ts +3 -0
  301. package/lib/browser/i18n/ja/account.js +205 -0
  302. package/lib/browser/i18n/ja/assistant.d.ts +3 -0
  303. package/lib/browser/i18n/ja/assistant.js +132 -0
  304. package/lib/browser/i18n/ja/call.d.ts +3 -0
  305. package/lib/browser/i18n/ja/call.js +89 -0
  306. package/lib/browser/i18n/ja/chat.d.ts +3 -0
  307. package/lib/browser/i18n/ja/chat.js +216 -0
  308. package/lib/browser/i18n/ja/common.d.ts +3 -0
  309. package/lib/browser/i18n/ja/common.js +102 -0
  310. package/lib/browser/i18n/ja/console.d.ts +3 -0
  311. package/lib/browser/i18n/ja/console.js +233 -0
  312. package/lib/browser/i18n/ja/discover.d.ts +3 -0
  313. package/lib/browser/i18n/ja/discover.js +120 -0
  314. package/lib/browser/i18n/ja/service.d.ts +3 -0
  315. package/lib/browser/i18n/ja/service.js +245 -0
  316. package/lib/browser/i18n/ja/settings.d.ts +3 -0
  317. package/lib/browser/i18n/ja/settings.js +216 -0
  318. package/lib/browser/i18n/ja/tools.d.ts +3 -0
  319. package/lib/browser/i18n/ja/tools.js +88 -0
  320. package/lib/browser/i18n/locales.d.ts +1136 -1136
  321. package/lib/browser/i18n/messages-ja.js +20 -1586
  322. package/lib/browser/i18n/messages-zh-tw.d.ts +0 -1
  323. package/lib/browser/i18n/messages-zh-tw.js +20 -1587
  324. package/lib/browser/i18n/messages.d.ts +1139 -1136
  325. package/lib/browser/i18n/messages.js +44 -3183
  326. package/lib/browser/i18n/zh/account.d.ts +3 -0
  327. package/lib/browser/i18n/zh/account.js +206 -0
  328. package/lib/browser/i18n/zh/assistant.d.ts +3 -0
  329. package/lib/browser/i18n/zh/assistant.js +132 -0
  330. package/lib/browser/i18n/zh/call.d.ts +3 -0
  331. package/lib/browser/i18n/zh/call.js +89 -0
  332. package/lib/browser/i18n/zh/chat.d.ts +3 -0
  333. package/lib/browser/i18n/zh/chat.js +216 -0
  334. package/lib/browser/i18n/zh/common.d.ts +3 -0
  335. package/lib/browser/i18n/zh/common.js +102 -0
  336. package/lib/browser/i18n/zh/console.d.ts +3 -0
  337. package/lib/browser/i18n/zh/console.js +233 -0
  338. package/lib/browser/i18n/zh/discover.d.ts +3 -0
  339. package/lib/browser/i18n/zh/discover.js +120 -0
  340. package/lib/browser/i18n/zh/service.d.ts +3 -0
  341. package/lib/browser/i18n/zh/service.js +245 -0
  342. package/lib/browser/i18n/zh/settings.d.ts +3 -0
  343. package/lib/browser/i18n/zh/settings.js +216 -0
  344. package/lib/browser/i18n/zh/tools.d.ts +3 -0
  345. package/lib/browser/i18n/zh/tools.js +89 -0
  346. package/lib/browser/i18n/zh-tw/account.d.ts +3 -0
  347. package/lib/browser/i18n/zh-tw/account.js +205 -0
  348. package/lib/browser/i18n/zh-tw/assistant.d.ts +3 -0
  349. package/lib/browser/i18n/zh-tw/assistant.js +132 -0
  350. package/lib/browser/i18n/zh-tw/call.d.ts +3 -0
  351. package/lib/browser/i18n/zh-tw/call.js +89 -0
  352. package/lib/browser/i18n/zh-tw/chat.d.ts +3 -0
  353. package/lib/browser/i18n/zh-tw/chat.js +216 -0
  354. package/lib/browser/i18n/zh-tw/common.d.ts +3 -0
  355. package/lib/browser/i18n/zh-tw/common.js +102 -0
  356. package/lib/browser/i18n/zh-tw/console.d.ts +3 -0
  357. package/lib/browser/i18n/zh-tw/console.js +233 -0
  358. package/lib/browser/i18n/zh-tw/discover.d.ts +3 -0
  359. package/lib/browser/i18n/zh-tw/discover.js +120 -0
  360. package/lib/browser/i18n/zh-tw/service.d.ts +3 -0
  361. package/lib/browser/i18n/zh-tw/service.js +245 -0
  362. package/lib/browser/i18n/zh-tw/settings.d.ts +3 -0
  363. package/lib/browser/i18n/zh-tw/settings.js +216 -0
  364. package/lib/browser/i18n/zh-tw/tools.d.ts +3 -0
  365. package/lib/browser/i18n/zh-tw/tools.js +88 -0
  366. package/lib/browser/offline/device-values.d.ts +4 -0
  367. package/lib/browser/offline/device-values.js +10 -0
  368. package/lib/browser/pwa/page-build.d.ts +16 -0
  369. package/lib/browser/pwa/page-build.js +48 -0
  370. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  371. package/lib/browser/settings/settings-protocol.js +2 -0
  372. package/lib/browser/style/base.d.ts +1 -1
  373. package/lib/browser/style/base.js +3 -0
  374. package/lib/browser/style/chat-list.d.ts +1 -1
  375. package/lib/browser/style/chat-list.js +6 -0
  376. package/lib/browser/style/conversation-column.d.ts +1 -1
  377. package/lib/browser/style/conversation-column.js +17 -0
  378. package/lib/browser/style/conversation.d.ts +1 -1
  379. package/lib/browser/style/conversation.js +5 -0
  380. package/lib/browser/style/pages.d.ts +1 -1
  381. package/lib/browser/style/pages.js +0 -7
  382. package/lib/browser/style/video-call.d.ts +1 -1
  383. package/lib/browser/style/video-call.js +15 -4
  384. package/lib/browser/util/call-transcript.d.ts +17 -0
  385. package/lib/browser/util/call-transcript.js +113 -0
  386. package/lib/browser/util/process.d.ts +6 -0
  387. package/lib/browser/util/process.js +17 -4
  388. package/lib/browser/video-call/call-people.d.ts +22 -0
  389. package/lib/browser/video-call/call-people.js +32 -0
  390. package/lib/browser/video-call/clip-plan.d.ts +11 -2
  391. package/lib/browser/video-call/clip-plan.js +19 -3
  392. package/lib/browser/video-call/face-camera.d.ts +94 -0
  393. package/lib/browser/video-call/face-camera.js +197 -0
  394. package/lib/browser/video-call/face-files.d.ts +43 -5
  395. package/lib/browser/video-call/face-files.js +73 -18
  396. package/lib/browser/video-call/face-moves.d.ts +69 -0
  397. package/lib/browser/video-call/face-moves.js +184 -0
  398. package/lib/browser/video-call/face-stage.d.ts +140 -0
  399. package/lib/browser/video-call/face-stage.js +223 -0
  400. package/lib/browser/video-call/mouth-layer.d.ts +82 -0
  401. package/lib/browser/video-call/mouth-layer.js +245 -0
  402. package/lib/browser/video-call/video-call-view.js +44 -4
  403. package/lib/browser/video-call/video-face.d.ts +11 -5
  404. package/lib/browser/video-call/video-face.js +302 -328
  405. package/lib/browser/workbench.d.ts +8 -0
  406. package/lib/browser/workbench.js +36 -0
  407. package/package.json +7 -7
  408. package/public/faces/README.md +17 -4
  409. package/public/faces/blonde/clap.mp4 +0 -0
  410. package/public/faces/blonde/dance.mp4 +0 -0
  411. package/public/faces/blonde/face.jpg +0 -0
  412. package/public/faces/blonde/happy.mp4 +0 -0
  413. package/public/faces/blonde/heart.mp4 +0 -0
  414. package/public/faces/blonde/idle-1.mp4 +0 -0
  415. package/public/faces/blonde/idle-2.mp4 +0 -0
  416. package/public/faces/blonde/idle-3.mp4 +0 -0
  417. package/public/faces/blonde/laugh.mp4 +0 -0
  418. package/public/faces/blonde/listening.mp4 +0 -0
  419. package/public/faces/blonde/poster.jpg +0 -0
  420. package/public/faces/blonde/shy.mp4 +0 -0
  421. package/public/faces/blonde/sorry.mp4 +0 -0
  422. package/public/faces/blonde/stretch.mp4 +0 -0
  423. package/public/faces/blonde/surprised.mp4 +0 -0
  424. package/public/faces/blonde/talk-1.mp4 +0 -0
  425. package/public/faces/blonde/talk-2.mp4 +0 -0
  426. package/public/faces/blonde/think-2.mp4 +0 -0
  427. package/public/faces/blonde/thinking.mp4 +0 -0
  428. package/public/faces/blonde/wave.mp4 +0 -0
  429. package/public/faces/dance.mp4 +0 -0
  430. package/public/faces/face.jpg +0 -0
  431. package/public/faces/framing.json +1 -0
  432. package/public/faces/lips.json +1 -1
  433. package/public/faces/stretch.mp4 +0 -0
  434. package/esm/browser/video-call/face-clips.d.ts +0 -33
  435. package/esm/browser/video-call/face-clips.js +0 -93
  436. package/lib/browser/video-call/face-clips.d.ts +0 -34
  437. package/lib/browser/video-call/face-clips.js +0 -96
@@ -1,31 +1,69 @@
1
+ import type { ClipFraming } from './face-camera.js';
1
2
  /** A URL of the page's own, from the document a video call draws in (its window is about:blank). */
2
3
  export declare function faceUrl(path: string, doc: Document): string;
3
4
  /**
4
5
  * The files of the person of a video call (faces/README.md), as they are now: their names stay the same from one Ta to
5
6
  * the next while the files of the server are kept a year, so each is asked again once a page (a 304 when unchanged)
6
7
  * and played from its copy in memory. A clip a cache kept from a Ta before would show another person than the one the
7
- * mouth is drawn for. With where her face is in each frame (lips.json), and the frames of the clips without a mouth.
8
+ * mouth is drawn for. With where her face is in each frame (lips.json), the frames of the clips without a mouth, and
9
+ * how the clips she stands up in are framed (framing.json). Of one person of those Ta has (CallPeople): her files are in
10
+ * a directory of her own (`blonde/`), the first person's at the top; the clips are named here as the first person's are
11
+ * (`talk-1`), and `full` gives the name of the file, as lips.json and the mouth know it (`blonde/talk-1`).
8
12
  */
9
13
  export declare class FaceFiles {
10
14
  protected readonly base: string;
15
+ /** The directory of the person in faces/ (`blonde/`), `''` for the first. */
16
+ readonly person: string;
11
17
  protected static current?: FaceFiles;
12
18
  /** The URL each file plays from: its copy in memory, else its own. */
13
19
  protected readonly urls: Map<string, string>;
14
20
  protected faceBoxes: Record<string, number[][]>;
15
21
  /** The frames of the clips no mouth is drawn on (lips.json `plain`). */
16
22
  protected plainFrames: Record<string, number>;
23
+ protected framings: Record<string, ClipFraming>;
17
24
  loaded: boolean;
18
25
  readonly ready: Promise<void>;
19
- protected constructor(base: string);
20
- /** The files of the page, loaded once. */
21
- static of(doc: Document): FaceFiles;
22
- static poster(doc: Document): string;
26
+ protected constructor(base: string,
27
+ /** The directory of the person in faces/ (`blonde/`), `''` for the first. */
28
+ person: string);
29
+ /** The files of a person (CallPeople.dir) for the page, loaded once (again as the person changes). */
30
+ static of(doc: Document, person?: string): FaceFiles;
31
+ static poster(doc: Document, person?: string): string;
32
+ /** The name of a clip of this person as lips.json and the mouth know it; one of the user's (`own:…`) as it is. */
33
+ full(clip: string): string;
23
34
  /** Where her face is (x1, y1, x2, y2) in each frame of a clip; undefined for a clip lips.json does not have. */
24
35
  boxes(clip: string): readonly number[][] | undefined;
25
36
  /** The frames of a clip; undefined for one lips.json does not have. */
26
37
  frames(clip: string): number | undefined;
38
+ /** How a clip she stands up in is framed (FaceCamera); undefined for the others, framed as they are. */
39
+ framing(clip: string): ClipFraming | undefined;
40
+ /**
41
+ * A clip of the user's (WebCallMove), played from its URL as Ta's own are: its frames, where her face is in each,
42
+ * and how it is framed as she stands up.
43
+ */
44
+ add(clip: string, file: {
45
+ url: string;
46
+ frames: number;
47
+ boxes?: number[][];
48
+ framing?: {
49
+ rest: number[];
50
+ body: number[][];
51
+ fps: number;
52
+ };
53
+ }): void;
27
54
  clip(name: string): string;
28
55
  protected load(): Promise<void>;
56
+ /** The framings of framing.json, those whole. */
57
+ static framings(file: FramingFile | undefined): Record<string, ClipFraming>;
29
58
  /** The file as the server has it now. */
30
59
  protected fresh(file: string): Promise<Response>;
31
60
  }
61
+ /** faces/framing.json: of each clip she stands up in, where the picture of the others is (x, y, width, height) and her body. */
62
+ export interface FramingFile {
63
+ fps?: number;
64
+ clips?: Record<string, {
65
+ rest?: number[];
66
+ body?: number[][];
67
+ back?: number;
68
+ }>;
69
+ }
@@ -1,5 +1,5 @@
1
- /** The picture shown until a clip plays (faces/README.md). */
2
- const POSTER = 'faces/poster.jpg';
1
+ /** The picture shown until a clip plays (faces/README.md), of a person (CallPeople). */
2
+ const POSTER = 'poster.jpg';
3
3
  /** A URL of the page's own, from the document a video call draws in (its window is about:blank). */
4
4
  export function faceUrl(path, doc) {
5
5
  return new URL(path, doc.baseURI === 'about:blank' ? document.baseURI : doc.baseURI).href;
@@ -8,63 +8,118 @@ export function faceUrl(path, doc) {
8
8
  * The files of the person of a video call (faces/README.md), as they are now: their names stay the same from one Ta to
9
9
  * the next while the files of the server are kept a year, so each is asked again once a page (a 304 when unchanged)
10
10
  * and played from its copy in memory. A clip a cache kept from a Ta before would show another person than the one the
11
- * mouth is drawn for. With where her face is in each frame (lips.json), and the frames of the clips without a mouth.
11
+ * mouth is drawn for. With where her face is in each frame (lips.json), the frames of the clips without a mouth, and
12
+ * how the clips she stands up in are framed (framing.json). Of one person of those Ta has (CallPeople): her files are in
13
+ * a directory of her own (`blonde/`), the first person's at the top; the clips are named here as the first person's are
14
+ * (`talk-1`), and `full` gives the name of the file, as lips.json and the mouth know it (`blonde/talk-1`).
12
15
  */
13
16
  export class FaceFiles {
14
- constructor(base) {
17
+ constructor(base,
18
+ /** The directory of the person in faces/ (`blonde/`), `''` for the first. */
19
+ person) {
15
20
  this.base = base;
21
+ this.person = person;
16
22
  /** The URL each file plays from: its copy in memory, else its own. */
17
23
  this.urls = new Map();
18
24
  this.faceBoxes = {};
19
25
  /** The frames of the clips no mouth is drawn on (lips.json `plain`). */
20
26
  this.plainFrames = {};
27
+ this.framings = {};
21
28
  this.loaded = false;
22
29
  this.ready = this.load().finally(() => {
23
30
  this.loaded = true;
24
31
  });
25
32
  }
26
- /** The files of the page, loaded once. */
27
- static of(doc) {
33
+ /** The files of a person (CallPeople.dir) for the page, loaded once (again as the person changes). */
34
+ static of(doc, person = '') {
28
35
  var _a;
29
36
  const base = faceUrl('faces/', doc);
30
- if (((_a = FaceFiles.current) === null || _a === void 0 ? void 0 : _a.base) !== base) {
31
- FaceFiles.current = new FaceFiles(base);
37
+ if (((_a = FaceFiles.current) === null || _a === void 0 ? void 0 : _a.base) !== base || FaceFiles.current.person !== person) {
38
+ FaceFiles.current = new FaceFiles(base, person);
32
39
  }
33
40
  return FaceFiles.current;
34
41
  }
35
- static poster(doc) {
42
+ static poster(doc, person = '') {
36
43
  var _a;
37
- var _b;
38
- return (_b = (_a = FaceFiles.current) === null || _a === void 0 ? void 0 : _a.urls.get('poster.jpg')) !== null && _b !== void 0 ? _b : faceUrl(POSTER, doc);
44
+ const current = FaceFiles.current;
45
+ return (_a = ((current === null || current === void 0 ? void 0 : current.person) === person ? current.urls.get(`${person}${POSTER}`) : undefined)) !== null && _a !== void 0 ? _a : faceUrl(`faces/${person}${POSTER}`, doc);
46
+ }
47
+ /** The name of a clip of this person as lips.json and the mouth know it; one of the user's (`own:…`) as it is. */
48
+ full(clip) {
49
+ return clip.includes(':') ? clip : `${this.person}${clip}`;
39
50
  }
40
51
  /** Where her face is (x1, y1, x2, y2) in each frame of a clip; undefined for a clip lips.json does not have. */
41
52
  boxes(clip) {
42
- return this.faceBoxes[clip];
53
+ return this.faceBoxes[this.full(clip)];
43
54
  }
44
55
  /** The frames of a clip; undefined for one lips.json does not have. */
45
56
  frames(clip) {
46
57
  var _a;
47
58
  var _b;
48
- return (_b = (_a = this.faceBoxes[clip]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : this.plainFrames[clip];
59
+ return (_b = (_a = this.faceBoxes[this.full(clip)]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : this.plainFrames[this.full(clip)];
60
+ }
61
+ /** How a clip she stands up in is framed (FaceCamera); undefined for the others, framed as they are. */
62
+ framing(clip) {
63
+ return this.framings[this.full(clip)];
64
+ }
65
+ /**
66
+ * A clip of the user's (WebCallMove), played from its URL as Ta's own are: its frames, where her face is in each,
67
+ * and how it is framed as she stands up.
68
+ */
69
+ add(clip, file) {
70
+ var _a, _b;
71
+ this.urls.set(`${clip}.mp4`, file.url);
72
+ if ((_a = file.boxes) === null || _a === void 0 ? void 0 : _a.length) {
73
+ this.faceBoxes[clip] = file.boxes;
74
+ }
75
+ else {
76
+ this.plainFrames[clip] = file.frames;
77
+ }
78
+ Object.assign(this.framings, FaceFiles.framings({ fps: (_b = file.framing) === null || _b === void 0 ? void 0 : _b.fps, clips: file.framing ? { [clip]: file.framing } : {} }));
49
79
  }
50
80
  clip(name) {
51
81
  var _a;
52
- const file = `${name}.mp4`;
82
+ const file = `${this.full(name)}.mp4`;
53
83
  return (_a = this.urls.get(file)) !== null && _a !== void 0 ? _a : new URL(file, this.base).href;
54
84
  }
55
85
  async load() {
56
86
  var _a, _b;
57
- const lips = await this.fresh('lips.json')
58
- .then(response => response.json())
59
- .catch(() => undefined);
87
+ const [lips, framing] = await Promise.all([
88
+ this.fresh('lips.json')
89
+ .then(response => response.json())
90
+ .catch(() => undefined),
91
+ this.fresh('framing.json')
92
+ .then(response => response.json())
93
+ .catch(() => undefined),
94
+ ]);
95
+ this.framings = FaceFiles.framings(framing);
60
96
  this.faceBoxes = (_a = lips === null || lips === void 0 ? void 0 : lips.clips) !== null && _a !== void 0 ? _a : {};
61
97
  this.plainFrames = (_b = lips === null || lips === void 0 ? void 0 : lips.plain) !== null && _b !== void 0 ? _b : {};
62
- const files = ['poster.jpg', ...[...Object.keys(this.faceBoxes), ...Object.keys(this.plainFrames)].map(clip => `${clip}.mp4`)];
98
+ // Of this person alone: the others' clips are not fetched.
99
+ const mine = (clip) => (this.person ? clip.startsWith(this.person) : !clip.includes('/'));
100
+ const clips = [...Object.keys(this.faceBoxes), ...Object.keys(this.plainFrames)].filter(mine);
101
+ const files = [`${this.person}${POSTER}`, ...clips.map(clip => `${clip}.mp4`)];
63
102
  await Promise.all(files.map(file => this.fresh(file)
64
103
  .then(response => response.blob())
65
104
  .then(blob => this.urls.set(file, URL.createObjectURL(blob)))
66
105
  .catch(() => undefined)));
67
106
  }
107
+ /** The framings of framing.json, those whole. */
108
+ static framings(file) {
109
+ var _a;
110
+ const framings = {};
111
+ for (const [clip, { rest, body, back }] of Object.entries((_a = file === null || file === void 0 ? void 0 : file.clips) !== null && _a !== void 0 ? _a : {})) {
112
+ if ((rest === null || rest === void 0 ? void 0 : rest.length) === 4 && (body === null || body === void 0 ? void 0 : body.length) && (file === null || file === void 0 ? void 0 : file.fps)) {
113
+ framings[clip] = {
114
+ rest: { x: rest[0], y: rest[1], w: rest[2], h: rest[3] },
115
+ body,
116
+ fps: file.fps,
117
+ ...(typeof back === 'number' ? { back } : {}),
118
+ };
119
+ }
120
+ }
121
+ return framings;
122
+ }
68
123
  /** The file as the server has it now. */
69
124
  async fresh(file) {
70
125
  const response = await fetch(new URL(file, this.base).href, { cache: 'no-cache' });
@@ -0,0 +1,68 @@
1
+ import { type TaCallOwnMove } from '@celljs/ta-protocol';
2
+ import type { CallPhase, CallReading } from '../assistant/voice-call-protocol.js';
3
+ import type { WebCallMove } from '../extension/web-api-call.js';
4
+ /** A state of the call, each with clips played at random, never the same twice in a row (loops). */
5
+ export type LoopKind = 'listening' | 'thinking' | 'speaking';
6
+ /** A move: a clip that plays once, as she says one of its words (`say`), or once she said it, as she listens (`after`). */
7
+ export interface FaceMove {
8
+ name: string;
9
+ when: 'say' | 'after';
10
+ clip: string;
11
+ /** Whether a sentence brings it. */
12
+ words: RegExp;
13
+ /** A few of its words, told to Ta (TaCallScene.moves): of the user's moves; Ta's own are told by TaCallMoves. */
14
+ told: string[];
15
+ /** The user's own (WebCallMoves). */
16
+ own?: boolean;
17
+ }
18
+ /**
19
+ * What the person of a video call can do, in one place (docs/design/ta-call.md 16): the clips of each state of the call
20
+ * and the moves a sentence brings, Ta's own and the user's (WebCallMoves) before them. Both ways Ta answers (its own
21
+ * front, a voice service answering by itself) end in what she says, so a move is brought by the words said, and Ta is
22
+ * told which moves there are and their words (TaCallScene.moves). A clip of the user's that cannot play gives way to
23
+ * Ta's own.
24
+ */
25
+ export declare class FaceMoves {
26
+ protected own: FaceMove[];
27
+ protected readonly ownLoops: Record<LoopKind, string[]>;
28
+ /** The user's clips that could not play, and why. */
29
+ protected readonly broken: Map<string, string>;
30
+ /** The state of the call as clips play it. */
31
+ static kind(phase: CallPhase, paused: boolean): LoopKind;
32
+ /** The clip name of a move of the user's, apart from those of Ta's own. */
33
+ static ownClip(name: string): string;
34
+ /** The user's moves (WebCallMoves), as a call begins. */
35
+ use(moves: readonly WebCallMove[]): void;
36
+ /** Words as a test of a sentence: any of them in it, whatever their case. */
37
+ static wordsOf(words: readonly string[]): RegExp;
38
+ /** The moves that may play now, the user's first; one of Ta's own named as one of the user's gives way to it. */
39
+ moves(): FaceMove[];
40
+ /**
41
+ * The move a sentence she says brings as she says it: one of the user's by its words, else the move it names
42
+ * (TaCallMoves: "给你比个心"), else its look ("谢谢你"); undefined for none.
43
+ */
44
+ said(words: string | undefined): FaceMove | undefined;
45
+ /** What she stands up to do once she said a sentence (she dances when she says she will); undefined for nothing. */
46
+ after(words: string | undefined): FaceMove | undefined;
47
+ /**
48
+ * A move begins at this second of a reading: the sentence heard then asks for one (the user's, or one TaCallMoves
49
+ * names), not played yet. The clip of speaking playing then gives way, so that she makes it as she says it.
50
+ */
51
+ cue(reading: Pick<CallReading, 'pieces' | 'pieceAt'> | undefined, seconds: number, used: ReadonlySet<number>): boolean;
52
+ /** The move a clip plays; undefined for a clip of a state. */
53
+ of(clip: string | undefined): FaceMove | undefined;
54
+ /** The clips of a state: the user's when they gave some that play, else Ta's own. */
55
+ loops(kind: LoopKind): readonly string[];
56
+ /** The next clip of a state, at random but never the one just played where it has others. */
57
+ loop(kind: LoopKind, last: string | undefined, random?: () => number): string;
58
+ /**
59
+ * The clip that begins at a second of a reading, after `last`: the move of a sentence heard since the clip before
60
+ * began, each sentence once (`used`), the user's own first, else the latest; else another clip of speaking. A clip
61
+ * plays whole (the mouth is drawn for its frames ahead), so a sentence said in its middle shows at its end.
62
+ */
63
+ at(reading: Pick<CallReading, 'pieces' | 'pieceAt'> | undefined, seconds: number, last: string | undefined, used: Set<number>): string;
64
+ /** A clip could not play: true when it was the user's, which then gives way to Ta's own. */
65
+ fail(clip: string, reason: string): boolean;
66
+ /** The moves of the user's Ta is told of (TaCallScene.moves), beside her own (TaCallMoves). */
67
+ told(): TaCallOwnMove[];
68
+ }
@@ -0,0 +1,180 @@
1
+ import { TaCallMoves } from '@celljs/ta-protocol';
2
+ /** The clips of each state, of Ta's own (public/faces, README.md there). */
3
+ const LOOPS = {
4
+ listening: ['listening', 'idle-1', 'idle-2', 'idle-3'],
5
+ thinking: ['thinking', 'think-2'],
6
+ speaking: ['talk-1', 'talk-2', 'idle-1', 'listening'],
7
+ };
8
+ /**
9
+ * Ta's own moves: the looks of what she says, by its words, in the order they are tried (sorrow first); and those she
10
+ * stands up for, brought by TaCallMoves.named as the moves she is asked for (wave, heart, clap, laugh too).
11
+ */
12
+ const BUILT_IN = [
13
+ move('sorry', 'say', /抱歉|对不起|不好意思|遗憾|可惜|失败了|出错|没做成|糟糕|對不起|ごめん|すみません|残念|\b(?:sorry|unfortunately|afraid|failed)\b/i, [
14
+ '抱歉',
15
+ 'sorry',
16
+ ]),
17
+ move('laugh', 'say', /哈哈|嘿嘿|笑死|好好笑|太好笑|逗死|ハハ|笑える|\b(?:haha\w*|lol|hilarious|funny)\b/i, ['哈哈', 'haha']),
18
+ move('surprised', 'say', /哇|天哪|天啊|真的吗|竟然|居然|没想到|わあ|まさか|\b(?:wow|really\?|no way|amazing|incredible)\b/i, ['哇', 'wow']),
19
+ move('clap', 'say', /恭喜|太棒了|真棒|好厉害|太厉害|干得漂亮|好样的|太強|おめでとう|すごい|\b(?:congrat\w*|bravo|well done|awesome)\b/i, [
20
+ '恭喜',
21
+ 'congrats',
22
+ ]),
23
+ move('heart', 'say', /爱你|喜欢你|比心|么么|谢谢你|感谢你|謝謝你|大好き|ありがとう|\b(?:love you|thank you|thanks)\b/i, ['谢谢你', 'thank you']),
24
+ move('shy', 'say', /过奖|過獎|哪里哪里|害羞|不好意思啦|夸得|照れ|\b(?:flattered|you're too kind|blush\w*)\b/i, ['过奖', 'flattered']),
25
+ move('wave', 'say', /你好|您好|嗨|哈喽|早上好|下午好|晚上好|再见|拜拜|回头见|こんにちは|おはよう|こんばんは|またね|さようなら|\b(?:hello|hi|hey|bye|goodbye|see you)\b/i, ['你好', '再见', 'hello']),
26
+ move('happy', 'say', /太好了|好开心|开心|高兴|很棒|成功了|搞定|嬉しい|やった|\b(?:great|glad|yay|done!)\b/i, ['太好了', 'great']),
27
+ move('dance', 'after', /(?!)/, []),
28
+ move('stretch', 'after', /(?!)/, []),
29
+ ];
30
+ /** A sentence that says she cannot, or will not: no move of the user's that she would stand up for. */
31
+ const NOT_AFTER = /不会|不能|没法|没办法|做不了|跳不了|不行|不太方便|できない|無理|\b(?:can'?t|cannot|unable|won'?t|not able)\b/i;
32
+ function move(name, when, words, told) {
33
+ return { name, when, clip: name, words, told };
34
+ }
35
+ /**
36
+ * What the person of a video call can do, in one place (docs/design/ta-call.md 16): the clips of each state of the call
37
+ * and the moves a sentence brings, Ta's own and the user's (WebCallMoves) before them. Both ways Ta answers (its own
38
+ * front, a voice service answering by itself) end in what she says, so a move is brought by the words said, and Ta is
39
+ * told which moves there are and their words (TaCallScene.moves). A clip of the user's that cannot play gives way to
40
+ * Ta's own.
41
+ */
42
+ export class FaceMoves {
43
+ constructor() {
44
+ this.own = [];
45
+ this.ownLoops = { listening: [], thinking: [], speaking: [] };
46
+ /** The user's clips that could not play, and why. */
47
+ this.broken = new Map();
48
+ }
49
+ /** The state of the call as clips play it. */
50
+ static kind(phase, paused) {
51
+ if (paused) {
52
+ return 'listening';
53
+ }
54
+ return phase === 'thinking' ? 'thinking' : phase === 'speaking' ? 'speaking' : 'listening';
55
+ }
56
+ /** The clip name of a move of the user's, apart from those of Ta's own. */
57
+ static ownClip(name) {
58
+ return `own:${name}`;
59
+ }
60
+ /** The user's moves (WebCallMoves), as a call begins. */
61
+ use(moves) {
62
+ var _a;
63
+ this.own = [];
64
+ for (const loop of Object.values(this.ownLoops)) {
65
+ loop.length = 0;
66
+ }
67
+ for (const given of moves) {
68
+ const clip = FaceMoves.ownClip(given.name);
69
+ if (given.kind === 'say' || given.kind === 'after') {
70
+ const words = ((_a = given.words) !== null && _a !== void 0 ? _a : []).map(word => word.trim()).filter(Boolean);
71
+ // In place of one of Ta's own without words of its own: brought by that one's words.
72
+ const same = BUILT_IN.find(move => move.name === given.name && move.when === given.kind);
73
+ if (words.length) {
74
+ this.own.push({ name: given.name, when: given.kind, clip, words: FaceMoves.wordsOf(words), told: words.slice(0, 3), own: true });
75
+ }
76
+ else if (same) {
77
+ this.own.push({ ...same, clip, own: true });
78
+ }
79
+ }
80
+ else if (given.kind in this.ownLoops) {
81
+ this.ownLoops[given.kind].push(clip);
82
+ }
83
+ }
84
+ }
85
+ /** Words as a test of a sentence: any of them in it, whatever their case. */
86
+ static wordsOf(words) {
87
+ return new RegExp(words.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'i');
88
+ }
89
+ /** The moves that may play now, the user's first; one of Ta's own named as one of the user's gives way to it. */
90
+ moves() {
91
+ const own = this.own.filter(move => !this.broken.has(move.clip));
92
+ const names = new Set(own.map(move => move.name));
93
+ return [...own, ...BUILT_IN.filter(move => !names.has(move.name))];
94
+ }
95
+ /**
96
+ * The move a sentence she says brings as she says it: one of the user's by its words, else the move it names
97
+ * (TaCallMoves: "给你比个心"), else its look ("谢谢你"); undefined for none.
98
+ */
99
+ said(words) {
100
+ var _a, _b;
101
+ if (!words) {
102
+ return undefined;
103
+ }
104
+ const moves = this.moves();
105
+ const named = TaCallMoves.named(words);
106
+ return ((_b = (_a = moves.find(move => move.own && move.when === 'say' && move.words.test(words))) !== null && _a !== void 0 ? _a : (named && !TaCallMoves.standing(named) ? moves.find(move => move.name === named) : undefined)) !== null && _b !== void 0 ? _b : moves.find(move => move.when === 'say' && move.words.test(words)));
107
+ }
108
+ /** What she stands up to do once she said a sentence (she dances when she says she will); undefined for nothing. */
109
+ after(words) {
110
+ var _a;
111
+ if (!words) {
112
+ return undefined;
113
+ }
114
+ const moves = this.moves();
115
+ const named = TaCallMoves.named(words);
116
+ return ((_a = (NOT_AFTER.test(words) ? undefined : moves.find(move => move.own && move.when === 'after' && move.words.test(words)))) !== null && _a !== void 0 ? _a : (TaCallMoves.standing(named) ? moves.find(move => move.name === named) : undefined));
117
+ }
118
+ /**
119
+ * A move begins at this second of a reading: the sentence heard then asks for one (the user's, or one TaCallMoves
120
+ * names), not played yet. The clip of speaking playing then gives way, so that she makes it as she says it.
121
+ */
122
+ cue(reading, seconds, used) {
123
+ const piece = reading === null || reading === void 0 ? void 0 : reading.pieceAt(seconds);
124
+ if (piece === undefined || used.has(piece)) {
125
+ return false;
126
+ }
127
+ const words = reading === null || reading === void 0 ? void 0 : reading.pieces[piece];
128
+ const named = TaCallMoves.named(words);
129
+ return (!!named && !TaCallMoves.standing(named)) || this.own.some(move => move.when === 'say' && !!words && move.words.test(words));
130
+ }
131
+ /** The move a clip plays; undefined for a clip of a state. */
132
+ of(clip) {
133
+ return clip === undefined ? undefined : this.moves().find(move => move.clip === clip);
134
+ }
135
+ /** The clips of a state: the user's when they gave some that play, else Ta's own. */
136
+ loops(kind) {
137
+ const own = this.ownLoops[kind].filter(clip => !this.broken.has(clip));
138
+ return own.length ? own : LOOPS[kind];
139
+ }
140
+ /** The next clip of a state, at random but never the one just played where it has others. */
141
+ loop(kind, last, random = Math.random) {
142
+ const all = this.loops(kind);
143
+ const others = all.filter(clip => clip !== last);
144
+ const from = others.length ? others : all;
145
+ return from[Math.floor(random() * from.length) % from.length];
146
+ }
147
+ /**
148
+ * The clip that begins at a second of a reading, after `last`: the move of a sentence heard since the clip before
149
+ * began, each sentence once (`used`), the user's own first, else the latest; else another clip of speaking. A clip
150
+ * plays whole (the mouth is drawn for its frames ahead), so a sentence said in its middle shows at its end.
151
+ */
152
+ at(reading, seconds, last, used) {
153
+ var _a;
154
+ const piece = reading === null || reading === void 0 ? void 0 : reading.pieceAt(seconds);
155
+ let chosen;
156
+ for (let k = piece !== null && piece !== void 0 ? piece : -1; k >= 0 && !used.has(k); k--) {
157
+ used.add(k);
158
+ const move = this.said(reading === null || reading === void 0 ? void 0 : reading.pieces[k]);
159
+ if (move && (!chosen || (move.own && !chosen.own))) {
160
+ chosen = move;
161
+ }
162
+ }
163
+ return (_a = chosen === null || chosen === void 0 ? void 0 : chosen.clip) !== null && _a !== void 0 ? _a : this.loop('speaking', last);
164
+ }
165
+ /** A clip could not play: true when it was the user's, which then gives way to Ta's own. */
166
+ fail(clip, reason) {
167
+ if (!clip.startsWith('own:') || this.broken.has(clip)) {
168
+ return false;
169
+ }
170
+ this.broken.set(clip, reason);
171
+ return true;
172
+ }
173
+ /** The moves of the user's Ta is told of (TaCallScene.moves), beside her own (TaCallMoves). */
174
+ told() {
175
+ return this.moves()
176
+ .filter(move => move.own && move.told.length)
177
+ .map(move => ({ name: move.name, ...(move.when === 'after' ? { after: true } : {}), words: move.told }));
178
+ }
179
+ }
180
+ //# sourceMappingURL=face-moves.js.map
@@ -0,0 +1,139 @@
1
+ /** The parts of a layer of video the stage uses (HTMLVideoElement), so that a check can play it without a browser. */
2
+ export interface StageVideo {
3
+ src: string;
4
+ currentTime: number;
5
+ playbackRate: number;
6
+ readonly paused: boolean;
7
+ readonly readyState: number;
8
+ readonly dataset: DOMStringMap;
9
+ readonly style: {
10
+ opacity: string;
11
+ zIndex: string;
12
+ };
13
+ readonly classList: {
14
+ toggle(name: string, on: boolean): unknown;
15
+ };
16
+ play(): Promise<void>;
17
+ pause(): void;
18
+ requestVideoFrameCallback?(callback: () => void): number;
19
+ }
20
+ /** How long a clip fades in over the one before at a seam (both on the seated frame), in ms. */
21
+ export declare const SEAM_MS = 120;
22
+ /** How long it fades in when it cuts into a clip midway: the more her pose differs, the longer, in ms. */
23
+ export declare const BLEND_MS: {
24
+ min: number;
25
+ max: number;
26
+ unknown: number;
27
+ };
28
+ /** A clip asked for: its name, from where, how long it fades in. */
29
+ interface Wanted {
30
+ clip: string;
31
+ at: number;
32
+ ms: number;
33
+ }
34
+ /**
35
+ * The two layers of video of the person of a video call (docs/design/ta-call.md 16), as players switch streams without
36
+ * a black frame: the next clip loads in the layer behind, hidden, and only once its first frame is on the screen
37
+ * (requestVideoFrameCallback) does it come over the one in front, fading in from nothing while that one stays whole
38
+ * under it; then the one under is hidden and paused. So the picture is whole at every moment: no empty layer, no
39
+ * room behind showing through. While a clip fades in, the next waits (the last asked), never taking the layer that
40
+ * shows. A clip known to come next is loaded and decoded ahead in the layer behind (prime).
41
+ */
42
+ export declare class FaceStage {
43
+ protected readonly videos: StageVideo[];
44
+ /** The URL a clip plays from. */
45
+ protected readonly urlOf: (clip: string) => string;
46
+ /** Now, in ms. */
47
+ protected readonly now: () => number;
48
+ protected readonly events: {
49
+ /** A clip is whole in front. */
50
+ shown?(clip: string): void;
51
+ /** A clip could not play. */
52
+ failed?(clip: string, error: unknown): void;
53
+ };
54
+ /** The layer in front, whole. */
55
+ protected front: number;
56
+ /** The clip each layer plays, by name (what the cameras frame). */
57
+ readonly names: (string | undefined)[];
58
+ /** The layer behind loading a clip, hidden until its first frame shows. */
59
+ protected loading?: Wanted & {
60
+ index: number;
61
+ token: number;
62
+ };
63
+ /** The layer behind fading in over the one in front. */
64
+ protected coming?: Wanted & {
65
+ index: number;
66
+ since: number;
67
+ };
68
+ /** The clip asked for while one faded in: it comes next. */
69
+ protected pending?: Wanted;
70
+ /** The clip loaded ahead in the layer behind. */
71
+ protected primed?: {
72
+ index: number;
73
+ clip: string;
74
+ at: number;
75
+ };
76
+ protected token: number;
77
+ protected closed: boolean;
78
+ constructor(videos: StageVideo[],
79
+ /** The URL a clip plays from. */
80
+ urlOf: (clip: string) => string,
81
+ /** Now, in ms. */
82
+ now: () => number, events?: {
83
+ /** A clip is whole in front. */
84
+ shown?(clip: string): void;
85
+ /** A clip could not play. */
86
+ failed?(clip: string, error: unknown): void;
87
+ });
88
+ /** The clip that shows, or comes to: the last asked for. */
89
+ get wanted(): string | undefined;
90
+ /** The layer that plays the clip on top, fading in or whole, with its clip. */
91
+ playing(): {
92
+ video: StageVideo;
93
+ clip: string | undefined;
94
+ };
95
+ /** While a clip fades in: the layer under it, and how much of the one on top shows (0 to 1). */
96
+ under(): {
97
+ video: StageVideo;
98
+ alpha: number;
99
+ } | undefined;
100
+ /**
101
+ * Plays `clip` from `at` seconds, fading in over `ms` once its first frame shows; `again`: though it is the clip
102
+ * that shows (another moment of it, as she hurries back to where she sits down).
103
+ */
104
+ show(clip: string, at?: number, ms?: number, again?: boolean): void;
105
+ /** Whether a clip loads or fades in: one asked for is on its way. */
106
+ busy(): boolean;
107
+ /** Whether the clip asked for last comes from `at` seconds (a show `again` on its way). */
108
+ jumping(at: number): boolean;
109
+ /** Loads `clip` ahead in the layer behind, decoded at `at`, so that it shows at once when asked for. */
110
+ prime(clip: string, at?: number): void;
111
+ /** Each frame of the screen: the clip fading in shows a little more; done, the one under goes. */
112
+ frame(): void;
113
+ close(): void;
114
+ protected load(wanted: Wanted): void;
115
+ /** Its first frame is on the screen (or it is late): the clip comes in. */
116
+ protected firstFrame(video: StageVideo, token: number): void;
117
+ protected come(token: number): void;
118
+ protected progress(coming: {
119
+ since: number;
120
+ ms: number;
121
+ }): number;
122
+ /** Smooth at both ends: the clip on top comes in without a step. */
123
+ static ease(part: number): number;
124
+ /** A layer whole in front (0), fading in over it (1), or hidden behind (-1). */
125
+ protected static layer(video: StageVideo, place: -1 | 0 | 1): void;
126
+ }
127
+ /** Where her face is in a frame (x1, y1, x2, y2); undefined where it is not known. */
128
+ type FaceBox = readonly number[] | undefined;
129
+ /**
130
+ * How long a clip fades in over another, by how far apart her pose is in the two frames (docs/design/ta-call.md 16):
131
+ * all clips begin and end on the same seated frame, so at a seam the fade only hides the step of decoding; cutting in
132
+ * midway, the farther her face moved, the slower it fades, so that the two poses blend rather than jump.
133
+ */
134
+ export declare namespace FaceBlend {
135
+ function ms(from: FaceBox, to: FaceBox, seam: boolean): number;
136
+ /** Whether a frame is on the seated frame every clip begins and ends on: its first or last few. */
137
+ function seated(frame: number, frames: number): boolean;
138
+ }
139
+ export {};