@chai-ui/vue 0.7.1 → 0.9.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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { inject, computed, defineComponent, provide, renderSlot, watch, onScopeDispose, h, ref, openBlock, createElementBlock, createElementVNode, normalizeClass, createBlock, unref, Fragment, renderList, resolveDynamicComponent, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, nextTick, mergeProps, onMounted, onUnmounted, withModifiers, withCtx, withDirectives, vModelText, reactive, toValue, shallowRef } from "vue";
2
- import { reasoningEngineFor, createReasoning, regionColor, composerView, composerAttachMenuItems, MAX_ANIMATE_ENHANCE_LENGTH, enhanceRevealDurationMs, composerAttachmentsFromFiles, regionBoxStyle, REGION_CORNERS, DEFAULT_MAX_REGIONS, freeRegionNumber, EDIT_ZOOM_STEPS, regionPopoverPosition, editCardWidth, newRegion, panForZoom, clampPan, fitBox, resizeBox, regionBoxForKey, panForKey, downloadMedia, downloadFilename, shareMedia, resultModelLabel, formatTokens, formatCost, formatDuration, formatAspectRatio, SUGGESTED_ANALYSIS_MODELS, DEFAULT_MAX_ATTACHMENTS_BY_KIND, isMediaAnalyzerAtCap, mediaAnalyzerModelSections, PROMPT_LENGTH_HINT, readMediaFiles, nextMediaAnalyzerAttachments, replacedNote, createComposerStore, pickReasoning, createMediaAnalyzerStore } from "@chai-ui/core";
3
- import { DEFAULT_MAX_ATTACHMENTS_BY_KIND as DEFAULT_MAX_ATTACHMENTS_BY_KIND2, DEFAULT_MAX_REGIONS as DEFAULT_MAX_REGIONS2, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, EDIT_IMAGE_USE_CASE, GenerationError, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, SUGGESTED_ANALYSIS_MODELS as SUGGESTED_ANALYSIS_MODELS2, SUGGESTED_EDIT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, TEXT_USE_CASE, buildRegionEditPrompt, checkSuggestedModels, createFalEngine, createMockEngine, createOpenRouterEngine, isMediaAnalyzerAtCap as isMediaAnalyzerAtCap2, mockEngine, nextMediaAnalyzerAttachments as nextMediaAnalyzerAttachments2, reasoningModelFor, suggestedModels } from "@chai-ui/core";
1
+ import { inject, computed, defineComponent, provide, renderSlot, watch, onScopeDispose, h, ref, openBlock, createElementBlock, createElementVNode, normalizeClass, createBlock, unref, Fragment, renderList, resolveDynamicComponent, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, useId, nextTick, shallowRef, mergeProps, onMounted, onUnmounted, withModifiers, withCtx, withDirectives, vModelText, reactive, toValue } from "vue";
2
+ import { reasoningEngineFor, createReasoning, regionColor, MAX_ANIMATE_ENHANCE_LENGTH, enhanceRevealDurationMs, VOICE_LEVEL_COUNT, formatVoiceElapsed, composerView, composerAttachMenuItems, createVoiceInput, composerAttachmentsFromFiles, regionBoxStyle, REGION_CORNERS, DEFAULT_MAX_REGIONS, freeRegionNumber, EDIT_ZOOM_STEPS, regionPopoverPosition, editCardWidth, newRegion, panForZoom, clampPan, fitBox, resizeBox, regionBoxForKey, panForKey, downloadMedia, downloadFilename, shareMedia, resultModelLabel, formatTokens, formatCost, formatDuration, formatAspectRatio, SUGGESTED_ANALYSIS_MODELS, DEFAULT_MAX_ATTACHMENTS_BY_KIND, isMediaAnalyzerAtCap, mediaAnalyzerModelSections, PROMPT_LENGTH_HINT, readMediaFiles, nextMediaAnalyzerAttachments, replacedNote, createComposerStore, pickReasoning, createMediaAnalyzerStore } from "@chai-ui/core";
3
+ import { DEFAULT_MAX_ATTACHMENTS_BY_KIND as DEFAULT_MAX_ATTACHMENTS_BY_KIND2, DEFAULT_MAX_REGIONS as DEFAULT_MAX_REGIONS2, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, EDIT_IMAGE_USE_CASE, GenerationError, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, SUGGESTED_ANALYSIS_MODELS as SUGGESTED_ANALYSIS_MODELS2, SUGGESTED_EDIT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, TEXT_USE_CASE, buildRegionEditPrompt, checkSuggestedModels, createFalEngine, createFalTranscriber, createMockEngine, createOpenRouterEngine, isMediaAnalyzerAtCap as isMediaAnalyzerAtCap2, mockEngine, nextMediaAnalyzerAttachments as nextMediaAnalyzerAttachments2, reasoningModelFor, suggestedModels } from "@chai-ui/core";
4
4
  import "@material/web/fab/fab.js";
5
5
  import "@material/web/checkbox/checkbox.js";
6
6
  import "@material/web/textfield/outlined-text-field.js";
@@ -10,7 +10,7 @@ function useReasoning() {
10
10
  const provided = inject(reasoningKey, null);
11
11
  return computed(() => provided?.value);
12
12
  }
13
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
13
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
14
14
  __name: "ChaiProvider",
15
15
  props: {
16
16
  reasoningModel: {},
@@ -64,6 +64,7 @@ const VisibilityIcon = icon("0 -960 960 960", [{ "d": "M600.5-379.5Q650-429 650-
64
64
  const VisibilityOffIcon = icon("0 -960 960 960", [{ "d": "m629-419-44-44q26-71-27-118t-115-24l-44-44q17-11 38-16t43-5q71 0 120.5 49.5T650-500q0 22-5.5 43.5T629-419Zm129 129-40-40q49-36 85.5-80.5T857-500q-50-111-150-175.5T490-740q-42 0-86 8t-69 19l-46-47q35-16 89.5-28T485-800q143 0 261.5 81.5T920-500q-26 64-67 117t-95 93Zm58 226L648-229q-35 14-79 21.5t-89 7.5q-146 0-265-81.5T40-500q20-52 55.5-101.5T182-696L56-822l42-43 757 757-39 44ZM223-654q-37 27-71.5 71T102-500q51 111 153.5 175.5T488-260q33 0 65-4t48-12l-64-64q-11 5-27 7.5t-30 2.5q-70 0-120-49t-50-121q0-15 2.5-30t7.5-27l-97-97Zm305 142Zm-116 58Z", "fill": "currentColor" }]);
65
65
  const CheckSymbolIcon = icon("0 -960 960 960", [{ "d": "M378-246 154-470l43-43 181 181 384-384 43 43-427 427Z", "fill": "currentColor" }]);
66
66
  const CloseSymbolIcon = icon("0 -960 960 960", [{ "d": "m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z", "fill": "currentColor" }]);
67
+ const MicIcon = icon("0 -960 960 960", [{ "d": "M408-453.92q-29-30.91-29-75.08v-251q0-41.67 29.44-70.83Q437.88-880 479.94-880t71.56 29.17Q581-821.67 581-780v251q0 44.17-29 75.08Q523-423 480-423t-72-30.92ZM480-651Zm-30 531v-136q-106-11-178-89t-72-184h60q0 91 64.29 153t155.5 62q91.21 0 155.71-62Q700-438 700-529h60q0 106-72 184t-178 89v136h-60Zm59.5-376.5Q521-510 521-529v-251q0-17-11.79-28.5T480-820q-17.42 0-29.21 11.5T439-780v251q0 19 11.5 32.5T480-483q18 0 29.5-13.5Z", "fill": "currentColor" }]);
67
68
  const StopIcon = icon("0 -960 960 960", [{ "d": "M240-240v-480h480v480H240Z", "fill": "currentColor" }]);
68
69
  const ThumbUpIcon = icon("0 0 18 18", [{ "d": "M5.25039 15.7502V6.00019L10.5004 0.750193L11.8879 2.13769L10.9129 6.00019H17.2504V9.30019L14.5129 15.7502H5.25039ZM6.75039 14.2502H13.5004L15.7504 9.00019V7.50019H9.00039L10.0129 3.37519L6.75039 6.63769V14.2502ZM1.50039 15.7502V6.00019H5.25039V7.50019H3.00039V14.2502H5.25039V15.7502H1.50039Z", "fill": "currentColor" }], true);
69
70
  const ThumbDownIcon = icon("0 0 18 18", [{ "d": "M2.24961 12C1.84961 12 1.49961 11.85 1.19961 11.55C0.899615 11.25 0.749615 10.9 0.749615 10.5V9C0.749615 8.9125 0.762115 8.81875 0.787115 8.71875C0.812115 8.61875 0.837115 8.525 0.862115 8.4375L3.11211 3.15C3.22461 2.9 3.41211 2.6875 3.67461 2.5125C3.93711 2.3375 4.21211 2.25 4.49961 2.25H12.7496V12L8.24961 16.4625C8.06211 16.65 7.84024 16.7594 7.58399 16.7906C7.32774 16.8219 7.08086 16.775 6.84336 16.65C6.60586 16.525 6.43086 16.35 6.31836 16.125C6.20586 15.9 6.18086 15.6688 6.24336 15.4313L7.08711 12H2.24961ZM11.2496 11.3625V3.75H4.49961L2.24961 9V10.5H8.99961L7.98711 14.625L11.2496 11.3625ZM14.9996 2.25C15.4121 2.25 15.7652 2.39688 16.059 2.69063C16.3527 2.98438 16.4996 3.3375 16.4996 3.75V10.5C16.4996 10.9125 16.3527 11.2656 16.059 11.5594C15.7652 11.8531 15.4121 12 14.9996 12H12.7496V10.5H14.9996V3.75H12.7496V2.25H14.9996Z", "fill": "currentColor" }], true);
@@ -86,24 +87,25 @@ const OptimizeIcon = icon("0 0 25 24", [{ "d": "M5 19H6.425L16.2 9.225L14.775 7.
86
87
  const UndoIcon = icon("0 -960 960 960", [{ "d": "M259-200v-60h310q70 0 120.5-46.5T740-422q0-69-50.5-115.5T569-584H274l114 114-42 42-186-186 186-186 42 42-114 114h294q95 0 163.5 64T800-422q0 94-68.5 158T568-200H259Z", "fill": "currentColor" }]);
87
88
  const AttachFileIcon = icon("0 -960 960 960", [{ "d": "M728-326q0 103-72.18 174.5-72.17 71.5-175 71.5Q378-80 305.5-151.5T233-326v-380q0-72.5 51.5-123.25T408-880q72 0 123.5 50.75T583-706v360q0 42-30 72t-72.5 30q-42.5 0-72.5-29.67-30-29.68-30-72.33v-370h60v370q0 17 12.5 29.5t30.64 12.5q18.14 0 30-12.5T523-346v-360q0-48-33.5-81t-81.71-33q-48.21 0-81.5 33.06T293-706v380q0 78 54.97 132T481-140q77.92 0 132.46-54Q668-248 668-326v-390h60v390Z", "fill": "currentColor" }]);
88
89
  const ImageIcon = icon("0 -960 960 960", [{ "d": "M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm56-97h489L578-473 446-302l-93-127-117 152Zm-56 97v-600 600Z", "fill": "currentColor" }]);
90
+ const GlobeIcon = icon("0 -960 960 960", [{ "d": "M480.27-80q-82.74 0-155.5-31.5Q252-143 197.5-197.5t-86-127.34Q80-397.68 80-480.5t31.5-155.66Q143-709 197.5-763t127.34-85.5Q397.68-880 480.5-880t155.66 31.5Q709-817 763-763t85.5 127Q880-563 880-480.27q0 82.74-31.5 155.5Q817-252 763-197.68q-54 54.31-127 86Q563-80 480.27-80Zm-.27-60q142.38 0 241.19-99.5T820-480v-13q-6 26-27.41 43.5Q771.19-432 742-432h-80q-33 0-56.5-23.5T582-512v-40H422v-80q0-33 23.5-56.5T502-712h40v-22q0-16 13.5-40t30.5-29q-25-8-51.36-12.5Q508.29-820 480-820q-141 0-240.5 98.81T140-480h150q66 0 113 47t47 113v40H330v105q34 17 71.7 26t78.3 9Z", "fill": "currentColor" }]);
89
91
  const VideocamIcon = icon("0 -960 960 960", [{ "d": "M140-160q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h520q24 0 42 18t18 42v215l160-160v410L720-435v215q0 24-18 42t-42 18H140Zm0-60h520v-520H140v520Zm0 0v-520 520Z", "fill": "currentColor" }]);
90
92
  const ContentCutIcon = icon("0 -960 960 960", [{ "d": "M782-114 481-415 364-298q11 17 13.5 33t2.5 35q0 64-43 107T230-80q-64 0-107-43T80-230q0-64 43-107t107-43q18 0 35.5 5t36.5 15l116-116-118-118q-17 8-34.5 11t-35.5 3q-64 0-107-43T80-730q0-64 43-107t107-43q64 0 107 43t43 107q0 19-2.5 36T367-662l514 514v34h-99ZM599-527l-66-66 249-249h99v33L599-527ZM294-666q26-26 26-64t-26-64q-26-26-64-26t-64 26q-26 26-26 64t26 64q26 26 64 26t64-26Zm202.5 203.5Q502-468 502-476t-5.5-13.5Q491-495 483-495t-13.5 5.5Q464-484 464-476t5.5 13.5Q475-457 483-457t13.5-5.5ZM294-166q26-26 26-64t-26-64q-26-26-64-26t-64 26q-26 26-26 64t26 64q26 26 64 26t64-26Z", "fill": "currentColor" }]);
91
93
  const MusicNoteIcon = icon("0 -960 960 960", [{ "d": "M286.5-163.5Q243-207 243-270t43.5-106.5Q330-420 393-420q28 0 50.5 8t39.5 22v-450h234v135H543v435q0 63-43.5 106.5T393-120q-63 0-106.5-43.5Z", "fill": "currentColor" }]);
92
- const _hoisted_1$g = ["disabled", "aria-expanded", "aria-label"];
93
- const _hoisted_2$b = {
94
+ const _hoisted_1$j = ["disabled", "aria-expanded", "aria-label"];
95
+ const _hoisted_2$e = {
94
96
  key: 0,
95
97
  class: "chai-composer__attach-menu",
96
98
  role: "menu"
97
99
  };
98
- const _hoisted_3$9 = ["onClick"];
99
- const _hoisted_4$7 = { class: "chai-composer__attach-menu-icon" };
100
- const _hoisted_5$6 = {
100
+ const _hoisted_3$c = ["onClick"];
101
+ const _hoisted_4$9 = { class: "chai-composer__attach-menu-icon" };
102
+ const _hoisted_5$7 = {
101
103
  key: 0,
102
104
  class: "chai-composer__attach-menu-divider",
103
105
  role: "separator"
104
106
  };
105
- const _hoisted_6$6 = ["accept", "multiple", "disabled"];
106
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
107
+ const _hoisted_6$7 = ["accept", "multiple", "disabled"];
108
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
107
109
  __name: "AttachMenu",
108
110
  props: {
109
111
  items: {},
@@ -113,7 +115,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
113
115
  emits: ["select", "files"],
114
116
  setup(__props, { emit: __emit }) {
115
117
  const emit = __emit;
116
- const ICONS = { "add-media": AttachFileIcon, "create-image": ImageIcon, "create-video": VideocamIcon, "edit-media": ContentCutIcon };
118
+ const ICONS = { "add-media": AttachFileIcon, "create-image": ImageIcon, "create-video": VideocamIcon, "create-world": GlobeIcon, "edit-media": ContentCutIcon };
117
119
  const open = ref(false);
118
120
  const root = ref();
119
121
  const input = ref();
@@ -144,8 +146,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
144
146
  onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
145
147
  }, [
146
148
  open.value ? (openBlock(), createBlock(unref(CloseSymbolIcon), { key: 0 })) : (openBlock(), createBlock(unref(PlusIcon), { key: 1 }))
147
- ], 10, _hoisted_1$g),
148
- open.value ? (openBlock(), createElementBlock("ul", _hoisted_2$b, [
149
+ ], 10, _hoisted_1$j),
150
+ open.value ? (openBlock(), createElementBlock("ul", _hoisted_2$e, [
149
151
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, i) => {
150
152
  return openBlock(), createElementBlock("li", {
151
153
  key: item.action,
@@ -157,12 +159,12 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
157
159
  class: "chai-composer__attach-menu-item",
158
160
  onClick: ($event) => pick(item.action)
159
161
  }, [
160
- createElementVNode("span", _hoisted_4$7, [
162
+ createElementVNode("span", _hoisted_4$9, [
161
163
  (openBlock(), createBlock(resolveDynamicComponent(ICONS[item.action])))
162
164
  ]),
163
165
  createTextVNode(toDisplayString(item.label), 1)
164
- ], 8, _hoisted_3$9),
165
- item.divider && i < __props.items.length - 1 ? (openBlock(), createElementBlock("hr", _hoisted_5$6)) : createCommentVNode("", true)
166
+ ], 8, _hoisted_3$c),
167
+ item.divider && i < __props.items.length - 1 ? (openBlock(), createElementBlock("hr", _hoisted_5$7)) : createCommentVNode("", true)
166
168
  ]);
167
169
  }), 128))
168
170
  ])) : createCommentVNode("", true),
@@ -175,18 +177,18 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
175
177
  hidden: "",
176
178
  disabled: __props.disabled,
177
179
  onChange: onFileChange
178
- }, null, 40, _hoisted_6$6)
180
+ }, null, 40, _hoisted_6$7)
179
181
  ], 512);
180
182
  };
181
183
  }
182
184
  });
183
- const _hoisted_1$f = {
185
+ const _hoisted_1$i = {
184
186
  key: 0,
185
187
  class: "chai-composer__region-badge",
186
188
  "aria-hidden": "true"
187
189
  };
188
- const _hoisted_2$a = ["disabled", "aria-label"];
189
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
190
+ const _hoisted_2$d = ["disabled", "aria-label"];
191
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
190
192
  __name: "Chip",
191
193
  props: {
192
194
  label: {},
@@ -202,7 +204,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
202
204
  class: normalizeClass(["chai-composer__chip", { "chai-composer__chip--region": __props.regionNumber != null }]),
203
205
  style: normalizeStyle(__props.regionNumber != null ? { "--chai-region-color": unref(regionColor)(__props.regionNumber) } : void 0)
204
206
  }, [
205
- __props.regionNumber != null ? (openBlock(), createElementBlock("span", _hoisted_1$f, toDisplayString(__props.regionNumber), 1)) : createCommentVNode("", true),
207
+ __props.regionNumber != null ? (openBlock(), createElementBlock("span", _hoisted_1$i, toDisplayString(__props.regionNumber), 1)) : createCommentVNode("", true),
206
208
  createTextVNode(toDisplayString(__props.label), 1),
207
209
  __props.removable ? (openBlock(), createElementBlock("button", {
208
210
  key: 1,
@@ -213,11 +215,272 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
213
215
  onClick: _cache[0] || (_cache[0] = ($event) => emit("remove"))
214
216
  }, [
215
217
  createVNode(unref(CloseSymbolIcon))
216
- ], 8, _hoisted_2$a)) : createCommentVNode("", true)
218
+ ], 8, _hoisted_2$d)) : createCommentVNode("", true)
217
219
  ], 6);
218
220
  };
219
221
  }
220
222
  });
223
+ const _hoisted_1$h = {
224
+ key: 0,
225
+ class: "chai-composer__world-field"
226
+ };
227
+ const _hoisted_2$c = { class: "chai-composer__world-field-head" };
228
+ const _hoisted_3$b = ["for"];
229
+ const _hoisted_4$8 = ["disabled", "aria-label", "title"];
230
+ const _hoisted_5$6 = { class: "chai-composer__field chai-composer__field--boxed" };
231
+ const _hoisted_6$6 = ["id", "value", "placeholder", "aria-describedby", "disabled"];
232
+ const _hoisted_7$6 = {
233
+ key: 0,
234
+ class: "chai-composer__reveal chai-composer__type",
235
+ "aria-hidden": "true"
236
+ };
237
+ const _hoisted_8$6 = { class: "chai-composer__reveal-text" };
238
+ const _hoisted_9$6 = ["id"];
239
+ const _hoisted_10$6 = {
240
+ key: 1,
241
+ class: "chai-composer__field"
242
+ };
243
+ const _hoisted_11$5 = ["id", "value", "placeholder", "aria-label", "disabled"];
244
+ const _hoisted_12$5 = {
245
+ key: 0,
246
+ class: "chai-composer__reveal chai-composer__type",
247
+ "aria-hidden": "true"
248
+ };
249
+ const _hoisted_13$5 = { class: "chai-composer__reveal-text" };
250
+ const _hoisted_14$5 = ["disabled", "aria-label", "title"];
251
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
252
+ __name: "PromptField",
253
+ props: {
254
+ value: {},
255
+ placeholder: {},
256
+ label: {},
257
+ heading: {},
258
+ note: {},
259
+ hint: {},
260
+ onEnhance: { type: Function },
261
+ enhancing: { type: Boolean },
262
+ disabled: { type: Boolean }
263
+ },
264
+ emits: ["change"],
265
+ setup(__props, { emit: __emit }) {
266
+ const props = __props;
267
+ const emit = __emit;
268
+ const id = useId();
269
+ const textarea = ref();
270
+ watch(
271
+ () => props.value,
272
+ () => {
273
+ const el = textarea.value;
274
+ if (!el) return;
275
+ el.style.height = "auto";
276
+ el.style.height = `${el.scrollHeight}px`;
277
+ },
278
+ { flush: "post", immediate: true }
279
+ );
280
+ const originalValue = ref(null);
281
+ const enhancedValue = ref(null);
282
+ const animatingText = ref(null);
283
+ const revealedLength = ref(0);
284
+ let raf = 0;
285
+ watch(
286
+ () => props.enhancing,
287
+ (now, was) => {
288
+ if (!was || now || originalValue.value == null || props.value === originalValue.value) return;
289
+ const value = props.value;
290
+ enhancedValue.value = value;
291
+ if (value.length > MAX_ANIMATE_ENHANCE_LENGTH || window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
292
+ animatingText.value = value;
293
+ revealedLength.value = 0;
294
+ const duration = enhanceRevealDurationMs(value.length);
295
+ const start = performance.now();
296
+ const tick = (time) => {
297
+ revealedLength.value = Math.min(value.length, Math.floor((time - start) / duration * value.length));
298
+ if (revealedLength.value < value.length) raf = requestAnimationFrame(tick);
299
+ else animatingText.value = null;
300
+ };
301
+ raf = requestAnimationFrame(tick);
302
+ }
303
+ );
304
+ onScopeDispose(() => cancelAnimationFrame(raf));
305
+ const animating = computed(() => animatingText.value != null);
306
+ const isEnhanced = computed(() => !animating.value && enhancedValue.value != null && props.value === enhancedValue.value);
307
+ const enhanceBusy = computed(() => props.enhancing || animating.value);
308
+ const optimizeName = computed(
309
+ () => `${isEnhanced.value ? "Revert to original" : "Optimize"} ${props.heading ? props.heading.toLowerCase() : "prompt"}`
310
+ );
311
+ function onOptimizeClick() {
312
+ if (isEnhanced.value) {
313
+ const original = originalValue.value;
314
+ enhancedValue.value = null;
315
+ originalValue.value = null;
316
+ if (original != null) emit("change", original);
317
+ return;
318
+ }
319
+ originalValue.value = props.value;
320
+ props.onEnhance?.(props.value);
321
+ }
322
+ return (_ctx, _cache) => {
323
+ return __props.heading ? (openBlock(), createElementBlock("div", _hoisted_1$h, [
324
+ createElementVNode("div", _hoisted_2$c, [
325
+ createElementVNode("label", {
326
+ for: unref(id),
327
+ class: "chai-composer__world-field-label"
328
+ }, [
329
+ createElementVNode("strong", null, toDisplayString(__props.heading), 1),
330
+ createTextVNode(" " + toDisplayString(__props.note), 1)
331
+ ], 8, _hoisted_3$b),
332
+ __props.onEnhance ? (openBlock(), createElementBlock("button", {
333
+ key: 0,
334
+ type: "button",
335
+ class: normalizeClass(["chai-composer__optimize", { "chai-composer__optimize--active": enhanceBusy.value }]),
336
+ disabled: __props.disabled || (isEnhanced.value ? false : !__props.value.trim() || enhanceBusy.value),
337
+ "aria-label": optimizeName.value,
338
+ title: optimizeName.value,
339
+ onClick: onOptimizeClick
340
+ }, [
341
+ isEnhanced.value ? (openBlock(), createBlock(unref(UndoIcon), { key: 0 })) : (openBlock(), createBlock(unref(OptimizeIcon), { key: 1 }))
342
+ ], 10, _hoisted_4$8)) : createCommentVNode("", true)
343
+ ]),
344
+ createElementVNode("div", _hoisted_5$6, [
345
+ createElementVNode("textarea", {
346
+ id: unref(id),
347
+ ref_key: "textarea",
348
+ ref: textarea,
349
+ class: normalizeClass(["chai-composer__input chai-composer__type", { "chai-composer__input--revealing": animating.value }]),
350
+ value: __props.value,
351
+ placeholder: __props.placeholder,
352
+ "aria-describedby": __props.hint ? `${unref(id)}-hint` : void 0,
353
+ rows: "1",
354
+ disabled: __props.disabled || animating.value,
355
+ onInput: _cache[0] || (_cache[0] = ($event) => emit("change", $event.target.value))
356
+ }, null, 42, _hoisted_6$6),
357
+ animating.value ? (openBlock(), createElementBlock("div", _hoisted_7$6, [
358
+ createElementVNode("span", _hoisted_8$6, toDisplayString(animatingText.value.slice(0, revealedLength.value)), 1)
359
+ ])) : createCommentVNode("", true)
360
+ ]),
361
+ __props.hint ? (openBlock(), createElementBlock("p", {
362
+ key: 0,
363
+ id: `${unref(id)}-hint`,
364
+ class: "chai-composer__field-hint"
365
+ }, toDisplayString(__props.hint), 9, _hoisted_9$6)) : createCommentVNode("", true)
366
+ ])) : (openBlock(), createElementBlock("div", _hoisted_10$6, [
367
+ createElementVNode("textarea", {
368
+ id: unref(id),
369
+ ref_key: "textarea",
370
+ ref: textarea,
371
+ class: normalizeClass(["chai-composer__input chai-composer__type", { "chai-composer__input--revealing": animating.value }]),
372
+ value: __props.value,
373
+ placeholder: __props.placeholder,
374
+ "aria-label": __props.label ?? __props.placeholder,
375
+ rows: "1",
376
+ disabled: __props.disabled || animating.value,
377
+ onInput: _cache[1] || (_cache[1] = ($event) => emit("change", $event.target.value))
378
+ }, null, 42, _hoisted_11$5),
379
+ animating.value ? (openBlock(), createElementBlock("div", _hoisted_12$5, [
380
+ createElementVNode("span", _hoisted_13$5, toDisplayString(animatingText.value.slice(0, revealedLength.value)), 1)
381
+ ])) : createCommentVNode("", true),
382
+ __props.onEnhance ? (openBlock(), createElementBlock("button", {
383
+ key: 1,
384
+ type: "button",
385
+ class: normalizeClass(["chai-composer__optimize", { "chai-composer__optimize--active": enhanceBusy.value }]),
386
+ disabled: __props.disabled || (isEnhanced.value ? false : !__props.value.trim() || enhanceBusy.value),
387
+ "aria-label": optimizeName.value,
388
+ title: optimizeName.value,
389
+ onClick: onOptimizeClick
390
+ }, [
391
+ isEnhanced.value ? (openBlock(), createBlock(unref(UndoIcon), { key: 0 })) : (openBlock(), createBlock(unref(OptimizeIcon), { key: 1 }))
392
+ ], 10, _hoisted_14$5)) : createCommentVNode("", true)
393
+ ]));
394
+ };
395
+ }
396
+ });
397
+ const _hoisted_1$g = ["data-status"];
398
+ const _hoisted_2$b = ["disabled", "aria-label", "title"];
399
+ const _hoisted_3$a = {
400
+ key: 0,
401
+ class: "chai-composer__voice-spinner",
402
+ "aria-hidden": "true"
403
+ };
404
+ const _hoisted_4$7 = {
405
+ class: "chai-visually-hidden",
406
+ role: "status"
407
+ };
408
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
409
+ __name: "VoiceButton",
410
+ props: {
411
+ voice: {},
412
+ state: {},
413
+ disabled: { type: Boolean }
414
+ },
415
+ setup(__props) {
416
+ const props = __props;
417
+ const label = computed(
418
+ () => props.state.status === "recording" ? "Stop recording and transcribe" : props.state.status === "transcribing" ? "Cancel transcription" : "Start voice input"
419
+ );
420
+ function onClick() {
421
+ const { status } = props.state;
422
+ if (status === "recording") props.voice.stop();
423
+ else if (status === "transcribing") props.voice.cancel();
424
+ else {
425
+ props.voice.dismiss();
426
+ void props.voice.start();
427
+ }
428
+ }
429
+ function onKeydown(e) {
430
+ if (e.key === "Escape" && props.state.status === "recording") props.voice.cancel();
431
+ }
432
+ return (_ctx, _cache) => {
433
+ return openBlock(), createElementBlock("div", {
434
+ class: "chai-composer__voice",
435
+ "data-status": __props.state.status
436
+ }, [
437
+ createElementVNode("button", {
438
+ type: "button",
439
+ class: "chai-composer__voice-button",
440
+ disabled: __props.disabled,
441
+ "aria-label": label.value,
442
+ title: label.value,
443
+ onClick,
444
+ onKeydown
445
+ }, [
446
+ __props.state.status === "transcribing" ? (openBlock(), createElementBlock("span", _hoisted_3$a)) : __props.state.status === "recording" ? (openBlock(), createBlock(unref(StopIcon), { key: 1 })) : (openBlock(), createBlock(unref(MicIcon), { key: 2 }))
447
+ ], 40, _hoisted_2$b),
448
+ createElementVNode("span", _hoisted_4$7, toDisplayString(__props.state.status === "recording" ? "Recording" : __props.state.status === "transcribing" ? "Transcribing" : ""), 1)
449
+ ], 8, _hoisted_1$g);
450
+ };
451
+ }
452
+ });
453
+ const _hoisted_1$f = {
454
+ class: "chai-composer__waveform",
455
+ "aria-hidden": "true"
456
+ };
457
+ const _hoisted_2$a = { class: "chai-composer__waveform-bars" };
458
+ const _hoisted_3$9 = { class: "chai-composer__waveform-time" };
459
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
460
+ __name: "VoiceWaveform",
461
+ props: {
462
+ levels: {},
463
+ elapsedMs: {}
464
+ },
465
+ setup(__props) {
466
+ const props = __props;
467
+ const bars = computed(() => [...Array(Math.max(0, VOICE_LEVEL_COUNT - props.levels.length)).fill(0), ...props.levels]);
468
+ return (_ctx, _cache) => {
469
+ return openBlock(), createElementBlock("div", _hoisted_1$f, [
470
+ createElementVNode("div", _hoisted_2$a, [
471
+ (openBlock(true), createElementBlock(Fragment, null, renderList(bars.value, (level, i) => {
472
+ return openBlock(), createElementBlock("span", {
473
+ key: i,
474
+ class: "chai-composer__waveform-bar",
475
+ style: normalizeStyle({ height: `${Math.max(20, level * 100)}%` })
476
+ }, null, 4);
477
+ }), 128))
478
+ ]),
479
+ createElementVNode("span", _hoisted_3$9, toDisplayString(unref(formatVoiceElapsed)(__props.elapsedMs)), 1)
480
+ ]);
481
+ };
482
+ }
483
+ });
221
484
  const _hoisted_1$e = ["aria-label", ".selected", ".disabled"];
222
485
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
223
486
  __name: "Toggle",
@@ -261,12 +524,12 @@ const _hoisted_11$4 = ["aria-label"];
261
524
  const _hoisted_12$4 = ["aria-pressed", "disabled", "onClick"];
262
525
  const _hoisted_13$4 = [".checked", ".disabled"];
263
526
  const _hoisted_14$4 = { class: "chai-search-menu__option-label" };
264
- const _hoisted_15$4 = {
527
+ const _hoisted_15$3 = {
265
528
  key: 1,
266
529
  class: "chai-search-menu__divider",
267
530
  role: "separator"
268
531
  };
269
- const _hoisted_16$3 = {
532
+ const _hoisted_16$2 = {
270
533
  key: 0,
271
534
  class: "chai-search-menu__empty"
272
535
  };
@@ -466,10 +729,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
466
729
  ]);
467
730
  }), 128))
468
731
  ], 8, _hoisted_11$4),
469
- i < groups.value.length - 1 ? (openBlock(), createElementBlock("hr", _hoisted_15$4)) : createCommentVNode("", true)
732
+ i < groups.value.length - 1 ? (openBlock(), createElementBlock("hr", _hoisted_15$3)) : createCommentVNode("", true)
470
733
  ]);
471
734
  }), 128)),
472
- !hasAnyOption.value ? (openBlock(), createElementBlock("li", _hoisted_16$3, "No matches.")) : createCommentVNode("", true)
735
+ !hasAnyOption.value ? (openBlock(), createElementBlock("li", _hoisted_16$2, "No matches.")) : createCommentVNode("", true)
473
736
  ])
474
737
  ], 12, _hoisted_3$8)) : createCommentVNode("", true)
475
738
  ], 512);
@@ -492,24 +755,25 @@ const _hoisted_6$4 = {
492
755
  class: "chai-composer__regions",
493
756
  "aria-label": "Edit regions"
494
757
  };
495
- const _hoisted_7$4 = { class: "chai-composer__field" };
496
- const _hoisted_8$4 = ["value", "placeholder", "aria-label", "disabled"];
497
- const _hoisted_9$4 = {
498
- key: 0,
499
- class: "chai-composer__reveal chai-composer__type",
500
- "aria-hidden": "true"
758
+ const _hoisted_7$4 = {
759
+ key: 3,
760
+ class: "chai-composer__world-fields"
501
761
  };
502
- const _hoisted_10$4 = { class: "chai-composer__reveal-text" };
503
- const _hoisted_11$3 = ["disabled", "aria-label", "title"];
504
- const _hoisted_12$3 = {
505
- key: 2,
762
+ const _hoisted_8$4 = {
763
+ key: 5,
506
764
  class: "chai-composer__error",
507
765
  role: "alert"
508
766
  };
509
- const _hoisted_13$3 = { class: "chai-composer__controls" };
510
- const _hoisted_14$3 = { class: "chai-composer__controls-start" };
511
- const _hoisted_15$3 = ["data-ready", "data-error", "data-stop", "aria-label", "aria-disabled"];
512
- const _hoisted_16$2 = { slot: "icon" };
767
+ const _hoisted_9$4 = {
768
+ key: 6,
769
+ class: "chai-composer__error",
770
+ role: "alert"
771
+ };
772
+ const _hoisted_10$4 = { class: "chai-composer__controls" };
773
+ const _hoisted_11$3 = { class: "chai-composer__controls-start" };
774
+ const _hoisted_12$3 = { class: "chai-composer__controls-end" };
775
+ const _hoisted_13$3 = ["data-ready", "data-error", "data-stop", "aria-label", "aria-disabled"];
776
+ const _hoisted_14$3 = { slot: "icon" };
513
777
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
514
778
  __name: "Composer",
515
779
  props: {
@@ -539,6 +803,10 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
539
803
  "onUpdate:aspectRatio": {},
540
804
  onEnhance: {},
541
805
  enhancing: { type: Boolean },
806
+ character: { default: "" },
807
+ "onUpdate:character": {},
808
+ frameRate: { default: null },
809
+ "onUpdate:frameRate": {},
542
810
  submitError: { default: null },
543
811
  submitDisabled: { type: Boolean, default: void 0 },
544
812
  submitting: { type: Boolean },
@@ -547,6 +815,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
547
815
  attachMenuActions: {},
548
816
  regions: { default: () => [] },
549
817
  "onUpdate:regions": {},
818
+ voiceInput: {},
550
819
  disabled: { type: Boolean }
551
820
  },
552
821
  emits: ["update:modelValue", "submit", "unsupportedFile"],
@@ -588,56 +857,24 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
588
857
  if (view.value.multiModel) props["onUpdate:modelIds"]?.(view.value.toggledModelIds(id));
589
858
  else props["onUpdate:modelId"]?.(id);
590
859
  }
591
- const textarea = ref();
592
- watch(
593
- () => props.modelValue,
594
- () => {
595
- const el = textarea.value;
596
- if (!el) return;
597
- el.style.height = "auto";
598
- el.style.height = `${el.scrollHeight}px`;
599
- },
600
- { flush: "post", immediate: true }
601
- );
602
- const originalValue = ref(null);
603
- const enhancedValue = ref(null);
604
- const animatingText = ref(null);
605
- const revealedLength = ref(0);
606
- let raf = 0;
607
- watch(
608
- () => props.enhancing,
609
- (now, was) => {
610
- if (!was || now || originalValue.value == null || props.modelValue === originalValue.value) return;
611
- const value = props.modelValue;
612
- enhancedValue.value = value;
613
- if (value.length > MAX_ANIMATE_ENHANCE_LENGTH || window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
614
- animatingText.value = value;
615
- revealedLength.value = 0;
616
- const duration = enhanceRevealDurationMs(value.length);
617
- const start = performance.now();
618
- const tick = (time) => {
619
- revealedLength.value = Math.min(value.length, Math.floor((time - start) / duration * value.length));
620
- if (revealedLength.value < value.length) raf = requestAnimationFrame(tick);
621
- else animatingText.value = null;
622
- };
623
- raf = requestAnimationFrame(tick);
860
+ const enhancingField = ref("prompt");
861
+ const enhanceField = (field) => props.onEnhance && ((current) => {
862
+ enhancingField.value = field;
863
+ props.onEnhance?.(current, field, view.value.enhanceMode);
864
+ });
865
+ const voice = createVoiceInput(
866
+ () => props.voiceInput ?? { transcribe: async () => "" },
867
+ (text) => {
868
+ const current = props.modelValue;
869
+ emit("update:modelValue", current.trim() ? `${current.trimEnd()} ${text}` : text);
624
870
  }
625
871
  );
626
- onScopeDispose(() => cancelAnimationFrame(raf));
627
- const animating = computed(() => animatingText.value != null);
628
- const isEnhanced = computed(() => !animating.value && enhancedValue.value != null && props.modelValue === enhancedValue.value);
629
- const enhanceBusy = computed(() => Boolean(props.enhancing) || animating.value);
630
- function onOptimizeClick() {
631
- if (isEnhanced.value) {
632
- const original = originalValue.value;
633
- enhancedValue.value = null;
634
- originalValue.value = null;
635
- if (original != null) emit("update:modelValue", original);
636
- return;
637
- }
638
- originalValue.value = props.modelValue;
639
- props.onEnhance?.(props.modelValue);
640
- }
872
+ const voiceState = shallowRef(voice.getState());
873
+ const stopVoice = voice.subscribe(() => voiceState.value = voice.getState());
874
+ onScopeDispose(() => {
875
+ stopVoice();
876
+ voice.dispose();
877
+ });
641
878
  async function onFiles(files) {
642
879
  const onAttachments = props["onUpdate:attachments"];
643
880
  if (!files || files.length === 0 || !onAttachments) return;
@@ -686,7 +923,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
686
923
  return openBlock(), createElementBlock("li", {
687
924
  key: r.id
688
925
  }, [
689
- createVNode(_sfc_main$f, {
926
+ createVNode(_sfc_main$i, {
690
927
  label: `Region ${r.number}`,
691
928
  "region-number": r.number,
692
929
  removable: Boolean(props["onUpdate:regions"]),
@@ -696,49 +933,63 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
696
933
  ]);
697
934
  }), 128))
698
935
  ])) : createCommentVNode("", true),
699
- createElementVNode("div", _hoisted_7$4, [
700
- createElementVNode("textarea", {
701
- ref_key: "textarea",
702
- ref: textarea,
703
- class: normalizeClass(["chai-composer__input chai-composer__type", { "chai-composer__input--revealing": animating.value }]),
936
+ __props.voiceInput && voiceState.value.status === "recording" ? (openBlock(), createBlock(_sfc_main$f, {
937
+ key: 2,
938
+ levels: voiceState.value.levels,
939
+ "elapsed-ms": voiceState.value.elapsedMs
940
+ }, null, 8, ["levels", "elapsed-ms"])) : view.value.world ? (openBlock(), createElementBlock("div", _hoisted_7$4, [
941
+ createVNode(_sfc_main$h, {
704
942
  value: __props.modelValue,
705
943
  placeholder: view.value.placeholder,
706
- "aria-label": __props.promptLabel ?? view.value.placeholder,
707
- rows: "1",
708
- disabled: __props.disabled || animating.value,
709
- onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
710
- }, null, 42, _hoisted_8$4),
711
- animating.value ? (openBlock(), createElementBlock("div", _hoisted_9$4, [
712
- createElementVNode("span", _hoisted_10$4, toDisplayString(animatingText.value.slice(0, revealedLength.value)), 1)
713
- ])) : createCommentVNode("", true),
714
- __props.onEnhance ? (openBlock(), createElementBlock("button", {
715
- key: 1,
716
- type: "button",
717
- class: normalizeClass(["chai-composer__optimize", { "chai-composer__optimize--active": enhanceBusy.value }]),
718
- disabled: __props.disabled || (isEnhanced.value ? false : !__props.modelValue.trim() || enhanceBusy.value),
719
- "aria-label": isEnhanced.value ? "Revert to original prompt" : "Optimize prompt",
720
- title: isEnhanced.value ? "Revert to original prompt" : "Optimize prompt",
721
- onClick: onOptimizeClick
722
- }, [
723
- isEnhanced.value ? (openBlock(), createBlock(unref(UndoIcon), { key: 0 })) : (openBlock(), createBlock(unref(OptimizeIcon), { key: 1 }))
724
- ], 10, _hoisted_11$3)) : createCommentVNode("", true)
725
- ]),
726
- __props.submitError ? (openBlock(), createElementBlock("p", _hoisted_12$3, [
944
+ heading: "Environment",
945
+ note: "(required)",
946
+ hint: view.value.environmentHint,
947
+ "on-enhance": enhanceField("environment"),
948
+ enhancing: Boolean(__props.enhancing) && enhancingField.value === "environment",
949
+ disabled: __props.disabled,
950
+ onChange: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
951
+ }, null, 8, ["value", "placeholder", "hint", "on-enhance", "enhancing", "disabled"]),
952
+ props["onUpdate:character"] ? (openBlock(), createBlock(_sfc_main$h, {
953
+ key: 0,
954
+ value: __props.character,
955
+ placeholder: view.value.characterPlaceholder,
956
+ heading: "Character",
957
+ note: "(optional)",
958
+ "on-enhance": enhanceField("character"),
959
+ enhancing: Boolean(__props.enhancing) && enhancingField.value === "character",
960
+ disabled: __props.disabled,
961
+ onChange: _cache[1] || (_cache[1] = ($event) => props["onUpdate:character"]?.($event))
962
+ }, null, 8, ["value", "placeholder", "on-enhance", "enhancing", "disabled"])) : createCommentVNode("", true)
963
+ ])) : (openBlock(), createBlock(_sfc_main$h, {
964
+ key: 4,
965
+ value: __props.modelValue,
966
+ placeholder: view.value.placeholder,
967
+ label: __props.promptLabel,
968
+ "on-enhance": enhanceField("prompt"),
969
+ enhancing: Boolean(__props.enhancing),
970
+ disabled: __props.disabled,
971
+ onChange: _cache[2] || (_cache[2] = ($event) => emit("update:modelValue", $event))
972
+ }, null, 8, ["value", "placeholder", "label", "on-enhance", "enhancing", "disabled"])),
973
+ __props.submitError ? (openBlock(), createElementBlock("p", _hoisted_8$4, [
727
974
  createVNode(unref(ErrorIcon)),
728
975
  createTextVNode(toDisplayString(__props.submitError), 1)
729
976
  ])) : createCommentVNode("", true),
730
- createElementVNode("div", _hoisted_13$3, [
731
- createElementVNode("div", _hoisted_14$3, [
732
- menuItems.value.length > 0 ? (openBlock(), createBlock(_sfc_main$g, {
977
+ __props.voiceInput && voiceState.value.status === "error" ? (openBlock(), createElementBlock("p", _hoisted_9$4, [
978
+ createVNode(unref(ErrorIcon)),
979
+ createTextVNode(toDisplayString(voiceState.value.error), 1)
980
+ ])) : createCommentVNode("", true),
981
+ createElementVNode("div", _hoisted_10$4, [
982
+ createElementVNode("div", _hoisted_11$3, [
983
+ menuItems.value.length > 0 ? (openBlock(), createBlock(_sfc_main$j, {
733
984
  key: 0,
734
985
  items: menuItems.value,
735
986
  "images-only": view.value.editing,
736
987
  disabled: __props.disabled,
737
- onSelect: _cache[1] || (_cache[1] = ($event) => __props.onAttachMenuSelect?.($event)),
988
+ onSelect: _cache[3] || (_cache[3] = ($event) => __props.onAttachMenuSelect?.($event)),
738
989
  onFiles
739
990
  }, null, 8, ["items", "images-only", "disabled"])) : createCommentVNode("", true),
740
991
  (openBlock(true), createElementBlock(Fragment, null, renderList(view.value.pickedUseCases, (u) => {
741
- return openBlock(), createBlock(_sfc_main$f, {
992
+ return openBlock(), createBlock(_sfc_main$i, {
742
993
  key: u.kind,
743
994
  label: u.label,
744
995
  removable: Boolean(__props.multiSelectUseCases ? props["onUpdate:useCases"] : __props.onClearUseCase),
@@ -756,7 +1007,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
756
1007
  "trigger-variant": "text",
757
1008
  disabled: __props.disabled || __props.autoSelectModel && !__props.showAutoSelectToggle,
758
1009
  "panel-width": __props.showAutoSelectToggle ? 320 : void 0,
759
- onSelect: _cache[2] || (_cache[2] = ($event) => toggleModel($event.id))
1010
+ onSelect: _cache[4] || (_cache[4] = ($event) => toggleModel($event.id))
760
1011
  }), null, 16, ["value", "multiple", "toggle-header", "trigger-label", "menu-label", "disabled", "panel-width"])) : createCommentVNode("", true),
761
1012
  view.value.showAspectRatio && view.value.aspectOptions.length > 0 && props["onUpdate:aspectRatio"] ? (openBlock(), createBlock(_sfc_main$d, {
762
1013
  key: 2,
@@ -767,25 +1018,45 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
767
1018
  searchable: false,
768
1019
  "trigger-variant": "text",
769
1020
  disabled: __props.disabled,
770
- onSelect: _cache[3] || (_cache[3] = ($event) => props["onUpdate:aspectRatio"]?.($event.id))
1021
+ onSelect: _cache[5] || (_cache[5] = ($event) => props["onUpdate:aspectRatio"]?.($event.id))
1022
+ }, null, 8, ["options", "value", "trigger-label", "disabled"])) : createCommentVNode("", true),
1023
+ view.value.frameRateOptions.length > 0 && props["onUpdate:frameRate"] ? (openBlock(), createBlock(_sfc_main$d, {
1024
+ key: 3,
1025
+ options: view.value.frameRateOptions.map((r) => ({ id: String(r), label: `${r}fps` })),
1026
+ value: view.value.offeredFrameRate == null ? null : String(view.value.offeredFrameRate),
1027
+ "trigger-label": view.value.offeredFrameRate == null ? "Frame rate" : `${view.value.offeredFrameRate}fps`,
1028
+ "menu-label": "Frame rate",
1029
+ searchable: false,
1030
+ "trigger-variant": "text",
1031
+ disabled: __props.disabled,
1032
+ onSelect: _cache[6] || (_cache[6] = ($event) => props["onUpdate:frameRate"]?.(Number($event.id)))
771
1033
  }, null, 8, ["options", "value", "trigger-label", "disabled"])) : createCommentVNode("", true)
772
1034
  ]),
773
- createElementVNode("md-fab", {
774
- class: "chai-composer__submit",
775
- size: "small",
776
- variant: "secondary",
777
- label: "",
778
- "data-ready": view.value.showStop || !view.value.isSubmitDisabled || void 0,
779
- "data-error": Boolean(__props.submitError) || void 0,
780
- "data-stop": view.value.showStop || void 0,
781
- "aria-label": view.value.showStop ? "Stop" : __props.submitError ? "Retry" : "Submit",
782
- "aria-disabled": view.value.showStop ? "false" : __props.submitting || view.value.isSubmitDisabled ? "true" : "false",
783
- onClick: onSubmitClick
784
- }, [
785
- createElementVNode("span", _hoisted_16$2, [
786
- view.value.showStop ? (openBlock(), createBlock(unref(StopIcon), { key: 0 })) : __props.submitError ? (openBlock(), createBlock(unref(RetryIcon), { key: 1 })) : (openBlock(), createBlock(unref(ArrowForwardIcon), { key: 2 }))
787
- ])
788
- ], 8, _hoisted_15$3)
1035
+ createElementVNode("div", _hoisted_12$3, [
1036
+ __props.voiceInput ? (openBlock(), createBlock(_sfc_main$g, {
1037
+ key: 0,
1038
+ voice: unref(voice),
1039
+ state: voiceState.value,
1040
+ disabled: __props.disabled
1041
+ }, null, 8, ["voice", "state", "disabled"])) : createCommentVNode("", true),
1042
+ !(__props.voiceInput && (voiceState.value.status === "recording" || voiceState.value.status === "transcribing")) ? (openBlock(), createElementBlock("md-fab", {
1043
+ key: 1,
1044
+ class: "chai-composer__submit",
1045
+ size: "small",
1046
+ variant: "secondary",
1047
+ label: "",
1048
+ "data-ready": view.value.showStop || !view.value.isSubmitDisabled || void 0,
1049
+ "data-error": Boolean(__props.submitError) || void 0,
1050
+ "data-stop": view.value.showStop || void 0,
1051
+ "aria-label": view.value.showStop ? "Stop" : __props.submitError ? "Retry" : "Submit",
1052
+ "aria-disabled": view.value.showStop ? "false" : __props.submitting || view.value.isSubmitDisabled ? "true" : "false",
1053
+ onClick: onSubmitClick
1054
+ }, [
1055
+ createElementVNode("span", _hoisted_14$3, [
1056
+ view.value.showStop ? (openBlock(), createBlock(unref(StopIcon), { key: 0 })) : __props.submitError ? (openBlock(), createBlock(unref(RetryIcon), { key: 1 })) : (openBlock(), createBlock(unref(ArrowForwardIcon), { key: 2 }))
1057
+ ])
1058
+ ], 8, _hoisted_13$3)) : createCommentVNode("", true)
1059
+ ])
789
1060
  ])
790
1061
  ]);
791
1062
  };
@@ -2477,7 +2748,7 @@ function useMediaAnalyzer(options = {}) {
2477
2748
  };
2478
2749
  }
2479
2750
  export {
2480
- _sfc_main$h as ChaiProvider,
2751
+ _sfc_main$k as ChaiProvider,
2481
2752
  _sfc_main$c as Composer,
2482
2753
  DEFAULT_MAX_ATTACHMENTS_BY_KIND2 as DEFAULT_MAX_ATTACHMENTS_BY_KIND,
2483
2754
  DEFAULT_MAX_REGIONS2 as DEFAULT_MAX_REGIONS,
@@ -2506,6 +2777,7 @@ export {
2506
2777
  buildRegionEditPrompt,
2507
2778
  checkSuggestedModels,
2508
2779
  createFalEngine,
2780
+ createFalTranscriber,
2509
2781
  createMockEngine,
2510
2782
  createOpenRouterEngine,
2511
2783
  isMediaAnalyzerAtCap2 as isMediaAnalyzerAtCap,