@8wave/ai-elements 0.121.0-beta.41 → 0.121.0-beta.43
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/_chunks/{PkChatbotFilePreview-CpFXWpU7.js → PkChatbotFilePreview-DxpEIFOG.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-CpFXWpU7.js.map → PkChatbotFilePreview-DxpEIFOG.js.map} +1 -1
- package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js → PkHeldImage-CztNY8OZ.js} +2 -2
- package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js.map → PkHeldImage-CztNY8OZ.js.map} +1 -1
- package/dist/_chunks/{PkLazyImg-BBFsS16D.js → PkLazyImg-BqbuNQgf.js} +2 -2
- package/dist/_chunks/{PkLazyImg-BBFsS16D.js.map → PkLazyImg-BqbuNQgf.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js → PkStreamingMarkdown-BlTH2AJX.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js.map → PkStreamingMarkdown-BlTH2AJX.js.map} +1 -1
- package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js → PkToolEditSpreadsheet-CDxglslA.js} +2 -2
- package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js.map → PkToolEditSpreadsheet-CDxglslA.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js → PkToolRequestGeolocation-CxMAoAv6.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js.map → PkToolRequestGeolocation-CxMAoAv6.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js → PkToolRequestOAuthConnection-DU1Y2odZ.js} +3 -3
- package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js.map → PkToolRequestOAuthConnection-DU1Y2odZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js → PkToolShareDocument-YrPrexhS.js} +5 -5
- package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js.map → PkToolShareDocument-YrPrexhS.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js → PkToolShowArtifact-jQeIv65U.js} +4 -4
- package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js.map → PkToolShowArtifact-jQeIv65U.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js → PkToolShowCalendarEvent-CAN5-qnM.js} +4 -4
- package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js.map → PkToolShowCalendarEvent-CAN5-qnM.js.map} +1 -1
- package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js → PkToolShowComparison-DGxHYpl3.js} +4 -4
- package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js.map → PkToolShowComparison-DGxHYpl3.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js → PkToolShowContactForm-D7wg3Jlu.js} +5 -5
- package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js.map → PkToolShowContactForm-D7wg3Jlu.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js → PkToolShowDiagram-BBs1rh96.js} +4 -4
- package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js.map → PkToolShowDiagram-BBs1rh96.js.map} +1 -1
- package/dist/_chunks/{PkToolShowEmail-C3jped-R.js → PkToolShowEmail-CeiSo-zx.js} +4 -4
- package/dist/_chunks/{PkToolShowEmail-C3jped-R.js.map → PkToolShowEmail-CeiSo-zx.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js → PkToolShowForm-BMVgXxzl.js} +4 -4
- package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js.map → PkToolShowForm-BMVgXxzl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js → PkToolShowImageGallery-Ba0CfKt6.js} +3 -3
- package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js.map → PkToolShowImageGallery-Ba0CfKt6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js → PkToolShowLocation-Cp95-u2H.js} +4 -4
- package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js.map → PkToolShowLocation-Cp95-u2H.js.map} +1 -1
- package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js → PkToolShowMessage-Bn8O_W0D.js} +4 -4
- package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js.map → PkToolShowMessage-Bn8O_W0D.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-BCmULLct.js → PkToolShowProductList-DbZfUUWe.js} +4 -4
- package/dist/_chunks/{PkToolShowProductList-BCmULLct.js.map → PkToolShowProductList-DbZfUUWe.js.map} +1 -1
- package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js → PkToolShowQrCode-D_9_c-Ws.js} +4 -4
- package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js.map → PkToolShowQrCode-D_9_c-Ws.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js → PkToolShowSources-Dkt4IId2.js} +4 -4
- package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js.map → PkToolShowSources-Dkt4IId2.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js → PkToolShowSuggestedReply-BF2sT3B1.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js.map → PkToolShowSuggestedReply-BF2sT3B1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js → PkToolShowVideo-l8JoSKCj.js} +3 -3
- package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js.map → PkToolShowVideo-l8JoSKCj.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js → PkToolShowWeather-DifqBB7o.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js.map → PkToolShowWeather-DifqBB7o.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js → PkToolShowWebPages-DtcEmrYt.js} +4 -4
- package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js.map → PkToolShowWebPages-DtcEmrYt.js.map} +1 -1
- package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js → VvButtonLocalized-D7K9ZslZ.js} +2 -2
- package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js.map → VvButtonLocalized-D7K9ZslZ.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js → VvCheckboxGroup.es-BebSMBKU.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js.map → VvCheckboxGroup.es-BebSMBKU.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js → VvCombobox.es-BfiDcdcw.js} +481 -481
- package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js.map → VvCombobox.es-BfiDcdcw.js.map} +1 -1
- package/dist/_chunks/{VvInputText.es-CETcNKlr.js → VvInputText.es-DllQ2Tue.js} +435 -435
- package/dist/_chunks/{VvInputText.es-CETcNKlr.js.map → VvInputText.es-DllQ2Tue.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js → VvRadioGroup.es-D6uqf6a1.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js.map → VvRadioGroup.es-D6uqf6a1.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-B_MShGnJ.js → VvSelect.es-BR5Ci5VC.js} +2 -2
- package/dist/_chunks/{VvSelect.es-B_MShGnJ.js.map → VvSelect.es-BR5Ci5VC.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js → VvTextarea.es-Bwe5xjXl.js} +29 -29
- package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js.map → VvTextarea.es-Bwe5xjXl.js.map} +1 -1
- package/dist/_chunks/{dist-Do_Ac5Yv.js → dist-CB7v_M5z.js} +52 -46
- package/dist/_chunks/dist-CB7v_M5z.js.map +1 -0
- package/dist/_chunks/{index.es-BTDKU45u.js → index.es-CKF2q-ww.js} +26 -26
- package/dist/_chunks/{index.es-BTDKU45u.js.map → index.es-CKF2q-ww.js.map} +1 -1
- package/dist/_chunks/{index.es-BZS9Cscn.js → index.es-CoWhnabo.js} +16 -16
- package/dist/_chunks/{index.es-BZS9Cscn.js.map → index.es-CoWhnabo.js.map} +1 -1
- package/dist/ai-elements.es.js +4171 -3913
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotQueuedMessages.d.ts +2 -0
- package/dist-vue/PkChatbotQueuedMessages.js +1 -0
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/PkChatbot-CObEhs2T.js +279 -0
- package/dist-vue/_chunks/PkChatbot-CObEhs2T.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-BJHtmPR-.js → PkChatbotInput-CuEoeb_M.js} +47 -22
- package/dist-vue/_chunks/PkChatbotInput-CuEoeb_M.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js +51 -0
- package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-BI_PtT72.js → PkChatbotViewChat-BZb-U7Ju.js} +246 -224
- package/dist-vue/_chunks/PkChatbotViewChat-BZb-U7Ju.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js +210 -0
- package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js → PkChatbotViewFiles-BgqksCn0.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js.map → PkChatbotViewFiles-BgqksCn0.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js → PkChatbotViewProfile-B6tHWrqn.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js.map → PkChatbotViewProfile-B6tHWrqn.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-DUz4dwzY.js → createChatbotApiClient-hcFAulTq.js} +12 -3
- package/dist-vue/_chunks/createChatbotApiClient-hcFAulTq.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-D7LcpA-6.js → useChatbotStore-Ct7G-voO.js} +953 -800
- package/dist-vue/_chunks/useChatbotStore-Ct7G-voO.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +10 -6
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +94 -80
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +16 -2
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
- package/dist-vue/packages/components/src/chat/PkChatbotQueuedMessages.d.ts +22 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +5 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +37 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/dist-Do_Ac5Yv.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-DIqduIwr.js +0 -290
- package/dist-vue/_chunks/PkChatbot-DIqduIwr.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-BJHtmPR-.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-BI_PtT72.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js +0 -199
- package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-DUz4dwzY.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-D7LcpA-6.js.map +0 -1
|
@@ -133,7 +133,9 @@ var P = N, F = ["type"], I = {
|
|
|
133
133
|
fileUpload: {},
|
|
134
134
|
attachmentLimitReached: { type: Boolean },
|
|
135
135
|
attachmentNotice: {},
|
|
136
|
-
voiceEnabled: { type: Boolean }
|
|
136
|
+
voiceEnabled: { type: Boolean },
|
|
137
|
+
queueEnabled: { type: Boolean },
|
|
138
|
+
answerNotices: {}
|
|
137
139
|
}, {
|
|
138
140
|
modelValue: { default: void 0 },
|
|
139
141
|
modelModifiers: {},
|
|
@@ -146,6 +148,8 @@ var P = N, F = ["type"], I = {
|
|
|
146
148
|
"file-select",
|
|
147
149
|
"dismiss-attachment-notice",
|
|
148
150
|
"dismiss-page-notice",
|
|
151
|
+
"open-answer-notice",
|
|
152
|
+
"dismiss-answer-notice",
|
|
149
153
|
"voice-start"
|
|
150
154
|
], ["update:modelValue", "update:pendingAttachments"]),
|
|
151
155
|
setup(h, { emit: g }) {
|
|
@@ -165,18 +169,18 @@ var P = N, F = ["type"], I = {
|
|
|
165
169
|
F.value && P.update(F.value);
|
|
166
170
|
}));
|
|
167
171
|
});
|
|
168
|
-
let U = c(() => N.status === "streaming"), W = c(() => N.status === "submitted"), G = c(() => U.value || W.value), K = re(), q = c(() => B.value.length), J = c(() => N.maxMessageLength !== void 0 && q.value > N.maxMessageLength), Se = c(() => j.value.some((e) => e.state === "uploading")), Y = c(() => G.value || Se.value || J.value ? !1 : B.value.trim().length > 0), Ce = "capture" in document.createElement("input"), we = c(() => {
|
|
172
|
+
let U = c(() => N.status === "streaming"), W = c(() => N.status === "submitted"), G = c(() => U.value || W.value), K = re(), q = c(() => B.value.length), J = c(() => N.maxMessageLength !== void 0 && q.value > N.maxMessageLength), Se = c(() => j.value.some((e) => e.state === "uploading")), Y = c(() => G.value && !N.queueEnabled || Se.value || J.value ? !1 : B.value.trim().length > 0), X = c(() => G.value && Y.value), Ce = "capture" in document.createElement("input"), we = c(() => {
|
|
169
173
|
let t = N.fileUpload?.allowedMimeTypes ?? [];
|
|
170
174
|
return [...t, ...e(t)].join(",");
|
|
171
|
-
}),
|
|
175
|
+
}), Z = c(() => (N.fileUpload?.allowedMimeTypes ?? []).filter((e) => e.startsWith("image/")).join(",")), Q = c(() => Ce && Z.value.length > 0), Te = () => {
|
|
172
176
|
I.value?.click();
|
|
173
|
-
},
|
|
177
|
+
}, Ee = () => {
|
|
174
178
|
R.value?.click();
|
|
175
|
-
}, Ee = (e) => {
|
|
176
|
-
for (let t of e) M("file-select", t);
|
|
177
179
|
}, De = (e) => {
|
|
180
|
+
for (let t of e) M("file-select", t);
|
|
181
|
+
}, $ = (e) => {
|
|
178
182
|
let t = e.target;
|
|
179
|
-
|
|
183
|
+
De(Array.from(t.files ?? [])), t.value = "";
|
|
180
184
|
}, Oe = (e) => {
|
|
181
185
|
let t = j.value.find((t) => t.id === e);
|
|
182
186
|
t && URL.revokeObjectURL(t.localUrl), j.value = j.value.filter((t) => t.id !== e);
|
|
@@ -190,6 +194,13 @@ var P = N, F = ["type"], I = {
|
|
|
190
194
|
dismiss: () => M("dismiss-attachment-notice")
|
|
191
195
|
}];
|
|
192
196
|
let e = [];
|
|
197
|
+
for (let t of N.answerNotices ?? []) e.push({
|
|
198
|
+
id: `answer-${t.id}`,
|
|
199
|
+
icon: "ri:chat-check-line",
|
|
200
|
+
text: t.text,
|
|
201
|
+
open: () => M("open-answer-notice", t.id),
|
|
202
|
+
dismiss: () => M("dismiss-answer-notice", t.id)
|
|
203
|
+
});
|
|
193
204
|
return N.pageNotice && e.push({
|
|
194
205
|
id: "page",
|
|
195
206
|
icon: "ri:pages-line",
|
|
@@ -214,10 +225,10 @@ var P = N, F = ["type"], I = {
|
|
|
214
225
|
x(() => {
|
|
215
226
|
F.value && P(F.value);
|
|
216
227
|
});
|
|
217
|
-
let
|
|
228
|
+
let Ie = 0;
|
|
218
229
|
return oe(F, ([e]) => {
|
|
219
230
|
let t = e?.contentRect.width ?? 0;
|
|
220
|
-
F.value && t !==
|
|
231
|
+
F.value && t !== Ie && (Ie = t, P.update(F.value));
|
|
221
232
|
}), O(() => N.placeholder, async () => {
|
|
222
233
|
await v(), F.value && P.update(F.value);
|
|
223
234
|
}), b(() => {
|
|
@@ -239,8 +250,15 @@ var P = N, F = ["type"], I = {
|
|
|
239
250
|
markdown: t.markdown,
|
|
240
251
|
class: "wysiwyg pk-chatbot-input__notice-text"
|
|
241
252
|
}, null, 8, ["markdown"])) : (S(), d("span", le, w(t.text), 1)),
|
|
242
|
-
t.
|
|
253
|
+
t.open ? (S(), l(v, {
|
|
243
254
|
key: 3,
|
|
255
|
+
label: e.$t("action.open"),
|
|
256
|
+
modifiers: "link",
|
|
257
|
+
class: "pk-chatbot-input__notice-action",
|
|
258
|
+
onClick: (e) => t.open()
|
|
259
|
+
}, null, 8, ["label", "onClick"])) : u("", !0),
|
|
260
|
+
t.dismiss ? (S(), l(v, {
|
|
261
|
+
key: 4,
|
|
244
262
|
title: e.$t("action.close"),
|
|
245
263
|
modifiers: "action-quiet",
|
|
246
264
|
icon: "ri:close-line",
|
|
@@ -274,7 +292,7 @@ var P = N, F = ["type"], I = {
|
|
|
274
292
|
"onRemove"
|
|
275
293
|
]))), 128))])) : u("", !0), f("div", de, [
|
|
276
294
|
ne(e.$slots, "prepend"),
|
|
277
|
-
h.fileUpload && h.fileUpload.enabled && (
|
|
295
|
+
h.fileUpload && h.fileUpload.enabled && (Q.value || e.$slots["additional-actions"]) ? (S(), l(x, ee(_({ key: 0 }, {
|
|
278
296
|
placement: "top-start",
|
|
279
297
|
modifiers: "menu",
|
|
280
298
|
flip: !0,
|
|
@@ -291,10 +309,10 @@ var P = N, F = ["type"], I = {
|
|
|
291
309
|
class: "pk-chat-button__icon"
|
|
292
310
|
})], 16, fe)]),
|
|
293
311
|
items: k(() => [
|
|
294
|
-
|
|
312
|
+
Q.value ? (S(), l(b, {
|
|
295
313
|
key: 0,
|
|
296
314
|
disabled: G.value || h.attachmentLimitReached,
|
|
297
|
-
onClick:
|
|
315
|
+
onClick: Ee
|
|
298
316
|
}, {
|
|
299
317
|
default: k(() => [m(g, {
|
|
300
318
|
name: "ri:camera-line",
|
|
@@ -304,7 +322,7 @@ var P = N, F = ["type"], I = {
|
|
|
304
322
|
}, 8, ["disabled"])) : u("", !0),
|
|
305
323
|
m(b, {
|
|
306
324
|
disabled: G.value || h.attachmentLimitReached,
|
|
307
|
-
onClick:
|
|
325
|
+
onClick: Te
|
|
308
326
|
}, {
|
|
309
327
|
default: k(() => [m(g, {
|
|
310
328
|
name: "ri:attachment-line",
|
|
@@ -320,7 +338,7 @@ var P = N, F = ["type"], I = {
|
|
|
320
338
|
icon: "ri:add-line",
|
|
321
339
|
title: e.$t("action.attachFile"),
|
|
322
340
|
disabled: G.value || h.attachmentLimitReached,
|
|
323
|
-
onClick:
|
|
341
|
+
onClick: Te
|
|
324
342
|
}, null, 8, ["title", "disabled"])) : u("", !0),
|
|
325
343
|
h.fileUpload && h.fileUpload.enabled ? (S(), d("input", {
|
|
326
344
|
key: 2,
|
|
@@ -330,17 +348,17 @@ var P = N, F = ["type"], I = {
|
|
|
330
348
|
hidden: "",
|
|
331
349
|
multiple: "",
|
|
332
350
|
accept: we.value,
|
|
333
|
-
onChange:
|
|
351
|
+
onChange: $
|
|
334
352
|
}, null, 40, pe)) : u("", !0),
|
|
335
|
-
h.fileUpload && h.fileUpload.enabled &&
|
|
353
|
+
h.fileUpload && h.fileUpload.enabled && Q.value ? (S(), d("input", {
|
|
336
354
|
key: 3,
|
|
337
355
|
ref_key: "cameraInputEl",
|
|
338
356
|
ref: R,
|
|
339
357
|
type: "file",
|
|
340
358
|
capture: "environment",
|
|
341
359
|
hidden: "",
|
|
342
|
-
accept:
|
|
343
|
-
onChange:
|
|
360
|
+
accept: Z.value,
|
|
361
|
+
onChange: $
|
|
344
362
|
}, null, 40, me)) : u("", !0),
|
|
345
363
|
f("div", he, [f("textarea", {
|
|
346
364
|
ref_key: "textareaEl",
|
|
@@ -372,13 +390,20 @@ var P = N, F = ["type"], I = {
|
|
|
372
390
|
U.value ? (S(), l(L, {
|
|
373
391
|
key: 6,
|
|
374
392
|
icon: "ri:stop-fill",
|
|
375
|
-
modifiers: "primary",
|
|
393
|
+
modifiers: X.value ? void 0 : "primary",
|
|
376
394
|
title: e.$t("action.stop"),
|
|
377
395
|
onClick: Ne
|
|
378
|
-
}, null, 8, ["title"])) : (
|
|
396
|
+
}, null, 8, ["modifiers", "title"])) : u("", !0),
|
|
397
|
+
X.value ? (S(), l(L, {
|
|
379
398
|
key: 7,
|
|
380
399
|
type: "submit",
|
|
381
400
|
modifiers: "primary",
|
|
401
|
+
icon: "ri:arrow-up-line",
|
|
402
|
+
title: e.$t("action.queueMessage")
|
|
403
|
+
}, null, 8, ["title"])) : U.value ? u("", !0) : (S(), l(L, {
|
|
404
|
+
key: 8,
|
|
405
|
+
type: "submit",
|
|
406
|
+
modifiers: "primary",
|
|
382
407
|
icon: W.value ? "loading-loop" : "ri:arrow-up-line",
|
|
383
408
|
title: e.$t("action.submit"),
|
|
384
409
|
disabled: !Y.value
|
|
@@ -394,4 +419,4 @@ var P = N, F = ["type"], I = {
|
|
|
394
419
|
//#endregion
|
|
395
420
|
export { L as n, R as t };
|
|
396
421
|
|
|
397
|
-
//# sourceMappingURL=PkChatbotInput-
|
|
422
|
+
//# sourceMappingURL=PkChatbotInput-CuEoeb_M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotInput-CuEoeb_M.js","names":["_hoisted_1","_hoisted_2","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createVNode","_toDisplayString","_createCommentVNode","_sfc_main","$t","$slots","$n","_useModel","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","_createCommentVNode","PkStreamingMarkdown","_toDisplayString","_createElementVNode","_withModifiers","PkChatbotFilePreview","_renderSlot","_normalizeProps","_mergeProps","_withCtx","_createVNode","_createTextVNode","PkChatButton","_unref","_withKeys","_normalizeClass","_sfc_main","codeExtensionsOf","PkStreamingMarkdown_default","PkChatbotFilePreview_default","e","t","o","r","n","l","a","i","s","d","c","v","_hoisted_1$1","_hoisted_2$1","PkChatButton_default","defineComponent","_component_VvIcon","VvIcon","openBlock","createElementBlock","normalizeClass","__props","createVNode","toDisplayString","createCommentVNode","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","PkChatbotInput_default","\"modelValue\"","\"modelModifiers\"","\"pendingAttachments\"","\"pendingAttachmentsModifiers\"","__emit","modelValue","useModel","pendingAttachments","emit","props","textareaEl","useTemplateRef","fileInputEl","cameraInputEl","formEl","localValue","ref","syncTimer","cancelSync","flushSync","scheduleSync","onTextareaInput","nextTick","isStreaming","computed","isSubmitted","isInputDisabled","counterId","useId","currentLength","isOverLimit","isUploadingAnyFile","isSubmitEnabled","isQueueing","hasCaptureSupport","acceptMimeTypes","allowed","acceptImageMimeTypes","m","showCameraOption","openFilePicker","openCameraPicker","emitFiles","file","files","onFileChange","input","event","removeAttachment","att","id","isDismissableNoticeVisible","closeDismissableNotice","activeNotices","notices","notice","keepKeyboardFocus","stopGeneration","handleSubmit","onTextareaEnter","textareaWidth","useResizeObserver","entry","width","watch","onBeforeUnmount","_component_VvButton","VvButtonLocalized","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","Fragment","renderList","createBlock","_ctx","createElementVNode","withModifiers","renderSlot","normalizeProps","mergeProps","withCtx","init","aria","toggle","createTextVNode","unref","withKeys","_cache"],"sources":["../../../../node_modules/.pnpm/autosize@6.0.1/node_modules/autosize/dist/autosize.esm.js","../../../../packages/components/src/chat/PkChatButton.vue","../../../../packages/components/src/chat/PkChatButton.vue","../../../../packages/components/src/chat/PkChatbotInput.vue","../../../../packages/components/src/chat/PkChatbotInput.vue"],"sourcesContent":["var e=new Map;function t(t){var o=e.get(t);o&&o.destroy()}function o(t){var o=e.get(t);o&&o.update()}var r=null;\"undefined\"==typeof window?((r=function(e){return e}).destroy=function(e){return e},r.update=function(e){return e}):((r=function(t,o){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&\"TEXTAREA\"===t.nodeName&&!e.has(t)){var o,r=null,n=window.getComputedStyle(t),i=(o=t.value,function(){a({testForHeightReduction:\"\"===o||!t.value.startsWith(o),restoreTextAlign:null}),o=t.value}),l=function(o){t.removeEventListener(\"autosize:destroy\",l),t.removeEventListener(\"autosize:update\",s),t.removeEventListener(\"input\",i),window.removeEventListener(\"resize\",s),Object.keys(o).forEach(function(e){return t.style[e]=o[e]}),e.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener(\"autosize:destroy\",l),t.addEventListener(\"autosize:update\",s),t.addEventListener(\"input\",i),window.addEventListener(\"resize\",s),t.style.overflowX=\"hidden\",t.style.wordWrap=\"break-word\",e.set(t,{destroy:l,update:s}),s()}function a(e){var o,i,l=e.restoreTextAlign,s=void 0===l?null:l,d=e.testForHeightReduction,u=void 0===d||d,c=n.overflowY;if(0!==t.scrollHeight&&(\"vertical\"===n.resize?t.style.resize=\"none\":\"both\"===n.resize&&(t.style.resize=\"horizontal\"),u&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],o=e[1];t.style.scrollBehavior=\"auto\",t.scrollTop=o,t.style.scrollBehavior=null})}}(t),t.style.height=\"\"),i=\"content-box\"===n.boxSizing?t.scrollHeight-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):t.scrollHeight+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),\"none\"!==n.maxHeight&&i>parseFloat(n.maxHeight)?(\"hidden\"===n.overflowY&&(t.style.overflow=\"scroll\"),i=parseFloat(n.maxHeight)):\"hidden\"!==n.overflowY&&(t.style.overflow=\"hidden\"),t.style.height=i+\"px\",s&&(t.style.textAlign=s),o&&o(),r!==i&&(t.dispatchEvent(new Event(\"autosize:resized\",{bubbles:!0})),r=i),c!==n.overflow&&!s)){var v=n.textAlign;\"hidden\"===n.overflow&&(t.style.textAlign=\"start\"===v?\"end\":\"start\"),a({restoreTextAlign:v,testForHeightReduction:!0})}}function s(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},r.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e});var n=r;export default n;\n","<script lang=\"ts\" setup>\n /**\n * The icon button of the chat dock: attach, send and stop in the input,\n * mute and hang up in a live call. One component, because the call bar\n * takes the place of the input and the two must not look like two\n * different pieces of software.\n *\n * Native attributes fall through to the button, so `title`, `disabled` and\n * `aria-pressed` are written by the caller as they would be on a `<button>`.\n */\n withDefaults(\n defineProps<{\n icon: string\n /** Written next to the icon, for an action nobody should have to guess from a glyph. */\n label?: string\n type?: 'button' | 'submit'\n /** `primary` is the filled circle of send and stop, the one action the dock is for. */\n modifiers?: 'danger' | 'primary'\n }>(),\n { label: undefined, type: 'button', modifiers: undefined },\n )\n</script>\n\n<template>\n <button\n class=\"pk-chat-button\"\n :class=\"[\n modifiers ? `pk-chat-button--${modifiers}` : undefined,\n { 'pk-chat-button--labelled': label },\n ]\"\n :type=\"type\">\n <VvIcon :name=\"icon\" class=\"pk-chat-button__icon\" />\n <span v-if=\"label\" class=\"pk-chat-button__label\">{{ label }}</span>\n </button>\n</template>\n\n<style lang=\"scss\">\n .pk-chat-button {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: var(--spacing-4);\n border: none;\n border-radius: var(--rounded);\n background-color: transparent;\n color: var(--color-word-1);\n cursor: pointer;\n transition: var(--transition-colors);\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n // The fields' focus ring: a 1px surface-5 line measured 1.3:1 on the\n // surface, under the 3:1 a focus indicator needs\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: 0;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n // A finger needs 40px and the button is drawn at 28: on a touch\n // screen it answers 8px around itself, in every layout of the chat\n // (it was the fullscreen one only) and in the call bar, which mounts\n // the same button\n @media (pointer: coarse) {\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-8));\n }\n }\n\n // A toggle has to survive a glance: a crossed-out glyph alone changes\n // too few pixels to notice mid-sentence.\n &[aria-pressed='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word);\n }\n\n // A wash of the same red rather than a lighter red behind it: the\n // `lighten-5` step lands close enough to the icon to leave it at about\n // 2:1, which is a button that disappears exactly while it is being\n // pointed at. The tint composites over whatever surface is behind, so\n // it holds in the dark theme too.\n &--danger {\n // The project's text shade of danger; the fill where a host app\n // loads only the library and this package's stylesheet\n color: var(--u-danger-text, var(--color-danger));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-danger) 12%,\n transparent\n );\n }\n }\n\n // Same 28px box as the ghost buttons, so the dock keeps its height,\n // with a smaller glyph because a filled shape needs air around it.\n // Its edge is visible, so it sits on the input's padding line just as\n // the text does: a ghost glyph sat 6px further in and made the two\n // sides of the input look unequal. Empty, it turns into a grey pad\n // with the fields' disabled ink: a light arrow on that pad vanished,\n // and with it the circle's edge, which is what squares the sides.\n // The agent's color when the widget has one, like the user's bubble.\n &--primary {\n --pk-chat-button-fill: var(\n --chatbot-main-color,\n var(--color-word-1)\n );\n\n padding: var(--spacing-6);\n border-radius: var(--rounded-full);\n background-color: var(--pk-chat-button-fill);\n color: var(--chatbot-contrast-color, var(--color-surface));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--pk-chat-button-fill) 85%,\n var(--color-surface)\n );\n }\n\n // Off the disc, or a dark ring would sink into a dark fill\n &:focus-visible {\n outline-offset: var(--spacing-2);\n }\n\n &:disabled {\n opacity: 1;\n background-color: var(--color-surface-3);\n color: var(--color-word-3);\n }\n\n .pk-chat-button__icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &--labelled {\n gap: var(--spacing-4);\n padding-inline: var(--spacing-8);\n font-size: var(--text-12);\n }\n\n &__icon {\n display: block;\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n /**\n * The icon button of the chat dock: attach, send and stop in the input,\n * mute and hang up in a live call. One component, because the call bar\n * takes the place of the input and the two must not look like two\n * different pieces of software.\n *\n * Native attributes fall through to the button, so `title`, `disabled` and\n * `aria-pressed` are written by the caller as they would be on a `<button>`.\n */\n withDefaults(\n defineProps<{\n icon: string\n /** Written next to the icon, for an action nobody should have to guess from a glyph. */\n label?: string\n type?: 'button' | 'submit'\n /** `primary` is the filled circle of send and stop, the one action the dock is for. */\n modifiers?: 'danger' | 'primary'\n }>(),\n { label: undefined, type: 'button', modifiers: undefined },\n )\n</script>\n\n<template>\n <button\n class=\"pk-chat-button\"\n :class=\"[\n modifiers ? `pk-chat-button--${modifiers}` : undefined,\n { 'pk-chat-button--labelled': label },\n ]\"\n :type=\"type\">\n <VvIcon :name=\"icon\" class=\"pk-chat-button__icon\" />\n <span v-if=\"label\" class=\"pk-chat-button__label\">{{ label }}</span>\n </button>\n</template>\n\n<style lang=\"scss\">\n .pk-chat-button {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: var(--spacing-4);\n border: none;\n border-radius: var(--rounded);\n background-color: transparent;\n color: var(--color-word-1);\n cursor: pointer;\n transition: var(--transition-colors);\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n // The fields' focus ring: a 1px surface-5 line measured 1.3:1 on the\n // surface, under the 3:1 a focus indicator needs\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: 0;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n // A finger needs 40px and the button is drawn at 28: on a touch\n // screen it answers 8px around itself, in every layout of the chat\n // (it was the fullscreen one only) and in the call bar, which mounts\n // the same button\n @media (pointer: coarse) {\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-8));\n }\n }\n\n // A toggle has to survive a glance: a crossed-out glyph alone changes\n // too few pixels to notice mid-sentence.\n &[aria-pressed='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word);\n }\n\n // A wash of the same red rather than a lighter red behind it: the\n // `lighten-5` step lands close enough to the icon to leave it at about\n // 2:1, which is a button that disappears exactly while it is being\n // pointed at. The tint composites over whatever surface is behind, so\n // it holds in the dark theme too.\n &--danger {\n // The project's text shade of danger; the fill where a host app\n // loads only the library and this package's stylesheet\n color: var(--u-danger-text, var(--color-danger));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-danger) 12%,\n transparent\n );\n }\n }\n\n // Same 28px box as the ghost buttons, so the dock keeps its height,\n // with a smaller glyph because a filled shape needs air around it.\n // Its edge is visible, so it sits on the input's padding line just as\n // the text does: a ghost glyph sat 6px further in and made the two\n // sides of the input look unequal. Empty, it turns into a grey pad\n // with the fields' disabled ink: a light arrow on that pad vanished,\n // and with it the circle's edge, which is what squares the sides.\n // The agent's color when the widget has one, like the user's bubble.\n &--primary {\n --pk-chat-button-fill: var(\n --chatbot-main-color,\n var(--color-word-1)\n );\n\n padding: var(--spacing-6);\n border-radius: var(--rounded-full);\n background-color: var(--pk-chat-button-fill);\n color: var(--chatbot-contrast-color, var(--color-surface));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--pk-chat-button-fill) 85%,\n var(--color-surface)\n );\n }\n\n // Off the disc, or a dark ring would sink into a dark fill\n &:focus-visible {\n outline-offset: var(--spacing-2);\n }\n\n &:disabled {\n opacity: 1;\n background-color: var(--color-surface-3);\n color: var(--color-word-3);\n }\n\n .pk-chat-button__icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &--labelled {\n gap: var(--spacing-4);\n padding-inline: var(--spacing-8);\n font-size: var(--text-12);\n }\n\n &__icon {\n display: block;\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n // @ts-expect-error - no types for autosize\n import autosize from 'autosize'\n import {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useResizeObserver } from '@vueuse/core'\n import { codeExtensionsOf, type AgentFileUpload } from 'models'\n import type { PendingAttachment } from 'composables'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import PkChatButton from './PkChatButton.vue'\n\n // --- Models & Props ---\n\n const modelValue = defineModel<string | undefined>({ default: undefined })\n const pendingAttachments = defineModel<PendingAttachment[]>(\n 'pendingAttachments',\n { default: () => [] },\n )\n\n const emit = defineEmits<{\n submit: []\n 'stop-generation': []\n 'file-select': [file: File]\n 'dismiss-attachment-notice': []\n 'dismiss-page-notice': []\n 'open-answer-notice': [id: string]\n 'dismiss-answer-notice': [id: string]\n 'voice-start': []\n }>()\n\n const props = defineProps<{\n placeholder?: string\n dismissableNotice?: string\n /**\n * What the agent can do on the page that embeds the chat (spec\n * `page-tools.md`). Its closing is the caller's to remember.\n */\n pageNotice?: string\n status?: 'submitted' | 'streaming' | 'ready' | 'error'\n maxMessageLength?: number\n fileUpload?: AgentFileUpload\n attachmentLimitReached?: boolean\n attachmentNotice?: string\n /** Show the talk button: the agent has voice enabled. */\n voiceEnabled?: boolean\n /**\n * What is written while the agent answers is queued and sent when the\n * answer ends (spec resumable-chat-streams, F2): sending stays open.\n */\n queueEnabled?: boolean\n /** Answers that ended in another conversation, each with its own line and its \"Open\". */\n answerNotices?: { id: string; text: string }[]\n }>()\n\n // --- Template refs ---\n\n const textareaEl = useTemplateRef<HTMLTextAreaElement>('textareaEl')\n const fileInputEl = useTemplateRef<HTMLInputElement>('fileInputEl')\n const cameraInputEl = useTemplateRef<HTMLInputElement>('cameraInputEl')\n const formEl = useTemplateRef<HTMLFormElement>('formEl')\n\n // --- Input buffering (decouples typing from reactive model propagation) ---\n\n const localValue = ref(modelValue.value ?? '')\n let syncTimer: ReturnType<typeof setTimeout> | null = null\n\n const cancelSync = () => {\n if (syncTimer !== null) {\n clearTimeout(syncTimer)\n syncTimer = null\n }\n }\n\n const flushSync = () => {\n cancelSync()\n modelValue.value = localValue.value\n }\n\n const scheduleSync = () => {\n cancelSync()\n syncTimer = setTimeout(() => {\n modelValue.value = localValue.value\n syncTimer = null\n }, 300)\n }\n\n const onTextareaInput = () => {\n localValue.value = textareaEl.value?.value ?? ''\n scheduleSync()\n }\n\n watch(modelValue, (v) => {\n if (v !== localValue.value) {\n localValue.value = v ?? ''\n nextTick(() => {\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n })\n }\n })\n\n // --- Status computeds ---\n\n const isStreaming = computed(() => props.status === 'streaming')\n const isSubmitted = computed(() => props.status === 'submitted')\n const isInputDisabled = computed(\n () => isStreaming.value || isSubmitted.value,\n )\n\n // --- Validation ---\n\n const counterId = useId()\n const currentLength = computed(() => localValue.value.length)\n\n const isOverLimit = computed(\n () =>\n props.maxMessageLength !== undefined &&\n currentLength.value > props.maxMessageLength,\n )\n\n const isUploadingAnyFile = computed(() =>\n pendingAttachments.value.some((a) => a.state === 'uploading'),\n )\n\n const isSubmitEnabled = computed(() => {\n if (\n (isInputDisabled.value && !props.queueEnabled) ||\n isUploadingAnyFile.value ||\n isOverLimit.value\n ) {\n return false\n }\n return localValue.value.trim().length > 0\n })\n\n /** Written during an answer: the send button queues it, next to the stop. */\n const isQueueing = computed(\n () => isInputDisabled.value && isSubmitEnabled.value,\n )\n\n // --- File upload ---\n\n const hasCaptureSupport = 'capture' in document.createElement('input')\n\n // A browser filters the picker by type and knows few code types: their\n // extensions go along.\n const acceptMimeTypes = computed(() => {\n const allowed = props.fileUpload?.allowedMimeTypes ?? []\n return [...allowed, ...codeExtensionsOf(allowed)].join(',')\n })\n\n const acceptImageMimeTypes = computed(() =>\n (props.fileUpload?.allowedMimeTypes ?? [])\n .filter((m) => m.startsWith('image/'))\n .join(','),\n )\n\n const showCameraOption = computed(\n () => hasCaptureSupport && acceptImageMimeTypes.value.length > 0,\n )\n\n const openFilePicker = () => {\n fileInputEl.value?.click()\n }\n\n const openCameraPicker = () => {\n cameraInputEl.value?.click()\n }\n\n // The store owns the attachment limits and drops any overflow; the input\n // just forwards every picked/dropped file.\n const emitFiles = (files: File[]) => {\n for (const file of files) {\n emit('file-select', file)\n }\n }\n\n const onFileChange = (event: Event) => {\n const input = event.target as HTMLInputElement\n emitFiles(Array.from(input.files ?? []))\n input.value = ''\n }\n\n // --- Attachments ---\n\n const removeAttachment = (id: string) => {\n const att = pendingAttachments.value.find((a) => a.id === id)\n if (att) {\n URL.revokeObjectURL(att.localUrl)\n }\n pendingAttachments.value = pendingAttachments.value.filter(\n (a) => a.id !== id,\n )\n }\n\n // --- Notices (one box above the input) ---\n\n type InputNotice = {\n id: string\n text?: string\n markdown?: string\n icon?: string\n open?: () => void\n dismiss?: () => void\n }\n\n const isDismissableNoticeVisible = ref(true)\n const closeDismissableNotice = () => {\n isDismissableNoticeVisible.value = false\n }\n\n const activeNotices = computed<InputNotice[]>(() => {\n // The alert answers what the user just did, and takes the box alone\n // until it is closed.\n if (props.attachmentNotice) {\n return [\n {\n id: 'limit',\n icon: 'ri:information-line',\n text: props.attachmentNotice,\n dismiss: () => emit('dismiss-attachment-notice'),\n },\n ]\n }\n const notices: InputNotice[] = []\n // An answer that ended where the user is not: news, so it comes\n // first, and it leaves once opened or closed.\n for (const notice of props.answerNotices ?? []) {\n notices.push({\n id: `answer-${notice.id}`,\n icon: 'ri:chat-check-line',\n text: notice.text,\n open: () => emit('open-answer-notice', notice.id),\n dismiss: () => emit('dismiss-answer-notice', notice.id),\n })\n }\n // What the agent does on this page, next: the user should read it\n // before writing. The agent's own notice stays beside it, never\n // behind it: it is where an agent states its terms, a privacy\n // policy among them.\n if (props.pageNotice) {\n notices.push({\n id: 'page',\n icon: 'ri:pages-line',\n text: props.pageNotice,\n dismiss: () => emit('dismiss-page-notice'),\n })\n }\n if (props.dismissableNotice && isDismissableNoticeVisible.value) {\n notices.push({\n id: 'dismissable',\n markdown: props.dismissableNotice,\n dismiss: closeDismissableNotice,\n })\n }\n return notices\n })\n\n // --- Submit ---\n\n /**\n * Send turns disabled and then gives way to stop, stop gives way to send:\n * a keyboard user who pressed one would be left on the page body. Hand\n * the focus to the textarea, but only after a keyboard press: a tap has no\n * focus to keep, and focusing would bring the phone keyboard back up over\n * the answer.\n */\n const keepKeyboardFocus = () => {\n if (formEl.value?.querySelector('button:focus-visible')) {\n textareaEl.value?.focus()\n }\n }\n\n const stopGeneration = () => {\n keepKeyboardFocus()\n emit('stop-generation')\n }\n\n const handleSubmit = () => {\n if (!isSubmitEnabled.value) {\n return\n }\n keepKeyboardFocus()\n flushSync()\n emit('submit')\n localValue.value = ''\n modelValue.value = ''\n nextTick(() => {\n if (textareaEl.value) {\n textareaEl.value.value = ''\n autosize.update(textareaEl.value)\n }\n })\n }\n\n /**\n * Enter sends, Shift+Enter goes to a new line. The Enter that confirms an\n * IME composition (Japanese, Chinese, Korean) belongs to the composition:\n * Safari reports it with `isComposing` already false, hence the 229.\n */\n const onTextareaEnter = (event: KeyboardEvent) => {\n if (event.shiftKey || event.isComposing || event.keyCode === 229) {\n return\n }\n event.preventDefault()\n handleSubmit()\n }\n\n // --- Lifecycle ---\n\n onMounted(() => {\n if (textareaEl.value) {\n autosize(textareaEl.value)\n }\n })\n\n // autosize measures on input and on a window resize only, and an empty\n // textarea measures its placeholder. The chat settles its layout after\n // mount: measured at a first, narrower width, the placeholder wrapped,\n // and on the chat page of a phone the field stayed 88px tall, four lines\n // with the text at their top, until the user typed. Measured again when\n // its width changes, or its placeholder.\n let textareaWidth = 0\n useResizeObserver(textareaEl, ([entry]) => {\n const width = entry?.contentRect.width ?? 0\n if (textareaEl.value && width !== textareaWidth) {\n textareaWidth = width\n autosize.update(textareaEl.value)\n }\n })\n watch(\n () => props.placeholder,\n async () => {\n await nextTick()\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n },\n )\n\n onBeforeUnmount(() => {\n cancelSync()\n if (textareaEl.value) {\n autosize.destroy(textareaEl.value)\n }\n for (const att of pendingAttachments.value) {\n URL.revokeObjectURL(att.localUrl)\n }\n })\n</script>\n\n<template>\n <div class=\"pk-chatbot-input\">\n <div\n v-if=\"activeNotices.length\"\n class=\"pk-chatbot-input__notice\"\n role=\"status\">\n <div\n v-for=\"notice in activeNotices\"\n :key=\"notice.id\"\n class=\"pk-chatbot-input__notice-item\">\n <VvIcon\n v-if=\"notice.icon\"\n :name=\"notice.icon\"\n class=\"pk-chatbot-input__notice-icon\" />\n <PkStreamingMarkdown\n v-if=\"notice.markdown\"\n :markdown=\"notice.markdown\"\n class=\"wysiwyg pk-chatbot-input__notice-text\" />\n <span v-else class=\"pk-chatbot-input__notice-text\">\n {{ notice.text }}\n </span>\n <VvButton\n v-if=\"notice.open\"\n :label=\"$t('action.open')\"\n modifiers=\"link\"\n class=\"pk-chatbot-input__notice-action\"\n @click=\"notice.open()\" />\n <VvButton\n v-if=\"notice.dismiss\"\n :title=\"$t('action.close')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"notice.dismiss()\" />\n </div>\n </div>\n <form\n ref=\"formEl\"\n class=\"pk-chatbot-input__form\"\n @submit.prevent=\"handleSubmit\">\n <div\n v-if=\"pendingAttachments.length\"\n class=\"pk-chatbot-input__attachments\">\n <PkChatbotFilePreview\n v-for=\"att in pendingAttachments\"\n :key=\"att.id\"\n :media-type=\"att.mediaSource?.mimeType ?? att.file.type\"\n :url=\"att.localUrl\"\n :filename=\"att.file.name\"\n :size=\"att.file.size\"\n :loading=\"att.state === 'uploading'\"\n :error=\"att.state === 'error' ? att.error : undefined\"\n :removable=\"att.state !== 'uploading'\"\n compact\n @remove=\"removeAttachment(att.id)\" />\n </div>\n <div class=\"pk-chatbot-input__fieldset\">\n <slot name=\"prepend\" />\n <VvDropdown\n v-if=\"\n fileUpload &&\n fileUpload.enabled &&\n (showCameraOption || $slots['additional-actions'])\n \"\n v-bind=\"{\n placement: 'top-start',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n }\">\n <template #default=\"{ init, toggle, aria }\">\n <!-- The only one still written by hand: the dropdown\n anchors itself to whatever `init` receives, and that\n has to be the element, not a component instance -->\n <button\n :ref=\"(e: any) => init(e)\"\n v-bind=\"aria\"\n class=\"pk-chat-button\"\n type=\"button\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled\"\n @click=\"toggle\">\n <VvIcon\n name=\"ri:add-line\"\n class=\"pk-chat-button__icon\" />\n </button>\n </template>\n <template #items>\n <VvDropdownAction\n v-if=\"showCameraOption\"\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openCameraPicker\">\n <VvIcon\n name=\"ri:camera-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.takePhoto') }}\n </VvDropdownAction>\n <VvDropdownAction\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openFilePicker\">\n <VvIcon\n name=\"ri:attachment-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.attachFile') }}\n </VvDropdownAction>\n <slot name=\"additional-actions\" />\n </template>\n </VvDropdown>\n <PkChatButton\n v-else-if=\"fileUpload && fileUpload.enabled\"\n icon=\"ri:add-line\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled || attachmentLimitReached\"\n @click=\"openFilePicker\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled\"\n ref=\"fileInputEl\"\n type=\"file\"\n hidden\n multiple\n :accept=\"acceptMimeTypes\"\n @change=\"onFileChange\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled && showCameraOption\"\n ref=\"cameraInputEl\"\n type=\"file\"\n capture=\"environment\"\n hidden\n :accept=\"acceptImageMimeTypes\"\n @change=\"onFileChange\" />\n <div class=\"pk-chatbot-input__content\">\n <textarea\n ref=\"textareaEl\"\n :value=\"localValue\"\n class=\"pk-chatbot-input__textarea\"\n name=\"message\"\n rows=\"1\"\n enterkeyhint=\"send\"\n :aria-label=\"$t('label.message')\"\n :aria-describedby=\"\n maxMessageLength ? counterId : undefined\n \"\n :aria-invalid=\"isOverLimit || undefined\"\n :placeholder\n @input=\"onTextareaInput\"\n @keydown.enter=\"onTextareaEnter\"></textarea>\n </div>\n <div\n v-if=\"maxMessageLength\"\n :id=\"counterId\"\n class=\"pk-chatbot-input__counter\"\n :class=\"{ 'pk-chatbot-input__counter--over': isOverLimit }\">\n {{ $n(currentLength, 'integer') }}/<span\n class=\"opacity-60\"\n >{{ $n(maxMessageLength, 'integer') }}</span\n >\n </div>\n <PkChatButton\n v-if=\"voiceEnabled && !isStreaming\"\n icon=\"ri:mic-line\"\n :title=\"$t('action.talk')\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('voice-start')\" />\n <!-- With a message to queue the send button is the filled one,\n and the stop steps back beside it -->\n <PkChatButton\n v-if=\"isStreaming\"\n icon=\"ri:stop-fill\"\n :modifiers=\"isQueueing ? undefined : 'primary'\"\n :title=\"$t('action.stop')\"\n @click=\"stopGeneration\" />\n <PkChatButton\n v-if=\"isQueueing\"\n type=\"submit\"\n modifiers=\"primary\"\n icon=\"ri:arrow-up-line\"\n :title=\"$t('action.queueMessage')\" />\n <PkChatButton\n v-else-if=\"!isStreaming\"\n type=\"submit\"\n modifiers=\"primary\"\n :icon=\"isSubmitted ? 'loading-loop' : 'ri:arrow-up-line'\"\n :title=\"$t('action.submit')\"\n :disabled=\"!isSubmitEnabled\" />\n </div>\n </form>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-input {\n position: relative;\n display: flex;\n flex-direction: column;\n margin-inline: var(--spacing-sm);\n margin-bottom: var(--spacing-sm);\n\n &__notice {\n position: relative;\n padding: var(--spacing-10) var(--spacing-sm);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-10);\n background-color: var(--color-surface-1);\n border-top-left-radius: var(--rounded-xl);\n border-top-right-radius: var(--rounded-xl);\n transition-property: var(--transition-property-all);\n transition-duration: var(--duration-300);\n transition-timing-function: var(--ease-in-out);\n font-size: var(--text-12);\n color: var(--color-word-4);\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: calc(-1 * var(--spacing-12));\n height: var(--spacing-12);\n background-color: var(--color-surface-1);\n z-index: 1;\n }\n\n // Two notices read as two lines of one box, with a hairline\n // between them\n &-item {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-sm);\n\n & + & {\n padding-top: var(--spacing-10);\n border-top: 1px solid var(--color-surface-3);\n }\n }\n\n &-icon {\n flex-shrink: 0;\n width: var(--spacing-18);\n height: var(--spacing-18);\n }\n\n &-text {\n flex: 1;\n min-width: 0;\n }\n\n // A word of the line's size, on the line: the notice stays one\n // quiet row, not a button bar\n &-action {\n flex-shrink: 0;\n font-size: inherit;\n }\n }\n\n &__form {\n position: relative;\n display: flex;\n z-index: 1;\n flex-direction: column;\n\n // The composer is a field too: same border and focus ring as the\n // form fields, on top of the shadow and the 12px radius that make\n // it the container (12) of its 8px buttons\n border-radius: var(--rounded-xl);\n border: 1px solid var(--input-border-color);\n background-color: var(--color-surface);\n padding: var(--spacing-14);\n box-shadow: var(--shadow-lg);\n font-size: var(\n --text-16\n ); // prevent ios zoom on input focus by using a font size >= 16px\n gap: var(--spacing-xs);\n transition: var(--input-transition);\n\n @include media-breakpoint-up('sm', $breakpoints) {\n font-size: var(--text-14);\n padding: var(--spacing-10);\n }\n\n &:has(:focus-within) {\n border-color: var(--input-focus-color);\n box-shadow: var(--shadow-lg), var(--input-focus-ring);\n }\n }\n\n &__fieldset {\n display: flex;\n align-items: center;\n gap: var(--spacing-xs);\n flex: 1;\n\n // The buttons answer 8px around themselves on a touch screen\n // (PkChatButton): 12px apart, neither takes the other's box\n @media (pointer: coarse) {\n gap: var(--spacing-12);\n }\n }\n\n &__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-4);\n min-width: 0;\n overflow: hidden;\n }\n\n &__textarea {\n display: block;\n border: none;\n outline: none;\n resize: none;\n width: 100%;\n max-height: 200px;\n color: var(--color-word-1);\n background-color: var(--color-surface);\n\n &::placeholder {\n color: var(--color-word-4);\n }\n }\n\n &__attachments {\n display: flex;\n flex-wrap: wrap;\n // Roomy gap so the uniform-height chips breathe in the row.\n gap: var(--spacing-12);\n padding-bottom: var(--spacing-xs);\n border-bottom: 1px solid var(--color-surface-2);\n }\n\n &__counter {\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-md);\n font-size: var(--text-12);\n color: var(--color-word-3);\n line-height: 1;\n padding-inline: var(--spacing-6);\n padding-block: var(--spacing-4);\n z-index: 1;\n font-variant-numeric: tabular-nums;\n font-family: var(--font-mono);\n font-weight: var(--font-bold);\n\n &--over {\n color: var(--u-danger-text, var(--color-danger));\n border-color: var(--color-danger-lighten-5);\n font-weight: var(--font-bold);\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n // @ts-expect-error - no types for autosize\n import autosize from 'autosize'\n import {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useResizeObserver } from '@vueuse/core'\n import { codeExtensionsOf, type AgentFileUpload } from 'models'\n import type { PendingAttachment } from 'composables'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import PkChatButton from './PkChatButton.vue'\n\n // --- Models & Props ---\n\n const modelValue = defineModel<string | undefined>({ default: undefined })\n const pendingAttachments = defineModel<PendingAttachment[]>(\n 'pendingAttachments',\n { default: () => [] },\n )\n\n const emit = defineEmits<{\n submit: []\n 'stop-generation': []\n 'file-select': [file: File]\n 'dismiss-attachment-notice': []\n 'dismiss-page-notice': []\n 'open-answer-notice': [id: string]\n 'dismiss-answer-notice': [id: string]\n 'voice-start': []\n }>()\n\n const props = defineProps<{\n placeholder?: string\n dismissableNotice?: string\n /**\n * What the agent can do on the page that embeds the chat (spec\n * `page-tools.md`). Its closing is the caller's to remember.\n */\n pageNotice?: string\n status?: 'submitted' | 'streaming' | 'ready' | 'error'\n maxMessageLength?: number\n fileUpload?: AgentFileUpload\n attachmentLimitReached?: boolean\n attachmentNotice?: string\n /** Show the talk button: the agent has voice enabled. */\n voiceEnabled?: boolean\n /**\n * What is written while the agent answers is queued and sent when the\n * answer ends (spec resumable-chat-streams, F2): sending stays open.\n */\n queueEnabled?: boolean\n /** Answers that ended in another conversation, each with its own line and its \"Open\". */\n answerNotices?: { id: string; text: string }[]\n }>()\n\n // --- Template refs ---\n\n const textareaEl = useTemplateRef<HTMLTextAreaElement>('textareaEl')\n const fileInputEl = useTemplateRef<HTMLInputElement>('fileInputEl')\n const cameraInputEl = useTemplateRef<HTMLInputElement>('cameraInputEl')\n const formEl = useTemplateRef<HTMLFormElement>('formEl')\n\n // --- Input buffering (decouples typing from reactive model propagation) ---\n\n const localValue = ref(modelValue.value ?? '')\n let syncTimer: ReturnType<typeof setTimeout> | null = null\n\n const cancelSync = () => {\n if (syncTimer !== null) {\n clearTimeout(syncTimer)\n syncTimer = null\n }\n }\n\n const flushSync = () => {\n cancelSync()\n modelValue.value = localValue.value\n }\n\n const scheduleSync = () => {\n cancelSync()\n syncTimer = setTimeout(() => {\n modelValue.value = localValue.value\n syncTimer = null\n }, 300)\n }\n\n const onTextareaInput = () => {\n localValue.value = textareaEl.value?.value ?? ''\n scheduleSync()\n }\n\n watch(modelValue, (v) => {\n if (v !== localValue.value) {\n localValue.value = v ?? ''\n nextTick(() => {\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n })\n }\n })\n\n // --- Status computeds ---\n\n const isStreaming = computed(() => props.status === 'streaming')\n const isSubmitted = computed(() => props.status === 'submitted')\n const isInputDisabled = computed(\n () => isStreaming.value || isSubmitted.value,\n )\n\n // --- Validation ---\n\n const counterId = useId()\n const currentLength = computed(() => localValue.value.length)\n\n const isOverLimit = computed(\n () =>\n props.maxMessageLength !== undefined &&\n currentLength.value > props.maxMessageLength,\n )\n\n const isUploadingAnyFile = computed(() =>\n pendingAttachments.value.some((a) => a.state === 'uploading'),\n )\n\n const isSubmitEnabled = computed(() => {\n if (\n (isInputDisabled.value && !props.queueEnabled) ||\n isUploadingAnyFile.value ||\n isOverLimit.value\n ) {\n return false\n }\n return localValue.value.trim().length > 0\n })\n\n /** Written during an answer: the send button queues it, next to the stop. */\n const isQueueing = computed(\n () => isInputDisabled.value && isSubmitEnabled.value,\n )\n\n // --- File upload ---\n\n const hasCaptureSupport = 'capture' in document.createElement('input')\n\n // A browser filters the picker by type and knows few code types: their\n // extensions go along.\n const acceptMimeTypes = computed(() => {\n const allowed = props.fileUpload?.allowedMimeTypes ?? []\n return [...allowed, ...codeExtensionsOf(allowed)].join(',')\n })\n\n const acceptImageMimeTypes = computed(() =>\n (props.fileUpload?.allowedMimeTypes ?? [])\n .filter((m) => m.startsWith('image/'))\n .join(','),\n )\n\n const showCameraOption = computed(\n () => hasCaptureSupport && acceptImageMimeTypes.value.length > 0,\n )\n\n const openFilePicker = () => {\n fileInputEl.value?.click()\n }\n\n const openCameraPicker = () => {\n cameraInputEl.value?.click()\n }\n\n // The store owns the attachment limits and drops any overflow; the input\n // just forwards every picked/dropped file.\n const emitFiles = (files: File[]) => {\n for (const file of files) {\n emit('file-select', file)\n }\n }\n\n const onFileChange = (event: Event) => {\n const input = event.target as HTMLInputElement\n emitFiles(Array.from(input.files ?? []))\n input.value = ''\n }\n\n // --- Attachments ---\n\n const removeAttachment = (id: string) => {\n const att = pendingAttachments.value.find((a) => a.id === id)\n if (att) {\n URL.revokeObjectURL(att.localUrl)\n }\n pendingAttachments.value = pendingAttachments.value.filter(\n (a) => a.id !== id,\n )\n }\n\n // --- Notices (one box above the input) ---\n\n type InputNotice = {\n id: string\n text?: string\n markdown?: string\n icon?: string\n open?: () => void\n dismiss?: () => void\n }\n\n const isDismissableNoticeVisible = ref(true)\n const closeDismissableNotice = () => {\n isDismissableNoticeVisible.value = false\n }\n\n const activeNotices = computed<InputNotice[]>(() => {\n // The alert answers what the user just did, and takes the box alone\n // until it is closed.\n if (props.attachmentNotice) {\n return [\n {\n id: 'limit',\n icon: 'ri:information-line',\n text: props.attachmentNotice,\n dismiss: () => emit('dismiss-attachment-notice'),\n },\n ]\n }\n const notices: InputNotice[] = []\n // An answer that ended where the user is not: news, so it comes\n // first, and it leaves once opened or closed.\n for (const notice of props.answerNotices ?? []) {\n notices.push({\n id: `answer-${notice.id}`,\n icon: 'ri:chat-check-line',\n text: notice.text,\n open: () => emit('open-answer-notice', notice.id),\n dismiss: () => emit('dismiss-answer-notice', notice.id),\n })\n }\n // What the agent does on this page, next: the user should read it\n // before writing. The agent's own notice stays beside it, never\n // behind it: it is where an agent states its terms, a privacy\n // policy among them.\n if (props.pageNotice) {\n notices.push({\n id: 'page',\n icon: 'ri:pages-line',\n text: props.pageNotice,\n dismiss: () => emit('dismiss-page-notice'),\n })\n }\n if (props.dismissableNotice && isDismissableNoticeVisible.value) {\n notices.push({\n id: 'dismissable',\n markdown: props.dismissableNotice,\n dismiss: closeDismissableNotice,\n })\n }\n return notices\n })\n\n // --- Submit ---\n\n /**\n * Send turns disabled and then gives way to stop, stop gives way to send:\n * a keyboard user who pressed one would be left on the page body. Hand\n * the focus to the textarea, but only after a keyboard press: a tap has no\n * focus to keep, and focusing would bring the phone keyboard back up over\n * the answer.\n */\n const keepKeyboardFocus = () => {\n if (formEl.value?.querySelector('button:focus-visible')) {\n textareaEl.value?.focus()\n }\n }\n\n const stopGeneration = () => {\n keepKeyboardFocus()\n emit('stop-generation')\n }\n\n const handleSubmit = () => {\n if (!isSubmitEnabled.value) {\n return\n }\n keepKeyboardFocus()\n flushSync()\n emit('submit')\n localValue.value = ''\n modelValue.value = ''\n nextTick(() => {\n if (textareaEl.value) {\n textareaEl.value.value = ''\n autosize.update(textareaEl.value)\n }\n })\n }\n\n /**\n * Enter sends, Shift+Enter goes to a new line. The Enter that confirms an\n * IME composition (Japanese, Chinese, Korean) belongs to the composition:\n * Safari reports it with `isComposing` already false, hence the 229.\n */\n const onTextareaEnter = (event: KeyboardEvent) => {\n if (event.shiftKey || event.isComposing || event.keyCode === 229) {\n return\n }\n event.preventDefault()\n handleSubmit()\n }\n\n // --- Lifecycle ---\n\n onMounted(() => {\n if (textareaEl.value) {\n autosize(textareaEl.value)\n }\n })\n\n // autosize measures on input and on a window resize only, and an empty\n // textarea measures its placeholder. The chat settles its layout after\n // mount: measured at a first, narrower width, the placeholder wrapped,\n // and on the chat page of a phone the field stayed 88px tall, four lines\n // with the text at their top, until the user typed. Measured again when\n // its width changes, or its placeholder.\n let textareaWidth = 0\n useResizeObserver(textareaEl, ([entry]) => {\n const width = entry?.contentRect.width ?? 0\n if (textareaEl.value && width !== textareaWidth) {\n textareaWidth = width\n autosize.update(textareaEl.value)\n }\n })\n watch(\n () => props.placeholder,\n async () => {\n await nextTick()\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n },\n )\n\n onBeforeUnmount(() => {\n cancelSync()\n if (textareaEl.value) {\n autosize.destroy(textareaEl.value)\n }\n for (const att of pendingAttachments.value) {\n URL.revokeObjectURL(att.localUrl)\n }\n })\n</script>\n\n<template>\n <div class=\"pk-chatbot-input\">\n <div\n v-if=\"activeNotices.length\"\n class=\"pk-chatbot-input__notice\"\n role=\"status\">\n <div\n v-for=\"notice in activeNotices\"\n :key=\"notice.id\"\n class=\"pk-chatbot-input__notice-item\">\n <VvIcon\n v-if=\"notice.icon\"\n :name=\"notice.icon\"\n class=\"pk-chatbot-input__notice-icon\" />\n <PkStreamingMarkdown\n v-if=\"notice.markdown\"\n :markdown=\"notice.markdown\"\n class=\"wysiwyg pk-chatbot-input__notice-text\" />\n <span v-else class=\"pk-chatbot-input__notice-text\">\n {{ notice.text }}\n </span>\n <VvButton\n v-if=\"notice.open\"\n :label=\"$t('action.open')\"\n modifiers=\"link\"\n class=\"pk-chatbot-input__notice-action\"\n @click=\"notice.open()\" />\n <VvButton\n v-if=\"notice.dismiss\"\n :title=\"$t('action.close')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"notice.dismiss()\" />\n </div>\n </div>\n <form\n ref=\"formEl\"\n class=\"pk-chatbot-input__form\"\n @submit.prevent=\"handleSubmit\">\n <div\n v-if=\"pendingAttachments.length\"\n class=\"pk-chatbot-input__attachments\">\n <PkChatbotFilePreview\n v-for=\"att in pendingAttachments\"\n :key=\"att.id\"\n :media-type=\"att.mediaSource?.mimeType ?? att.file.type\"\n :url=\"att.localUrl\"\n :filename=\"att.file.name\"\n :size=\"att.file.size\"\n :loading=\"att.state === 'uploading'\"\n :error=\"att.state === 'error' ? att.error : undefined\"\n :removable=\"att.state !== 'uploading'\"\n compact\n @remove=\"removeAttachment(att.id)\" />\n </div>\n <div class=\"pk-chatbot-input__fieldset\">\n <slot name=\"prepend\" />\n <VvDropdown\n v-if=\"\n fileUpload &&\n fileUpload.enabled &&\n (showCameraOption || $slots['additional-actions'])\n \"\n v-bind=\"{\n placement: 'top-start',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n }\">\n <template #default=\"{ init, toggle, aria }\">\n <!-- The only one still written by hand: the dropdown\n anchors itself to whatever `init` receives, and that\n has to be the element, not a component instance -->\n <button\n :ref=\"(e: any) => init(e)\"\n v-bind=\"aria\"\n class=\"pk-chat-button\"\n type=\"button\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled\"\n @click=\"toggle\">\n <VvIcon\n name=\"ri:add-line\"\n class=\"pk-chat-button__icon\" />\n </button>\n </template>\n <template #items>\n <VvDropdownAction\n v-if=\"showCameraOption\"\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openCameraPicker\">\n <VvIcon\n name=\"ri:camera-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.takePhoto') }}\n </VvDropdownAction>\n <VvDropdownAction\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openFilePicker\">\n <VvIcon\n name=\"ri:attachment-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.attachFile') }}\n </VvDropdownAction>\n <slot name=\"additional-actions\" />\n </template>\n </VvDropdown>\n <PkChatButton\n v-else-if=\"fileUpload && fileUpload.enabled\"\n icon=\"ri:add-line\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled || attachmentLimitReached\"\n @click=\"openFilePicker\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled\"\n ref=\"fileInputEl\"\n type=\"file\"\n hidden\n multiple\n :accept=\"acceptMimeTypes\"\n @change=\"onFileChange\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled && showCameraOption\"\n ref=\"cameraInputEl\"\n type=\"file\"\n capture=\"environment\"\n hidden\n :accept=\"acceptImageMimeTypes\"\n @change=\"onFileChange\" />\n <div class=\"pk-chatbot-input__content\">\n <textarea\n ref=\"textareaEl\"\n :value=\"localValue\"\n class=\"pk-chatbot-input__textarea\"\n name=\"message\"\n rows=\"1\"\n enterkeyhint=\"send\"\n :aria-label=\"$t('label.message')\"\n :aria-describedby=\"\n maxMessageLength ? counterId : undefined\n \"\n :aria-invalid=\"isOverLimit || undefined\"\n :placeholder\n @input=\"onTextareaInput\"\n @keydown.enter=\"onTextareaEnter\"></textarea>\n </div>\n <div\n v-if=\"maxMessageLength\"\n :id=\"counterId\"\n class=\"pk-chatbot-input__counter\"\n :class=\"{ 'pk-chatbot-input__counter--over': isOverLimit }\">\n {{ $n(currentLength, 'integer') }}/<span\n class=\"opacity-60\"\n >{{ $n(maxMessageLength, 'integer') }}</span\n >\n </div>\n <PkChatButton\n v-if=\"voiceEnabled && !isStreaming\"\n icon=\"ri:mic-line\"\n :title=\"$t('action.talk')\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('voice-start')\" />\n <!-- With a message to queue the send button is the filled one,\n and the stop steps back beside it -->\n <PkChatButton\n v-if=\"isStreaming\"\n icon=\"ri:stop-fill\"\n :modifiers=\"isQueueing ? undefined : 'primary'\"\n :title=\"$t('action.stop')\"\n @click=\"stopGeneration\" />\n <PkChatButton\n v-if=\"isQueueing\"\n type=\"submit\"\n modifiers=\"primary\"\n icon=\"ri:arrow-up-line\"\n :title=\"$t('action.queueMessage')\" />\n <PkChatButton\n v-else-if=\"!isStreaming\"\n type=\"submit\"\n modifiers=\"primary\"\n :icon=\"isSubmitted ? 'loading-loop' : 'ri:arrow-up-line'\"\n :title=\"$t('action.submit')\"\n :disabled=\"!isSubmitEnabled\" />\n </div>\n </form>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-input {\n position: relative;\n display: flex;\n flex-direction: column;\n margin-inline: var(--spacing-sm);\n margin-bottom: var(--spacing-sm);\n\n &__notice {\n position: relative;\n padding: var(--spacing-10) var(--spacing-sm);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-10);\n background-color: var(--color-surface-1);\n border-top-left-radius: var(--rounded-xl);\n border-top-right-radius: var(--rounded-xl);\n transition-property: var(--transition-property-all);\n transition-duration: var(--duration-300);\n transition-timing-function: var(--ease-in-out);\n font-size: var(--text-12);\n color: var(--color-word-4);\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: calc(-1 * var(--spacing-12));\n height: var(--spacing-12);\n background-color: var(--color-surface-1);\n z-index: 1;\n }\n\n // Two notices read as two lines of one box, with a hairline\n // between them\n &-item {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-sm);\n\n & + & {\n padding-top: var(--spacing-10);\n border-top: 1px solid var(--color-surface-3);\n }\n }\n\n &-icon {\n flex-shrink: 0;\n width: var(--spacing-18);\n height: var(--spacing-18);\n }\n\n &-text {\n flex: 1;\n min-width: 0;\n }\n\n // A word of the line's size, on the line: the notice stays one\n // quiet row, not a button bar\n &-action {\n flex-shrink: 0;\n font-size: inherit;\n }\n }\n\n &__form {\n position: relative;\n display: flex;\n z-index: 1;\n flex-direction: column;\n\n // The composer is a field too: same border and focus ring as the\n // form fields, on top of the shadow and the 12px radius that make\n // it the container (12) of its 8px buttons\n border-radius: var(--rounded-xl);\n border: 1px solid var(--input-border-color);\n background-color: var(--color-surface);\n padding: var(--spacing-14);\n box-shadow: var(--shadow-lg);\n font-size: var(\n --text-16\n ); // prevent ios zoom on input focus by using a font size >= 16px\n gap: var(--spacing-xs);\n transition: var(--input-transition);\n\n @include media-breakpoint-up('sm', $breakpoints) {\n font-size: var(--text-14);\n padding: var(--spacing-10);\n }\n\n &:has(:focus-within) {\n border-color: var(--input-focus-color);\n box-shadow: var(--shadow-lg), var(--input-focus-ring);\n }\n }\n\n &__fieldset {\n display: flex;\n align-items: center;\n gap: var(--spacing-xs);\n flex: 1;\n\n // The buttons answer 8px around themselves on a touch screen\n // (PkChatButton): 12px apart, neither takes the other's box\n @media (pointer: coarse) {\n gap: var(--spacing-12);\n }\n }\n\n &__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-4);\n min-width: 0;\n overflow: hidden;\n }\n\n &__textarea {\n display: block;\n border: none;\n outline: none;\n resize: none;\n width: 100%;\n max-height: 200px;\n color: var(--color-word-1);\n background-color: var(--color-surface);\n\n &::placeholder {\n color: var(--color-word-4);\n }\n }\n\n &__attachments {\n display: flex;\n flex-wrap: wrap;\n // Roomy gap so the uniform-height chips breathe in the row.\n gap: var(--spacing-12);\n padding-bottom: var(--spacing-xs);\n border-bottom: 1px solid var(--color-surface-2);\n }\n\n &__counter {\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-md);\n font-size: var(--text-12);\n color: var(--color-word-3);\n line-height: 1;\n padding-inline: var(--spacing-6);\n padding-block: var(--spacing-4);\n z-index: 1;\n font-variant-numeric: tabular-nums;\n font-family: var(--font-mono);\n font-weight: var(--font-bold);\n\n &--over {\n color: var(--u-danger-text, var(--color-danger));\n border-color: var(--color-danger-lighten-5);\n font-weight: var(--font-bold);\n }\n }\n }\n</style>\n"],"ignoreList":[0],"mappings":";;;;;;;;AAAA,IAAI2C,oBAAE,IAAI,IAAE;AAAE,SAASC,EAAE,GAAE;CAAC,IAAIC,IAAEF,EAAE,IAAIC,CAAC;CAAE,KAAGC,EAAE,QAAQ;AAAC;AAAC,SAASA,EAAE,GAAE;CAAC,IAAIA,IAAEF,EAAE,IAAIC,CAAC;CAAE,KAAGC,EAAE,OAAO;AAAC;AAAC,IAAIC,IAAE;AAAkB,OAAO,SAApB,OAA4B,CAAC,IAAE,SAAS,GAAE;CAAC,OAAO;AAAC,EAAA,CAAG,UAAQ,SAAS,GAAE;CAAC,OAAO;AAAC,GAAE,EAAE,SAAO,SAAS,GAAE;CAAC,OAAO;AAAC,MAAI,CAAC,IAAE,SAAS,GAAE,GAAE;CAAC,OAAOF,KAAG,MAAM,UAAU,QAAQ,KAAKA,EAAE,SAAOA,IAAE,CAACA,CAAC,GAAE,SAAS,GAAE;EAAC,OAAO,SAAS,GAAE;GAAC,IAAGA,KAAGA,EAAE,YAAuBA,EAAE,aAAf,cAAyB,CAACD,EAAE,IAAIC,CAAC,GAAE;IAAC,IAAIC,GAAEC,IAAE,MAAKC,IAAE,OAAO,iBAAiBH,CAAC,GAAE,KAAG,IAAEA,EAAE,OAAM,WAAU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CAAA,GAAApF,EAGlC,QAHkCqD,IAGlCtD,EADOb,EAAAA,GAAGoD,EAAA,kBAAgB,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAAc,EAAA,KAAAX,EAAA,IAAA,EAAA;IAIrBH,EAAA,gBAAY,CAAKwC,EAAA,SAD3BtF,EAAA,GAAAI,EAKmCa,GAAA;;KAH/B,MAAK;KACJ,OAAOzB,EAAAA,GAAE,aAAA;KACT,UAAUiG,EAAA;KACV,SAAK,AAAA8D,EAAA,QAAA,MAAEhF,EAAI,aAAA;;IAINe,EAAA,SADVtF,EAAA,GAAAI,EAK8Ba,GAAA;;KAH1B,MAAK;KACJ,WAAW+E,EAAA,QAAa,KAAA,IAAS;KACjC,OAAOxG,EAAAA,GAAE,aAAA;KACT,SAAOgI;;IAEFxB,EAAA,SADVhG,EAAA,GAAAI,EAKyCa,GAAA;;KAHrC,MAAK;KACL,WAAU;KACV,MAAK;KACJ,OAAOzB,EAAAA,GAAE,qBAAA;IAEE,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,KAAA8F,EAAA,qBADhBtF,EAAA,GAAAI,EAMmCa,GAAA;;KAJ/B,MAAK;KACL,WAAU;KACT,MAAMuE,EAAA,QAAW,iBAAA;KACjB,OAAOhG,EAAAA,GAAE,eAAA;KACT,UAAQ,CAAGuG,EAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { t as e } from "./VvButtonLocalized-BuzLsXp3.js";
|
|
2
|
+
import { VvButtonGroup as t } from "@volverjs/ui-vue/components";
|
|
3
|
+
import { Fragment as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, openBlock as s, renderList as c, toDisplayString as l, withCtx as u } from "vue";
|
|
4
|
+
//#region ../../packages/components/src/chat/PkChatbotQueuedMessages.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var d = ["aria-label"], f = { class: "pk-chatbot-queued__label" }, p = { class: "pk-chatbot-queued__bubble" }, m = { class: "pk-chatbot-queued__text" }, h = /* @__PURE__ */ o({
|
|
6
|
+
__name: "PkChatbotQueuedMessages",
|
|
7
|
+
props: { messages: {} },
|
|
8
|
+
emits: ["edit", "remove"],
|
|
9
|
+
setup(o, { emit: h }) {
|
|
10
|
+
let g = h;
|
|
11
|
+
return (h, _) => {
|
|
12
|
+
let v = e, y = t;
|
|
13
|
+
return s(), r("ol", {
|
|
14
|
+
class: "pk-chatbot-queued",
|
|
15
|
+
"aria-label": h.$t("label.queuedMessages")
|
|
16
|
+
}, [(s(!0), r(n, null, c(o.messages, (e, t) => (s(), r("li", {
|
|
17
|
+
key: `${t}:${e}`,
|
|
18
|
+
class: "pk-chatbot-queued__item"
|
|
19
|
+
}, [i("span", f, l(h.$t("label.queued")), 1), i("div", p, [i("p", m, l(e), 1), a(y, { class: "pk-chatbot-queued__actions" }, {
|
|
20
|
+
default: u(() => [a(v, {
|
|
21
|
+
icon: "ri:edit-line",
|
|
22
|
+
modifiers: "action-quiet",
|
|
23
|
+
title: h.$t("action.edit"),
|
|
24
|
+
"aria-label": h.$t("action.edit"),
|
|
25
|
+
class: "w-24 h-24",
|
|
26
|
+
onClick: (e) => g("edit", t)
|
|
27
|
+
}, null, 8, [
|
|
28
|
+
"title",
|
|
29
|
+
"aria-label",
|
|
30
|
+
"onClick"
|
|
31
|
+
]), a(v, {
|
|
32
|
+
icon: "ri:close-line",
|
|
33
|
+
modifiers: "action-quiet",
|
|
34
|
+
title: h.$t("action.removeFromQueue"),
|
|
35
|
+
"aria-label": h.$t("action.removeFromQueue"),
|
|
36
|
+
class: "w-24 h-24",
|
|
37
|
+
onClick: (e) => g("remove", t)
|
|
38
|
+
}, null, 8, [
|
|
39
|
+
"title",
|
|
40
|
+
"aria-label",
|
|
41
|
+
"onClick"
|
|
42
|
+
])]),
|
|
43
|
+
_: 2
|
|
44
|
+
}, 1024)])]))), 128))], 8, d);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { h as t };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=PkChatbotQueuedMessages-DlydYgwC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotQueuedMessages-DlydYgwC.js","names":["$t","__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_createVNode","_withCtx","_sfc_main","VvButtonLocalized","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","PkChatbotQueuedMessages_default","defineComponent","__emit","emit","_component_VvButton","_component_VvButtonGroup","VvButtonGroup","openBlock","createElementBlock","_ctx","Fragment","renderList","__props","index","text","createElementVNode","toDisplayString","createVNode","withCtx"],"sources":["../../../../packages/components/src/chat/PkChatbotQueuedMessages.vue","../../../../packages/components/src/chat/PkChatbotQueuedMessages.vue"],"sourcesContent":["<script setup lang=\"ts\">\n /**\n * What the user wrote while the agent answers (spec\n * resumable-chat-streams, F2), sent together when the answer ends. At the\n * bottom of the conversation, above the input and outside the scrolling\n * list: the answer in flight holds its place there, anchored under the\n * question, and a message added after it would sit below that hold, out\n * of view. Each one goes back to the input to be changed, or leaves the\n * queue.\n */\n defineProps<{\n messages: string[]\n }>()\n\n const emit = defineEmits<{\n edit: [index: number]\n remove: [index: number]\n }>()\n</script>\n\n<template>\n <ol class=\"pk-chatbot-queued\" :aria-label=\"$t('label.queuedMessages')\">\n <li\n v-for=\"(text, index) in messages\"\n :key=\"`${index}:${text}`\"\n class=\"pk-chatbot-queued__item\">\n <span class=\"pk-chatbot-queued__label\">\n {{ $t('label.queued') }}\n </span>\n <div class=\"pk-chatbot-queued__bubble\">\n <p class=\"pk-chatbot-queued__text\">{{ text }}</p>\n <VvButtonGroup class=\"pk-chatbot-queued__actions\">\n <VvButton\n icon=\"ri:edit-line\"\n modifiers=\"action-quiet\"\n :title=\"$t('action.edit')\"\n :aria-label=\"$t('action.edit')\"\n class=\"w-24 h-24\"\n @click=\"emit('edit', index)\" />\n <VvButton\n icon=\"ri:close-line\"\n modifiers=\"action-quiet\"\n :title=\"$t('action.removeFromQueue')\"\n :aria-label=\"$t('action.removeFromQueue')\"\n class=\"w-24 h-24\"\n @click=\"emit('remove', index)\" />\n </VvButtonGroup>\n </div>\n </li>\n </ol>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-queued {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: var(--spacing-8);\n width: 100%;\n max-width: 768px;\n margin: 0 auto;\n padding: 0 var(--spacing-md) var(--spacing-sm);\n list-style: none;\n\n &__item {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: var(--spacing-4);\n max-width: 85%;\n }\n\n &__label {\n font-size: var(--text-12);\n color: var(--color-word-3);\n }\n\n // A user bubble not sent yet: the shape of the user's own, drawn in\n // outline and quieter, so it never reads as part of the conversation\n &__bubble {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-8);\n padding: var(--spacing-8) var(--spacing-8) var(--spacing-8)\n var(--spacing-12);\n border: 1px dashed var(--color-surface-4);\n border-radius: var(--rounded-xl) var(--rounded-xl) 0\n var(--rounded-xl);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n }\n\n &__text {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: var(--text-14);\n line-height: var(--leading-normal);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n\n &__actions {\n flex-shrink: 0;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /**\n * What the user wrote while the agent answers (spec\n * resumable-chat-streams, F2), sent together when the answer ends. At the\n * bottom of the conversation, above the input and outside the scrolling\n * list: the answer in flight holds its place there, anchored under the\n * question, and a message added after it would sit below that hold, out\n * of view. Each one goes back to the input to be changed, or leaves the\n * queue.\n */\n defineProps<{\n messages: string[]\n }>()\n\n const emit = defineEmits<{\n edit: [index: number]\n remove: [index: number]\n }>()\n</script>\n\n<template>\n <ol class=\"pk-chatbot-queued\" :aria-label=\"$t('label.queuedMessages')\">\n <li\n v-for=\"(text, index) in messages\"\n :key=\"`${index}:${text}`\"\n class=\"pk-chatbot-queued__item\">\n <span class=\"pk-chatbot-queued__label\">\n {{ $t('label.queued') }}\n </span>\n <div class=\"pk-chatbot-queued__bubble\">\n <p class=\"pk-chatbot-queued__text\">{{ text }}</p>\n <VvButtonGroup class=\"pk-chatbot-queued__actions\">\n <VvButton\n icon=\"ri:edit-line\"\n modifiers=\"action-quiet\"\n :title=\"$t('action.edit')\"\n :aria-label=\"$t('action.edit')\"\n class=\"w-24 h-24\"\n @click=\"emit('edit', index)\" />\n <VvButton\n icon=\"ri:close-line\"\n modifiers=\"action-quiet\"\n :title=\"$t('action.removeFromQueue')\"\n :aria-label=\"$t('action.removeFromQueue')\"\n class=\"w-24 h-24\"\n @click=\"emit('remove', index)\" />\n </VvButtonGroup>\n </div>\n </li>\n </ol>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-queued {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: var(--spacing-8);\n width: 100%;\n max-width: 768px;\n margin: 0 auto;\n padding: 0 var(--spacing-md) var(--spacing-sm);\n list-style: none;\n\n &__item {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: var(--spacing-4);\n max-width: 85%;\n }\n\n &__label {\n font-size: var(--text-12);\n color: var(--color-word-3);\n }\n\n // A user bubble not sent yet: the shape of the user's own, drawn in\n // outline and quieter, so it never reads as part of the conversation\n &__bubble {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-8);\n padding: var(--spacing-8) var(--spacing-8) var(--spacing-8)\n var(--spacing-12);\n border: 1px dashed var(--color-surface-4);\n border-radius: var(--rounded-xl) var(--rounded-xl) 0\n var(--rounded-xl);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n }\n\n &__text {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: var(--text-14);\n line-height: var(--leading-normal);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n\n &__actions {\n flex-shrink: 0;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;EAcI,IAAMoB,IAAOD;;;GAOb,OAAAhB,EAAA,GAAAC,EA4BK,MAAA;IA5BD,OAAM;IAAqB,cAAYJ,EAAAA,GAAE,sBAAA;GACzCG,GAAAA,EAAAA,EAAA,EAAA,GAAAC,EA0BKC,GAAA,MAAAC,EAzBuBuB,EAAA,WAAhB,GAAM,OADlB1B,EAAA,GAAAC,EA0BK,MAAA;IAxBA,KAAG,GAAK0B,EAAK,GAAIC;IAClB,OAAM;GACNxB,GAAAA,CAAAA,EAEO,QAFPO,GAEON,EADAR,EAAAA,GAAE,cAAA,CAAA,GAAA,CAAA,GAETO,EAkBM,OAlBNQ,GAkBM,CAjBFR,EAAiD,KAAjDS,GAAiDR,EAAXuB,CAAI,GAAA,CAAA,GAC1CtB,EAegBa,GAAA,EAfD,OAAM,6BAA4B,GAAA;IAC7C,SAAAZ,QAMmC,CANnCD,EAMmCY,GAAA;KAL/B,MAAK;KACL,WAAU;KACT,OAAOrB,EAAAA,GAAE,aAAA;KACT,cAAYA,EAAAA,GAAE,aAAA;KACf,OAAM;KACL,UAAK,MAAEoB,EAAI,QAASU,CAAK;;;;;IAC9BrB,CAAAA,GAAAA,EAMqCY,GAAA;KALjC,MAAK;KACL,WAAU;KACT,OAAOrB,EAAAA,GAAE,wBAAA;KACT,cAAYA,EAAAA,GAAE,wBAAA;KACf,OAAM;KACL,UAAK,MAAEoB,EAAI,UAAWU,CAAK"}
|