@k2b/ui 0.29.0 → 0.31.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 (243) hide show
  1. package/README.md +2 -2
  2. package/dist/base.css +2 -2
  3. package/dist/browser/actions/Dropdown.js +6 -3
  4. package/dist/browser/actions/Dropdown.js.map +1 -1
  5. package/dist/browser/actions/FilterChip.js +137 -7
  6. package/dist/browser/actions/FilterChip.js.map +1 -1
  7. package/dist/browser/actions/SegmentedControl.js +5 -9
  8. package/dist/browser/actions/SegmentedControl.js.map +1 -1
  9. package/dist/browser/actions/SpotlightSearch.js +6 -3
  10. package/dist/browser/actions/SpotlightSearch.js.map +1 -1
  11. package/dist/browser/actions/Tabs.js +5 -2
  12. package/dist/browser/actions/Tabs.js.map +1 -1
  13. package/dist/browser/actions/Toolbar.js +2 -0
  14. package/dist/browser/actions/Toolbar.js.map +1 -1
  15. package/dist/browser/actions/ViewTabs.js +294 -0
  16. package/dist/browser/actions/ViewTabs.js.map +1 -0
  17. package/dist/browser/actions/filter-messages.js +6 -2
  18. package/dist/browser/actions/filter-messages.js.map +1 -1
  19. package/dist/browser/actions/index.js +2 -1
  20. package/dist/browser/actions/index.js.map +1 -1
  21. package/dist/browser/chat/ChatComposer.js +1108 -604
  22. package/dist/browser/chat/ChatComposer.js.map +1 -1
  23. package/dist/browser/chat/ChatDecision.js +146 -84
  24. package/dist/browser/chat/ChatDecision.js.map +1 -1
  25. package/dist/browser/chat/ChatPrimitives.js +292 -159
  26. package/dist/browser/chat/ChatPrimitives.js.map +1 -1
  27. package/dist/browser/chat/chat-messages.js +8 -0
  28. package/dist/browser/chat/chat-messages.js.map +1 -1
  29. package/dist/browser/chat/command-search.js +26 -15
  30. package/dist/browser/chat/command-search.js.map +1 -1
  31. package/dist/browser/chat/index.js +4 -2
  32. package/dist/browser/chat/index.js.map +1 -1
  33. package/dist/browser/content/Calendar.js +143 -116
  34. package/dist/browser/content/Calendar.js.map +1 -1
  35. package/dist/browser/content/CalendarWeekView.js +291 -266
  36. package/dist/browser/content/CalendarWeekView.js.map +1 -1
  37. package/dist/browser/content/DataTable.js +224 -155
  38. package/dist/browser/content/DataTable.js.map +1 -1
  39. package/dist/browser/content/MapAttribution.js +27 -0
  40. package/dist/browser/content/MapAttribution.js.map +1 -0
  41. package/dist/browser/content/MapView.js +553 -0
  42. package/dist/browser/content/MapView.js.map +1 -0
  43. package/dist/browser/content/MapViewFrame.js +395 -0
  44. package/dist/browser/content/MapViewFrame.js.map +1 -0
  45. package/dist/browser/content/data-table-messages.js +4 -2
  46. package/dist/browser/content/data-table-messages.js.map +1 -1
  47. package/dist/browser/content/index.js +5 -0
  48. package/dist/browser/content/index.js.map +1 -1
  49. package/dist/browser/content/map-palette.js +39 -0
  50. package/dist/browser/content/map-palette.js.map +1 -0
  51. package/dist/browser/content/map-style.js +276 -0
  52. package/dist/browser/content/map-style.js.map +1 -0
  53. package/dist/browser/content/map-view-geometry.js +269 -0
  54. package/dist/browser/content/map-view-geometry.js.map +1 -0
  55. package/dist/browser/content/map-view-live.js +28 -0
  56. package/dist/browser/content/map-view-live.js.map +1 -0
  57. package/dist/browser/content/map-view-messages.js +53 -0
  58. package/dist/browser/content/map-view-messages.js.map +1 -0
  59. package/dist/browser/content/map-view-types.js +2 -0
  60. package/dist/browser/content/map-view-types.js.map +1 -0
  61. package/dist/browser/content/map-view-worker.js +10 -0
  62. package/dist/browser/feedback/MovedHint.js +197 -0
  63. package/dist/browser/feedback/MovedHint.js.map +1 -0
  64. package/dist/browser/feedback/dialog-core.js +85 -9
  65. package/dist/browser/feedback/dialog-core.js.map +1 -1
  66. package/dist/browser/feedback/index.js +1 -0
  67. package/dist/browser/feedback/index.js.map +1 -1
  68. package/dist/browser/feedback/prompts.js +6 -1
  69. package/dist/browser/feedback/prompts.js.map +1 -1
  70. package/dist/browser/inputs/DatePicker.js +337 -212
  71. package/dist/browser/inputs/DatePicker.js.map +1 -1
  72. package/dist/browser/inputs/date-picker.js +59 -5
  73. package/dist/browser/inputs/date-picker.js.map +1 -1
  74. package/dist/browser/intl/messages.js +12 -0
  75. package/dist/browser/intl/messages.js.map +1 -1
  76. package/dist/browser/intl/weekend.js +39 -0
  77. package/dist/browser/intl/weekend.js.map +1 -0
  78. package/dist/browser/layout/AppOverview.js +0 -1
  79. package/dist/browser/layout/AppOverview.js.map +1 -1
  80. package/dist/browser/layout/AppWorkspace.js +701 -476
  81. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  82. package/dist/browser/layout/PageTitle.js +3 -2
  83. package/dist/browser/layout/PageTitle.js.map +1 -1
  84. package/dist/browser/layout/SettingsModal.js +2 -2
  85. package/dist/browser/layout/SettingsModal.js.map +1 -1
  86. package/dist/browser/layout/SidebarSwitcher.js +13 -12
  87. package/dist/browser/layout/SidebarSwitcher.js.map +1 -1
  88. package/dist/browser/layout/TabBar.js +1 -1
  89. package/dist/browser/layout/TabBar.js.map +1 -1
  90. package/dist/browser/layout/app-host-width.js +44 -0
  91. package/dist/browser/layout/app-host-width.js.map +1 -0
  92. package/dist/browser/layout/app-workspace-controller.js +331 -45
  93. package/dist/browser/layout/app-workspace-controller.js.map +1 -1
  94. package/dist/browser/layout/app-workspace-width.js +26 -0
  95. package/dist/browser/layout/app-workspace-width.js.map +1 -0
  96. package/dist/browser/layout/index.js +2 -1
  97. package/dist/browser/layout/index.js.map +1 -1
  98. package/dist/browser/surfaces/Placeholder.js +36 -13
  99. package/dist/browser/surfaces/Placeholder.js.map +1 -1
  100. package/dist/licenses/maplibre-gl.txt +116 -0
  101. package/dist/ssr/actions/Dropdown.js +5 -2
  102. package/dist/ssr/actions/Dropdown.js.map +1 -1
  103. package/dist/ssr/actions/FilterChip.js +59 -7
  104. package/dist/ssr/actions/FilterChip.js.map +1 -1
  105. package/dist/ssr/actions/SegmentedControl.js +1 -2
  106. package/dist/ssr/actions/SegmentedControl.js.map +1 -1
  107. package/dist/ssr/actions/SpotlightSearch.js +2 -2
  108. package/dist/ssr/actions/SpotlightSearch.js.map +1 -1
  109. package/dist/ssr/actions/Tabs.js +2 -2
  110. package/dist/ssr/actions/Tabs.js.map +1 -1
  111. package/dist/ssr/actions/Toolbar.js +2 -0
  112. package/dist/ssr/actions/Toolbar.js.map +1 -1
  113. package/dist/ssr/actions/ViewTabs.js +211 -0
  114. package/dist/ssr/actions/ViewTabs.js.map +1 -0
  115. package/dist/ssr/actions/filter-messages.js +6 -2
  116. package/dist/ssr/actions/filter-messages.js.map +1 -1
  117. package/dist/ssr/actions/index.js +2 -1
  118. package/dist/ssr/actions/index.js.map +1 -1
  119. package/dist/ssr/chat/ChatComposer.js +546 -131
  120. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  121. package/dist/ssr/chat/ChatDecision.js +44 -19
  122. package/dist/ssr/chat/ChatDecision.js.map +1 -1
  123. package/dist/ssr/chat/ChatPrimitives.js +95 -24
  124. package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
  125. package/dist/ssr/chat/chat-messages.js +8 -0
  126. package/dist/ssr/chat/chat-messages.js.map +1 -1
  127. package/dist/ssr/chat/command-search.js +26 -15
  128. package/dist/ssr/chat/command-search.js.map +1 -1
  129. package/dist/ssr/chat/index.js +4 -2
  130. package/dist/ssr/chat/index.js.map +1 -1
  131. package/dist/ssr/content/Calendar.js +109 -100
  132. package/dist/ssr/content/Calendar.js.map +1 -1
  133. package/dist/ssr/content/CalendarWeekView.js +42 -28
  134. package/dist/ssr/content/CalendarWeekView.js.map +1 -1
  135. package/dist/ssr/content/DataTable.js +78 -31
  136. package/dist/ssr/content/DataTable.js.map +1 -1
  137. package/dist/ssr/content/MapAttribution.js +19 -0
  138. package/dist/ssr/content/MapAttribution.js.map +1 -0
  139. package/dist/ssr/content/MapView.js +474 -0
  140. package/dist/ssr/content/MapView.js.map +1 -0
  141. package/dist/ssr/content/MapViewFrame.js +193 -0
  142. package/dist/ssr/content/MapViewFrame.js.map +1 -0
  143. package/dist/ssr/content/data-table-messages.js +4 -2
  144. package/dist/ssr/content/data-table-messages.js.map +1 -1
  145. package/dist/ssr/content/index.js +5 -0
  146. package/dist/ssr/content/index.js.map +1 -1
  147. package/dist/ssr/content/map-palette.js +39 -0
  148. package/dist/ssr/content/map-palette.js.map +1 -0
  149. package/dist/ssr/content/map-style.js +276 -0
  150. package/dist/ssr/content/map-style.js.map +1 -0
  151. package/dist/ssr/content/map-view-geometry.js +269 -0
  152. package/dist/ssr/content/map-view-geometry.js.map +1 -0
  153. package/dist/ssr/content/map-view-live.js +1 -0
  154. package/dist/ssr/content/map-view-messages.js +53 -0
  155. package/dist/ssr/content/map-view-messages.js.map +1 -0
  156. package/dist/ssr/content/map-view-types.js +2 -0
  157. package/dist/ssr/content/map-view-types.js.map +1 -0
  158. package/dist/ssr/feedback/MovedHint.js +166 -0
  159. package/dist/ssr/feedback/MovedHint.js.map +1 -0
  160. package/dist/ssr/feedback/dialog-core.js +85 -9
  161. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  162. package/dist/ssr/feedback/index.js +1 -0
  163. package/dist/ssr/feedback/index.js.map +1 -1
  164. package/dist/ssr/feedback/prompts.js +6 -1
  165. package/dist/ssr/feedback/prompts.js.map +1 -1
  166. package/dist/ssr/inputs/DatePicker.js +138 -69
  167. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  168. package/dist/ssr/inputs/date-picker.js +59 -5
  169. package/dist/ssr/inputs/date-picker.js.map +1 -1
  170. package/dist/ssr/intl/messages.js +12 -0
  171. package/dist/ssr/intl/messages.js.map +1 -1
  172. package/dist/ssr/intl/weekend.js +39 -0
  173. package/dist/ssr/intl/weekend.js.map +1 -0
  174. package/dist/ssr/layout/AppOverview.js +0 -1
  175. package/dist/ssr/layout/AppOverview.js.map +1 -1
  176. package/dist/ssr/layout/AppWorkspace.js +216 -44
  177. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  178. package/dist/ssr/layout/PageTitle.js +3 -2
  179. package/dist/ssr/layout/PageTitle.js.map +1 -1
  180. package/dist/ssr/layout/SettingsModal.js +2 -2
  181. package/dist/ssr/layout/SettingsModal.js.map +1 -1
  182. package/dist/ssr/layout/SidebarSwitcher.js +13 -12
  183. package/dist/ssr/layout/SidebarSwitcher.js.map +1 -1
  184. package/dist/ssr/layout/TabBar.js +1 -1
  185. package/dist/ssr/layout/TabBar.js.map +1 -1
  186. package/dist/ssr/layout/app-host-width.js +44 -0
  187. package/dist/ssr/layout/app-host-width.js.map +1 -0
  188. package/dist/ssr/layout/app-workspace-controller.js +331 -45
  189. package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
  190. package/dist/ssr/layout/app-workspace-width.js +26 -0
  191. package/dist/ssr/layout/app-workspace-width.js.map +1 -0
  192. package/dist/ssr/layout/index.js +2 -1
  193. package/dist/ssr/layout/index.js.map +1 -1
  194. package/dist/ssr/surfaces/Placeholder.js +24 -7
  195. package/dist/ssr/surfaces/Placeholder.js.map +1 -1
  196. package/dist/styles.css +1 -1
  197. package/dist/types/actions/Dropdown.d.ts +4 -0
  198. package/dist/types/actions/FilterChip.d.ts +22 -0
  199. package/dist/types/actions/ViewTabs.d.ts +30 -0
  200. package/dist/types/actions/filter-messages.d.ts +2 -0
  201. package/dist/types/actions/index.d.ts +4 -2
  202. package/dist/types/chat/ChatComposer.d.ts +52 -0
  203. package/dist/types/chat/ChatDecision.d.ts +18 -2
  204. package/dist/types/chat/ChatPrimitives.d.ts +10 -0
  205. package/dist/types/chat/chat-messages.d.ts +4 -0
  206. package/dist/types/chat/command-search.d.ts +2 -0
  207. package/dist/types/chat/index.d.ts +9 -8
  208. package/dist/types/content/DataTable.d.ts +3 -0
  209. package/dist/types/content/MapAttribution.d.ts +6 -0
  210. package/dist/types/content/MapView.d.ts +5 -0
  211. package/dist/types/content/MapViewFrame.d.ts +31 -0
  212. package/dist/types/content/data-table-messages.d.ts +1 -0
  213. package/dist/types/content/index.d.ts +6 -0
  214. package/dist/types/content/map-palette.d.ts +58 -0
  215. package/dist/types/content/map-style.d.ts +29 -0
  216. package/dist/types/content/map-view-geometry.d.ts +55 -0
  217. package/dist/types/content/map-view-live.d.ts +2 -0
  218. package/dist/types/content/map-view-messages.d.ts +21 -0
  219. package/dist/types/content/map-view-types.d.ts +61 -0
  220. package/dist/types/feedback/MovedHint.d.ts +25 -0
  221. package/dist/types/feedback/dialog-core.d.ts +6 -2
  222. package/dist/types/feedback/index.d.ts +2 -0
  223. package/dist/types/feedback/prompts.d.ts +2 -0
  224. package/dist/types/inputs/DatePicker.d.ts +7 -0
  225. package/dist/types/inputs/date-picker.d.ts +25 -1
  226. package/dist/types/intl/messages.d.ts +6 -0
  227. package/dist/types/intl/weekend.d.ts +12 -0
  228. package/dist/types/layout/AppWorkspace.d.ts +48 -8
  229. package/dist/types/layout/app-host-width.d.ts +6 -0
  230. package/dist/types/layout/app-workspace-width.d.ts +13 -0
  231. package/dist/types/layout/index.d.ts +3 -2
  232. package/dist/types/surfaces/Placeholder.d.ts +2 -1
  233. package/map-glyphs/IBM Plex Sans Medium/0-255.pbf +0 -0
  234. package/map-glyphs/IBM Plex Sans Medium/1024-1279.pbf +0 -0
  235. package/map-glyphs/IBM Plex Sans Medium/256-511.pbf +0 -0
  236. package/map-glyphs/IBM Plex Sans Medium/512-767.pbf +0 -0
  237. package/map-glyphs/IBM Plex Sans Medium/768-1023.pbf +0 -0
  238. package/map-glyphs/IBM Plex Sans Medium/7680-7935.pbf +0 -0
  239. package/map-glyphs/IBM Plex Sans Medium/8192-8447.pbf +0 -0
  240. package/map-glyphs/IBM Plex Sans Medium/8448-8703.pbf +0 -0
  241. package/map-glyphs/IBM Plex Sans Medium/8704-8959.pbf +0 -0
  242. package/map-glyphs/OFL.txt +93 -0
  243. package/package.json +11 -6
@@ -25,41 +25,43 @@ var _tmpl$ = /*#__PURE__*/_$template(`<span><strong>`),
25
25
  _tmpl$0 = /*#__PURE__*/_$template(`<textarea class=k2b-chat-composer__measure rows=1 tabindex=-1 aria-hidden=true readonly>`),
26
26
  _tmpl$1 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__input role=group><!$><!/><textarea rows=1></textarea><!$><!/>`),
27
27
  _tmpl$10 = /*#__PURE__*/_$template(`<span>`),
28
- _tmpl$11 = /*#__PURE__*/_$template(`<small>`),
28
+ _tmpl$11 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__command-detail><small></small><small><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><!$><!/>`),
29
29
  _tmpl$12 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__command-end><i class="ti ti-check"aria-hidden=true></i><span class=k2b-sr-only>`),
30
30
  _tmpl$13 = /*#__PURE__*/_$template(`<button class=k2b-chat-composer__command type=button role=option tabindex=-1><i aria-hidden=true></i><span class=k2b-chat-composer__command-text><strong></strong><!$><!/></span><!$><!/>`),
31
31
  _tmpl$14 = /*#__PURE__*/_$template(`<b>`),
32
- _tmpl$15 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox>`),
33
- _tmpl$16 = /*#__PURE__*/_$template(`<div role=status class=k2b-chat-composer__loading><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><strong>`),
34
- _tmpl$17 = /*#__PURE__*/_$template(`<div role=status><i class="ti ti-alert-circle"></i> <!$><!/>`),
35
- _tmpl$18 = /*#__PURE__*/_$template(`<div role=status>`),
36
- _tmpl$19 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory data-commands><div class=k2b-chat-composer__commands role=listbox><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
37
- _tmpl$20 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-slot><div></div><!$><!/><!$><!/>`),
38
- _tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__hint aria-live=polite>`),
39
- _tmpl$22 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachments role=list tabindex=0>`),
40
- _tmpl$23 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__error role=alert><i class="ti ti-alert-circle"aria-hidden=true></i><!$><!/>`),
41
- _tmpl$24 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__row><!$><!/><!$><!/><div class=k2b-chat-composer__field><!$><!/><div class=k2b-chat-composer__field-tools><!$><!/><!$><!/><!$><!/></div></div><!$><!/>`),
42
- _tmpl$25 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-shell><!$><!/><section role=group><!$><!/><!$><!/><!$><!/><!$><!/></section><div class=k2b-sr-only role=status aria-live=polite></div><div class=k2b-chat-composer__status role=status><!$><!/><!$><!/>`),
43
- _tmpl$26 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><span class=k2b-chat-composer__emoji-glyph aria-hidden=true></span><strong></strong><!$><!/>`),
44
- _tmpl$27 = /*#__PURE__*/_$template(`<small>:<!$><!/>:`),
45
- _tmpl$28 = /*#__PURE__*/_$template(`<i class="ti ti-loader-2 k2b-spin"aria-hidden=true>`),
46
- _tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-placeholder aria-hidden=true><span></span><span><span></span><span>`),
47
- _tmpl$30 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-group role=group><div class=k2b-chat-composer__command-heading role=presentation><span></span><!$><!/></div><!$><!/><!$><!/>`),
48
- _tmpl$31 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__hint-text>`),
49
- _tmpl$32 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__dictation><i aria-hidden=true></i><span>`),
50
- _tmpl$33 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__hint-action>`),
51
- _tmpl$34 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-remove><i class="ti ti-x"aria-hidden=true>`),
52
- _tmpl$35 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment role=listitem><div class=k2b-chat-composer__attachment-content><!$><!/><!$><!/></div><!$><!/>`),
53
- _tmpl$36 = /*#__PURE__*/_$template(`<img>`),
54
- _tmpl$37 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment-identity><!$><!/><!$><!/>`),
55
- _tmpl$38 = /*#__PURE__*/_$template(`<a class=k2b-chat-composer__attachment-link target=_blank rel="noopener noreferrer"><!$><!/><!$><!/>`),
56
- _tmpl$39 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-action><!$><!/><!$><!/>`),
57
- _tmpl$40 = /*#__PURE__*/_$template(`<footer class=k2b-chat-composer__footer>`),
58
- _tmpl$41 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__tools><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
59
- _tmpl$42 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__submit><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
60
- _tmpl$43 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__status-line><i aria-hidden=true></i><span>`),
61
- _tmpl$44 = /*#__PURE__*/_$template(`<span class=k2b-sr-only>`);
62
- import { batch, children, createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, onMount, Show, untrack } from "solid-js";
32
+ _tmpl$15 = /*#__PURE__*/_$template(`<small>`),
33
+ _tmpl$16 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox>`),
34
+ _tmpl$17 = /*#__PURE__*/_$template(`<label class=k2b-chat-composer__command-search><i class="ti ti-search"aria-hidden=true></i><input type=text role=combobox aria-autocomplete=list aria-expanded=true autocomplete=off autocapitalize=off>`),
35
+ _tmpl$18 = /*#__PURE__*/_$template(`<div role=status class=k2b-chat-composer__loading><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><strong>`),
36
+ _tmpl$19 = /*#__PURE__*/_$template(`<div role=status><i class="ti ti-alert-circle"></i> <!$><!/>`),
37
+ _tmpl$20 = /*#__PURE__*/_$template(`<div role=status>`),
38
+ _tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory data-commands><!$><!/><div class=k2b-chat-composer__commands role=listbox><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
39
+ _tmpl$22 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-slot><div></div><!$><!/><!$><!/>`),
40
+ _tmpl$23 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__hint aria-live=polite>`),
41
+ _tmpl$24 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachments role=list tabindex=0>`),
42
+ _tmpl$25 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__error role=alert><i class="ti ti-alert-circle"aria-hidden=true></i><!$><!/>`),
43
+ _tmpl$26 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__row><!$><!/><!$><!/><div class=k2b-chat-composer__field><!$><!/><div class=k2b-chat-composer__field-tools><!$><!/><!$><!/><!$><!/></div></div><!$><!/>`),
44
+ _tmpl$27 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-shell><!$><!/><section role=group><!$><!/><!$><!/><!$><!/><!$><!/></section><div class=k2b-sr-only role=status aria-live=polite></div><div class=k2b-chat-composer__status role=status><!$><!/><!$><!/>`),
45
+ _tmpl$28 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><span class=k2b-chat-composer__emoji-glyph aria-hidden=true></span><strong></strong><!$><!/>`),
46
+ _tmpl$29 = /*#__PURE__*/_$template(`<small>:<!$><!/>:`),
47
+ _tmpl$30 = /*#__PURE__*/_$template(`<i class="ti ti-loader-2 k2b-spin"aria-hidden=true>`),
48
+ _tmpl$31 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-group role=group><div class=k2b-chat-composer__command-heading role=presentation><span></span><!$><!/></div><!$><!/><!$><!/>`),
49
+ _tmpl$32 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-placeholder aria-hidden=true><span></span><span><span></span><span>`),
50
+ _tmpl$33 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__hint-text>`),
51
+ _tmpl$34 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__dictation><i aria-hidden=true></i><span>`),
52
+ _tmpl$35 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__hint-action>`),
53
+ _tmpl$36 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-remove><i class="ti ti-x"aria-hidden=true>`),
54
+ _tmpl$37 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment role=listitem><div class=k2b-chat-composer__attachment-content><!$><!/><!$><!/></div><!$><!/>`),
55
+ _tmpl$38 = /*#__PURE__*/_$template(`<img>`),
56
+ _tmpl$39 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment-identity><!$><!/><!$><!/>`),
57
+ _tmpl$40 = /*#__PURE__*/_$template(`<a class=k2b-chat-composer__attachment-link target=_blank rel="noopener noreferrer"><!$><!/><!$><!/>`),
58
+ _tmpl$41 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-action><!$><!/><!$><!/>`),
59
+ _tmpl$42 = /*#__PURE__*/_$template(`<footer class=k2b-chat-composer__footer>`),
60
+ _tmpl$43 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__tools><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
61
+ _tmpl$44 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__submit><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
62
+ _tmpl$45 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__status-line><i aria-hidden=true></i><span>`),
63
+ _tmpl$46 = /*#__PURE__*/_$template(`<span class=k2b-sr-only>`);
64
+ import { batch, children, createEffect, createMemo, createSignal, createUniqueId, For, Index, on, onCleanup, onMount, Show, untrack } from "solid-js";
63
65
  import { Dropdown } from "../actions/Dropdown";
64
66
  import { dialogHistorySettled, holdDialogHistory } from "../feedback/dialog-core";
65
67
  import { Tooltip } from "../feedback/Tooltip";
@@ -90,6 +92,13 @@ const composerUndoBudgetChars = 1_000_000;
90
92
  * dialog: `mention` takes the token's place exactly as a `mention` row does, and Ctrl/⌘+Z brings the token back.
91
93
  */
92
94
 
95
+ /** The draft as a successful `open` leaves it: without the `/…` token, with its references moved along. Save this one. */
96
+
97
+ /**
98
+ * How an `open` row ends: on success (`void`) the token leaves as for an action; `"cancelled"` changes nothing; `failed`
99
+ * keeps the list open and the draft unchanged, and its text replaces the row's description until the row runs again.
100
+ */
101
+
93
102
  /** A fixed place in the slash list. Sections keep the given order, also while searching. */
94
103
 
95
104
  /** First-word narrowing; Tab writes `words[0]` followed by a space. */
@@ -178,6 +187,17 @@ export function ChatComposer(props) {
178
187
  return `${commandListId}-c${commandIds.get(key)}`;
179
188
  };
180
189
  const [closedAt, setClosedAt] = createSignal();
190
+ /** The list opened from "+": the field's selection when "+" was pressed, and the search field's text. */
191
+ const [addSearch, setAddSearch] = createSignal();
192
+ const [addQuery, setAddQuery] = createSignal("");
193
+ let addSearchRef;
194
+ let addButtonRef;
195
+ let addComposing = false;
196
+ /** The `open` row running now, and why `open` rows failed in this opening, by row key. */
197
+ const [openingRow, setOpeningRow] = createSignal();
198
+ const [openFailures, setOpenFailures] = createSignal({});
199
+ /** Cancels the `open` row running now; `key` follows announced draft moves, `label` is its busy line. */
200
+ let openingRun;
181
201
  // Where the pending native edit starts; a selection replaced as a whole starts at its beginning.
182
202
  let inputStart;
183
203
  let inputEnd;
@@ -282,7 +302,17 @@ export function ChatComposer(props) {
282
302
  return token && index ? suggestEmoji(index, token.query, emojiSuggestionLimit) : [];
283
303
  });
284
304
  const emojiOpen = () => emojiMatches().length > 0;
285
- const caretCommandToken = createMemo(() => chatCommandQuery(props.value, caret(), selectionEnd()));
305
+ // From "+", the search field's text is the query of an empty token at the field's stored caret.
306
+ const caretCommandToken = createMemo(() => {
307
+ const search = addSearch();
308
+ if (!search) return chatCommandQuery(props.value, caret(), selectionEnd());
309
+ const at = Math.min(search.end, props.value.length);
310
+ return {
311
+ start: at,
312
+ end: at,
313
+ query: addQuery()
314
+ };
315
+ });
286
316
  const caretCommandStart = createMemo(() => caretCommandToken()?.start);
287
317
  // Retained server rows belong to one `/`: they go when it does or when another `/` starts.
288
318
  createEffect(() => {
@@ -297,6 +327,7 @@ export function ChatComposer(props) {
297
327
  });
298
328
  const commandQuery = createMemo(() => {
299
329
  const token = caretCommandToken();
330
+ if (addSearch()) return token;
300
331
  return dismissed() || composing() || token?.start === closedAt() ? null : token;
301
332
  });
302
333
  const openingStart = createMemo(() => commandQuery()?.start);
@@ -305,6 +336,12 @@ export function ChatComposer(props) {
305
336
  const start = openingStart();
306
337
  if (start !== undefined) setCommandOpening(opening => opening + 1);
307
338
  });
339
+ // A failed `open` row says so for the rest of its list opening.
340
+ createEffect(() => {
341
+ props.draftKey;
342
+ commandOpening();
343
+ setOpenFailures({});
344
+ });
308
345
  const parsedCommandQuery = createMemo(() => parseChatCommandQuery(commandQuery()?.query ?? "", props.commandScopes ?? []));
309
346
  const commandFallbackRow = createMemo(() => {
310
347
  const parsed = parsedCommandQuery();
@@ -320,7 +357,23 @@ export function ChatComposer(props) {
320
357
  setSearchResults([]);
321
358
  setSearchResultsQuery(undefined);
322
359
  });
323
- const localCommands = createMemo(() => props.commands ?? []);
360
+ // Rows of a `fixedWhileOpen` section are the ones it had when this `/` opened the list; later ones wait for the next
361
+ // `/`. A retry row starts another opening in the same open list, so it does not count.
362
+ const fixedCommandKeys = createMemo(() => {
363
+ props.draftKey;
364
+ if (openingStart() === undefined) return undefined;
365
+ return untrack(() => {
366
+ const fixed = new Set((props.commandSections ?? []).filter(section => section.fixedWhileOpen).map(section => section.id));
367
+ return fixed.size ? new Set((props.commands ?? []).filter(command => fixed.has(command.section ?? "")).map(chatCommandKey)) : undefined;
368
+ });
369
+ });
370
+ const localCommands = createMemo(() => {
371
+ const commands = props.commands ?? [];
372
+ const keys = fixedCommandKeys();
373
+ if (!keys) return commands;
374
+ const fixed = new Set((props.commandSections ?? []).filter(section => section.fixedWhileOpen).map(section => section.id));
375
+ return commands.filter(command => !fixed.has(command.section ?? "") || keys.has(chatCommandKey(command)));
376
+ });
324
377
  const commandModel = createMemo(() => chatCommandListModel({
325
378
  query: commandQuery()?.query ?? "",
326
379
  scopes: props.commandScopes,
@@ -344,12 +397,86 @@ export function ChatComposer(props) {
344
397
  setCommandMoved(false);
345
398
  });
346
399
  const commandsOpen = () => Boolean(!emojiOpen() && commandQuery() && (localCommands().length || props.searchCommands || commandFallbackRow()));
347
- const commandSheetHeld = createMemo(() => commandsOpen() && isTouchOnly());
400
+ // Rows that arrive for a pending section never move a visible row of the overview: until the person types, the list
401
+ // keeps the height it had with its placeholders and scrolls what does not fit. A list below its maximum height grows
402
+ // upward from the field, so a change of height alone would move its first row. While searching, the rows arrive
403
+ // with the search's own answer, which changes the list anyway.
404
+ // From "+", the whole panel keeps the height it opened with instead.
405
+ const commandsPending = createMemo(() => commandsOpen() && !addSearch() && !parsedCommandQuery().scope && !parsedCommandQuery().query.trim() && commandModel().groups.some(group => group.pendingRows > 0));
406
+ // Typing, another opening or closing the list lets it size itself again.
407
+ const commandListSizeKey = createMemo(() => commandsOpen() ? `${commandOpening()}\u0000${caretCommandToken()?.query}` : undefined);
408
+ // The list's height with its placeholders, for the size key it was measured under.
409
+ let pendingList;
410
+ createEffect(() => {
411
+ const list = commandListRef;
412
+ if (!commandsPending() || !list || typeof ResizeObserver === "undefined") return;
413
+ const measure = () => {
414
+ pendingList = {
415
+ height: list.getBoundingClientRect().height,
416
+ key: untrack(commandListSizeKey)
417
+ };
418
+ };
419
+ measure();
420
+ const observer = new ResizeObserver(measure);
421
+ observer.observe(list);
422
+ onCleanup(() => observer.disconnect());
423
+ });
424
+ createEffect(on(commandsPending, (pending, wasPending) => {
425
+ const held = pendingList;
426
+ pendingList = undefined;
427
+ // Only rows arriving hold the list; the person's typing or closing it does not.
428
+ if (pending || !wasPending || !held || held.key !== commandListSizeKey() || !commandListRef?.isConnected) return;
429
+ commandListRef.style.height = `${held.height}px`;
430
+ commandListRef.setAttribute("data-held", "");
431
+ }));
432
+ createEffect(on(commandListSizeKey, () => {
433
+ commandListRef?.style.removeProperty("height");
434
+ commandListRef?.removeAttribute("data-held");
435
+ }, {
436
+ defer: true
437
+ }));
438
+ // Escape, a press outside, or moving the caret away closes the list; while an `open` row runs, that cancels it, so
439
+ // nothing opens after the person backed out. Success ends the opening and closes the list in one step. A new draft
440
+ // cancels too, unless the opener announced that next move with `follow()`: its busy line moves to the status line,
441
+ // and Escape still cancels there. Any later unannounced draft change cancels.
442
+ createEffect(() => {
443
+ const draftKey = props.draftKey;
444
+ const open = commandsOpen();
445
+ const row = openingRow();
446
+ const run = openingRun;
447
+ if (!run || row === undefined) return;
448
+ if (draftKey !== run.key) {
449
+ if (run.follow) {
450
+ run.follow = false;
451
+ run.key = draftKey;
452
+ run.moved = true;
453
+ showCommandStatus({
454
+ tone: "busy",
455
+ text: run.label
456
+ });
457
+ } else run.controller.abort();
458
+ return;
459
+ }
460
+ if (!open && !run.moved) run.controller.abort();
461
+ });
462
+ onCleanup(() => openingRun?.controller.abort());
463
+ // An `open` row gives the sheet's Back entry up first, so it never races the navigation it starts.
464
+ const commandSheetHeld = createMemo(() => commandsOpen() && isTouchOnly() && openingRow() === undefined);
348
465
  createEffect(() => {
349
466
  if (!commandSheetHeld()) return;
350
- onCleanup(holdDialogHistory(() => setClosedAt(commandQuery()?.start)));
467
+ onCleanup(holdDialogHistory(() => closeCommandList()));
351
468
  });
352
469
  const suggestionsOpen = () => commandsOpen() || emojiOpen();
470
+ const fieldOwnsList = () => suggestionsOpen() && !addSearch();
471
+ // From "+", the panel keeps the height it opened with while the person types or rows arrive, so neither the search
472
+ // field nor the first row moves; what does not fit scrolls. The space above the field still bounds it.
473
+ const addPanelOpen = createMemo(() => addSearch() !== undefined && commandsOpen());
474
+ createEffect(() => {
475
+ const accessory = addPanelOpen() ? commandListRef?.parentElement : undefined;
476
+ if (!accessory) return;
477
+ const frame = requestAnimationFrame(() => accessory.style.setProperty("--k2b-chat-command-held", `${accessory.getBoundingClientRect().height}px`));
478
+ onCleanup(() => cancelAnimationFrame(frame));
479
+ });
353
480
  createEffect(() => {
354
481
  if (!suggestionsOpen()) return;
355
482
  let disposed = false;
@@ -377,10 +504,13 @@ export function ChatComposer(props) {
377
504
  const left = Math.max(0, column?.left ?? 0);
378
505
  const right = Math.min(page, column?.right ?? page);
379
506
  const slot = accessory.parentElement.getBoundingClientRect();
380
- const bottom = accessory.getBoundingClientRect().bottom;
381
- commandListRef.style.setProperty("--k2b-chat-command-space", `${Math.max(40, bottom - top - 8)}px`);
507
+ // From its place in the slot, not its box: the sheet opened from "+" rises into place, and a box measured during
508
+ // that animation would include its offset.
509
+ const bottom = slot.bottom - (Number.parseFloat(window.getComputedStyle(accessory).bottom) || 0);
510
+ // On the accessory, so a panel opened from "+" is bounded as a whole, with its search field.
511
+ accessory.style.setProperty("--k2b-chat-command-space", `${Math.max(40, bottom - top - 8)}px`);
382
512
  // Only a list that reaches the screen's top edge keeps clear of a notch or the status bar.
383
- commandListRef.style.setProperty("--k2b-chat-command-safe-top", top === viewportTop ? "env(safe-area-inset-top, 0px)" : "0px");
513
+ accessory.style.setProperty("--k2b-chat-command-safe-top", top === viewportTop ? "env(safe-area-inset-top, 0px)" : "0px");
384
514
  accessory.style.setProperty("--k2b-chat-command-reach-left", `${Math.max(0, slot.left - left)}px`);
385
515
  accessory.style.setProperty("--k2b-chat-command-reach-right", `${Math.max(0, right - slot.right)}px`);
386
516
  };
@@ -398,11 +528,29 @@ export function ChatComposer(props) {
398
528
  // A press outside the command list and the field closes the list, as Escape does; the text stays. With a mouse or a
399
529
  // trackpad the press then acts as usual. On a touch-only device a tap outside the composer closes only the list: it
400
530
  // reaches nothing beneath, and the field keeps focus, so the keyboard stays open.
531
+ // A list opened from "+" is a menu: any press outside it closes only the list, with every pointer, and the field gets
532
+ // its focus back. "+" itself toggles with its click; a press in the field closes the list and lands there as usual.
401
533
  createEffect(() => {
402
534
  if (!commandsOpen()) return;
403
535
  const onPointerDown = event => {
404
536
  const target = event.target;
405
- if (!(target instanceof Node) || commandListRef?.contains(target) || textareaRef?.parentElement?.contains(target)) return;
537
+ if (!(target instanceof Node) || commandListRef?.parentElement?.contains(target)) return;
538
+ if (addSearch()) {
539
+ if (addButtonRef?.contains(target) && !addButtonRef.disabled) return;
540
+ if (textareaRef?.parentElement?.contains(target)) {
541
+ // The field takes the focus before the search field goes, so a phone keeps its keyboard; the press itself
542
+ // then places the caret.
543
+ textareaRef.focus({
544
+ preventScroll: true
545
+ });
546
+ endAddSearch(false);
547
+ return;
548
+ }
549
+ swallowTap(event);
550
+ endAddSearch(true);
551
+ return;
552
+ }
553
+ if (textareaRef?.parentElement?.contains(target)) return;
406
554
  setClosedAt(commandQuery()?.start);
407
555
  if (isTouchOnly() && !shellRef?.contains(target)) swallowTap(event);
408
556
  };
@@ -452,9 +600,10 @@ export function ChatComposer(props) {
452
600
  });
453
601
  });
454
602
  let settledEmpty;
603
+ // A space after "Nothing found" ends the `/…` as plain text; a search field opened from "+" just keeps its text.
455
604
  createEffect(() => {
456
605
  const token = commandQuery();
457
- if (!token || parsedCommandQuery().scope || searchError()) {
606
+ if (!token || addSearch() || parsedCommandQuery().scope || searchError()) {
458
607
  settledEmpty = undefined;
459
608
  return;
460
609
  }
@@ -505,6 +654,7 @@ export function ChatComposer(props) {
505
654
  history.length = 0;
506
655
  historyIndex = -1;
507
656
  finishModelSelection(null);
657
+ endAddSearch(false);
508
658
  setDismissed(true);
509
659
  setClosedAt(undefined);
510
660
  setSearchResults([]);
@@ -553,6 +703,8 @@ export function ChatComposer(props) {
553
703
  setDismissed(false);
554
704
  };
555
705
  const restoreHistory = direction => {
706
+ // A field that only stays enabled to keep focus, while an `open` row runs, is not edited by undo either.
707
+ if (editBlocked()) return;
556
708
  record();
557
709
  const next = history[historyIndex + direction];
558
710
  if (!next) return;
@@ -571,6 +723,45 @@ export function ChatComposer(props) {
571
723
  setSelectionEnd(textareaRef?.selectionEnd ?? props.value.length);
572
724
  });
573
725
  };
726
+ /** Closes the list opened from "+"; `refocus` gives the field its focus and the selection it had when "+" was pressed. */
727
+ const endAddSearch = refocus => {
728
+ const search = addSearch();
729
+ if (!search) return;
730
+ addComposing = false;
731
+ batch(() => {
732
+ setAddSearch(undefined);
733
+ setAddQuery("");
734
+ });
735
+ if (!refocus || !textareaRef) return;
736
+ const length = textareaRef.value.length;
737
+ textareaRef.focus();
738
+ textareaRef.setSelectionRange(Math.min(search.start, length), Math.min(search.end, length));
739
+ syncCaret();
740
+ };
741
+ /** Escape, Back, a press outside: the list closes and the text stays. */
742
+ const closeCommandList = (refocus = true) => {
743
+ if (addSearch()) endAddSearch(refocus);else setClosedAt(commandQuery()?.start);
744
+ };
745
+ const toggleAddSearch = () => {
746
+ if (addSearch()) {
747
+ endAddSearch(true);
748
+ return;
749
+ }
750
+ if (blocked() || !textareaRef) return;
751
+ const start = textareaRef.selectionStart;
752
+ const end = textareaRef.selectionEnd;
753
+ batch(() => {
754
+ // Emoji suggestions for a `:shortcode` at the caret give way; they would hold the list closed.
755
+ setDismissed(true);
756
+ setAddQuery("");
757
+ setAddSearch({
758
+ start,
759
+ end
760
+ });
761
+ });
762
+ // Within the press, so a phone opens its keyboard for the search field.
763
+ addSearchRef?.focus();
764
+ };
574
765
  const selectedCommand = createMemo(() => {
575
766
  const rows = commandMatches();
576
767
  return commandMoved() && rows.find(command => chatCommandKey(command) === activeCommandKey()) || rows[0];
@@ -594,6 +785,8 @@ export function ChatComposer(props) {
594
785
  const canSubmit = () => !submitting() && submittable();
595
786
  const canSelectFiles = () => Boolean(props.fileSelection && !props.fileSelection.disabled && !running() && !blocked());
596
787
  const hasAddMenu = () => Boolean(props.fileSelection || props.menuActions?.length);
788
+ /** "+" opens the slash list, as long as there is one; otherwise it stays the add menu. */
789
+ const addOpensCommands = () => Boolean(props.addOpensCommands && (props.commands?.length || props.searchCommands));
597
790
  const hasContextUsage = () => {
598
791
  if (props.contextPopupAction) return true;
599
792
  const context = props.contextUsage;
@@ -736,7 +929,7 @@ export function ChatComposer(props) {
736
929
  * key or click that chose the row, because the device's file dialog needs that activation. Closing the selection
737
930
  * without a file brings the token back, unless the draft changed meanwhile.
738
931
  */
739
- const attachFilesFromCommand = token => {
932
+ const attachFilesFromCommand = (token, selection) => {
740
933
  if (!canSelectFiles()) return;
741
934
  const key = props.draftKey;
742
935
  const previous = snapshot();
@@ -755,7 +948,7 @@ export function ChatComposer(props) {
755
948
  history.splice(0, history.length, ...previousHistory.entries);
756
949
  historyIndex = previousHistory.index;
757
950
  queueMicrotask(() => {
758
- textareaRef?.setSelectionRange(token.end, token.end);
951
+ textareaRef?.setSelectionRange(selection?.start ?? token.end, selection?.end ?? token.end);
759
952
  syncCaret();
760
953
  focus();
761
954
  });
@@ -787,7 +980,7 @@ export function ChatComposer(props) {
787
980
  setSubmitting(true);
788
981
  try {
789
982
  if (isTouchOnly()) {
790
- if (commandSheetHeld()) setClosedAt(commandQuery()?.start);
983
+ if (commandSheetHeld()) closeCommandList(false);
791
984
  // The sheet's Back entry leaves first, so a submit handler that navigates finds the history settled.
792
985
  await dialogHistorySettled();
793
986
  // A draft that another one replaced, or that may no longer go out, is not sent and keeps its text.
@@ -839,6 +1032,10 @@ export function ChatComposer(props) {
839
1032
  const word = scope?.words[0];
840
1033
  const token = commandQuery();
841
1034
  if (!word || !token || !textareaRef) return false;
1035
+ if (addSearch()) {
1036
+ setAddQuery(`${word} `);
1037
+ return true;
1038
+ }
842
1039
  replaceTextareaRange(textareaRef, token.start + 1, token.end, `${word} `);
843
1040
  syncCaret();
844
1041
  return true;
@@ -846,6 +1043,8 @@ export function ChatComposer(props) {
846
1043
  const executeCommand = async (command, tab = false) => {
847
1044
  const token = commandQuery();
848
1045
  const heldHistory = commandSheetHeld();
1046
+ const addSelection = addSearch();
1047
+ const fromAdd = addSelection !== undefined;
849
1048
  if (!token || blocked()) return;
850
1049
  if (command.disabled || command.reason) {
851
1050
  // A new object each time, so choosing the same row again inserts and announces its reason again.
@@ -861,19 +1060,33 @@ export function ChatComposer(props) {
861
1060
  }
862
1061
  if (command.scope && (tab || !command.action && !command.mention && !command.attachFiles) && narrowCommand(command)) return;
863
1062
  if (command.attachFiles) {
864
- attachFilesFromCommand(token);
1063
+ if (!canSelectFiles()) return;
1064
+ // The field has the focus before the selection opens, so closing it without a file comes back there.
1065
+ endAddSearch(true);
1066
+ attachFilesFromCommand(token, addSelection);
865
1067
  return;
866
1068
  }
1069
+ if (command.open) {
1070
+ await openFromCommand(command, command.open, token);
1071
+ return;
1072
+ }
1073
+ // The field has the focus again before an action opens a dialog, so the dialog gives it back there.
1074
+ endAddSearch(true);
1075
+ // From "+" a reference joins the text at the caret, apart from a word right before it.
1076
+ const lead = value => fromAdd && token.start > 0 && !/\s/.test(value[token.start - 1] ?? "") ? " " : "";
867
1077
  const previous = snapshot();
868
1078
  const key = props.draftKey;
869
- const replacement = command.mention ? command.mention.name + " " : "";
1079
+ const replacement = command.mention ? lead(props.value) + command.mention.name + " " : "";
870
1080
  const nextValue = props.value.slice(0, token.start) + replacement + props.value.slice(token.end);
871
1081
  const nextMentions = reconcileChatMentions(props.value, nextValue, mentions());
872
- if (command.mention) nextMentions.push({
873
- start: token.start,
874
- end: token.start + command.mention.name.length,
875
- attachment: command.mention
876
- });
1082
+ if (command.mention) {
1083
+ const start = token.start + lead(props.value).length;
1084
+ nextMentions.push({
1085
+ start,
1086
+ end: start + command.mention.name.length,
1087
+ attachment: command.mention
1088
+ });
1089
+ }
877
1090
  // A cancelled or failed command leaves no undo step behind: restoring puts the history back as well.
878
1091
  const previousHistory = {
879
1092
  entries: [...history],
@@ -923,16 +1136,17 @@ export function ChatComposer(props) {
923
1136
  restore();
924
1137
  restored = false;
925
1138
  const name = result.mention.name;
926
- const withMention = previous.value.slice(0, token.start) + name + " " + previous.value.slice(token.end);
1139
+ const start = token.start + lead(previous.value).length;
1140
+ const withMention = previous.value.slice(0, token.start) + lead(previous.value) + name + " " + previous.value.slice(token.end);
927
1141
  edit(withMention, [...reconcileChatMentions(previous.value, withMention, previous.mentions), {
928
- start: token.start,
929
- end: token.start + name.length,
1142
+ start,
1143
+ end: start + name.length,
930
1144
  attachment: result.mention
931
1145
  }]);
932
1146
  setDismissed(true);
933
1147
  mentioned = {
934
1148
  value: withMention,
935
- caret: token.start + name.length + 1
1149
+ caret: start + name.length + 1
936
1150
  };
937
1151
  showCommandStatus();
938
1152
  } else {
@@ -966,7 +1180,7 @@ export function ChatComposer(props) {
966
1180
  if (props.draftKey !== key) return;
967
1181
  if (restored || props.value === nextValue || mentioned && props.value === mentioned.value) {
968
1182
  const position = restored ? token.end : mentioned?.caret ?? token.start + replacement.length;
969
- textareaRef?.setSelectionRange(position, position);
1183
+ textareaRef?.setSelectionRange(restored && addSelection ? addSelection.start : position, restored && addSelection ? addSelection.end : position);
970
1184
  }
971
1185
  syncCaret();
972
1186
  autoResize();
@@ -974,6 +1188,110 @@ export function ChatComposer(props) {
974
1188
  });
975
1189
  };
976
1190
 
1191
+ /**
1192
+ * Runs an `open` row with the token and the list in place. Success removes the token in one undo step; `failed`
1193
+ * stays in the row while the list is still there, otherwise the status line says it, so it never ends in silence.
1194
+ */
1195
+ const openFromCommand = async (command, open, token) => {
1196
+ const key = props.draftKey;
1197
+ const row = chatCommandKey(command);
1198
+ const value = props.value;
1199
+ const nextValue = value.slice(0, token.start) + value.slice(token.end);
1200
+ const nextMentions = reconcileChatMentions(value, nextValue, mentions());
1201
+ // Still the same draft and `/…`, so the row is where the person chose it.
1202
+ const inPlace = () => !disposed && props.draftKey === key && props.value === value && commandQuery()?.start === token.start;
1203
+ const heldHistory = commandSheetHeld();
1204
+ // Closing the list or leaving the composer cancels the opening; the row ends at once, without waiting for it.
1205
+ const controller = new AbortController();
1206
+ const run = {
1207
+ controller,
1208
+ key,
1209
+ label: command.busyLabel ?? chatMessages().commandOpening,
1210
+ follow: false,
1211
+ moved: false
1212
+ };
1213
+ openingRun = run;
1214
+ const cancelled = new Promise(resolve => controller.signal.addEventListener("abort", () => resolve("cancelled"), {
1215
+ once: true
1216
+ }));
1217
+ setOpenFailures(({
1218
+ [row]: _,
1219
+ ...rest
1220
+ }) => rest);
1221
+ setOpeningRow(row);
1222
+ setExecuting(true);
1223
+ // An opening that ends without leaving, by failure, rejection or cancelling, also aborts `signal`, so the opener
1224
+ // can put back what it saved without the token.
1225
+ const finish = (left = false) => {
1226
+ if (!left) controller.abort();
1227
+ if (openingRun === run) openingRun = undefined;
1228
+ if (commandStatus()?.tone === "busy") showCommandStatus();
1229
+ setOpeningRow(undefined);
1230
+ setExecuting(false);
1231
+ };
1232
+ let result;
1233
+ try {
1234
+ if (heldHistory) {
1235
+ await dialogHistorySettled();
1236
+ if (!inPlace()) {
1237
+ finish();
1238
+ return;
1239
+ }
1240
+ }
1241
+ result = await Promise.race([open({
1242
+ value: nextValue,
1243
+ mentions: nextMentions
1244
+ }, controller.signal, () => {
1245
+ run.follow = true;
1246
+ }), cancelled]);
1247
+ } catch (error) {
1248
+ finish();
1249
+ if (disposed) {
1250
+ props.onError?.(error);
1251
+ return;
1252
+ }
1253
+ if (inPlace()) closeCommandList();
1254
+ showCommandStatus({
1255
+ tone: "error",
1256
+ text: error instanceof Error && error.message ? error.message : chatMessages().commandFailed
1257
+ });
1258
+ return;
1259
+ }
1260
+ if (!result) {
1261
+ // Success: the token leaves and the list closes in the same step that ends the opening, so a phone sheet never
1262
+ // takes its Back entry again while the page navigates.
1263
+ batch(() => {
1264
+ if (!disposed && props.draftKey === key && props.value === value) {
1265
+ edit(nextValue, nextMentions);
1266
+ setDismissed(true);
1267
+ }
1268
+ endAddSearch(!disposed && props.draftKey === key);
1269
+ finish(true);
1270
+ });
1271
+ queueMicrotask(() => {
1272
+ if (disposed || props.draftKey !== key || props.value !== nextValue) return;
1273
+ textareaRef?.setSelectionRange(token.start, token.start);
1274
+ syncCaret();
1275
+ autoResize();
1276
+ });
1277
+ return;
1278
+ }
1279
+ finish();
1280
+ if (result === "cancelled") return;
1281
+ if (inPlace()) {
1282
+ setOpenFailures(failures => ({
1283
+ ...failures,
1284
+ [row]: result.failed
1285
+ }));
1286
+ setAnnouncement({
1287
+ text: result.failed
1288
+ });
1289
+ } else if (disposed) props.onError?.(new Error(result.failed));else showCommandStatus({
1290
+ tone: "error",
1291
+ text: result.failed
1292
+ });
1293
+ };
1294
+
977
1295
  /** Replaces `start`–`end` with the emoji through the editing path, so the browser's undo restores the shortcode. */
978
1296
  const insertEmoji = (start, end, emoji) => {
979
1297
  if (!textareaRef || editBlocked()) return;
@@ -1014,9 +1332,66 @@ export function ChatComposer(props) {
1014
1332
  if (untouched && textarea.matches(":focus")) convert(loaded);
1015
1333
  }, () => undefined);
1016
1334
  };
1335
+
1336
+ /** Moving through and choosing in the command list, from the field or from the search field opened by "+". */
1337
+ const commandListKey = event => {
1338
+ if (!commandsOpen()) return false;
1339
+ const matches = commandMatches();
1340
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
1341
+ event.preventDefault();
1342
+ const index = matches.indexOf(selectedCommand());
1343
+ const next = matches[nextChatCommandIndex(index, matches.length, event.key === "ArrowUp" ? -1 : 1)];
1344
+ setActiveCommandKey(next ? chatCommandKey(next) : undefined);
1345
+ setCommandMoved(true);
1346
+ setAnnouncement(undefined);
1347
+ return true;
1348
+ }
1349
+ // Ctrl/⌘+Enter sends, also while suggestions are open.
1350
+ const plain = !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
1351
+ if (plain && (event.key === "Tab" || event.key === "Enter") && matches.length > 0) {
1352
+ event.preventDefault();
1353
+ const command = selectedCommand();
1354
+ // A server row answering an earlier query may no longer match; wait for fresh results. Local rows match now.
1355
+ const row = commandModel().rows.find(row => chatCommandKey(row.command) === selectedCommandKey());
1356
+ const staleServerRow = row?.server && (searchResultsQuery() !== commandQuery()?.query || searchResultsScope() !== parsedCommandQuery().scope?.id);
1357
+ if (staleServerRow) return true;
1358
+ if (command) void executeCommand(command, event.key === "Tab");
1359
+ return true;
1360
+ }
1361
+ if (event.key === "Escape") {
1362
+ event.preventDefault();
1363
+ closeCommandList();
1364
+ return true;
1365
+ }
1366
+ return false;
1367
+ };
1368
+ const onAddSearchKeyDown = event => {
1369
+ // Nothing chooses while an input method composes, as in the field.
1370
+ if (event.isComposing || event.keyCode === 229 || addComposing) return;
1371
+ if (event.key === "Escape" && openingRun) {
1372
+ event.preventDefault();
1373
+ openingRun.controller.abort();
1374
+ endAddSearch(true);
1375
+ return;
1376
+ }
1377
+ if (commandListKey(event)) return;
1378
+ // Ctrl/⌘+Enter sends from the search field as from the field, with the list closed first.
1379
+ if (event.key === "Enter" && (event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey) {
1380
+ event.preventDefault();
1381
+ endAddSearch(true);
1382
+ void submit();
1383
+ }
1384
+ };
1017
1385
  const onKeyDown = event => {
1018
1386
  // WebKit ends the composition before the keydown of the Enter that confirms it; that keydown keeps keyCode 229.
1019
1387
  if (event.isComposing || event.keyCode === 229 || composing()) return;
1388
+ // Escape cancels a running `open` row, also once its list is gone because the draft moved to a new chat.
1389
+ if (event.key === "Escape" && openingRun) {
1390
+ event.preventDefault();
1391
+ openingRun.controller.abort();
1392
+ if (commandsOpen()) closeCommandList();
1393
+ return;
1394
+ }
1020
1395
  if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "z") {
1021
1396
  event.preventDefault();
1022
1397
  restoreHistory(event.shiftKey ? 1 : -1);
@@ -1041,38 +1416,11 @@ export function ChatComposer(props) {
1041
1416
  return;
1042
1417
  }
1043
1418
  }
1044
- const matches = commandMatches();
1045
- if (commandsOpen()) {
1046
- if (event.key === "ArrowUp" || event.key === "ArrowDown") {
1047
- event.preventDefault();
1048
- const index = matches.indexOf(selectedCommand());
1049
- const next = matches[nextChatCommandIndex(index, matches.length, event.key === "ArrowUp" ? -1 : 1)];
1050
- setActiveCommandKey(next ? chatCommandKey(next) : undefined);
1051
- setCommandMoved(true);
1052
- setAnnouncement(undefined);
1053
- return;
1054
- }
1055
- // Ctrl/⌘+Enter sends, also while suggestions are open.
1056
- const plain = !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
1057
- if (plain && (event.key === "Tab" || event.key === "Enter") && matches.length > 0) {
1058
- event.preventDefault();
1059
- const command = selectedCommand();
1060
- // A server row answering an earlier query may no longer match; wait for fresh results. Local rows match now.
1061
- const row = commandModel().rows.find(row => chatCommandKey(row.command) === selectedCommandKey());
1062
- const staleServerRow = row?.server && (searchResultsQuery() !== commandQuery()?.query || searchResultsScope() !== parsedCommandQuery().scope?.id);
1063
- if (staleServerRow) return;
1064
- if (command) void executeCommand(command, event.key === "Tab");
1065
- return;
1066
- }
1067
- if (event.key === "Escape") {
1068
- event.preventDefault();
1069
- setClosedAt(commandQuery()?.start);
1070
- return;
1071
- }
1072
- }
1419
+ if (commandListKey(event)) return;
1073
1420
  const format = props.formatting && textareaRef ? formatShortcut(event) : undefined;
1074
1421
  if (format && textareaRef) {
1075
1422
  event.preventDefault();
1423
+ if (editBlocked()) return;
1076
1424
  format.run(textareaRef);
1077
1425
  return;
1078
1426
  }
@@ -1213,8 +1561,52 @@ export function ChatComposer(props) {
1213
1561
  }
1214
1562
  });
1215
1563
 
1564
+ /** "+" as the way to the slash list on keyboards without a handy "/". */
1565
+ const addSearchButton = (extraClass = "") => _$createComponent(Tooltip.Trigger, {
1566
+ ref(r$) {
1567
+ var _ref$2 = addButtonRef;
1568
+ typeof _ref$2 === "function" ? _ref$2(r$) : addButtonRef = r$;
1569
+ },
1570
+ type: "button",
1571
+ "class": `k2b-chat-composer__icon-action${extraClass}`,
1572
+ get ["aria-label"]() {
1573
+ return chatMessages().addMenu;
1574
+ },
1575
+ "aria-haspopup": "listbox",
1576
+ get ["aria-expanded"]() {
1577
+ return addSearch() !== undefined;
1578
+ },
1579
+ get ["aria-controls"]() {
1580
+ return addSearch() ? commandListId : undefined;
1581
+ },
1582
+ get content() {
1583
+ return chatMessages().addMenu;
1584
+ },
1585
+ get disabled() {
1586
+ return blocked();
1587
+ },
1588
+ onMouseDown: keepFieldFocus,
1589
+ onClick: toggleAddSearch,
1590
+ get children() {
1591
+ var _el$5 = _$getNextElement(_tmpl$3);
1592
+ _$effect(() => _$className(_el$5, addingFiles() ? "ti ti-loader-2 k2b-spin" : "ti ti-plus"));
1593
+ return _el$5;
1594
+ }
1595
+ });
1596
+
1216
1597
  /** The conversation's attach button opens the file choice directly; other actions turn it into the add menu. */
1217
1598
  const attachControl = () => _$createComponent(Show, {
1599
+ get when() {
1600
+ return !addOpensCommands();
1601
+ },
1602
+ get fallback() {
1603
+ return addSearchButton(" k2b-chat-composer__attach");
1604
+ },
1605
+ get children() {
1606
+ return attachChoice();
1607
+ }
1608
+ });
1609
+ const attachChoice = () => _$createComponent(Show, {
1218
1610
  get when() {
1219
1611
  return props.menuActions?.length;
1220
1612
  },
@@ -1237,9 +1629,9 @@ export function ChatComposer(props) {
1237
1629
  },
1238
1630
  onClick: () => chooseFiles(),
1239
1631
  get children() {
1240
- var _el$5 = _$getNextElement(_tmpl$3);
1241
- _$effect(() => _$className(_el$5, addingFiles() ? "ti ti-loader-2 k2b-spin" : "ti ti-plus"));
1242
- return _el$5;
1632
+ var _el$6 = _$getNextElement(_tmpl$3);
1633
+ _$effect(() => _$className(_el$6, addingFiles() ? "ti ti-loader-2 k2b-spin" : "ti ti-plus"));
1634
+ return _el$6;
1243
1635
  }
1244
1636
  })
1245
1637
  });
@@ -1283,9 +1675,9 @@ export function ChatComposer(props) {
1283
1675
  return _$memo(() => !!props.formatting)() && formattingOpen();
1284
1676
  },
1285
1677
  get children() {
1286
- var _el$7 = _$getNextElement(_tmpl$5);
1287
- _$setAttribute(_el$7, "id", formatGroupId);
1288
- _$insert(_el$7, _$createComponent(For, {
1678
+ var _el$8 = _$getNextElement(_tmpl$5);
1679
+ _$setAttribute(_el$8, "id", formatGroupId);
1680
+ _$insert(_el$8, _$createComponent(For, {
1289
1681
  each: formatTools,
1290
1682
  children: tool => _$createComponent(Tooltip.Trigger, {
1291
1683
  type: "button",
@@ -1304,14 +1696,14 @@ export function ChatComposer(props) {
1304
1696
  if (textareaRef) tool.run(textareaRef);
1305
1697
  },
1306
1698
  get children() {
1307
- var _el$8 = _$getNextElement(_tmpl$3);
1308
- _$effect(() => _$className(_el$8, tool.icon));
1309
- return _el$8;
1699
+ var _el$9 = _$getNextElement(_tmpl$3);
1700
+ _$effect(() => _$className(_el$9, tool.icon));
1701
+ return _el$9;
1310
1702
  }
1311
1703
  })
1312
1704
  }));
1313
- _$effect(() => _$setAttribute(_el$7, "aria-label", chatMessages().composerFormatting));
1314
- return _el$7;
1705
+ _$effect(() => _$setAttribute(_el$8, "aria-label", chatMessages().composerFormatting));
1706
+ return _el$8;
1315
1707
  }
1316
1708
  });
1317
1709
  const emojiButton = () => _$createComponent(Show, {
@@ -1348,14 +1740,14 @@ export function ChatComposer(props) {
1348
1740
  return _$memo(() => !!(props.microphone?.onDictate || props.microphone?.onVoiceMessage))() ? props.microphone : undefined;
1349
1741
  },
1350
1742
  children: microphone => (() => {
1351
- var _el$0 = _$getNextElement(_tmpl$8),
1352
- _el$11 = _el$0.firstChild,
1353
- [_el$12, _co$] = _$getNextMarker(_el$11.nextSibling),
1354
- _el$13 = _el$12.nextSibling,
1355
- [_el$14, _co$2] = _$getNextMarker(_el$13.nextSibling);
1356
- var _ref$2 = microphoneRef;
1357
- typeof _ref$2 === "function" ? _$use(_ref$2, _el$0) : microphoneRef = _el$0;
1358
- _$insert(_el$0, _$createComponent(Tooltip.Trigger, {
1743
+ var _el$1 = _$getNextElement(_tmpl$8),
1744
+ _el$12 = _el$1.firstChild,
1745
+ [_el$13, _co$] = _$getNextMarker(_el$12.nextSibling),
1746
+ _el$14 = _el$13.nextSibling,
1747
+ [_el$15, _co$2] = _$getNextMarker(_el$14.nextSibling);
1748
+ var _ref$3 = microphoneRef;
1749
+ typeof _ref$3 === "function" ? _$use(_ref$3, _el$1) : microphoneRef = _el$1;
1750
+ _$insert(_el$1, _$createComponent(Tooltip.Trigger, {
1359
1751
  type: "button",
1360
1752
  "class": "k2b-chat-composer__icon-action k2b-chat-composer__microphone-button",
1361
1753
  get ["data-state"]() {
@@ -1415,12 +1807,12 @@ export function ChatComposer(props) {
1415
1807
  }
1416
1808
  },
1417
1809
  get children() {
1418
- var _el$1 = _$getNextElement(_tmpl$3);
1419
- _$effect(() => _$className(_el$1, dictation() === "listening" ? "ti ti-player-stop" : dictation() === "refining" ? "ti ti-loader-2 k2b-spin" : "ti ti-microphone"));
1420
- return _el$1;
1810
+ var _el$10 = _$getNextElement(_tmpl$3);
1811
+ _$effect(() => _$className(_el$10, dictation() === "listening" ? "ti ti-player-stop" : dictation() === "refining" ? "ti ti-loader-2 k2b-spin" : "ti ti-microphone"));
1812
+ return _el$10;
1421
1813
  }
1422
- }), _el$12, _co$);
1423
- _$insert(_el$0, _$createComponent(Show, {
1814
+ }), _el$13, _co$);
1815
+ _$insert(_el$1, _$createComponent(Show, {
1424
1816
  get when() {
1425
1817
  return microphone().onVoiceMessage;
1426
1818
  },
@@ -1457,8 +1849,8 @@ export function ChatComposer(props) {
1457
1849
  }
1458
1850
  });
1459
1851
  }
1460
- }), _el$14, _co$2);
1461
- return _el$0;
1852
+ }), _el$15, _co$2);
1853
+ return _el$1;
1462
1854
  })()
1463
1855
  });
1464
1856
  const sendControl = () => _$createComponent(Show, {
@@ -1483,9 +1875,9 @@ export function ChatComposer(props) {
1483
1875
  },
1484
1876
  onClick: () => void submit(),
1485
1877
  get children() {
1486
- var _el$16 = _$getNextElement(_tmpl$3);
1487
- _$effect(() => _$className(_el$16, submitting() ? "ti ti-loader-2 k2b-spin" : conversation() ? "ti ti-send" : "ti ti-arrow-up"));
1488
- return _el$16;
1878
+ var _el$17 = _$getNextElement(_tmpl$3);
1879
+ _$effect(() => _$className(_el$17, submitting() ? "ti ti-loader-2 k2b-spin" : conversation() ? "ti ti-send" : "ti ti-arrow-up"));
1880
+ return _el$17;
1489
1881
  }
1490
1882
  });
1491
1883
  },
@@ -1504,47 +1896,47 @@ export function ChatComposer(props) {
1504
1896
  },
1505
1897
  onClick: () => reportChatFailure(() => props.onStop?.(), props.onError),
1506
1898
  get children() {
1507
- var _el$15 = _$getNextElement(_tmpl$3);
1508
- _$effect(() => _$className(_el$15, stopping() ? "ti ti-loader-2 k2b-spin" : "ti ti-player-stop"));
1509
- return _el$15;
1899
+ var _el$16 = _$getNextElement(_tmpl$3);
1900
+ _$effect(() => _$className(_el$16, stopping() ? "ti ti-loader-2 k2b-spin" : "ti ti-player-stop"));
1901
+ return _el$16;
1510
1902
  }
1511
1903
  });
1512
1904
  }
1513
1905
  });
1514
1906
  const field = () => (() => {
1515
- var _el$17 = _$getNextElement(_tmpl$1),
1516
- _el$24 = _el$17.firstChild,
1517
- [_el$25, _co$4] = _$getNextMarker(_el$24.nextSibling),
1518
- _el$22 = _el$25.nextSibling,
1519
- _el$26 = _el$22.nextSibling,
1520
- [_el$27, _co$5] = _$getNextMarker(_el$26.nextSibling);
1521
- _$insert(_el$17, _$createComponent(Show, {
1907
+ var _el$18 = _$getNextElement(_tmpl$1),
1908
+ _el$25 = _el$18.firstChild,
1909
+ [_el$26, _co$4] = _$getNextMarker(_el$25.nextSibling),
1910
+ _el$23 = _el$26.nextSibling,
1911
+ _el$27 = _el$23.nextSibling,
1912
+ [_el$28, _co$5] = _$getNextMarker(_el$27.nextSibling);
1913
+ _$insert(_el$18, _$createComponent(Show, {
1522
1914
  get when() {
1523
1915
  return mentions().length > 0;
1524
1916
  },
1525
1917
  get children() {
1526
- var _el$18 = _$getNextElement(_tmpl$9),
1527
- _el$20 = _el$18.firstChild,
1528
- [_el$21, _co$3] = _$getNextMarker(_el$20.nextSibling),
1529
- _el$19 = _el$21.nextSibling;
1530
- var _ref$3 = highlightRef;
1531
- typeof _ref$3 === "function" ? _$use(_ref$3, _el$18) : highlightRef = _el$18;
1532
- _$insert(_el$18, _$createComponent(For, {
1918
+ var _el$19 = _$getNextElement(_tmpl$9),
1919
+ _el$21 = _el$19.firstChild,
1920
+ [_el$22, _co$3] = _$getNextMarker(_el$21.nextSibling),
1921
+ _el$20 = _el$22.nextSibling;
1922
+ var _ref$4 = highlightRef;
1923
+ typeof _ref$4 === "function" ? _$use(_ref$4, _el$19) : highlightRef = _el$19;
1924
+ _$insert(_el$19, _$createComponent(For, {
1533
1925
  get each() {
1534
1926
  return chatMentionSegments(props.value, mentions());
1535
1927
  },
1536
1928
  children: part => (() => {
1537
- var _el$28 = _$getNextElement(_tmpl$10);
1538
- _$insert(_el$28, () => part.text);
1539
- _$effect(() => _el$28.classList.toggle("k2b-chat-composer__mention", !!Boolean(part.mention)));
1540
- return _el$28;
1929
+ var _el$29 = _$getNextElement(_tmpl$10);
1930
+ _$insert(_el$29, () => part.text);
1931
+ _$effect(() => _el$29.classList.toggle("k2b-chat-composer__mention", !!Boolean(part.mention)));
1932
+ return _el$29;
1541
1933
  })()
1542
- }), _el$21, _co$3);
1543
- return _el$18;
1934
+ }), _el$22, _co$3);
1935
+ return _el$19;
1544
1936
  }
1545
- }), _el$25, _co$4);
1546
- _el$22.$$keydown = onKeyDown;
1547
- _el$22.$$beforeinput = event => {
1937
+ }), _el$26, _co$4);
1938
+ _el$23.$$keydown = onKeyDown;
1939
+ _el$23.$$beforeinput = event => {
1548
1940
  inputStart = event.currentTarget.selectionStart;
1549
1941
  inputEnd = event.currentTarget.selectionEnd;
1550
1942
  if (event.inputType === "historyUndo" || event.inputType === "historyRedo") {
@@ -1552,22 +1944,27 @@ export function ChatComposer(props) {
1552
1944
  restoreHistory(event.inputType === "historyUndo" ? -1 : 1);
1553
1945
  }
1554
1946
  };
1555
- _el$22.addEventListener("scroll", () => {
1947
+ _el$23.addEventListener("scroll", () => {
1556
1948
  if (highlightRef && textareaRef) highlightRef.scrollTop = textareaRef.scrollTop;
1557
1949
  });
1558
- _el$22.addEventListener("compositionend", () => {
1950
+ _el$23.addEventListener("compositionend", () => {
1559
1951
  setComposing(false);
1560
1952
  syncCaret();
1561
1953
  });
1562
- _el$22.addEventListener("compositionstart", () => setComposing(true));
1563
- _el$22.$$keyup = syncCaret;
1564
- _el$22.$$click = () => {
1954
+ _el$23.addEventListener("compositionstart", () => setComposing(true));
1955
+ _el$23.$$keyup = syncCaret;
1956
+ _el$23.$$click = () => {
1565
1957
  setDismissed(false);
1566
1958
  syncCaret();
1567
1959
  };
1568
- _el$22.addEventListener("blur", () => setDismissed(true));
1569
- _el$22.addEventListener("select", syncCaret);
1570
- _el$22.addEventListener("paste", event => {
1960
+ _el$23.addEventListener("blur", () => setDismissed(true));
1961
+ _el$23.addEventListener("select", syncCaret);
1962
+ _el$23.addEventListener("paste", event => {
1963
+ // Read-only while an `open` row runs: nothing may join the draft after it was saved.
1964
+ if (editBlocked()) {
1965
+ event.preventDefault();
1966
+ return;
1967
+ }
1571
1968
  const clipboardData = event.clipboardData;
1572
1969
  if (canSelectFiles() && clipboardData?.files.length) {
1573
1970
  event.preventDefault();
@@ -1576,7 +1973,7 @@ export function ChatComposer(props) {
1576
1973
  }
1577
1974
  props.onPaste?.(event);
1578
1975
  });
1579
- _el$22.$$input = event => {
1976
+ _el$23.$$input = event => {
1580
1977
  batch(() => {
1581
1978
  edit(event.currentTarget.value);
1582
1979
  syncCaret();
@@ -1585,42 +1982,44 @@ export function ChatComposer(props) {
1585
1982
  const input = event;
1586
1983
  if (input.inputType === "insertText" && input.data === ":") queueMicrotask(completeShortcode);
1587
1984
  };
1588
- var _ref$4 = textareaRef;
1589
- typeof _ref$4 === "function" ? _$use(_ref$4, _el$22) : textareaRef = _el$22;
1590
- _$insert(_el$17, _$createComponent(Show, {
1985
+ var _ref$5 = textareaRef;
1986
+ typeof _ref$5 === "function" ? _$use(_ref$5, _el$23) : textareaRef = _el$23;
1987
+ _$insert(_el$18, _$createComponent(Show, {
1591
1988
  get when() {
1592
1989
  return conversation();
1593
1990
  },
1594
1991
  get children() {
1595
- var _el$23 = _$getNextElement(_tmpl$0);
1596
- var _ref$5 = measureRef;
1597
- typeof _ref$5 === "function" ? _$use(_ref$5, _el$23) : measureRef = _el$23;
1598
- return _el$23;
1992
+ var _el$24 = _$getNextElement(_tmpl$0);
1993
+ var _ref$6 = measureRef;
1994
+ typeof _ref$6 === "function" ? _$use(_ref$6, _el$24) : measureRef = _el$24;
1995
+ return _el$24;
1599
1996
  }
1600
- }), _el$27, _co$5);
1997
+ }), _el$28, _co$5);
1601
1998
  _$effect(_p$ => {
1602
1999
  var _v$3 = chatMessages().messageInput,
1603
2000
  _v$4 = !!(mentions().length > 0),
1604
- _v$5 = editBlocked(),
1605
- _v$6 = conversation() ? "enter" : undefined,
1606
- _v$7 = props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage),
1607
- _v$8 = props.inputLabel ?? messages().message,
1608
- _v$9 = suggestionsOpen() ? "combobox" : undefined,
1609
- _v$0 = suggestionsOpen() ? "list" : undefined,
1610
- _v$1 = suggestionsOpen() ? commandListId : undefined,
1611
- _v$10 = suggestionsOpen() ? "true" : undefined,
1612
- _v$11 = emojiOpen() ? `${commandListId}-${selectedCommandIndex()}` : selectedCommand() ? commandOptionId(selectedCommand()) : undefined;
1613
- _v$3 !== _p$.e && _$setAttribute(_el$17, "aria-label", _p$.e = _v$3);
1614
- _v$4 !== _p$.t && _el$22.classList.toggle("k2b-chat-composer__textarea--highlighted", _p$.t = _v$4);
1615
- _v$5 !== _p$.a && _$setProperty(_el$22, "disabled", _p$.a = _v$5);
1616
- _v$6 !== _p$.o && _$setAttribute(_el$22, "enterkeyhint", _p$.o = _v$6);
1617
- _v$7 !== _p$.i && _$setAttribute(_el$22, "placeholder", _p$.i = _v$7);
1618
- _v$8 !== _p$.n && _$setAttribute(_el$22, "aria-label", _p$.n = _v$8);
1619
- _v$9 !== _p$.s && _$setAttribute(_el$22, "role", _p$.s = _v$9);
1620
- _v$0 !== _p$.h && _$setAttribute(_el$22, "aria-autocomplete", _p$.h = _v$0);
1621
- _v$1 !== _p$.r && _$setAttribute(_el$22, "aria-controls", _p$.r = _v$1);
1622
- _v$10 !== _p$.d && _$setAttribute(_el$22, "aria-expanded", _p$.d = _v$10);
1623
- _v$11 !== _p$.l && _$setAttribute(_el$22, "aria-activedescendant", _p$.l = _v$11);
2001
+ _v$5 = editBlocked() && openingRow() === undefined,
2002
+ _v$6 = openingRow() !== undefined,
2003
+ _v$7 = conversation() ? "enter" : undefined,
2004
+ _v$8 = props.placeholder ?? (running() ? chatMessages().addGuidance : conversation() ? chatMessages().writeConversationMessage : chatMessages().writeMessage),
2005
+ _v$9 = props.inputLabel ?? messages().message,
2006
+ _v$0 = fieldOwnsList() ? "combobox" : undefined,
2007
+ _v$1 = fieldOwnsList() ? "list" : undefined,
2008
+ _v$10 = fieldOwnsList() ? commandListId : undefined,
2009
+ _v$11 = fieldOwnsList() ? "true" : undefined,
2010
+ _v$12 = !fieldOwnsList() ? undefined : emojiOpen() ? `${commandListId}-${selectedCommandIndex()}` : selectedCommand() ? commandOptionId(selectedCommand()) : undefined;
2011
+ _v$3 !== _p$.e && _$setAttribute(_el$18, "aria-label", _p$.e = _v$3);
2012
+ _v$4 !== _p$.t && _el$23.classList.toggle("k2b-chat-composer__textarea--highlighted", _p$.t = _v$4);
2013
+ _v$5 !== _p$.a && _$setProperty(_el$23, "disabled", _p$.a = _v$5);
2014
+ _v$6 !== _p$.o && _$setProperty(_el$23, "readOnly", _p$.o = _v$6);
2015
+ _v$7 !== _p$.i && _$setAttribute(_el$23, "enterkeyhint", _p$.i = _v$7);
2016
+ _v$8 !== _p$.n && _$setAttribute(_el$23, "placeholder", _p$.n = _v$8);
2017
+ _v$9 !== _p$.s && _$setAttribute(_el$23, "aria-label", _p$.s = _v$9);
2018
+ _v$0 !== _p$.h && _$setAttribute(_el$23, "role", _p$.h = _v$0);
2019
+ _v$1 !== _p$.r && _$setAttribute(_el$23, "aria-autocomplete", _p$.r = _v$1);
2020
+ _v$10 !== _p$.d && _$setAttribute(_el$23, "aria-controls", _p$.d = _v$10);
2021
+ _v$11 !== _p$.l && _$setAttribute(_el$23, "aria-expanded", _p$.l = _v$11);
2022
+ _v$12 !== _p$.u && _$setAttribute(_el$23, "aria-activedescendant", _p$.u = _v$12);
1624
2023
  return _p$;
1625
2024
  }, {
1626
2025
  e: undefined,
@@ -1633,32 +2032,35 @@ export function ChatComposer(props) {
1633
2032
  h: undefined,
1634
2033
  r: undefined,
1635
2034
  d: undefined,
1636
- l: undefined
2035
+ l: undefined,
2036
+ u: undefined
1637
2037
  });
1638
- _$effect(() => _$setProperty(_el$22, "value", props.value));
2038
+ _$effect(() => _$setProperty(_el$23, "value", props.value));
1639
2039
  _$runHydrationEvents();
1640
- return _el$17;
2040
+ return _el$18;
1641
2041
  })();
1642
2042
  const commandRowMap = createMemo(() => new Map(commandModel().rows.map(row => [row.command, row])));
1643
2043
  const commandGroupKey = group => group.scopeTitle ? "scope" : group.section ? `section:${group.section.id}` : "flat";
1644
2044
  const renderCommandRow = command => {
1645
2045
  const highlight = () => commandRowMap().get(command)?.highlight;
1646
2046
  const title = () => command.label ?? command.name;
2047
+ const opening = () => openingRow() === chatCommandKey(command);
2048
+ const failure = () => openFailures()[chatCommandKey(command)];
1647
2049
  return (() => {
1648
- var _el$29 = _$getNextElement(_tmpl$13),
1649
- _el$30 = _el$29.firstChild,
1650
- _el$31 = _el$30.nextSibling,
1651
- _el$32 = _el$31.firstChild,
1652
- _el$34 = _el$32.nextSibling,
1653
- [_el$35, _co$6] = _$getNextMarker(_el$34.nextSibling),
1654
- _el$39 = _el$31.nextSibling,
1655
- [_el$40, _co$7] = _$getNextMarker(_el$39.nextSibling);
1656
- _el$29.$$click = event => {
2050
+ var _el$30 = _$getNextElement(_tmpl$13),
2051
+ _el$31 = _el$30.firstChild,
2052
+ _el$32 = _el$31.nextSibling,
2053
+ _el$33 = _el$32.firstChild,
2054
+ _el$40 = _el$33.nextSibling,
2055
+ [_el$41, _co$7] = _$getNextMarker(_el$40.nextSibling),
2056
+ _el$45 = _el$32.nextSibling,
2057
+ [_el$46, _co$8] = _$getNextMarker(_el$45.nextSibling);
2058
+ _el$30.$$click = event => {
1657
2059
  event.preventDefault();
1658
2060
  void executeCommand(command);
1659
2061
  };
1660
- _el$29.$$mousedown = keepFieldFocus;
1661
- _$insert(_el$32, _$createComponent(Show, {
2062
+ _el$30.$$mousedown = keepFieldFocus;
2063
+ _$insert(_el$33, _$createComponent(Show, {
1662
2064
  get when() {
1663
2065
  return highlight();
1664
2066
  },
@@ -1666,49 +2068,82 @@ export function ChatComposer(props) {
1666
2068
  return title();
1667
2069
  },
1668
2070
  children: range => [_$memo(() => title().slice(0, range()[0])), (() => {
1669
- var _el$41 = _$getNextElement(_tmpl$14);
1670
- _$insert(_el$41, () => title().slice(range()[0], range()[1]));
1671
- return _el$41;
2071
+ var _el$47 = _$getNextElement(_tmpl$14);
2072
+ _$insert(_el$47, () => title().slice(range()[0], range()[1]));
2073
+ return _el$47;
1672
2074
  })(), _$memo(() => title().slice(range()[1]))]
1673
2075
  }));
1674
- _$insert(_el$31, _$createComponent(Show, {
2076
+ _$insert(_el$32, _$createComponent(Show, {
1675
2077
  get when() {
1676
- return command.reason ?? command.description;
2078
+ return _$memo(() => !!command.open)() && !command.reason;
2079
+ },
2080
+ get fallback() {
2081
+ return _$createComponent(Show, {
2082
+ get when() {
2083
+ return command.reason ?? command.description;
2084
+ },
2085
+ get children() {
2086
+ var _el$48 = _$getNextElement(_tmpl$15);
2087
+ _$insert(_el$48, () => command.reason ?? command.description);
2088
+ _$effect(() => _$setAttribute(_el$48, "id", command.reason ? `${commandOptionId(command)}-reason` : undefined));
2089
+ return _el$48;
2090
+ }
2091
+ });
1677
2092
  },
1678
2093
  get children() {
1679
- var _el$33 = _$getNextElement(_tmpl$11);
1680
- _$insert(_el$33, () => command.reason ?? command.description);
1681
- _$effect(() => _$setAttribute(_el$33, "id", command.reason ? `${commandOptionId(command)}-reason` : undefined));
1682
- return _el$33;
2094
+ var _el$34 = _$getNextElement(_tmpl$11),
2095
+ _el$35 = _el$34.firstChild,
2096
+ _el$36 = _el$35.nextSibling,
2097
+ _el$37 = _el$36.firstChild,
2098
+ _el$38 = _el$37.nextSibling,
2099
+ [_el$39, _co$6] = _$getNextMarker(_el$38.nextSibling);
2100
+ _$insert(_el$35, () => failure() ?? command.description);
2101
+ _$insert(_el$36, () => command.busyLabel ?? chatMessages().commandOpening, _el$39, _co$6);
2102
+ _$effect(_p$ => {
2103
+ var _v$13 = opening() ? "busy" : failure() ? "failed" : undefined,
2104
+ _v$14 = opening() ? "true" : undefined,
2105
+ _v$15 = opening() ? undefined : "true";
2106
+ _v$13 !== _p$.e && _$setAttribute(_el$34, "data-state", _p$.e = _v$13);
2107
+ _v$14 !== _p$.t && _$setAttribute(_el$35, "aria-hidden", _p$.t = _v$14);
2108
+ _v$15 !== _p$.a && _$setAttribute(_el$36, "aria-hidden", _p$.a = _v$15);
2109
+ return _p$;
2110
+ }, {
2111
+ e: undefined,
2112
+ t: undefined,
2113
+ a: undefined
2114
+ });
2115
+ return _el$34;
1683
2116
  }
1684
- }), _el$35, _co$6);
1685
- _$insert(_el$29, _$createComponent(Show, {
2117
+ }), _el$41, _co$7);
2118
+ _$insert(_el$30, _$createComponent(Show, {
1686
2119
  get when() {
1687
2120
  return command.selected;
1688
2121
  },
1689
2122
  get children() {
1690
- var _el$36 = _$getNextElement(_tmpl$12),
1691
- _el$37 = _el$36.firstChild,
1692
- _el$38 = _el$37.nextSibling;
1693
- _$insert(_el$38, () => chatMessages().commandSelected);
1694
- return _el$36;
2123
+ var _el$42 = _$getNextElement(_tmpl$12),
2124
+ _el$43 = _el$42.firstChild,
2125
+ _el$44 = _el$43.nextSibling;
2126
+ _$insert(_el$44, () => chatMessages().commandSelected);
2127
+ return _el$42;
1695
2128
  }
1696
- }), _el$40, _co$7);
2129
+ }), _el$46, _co$8);
1697
2130
  _$effect(_p$ => {
1698
- var _v$12 = commandOptionId(command),
1699
- _v$13 = selectedCommand() === command,
1700
- _v$14 = Boolean(command.disabled || command.reason),
1701
- _v$15 = command.reason ? `${commandOptionId(command)}-reason` : undefined,
1702
- _v$16 = command.reason ? "true" : undefined,
1703
- _v$17 = selectedCommand() === command ? "true" : undefined,
1704
- _v$18 = command.icon ?? "ti ti-slash";
1705
- _v$12 !== _p$.e && _$setAttribute(_el$29, "id", _p$.e = _v$12);
1706
- _v$13 !== _p$.t && _$setAttribute(_el$29, "aria-selected", _p$.t = _v$13);
1707
- _v$14 !== _p$.a && _$setAttribute(_el$29, "aria-disabled", _p$.a = _v$14);
1708
- _v$15 !== _p$.o && _$setAttribute(_el$29, "aria-describedby", _p$.o = _v$15);
1709
- _v$16 !== _p$.i && _$setAttribute(_el$29, "data-reason", _p$.i = _v$16);
1710
- _v$17 !== _p$.n && _$setAttribute(_el$29, "data-active", _p$.n = _v$17);
1711
- _v$18 !== _p$.s && _$className(_el$30, _p$.s = _v$18);
2131
+ var _v$16 = commandOptionId(command),
2132
+ _v$17 = selectedCommand() === command,
2133
+ _v$18 = Boolean(command.disabled || command.reason),
2134
+ _v$19 = opening() ? "true" : undefined,
2135
+ _v$20 = command.reason ? `${commandOptionId(command)}-reason` : undefined,
2136
+ _v$21 = command.reason ? "true" : undefined,
2137
+ _v$22 = selectedCommand() === command ? "true" : undefined,
2138
+ _v$23 = command.icon ?? "ti ti-slash";
2139
+ _v$16 !== _p$.e && _$setAttribute(_el$30, "id", _p$.e = _v$16);
2140
+ _v$17 !== _p$.t && _$setAttribute(_el$30, "aria-selected", _p$.t = _v$17);
2141
+ _v$18 !== _p$.a && _$setAttribute(_el$30, "aria-disabled", _p$.a = _v$18);
2142
+ _v$19 !== _p$.o && _$setAttribute(_el$30, "aria-busy", _p$.o = _v$19);
2143
+ _v$20 !== _p$.i && _$setAttribute(_el$30, "aria-describedby", _p$.i = _v$20);
2144
+ _v$21 !== _p$.n && _$setAttribute(_el$30, "data-reason", _p$.n = _v$21);
2145
+ _v$22 !== _p$.s && _$setAttribute(_el$30, "data-active", _p$.s = _v$22);
2146
+ _v$23 !== _p$.h && _$className(_el$31, _p$.h = _v$23);
1712
2147
  return _p$;
1713
2148
  }, {
1714
2149
  e: undefined,
@@ -1717,92 +2152,93 @@ export function ChatComposer(props) {
1717
2152
  o: undefined,
1718
2153
  i: undefined,
1719
2154
  n: undefined,
1720
- s: undefined
2155
+ s: undefined,
2156
+ h: undefined
1721
2157
  });
1722
2158
  _$runHydrationEvents();
1723
- return _el$29;
2159
+ return _el$30;
1724
2160
  })();
1725
2161
  };
1726
2162
  return (() => {
1727
- var _el$42 = _$getNextElement(_tmpl$25),
1728
- _el$110 = _el$42.firstChild,
1729
- [_el$111, _co$28] = _$getNextMarker(_el$110.nextSibling),
1730
- _el$72 = _el$111.nextSibling,
1731
- _el$96 = _el$72.firstChild,
1732
- [_el$97, _co$22] = _$getNextMarker(_el$96.nextSibling),
1733
- _el$98 = _el$97.nextSibling,
1734
- [_el$99, _co$23] = _$getNextMarker(_el$98.nextSibling),
1735
- _el$100 = _el$99.nextSibling,
1736
- [_el$101, _co$24] = _$getNextMarker(_el$100.nextSibling),
1737
- _el$102 = _el$101.nextSibling,
1738
- [_el$103, _co$25] = _$getNextMarker(_el$102.nextSibling),
1739
- _el$104 = _el$72.nextSibling,
1740
- _el$105 = _el$104.nextSibling,
1741
- _el$106 = _el$105.firstChild,
1742
- [_el$107, _co$26] = _$getNextMarker(_el$106.nextSibling),
1743
- _el$108 = _el$107.nextSibling,
1744
- [_el$109, _co$27] = _$getNextMarker(_el$108.nextSibling);
1745
- var _ref$6 = shellRef;
1746
- typeof _ref$6 === "function" ? _$use(_ref$6, _el$42) : shellRef = _el$42;
1747
- _$insert(_el$42, _$createComponent(Show, {
2163
+ var _el$49 = _$getNextElement(_tmpl$27),
2164
+ _el$122 = _el$49.firstChild,
2165
+ [_el$123, _co$30] = _$getNextMarker(_el$122.nextSibling),
2166
+ _el$84 = _el$123.nextSibling,
2167
+ _el$108 = _el$84.firstChild,
2168
+ [_el$109, _co$24] = _$getNextMarker(_el$108.nextSibling),
2169
+ _el$110 = _el$109.nextSibling,
2170
+ [_el$111, _co$25] = _$getNextMarker(_el$110.nextSibling),
2171
+ _el$112 = _el$111.nextSibling,
2172
+ [_el$113, _co$26] = _$getNextMarker(_el$112.nextSibling),
2173
+ _el$114 = _el$113.nextSibling,
2174
+ [_el$115, _co$27] = _$getNextMarker(_el$114.nextSibling),
2175
+ _el$116 = _el$84.nextSibling,
2176
+ _el$117 = _el$116.nextSibling,
2177
+ _el$118 = _el$117.firstChild,
2178
+ [_el$119, _co$28] = _$getNextMarker(_el$118.nextSibling),
2179
+ _el$120 = _el$119.nextSibling,
2180
+ [_el$121, _co$29] = _$getNextMarker(_el$120.nextSibling);
2181
+ var _ref$7 = shellRef;
2182
+ typeof _ref$7 === "function" ? _$use(_ref$7, _el$49) : shellRef = _el$49;
2183
+ _$insert(_el$49, _$createComponent(Show, {
1748
2184
  get when() {
1749
2185
  return suggestionsOpen() || hasAccessory();
1750
2186
  },
1751
2187
  get children() {
1752
- var _el$43 = _$getNextElement(_tmpl$20),
1753
- _el$44 = _el$43.firstChild,
1754
- _el$68 = _el$44.nextSibling,
1755
- [_el$69, _co$12] = _$getNextMarker(_el$68.nextSibling),
1756
- _el$70 = _el$69.nextSibling,
1757
- [_el$71, _co$13] = _$getNextMarker(_el$70.nextSibling);
1758
- _$insert(_el$44, accessory);
1759
- _$insert(_el$43, _$createComponent(Show, {
2188
+ var _el$50 = _$getNextElement(_tmpl$22),
2189
+ _el$51 = _el$50.firstChild,
2190
+ _el$80 = _el$51.nextSibling,
2191
+ [_el$81, _co$14] = _$getNextMarker(_el$80.nextSibling),
2192
+ _el$82 = _el$81.nextSibling,
2193
+ [_el$83, _co$15] = _$getNextMarker(_el$82.nextSibling);
2194
+ _$insert(_el$51, accessory);
2195
+ _$insert(_el$50, _$createComponent(Show, {
1760
2196
  get when() {
1761
2197
  return emojiOpen();
1762
2198
  },
1763
2199
  get children() {
1764
- var _el$45 = _$getNextElement(_tmpl$15),
1765
- _el$46 = _el$45.firstChild;
1766
- var _ref$7 = commandListRef;
1767
- typeof _ref$7 === "function" ? _$use(_ref$7, _el$46) : commandListRef = _el$46;
1768
- _$setAttribute(_el$46, "id", commandListId);
1769
- _$insert(_el$46, _$createComponent(For, {
2200
+ var _el$52 = _$getNextElement(_tmpl$16),
2201
+ _el$53 = _el$52.firstChild;
2202
+ var _ref$8 = commandListRef;
2203
+ typeof _ref$8 === "function" ? _$use(_ref$8, _el$53) : commandListRef = _el$53;
2204
+ _$setAttribute(_el$53, "id", commandListId);
2205
+ _$insert(_el$53, _$createComponent(For, {
1770
2206
  get each() {
1771
2207
  return emojiMatches();
1772
2208
  },
1773
2209
  children: (entry, index) => (() => {
1774
- var _el$112 = _$getNextElement(_tmpl$26),
1775
- _el$113 = _el$112.firstChild,
1776
- _el$114 = _el$113.nextSibling,
1777
- _el$115 = _el$114.nextSibling,
1778
- [_el$116, _co$29] = _$getNextMarker(_el$115.nextSibling);
1779
- _el$112.$$click = () => pickEmojiSuggestion(index());
1780
- _el$112.$$mousedown = keepFieldFocus;
1781
- _$insert(_el$113, () => emojiInTone(entry, props.emoji?.skinTone ?? 0));
1782
- _$insert(_el$114, () => emojiName(entry, locale()));
1783
- _$insert(_el$112, _$createComponent(Show, {
2210
+ var _el$124 = _$getNextElement(_tmpl$28),
2211
+ _el$125 = _el$124.firstChild,
2212
+ _el$126 = _el$125.nextSibling,
2213
+ _el$127 = _el$126.nextSibling,
2214
+ [_el$128, _co$31] = _$getNextMarker(_el$127.nextSibling);
2215
+ _el$124.$$click = () => pickEmojiSuggestion(index());
2216
+ _el$124.$$mousedown = keepFieldFocus;
2217
+ _$insert(_el$125, () => emojiInTone(entry, props.emoji?.skinTone ?? 0));
2218
+ _$insert(_el$126, () => emojiName(entry, locale()));
2219
+ _$insert(_el$124, _$createComponent(Show, {
1784
2220
  get when() {
1785
2221
  return entry.shortcodes[0];
1786
2222
  },
1787
2223
  children: code => (() => {
1788
- var _el$117 = _$getNextElement(_tmpl$27),
1789
- _el$118 = _el$117.firstChild,
1790
- _el$120 = _el$118.nextSibling,
1791
- [_el$121, _co$30] = _$getNextMarker(_el$120.nextSibling),
1792
- _el$119 = _el$121.nextSibling;
1793
- _$insert(_el$117, code, _el$121, _co$30);
1794
- return _el$117;
2224
+ var _el$129 = _$getNextElement(_tmpl$29),
2225
+ _el$130 = _el$129.firstChild,
2226
+ _el$132 = _el$130.nextSibling,
2227
+ [_el$133, _co$32] = _$getNextMarker(_el$132.nextSibling),
2228
+ _el$131 = _el$133.nextSibling;
2229
+ _$insert(_el$129, code, _el$133, _co$32);
2230
+ return _el$129;
1795
2231
  })()
1796
- }), _el$116, _co$29);
2232
+ }), _el$128, _co$31);
1797
2233
  _$effect(_p$ => {
1798
- var _v$28 = `${commandListId}-${index()}`,
1799
- _v$29 = index() === selectedCommandIndex(),
1800
- _v$30 = emojiName(entry, locale()),
1801
- _v$31 = index() === selectedCommandIndex() ? "true" : undefined;
1802
- _v$28 !== _p$.e && _$setAttribute(_el$112, "id", _p$.e = _v$28);
1803
- _v$29 !== _p$.t && _$setAttribute(_el$112, "aria-selected", _p$.t = _v$29);
1804
- _v$30 !== _p$.a && _$setAttribute(_el$112, "aria-label", _p$.a = _v$30);
1805
- _v$31 !== _p$.o && _$setAttribute(_el$112, "data-active", _p$.o = _v$31);
2234
+ var _v$38 = `${commandListId}-${index()}`,
2235
+ _v$39 = index() === selectedCommandIndex(),
2236
+ _v$40 = emojiName(entry, locale()),
2237
+ _v$41 = index() === selectedCommandIndex() ? "true" : undefined;
2238
+ _v$38 !== _p$.e && _$setAttribute(_el$124, "id", _p$.e = _v$38);
2239
+ _v$39 !== _p$.t && _$setAttribute(_el$124, "aria-selected", _p$.t = _v$39);
2240
+ _v$40 !== _p$.a && _$setAttribute(_el$124, "aria-label", _p$.a = _v$40);
2241
+ _v$41 !== _p$.o && _$setAttribute(_el$124, "data-active", _p$.o = _v$41);
1806
2242
  return _p$;
1807
2243
  }, {
1808
2244
  e: undefined,
@@ -1811,34 +2247,88 @@ export function ChatComposer(props) {
1811
2247
  o: undefined
1812
2248
  });
1813
2249
  _$runHydrationEvents();
1814
- return _el$112;
2250
+ return _el$124;
1815
2251
  })()
1816
2252
  }));
1817
- _$effect(() => _$setAttribute(_el$46, "aria-label", chatMessages().emojiSuggestions));
1818
- return _el$45;
2253
+ _$effect(() => _$setAttribute(_el$53, "aria-label", chatMessages().emojiSuggestions));
2254
+ return _el$52;
1819
2255
  }
1820
- }), _el$69, _co$12);
1821
- _$insert(_el$43, _$createComponent(Show, {
2256
+ }), _el$81, _co$14);
2257
+ _$insert(_el$50, _$createComponent(Show, {
1822
2258
  get when() {
1823
2259
  return commandsOpen();
1824
2260
  },
1825
2261
  get children() {
1826
- var _el$47 = _$getNextElement(_tmpl$19),
1827
- _el$48 = _el$47.firstChild,
1828
- _el$58 = _el$48.firstChild,
1829
- [_el$59, _co$9] = _$getNextMarker(_el$58.nextSibling),
1830
- _el$60 = _el$59.nextSibling,
1831
- [_el$61, _co$0] = _$getNextMarker(_el$60.nextSibling),
1832
- _el$62 = _el$61.nextSibling,
1833
- [_el$63, _co$1] = _$getNextMarker(_el$62.nextSibling),
1834
- _el$64 = _el$63.nextSibling,
1835
- [_el$65, _co$10] = _$getNextMarker(_el$64.nextSibling),
1836
- _el$66 = _el$65.nextSibling,
1837
- [_el$67, _co$11] = _$getNextMarker(_el$66.nextSibling);
1838
- var _ref$8 = commandListRef;
1839
- typeof _ref$8 === "function" ? _$use(_ref$8, _el$48) : commandListRef = _el$48;
1840
- _$setAttribute(_el$48, "id", commandListId);
1841
- _$insert(_el$48, _$createComponent(For, {
2262
+ var _el$54 = _$getNextElement(_tmpl$21),
2263
+ _el$78 = _el$54.firstChild,
2264
+ [_el$79, _co$13] = _$getNextMarker(_el$78.nextSibling),
2265
+ _el$58 = _el$79.nextSibling,
2266
+ _el$68 = _el$58.firstChild,
2267
+ [_el$69, _co$0] = _$getNextMarker(_el$68.nextSibling),
2268
+ _el$70 = _el$69.nextSibling,
2269
+ [_el$71, _co$1] = _$getNextMarker(_el$70.nextSibling),
2270
+ _el$72 = _el$71.nextSibling,
2271
+ [_el$73, _co$10] = _$getNextMarker(_el$72.nextSibling),
2272
+ _el$74 = _el$73.nextSibling,
2273
+ [_el$75, _co$11] = _$getNextMarker(_el$74.nextSibling),
2274
+ _el$76 = _el$75.nextSibling,
2275
+ [_el$77, _co$12] = _$getNextMarker(_el$76.nextSibling);
2276
+ _el$54.$$mousedown = event => {
2277
+ if (addSearch() && event.target !== addSearchRef) event.preventDefault();
2278
+ };
2279
+ _$insert(_el$54, _$createComponent(Show, {
2280
+ get when() {
2281
+ return addSearch();
2282
+ },
2283
+ get children() {
2284
+ var _el$55 = _$getNextElement(_tmpl$17),
2285
+ _el$56 = _el$55.firstChild,
2286
+ _el$57 = _el$56.nextSibling;
2287
+ _el$57.$$focusout = event => {
2288
+ const next = event.relatedTarget;
2289
+ if (next instanceof Node && commandListRef?.parentElement?.contains(next)) return;
2290
+ // Focus that leaves another way, such as with Shift+Tab, closes the list and stays where it went.
2291
+ queueMicrotask(() => {
2292
+ if (addSearch() && document.activeElement !== addSearchRef) endAddSearch(false);
2293
+ });
2294
+ };
2295
+ _el$57.addEventListener("compositionend", () => {
2296
+ addComposing = false;
2297
+ });
2298
+ _el$57.addEventListener("compositionstart", () => {
2299
+ addComposing = true;
2300
+ });
2301
+ _el$57.$$keydown = onAddSearchKeyDown;
2302
+ _el$57.$$input = event => setAddQuery(event.currentTarget.value);
2303
+ var _ref$9 = addSearchRef;
2304
+ typeof _ref$9 === "function" ? _$use(_ref$9, _el$57) : addSearchRef = _el$57;
2305
+ _$setAttribute(_el$57, "aria-controls", commandListId);
2306
+ _$setAttribute(_el$57, "spellcheck", false);
2307
+ _$effect(_p$ => {
2308
+ var _v$24 = chatMessages().commandSearch,
2309
+ _v$25 = chatMessages().commandSearchLabel,
2310
+ _v$26 = selectedCommand() ? commandOptionId(selectedCommand()) : undefined,
2311
+ _v$27 = openingRow() !== undefined;
2312
+ _v$24 !== _p$.e && _$setAttribute(_el$57, "placeholder", _p$.e = _v$24);
2313
+ _v$25 !== _p$.t && _$setAttribute(_el$57, "aria-label", _p$.t = _v$25);
2314
+ _v$26 !== _p$.a && _$setAttribute(_el$57, "aria-activedescendant", _p$.a = _v$26);
2315
+ _v$27 !== _p$.o && _$setProperty(_el$57, "readOnly", _p$.o = _v$27);
2316
+ return _p$;
2317
+ }, {
2318
+ e: undefined,
2319
+ t: undefined,
2320
+ a: undefined,
2321
+ o: undefined
2322
+ });
2323
+ _$effect(() => _$setProperty(_el$57, "value", addQuery()));
2324
+ _$runHydrationEvents();
2325
+ return _el$55;
2326
+ }
2327
+ }), _el$79, _co$13);
2328
+ var _ref$0 = commandListRef;
2329
+ typeof _ref$0 === "function" ? _$use(_ref$0, _el$58) : commandListRef = _el$58;
2330
+ _$setAttribute(_el$58, "id", commandListId);
2331
+ _$insert(_el$58, _$createComponent(For, {
1842
2332
  get each() {
1843
2333
  return commandModel().groups.map(commandGroupKey);
1844
2334
  },
@@ -1857,350 +2347,354 @@ export function ChatComposer(props) {
1857
2347
  });
1858
2348
  },
1859
2349
  get children() {
1860
- var _el$122 = _$getNextElement(_tmpl$30),
1861
- _el$123 = _el$122.firstChild,
1862
- _el$124 = _el$123.firstChild,
1863
- _el$126 = _el$124.nextSibling,
1864
- [_el$127, _co$31] = _$getNextMarker(_el$126.nextSibling),
1865
- _el$129 = _el$123.nextSibling,
1866
- [_el$130, _co$32] = _$getNextMarker(_el$129.nextSibling),
1867
- _el$131 = _el$130.nextSibling,
1868
- [_el$132, _co$33] = _$getNextMarker(_el$131.nextSibling);
1869
- _$insert(_el$124, () => group()?.scopeTitle ?? group()?.section?.label);
1870
- _$insert(_el$123, _$createComponent(Show, {
2350
+ var _el$134 = _$getNextElement(_tmpl$31),
2351
+ _el$135 = _el$134.firstChild,
2352
+ _el$136 = _el$135.firstChild,
2353
+ _el$138 = _el$136.nextSibling,
2354
+ [_el$139, _co$33] = _$getNextMarker(_el$138.nextSibling),
2355
+ _el$140 = _el$135.nextSibling,
2356
+ [_el$141, _co$34] = _$getNextMarker(_el$140.nextSibling),
2357
+ _el$142 = _el$141.nextSibling,
2358
+ [_el$143, _co$35] = _$getNextMarker(_el$142.nextSibling);
2359
+ _$insert(_el$136, () => group()?.scopeTitle ?? group()?.section?.label);
2360
+ _$insert(_el$135, _$createComponent(Show, {
1871
2361
  get when() {
1872
2362
  return group()?.loading;
1873
2363
  },
1874
2364
  get children() {
1875
- return _$getNextElement(_tmpl$28);
2365
+ return _$getNextElement(_tmpl$30);
1876
2366
  }
1877
- }), _el$127, _co$31);
1878
- _$insert(_el$122, _$createComponent(For, {
2367
+ }), _el$139, _co$33);
2368
+ _$insert(_el$134, _$createComponent(For, {
1879
2369
  get each() {
1880
2370
  return rows();
1881
2371
  },
1882
2372
  children: renderCommandRow
1883
- }), _el$130, _co$32);
1884
- _$insert(_el$122, _$createComponent(Show, {
1885
- get when() {
1886
- return group()?.placeholder;
2373
+ }), _el$141, _co$34);
2374
+ _$insert(_el$134, _$createComponent(Index, {
2375
+ get each() {
2376
+ return Array.from({
2377
+ length: Math.max(group()?.placeholder ? 1 : 0, group()?.pendingRows ?? 0)
2378
+ });
1887
2379
  },
1888
- get children() {
1889
- return _$getNextElement(_tmpl$29);
1890
- }
1891
- }), _el$132, _co$33);
2380
+ children: () => _$getNextElement(_tmpl$32)
2381
+ }), _el$143, _co$35);
1892
2382
  _$effect(_p$ => {
1893
- var _v$32 = headingId(),
1894
- _v$33 = headingId();
1895
- _v$32 !== _p$.e && _$setAttribute(_el$122, "aria-labelledby", _p$.e = _v$32);
1896
- _v$33 !== _p$.t && _$setAttribute(_el$123, "id", _p$.t = _v$33);
2383
+ var _v$42 = headingId(),
2384
+ _v$43 = headingId();
2385
+ _v$42 !== _p$.e && _$setAttribute(_el$134, "aria-labelledby", _p$.e = _v$42);
2386
+ _v$43 !== _p$.t && _$setAttribute(_el$135, "id", _p$.t = _v$43);
1897
2387
  return _p$;
1898
2388
  }, {
1899
2389
  e: undefined,
1900
2390
  t: undefined
1901
2391
  });
1902
- return _el$122;
2392
+ return _el$134;
1903
2393
  }
1904
2394
  });
1905
2395
  }
1906
- }), _el$59, _co$9);
1907
- _$insert(_el$48, _$createComponent(Show, {
2396
+ }), _el$69, _co$0);
2397
+ _$insert(_el$58, _$createComponent(Show, {
1908
2398
  get when() {
1909
2399
  return _$memo(() => !!(searching() && foundCommandCount() === 0))() && !commandModel().groups.some(group => group.section || group.scopeTitle);
1910
2400
  },
1911
2401
  get children() {
1912
- var _el$49 = _$getNextElement(_tmpl$16),
1913
- _el$50 = _el$49.firstChild,
1914
- _el$51 = _el$50.nextSibling;
1915
- _$insert(_el$51, () => messages().loading);
1916
- return _el$49;
2402
+ var _el$59 = _$getNextElement(_tmpl$18),
2403
+ _el$60 = _el$59.firstChild,
2404
+ _el$61 = _el$60.nextSibling;
2405
+ _$insert(_el$61, () => messages().loading);
2406
+ return _el$59;
1917
2407
  }
1918
- }), _el$61, _co$0);
1919
- _$insert(_el$48, _$createComponent(Show, {
2408
+ }), _el$71, _co$1);
2409
+ _$insert(_el$58, _$createComponent(Show, {
1920
2410
  get when() {
1921
2411
  return searchError();
1922
2412
  },
1923
2413
  get children() {
1924
- var _el$52 = _$getNextElement(_tmpl$17),
1925
- _el$53 = _el$52.firstChild,
1926
- _el$54 = _el$53.nextSibling,
1927
- _el$55 = _el$54.nextSibling,
1928
- [_el$56, _co$8] = _$getNextMarker(_el$55.nextSibling);
1929
- _$insert(_el$52, () => messages().error, _el$56, _co$8);
1930
- return _el$52;
2414
+ var _el$62 = _$getNextElement(_tmpl$19),
2415
+ _el$63 = _el$62.firstChild,
2416
+ _el$64 = _el$63.nextSibling,
2417
+ _el$65 = _el$64.nextSibling,
2418
+ [_el$66, _co$9] = _$getNextMarker(_el$65.nextSibling);
2419
+ _$insert(_el$62, () => messages().error, _el$66, _co$9);
2420
+ return _el$62;
1931
2421
  }
1932
- }), _el$63, _co$1);
1933
- _$insert(_el$48, _$createComponent(Show, {
2422
+ }), _el$73, _co$10);
2423
+ _$insert(_el$58, _$createComponent(Show, {
1934
2424
  get when() {
1935
- return _$memo(() => !!(!searching() && !searchError()))() && foundCommandCount() === 0;
2425
+ return _$memo(() => !!(!searching() && !searchError() && foundCommandCount() === 0))() && !commandModel().groups.some(group => group.pendingRows);
1936
2426
  },
1937
2427
  get children() {
1938
- var _el$57 = _$getNextElement(_tmpl$18);
1939
- _$insert(_el$57, (() => {
2428
+ var _el$67 = _$getNextElement(_tmpl$20);
2429
+ _$insert(_el$67, (() => {
1940
2430
  var _c$ = _$memo(() => !!!parsedCommandQuery().query.trim());
1941
2431
  return () => _c$() ? messages().noResults : chatMessages().commandsNothingFound({
1942
2432
  query: parsedCommandQuery().query.trim()
1943
2433
  });
1944
2434
  })());
1945
- return _el$57;
2435
+ return _el$67;
1946
2436
  }
1947
- }), _el$65, _co$10);
1948
- _$insert(_el$48, _$createComponent(Show, {
2437
+ }), _el$75, _co$11);
2438
+ _$insert(_el$58, _$createComponent(Show, {
1949
2439
  get when() {
1950
2440
  return commandModel().fallback?.command;
1951
2441
  },
1952
2442
  keyed: true,
1953
2443
  children: command => renderCommandRow(command)
1954
- }), _el$67, _co$11);
2444
+ }), _el$77, _co$12);
1955
2445
  _$effect(_p$ => {
1956
- var _v$19 = chatMessages().commands,
1957
- _v$20 = searching() ? "true" : undefined;
1958
- _v$19 !== _p$.e && _$setAttribute(_el$48, "aria-label", _p$.e = _v$19);
1959
- _v$20 !== _p$.t && _$setAttribute(_el$48, "aria-busy", _p$.t = _v$20);
2446
+ var _v$28 = addSearch() ? "" : undefined,
2447
+ _v$29 = chatMessages().commands,
2448
+ _v$30 = searching() ? "true" : undefined;
2449
+ _v$28 !== _p$.e && _$setAttribute(_el$54, "data-search", _p$.e = _v$28);
2450
+ _v$29 !== _p$.t && _$setAttribute(_el$58, "aria-label", _p$.t = _v$29);
2451
+ _v$30 !== _p$.a && _$setAttribute(_el$58, "aria-busy", _p$.a = _v$30);
1960
2452
  return _p$;
1961
2453
  }, {
1962
2454
  e: undefined,
1963
- t: undefined
2455
+ t: undefined,
2456
+ a: undefined
1964
2457
  });
1965
- return _el$47;
2458
+ _$runHydrationEvents();
2459
+ return _el$54;
1966
2460
  }
1967
- }), _el$71, _co$13);
2461
+ }), _el$83, _co$15);
1968
2462
  _$effect(_p$ => {
1969
- var _v$21 = hasAccessory() ? undefined : "true",
1970
- _v$22 = suggestionsOpen() ? "hidden" : undefined,
1971
- _v$23 = suggestionsOpen();
1972
- _v$21 !== _p$.e && _$setAttribute(_el$43, "data-overlay", _p$.e = _v$21);
1973
- _v$22 !== _p$.t && _$setStyleProperty(_el$44, "visibility", _p$.t = _v$22);
1974
- _v$23 !== _p$.a && _$setProperty(_el$44, "inert", _p$.a = _v$23);
2463
+ var _v$31 = hasAccessory() ? undefined : "true",
2464
+ _v$32 = suggestionsOpen() ? "hidden" : undefined,
2465
+ _v$33 = suggestionsOpen();
2466
+ _v$31 !== _p$.e && _$setAttribute(_el$50, "data-overlay", _p$.e = _v$31);
2467
+ _v$32 !== _p$.t && _$setStyleProperty(_el$51, "visibility", _p$.t = _v$32);
2468
+ _v$33 !== _p$.a && _$setProperty(_el$51, "inert", _p$.a = _v$33);
1975
2469
  return _p$;
1976
2470
  }, {
1977
2471
  e: undefined,
1978
2472
  t: undefined,
1979
2473
  a: undefined
1980
2474
  });
1981
- return _el$43;
2475
+ return _el$50;
1982
2476
  }
1983
- }), _el$111, _co$28);
1984
- var _ref$9 = composerRef;
1985
- typeof _ref$9 === "function" ? _$use(_ref$9, _el$72) : composerRef = _el$72;
1986
- _$insert(_el$72, _$createComponent(Show, {
2477
+ }), _el$123, _co$30);
2478
+ var _ref$1 = composerRef;
2479
+ typeof _ref$1 === "function" ? _$use(_ref$1, _el$84) : composerRef = _el$84;
2480
+ _$insert(_el$84, _$createComponent(Show, {
1987
2481
  get when() {
1988
2482
  return showHint();
1989
2483
  },
1990
2484
  get children() {
1991
- var _el$73 = _$getNextElement(_tmpl$21);
1992
- _$insert(_el$73, _$createComponent(Show, {
2485
+ var _el$85 = _$getNextElement(_tmpl$23);
2486
+ _$insert(_el$85, _$createComponent(Show, {
1993
2487
  get when() {
1994
2488
  return dictationStatus();
1995
2489
  },
1996
2490
  get fallback() {
1997
2491
  return (() => {
1998
- var _el$133 = _$getNextElement(_tmpl$31);
1999
- _$insert(_el$133, hint);
2000
- return _el$133;
2492
+ var _el$145 = _$getNextElement(_tmpl$33);
2493
+ _$insert(_el$145, hint);
2494
+ return _el$145;
2001
2495
  })();
2002
2496
  },
2003
2497
  children: status => [(() => {
2004
- var _el$134 = _$getNextElement(_tmpl$32),
2005
- _el$135 = _el$134.firstChild,
2006
- _el$136 = _el$135.nextSibling;
2007
- _$insert(_el$136, () => status().text);
2498
+ var _el$146 = _$getNextElement(_tmpl$34),
2499
+ _el$147 = _el$146.firstChild,
2500
+ _el$148 = _el$147.nextSibling;
2501
+ _$insert(_el$148, () => status().text);
2008
2502
  _$effect(_p$ => {
2009
- var _v$34 = dictation() ?? undefined,
2010
- _v$35 = status().icon;
2011
- _v$34 !== _p$.e && _$setAttribute(_el$134, "data-state", _p$.e = _v$34);
2012
- _v$35 !== _p$.t && _$className(_el$135, _p$.t = _v$35);
2503
+ var _v$44 = dictation() ?? undefined,
2504
+ _v$45 = status().icon;
2505
+ _v$44 !== _p$.e && _$setAttribute(_el$146, "data-state", _p$.e = _v$44);
2506
+ _v$45 !== _p$.t && _$className(_el$147, _p$.t = _v$45);
2013
2507
  return _p$;
2014
2508
  }, {
2015
2509
  e: undefined,
2016
2510
  t: undefined
2017
2511
  });
2018
- return _el$134;
2512
+ return _el$146;
2019
2513
  })(), _$createComponent(Show, {
2020
2514
  get when() {
2021
2515
  return _$memo(() => dictation() === "refined")() ? props.microphone?.onRestoreOriginal : undefined;
2022
2516
  },
2023
2517
  children: restore => (() => {
2024
- var _el$137 = _$getNextElement(_tmpl$33);
2025
- _el$137.$$click = () => reportChatFailure(restore(), props.onError);
2026
- _el$137.$$mousedown = keepFieldFocus;
2027
- _$insert(_el$137, () => chatMessages().restoreOriginal);
2028
- _$effect(() => _$setProperty(_el$137, "disabled", microphoneDisabled()));
2518
+ var _el$149 = _$getNextElement(_tmpl$35);
2519
+ _el$149.$$click = () => reportChatFailure(restore(), props.onError);
2520
+ _el$149.$$mousedown = keepFieldFocus;
2521
+ _$insert(_el$149, () => chatMessages().restoreOriginal);
2522
+ _$effect(() => _$setProperty(_el$149, "disabled", microphoneDisabled()));
2029
2523
  _$runHydrationEvents();
2030
- return _el$137;
2524
+ return _el$149;
2031
2525
  })()
2032
2526
  })]
2033
2527
  }));
2034
- return _el$73;
2528
+ return _el$85;
2035
2529
  }
2036
- }), _el$97, _co$22);
2037
- _$insert(_el$72, _$createComponent(Show, {
2530
+ }), _el$109, _co$24);
2531
+ _$insert(_el$84, _$createComponent(Show, {
2038
2532
  get when() {
2039
2533
  return attachments().length > 0;
2040
2534
  },
2041
2535
  get children() {
2042
- var _el$74 = _$getNextElement(_tmpl$22);
2043
- _$insert(_el$74, _$createComponent(For, {
2536
+ var _el$86 = _$getNextElement(_tmpl$24);
2537
+ _$insert(_el$86, _$createComponent(For, {
2044
2538
  get each() {
2045
2539
  return attachments();
2046
2540
  },
2047
2541
  children: attachment => (() => {
2048
- var _el$138 = _$getNextElement(_tmpl$35),
2049
- _el$139 = _el$138.firstChild,
2050
- _el$140 = _el$139.firstChild,
2051
- [_el$141, _co$34] = _$getNextMarker(_el$140.nextSibling),
2052
- _el$142 = _el$141.nextSibling,
2053
- [_el$143, _co$35] = _$getNextMarker(_el$142.nextSibling),
2054
- _el$145 = _el$139.nextSibling,
2055
- [_el$146, _co$36] = _$getNextMarker(_el$145.nextSibling);
2056
- _$insert(_el$139, _$createComponent(Show, {
2542
+ var _el$150 = _$getNextElement(_tmpl$37),
2543
+ _el$151 = _el$150.firstChild,
2544
+ _el$152 = _el$151.firstChild,
2545
+ [_el$153, _co$36] = _$getNextMarker(_el$152.nextSibling),
2546
+ _el$154 = _el$153.nextSibling,
2547
+ [_el$155, _co$37] = _$getNextMarker(_el$154.nextSibling),
2548
+ _el$157 = _el$151.nextSibling,
2549
+ [_el$158, _co$38] = _$getNextMarker(_el$157.nextSibling);
2550
+ _$insert(_el$151, _$createComponent(Show, {
2057
2551
  get when() {
2058
2552
  return attachment.href;
2059
2553
  },
2060
2554
  get fallback() {
2061
2555
  return (() => {
2062
- var _el$147 = _$getNextElement(_tmpl$37),
2063
- _el$149 = _el$147.firstChild,
2064
- [_el$150, _co$37] = _$getNextMarker(_el$149.nextSibling),
2065
- _el$151 = _el$150.nextSibling,
2066
- [_el$152, _co$38] = _$getNextMarker(_el$151.nextSibling);
2067
- _$insert(_el$147, _$createComponent(Show, {
2556
+ var _el$159 = _$getNextElement(_tmpl$39),
2557
+ _el$161 = _el$159.firstChild,
2558
+ [_el$162, _co$39] = _$getNextMarker(_el$161.nextSibling),
2559
+ _el$163 = _el$162.nextSibling,
2560
+ [_el$164, _co$40] = _$getNextMarker(_el$163.nextSibling);
2561
+ _$insert(_el$159, _$createComponent(Show, {
2068
2562
  get when() {
2069
2563
  return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
2070
2564
  },
2071
2565
  get fallback() {
2072
2566
  return (() => {
2073
- var _el$153 = _$getNextElement(_tmpl$3);
2074
- _$effect(() => _$className(_el$153, attachmentIcon(attachment)));
2075
- return _el$153;
2567
+ var _el$165 = _$getNextElement(_tmpl$3);
2568
+ _$effect(() => _$className(_el$165, attachmentIcon(attachment)));
2569
+ return _el$165;
2076
2570
  })();
2077
2571
  },
2078
2572
  get children() {
2079
- var _el$148 = _$getNextElement(_tmpl$36);
2573
+ var _el$160 = _$getNextElement(_tmpl$38);
2080
2574
  _$effect(_p$ => {
2081
- var _v$38 = attachment.previewUrl,
2082
- _v$39 = attachment.alt ?? "";
2083
- _v$38 !== _p$.e && _$setAttribute(_el$148, "src", _p$.e = _v$38);
2084
- _v$39 !== _p$.t && _$setAttribute(_el$148, "alt", _p$.t = _v$39);
2575
+ var _v$48 = attachment.previewUrl,
2576
+ _v$49 = attachment.alt ?? "";
2577
+ _v$48 !== _p$.e && _$setAttribute(_el$160, "src", _p$.e = _v$48);
2578
+ _v$49 !== _p$.t && _$setAttribute(_el$160, "alt", _p$.t = _v$49);
2085
2579
  return _p$;
2086
2580
  }, {
2087
2581
  e: undefined,
2088
2582
  t: undefined
2089
2583
  });
2090
- return _el$148;
2584
+ return _el$160;
2091
2585
  }
2092
- }), _el$150, _co$37);
2093
- _$insert(_el$147, () => renderAttachmentCopy(attachment), _el$152, _co$38);
2094
- return _el$147;
2586
+ }), _el$162, _co$39);
2587
+ _$insert(_el$159, () => renderAttachmentCopy(attachment), _el$164, _co$40);
2588
+ return _el$159;
2095
2589
  })();
2096
2590
  },
2097
2591
  children: href => (() => {
2098
- var _el$154 = _$getNextElement(_tmpl$38),
2099
- _el$156 = _el$154.firstChild,
2100
- [_el$157, _co$39] = _$getNextMarker(_el$156.nextSibling),
2101
- _el$158 = _el$157.nextSibling,
2102
- [_el$159, _co$40] = _$getNextMarker(_el$158.nextSibling);
2103
- _$insert(_el$154, _$createComponent(Show, {
2592
+ var _el$166 = _$getNextElement(_tmpl$40),
2593
+ _el$168 = _el$166.firstChild,
2594
+ [_el$169, _co$41] = _$getNextMarker(_el$168.nextSibling),
2595
+ _el$170 = _el$169.nextSibling,
2596
+ [_el$171, _co$42] = _$getNextMarker(_el$170.nextSibling);
2597
+ _$insert(_el$166, _$createComponent(Show, {
2104
2598
  get when() {
2105
2599
  return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
2106
2600
  },
2107
2601
  get fallback() {
2108
2602
  return (() => {
2109
- var _el$160 = _$getNextElement(_tmpl$3);
2110
- _$effect(() => _$className(_el$160, attachmentIcon(attachment)));
2111
- return _el$160;
2603
+ var _el$172 = _$getNextElement(_tmpl$3);
2604
+ _$effect(() => _$className(_el$172, attachmentIcon(attachment)));
2605
+ return _el$172;
2112
2606
  })();
2113
2607
  },
2114
2608
  get children() {
2115
- var _el$155 = _$getNextElement(_tmpl$36);
2609
+ var _el$167 = _$getNextElement(_tmpl$38);
2116
2610
  _$effect(_p$ => {
2117
- var _v$40 = attachment.previewUrl,
2118
- _v$41 = attachment.alt ?? "";
2119
- _v$40 !== _p$.e && _$setAttribute(_el$155, "src", _p$.e = _v$40);
2120
- _v$41 !== _p$.t && _$setAttribute(_el$155, "alt", _p$.t = _v$41);
2611
+ var _v$50 = attachment.previewUrl,
2612
+ _v$51 = attachment.alt ?? "";
2613
+ _v$50 !== _p$.e && _$setAttribute(_el$167, "src", _p$.e = _v$50);
2614
+ _v$51 !== _p$.t && _$setAttribute(_el$167, "alt", _p$.t = _v$51);
2121
2615
  return _p$;
2122
2616
  }, {
2123
2617
  e: undefined,
2124
2618
  t: undefined
2125
2619
  });
2126
- return _el$155;
2620
+ return _el$167;
2127
2621
  }
2128
- }), _el$157, _co$39);
2129
- _$insert(_el$154, () => renderAttachmentCopy(attachment), _el$159, _co$40);
2622
+ }), _el$169, _co$41);
2623
+ _$insert(_el$166, () => renderAttachmentCopy(attachment), _el$171, _co$42);
2130
2624
  _$effect(_p$ => {
2131
- var _v$42 = href(),
2132
- _v$43 = chatMessages().openInNewTab({
2625
+ var _v$52 = href(),
2626
+ _v$53 = chatMessages().openInNewTab({
2133
2627
  name: attachment.name
2134
2628
  });
2135
- _v$42 !== _p$.e && _$setAttribute(_el$154, "href", _p$.e = _v$42);
2136
- _v$43 !== _p$.t && _$setAttribute(_el$154, "aria-label", _p$.t = _v$43);
2629
+ _v$52 !== _p$.e && _$setAttribute(_el$166, "href", _p$.e = _v$52);
2630
+ _v$53 !== _p$.t && _$setAttribute(_el$166, "aria-label", _p$.t = _v$53);
2137
2631
  return _p$;
2138
2632
  }, {
2139
2633
  e: undefined,
2140
2634
  t: undefined
2141
2635
  });
2142
- return _el$154;
2636
+ return _el$166;
2143
2637
  })()
2144
- }), _el$141, _co$34);
2145
- _$insert(_el$139, _$createComponent(Show, {
2638
+ }), _el$153, _co$36);
2639
+ _$insert(_el$151, _$createComponent(Show, {
2146
2640
  get when() {
2147
2641
  return attachment.action;
2148
2642
  },
2149
2643
  children: action => (() => {
2150
- var _el$161 = _$getNextElement(_tmpl$39),
2151
- _el$162 = _el$161.firstChild,
2152
- [_el$163, _co$41] = _$getNextMarker(_el$162.nextSibling),
2153
- _el$164 = _el$163.nextSibling,
2154
- [_el$165, _co$42] = _$getNextMarker(_el$164.nextSibling);
2155
- _el$161.$$click = () => reportChatFailure(() => executeChatAction(action()), props.onError);
2156
- _$insert(_el$161, _$createComponent(Show, {
2644
+ var _el$173 = _$getNextElement(_tmpl$41),
2645
+ _el$174 = _el$173.firstChild,
2646
+ [_el$175, _co$43] = _$getNextMarker(_el$174.nextSibling),
2647
+ _el$176 = _el$175.nextSibling,
2648
+ [_el$177, _co$44] = _$getNextMarker(_el$176.nextSibling);
2649
+ _el$173.$$click = () => reportChatFailure(() => executeChatAction(action()), props.onError);
2650
+ _$insert(_el$173, _$createComponent(Show, {
2157
2651
  get when() {
2158
2652
  return action().icon;
2159
2653
  },
2160
2654
  children: icon => (() => {
2161
- var _el$166 = _$getNextElement(_tmpl$3);
2162
- _$effect(() => _$className(_el$166, icon()));
2163
- return _el$166;
2655
+ var _el$178 = _$getNextElement(_tmpl$3);
2656
+ _$effect(() => _$className(_el$178, icon()));
2657
+ return _el$178;
2164
2658
  })()
2165
- }), _el$163, _co$41);
2166
- _$insert(_el$161, () => action().label, _el$165, _co$42);
2167
- _$effect(() => _$setProperty(_el$161, "disabled", blocked() || action().disabled));
2659
+ }), _el$175, _co$43);
2660
+ _$insert(_el$173, () => action().label, _el$177, _co$44);
2661
+ _$effect(() => _$setProperty(_el$173, "disabled", blocked() || action().disabled));
2168
2662
  _$runHydrationEvents();
2169
- return _el$161;
2663
+ return _el$173;
2170
2664
  })()
2171
- }), _el$143, _co$35);
2172
- _$insert(_el$138, _$createComponent(Show, {
2665
+ }), _el$155, _co$37);
2666
+ _$insert(_el$150, _$createComponent(Show, {
2173
2667
  get when() {
2174
2668
  return props.onAttachmentsChange;
2175
2669
  },
2176
2670
  get children() {
2177
- var _el$144 = _$getNextElement(_tmpl$34);
2178
- _el$144.$$click = () => setAttachments(attachments().filter(candidate => candidate.id !== attachment.id));
2671
+ var _el$156 = _$getNextElement(_tmpl$36);
2672
+ _el$156.$$click = () => setAttachments(attachments().filter(candidate => candidate.id !== attachment.id));
2179
2673
  _$effect(_p$ => {
2180
- var _v$36 = selectMessages().removeNamed({
2674
+ var _v$46 = selectMessages().removeNamed({
2181
2675
  name: attachment.name
2182
2676
  }),
2183
- _v$37 = blocked();
2184
- _v$36 !== _p$.e && _$setAttribute(_el$144, "aria-label", _p$.e = _v$36);
2185
- _v$37 !== _p$.t && _$setProperty(_el$144, "disabled", _p$.t = _v$37);
2677
+ _v$47 = blocked();
2678
+ _v$46 !== _p$.e && _$setAttribute(_el$156, "aria-label", _p$.e = _v$46);
2679
+ _v$47 !== _p$.t && _$setProperty(_el$156, "disabled", _p$.t = _v$47);
2186
2680
  return _p$;
2187
2681
  }, {
2188
2682
  e: undefined,
2189
2683
  t: undefined
2190
2684
  });
2191
2685
  _$runHydrationEvents();
2192
- return _el$144;
2686
+ return _el$156;
2193
2687
  }
2194
- }), _el$146, _co$36);
2195
- _$effect(() => _el$139.classList.toggle("k2b-chat-composer__attachment-content--action", !!Boolean(attachment.action)));
2196
- return _el$138;
2688
+ }), _el$158, _co$38);
2689
+ _$effect(() => _el$151.classList.toggle("k2b-chat-composer__attachment-content--action", !!Boolean(attachment.action)));
2690
+ return _el$150;
2197
2691
  })()
2198
2692
  }));
2199
- _$effect(() => _$setAttribute(_el$74, "aria-label", chatMessages().attachments));
2200
- return _el$74;
2693
+ _$effect(() => _$setAttribute(_el$86, "aria-label", chatMessages().attachments));
2694
+ return _el$86;
2201
2695
  }
2202
- }), _el$99, _co$23);
2203
- _$insert(_el$72, _$createComponent(Show, {
2696
+ }), _el$111, _co$25);
2697
+ _$insert(_el$84, _$createComponent(Show, {
2204
2698
  get when() {
2205
2699
  return conversation();
2206
2700
  },
@@ -2210,49 +2704,59 @@ export function ChatComposer(props) {
2210
2704
  return props.error;
2211
2705
  },
2212
2706
  get children() {
2213
- var _el$167 = _$getNextElement(_tmpl$23),
2214
- _el$168 = _el$167.firstChild,
2215
- _el$169 = _el$168.nextSibling,
2216
- [_el$170, _co$43] = _$getNextMarker(_el$169.nextSibling);
2217
- _$insert(_el$167, () => props.error, _el$170, _co$43);
2218
- return _el$167;
2707
+ var _el$179 = _$getNextElement(_tmpl$25),
2708
+ _el$180 = _el$179.firstChild,
2709
+ _el$181 = _el$180.nextSibling,
2710
+ [_el$182, _co$45] = _$getNextMarker(_el$181.nextSibling);
2711
+ _$insert(_el$179, () => props.error, _el$182, _co$45);
2712
+ return _el$179;
2219
2713
  }
2220
2714
  }), _$memo(formatRow), (() => {
2221
- var _el$171 = _$getNextElement(_tmpl$40);
2222
- _$insert(_el$171, _$createComponent(Show, {
2715
+ var _el$183 = _$getNextElement(_tmpl$42);
2716
+ _$insert(_el$183, _$createComponent(Show, {
2223
2717
  get when() {
2224
2718
  return footer();
2225
2719
  },
2226
2720
  get fallback() {
2227
2721
  return [(() => {
2228
- var _el$172 = _$getNextElement(_tmpl$41),
2229
- _el$173 = _el$172.firstChild,
2230
- [_el$174, _co$44] = _$getNextMarker(_el$173.nextSibling),
2231
- _el$175 = _el$174.nextSibling,
2232
- [_el$176, _co$45] = _$getNextMarker(_el$175.nextSibling),
2233
- _el$177 = _el$176.nextSibling,
2234
- [_el$178, _co$46] = _$getNextMarker(_el$177.nextSibling),
2235
- _el$179 = _el$178.nextSibling,
2236
- [_el$180, _co$47] = _$getNextMarker(_el$179.nextSibling),
2237
- _el$181 = _el$180.nextSibling,
2238
- [_el$182, _co$48] = _$getNextMarker(_el$181.nextSibling),
2239
- _el$183 = _el$182.nextSibling,
2240
- [_el$184, _co$49] = _$getNextMarker(_el$183.nextSibling),
2241
- _el$185 = _el$184.nextSibling,
2242
- [_el$186, _co$50] = _$getNextMarker(_el$185.nextSibling);
2243
- _$insert(_el$172, () => props.footerTools, _el$174, _co$44);
2244
- _$insert(_el$172, _$createComponent(Show, {
2722
+ var _el$184 = _$getNextElement(_tmpl$43),
2723
+ _el$185 = _el$184.firstChild,
2724
+ [_el$186, _co$46] = _$getNextMarker(_el$185.nextSibling),
2725
+ _el$187 = _el$186.nextSibling,
2726
+ [_el$188, _co$47] = _$getNextMarker(_el$187.nextSibling),
2727
+ _el$189 = _el$188.nextSibling,
2728
+ [_el$190, _co$48] = _$getNextMarker(_el$189.nextSibling),
2729
+ _el$191 = _el$190.nextSibling,
2730
+ [_el$192, _co$49] = _$getNextMarker(_el$191.nextSibling),
2731
+ _el$193 = _el$192.nextSibling,
2732
+ [_el$194, _co$50] = _$getNextMarker(_el$193.nextSibling),
2733
+ _el$195 = _el$194.nextSibling,
2734
+ [_el$196, _co$51] = _$getNextMarker(_el$195.nextSibling),
2735
+ _el$197 = _el$196.nextSibling,
2736
+ [_el$198, _co$52] = _$getNextMarker(_el$197.nextSibling);
2737
+ _$insert(_el$184, () => props.footerTools, _el$186, _co$46);
2738
+ _$insert(_el$184, _$createComponent(Show, {
2245
2739
  get when() {
2246
- return hasAddMenu();
2740
+ return addOpensCommands();
2741
+ },
2742
+ get fallback() {
2743
+ return _$createComponent(Show, {
2744
+ get when() {
2745
+ return hasAddMenu();
2746
+ },
2747
+ get children() {
2748
+ return addMenu("ti ti-plus");
2749
+ }
2750
+ });
2247
2751
  },
2248
2752
  get children() {
2249
- return addMenu("ti ti-plus");
2753
+ return addSearchButton();
2250
2754
  }
2251
- }), _el$176, _co$45);
2252
- _$insert(_el$172, fileInput, _el$178, _co$46);
2253
- _$insert(_el$172, formatToggle, _el$180, _co$47);
2254
- _$insert(_el$172, emojiButton, _el$182, _co$48);
2255
- _$insert(_el$172, _$createComponent(Show, {
2755
+ }), _el$188, _co$47);
2756
+ _$insert(_el$184, fileInput, _el$190, _co$48);
2757
+ _$insert(_el$184, formatToggle, _el$192, _co$49);
2758
+ _$insert(_el$184, emojiButton, _el$194, _co$50);
2759
+ _$insert(_el$184, _$createComponent(Show, {
2256
2760
  get when() {
2257
2761
  return (props.models?.length ?? 0) > 0;
2258
2762
  },
@@ -2298,22 +2802,22 @@ export function ChatComposer(props) {
2298
2802
  }
2299
2803
  });
2300
2804
  }
2301
- }), _el$184, _co$49);
2302
- _$insert(_el$172, () => props.modelDetails, _el$186, _co$50);
2303
- return _el$172;
2805
+ }), _el$196, _co$51);
2806
+ _$insert(_el$184, () => props.modelDetails, _el$198, _co$52);
2807
+ return _el$184;
2304
2808
  })(), (() => {
2305
- var _el$187 = _$getNextElement(_tmpl$42),
2306
- _el$188 = _el$187.firstChild,
2307
- [_el$189, _co$51] = _$getNextMarker(_el$188.nextSibling),
2308
- _el$190 = _el$189.nextSibling,
2309
- [_el$191, _co$52] = _$getNextMarker(_el$190.nextSibling),
2310
- _el$192 = _el$191.nextSibling,
2311
- [_el$193, _co$53] = _$getNextMarker(_el$192.nextSibling),
2312
- _el$194 = _el$193.nextSibling,
2313
- [_el$195, _co$54] = _$getNextMarker(_el$194.nextSibling),
2314
- _el$196 = _el$195.nextSibling,
2315
- [_el$197, _co$55] = _$getNextMarker(_el$196.nextSibling);
2316
- _$insert(_el$187, _$createComponent(For, {
2809
+ var _el$199 = _$getNextElement(_tmpl$44),
2810
+ _el$200 = _el$199.firstChild,
2811
+ [_el$201, _co$53] = _$getNextMarker(_el$200.nextSibling),
2812
+ _el$202 = _el$201.nextSibling,
2813
+ [_el$203, _co$54] = _$getNextMarker(_el$202.nextSibling),
2814
+ _el$204 = _el$203.nextSibling,
2815
+ [_el$205, _co$55] = _$getNextMarker(_el$204.nextSibling),
2816
+ _el$206 = _el$205.nextSibling,
2817
+ [_el$207, _co$56] = _$getNextMarker(_el$206.nextSibling),
2818
+ _el$208 = _el$207.nextSibling,
2819
+ [_el$209, _co$57] = _$getNextMarker(_el$208.nextSibling);
2820
+ _$insert(_el$199, _$createComponent(For, {
2317
2821
  get each() {
2318
2822
  return props.contextActions;
2319
2823
  },
@@ -2337,13 +2841,13 @@ export function ChatComposer(props) {
2337
2841
  },
2338
2842
  onClick: () => reportChatFailure(() => executeChatAction(action), props.onError),
2339
2843
  get children() {
2340
- var _el$198 = _$getNextElement(_tmpl$3);
2341
- _$effect(() => _$className(_el$198, action.icon ?? "ti ti-dots"));
2342
- return _el$198;
2844
+ var _el$210 = _$getNextElement(_tmpl$3);
2845
+ _$effect(() => _$className(_el$210, action.icon ?? "ti ti-dots"));
2846
+ return _el$210;
2343
2847
  }
2344
2848
  })
2345
- }), _el$189, _co$51);
2346
- _$insert(_el$187, _$createComponent(Show, {
2849
+ }), _el$201, _co$53);
2850
+ _$insert(_el$199, _$createComponent(Show, {
2347
2851
  get when() {
2348
2852
  return _$memo(() => !!hasContextUsage())() ? props.contextUsage ?? {} : undefined;
2349
2853
  },
@@ -2355,18 +2859,18 @@ export function ChatComposer(props) {
2355
2859
  return props.onError;
2356
2860
  }
2357
2861
  }))
2358
- }), _el$191, _co$52);
2359
- _$insert(_el$187, () => props.submitTools, _el$193, _co$53);
2360
- _$insert(_el$187, microphoneControl, _el$195, _co$54);
2361
- _$insert(_el$187, sendControl, _el$197, _co$55);
2362
- return _el$187;
2862
+ }), _el$203, _co$54);
2863
+ _$insert(_el$199, () => props.submitTools, _el$205, _co$55);
2864
+ _$insert(_el$199, microphoneControl, _el$207, _co$56);
2865
+ _$insert(_el$199, sendControl, _el$209, _co$57);
2866
+ return _el$199;
2363
2867
  })()];
2364
2868
  },
2365
2869
  get children() {
2366
2870
  return footer();
2367
2871
  }
2368
2872
  }));
2369
- return _el$171;
2873
+ return _el$183;
2370
2874
  })()];
2371
2875
  },
2372
2876
  get children() {
@@ -2375,43 +2879,43 @@ export function ChatComposer(props) {
2375
2879
  return props.error;
2376
2880
  },
2377
2881
  get children() {
2378
- var _el$75 = _$getNextElement(_tmpl$23),
2379
- _el$76 = _el$75.firstChild,
2380
- _el$77 = _el$76.nextSibling,
2381
- [_el$78, _co$14] = _$getNextMarker(_el$77.nextSibling);
2382
- _$insert(_el$75, () => props.error, _el$78, _co$14);
2383
- return _el$75;
2882
+ var _el$87 = _$getNextElement(_tmpl$25),
2883
+ _el$88 = _el$87.firstChild,
2884
+ _el$89 = _el$88.nextSibling,
2885
+ [_el$90, _co$16] = _$getNextMarker(_el$89.nextSibling);
2886
+ _$insert(_el$87, () => props.error, _el$90, _co$16);
2887
+ return _el$87;
2384
2888
  }
2385
2889
  }), _$memo(() => formatRow()), (() => {
2386
- var _el$79 = _$getNextElement(_tmpl$24),
2387
- _el$90 = _el$79.firstChild,
2388
- [_el$91, _co$19] = _$getNextMarker(_el$90.nextSibling),
2389
- _el$92 = _el$91.nextSibling,
2390
- [_el$93, _co$20] = _$getNextMarker(_el$92.nextSibling),
2391
- _el$80 = _el$93.nextSibling,
2392
- _el$88 = _el$80.firstChild,
2393
- [_el$89, _co$18] = _$getNextMarker(_el$88.nextSibling),
2394
- _el$81 = _el$89.nextSibling,
2395
- _el$82 = _el$81.firstChild,
2396
- [_el$83, _co$15] = _$getNextMarker(_el$82.nextSibling),
2397
- _el$84 = _el$83.nextSibling,
2398
- [_el$85, _co$16] = _$getNextMarker(_el$84.nextSibling),
2399
- _el$86 = _el$85.nextSibling,
2400
- [_el$87, _co$17] = _$getNextMarker(_el$86.nextSibling),
2401
- _el$94 = _el$80.nextSibling,
2402
- [_el$95, _co$21] = _$getNextMarker(_el$94.nextSibling);
2403
- _$insert(_el$79, attachControl, _el$91, _co$19);
2404
- _$insert(_el$79, fileInput, _el$93, _co$20);
2405
- _$insert(_el$80, field, _el$89, _co$18);
2406
- _$insert(_el$81, formatToggle, _el$83, _co$15);
2407
- _$insert(_el$81, emojiButton, _el$85, _co$16);
2408
- _$insert(_el$81, microphoneControl, _el$87, _co$17);
2409
- _$insert(_el$79, sendControl, _el$95, _co$21);
2410
- return _el$79;
2890
+ var _el$91 = _$getNextElement(_tmpl$26),
2891
+ _el$102 = _el$91.firstChild,
2892
+ [_el$103, _co$21] = _$getNextMarker(_el$102.nextSibling),
2893
+ _el$104 = _el$103.nextSibling,
2894
+ [_el$105, _co$22] = _$getNextMarker(_el$104.nextSibling),
2895
+ _el$92 = _el$105.nextSibling,
2896
+ _el$100 = _el$92.firstChild,
2897
+ [_el$101, _co$20] = _$getNextMarker(_el$100.nextSibling),
2898
+ _el$93 = _el$101.nextSibling,
2899
+ _el$94 = _el$93.firstChild,
2900
+ [_el$95, _co$17] = _$getNextMarker(_el$94.nextSibling),
2901
+ _el$96 = _el$95.nextSibling,
2902
+ [_el$97, _co$18] = _$getNextMarker(_el$96.nextSibling),
2903
+ _el$98 = _el$97.nextSibling,
2904
+ [_el$99, _co$19] = _$getNextMarker(_el$98.nextSibling),
2905
+ _el$106 = _el$92.nextSibling,
2906
+ [_el$107, _co$23] = _$getNextMarker(_el$106.nextSibling);
2907
+ _$insert(_el$91, attachControl, _el$103, _co$21);
2908
+ _$insert(_el$91, fileInput, _el$105, _co$22);
2909
+ _$insert(_el$92, field, _el$101, _co$20);
2910
+ _$insert(_el$93, formatToggle, _el$95, _co$17);
2911
+ _$insert(_el$93, emojiButton, _el$97, _co$18);
2912
+ _$insert(_el$93, microphoneControl, _el$99, _co$19);
2913
+ _$insert(_el$91, sendControl, _el$107, _co$23);
2914
+ return _el$91;
2411
2915
  })()];
2412
2916
  }
2413
- }), _el$101, _co$24);
2414
- _$insert(_el$72, _$createComponent(Show, {
2917
+ }), _el$113, _co$26);
2918
+ _$insert(_el$84, _$createComponent(Show, {
2415
2919
  get when() {
2416
2920
  return props.fileSelection;
2417
2921
  },
@@ -2430,60 +2934,60 @@ export function ChatComposer(props) {
2430
2934
  },
2431
2935
  onDrop: files => void runFiles(files)
2432
2936
  })
2433
- }), _el$103, _co$25);
2434
- _$insert(_el$104, _$createComponent(Show, {
2937
+ }), _el$115, _co$27);
2938
+ _$insert(_el$116, _$createComponent(Show, {
2435
2939
  get when() {
2436
2940
  return suggestionAnnouncement();
2437
2941
  },
2438
2942
  keyed: true,
2439
2943
  children: announced => (() => {
2440
- var _el$199 = _$getNextElement(_tmpl$10);
2441
- _$insert(_el$199, () => announced.text);
2442
- return _el$199;
2944
+ var _el$211 = _$getNextElement(_tmpl$10);
2945
+ _$insert(_el$211, () => announced.text);
2946
+ return _el$211;
2443
2947
  })()
2444
2948
  }));
2445
- _$insert(_el$105, _$createComponent(Show, {
2949
+ _$insert(_el$117, _$createComponent(Show, {
2446
2950
  get when() {
2447
2951
  return _$memo(() => !!!suggestionsOpen())() && commandStatus();
2448
2952
  },
2449
2953
  children: status => (() => {
2450
- var _el$200 = _$getNextElement(_tmpl$43),
2451
- _el$201 = _el$200.firstChild,
2452
- _el$202 = _el$201.nextSibling;
2453
- _$insert(_el$202, () => status().text);
2954
+ var _el$212 = _$getNextElement(_tmpl$45),
2955
+ _el$213 = _el$212.firstChild,
2956
+ _el$214 = _el$213.nextSibling;
2957
+ _$insert(_el$214, () => status().text);
2454
2958
  _$effect(_p$ => {
2455
- var _v$44 = status().tone,
2456
- _v$45 = status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle";
2457
- _v$44 !== _p$.e && _$setAttribute(_el$200, "data-tone", _p$.e = _v$44);
2458
- _v$45 !== _p$.t && _$className(_el$201, _p$.t = _v$45);
2959
+ var _v$54 = status().tone,
2960
+ _v$55 = status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle";
2961
+ _v$54 !== _p$.e && _$setAttribute(_el$212, "data-tone", _p$.e = _v$54);
2962
+ _v$55 !== _p$.t && _$className(_el$213, _p$.t = _v$55);
2459
2963
  return _p$;
2460
2964
  }, {
2461
2965
  e: undefined,
2462
2966
  t: undefined
2463
2967
  });
2464
- return _el$200;
2968
+ return _el$212;
2465
2969
  })()
2466
- }), _el$107, _co$26);
2467
- _$insert(_el$105, _$createComponent(Show, {
2970
+ }), _el$119, _co$28);
2971
+ _$insert(_el$117, _$createComponent(Show, {
2468
2972
  get when() {
2469
2973
  return _$memo(() => !!suggestionsOpen())() && announcement();
2470
2974
  },
2471
2975
  keyed: true,
2472
2976
  children: announced => (() => {
2473
- var _el$203 = _$getNextElement(_tmpl$44);
2474
- _$insert(_el$203, () => announced.text);
2475
- return _el$203;
2977
+ var _el$215 = _$getNextElement(_tmpl$46);
2978
+ _$insert(_el$215, () => announced.text);
2979
+ return _el$215;
2476
2980
  })()
2477
- }), _el$109, _co$27);
2981
+ }), _el$121, _co$29);
2478
2982
  _$effect(_p$ => {
2479
- var _v$24 = `k2b-chat-composer ${props.class ?? ""}`,
2480
- _v$25 = running() ? "true" : undefined,
2481
- _v$26 = conversation() ? "conversation" : undefined,
2482
- _v$27 = props.label ?? chatMessages().messageComposer;
2483
- _v$24 !== _p$.e && _$className(_el$72, _p$.e = _v$24);
2484
- _v$25 !== _p$.t && _$setAttribute(_el$72, "data-running", _p$.t = _v$25);
2485
- _v$26 !== _p$.a && _$setAttribute(_el$72, "data-variant", _p$.a = _v$26);
2486
- _v$27 !== _p$.o && _$setAttribute(_el$72, "aria-label", _p$.o = _v$27);
2983
+ var _v$34 = `k2b-chat-composer ${props.class ?? ""}`,
2984
+ _v$35 = running() ? "true" : undefined,
2985
+ _v$36 = conversation() ? "conversation" : undefined,
2986
+ _v$37 = props.label ?? chatMessages().messageComposer;
2987
+ _v$34 !== _p$.e && _$className(_el$84, _p$.e = _v$34);
2988
+ _v$35 !== _p$.t && _$setAttribute(_el$84, "data-running", _p$.t = _v$35);
2989
+ _v$36 !== _p$.a && _$setAttribute(_el$84, "data-variant", _p$.a = _v$36);
2990
+ _v$37 !== _p$.o && _$setAttribute(_el$84, "aria-label", _p$.o = _v$37);
2487
2991
  return _p$;
2488
2992
  }, {
2489
2993
  e: undefined,
@@ -2491,8 +2995,8 @@ export function ChatComposer(props) {
2491
2995
  a: undefined,
2492
2996
  o: undefined
2493
2997
  });
2494
- return _el$42;
2998
+ return _el$49;
2495
2999
  })();
2496
3000
  }
2497
- _$delegateEvents(["input", "click", "keyup", "beforeinput", "keydown", "mousedown"]);
3001
+ _$delegateEvents(["input", "click", "keyup", "beforeinput", "keydown", "mousedown", "focusout"]);
2498
3002
  //# sourceMappingURL=ChatComposer.js.map