@k2b/ui 0.26.0 → 0.27.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 (65) hide show
  1. package/dist/browser/chat/ChatComposer.js +811 -406
  2. package/dist/browser/chat/ChatComposer.js.map +1 -1
  3. package/dist/browser/chat/chat-behavior.js +4 -0
  4. package/dist/browser/chat/chat-behavior.js.map +1 -1
  5. package/dist/browser/chat/chat-messages.js +14 -0
  6. package/dist/browser/chat/chat-messages.js.map +1 -1
  7. package/dist/browser/chat/command-search.js +170 -0
  8. package/dist/browser/chat/command-search.js.map +1 -0
  9. package/dist/browser/chat/composer-document.js +1 -1
  10. package/dist/browser/chat/composer-document.js.map +1 -1
  11. package/dist/browser/chat/index.js.map +1 -1
  12. package/dist/browser/content/CalendarDayView.js +28 -3
  13. package/dist/browser/content/CalendarDayView.js.map +1 -1
  14. package/dist/browser/inputs/Combobox.js +4 -2
  15. package/dist/browser/inputs/Combobox.js.map +1 -1
  16. package/dist/browser/inputs/SelectChip.js +43 -12
  17. package/dist/browser/inputs/SelectChip.js.map +1 -1
  18. package/dist/browser/layout/AppWorkspace.js +708 -515
  19. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  20. package/dist/browser/layout/BottomSheet.js +8 -0
  21. package/dist/browser/layout/BottomSheet.js.map +1 -1
  22. package/dist/browser/layout/app-workspace-controller.js +155 -23
  23. package/dist/browser/layout/app-workspace-controller.js.map +1 -1
  24. package/dist/browser/layout/app-workspace-state.js +5 -1
  25. package/dist/browser/layout/app-workspace-state.js.map +1 -1
  26. package/dist/browser/layout/index.js +1 -1
  27. package/dist/browser/layout/index.js.map +1 -1
  28. package/dist/ssr/chat/ChatComposer.js +410 -93
  29. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  30. package/dist/ssr/chat/chat-behavior.js +4 -0
  31. package/dist/ssr/chat/chat-behavior.js.map +1 -1
  32. package/dist/ssr/chat/chat-messages.js +14 -0
  33. package/dist/ssr/chat/chat-messages.js.map +1 -1
  34. package/dist/ssr/chat/command-search.js +170 -0
  35. package/dist/ssr/chat/command-search.js.map +1 -0
  36. package/dist/ssr/chat/composer-document.js +1 -1
  37. package/dist/ssr/chat/composer-document.js.map +1 -1
  38. package/dist/ssr/chat/index.js.map +1 -1
  39. package/dist/ssr/content/CalendarDayView.js +28 -3
  40. package/dist/ssr/content/CalendarDayView.js.map +1 -1
  41. package/dist/ssr/inputs/Combobox.js +4 -2
  42. package/dist/ssr/inputs/Combobox.js.map +1 -1
  43. package/dist/ssr/inputs/SelectChip.js +35 -11
  44. package/dist/ssr/inputs/SelectChip.js.map +1 -1
  45. package/dist/ssr/layout/AppWorkspace.js +242 -105
  46. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  47. package/dist/ssr/layout/BottomSheet.js +8 -0
  48. package/dist/ssr/layout/BottomSheet.js.map +1 -1
  49. package/dist/ssr/layout/app-workspace-controller.js +155 -23
  50. package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
  51. package/dist/ssr/layout/app-workspace-state.js +5 -1
  52. package/dist/ssr/layout/app-workspace-state.js.map +1 -1
  53. package/dist/ssr/layout/index.js +1 -1
  54. package/dist/ssr/layout/index.js.map +1 -1
  55. package/dist/styles.css +1 -1
  56. package/dist/types/chat/ChatComposer.d.ts +44 -2
  57. package/dist/types/chat/chat-behavior.d.ts +4 -0
  58. package/dist/types/chat/chat-messages.d.ts +7 -0
  59. package/dist/types/chat/command-search.d.ts +39 -0
  60. package/dist/types/chat/index.d.ts +1 -1
  61. package/dist/types/inputs/SelectChip.d.ts +4 -0
  62. package/dist/types/layout/AppWorkspace.d.ts +13 -1
  63. package/dist/types/layout/BottomSheet.d.ts +8 -0
  64. package/dist/types/layout/index.d.ts +1 -1
  65. package/package.json +4 -4
@@ -25,33 +25,40 @@ 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(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox>`),
29
- _tmpl$12 = /*#__PURE__*/_$template(`<div role=status class=k2b-chat-composer__loading><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><strong>`),
30
- _tmpl$13 = /*#__PURE__*/_$template(`<div role=status><i class="ti ti-alert-circle"></i> <!$><!/>`),
31
- _tmpl$14 = /*#__PURE__*/_$template(`<div role=status>`),
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 class=k2b-chat-composer-slot><div></div><!$><!/><!$><!/>`),
34
- _tmpl$17 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__hint aria-live=polite>`),
35
- _tmpl$18 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachments role=list tabindex=0>`),
36
- _tmpl$19 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__error role=alert><i class="ti ti-alert-circle"aria-hidden=true></i><!$><!/>`),
37
- _tmpl$20 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__row><!$><!/><!$><!/><div class=k2b-chat-composer__field><!$><!/><div class=k2b-chat-composer__field-tools><!$><!/><!$><!/><!$><!/></div></div><!$><!/>`),
38
- _tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-shell><!$><!/><section role=group><!$><!/><!$><!/><!$><!/><!$><!/>`),
39
- _tmpl$22 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><span class=k2b-chat-composer__emoji-glyph aria-hidden=true></span><strong></strong><!$><!/>`),
40
- _tmpl$23 = /*#__PURE__*/_$template(`<small>:<!$><!/>:`),
41
- _tmpl$24 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><i aria-hidden=true></i><strong></strong><small>`),
42
- _tmpl$25 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__hint-text>`),
43
- _tmpl$26 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__dictation><i aria-hidden=true></i><span>`),
44
- _tmpl$27 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__hint-action>`),
45
- _tmpl$28 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-remove><i class="ti ti-x"aria-hidden=true>`),
46
- _tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment role=listitem><div class=k2b-chat-composer__attachment-content><!$><!/><!$><!/></div><!$><!/>`),
47
- _tmpl$30 = /*#__PURE__*/_$template(`<img>`),
48
- _tmpl$31 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment-identity><!$><!/><!$><!/>`),
49
- _tmpl$32 = /*#__PURE__*/_$template(`<a class=k2b-chat-composer__attachment-link target=_blank rel="noopener noreferrer"><!$><!/><!$><!/>`),
50
- _tmpl$33 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-action><!$><!/><!$><!/>`),
51
- _tmpl$34 = /*#__PURE__*/_$template(`<footer class=k2b-chat-composer__footer>`),
52
- _tmpl$35 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__tools><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
53
- _tmpl$36 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__submit><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`);
54
- import { children, createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, onMount, Show, untrack } from "solid-js";
28
+ _tmpl$11 = /*#__PURE__*/_$template(`<small>`),
29
+ _tmpl$12 = /*#__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><!$><!/>`),
30
+ _tmpl$13 = /*#__PURE__*/_$template(`<b>`),
31
+ _tmpl$14 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox>`),
32
+ _tmpl$15 = /*#__PURE__*/_$template(`<div role=status class=k2b-chat-composer__loading><i class="ti ti-loader-2 k2b-spin"aria-hidden=true></i><strong>`),
33
+ _tmpl$16 = /*#__PURE__*/_$template(`<div role=status><i class="ti ti-alert-circle"></i> <!$><!/>`),
34
+ _tmpl$17 = /*#__PURE__*/_$template(`<div role=status>`),
35
+ _tmpl$18 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-accessory><div class=k2b-chat-composer__commands role=listbox><!$><!/><!$><!/><!$><!/><!$><!/>`),
36
+ _tmpl$19 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer-slot><div></div><!$><!/><!$><!/>`),
37
+ _tmpl$20 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__hint aria-live=polite>`),
38
+ _tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachments role=list tabindex=0>`),
39
+ _tmpl$22 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__error role=alert><i class="ti ti-alert-circle"aria-hidden=true></i><!$><!/>`),
40
+ _tmpl$23 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__row><!$><!/><!$><!/><div class=k2b-chat-composer__field><!$><!/><div class=k2b-chat-composer__field-tools><!$><!/><!$><!/><!$><!/></div></div><!$><!/>`),
41
+ _tmpl$24 = /*#__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><!$><!/><!$><!/>`),
42
+ _tmpl$25 = /*#__PURE__*/_$template(`<button type=button role=option tabindex=-1><span class=k2b-chat-composer__emoji-glyph aria-hidden=true></span><strong></strong><!$><!/>`),
43
+ _tmpl$26 = /*#__PURE__*/_$template(`<small>:<!$><!/>:`),
44
+ _tmpl$27 = /*#__PURE__*/_$template(`<i class="ti ti-loader-2 k2b-spin"aria-hidden=true>`),
45
+ _tmpl$28 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-placeholder aria-hidden=true><span></span><span><span></span><span>`),
46
+ _tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__command-group role=group><div class=k2b-chat-composer__command-heading role=presentation><span></span><!$><!/></div><!$><!/><!$><!/>`),
47
+ _tmpl$30 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__hint-text>`),
48
+ _tmpl$31 = /*#__PURE__*/_$template(`<span class=k2b-chat-composer__dictation><i aria-hidden=true></i><span>`),
49
+ _tmpl$32 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__hint-action>`),
50
+ _tmpl$33 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-remove><i class="ti ti-x"aria-hidden=true>`),
51
+ _tmpl$34 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment role=listitem><div class=k2b-chat-composer__attachment-content><!$><!/><!$><!/></div><!$><!/>`),
52
+ _tmpl$35 = /*#__PURE__*/_$template(`<img>`),
53
+ _tmpl$36 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__attachment-identity><!$><!/><!$><!/>`),
54
+ _tmpl$37 = /*#__PURE__*/_$template(`<a class=k2b-chat-composer__attachment-link target=_blank rel="noopener noreferrer"><!$><!/><!$><!/>`),
55
+ _tmpl$38 = /*#__PURE__*/_$template(`<button type=button class=k2b-chat-composer__attachment-action><!$><!/><!$><!/>`),
56
+ _tmpl$39 = /*#__PURE__*/_$template(`<footer class=k2b-chat-composer__footer>`),
57
+ _tmpl$40 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__tools><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
58
+ _tmpl$41 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__submit><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
59
+ _tmpl$42 = /*#__PURE__*/_$template(`<div class=k2b-chat-composer__status-line><i aria-hidden=true></i><span>`),
60
+ _tmpl$43 = /*#__PURE__*/_$template(`<span class=k2b-sr-only>`);
61
+ import { batch, children, createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, onMount, Show, untrack } from "solid-js";
55
62
  import { Dropdown } from "../actions/Dropdown";
56
63
  import { Tooltip } from "../feedback/Tooltip";
57
64
  import { replaceTextareaRange } from "../inputs/editor-dom";
@@ -65,14 +72,25 @@ import { useSelectMessages } from "../inputs/select-messages";
65
72
  import { useLocale } from "../intl/locale";
66
73
  import { useUiMessages } from "../intl/messages";
67
74
  import { ChatContextUsage as ContextUsage } from "./ChatPrimitives";
68
- import { conversationEnterAction, executeChatAction, nextChatCommandIndex, reportChatFailure, runChatSubmission } from "./chat-behavior";
75
+ import { chatCommandKey, conversationEnterAction, executeChatAction, nextChatCommandIndex, reportChatFailure, runChatSubmission } from "./chat-behavior";
69
76
  import { useChatMessages } from "./chat-messages";
77
+ import { chatCommandListModel, parseChatCommandQuery } from "./command-search";
70
78
  import { chatCommandQuery, chatMentionSegments, reconcileChatMentions } from "./composer-document";
71
79
  const composerMaxInputHeight = 309;
80
+ const commandDoneMs = 3_000;
72
81
  /** Emoji suggestions for a `:shortcode`, as many as fit the list without scrolling on a phone. */
73
82
  const emojiSuggestionLimit = 8;
74
83
  // Keep editor undo text within approximately 2 MiB, plus the current edit.
75
84
  const composerUndoBudgetChars = 1_000_000;
85
+
86
+ /** An action can cancel and restore its token, or report a short completion message. */
87
+
88
+ /** A fixed place in the slash list. Sections keep the given order, also while searching. */
89
+
90
+ /** First-word narrowing; Tab writes `words[0]` followed by a space. */
91
+
92
+ /** Passed as the third argument to `searchCommands`. */
93
+
76
94
  /** The row stays short: what a chat message needs. Other Markdown, typed by hand, keeps working. */
77
95
  const formatTools = [{
78
96
  id: "bold",
@@ -115,7 +133,36 @@ export function ChatComposer(props) {
115
133
  const selectMessages = useSelectMessages();
116
134
  const commandListId = `k2b-chat-commands-${createUniqueId().replace(/[^A-Za-z0-9_-]/g, "-")}`;
117
135
  const formatGroupId = `${commandListId}-format`;
136
+ // Emoji suggestions keep their index-based selection and ids.
118
137
  const [selectedCommandIndex, setSelectedCommandIndex] = createSignal(0);
138
+ const [activeCommandKey, setActiveCommandKey] = createSignal();
139
+ const [commandMoved, setCommandMoved] = createSignal(false);
140
+ const commandIds = new Map();
141
+ let commandIdCounter = 0;
142
+ const commandOptionId = command => {
143
+ const key = chatCommandKey(command);
144
+ if (!commandIds.has(key)) commandIds.set(key, commandIdCounter++);
145
+ return `${commandListId}-c${commandIds.get(key)}`;
146
+ };
147
+ const [closedAt, setClosedAt] = createSignal();
148
+ // Where the pending native edit starts; a selection replaced as a whole starts at its beginning.
149
+ let inputStart;
150
+ const [commandStatus, setCommandStatus] = createSignal();
151
+ const [announcement, setAnnouncement] = createSignal();
152
+ let statusTimer;
153
+ let disposed = false;
154
+ const showCommandStatus = status => {
155
+ if (disposed) return;
156
+ clearTimeout(statusTimer);
157
+ setCommandStatus(status);
158
+ if (status?.tone === "done") {
159
+ statusTimer = setTimeout(() => setCommandStatus(undefined), commandDoneMs);
160
+ }
161
+ };
162
+ onCleanup(() => {
163
+ disposed = true;
164
+ clearTimeout(statusTimer);
165
+ });
119
166
  const [addingFiles, setAddingFiles] = createSignal(false);
120
167
  const [submitting, setSubmitting] = createSignal(false);
121
168
  let composerRef;
@@ -139,6 +186,9 @@ export function ChatComposer(props) {
139
186
  const [dismissed, setDismissed] = createSignal(false);
140
187
  const [composing, setComposing] = createSignal(false);
141
188
  const [searchResults, setSearchResults] = createSignal([]);
189
+ const [searchResultsQuery, setSearchResultsQuery] = createSignal();
190
+ const [searchResultsScope, setSearchResultsScope] = createSignal();
191
+ const [suggestionAnnouncement, setSuggestionAnnouncement] = createSignal();
142
192
  const [searching, setSearching] = createSignal(false);
143
193
  const [searchError, setSearchError] = createSignal(false);
144
194
  const [executing, setExecuting] = createSignal(false);
@@ -158,13 +208,51 @@ export function ChatComposer(props) {
158
208
  return token && index ? suggestEmoji(index, token.query, emojiSuggestionLimit) : [];
159
209
  });
160
210
  const emojiOpen = () => emojiMatches().length > 0;
161
- const commandQuery = createMemo(() => dismissed() || composing() ? null : chatCommandQuery(props.value, caret(), selectionEnd()));
162
- const commandMatches = createMemo(() => {
163
- const token = commandQuery();
164
- if (!token) return [];
165
- return [...(props.commands ?? []).filter(command => command.name.toLowerCase().includes(token.query.toLowerCase())), ...searchResults()];
211
+ const caretCommandToken = createMemo(() => chatCommandQuery(props.value, caret(), selectionEnd()));
212
+ const caretCommandStart = createMemo(() => caretCommandToken()?.start);
213
+ // Retained server rows belong to one `/`: they go when it does or when another `/` starts.
214
+ createEffect(() => {
215
+ caretCommandStart();
216
+ setSearchResults([]);
217
+ setSearchResultsQuery(undefined);
218
+ });
219
+ // Escape closes the list for one `/` character, wherever the caret or selection goes; only that `/` going away ends it.
220
+ createEffect(() => {
221
+ const closed = closedAt();
222
+ if (closed !== undefined && props.value[closed] !== "/") setClosedAt(undefined);
223
+ });
224
+ const commandQuery = createMemo(() => {
225
+ const token = caretCommandToken();
226
+ return dismissed() || composing() || token?.start === closedAt() ? null : token;
166
227
  });
167
- const commandsOpen = () => Boolean(!emojiOpen() && commandQuery() && (props.commands?.length || props.searchCommands));
228
+ const parsedCommandQuery = createMemo(() => parseChatCommandQuery(commandQuery()?.query ?? "", props.commandScopes ?? []));
229
+ const currentCommandScope = createMemo(() => parsedCommandQuery().scope?.id);
230
+ createEffect(() => {
231
+ currentCommandScope();
232
+ setSearchResults([]);
233
+ setSearchResultsQuery(undefined);
234
+ });
235
+ const localCommands = createMemo(() => props.commands ?? []);
236
+ const commandModel = createMemo(() => chatCommandListModel({
237
+ query: commandQuery()?.query ?? "",
238
+ scopes: props.commandScopes,
239
+ sections: props.commandSections,
240
+ commands: localCommands(),
241
+ searchResults: searchResultsScope() === parsedCommandQuery().scope?.id ? searchResults() : [],
242
+ searchResultsFresh: searchResultsQuery() === commandQuery()?.query && searchResultsScope() === parsedCommandQuery().scope?.id,
243
+ searchSettled: searchResultsQuery() !== undefined && searchResultsScope() === parsedCommandQuery().scope?.id,
244
+ searching: searching()
245
+ }));
246
+ const commandMatches = createMemo(() => commandQuery() ? commandModel().rows.map(row => row.command) : []);
247
+ const currentCommandQuery = createMemo(() => caretCommandToken()?.query);
248
+ // Arrow marking belongs to one token in one draft; another draft or `/` starts at the top row again.
249
+ createEffect(() => {
250
+ props.draftKey;
251
+ caretCommandStart();
252
+ currentCommandQuery();
253
+ setCommandMoved(false);
254
+ });
255
+ const commandsOpen = () => Boolean(!emojiOpen() && commandQuery() && (localCommands().length || props.searchCommands));
168
256
  const suggestionsOpen = () => commandsOpen() || emojiOpen();
169
257
  createEffect(() => {
170
258
  if (!suggestionsOpen()) return;
@@ -192,20 +280,33 @@ export function ChatComposer(props) {
192
280
  });
193
281
  });
194
282
  createEffect(() => {
283
+ props.draftKey;
195
284
  const token = commandQuery();
196
- setSearchResults([]);
197
285
  setSearchError(false);
198
286
  if (!token || !props.searchCommands) {
199
287
  setSearching(false);
200
288
  return;
201
289
  }
290
+ const parsed = parsedCommandQuery();
202
291
  const abort = new AbortController();
203
292
  setSearching(true);
204
293
  const timer = setTimeout(() => {
205
- Promise.resolve(props.searchCommands(token.query, abort.signal)).then(results => {
206
- if (!abort.signal.aborted) setSearchResults(results);
294
+ Promise.resolve().then(() => props.searchCommands(parsed.query, abort.signal, {
295
+ scope: parsed.scope?.id
296
+ })).then(results => {
297
+ if (!abort.signal.aborted) {
298
+ batch(() => {
299
+ setSearchResults(results);
300
+ setSearchResultsQuery(token.query);
301
+ setSearchResultsScope(parsed.scope?.id);
302
+ });
303
+ }
207
304
  }).catch(() => {
208
- if (!abort.signal.aborted) setSearchError(true);
305
+ if (!abort.signal.aborted) {
306
+ setSearchResults([]);
307
+ setSearchResultsQuery(undefined);
308
+ setSearchError(true);
309
+ }
209
310
  }).finally(() => {
210
311
  if (!abort.signal.aborted) setSearching(false);
211
312
  });
@@ -215,6 +316,52 @@ export function ChatComposer(props) {
215
316
  abort.abort();
216
317
  });
217
318
  });
319
+ let settledEmpty;
320
+ createEffect(() => {
321
+ const token = commandQuery();
322
+ if (!token || parsedCommandQuery().scope || searchError()) {
323
+ settledEmpty = undefined;
324
+ return;
325
+ }
326
+ const previous = settledEmpty;
327
+ if (/\s$/.test(token.query) && previous?.start === token.start && previous.query.trimEnd() === token.query.trimEnd()) {
328
+ setClosedAt(token.start);
329
+ return;
330
+ }
331
+ const settled = !searching() && (!props.searchCommands || searchResultsQuery() === token.query);
332
+ if (settled && commandModel().empty) {
333
+ settledEmpty = {
334
+ start: token.start,
335
+ query: token.query
336
+ };
337
+ if (/\s$/.test(token.query)) setClosedAt(token.start);
338
+ } else if (!searching()) settledEmpty = undefined;
339
+ });
340
+ let lastSuggestion;
341
+ createEffect(() => {
342
+ const model = commandModel();
343
+ const query = commandQuery()?.query;
344
+ if (!commandsOpen()) {
345
+ setSuggestionAnnouncement(undefined);
346
+ lastSuggestion = undefined;
347
+ return;
348
+ }
349
+ if (searching() || searchError() || props.searchCommands && searchResultsQuery() !== query) return;
350
+ const text = chatMessages().commandSuggestions({
351
+ count: model.rows.length
352
+ });
353
+ const timer = setTimeout(() => {
354
+ if (lastSuggestion && lastSuggestion.query === query && lastSuggestion.text === text) return;
355
+ lastSuggestion = {
356
+ query: query ?? "",
357
+ text
358
+ };
359
+ setSuggestionAnnouncement({
360
+ text
361
+ });
362
+ }, 350);
363
+ onCleanup(() => clearTimeout(timer));
364
+ });
218
365
  const history = [];
219
366
  let historyIndex = -1;
220
367
  createEffect(() => {
@@ -223,6 +370,11 @@ export function ChatComposer(props) {
223
370
  history.length = 0;
224
371
  historyIndex = -1;
225
372
  setDismissed(true);
373
+ setClosedAt(undefined);
374
+ setSearchResults([]);
375
+ setSearchResultsQuery(undefined);
376
+ // A failure belongs to the draft it happened in; success notes may follow a command into the chat it opened.
377
+ if (commandStatus()?.tone === "error") showCommandStatus();
226
378
  });
227
379
  });
228
380
  const snapshot = () => ({
@@ -241,6 +393,15 @@ export function ChatComposer(props) {
241
393
  }
242
394
  };
243
395
  const edit = (value, nextMentions = reconcileChatMentions(props.value, value, mentions())) => {
396
+ if (commandStatus()?.tone === "error") showCommandStatus();
397
+ // An edit that starts at or before the closed `/` (select all, then type `/`) replaces it; the new `/` may open again.
398
+ const closed = closedAt();
399
+ if (closed !== undefined) {
400
+ let same = 0;
401
+ while (same <= closed && props.value[same] === value[same]) same++;
402
+ if (Math.min(same, inputStart ?? same) <= closed) setClosedAt(undefined);
403
+ }
404
+ inputStart = undefined;
244
405
  record();
245
406
  props.onValueChange(value);
246
407
  props.onMentionsChange?.(nextMentions);
@@ -260,10 +421,25 @@ export function ChatComposer(props) {
260
421
  });
261
422
  };
262
423
  const syncCaret = () => {
263
- setCaret(textareaRef?.selectionStart ?? props.value.length);
264
- setSelectionEnd(textareaRef?.selectionEnd ?? props.value.length);
424
+ // One update, so no effect sees a half-moved selection (it would read as "no `/` here" and reopen a closed list).
425
+ batch(() => {
426
+ setCaret(textareaRef?.selectionStart ?? props.value.length);
427
+ setSelectionEnd(textareaRef?.selectionEnd ?? props.value.length);
428
+ });
265
429
  };
266
- const selectedCommand = () => commandMatches()[selectedCommandIndex()];
430
+ const selectedCommand = createMemo(() => {
431
+ const rows = commandMatches();
432
+ return commandMoved() && rows.find(command => chatCommandKey(command) === activeCommandKey()) || rows[0];
433
+ });
434
+ const selectedCommandKey = createMemo(() => {
435
+ const command = selectedCommand();
436
+ return command ? chatCommandKey(command) : undefined;
437
+ });
438
+ createEffect(() => {
439
+ if (!commandsOpen()) commandIds.clear();
440
+ selectedCommandKey();
441
+ setAnnouncement(undefined);
442
+ });
267
443
  const busy = () => Boolean(props.disabled || stopping() || state() === "submitting" || executing() || addingFiles());
268
444
  const blocked = () => busy() || submitting();
269
445
  /** The conversation field stays editable while a message is sent, so it keeps the focus and a phone its keyboard. */
@@ -326,21 +502,23 @@ export function ChatComposer(props) {
326
502
  }
327
503
  });
328
504
  createEffect(() => {
329
- commandMatches();
330
505
  emojiMatches();
331
506
  setSelectedCommandIndex(0);
332
507
  });
333
508
  createEffect(() => {
334
- const index = selectedCommandIndex();
335
- commandMatches();
336
- emojiMatches();
509
+ const command = selectedCommand();
510
+ const id = emojiOpen() ? `${commandListId}-${selectedCommandIndex()}` : command ? commandOptionId(command) : undefined;
337
511
  queueMicrotask(() => {
338
512
  const list = commandListRef;
339
- const item = list?.querySelector(`[id="${commandListId}-${index}"]`);
513
+ const item = id ? list?.querySelector(`[id="${id}"]`) : undefined;
340
514
  if (!list || !item?.isConnected) return;
341
- if (item.offsetTop < list.scrollTop) list.scrollTop = item.offsetTop;else if (item.offsetTop + item.offsetHeight > list.scrollTop + list.clientHeight) {
342
- list.scrollTop = item.offsetTop + item.offsetHeight - list.clientHeight;
343
- }
515
+ // Measured against the visible part of the list: a sticky section heading covers the top of it.
516
+ const heading = item.closest(".k2b-chat-composer__command-group")?.querySelector(".k2b-chat-composer__command-heading");
517
+ const listTop = list.getBoundingClientRect().top + list.clientTop;
518
+ const box = item.getBoundingClientRect();
519
+ const top = box.top - listTop - (heading?.offsetHeight ?? 0);
520
+ const bottom = box.bottom - listTop - list.clientHeight;
521
+ if (top < 0) list.scrollTop += top;else if (bottom > 0) list.scrollTop += bottom;
344
522
  });
345
523
  });
346
524
  createEffect(() => {
@@ -436,9 +614,26 @@ export function ChatComposer(props) {
436
614
  });
437
615
  }
438
616
  };
439
- const executeCommand = async command => {
617
+ const narrowCommand = command => {
618
+ const scope = props.commandScopes?.find(scope => scope.id === command.scope);
619
+ const word = scope?.words[0];
440
620
  const token = commandQuery();
441
- if (!token || command.disabled || blocked()) return;
621
+ if (!word || !token || !textareaRef) return false;
622
+ replaceTextareaRange(textareaRef, token.start + 1, token.end, `${word} `);
623
+ syncCaret();
624
+ return true;
625
+ };
626
+ const executeCommand = async (command, tab = false) => {
627
+ const token = commandQuery();
628
+ if (!token || blocked()) return;
629
+ if (command.disabled || command.reason) {
630
+ // A new object each time, so choosing the same row again inserts and announces its reason again.
631
+ setAnnouncement(command.reason ? {
632
+ text: command.reason
633
+ } : undefined);
634
+ return;
635
+ }
636
+ if (command.scope && (tab || !command.action && !command.mention) && narrowCommand(command)) return;
442
637
  const previous = snapshot();
443
638
  const key = props.draftKey;
444
639
  const replacement = command.mention ? command.mention.name + " " : "";
@@ -449,32 +644,66 @@ export function ChatComposer(props) {
449
644
  end: token.start + command.mention.name.length,
450
645
  attachment: command.mention
451
646
  });
647
+ // A cancelled or failed command leaves no undo step behind: restoring puts the history back as well.
648
+ const previousHistory = {
649
+ entries: [...history],
650
+ index: historyIndex
651
+ };
452
652
  edit(nextValue, nextMentions);
453
653
  setDismissed(true);
454
654
  setExecuting(true);
455
655
  let submitRequested = false;
656
+ let restored = false;
657
+ const restore = () => {
658
+ if (props.draftKey !== key || props.value !== nextValue) return;
659
+ setDismissed(true);
660
+ props.onValueChange(previous.value);
661
+ props.onMentionsChange?.(previous.mentions);
662
+ history.splice(0, history.length, ...previousHistory.entries);
663
+ historyIndex = previousHistory.index;
664
+ restored = true;
665
+ };
666
+ showCommandStatus(command.busyLabel ? {
667
+ tone: "busy",
668
+ text: command.busyLabel
669
+ } : undefined);
456
670
  try {
457
- await command.action?.({
671
+ const result = await command.action?.({
458
672
  setValue: value => edit(value),
459
673
  submit: () => {
460
674
  submitRequested = true;
461
675
  },
462
676
  focus
463
677
  });
678
+ if (result === "cancelled") {
679
+ submitRequested = false;
680
+ restore();
681
+ showCommandStatus();
682
+ } else if (result) {
683
+ showCommandStatus({
684
+ tone: "done",
685
+ text: result.done
686
+ });
687
+ }
464
688
  } catch (error) {
465
689
  submitRequested = false;
466
- if (props.draftKey === key && props.value === nextValue) {
467
- props.onValueChange(previous.value);
468
- props.onMentionsChange?.(previous.mentions);
469
- }
470
- props.onError?.(error);
690
+ restore();
691
+ // An unmounted composer has no status line left; the app's error channel keeps the failure from going silent.
692
+ if (disposed) props.onError?.(error);else showCommandStatus({
693
+ tone: "error",
694
+ text: error instanceof Error && error.message ? error.message : chatMessages().commandFailed
695
+ });
471
696
  } finally {
697
+ if (commandStatus()?.tone === "busy") showCommandStatus();
472
698
  setExecuting(false);
473
699
  }
474
700
  if (submitRequested && props.draftKey === key) await submit();
475
701
  queueMicrotask(() => {
476
702
  if (props.draftKey !== key) return;
477
- textareaRef?.setSelectionRange(token.start + replacement.length, token.start + replacement.length);
703
+ if (restored || props.value === nextValue) {
704
+ const position = restored ? token.end : token.start + replacement.length;
705
+ textareaRef?.setSelectionRange(position, position);
706
+ }
478
707
  syncCaret();
479
708
  autoResize();
480
709
  focus();
@@ -552,19 +781,28 @@ export function ChatComposer(props) {
552
781
  if (commandsOpen()) {
553
782
  if (event.key === "ArrowUp" || event.key === "ArrowDown") {
554
783
  event.preventDefault();
555
- setSelectedCommandIndex(index => nextChatCommandIndex(index, matches.length, event.key === "ArrowUp" ? -1 : 1));
784
+ const index = matches.indexOf(selectedCommand());
785
+ const next = matches[nextChatCommandIndex(index, matches.length, event.key === "ArrowUp" ? -1 : 1)];
786
+ setActiveCommandKey(next ? chatCommandKey(next) : undefined);
787
+ setCommandMoved(true);
788
+ setAnnouncement(undefined);
556
789
  return;
557
790
  }
558
791
  // Ctrl/⌘+Enter sends, also while suggestions are open.
559
- if ((event.key === "Tab" || event.key === "Enter" && !event.ctrlKey && !event.metaKey) && matches.length > 0) {
792
+ const plain = !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
793
+ if (plain && (event.key === "Tab" || event.key === "Enter") && matches.length > 0) {
560
794
  event.preventDefault();
561
795
  const command = selectedCommand();
562
- if (command) void executeCommand(command);
796
+ // A server row answering an earlier query may no longer match; wait for fresh results. Local rows match now.
797
+ const row = commandModel().rows.find(row => chatCommandKey(row.command) === selectedCommandKey());
798
+ const staleServerRow = row?.server && (searchResultsQuery() !== commandQuery()?.query || searchResultsScope() !== parsedCommandQuery().scope?.id);
799
+ if (staleServerRow) return;
800
+ if (command) void executeCommand(command, event.key === "Tab");
563
801
  return;
564
802
  }
565
803
  if (event.key === "Escape") {
566
804
  event.preventDefault();
567
- setDismissed(true);
805
+ setClosedAt(commandQuery()?.start);
568
806
  return;
569
807
  }
570
808
  }
@@ -1043,6 +1281,7 @@ export function ChatComposer(props) {
1043
1281
  }), _el$25, _co$4);
1044
1282
  _el$22.$$keydown = onKeyDown;
1045
1283
  _el$22.$$beforeinput = event => {
1284
+ inputStart = event.currentTarget.selectionStart;
1046
1285
  if (event.inputType === "historyUndo" || event.inputType === "historyRedo") {
1047
1286
  event.preventDefault();
1048
1287
  restoreHistory(event.inputType === "historyUndo" ? -1 : 1);
@@ -1073,8 +1312,10 @@ export function ChatComposer(props) {
1073
1312
  props.onPaste?.(event);
1074
1313
  });
1075
1314
  _el$22.$$input = event => {
1076
- edit(event.currentTarget.value);
1077
- syncCaret();
1315
+ batch(() => {
1316
+ edit(event.currentTarget.value);
1317
+ syncCaret();
1318
+ });
1078
1319
  autoResize();
1079
1320
  const input = event;
1080
1321
  if (input.inputType === "insertText" && input.data === ":") queueMicrotask(completeShortcode);
@@ -1103,7 +1344,7 @@ export function ChatComposer(props) {
1103
1344
  _v$0 = suggestionsOpen() ? "list" : undefined,
1104
1345
  _v$1 = suggestionsOpen() ? commandListId : undefined,
1105
1346
  _v$10 = suggestionsOpen() ? "true" : undefined,
1106
- _v$11 = (emojiOpen() ? emojiMatches()[selectedCommandIndex()] : selectedCommand()) ? `${commandListId}-${selectedCommandIndex()}` : undefined;
1347
+ _v$11 = emojiOpen() ? `${commandListId}-${selectedCommandIndex()}` : selectedCommand() ? commandOptionId(selectedCommand()) : undefined;
1107
1348
  _v$3 !== _p$.e && _$setAttribute(_el$17, "aria-label", _p$.e = _v$3);
1108
1349
  _v$4 !== _p$.t && _el$22.classList.toggle("k2b-chat-composer__textarea--highlighted", _p$.t = _v$4);
1109
1350
  _v$5 !== _p$.a && _$setProperty(_el$22, "disabled", _p$.a = _v$5);
@@ -1133,78 +1374,154 @@ export function ChatComposer(props) {
1133
1374
  _$runHydrationEvents();
1134
1375
  return _el$17;
1135
1376
  })();
1377
+ const commandRowMap = createMemo(() => new Map(commandModel().rows.map(row => [row.command, row])));
1378
+ const commandGroupKey = group => group.scopeTitle ? "scope" : group.section ? `section:${group.section.id}` : "flat";
1379
+ const renderCommandRow = command => {
1380
+ const highlight = () => commandRowMap().get(command)?.highlight;
1381
+ const title = () => command.label ?? command.name;
1382
+ return (() => {
1383
+ var _el$29 = _$getNextElement(_tmpl$12),
1384
+ _el$30 = _el$29.firstChild,
1385
+ _el$31 = _el$30.nextSibling,
1386
+ _el$32 = _el$31.firstChild,
1387
+ _el$34 = _el$32.nextSibling,
1388
+ [_el$35, _co$6] = _$getNextMarker(_el$34.nextSibling);
1389
+ _el$29.$$click = event => {
1390
+ event.preventDefault();
1391
+ void executeCommand(command);
1392
+ };
1393
+ _el$29.$$pointerdown = event => event.preventDefault();
1394
+ _$insert(_el$32, _$createComponent(Show, {
1395
+ get when() {
1396
+ return highlight();
1397
+ },
1398
+ get fallback() {
1399
+ return title();
1400
+ },
1401
+ children: range => [_$memo(() => title().slice(0, range()[0])), (() => {
1402
+ var _el$36 = _$getNextElement(_tmpl$13);
1403
+ _$insert(_el$36, () => title().slice(range()[0], range()[1]));
1404
+ return _el$36;
1405
+ })(), _$memo(() => title().slice(range()[1]))]
1406
+ }));
1407
+ _$insert(_el$31, _$createComponent(Show, {
1408
+ get when() {
1409
+ return command.reason ?? command.description;
1410
+ },
1411
+ get children() {
1412
+ var _el$33 = _$getNextElement(_tmpl$11);
1413
+ _$insert(_el$33, () => command.reason ?? command.description);
1414
+ _$effect(() => _$setAttribute(_el$33, "id", command.reason ? `${commandOptionId(command)}-reason` : undefined));
1415
+ return _el$33;
1416
+ }
1417
+ }), _el$35, _co$6);
1418
+ _$effect(_p$ => {
1419
+ var _v$12 = commandOptionId(command),
1420
+ _v$13 = selectedCommand() === command,
1421
+ _v$14 = Boolean(command.disabled || command.reason),
1422
+ _v$15 = command.reason ? `${commandOptionId(command)}-reason` : undefined,
1423
+ _v$16 = command.reason ? "true" : undefined,
1424
+ _v$17 = selectedCommand() === command ? "true" : undefined,
1425
+ _v$18 = command.icon ?? "ti ti-slash";
1426
+ _v$12 !== _p$.e && _$setAttribute(_el$29, "id", _p$.e = _v$12);
1427
+ _v$13 !== _p$.t && _$setAttribute(_el$29, "aria-selected", _p$.t = _v$13);
1428
+ _v$14 !== _p$.a && _$setAttribute(_el$29, "aria-disabled", _p$.a = _v$14);
1429
+ _v$15 !== _p$.o && _$setAttribute(_el$29, "aria-describedby", _p$.o = _v$15);
1430
+ _v$16 !== _p$.i && _$setAttribute(_el$29, "data-reason", _p$.i = _v$16);
1431
+ _v$17 !== _p$.n && _$setAttribute(_el$29, "data-active", _p$.n = _v$17);
1432
+ _v$18 !== _p$.s && _$className(_el$30, _p$.s = _v$18);
1433
+ return _p$;
1434
+ }, {
1435
+ e: undefined,
1436
+ t: undefined,
1437
+ a: undefined,
1438
+ o: undefined,
1439
+ i: undefined,
1440
+ n: undefined,
1441
+ s: undefined
1442
+ });
1443
+ _$runHydrationEvents();
1444
+ return _el$29;
1445
+ })();
1446
+ };
1136
1447
  return (() => {
1137
- var _el$29 = _$getNextElement(_tmpl$21),
1138
- _el$89 = _el$29.firstChild,
1139
- [_el$90, _co$23] = _$getNextMarker(_el$89.nextSibling),
1140
- _el$57 = _el$90.nextSibling,
1141
- _el$81 = _el$57.firstChild,
1142
- [_el$82, _co$19] = _$getNextMarker(_el$81.nextSibling),
1143
- _el$83 = _el$82.nextSibling,
1144
- [_el$84, _co$20] = _$getNextMarker(_el$83.nextSibling),
1145
- _el$85 = _el$84.nextSibling,
1146
- [_el$86, _co$21] = _$getNextMarker(_el$85.nextSibling),
1147
- _el$87 = _el$86.nextSibling,
1148
- [_el$88, _co$22] = _$getNextMarker(_el$87.nextSibling);
1149
- _$insert(_el$29, _$createComponent(Show, {
1448
+ var _el$37 = _$getNextElement(_tmpl$24),
1449
+ _el$103 = _el$37.firstChild,
1450
+ [_el$104, _co$26] = _$getNextMarker(_el$103.nextSibling),
1451
+ _el$65 = _el$104.nextSibling,
1452
+ _el$89 = _el$65.firstChild,
1453
+ [_el$90, _co$20] = _$getNextMarker(_el$89.nextSibling),
1454
+ _el$91 = _el$90.nextSibling,
1455
+ [_el$92, _co$21] = _$getNextMarker(_el$91.nextSibling),
1456
+ _el$93 = _el$92.nextSibling,
1457
+ [_el$94, _co$22] = _$getNextMarker(_el$93.nextSibling),
1458
+ _el$95 = _el$94.nextSibling,
1459
+ [_el$96, _co$23] = _$getNextMarker(_el$95.nextSibling),
1460
+ _el$97 = _el$65.nextSibling,
1461
+ _el$98 = _el$97.nextSibling,
1462
+ _el$99 = _el$98.firstChild,
1463
+ [_el$100, _co$24] = _$getNextMarker(_el$99.nextSibling),
1464
+ _el$101 = _el$100.nextSibling,
1465
+ [_el$102, _co$25] = _$getNextMarker(_el$101.nextSibling);
1466
+ _$insert(_el$37, _$createComponent(Show, {
1150
1467
  get when() {
1151
1468
  return suggestionsOpen() || hasAccessory();
1152
1469
  },
1153
1470
  get children() {
1154
- var _el$30 = _$getNextElement(_tmpl$16),
1155
- _el$31 = _el$30.firstChild,
1156
- _el$53 = _el$31.nextSibling,
1157
- [_el$54, _co$1] = _$getNextMarker(_el$53.nextSibling),
1158
- _el$55 = _el$54.nextSibling,
1159
- [_el$56, _co$10] = _$getNextMarker(_el$55.nextSibling);
1160
- _$insert(_el$31, accessory);
1161
- _$insert(_el$30, _$createComponent(Show, {
1471
+ var _el$38 = _$getNextElement(_tmpl$19),
1472
+ _el$39 = _el$38.firstChild,
1473
+ _el$61 = _el$39.nextSibling,
1474
+ [_el$62, _co$10] = _$getNextMarker(_el$61.nextSibling),
1475
+ _el$63 = _el$62.nextSibling,
1476
+ [_el$64, _co$11] = _$getNextMarker(_el$63.nextSibling);
1477
+ _$insert(_el$39, accessory);
1478
+ _$insert(_el$38, _$createComponent(Show, {
1162
1479
  get when() {
1163
1480
  return emojiOpen();
1164
1481
  },
1165
1482
  get children() {
1166
- var _el$32 = _$getNextElement(_tmpl$11),
1167
- _el$33 = _el$32.firstChild;
1483
+ var _el$40 = _$getNextElement(_tmpl$14),
1484
+ _el$41 = _el$40.firstChild;
1168
1485
  var _ref$6 = commandListRef;
1169
- typeof _ref$6 === "function" ? _$use(_ref$6, _el$33) : commandListRef = _el$33;
1170
- _$setAttribute(_el$33, "id", commandListId);
1171
- _$insert(_el$33, _$createComponent(For, {
1486
+ typeof _ref$6 === "function" ? _$use(_ref$6, _el$41) : commandListRef = _el$41;
1487
+ _$setAttribute(_el$41, "id", commandListId);
1488
+ _$insert(_el$41, _$createComponent(For, {
1172
1489
  get each() {
1173
1490
  return emojiMatches();
1174
1491
  },
1175
1492
  children: (entry, index) => (() => {
1176
- var _el$91 = _$getNextElement(_tmpl$22),
1177
- _el$92 = _el$91.firstChild,
1178
- _el$93 = _el$92.nextSibling,
1179
- _el$94 = _el$93.nextSibling,
1180
- [_el$95, _co$24] = _$getNextMarker(_el$94.nextSibling);
1181
- _el$91.$$click = () => pickEmojiSuggestion(index());
1182
- _el$91.$$pointerdown = event => event.preventDefault();
1183
- _$insert(_el$92, () => emojiInTone(entry, props.emoji?.skinTone ?? 0));
1184
- _$insert(_el$93, () => emojiName(entry, locale()));
1185
- _$insert(_el$91, _$createComponent(Show, {
1493
+ var _el$105 = _$getNextElement(_tmpl$25),
1494
+ _el$106 = _el$105.firstChild,
1495
+ _el$107 = _el$106.nextSibling,
1496
+ _el$108 = _el$107.nextSibling,
1497
+ [_el$109, _co$27] = _$getNextMarker(_el$108.nextSibling);
1498
+ _el$105.$$click = () => pickEmojiSuggestion(index());
1499
+ _el$105.$$pointerdown = event => event.preventDefault();
1500
+ _$insert(_el$106, () => emojiInTone(entry, props.emoji?.skinTone ?? 0));
1501
+ _$insert(_el$107, () => emojiName(entry, locale()));
1502
+ _$insert(_el$105, _$createComponent(Show, {
1186
1503
  get when() {
1187
1504
  return entry.shortcodes[0];
1188
1505
  },
1189
1506
  children: code => (() => {
1190
- var _el$96 = _$getNextElement(_tmpl$23),
1191
- _el$97 = _el$96.firstChild,
1192
- _el$99 = _el$97.nextSibling,
1193
- [_el$100, _co$25] = _$getNextMarker(_el$99.nextSibling),
1194
- _el$98 = _el$100.nextSibling;
1195
- _$insert(_el$96, code, _el$100, _co$25);
1196
- return _el$96;
1507
+ var _el$110 = _$getNextElement(_tmpl$26),
1508
+ _el$111 = _el$110.firstChild,
1509
+ _el$113 = _el$111.nextSibling,
1510
+ [_el$114, _co$28] = _$getNextMarker(_el$113.nextSibling),
1511
+ _el$112 = _el$114.nextSibling;
1512
+ _$insert(_el$110, code, _el$114, _co$28);
1513
+ return _el$110;
1197
1514
  })()
1198
- }), _el$95, _co$24);
1515
+ }), _el$109, _co$27);
1199
1516
  _$effect(_p$ => {
1200
- var _v$19 = `${commandListId}-${index()}`,
1201
- _v$20 = index() === selectedCommandIndex(),
1202
- _v$21 = emojiName(entry, locale()),
1203
- _v$22 = index() === selectedCommandIndex() ? "true" : undefined;
1204
- _v$19 !== _p$.e && _$setAttribute(_el$91, "id", _p$.e = _v$19);
1205
- _v$20 !== _p$.t && _$setAttribute(_el$91, "aria-selected", _p$.t = _v$20);
1206
- _v$21 !== _p$.a && _$setAttribute(_el$91, "aria-label", _p$.a = _v$21);
1207
- _v$22 !== _p$.o && _$setAttribute(_el$91, "data-active", _p$.o = _v$22);
1517
+ var _v$28 = `${commandListId}-${index()}`,
1518
+ _v$29 = index() === selectedCommandIndex(),
1519
+ _v$30 = emojiName(entry, locale()),
1520
+ _v$31 = index() === selectedCommandIndex() ? "true" : undefined;
1521
+ _v$28 !== _p$.e && _$setAttribute(_el$105, "id", _p$.e = _v$28);
1522
+ _v$29 !== _p$.t && _$setAttribute(_el$105, "aria-selected", _p$.t = _v$29);
1523
+ _v$30 !== _p$.a && _$setAttribute(_el$105, "aria-label", _p$.a = _v$30);
1524
+ _v$31 !== _p$.o && _$setAttribute(_el$105, "data-active", _p$.o = _v$31);
1208
1525
  return _p$;
1209
1526
  }, {
1210
1527
  e: undefined,
@@ -1213,343 +1530,387 @@ export function ChatComposer(props) {
1213
1530
  o: undefined
1214
1531
  });
1215
1532
  _$runHydrationEvents();
1216
- return _el$91;
1533
+ return _el$105;
1217
1534
  })()
1218
1535
  }));
1219
- _$effect(() => _$setAttribute(_el$33, "aria-label", chatMessages().emojiSuggestions));
1220
- return _el$32;
1536
+ _$effect(() => _$setAttribute(_el$41, "aria-label", chatMessages().emojiSuggestions));
1537
+ return _el$40;
1221
1538
  }
1222
- }), _el$54, _co$1);
1223
- _$insert(_el$30, _$createComponent(Show, {
1539
+ }), _el$62, _co$10);
1540
+ _$insert(_el$38, _$createComponent(Show, {
1224
1541
  get when() {
1225
1542
  return commandsOpen();
1226
1543
  },
1227
1544
  get children() {
1228
- var _el$34 = _$getNextElement(_tmpl$15),
1229
- _el$35 = _el$34.firstChild,
1230
- _el$45 = _el$35.firstChild,
1231
- [_el$46, _co$7] = _$getNextMarker(_el$45.nextSibling),
1232
- _el$47 = _el$46.nextSibling,
1233
- [_el$48, _co$8] = _$getNextMarker(_el$47.nextSibling),
1234
- _el$49 = _el$48.nextSibling,
1235
- [_el$50, _co$9] = _$getNextMarker(_el$49.nextSibling),
1236
- _el$51 = _el$50.nextSibling,
1237
- [_el$52, _co$0] = _$getNextMarker(_el$51.nextSibling);
1545
+ var _el$42 = _$getNextElement(_tmpl$18),
1546
+ _el$43 = _el$42.firstChild,
1547
+ _el$53 = _el$43.firstChild,
1548
+ [_el$54, _co$8] = _$getNextMarker(_el$53.nextSibling),
1549
+ _el$55 = _el$54.nextSibling,
1550
+ [_el$56, _co$9] = _$getNextMarker(_el$55.nextSibling),
1551
+ _el$57 = _el$56.nextSibling,
1552
+ [_el$58, _co$0] = _$getNextMarker(_el$57.nextSibling),
1553
+ _el$59 = _el$58.nextSibling,
1554
+ [_el$60, _co$1] = _$getNextMarker(_el$59.nextSibling);
1238
1555
  var _ref$7 = commandListRef;
1239
- typeof _ref$7 === "function" ? _$use(_ref$7, _el$35) : commandListRef = _el$35;
1240
- _$setAttribute(_el$35, "id", commandListId);
1241
- _$insert(_el$35, _$createComponent(For, {
1556
+ typeof _ref$7 === "function" ? _$use(_ref$7, _el$43) : commandListRef = _el$43;
1557
+ _$setAttribute(_el$43, "id", commandListId);
1558
+ _$insert(_el$43, _$createComponent(For, {
1242
1559
  get each() {
1243
- return commandMatches();
1560
+ return commandModel().groups.map(commandGroupKey);
1244
1561
  },
1245
- children: (command, index) => (() => {
1246
- var _el$101 = _$getNextElement(_tmpl$24),
1247
- _el$102 = _el$101.firstChild,
1248
- _el$103 = _el$102.nextSibling,
1249
- _el$104 = _el$103.nextSibling;
1250
- _el$101.$$click = () => void executeCommand(command);
1251
- _el$101.$$pointerdown = event => event.preventDefault();
1252
- _$insert(_el$103, () => command.label ?? `/${command.name}`);
1253
- _$insert(_el$104, () => command.description);
1254
- _$effect(_p$ => {
1255
- var _v$23 = `${commandListId}-${index()}`,
1256
- _v$24 = index() === selectedCommandIndex(),
1257
- _v$25 = command.disabled,
1258
- _v$26 = index() === selectedCommandIndex() ? "true" : undefined,
1259
- _v$27 = command.icon ?? "ti ti-slash";
1260
- _v$23 !== _p$.e && _$setAttribute(_el$101, "id", _p$.e = _v$23);
1261
- _v$24 !== _p$.t && _$setAttribute(_el$101, "aria-selected", _p$.t = _v$24);
1262
- _v$25 !== _p$.a && _$setAttribute(_el$101, "aria-disabled", _p$.a = _v$25);
1263
- _v$26 !== _p$.o && _$setAttribute(_el$101, "data-active", _p$.o = _v$26);
1264
- _v$27 !== _p$.i && _$className(_el$102, _p$.i = _v$27);
1265
- return _p$;
1266
- }, {
1267
- e: undefined,
1268
- t: undefined,
1269
- a: undefined,
1270
- o: undefined,
1271
- i: undefined
1562
+ children: key => {
1563
+ const group = createMemo(() => commandModel().groups.find(group => commandGroupKey(group) === key));
1564
+ const headingId = () => `${commandListId}-g-${key === "scope" ? "scope" : props.commandSections?.findIndex(section => section.id === group()?.section?.id)}`;
1565
+ const rows = () => group()?.rows.map(row => row.command) ?? [];
1566
+ return _$createComponent(Show, {
1567
+ when: key !== "flat",
1568
+ get fallback() {
1569
+ return _$createComponent(For, {
1570
+ get each() {
1571
+ return rows();
1572
+ },
1573
+ children: renderCommandRow
1574
+ });
1575
+ },
1576
+ get children() {
1577
+ var _el$115 = _$getNextElement(_tmpl$29),
1578
+ _el$116 = _el$115.firstChild,
1579
+ _el$117 = _el$116.firstChild,
1580
+ _el$119 = _el$117.nextSibling,
1581
+ [_el$120, _co$29] = _$getNextMarker(_el$119.nextSibling),
1582
+ _el$122 = _el$116.nextSibling,
1583
+ [_el$123, _co$30] = _$getNextMarker(_el$122.nextSibling),
1584
+ _el$124 = _el$123.nextSibling,
1585
+ [_el$125, _co$31] = _$getNextMarker(_el$124.nextSibling);
1586
+ _$insert(_el$117, () => group()?.scopeTitle ?? group()?.section?.label);
1587
+ _$insert(_el$116, _$createComponent(Show, {
1588
+ get when() {
1589
+ return group()?.loading;
1590
+ },
1591
+ get children() {
1592
+ return _$getNextElement(_tmpl$27);
1593
+ }
1594
+ }), _el$120, _co$29);
1595
+ _$insert(_el$115, _$createComponent(For, {
1596
+ get each() {
1597
+ return rows();
1598
+ },
1599
+ children: renderCommandRow
1600
+ }), _el$123, _co$30);
1601
+ _$insert(_el$115, _$createComponent(Show, {
1602
+ get when() {
1603
+ return group()?.placeholder;
1604
+ },
1605
+ get children() {
1606
+ return _$getNextElement(_tmpl$28);
1607
+ }
1608
+ }), _el$125, _co$31);
1609
+ _$effect(_p$ => {
1610
+ var _v$32 = headingId(),
1611
+ _v$33 = headingId();
1612
+ _v$32 !== _p$.e && _$setAttribute(_el$115, "aria-labelledby", _p$.e = _v$32);
1613
+ _v$33 !== _p$.t && _$setAttribute(_el$116, "id", _p$.t = _v$33);
1614
+ return _p$;
1615
+ }, {
1616
+ e: undefined,
1617
+ t: undefined
1618
+ });
1619
+ return _el$115;
1620
+ }
1272
1621
  });
1273
- _$runHydrationEvents();
1274
- return _el$101;
1275
- })()
1276
- }), _el$46, _co$7);
1277
- _$insert(_el$35, _$createComponent(Show, {
1622
+ }
1623
+ }), _el$54, _co$8);
1624
+ _$insert(_el$43, _$createComponent(Show, {
1278
1625
  get when() {
1279
- return searching();
1626
+ return _$memo(() => !!(searching() && commandMatches().length === 0))() && !commandModel().groups.some(group => group.section || group.scopeTitle);
1280
1627
  },
1281
1628
  get children() {
1282
- var _el$36 = _$getNextElement(_tmpl$12),
1283
- _el$37 = _el$36.firstChild,
1284
- _el$38 = _el$37.nextSibling;
1285
- _$insert(_el$38, () => messages().loading);
1286
- return _el$36;
1629
+ var _el$44 = _$getNextElement(_tmpl$15),
1630
+ _el$45 = _el$44.firstChild,
1631
+ _el$46 = _el$45.nextSibling;
1632
+ _$insert(_el$46, () => messages().loading);
1633
+ return _el$44;
1287
1634
  }
1288
- }), _el$48, _co$8);
1289
- _$insert(_el$35, _$createComponent(Show, {
1635
+ }), _el$56, _co$9);
1636
+ _$insert(_el$43, _$createComponent(Show, {
1290
1637
  get when() {
1291
1638
  return searchError();
1292
1639
  },
1293
1640
  get children() {
1294
- var _el$39 = _$getNextElement(_tmpl$13),
1295
- _el$40 = _el$39.firstChild,
1296
- _el$41 = _el$40.nextSibling,
1297
- _el$42 = _el$41.nextSibling,
1298
- [_el$43, _co$6] = _$getNextMarker(_el$42.nextSibling);
1299
- _$insert(_el$39, () => messages().error, _el$43, _co$6);
1300
- return _el$39;
1641
+ var _el$47 = _$getNextElement(_tmpl$16),
1642
+ _el$48 = _el$47.firstChild,
1643
+ _el$49 = _el$48.nextSibling,
1644
+ _el$50 = _el$49.nextSibling,
1645
+ [_el$51, _co$7] = _$getNextMarker(_el$50.nextSibling);
1646
+ _$insert(_el$47, () => messages().error, _el$51, _co$7);
1647
+ return _el$47;
1301
1648
  }
1302
- }), _el$50, _co$9);
1303
- _$insert(_el$35, _$createComponent(Show, {
1649
+ }), _el$58, _co$0);
1650
+ _$insert(_el$43, _$createComponent(Show, {
1304
1651
  get when() {
1305
1652
  return _$memo(() => !!(!searching() && !searchError()))() && commandMatches().length === 0;
1306
1653
  },
1307
1654
  get children() {
1308
- var _el$44 = _$getNextElement(_tmpl$14);
1309
- _$insert(_el$44, () => messages().noResults);
1310
- return _el$44;
1655
+ var _el$52 = _$getNextElement(_tmpl$17);
1656
+ _$insert(_el$52, (() => {
1657
+ var _c$ = _$memo(() => !!!parsedCommandQuery().query.trim());
1658
+ return () => _c$() ? messages().noResults : chatMessages().commandsNothingFound({
1659
+ query: parsedCommandQuery().query.trim()
1660
+ });
1661
+ })());
1662
+ return _el$52;
1311
1663
  }
1312
- }), _el$52, _co$0);
1313
- _$effect(() => _$setAttribute(_el$35, "aria-label", chatMessages().commands));
1314
- return _el$34;
1664
+ }), _el$60, _co$1);
1665
+ _$effect(_p$ => {
1666
+ var _v$19 = chatMessages().commands,
1667
+ _v$20 = searching() ? "true" : undefined;
1668
+ _v$19 !== _p$.e && _$setAttribute(_el$43, "aria-label", _p$.e = _v$19);
1669
+ _v$20 !== _p$.t && _$setAttribute(_el$43, "aria-busy", _p$.t = _v$20);
1670
+ return _p$;
1671
+ }, {
1672
+ e: undefined,
1673
+ t: undefined
1674
+ });
1675
+ return _el$42;
1315
1676
  }
1316
- }), _el$56, _co$10);
1677
+ }), _el$64, _co$11);
1317
1678
  _$effect(_p$ => {
1318
- var _v$12 = hasAccessory() ? undefined : "true",
1319
- _v$13 = suggestionsOpen() ? "hidden" : undefined,
1320
- _v$14 = suggestionsOpen();
1321
- _v$12 !== _p$.e && _$setAttribute(_el$30, "data-overlay", _p$.e = _v$12);
1322
- _v$13 !== _p$.t && _$setStyleProperty(_el$31, "visibility", _p$.t = _v$13);
1323
- _v$14 !== _p$.a && _$setProperty(_el$31, "inert", _p$.a = _v$14);
1679
+ var _v$21 = hasAccessory() ? undefined : "true",
1680
+ _v$22 = suggestionsOpen() ? "hidden" : undefined,
1681
+ _v$23 = suggestionsOpen();
1682
+ _v$21 !== _p$.e && _$setAttribute(_el$38, "data-overlay", _p$.e = _v$21);
1683
+ _v$22 !== _p$.t && _$setStyleProperty(_el$39, "visibility", _p$.t = _v$22);
1684
+ _v$23 !== _p$.a && _$setProperty(_el$39, "inert", _p$.a = _v$23);
1324
1685
  return _p$;
1325
1686
  }, {
1326
1687
  e: undefined,
1327
1688
  t: undefined,
1328
1689
  a: undefined
1329
1690
  });
1330
- return _el$30;
1691
+ return _el$38;
1331
1692
  }
1332
- }), _el$90, _co$23);
1693
+ }), _el$104, _co$26);
1333
1694
  var _ref$8 = composerRef;
1334
- typeof _ref$8 === "function" ? _$use(_ref$8, _el$57) : composerRef = _el$57;
1335
- _$insert(_el$57, _$createComponent(Show, {
1695
+ typeof _ref$8 === "function" ? _$use(_ref$8, _el$65) : composerRef = _el$65;
1696
+ _$insert(_el$65, _$createComponent(Show, {
1336
1697
  get when() {
1337
1698
  return showHint();
1338
1699
  },
1339
1700
  get children() {
1340
- var _el$58 = _$getNextElement(_tmpl$17);
1341
- _$insert(_el$58, _$createComponent(Show, {
1701
+ var _el$66 = _$getNextElement(_tmpl$20);
1702
+ _$insert(_el$66, _$createComponent(Show, {
1342
1703
  get when() {
1343
1704
  return dictationStatus();
1344
1705
  },
1345
1706
  get fallback() {
1346
1707
  return (() => {
1347
- var _el$105 = _$getNextElement(_tmpl$25);
1348
- _$insert(_el$105, hint);
1349
- return _el$105;
1708
+ var _el$126 = _$getNextElement(_tmpl$30);
1709
+ _$insert(_el$126, hint);
1710
+ return _el$126;
1350
1711
  })();
1351
1712
  },
1352
1713
  children: status => [(() => {
1353
- var _el$106 = _$getNextElement(_tmpl$26),
1354
- _el$107 = _el$106.firstChild,
1355
- _el$108 = _el$107.nextSibling;
1356
- _$insert(_el$108, () => status().text);
1714
+ var _el$127 = _$getNextElement(_tmpl$31),
1715
+ _el$128 = _el$127.firstChild,
1716
+ _el$129 = _el$128.nextSibling;
1717
+ _$insert(_el$129, () => status().text);
1357
1718
  _$effect(_p$ => {
1358
- var _v$28 = dictation() ?? undefined,
1359
- _v$29 = status().icon;
1360
- _v$28 !== _p$.e && _$setAttribute(_el$106, "data-state", _p$.e = _v$28);
1361
- _v$29 !== _p$.t && _$className(_el$107, _p$.t = _v$29);
1719
+ var _v$34 = dictation() ?? undefined,
1720
+ _v$35 = status().icon;
1721
+ _v$34 !== _p$.e && _$setAttribute(_el$127, "data-state", _p$.e = _v$34);
1722
+ _v$35 !== _p$.t && _$className(_el$128, _p$.t = _v$35);
1362
1723
  return _p$;
1363
1724
  }, {
1364
1725
  e: undefined,
1365
1726
  t: undefined
1366
1727
  });
1367
- return _el$106;
1728
+ return _el$127;
1368
1729
  })(), _$createComponent(Show, {
1369
1730
  get when() {
1370
1731
  return _$memo(() => dictation() === "refined")() ? props.microphone?.onRestoreOriginal : undefined;
1371
1732
  },
1372
1733
  children: restore => (() => {
1373
- var _el$109 = _$getNextElement(_tmpl$27);
1374
- _el$109.$$click = () => reportChatFailure(restore(), props.onError);
1375
- _el$109.$$mousedown = keepFieldFocus;
1376
- _$insert(_el$109, () => chatMessages().restoreOriginal);
1377
- _$effect(() => _$setProperty(_el$109, "disabled", microphoneDisabled()));
1734
+ var _el$130 = _$getNextElement(_tmpl$32);
1735
+ _el$130.$$click = () => reportChatFailure(restore(), props.onError);
1736
+ _el$130.$$mousedown = keepFieldFocus;
1737
+ _$insert(_el$130, () => chatMessages().restoreOriginal);
1738
+ _$effect(() => _$setProperty(_el$130, "disabled", microphoneDisabled()));
1378
1739
  _$runHydrationEvents();
1379
- return _el$109;
1740
+ return _el$130;
1380
1741
  })()
1381
1742
  })]
1382
1743
  }));
1383
- return _el$58;
1744
+ return _el$66;
1384
1745
  }
1385
- }), _el$82, _co$19);
1386
- _$insert(_el$57, _$createComponent(Show, {
1746
+ }), _el$90, _co$20);
1747
+ _$insert(_el$65, _$createComponent(Show, {
1387
1748
  get when() {
1388
1749
  return attachments().length > 0;
1389
1750
  },
1390
1751
  get children() {
1391
- var _el$59 = _$getNextElement(_tmpl$18);
1392
- _$insert(_el$59, _$createComponent(For, {
1752
+ var _el$67 = _$getNextElement(_tmpl$21);
1753
+ _$insert(_el$67, _$createComponent(For, {
1393
1754
  get each() {
1394
1755
  return attachments();
1395
1756
  },
1396
1757
  children: attachment => (() => {
1397
- var _el$110 = _$getNextElement(_tmpl$29),
1398
- _el$111 = _el$110.firstChild,
1399
- _el$112 = _el$111.firstChild,
1400
- [_el$113, _co$26] = _$getNextMarker(_el$112.nextSibling),
1401
- _el$114 = _el$113.nextSibling,
1402
- [_el$115, _co$27] = _$getNextMarker(_el$114.nextSibling),
1403
- _el$117 = _el$111.nextSibling,
1404
- [_el$118, _co$28] = _$getNextMarker(_el$117.nextSibling);
1405
- _$insert(_el$111, _$createComponent(Show, {
1758
+ var _el$131 = _$getNextElement(_tmpl$34),
1759
+ _el$132 = _el$131.firstChild,
1760
+ _el$133 = _el$132.firstChild,
1761
+ [_el$134, _co$32] = _$getNextMarker(_el$133.nextSibling),
1762
+ _el$135 = _el$134.nextSibling,
1763
+ [_el$136, _co$33] = _$getNextMarker(_el$135.nextSibling),
1764
+ _el$138 = _el$132.nextSibling,
1765
+ [_el$139, _co$34] = _$getNextMarker(_el$138.nextSibling);
1766
+ _$insert(_el$132, _$createComponent(Show, {
1406
1767
  get when() {
1407
1768
  return attachment.href;
1408
1769
  },
1409
1770
  get fallback() {
1410
1771
  return (() => {
1411
- var _el$119 = _$getNextElement(_tmpl$31),
1412
- _el$121 = _el$119.firstChild,
1413
- [_el$122, _co$29] = _$getNextMarker(_el$121.nextSibling),
1414
- _el$123 = _el$122.nextSibling,
1415
- [_el$124, _co$30] = _$getNextMarker(_el$123.nextSibling);
1416
- _$insert(_el$119, _$createComponent(Show, {
1772
+ var _el$140 = _$getNextElement(_tmpl$36),
1773
+ _el$142 = _el$140.firstChild,
1774
+ [_el$143, _co$35] = _$getNextMarker(_el$142.nextSibling),
1775
+ _el$144 = _el$143.nextSibling,
1776
+ [_el$145, _co$36] = _$getNextMarker(_el$144.nextSibling);
1777
+ _$insert(_el$140, _$createComponent(Show, {
1417
1778
  get when() {
1418
1779
  return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
1419
1780
  },
1420
1781
  get fallback() {
1421
1782
  return (() => {
1422
- var _el$125 = _$getNextElement(_tmpl$3);
1423
- _$effect(() => _$className(_el$125, attachmentIcon(attachment)));
1424
- return _el$125;
1783
+ var _el$146 = _$getNextElement(_tmpl$3);
1784
+ _$effect(() => _$className(_el$146, attachmentIcon(attachment)));
1785
+ return _el$146;
1425
1786
  })();
1426
1787
  },
1427
1788
  get children() {
1428
- var _el$120 = _$getNextElement(_tmpl$30);
1789
+ var _el$141 = _$getNextElement(_tmpl$35);
1429
1790
  _$effect(_p$ => {
1430
- var _v$32 = attachment.previewUrl,
1431
- _v$33 = attachment.alt ?? "";
1432
- _v$32 !== _p$.e && _$setAttribute(_el$120, "src", _p$.e = _v$32);
1433
- _v$33 !== _p$.t && _$setAttribute(_el$120, "alt", _p$.t = _v$33);
1791
+ var _v$38 = attachment.previewUrl,
1792
+ _v$39 = attachment.alt ?? "";
1793
+ _v$38 !== _p$.e && _$setAttribute(_el$141, "src", _p$.e = _v$38);
1794
+ _v$39 !== _p$.t && _$setAttribute(_el$141, "alt", _p$.t = _v$39);
1434
1795
  return _p$;
1435
1796
  }, {
1436
1797
  e: undefined,
1437
1798
  t: undefined
1438
1799
  });
1439
- return _el$120;
1800
+ return _el$141;
1440
1801
  }
1441
- }), _el$122, _co$29);
1442
- _$insert(_el$119, () => renderAttachmentCopy(attachment), _el$124, _co$30);
1443
- return _el$119;
1802
+ }), _el$143, _co$35);
1803
+ _$insert(_el$140, () => renderAttachmentCopy(attachment), _el$145, _co$36);
1804
+ return _el$140;
1444
1805
  })();
1445
1806
  },
1446
1807
  children: href => (() => {
1447
- var _el$126 = _$getNextElement(_tmpl$32),
1448
- _el$128 = _el$126.firstChild,
1449
- [_el$129, _co$31] = _$getNextMarker(_el$128.nextSibling),
1450
- _el$130 = _el$129.nextSibling,
1451
- [_el$131, _co$32] = _$getNextMarker(_el$130.nextSibling);
1452
- _$insert(_el$126, _$createComponent(Show, {
1808
+ var _el$147 = _$getNextElement(_tmpl$37),
1809
+ _el$149 = _el$147.firstChild,
1810
+ [_el$150, _co$37] = _$getNextMarker(_el$149.nextSibling),
1811
+ _el$151 = _el$150.nextSibling,
1812
+ [_el$152, _co$38] = _$getNextMarker(_el$151.nextSibling);
1813
+ _$insert(_el$147, _$createComponent(Show, {
1453
1814
  get when() {
1454
1815
  return _$memo(() => attachment.kind === "image")() && attachment.previewUrl;
1455
1816
  },
1456
1817
  get fallback() {
1457
1818
  return (() => {
1458
- var _el$132 = _$getNextElement(_tmpl$3);
1459
- _$effect(() => _$className(_el$132, attachmentIcon(attachment)));
1460
- return _el$132;
1819
+ var _el$153 = _$getNextElement(_tmpl$3);
1820
+ _$effect(() => _$className(_el$153, attachmentIcon(attachment)));
1821
+ return _el$153;
1461
1822
  })();
1462
1823
  },
1463
1824
  get children() {
1464
- var _el$127 = _$getNextElement(_tmpl$30);
1825
+ var _el$148 = _$getNextElement(_tmpl$35);
1465
1826
  _$effect(_p$ => {
1466
- var _v$34 = attachment.previewUrl,
1467
- _v$35 = attachment.alt ?? "";
1468
- _v$34 !== _p$.e && _$setAttribute(_el$127, "src", _p$.e = _v$34);
1469
- _v$35 !== _p$.t && _$setAttribute(_el$127, "alt", _p$.t = _v$35);
1827
+ var _v$40 = attachment.previewUrl,
1828
+ _v$41 = attachment.alt ?? "";
1829
+ _v$40 !== _p$.e && _$setAttribute(_el$148, "src", _p$.e = _v$40);
1830
+ _v$41 !== _p$.t && _$setAttribute(_el$148, "alt", _p$.t = _v$41);
1470
1831
  return _p$;
1471
1832
  }, {
1472
1833
  e: undefined,
1473
1834
  t: undefined
1474
1835
  });
1475
- return _el$127;
1836
+ return _el$148;
1476
1837
  }
1477
- }), _el$129, _co$31);
1478
- _$insert(_el$126, () => renderAttachmentCopy(attachment), _el$131, _co$32);
1838
+ }), _el$150, _co$37);
1839
+ _$insert(_el$147, () => renderAttachmentCopy(attachment), _el$152, _co$38);
1479
1840
  _$effect(_p$ => {
1480
- var _v$36 = href(),
1481
- _v$37 = chatMessages().openInNewTab({
1841
+ var _v$42 = href(),
1842
+ _v$43 = chatMessages().openInNewTab({
1482
1843
  name: attachment.name
1483
1844
  });
1484
- _v$36 !== _p$.e && _$setAttribute(_el$126, "href", _p$.e = _v$36);
1485
- _v$37 !== _p$.t && _$setAttribute(_el$126, "aria-label", _p$.t = _v$37);
1845
+ _v$42 !== _p$.e && _$setAttribute(_el$147, "href", _p$.e = _v$42);
1846
+ _v$43 !== _p$.t && _$setAttribute(_el$147, "aria-label", _p$.t = _v$43);
1486
1847
  return _p$;
1487
1848
  }, {
1488
1849
  e: undefined,
1489
1850
  t: undefined
1490
1851
  });
1491
- return _el$126;
1852
+ return _el$147;
1492
1853
  })()
1493
- }), _el$113, _co$26);
1494
- _$insert(_el$111, _$createComponent(Show, {
1854
+ }), _el$134, _co$32);
1855
+ _$insert(_el$132, _$createComponent(Show, {
1495
1856
  get when() {
1496
1857
  return attachment.action;
1497
1858
  },
1498
1859
  children: action => (() => {
1499
- var _el$133 = _$getNextElement(_tmpl$33),
1500
- _el$134 = _el$133.firstChild,
1501
- [_el$135, _co$33] = _$getNextMarker(_el$134.nextSibling),
1502
- _el$136 = _el$135.nextSibling,
1503
- [_el$137, _co$34] = _$getNextMarker(_el$136.nextSibling);
1504
- _el$133.$$click = () => reportChatFailure(() => executeChatAction(action()), props.onError);
1505
- _$insert(_el$133, _$createComponent(Show, {
1860
+ var _el$154 = _$getNextElement(_tmpl$38),
1861
+ _el$155 = _el$154.firstChild,
1862
+ [_el$156, _co$39] = _$getNextMarker(_el$155.nextSibling),
1863
+ _el$157 = _el$156.nextSibling,
1864
+ [_el$158, _co$40] = _$getNextMarker(_el$157.nextSibling);
1865
+ _el$154.$$click = () => reportChatFailure(() => executeChatAction(action()), props.onError);
1866
+ _$insert(_el$154, _$createComponent(Show, {
1506
1867
  get when() {
1507
1868
  return action().icon;
1508
1869
  },
1509
1870
  children: icon => (() => {
1510
- var _el$138 = _$getNextElement(_tmpl$3);
1511
- _$effect(() => _$className(_el$138, icon()));
1512
- return _el$138;
1871
+ var _el$159 = _$getNextElement(_tmpl$3);
1872
+ _$effect(() => _$className(_el$159, icon()));
1873
+ return _el$159;
1513
1874
  })()
1514
- }), _el$135, _co$33);
1515
- _$insert(_el$133, () => action().label, _el$137, _co$34);
1516
- _$effect(() => _$setProperty(_el$133, "disabled", blocked() || action().disabled));
1875
+ }), _el$156, _co$39);
1876
+ _$insert(_el$154, () => action().label, _el$158, _co$40);
1877
+ _$effect(() => _$setProperty(_el$154, "disabled", blocked() || action().disabled));
1517
1878
  _$runHydrationEvents();
1518
- return _el$133;
1879
+ return _el$154;
1519
1880
  })()
1520
- }), _el$115, _co$27);
1521
- _$insert(_el$110, _$createComponent(Show, {
1881
+ }), _el$136, _co$33);
1882
+ _$insert(_el$131, _$createComponent(Show, {
1522
1883
  get when() {
1523
1884
  return props.onAttachmentsChange;
1524
1885
  },
1525
1886
  get children() {
1526
- var _el$116 = _$getNextElement(_tmpl$28);
1527
- _el$116.$$click = () => setAttachments(attachments().filter(candidate => candidate.id !== attachment.id));
1887
+ var _el$137 = _$getNextElement(_tmpl$33);
1888
+ _el$137.$$click = () => setAttachments(attachments().filter(candidate => candidate.id !== attachment.id));
1528
1889
  _$effect(_p$ => {
1529
- var _v$30 = selectMessages().removeNamed({
1890
+ var _v$36 = selectMessages().removeNamed({
1530
1891
  name: attachment.name
1531
1892
  }),
1532
- _v$31 = blocked();
1533
- _v$30 !== _p$.e && _$setAttribute(_el$116, "aria-label", _p$.e = _v$30);
1534
- _v$31 !== _p$.t && _$setProperty(_el$116, "disabled", _p$.t = _v$31);
1893
+ _v$37 = blocked();
1894
+ _v$36 !== _p$.e && _$setAttribute(_el$137, "aria-label", _p$.e = _v$36);
1895
+ _v$37 !== _p$.t && _$setProperty(_el$137, "disabled", _p$.t = _v$37);
1535
1896
  return _p$;
1536
1897
  }, {
1537
1898
  e: undefined,
1538
1899
  t: undefined
1539
1900
  });
1540
1901
  _$runHydrationEvents();
1541
- return _el$116;
1902
+ return _el$137;
1542
1903
  }
1543
- }), _el$118, _co$28);
1544
- _$effect(() => _el$111.classList.toggle("k2b-chat-composer__attachment-content--action", !!Boolean(attachment.action)));
1545
- return _el$110;
1904
+ }), _el$139, _co$34);
1905
+ _$effect(() => _el$132.classList.toggle("k2b-chat-composer__attachment-content--action", !!Boolean(attachment.action)));
1906
+ return _el$131;
1546
1907
  })()
1547
1908
  }));
1548
- _$effect(() => _$setAttribute(_el$59, "aria-label", chatMessages().attachments));
1549
- return _el$59;
1909
+ _$effect(() => _$setAttribute(_el$67, "aria-label", chatMessages().attachments));
1910
+ return _el$67;
1550
1911
  }
1551
- }), _el$84, _co$20);
1552
- _$insert(_el$57, _$createComponent(Show, {
1912
+ }), _el$92, _co$21);
1913
+ _$insert(_el$65, _$createComponent(Show, {
1553
1914
  get when() {
1554
1915
  return conversation();
1555
1916
  },
@@ -1559,49 +1920,49 @@ export function ChatComposer(props) {
1559
1920
  return props.error;
1560
1921
  },
1561
1922
  get children() {
1562
- var _el$139 = _$getNextElement(_tmpl$19),
1563
- _el$140 = _el$139.firstChild,
1564
- _el$141 = _el$140.nextSibling,
1565
- [_el$142, _co$35] = _$getNextMarker(_el$141.nextSibling);
1566
- _$insert(_el$139, () => props.error, _el$142, _co$35);
1567
- return _el$139;
1923
+ var _el$160 = _$getNextElement(_tmpl$22),
1924
+ _el$161 = _el$160.firstChild,
1925
+ _el$162 = _el$161.nextSibling,
1926
+ [_el$163, _co$41] = _$getNextMarker(_el$162.nextSibling);
1927
+ _$insert(_el$160, () => props.error, _el$163, _co$41);
1928
+ return _el$160;
1568
1929
  }
1569
1930
  }), _$memo(formatRow), (() => {
1570
- var _el$143 = _$getNextElement(_tmpl$34);
1571
- _$insert(_el$143, _$createComponent(Show, {
1931
+ var _el$164 = _$getNextElement(_tmpl$39);
1932
+ _$insert(_el$164, _$createComponent(Show, {
1572
1933
  get when() {
1573
1934
  return props.footerContent;
1574
1935
  },
1575
1936
  get fallback() {
1576
1937
  return [(() => {
1577
- var _el$144 = _$getNextElement(_tmpl$35),
1578
- _el$145 = _el$144.firstChild,
1579
- [_el$146, _co$36] = _$getNextMarker(_el$145.nextSibling),
1580
- _el$147 = _el$146.nextSibling,
1581
- [_el$148, _co$37] = _$getNextMarker(_el$147.nextSibling),
1582
- _el$149 = _el$148.nextSibling,
1583
- [_el$150, _co$38] = _$getNextMarker(_el$149.nextSibling),
1584
- _el$151 = _el$150.nextSibling,
1585
- [_el$152, _co$39] = _$getNextMarker(_el$151.nextSibling),
1586
- _el$153 = _el$152.nextSibling,
1587
- [_el$154, _co$40] = _$getNextMarker(_el$153.nextSibling),
1588
- _el$155 = _el$154.nextSibling,
1589
- [_el$156, _co$41] = _$getNextMarker(_el$155.nextSibling),
1590
- _el$157 = _el$156.nextSibling,
1591
- [_el$158, _co$42] = _$getNextMarker(_el$157.nextSibling);
1592
- _$insert(_el$144, () => props.footerTools, _el$146, _co$36);
1593
- _$insert(_el$144, _$createComponent(Show, {
1938
+ var _el$165 = _$getNextElement(_tmpl$40),
1939
+ _el$166 = _el$165.firstChild,
1940
+ [_el$167, _co$42] = _$getNextMarker(_el$166.nextSibling),
1941
+ _el$168 = _el$167.nextSibling,
1942
+ [_el$169, _co$43] = _$getNextMarker(_el$168.nextSibling),
1943
+ _el$170 = _el$169.nextSibling,
1944
+ [_el$171, _co$44] = _$getNextMarker(_el$170.nextSibling),
1945
+ _el$172 = _el$171.nextSibling,
1946
+ [_el$173, _co$45] = _$getNextMarker(_el$172.nextSibling),
1947
+ _el$174 = _el$173.nextSibling,
1948
+ [_el$175, _co$46] = _$getNextMarker(_el$174.nextSibling),
1949
+ _el$176 = _el$175.nextSibling,
1950
+ [_el$177, _co$47] = _$getNextMarker(_el$176.nextSibling),
1951
+ _el$178 = _el$177.nextSibling,
1952
+ [_el$179, _co$48] = _$getNextMarker(_el$178.nextSibling);
1953
+ _$insert(_el$165, () => props.footerTools, _el$167, _co$42);
1954
+ _$insert(_el$165, _$createComponent(Show, {
1594
1955
  get when() {
1595
1956
  return hasAddMenu();
1596
1957
  },
1597
1958
  get children() {
1598
1959
  return addMenu("ti ti-plus");
1599
1960
  }
1600
- }), _el$148, _co$37);
1601
- _$insert(_el$144, fileInput, _el$150, _co$38);
1602
- _$insert(_el$144, formatToggle, _el$152, _co$39);
1603
- _$insert(_el$144, emojiButton, _el$154, _co$40);
1604
- _$insert(_el$144, _$createComponent(Show, {
1961
+ }), _el$169, _co$43);
1962
+ _$insert(_el$165, fileInput, _el$171, _co$44);
1963
+ _$insert(_el$165, formatToggle, _el$173, _co$45);
1964
+ _$insert(_el$165, emojiButton, _el$175, _co$46);
1965
+ _$insert(_el$165, _$createComponent(Show, {
1605
1966
  get when() {
1606
1967
  return (props.models?.length ?? 0) > 0;
1607
1968
  },
@@ -1635,22 +1996,22 @@ export function ChatComposer(props) {
1635
1996
  }
1636
1997
  });
1637
1998
  }
1638
- }), _el$156, _co$41);
1639
- _$insert(_el$144, () => props.modelDetails, _el$158, _co$42);
1640
- return _el$144;
1999
+ }), _el$177, _co$47);
2000
+ _$insert(_el$165, () => props.modelDetails, _el$179, _co$48);
2001
+ return _el$165;
1641
2002
  })(), (() => {
1642
- var _el$159 = _$getNextElement(_tmpl$36),
1643
- _el$160 = _el$159.firstChild,
1644
- [_el$161, _co$43] = _$getNextMarker(_el$160.nextSibling),
1645
- _el$162 = _el$161.nextSibling,
1646
- [_el$163, _co$44] = _$getNextMarker(_el$162.nextSibling),
1647
- _el$164 = _el$163.nextSibling,
1648
- [_el$165, _co$45] = _$getNextMarker(_el$164.nextSibling),
1649
- _el$166 = _el$165.nextSibling,
1650
- [_el$167, _co$46] = _$getNextMarker(_el$166.nextSibling),
1651
- _el$168 = _el$167.nextSibling,
1652
- [_el$169, _co$47] = _$getNextMarker(_el$168.nextSibling);
1653
- _$insert(_el$159, _$createComponent(For, {
2003
+ var _el$180 = _$getNextElement(_tmpl$41),
2004
+ _el$181 = _el$180.firstChild,
2005
+ [_el$182, _co$49] = _$getNextMarker(_el$181.nextSibling),
2006
+ _el$183 = _el$182.nextSibling,
2007
+ [_el$184, _co$50] = _$getNextMarker(_el$183.nextSibling),
2008
+ _el$185 = _el$184.nextSibling,
2009
+ [_el$186, _co$51] = _$getNextMarker(_el$185.nextSibling),
2010
+ _el$187 = _el$186.nextSibling,
2011
+ [_el$188, _co$52] = _$getNextMarker(_el$187.nextSibling),
2012
+ _el$189 = _el$188.nextSibling,
2013
+ [_el$190, _co$53] = _$getNextMarker(_el$189.nextSibling);
2014
+ _$insert(_el$180, _$createComponent(For, {
1654
2015
  get each() {
1655
2016
  return props.contextActions;
1656
2017
  },
@@ -1674,13 +2035,13 @@ export function ChatComposer(props) {
1674
2035
  },
1675
2036
  onClick: () => reportChatFailure(() => executeChatAction(action), props.onError),
1676
2037
  get children() {
1677
- var _el$170 = _$getNextElement(_tmpl$3);
1678
- _$effect(() => _$className(_el$170, action.icon ?? "ti ti-dots"));
1679
- return _el$170;
2038
+ var _el$191 = _$getNextElement(_tmpl$3);
2039
+ _$effect(() => _$className(_el$191, action.icon ?? "ti ti-dots"));
2040
+ return _el$191;
1680
2041
  }
1681
2042
  })
1682
- }), _el$161, _co$43);
1683
- _$insert(_el$159, _$createComponent(Show, {
2043
+ }), _el$182, _co$49);
2044
+ _$insert(_el$180, _$createComponent(Show, {
1684
2045
  get when() {
1685
2046
  return _$memo(() => !!hasContextUsage())() ? props.contextUsage ?? {} : undefined;
1686
2047
  },
@@ -1692,16 +2053,16 @@ export function ChatComposer(props) {
1692
2053
  return props.onError;
1693
2054
  }
1694
2055
  }))
1695
- }), _el$163, _co$44);
1696
- _$insert(_el$159, () => props.submitTools, _el$165, _co$45);
1697
- _$insert(_el$159, microphoneControl, _el$167, _co$46);
1698
- _$insert(_el$159, sendControl, _el$169, _co$47);
1699
- return _el$159;
2056
+ }), _el$184, _co$50);
2057
+ _$insert(_el$180, () => props.submitTools, _el$186, _co$51);
2058
+ _$insert(_el$180, microphoneControl, _el$188, _co$52);
2059
+ _$insert(_el$180, sendControl, _el$190, _co$53);
2060
+ return _el$180;
1700
2061
  })()];
1701
2062
  },
1702
2063
  children: content => content()
1703
2064
  }));
1704
- return _el$143;
2065
+ return _el$164;
1705
2066
  })()];
1706
2067
  },
1707
2068
  get children() {
@@ -1710,43 +2071,43 @@ export function ChatComposer(props) {
1710
2071
  return props.error;
1711
2072
  },
1712
2073
  get children() {
1713
- var _el$60 = _$getNextElement(_tmpl$19),
1714
- _el$61 = _el$60.firstChild,
1715
- _el$62 = _el$61.nextSibling,
1716
- [_el$63, _co$11] = _$getNextMarker(_el$62.nextSibling);
1717
- _$insert(_el$60, () => props.error, _el$63, _co$11);
1718
- return _el$60;
2074
+ var _el$68 = _$getNextElement(_tmpl$22),
2075
+ _el$69 = _el$68.firstChild,
2076
+ _el$70 = _el$69.nextSibling,
2077
+ [_el$71, _co$12] = _$getNextMarker(_el$70.nextSibling);
2078
+ _$insert(_el$68, () => props.error, _el$71, _co$12);
2079
+ return _el$68;
1719
2080
  }
1720
2081
  }), _$memo(() => formatRow()), (() => {
1721
- var _el$64 = _$getNextElement(_tmpl$20),
1722
- _el$75 = _el$64.firstChild,
1723
- [_el$76, _co$16] = _$getNextMarker(_el$75.nextSibling),
2082
+ var _el$72 = _$getNextElement(_tmpl$23),
2083
+ _el$83 = _el$72.firstChild,
2084
+ [_el$84, _co$17] = _$getNextMarker(_el$83.nextSibling),
2085
+ _el$85 = _el$84.nextSibling,
2086
+ [_el$86, _co$18] = _$getNextMarker(_el$85.nextSibling),
2087
+ _el$73 = _el$86.nextSibling,
2088
+ _el$81 = _el$73.firstChild,
2089
+ [_el$82, _co$16] = _$getNextMarker(_el$81.nextSibling),
2090
+ _el$74 = _el$82.nextSibling,
2091
+ _el$75 = _el$74.firstChild,
2092
+ [_el$76, _co$13] = _$getNextMarker(_el$75.nextSibling),
1724
2093
  _el$77 = _el$76.nextSibling,
1725
- [_el$78, _co$17] = _$getNextMarker(_el$77.nextSibling),
1726
- _el$65 = _el$78.nextSibling,
1727
- _el$73 = _el$65.firstChild,
1728
- [_el$74, _co$15] = _$getNextMarker(_el$73.nextSibling),
1729
- _el$66 = _el$74.nextSibling,
1730
- _el$67 = _el$66.firstChild,
1731
- [_el$68, _co$12] = _$getNextMarker(_el$67.nextSibling),
1732
- _el$69 = _el$68.nextSibling,
1733
- [_el$70, _co$13] = _$getNextMarker(_el$69.nextSibling),
1734
- _el$71 = _el$70.nextSibling,
1735
- [_el$72, _co$14] = _$getNextMarker(_el$71.nextSibling),
1736
- _el$79 = _el$65.nextSibling,
1737
- [_el$80, _co$18] = _$getNextMarker(_el$79.nextSibling);
1738
- _$insert(_el$64, attachControl, _el$76, _co$16);
1739
- _$insert(_el$64, fileInput, _el$78, _co$17);
1740
- _$insert(_el$65, field, _el$74, _co$15);
1741
- _$insert(_el$66, formatToggle, _el$68, _co$12);
1742
- _$insert(_el$66, emojiButton, _el$70, _co$13);
1743
- _$insert(_el$66, microphoneControl, _el$72, _co$14);
1744
- _$insert(_el$64, sendControl, _el$80, _co$18);
1745
- return _el$64;
2094
+ [_el$78, _co$14] = _$getNextMarker(_el$77.nextSibling),
2095
+ _el$79 = _el$78.nextSibling,
2096
+ [_el$80, _co$15] = _$getNextMarker(_el$79.nextSibling),
2097
+ _el$87 = _el$73.nextSibling,
2098
+ [_el$88, _co$19] = _$getNextMarker(_el$87.nextSibling);
2099
+ _$insert(_el$72, attachControl, _el$84, _co$17);
2100
+ _$insert(_el$72, fileInput, _el$86, _co$18);
2101
+ _$insert(_el$73, field, _el$82, _co$16);
2102
+ _$insert(_el$74, formatToggle, _el$76, _co$13);
2103
+ _$insert(_el$74, emojiButton, _el$78, _co$14);
2104
+ _$insert(_el$74, microphoneControl, _el$80, _co$15);
2105
+ _$insert(_el$72, sendControl, _el$88, _co$19);
2106
+ return _el$72;
1746
2107
  })()];
1747
2108
  }
1748
- }), _el$86, _co$21);
1749
- _$insert(_el$57, _$createComponent(Show, {
2109
+ }), _el$94, _co$22);
2110
+ _$insert(_el$65, _$createComponent(Show, {
1750
2111
  get when() {
1751
2112
  return props.fileSelection;
1752
2113
  },
@@ -1765,16 +2126,60 @@ export function ChatComposer(props) {
1765
2126
  },
1766
2127
  onDrop: files => void runFiles(files)
1767
2128
  })
1768
- }), _el$88, _co$22);
2129
+ }), _el$96, _co$23);
2130
+ _$insert(_el$97, _$createComponent(Show, {
2131
+ get when() {
2132
+ return suggestionAnnouncement();
2133
+ },
2134
+ keyed: true,
2135
+ children: announced => (() => {
2136
+ var _el$192 = _$getNextElement(_tmpl$10);
2137
+ _$insert(_el$192, () => announced.text);
2138
+ return _el$192;
2139
+ })()
2140
+ }));
2141
+ _$insert(_el$98, _$createComponent(Show, {
2142
+ get when() {
2143
+ return _$memo(() => !!!suggestionsOpen())() && commandStatus();
2144
+ },
2145
+ children: status => (() => {
2146
+ var _el$193 = _$getNextElement(_tmpl$42),
2147
+ _el$194 = _el$193.firstChild,
2148
+ _el$195 = _el$194.nextSibling;
2149
+ _$insert(_el$195, () => status().text);
2150
+ _$effect(_p$ => {
2151
+ var _v$44 = status().tone,
2152
+ _v$45 = status().tone === "busy" ? "ti ti-loader-2 k2b-spin" : status().tone === "done" ? "ti ti-check" : "ti ti-alert-circle";
2153
+ _v$44 !== _p$.e && _$setAttribute(_el$193, "data-tone", _p$.e = _v$44);
2154
+ _v$45 !== _p$.t && _$className(_el$194, _p$.t = _v$45);
2155
+ return _p$;
2156
+ }, {
2157
+ e: undefined,
2158
+ t: undefined
2159
+ });
2160
+ return _el$193;
2161
+ })()
2162
+ }), _el$100, _co$24);
2163
+ _$insert(_el$98, _$createComponent(Show, {
2164
+ get when() {
2165
+ return _$memo(() => !!suggestionsOpen())() && announcement();
2166
+ },
2167
+ keyed: true,
2168
+ children: announced => (() => {
2169
+ var _el$196 = _$getNextElement(_tmpl$43);
2170
+ _$insert(_el$196, () => announced.text);
2171
+ return _el$196;
2172
+ })()
2173
+ }), _el$102, _co$25);
1769
2174
  _$effect(_p$ => {
1770
- var _v$15 = `k2b-chat-composer ${props.class ?? ""}`,
1771
- _v$16 = running() ? "true" : undefined,
1772
- _v$17 = conversation() ? "conversation" : undefined,
1773
- _v$18 = props.label ?? chatMessages().messageComposer;
1774
- _v$15 !== _p$.e && _$className(_el$57, _p$.e = _v$15);
1775
- _v$16 !== _p$.t && _$setAttribute(_el$57, "data-running", _p$.t = _v$16);
1776
- _v$17 !== _p$.a && _$setAttribute(_el$57, "data-variant", _p$.a = _v$17);
1777
- _v$18 !== _p$.o && _$setAttribute(_el$57, "aria-label", _p$.o = _v$18);
2175
+ var _v$24 = `k2b-chat-composer ${props.class ?? ""}`,
2176
+ _v$25 = running() ? "true" : undefined,
2177
+ _v$26 = conversation() ? "conversation" : undefined,
2178
+ _v$27 = props.label ?? chatMessages().messageComposer;
2179
+ _v$24 !== _p$.e && _$className(_el$65, _p$.e = _v$24);
2180
+ _v$25 !== _p$.t && _$setAttribute(_el$65, "data-running", _p$.t = _v$25);
2181
+ _v$26 !== _p$.a && _$setAttribute(_el$65, "data-variant", _p$.a = _v$26);
2182
+ _v$27 !== _p$.o && _$setAttribute(_el$65, "aria-label", _p$.o = _v$27);
1778
2183
  return _p$;
1779
2184
  }, {
1780
2185
  e: undefined,
@@ -1782,7 +2187,7 @@ export function ChatComposer(props) {
1782
2187
  a: undefined,
1783
2188
  o: undefined
1784
2189
  });
1785
- return _el$29;
2190
+ return _el$37;
1786
2191
  })();
1787
2192
  }
1788
2193
  _$delegateEvents(["input", "click", "keyup", "beforeinput", "keydown", "pointerdown", "mousedown"]);